(window.webpackJsonp=window.webpackJsonp||[]).push([[179,3,5,7,8,17,20],{"+NIl":function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){"use strict";J.defineMode("stex",function(K,R){"use strict";function H(O,p){O.cmdState.push(p)}function I(O){return O.cmdState.length>0?O.cmdState[O.cmdState.length-1]:null}function x(O){var p=O.cmdState.pop();p&&p.closeBracket()}function U(O){for(var p=O.cmdState,g=p.length-1;g>=0;g--){var i=p[g];if(i.name=="DEFAULT")continue;return i}return{styleIdentifier:function(){return null}}}function N(O,p,g){return function(){this.name=O,this.bracketNo=0,this.style=p,this.styles=g,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var E={};E.importmodule=N("importmodule","tag",["string","builtin"]),E.documentclass=N("documentclass","tag",["","atom"]),E.usepackage=N("usepackage","tag",["atom"]),E.begin=N("begin","tag",["atom"]),E.end=N("end","tag",["atom"]),E.label=N("label","tag",["atom"]),E.ref=N("ref","tag",["atom"]),E.eqref=N("eqref","tag",["atom"]),E.cite=N("cite","tag",["atom"]),E.bibitem=N("bibitem","tag",["atom"]),E.Bibitem=N("Bibitem","tag",["atom"]),E.RBibitem=N("RBibitem","tag",["atom"]),E.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(O,p){O.f=p}function c(O,p){var g;if(O.match(/^\\[a-zA-Z@]+/)){var i=O.current().slice(1);return g=E.hasOwnProperty(i)?E[i]:E.DEFAULT,g=new g,H(p,g),L(p,P),g.style}if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/\\]/))return"tag";if(O.match("\\["))return L(p,function(u,h){return T(u,h,"\\]")}),"keyword";if(O.match("\\("))return L(p,function(u,h){return T(u,h,"\\)")}),"keyword";if(O.match("$$"))return L(p,function(u,h){return T(u,h,"$$")}),"keyword";if(O.match("$"))return L(p,function(u,h){return T(u,h,"$")}),"keyword";var a=O.next();if(a=="%")return O.skipToEnd(),"comment";if(a=="}"||a=="]"){if(g=I(p),g)g.closeBracket(a),L(p,P);else return"error";return"bracket"}else return a=="{"||a=="["?(g=E.DEFAULT,g=new g,H(p,g),"bracket"):/\d/.test(a)?(O.eatWhile(/[\w.%]/),"atom"):(O.eatWhile(/[\w\-_]/),g=U(p),g.name=="begin"&&(g.argument=O.current()),g.styleIdentifier())}function T(O,p,g){if(O.eatSpace())return null;if(g&&O.match(g))return L(p,c),"keyword";if(O.match(/^\\[a-zA-Z@]+/))return"tag";if(O.match(/^[a-zA-Z]+/))return"variable-2";if(O.match(/^\\[$&%#{}_]/))return"tag";if(O.match(/^\\[,;!\/]/))return"tag";if(O.match(/^[\^_&]/))return"tag";if(O.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(O.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var i=O.next();return i=="{"||i=="}"||i=="["||i=="]"||i=="("||i==")"?"bracket":i=="%"?(O.skipToEnd(),"comment"):"error"}function P(O,p){var g=O.peek(),i;return g=="{"||g=="["?(i=I(p),i.openBracket(g),O.eat(g),L(p,c),"bracket"):/[ \t\r]/.test(g)?(O.eat(g),null):(L(p,c),x(p),c(O,p))}return{startState:function(){var O=R.inMathMode?function(p,g){return T(p,g)}:c;return{cmdState:[],f:O}},copyState:function(O){return{cmdState:O.cmdState.slice(),f:O.f}},token:function(O,p){return p.f(O,p)},blankLine:function(O){O.f=c,O.cmdState.length=0},lineComment:"%"}}),J.defineMIME("text/x-stex","stex"),J.defineMIME("text/x-latex","stex")})},"+k/U":function(Fe,Ce,j){Fe.exports={pagination:"pagination___2XcQw",info:"info___12Y4R"}},"07cG":function(Fe,Ce,j){Fe.exports={ldsRing:"ldsRing___2F8W7",idsRingWrapper:"idsRingWrapper___fC2cF",ldsring:"ldsring___3A88y"}},"19Vz":function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){J.defineOption("placeholder","",function(N,E,L){var c=L&&L!=J.Init;if(E&&!c)N.on("blur",I),N.on("change",x),N.on("swapDoc",x),J.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){H(N)}),x(N);else if(!E&&c){N.off("blur",I),N.off("change",x),N.off("swapDoc",x),J.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),K(N);var T=N.getWrapperElement();T.className=T.className.replace(" CodeMirror-empty","")}E&&!N.hasFocus()&&I(N)});function K(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function R(N){K(N);var E=N.state.placeholder=document.createElement("pre");E.style.cssText="height: 0; overflow: visible",E.style.direction=N.getOption("direction"),E.className="CodeMirror-placeholder CodeMirror-line-like";var L=N.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),E.appendChild(L),N.display.lineSpace.insertBefore(E,N.display.lineSpace.firstChild)}function H(N){setTimeout(function(){var E=!1,L=N.getInputField();L.nodeName=="TEXTAREA"?E=!L.value:N.lineCount()==1&&(E=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),E?R(N):K(N)},20)}function I(N){U(N)&&R(N)}function x(N){var E=N.getWrapperElement(),L=U(N);E.className=E.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?R(N):K(N)}function U(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){"use strict";var K={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},R={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};J.defineMode("xml",function(H,I){var x=H.indentUnit,U={},N=I.htmlMode?K:R;for(var E in N)U[E]=N[E];for(var E in I)U[E]=I[E];var L,c;function T(s,_){function C(B){return _.tokenize=B,B(s,_)}var y=s.next();if(y=="<")return s.eat("!")?s.eat("[")?s.match("CDATA[")?C(p("atom","]]>")):null:s.match("--")?C(p("comment","-->")):s.match("DOCTYPE",!0,!0)?(s.eatWhile(/[\w\._\-]/),C(g(1))):null:s.eat("?")?(s.eatWhile(/[\w\._\-]/),_.tokenize=p("meta","?>"),"meta"):(L=s.eat("/")?"closeTag":"openTag",_.tokenize=P,"tag bracket");if(y=="&"){var M;return s.eat("#")?s.eat("x")?M=s.eatWhile(/[a-fA-F\d]/)&&s.eat(";"):M=s.eatWhile(/[\d]/)&&s.eat(";"):M=s.eatWhile(/[\w\.\-:]/)&&s.eat(";"),M?"atom":"error"}else return s.eatWhile(/[^&<]/),null}T.isInText=!0;function P(s,_){var C=s.next();if(C==">"||C=="/"&&s.eat(">"))return _.tokenize=T,L=C==">"?"endTag":"selfcloseTag","tag bracket";if(C=="=")return L="equals",null;if(C=="<"){_.tokenize=T,_.state=h,_.tagName=_.tagStart=null;var y=_.tokenize(s,_);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(C)?(_.tokenize=O(C),_.stringStartCol=s.column(),_.tokenize(s,_)):(s.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function O(s){var _=function(C,y){for(;!C.eol();)if(C.next()==s){y.tokenize=P;break}return"string"};return _.isInAttribute=!0,_}function p(s,_){return function(C,y){for(;!C.eol();){if(C.match(_)){y.tokenize=T;break}C.next()}return s}}function g(s){return function(_,C){for(var y;(y=_.next())!=null;){if(y=="<")return C.tokenize=g(s+1),C.tokenize(_,C);if(y==">")if(s==1){C.tokenize=T;break}else return C.tokenize=g(s-1),C.tokenize(_,C)}return"meta"}}function i(s,_,C){this.prev=s.context,this.tagName=_,this.indent=s.indented,this.startOfLine=C,(U.doNotIndent.hasOwnProperty(_)||s.context&&s.context.noIndent)&&(this.noIndent=!0)}function a(s){s.context&&(s.context=s.context.prev)}function u(s,_){for(var C;;){if(!s.context)return;if(C=s.context.tagName,!U.contextGrabbers.hasOwnProperty(C)||!U.contextGrabbers[C].hasOwnProperty(_))return;a(s)}}function h(s,_,C){return s=="openTag"?(C.tagStart=_.column(),w):s=="closeTag"?b:h}function w(s,_,C){return s=="word"?(C.tagName=_.current(),c="tag",S):U.allowMissingTagName&&s=="endTag"?(c="tag bracket",S(s,_,C)):(c="error",w)}function b(s,_,C){if(s=="word"){var y=_.current();return C.context&&C.context.tagName!=y&&U.implicitlyClosed.hasOwnProperty(C.context.tagName)&&a(C),C.context&&C.context.tagName==y||U.matchClosing===!1?(c="tag",v):(c="tag error",D)}else return U.allowMissingTagName&&s=="endTag"?(c="tag bracket",v(s,_,C)):(c="error",D)}function v(s,_,C){return s!="endTag"?(c="error",v):(a(C),h)}function D(s,_,C){return c="error",v(s,_,C)}function S(s,_,C){if(s=="word")return c="attribute",f;if(s=="endTag"||s=="selfcloseTag"){var y=C.tagName,M=C.tagStart;return C.tagName=C.tagStart=null,s=="selfcloseTag"||U.autoSelfClosers.hasOwnProperty(y)?u(C,y):(u(C,y),C.context=new i(C,y,M==C.indented)),h}return c="error",S}function f(s,_,C){return s=="equals"?d:(U.allowMissing||(c="error"),S(s,_,C))}function d(s,_,C){return s=="string"?o:s=="word"&&U.allowUnquoted?(c="string",S):(c="error",S(s,_,C))}function o(s,_,C){return s=="string"?o:S(s,_,C)}return{startState:function(s){var _={tokenize:T,state:h,indented:s||0,tagName:null,tagStart:null,context:null};return s!=null&&(_.baseIndent=s),_},token:function(s,_){if(!_.tagName&&s.sol()&&(_.indented=s.indentation()),s.eatSpace())return null;L=null;var C=_.tokenize(s,_);return(C||L)&&C!="comment"&&(c=null,_.state=_.state(L||C,s,_),c&&(C=c=="error"?C+" error":c)),C},indent:function(s,_,C){var y=s.context;if(s.tokenize.isInAttribute)return s.tagStart==s.indented?s.stringStartCol+1:s.indented+x;if(y&&y.noIndent)return J.Pass;if(s.tokenize!=P&&s.tokenize!=T)return C?C.match(/^(\s*)/)[0].length:0;if(s.tagName)return U.multilineTagIndentPastTag!==!1?s.tagStart+s.tagName.length+2:s.tagStart+x*(U.multilineTagIndentFactor||1);if(U.alignCDATA&&/$/,blockCommentStart:"",configuration:U.htmlMode?"html":"xml",helperType:U.htmlMode?"html":"xml",skipAttribute:function(s){s.state==d&&(s.state=S)},xmlCurrentTag:function(s){return s.tagName?{name:s.tagName,close:s.type=="closeTag"}:null},xmlCurrentContext:function(s){for(var _=[],C=s.context;C;C=C.prev)C.tagName&&_.push(C.tagName);return _.reverse()}}}),J.defineMIME("text/xml","xml"),J.defineMIME("application/xml","xml"),J.mimeModes.hasOwnProperty("text/html")||J.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"1j5w":function(Fe,Ce,j){"use strict";j.d(Ce,"d",function(){return Rt}),j.d(Ce,"b",function(){return we}),j.d(Ce,"c",function(){return Ze}),j.d(Ce,"a",function(){return It});var J=j("VTBJ"),K=j("1OyB"),R=j("vuIU"),H=j("JX7q"),I=j("Ji7U"),x=j("LK+K"),U=j("q1tI"),N=j("I8Z2"),E=j("BGR+"),L=j("wx14"),c=j("rePB"),T=j("4IlW"),P=j("2GS6"),O=j("Gytx"),p=j.n(O),g=j("TSYQ"),i=j.n(g),a=j("U8pU"),u=j("ODXe"),h=/iPhone/i,w=/iPod/i,b=/iPad/i,v=/\bAndroid(?:.+)Mobile\b/i,D=/Android/i,S=/\bAndroid(?:.+)SD4930UR\b/i,f=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,d=/Windows Phone/i,o=/\bWindows(?:.+)ARM\b/i,s=/BlackBerry/i,_=/BB10/i,C=/Opera Mini/i,y=/\b(CriOS|Chrome)(?:.+)Mobile/i,M=/Mobile(?:.+)Firefox\b/i;function B(it,Be){return it.test(Be)}function F(it){var Be=it||(typeof navigator!="undefined"?navigator.userAgent:""),Ue=Be.split("[FBAN");if(typeof Ue[1]!="undefined"){var Le=Ue,se=Object(u.a)(Le,1);Be=se[0]}if(Ue=Be.split("Twitter"),typeof Ue[1]!="undefined"){var pe=Ue,je=Object(u.a)(pe,1);Be=je[0]}var Ie={apple:{phone:B(h,Be)&&!B(d,Be),ipod:B(w,Be),tablet:!B(h,Be)&&B(b,Be)&&!B(d,Be),device:(B(h,Be)||B(w,Be)||B(b,Be))&&!B(d,Be)},amazon:{phone:B(S,Be),tablet:!B(S,Be)&&B(f,Be),device:B(S,Be)||B(f,Be)},android:{phone:!B(d,Be)&&B(S,Be)||!B(d,Be)&&B(v,Be),tablet:!B(d,Be)&&!B(S,Be)&&!B(v,Be)&&(B(f,Be)||B(D,Be)),device:!B(d,Be)&&(B(S,Be)||B(f,Be)||B(v,Be)||B(D,Be))||B(/\bokhttp\b/i,Be)},windows:{phone:B(d,Be),tablet:B(o,Be),device:B(d,Be)||B(o,Be)},other:{blackberry:B(s,Be),blackberry10:B(_,Be),opera:B(C,Be),firefox:B(M,Be),chrome:B(y,Be),device:B(s,Be)||B(_,Be)||B(C,Be)||B(M,Be)||B(y,Be)},any:null,phone:null,tablet:null};return Ie.any=Ie.apple.device||Ie.android.device||Ie.windows.device||Ie.other.device,Ie.phone=Ie.apple.phone||Ie.android.phone||Ie.windows.phone,Ie.tablet=Ie.apple.tablet||Ie.android.tablet||Ie.windows.tablet,Ie}var Q=Object(J.a)(Object(J.a)({},F()),{},{isMobile:F}),V=Q;function W(){}function $(it,Be,Ue){var Le=Be||"";return it.key||"".concat(Le,"item_").concat(Ue)}function re(it){return"".concat(it,"-menu-")}function ae(it,Be){var Ue=-1;U.Children.forEach(it,function(Le){Ue+=1,Le&&Le.type&&Le.type.isMenuItemGroup?U.Children.forEach(Le.props.children,function(se){Ue+=1,Be(se,Ue)}):Be(Le,Ue)})}function he(it,Be,Ue){if(!it||Ue.find)return;U.Children.forEach(it,function(Le){if(Le){var se=Le.type;if(!se||!(se.isSubMenu||se.isMenuItem||se.isMenuItemGroup))return;Be.indexOf(Le.key)!==-1?Ue.find=!0:Le.props.children&&he(Le.props.children,Be,Ue)}})}var Se=["defaultSelectedKeys","selectedKeys","defaultOpenKeys","openKeys","mode","getPopupContainer","onSelect","onDeselect","onDestroy","openTransitionName","openAnimation","subMenuOpenDelay","subMenuCloseDelay","forceSubMenuRender","triggerSubMenuAction","level","selectable","multiple","onOpenChange","visible","focusable","defaultActiveFirst","prefixCls","inlineIndent","parentMenu","title","rootPrefixCls","eventKey","active","onItemHover","onTitleMouseEnter","onTitleMouseLeave","onTitleClick","popupAlign","popupOffset","isOpen","renderMenuItem","manualRef","subMenuKey","disabled","index","isSelected","store","activeKey","builtinPlacements","overflowedIndicator","motion","attribute","value","popupClassName","inlineCollapsed","menu","theme","itemIcon","expandIcon"],ye=function(Be){var Ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Le=Be&&typeof Be.getBoundingClientRect=="function"&&Be.getBoundingClientRect().width;if(Le){if(Ue){var se=getComputedStyle(Be),pe=se.marginLeft,je=se.marginRight;Le+=+pe.replace("px","")+ +je.replace("px","")}Le=+Le.toFixed(6)}return Le||0},be=function(Be,Ue,Le){Be&&Object(a.a)(Be.style)==="object"&&(Be.style[Ue]=Le)},Oe=function(){return V.any},_e=j("KQm4"),fe=j("Ff2n"),le=j("i8i4"),Re=j("bdgK"),ot=j("uciX"),st=j("8XRh"),nt={adjustX:1,adjustY:1},$e={topLeft:{points:["bl","tl"],overflow:nt,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:nt,offset:[0,7]},leftTop:{points:["tr","tl"],overflow:nt,offset:[-4,0]},rightTop:{points:["tl","tr"],overflow:nt,offset:[4,0]}},Ke={topLeft:{points:["bl","tl"],overflow:nt,offset:[0,-7]},bottomLeft:{points:["tl","bl"],overflow:nt,offset:[0,7]},rightTop:{points:["tr","tl"],overflow:nt,offset:[-4,0]},leftTop:{points:["tl","tr"],overflow:nt,offset:[4,0]}},Ye=$e,ut=0,pt={horizontal:"bottomLeft",vertical:"rightTop","vertical-left":"rightTop","vertical-right":"leftTop"},at=function(Be,Ue,Le){var se=re(Ue),pe=Be.getState();Be.setState({defaultActiveFirst:Object(J.a)(Object(J.a)({},pe.defaultActiveFirst),{},Object(c.a)({},se,Le))})},Qe=function(it){Object(I.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(Le){var se;Object(K.a)(this,Ue),se=Be.call(this,Le),se.onDestroy=function(Ae){se.props.onDestroy(Ae)},se.onKeyDown=function(Ae){var tt=Ae.keyCode,mt=se.menuInstance,gt=se.props,Lt=gt.isOpen,mn=gt.store;if(tt===T.a.ENTER)return se.onTitleClick(Ae),at(mn,se.props.eventKey,!0),!0;if(tt===T.a.RIGHT)return Lt?mt.onKeyDown(Ae):(se.triggerOpenChange(!0),at(mn,se.props.eventKey,!0)),!0;if(tt===T.a.LEFT){var hn;if(Lt)hn=mt.onKeyDown(Ae);else return;return hn||(se.triggerOpenChange(!1),hn=!0),hn}return Lt&&(tt===T.a.UP||tt===T.a.DOWN)?mt.onKeyDown(Ae):void 0},se.onOpenChange=function(Ae){se.props.onOpenChange(Ae)},se.onPopupVisibleChange=function(Ae){se.triggerOpenChange(Ae,Ae?"mouseenter":"mouseleave")},se.onMouseEnter=function(Ae){var tt=se.props,mt=tt.eventKey,gt=tt.onMouseEnter,Lt=tt.store;at(Lt,se.props.eventKey,!1),gt({key:mt,domEvent:Ae})},se.onMouseLeave=function(Ae){var tt=se.props,mt=tt.parentMenu,gt=tt.eventKey,Lt=tt.onMouseLeave;mt.subMenuInstance=Object(H.a)(se),Lt({key:gt,domEvent:Ae})},se.onTitleMouseEnter=function(Ae){var tt=se.props,mt=tt.eventKey,gt=tt.onItemHover,Lt=tt.onTitleMouseEnter;gt({key:mt,hover:!0}),Lt({key:mt,domEvent:Ae})},se.onTitleMouseLeave=function(Ae){var tt=se.props,mt=tt.parentMenu,gt=tt.eventKey,Lt=tt.onItemHover,mn=tt.onTitleMouseLeave;mt.subMenuInstance=Object(H.a)(se),Lt({key:gt,hover:!1}),mn({key:gt,domEvent:Ae})},se.onTitleClick=function(Ae){var tt=Object(H.a)(se),mt=tt.props;if(mt.onTitleClick({key:mt.eventKey,domEvent:Ae}),mt.triggerSubMenuAction==="hover")return;se.triggerOpenChange(!mt.isOpen,"click"),at(mt.store,se.props.eventKey,!1)},se.onSubMenuClick=function(Ae){typeof se.props.onClick=="function"&&se.props.onClick(se.addKeyPath(Ae))},se.onSelect=function(Ae){se.props.onSelect(Ae)},se.onDeselect=function(Ae){se.props.onDeselect(Ae)},se.getPrefixCls=function(){return"".concat(se.props.rootPrefixCls,"-submenu")},se.getActiveClassName=function(){return"".concat(se.getPrefixCls(),"-active")},se.getDisabledClassName=function(){return"".concat(se.getPrefixCls(),"-disabled")},se.getSelectedClassName=function(){return"".concat(se.getPrefixCls(),"-selected")},se.getOpenClassName=function(){return"".concat(se.props.rootPrefixCls,"-submenu-open")},se.saveMenuInstance=function(Ae){se.menuInstance=Ae},se.addKeyPath=function(Ae){return Object(J.a)(Object(J.a)({},Ae),{},{keyPath:(Ae.keyPath||[]).concat(se.props.eventKey)})},se.triggerOpenChange=function(Ae,tt){var mt=se.props.eventKey,gt=function(){se.onOpenChange({key:mt,item:Object(H.a)(se),trigger:tt,open:Ae})};tt==="mouseenter"?se.mouseenterTimeout=setTimeout(function(){gt()},0):gt()},se.isChildrenSelected=function(){var Ae={find:!1};return he(se.props.children,se.props.selectedKeys,Ae),Ae.find},se.isOpen=function(){return se.props.openKeys.indexOf(se.props.eventKey)!==-1},se.adjustWidth=function(){if(!se.subMenuTitle||!se.menuInstance)return;var Ae=le.findDOMNode(se.menuInstance);if(Ae.offsetWidth>=se.subMenuTitle.offsetWidth)return;Ae.style.minWidth="".concat(se.subMenuTitle.offsetWidth,"px")},se.saveSubMenuTitle=function(Ae){se.subMenuTitle=Ae},se.getBaseProps=function(){var Ae=Object(H.a)(se),tt=Ae.props;return{mode:tt.mode==="horizontal"?"vertical":tt.mode,visible:se.props.isOpen,level:tt.level+1,inlineIndent:tt.inlineIndent,focusable:!1,onClick:se.onSubMenuClick,onSelect:se.onSelect,onDeselect:se.onDeselect,onDestroy:se.onDestroy,selectedKeys:tt.selectedKeys,eventKey:"".concat(tt.eventKey,"-menu-"),openKeys:tt.openKeys,motion:tt.motion,onOpenChange:se.onOpenChange,subMenuOpenDelay:tt.subMenuOpenDelay,parentMenu:Object(H.a)(se),subMenuCloseDelay:tt.subMenuCloseDelay,forceSubMenuRender:tt.forceSubMenuRender,triggerSubMenuAction:tt.triggerSubMenuAction,builtinPlacements:tt.builtinPlacements,defaultActiveFirst:tt.store.getState().defaultActiveFirst[re(tt.eventKey)],multiple:tt.multiple,prefixCls:tt.rootPrefixCls,id:se.internalMenuId,manualRef:se.saveMenuInstance,itemIcon:tt.itemIcon,expandIcon:tt.expandIcon,direction:tt.direction}},se.getMotion=function(Ae,tt){var mt=Object(H.a)(se),gt=mt.haveRendered,Lt=se.props,mn=Lt.motion,hn=Lt.rootPrefixCls,en=Object(J.a)(Object(J.a)({},mn),{},{leavedClassName:"".concat(hn,"-hidden"),removeOnLeave:!1,motionAppear:gt||!tt||Ae!=="inline"});return en};var pe=Le.store,je=Le.eventKey,Ie=pe.getState(),dt=Ie.defaultActiveFirst;se.isRootMenu=!1;var lt=!1;return dt&&(lt=dt[je]),at(pe,je,lt),se}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){this.componentDidUpdate()}},{key:"componentDidUpdate",value:function(){var se=this,pe=this.props,je=pe.mode,Ie=pe.parentMenu,dt=pe.manualRef;if(dt&&dt(this),je!=="horizontal"||!Ie.isRootMenu||!this.props.isOpen)return;this.minWidthTimeout=setTimeout(function(){return se.adjustWidth()},0)}},{key:"componentWillUnmount",value:function(){var se=this.props,pe=se.onDestroy,je=se.eventKey;pe&&pe(je),this.minWidthTimeout&&clearTimeout(this.minWidthTimeout),this.mouseenterTimeout&&clearTimeout(this.mouseenterTimeout)}},{key:"renderChildren",value:function(se){var pe=this,je=this.getBaseProps(),Ie=this.getMotion(je.mode,je.visible);if(this.haveRendered=!0,this.haveOpened=this.haveOpened||je.visible||je.forceSubMenuRender,!this.haveOpened)return U.createElement("div",null);var dt=je.direction;return U.createElement(st.default,Object.assign({visible:je.visible},Ie),function(lt){var Ae=lt.className,tt=lt.style,mt=i()("".concat(je.prefixCls,"-sub"),Ae,Object(c.a)({},"".concat(je.prefixCls,"-rtl"),dt==="rtl"));return U.createElement(ge,Object.assign({},je,{id:pe.internalMenuId,className:mt,style:tt}),se)})}},{key:"render",value:function(){var se,pe=Object(J.a)({},this.props),je=pe.isOpen,Ie=this.getPrefixCls(),dt=pe.mode==="inline",lt=i()(Ie,"".concat(Ie,"-").concat(pe.mode),(se={},Object(c.a)(se,pe.className,!!pe.className),Object(c.a)(se,this.getOpenClassName(),je),Object(c.a)(se,this.getActiveClassName(),pe.active||je&&!dt),Object(c.a)(se,this.getDisabledClassName(),pe.disabled),Object(c.a)(se,this.getSelectedClassName(),this.isChildrenSelected()),se));this.internalMenuId||(pe.eventKey?this.internalMenuId="".concat(pe.eventKey,"$Menu"):(ut+=1,this.internalMenuId="$__$".concat(ut,"$Menu")));var Ae={},tt={},mt={};pe.disabled||(Ae={onMouseLeave:this.onMouseLeave,onMouseEnter:this.onMouseEnter},tt={onClick:this.onTitleClick},mt={onMouseEnter:this.onTitleMouseEnter,onMouseLeave:this.onTitleMouseLeave});var gt={},Lt=pe.direction;dt&&(Lt==="rtl"?gt.paddingRight=pe.inlineIndent*pe.level:gt.paddingLeft=pe.inlineIndent*pe.level);var mn={};this.props.isOpen&&(mn={"aria-owns":this.internalMenuId});var hn=null;pe.mode!=="horizontal"&&(hn=this.props.expandIcon,typeof this.props.expandIcon=="function"&&(hn=U.createElement(this.props.expandIcon,Object(J.a)({},this.props))));var en=U.createElement("div",Object.assign({ref:this.saveSubMenuTitle,style:gt,className:"".concat(Ie,"-title"),role:"button"},mt,tt,{"aria-expanded":je},mn,{"aria-haspopup":"true",title:typeof pe.title=="string"?pe.title:void 0}),pe.title,hn||U.createElement("i",{className:"".concat(Ie,"-arrow")})),Dt=this.renderChildren(pe.children),xn=pe.parentMenu.isRootMenu?pe.parentMenu.props.getPopupContainer:function(Gt){return Gt.parentNode},He=pt[pe.mode],ht=pe.popupOffset?{offset:pe.popupOffset}:{},St=pe.mode==="inline"?"":pe.popupClassName;St+=Lt==="rtl"?" ".concat(Ie,"-rtl"):"";var Xt=pe.disabled,an=pe.triggerSubMenuAction,un=pe.subMenuOpenDelay,Je=pe.forceSubMenuRender,ft=pe.subMenuCloseDelay,kt=pe.builtinPlacements;Se.forEach(function(Gt){return delete pe[Gt]}),delete pe.onClick;var vn=Lt==="rtl"?Object.assign({},Ke,kt):Object.assign({},$e,kt);return delete pe.direction,U.createElement("li",Object.assign({},pe,Ae,{className:lt,role:"menuitem"}),dt&&en,dt&&Dt,!dt&&U.createElement(ot.a,{prefixCls:Ie,popupClassName:i()("".concat(Ie,"-popup"),St),getPopupContainer:xn,builtinPlacements:vn,popupPlacement:He,popupVisible:je,popupAlign:ht,popup:Dt,action:Xt?[]:[an],mouseEnterDelay:un,mouseLeaveDelay:ft,onPopupVisibleChange:this.onPopupVisibleChange,forceRender:Je},en))}}]),Ue}(U.Component);Qe.defaultProps={onMouseEnter:W,onMouseLeave:W,onTitleMouseEnter:W,onTitleMouseLeave:W,onTitleClick:W,manualRef:W,mode:"vertical",title:""};var rt=Object(N.b)(function(it,Be){var Ue=it.openKeys,Le=it.activeKey,se=it.selectedKeys,pe=Be.eventKey,je=Be.subMenuKey;return{isOpen:Ue.indexOf(pe)>-1,active:Le[je]===pe,selectedKeys:se}})(Qe);rt.isSubMenu=!0;var Rt=rt,Ct="menuitem-overflowed",xt=.5,yt=function(it){Object(I.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(){var Le;return Object(K.a)(this,Ue),Le=Be.apply(this,arguments),Le.resizeObserver=null,Le.mutationObserver=null,Le.originalTotalWidth=0,Le.overflowedItems=[],Le.menuItemSizes=[],Le.cancelFrameId=null,Le.state={lastVisibleIndex:void 0},Le.getMenuItemNodes=function(){var se=Le.props.prefixCls,pe=le.findDOMNode(Object(H.a)(Le));return pe?[].slice.call(pe.children).filter(function(je){return je.className.split(" ").indexOf("".concat(se,"-overflowed-submenu"))<0}):[]},Le.getOverflowedSubMenuItem=function(se,pe,je){var Ie=Le.props,dt=Ie.overflowedIndicator,lt=Ie.level,Ae=Ie.mode,tt=Ie.prefixCls,mt=Ie.theme;if(lt!==1||Ae!=="horizontal")return null;var gt=Le.props.children[0],Lt=gt.props,mn=Lt.children,hn=Lt.title,en=Lt.style,Dt=Object(fe.a)(Lt,["children","title","style"]),xn=Object(J.a)({},en),He="".concat(se,"-overflowed-indicator"),ht="".concat(se,"-overflowed-indicator");pe.length===0&&je!==!0?xn=Object(J.a)(Object(J.a)({},xn),{},{display:"none"}):je&&(xn=Object(J.a)(Object(J.a)({},xn),{},{visibility:"hidden",position:"absolute"}),He="".concat(He,"-placeholder"),ht="".concat(ht,"-placeholder"));var St=mt?"".concat(tt,"-").concat(mt):"",Xt={};return Se.forEach(function(an){Dt[an]!==void 0&&(Xt[an]=Dt[an])}),U.createElement(Rt,Object.assign({title:dt,className:"".concat(tt,"-overflowed-submenu"),popupClassName:St},Xt,{key:He,eventKey:ht,disabled:!1,style:xn}),pe)},Le.setChildrenWidthAndResize=function(){if(Le.props.mode!=="horizontal")return;var se=le.findDOMNode(Object(H.a)(Le));if(!se)return;var pe=se.children;if(!pe||pe.length===0)return;var je=se.children[pe.length-1];be(je,"display","inline-block");var Ie=Le.getMenuItemNodes(),dt=Ie.filter(function(lt){return lt.className.split(" ").indexOf(Ct)>=0});dt.forEach(function(lt){be(lt,"display","inline-block")}),Le.menuItemSizes=Ie.map(function(lt){return ye(lt,!0)}),dt.forEach(function(lt){be(lt,"display","none")}),Le.overflowedIndicatorWidth=ye(se.children[se.children.length-1],!0),Le.originalTotalWidth=Le.menuItemSizes.reduce(function(lt,Ae){return lt+Ae},0),Le.handleResize(),be(je,"display","none")},Le.handleResize=function(){if(Le.props.mode!=="horizontal")return;var se=le.findDOMNode(Object(H.a)(Le));if(!se)return;var pe=ye(se);Le.overflowedItems=[];var je=0,Ie;Le.originalTotalWidth>pe+xt&&(Ie=-1,Le.menuItemSizes.forEach(function(dt){je+=dt,je+Le.overflowedIndicatorWidth<=pe&&(Ie+=1)})),Le.setState({lastVisibleIndex:Ie})},Le}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){var se=this;if(this.setChildrenWidthAndResize(),this.props.level===1&&this.props.mode==="horizontal"){var pe=le.findDOMNode(this);if(!pe)return;this.resizeObserver=new Re.default(function(je){je.forEach(function(){var Ie=se.cancelFrameId;cancelAnimationFrame(Ie),se.cancelFrameId=requestAnimationFrame(se.setChildrenWidthAndResize)})}),[].slice.call(pe.children).concat(pe).forEach(function(je){se.resizeObserver.observe(je)}),typeof MutationObserver!="undefined"&&(this.mutationObserver=new MutationObserver(function(){se.resizeObserver.disconnect(),[].slice.call(pe.children).concat(pe).forEach(function(je){se.resizeObserver.observe(je)}),se.setChildrenWidthAndResize()}),this.mutationObserver.observe(pe,{attributes:!1,childList:!0,subTree:!1}))}}},{key:"componentWillUnmount",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),cancelAnimationFrame(this.cancelFrameId)}},{key:"renderChildren",value:function(se){var pe=this,je=this.state.lastVisibleIndex;return(se||[]).reduce(function(Ie,dt,lt){var Ae=dt;if(pe.props.mode==="horizontal"){var tt=pe.getOverflowedSubMenuItem(dt.props.eventKey,[]);je!==void 0&&pe.props.className.indexOf("".concat(pe.props.prefixCls,"-root"))!==-1&&(lt>je&&(Ae=U.cloneElement(dt,{style:{display:"none"},eventKey:"".concat(dt.props.eventKey,"-hidden"),className:"".concat(Ct)})),lt===je+1&&(pe.overflowedItems=se.slice(je+1).map(function(gt){return U.cloneElement(gt,{key:gt.props.eventKey,mode:"vertical-left"})}),tt=pe.getOverflowedSubMenuItem(dt.props.eventKey,pe.overflowedItems)));var mt=[].concat(Object(_e.a)(Ie),[tt,Ae]);return lt===se.length-1&&mt.push(pe.getOverflowedSubMenuItem(dt.props.eventKey,[],!0)),mt}return[].concat(Object(_e.a)(Ie),[Ae])},[])}},{key:"render",value:function(){var se=this.props,pe=se.visible,je=se.prefixCls,Ie=se.overflowedIndicator,dt=se.mode,lt=se.level,Ae=se.tag,tt=se.children,mt=se.theme,gt=Object(fe.a)(se,["visible","prefixCls","overflowedIndicator","mode","level","tag","children","theme"]),Lt=Ae;return U.createElement(Lt,Object.assign({},gt),this.renderChildren(tt))}}]),Ue}(U.Component);yt.defaultProps={tag:"div",className:""};var wt=yt;function Et(it){return it.length?it.every(function(Be){return!!Be.props.disabled}):!0}function Te(it,Be,Ue){var Le=it.getState();it.setState({activeKey:Object(J.a)(Object(J.a)({},Le.activeKey),{},Object(c.a)({},Be,Ue))})}function xe(it){return it.eventKey||"0-menu-"}function ze(it,Be){var Ue=Be,Le=it.children,se=it.eventKey;if(Ue){var pe;if(ae(Le,function(je,Ie){je&&je.props&&!je.props.disabled&&Ue===$(je,se,Ie)&&(pe=!0)}),pe)return Ue}return Ue=null,it.defaultActiveFirst&&ae(Le,function(je,Ie){!Ue&&je&&!je.props.disabled&&(Ue=$(je,se,Ie))}),Ue}function Ve(it){if(it){var Be=this.instanceArray.indexOf(it);Be!==-1?this.instanceArray[Be]=it:this.instanceArray.push(it)}}var De=function(it){Object(I.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(Le){var se;return Object(K.a)(this,Ue),se=Be.call(this,Le),se.onKeyDown=function(pe,je){var Ie=pe.keyCode,dt;if(se.getFlatInstanceArray().forEach(function(Ae){Ae&&Ae.props.active&&Ae.onKeyDown&&(dt=Ae.onKeyDown(pe))}),dt)return 1;var lt=null;return(Ie===T.a.UP||Ie===T.a.DOWN)&&(lt=se.step(Ie===T.a.UP?-1:1)),lt?(pe.preventDefault(),Te(se.props.store,xe(se.props),lt.props.eventKey),typeof je=="function"&&je(lt),1):void 0},se.onItemHover=function(pe){var je=pe.key,Ie=pe.hover;Te(se.props.store,xe(se.props),Ie?je:null)},se.onDeselect=function(pe){se.props.onDeselect(pe)},se.onSelect=function(pe){se.props.onSelect(pe)},se.onClick=function(pe){se.props.onClick(pe)},se.onOpenChange=function(pe){se.props.onOpenChange(pe)},se.onDestroy=function(pe){se.props.onDestroy(pe)},se.getFlatInstanceArray=function(){return se.instanceArray},se.step=function(pe){var je=se.getFlatInstanceArray(),Ie=se.props.store.getState().activeKey[xe(se.props)],dt=je.length;if(!dt)return null;pe<0&&(je=je.concat().reverse());var lt=-1;if(je.every(function(gt,Lt){return gt&>.props.eventKey===Ie?(lt=Lt,!1):!0}),!se.props.defaultActiveFirst&<!==-1&&Et(je.slice(lt,dt-1)))return;var Ae=(lt+1)%dt,tt=Ae;do{var mt=je[tt];if(!mt||mt.props.disabled)tt=(tt+1)%dt;else return mt}while(tt!==Ae);return null},se.renderCommonMenuItem=function(pe,je,Ie){var dt=se.props.store.getState(),lt=Object(H.a)(se),Ae=lt.props,tt=$(pe,Ae.eventKey,je),mt=pe.props;if(!mt||typeof pe.type=="string")return pe;var gt=tt===dt.activeKey,Lt=Object(J.a)(Object(J.a)({mode:mt.mode||Ae.mode,level:Ae.level,inlineIndent:Ae.inlineIndent,renderMenuItem:se.renderMenuItem,rootPrefixCls:Ae.prefixCls,index:je,parentMenu:Ae.parentMenu,manualRef:mt.disabled?void 0:Object(P.a)(pe.ref,Ve.bind(Object(H.a)(se))),eventKey:tt,active:!mt.disabled&>,multiple:Ae.multiple,onClick:function(hn){(mt.onClick||W)(hn),se.onClick(hn)},onItemHover:se.onItemHover,motion:Ae.motion,subMenuOpenDelay:Ae.subMenuOpenDelay,subMenuCloseDelay:Ae.subMenuCloseDelay,forceSubMenuRender:Ae.forceSubMenuRender,onOpenChange:se.onOpenChange,onDeselect:se.onDeselect,onSelect:se.onSelect,builtinPlacements:Ae.builtinPlacements,itemIcon:mt.itemIcon||se.props.itemIcon,expandIcon:mt.expandIcon||se.props.expandIcon},Ie),{},{direction:Ae.direction});return(Ae.mode==="inline"||Oe())&&(Lt.triggerSubMenuAction="click"),U.cloneElement(pe,Lt)},se.renderMenuItem=function(pe,je,Ie){if(!pe)return null;var dt=se.props.store.getState(),lt={openKeys:dt.openKeys,selectedKeys:dt.selectedKeys,triggerSubMenuAction:se.props.triggerSubMenuAction,subMenuKey:Ie};return se.renderCommonMenuItem(pe,je,lt)},Le.store.setState({activeKey:Object(J.a)(Object(J.a)({},Le.store.getState().activeKey),{},Object(c.a)({},Le.eventKey,ze(Le,Le.activeKey)))}),se.instanceArray=[],se}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"shouldComponentUpdate",value:function(se){return this.props.visible||se.visible||this.props.className!==se.className||!p()(this.props.style,se.style)}},{key:"componentDidUpdate",value:function(se){var pe=this.props,je="activeKey"in pe?pe.activeKey:pe.store.getState().activeKey[xe(pe)],Ie=ze(pe,je);if(Ie!==je)Te(pe.store,xe(pe),Ie);else if("activeKey"in se){var dt=ze(se,se.activeKey);Ie!==dt&&Te(pe.store,xe(pe),Ie)}}},{key:"render",value:function(){var se=this,pe=Object(L.a)({},this.props);this.instanceArray=[];var je=i()(pe.prefixCls,pe.className,"".concat(pe.prefixCls,"-").concat(pe.mode)),Ie={className:je,role:pe.role||"menu"};pe.id&&(Ie.id=pe.id),pe.focusable&&(Ie.tabIndex=0,Ie.onKeyDown=this.onKeyDown);var dt=pe.prefixCls,lt=pe.eventKey,Ae=pe.visible,tt=pe.level,mt=pe.mode,gt=pe.overflowedIndicator,Lt=pe.theme;return Se.forEach(function(mn){return delete pe[mn]}),delete pe.onClick,U.createElement(wt,Object.assign({},pe,{prefixCls:dt,mode:mt,tag:"ul",level:tt,theme:Lt,visible:Ae,overflowedIndicator:gt},Ie),U.Children.map(pe.children,function(mn,hn){return se.renderMenuItem(mn,hn,lt||"0-menu-")}))}}]),Ue}(U.Component);De.defaultProps={prefixCls:"rc-menu",className:"",mode:"vertical",level:1,inlineIndent:24,visible:!0,focusable:!0,style:{},manualRef:W};var We=Object(N.b)()(De),ge=We,de=j("Kwbf");function ce(it,Be,Ue){var Le=it.prefixCls,se=it.motion,pe=it.defaultMotions,je=pe===void 0?{}:pe,Ie=it.openAnimation,dt=it.openTransitionName,lt=Be.switchingModeFromInline;if(se)return se;if(Object(a.a)(Ie)==="object"&&Ie)Object(de.a)(!1,"Object type of `openAnimation` is removed. Please use `motion` instead.");else if(typeof Ie=="string")return{motionName:"".concat(Le,"-open-").concat(Ie)};if(dt)return{motionName:dt};var Ae=je[Ue];return Ae||(lt?null:je.other)}var ne=function(it){Object(I.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(Le){var se;Object(K.a)(this,Ue),se=Be.call(this,Le),se.inlineOpenKeys=[],se.onSelect=function(Ie){var dt=Object(H.a)(se),lt=dt.props;if(lt.selectable){var Ae=se.store.getState(),tt=Ae.selectedKeys,mt=Ie.key;lt.multiple?tt=tt.concat([mt]):tt=[mt],"selectedKeys"in lt||se.store.setState({selectedKeys:tt}),lt.onSelect(Object(J.a)(Object(J.a)({},Ie),{},{selectedKeys:tt}))}},se.onClick=function(Ie){var dt=se.getRealMenuMode(),lt=Object(H.a)(se),Ae=lt.store,tt=lt.props.onOpenChange;dt!=="inline"&&!("openKeys"in se.props)&&(Ae.setState({openKeys:[]}),tt([])),se.props.onClick(Ie)},se.onKeyDown=function(Ie,dt){se.innerMenu.getWrappedInstance().onKeyDown(Ie,dt)},se.onOpenChange=function(Ie){var dt=Object(H.a)(se),lt=dt.props,Ae=se.store.getState().openKeys.concat(),tt=!1,mt=function(Lt){var mn=!1;if(Lt.open)mn=Ae.indexOf(Lt.key)===-1,mn&&Ae.push(Lt.key);else{var hn=Ae.indexOf(Lt.key);mn=hn!==-1,mn&&Ae.splice(hn,1)}tt=tt||mn};Array.isArray(Ie)?Ie.forEach(mt):mt(Ie),tt&&("openKeys"in se.props||se.store.setState({openKeys:Ae}),lt.onOpenChange(Ae))},se.onDeselect=function(Ie){var dt=Object(H.a)(se),lt=dt.props;if(lt.selectable){var Ae=se.store.getState().selectedKeys.concat(),tt=Ie.key,mt=Ae.indexOf(tt);mt!==-1&&Ae.splice(mt,1),"selectedKeys"in lt||se.store.setState({selectedKeys:Ae}),lt.onDeselect(Object(J.a)(Object(J.a)({},Ie),{},{selectedKeys:Ae}))}},se.onMouseEnter=function(Ie){se.restoreModeVerticalFromInline();var dt=se.props.onMouseEnter;dt&&dt(Ie)},se.onTransitionEnd=function(Ie){var dt=Ie.propertyName==="width"&&Ie.target===Ie.currentTarget,lt=Ie.target.className,Ae=Object.prototype.toString.call(lt)==="[object SVGAnimatedString]"?lt.animVal:lt,tt=Ie.propertyName==="font-size"&&Ae.indexOf("anticon")>=0;(dt||tt)&&se.restoreModeVerticalFromInline()},se.setInnerMenu=function(Ie){se.innerMenu=Ie},se.isRootMenu=!0;var pe=Le.defaultSelectedKeys,je=Le.defaultOpenKeys;return"selectedKeys"in Le&&(pe=Le.selectedKeys||[]),"openKeys"in Le&&(je=Le.openKeys||[]),se.store=Object(N.c)({selectedKeys:pe,openKeys:je,activeKey:{"0-menu-":ze(Le,Le.activeKey)}}),se.state={switchingModeFromInline:!1},se}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){this.updateMiniStore(),this.updateMenuDisplay()}},{key:"componentDidUpdate",value:function(se){this.updateOpentKeysWhenSwitchMode(se),this.updateMiniStore();var pe=this.props,je=pe.siderCollapsed,Ie=pe.inlineCollapsed,dt=pe.onOpenChange;(!se.inlineCollapsed&&Ie||!se.siderCollapsed&&je)&&dt([]),this.updateMenuDisplay()}},{key:"updateOpentKeysWhenSwitchMode",value:function(se){var pe=this.props,je=this.store,Ie=this.inlineOpenKeys,dt=je.getState(),lt={};se.mode==="inline"&&pe.mode!=="inline"&&this.setState({switchingModeFromInline:!0}),"openKeys"in pe||((pe.inlineCollapsed&&!se.inlineCollapsed||pe.siderCollapsed&&!se.siderCollapsed)&&(this.setState({switchingModeFromInline:!0}),this.inlineOpenKeys=dt.openKeys.concat(),lt.openKeys=[]),(!pe.inlineCollapsed&&se.inlineCollapsed||!pe.siderCollapsed&&se.siderCollapsed)&&(lt.openKeys=Ie,this.inlineOpenKeys=[])),Object.keys(lt).length&&je.setState(lt)}},{key:"updateMenuDisplay",value:function(){var se=this.props.collapsedWidth,pe=this.store,je=this.prevOpenKeys,Ie=this.getInlineCollapsed()&&(se===0||se==="0"||se==="0px");Ie?(this.prevOpenKeys=pe.getState().openKeys.concat(),this.store.setState({openKeys:[]})):je&&(this.store.setState({openKeys:je}),this.prevOpenKeys=null)}},{key:"getRealMenuMode",value:function(){var se=this.props.mode,pe=this.state.switchingModeFromInline,je=this.getInlineCollapsed();return pe&&je?"inline":je?"vertical":se}},{key:"getInlineCollapsed",value:function(){var se=this.props,pe=se.inlineCollapsed,je=se.siderCollapsed;return je!==void 0?je:pe}},{key:"restoreModeVerticalFromInline",value:function(){var se=this.state.switchingModeFromInline;se&&this.setState({switchingModeFromInline:!1})}},{key:"updateMiniStore",value:function(){"selectedKeys"in this.props&&this.store.setState({selectedKeys:this.props.selectedKeys||[]}),"openKeys"in this.props&&this.store.setState({openKeys:this.props.openKeys||[]})}},{key:"render",value:function(){var se=Object(J.a)({},Object(E.default)(this.props,["collapsedWidth","siderCollapsed","defaultMotions"])),pe=this.getRealMenuMode();return se.className+=" ".concat(se.prefixCls,"-root"),se.direction==="rtl"&&(se.className+=" ".concat(se.prefixCls,"-rtl")),se=Object(J.a)(Object(J.a)({},se),{},{mode:pe,onClick:this.onClick,onOpenChange:this.onOpenChange,onDeselect:this.onDeselect,onSelect:this.onSelect,onMouseEnter:this.onMouseEnter,onTransitionEnd:this.onTransitionEnd,parentMenu:this,motion:ce(this.props,this.state,pe)}),delete se.openAnimation,delete se.openTransitionName,U.createElement(N.a,{store:this.store},U.createElement(ge,Object.assign({},se,{ref:this.setInnerMenu}),this.props.children))}}]),Ue}(U.Component);ne.defaultProps={selectable:!0,onClick:W,onSelect:W,onOpenChange:W,onDeselect:W,defaultSelectedKeys:[],defaultOpenKeys:[],subMenuOpenDelay:.1,subMenuCloseDelay:.1,triggerSubMenuAction:"hover",prefixCls:"rc-menu",className:"",mode:"vertical",style:{},builtinPlacements:{},overflowedIndicator:U.createElement("span",null,"\xB7\xB7\xB7")};var ie=ne,oe=function(it){Object(I.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(){var Le;return Object(K.a)(this,Ue),Le=Be.apply(this,arguments),Le.onKeyDown=function(se){var pe=se.keyCode;return pe===T.a.ENTER?(Le.onClick(se),!0):void 0},Le.onMouseLeave=function(se){var pe=Le.props,je=pe.eventKey,Ie=pe.onItemHover,dt=pe.onMouseLeave;Ie({key:je,hover:!1}),dt({key:je,domEvent:se})},Le.onMouseEnter=function(se){var pe=Le.props,je=pe.eventKey,Ie=pe.onItemHover,dt=pe.onMouseEnter;Ie({key:je,hover:!0}),dt({key:je,domEvent:se})},Le.onClick=function(se){var pe=Le.props,je=pe.eventKey,Ie=pe.multiple,dt=pe.onClick,lt=pe.onSelect,Ae=pe.onDeselect,tt=pe.isSelected,mt={key:je,keyPath:[je],item:Object(H.a)(Le),domEvent:se};dt(mt),Ie?tt?Ae(mt):lt(mt):tt||lt(mt)},Le.saveNode=function(se){Le.node=se},Le}return Object(R.a)(Ue,[{key:"componentDidMount",value:function(){this.callRef()}},{key:"componentDidUpdate",value:function(){this.callRef()}},{key:"componentWillUnmount",value:function(){var se=this.props;se.onDestroy&&se.onDestroy(se.eventKey)}},{key:"getPrefixCls",value:function(){return"".concat(this.props.rootPrefixCls,"-item")}},{key:"getActiveClassName",value:function(){return"".concat(this.getPrefixCls(),"-active")}},{key:"getSelectedClassName",value:function(){return"".concat(this.getPrefixCls(),"-selected")}},{key:"getDisabledClassName",value:function(){return"".concat(this.getPrefixCls(),"-disabled")}},{key:"callRef",value:function(){this.props.manualRef&&this.props.manualRef(this)}},{key:"render",value:function(){var se,pe=Object(J.a)({},this.props),je=i()(this.getPrefixCls(),pe.className,(se={},Object(c.a)(se,this.getActiveClassName(),!pe.disabled&&pe.active),Object(c.a)(se,this.getSelectedClassName(),pe.isSelected),Object(c.a)(se,this.getDisabledClassName(),pe.disabled),se)),Ie=Object(J.a)(Object(J.a)({},pe.attribute),{},{title:typeof pe.title=="string"?pe.title:void 0,className:je,role:pe.role||"menuitem","aria-disabled":pe.disabled});pe.role==="option"?Ie=Object(J.a)(Object(J.a)({},Ie),{},{role:"option","aria-selected":pe.isSelected}):(pe.role===null||pe.role==="none")&&(Ie.role="none");var dt={onClick:pe.disabled?null:this.onClick,onMouseLeave:pe.disabled?null:this.onMouseLeave,onMouseEnter:pe.disabled?null:this.onMouseEnter},lt=Object(J.a)({},pe.style);pe.mode==="inline"&&(pe.direction==="rtl"?lt.paddingRight=pe.inlineIndent*pe.level:lt.paddingLeft=pe.inlineIndent*pe.level),Se.forEach(function(tt){return delete pe[tt]}),delete pe.direction;var Ae=this.props.itemIcon;return typeof this.props.itemIcon=="function"&&(Ae=U.createElement(this.props.itemIcon,this.props)),U.createElement("li",Object.assign({},Object(E.default)(pe,["onClick","onMouseEnter","onMouseLeave","onSelect"]),Ie,dt,{style:lt,ref:this.saveNode}),pe.children,Ae)}}]),Ue}(U.Component);oe.isMenuItem=!0,oe.defaultProps={onSelect:W,onMouseEnter:W,onMouseLeave:W,manualRef:W};var ue=Object(N.b)(function(it,Be){var Ue=it.activeKey,Le=it.selectedKeys,se=Be.eventKey,pe=Be.subMenuKey;return{active:Ue[pe]===se,isSelected:Le.indexOf(se)!==-1}})(oe),we=ue,ke=function(it){Object(I.a)(Ue,it);var Be=Object(x.a)(Ue);function Ue(){var Le;return Object(K.a)(this,Ue),Le=Be.apply(this,arguments),Le.renderInnerMenuItem=function(se){var pe=Le.props,je=pe.renderMenuItem,Ie=pe.index;return je(se,Ie,Le.props.subMenuKey)},Le}return Object(R.a)(Ue,[{key:"render",value:function(){var se=Object(L.a)({},this.props),pe=se.className,je=pe===void 0?"":pe,Ie=se.rootPrefixCls,dt="".concat(Ie,"-item-group-title"),lt="".concat(Ie,"-item-group-list"),Ae=se.title,tt=se.children;return Se.forEach(function(mt){return delete se[mt]}),delete se.onClick,delete se.direction,U.createElement("li",Object.assign({},se,{className:"".concat(je," ").concat(Ie,"-item-group")}),U.createElement("div",{className:dt,title:typeof Ae=="string"?Ae:void 0},Ae),U.createElement("ul",{className:lt},U.Children.map(tt,this.renderInnerMenuItem)))}}]),Ue}(U.Component);ke.isMenuItemGroup=!0,ke.defaultProps={disabled:!0};var Ze=ke,bt=function(Be){var Ue=Be.className,Le=Be.rootPrefixCls,se=Be.style;return U.createElement("li",{className:"".concat(Ue," ").concat(Le,"-item-divider"),style:se})};bt.defaultProps={disabled:!0,className:"",style:{}};var It=bt,Ge=Ce.e=ie},"55Ip":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return u}),j.d(Ce,"b",function(){return S});var J=j("Ty5D"),K=j("dI71"),R=j("q1tI"),H=j.n(R),I=j("YS25"),x=j("17x9"),U=j.n(x),N=j("wx14"),E=j("zLVn"),L=j("9R94"),c=function(d){Object(K.a)(o,d);function o(){for(var _,C=arguments.length,y=new Array(C),M=0;M=0||C.relatedTarget.className.indexOf("".concat(F,"-next"))>=0))return;d.setState({goInputText:""}),B(d.getValidValue())},d.go=function(C){var y=d.state.goInputText;if(y==="")return;(C.keyCode===O.ENTER||C.type==="click")&&(d.setState({goInputText:""}),d.props.quickGo(d.getValidValue()))},d}return Object(I.a)(f,[{key:"getValidValue",value:function(){var o=this.state,s=o.goInputText,_=o.current;return!s||isNaN(s)?_:Number(s)}},{key:"getPageSizeOptions",value:function(){var o=this.props,s=o.pageSize,_=o.pageSizeOptions;return _.some(function(C){return C.toString()===s.toString()})?_:_.concat([s.toString()]).sort(function(C,y){var M=isNaN(Number(C))?0:Number(C),B=isNaN(Number(y))?0:Number(y);return M-B})}},{key:"render",value:function(){var o=this,s=this.props,_=s.pageSize,C=s.locale,y=s.rootPrefixCls,M=s.changeSize,B=s.quickGo,F=s.goButton,Q=s.selectComponentClass,V=s.buildOptionText,W=s.selectPrefixCls,$=s.disabled,re=this.state.goInputText,ae="".concat(y,"-options"),he=Q,Se=null,ye=null,be=null;if(!M&&!B)return null;var Oe=this.getPageSizeOptions();if(M&&he){var _e=Oe.map(function(fe,le){return E.a.createElement(he.Option,{key:le,value:fe.toString()},(V||o.buildOptionText)(fe))});Se=E.a.createElement(he,{disabled:$,prefixCls:W,showSearch:!1,className:"".concat(ae,"-size-changer"),optionLabelProp:"children",dropdownMatchSelectWidth:!1,value:(_||Oe[0]).toString(),onChange:this.changeSize,getPopupContainer:function(le){return le.parentNode}},_e)}return B&&(F&&(be=typeof F=="boolean"?E.a.createElement("button",{type:"button",onClick:this.go,onKeyUp:this.go,disabled:$,className:"".concat(ae,"-quick-jumper-button")},C.jump_to_confirm):E.a.createElement("span",{onClick:this.go,onKeyUp:this.go},F)),ye=E.a.createElement("div",{className:"".concat(ae,"-quick-jumper")},C.jump_to,E.a.createElement("input",{disabled:$,type:"text",value:re,onChange:this.handleChange,onKeyUp:this.go,onBlur:this.handleBlur}),C.page,be)),E.a.createElement("li",{className:"".concat(ae)},Se,ye)}}]),f}(E.a.Component);p.defaultProps={pageSizeOptions:["10","20","50","100"]};var g=p,i=j("N2Kk");function a(){}function u(D){return typeof D=="number"&&isFinite(D)&&Math.floor(D)===D}function h(D,S,f){return f}function w(D,S,f){var d=typeof D=="undefined"?S.pageSize:D;return Math.floor((f.total-1)/d)+1}var b=function(D){Object(x.a)(f,D);var S=Object(U.a)(f);function f(d){var o;Object(H.a)(this,f),o=S.call(this,d),o.getJumpPrevPage=function(){return Math.max(1,o.state.current-(o.props.showLessItems?3:5))},o.getJumpNextPage=function(){return Math.min(w(void 0,o.state,o.props),o.state.current+(o.props.showLessItems?3:5))},o.getItemIcon=function(M,B){var F=o.props.prefixCls,Q=M||E.a.createElement("button",{type:"button","aria-label":B,className:"".concat(F,"-item-link")});return typeof M=="function"&&(Q=E.a.createElement(M,Object(R.a)({},o.props))),Q},o.savePaginationNode=function(M){o.paginationNode=M},o.isValid=function(M){return u(M)&&M!==o.state.current},o.shouldDisplayQuickJumper=function(){var M=o.props,B=M.showQuickJumper,F=M.pageSize,Q=M.total;return Q<=F?!1:B},o.handleKeyDown=function(M){(M.keyCode===O.ARROW_UP||M.keyCode===O.ARROW_DOWN)&&M.preventDefault()},o.handleKeyUp=function(M){var B=o.getValidValue(M),F=o.state.currentInputValue;B!==F&&o.setState({currentInputValue:B}),M.keyCode===O.ENTER?o.handleChange(B):M.keyCode===O.ARROW_UP?o.handleChange(B-1):M.keyCode===O.ARROW_DOWN&&o.handleChange(B+1)},o.changePageSize=function(M){var B=o.state.current,F=w(M,o.state,o.props);B=B>F?F:B,F===0&&(B=o.state.current),typeof M=="number"&&("pageSize"in o.props||o.setState({pageSize:M}),"current"in o.props||o.setState({current:B,currentInputValue:B})),o.props.onShowSizeChange(B,M),"onChange"in o.props&&o.props.onChange&&o.props.onChange(B,M)},o.handleChange=function(M){var B=o.props.disabled,F=M;if(o.isValid(F)&&!B){var Q=w(void 0,o.state,o.props);F>Q?F=Q:F<1&&(F=1),"current"in o.props||o.setState({current:F,currentInputValue:F});var V=o.state.pageSize;return o.props.onChange(F,V),F}return o.state.current},o.prev=function(){o.hasPrev()&&o.handleChange(o.state.current-1)},o.next=function(){o.hasNext()&&o.handleChange(o.state.current+1)},o.jumpPrev=function(){o.handleChange(o.getJumpPrevPage())},o.jumpNext=function(){o.handleChange(o.getJumpNextPage())},o.hasPrev=function(){return o.state.current>1},o.hasNext=function(){return o.state.current2?F-2:0),V=2;V=_?y=_:y=Number(s),y}},{key:"getShowSizeChanger",value:function(){var o=this.props,s=o.showSizeChanger,_=o.total,C=o.totalBoundaryShowSizeChanger;return typeof s!="undefined"?s:_>C}},{key:"renderPrev",value:function(o){var s=this.props,_=s.prevIcon,C=s.itemRender,y=C(o,"prev",this.getItemIcon(_,"prev page")),M=!this.hasPrev();return Object(N.isValidElement)(y)?Object(N.cloneElement)(y,{disabled:M}):y}},{key:"renderNext",value:function(o){var s=this.props,_=s.nextIcon,C=s.itemRender,y=C(o,"next",this.getItemIcon(_,"next page")),M=!this.hasNext();return Object(N.isValidElement)(y)?Object(N.cloneElement)(y,{disabled:M}):y}},{key:"render",value:function(){var o=this,s=this.props,_=s.prefixCls,C=s.className,y=s.style,M=s.disabled,B=s.hideOnSinglePage,F=s.total,Q=s.locale,V=s.showQuickJumper,W=s.showLessItems,$=s.showTitle,re=s.showTotal,ae=s.simple,he=s.itemRender,Se=s.showPrevNextJumpers,ye=s.jumpPrevIcon,be=s.jumpNextIcon,Oe=s.selectComponentClass,_e=s.selectPrefixCls,fe=s.pageSizeOptions,le=this.state,Re=le.current,ot=le.pageSize,st=le.currentInputValue;if(B===!0&&F<=ot)return null;var nt=w(void 0,this.state,this.props),$e=[],Ke=null,Ye=null,ut=null,pt=null,at=null,Qe=V&&V.goButton,rt=W?1:2,Rt=Re-1>0?Re-1:0,Ct=Re+1=rt*2&&Re!==1+2&&($e[0]=Object(N.cloneElement)($e[0],{className:"".concat(_,"-item-after-jump-prev")}),$e.unshift(Ke)),nt-Re>=rt*2&&Re!==nt-2&&($e[$e.length-1]=Object(N.cloneElement)($e[$e.length-1],{className:"".concat(_,"-item-before-jump-next")}),$e.push(Ye)),ze!==1&&$e.unshift(ut),Ve!==nt&&$e.push(pt)}var ge=null;re&&(ge=E.a.createElement("li",{className:"".concat(_,"-total-text")},re(F,[F===0?0:(Re-1)*ot+1,Re*ot>F?F:Re*ot])));var de=!this.hasPrev()||!nt,ce=!this.hasNext()||!nt;return E.a.createElement("ul",Object(J.a)({className:c()(_,C,Object(K.a)({},"".concat(_,"-disabled"),M)),style:y,unselectable:"unselectable",ref:this.savePaginationNode},xt),ge,E.a.createElement("li",{title:$?Q.prev_page:null,onClick:this.prev,tabIndex:de?null:0,onKeyPress:this.runIfEnterPrev,className:c()("".concat(_,"-prev"),Object(K.a)({},"".concat(_,"-disabled"),de)),"aria-disabled":de},this.renderPrev(Rt)),$e,E.a.createElement("li",{title:$?Q.next_page:null,onClick:this.next,tabIndex:ce?null:0,onKeyPress:this.runIfEnterNext,className:c()("".concat(_,"-next"),Object(K.a)({},"".concat(_,"-disabled"),ce)),"aria-disabled":ce},this.renderNext(Ct)),E.a.createElement(g,{disabled:M,locale:Q,rootPrefixCls:_,selectComponentClass:Oe,selectPrefixCls:_e,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:Re,pageSize:ot,pageSizeOptions:fe,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:Qe}))}}],[{key:"getDerivedStateFromProps",value:function(o,s){var _={};if("current"in o&&(_.current=o.current,o.current!==s.current&&(_.currentInputValue=_.current)),"pageSize"in o&&o.pageSize!==s.pageSize){var C=s.current,y=w(o.pageSize,s,o);C=C>y?y:C,"current"in o||(_.current=C,_.currentInputValue=C),_.pageSize=o.pageSize}return _}}]),f}(E.a.Component);b.defaultProps={defaultCurrent:1,total:0,defaultPageSize:10,onChange:a,className:"",selectPrefixCls:"rc-select",prefixCls:"rc-pagination",selectComponentClass:null,hideOnSinglePage:!1,showPrevNextJumpers:!0,showQuickJumper:!1,showLessItems:!1,showTitle:!0,onShowSizeChange:a,locale:i.a,style:{},itemRender:h,totalBoundaryShowSizeChanger:50};var v=b},"6RRn":function(Fe,Ce,j){"use strict";var J=j("wCXF"),K=j("n6Qo");j.d(Ce,"b",function(){return K.a});var R=j("IBYe"),H=j("6eGT"),I=j("hW8S");j.d(Ce,"a",function(){return I.a}),Ce.c=J.b},"6eGT":function(Fe,Ce,j){"use strict";function J(K){return null}Ce.a=J},"7Cbv":function(Fe,Ce,j){"use strict";var J=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),K=new Uint8Array(16);function R(){if(!J)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return J(K)}var H=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function I(P){return typeof P=="string"&&H.test(P)}for(var x=I,U=[],N=0;N<256;++N)U.push((N+256).toString(16).substr(1));function E(P){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,p=(U[P[O+0]]+U[P[O+1]]+U[P[O+2]]+U[P[O+3]]+"-"+U[P[O+4]]+U[P[O+5]]+"-"+U[P[O+6]]+U[P[O+7]]+"-"+U[P[O+8]]+U[P[O+9]]+"-"+U[P[O+10]]+U[P[O+11]]+U[P[O+12]]+U[P[O+13]]+U[P[O+14]]+U[P[O+15]]).toLowerCase();if(!x(p))throw TypeError("Stringified UUID is invalid");return p}var L=E;function c(P,O,p){P=P||{};var g=P.random||(P.rng||R)();if(g[6]=g[6]&15|64,g[8]=g[8]&63|128,O){p=p||0;for(var i=0;i<16;++i)O[p+i]=g[i];return O}return L(g)}var T=Ce.a=c},"7ahc":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return w});var J=j("k1fw"),K=j("0Owb"),R=j("+L6B"),H=j("2/Rp"),I=j("y8nQ"),x=j("Vl3Y"),U=j("tJVT"),N=j("OaEy"),E=j("2fM7"),L=j("q1tI"),c=j.n(L),T=j("VrN/"),P=j.n(T),O=j("p77/"),p=j.n(O),g=j("c5Ni"),i=j.n(g),a=E.a.Option,u={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};Ce.b=function(b){var v=b.callback,D=b.onCancel,S=Object(L.useState)("python"),f=Object(U.a)(S,2),d=f[0],o=f[1];function s(C){o(h[C][1])}function _(C){v(C)}return c.a.createElement(x.a,Object(K.a)({},u,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:_}),c.a.createElement(x.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},c.a.createElement(E.a,{onChange:s},Object.keys(h).map(function(C){return c.a.createElement(a,{key:C,value:C},h[C][0])}))),c.a.createElement(x.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},c.a.createElement(w,{mode:d})),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(H.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function w(b){var v=b.value,D=b.onChange,S=b.mode,f=b.options,d=f===void 0?{}:f,o=Object(L.useRef)(),s=Object(L.useState)(),_=Object(U.a)(s,2),C=_[0],y=_[1];return Object(L.useEffect)(function(){if(C){function M(B){var F=B.getValue();D&&D(F)}return C.on("change",M),function(){C.off("change",M)}}},[C,D]),Object(L.useEffect)(function(){C&&C.setOption("mode",S)},[C,S]),Object(L.useEffect)(function(){C&&((v!==C.getValue()||v==="")&&setTimeout(function(){C.setValue(v||" ")},300))},[C,v]),Object(L.useEffect)(function(){if(o.current&&!C){var M=P.a.fromTextArea(o.current,Object(J.a)({mode:S,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},d));y(M)}},[o.current,C]),c.a.createElement("div",{className:"my-codemirror-container"},c.a.createElement("textarea",{ref:o}))}},"7ixt":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return R});var J={adjustX:1,adjustY:1},K=[0,0],R={left:{points:["cr","cl"],overflow:J,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:J,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:J,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:J,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:J,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:J,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:J,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:J,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:J,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:J,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:J,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:J,offset:[-4,0],targetOffset:K}},H=R},"815F":function(Fe,Ce,j){"use strict";j.d(Ce,"e",function(){return U}),j.d(Ce,"c",function(){return E}),j.d(Ce,"d",function(){return L}),j.d(Ce,"a",function(){return T}),j.d(Ce,"f",function(){return P}),j.d(Ce,"b",function(){return O});var J=j("KQm4"),K=j("VTBJ"),R=j("Ff2n"),H=j("Zm9Q"),I=j("Kwbf"),x=j("OZM5");function U(p,g){return p!=null?p:g}function N(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=new Map;function i(a){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";(a||[]).forEach(function(h){var w=h.key,b=h.children;Object(I.a)(w!=null,"Tree node must have a certain key: [".concat(u).concat(w,"]"));var v=String(w);Object(I.a)(!g.has(v)||w===null||w===void 0,"Same 'key' exist in the Tree: ".concat(v)),g.set(v,!0),i(b,"".concat(u).concat(v," > "))})}i(p)}function E(p){function g(i){var a=Object(H.a)(i);return a.map(function(u){if(!Object(x.i)(u))return Object(I.a)(!u,"Tree/TreeNode can only accept TreeNode as children."),null;var h=u.key,w=u.props,b=w.children,v=Object(R.a)(w,["children"]),D=Object(K.a)({key:h},v),S=g(b);return S.length&&(D.children=S),D}).filter(function(u){return u})}return g(p)}function L(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=new Set(g===!0?[]:g),a=[];function u(h){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return h.map(function(b,v){var D=Object(x.h)(w?w.pos:"0",v),S=U(b.key,D),f=Object(K.a)(Object(K.a)({},b),{},{parent:w,pos:D,children:null,data:b,isStart:[].concat(Object(J.a)(w?w.isStart:[]),[v===0]),isEnd:[].concat(Object(J.a)(w?w.isEnd:[]),[v===h.length-1])});return a.push(f),g===!0||i.has(S)?f.children=u(b.children||[],f):f.children=[],f})}return u(p),a}function c(p,g,i){var a;i?typeof i=="string"?a=function(w){return w[i]}:typeof i=="function"&&(a=function(w){return i(w)}):a=function(w,b){return U(w.key,b)};function u(h,w,b){var v=h?h.children:p,D=h?Object(x.h)(b.pos,w):"0";if(h){var S=a(h,D),f={node:h,index:w,pos:D,key:S,parentPos:b.node?b.pos:null,level:b.level+1};g(f)}v&&v.forEach(function(d,o){u(d,o,{node:h,pos:D,level:b?b.level+1:-1})})}u(null)}function T(p){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=g.initWrapper,a=g.processEntity,u=g.onProcessFinished,h=arguments.length>2?arguments[2]:void 0,w={},b={},v={posEntities:w,keyEntities:b};return i&&(v=i(v)||v),c(p,function(D){var S=D.node,f=D.index,d=D.pos,o=D.key,s=D.parentPos,_=D.level,C={node:S,index:f,key:o,pos:d,level:_},y=U(o,d);w[d]=C,b[y]=C,C.parent=w[s],C.parent&&(C.parent.children=C.parent.children||[],C.parent.children.push(C)),a&&a(C,v)},h),u&&u(v),v}function P(p,g){var i=g.expandedKeys,a=g.selectedKeys,u=g.loadedKeys,h=g.loadingKeys,w=g.checkedKeys,b=g.halfCheckedKeys,v=g.dragOverNodeKey,D=g.dropPosition,S=g.keyEntities,f=S[p],d={eventKey:p,expanded:i.indexOf(p)!==-1,selected:a.indexOf(p)!==-1,loaded:u.indexOf(p)!==-1,loading:h.indexOf(p)!==-1,checked:w.indexOf(p)!==-1,halfChecked:b.indexOf(p)!==-1,pos:String(f?f.pos:""),dragOver:v===p&&D===0,dragOverGapTop:v===p&&D===-1,dragOverGapBottom:v===p&&D===1};return d}function O(p){var g=p.data,i=p.expanded,a=p.selected,u=p.checked,h=p.loaded,w=p.loading,b=p.halfChecked,v=p.dragOver,D=p.dragOverGapTop,S=p.dragOverGapBottom,f=p.pos,d=p.active,o=Object(K.a)(Object(K.a)({},g),{},{expanded:i,selected:a,checked:u,loaded:h,loading:w,halfChecked:b,dragOver:v,dragOverGapTop:D,dragOverGapBottom:S,pos:f,active:d});return"props"in o||Object.defineProperty(o,"props",{get:function(){return Object(I.a)(!1,"Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."),p}}),o}},"8EBN":function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){"use strict";J.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var K=0;K-1&&H.substring(U+1,H.length);if(N)return J.findModeByExtension(N)},J.findModeByName=function(H){H=H.toLowerCase();for(var I=0;I=G.length?ee.slice(G.length):ee}).join(` `)}var i=[],a=["
    "],u=new O.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function w(){i.length=0,a=["
      "]}var b={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function v(z,m,A,G){if(m>=z.length||z[m].level<=A)return m;var ee=z[m];G.push("
    • "+ee.text+""),m++;var X=[];return m=v(z,m,ee.level,X),X.length>0&&(G.push("
        "),X.forEach(function(ve){G.push(ve)}),G.push("
      ")),G.push("
    • "),m=v(z,m,A,G),m}function D(){return v(i,0,0,a),a.push("
    "),a.join("")}var S={heading:function(m){var A=h.exec(m);if(A)return{type:"heading",raw:A[0],depth:A[1].length,text:A[2]}},fences:function(m){var A=this.rules.block.fences.exec(m);if(A){var G=A[0],ee=g(G,A[3]||""),X=A[2]?A[2].trim():A[2];if(["latex","katex","math"].indexOf(X)>=0){var ve=o(),Xe=ee;ee=ve,s[ve]={type:"block",expression:Xe}}return{type:"code",raw:G,lang:X,text:ee}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,d=0,o=function(){return"__special_katext_id_".concat(d++,"__")},s={};function _(){return s}function C(){d=0,s={}}function y(z){return z=z.replace(f,function(m,A){var G=o();return s[G]={type:"inline",expression:A},G}),z}var M=u.listitem;u.listitem=function(z){return M(y(z))};var B=u.paragraph;u.paragraph=function(z){return B(y(z))};var F=u.tablecell;u.tablecell=function(z,m){return F(y(z),m)},u.code=function(z,m,A){var G=(m||"").match(/\S*/)[0];return G?["latex","katex","math"].indexOf(G)>=0?"

    ".concat(z,"

    "):'
    ').concat(A?z:Object(p.escape)(z,!0),`
    `):'
    '+(A?z:Object(p.escape)(z,!0))+"
    "},u.heading=function(z,m,A){var G=this.options.headerPrefix+A.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return i.push({anchor:G,level:m,text:z}),"'+z+""},O.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),O.a.use({tokenizer:S,renderer:u});var Q=O.a,V=j("SJMd"),W=j("ulZh"),$=j.n(W),re=j("m3rI"),ae=j("Oy/b"),he=j("p5ED"),Se=j("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 ye=function(z,m){return(ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,G){A.__proto__=G}||function(A,G){for(var ee in G)Object.prototype.hasOwnProperty.call(G,ee)&&(A[ee]=G[ee])})(z,m)};function be(z,m){function A(){this.constructor=z}ye(z,m),z.prototype=m===null?Object.create(m):(A.prototype=m.prototype,new A)}function Oe(z,m,A,G){return new(A||(A=Promise))(function(ee,X){function ve(At){try{Me(G.next(At))}catch(qe){X(qe)}}function Xe(At){try{Me(G.throw(At))}catch(qe){X(qe)}}function Me(At){var qe;At.done?ee(At.value):(qe=At.value,qe instanceof A?qe:new A(function(Bt){Bt(qe)})).then(ve,Xe)}Me((G=G.apply(z,m||[])).next())})}function _e(z,m){var A,G,ee,X,ve={label:0,sent:function(){if(1&ee[0])throw ee[1];return ee[1]},trys:[],ops:[]};return X={next:Xe(0),throw:Xe(1),return:Xe(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function Xe(Me){return function(At){return function(qe){if(A)throw new TypeError("Generator is already executing.");for(;ve;)try{if(A=1,G&&(ee=2&qe[0]?G.return:qe[0]?G.throw||((ee=G.return)&&ee.call(G),0):G.next)&&!(ee=ee.call(G,qe[1])).done)return ee;switch(G=0,ee&&(qe=[2&qe[0],ee.value]),qe[0]){case 0:case 1:ee=qe;break;case 4:return ve.label++,{value:qe[1],done:!1};case 5:ve.label++,G=qe[1],qe=[0];continue;case 7:qe=ve.ops.pop(),ve.trys.pop();continue;default:if(!(ee=ve.trys,(ee=ee.length>0&&ee[ee.length-1])||qe[0]!==6&&qe[0]!==2)){ve=0;continue}if(qe[0]===3&&(!ee||qe[1]>ee[0]&&qe[1]',"select"),this.addActionButton(G,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(G,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(G,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(G,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(G,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(G,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(G,'',"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(X){var ve=document.createElement("div");ve.className=""+A.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",X.typeName),ve.innerHTML=X.icon,ve.addEventListener("click",function(){A.markerToolbarButtonClicked(ve,X)}),A.buttons.push(ve),A.markerButtons.push(ve)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var ee=document.createElement("div");ee.className=this.toolbarBlockStyleClass.name,ee.style.whiteSpace="nowrap",ee.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(ee),this.addActionButton(ee,'',"render"),this.addActionButton(ee,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},z.prototype.addButtonClickListener=function(m){this.buttonClickListeners.push(m)},z.prototype.removeButtonClickListener=function(m){this.buttonClickListeners.indexOf(m)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(m),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var m=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var A=0;A0&&this.buttonClickListeners.forEach(function(G){return G("marker",A)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(m,A){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("action",A)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(m){this.resetButtonStyles(),m.className=m.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),m.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(m){var A=this.markerButtons.find(function(G){return G.getAttribute("data-type-name")===m});A&&this.setActiveButton(A)},z.prototype.setCurrentMarker=function(m){var A=this;this.currentMarker=m,this.buttons.filter(function(G){return/delete|notes/.test(G.getAttribute("data-action"))}).forEach(function(G){A.currentMarker===void 0?(G.style.fillOpacity="0.4",G.style.pointerEvents="none"):(G.style.fillOpacity="1",G.style.pointerEvents="all")})},z}(),ut=function(){function z(m,A,G,ee){this.panels=[],this.panelButtons=[],this.markerjsContainer=m,this.displayMode=A,this.uiStyleSettings=G,this.styles=ee,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var m;this.toolboxStyleClass=this.styles.addClass(new Ke("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 Ke("toolbox_colors",` color: `+this.uiStyleSettings.toolboxColor+`; `));var A=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ke("toolbox-button-row",` display: flex; cursor: default; box-sizing: content-box; `)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ke("toolbox-button-row_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`; `)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ke("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 Ke("toolbox-panel-row_colors",` background-color: `+((m=this.uiStyleSettings.toolboxBackgroundColor)!==null&&m!==void 0?m:this.uiStyleSettings.toolbarBackgroundHoverColor)+`; `)),this.toolboxButtonStyleClass=this.styles.addClass(new Ke("toolbox_button",` display: inline-block; width: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px; height: `+(this.uiStyleSettings.toolbarHeight-2*A)+`px; padding: `+A+`px; box-sizing: content-box; `)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ke("toolbox-button_colors",` fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ke("toolbox-active-button_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`; fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.styles.addRule(new $e("."+this.toolboxButtonStyleColorsClass.name+":hover",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+` `)),this.styles.addRule(new $e("."+this.toolboxButtonStyleClass.name+" svg",` height: `+this.uiStyleSettings.toolbarHeight/2+`px; `))},z.prototype.show=function(m){var A;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=m,this.uiContainer.className=this.toolboxStyleClass.name+" "+((A=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(m){var A,G,ee=this;this.panels=m,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((A=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&A!==void 0?A:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((G=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&G!==void 0?G:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(X){var ve;X.uiStyleSettings=ee.uiStyleSettings;var Xe=document.createElement("div");Xe.className=ee.toolboxButtonStyleClass.name+" "+((ve=ee.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:ee.toolboxButtonStyleColorsClass.name),Xe.innerHTML=X.icon,Xe.title=X.title,Xe.addEventListener("click",function(){ee.panelButtonClick(X)}),ee.panelButtons.push(Xe),ee.buttonRow.appendChild(Xe)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(m){var A=this,G=-1;if(m!==this.activePanel){G=this.panels.indexOf(m),this.panelRow.innerHTML="";var ee=m.getUi();ee.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(ee),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=m}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){A.displayMode==="inline"?A.panelRow.style.display="none":A.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(X,ve){var Xe,Me;X.className=A.toolboxButtonStyleClass.name+" "+(ve===G?""+((Xe=A.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&Xe!==void 0?Xe:A.toolboxActiveButtonStyleColorsClass.name):""+((Me=A.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Me!==void 0?Me:A.toolboxButtonStyleColorsClass.name))})},z}(),pt=function(z,m){this.title=z,this.icon=m},at=function(z){function m(A,G,ee,X){var ve=z.call(this,A,X||'')||this;return ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=G,ve.currentColor=ee,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return be(m,z),m.prototype.getUi=function(){var A=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.whiteSpace="nowrap",this.colors.forEach(function(ee){var X=A.getColorBox(ee);G.appendChild(X),A.colorBoxes.push(X)}),G},m.prototype.getColorBox=function(A){var G=this,ee=this.uiStyleSettings.toolbarHeight/4,X=this.uiStyleSettings.toolbarHeight-ee,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=X-2+"px",ve.style.height=X-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(X+2)/2+"px",ve.style.borderColor=A===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){G.setCurrentColor(A,ve)});var Xe=document.createElement("div");return Xe.style.display="inline-block",Xe.style.width=X-2+"px",Xe.style.height=X-2+"px",Xe.style.backgroundColor=A,Xe.style.borderRadius=X/2+"px",A==="transparent"&&(Xe.style.fill=this.uiStyleSettings.toolboxAccentColor,Xe.innerHTML=` `),ve.appendChild(Xe),ve},m.prototype.setCurrentColor=function(A,G){var ee=this;this.currentColor=A,this.colorBoxes.forEach(function(X){X.style.borderColor=X===G?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(A)},m}(pt),Qe=function(){function z(m,A,G){this._state="new",this._isSelected=!1,this._container=m,this._overlayContainer=A,this.globalSettings=G,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(m){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(m,A){},z.prototype.dblClick=function(m,A){},z.prototype.manipulate=function(m){},z.prototype.pointerUp=function(m){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(m){this.container.childNodes.length>0?this.container.insertBefore(m,this.container.childNodes[0]):this.container.appendChild(m)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(m){this._state=m.state,this.notes=m.notes},z.prototype.scale=function(m,A){},z.prototype.colorChanged=function(m){this.onColorChanged&&this.onColorChanged(m),this.stateChanged()},z.prototype.fillColorChanged=function(m){this.onFillColorChanged&&this.onFillColorChanged(m),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var m=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),m.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(m)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),rt=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(m){return this.topLeft.ownsTarget(m)?this.topLeft:this.topCenter.ownsTarget(m)?this.topCenter:this.topRight.ownsTarget(m)?this.topRight:this.centerLeft.ownsTarget(m)?this.centerLeft:this.centerRight.ownsTarget(m)?this.centerRight:this.bottomLeft.ownsTarget(m)?this.bottomLeft:this.bottomCenter.ownsTarget(m)?this.bottomCenter:this.bottomRight.ownsTarget(m)?this.bottomRight:void 0},z}(),Rt=function(){function z(){this.GRIP_SIZE=10,this.visual=le.createGroup(),this.visual.appendChild(le.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(le.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(m){return m===this.visual||m===this.visual.childNodes[0]||m===this.visual.childNodes[1]},z}(),Ct=function(){function z(){}return z.toITransformMatrix=function(m){return{a:m.a,b:m.b,c:m.c,d:m.d,e:m.e,f:m.f}},z.toSVGMatrix=function(m,A){return m.a=A.a,m.b=A.b,m.c=A.c,m.d=A.d,m.e=A.e,m.f=A.f,m},z}(),xt=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.left=0,X.top=0,X.width=0,X.height=0,X.defaultSize={x:50,y:20},X.offsetX=0,X.offsetY=0,X.rotationAngle=0,X.CB_DISTANCE=10,X._suppressMarkerCreateEvent=!1,X.container.transform.baseVal.appendItem(le.createTransform()),X.setupControlBox(),X}return be(m,z),Object.defineProperty(m.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"visual",{get:function(){return this._visual},set:function(A){this._visual=A;var G=le.createTransform();this._visual.transform.baseVal.appendItem(G)},enumerable:!1,configurable:!0}),m.prototype.ownsTarget=function(A){return!!z.prototype.ownsTarget.call(this,A)||!!(this.controlGrips.findGripByVisual(A)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(A))},m.prototype.pointerDown=function(A,G){z.prototype.pointerDown.call(this,A,G),this.state==="new"&&(this.left=A.x,this.top=A.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var ee=this.unrotatePoint(A);if(this.manipulationStartX=ee.x,this.manipulationStartY=ee.y,this.offsetX=ee.x-this.left,this.offsetY=ee.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(G),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(G)){this.activeGrip=this.rotatorGrip;var X=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=X.x-this.width/2,this.top=X.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},m.prototype.pointerUp=function(A){var G=this.state;z.prototype.pointerUp.call(this,A),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(A),this._state="select",G==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},m.prototype.moveVisual=function(A){this.visual.style.transform="translate("+A.x+"px, "+A.y+"px)"},m.prototype.manipulate=function(A){var G=this.unrotatePoint(A);this.state==="creating"?this.resize(A):this.state==="move"?(this.left=this.manipulationStartLeft+(G.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(G.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(G):this.state==="rotate"&&this.rotate(A)},m.prototype.resize=function(A){var G=this.manipulationStartLeft,ee=this.manipulationStartWidth,X=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:G=this.manipulationStartLeft+A.x-this.manipulationStartX,ee=this.manipulationStartWidth+this.manipulationStartLeft-G;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:ee=this.manipulationStartWidth+A.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:X=this.manipulationStartTop+A.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-X;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+A.y-this.manipulationStartY}ee>=0?(this.left=G,this.width=ee):(this.left=G+ee,this.width=-ee),ve>=0?(this.top=X,this.height=ve):(this.top=X+ve,this.height=-ve),this.setSize()},m.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},m.prototype.rotate=function(A){if(Math.abs(A.x-this.centerX)>.1){var G=Math.sign(A.x-this.centerX);this.rotationAngle=180*Math.atan((A.y-this.centerY)/(A.x-this.centerX))/Math.PI+90*G,this.applyRotation()}},m.prototype.applyRotation=function(){var A=this.container.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(A,0)},m.prototype.rotatePoint=function(A){if(this.rotationAngle===0)return A;var G=this.container.getCTM(),ee=le.createPoint(A.x,A.y);return{x:(ee=ee.matrixTransform(G)).x,y:ee.y}},m.prototype.unrotatePoint=function(A){if(this.rotationAngle===0)return A;var G=this.container.getCTM();G=G.inverse();var ee=le.createPoint(A.x,A.y);return{x:(ee=ee.matrixTransform(G)).x,y:ee.y}},m.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},m.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},m.prototype.setupControlBox=function(){this.controlBox=le.createGroup();var A=le.createTransform();A.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(A),this.container.appendChild(this.controlBox),this.controlRect=le.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=le.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 rt,this.addControlGrips(),this.controlBox.style.display="none"},m.prototype.adjustControlBox=function(){var A=this.controlBox.transform.baseVal.getItem(0);A.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(A,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()},m.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()},m.prototype.createGrip=function(){var A=new Rt;return A.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(A.visual),A},m.prototype.positionGrips=function(){var A=this.controlGrips.topLeft.GRIP_SIZE,G=-A/2,ee=G,X=(this.width+this.CB_DISTANCE)/2-A/2,ve=(this.height+this.CB_DISTANCE)/2-A/2,Xe=this.height+this.CB_DISTANCE-A/2,Me=this.width+this.CB_DISTANCE-A/2;this.positionGrip(this.controlGrips.topLeft.visual,G,ee),this.positionGrip(this.controlGrips.topCenter.visual,X,ee),this.positionGrip(this.controlGrips.topRight.visual,Me,ee),this.positionGrip(this.controlGrips.centerLeft.visual,G,ve),this.positionGrip(this.controlGrips.centerRight.visual,Me,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,G,Xe),this.positionGrip(this.controlGrips.bottomCenter.visual,X,Xe),this.positionGrip(this.controlGrips.bottomRight.visual,Me,Xe),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,X,ee-3*this.CB_DISTANCE)},m.prototype.positionGrip=function(A,G,ee){var X=A.transform.baseVal.getItem(0);X.setTranslate(G,ee),A.transform.baseVal.replaceItem(X,0)},m.prototype.hideControlBox=function(){this.controlBox.style.display="none"},m.prototype.showControlBox=function(){this.controlBox.style.display=""},m.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:Ct.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:Ct.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},m.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var G=A;this.left=G.left,this.top=G.top,this.width=G.width,this.height=G.height,this.rotationAngle=G.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(Ct.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,G.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(Ct.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,G.containerTransformMatrix))},m.prototype.scale=function(A,G){z.prototype.scale.call(this,A,G);var ee=this.rotatePoint({x:this.left,y:this.top}),X=this.unrotatePoint({x:ee.x*A,y:ee.y*G});this.left=X.x,this.top=X.y,this.width=this.width*A,this.height=this.height*G,this.adjustControlBox()},m}(Qe),yt=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.fillColor="transparent",X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.opacity=1,X.setStrokeColor=X.setStrokeColor.bind(X),X.setFillColor=X.setFillColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.createVisual=X.createVisual.bind(X),X}return be(m,z),m.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual)},m.prototype.createVisual=function(){this.visual=le.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)},m.prototype.pointerDown=function(A,G){z.prototype.pointerDown.call(this,A,G),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},m.prototype.manipulate=function(A){z.prototype.manipulate.call(this,A)},m.prototype.resize=function(A){z.prototype.resize.call(this,A),this.setSize()},m.prototype.setSize=function(){z.prototype.setSize.call(this),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},m.prototype.pointerUp=function(A){z.prototype.pointerUp.call(this,A),this.setSize()},m.prototype.setStrokeColor=function(A){this.strokeColor=A,this.visual&&le.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(A),this.stateChanged()},m.prototype.setFillColor=function(A){this.fillColor=A,this.visual&&le.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},m.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.visual&&le.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},m.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.visual&&le.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},m.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},m.prototype.restoreState=function(A){var G=A;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),z.prototype.restoreState.call(this,A),this.setSize()},m.prototype.scale=function(A,G){z.prototype.scale.call(this,A,G),this.setSize()},m.title="Rectangle marker",m}(xt),wt=function(z){function m(A,G,ee,X){var ve=z.call(this,A,X||'')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=G,ve.currentWidth=ee,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return be(m,z),m.prototype.getUi=function(){var A=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.widths.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.flexGrow="2",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.borderColor=ee===A.currentWidth?A.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){A.setCurrentWidth(ee,X)}),G.appendChild(X);var ve=document.createElement("div");ve.innerText=ee.toString(),ve.style.marginRight="5px",X.appendChild(ve);var Xe=document.createElement("div");Xe.style.minHeight="20px",Xe.style.flexGrow="2",Xe.style.display="flex",Xe.style.alignItems="center";var Me=document.createElement("hr");Me.style.minWidth="20px",Me.style.border="0px",Me.style.borderTop=ee+"px solid "+A.uiStyleSettings.toolboxColor,Me.style.flexGrow="2",Xe.appendChild(Me),X.appendChild(Xe),A.widthBoxes.push(X)}),G},m.prototype.setCurrentWidth=function(A,G){var ee=this;this.currentWidth=A,this.widthBoxes.forEach(function(X){X.style.borderColor=X===G?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},m}(pt),Et=function(z){function m(A,G,ee,X){var ve=z.call(this,A,X||'')||this;return ve.styles=[],ve.styleBoxes=[],ve.styles=G,ve.currentStyle=ee,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return be(m,z),m.prototype.getUi=function(){var A=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.styles.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.overflow="hidden",X.style.maxWidth=100/A.styles.length-5+"%",X.style.borderColor=ee===A.currentStyle?A.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){A.setCurrentStyle(ee,X)}),G.appendChild(X);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var Xe=` `;ve.innerHTML=Xe,X.appendChild(ve),A.styleBoxes.push(X)}),G},m.prototype.setCurrentStyle=function(A,G){var ee=this;this.currentStyle=A,this.styleBoxes.forEach(function(X){X.style.borderColor=X===G?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},m}(pt),Te=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new at("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Et("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return be(m,z),Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=m.typeName,A},m.typeName="FrameMarker",m.title="Frame marker",m.icon='',m}(yt),xe=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},ze=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.x1=0,X.y1=0,X.x2=0,X.y2=0,X.defaultLength=50,X.manipulationStartX=0,X.manipulationStartY=0,X.manipulationStartX1=0,X.manipulationStartY1=0,X.manipulationStartX2=0,X.manipulationStartY2=0,X.setupControlBox(),X}return be(m,z),m.prototype.ownsTarget=function(A){return!!z.prototype.ownsTarget.call(this,A)||!(!this.grip1.ownsTarget(A)&&!this.grip2.ownsTarget(A))},m.prototype.pointerDown=function(A,G){z.prototype.pointerDown.call(this,A,G),this.manipulationStartX=A.x,this.manipulationStartY=A.y,this.state==="new"&&(this.x1=A.x,this.y1=A.y,this.x2=A.x,this.y2=A.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(G)?this.activeGrip=this.grip1:this.grip2.ownsTarget(G)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},m.prototype.pointerUp=function(A){var G=this.state;z.prototype.pointerUp.call(this,A),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(A),this._state="select",G==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},m.prototype.adjustVisual=function(){},m.prototype.manipulate=function(A){this.state==="creating"?this.resize(A):this.state==="move"?(this.x1=this.manipulationStartX1+A.x-this.manipulationStartX,this.y1=this.manipulationStartY1+A.y-this.manipulationStartY,this.x2=this.manipulationStartX2+A.x-this.manipulationStartX,this.y2=this.manipulationStartY2+A.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(A)},m.prototype.resize=function(A){switch(this.activeGrip){case this.grip1:this.x1=A.x,this.y1=A.y;break;case this.grip2:case void 0:this.x2=A.x,this.y2=A.y}this.adjustVisual(),this.adjustControlBox()},m.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},m.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},m.prototype.setupControlBox=function(){this.controlBox=le.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},m.prototype.adjustControlBox=function(){this.positionGrips()},m.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},m.prototype.createGrip=function(){var A=new Rt;return A.visual.transform.baseVal.appendItem(le.createTransform()),this.controlBox.appendChild(A.visual),A},m.prototype.positionGrips=function(){var A=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-A/2,this.y1-A/2),this.positionGrip(this.grip2.visual,this.x2-A/2,this.y2-A/2)},m.prototype.positionGrip=function(A,G,ee){var X=A.transform.baseVal.getItem(0);X.setTranslate(G,ee),A.transform.baseVal.replaceItem(X,0)},m.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},m.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var G=A;this.x1=G.x1,this.y1=G.y1,this.x2=G.x2,this.y2=G.y2},m.prototype.scale=function(A,G){z.prototype.scale.call(this,A,G),this.x1=this.x1*A,this.y1=this.y1*G,this.x2=this.x2*A,this.y2=this.y2*G,this.adjustVisual(),this.adjustControlBox()},m}(Qe),Ve=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.setStrokeColor=X.setStrokeColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new at("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Et("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return be(m,z),m.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorLine&&A!==this.visibleLine)},m.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorLine=le.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=le.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)},m.prototype.pointerDown=function(A,G){z.prototype.pointerDown.call(this,A,G),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},m.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()),le.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},m.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},m.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},m.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual(),this.stateChanged()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return A.typeName=m.typeName,A},m.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var G=A;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.createVisual(),this.adjustVisual()},m.typeName="LineMarker",m.title="Line marker",m.icon='',m}(ze),De=function(z){function m(A,G,ee,X){var ve=z.call(this,A,X||'')||this;return ve.fonts=[],ve.fontBoxes=[],ve.fonts=G,ve.currentFont=ee,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return be(m,z),m.prototype.getUi=function(){var A=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.flexGrow="2",this.fonts.forEach(function(ee){var X=document.createElement("div");X.style.display="inline-block",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.overflow="hidden",X.style.maxWidth=100/A.fonts.length-5+"%",X.style.borderColor=ee===A.currentFont?A.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){A.setCurrentFont(ee,X)}),G.appendChild(X);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=ee,ve.style.overflow="hidden";var Xe=document.createElement("div");Xe.style.whiteSpace="nowrap",Xe.style.overflow="hidden",Xe.style.textOverflow="ellipsis",Xe.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(Xe),X.appendChild(ve),A.fontBoxes.push(X)}),G},m.prototype.setCurrentFont=function(A,G){var ee=this;this.currentFont=A,this.fontBoxes.forEach(function(X){X.style.borderColor=X===G?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},m}(pt),We=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.color="transparent",X.padding=5,X.DEFAULT_TEXT="your text here",X.text=X.DEFAULT_TEXT,X.isMoved=!1,X.color=ee.defaultColor,X.fontFamily=ee.defaultFontFamily,X.defaultSize={x:100,y:30},X.setColor=X.setColor.bind(X),X.setFont=X.setFont.bind(X),X.renderText=X.renderText.bind(X),X.sizeText=X.sizeText.bind(X),X.textEditDivClicked=X.textEditDivClicked.bind(X),X.showTextEditor=X.showTextEditor.bind(X),X.setSize=X.setSize.bind(X),X.positionTextEditor=X.positionTextEditor.bind(X),X.colorPanel=new at("Color",ee.defaultColorSet,ee.defaultColor),X.colorPanel.onColorChanged=X.setColor,X.fontFamilyPanel=new De("Font",ee.defaultFontFamilies,ee.defaultFontFamily),X.fontFamilyPanel.onFontChanged=X.setFont,X}return be(m,z),m.prototype.ownsTarget=function(A){if(z.prototype.ownsTarget.call(this,A)||A===this.visual||A===this.textElement||A===this.bgRectangle)return!0;var G=!1;return this.textElement.childNodes.forEach(function(ee){ee===A&&(G=!0)}),G},m.prototype.createVisual=function(){this.visual=le.createGroup(),this.bgRectangle=le.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=le.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.textElement.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},m.prototype.pointerDown=function(A,G){z.prototype.pointerDown.call(this,A,G),this.isMoved=!1,this.pointerDownPoint=A,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(A),this._state="creating")},m.prototype.renderText=function(){var A=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(G){A.textElement.appendChild(le.createTSpan(G.trim()===""?" ":G.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},m.prototype.getTextScale=function(){var A=this.textElement.getBBox(),G=1;if(A.width>0&&A.height>0){var ee=(1*this.width-this.width*this.padding*2/100)/A.width,X=(1*this.height-this.height*this.padding*2/100)/A.height;G=Math.min(ee,X)}return G},m.prototype.getTextPosition=function(A){var G=this.textElement.getBBox(),ee=0,X=0;return G.width>0&&G.height>0&&(ee=(this.width-G.width*A)/2,X=this.height/2-G.height*A/2),{x:ee,y:X}},m.prototype.sizeText=function(){var A=this.textElement.getBBox(),G=this.getTextScale(),ee=this.getTextPosition(G);ee.y-=A.y*G,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+ee.x+"px, "+ee.y+"px) scale("+G+", "+G+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(ee.x,ee.y),this.textElement.transform.baseVal.getItem(1).setScale(G,G))},m.prototype.manipulate=function(A){z.prototype.manipulate.call(this,A),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(A.x-this.pointerDownPoint.x)>5||Math.abs(A.y-this.pointerDownPoint.y)>5)},m.prototype.resize=function(A){z.prototype.resize.call(this,A),this.isMoved=!0,this.setSize(),this.sizeText()},m.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},m.prototype.pointerUp=function(A){var G=this.state;G==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,A),this.setSize(),(G==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},m.prototype.showTextEditor=function(){var A=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(G){G.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var G=Number.parseFloat(A.textEditor.style.fontSize);A.textEditor.clientWidth>=Number.parseInt(A.textEditor.style.maxWidth)&&G>.9;)G-=.1,A.textEditor.style.fontSize=Math.max(G,.9)+"em"}),this.textEditor.addEventListener("keyup",function(G){G.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(G){if(G.clipboardData){var ee=G.clipboardData.getData("text"),X=window.getSelection();if(!X.rangeCount)return!1;X.deleteFromDocument(),X.getRangeAt(0).insertNode(document.createTextNode(ee)),G.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){A.textEditDivClicked(A.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},m.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var A=this.getTextScale(),G=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),ee=this.textElement.getBBox(),X={x:ee.width*A,y:ee.height*A};G.x-=X.x/2,G.y-=X.y/2,this.textEditor.style.top=G.y+"px",this.textEditor.style.left=G.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-G.x+"px",this.textEditor.style.fontSize=Math.max(16*A,12)+"px",this.textElement.style.display="none"}},m.prototype.textEditDivClicked=function(A){this.text=A.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},m.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},m.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},m.prototype.dblClick=function(A,G){z.prototype.dblClick.call(this,A,G),this.showTextEditor()},m.prototype.setColor=function(A){this.textElement&&le.setAttributes(this.textElement,[["fill",A]]),this.color=A,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(A)},m.prototype.setFont=function(A){this.textElement&&le.setAttributes(this.textElement,[["font-family",A]]),this.fontFamily=A,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},m.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},m.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return A.typeName=m.typeName,A},m.prototype.restoreState=function(A){var G=A;this.color=G.color,this.fontFamily=G.fontFamily,this.padding=G.padding,this.text=G.text,this.createVisual(),z.prototype.restoreState.call(this,A),this.setSize()},m.prototype.scale=function(A,G){z.prototype.scale.call(this,A,G),this.setSize(),this.sizeText(),this.positionTextEditor()},m.typeName="TextMarker",m.title="Text marker",m.icon='',m}(xt),ge=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.color="transparent",X.lineWidth=3,X.drawing=!1,X.pixelRatio=1,X.color=ee.defaultColor,X.lineWidth=ee.defaultStrokeWidth,X.pixelRatio=ee.freehandPixelRatio,X.setColor=X.setColor.bind(X),X.addCanvas=X.addCanvas.bind(X),X.finishCreation=X.finishCreation.bind(X),X.setLineWidth=X.setLineWidth.bind(X),X.colorPanel=new at("Color",ee.defaultColorSet,ee.defaultColor),X.colorPanel.onColorChanged=X.setColor,X.lineWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.lineWidthPanel.onWidthChanged=X.setLineWidth,X}return be(m,z),m.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.drawingImage)},m.prototype.createVisual=function(){this.visual=le.createGroup(),this.drawingImage=le.createImage(),this.visual.appendChild(this.drawingImage);var A=le.createTransform();this.visual.transform.baseVal.appendItem(A),this.addMarkerVisualToContainer(this.visual)},m.prototype.pointerDown=function(A,G){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(A.x,A.y),this.drawing=!0):z.prototype.pointerDown.call(this,A,G)},m.prototype.manipulate=function(A){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(A.x,A.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,A)},m.prototype.resize=function(A){z.prototype.resize.call(this,A),le.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},m.prototype.pointerUp=function(A){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,A)},m.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)},m.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},m.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},m.prototype.finishCreation=function(){for(var A=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),G=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],ee=G[0],X=G[1],ve=G[2],Xe=G[3],Me=!1,At=0;At0&&(Me=!0,AtXe&&(Xe=At),qe>ve&&(ve=qe));if(Me){this.left=ee/this.pixelRatio,this.top=X/this.pixelRatio,this.width=(ve-ee)/this.pixelRatio,this.height=(Xe-X)/this.pixelRatio;var Bt=document.createElement("canvas");Bt.width=ve-ee,Bt.height=Xe-X,Bt.getContext("2d").putImageData(this.canvasContext.getImageData(ee,X,ve-ee,Xe-X),0,0),this.drawingImgUrl=Bt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},m.prototype.setDrawingImage=function(){le.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),le.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},m.prototype.setColor=function(A){this.color=A,this.colorChanged(A)},m.prototype.setLineWidth=function(A){this.lineWidth=A},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return A.typeName=m.typeName,A},m.prototype.restoreState=function(A){this.createVisual(),z.prototype.restoreState.call(this,A),this.drawingImgUrl=A.drawingImgUrl,this.setDrawingImage()},m.prototype.scale=function(A,G){z.prototype.scale.call(this,A,G),this.setDrawingImage()},m.typeName="FreehandMarker",m.title="Freehand marker",m.icon='',m}(xt),de=function(z){function m(A,G,ee){var X=z.call(this,A,ee||'')||this;return X.typeBoxes=[],X.currentType=G,X.setCurrentType=X.setCurrentType.bind(X),X}return be(m,z),m.prototype.getUi=function(){var A=this,G=document.createElement("div");G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2";for(var ee=function(Xe){var Me="both";switch(Xe){case 0:Me="both";break;case 1:Me="start";break;case 2:Me="end";break;case 3:Me="none"}var At=document.createElement("div");if(At.style.display="flex",At.style.flexGrow="2",At.style.alignItems="center",At.style.justifyContent="space-between",At.style.padding="5px",At.style.borderWidth="2px",At.style.borderStyle="solid",At.style.borderColor=Me===X.currentType?X.uiStyleSettings.toolboxAccentColor:"transparent",At.addEventListener("click",function(){A.setCurrentType(Me,At)}),G.appendChild(At),Me==="both"||Me==="start"){var qe=document.createElement("div");qe.style.display="flex",qe.style.alignItems="center",qe.style.minHeight="20px",qe.innerHTML=` `,qe.style.marginLeft="5px",At.appendChild(qe)}var Bt=document.createElement("div");Bt.style.display="flex",Bt.style.alignItems="center",Bt.style.minHeight="20px",Bt.style.flexGrow="2";var Ft=document.createElement("hr");if(Ft.style.minWidth="20px",Ft.style.border="0px",Ft.style.borderTop="3px solid "+(X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxColor:"#eeeeee"),Ft.style.flexGrow="2",Bt.appendChild(Ft),At.appendChild(Bt),Me==="both"||Me==="end"){var tn=document.createElement("div");tn.style.display="flex",tn.style.alignItems="center",tn.style.minHeight="20px",tn.innerHTML=` `,tn.style.marginRight="5px",At.appendChild(tn)}X.typeBoxes.push(At)},X=this,ve=0;ve<4;ve++)ee(ve);return G},m.prototype.setCurrentType=function(A,G){var ee=this;this.currentType=A,this.typeBoxes.forEach(function(X){X.style.borderColor=X===G?ee.uiStyleSettings!==void 0?ee.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},m}(pt),ce=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.arrowType="end",X.arrowBaseHeight=10,X.arrowBaseWidth=10,X.getArrowPoints=X.getArrowPoints.bind(X),X.setArrowType=X.setArrowType.bind(X),X.arrowTypePanel=new de("Arrow type","end"),X.arrowTypePanel.onArrowTypeChanged=X.setArrowType,X}return be(m,z),m.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.arrow1&&A!==this.arrow2)},m.prototype.getArrowPoints=function(A,G){var ee=this.arrowBaseWidth+2*this.strokeWidth,X=this.arrowBaseHeight+2*this.strokeWidth;return A-ee/2+","+(G+X/2)+" "+A+","+(G-X/2)+" "+(A+ee/2)+","+(G+X/2)},m.prototype.createTips=function(){this.arrow1=le.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=le.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(le.createTransform()),this.visual.appendChild(this.arrow2)},m.prototype.pointerDown=function(A,G){z.prototype.pointerDown.call(this,A,G),this.state==="creating"&&this.createTips()},m.prototype.adjustVisual=function(){if(z.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",le.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),le.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.arrow1.transform.baseVal.getItem(0);G.setRotate(A,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(G,0);var ee=this.arrow2.transform.baseVal.getItem(0);ee.setRotate(A+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(ee,0)}},m.prototype.setArrowType=function(A){this.arrowType=A,this.adjustVisual(),this.stateChanged()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return A.typeName=m.typeName,A},m.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var G=A;this.arrowType=G.arrowType,this.createTips(),this.adjustVisual()},m.typeName="ArrowMarker",m.title="Arrow marker",m.icon='',m}(Ve),ne=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.fillColor=ee.defaultFillColor,X.strokeWidth=0,X.fillPanel=new at("Color",ee.defaultColorSet,ee.defaultFillColor),X.fillPanel.onColorChanged=X.setFillColor,X}return be(m,z),Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=m.typeName,A},m.typeName="CoverMarker",m.title="Cover marker",m.icon='',m}(yt),ie=function(z){function m(A,G,ee,X){var ve=z.call(this,A,X||'')||this;return ve.opacities=[],ve.opacityBoxes=[],ve.opacities=G,ve.currentOpacity=ee,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return be(m,z),m.prototype.getUi=function(){var A=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",G.style.justifyContent="space-between",this.opacities.forEach(function(ee){var X=document.createElement("div");X.style.display="flex",X.style.alignItems="center",X.style.justifyContent="center",X.style.padding="5px",X.style.borderWidth="2px",X.style.borderStyle="solid",X.style.borderColor=ee===A.currentOpacity?A.uiStyleSettings.toolboxAccentColor:"transparent",X.addEventListener("click",function(){A.setCurrentOpacity(ee,X)}),G.appendChild(X);var ve=document.createElement("div");ve.innerText=100*ee+"%",X.appendChild(ve),A.opacityBoxes.push(X)}),G},m.prototype.setCurrentOpacity=function(A,G){var ee=this;this.currentOpacity=A,this.opacityBoxes.forEach(function(X){X.style.borderColor=X===G?ee.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},m}(pt),oe=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.setOpacity=X.setOpacity.bind(X),X.fillColor=ee.defaultHighlightColor,X.strokeWidth=0,X.opacity=ee.defaultHighlightOpacity,X.fillPanel=new at("Color",ee.defaultColorSet,X.fillColor),X.fillPanel.onColorChanged=X.setFillColor,X.opacityPanel=new ie("Opacity",ee.defaultOpacitySteps,X.opacity),X.opacityPanel.onOpacityChanged=X.setOpacity,X}return be(m,z),m.prototype.setOpacity=function(A){this.opacity=A,this.visual&&le.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=m.typeName,A},m.typeName="HighlightMarker",m.title="Highlight marker",m.icon='',m}(ne),ue='',we=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.bgColor="transparent",X.tipPosition={x:0,y:0},X.tipBase1Position={x:0,y:0},X.tipBase2Position={x:0,y:0},X.tipMoving=!1,X.color=ee.defaultStrokeColor,X.bgColor=ee.defaultFillColor,X.fontFamily=ee.defaultFontFamily,X.defaultSize={x:100,y:30},X.setBgColor=X.setBgColor.bind(X),X.getTipPoints=X.getTipPoints.bind(X),X.positionTip=X.positionTip.bind(X),X.setTipPoints=X.setTipPoints.bind(X),X.colorPanel=new at("Text color",ee.defaultColorSet,X.color,''),X.colorPanel.onColorChanged=X.setColor,X.bgColorPanel=new at("Fill color",ee.defaultColorSet,X.bgColor,ue),X.bgColorPanel.onColorChanged=X.setBgColor,X.fontFamilyPanel=new De("Font",ee.defaultFontFamilies,ee.defaultFontFamily),X.fontFamilyPanel.onFontChanged=X.setFont,X.tipGrip=new Rt,X.tipGrip.visual.transform.baseVal.appendItem(le.createTransform()),X.controlBox.appendChild(X.tipGrip.visual),X}return be(m,z),m.prototype.ownsTarget=function(A){return z.prototype.ownsTarget.call(this,A)||this.tipGrip.ownsTarget(A)||this.tip===A},m.prototype.createTip=function(){le.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=le.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},m.prototype.pointerDown=function(A,G){this.state==="new"&&z.prototype.pointerDown.call(this,A,G),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(G)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,A,G)},m.prototype.pointerUp=function(A){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,A);else{var G=this.state==="creating";z.prototype.pointerUp.call(this,A),this.setTipPoints(G),this.positionTip()}},m.prototype.manipulate=function(A){if(this.tipMoving){var G=this.unrotatePoint(A);this.tipPosition={x:G.x-this.manipulationStartLeft,y:G.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,A)},m.prototype.setBgColor=function(A){this.bgRectangle&&this.tip&&(le.setAttributes(this.bgRectangle,[["fill",A]]),le.setAttributes(this.tip,[["fill",A]])),this.bgColor=A,this.fillColorChanged(A)},m.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},m.prototype.setTipPoints=function(A){A===void 0&&(A=!1);var G=Math.min(this.height/2,15),ee=this.height/5;A&&(this.tipPosition={x:G+ee/2,y:this.height+20});var X=Math.atan(this.height/2/(this.width/2));this.tipPosition.x=this.width/2&&this.tipPosition.y=this.width/2&&this.tipPosition.y>=this.height/2?X.1)){var A=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.tip1.transform.baseVal.getItem(0);G.setRotate(A,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(G,0);var ee=this.tip2.transform.baseVal.getItem(0);ee.setRotate(A+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(ee,0)}},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=m.typeName,A},m.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A),this.createTips(),this.adjustVisual()},m.typeName="MeasurementMarker",m.title="Measurement marker",m.icon='',m}(Ve),bt=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.strokePanel.colors=ee.defaultColorSet,X.fillColor="transparent",X}return be(m,z),Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=z.prototype.getState.call(this);return A.typeName=m.typeName,A},m.typeName="EllipseFrameMarker",m.title="Ellipse frame marker",m.icon='',m}(ke),It=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(m){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(m)||(this.undoStack.push(m),JSON.stringify(this.lastRedoStep)!==JSON.stringify(m)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(m){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=m)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var m=this.undoStack.pop();return m!==void 0&&this.redoStack.push(m),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),Ge=function(z){function m(A,G,ee){var X=z.call(this,A,G,ee)||this;return X.strokeColor="transparent",X.strokeWidth=0,X.strokeDasharray="",X.curveX=0,X.curveY=0,X.manipulationStartCurveX=0,X.manipulationStartCurveY=0,X.setStrokeColor=X.setStrokeColor.bind(X),X.setStrokeWidth=X.setStrokeWidth.bind(X),X.setStrokeDasharray=X.setStrokeDasharray.bind(X),X.positionGrips=X.positionGrips.bind(X),X.addControlGrips=X.addControlGrips.bind(X),X.adjustVisual=X.adjustVisual.bind(X),X.setupControlBox=X.setupControlBox.bind(X),X.resize=X.resize.bind(X),X.strokeColor=ee.defaultColor,X.strokeWidth=ee.defaultStrokeWidth,X.strokeDasharray=ee.defaultStrokeDasharray,X.strokePanel=new at("Line color",ee.defaultColorSet,ee.defaultColor),X.strokePanel.onColorChanged=X.setStrokeColor,X.strokeWidthPanel=new wt("Line width",ee.defaultStrokeWidths,ee.defaultStrokeWidth),X.strokeWidthPanel.onWidthChanged=X.setStrokeWidth,X.strokeStylePanel=new Et("Line style",ee.defaultStrokeDasharrays,ee.defaultStrokeDasharray),X.strokeStylePanel.onStyleChanged=X.setStrokeDasharray,X}return be(m,z),m.prototype.ownsTarget=function(A){return!(!z.prototype.ownsTarget.call(this,A)&&A!==this.visual&&A!==this.selectorCurve&&A!==this.visibleCurve&&!this.curveGrip.ownsTarget(A))},m.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},m.prototype.createVisual=function(){this.visual=le.createGroup(),this.selectorCurve=le.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=le.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)},m.prototype.pointerDown=function(A,G){z.prototype.pointerDown.call(this,A,G),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=A.x,this.curveY=A.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(G)&&(this.activeGrip=this.curveGrip,this._state="resize")},m.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),le.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),le.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),le.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},m.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=le.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=le.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)},m.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},m.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var A=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-A/2,this.curveY-A/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()))},m.prototype.manipulate=function(A){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+A.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+A.y-this.manipulationStartY),z.prototype.manipulate.call(this,A)},m.prototype.resize=function(A){this.activeGrip===this.curveGrip&&(this.curveX=A.x,this.curveY=A.y),z.prototype.resize.call(this,A),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},m.prototype.setStrokeColor=function(A){this.strokeColor=A,this.adjustVisual(),this.colorChanged(A)},m.prototype.setStrokeWidth=function(A){this.strokeWidth=A,this.adjustVisual()},m.prototype.setStrokeDasharray=function(A){this.strokeDasharray=A,this.adjustVisual()},m.prototype.scale=function(A,G){this.curveX=this.curveX*A,this.curveY=this.curveY*G,z.prototype.scale.call(this,A,G)},Object.defineProperty(m.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),m.prototype.getState=function(){var A=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return A.typeName=m.typeName,A},m.prototype.restoreState=function(A){z.prototype.restoreState.call(this,A);var G=A;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.curveX=G.curveX,this.curveY=G.curveY,this.createVisual(),this.adjustVisual()},m.typeName="CurveMarker",m.title="Curve marker",m.icon='',m}(ze),it=function(){function z(m,A){A===void 0&&(A=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=m,this.cancelable=A}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),Be=function(z){function m(A,G,ee){var X=z.call(this,A,!1)||this;return X.dataUrl=G,X.state=ee,X}return be(m,z),m}(it),Ue=function(z){function m(A,G,ee){ee===void 0&&(ee=!1);var X=z.call(this,A,ee)||this;return X.marker=G,X}return be(m,z),m}(it),Le=function(){function z(){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 z.prototype.addEventListener=function(m,A){this[m].push(A)},z.prototype.removeEventListener=function(m,A){var G=this[m].indexOf(A);G>-1&&this[m].splice(G,1)},z}(),se=function(){function z(m){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new xe,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 Le,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new nt(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=m,this.targetRoot=document.body,this.width=m.clientWidth,this.height=m.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(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[Te,ge,ce,We,bt,ke,oe,we,Ze,ne,Ve,Ge]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Te,ge,ce,We,ke,oe,we]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Te,ge,ce,We,oe]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(m){var A=this;this._availableMarkerTypes.splice(0),m.forEach(function(G){if(typeof G=="string"){var ee=A.ALL_MARKER_TYPES.find(function(X){return X.typeName===G});ee!==void 0&&A._availableMarkerTypes.push(ee)}else A._availableMarkerTypes.push(G)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(m){this._zoomLevel=m,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),Re.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var m=this;this.styles.styleSheetRoot===void 0&&st.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=st.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(A){return A(new it(m))})},z.prototype.render=function(){return Oe(this,void 0,void 0,function(){var m;return _e(this,function(A){switch(A.label){case 0:return this.setCurrentMarker(),(m=new ot).naturalSize=this.renderAtNaturalSize,m.imageType=this.renderImageType,m.imageQuality=this.renderImageQuality,m.markersOnly=this.renderMarkersOnly,m.width=this.renderWidth,m.height=this.renderHeight,[4,m.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return A.sent(),[4,m.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,A.sent()]}})})},z.prototype.close=function(m){var A=this;if(m===void 0&&(m=!1),this.isOpen){var G=!1;m||this.eventListeners.beforeclose.forEach(function(ee){var X=new it(A,!0);ee(X),X.defaultPrevented&&(G=!0)}),G||(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(ee){return ee(new it(A))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var m,A=[],G=0;Gthis.editorCanvas.clientHeight?this.editorCanvas.clientHeight*m:this.editorCanvas.clientWidth,G=A',m.title="Powered by marker.js",m.style.display="grid",m.style.alignItems="center",m.style.justifyItems="center",m.style.padding="3px",m.style.width="20px",m.style.height="20px",this.logoUI.appendChild(m),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.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")},z.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"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.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 m=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=m+"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 Ye(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-1&&this.markers.splice(this.markers.indexOf(m),1),m.dispose()},z.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())},z.prototype.toolbarButtonClicked=function(m,A){if(m==="marker"&&A!==void 0)this.createNewMarker(A);else if(m==="action")switch(A){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()}},z.prototype.deleteSelectedMarker=function(){var m=this;if(this._currentMarker!==void 0){var A=!1;if(this.eventListeners.markerbeforedelete.forEach(function(ee){var X=new Ue(m,m._currentMarker,!0);ee(X),X.defaultPrevented&&(A=!0)}),!A){var G=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(ee){return ee(new Ue(m,G))})}}},z.prototype.clear=function(){var m=this,A=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var Xe=new Ue(m,void 0,!0);ve(Xe),Xe.defaultPrevented&&(A=!0)}),!A)){this.setCurrentMarker();for(var G=function(ve){var Xe=ee.markers[ve];ee.setCurrentMarker(ee.markers[ve]),ee._currentMarker.dispose(),ee.markerImage.removeChild(ee._currentMarker.container),ee.markers.splice(ee.markers.indexOf(ee._currentMarker),1),ee.eventListeners.markerdelete.forEach(function(Me){return Me(new Ue(m,Xe))})},ee=this,X=this.markers.length-1;X>=0;X--)G(X);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var m;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=(m=this._currentMarker.notes)!==null&&m!==void 0?m:"",this.overlayContainer.appendChild(this.notesArea))},z.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)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var m=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var A=this.getState(),G=this.undoRedoManager.getLastUndoStep();if(!G||G.width===A.width&&G.height===A.height){var ee=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(A),ee1&&this.panTo({x:m.clientX,y:m.clientY}))},z.prototype.onPointerUp=function(m){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(m.clientX,m.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(m){this._currentMarker===void 0||this.notesArea!==void 0||m.key!=="Delete"&&m.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(m,A){var G=this.markerImage.getBoundingClientRect();return{x:(m-G.left)/this.zoomLevel,y:(A-G.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var m=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=m+"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()},z.prototype.addLicenseKey=function(m){Re.addKey(m)},z.prototype.addEventListener=function(m,A){this.eventListeners.addEventListener(m,A)},z.prototype.removeEventListener=function(m,A){this.eventListeners.removeEventListener(m,A)},z.prototype.renderState=function(m){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(m),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var m=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(A){return A(new it(m))}))},z.prototype.blur=function(){var m=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(A){return A(new it(m))}))},z.instanceCounter=0,z}();/* ********************************** 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 pe=function(z,m){return(pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,G){A.__proto__=G}||function(A,G){for(var ee in G)Object.prototype.hasOwnProperty.call(G,ee)&&(A[ee]=G[ee])})(z,m)};function je(z,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");function A(){this.constructor=z}pe(z,m),z.prototype=m===null?Object.create(m):(A.prototype=m.prototype,new A)}function Ie(z,m,A,G){return new(A||(A=Promise))(function(ee,X){function ve(At){try{Me(G.next(At))}catch(qe){X(qe)}}function Xe(At){try{Me(G.throw(At))}catch(qe){X(qe)}}function Me(At){var qe;At.done?ee(At.value):(qe=At.value,qe instanceof A?qe:new A(function(Bt){Bt(qe)})).then(ve,Xe)}Me((G=G.apply(z,m||[])).next())})}function dt(z,m){var A,G,ee,X,ve={label:0,sent:function(){if(1&ee[0])throw ee[1];return ee[1]},trys:[],ops:[]};return X={next:Xe(0),throw:Xe(1),return:Xe(2)},typeof Symbol=="function"&&(X[Symbol.iterator]=function(){return this}),X;function Xe(Me){return function(At){return function(qe){if(A)throw new TypeError("Generator is already executing.");for(;ve;)try{if(A=1,G&&(ee=2&qe[0]?G.return:qe[0]?G.throw||((ee=G.return)&&ee.call(G),0):G.next)&&!(ee=ee.call(G,qe[1])).done)return ee;switch(G=0,ee&&(qe=[2&qe[0],ee.value]),qe[0]){case 0:case 1:ee=qe;break;case 4:return ve.label++,{value:qe[1],done:!1};case 5:ve.label++,G=qe[1],qe=[0];continue;case 7:qe=ve.ops.pop(),ve.trys.pop();continue;default:if(!(ee=ve.trys,(ee=ee.length>0&&ee[ee.length-1])||qe[0]!==6&&qe[0]!==2)){ve=0;continue}if(qe[0]===3&&(!ee||qe[1]>ee[0]&&qe[1]0&&A>0){var G=new xn(m,A),ee=G.ratio>=1?20:G.getHorizontalLength(20),X=G.ratio<1?20:G.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var Xe=Ae.createDefs();ve.appendChild(Xe);var Me=Ae.createElement("clipPath",[["id","text-bg-clip"]]);Xe.appendChild(Me);var At=Ae.createPath(Ae.getHollowRectanglePath((24-ee)/2,(24-X)/2,ee,X,(24-ee)/2+2,(24-X)/2+2,ee-4,X-4));ve.appendChild(At);var qe=Ae.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);qe.appendChild(Ae.createTSpan(m+":"+A)),ve.appendChild(qe);var Bt=qe.getBBox();Ae.setAttributes(qe,[["x",((24-Bt.width)/2).toString()],["y",((24-Bt.height)/2-Bt.y).toString()]]);var Ft=Ae.createPath(Ae.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Bt.width))/2,(24-Math.ceil(Bt.height))/2,Math.ceil(Bt.width),Math.ceil(Bt.height)));return Me.appendChild(Ft),Ae.setAttributes(At,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.outerHTML}return''},z}(),ht=function(z){function m(A,G,ee){var X=z.call(this,A,G)||this;return X.isDropdownOpen=!1,X.onClick=X.dropdownButtonClicked,X.dropdownButtons=ee,X}return je(m,z),m.prototype.setupDropdown=function(){var A=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(G){G.className=A.className,G.colorsClassName=A.colorsClassName,A.dropdownBlock.appendChild(G.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},m.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},m.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},m.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},m.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},m.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},m}(en),St=function(){function z(m,A){this.GRIP_SIZE=10,this.color=m,this.fillColor=A,this.visual=Ae.createGroup(),this.visual.appendChild(Ae.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(Ae.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(m){return m===this.visual||m===this.visual.childNodes[0]||m===this.visual.childNodes[1]},z.prototype.setCenter=function(m,A){this.visual.childNodes.forEach(function(G){return Ae.setAttributes(G,[["cx",m.toString()],["cy",A.toString()]])})},z}(),Xt=function(){function z(m,A,G,ee){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=m,this.canvasHeight=A,this.margin=G,this.container=ee,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(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(m){this._aspectRatio=m,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(m){this._isGridVisible=m,this.gridContainer&&Ae.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(m){this._zoomFactor=m,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var m=this;this.cropShadeElement=Ae.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=Ae.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var A=0;Athis.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-A.height/2),Ae.setAttributes(this.cropRectElement,[["x",A.x.toString()],["y",A.y.toString()],["width",A.width.toString()],["height",A.height.toString()]]);var G=A.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(X,ve){var Xe=A.y+G*(ve+1);Ae.setAttributes(X,[["x1",""+A.x],["y1",""+Xe],["x2",""+(A.x+A.width)],["y2",""+Xe]])});var ee=A.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(X,ve){var Xe=A.x+ee*(ve+1);Ae.setAttributes(X,[["x1",""+Xe],["y1",""+A.y],["x2",""+Xe],["y2",""+(A.y+A.height)]])}),Ae.setAttributes(this.cropShadeElement,[["d",Ae.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,A.x,A.y,A.width,A.height)]]),this.topLeftGrip.setCenter(A.x,A.y),this.topRightGrip.setCenter(A.x+A.width,A.y),this.bottomLeftGrip.setCenter(A.x,A.y+A.height),this.bottomRightGrip.setCenter(A.x+A.width,A.y+A.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.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)},z.prototype.clientToLocalCoordinates=function(m,A){var G=this.container.getBoundingClientRect();return{x:m-G.left+this.margin,y:A-G.top+this.margin}},z.prototype.onPointerDown=function(m){this.container.setPointerCapture(m.pointerId),this.previousPoint=this.clientToLocalCoordinates(m.clientX,m.clientY),this.cropRectElement===m.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(m.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(m.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(m.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(m.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(m){if(this.isMoving)this.move(this.clientToLocalCoordinates(m.clientX,m.clientY));else if(this.activeGrip){var A=this.clientToLocalCoordinates(m.clientX,m.clientY);this.resize(A)}m.preventDefault()},z.prototype.onPointerUp=function(m){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(m.pointerId)},z.prototype.move=function(m){var A=m.x-this.previousPoint.x,G=m.y-this.previousPoint.y;this.zoomFactor!==1&&(A=-A/this.zoomFactor,G=-G/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+A),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+G),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=m},z.prototype.resize=function(m){var A=Object.assign({},this.cropRect),G=m.x-this.previousPoint.x,ee=m.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:A.x+Gthis.canvasWidth*this.zoomFactor&&(G=this.canvasWidth*this.zoomFactor-A.width),A.width+=G}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(A.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(G),A.height=this.aspectRatio.getVerticalLength(A.width)):(A.y+=ee,A.height=this.cropRect.y+this.cropRect.height-A.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?A.height=this.aspectRatio.getVerticalLength(A.width):A.height+=ee}A.width<10&&(A.x=this.cropRect.x,A.width=10),A.height<10&&(A.y=this.cropRect.y,A.height=10),this.previousPoint=m,A.x>=this.margin&&A.y>=this.margin&&A.x-this.margin+A.width<=this.canvasWidth&&A.y-this.margin+A.height<=this.canvasHeight&&(this.cropRect=A,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var m=this.cropRect.x+this.cropRect.width/2,A=this.cropRect.y+this.cropRect.height/2,G=this.aspectRatio.getHorizontalLength(this.cropRect.height),ee=this.aspectRatio.getVerticalLength(this.cropRect.width);G/this.canvasWidththis.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=m-this.cropRect.width/2,this.cropRect.y=A-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)}},z.prototype.getRescaledRect=function(m,A,G,ee,X,ve){var Xe=G/m,Me=ee/A;return{x:(X.x-ve)*Xe+ve,y:(X.y-ve)*Me+ve,width:X.width*Xe,height:X.height*Me}},z.prototype.scaleCanvas=function(m,A){var G=this.getRescaledRect(this.canvasWidth,this.canvasHeight,m,A,this.cropRect,this.margin);this.canvasWidth=m,this.canvasHeight=A,this.onCropChange&&this.onCropChange(G),this.setCropRectangle(G)},z}(),an=function(){function z(m){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=m,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(z.prototype,"angle",{get:function(){return this._angle},set:function(m){this._angle=m,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.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},z.prototype.onPointerDown=function(m){this.controlContainer.setPointerCapture(m.pointerId),this.isDragging=!0,this.previousPoint={x:m.clientX,y:m.clientY}},z.prototype.onPointerMove=function(m){this.isDragging&&(this.onAngleChange&&this.onAngleChange((m.clientX-this.previousPoint.x)/5),this.previousPoint.x=m.clientX)},z.prototype.onPointerUp=function(m){this.isDragging&&this.onAngleChange&&this.onAngleChange((m.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(m.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var m=this.angleLabelText.getBBox();Ae.setAttributes(this.angleLabelElement,[["x",((this.width-m.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var m=this.scaleShape.transform.baseVal.getItem(0);m.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(m,0)}},z.prototype.getVisual=function(){var m=document.createElementNS("http://www.w3.org/2000/svg","svg");m.setAttribute("xmlns","http://www.w3.org/2000/svg"),m.setAttribute("width",this.width+"px"),m.setAttribute("height",this.height+"px"),m.setAttribute("viewBox","0 0 "+this.width+" "+this.height),m.style.flexShrink="0",document.body.appendChild(m);for(var A="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,G=1;G<=this.width/5+10;G++){var ee=G%5==0?this.height/3:this.height/6;A+="h4v"+-ee+"h1v"+ee}A+="v1H0Z",this.scaleShape=Ae.createPath(A);var X=Ae.createTransform();this.scaleShape.transform.baseVal.appendItem(X),m.appendChild(this.scaleShape),this.angleLabelElement=Ae.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=Ae.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=Ae.createTSpan("");return ve.innerHTML="°",this.angleLabelElement.appendChild(ve),m.appendChild(this.angleLabelElement),document.body.removeChild(m),m},z}(),un=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(m,A,G,ee,X,ve,Xe){var Me=this;return new Promise(function(At){var qe=document.createElement("canvas");qe.width=m.width.baseVal.value-2*ee,qe.height=m.height.baseVal.value-2*ee;var Bt=1,Ft=1;Me.naturalSize===!0?(Bt=A.naturalWidth/(m.width.baseVal.value-2*ee)/ve,Ft=A.naturalHeight/(m.height.baseVal.value-2*ee)/Xe,qe.width=A.naturalWidth/ve,qe.height=A.naturalHeight/Xe):Me.width!==void 0&&Me.height!==void 0&&(Bt=Me.width/G.width,Ft=Me.height/G.height,qe.width*=Bt,qe.height*=Ft);var tn=qe.getContext("2d");tn.translate(qe.width/2,qe.height/2),tn.rotate(X*Math.PI/180),tn.scale(ve,Xe),tn.translate(-qe.width/2,-qe.height/2),tn.drawImage(A,0,0,qe.width,qe.height);var zn=document.createElement("canvas");zn.width=G.width*Bt,zn.height=G.height*Ft,zn.getContext("2d").putImageData(tn.getImageData((G.x-ee)*Bt,(G.y-ee)*Ft,G.width*Bt,G.height*Ft),0,0),At(zn.toDataURL(Me.imageType,Me.imageQuality))})},z}(),Je=function(){function z(m){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=z.instanceCounter++,this.styles=new tt(this.instanceNo),this.target=m,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(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(m){this._zoomToCropEnabled=m,m?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(m){this._isGridVisible=m,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(m){this._gridLines=m,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(m){this._rotationAngle=m,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var m;return(m=this._aspectRatio)!==null&&m!==void 0?m:this.aspectRatios[0]},set:function(m){this._aspectRatio=m},enumerable:!1,configurable:!0}),z.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},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(m){m===void 0&&(m=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),m||this.closeEventListeners.forEach(function(A){return A()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(m){this.renderEventListeners.push(m)},z.prototype.removeRenderEventListener=function(m){this.renderEventListeners.indexOf(m)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(m),1)},z.prototype.addCloseEventListener=function(m){this.closeEventListeners.push(m)},z.prototype.removeCloseEventListener=function(m){this.closeEventListeners.indexOf(m)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(m),1)},z.prototype.setupResizeObserver=function(){var m=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){m.resize(m.target.clientWidth,m.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))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var m=1*this.target.clientWidth/this.target.clientHeight,A=this.contentDiv.clientWidth/m>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*m:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,G=A+2*this.CANVAS_MARGINm+this.CANVAS_MARGIN?this.target.offsetTop-(m+this.CANVAS_MARGIN):0;this.coverDiv.style.top=A+"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},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var m=this;this.topToolbar=new Lt,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 A=new hn;A.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(A);var G=[];this.aspectRatios.forEach(function(Ft){var tn=new en(He.getIcon(Ft.horizontal,Ft.vertical),Ft.horizontal===0&&Ft.vertical===0?"FREE":Ft.horizontal+":"+Ft.vertical);tn.onClick=function(){return m.ratioButtonClicked(Ft)},G.push(tn)}),this.aspectRatioButton=new ht(He.getIcon(0,0),"Aspect ratio",G),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,A.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var ee=new en('',"Toggle grid");ee.isActive=this.isGridVisible,ee.onClick=function(){m.isGridVisible=!m.isGridVisible,ee.isActive=m.isGridVisible},A.addButton(ee);var X=new en('',"Zoom to selection");if(X.isActive=this.zoomToCropEnabled,X.onClick=function(){m.zoomToCropEnabled=!m.zoomToCropEnabled,X.isActive=m.zoomToCropEnabled},A.addButton(X),!lt.isLicensed){var ve=new Dt;this.topToolbar.addElementBlock(ve);var Xe=document.createElement("div");Xe.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='',Xe.appendChild(Me),ve.addElement(Xe)}var At=new hn;At.minWidth=3*this.toolbarHeight+"px",At.contentAlign="end",this.topToolbar.addButtonBlock(At);var qe=new en('',"OK");qe.onClick=this.startRenderAndClose,At.addButton(qe),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(qe.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Bt=new en('',"Close");Bt.onClick=this.close,At.addButton(Bt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Bt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var m=this;this.bottomToolbar=new Lt,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 A=new hn;A.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(A);var G=new en('',"Rotate left");G.onClick=this.rotateLeftButtonClicked,A.addButton(G);var ee=new en('',"Rotate right");ee.onClick=this.rotateRightButtonClicked,A.addButton(ee);var X=new Dt;X.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(X),this.straightener=new an("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(At){m.rotateBy(At),m.straightener.angle=m.rotationAngle},X.addElement(this.straightener.getUI());var ve=new hn;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var Xe=new en('',"Flip horizontal");Xe.onClick=this.flipHorizontallyButtonClicked,ve.addButton(Xe);var Me=new en('',"Flip vertical");Me.onClick=this.flipVerticallyButtonClicked,ve.addButton(Me)},z.prototype.ratioButtonClicked=function(m){this.aspectRatio=m,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=He.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new xn(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(m){if(m){var A=this.cropLayer.getRescaledRect(m.width,m.height,this.imageWidth,this.imageHeight,m.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(A),this.cropRectChanged(A),this.flippedHorizontally=m.flippedHorizontally,this.flippedVertically=m.flippedVertically,this.applyFlip(),this.rotationAngle=m.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(m,A){var G=this.cropImage.getBoundingClientRect();return{x:m-G.left,y:A-G.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var m=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=m+"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()},z.prototype.rotateLeftButtonClicked=function(){var m=this.rotationAngle-90;this.rotationAngle%90!=0&&(m+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(m)},z.prototype.rotateRightButtonClicked=function(){var m=this.rotationAngle+90;this.rotationAngle%90!=0&&(m-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(m)},z.prototype.rotateTo=function(m){m=(m=m>180?m-360:m)<=-180?m+360:m,this.rotationAngle=m,this.applyRotation()},z.prototype.rotateBy=function(m){this.rotateTo((this.rotationAngle+m)%360)},z.prototype.applyRotation=function(){var m=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var A=this.editingTargetRotationContainer.transform.baseVal.getItem(0);A.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(A,0);var G=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/G.width,this.imageHeight/G.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=m},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return Ie(this,void 0,void 0,function(){var m,A;return dt(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return m=G.sent(),A=this.getState(),this.renderEventListeners.forEach(function(ee){return ee(m,A)}),this.close(!0),[2]}})})},z.prototype.render=function(){return Ie(this,void 0,void 0,function(){var m;return dt(this,function(A){switch(A.label){case 0:return(m=new un).naturalSize=this.renderAtNaturalSize,m.imageType=this.renderImageType,m.imageQuality=this.renderImageQuality,m.width=this.renderWidth,m.height=this.renderHeight,this.unzoomFromCrop(),Ae.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,m.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 A.sent(),[4,m.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,A.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new gt("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 gt("toolbar_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarBlockStyleClass=this.styles.addClass(new gt("toolbar-block",` display: flex; align-items: center; box-sizing: content-box; `));var m=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new gt("toolbar_button",` display: inline-block; width: `+(this.toolbarHeight-2*m)+`px; height: `+(this.toolbarHeight-2*m)+`px; padding: `+m+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new gt("toolbar_button_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new gt("toolbar_active_button",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; background-color: `+this.styles.settings.toolbarBackgroundActiveColor+` `)),this.styles.addRule(new mt("."+this.toolbarButtonStyleClass.name+" svg",` height: `+this.toolbarHeight/2+`px; `)),this.styles.addRule(new mt("."+this.toolbarButtonStyleColorsClass.name+":hover",` background-color: `+this.styles.settings.toolbarBackgroundHoverColor+` `)),this.toolbarDropdownStyleClass=this.styles.addClass(new gt("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 gt("toolbar_dropdown_colors",` background-color: `+this.styles.settings.toolbarBackgroundColor+`; `)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new gt("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 gt("toolbar_straightener",` display: flex; overflow: hidden; justify-content: center; height: `+(this.toolbarHeight-2*m)+`px; padding: `+m+`px; cursor: default; user-select: none; box-sizing: content-box; `)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new gt("toolbar_straightener_colors",` color: `+this.styles.settings.toolbarColor+`; fill: currentColor; `))},z.instanceCounter=0,z}(),ft=j("8hTe"),kt=j.n(ft),vn=/]*>/g;function Gt(z){var m=document.createElement("div");return m.innerHTML=z,m.childNodes.length===0?"":m.childNodes[0].nodeValue}var Zt=Ce.a=function(z){var m=z.value,A=m===void 0?"":m,G=z.edit,ee=G===void 0?!1:G,X=z.className,ve=z.showTextOnly,Xe=z.showLines,Me=z.replaces,At=z.zoomImg,qe=z.hasMask,Bt=z.style,Ft=Bt===void 0?{}:Bt,tn=z.stylesPrev,zn=tn===void 0?{}:tn,Wn=String(A),$t=Object(L.useRef)(),yn=Object(L.useRef)(),Mn=Object(L.useState)(""),bn=Object(U.a)(Mn,2),fn=bn[0],Sn=bn[1],Tn=Object(L.useState)("office"),Hn=Object(U.a)(Tn,2),Gn=Hn[0],er=Hn[1],Dn=function(){var nn=new Je(yn.current);nn.displayMode="popup",nn.addRenderEventListener(function(){var Pn=Object(x.a)(E.a.mark(function dn(kn){var gn;return E.a.wrap(function(Un){for(;;)switch(Un.prev=Un.next){case 0:return $t.current.style.display="none",Un.next=3,Object(Se.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:kn}});case 3:gn=Un.sent,gn!=null&&gn.id&&Me(yn.current.getAttribute("src").replace(re.a.API_SERVER,""),"/api/attachments/".concat(gn==null?void 0:gn.id,"?type=").concat(gn.content_type));case 5:case"end":return Un.stop()}},dn)}));return function(dn){return Pn.apply(this,arguments)}}()),nn.show()},Or=function(){var nn=new se(yn.current);nn.settings.displayMode="popup",nn.addEventListener("render",function(){var Pn=Object(x.a)(E.a.mark(function dn(kn){var gn;return E.a.wrap(function(Un){for(;;)switch(Un.prev=Un.next){case 0:if($t.current.style.display="none",!yn.current){Un.next=6;break}return Un.next=4,Object(Se.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:kn.dataUrl}});case 4:gn=Un.sent,gn!=null&&gn.id&&Me(yn.current.getAttribute("src").replace(re.a.API_SERVER,""),"/api/attachments/".concat(gn==null?void 0:gn.id,"?type=").concat(gn.content_type));case 6:case"end":return Un.stop()}},dn)}));return function(dn){return Pn.apply(this,arguments)}}()),nn.show(),window.markerArea=nn},on=Object(L.useMemo)(function(){try{var pn=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,nn=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Pn=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Wn=Wn.replace(pn,"("+re.a.API_SERVER+"/api/attachments/").replace(nn,'"'+re.a.API_SERVER+"/api/attachments/").replace(Pn,'"'+re.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,` `),Wn=Wn.replace(new RegExp("(?[TOC]

    ",D()),w()),dn=dn.replace(/(__special_katext_id_\d+__)/g,function(Er,Un){var Bn=kn[Un],tr=Bn.type,cr=Bn.expression;return Object(ae.renderToString)(Gt(cr)||"",{displayMode:tr==="block",throwOnError:!1,output:"html"})}),dn=dn.replace(/▁/g,"\u2581\u2581\u2581"),C(),ve){var gn=document.createElement("div");return gn.innerHTML=dn,gn.innerText}return setTimeout(function(){return yr()},500),dn},[Wn]),Yn=Object(L.useRef)();b.WebkitLineClamp=Xe,Xe&&(Ft=Object(I.a)(Object(I.a)({},Ft),b));function Ar(pn){var nn=pn.target;if(nn.tagName.toUpperCase()==="IMG"){if(At){var Pn=nn.getAttribute("src");Sn(Pn),er("image")}}else if(nn.tagName.toUpperCase()==="A"){var dn=nn.getAttribute("href");if(dn.indexOf("office")>-1)pn.preventDefault(),Sn(dn),er("office");else if(dn.indexOf("application/pdf")>-1)pn.preventDefault(),Sn(dn),er("pdf");else if(dn.indexOf("type=text")>-1)pn.preventDefault(),Sn(dn),er("html");else if(dn.startsWith("#")){pn.preventDefault();var kn=document.getElementById(dn.replace("#",""));kn&&kn.scrollIntoView(!0)}}}var yr=function(){var nn,Pn=(nn=Yn.current)===null||nn===void 0?void 0:nn.querySelectorAll("video");Pn==null||Pn.forEach(function(dn){if(dn.oncontextmenu=function(){return!1},dn.src.indexOf(".m3u8")>-1&&!dn.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var kn=new $.a;kn.loadSource(dn.src),kn.attachMedia(dn)}}})};Object(L.useEffect)(function(){if(Yn.current&&on&&(on.match(vn)&&window.PR.prettyPrint()),Yn.current)return Yn.current.addEventListener("click",Ar),function(){Yn.current.removeEventListener("click",Ar),C(),w()}},[on,Yn.current,Ar]);var br=function(nn){if(!ee)return;nn.target.nodeName==="IMG"?($t.current.style.display="flex",$t.current.style.width=nn.target.clientWidth+"px",$t.current.style.height=nn.target.clientHeight+"px",$t.current.style.top=nn.target.offsetTop+"px",$t.current.style.left=nn.target.offsetLeft+"px",yn.current.src=nn.target.getAttribute("src")):$t.current.style.display="none"};return c.a.createElement("div",{style:{position:"relative"}},c.a.createElement("div",{ref:Yn,style:Object(I.a)({},Ft),className:"".concat(X||""," markdown-body ").concat(kt.a.mdBody),onMouseOver:br,dangerouslySetInnerHTML:{__html:on}}),c.a.createElement("div",{ref:$t,className:kt.a.button},c.a.createElement(K.a,null,c.a.createElement(H.a,{onClick:function(){return Dn()}},"\u88C1\u526A"),c.a.createElement(H.a,{onClick:function(){return Or()}},"\u7F16\u8F91"))),c.a.createElement("img",{ref:yn,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),c.a.createElement(he.a,{close:!0,data:fn,hasMask:qe,type:fn!=null&&fn.length?Gn:"",style:Object(I.a)({},zn),onClose:function(){return Sn("")}}))}},"9VGf":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return R});var J=j("q1tI"),K=j.n(J);function R(H,I){var x=Object(J.useRef)();Object(J.useEffect)(function(){x.current=H}),Object(J.useEffect)(function(){function U(){x.current()}if(I!==null){var N=setInterval(U,I);return function(){return clearInterval(N)}}},[I])}},AMnG:function(Fe,Ce,j){"use strict";var J=j("miYZ"),K=j("tsqr"),R=j("tJVT"),H=j("q1tI"),I=j.n(H),x=j("nWbc"),U=j.n(x),N=j("Ot1p");Ce.a=function(E){var L=E.id,c=E.activeDiscussIndex,T=E.onReplyDiscuss,P=Object(H.useState)(""),O=Object(R.a)(P,2),p=O[0],g=O[1];function i(u){g(u)}function a(){if(!p){K.b.info("\u56DE\u590D\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A!");return}T(L,p),g("")}return I.a.createElement("div",{key:L,className:"discuss-item-editor",style:{display:c===L?"block":"none",width:"100%"}},I.a.createElement(N.a,{miniToolbar:!0,startInit:c===L,defaultValue:p,id:L,noStorage:!0,watch:!1,height:155,placeholder:"\u6211\u8981\u56DE\u590D",showResizeBar:!0,onChange:i}),I.a.createElement("a",{onClick:a,className:"btn-send"},"\u53D1\u9001"))}},BU3w:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return x});var J=j("MNnm"),K="rc-util-key";function R(U){if(U.attachTo)return U.attachTo;var N=document.querySelector("head");return N||document.body}function H(U){var N,E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(J.a)())return null;var L=document.createElement("style");if((N=E.csp)===null||N===void 0?void 0:N.nonce){var c;L.nonce=(c=E.csp)===null||c===void 0?void 0:c.nonce}L.innerHTML=U;var T=R(E),P=T.firstChild;return E.prepend&&T.prepend?T.prepend(L):E.prepend&&P?T.insertBefore(L,P):T.appendChild(L),L}var I=new Map;function x(U,N){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=R(E);if(!I.has(L)){var c=H("",E),T=c.parentNode;I.set(L,T),T.removeChild(c)}var P=Array.from(I.get(L).children).find(function(a){return a.tagName==="STYLE"&&a[K]===N});if(P){var O,p;if(((O=E.csp)===null||O===void 0?void 0:O.nonce)&&P.nonce!==((p=E.csp)===null||p===void 0?void 0:p.nonce)){var g;P.nonce=(g=E.csp)===null||g===void 0?void 0:g.nonce}return P.innerHTML!==U&&(P.innerHTML=U),P}var i=H(U,E);return i[K]=N,i}},Bd2K:function(Fe,Ce,j){(function(J){J(j("VrN/"),j("osHv"))})(function(J){J.defineOption("autoCloseTags",!1,function(E,L,c){if(c!=J.Init&&c&&E.removeKeyMap("autoCloseTags"),!L)return;var T={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(T["'/'"]=function(P){return x(P)}),(typeof L!="object"||L.whenOpening!==!1)&&(T["'>'"]=function(P){return H(P)}),E.addKeyMap(T)});var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],R=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function H(E){if(E.getOption("disableInput"))return J.Pass;for(var L=E.listSelections(),c=[],T=E.getOption("autoCloseTags"),P=0;PO.ch&&(u=u.slice(0,u.length-p.end+O.ch));var v=u.toLowerCase();if(!u||p.type=="string"&&(p.end!=O.ch||!/[\"\']/.test(p.string.charAt(p.string.length-1))||p.string.length==1)||p.type=="tag"&&a.close||p.string.indexOf("/")==O.ch-p.start-1||w&&U(w,v)>-1||N(E,g.mode.xmlCurrentContext&&g.mode.xmlCurrentContext(i)||[],u,O,!0))return J.Pass;var D=typeof T=="object"&&T.emptyTags;if(D&&U(D,u)>-1){c[P]={text:"/>",newPos:J.Pos(O.line,O.ch+2)};continue}var S=b&&U(b,v)>-1;c[P]={indent:S,text:">"+(S?` `:"")+"",newPos:S?J.Pos(O.line+1,0):J.Pos(O.line,O.ch+1)}}for(var f=typeof T=="object"&&T.dontIndentOnAutoClose,P=L.length-1;P>=0;P--){var d=c[P];E.replaceRange(d.text,L[P].head,L[P].anchor,"+insert");var o=E.listSelections().slice(0);o[P]={head:d.newPos,anchor:d.newPos},E.setSelections(o),!f&&d.indent&&(E.indentLine(d.newPos.line,null,!0),E.indentLine(d.newPos.line+1,null,!0))}}function I(E,L){for(var c=E.listSelections(),T=[],P=L?"/":""&&(w+=">"),T[g]=w}if(E.replaceSelections(T),c=E.listSelections(),!p)for(var g=0;g=0&&L[i]==c;i--)++g;T=p.to;for(var i=1;i0){for(var L=0;L1&&arguments[1]!==void 0?arguments[1]:"",L=[],c=0;c=0;L--){var c=R().key(L);E(H(c),c)}}function U(E){return R().removeItem(E)}function N(){return R().clear()}},D1Df:function(Fe,Ce,j){"use strict";function J(y){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?J=function(B){return typeof B}:J=function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B},J(y)}function K(){return K=Object.assign||function(y){for(var M=1;M=0)continue;if(!Object.prototype.propertyIsEnumerable.call(y,F))continue;B[F]=y[F]}}return B}function x(y,M){if(y==null)return{};var B={},F=Object.keys(y),Q,V;for(V=0;V=0)continue;B[Q]=y[Q]}return B}function U(y,M){if(!(y instanceof M))throw new TypeError("Cannot call a class as a function")}function N(y,M){for(var B=0;B>6),M+=String.fromCharCode(128|F&63)):F<55296||F>=57344?(M+=String.fromCharCode(224|F>>12),M+=String.fromCharCode(128|F>>6&63),M+=String.fromCharCode(128|F&63)):(B++,F=65536+((F&1023)<<10|y.charCodeAt(B)&1023),M+=String.fromCharCode(240|F>>18),M+=String.fromCharCode(128|F>>12&63),M+=String.fromCharCode(128|F>>6&63),M+=String.fromCharCode(128|F&63))}return M}var w={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},b={},v=4,D=.1;function S(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,B=[];return y.forEach(function(F,Q){var V=null;F.forEach(function(W,$){if(!W&&V!==null){B.push("M".concat(V+M," ").concat(Q+M,"h").concat($-V,"v1H").concat(V+M,"z")),V=null;return}if($===F.length-1){if(!W)return;V===null?B.push("M".concat($+M,",").concat(Q+M," h1v1H").concat($+M,"z")):B.push("M".concat(V+M,",").concat(Q+M," h").concat($+1-V,"v1H").concat(V+M,"z"));return}W&&V===null&&(V=$)})}),B.join("")}function f(y,M){return y.slice().map(function(B,F){return F=M.y+M.h?B:B.map(function(Q,V){return V=M.x+M.w?Q:!1})})}function d(y,M){var B=y.imageSettings,F=y.size,Q=y.includeMargin;if(B==null)return null;var V=Q?v:0,W=M.length+V*2,$=Math.floor(F*D),re=W/F,ae=(B.width||$)*re,he=(B.height||$)*re,Se=B.x==null?M.length/2-ae/2:B.x*re,ye=B.y==null?M.length/2-he/2:B.y*re,be=null;if(B.excavate){var Oe=Math.floor(Se),_e=Math.floor(ye),fe=Math.ceil(ae+Se-Oe),le=Math.ceil(he+ye-_e);be={x:Oe,y:_e,w:fe,h:le}}return{x:Se,y:ye,h:he,w:ae,excavation:be}}var o=function(){try{new Path2D().addPath(new Path2D)}catch(y){return!1}return!0}(),s=function(y){P(M,y);function M(){var B,F;U(this,M);for(var Q=arguments.length,V=new Array(Q),W=0;Wge.length)&&(de=ge.length);for(var ce=0,ne=new Array(de);ce=ge.length?{done:!0}:{done:!1,value:ge[ne++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ce=ge[Symbol.iterator](),ce.next.bind(ce)}function x(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var U=x(function(ge){function de(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ce(ne){ge.exports.defaults=ne}ge.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),N=U.defaults,E=U.getDefaults,L=U.changeDefaults,c=/[&<>"']/,T=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,O=/[<>"']|&(?!#?\w+;)/g,p={"&":"&","<":"<",">":">",'"':""","'":"'"},g=function(de){return p[de]};function i(ge,de){if(de){if(c.test(ge))return ge.replace(T,g)}else if(P.test(ge))return ge.replace(O,g);return ge}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function u(ge){return ge.replace(a,function(de,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var h=/(^|[^\[])\^/g;function w(ge,de){ge=ge.source||ge,de=de||"";var ce={replace:function(ie,oe){return oe=oe.source||oe,oe=oe.replace(h,"$1"),ge=ge.replace(ie,oe),ce},getRegex:function(){return new RegExp(ge,de)}};return ce}var b=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(ge,de,ce){if(ge){var ne;try{ne=decodeURIComponent(u(ce)).replace(b,"").toLowerCase()}catch(ie){return null}if(ne.indexOf("javascript:")===0||ne.indexOf("vbscript:")===0||ne.indexOf("data:")===0)return null}de&&!v.test(ce)&&(ce=s(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(ie){return null}return ce}var S={},f=/^[^:]+:\/*[^/]*$/,d=/^([^:]+:)[\s\S]*$/,o=/^([^:]+:\/*[^/]*)[\s\S]*$/;function s(ge,de){S[" "+ge]||(f.test(ge)?S[" "+ge]=ge+"/":S[" "+ge]=M(ge,"/",!0)),ge=S[" "+ge];var ce=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:ge.replace(d,"$1")+de:de.charAt(0)==="/"?ce?de:ge.replace(o,"$1")+de:ge+de}var _={exec:function(){}};function C(ge){for(var de=1,ce,ne;de=0&&we[Ze]==="\\";)ke=!ke;return ke?"|":" |"}),ne=ce.split(/ \|/),ie=0;if(ne.length>de)ne.splice(de);else for(;ne.length=ne.length?ie.slice(ne.length):ie}).join(` `)}var ye=function(){function ge(ce){this.options=ce||V}var de=ge.prototype;return de.space=function(ne){var ie=this.rules.block.newline.exec(ne);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:` `}},de.code=function(ne,ie){var oe=this.rules.block.code.exec(ne);if(oe){var ue=ie[ie.length-1];if(ue&&ue.type==="paragraph")return{raw:oe[0],text:oe[0].trimRight()};var we=oe[0].replace(/^ {4}/gm,"");return{type:"code",raw:oe[0],codeBlockStyle:"indented",text:this.options.pedantic?we:W(we,` `)}}},de.fences=function(ne){var ie=this.rules.block.fences.exec(ne);if(ie){var oe=ie[0],ue=Se(oe,ie[3]||"");return{type:"code",raw:oe,lang:ie[2]?ie[2].trim():ie[2],text:ue}}},de.heading=function(ne){var ie=this.rules.block.heading.exec(ne);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},de.nptable=function(ne){var ie=this.rules.block.nptable.exec(ne);if(ie){var oe={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(` `):[],raw:ie[0]};if(oe.header.length===oe.align.length){var ue=oe.align.length,we;for(we=0;we ?/gm,"");return{type:"blockquote",raw:ie[0],text:oe}}},de.list=function(ne){var ie=this.rules.block.list.exec(ne);if(ie){for(var oe=ie[0],ue=ie[2],we=ue.length>1,ke=ue[ue.length-1]===")",Ze={type:"list",raw:oe,ordered:we,start:we?+ue.slice(0,-1):"",loose:!1,items:[]},bt=ie[0].match(this.rules.block.item),It=!1,Ge,it,Be,Ue,Le,se,pe,je=bt.length,Ie=0;Ie1||this.options.smartLists&&Be!==ue)&&(Ue=bt.slice(Ie+1).join(` `),Ze.raw=Ze.raw.substring(0,Ze.raw.length-Ue.length),Ie=je-1)),Le=It||/\n\n(?!\s*$)/.test(Ge),Ie!==je-1&&(It=Ge.charAt(Ge.length-1)===` `,Le||(Le=It)),Le&&(Ze.loose=!0),se=/^\[[ xX]\] /.test(Ge),pe=void 0,se&&(pe=Ge[1]!==" ",Ge=Ge.replace(/^\[[ xX]\] +/,"")),Ze.items.push({type:"list_item",raw:oe,task:se,checked:pe,loose:Le,text:Ge});return Ze}},de.html=function(ne){var ie=this.rules.block.html.exec(ne);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):re(ie[0]):ie[0]}},de.def=function(ne){var ie=this.rules.block.def.exec(ne);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var oe=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:oe,raw:ie[0],href:ie[2],title:ie[3]}}},de.table=function(ne){var ie=this.rules.block.table.exec(ne);if(ie){var oe={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(` `):[]};if(oe.header.length===oe.align.length){oe.raw=ie[0];var ue=oe.align.length,we;for(we=0;we/i.test(ue[0])&&(ie=!1),!oe&&/^<(pre|code|kbd|script)(\s|>)/i.test(ue[0])?oe=!0:oe&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ue[0])&&(oe=!1),{type:this.options.sanitize?"text":"html",raw:ue[0],inLink:ie,inRawBlock:oe,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):re(ue[0]):ue[0]}},de.link=function(ne){var ie=this.rules.inline.link.exec(ne);if(ie){var oe=ae(ie[2],"()");if(oe>-1){var ue=ie[0].indexOf("!")===0?5:4,we=ue+ie[1].length+oe;ie[2]=ie[2].substring(0,oe),ie[0]=ie[0].substring(0,we).trim(),ie[3]=""}var ke=ie[2],Ze="";if(this.options.pedantic){var bt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(ke);bt?(ke=bt[1],Ze=bt[3]):Ze=""}else Ze=ie[3]?ie[3].slice(1,-1):"";ke=ke.trim().replace(/^<([\s\S]*)>$/,"$1");var It=he(ie,{href:ke&&ke.replace(this.rules.inline._escapes,"$1"),title:Ze&&Ze.replace(this.rules.inline._escapes,"$1")},ie[0]);return It}},de.reflink=function(ne,ie){var oe;if((oe=this.rules.inline.reflink.exec(ne))||(oe=this.rules.inline.nolink.exec(ne))){var ue=(oe[2]||oe[1]).replace(/\s+/g," ");if(ue=ie[ue.toLowerCase()],!ue||!ue.href){var we=oe[0].charAt(0);return{type:"text",raw:we,text:we}}var ke=he(oe,ue,oe[0]);return ke}},de.strong=function(ne,ie,oe){oe===void 0&&(oe="");var ue=this.rules.inline.strong.start.exec(ne);if(ue&&(!ue[1]||ue[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ie=ie.slice(-1*ne.length);var we=ue[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;we.lastIndex=0;for(var ke;(ue=we.exec(ie))!=null;)if(ke=this.rules.inline.strong.middle.exec(ie.slice(0,ue.index+3)),ke)return{type:"strong",raw:ne.slice(0,ke[0].length),text:ne.slice(2,ke[0].length-2)}}},de.em=function(ne,ie,oe){oe===void 0&&(oe="");var ue=this.rules.inline.em.start.exec(ne);if(ue&&(!ue[1]||ue[1]&&(oe===""||this.rules.inline.punctuation.exec(oe)))){ie=ie.slice(-1*ne.length);var we=ue[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;we.lastIndex=0;for(var ke;(ue=we.exec(ie))!=null;)if(ke=this.rules.inline.em.middle.exec(ie.slice(0,ue.index+2)),ke)return{type:"em",raw:ne.slice(0,ke[0].length),text:ne.slice(1,ke[0].length-1)}}},de.codespan=function(ne){var ie=this.rules.inline.code.exec(ne);if(ie){var oe=ie[2].replace(/\n/g," "),ue=/[^ ]/.test(oe),we=oe.startsWith(" ")&&oe.endsWith(" ");return ue&&we&&(oe=oe.substring(1,oe.length-1)),oe=re(oe,!0),{type:"codespan",raw:ie[0],text:oe}}},de.br=function(ne){var ie=this.rules.inline.br.exec(ne);if(ie)return{type:"br",raw:ie[0]}},de.del=function(ne){var ie=this.rules.inline.del.exec(ne);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},de.autolink=function(ne,ie){var oe=this.rules.inline.autolink.exec(ne);if(oe){var ue,we;return oe[2]==="@"?(ue=re(this.options.mangle?ie(oe[1]):oe[1]),we="mailto:"+ue):(ue=re(oe[1]),we=ue),{type:"link",raw:oe[0],text:ue,href:we,tokens:[{type:"text",raw:ue,text:ue}]}}},de.url=function(ne,ie){var oe;if(oe=this.rules.inline.url.exec(ne)){var ue,we;if(oe[2]==="@")ue=re(this.options.mangle?ie(oe[0]):oe[0]),we="mailto:"+ue;else{var ke;do ke=oe[0],oe[0]=this.rules.inline._backpedal.exec(oe[0])[0];while(ke!==oe[0]);ue=re(oe[0]),oe[1]==="www."?we="http://"+ue:we=ue}return{type:"link",raw:oe[0],text:ue,href:we,tokens:[{type:"text",raw:ue,text:ue}]}}},de.inlineText=function(ne,ie,oe){var ue=this.rules.inline.text.exec(ne);if(ue){var we;return ie?we=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ue[0]):re(ue[0]):ue[0]:we=re(this.options.smartypants?oe(ue[0]):ue[0]),{type:"text",raw:ue[0],text:we}}},ge}(),be=Q.noopTest,Oe=Q.edit,_e=Q.merge,fe={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:be,table:be,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};fe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,fe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,fe.def=Oe(fe.def).replace("label",fe._label).replace("title",fe._title).getRegex(),fe.bullet=/(?:[*+-]|\d{1,9}[.)])/,fe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,fe.item=Oe(fe.item,"gm").replace(/bull/g,fe.bullet).getRegex(),fe.list=Oe(fe.list).replace(/bull/g,fe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+fe.def.source+")").getRegex(),fe._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",fe._comment=//,fe.html=Oe(fe.html,"i").replace("comment",fe._comment).replace("tag",fe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe.paragraph=Oe(fe._paragraph).replace("hr",fe.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.blockquote=Oe(fe.blockquote).replace("paragraph",fe.paragraph).getRegex(),fe.normal=_e({},fe),fe.gfm=_e({},fe.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*|$)"}),fe.gfm.nptable=Oe(fe.gfm.nptable).replace("hr",fe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.gfm.table=Oe(fe.gfm.table).replace("hr",fe.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",fe._tag).getRegex(),fe.pedantic=_e({},fe.normal,{html:Oe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",fe._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:be,paragraph:Oe(fe.normal._paragraph).replace("hr",fe.hr).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",fe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var le={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:be,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:be,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~",le.punctuation=Oe(le.punctuation).replace(/punctuation/g,le._punctuation).getRegex(),le._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",le._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",le.em.start=Oe(le.em.start).replace(/punctuation/g,le._punctuation).getRegex(),le.em.middle=Oe(le.em.middle).replace(/punctuation/g,le._punctuation).replace(/overlapSkip/g,le._overlapSkip).getRegex(),le.em.endAst=Oe(le.em.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.em.endUnd=Oe(le.em.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.start=Oe(le.strong.start).replace(/punctuation/g,le._punctuation).getRegex(),le.strong.middle=Oe(le.strong.middle).replace(/punctuation/g,le._punctuation).replace(/blockSkip/g,le._blockSkip).getRegex(),le.strong.endAst=Oe(le.strong.endAst,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.strong.endUnd=Oe(le.strong.endUnd,"g").replace(/punctuation/g,le._punctuation).getRegex(),le.blockSkip=Oe(le._blockSkip,"g").getRegex(),le.overlapSkip=Oe(le._overlapSkip,"g").getRegex(),le._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,le._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,le._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])?)+(?![-_])/,le.autolink=Oe(le.autolink).replace("scheme",le._scheme).replace("email",le._email).getRegex(),le._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,le.tag=Oe(le.tag).replace("comment",fe._comment).replace("attribute",le._attribute).getRegex(),le._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,le._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,le._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,le.link=Oe(le.link).replace("label",le._label).replace("href",le._href).replace("title",le._title).getRegex(),le.reflink=Oe(le.reflink).replace("label",le._label).getRegex(),le.reflinkSearch=Oe(le.reflinkSearch,"g").replace("reflink",le.reflink).replace("nolink",le.nolink).getRegex(),le.normal=_e({},le),le.pedantic=_e({},le.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:Oe(/^!?\[(label)\]\((.*?)\)/).replace("label",le._label).getRegex(),reflink:Oe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le._label).getRegex()}),le.gfm=_e({},le.normal,{escape:Oe(le.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\.5&&(ne="x"+ne.toString(16)),de+="&#"+ne+";";return de}var Ye=function(){function ge(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||ot,this.options.tokenizer=this.options.tokenizer||new ye,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var ne={block:st.normal,inline:nt.normal};this.options.pedantic?(ne.block=st.pedantic,ne.inline=nt.pedantic):this.options.gfm&&(ne.block=st.gfm,this.options.breaks?ne.inline=nt.breaks:ne.inline=nt.gfm),this.tokenizer.rules=ne}ge.lex=function(ne,ie){var oe=new ge(ie);return oe.lex(ne)};var de=ge.prototype;return de.lex=function(ne){return ne=ne.replace(/\r\n|\r/g,` `).replace(/\t/g," "),this.blockTokens(ne,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(ne,ie,oe){ie===void 0&&(ie=[]),oe===void 0&&(oe=!0),ne=ne.replace(/^ +$/gm,"");for(var ue,we,ke,Ze;ne;){if(ue=this.tokenizer.space(ne)){ne=ne.substring(ue.raw.length),ue.type&&ie.push(ue);continue}if(ue=this.tokenizer.code(ne,ie)){ne=ne.substring(ue.raw.length),ue.type?ie.push(ue):(Ze=ie[ie.length-1],Ze.raw+=` `+ue.raw,Ze.text+=` `+ue.text);continue}if(ue=this.tokenizer.fences(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.heading(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.nptable(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.hr(ne)){ne=ne.substring(ue.raw.length),ie.push(ue);continue}if(ue=this.tokenizer.blockquote(ne)){ne=ne.substring(ue.raw.length),ue.tokens=this.blockTokens(ue.text,[],oe),ie.push(ue);continue}if(ue=this.tokenizer.list(ne)){for(ne=ne.substring(ue.raw.length),ke=ue.items.length,we=0;we0)for(;(bt=this.tokenizer.rules.inline.reflinkSearch.exec(Ze))!=null;)It.includes(bt[0].slice(bt[0].lastIndexOf("[")+1,-1))&&(Ze=Ze.slice(0,bt.index)+"["+"a".repeat(bt[0].length-2)+"]"+Ze.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(bt=this.tokenizer.rules.inline.blockSkip.exec(Ze))!=null;)Ze=Ze.slice(0,bt.index)+"["+"a".repeat(bt[0].length-2)+"]"+Ze.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;ne;){if(ke=this.tokenizer.escape(ne)){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(ke=this.tokenizer.tag(ne,oe,ue)){ne=ne.substring(ke.raw.length),oe=ke.inLink,ue=ke.inRawBlock,ie.push(ke);continue}if(ke=this.tokenizer.link(ne)){ne=ne.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,ue)),ie.push(ke);continue}if(ke=this.tokenizer.reflink(ne,this.tokens.links)){ne=ne.substring(ke.raw.length),ke.type==="link"&&(ke.tokens=this.inlineTokens(ke.text,[],!0,ue)),ie.push(ke);continue}if(ke=this.tokenizer.strong(ne,Ze,we)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],oe,ue),ie.push(ke);continue}if(ke=this.tokenizer.em(ne,Ze,we)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],oe,ue),ie.push(ke);continue}if(ke=this.tokenizer.codespan(ne)){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(ke=this.tokenizer.br(ne)){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(ke=this.tokenizer.del(ne)){ne=ne.substring(ke.raw.length),ke.tokens=this.inlineTokens(ke.text,[],oe,ue),ie.push(ke);continue}if(ke=this.tokenizer.autolink(ne,Ke)){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(!oe&&(ke=this.tokenizer.url(ne,Ke))){ne=ne.substring(ke.raw.length),ie.push(ke);continue}if(ke=this.tokenizer.inlineText(ne,ue,$e)){ne=ne.substring(ke.raw.length),we=ke.raw.slice(-1),ie.push(ke);continue}if(ne){var Ge="Infinite loop on byte: "+ne.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return ie},K(ge,null,[{key:"rules",get:function(){return{block:st,inline:nt}}}]),ge}(),ut=U.defaults,pt=Q.cleanUrl,at=Q.escape,Qe=function(){function ge(ce){this.options=ce||ut}var de=ge.prototype;return de.code=function(ne,ie,oe){var ue=(ie||"").match(/\S*/)[0];if(this.options.highlight){var we=this.options.highlight(ne,ue);we!=null&&we!==ne&&(oe=!0,ne=we)}return ue?'
    '+(oe?ne:at(ne,!0))+`
    `:"
    "+(oe?ne:at(ne,!0))+`
    `},de.blockquote=function(ne){return`
    `+ne+`
    `},de.html=function(ne){return ne},de.heading=function(ne,ie,oe,ue){return this.options.headerIds?"'+ne+" `:""+ne+" `},de.hr=function(){return this.options.xhtml?`
    `:`
    `},de.list=function(ne,ie,oe){var ue=ie?"ol":"ul",we=ie&&oe!==1?' start="'+oe+'"':"";return"<"+ue+we+`> `+ne+" `},de.listitem=function(ne){return"
  • "+ne+`
  • `},de.checkbox=function(ne){return" "},de.paragraph=function(ne){return"

    "+ne+`

    `},de.table=function(ne,ie){return ie&&(ie=""+ie+""),` `+ne+` `+ie+`
    `},de.tablerow=function(ne){return` `+ne+` `},de.tablecell=function(ne,ie){var oe=ie.header?"th":"td",ue=ie.align?"<"+oe+' align="'+ie.align+'">':"<"+oe+">";return ue+ne+" `},de.strong=function(ne){return""+ne+""},de.em=function(ne){return""+ne+""},de.codespan=function(ne){return""+ne+""},de.br=function(){return this.options.xhtml?"
    ":"
    "},de.del=function(ne){return""+ne+""},de.link=function(ne,ie,oe){if(ne=pt(this.options.sanitize,this.options.baseUrl,ne),ne===null)return oe;var ue='",ue},de.image=function(ne,ie,oe){if(ne=pt(this.options.sanitize,this.options.baseUrl,ne),ne===null)return oe;var ue=''+oe+'":">",ue},de.text=function(ne){return ne},ge}(),rt=function(){function ge(){}var de=ge.prototype;return de.strong=function(ne){return ne},de.em=function(ne){return ne},de.codespan=function(ne){return ne},de.del=function(ne){return ne},de.html=function(ne){return ne},de.text=function(ne){return ne},de.link=function(ne,ie,oe){return""+oe},de.image=function(ne,ie,oe){return""+oe},de.br=function(){return""},ge}(),Rt=function(){function ge(){this.seen={}}var de=ge.prototype;return de.slug=function(ne){var ie=ne.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var oe=ie;do this.seen[oe]++,ie=oe+"-"+this.seen[oe];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},ge}(),Ct=U.defaults,xt=Q.unescape,yt=function(){function ge(ce){this.options=ce||Ct,this.options.renderer=this.options.renderer||new Qe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new rt,this.slugger=new Rt}ge.parse=function(ne,ie){var oe=new ge(ie);return oe.parse(ne)};var de=ge.prototype;return de.parse=function(ne,ie){ie===void 0&&(ie=!0);var oe="",ue,we,ke,Ze,bt,It,Ge,it,Be,Ue,Le,se,pe,je,Ie,dt,lt,Ae,tt=ne.length;for(ue=0;ue0&&Ie.tokens[0].type==="text"?(Ie.tokens[0].text=Ae+" "+Ie.tokens[0].text,Ie.tokens[0].tokens&&Ie.tokens[0].tokens.length>0&&Ie.tokens[0].tokens[0].type==="text"&&(Ie.tokens[0].tokens[0].text=Ae+" "+Ie.tokens[0].tokens[0].text)):Ie.tokens.unshift({type:"text",text:Ae}):je+=Ae),je+=this.parse(Ie.tokens,pe),Be+=this.renderer.listitem(je,lt,dt);oe+=this.renderer.list(Be,Le,se);continue}case"html":{oe+=this.renderer.html(Ue.text);continue}case"paragraph":{oe+=this.renderer.paragraph(this.parseInline(Ue.tokens));continue}case"text":{for(Be=Ue.tokens?this.parseInline(Ue.tokens):Ue.text;ue+1An error occurred:

    "+Te(ke.message+"",!0)+"
    ";throw ke}}De.options=De.setOptions=function(ge){return wt(De.defaults,ge),ze(De.defaults),De},De.getDefaults=xe,De.defaults=Ve,De.use=function(ge){var de=wt({},ge);if(ge.renderer&&function(){var ne=De.defaults.renderer||new Qe,ie=function(we){var ke=ne[we];ne[we]=function(){for(var Ze=arguments.length,bt=new Array(Ze),It=0;It=0;P--){if(!R(T[P]))continue;var O=T[P].split("="),p=unescape(O[0]),g=unescape(O[1]);c(g,p)}}function U(c,T){if(!c)return;H.cookie=escape(c)+"="+escape(T)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"}function N(c){if(!c||!L(c))return;H.cookie=escape(c)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"}function E(){x(function(c,T){N(T)})}function L(c){return new RegExp("(?:^|;\\s*)"+escape(c).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(H.cookie)}},EHPI:function(Fe,Ce,j){"use strict";var J=j("bbsP"),K=j("/wGt"),R=j("tJVT"),H=j("k1fw"),I=j("q1tI"),x=j.n(I),U=j("ZW9T"),N=j("ZD9Y"),E=j("M8RZ"),L=j("bCnd"),c=j("fcyK"),T=j.n(c),P={theme:Object(L.a)("cmCodeMode","vs-dark"),fontSize:Object(L.a)("cmFontSize",14),showEditorSetting:!1,tabToSpace:Object(L.a)("cmTabToSpace",!0)},O;(function(i){i[i.set_font_size=0]="set_font_size",i[i.set_theme=1]="set_theme",i[i.on_tab_to_space=2]="on_tab_to_space",i[i.set_show_editor_setting=3]="set_show_editor_setting"})(O||(O={}));function p(i,a){switch(a.type){case O.set_show_editor_setting:return Object(H.a)(Object(H.a)({},i),{},{showEditorSetting:a.payload});case O.set_theme:return Object(H.a)(Object(H.a)({},i),{},{theme:a.payload});case O.set_font_size:return Object(H.a)(Object(H.a)({},i),{},{fontSize:a.payload});case O.on_tab_to_space:return Object(H.a)(Object(H.a)({},i),{},{tabToSpace:a.payload});default:throw new Error}}Ce.a=function(i){var a=i.value,u=i.onChange,h=i.language,w=i.ActionBarRender,b=w===void 0?function(F){return x.a.createElement(g,{onShowCodeSetting:F})}:w,v=Object(I.useReducer)(p,P),D=Object(R.a)(v,2),S=D[0],f=D[1],d=S.theme,o=S.fontSize,s=S.showEditorSetting,_=S.tabToSpace,C={onFontSizeChange:function(Q){f({type:O.set_font_size,payload:Q}),Object(L.b)("cmFontSize",Q)},tabToSpace:_,cmFontSize:o,className:"oj",cmCodeMode:d,onTabToSpace:function(Q){f({type:O.on_tab_to_space,payload:Q}),Object(L.b)("cmTabToSpace",Q)},onCodeModeChange:function(Q){f({type:O.set_theme,payload:Q}),Object(L.b)("cmCodeMode",Q)}};function y(){f({type:O.set_show_editor_setting,payload:!1})}function M(){f({type:O.set_show_editor_setting,payload:!0})}var B={value:a,language:h,onChange:u,theme:d,height:"calc(100% - 56px)",options:{fontSize:o,insertSpaces:_}};return x.a.createElement(I.Fragment,null,x.a.createElement("div",{className:"code-panel-container"},b(M),x.a.createElement(U.b,B)),x.a.createElement(E.a,null,x.a.createElement(K.a,{className:"oj",title:null,placement:"right",closable:!1,visible:s,onClose:y},x.a.createElement(N.a,C))))};function g(i){var a=i.onShowCodeSetting;return x.a.createElement("div",{className:"action-bar"},x.a.createElement("span",null,"\u5B66\u5458\u521D\u59CB\u4EE3\u7801\u6587\u4EF6"),x.a.createElement("a",{onClick:a},x.a.createElement("i",{className:"iconfont icon-shezhi"})))}},ELLl:function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},R=J.Pos;J.defineOption("autoCloseBrackets",!1,function(p,g,i){i&&i!=J.Init&&(p.removeKeyMap(I),p.state.closeBrackets=null),g&&(x(H(g,"pairs")),p.state.closeBrackets=g,p.addKeyMap(I))});function H(p,g){return g=="pairs"&&typeof p=="string"?p:typeof p=="object"&&p[g]!=null?p[g]:K[g]}var I={Backspace:E,Enter:L};function x(p){for(var g=0;g=0;u--){var w=a[u].head;p.replaceRange("",R(w.line,w.ch-1),R(w.line,w.ch+1),"+delete")}}function L(p){var g=N(p),i=g&&H(g,"explode");if(!i||p.getOption("disableInput"))return J.Pass;for(var a=p.listSelections(),u=0;u0;return{anchor:new R(p.anchor.line,p.anchor.ch+(g?-1:1)),head:new R(p.head.line,p.head.ch+(g?1:-1))}}function T(p,g){var i=N(p);if(!i||p.getOption("disableInput"))return J.Pass;var a=H(i,"pairs"),u=a.indexOf(g);if(u==-1)return J.Pass;for(var h=H(i,"closeBefore"),w=H(i,"triples"),b=a.charAt(u+1)==g,v=p.listSelections(),D=u%2==0,S,f=0;f=0&&p.getRange(o,R(o.line,o.ch+3))==g+g+g?s="skipThree":s="skip";else if(b&&o.ch>1&&w.indexOf(g)>=0&&p.getRange(R(o.line,o.ch-2),o)==g+g){if(o.ch>2&&/\bstring/.test(p.getTokenTypeAt(R(o.line,o.ch-2))))return J.Pass;s="addFour"}else if(b){var C=o.ch==0?" ":p.getRange(R(o.line,o.ch-1),o);if(!J.isWordChar(_)&&C!=g&&!J.isWordChar(C))s="both";else return J.Pass}else if(D&&(_.length===0||/\s/.test(_)||h.indexOf(_)>-1))s="both";else return J.Pass;if(!S)S=s;else if(S!=s)return J.Pass}var y=u%2?a.charAt(u-1):g,M=u%2?g:a.charAt(u+1);p.operation(function(){if(S=="skip")p.execCommand("goCharRight");else if(S=="skipThree")for(var B=0;B<3;B++)p.execCommand("goCharRight");else if(S=="surround"){for(var F=p.getSelections(),B=0;B=7&&this.setupTypeNumber(N),this.dataCache==null&&(this.dataCache=x.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,E)},U.setupPositionProbePattern=function(N,E){for(var L=-1;L<=7;L++){if(N+L<=-1||this.moduleCount<=N+L)continue;for(var c=-1;c<=7;c++){if(E+c<=-1||this.moduleCount<=E+c)continue;0<=L&&L<=6&&(c==0||c==6)||0<=c&&c<=6&&(L==0||L==6)||2<=L&&L<=4&&2<=c&&c<=4?this.modules[N+L][E+c]=!0:this.modules[N+L][E+c]=!1}}},U.getBestMaskPattern=function(){for(var N=0,E=0,L=0;L<8;L++){this.makeImpl(!0,L);var c=H.getLostPoint(this);(L==0||N>c)&&(N=c,E=L)}return E},U.createMovieClip=function(N,E,L){var c=N.createEmptyMovieClip(E,L),T=1;this.make();for(var P=0;P>L&1)==1;this.modules[Math.floor(L/3)][L%3+this.moduleCount-8-3]=c}for(var L=0;L<18;L++){var c=!N&&(E>>L&1)==1;this.modules[L%3+this.moduleCount-8-3][Math.floor(L/3)]=c}},U.setupTypeInfo=function(N,E){for(var L=this.errorCorrectLevel<<3|E,c=H.getBCHTypeInfo(L),T=0;T<15;T++){var P=!N&&(c>>T&1)==1;T<6?this.modules[T][8]=P:T<8?this.modules[T+1][8]=P:this.modules[this.moduleCount-15+T][8]=P}for(var T=0;T<15;T++){var P=!N&&(c>>T&1)==1;T<8?this.modules[8][this.moduleCount-T-1]=P:T<9?this.modules[8][15-T-1+1]=P:this.modules[8][15-T-1]=P}this.modules[this.moduleCount-8][8]=!N},U.mapData=function(N,E){for(var L=-1,c=this.moduleCount-1,T=7,P=0,O=this.moduleCount-1;O>0;O-=2)for(O==6&&O--;;){for(var p=0;p<2;p++)if(this.modules[c][O-p]==null){var g=!1;P>>T&1)==1);var i=H.getMask(E,c,O-p);i&&(g=!g),this.modules[c][O-p]=g,T--,T==-1&&(P++,T=7)}if(c+=L,c<0||this.moduleCount<=c){c-=L,L=-L;break}}},x.PAD0=236,x.PAD1=17,x.createData=function(N,E,L){for(var c=K.getRSBlocks(N,E),T=new R,P=0;Pp*8)throw new Error("code length overflow. ("+T.getLengthInBits()+">"+p*8+")");for(T.getLengthInBits()+4<=p*8&&T.put(0,4);T.getLengthInBits()%8!=0;)T.putBit(!1);for(;!(T.getLengthInBits()>=p*8);){if(T.put(x.PAD0,8),T.getLengthInBits()>=p*8)break;T.put(x.PAD1,8)}return x.createBytes(T,c)},x.createBytes=function(N,E){for(var L=0,c=0,T=0,P=new Array(E.length),O=new Array(E.length),p=0;p=0?w.get(b):0}}for(var v=0,a=0;a=0;)U^=I.G15<=0;)U^=I.G18<>>=1;return U},getPatternPosition:function(x){return I.PATTERN_POSITION_TABLE[x-1]},getMask:function(x,U,N){switch(x){case H.PATTERN000:return(U+N)%2==0;case H.PATTERN001:return U%2==0;case H.PATTERN010:return N%3==0;case H.PATTERN011:return(U+N)%3==0;case H.PATTERN100:return(Math.floor(U/2)+Math.floor(N/3))%2==0;case H.PATTERN101:return U*N%2+U*N%3==0;case H.PATTERN110:return(U*N%2+U*N%3)%2==0;case H.PATTERN111:return(U*N%3+(U+N)%2)%2==0;default:throw new Error("bad maskPattern:"+x)}},getErrorCorrectPolynomial:function(x){for(var U=new K([1],0),N=0;N5&&(N+=3+c-5)}for(var E=0;E>>6)+E(128|M&63):E(224|M>>>12&15)+E(128|M>>>6&63)+E(128|M&63)}else{var M=65536+(y.charCodeAt(0)-55296)*1024+(y.charCodeAt(1)-56320);return E(240|M>>>18&7)+E(128|M>>>12&63)+E(128|M>>>6&63)+E(128|M&63)}},c=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,T=function(y){return y.replace(c,L)},P=function(y){var M=[0,2,1][y.length%3],B=y.charCodeAt(0)<<16|(y.length>1?y.charCodeAt(1):0)<<8|(y.length>2?y.charCodeAt(2):0),F=[U.charAt(B>>>18),U.charAt(B>>>12&63),M>=2?"=":U.charAt(B>>>6&63),M>=1?"=":U.charAt(B&63)];return F.join("")},O=H.btoa&&typeof H.btoa=="function"?function(y){return H.btoa(y)}:function(y){if(y.match(/[^\x00-\xFF]/))throw new RangeError("The string contains invalid characters.");return y.replace(/[\s\S]{1,3}/g,P)},p=function(y){return O(T(String(y)))},g=function(y){return y.replace(/[+\/]/g,function(M){return M=="+"?"-":"_"}).replace(/=/g,"")},i=function(y,M){return M?g(p(y)):p(y)},a=function(y){return i(y,!0)},u;H.Uint8Array&&(u=function(y,M){for(var B="",F=0,Q=y.length;F>>18)+U.charAt(re>>>12&63)+(typeof W!="undefined"?U.charAt(re>>>6&63):"=")+(typeof $!="undefined"?U.charAt(re&63):"=")}return M?g(B):B});var h=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,w=function(y){switch(y.length){case 4:var M=(7&y.charCodeAt(0))<<18|(63&y.charCodeAt(1))<<12|(63&y.charCodeAt(2))<<6|63&y.charCodeAt(3),B=M-65536;return E((B>>>10)+55296)+E((B&1023)+56320);case 3:return E((15&y.charCodeAt(0))<<12|(63&y.charCodeAt(1))<<6|63&y.charCodeAt(2));default:return E((31&y.charCodeAt(0))<<6|63&y.charCodeAt(1))}},b=function(y){return y.replace(h,w)},v=function(y){var M=y.length,B=M%4,F=(M>0?N[y.charAt(0)]<<18:0)|(M>1?N[y.charAt(1)]<<12:0)|(M>2?N[y.charAt(2)]<<6:0)|(M>3?N[y.charAt(3)]:0),Q=[E(F>>>16),E(F>>>8&255),E(F&255)];return Q.length-=[0,0,2,1][B],Q.join("")},D=H.atob&&typeof H.atob=="function"?function(y){return H.atob(y)}:function(y){return y.replace(/\S{1,4}/g,v)},S=function(y){return D(String(y).replace(/[^A-Za-z0-9\+\/]/g,""))},f=function(y){return b(D(y))},d=function(y){return String(y).replace(/[-_]/g,function(M){return M=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")},o=function(y){return f(d(y))},s;H.Uint8Array&&(s=function(y){return Uint8Array.from(S(d(y)),function(M){return M.charCodeAt(0)})});var _=function(){var y=H.Base64;return H.Base64=I,y};if(H.Base64={VERSION:x,atob:S,btoa:O,fromBase64:o,toBase64:i,utob:T,encode:i,encodeURI:a,btou:b,decode:o,noConflict:_,fromUint8Array:u,toUint8Array:s},typeof Object.defineProperty=="function"){var C=function(y){return{value:y,enumerable:!1,writable:!0,configurable:!0}};H.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",C(function(){return o(this)})),Object.defineProperty(String.prototype,"toBase64",C(function(y){return i(this,y)})),Object.defineProperty(String.prototype,"toBase64URI",C(function(){return i(this,!0)}))}}return H.Meteor&&(Base64=H.Base64),Fe.exports?Fe.exports.Base64=H.Base64:!(K=[],R=function(){return H.Base64}.apply(Ce,K),R!==void 0&&(Fe.exports=R)),{Base64:H.Base64}})}).call(this,j("IyRk"))},JB8y:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return J});var J;(function(K){K[K.NOMATCH=-1]="NOMATCH",K[K.OK=0]="OK",K[K.TIMEOUT=2]="TIMEOUT",K[K.PODFAILURE=3]="PODFAILURE",K[K.COMPILEFAILURE=4]="COMPILEFAILURE",K[K.EXECUTEFAILURE=5]="EXECUTEFAILURE"})(J||(J={}))},JPnl:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return v}),j.d(Ce,"c",function(){return f});var J=j("+L6B"),K=j("2/Rp"),R=j("tJVT"),H=j("k1fw"),I=j("jrin"),x=j("5NDa"),U=j("5rEg"),N=j("q1tI"),E=j.n(N),L=j("8Skl"),c=j("y3Kf"),T=j("JB8y"),P=j("J66h"),O=j.n(P),p=j("a4uL"),g=j.n(p),i=j("IxHN"),a=j("9Bee"),u=j("1vsH"),h,w=U.a.TextArea,b={visible:!1,tabIndex:"0"},v=(h={},Object(I.a)(h,T.a.NOMATCH,"\u6D4B\u8BD5\u7528\u4F8B\u7ED3\u679C\u4E0D\u5339\u914D"),Object(I.a)(h,T.a.OK,"\u8C03\u8BD5\u901A\u8FC7"),Object(I.a)(h,2,"\u8C03\u8BD5\u8D85\u65F6"),Object(I.a)(h,3,"\u8C03\u8BD5pod\u5931\u8D25"),Object(I.a)(h,4,"\u7F16\u8BD1\u5931\u8D25"),Object(I.a)(h,5,"\u6267\u884C\u5931\u8D25"),h),D;(function(o){o[o.SET_VISIBLE=0]="SET_VISIBLE",o[o.SET_TABINDEX=1]="SET_TABINDEX"})(D||(D={}));function S(o,s){switch(s.type){case D.SET_VISIBLE:return Object(H.a)(Object(H.a)({},o),{},{visible:s.payload});case D.SET_TABINDEX:return Object(H.a)(Object(H.a)({},o),{},{tabIndex:s.payload});default:throw new Error}}function f(o){var s=o.status,_=o.error_msg,C=o.output,y=o.input,M=o.expected_output,B=o.is_file,F=o.input_file_url,Q=o.output_file_url,V=o.expected_output_file_url,W=null,$={minHeight:150,marginBottom:10,paddingLeft:24,background:"#070f19",color:"#fff"};switch(s){case T.a.NOMATCH:W=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),!B&&E.a.createElement(a.a,{value:y,style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(F,y)}},y)),E.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),!B&&E.a.createElement(a.a,{value:C&&P.Base64.decode(C)||"",style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(Q,C)}},C)),E.a.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),!B&&E.a.createElement(a.a,{value:M&&P.Base64.decode(M)||"",style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(V,M)}},M)));break;case T.a.EXECUTEFAILURE:W=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!B&&E.a.createElement(a.a,{value:y,style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(F,y)}},y)),E.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),E.a.createElement("pre",{className:"error"},P.Base64.decode(_)));break;case T.a.COMPILEFAILURE:W=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A"),!B&&E.a.createElement(a.a,{value:y,style:$}),B&&E.a.createElement("div",{style:$},E.a.createElement("a",{onClick:function(){return Object(u.w)(F,y)}},y)),E.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),E.a.createElement("pre",{className:"error"},P.Base64.decode(_)));break;case T.a.PODFAILURE:W=E.a.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case T.a.TIMEOUT:W=E.a.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return E.a.createElement(E.a.Fragment,null," ",W," ")}function d(o){var s=o.status,_=o.error_msg,C=o.execute_time,y=o.output,M=o.input,B=o.expected_output,F=o.is_file,Q=o.input_file_url,V=o.output_file_url,W=o.expected_output_file_url,$=null;switch(s){case T.a.OK:$=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6267\u884C\u7528\u65F6\uFF1A",C),E.a.createElement("p",null,"\u6267\u884C\u7ED3\u679C\uFF1A"),E.a.createElement("pre",null,P.Base64.decode(y)));break;case T.a.NOMATCH:$=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u8F93\u5165\uFF1A",E.a.createElement("pre",null,M)),E.a.createElement("p",null,"\u8F93\u51FA\uFF1A",y&&P.Base64.decode(y)),E.a.createElement("p",null,"\u9884\u671F\u8F93\u51FA\uFF1A",B&&P.Base64.decode(B)));break;case T.a.EXECUTEFAILURE:$=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",E.a.createElement("pre",null,M)),E.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),E.a.createElement("pre",{className:"error"},P.Base64.decode(_)));break;case T.a.COMPILEFAILURE:$=E.a.createElement(E.a.Fragment,null,E.a.createElement("p",null,"\u6700\u540E\u6267\u884C\u7684\u8F93\u5165\uFF1A",E.a.createElement("pre",null,M)),E.a.createElement("p",null,"\u6267\u884C\u51FA\u9519\u4FE1\u606F\uFF1A"),E.a.createElement("pre",{className:"error"},P.Base64.decode(_)));break;case T.a.PODFAILURE:$=E.a.createElement("p",null,"\u521B\u5EFApod\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break;case T.a.TIMEOUT:$=E.a.createElement("p",null,"\u8BC4\u6D4B\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5");break}return E.a.createElement(E.a.Fragment,null," ",$," ")}Ce.b=function(o){var s=o.input,_=o.debuging,C=o.submitting,y=o.executingMessage,M=o.debugResult,B=o.onChangeInput,F=o.onDebugCode,Q=o.onSubmitCode,V=Object(N.useReducer)(S,b),W=Object(R.a)(V,2),$=W[0],re=W[1],ae=$.visible,he=$.tabIndex;function Se(_e){var fe=_e.target.id;re({type:D.SET_TABINDEX,payload:fe})}function ye(){re({type:D.SET_VISIBLE,payload:!ae})}var be=Object(N.useMemo)(function(){if(M){var _e=M.status;return E.a.createElement(E.a.Fragment,null,d(M))}return null},[M]);function Oe(){re({type:D.SET_VISIBLE,payload:!0}),re({type:D.SET_TABINDEX,payload:"1"}),F()}return E.a.createElement("div",{className:"test-case-panel"},E.a.createElement("div",{className:"test-case-panel-body ".concat(ae?"active":"")},E.a.createElement("ul",{className:"s-navs"},E.a.createElement("li",null,E.a.createElement("a",{className:he==="0"?"active":"",id:"0",onClick:Se},"\u81EA\u5B9A\u4E49\u6D4B\u8BD5\u7528\u4F8B")),E.a.createElement("li",null,E.a.createElement("a",{className:he==="1"?"active":"",id:"1",onClick:Se},"\u4EE3\u7801\u6267\u884C\u7ED3\u679C"))),E.a.createElement("div",{className:"tab-panel-body ".concat(he==="0"?"":"hide")},E.a.createElement(w,{placeholder:"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D",value:s,onChange:B})),E.a.createElement("div",{className:"tab-panel-body ".concat(he==="1"?"":"hide")},_?E.a.createElement(i.a,{message:y}):M?E.a.createElement("section",{style:{height:200}}," ",be," "):E.a.createElement("p",{className:"tip"},"\u8BF7\u586B\u5199\u6D4B\u8BD5\u7528\u4F8B\u7684\u8F93\u5165\u503C\uFF0C\u70B9\u51FB\u201C\u8C03\u8BD5\u4EE3\u7801\u201D"))),E.a.createElement("a",{className:"btn-collapse ".concat(ae?"up":""),onClick:ye},ae?E.a.createElement(L.a,null):E.a.createElement(c.a,null)),E.a.createElement("footer",{className:"footer"},E.a.createElement("span",null,"\u63A7\u5236\u53F0"),E.a.createElement("div",{className:"flex-container"},E.a.createElement(K.a,{className:"btn-green",type:"ghost",loading:_,onClick:Oe},"\u8C03\u8BD5\u4EE3\u7801"),E.a.createElement(K.a,{type:"primary",loading:C,disabled:C,onClick:function(){re({type:D.SET_VISIBLE,payload:!1}),Q()}},"\u8BC4\u6D4B\u5E76\u63D0\u4EA4"))))}},LdHM:function(Fe,Ce,j){"use strict";j.d(Ce,"b",function(){return h}),j.d(Ce,"a",function(){return b});var J=j("1OyB"),K=j("vuIU"),R=j("Ji7U"),H=j("LK+K"),I=j("q1tI"),x=j("rePB"),U=j("Ff2n"),N=j("ODXe"),E=j("4IlW"),L=j("bX4T"),c=j("YrtM"),T=j("TSYQ"),P=j.n(T),O=j("+nKL"),p=j("8OUc"),g=function($,re){var ae=$.prefixCls,he=$.id,Se=$.flattenOptions,ye=$.childrenAsData,be=$.values,Oe=$.searchValue,_e=$.multiple,fe=$.defaultActiveFirstOption,le=$.height,Re=$.itemHeight,ot=$.notFoundContent,st=$.open,nt=$.menuItemSelectedIcon,$e=$.virtual,Ke=$.onSelect,Ye=$.onToggleOpen,ut=$.onActiveValue,pt=$.onScroll,at=$.onMouseEnter,Qe="".concat(ae,"-item"),rt=Object(c.a)(function(){return Se},[st,Se],function(We,ge){return ge[0]&&We[1]!==ge[1]}),Rt=I.useRef(null),Ct=function(ge){ge.preventDefault()},xt=function(ge){Rt.current&&Rt.current.scrollTo({index:ge})},yt=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=rt.length,ne=0;ne1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(W).map(function(re,ae){if(!I.isValidElement(re)||!re.type)return null;var he=re.type.isSelectOptGroup,Se=re.key,ye=re.props,be=ye.children,Oe=Object(U.a)(ye,["children"]);return $||!he?S(re):Object(v.a)(Object(v.a)({key:"__RC_SELECT_GRP__".concat(Se===null?ae:Se,"__"),label:Se},Oe),{},{options:f(be)})}).filter(function(re){return re})}var d=j("2Qr1"),o=j("qNPg"),s=j("U8pU"),_=j("Kwbf"),C=j("WKfj");function y(W){var $=W.mode,re=W.options,ae=W.children,he=W.backfill,Se=W.allowClear,ye=W.placeholder,be=W.getInputElement,Oe=W.showSearch,_e=W.onSearch,fe=W.defaultOpen,le=W.autoFocus,Re=W.labelInValue,ot=W.value,st=W.inputValue,nt=W.optionLabelProp,$e=$==="multiple"||$==="tags",Ke=Oe!==void 0?Oe:$e||$==="combobox",Ye=re||f(ae);if(Object(_.a)($!=="tags"||Ye.every(function(Qe){return!Qe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var ut=Ye.some(function(Qe){return Qe.options?Qe.options.some(function(rt){return typeof("value"in rt?rt.value:rt.key)=="number"}):typeof("value"in Qe?Qe.value:Qe.key)=="number"});Object(_.a)(!ut,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(_.a)($!=="combobox"||!nt,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(_.a)($==="combobox"||!he,"`backfill` only works with `combobox` mode."),Object(_.a)($==="combobox"||!be,"`getInputElement` only work with `combobox` mode."),Object(_.b)($!=="combobox"||!be||!Se||!ye,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),_e&&!Ke&&$!=="combobox"&&$!=="tags"&&Object(_.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(_.b)(!fe||le,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ot!=null){var pt=Object(C.d)(ot);Object(_.a)(!Re||pt.every(function(Qe){return Object(s.a)(Qe)==="object"&&("key"in Qe||"value"in Qe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(_.a)(!$e||Array.isArray(ot),"`value` should be array when `mode` is `multiple` or `tags`")}if(ae){var at=null;Object(D.a)(ae).some(function(Qe){if(!I.isValidElement(Qe)||!Qe.type)return!1;var rt=Qe.type;if(rt.isSelectOption)return!1;if(rt.isSelectOptGroup){var Rt=Object(D.a)(Qe.props.children).every(function(Ct){return!I.isValidElement(Ct)||!Qe.type||Ct.type.isSelectOption?!0:(at=Ct.type,!1)});return!Rt}return at=rt,!0}),at&&Object(_.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(at.displayName||at.name||at,"`.")),Object(_.a)(st===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=y,B=Object(o.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:f,flattenOptions:d.d,getLabeledValue:d.e,filterOptions:d.b,isValueDisabled:d.g,findValueOption:d.c,warningProps:M,fillOptionsWithMissingValue:d.a}),F=function(W){Object(R.a)(re,W);var $=Object(H.a)(re);function re(){var ae;return Object(J.a)(this,re),ae=$.apply(this,arguments),ae.selectRef=I.createRef(),ae.focus=function(){ae.selectRef.current.focus()},ae.blur=function(){ae.selectRef.current.blur()},ae}return Object(K.a)(re,[{key:"render",value:function(){return I.createElement(B,Object.assign({ref:this.selectRef},this.props))}}]),re}(I.Component);F.Option=h,F.OptGroup=b;var Q=F,V=Ce.c=Q},M8RZ:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return E});var J=j("fWQN"),K=j("mtLc"),R=j("yKVA"),H=j("879j"),I=j("q1tI"),x=j.n(I),U=j("i8i4"),N=j.n(U),E=function(L){Object(R.a)(T,L);var c=Object(H.a)(T);function T(P){var O;Object(J.a)(this,T),O=c.call(this,P);var p=window.document;return O.node=p.createElement("div"),p.body.appendChild(O.node),O}return Object(K.a)(T,[{key:"render",value:function(){var O=this.props.children;return Object(U.createPortal)(O,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),T}(x.a.Component)},MFOe:function(Fe,Ce,j){(function(J){var K=x(),R=U(),H=N(),I=typeof window!="undefined"?window:J;Fe.exports={assign:K,create:R,trim:H,bind:E,slice:L,each:c,map:T,pluck:P,isList:O,isFunction:p,isObject:g,Global:I};function x(){return Object.assign?Object.assign:function(a,u,h,w){for(var b=1;b=0;g-=1){var i=N.get(g)||new Set;i.forEach(function(a){var u=a.parent,h=a.node;if(L(h)||!a.parent||p.has(a.parent.key))return;if(L(a.parent.node)){p.add(u.key);return}var w=!0,b=!1;(u.children||[]).filter(function(v){return!L(v.node)}).forEach(function(v){var D=v.key,S=c.has(D);w&&!S&&(w=!1),!b&&(S||T.has(D))&&(b=!0)}),w&&c.add(u.key),b&&T.add(u.key),p.add(u.key)})}return{checkedKeys:Array.from(c),halfCheckedKeys:Array.from(K(T,c))}}function I(U,N,E,L,c){for(var T=new Set(U),P=new Set(N),O=0;O<=L;O+=1){var p=E.get(O)||new Set;p.forEach(function(u){var h=u.key,w=u.node,b=u.children,v=b===void 0?[]:b;!T.has(h)&&!P.has(h)&&!c(w)&&v.filter(function(D){return!c(D.node)}).forEach(function(D){T.delete(D.key)})})}P=new Set;for(var g=new Set,i=L;i>=0;i-=1){var a=E.get(i)||new Set;a.forEach(function(u){var h=u.parent,w=u.node;if(c(w)||!u.parent||g.has(u.parent.key))return;if(c(u.parent.node)){g.add(h.key);return}var b=!0,v=!1;(h.children||[]).filter(function(D){return!c(D.node)}).forEach(function(D){var S=D.key,f=T.has(S);b&&!f&&(b=!1),!v&&(f||P.has(S))&&(v=!0)}),b||T.delete(h.key),v&&P.add(h.key),g.add(h.key)})}return{checkedKeys:Array.from(T),halfCheckedKeys:Array.from(K(P,T))}}function x(U,N,E,L){var c=[],T;L?T=L:T=R;var P=new Set(U.filter(function(i){var a=!!E[i];return a||c.push(i),a})),O=new Map,p=0;Object.keys(E).forEach(function(i){var a=E[i],u=a.level,h=O.get(u);h||(h=new Set,O.set(u,h)),h.add(a),p=Math.max(p,u)}),Object(J.a)(!c.length,"Tree missing follow keys: ".concat(c.slice(0,100).map(function(i){return"'".concat(i,"'")}).join(", ")));var g;return N===!0?g=H(P,O,p,T):g=I(P,N.halfCheckedKeys,O,p,T),g}},OJz4:function(Fe,Ce,j){"use strict";j.d(Ce,"d",function(){return K}),j.d(Ce,"h",function(){return R}),j.d(Ce,"b",function(){return H}),j.d(Ce,"f",function(){return I}),j.d(Ce,"e",function(){return x}),j.d(Ce,"c",function(){return U}),j.d(Ce,"a",function(){return N}),j.d(Ce,"g",function(){return E}),j.d(Ce,"i",function(){return L}),j.d(Ce,"k",function(){return c}),j.d(Ce,"l",function(){return T}),j.d(Ce,"j",function(){return P});var J=j("ErOA");function K(O){return Object(J.c)("myproblems/".concat(O,".json"),{hidePopLogin:!0})}function R(O,p){return Object(J.f)("myproblems/".concat(O,"/code_submit.json"),p)}function H(O,p){return Object(J.c)("myproblems/".concat(O,"/code_debug.json"),p)}function I(O,p){return Object(J.c)("myproblems/".concat(O,"/submit_records.json"),p)}function x(O){return Object(J.c)("myproblems/record_detail.json",{id:O})}function U(O,p){return Object(J.c)("myproblems/".concat(O,"/result.json"),{mode:p})}function N(O,p){return Object(J.f)("myproblems/".concat(O,"/add_notes.json"),p)}function E(O){return Object(J.f)("myproblems/".concat(O,"/restore_initial_code.json"))}function L(O){return Object(J.f)("myproblems/".concat(O,"/sync_code.json"))}function c(O,p){return Object(J.f)("myproblems/".concat(O,"/update_code.json"),p)}function T(O){return Object(J.f)("myproblems/".concat(O,"/cost_time.json"))}function P(O,p){return Object(J.f)("discusses/".concat(O,"/plus.json"),p)}},OLES:function(Fe,Ce,j){"use strict";var J=j("U8pU"),K=j("VTBJ"),R=j("Ff2n"),H=j("q1tI"),I=j("uciX"),x=j("7ixt"),U=function(P){var O=P.overlay,p=P.prefixCls,g=P.id,i=P.overlayInnerStyle;return H.createElement("div",{className:"".concat(p,"-inner"),id:g,role:"tooltip",style:i},typeof O=="function"?O():O)},N=U,E=function(P,O){var p=P.overlayClassName,g=P.trigger,i=g===void 0?["hover"]:g,a=P.mouseEnterDelay,u=a===void 0?0:a,h=P.mouseLeaveDelay,w=h===void 0?.1:h,b=P.overlayStyle,v=P.prefixCls,D=v===void 0?"rc-tooltip":v,S=P.children,f=P.onVisibleChange,d=P.afterVisibleChange,o=P.transitionName,s=P.animation,_=P.placement,C=_===void 0?"right":_,y=P.align,M=y===void 0?{}:y,B=P.destroyTooltipOnHide,F=B===void 0?!1:B,Q=P.defaultVisible,V=P.getTooltipContainer,W=P.overlayInnerStyle,$=Object(R.a)(P,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),re=Object(H.useRef)(null);Object(H.useImperativeHandle)(O,function(){return re.current});var ae=Object(K.a)({},$);"visible"in P&&(ae.popupVisible=P.visible);var he=function(){var _e=P.arrowContent,fe=_e===void 0?null:_e,le=P.overlay,Re=P.id;return[H.createElement("div",{className:"".concat(D,"-arrow"),key:"arrow"},fe),H.createElement(N,{key:"content",prefixCls:D,id:Re,overlay:le,overlayInnerStyle:W})]},Se=!1,ye=!1;if(typeof F=="boolean")Se=F;else if(F&&Object(J.a)(F)==="object"){var be=F.keepParent;Se=be===!0,ye=be===!1}return H.createElement(I.a,Object.assign({popupClassName:p,prefixCls:D,popup:he,action:i,builtinPlacements:x.a,popupPlacement:C,ref:re,popupAlign:M,getPopupContainer:V,onPopupVisibleChange:f,afterPopupVisibleChange:d,popupTransitionName:o,popupAnimation:s,defaultPopupVisible:Q,destroyPopupOnHide:Se,autoDestroy:ye,mouseLeaveDelay:w,popupStyle:b,mouseEnterDelay:u},ae),S)},L=Object(H.forwardRef)(E),c=Ce.a=L},OZM5:function(Fe,Ce,j){"use strict";j.d(Ce,"b",function(){return L}),j.d(Ce,"a",function(){return c}),j.d(Ce,"k",function(){return T}),j.d(Ce,"h",function(){return P}),j.d(Ce,"i",function(){return O}),j.d(Ce,"g",function(){return p}),j.d(Ce,"c",function(){return g}),j.d(Ce,"d",function(){return i}),j.d(Ce,"j",function(){return h}),j.d(Ce,"e",function(){return w}),j.d(Ce,"f",function(){return b});var J=j("KQm4"),K=j("U8pU"),R=j("Ff2n"),H=j("q1tI"),I=j.n(H),x=j("Kwbf"),U=j("WaYH"),N=.25,E=2;function L(v,D){var S=v.slice(),f=S.indexOf(D);return f>=0&&S.splice(f,1),S}function c(v,D){var S=v.slice();return S.indexOf(D)===-1&&S.push(D),S}function T(v){return v.split("-")}function P(v,D){return"".concat(v,"-").concat(D)}function O(v){return v&&v.type&&v.type.isTreeNode}function p(v,D){var S=[v],f=D[v];function d(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];o.forEach(function(s){var _=s.key,C=s.children;S.push(_),d(C)})}return d(f.children),S}function g(v,D){var S=v.clientY,f=D.selectHandle.getBoundingClientRect(),d=f.top,o=f.bottom,s=f.height,_=Math.max(s*N,E);return S<=d+_?-1:S>=o-_?1:0}function i(v,D){if(!v)return;var S=D.multiple;return S?v.slice():v.length?[v[0]]:v}var a=function(D){return D};function u(v,D){if(!v)return[];var S=D||{},f=S.processProps,d=f===void 0?a:f,o=Array.isArray(v)?v:[v];return o.map(function(s){var _=s.children,C=Object(R.a)(s,["children"]),y=u(_,D);return I.a.createElement(U.a,Object.assign({},d(C)),y)})}function h(v){if(!v)return null;var D;if(Array.isArray(v))D={checkedKeys:v,halfCheckedKeys:void 0};else if(Object(K.a)(v)==="object")D={checkedKeys:v.checked||void 0,halfCheckedKeys:v.halfChecked||void 0};else return Object(x.a)(!1,"`checkedKeys` is not an array or an object"),null;return D}function w(v,D){var S=new Set;function f(d){if(S.has(d))return;var o=D[d];if(!o)return;S.add(d);var s=o.parent,_=o.node;if(_.disabled)return;s&&f(s.key)}return(v||[]).forEach(function(d){f(d)}),Object(J.a)(S)}function b(v){var D={};return Object.keys(v).forEach(function(S){(S.startsWith("data-")||S.startsWith("aria-"))&&(D[S]=v[S])}),D}},Ot1p:function(Fe,Ce,j){"use strict";var J=j("2qtc"),K=j("kLXV"),R=j("rAM+"),H=j("miYZ"),I=j("tsqr"),x=j("9og8"),U=j("tJVT"),N=j("jrin"),E=j("WmNS"),L=j.n(E),c=j("q1tI"),T=j.n(c),P=j("VrN/"),O=j.n(P),p=j("bdgK"),g=j("p77/"),i=j("Bd2K"),a=j("ELLl"),u=j("19Vz"),h=j("lZu9"),w=j("+NIl"),b=j("kSUc"),v=j("9Bee"),D=function(Ge){var it=Ge.value,Be=it===void 0?"":it,Ue=Ge.className,Le=Ge.showTextOnly,se=Ge.showLines,pe=Ge.style,je=pe===void 0?{}:pe,Ie=Object(c.useMemo)(function(){return""},[Be]);return T.a.createElement(T.a.Fragment,null,T.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ie}}))},S=j("Q9mQ"),f=j("diRs"),d=j("0Owb"),o=j("dejd"),s=j("C+DQ"),_=j("D1Df"),C=j.n(_),y=j("1vsH"),M=j("m3rI"),B=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function F(Ge){var it=Ge.onActionCallback,Be=Ge.title,Ue=Ge.icon,Le=Ge.actionName,se=Ge.className,pe=se===void 0?"":se,je=Ge.children;function Ie(){it(Le)}return T.a.createElement("a",{title:Be,className:pe,onClick:Ie},T.a.createElement("i",{className:"md-iconfont ".concat(Ue)}),je)}var Q=function(Ge){var it=Ge.watch,Be=Ge.showNullButton,Ue=Ge.onActionCallback,Le=Ge.fullScreen,se=Ge.insertTemp,pe=Ge.hidetoolBar,je=Ge.uuid,Ie=Ge.setOpenPhones,dt=Object(y.E)("_educoder_session_login"),lt=Object(y.E)("_educoder_session"),Ae=[].concat(B,[{title:"".concat(it?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(it?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return T.a.createElement("ul",{className:"markdown-toolbar-container"},!pe&&Ae.map(function(tt,mt){return T.a.createElement("li",{key:mt},tt.actionName?T.a.createElement(F,Object(d.a)({},tt,{onActionCallback:Ue})):T.a.createElement("span",{className:"v-line"}))}),Be?T.a.createElement("li",null,T.a.createElement(F,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ue},T.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,se&&T.a.createElement("li",null,T.a.createElement(F,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(se),onActionCallback:Ue},T.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),T.a.createElement("li",null,T.a.createElement(f.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:T.a.createElement("div",null,T.a.createElement("span",{style:{display:"none"}},location.origin+"/react/build/upload.html?_educoder_session_login="+dt+"&_educoder_session="+lt+"&key="+je+"&api="+encodeURIComponent(M.a.API_SERVER)),T.a.createElement(C.a,{size:150,fgColor:"#000",value:location.origin+"/react/build/upload.html?_educoder_session_login="+dt+"&_educoder_session="+lt+"&key="+je+"&api="+encodeURIComponent(M.a.API_SERVER)}))},T.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return Ie(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),T.a.createElement("li",{className:"btn-full-screen"},T.a.createElement(F,{icon:"".concat(Le?"icon-shrink":"icon-enlarge"),title:Le?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ue})))},V=j("M8RZ"),W=j("+L6B"),$=j("2/Rp"),re=j("y8nQ"),ae=j("Vl3Y"),he=j("5NDa"),Se=j("5rEg"),ye={labelCol:{span:4},wrapperCol:{span:20}},be=function(Ge){var it=Ge.callback,Be=Ge.onCancel;function Ue(Le){it(Le)}return T.a.createElement(ae.a,Object(d.a)({},ye,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ue}),T.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},T.a.createElement(Se.a,null)),T.a.createElement(ae.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},T.a.createElement(Se.a,null)),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement($.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))},Oe=j("7ahc"),_e=j("k1fw"),fe=j("HmJG"),le=j("BjJ7"),Re=ae.a.useForm,ot={width:280,marginRight:10},st={labelCol:{span:5},wrapperCol:{span:19}},nt=function(Ge){var it=Ge.callback,Be=Ge.onCancel,Ue=Re(),Le=Object(U.a)(Ue,1),se=Le[0],pe=Object(c.useRef)();function je(lt){it(Object(_e.a)(Object(_e.a)({},lt),{},{name:pe.current}))}function Ie(lt,Ae){se.setFieldsValue({src:"/api/attachments/".concat(lt.id,"?type=").concat(lt.content_type),type:Ae.type})}function dt(lt){var Ae=lt.target.files[0];pe.current=Ae.name,Ke(Ae,Ie)}return T.a.createElement(ae.a,Object(d.a)({form:se},st,{className:"upload-image-panel",onFinish:je}),T.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},T.a.createElement("div",{className:"flex-container"},T.a.createElement(ae.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},T.a.createElement(Se.a,{style:ot})),T.a.createElement($e,{onFileChange:dt}))),T.a.createElement(ae.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},T.a.createElement(Se.a,{style:{width:264}})),T.a.createElement(ae.a.Item,{style:{textAlign:"right"}},T.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement($.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))};function $e(Ge){var it=Ge.onFileChange;return T.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",T.a.createElement("input",{type:"file",onChange:it}))}function Ke(Ge,it){if(!Ge)throw new String("\u6CA1\u6709\u6587\u4EF6");var Be=new FormData;Be.append("editormd-image-file",Ge),Be.append("file_param_name","editormd-image-file"),Be.append("byxhr","true");var Ue=new window.XMLHttpRequest;Ue.withCredentials=!0,Ue.addEventListener("load",function(Le){it(JSON.parse(Le.target.responseText),Ge)},!1),Ue.addEventListener("error",function(Le){console.error(Le)},!1),Ue.open("POST","".concat(le.a,"/api/attachments.json")),Ue.send(Be)}var Ye=j("giR+"),ut=j("fyUT"),pt=j("7Kak"),at=j("9yH6"),Qe=at.a.Group,rt={margin:"0 8px"},Rt=function(Ge){var it=Ge.callback,Be=Ge.onCancel;function Ue(Le){it(Le)}return T.a.createElement(ae.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ue},T.a.createElement("div",{className:"flex-container"},T.a.createElement("span",{style:rt},"\u5355\u5143\u683C\u6570\uFF1A"),T.a.createElement("span",{style:rt},"\u884C\u6570"),T.a.createElement(ae.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},T.a.createElement(ut.a,null)),T.a.createElement("span",{style:rt},"\u5217\u6570"),T.a.createElement(ae.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},T.a.createElement(ut.a,null))),T.a.createElement("div",{className:"flex-container",style:{marginTop:12}},T.a.createElement("span",{style:rt},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),T.a.createElement(ae.a.Item,{name:"align"},T.a.createElement(Qe,null,T.a.createElement(at.a,{value:"default"},T.a.createElement("i",{className:"fa fa-align-justify"})),T.a.createElement(at.a,{value:"left"},T.a.createElement("i",{className:"fa fa-align-left"})),T.a.createElement(at.a,{value:"center"},T.a.createElement("i",{className:"fa fa-align-center"})),T.a.createElement(at.a,{value:"right"},T.a.createElement("i",{className:"fa fa-align-right"}))))),T.a.createElement("div",{className:"flex-container flex-end"},T.a.createElement($.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),T.a.createElement($.a,{type:"ghost",onClick:Be},"\u53D6\u6D88")))},Ct=j("ErOA"),xt=j("7Cbv"),yt="link",wt="upload-image",Et="code-block",Te="add-table",xe="------------",ze={default:xe,left:":".concat(xe),center:":".concat(xe,":"),right:"".concat(xe,":")},Ve=j("9VGf"),De,We;function ge(){}var de=0,ce=1e4,ne="\u2581",ie=` **\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 oe(Ge){return/^\d+$/.test(Ge)?"".concat(Ge,"px"):Ge}var ue=navigator.platform.toUpperCase().indexOf("MAC")>=0,we=ue?"Cmd":"Ctrl",ke=["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"],Ze=(De={},Object(N.a)(De,we+"-B","bold"),Object(N.a)(De,we+"-I","italic"),De),bt=(We={},Object(N.a)(We,yt,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(We,Et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(We,wt,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(We,Te,"\u6DFB\u52A0\u8868\u683C"),We),It=Ce.a=function(Ge){var it=Ge.defaultValue,Be=it===void 0?"":it,Ue=Ge.onChange,Le=Ge.width,se=Le===void 0?"100%":Le,pe=Ge.height,je=pe===void 0?400:pe,Ie=Ge.miniToolbar,dt=Ie===void 0?!1:Ie,lt=Ge.isFocus,Ae=lt===void 0?!1:lt,tt=Ge.watch,mt=Ge.insertTemp,gt=Ge.mode,Lt=gt===void 0?"markdown":gt,mn=Ge.id,hn=mn===void 0?"markdown-editor-id":mn,en=Ge.showResizeBar,Dt=en===void 0?!1:en,xn=Ge.noStorage,He=xn===void 0?!1:xn,ht=Ge.showNullButton,St=ht===void 0?!1:ht,Xt=Ge.hidetoolBar,an=Xt===void 0?!1:Xt,un=Ge.fullScreen,Je=un===void 0?!1:un,ft=Ge.onBlur,kt=Ge.onCMBeforeChange,vn=Ge.onFullScreen,Gt=Ge.className,Zt=Gt===void 0?"":Gt,z=Ge.disablePaste,m=z===void 0?!1:z,A=Ge.placeholder,G=A===void 0?"":A,ee=Ge.values,X=ee===void 0?"":ee,ve=Object(c.useState)(null),Xe=Object(U.a)(ve,2),Me=Xe[0],At=Xe[1],qe=Object(c.useState)(Be),Bt=Object(U.a)(qe,2),Ft=Bt[0],tn=Bt[1],zn=Object(c.useState)(tt),Wn=Object(U.a)(zn,2),$t=Wn[0],yn=Wn[1],Mn=Object(c.useState)(Je),bn=Object(U.a)(Mn,2),fn=bn[0],Sn=bn[1],Tn=Object(c.useState)(""),Hn=Object(U.a)(Tn,2),Gn=Hn[0],er=Hn[1],Dn=Object(c.useState)(0),Or=Object(U.a)(Dn,2),on=Or[0],Yn=Or[1],Ar=Object(c.useState)(je),yr=Object(U.a)(Ar,2),br=yr[0],pn=yr[1],nn=Object(c.useState)(!1),Pn=Object(U.a)(nn,2),dn=Pn[0],kn=Pn[1],gn=Object(c.useRef)(Object(xt.a)()),Er=Object(c.useRef)(!1),Un=Object(c.useRef)(),Bn=Object(c.useRef)(),tr=Object(c.useRef)(),cr=Object(c.useRef)(),xr=Object(c.useRef)(),Ur=function(){var Mt=Object(x.a)(L.a.mark(function Nt(){var Wt,Tt;return L.a.wrap(function(sn){for(;;)switch(sn.prev=sn.next){case 0:return sn.next=2,Object(Ct.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:gn.current}});case 2:Tt=sn.sent,Tt!=null&&(Wt=Tt.attachments)!==null&&Wt!==void 0&&Wt.length&&(console.log("cm:",Me,Bn),Tt.attachments.map(function(Jt){Jt.content_type.indexOf("image")>-1?Me.replaceSelection("![,](/api/attachments/".concat(Jt.id,"?type=").concat(Jt.content_type,")")):Jt.content_type.indexOf("video")>-1?Me.replaceSelection('')):Jt.content_type.indexOf("pdf")>-1?Me.replaceSelection('
    ').concat(Jt.name,"")):Me.replaceSelection("[".concat(Jt.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(Jt.id,"?type=").concat(Jt.content_type,")"))}));case 4:case"end":return sn.stop()}},Nt)}));return function(){return Mt.apply(this,arguments)}}();Object(c.useEffect)(function(){tn(X),Me==null||Me.setValue(X)},[X]),Object(c.useEffect)(function(){vn==null||vn(fn)},[fn]),Object(c.useEffect)(function(){if(Bn.current){var Mt=O.a.fromTextArea(Bn.current,{mode:Lt,lineNumbers:!dt,lineWrapping:!0,value:Be,autoCloseTags:!0,autoCloseBrackets:!0});Ae&&Mt.focus();function Nt(Wt,Tt){if(m){Tt.preventDefault();return}var rn=Tt.clipboardData;if(rn){var sn=rn.types.toString(),Jt=rn.items;if(sn==="Files"||rn.types.indexOf("Files")>-1){if(Tt.preventDefault(),Lt=="stex")return;try{var cn,Rn=Jt[1];((cn=Jt[0])===null||cn===void 0?void 0:cn.kind)==="file"&&(Rn=Jt[0]);var zt=Rn.getAsFile(),lr=zt.name.split(".").pop();Ke(zt,function(jt){if(jt.id){var Qt,Ht,In;(zt==null||((Qt=zt.type)===null||Qt===void 0)?void 0:Qt.indexOf("image"))>-1?Mt.replaceSelection("![,](/api/attachments/".concat(jt.id,"?type=").concat(jt.content_type,")")):(zt==null||((Ht=zt.type)===null||Ht===void 0)?void 0:Ht.indexOf("video"))>-1?Mt.replaceSelection('')):(zt==null||((In=zt.type)===null||In===void 0)?void 0:In.indexOf("pdf"))>-1?Mt.replaceSelection('').concat(zt.name,"")):ke.includes(lr)?Mt.replaceSelection('').concat(zt.name,"")):Mt.replaceSelection("[".concat(zt.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,"?type=").concat(jt.content_type,")"))}else(jt==null?void 0:jt.status)===401&&(document.location.href="/user/login")})}catch(jt){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Mt.on("paste",Nt),Mt.on("dragleave",function(Wt,Tt){tr.current.classList.remove("mouse-hover-md")}),Mt.on("dragover",function(Wt,Tt){tr.current.classList.add("mouse-hover-md")}),Mt.on("drop",function(Wt,Tt){tr.current.classList.add("mouse-hover-md");var rn;if(rn=Tt.dataTransfer.files,rn.length>0){Tt.preventDefault(),Tt.stopPropagation();for(var sn=function(Rn){var zt=rn[Rn],lr=zt.name.split(".").pop();Ke(zt,function(jt){if(jt.id){var Qt,Ht,In;(zt==null||((Qt=zt.type)===null||Qt===void 0)?void 0:Qt.indexOf("image"))>-1?Mt.replaceSelection("![,](/api/attachments/".concat(jt.id,"?type=").concat(jt.content_type,")")):(zt==null||((Ht=zt.type)===null||Ht===void 0)?void 0:Ht.indexOf("video"))>-1?Mt.replaceSelection('')):(zt==null||((In=zt.type)===null||In===void 0)?void 0:In.indexOf("pdf"))>-1?Mt.replaceSelection('').concat(zt.name,"")):ke.includes(lr)?Mt.replaceSelection('').concat(zt.name,"")):Mt.replaceSelection("[".concat(zt.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(jt.id,"?type=").concat(jt.content_type,")"))}else(jt==null?void 0:jt.status)===401&&(document.location.href="/user/login")})},Jt=0;Jt0||Jt.target.offsetWidth>0)&&(hr(),Me.setSize("100%","100%"),Me.refresh())}}catch(cn){rn.e(cn)}finally{rn.f()}});return Wt.observe(Bn.current.parentElement),Wt}if(Me){var Nt=Mt();return function(){Nt.unobserve(Bn.current.parentElement)}}},[Me,hr]),Object(c.useEffect)(function(){if(Me){for(var Mt=[],Nt=function(){var Jt=Tt[Wt];rn=Object(U.a)(Jt,2);var cn=rn[0],Rn=rn[1],zt=Object(N.a)({},cn,function(){Tr(Rn)});Mt.push(zt),Me.addKeyMap(zt)},Wt=0,Tt=Object.entries(Ze);Wt0){var Mt=new Date().getTime(),Nt=window.sessionStorage.getItem(hn);Mt>=on+ce&&(!Nt||Nt!==Ft)&&(window.sessionStorage.setItem(hn,Ft),kn(!0))}},ce),Object(c.useEffect)(function(){yn(tt)},[Me,tt]),Object(c.useEffect)(function(){Me&&(Ae&&Me.focus())},[Me,Ae]),Object(c.useEffect)(function(){if($t&&Me){var Mt=Me.getScrollerElement();function Nt(Wt){var Tt=Wt.target;if(xr.current){var rn=Tt.scrollTop/Tt.scrollHeight;xr.current.scrollTop=xr.current.scrollHeight*rn}}return Mt.addEventListener("scroll",Nt),function(){Mt.removeEventListener("scroll",Nt)}}},[Me,$t]),Object(c.useEffect)(function(){if(Me&&kt){function Mt(Nt,Wt){kt(Nt,Wt)}return Me.on("beforeChange",Mt),function(){Me.off("beforeChange",Mt)}}},[Me,kt]),Object(c.useEffect)(function(){if(Me&&ft){function Mt(){ft(Me.getValue())}return Me.on("blur",Mt),function(){Me.off("blur",Mt)}}},[Me,ft]),Object(c.useEffect)(function(){if(Me){function Mt(Nt){var Wt=Nt.getValue();tn(Wt),Yn(new Date().getTime()),Nt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ue&&Ue(Wt)}return Me.on("change",Mt),function(){Me.off("change",Mt)}}},[Me,Ue]),Object(c.useEffect)(function(){Me&&(Be==null?(Me.setValue(""),tn("")):Be!==Me.getValue()&&(Me.setValue(Be),tn(Be),Me.setCursor(Me.lineCount(),0)))},[Me,Be]);var Tr=Object(c.useCallback)(function(Mt){var Nt=Me.getCursor(),Wt=Me.getSelection(),Tt=Wt.split(` `);switch(Mt){case"bold":return Me.replaceSelection("**"+Wt+"**"),Wt===""&&Me.setCursor(Nt.line,Nt.ch+2),Me.focus();case"italic":return Me.replaceSelection("*"+Wt+"*"),Wt===""&&Me.setCursor(Nt.line,Nt.ch+1),Me.focus();case"code":return Me.replaceSelection("`"+Wt+"`"),Wt===""&&Me.setCursor(Nt.line,Nt.ch+1),Me.focus();case"inline-latex":return Me.replaceSelection("`$$"+Wt+"$$`"),Wt===""&&Me.setCursor(Nt.line,Nt.ch+3),Me.focus();case"latex":return Me.replaceSelection("```latex\n"+Wt+"\n```"),Me.setCursor(Nt.line+1,Wt.length+1),Me.focus();case"line-break":return Me.replaceSelection(`
    `),Me.focus();case"list-ul":return Wt===""?Me.replaceSelection("- "+Wt):Me.replaceSelection(Tt.map(function(rn){return rn===""?"":"- ".concat(rn)}).join(` `)),Me.focus();case"list-ol":return Wt===""?Me.replaceSelection("1. "+Wt):Me.replaceSelection(Tt.map(function(rn,sn){return rn===""?"":"".concat(sn+1,". ").concat(rn)}).join(` `)),Me.focus();case"add-null-ch":return Wt===""&&Me.setCursor(Nt.line,Nt.ch+1),Me.replaceSelection(ne),Me.focus();case"inster-template-1":return Wt===""&&Me.setCursor(Nt.line,Nt.ch),Me.replaceSelection(ie),Me.focus();case"eraser":return Me.setValue(""),Me.focus();case"trigger-watch":return yn(!$t),Me.focus();case"trigger-full-screen":return Sn(!fn),Me.focus();case yt:er(yt);return;case Et:er(Et);return;case wt:er(wt);return;case Te:er(Te);return;default:throw new Error}},[Me,$t,fn]),nr=Object(c.useCallback)(function(Mt){er("");switch(Gn){case yt:var Nt=Mt.title,Wt=Mt.link;return Me.replaceSelection("[".concat(Nt,"](").concat(Wt,")")),Me.focus();case Et:var Tt=Mt.language,rn=Mt.content;return Me.replaceSelection(["```"+Tt,rn,"```"].join(` `)),Me.focus();case wt:var sn=Mt.src,Jt=Mt.alt,cn=Mt.name;return sn.indexOf("type=image")>-1?Me.replaceSelection("![ ".concat(Jt||""," ]( ").concat(sn,' "').concat(Jt||"",'" )')):sn.indexOf("type=application/pdf")>-1?Me.replaceSelection('').concat(cn,"")):Me.replaceSelection('').concat(cn,"")),Me.focus();case Te:for(var Rn=Mt.row,zt=Mt.col,lr=Mt.align,jt=` `,Qt=0;Qt300&&(cn=300);var Rn=je+cn+"px";pn(Rn)}}return Mt.addEventListener("mousedown",Tt),document.addEventListener("mousemove",sn),document.addEventListener("mouseup",rn),function(){Mt.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",sn),document.removeEventListener("mouseup",rn)}}},[Me,cr]),Object(c.useEffect)(function(){pn(je)},[je]);var ar=oe(se),En=oe(br),qt={width:ar,height:En},On=Object(c.useMemo)(function(){if(on){var Mt=new Date(on),Nt=Mt.getHours(),Wt=Mt.getMinutes(),Tt=Mt.getSeconds();return Nt=Nt<10?"0"+Nt:Nt,Wt=Wt<10?"0"+Wt:Wt,Tt=Tt<10?"0"+Tt:Tt,"".concat(Nt,":").concat(Wt,":").concat(Tt)}return 0},[on]);function Kt(){window.sessionStorage.removeItem(hn),kn(!1),Yn(0)}function wn(){kn(!1),Yn(0),Me.setValue(window.sessionStorage.getItem(hn))}function _n(Mt,Nt){var Wt=Me.getValue();Wt=Wt.replace(Mt,Nt),tn(Wt),Me==null||Me.setValue(Wt)}return T.a.createElement(c.Fragment,null,T.a.createElement("div",{className:"markdown-editor-wrapper",ref:tr},T.a.createElement("div",{className:"markdown-editor-container ".concat(Zt," ").concat($t?"on-preview":""," ").concat(dt?"mini":""," ").concat(fn?"full-screen":""),style:qt},T.a.createElement(Q,{insertTemp:mt,watch:$t,fullScreen:fn,showNullButton:St,onActionCallback:Tr,hidetoolBar:an,uuid:gn.current,setOpenPhones:function(){Er.current=!0}}),T.a.createElement("div",{className:"markdown-editor-body"},T.a.createElement("div",{className:"codemirror-container"},T.a.createElement("textarea",{ref:Bn,placeholder:G})),$t?T.a.createElement("div",{ref:xr,className:"preview-container"},Lt==="stex"&&T.a.createElement(D,{value:Ft}),Lt!=="stex"&&T.a.createElement(v.a,{edit:!0,value:Ft,replaces:_n})):null))),Dt?T.a.createElement("a",{ref:cr,className:"editor-resize"}):null,T.a.createElement(V.a,null,bt[Gn]?T.a.createElement(K.a,{centered:!0,title:bt[Gn],visible:!0,onCancel:ir,footer:null},Dr):null))}},PD8m:function(Fe,Ce){Fe.exports={name:"memoryStorage",read:J,write:K,each:R,remove:H,clearAll:I};var j={};function J(x){return j[x]}function K(x,U){j[x]=U}function R(x){for(var U in j)j.hasOwnProperty(U)&&x(j[U],U)}function H(x){delete j[x]}function I(x){j={}}},QUZ3:function(Fe,Ce,j){"use strict";j.r(Ce);var J=j("0Owb"),K=j("PpiC"),R=j("T2oS"),H=j("W9HT"),I=j("+L6B"),x=j("2/Rp"),U=j("2qtc"),N=j("kLXV"),E=j("9og8"),L=j("tJVT"),c=j("k1fw"),T=j("aHsQ"),P=j("sGsY"),O=j("WmNS"),p=j.n(O),g=j("q1tI"),i=j.n(g),a=j("Fvcw"),u=j("GIiI"),h=j("Ty5D"),w=j("55Ip"),b=j("OJz4"),v=j("V0Rq"),D=j("bntm"),S=j("cDPC"),f=j("m3rI"),d=j("RCxd"),o=j("EHPI"),s=j("S+dL"),_=j.n(s),C=j("J66h"),y=j("uMZB"),M=j.n(y),B=j("p/48"),F=j("JPnl"),Q=j("y8nQ"),V=j("Vl3Y"),W=j("5NDa"),$=j("5rEg"),re=$.a.TextArea,ae=5e3,he=function(He){var ht=He.callback,St=He.onCancel,Xt=He.notes;function an(un){ht(un)}return i.a.createElement(V.a,{className:"note-form-panel",onFinish:an,initialValues:{notes:Xt}},i.a.createElement(V.a.Item,{name:"notes",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9"},{max:ae,message:"\u7B14\u8BB0\u6700\u5927\u5B57\u6570\u4E3A".concat(ae)}]},i.a.createElement(re,{placeholder:"\u8BF7\u8F93\u5165\u7B14\u8BB0\u5185\u5BB9",rows:5})),i.a.createElement(V.a.Item,{style:{textAlign:"right"}},i.a.createElement(x.a,{type:"ghost",onClick:St,style:{marginRight:10}}," \u53D6\u6D88 "),i.a.createElement(x.a,{type:"primary",htmlType:"submit"}," \u63D0\u4EA4 ")))},Se=j("H2Ag"),ye=j.n(Se),be=j("DjyN"),Oe=j("NUBc"),_e=j("miYZ"),fe=j("tsqr"),le=j("g9YV"),Re=j("wCAj"),ot=j("+k/U"),st=j.n(ot),nt=j("ye1Q"),$e=j("lfch"),Ke=j("JB8y"),Ye=j("1vsH"),ut=j("wd/R"),pt=j.n(ut),at=Re.a.Column,Qe=function(He){var ht=He.submitResult,St=He.submitting,Xt=He.submitRecords,an=He.page,un=He.onPageChange,Je=He.topicId,ft=ht||{},kt=ft.status,vn=ft.id,Gt=ft.input,Zt=ft.output,z=ft.expected_output,m=ft.is_file,A=ft.input_file_url,G=ft.output_file_url,ee=ft.expected_output_file_url,X=ft.error_msg,ve=Xt||{},Xe=ve.records,Me=ve.records_count;function At(){m?navigator.clipboard.writeText(C.Base64.decode(X)).then(function(){fe.b.success("\u590D\u5236\u9519\u8BEF\u4FE1\u606F\u6210\u529F")}):navigator.clipboard.writeText(C.Base64.decode(Zt)).then(function(){fe.b.success("\u590D\u5236\u9519\u8BEF\u4FE1\u606F\u6210\u529F")})}return i.a.createElement(H.a,{spinning:St,tip:"\u8BC4\u6D4B\u4E2D...",indicator:i.a.createElement(nt.a,{style:{fontSize:24},spin:!0})},vn?i.a.createElement(i.a.Fragment,null,i.a.createElement("ul",{className:st.a.info},i.a.createElement("li",null,"\u6267\u884C\u7ED3\u679C\uFF1A",i.a.createElement("span",{className:kt===Ke.a.OK?"c-green":"c-red"},F.a[kt])),i.a.createElement("li",{className:st.a.error},i.a.createElement("a",{onClick:At},"\u590D\u5236\u9519\u8BEF\u4FE1\u606F ",i.a.createElement($e.a,null)," ")),i.a.createElement("li",null,i.a.createElement(w.a,{to:"/myproblems/".concat(Je,"/record-detail/").concat(vn)},"\u663E\u793A\u8BE6\u60C5 >"," "))),kt!==Ke.a.OK?i.a.createElement(i.a.Fragment,null,i.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u5165\uFF1A"),i.a.createElement("pre",null,!m&&Gt,m&&i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object(Ye.w)(A,Gt)}},Gt)),i.a.createElement("p",{className:"c-red"},"\u5B9E\u9645\u8F93\u51FA\uFF1A"),i.a.createElement("pre",null,(kt===4||kt===5)&&C.Base64.decode(X),kt!=4&&kt!=5&&(m?i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object(Ye.w)(G,Zt)}},Zt):C.Base64.decode(Zt))),i.a.createElement("p",{className:"c-red"},"\u9884\u671F\u8F93\u51FA\uFF1A"),i.a.createElement("pre",null,!m&&C.Base64.decode(z),m&&i.a.createElement("a",{style:{fontSize:"16px"},onClick:function(){return Object(Ye.w)(ee,z)}},z))):null):null,(Xe==null?void 0:Xe.length)>0?i.a.createElement(Re.a,{dataSource:Xe,rowKey:"id",pagination:!1},i.a.createElement(at,{title:"\u63D0\u4EA4\u65F6\u95F4",dataIndex:"created_at",key:"created_at",render:function(Bt,Ft){return i.a.createElement("span",null," ",pt()(Bt).format("YYYY-MM-DD HH:mm:ss"))}}),i.a.createElement(at,{title:"\u63D0\u4EA4\u7ED3\u679C",dataIndex:"status",key:"status",render:function(Bt,Ft){var tn;return i.a.createElement(w.a,{className:Bt===0?"c-green":"c-red",to:"/myproblems/".concat(Je,"/record-detail/").concat(Ft.id)},(tn=F.a[Bt])===null||tn===void 0?void 0:tn.replace("\u8C03\u8BD5","\u8BC4\u6D4B"))}}),i.a.createElement(at,{title:"\u6267\u884C\u7528\u65F6 (S)",dataIndex:"execute_time",key:"execute_time"}),i.a.createElement(at,{title:"\u5185\u5B58\u6D88\u8017\uFF08MB\uFF09",dataIndex:"execute_memory",key:"execute_memory"}),i.a.createElement(at,{title:"\u8BED\u8A00",dataIndex:"language",key:"language"}),i.a.createElement(at,{title:"\u64CD\u4F5C",dataIndex:"status",key:"status",render:function(Bt,Ft){return i.a.createElement(w.a,{className:"c-light-primary",to:"/myproblems/".concat(Je,"/record-detail/").concat(Ft.id)},"\u67E5\u770B")}})):i.a.createElement("div",{style:{height:300,width:"100%"}}),Me>15?i.a.createElement(Oe.a,{className:st.a.pagination,current:an,pageSize:15,total:Me,onChange:un}):null)},rt=j("BdwD"),Rt=j("DYRE"),Ct=j("zeV3"),xt=j("+BJd"),yt=j("mr32"),wt=j("pPuO"),Et=j.n(wt),Te=j("9Bee"),xe={1:{name:"\u7B80\u5355",color:"#52c41a"},2:{name:"\u4E2D\u7B49",color:"#faad14"},3:{name:"\u56F0\u96BE",color:"#f5222d"}},ze=function(He){var ht=He.hack,St=He.onTriggerPraise,Xt=He.toDiscuss,an=ht.language,un=ht.difficult,Je=ht.time_limit,ft=ht.username,kt=ht.user_path,vn=ht.user_praise,Gt=ht.comments_count,Zt=ht.praises_count,z=ht.description,m=ht.pass_count,A=ht.submit_count,G=Object(h.h)(),ee=xe[un];return i.a.createElement(i.a.Fragment,null,i.a.createElement("ul",{className:Et.a.info},i.a.createElement("li",null,"\u7F16\u7A0B\u8BED\uFF1A",i.a.createElement("b",null,an)),i.a.createElement("li",null,"\u96BE\u5EA6\uFF1A",i.a.createElement(yt.a,{color:ee.color},ee.name)),i.a.createElement("li",null,"\u8BC4\u6D4B\u65F6\u957F\u9650\u5236\uFF1A",i.a.createElement("b",null,Je,"\u79D2"))),i.a.createElement(Te.a,{value:z,className:Et.a.desc}),i.a.createElement("ul",{className:Et.a["commit-info"]},i.a.createElement("li",null,i.a.createElement(Ct.a,{size:4},i.a.createElement("span",null,"\u901A\u8FC7\u6B21\u6570")," ",i.a.createElement("b",null,m))),i.a.createElement("li",null,i.a.createElement(Ct.a,{size:4},i.a.createElement("span",null,"\u63D0\u4EA4\u6B21\u6570")," ",i.a.createElement("b",null,A))," "),i.a.createElement("li",{style:{flex:"1 0 0"}}),G.query.type!=="exercises"&&i.a.createElement("li",null,i.a.createElement(Ct.a,{size:4},i.a.createElement("i",{className:"iconfont icon-huifu1",onClick:Xt})," ",i.a.createElement("b",null,Gt))," ")))},Ve=j("dhSg"),De=j("oBTY"),We=j("M8RZ"),ge=j("qJ4+"),de=j("ErOA");function ce(He,ht){return Object(de.c)("/problems/".concat(He,"/comments.json?page=").concat(ht,"&limit=10"))}function ne(He){return Object(de.f)("/discusses/".concat(He,"/plus.json"),{container_type:"Discuss",type:1})}function ie(He,ht,St){return Object(de.f)("/problems/".concat(He,"/comments/reply.json"),{comments:{content:St,parent_id:ht}})}function oe(He,ht){return Object(de.f)("/problems/".concat(He,"/comments.json"),{comments:{content:ht}})}function ue(He,ht,St){return Object(de.f)("/problems/".concat(He,"/comments/").concat(ht,"/hidden.json"),St)}function we(He,ht){return Object(de.b)("/problems/".concat(He,"/comments/").concat(ht))}var ke=j("U7T7"),Ze=j("AMnG");function bt(He){var ht=He.author;return i.a.createElement("a",{href:"/users/".concat(ht.login),target:"_blank"},i.a.createElement("img",{alt:"\u7528\u6237\u5934\u50CF",height:"50",style:{borderRadius:"50%"},src:"".concat(f.a.IMG_SERVER,"/images/").concat(ht.image_url),width:"50"}))}function It(He){var ht=He.data,St=He.index,Xt=He.parentDiscussIndex,an=He.user,un=He.onSetActionType,Je=ht.author,ft=ht.can_delete,kt=ht.content,vn=ht.id,Gt=ht.time;function Zt(){un({id:vn,index:St,type:"delete-discuss",parentDiscussIndex:Xt,message:"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"})}var z=an.admin||ft||Je.user_id===an.user_id;return i.a.createElement("div",{className:"discuss-item-container second-discuss "},i.a.createElement(bt,{author:Je}),i.a.createElement("section",null,i.a.createElement("div",{className:"discuss-info"},i.a.createElement("a",{href:"/users/".concat(Je.login),target:"_blank"},Je.name),i.a.createElement("span",{className:"grey"},Gt),i.a.createElement("div",{className:"btn-group",style:{marginBottom:0}},z?i.a.createElement("a",{onClick:Zt,title:"\u5220\u9664"},i.a.createElement("i",{className:"iconfont icon-shanchu"})):null)),i.a.createElement(Te.a,{className:"discuss-content",value:kt})))}var Ge=function(He){var ht=He.user,St=He.data,Xt=He.index,an=He.onPlusDiscuss,un=He.onSetActionType,Je=He.activeDiscussIndex,ft=He.onReplyDiscuss,kt=He.onSetActiveDiscussIndex,vn=St.content,Gt=St.children,Zt=St.hidden,z=St.id,m=St.praise_count,A=St.time,G=St.user_praise,ee=St.can_delete,X=St.author;function ve(){kt(z)}function Xe(){an(z,!G,Xt)}function Me(){un({id:z,index:Xt,type:"delete-discuss",message:"\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u6761\u56DE\u590D\u5417"})}function At(){un({id:z,index:Xt,params:{hidden:Zt?"0":"1"},type:"hidden-discuss",message:Zt?"\u786E\u5B9A\u8981\u53D6\u6D88\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417":"\u786E\u5B9A\u8981\u9690\u85CF\u8BE5\u6761\u56DE\u590D\u5417"})}var qe=ht.admin||ht.user_id===X.user_id;return i.a.createElement("div",{className:"discuss-item-container",key:z},i.a.createElement(bt,{author:X}),i.a.createElement("section",null,i.a.createElement("div",{className:"discuss-info"},i.a.createElement("a",{href:"/users/".concat(X.login),target:"_blank"}," ",X.name," "),i.a.createElement("span",{className:"grey"},A)),i.a.createElement(Te.a,{className:"discuss-content",value:vn}),Gt&&Gt.length>0?i.a.createElement("div",{className:"reply-discuss-container"},Gt.map(function(Bt,Ft){return i.a.createElement(It,{key:Bt.id,data:Bt,index:Ft,user:ht,onSetActionType:un,parentDiscussIndex:Xt})})):null,i.a.createElement("div",{className:"btn-group"},qe?i.a.createElement("a",{onClick:At,title:Zt?"\u53D6\u6D88\u9690\u85CF":"\u9690\u85CF\u8BC4\u8BBA"},i.a.createElement("i",{className:Zt?"iconfont icon-yincangbiyan":"fa fa-eye"})):null,ee&&(!Gt||Gt.length==0)?i.a.createElement("a",{onClick:Me,title:"\u5220\u9664"},i.a.createElement("i",{className:"iconfont icon-shanchu"})):null,i.a.createElement("a",{onClick:ve,title:"\u56DE\u590D"}," ",i.a.createElement("i",{className:"iconfont icon-huifu1"})," "),i.a.createElement("a",{onClick:Xe,className:G?"c-orange":""},i.a.createElement("i",{className:G?"iconfont icon-dianzan mr3":"iconfont icon-dianzan-xian mr3 "}),i.a.createElement("span",null,m||""))),i.a.createElement(Ze.a,{id:z,activeDiscussIndex:Je,onReplyDiscuss:ft})))},it=j("kaH+"),Be=j("uD2n"),Ue=j.n(Be),Le=j("Ot1p"),se=function(He){var ht=He.user_praise,St=He.praise_count,Xt=He.praisePlus,an=He.onCreateDiscuss,un=He.discuss_count,Je=Object(g.useState)(!1),ft=Object(L.a)(Je,2),kt=ft[0],vn=ft[1],Gt=Object(g.useState)(""),Zt=Object(L.a)(Gt,2),z=Zt[0],m=Zt[1];function A(Xe){m(Xe)}function G(){vn(!0)}function ee(){vn(!1)}function X(){return ve.apply(this,arguments)}function ve(){return ve=Object(E.a)(p.a.mark(function Xe(){return p.a.wrap(function(At){for(;;)switch(At.prev=At.next){case 0:an(z),m(""),vn(!1);case 3:case"end":return At.stop()}},Xe)})),ve.apply(this,arguments)}return i.a.createElement("div",{className:"".concat(Ue.a["dis-input-editor-container"]," ").concat(kt?Ue.a.active:""," ")},i.a.createElement("div",{className:kt?"hide ".concat(Ue.a["text-area"]):Ue.a["text-area"]},i.a.createElement("input",{placeholder:"\u8BF4\u70B9\u4EC0\u4E48",onClick:G}),i.a.createElement("a",null," ",i.a.createElement("i",{className:"iconfont icon-huifu1"})," \xA0 \xA0",un," "),i.a.createElement("a",{className:"c-light-black",onClick:Xt,title:ht?"\u53D6\u6D88\u70B9\u8D5E":"\u70B9\u8D5E"},i.a.createElement("i",{className:"mr3 ".concat(ht?"iconfont icon-dianzan c-orange":"iconfont icon-dianzan-xian"," ")}),St?i.a.createElement("span",null,St):"")),kt?i.a.createElement("div",{className:Ue.a["input-mask"],onClick:ee}):null,i.a.createElement("div",{className:kt?Ue.a["md-container"]:"".concat(Ue.a["md-container"]," hide")},i.a.createElement(Le.a,{id:"discuss-input-editor",miniToolbar:!0,watch:!1,noStorage:!0,defaultValue:z,height:240,onChange:A}),i.a.createElement("div",{className:Ue.a["tip-container"],onClick:ee},i.a.createElement("a",{className:Ue.a["btn-send"],onClick:X}," \u53D1\u9001 "))))},pe={loading:!1,page:1,data:[],count:0,actionType:null,activeDiscussIndex:null},je;(function(He){He[He.GET_DISCUSSES=0]="GET_DISCUSSES",He[He.TOP_OR_DOWN_DISCUSS=1]="TOP_OR_DOWN_DISCUSS",He[He.ACTIVE_DISCUSS_INDEX=2]="ACTIVE_DISCUSS_INDEX",He[He.PLUS_DISCUSS=3]="PLUS_DISCUSS",He[He.SET_ACTION_TYPE=4]="SET_ACTION_TYPE",He[He.SET_PAGE=5]="SET_PAGE",He[He.SHOW_DISCUSSES_LOADING=6]="SHOW_DISCUSSES_LOADING"})(je||(je={}));function Ie(He,ht){switch(ht.type){case je.SHOW_DISCUSSES_LOADING:return Object(c.a)(Object(c.a)({},He),{},{loading:!0});case je.GET_DISCUSSES:return Object(c.a)(Object(c.a)({},He),ht.payload);case je.TOP_OR_DOWN_DISCUSS:return Object(c.a)(Object(c.a)({},He),ht.payload);case je.SET_ACTION_TYPE:return Object(c.a)(Object(c.a)({},He),ht.payload);case je.PLUS_DISCUSS:return Object(c.a)(Object(c.a)({},He),ht.payload);case je.SET_PAGE:return Object(c.a)(Object(c.a)({},He),{},{page:ht.payload});case je.ACTIVE_DISCUSS_INDEX:return Object(c.a)(Object(c.a)({},He),ht.payload);default:throw new Error}}var dt=function(He){var ht=He.user,St=He.identifier,Xt=He.hack,an=He.onTriggerPraise,un=Object(g.useReducer)(Ie,pe),Je=Object(L.a)(un,2),ft=Je[0],kt=Je[1],vn=ft.loading,Gt=ft.page,Zt=ft.data,z=ft.count,m=ft.actionType,A=ft.activeDiscussIndex,G=Object(g.useCallback)(Object(E.a)(p.a.mark(function $t(){var yn,Mn,bn;return p.a.wrap(function(Sn){for(;;)switch(Sn.prev=Sn.next){case 0:return kt({type:je.SHOW_DISCUSSES_LOADING}),Sn.next=3,ce(St,Gt);case 3:yn=Sn.sent,Mn=yn.comments,bn=yn.disscuss_count,kt({type:je.GET_DISCUSSES,payload:{data:Mn,count:bn,loading:!1}});case 6:case"end":return Sn.stop()}},$t)})),[Gt,St]);Object(g.useEffect)(function(){G()},[St,Gt]);function ee($t){kt({type:je.SET_PAGE,page:$t})}function X($t){kt({type:je.SET_ACTION_TYPE,payload:{actionType:$t}})}function ve($t){A===$t?kt({type:je.ACTIVE_DISCUSS_INDEX,payload:{activeDiscussIndex:null}}):kt({type:je.ACTIVE_DISCUSS_INDEX,payload:{activeDiscussIndex:$t}})}function Xe($t,yn,Mn){return Me.apply(this,arguments)}function Me(){return Me=Object(E.a)(p.a.mark(function $t(yn,Mn,bn){var fn;return p.a.wrap(function(Tn){for(;;)switch(Tn.prev=Tn.next){case 0:return Tn.prev=0,Tn.next=3,ne(yn);case 3:fn=Tn.sent,Zt[bn].user_praise=Mn,Zt[bn].praise_count=fn.praise_count,kt({type:je.PLUS_DISCUSS,payload:{data:Object(De.a)(Zt)}}),Tn.next=12;break;case 9:Tn.prev=9,Tn.t0=Tn.catch(0),console.log(Tn.t0);case 12:case"end":return Tn.stop()}},$t,null,[[0,9]])})),Me.apply(this,arguments)}function At(){return qe.apply(this,arguments)}function qe(){return qe=Object(E.a)(p.a.mark(function $t(){var yn,Mn,bn,fn,Sn,Tn,Hn,Gn;return p.a.wrap(function(Dn){for(;;)switch(Dn.prev=Dn.next){case 0:if(yn=m.id,Mn=m.params,bn=m.type,fn=m.index,Sn=m.parentDiscussIndex,!(bn==="hidden-discuss")){Dn.next=6;break}return Dn.next=4,ue(St,yn,Mn);case 4:Sn?Zt[Sn].children[fn].hidden=Mn.hidden==1:Zt[fn].hidden=Mn.hidden==1,kt({type:je.SET_ACTION_TYPE,payload:{actionType:null,data:Object(De.a)(Zt)}});case 6:if(!(bn==="delete-discuss")){Dn.next=31;break}return Dn.next=9,we(St,yn);case 9:if(!(Sn||Sn===0)){Dn.next=22;break}Tn=Zt[Sn].children,Hn=Tn.length-1;case 12:if(!(Hn>=0)){Dn.next=19;break}if(!(Tn[Hn].id===yn)){Dn.next=16;break}return Tn.splice(Hn,1),Dn.abrupt("break",19);case 16:Hn--,Dn.next=12;break;case 19:Zt[Sn].children=Tn,Dn.next=30;break;case 22:Gn=Zt.length-1;case 23:if(!(Gn>=0)){Dn.next=30;break}if(!(Zt[Gn].id===yn)){Dn.next=27;break}return Zt.splice(Gn,1),Dn.abrupt("break",30);case 27:Gn--,Dn.next=23;break;case 30:kt({type:je.SET_ACTION_TYPE,payload:{actionType:null,data:Object(De.a)(Zt)}});case 31:case"end":return Dn.stop()}},$t)})),qe.apply(this,arguments)}function Bt(){kt({type:je.SET_ACTION_TYPE,payload:{actionType:null}})}function Ft($t,yn){return tn.apply(this,arguments)}function tn(){return tn=Object(E.a)(p.a.mark(function $t(yn,Mn){return p.a.wrap(function(fn){for(;;)switch(fn.prev=fn.next){case 0:return fn.prev=0,fn.next=3,ie(St,yn,Mn);case 3:G(),fn.next=9;break;case 6:fn.prev=6,fn.t0=fn.catch(0),console.log(fn.t0);case 9:case"end":return fn.stop()}},$t,null,[[0,6]])})),tn.apply(this,arguments)}function zn($t){return Wn.apply(this,arguments)}function Wn(){return Wn=Object(E.a)(p.a.mark(function $t(yn){return p.a.wrap(function(bn){for(;;)switch(bn.prev=bn.next){case 0:return kt({type:je.SHOW_DISCUSSES_LOADING}),bn.next=3,oe(St,yn);case 3:G();case 4:case"end":return bn.stop()}},$t)})),Wn.apply(this,arguments)}return i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{className:"discuss-panel"},Zt.length===0?i.a.createElement(rt.a,null):Zt.map(function($t,yn){return i.a.createElement(Ge,{onReplyDiscuss:Ft,onPlusDiscuss:Xe,onSetActiveDiscussIndex:ve,onSetActionType:X,data:$t,index:yn,user:ht,activeDiscussIndex:A})}),z>10?i.a.createElement("div",{className:"pagination-container"},i.a.createElement(Oe.a,{showQuickJumper:!0,onChange:ee,current:Gt,total:z})):null),i.a.createElement(se,{user_praise:Xt.user_praise,praise_count:Xt.praises_count,praisePlus:an,discuss_count:Xt.comments_count,onCreateDiscuss:zn}),i.a.createElement(We.a,null,i.a.createElement(N.a,{centered:!0,title:"\u63D0\u793A",visible:!!m,onOk:At,onCancel:Bt},i.a.createElement("p",null,m?m.message:"")),i.a.createElement(it.a,null)))},lt=function(He){var ht=He.hack;return i.a.createElement("div",{style:{padding:20}},i.a.createElement("div",{className:"font16 c-grey-333"},"\u6837\u4F8B\u4EE3\u7801\uFF1A"),i.a.createElement(Te.a,{hasMask:!0,value:ht==null?void 0:ht.standard_answer,zoomImg:!0}))},Ae=function(He){var ht=He.hack,St=He.onTriggerPraise,Xt=He.topicId,an=He.page,un=He.onPageChange,Je=He.user,ft=He.submitRecords,kt=He.submitting,vn=He.submitResult,Gt=Object(g.useState)("0"),Zt=Object(L.a)(Gt,2),z=Zt[0],m=Zt[1],A=Object(h.h)();function G(X){var ve=X.target.id;m(ve)}Object(g.useEffect)(function(){var X=Ve.a.subscribe("to-commit-info",function(){m("1")});return X},[]);function ee(){m("2")}return console.log(ft,"submitRecords"),i.a.createElement("div",{className:ye.a["left-panel"]},i.a.createElement("ul",{className:"".concat(ye.a["s-navs"],' "bg-white"')},i.a.createElement("li",null,i.a.createElement("a",{className:z==="0"?ye.a.active:"",id:"0",onClick:G},"\u4EFB\u52A1\u63CF\u8FF0")),i.a.createElement("li",null,i.a.createElement("a",{className:z==="1"?ye.a.active:"",id:"1",onClick:G},"\u63D0\u4EA4\u8BB0\u5F55")),A.query.type!=="exercises"&&i.a.createElement("li",null,i.a.createElement("a",{className:z==="2"?ye.a.active:"",id:"2",onClick:G},"\u8BC4\u8BBA")),i.a.createElement("li",null,i.a.createElement("a",{className:z==="3"?ye.a.active:"",id:"3",onClick:G},"\u6837\u4F8B\u4EE3\u7801"))),i.a.createElement("div",{className:"".concat(ye.a["tab-panel-body"]," ").concat(z==="0"?"":"hide")},i.a.createElement(ze,{hack:ht,onTriggerPraise:St,toDiscuss:ee})),i.a.createElement("div",{className:"".concat(ye.a["tab-panel-body"]," ").concat(z==="1"?"":"hide")},!!(ft!=null&&ft.records_count)||kt?i.a.createElement(Qe,{page:an,onPageChange:un,topicId:Xt,submitting:kt,submitRecords:ft,submitResult:vn}):i.a.createElement(rt.a,null)),i.a.createElement("div",{className:"".concat(ye.a["tab-panel-body"]," ").concat(z==="2"?"":"hide"),style:{padding:0}},i.a.createElement(dt,{user:Je,identifier:ht.identifier,hack:ht,onTriggerPraise:St})),i.a.createElement("div",{className:"".concat(ye.a["tab-panel-body"]," ").concat(z==="3"?"":"hide"),style:{padding:0}},i.a.createElement(lt,{hack:ht})))},tt=P.a.Countdown,mt={Java:"java",C:"c",Python:"py","C++":"c"},gt;(function(He){He[He.SET_LOADING=0]="SET_LOADING",He[He.GET_DATA=1]="GET_DATA",He[He.GET_SUBMIT_RECORDS=2]="GET_SUBMIT_RECORDS",He[He.SET_DATA=3]="SET_DATA",He[He.SET_DEBUGING=4]="SET_DEBUGING",He[He.SET_SUBMITING=5]="SET_SUBMITING",He[He.SET_EXECUTE_MESSAGE=6]="SET_EXECUTE_MESSAGE",He[He.SET_EXECUTE_RESULT=7]="SET_EXECUTE_RESULT",He[He.SET_SUBMIT_RESULT=8]="SET_SUBMIT_RESULT",He[He.SET_SHOW_NOTE=9]="SET_SHOW_NOTE",He[He.SET_PAGE=10]="SET_PAGE"})(gt||(gt={}));function Lt(){return new Date().getTime()}var mn={loading:!0,data:void 0,showNote:!1,debugResult:void 0,submitResult:void 0,debuging:!1,submitting:!1,submitRecords:void 0,submitRecordPage:1,executingMessage:""};function hn(He,ht){switch(ht.type){case gt.GET_DATA:return Object(c.a)(Object(c.a)({},He),ht.payload);case gt.SET_DATA:return Object(c.a)(Object(c.a)({},He),{},{data:ht.payload});case gt.SET_LOADING:return Object(c.a)(Object(c.a)({},He),{},{loading:ht.payload});case gt.SET_SHOW_NOTE:return Object(c.a)(Object(c.a)({},He),{},{showNote:ht.payload});case gt.SET_DEBUGING:return Object(c.a)(Object(c.a)({},He),{},{debuging:ht.payload});case gt.SET_SUBMITING:return Object(c.a)(Object(c.a)({},He),{},{submitting:ht.payload});case gt.GET_SUBMIT_RECORDS:return Object(c.a)(Object(c.a)({},He),{},{submitRecords:ht.payload});case gt.SET_PAGE:return Object(c.a)(Object(c.a)({},He),{},{submitRecordPage:ht.payload});case gt.SET_EXECUTE_MESSAGE:return Object(c.a)(Object(c.a)({},He),{},{executingMessage:ht.payload});case gt.SET_EXECUTE_RESULT:return Object(c.a)(Object(c.a)({},He),ht.payload);case gt.SET_SUBMIT_RESULT:return Object(c.a)(Object(c.a)({},He),ht.payload);default:throw new Error}}var en=Ce.default=function(He){var ht,St,Xt,an=He.children,un=Object(g.useReducer)(hn,mn),Je=Object(L.a)(un,2),ft=Je[0],kt=Je[1],vn=Object(h.i)(),Gt=vn.id,Zt=Object(h.g)(),z=Object(h.h)(),m=ft.loading,A=ft.data,G=ft.debugResult,ee=ft.submitResult,X=ft.submitRecords,ve=ft.submitRecordPage,Xe=ft.showNote,Me=ft.debuging,At=ft.submitting,qe=ft.executingMessage,Bt=Object(g.useState)("#FFF"),Ft=Object(L.a)(Bt,2),tn=Ft[0],zn=Ft[1],Wn=Object(g.useState)(null),$t=Object(L.a)(Wn,2),yn=$t[0],Mn=$t[1],bn=Object(g.useState)({}),fn=Object(L.a)(bn,2),Sn=fn[0],Tn=fn[1],Hn=Object(g.useState)(!0),Gn=Object(L.a)(Hn,2),er=Gn[0],Dn=Gn[1],Or=A==null?void 0:A.user,on=A==null?void 0:A.hack;Object(g.useEffect)(function(){function En(){return qt.apply(this,arguments)}function qt(){return qt=Object(E.a)(p.a.mark(function On(){var Kt,wn,_n,Mt,Nt,Wt,Tt,rn,sn,Jt,cn;return p.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return Dn(!0),zt.next=3,Object(b.d)(Gt);case 3:if(Kt=zt.sent,setTimeout(function(){Dn(!1)},800),Kt.status===401?document.location.href="/user/login":(Kt.hack.code=C.Base64.decode(Kt.hack.code),kt({type:gt.GET_DATA,payload:{loading:!1,data:Kt}})),!(z.query.type==="exercises")){zt.next=18;break}if(!(z.query.coursesId=="coursesId")){zt.next=13;break}return zt.next=10,Object(v.Y)({categoryId:z.query.exercisesId,login:z.query.login});case 10:Nt=zt.sent,zt.next=16;break;case 13:return zt.next=15,Object(v.y)({categoryId:z.query.exercisesId,login:z.query.login});case 15:Nt=zt.sent;case 16:Tn(Object(c.a)({},Nt)),(wn=Nt)!==null&&wn!==void 0&&wn.left_banner_id&&(_n=Nt)!==null&&_n!==void 0&&(Mt=_n.exercise)!==null&&Mt!==void 0&&Mt.left_time&&(Mn(Date.now()+((Wt=Nt)===null||Wt===void 0||((Tt=Wt.exercise)===null||Tt===void 0)?void 0:Tt.left_time)*1e3),setTimeout(function(){zn("red")},(((rn=Nt)===null||rn===void 0||((sn=rn.exercise)===null||sn===void 0)?void 0:sn.left_time)-300>0?((Jt=Nt)===null||Jt===void 0||((cn=Jt.exercise)===null||cn===void 0)?void 0:cn.left_time)-300:0)*1e3));case 18:case"end":return zt.stop()}},On)})),qt.apply(this,arguments)}Gt&&En()},[Gt]),Object(g.useEffect)(function(){return Ar(),z.query.type==="exercises"&&(document.addEventListener(Object(D.c)(),Yn),window.focus(),window.onblur=function(){Object(D.a)()&&Object(D.b)()}),function(){document.removeEventListener(Object(D.c)(),Yn)}},[Gt,ve]);var Yn=function(){window.parent.postMessage("backExercise","*")};function Ar(){return yr.apply(this,arguments)}function yr(){return yr=Object(E.a)(p.a.mark(function En(){var qt;return p.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.prev=0,Kt.next=3,Object(b.f)(Gt,{limit:15,page:ve});case 3:qt=Kt.sent,kt({type:gt.GET_SUBMIT_RECORDS,payload:qt}),Kt.next=10;break;case 7:Kt.prev=7,Kt.t0=Kt.catch(0),console.log(Kt.t0);case 10:case"end":return Kt.stop()}},En,null,[[0,7]])})),yr.apply(this,arguments)}function br(En){kt({type:gt.SET_PAGE,payload:En})}function pn(){return nn.apply(this,arguments)}function nn(){return nn=Object(E.a)(p.a.mark(function En(){var qt;return p.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.next=2,Object(b.k)(Gt,{code:C.Base64.encode(on.code)});case 2:return qt=Kt.sent,Kt.abrupt("return",qt);case 4:case"end":return Kt.stop()}},En)})),nn.apply(this,arguments)}function Pn(){return dn.apply(this,arguments)}function dn(){return dn=Object(E.a)(p.a.mark(function En(){var qt,On,Kt,wn,_n,Mt,Nt;return p.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:if(!At){Tt.next=2;break}return Tt.abrupt("return");case 2:return kt({type:gt.SET_SUBMITING,payload:!0}),Tt.prev=3,Tt.next=6,Object(b.l)(Gt);case 6:return Ve.a.publish("to-commit-info"),Tt.next=9,pn();case 9:if(qt=Tt.sent,console.log(qt,1),!(qt.status===0)){Tt.next=25;break}return Nt=function(){return Nt=Object(E.a)(p.a.mark(function sn(){var Jt,cn,Rn,zt,lr,jt;return p.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(b.c)(Gt,"submit");case 2:if(Jt=Ht.sent,cn=Jt.status,Rn=Jt.data,zt=Lt(),lr=zt-_n>(wn+3)*1e3,cn!==0&&!lr&&setTimeout(Mt,1e3),!lr){Ht.next=12;break}return N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8BC4\u6D4B\u4EE3\u7801\u8D85\u65F6"}),kt({type:gt.SET_SUBMITING,payload:!1}),Ht.abrupt("return");case 12:if(!(cn===0)){Ht.next=18;break}return Rn.status===2&&N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8BC4\u6D4B\u4EE3\u7801\u8D85\u65F6"}),Ht.next=16,Object(b.f)(Gt,{limit:15,page:ve});case 16:jt=Ht.sent,kt({type:gt.SET_SUBMIT_RESULT,payload:Object(c.a)(Object(c.a)({},ft),{},{submitResult:Rn,submitting:!1,submitRecords:jt})});case 18:case"end":return Ht.stop()}},sn)})),Nt.apply(this,arguments)},Mt=function(){return Nt.apply(this,arguments)},On={},z.query.type==="exercises"&&(On.extras={exercise_id:z.query.exercisesId,question_id:z.query.questionId}),Tt.next=18,Object(b.h)(Gt,On);case 18:if(Kt=Tt.sent,!(Kt.status===-1)){Tt.next=22;break}return window.parent.location.href="/classrooms/".concat(z.query.coursesId,"/exercise/").concat(z.query.exercisesId,"/detail"),Tt.abrupt("return");case 22:wn=on.time_limit,_n=Lt(),Mt();case 25:Tt.next=31;break;case 27:Tt.prev=27,Tt.t0=Tt.catch(3),console.log(Tt.t0),kt({type:gt.SET_SUBMITING,payload:!1});case 31:case"end":return Tt.stop()}},En,null,[[3,27]])})),dn.apply(this,arguments)}function kn(){return gn.apply(this,arguments)}function gn(){return gn=Object(E.a)(p.a.mark(function En(){var qt,On,Kt,wn,_n,Mt,Nt;return p.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:return ft.debuging=!0,kt({type:gt.SET_DEBUGING,payload:!0}),Tt.prev=2,Tt.next=5,pn();case 5:if(qt=Tt.sent,!(qt.status===0)){Tt.next=22;break}return Nt=function(){return Nt=Object(E.a)(p.a.mark(function sn(){var Jt,cn,Rn,zt,lr,jt;return p.a.wrap(function(Ht){for(;;)switch(Ht.prev=Ht.next){case 0:return Ht.next=2,Object(b.c)(Gt,"debug");case 2:if(Jt=Ht.sent,cn=Jt.status,Rn=Jt.message,zt=Jt.data,lr=Lt(),jt=lr-_n>(On+3)*1e3,cn!==0&&!jt&&(kt({type:gt.SET_EXECUTE_MESSAGE,payload:Rn}),setTimeout(Mt,1e3)),!jt){Ht.next=13;break}return N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),kt({type:gt.SET_DEBUGING,payload:!1}),Ht.abrupt("return");case 13:cn===0&&(kt({type:gt.SET_DEBUGING,payload:!1}),zt.status===2&&N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),zt.status===2&&N.a.error({centered:!0,okText:"\u77E5\u9053\u5566",content:"\u8C03\u8BD5\u4EE3\u7801\u8D85\u65F6"}),kt({type:gt.SET_EXECUTE_RESULT,payload:Object(c.a)(Object(c.a)({},ft),{},{debugResult:zt,debuging:!1})}));case 14:case"end":return Ht.stop()}},sn)})),Nt.apply(this,arguments)},Mt=function(){return Nt.apply(this,arguments)},On=on.time_limit,Kt={input:encodeURIComponent(A.test_case.input)},z.query.type==="exercises"&&(Kt.exercise_id=z.query.exercisesId),Tt.next=14,Object(b.b)(Gt,Kt);case 14:if(wn=Tt.sent,!(wn.status===-1)){Tt.next=18;break}return window.parent.location.href="/classrooms/".concat(z.query.coursesId,"/exercise/").concat(z.query.exercisesId,"/detail"),Tt.abrupt("return");case 18:_n=Lt(),Mt(),Tt.next=23;break;case 22:kt({type:gt.SET_DEBUGING,payload:!1});case 23:Tt.next=28;break;case 25:Tt.prev=25,Tt.t0=Tt.catch(2),console.log(Tt.t0);case 28:return Tt.prev=28,Tt.finish(28);case 30:case"end":return Tt.stop()}},En,null,[[2,25,28,30]])})),gn.apply(this,arguments)}function Er(En){kt({type:gt.SET_DATA,payload:Object(c.a)(Object(c.a)({},A),{},{hack:Object(c.a)(Object(c.a)({},on),{},{code:En})})})}function Un(En){var qt=En.target.value;kt({type:gt.SET_DATA,payload:Object(c.a)(Object(c.a)({},A),{},{test_case:{input:qt}})})}function Bn(){return tr.apply(this,arguments)}function tr(){return tr=Object(E.a)(p.a.mark(function En(){var qt;return p.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.prev=0,Kt.next=3,Object(b.g)(Gt);case 3:qt=Kt.sent,qt.status===401?Zt.replace("/login",{from:z.pathname}):Er(C.Base64.decode(qt.code)),Kt.next=10;break;case 7:Kt.prev=7,Kt.t0=Kt.catch(0),console.log(Kt.t0);case 10:case"end":return Kt.stop()}},En,null,[[0,7]])})),tr.apply(this,arguments)}function cr(){N.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:i.a.createElement("p",null,"\u521D\u59CB\u4EE3\u7801\u6709\u4FEE\u6539\uFF0C\u66F4\u65B0\u540E\u5C06\u8986\u76D6\u73B0\u6709\u4EE3\u7801\u54E6~ ",i.a.createElement("br",null),"\u8BF7\u5C06\u60A8\u7F16\u8F91\u7684\u4EE3\u7801\u4FDD\u5B58\u81F3\u672C\u5730\uFF0C\u4EE5\u9632\u4E22\u5931"),onOk:function(){return Object(E.a)(p.a.mark(function qt(){var On;return p.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return wn.next=2,Object(b.i)(Gt);case 2:On=wn.sent,On.status===401?Zt.replace("/login",{from:z.pathname}):Er(C.Base64.decode(On.code));case 4:case"end":return wn.stop()}},qt)}))()}})}function xr(){kt({type:gt.SET_SHOW_NOTE,payload:!0})}function Ur(){kt({type:gt.SET_SHOW_NOTE,payload:!1})}function hr(En){return Tr.apply(this,arguments)}function Tr(){return Tr=Object(E.a)(p.a.mark(function En(qt){return p.a.wrap(function(Kt){for(;;)switch(Kt.prev=Kt.next){case 0:return Kt.next=2,Object(b.a)(Gt,qt);case 2:kt({type:gt.GET_DATA,payload:{showNote:!1,data:Object(c.a)(Object(c.a)({},A),{},{hack:Object(c.a)(Object(c.a)({},on),{},{notes:qt.notes})})}});case 3:case"end":return Kt.stop()}},En)})),Tr.apply(this,arguments)}var nr={input:A==null||((ht=A.test_case)===null||ht===void 0)?void 0:ht.input,language:on==null?void 0:on.language,code:on==null?void 0:on.code,title:"main."+mt[on==null?void 0:on.language],modify_code:on==null?void 0:on.modify_code,notes:on==null?void 0:on.notes,debugResult:G,debuging:Me,submitting:At,executingMessage:qe,onCancelNote:Ur,onAddNote:hr,showNote:Xe,onShowNote:xr,onSubmitCode:Pn,onChangeCode:Er,onChangeInput:Un,onDebugCode:kn,onResetCode:Bn,onSyncCode:cr,onUpdateCode:pn};function Dr(){return ir.apply(this,arguments)}function ir(){return ir=Object(E.a)(p.a.mark(function En(){var qt,On,Kt;return p.a.wrap(function(_n){for(;;)switch(_n.prev=_n.next){case 0:return _n.next=2,Object(b.j)(on.id,{container_type:"Hack",type:1});case 2:qt=_n.sent,On=qt.praise_count,Kt=Object(c.a)(Object(c.a)({},A),{},{hack:Object(c.a)(Object(c.a)({},on),{},{praises_count:On,user_praise:!on.user_praise})}),kt({type:gt.SET_DATA,payload:Kt});case 6:case"end":return _n.stop()}},En)})),ir.apply(this,arguments)}var ar={topicId:Gt,submitResult:ee,submitRecords:X,submitting:At,page:ve,onPageChange:br,hack:on,user:A==null?void 0:A.user,onTriggerPraise:Dr};return i.a.createElement(i.a.Fragment,null,i.a.createElement(H.a,{spinning:m,delay:500},A?i.a.createElement(i.a.Fragment,null,i.a.createElement("header",{className:M.a.header},z.query.type!=="exercises"&&i.a.createElement("div",null,i.a.createElement("img",{src:"".concat(f.a.IMG_SERVER,"/images/").concat(Or.image_url),alt:"user",width:30}),i.a.createElement("span",null,Or.name)),i.a.createElement("h2",null," ",on.name," "),Or.hack_manager?i.a.createElement(w.a,{className:M.a.btn_back,to:"/problems/".concat(on.identifier,"/edit"),style:{marginRight:10}}," ",i.a.createElement(a.a,null)," \u7F16\u8F91"):null,(Sn==null||((St=Sn.exercise)===null||St===void 0)?void 0:St.left_time)&&i.a.createElement(i.a.Fragment,null,i.a.createElement("span",{style:{color:tn},className:"iconfont icon-kaoshishichang mr5"}),i.a.createElement("span",{className:"c-white mr20"},i.a.createElement(tt,{valueStyle:{color:tn,fontSize:16,fontWeight:"normal"},title:i.a.createElement("span",{style:{color:tn,fontSize:16}},"\u5269\u4F59\u65F6\u95F4\uFF1A"),value:yn,onFinish:Object(E.a)(p.a.mark(function En(){var qt,On;return p.a.wrap(function(wn){for(;;)switch(wn.prev=wn.next){case 0:return wn.next=2,Object(v.Z)({categoryId:z.query.exercisesId,commit_method:2});case 2:qt=wn.sent,(qt==null?void 0:qt.status)===0&&(pn(),N.a.info({width:530,title:"\u63D0\u793A",centered:!0,okText:"\u786E\u5B9A",content:i.a.createElement("div",{className:"tc font16"},"\u7B54\u9898\u7ED3\u675F\u4E86\uFF0C\u7CFB\u7EDF\u5DF2\u81EA\u52A8\u63D0\u4EA4\u8BD5\u5377",i.a.createElement("br",null),"\u4E0D\u80FD\u518D\u4FEE\u6539\u7B54\u9898"),onOk:function(){var _n=Object(E.a)(p.a.mark(function Nt(){return p.a.wrap(function(Tt){for(;;)switch(Tt.prev=Tt.next){case 0:window.parent.location.href="/classrooms/".concat(z.query.coursesId,"/exercise/").concat(z.query.exercisesId,"/detail");case 1:case"end":return Tt.stop()}},Nt)}));function Mt(){return _n.apply(this,arguments)}return Mt}()})),(qt==null?void 0:qt.status)===-3&&(On=parseInt(qt==null?void 0:qt.message),Mn(Date.now()+On*1e3));case 5:case"end":return wn.stop()}},En)}))}))),(z==null||((Xt=z.query)===null||Xt===void 0)?void 0:Xt.type)==="exercises"?i.a.createElement(x.a,{type:"primary",onClick:function(){pn(),N.a.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:i.a.createElement("div",{className:"tc"},"\u8BF7\u786E\u8BA4\u4F60\u7684\u7B54\u9898\u5185\u5BB9\u5DF2\u7ECF\u63D0\u4EA4\uFF1F"),onOk:function(){var qt=Object(E.a)(p.a.mark(function Kt(){return p.a.wrap(function(_n){for(;;)switch(_n.prev=_n.next){case 0:return _n.next=2,Object(b.l)(Gt);case 2:Yn();case 3:case"end":return _n.stop()}},Kt)}));function On(){return qt.apply(this,arguments)}return On}()})}},i.a.createElement("span",{className:"iconfont icon-yiguanbi mr5 font14"})," \u8FD4\u56DE\u8BD5\u5377"):i.a.createElement(w.a,{className:M.a.btn_back,to:"/problemset"}," ",i.a.createElement(u.a,null),"\u9000\u51FA")),i.a.createElement(H.a,{size:"large",spinning:er},i.a.createElement(S.a,{className:"my-problems",leftChild:i.a.createElement(Ae,ar),rightChild:i.a.createElement(xn,nr)}))):null))};function Dt(He){var ht=He.title,St=He.modify_code,Xt=He.onSyncCode,an=He.onShowCodeSetting,un=He.onResetCode,Je=function(){N.a.confirm({title:"\u6062\u590D\u521D\u59CB\u4EE3\u7801",icon:i.a.createElement(d.a,null),content:"\u4F60\u5728\u672C\u6587\u4EF6\u4E2D\u4FEE\u6539\u7684\u5185\u5BB9\u5C06\u4E22\u5931\uFF0C\u662F\u5426\u786E\u5B9A\u91CD\u65B0\u52A0\u8F7D\u521D\u59CB\u4EE3\u7801\uFF1F",centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",onOk:un})};return i.a.createElement("div",{className:"action-bar"},i.a.createElement("span",null),St?i.a.createElement("a",{title:"\u66F4\u65B0\u901A\u77E5",onClick:Xt},i.a.createElement("img",{src:_.a,alt:"notice"})):null,i.a.createElement("a",{title:"\u6062\u590D\u521D\u59CB\u4EE3\u7801",onClick:Je},i.a.createElement("i",{className:"iconfont icon-zhongzhi font-20 "})),i.a.createElement("a",{onClick:an},i.a.createElement("i",{className:"iconfont icon-shezhi"})))}function xn(He){var ht=He.input,St=He.showNote,Xt=He.onShowNote,an=He.notes,un=He.onCancelNote,Je=He.onAddNote,ft=He.debugResult,kt=He.language,vn=He.debuging,Gt=He.submitting,Zt=He.executingMessage,z=He.code,m=He.onSubmitCode,A=He.onDebugCode,G=He.onChangeCode,ee=He.onChangeInput,X=He.onUpdateCode,ve=Object(K.a)(He,["input","showNote","onShowNote","notes","onCancelNote","onAddNote","debugResult","language","debuging","submitting","executingMessage","code","onSubmitCode","onDebugCode","onChangeCode","onChangeInput","onUpdateCode"]);function Xe(At){return i.a.createElement(Dt,Object(J.a)({},ve,{onShowCodeSetting:At}))}var Me={input:ht,debugResult:ft,debuging:vn,submitting:Gt,executingMessage:Zt,onDebugCode:A,onChangeCode:G,onSubmitCode:m,onChangeInput:ee};return i.a.createElement("div",{className:"right-panel"},i.a.createElement(o.a,{language:kt,value:z,onChange:G,ActionBarRender:Xe}),i.a.createElement("div",{className:"note-form-area ".concat(St?"active":"")},i.a.createElement(he,{onCancel:un,notes:an,callback:Je})),i.a.createElement(F.b,Me))}},RELg:function(Fe,Ce,j){var J=j("MFOe"),K=J.Global;Fe.exports={name:"oldIE-userDataStorage",write:U,read:N,each:E,remove:L,clearAll:c};var R="storejs",H=K.document,I=O(),x=(K.navigator?K.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function U(p,g){if(x)return;var i=P(p);I(function(a){a.setAttribute(i,g),a.save(R)})}function N(p){if(x)return;var g=P(p),i=null;return I(function(a){i=a.getAttribute(g)}),i}function E(p){I(function(g){for(var i=g.XMLDocument.documentElement.attributes,a=i.length-1;a>=0;a--){var u=i[a];p(g.getAttribute(u.name),u.name)}})}function L(p){var g=P(p);I(function(i){i.removeAttribute(g),i.save(R)})}function c(){I(function(p){var g=p.XMLDocument.documentElement.attributes;p.load(R);for(var i=g.length-1;i>=0;i--)p.removeAttribute(g[i].name);p.save(R)})}var T=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function P(p){return p.replace(/^\d/,"___$&").replace(T,"___")}function O(){if(!H||!H.documentElement||!H.documentElement.addBehavior)return null;var p="script",g,i,a;try{i=new ActiveXObject("htmlfile"),i.open(),i.write("<"+p+">document.w=window'),i.close(),g=i.w.frames[0].document,a=g.createElement("div")}catch(u){a=H.createElement("div"),g=H.body}return function(u){var h=[].slice.call(arguments,0);h.unshift(a),g.appendChild(a),a.addBehavior("#default#userData"),a.load(R),u.apply(this,h),g.removeChild(a);return}}},"S+dL":function(Fe,Ce){Fe.exports="data:image/gif;base64,R0lGODlhFAAQAOZVAD6Q33p6ezZto2VnaW5vcDuCxiYvNysvM1tdXzNij5eXlyg0QTA0OExOUWZnaS8zN19hYzFYf0Oi/Sg1QoeHh2JjZWZoaTdzrTRmljl5tzFZgDBWez6P3Tl4tjl8uzdxqWBiYys/VCUqL39/gHV2dy4yNScyPDJeiEpNTzk8P0CX6jc7PiYuNWlqaywwNDZtojAzNytDWScrLitAVUGb8Xl6eoWFhTp+wDNgjWRmZ4+QkFdZWzo9QIODgyo/Uzh3syg0QCczPmprbTRllW9wcSotMVJUVjZupDuEylBSVUGb8kxPUZGRkTd0rUGc82JkZUKe9j2M1zg7P4iIiEOj/yUpLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6N0U3Nzk1NkY5QkRGMTFFQUIzQzFDQjY5MEVFODZDMDciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6N0U3Nzk1NzA5QkRGMTFFQUIzQzFDQjY5MEVFODZDMDciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3RTc3OTU2RDlCREYxMUVBQjNDMUNCNjkwRUU4NkMwNyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo3RTc3OTU2RTlCREYxMUVBQjNDMUNCNjkwRUU4NkMwNyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KBgH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZFRENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAUyAFUALAAAAAAUABAAAAd5gFWCg4RSLoSIiVUPFlNEhAwDCIoyST1TUwGCBwM6AweJPCSYmJpVCAMMgykgFRUtFKSlilVCsreZtAS4sqaJu7yzisDBvhAKyBDEvL6Iy7jNhA7BwoklKA0NRiO30bRFOzakpqiqtItPsTWbA0wWoOcrOUuEMA6TgQAh+QQFMgBVACwAAAAAFAAQAAAHeIBVgoOEISaEiIlVExlUSIQLAgmKIidOVFQAggYCNAIGiTFRmJiaVQkCC4MzHxcXHhKkpYpVN7K3mbQFuLKmibu8s4rAwb4YpBjEvL6IyrjMhB3BwolBGxEROCq30LQsQ1CkpqiqtItNsRybAkpHoOY+PxqEQC+TgQA7"},"SA+Z":function(Fe,Ce,j){var J=j("wTVA"),K=j("EbDI"),R=j("ZhPi"),H=j("wkBT");function I(x){return J(x)||K(x)||R(x)||H()}Fe.exports=I,Fe.exports.__esModule=!0,Fe.exports.default=Fe.exports},SJMd:function(Fe,Ce){/** * @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 j,J,K,R=!1,H,I;window.PR_SHOULD_USE_CONTINUATION=!0;var x,U;(function(){var N=window,E=["break,continue,do,else,for,if,return,while"],L=[E,"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"],c=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],T=[c,"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=[c,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],O=[c,"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"],p="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",g=[c,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],i="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",a=[E,"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=[E,"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"],h=[E,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[T,O,P,g,i,a,u,h],b=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,v="str",D="kwd",S="com",f="typ",d="lit",o="pun",s="pln",_="tag",C="dec",y="src",M="atn",B="atv",F="nocode",Q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function V(Ke){for(var Ye=0,ut=!1,pt=!1,at=0,Qe=Ke.length;at122||(ne<65||ce>90||ze.push([Math.max(65,ce)|32,Math.min(ne,90)|32]),ne<97||ce>122||ze.push([Math.max(97,ce)&~32,Math.min(ne,122)&~32]))}}ze.sort(function(we,ke){return we[0]-ke[0]||ke[1]-we[1]});for(var ie=[],oe=[],We=0;Weue[0]&&(ue[1]+1>ue[0]&&De.push("-"),De.push(xt(ue[1])))}return De.push("]"),De.join("")}function wt(Te){for(var xe=Te.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),ze=xe.length,Ve=[],De=0,We=0;De=2&&ce==="["?xe[De]=yt(ge):ce!=="\\"&&(xe[De]=ge.replace(/[a-zA-Z]/g,function(oe){var ue=oe.charCodeAt(0);return"["+String.fromCharCode(ue&~32,ue|32)+"]"}))}return xe.join("")}for(var Et=[],at=0,Qe=Ke.length;at=0;)ut[Et.charAt(Te)]=wt;var xe=wt[1],ze=""+xe;Ct.hasOwnProperty(ze)||(Rt.push(xe),Ct[ze]=null)}Rt.push(/[\0-\uffff]/),pt=V(Rt)})();var at=Ye.length,Qe=function(rt){for(var Rt=rt.sourceCode,Ct=rt.basePos,xt=rt.sourceNode,yt=[Ct,s],wt=0,Et=Rt.match(pt)||[],Te={},xe=0,ze=Et.length;xe=5&&De.substring(0,5)==="lang-",ge&&!(We&&typeof We[1]=="string")&&(ge=!1,De=y),ge||(Te[Ve]=De)}var ne=wt;if(wt+=Ve.length,!ge)yt.push(Ct+ne,De);else{var ie=We[1],oe=Ve.indexOf(ie),ue=oe+ie.length;We[2]&&(ue=Ve.length-We[2].length,oe=ue-ie.length);var we=De.substring(5);$(xt,Ct+ne,Ve.substring(0,oe),Qe,yt),$(xt,Ct+ne+oe,ie,le(we,ie),yt),$(xt,Ct+ne+ue,Ve.substring(ue),Qe,yt)}}rt.decorations=yt};return Qe}function Se(Ke){var Ye=[],ut=[];Ke.tripleQuotedStrings?Ye.push([v,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ke.multiLineStrings?Ye.push([v,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Ye.push([v,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ke.verbatimStrings&&ut.push([v,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var pt=Ke.hashComments;pt&&(Ke.cStyleComments?(pt>1?Ye.push([S,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Ye.push([S,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),ut.push([v,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Ye.push([S,/^#[^\r\n]*/,null,"#"])),Ke.cStyleComments&&(ut.push([S,/^\/\/[^\r\n]*/,null]),ut.push([S,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var at=Ke.regexLiterals;if(at){var Qe=at>1?"":` \r`,rt=Qe?".":"[\\S\\s]",Rt="/(?=[^/*"+Qe+"])(?:[^/\\x5B\\x5C"+Qe+"]|\\x5C"+rt+"|\\x5B(?:[^\\x5C\\x5D"+Qe+"]|\\x5C"+rt+")*(?:\\x5D|$))+/";ut.push(["lang-regex",RegExp("^"+Q+"("+Rt+")")])}var Ct=Ke.types;Ct&&ut.push([f,Ct]);var xt=(""+Ke.keywords).replace(/^ | $/g,"");xt.length&&ut.push([D,new RegExp("^(?:"+xt.replace(/[\s,]+/g,"|")+")\\b"),null]),Ye.push([s,/^\s+/,null,` \r \xA0`]);var yt="^.[^\\s\\w.$@'\"`/\\\\]*";return Ke.regexLiterals&&(yt+="(?!s*/)"),ut.push([d,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[s,/^[a-z_$][a-z_$@0-9]*/i,null],[d,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[s,/^\\[\s\S]?/,null],[o,new RegExp(yt),null]),he(Ye,ut)}var ye=Se({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function be(Ke,Ye,ut){for(var pt=/(?:^|\s)nocode(?:\s|$)/,at=/\r\n?|\n/,Qe=Ke.ownerDocument,rt=Qe.createElement("li");Ke.firstChild;)rt.appendChild(Ke.firstChild);var Rt=[rt];function Ct(xe){var ze=xe.nodeType;if(ze==1&&!pt.test(xe.className))if(xe.nodeName==="br")xt(xe),xe.parentNode&&xe.parentNode.removeChild(xe);else for(var Ve=xe.firstChild;Ve;Ve=Ve.nextSibling)Ct(Ve);else if((ze==3||ze==4)&&ut){var De=xe.nodeValue,We=De.match(at);if(We){var ge=De.substring(0,We.index);xe.nodeValue=ge;var de=De.substring(We.index+We[0].length);if(de){var ce=xe.parentNode;ce.insertBefore(Qe.createTextNode(de),xe.nextSibling)}xt(xe),ge||xe.parentNode.removeChild(xe)}}}function xt(xe){for(;!xe.nextSibling;)if(xe=xe.parentNode,!xe)return;function ze(We,ge){var de=ge?We.cloneNode(!1):We,ce=We.parentNode;if(ce){var ne=ze(ce,1),ie=We.nextSibling;ne.appendChild(de);for(var oe=ie;oe;oe=ie)ie=oe.nextSibling,ne.appendChild(oe)}return de}for(var Ve=ze(xe.nextSibling,0),De;(De=Ve.parentNode)&&De.nodeType===1;)Ve=De;Rt.push(Ve)}for(var yt=0;yt=ce&&(Ct+=2),Qe>=ne&&(wt+=2)}}finally{De&&(De.style.display=We)}}var _e={};function fe(Ke,Ye){for(var ut=Ye.length;--ut>=0;){var pt=Ye[ut];_e.hasOwnProperty(pt)?N.console&&console.warn("cannot override language handler %s",pt):_e[pt]=Ke}}function le(Ke,Ye){return Ke&&_e.hasOwnProperty(Ke)||(Ke=/^\s*]*(?:>|$)/],[S,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[o,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),fe(he([[s,/^[\s]+/,null,` \r `],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[_,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[o,/^[=<>\/]+/],["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"]),fe(he([],[[B,/^[\s\S]+/]]),["uq.val"]),fe(Se({keywords:T,hashComments:!0,cStyleComments:!0,types:b}),["c","cc","cpp","cxx","cyc","m"]),fe(Se({keywords:"null,true,false"}),["json"]),fe(Se({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:b}),["cs"]),fe(Se({keywords:P,cStyleComments:!0}),["java"]),fe(Se({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),fe(Se({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),fe(Se({keywords:i,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),fe(Se({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),fe(Se({keywords:g,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),fe(Se({keywords:p,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),fe(he([],[[v,/^[\s\S]+/]]),["regex"]);function Re(Ke){var Ye=Ke.langExtension;try{var ut=W(Ke.sourceNode,Ke.pre),pt=ut.sourceCode;Ke.sourceCode=pt,Ke.spans=ut.spans,Ke.basePos=0,le(Ye,pt)(Ke),Oe(Ke)}catch(at){N.console&&console.log(at&&at.stack||at)}}function ot(Ke,Ye,ut){var pt=ut||!1,at=Ye||null,Qe=document.createElement("div");Qe.innerHTML="
    "+Ke+"
    ",Qe=Qe.firstChild,pt&&be(Qe,pt,!0);var rt={langExtension:at,numberLines:pt,sourceNode:Qe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return Re(rt),Qe.innerHTML}function st(Ke,Ye){var ut=Ye||document.body,pt=ut.ownerDocument||document;function at(de){return ut.getElementsByTagName(de)}for(var Qe=[at("pre"),at("code"),at("xmp")],rt=[],Rt=0;Rt=15&&(T=!1,E=!0);var v=u&&(L||T&&(b==null||b<12.11)),D=R||U&&N>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var r=e.className,n=S(t).exec(r);if(n){var l=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(l?n[1]+l:"")}};function d(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function o(e,t){return d(e).appendChild(t)}function s(e,t,r,n){var l=document.createElement(e);if(r&&(l.className=r),n&&(l.style.cssText=n),typeof t=="string")l.appendChild(document.createTextNode(t));else if(t)for(var k=0;k=t)return Y+(t-k);Y+=Z-k,Y+=r-Y%r,k=Z+1}}var re=function(){this.id=null,this.f=null,this.time=0,this.handler=V(this.onTimeout,this)};re.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},re.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r=t)return n+Math.min(Y,t-l);if(l+=k-n,l+=r-l%r,n=k+1,l>=t)return n}}var fe=[""];function le(e){for(;fe.length<=e;)fe.push(Re(fe)+" ");return fe[e]}function Re(e){return e[e.length-1]}function ot(e,t){for(var r=[],n=0;n"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Ke.test(e))}function ut(e,t){return t?t.source.indexOf("\\w")>-1&&Ye(e)?!0:t.test(e):Ye(e)}function pt(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var at=/[\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 Qe(e){return e.charCodeAt(0)>=768&&at.test(e)}function rt(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var l=(t+r)/2,k=n<0?Math.ceil(l):Math.floor(l);if(k==t)return e(k)?t:r;e(k)?r=k:t=k+n}}function Ct(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var l=!1,k=0;kt||t==r&&Y.to==t)&&(n(Math.max(Y.from,t),Math.min(Y.to,r),Y.level==1?"rtl":"ltr",k),l=!0)}l||n(t,r,"ltr")}var xt=null;function yt(e,t,r){var n;xt=null;for(var l=0;lt)return l;k.to==t&&(k.from!=k.to&&r=="before"?n=l:xt=l),k.from==t&&(k.from!=k.to&&r!="before"?n=l:xt=l)}return n!=null?n:xt}var wt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(te){return te<=247?e.charAt(te):1424<=te&&te<=1524?"R":1536<=te&&te<=1785?t.charAt(te-1536):1774<=te&&te<=2220?"r":8192<=te&&te<=8203?"w":te==8204?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,l=/[stwN]/,k=/[LRr]/,Y=/[Lb1n]/,Z=/[1n]/;function q(te,me,Ee){this.level=te,this.from=me,this.to=Ee}return function(te,me){var Ee=me=="ltr"?"L":"R";if(te.length==0||me=="ltr"&&!n.test(te))return!1;for(var Ne=te.length,Pe=[],et=0;et-1&&(n[t]=l.slice(0,k).concat(l.slice(k+1)))}}}function De(e,t){var r=ze(e,t);if(!r.length)return;for(var n=Array.prototype.slice.call(arguments,2),l=0;l0}function ce(e){e.prototype.on=function(t,r){xe(this,t,r)},e.prototype.off=function(t,r){Ve(this,t,r)}}function ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function oe(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ue(e){ne(e),ie(e)}function we(e){return e.target||e.srcElement}function ke(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 Ze=function(){if(U&&N<9)return!1;var e=s("div");return"draggable"in e||"dragDrop"in e}(),bt;function It(e){if(bt==null){var t=s("span","\u200B");o(e,s("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(bt=t.offsetWidth<=1&&t.offsetHeight>2&&!(U&&N<8))}var r=bt?s("span","\u200B"):s("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}var Ge;function it(e){if(Ge!=null)return Ge;var t=o(e,document.createTextNode("A\u062EA")),r=C(t,0,1).getBoundingClientRect(),n=C(t,1,2).getBoundingClientRect();return d(e),!r||r.left==r.right?!1:Ge=n.right-r.right<3}var Be=` b`.split(/\n/).length!=3?function(e){for(var t=0,r=[],n=e.length;t<=n;){var l=e.indexOf(` `,t);l==-1&&(l=e.length);var k=e.slice(t,e.charAt(l-1)=="\r"?l-1:l),Y=k.indexOf("\r");Y!=-1?(r.push(k.slice(0,Y)),t+=Y+1):(r.push(k),t=l+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Ue=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(r){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Le=function(){var e=s("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),se=null;function pe(e){if(se!=null)return se;var t=o(e,s("span","x")),r=t.getBoundingClientRect(),n=C(t,0,1).getBoundingClientRect();return se=Math.abs(r.left-n.left)>1}var je={},Ie={};function dt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),je[e]=t}function lt(e,t){Ie[e]=t}function Ae(e){if(typeof e=="string"&&Ie.hasOwnProperty(e))e=Ie[e];else if(e&&typeof e.name=="string"&&Ie.hasOwnProperty(e.name)){var t=Ie[e.name];typeof t=="string"&&(t={name:t}),e=$e(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ae("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ae("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function tt(e,t){t=Ae(t);var r=je[t.name];if(!r)return tt(e,"text/plain");var n=r(e,t);if(mt.hasOwnProperty(t.name)){var l=mt[t.name];for(var k in l){if(!l.hasOwnProperty(k))continue;n.hasOwnProperty(k)&&(n["_"+k]=n[k]),n[k]=l[k]}}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var Y in t.modeProps)n[Y]=t.modeProps[Y];return n}var mt={};function gt(e,t){var r=mt.hasOwnProperty(e)?mt[e]:mt[e]={};W(t,r)}function Lt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var l=t[n];l instanceof Array&&(l=l.concat([])),r[n]=l}return r}function mn(e,t){for(var r;e.innerMode&&!(r=e.innerMode(t),!r||r.mode==e);)t=r.state,e=r.mode;return r||{mode:e,state:t}}function hn(e,t,r){return e.startState?e.startState(t,r):!0}var en=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};en.prototype.eol=function(){return this.pos>=this.string.length},en.prototype.sol=function(){return this.pos==this.lineStart},en.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},en.prototype.next=function(){if(this.post},en.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},en.prototype.skipToEnd=function(){this.pos=this.string.length},en.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},en.prototype.backUp=function(e){this.pos-=e},en.prototype.column=function(){return this.lastColumnPos0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},en.prototype.current=function(){return this.string.slice(this.start,this.pos)},en.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},en.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},en.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Dt(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 r=e;!r.lines;)for(var n=0;;++n){var l=r.children[n],k=l.chunkSize();if(t=e.first&&tr?Je(r,Dt(e,r).text.length):A(t,Dt(e,t.line).text.length)}function A(e,t){var r=e.ch;return r==null||r>t?Je(e.line,t):r<0?Je(e.line,0):e}function G(e,t){for(var r=[],n=0;nthis.maxLookAhead&&(this.maxLookAhead=e),t},X.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}},X.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},X.fromSaved=function(e,t,r){return t instanceof ee?new X(e,Lt(e.mode,t.state),r,t.lookAhead):new X(e,Lt(e.mode,t),r)},X.prototype.save=function(e){var t=e!==!1?Lt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ee(t,this.maxLookAhead):t};function ve(e,t,r,n){var l=[e.state.modeGen],k={};Wn(e,t.text,e.doc.mode,r,function(te,me){return l.push(te,me)},k,n);for(var Y=r.state,Z=function(te){r.baseTokens=l;var me=e.state.overlays[te],Ee=1,Ne=0;r.state=!0,Wn(e,t.text,me.mode,r,function(Pe,et){for(var ct=Ee;NePe&&l.splice(Ee,1,Pe,l[Ee+1],vt),Ee+=2,Ne=Math.min(Pe,vt)}if(!et)return;if(me.opaque)l.splice(ct,Ee-ct,Pe,"overlay "+et),Ee=ct+2;else for(;cte.options.maxHighlightLength&&Lt(e.doc.mode,n.state),k=ve(e,t,n);l&&(n.state=l),t.stateAfter=n.save(!l),t.styles=k.styles,k.classes?t.styleClasses=k.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Me(e,t,r){var n=e.doc,l=e.display;if(!n.mode.startState)return new X(n,!0,t);var k=$t(e,t,r),Y=k>n.first&&Dt(n,k-1).stateAfter,Z=Y?X.fromSaved(n,Y,k):new X(n,hn(n.mode),k);return n.iter(k,t,function(q){At(e,q.text,Z);var te=Z.line;q.stateAfter=te==t-1||te%5==0||te>=l.viewFrom&&tet.start)return k}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ft=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function tn(e,t,r,n){var l=e.doc,k=l.mode,Y;t=m(l,t);var Z=Dt(l,t.line),q=Me(e,t.line,r),te=new en(Z.text,e.options.tabSize,q),me;for(n&&(me=[]);(n||te.pose.options.maxHighlightLength?(Z=!1,Y&&At(e,t,n,me.pos),me.pos=t.length,Ee=null):Ee=zn(Bt(r,me,n.state,Ne),k),Ne){var Pe=Ne[0].name;Pe&&(Ee="m-"+(Ee?Pe+" "+Ee:Pe))}if(!Z||te!=Ee){for(;qY;--Z){if(Z<=k.first)return k.first;var q=Dt(k,Z-1),te=q.stateAfter;if(te&&(!r||Z+(te instanceof ee?te.lookAhead:0)<=k.modeFrontier))return Z;var me=$(q.text,null,e.options.tabSize);(l==null||n>me)&&(l=Z-1,n=me)}return l}function yn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontierr;n--){var l=Dt(e,n).stateAfter;if(l&&(!(l instanceof ee)||n+l.lookAhead=t:k.to>t);(n||(n=[])).push(new Tn(Y,k.from,q?null:k.to))}}return n}function Or(e,t,r){var n;if(e)for(var l=0;l=t:k.to>t);if(Z||k.from==t&&Y.type=="bookmark"&&(!r||k.marker.insertLeft)){var q=k.from==null||(Y.inclusiveLeft?k.from<=t:k.from0&&Z)for(var Ut=0;Ut0)continue;var me=[q,1],Ee=ft(te.from,Z.from),Ne=ft(te.to,Z.to);(Ee<0||!Y.inclusiveLeft&&!Ee)&&me.push({from:te.from,to:Z.from}),(Ne>0||!Y.inclusiveRight&&!Ne)&&me.push({from:Z.to,to:te.to}),l.splice.apply(l,me),q+=me.length-3}return l}function yr(e){var t=e.markedSpans;if(!t)return;for(var r=0;rt)&&(!n||Pn(n,k.marker)<0)&&(n=k.marker)}return n}function Un(e,t,r,n,l){var k=Dt(e,t),Y=bn&&k.markedSpans;if(Y)for(var Z=0;Z=0&&Ee<=0||me<=0&&Ee>=0)continue;if(me<=0&&(q.marker.inclusiveRight&&l.inclusiveLeft?ft(te.to,r)>=0:ft(te.to,r)>0)||me>=0&&(q.marker.inclusiveRight&&l.inclusiveLeft?ft(te.from,n)<=0:ft(te.from,n)<0))return!0}}function Bn(e){for(var t;t=kn(e);)e=t.find(-1,!0).line;return e}function tr(e){for(var t;t=gn(e);)e=t.find(1,!0).line;return e}function cr(e){for(var t,r;t=gn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function xr(e,t){var r=Dt(e,t),n=Bn(r);return r==n?t:St(n)}function Ur(e,t){if(t>e.lastLine())return t;var r=Dt(e,t),n;if(!hr(e,r))return t;for(;n=gn(r);)r=n.find(1,!0).line;return St(r)+1}function hr(e,t){var r=bn&&t.markedSpans;if(r)for(var n=void 0,l=0;lt.maxLineLength&&(t.maxLineLength=l,t.maxLine=n)})}var ar=function(e,t,r){this.text=e,br(this,t),this.height=r?r(this):1};ar.prototype.lineNo=function(){return St(this)},ce(ar);function En(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),yr(e),br(e,r);var l=n?n(e):1;l!=e.height&&ht(e,l)}function qt(e){e.parent=null,yr(e)}var On={},Kt={};function wn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Kt:On;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function _n(e,t){var r=_("span",null,null,E?"padding-right: .1px":null),n={pre:_("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var l=0;l<=(t.rest?t.rest.length:0);l++){var k=l?t.rest[l-1]:t.line,Y=void 0;n.pos=0,n.addToken=Nt,it(e.display.measure)&&(Y=Et(k,e.doc.direction))&&(n.addToken=Tt(n.addToken,Y)),n.map=[];var Z=t!=e.display.externalMeasured&&St(k);sn(k,n,Xe(e,k,Z)),k.styleClasses&&(k.styleClasses.bgClass&&(n.bgClass=F(k.styleClasses.bgClass,n.bgClass||"")),k.styleClasses.textClass&&(n.textClass=F(k.styleClasses.textClass,n.textClass||""))),n.map.length==0&&n.map.push(0,0,n.content.appendChild(It(e.display.measure))),l==0?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(E){var q=n.content.lastChild;(/\bcm-tab\b/.test(q.className)||q.querySelector&&q.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return De(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function Mt(e){var t=s("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Nt(e,t,r,n,l,k,Y){if(!t)return;var Z=e.splitSpaces?Wt(t,e.trailingSpace):t,q=e.cm.state.specialChars,te=!1,me;if(!q.test(t))e.col+=t.length,me=document.createTextNode(Z),e.map.push(e.pos,e.pos+t.length,me),U&&N<9&&(te=!0),e.pos+=t.length;else{me=document.createDocumentFragment();for(var Ee=0;;){q.lastIndex=Ee;var Ne=q.exec(t),Pe=Ne?Ne.index-Ee:t.length-Ee;if(Pe){var et=document.createTextNode(Z.slice(Ee,Ee+Pe));U&&N<9?me.appendChild(s("span",[et])):me.appendChild(et),e.map.push(e.pos,e.pos+Pe,et),e.col+=Pe,e.pos+=Pe}if(!Ne)break;Ee+=Pe+1;var ct=void 0;if(Ne[0]==" "){var vt=e.cm.options.tabSize,_t=vt-e.col%vt;ct=me.appendChild(s("span",le(_t),"cm-tab")),ct.setAttribute("role","presentation"),ct.setAttribute("cm-text"," "),e.col+=_t}else Ne[0]=="\r"||Ne[0]==` `?(ct=me.appendChild(s("span",Ne[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ct.setAttribute("cm-text",Ne[0]),e.col+=1):(ct=e.cm.options.specialCharPlaceholder(Ne[0]),ct.setAttribute("cm-text",Ne[0]),U&&N<9?me.appendChild(s("span",[ct])):me.appendChild(ct),e.col+=1);e.map.push(e.pos,e.pos+1,ct),e.pos++}}if(e.trailingSpace=Z.charCodeAt(t.length-1)==32,r||n||l||te||k||Y){var Pt=r||"";n&&(Pt+=n),l&&(Pt+=l);var Ot=s("span",[me],Pt,k);if(Y)for(var Ut in Y)Y.hasOwnProperty(Ut)&&Ut!="style"&&Ut!="class"&&Ot.setAttribute(Ut,Y[Ut]);return e.content.appendChild(Ot)}e.content.appendChild(me)}function Wt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,n="",l=0;lte&&Ee.from<=te);Ne++);if(Ee.to>=me)return e(r,n,l,k,Y,Z,q);e(r,n.slice(0,Ee.to-te),l,k,null,Z,q),k=null,n=n.slice(Ee.to-te),te=Ee.to}}}function rn(e,t,r,n){var l=!n&&r.widgetNode;l&&e.map.push(e.pos,e.pos+t,l),!n&&e.cm.display.input.needsContentAttribute&&(l||(l=e.content.appendChild(document.createElement("span"))),l.setAttribute("cm-marker",r.id)),l&&(e.cm.display.input.setUneditable(l),e.content.appendChild(l)),e.pos+=t,e.trailingSpace=!1}function sn(e,t,r){var n=e.markedSpans,l=e.text,k=0;if(!n){for(var Y=1;Yq||ln.collapsed&&Vt.to==q&&Vt.from==q)){if(Vt.to!=null&&Vt.to!=q&&Pe>Vt.to&&(Pe=Vt.to,ct=""),ln.className&&(et+=" "+ln.className),ln.css&&(Ne=(Ne?Ne+";":"")+ln.css),ln.startStyle&&Vt.from==q&&(vt+=" "+ln.startStyle),ln.endStyle&&Vt.to==Pe&&(Ut||(Ut=[])).push(ln.endStyle,Vt.to),ln.title&&((Pt||(Pt={})).title=ln.title),ln.attributes)for(var Ln in ln.attributes)(Pt||(Pt={}))[Ln]=ln.attributes[Ln];ln.collapsed&&(!_t||Pn(_t.marker,ln)<0)&&(_t=Vt)}else Vt.from>q&&Pe>Vt.from&&(Pe=Vt.from)}if(Ut)for(var Zn=0;Zn=Z)break;for(var Sr=Math.min(Z,Pe);;){if(me){var mr=q+me.length;if(!_t){var Vn=mr>Sr?me.slice(0,Sr-q):me;t.addToken(t,Vn,Ee?Ee+et:et,vt,q+Vn.length==Pe?ct:"",Ne,Pt)}if(mr>=Sr){me=me.slice(Sr-q),q=Sr;break}q=mr,vt=""}me=l.slice(k,k=r[te++]),Ee=wn(r[te++],t.cm.options)}}}function Jt(e,t,r){this.line=t,this.rest=cr(t),this.size=this.rest?St(Re(this.rest))-r+1:1,this.node=this.text=null,this.hidden=hr(e,t)}function cn(e,t,r){for(var n=[],l,k=t;k2&&k.push((q.bottom+te.top)/2-r.top)}}k.push(r.bottom-r.top)}}function ao(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[l],cache:e.measure.caches[l],before:!0}}function js(e,t){t=Bn(t);var r=St(t),n=e.display.externalMeasured=new Jt(e.doc,t,r);n.lineN=r;var l=n.built=_n(e,n);return n.text=l.pre,o(e.display.lineMeasure,l.pre),n}function oo(e,t,r,n){return Ir(e,oi(e,t),r,n)}function Ea(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt)&&(k=q-Z,l=k-1,t>=q&&(Y="right")),l!=null){if(n=e[te+2],Z==q&&r==(n.insertLeft?"left":"right")&&(Y=r),r=="left"&&l==0)for(;te&&e[te-2]==e[te-3]&&e[te-1].insertLeft;)n=e[(te-=3)+2],Y="left";if(r=="right"&&l==q-Z)for(;te=0&&!((r=e[l]).left!=r.right);l--);return r}function Ws(e,t,r,n){var l=lo(t.map,r,n),k=l.node,Y=l.start,Z=l.end,q=l.collapse,te;if(k.nodeType==3){for(var me=0;me<4;me++){for(;Y&&Qe(t.line.text.charAt(l.coverStart+Y));)--Y;for(;l.coverStart+Z0&&(q=n="right");var Ee;e.options.lineWrapping&&(Ee=k.getClientRects()).length>1?te=Ee[n=="right"?Ee.length-1:0]:te=k.getBoundingClientRect()}if(U&&N<9&&!Y&&(!te||!te.left&&!te.right)){var Ne=k.parentNode.getClientRects()[0];Ne?te={left:Ne.left,right:Ne.left+li(e.display),top:Ne.top,bottom:Ne.bottom}:te=so}for(var Pe=te.top-t.rect.top,et=te.bottom-t.rect.top,ct=(Pe+et)/2,vt=t.view.measure.heights,_t=0;_t=n.text.length?(q=n.text.length,te="before"):q<=0&&(q=0,te="after"),!Z)return Y(te=="before"?q-1:q,te=="before");function me(et,ct,vt){var _t=Z[ct],Pt=_t.level==1;return Y(vt?et-1:et,Pt!=vt)}var Ee=yt(Z,q,te),Ne=xt,Pe=me(q,Ee,te=="before");return Ne!=null&&(Pe.other=me(q,Ne,te!="before")),Pe}function mo(e,t){var r=0;t=m(e.doc,t),e.options.lineWrapping||(r=li(e.display)*t.ch);var n=Dt(e.doc,t.line),l=nr(n)+Yi(e.display);return{left:r,right:r,top:l,bottom:l+n.height}}function Sa(e,t,r,n,l){var k=Je(e,t,r);return k.xRel=l,n&&(k.outside=n),k}function Ta(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return Sa(n.first,0,null,-1,-1);var l=Xt(n,r),k=n.first+n.size-1;if(l>k)return Sa(n.first+n.size-1,Dt(n,k).text.length,null,1,1);t<0&&(t=0);for(var Y=Dt(n,l);;){var Z=Ks(e,Y,l,t,r),q=Er(Y,Z.ch+(Z.xRel>0||Z.outside>0?1:0));if(!q)return Z;var te=q.find(1);if(te.line==l)return te;Y=Dt(n,l=te.line)}}function go(e,t,r,n){n-=xa(t);var l=t.text.length,k=Rt(function(Y){return Ir(e,r,Y-1).bottom<=n},l,0);return l=Rt(function(Y){return Ir(e,r,Y).top>n},k,l),{begin:k,end:l}}function vo(e,t,r,n){r||(r=oi(e,t));var l=$i(e,t,Ir(e,r,n),"line").top;return go(e,t,r,l)}function wa(e,t,r,n){return e.bottom<=r?!1:e.top>r?!0:(n?e.left:e.right)>t}function Ks(e,t,r,n,l){l-=nr(t);var k=oi(e,t),Y=xa(t),Z=0,q=t.text.length,te=!0,me=Et(t,e.doc.direction);if(me){var Ee=(e.options.lineWrapping?Gs:zs)(e,t,r,k,me,n,l);te=Ee.level!=1,Z=te?Ee.from:Ee.to-1,q=te?Ee.to:Ee.from-1}var Ne=null,Pe=null,et=Rt(function(Yt){var Vt=Ir(e,k,Yt);return Vt.top+=Y,Vt.bottom+=Y,wa(Vt,n,l,!1)?(Vt.top<=l&&Vt.left<=n&&(Ne=Yt,Pe=Vt),!0):!1},Z,q),ct,vt,_t=!1;if(Pe){var Pt=n-Pe.left=Ut.bottom?1:0}return et=rt(t.text,et,1),Sa(r,et,vt,_t,n-ct)}function zs(e,t,r,n,l,k,Y){var Z=Rt(function(Ee){var Ne=l[Ee],Pe=Ne.level!=1;return wa(Lr(e,Je(r,Pe?Ne.to:Ne.from,Pe?"before":"after"),"line",t,n),k,Y,!0)},0,l.length-1),q=l[Z];if(Z>0){var te=q.level!=1,me=Lr(e,Je(r,te?q.from:q.to,te?"after":"before"),"line",t,n);wa(me,k,Y,!0)&&me.top>Y&&(q=l[Z-1])}return q}function Gs(e,t,r,n,l,k,Y){var Z=go(e,t,n,Y),q=Z.begin,te=Z.end;/\s/.test(t.text.charAt(te-1))&&te--;for(var me=null,Ee=null,Ne=0;Ne=te||Pe.to<=q)continue;var et=Pe.level!=1,ct=Ir(e,n,et?Math.min(te,Pe.to)-1:Math.max(q,Pe.from)).right,vt=ctvt)&&(me=Pe,Ee=vt)}return me||(me=l[l.length-1]),me.fromte&&(me={from:me.from,to:te,level:me.level}),me}var Qr;function si(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Qr==null){Qr=s("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Qr.appendChild(document.createTextNode("x")),Qr.appendChild(s("br"));Qr.appendChild(document.createTextNode("x"))}o(e.measure,Qr);var r=Qr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),d(e.measure),r||1}function li(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=s("span","xxxxxxxxxx"),r=s("pre",[t],"CodeMirror-line-like");o(e.measure,r);var n=t.getBoundingClientRect(),l=(n.right-n.left)/10;return l>2&&(e.cachedCharWidth=l),l||10}function _a(e){for(var t=e.display,r={},n={},l=t.gutters.clientLeft,k=t.gutters.firstChild,Y=0;k;k=k.nextSibling,++Y){var Z=e.display.gutterSpecs[Y].className;r[Z]=k.offsetLeft+k.clientLeft+l,n[Z]=k.clientWidth}return{fixedPos:Oa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Oa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function yo(e){var t=si(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/li(e.display)-3);return function(l){if(hr(e.doc,l))return 0;var k=0;if(l.widgets)for(var Y=0;Y0&&(te=Dt(e.doc,q.line).text).length==q.ch){var me=$(te,te.length,e.options.tabSize)-te.length;q=Je(q.line,Math.max(0,Math.round((k-io(e.display).left)/li(e.display))-me))}return q}function qr(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;nt)&&(l.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=l.viewTo)bn&&xr(e.doc,t)l.viewFrom?Kr(e):(l.viewFrom+=n,l.viewTo+=n);else if(t<=l.viewFrom&&r>=l.viewTo)Kr(e);else if(t<=l.viewFrom){var k=Ji(e,r,r+n,1);k?(l.view=l.view.slice(k.index),l.viewFrom=k.lineN,l.viewTo+=n):Kr(e)}else if(r>=l.viewTo){var Y=Ji(e,t,t,-1);Y?(l.view=l.view.slice(0,Y.index),l.viewTo=Y.lineN):Kr(e)}else{var Z=Ji(e,t,t,-1),q=Ji(e,r,r+n,1);Z&&q?(l.view=l.view.slice(0,Z.index).concat(cn(e,Z.lineN,q.lineN)).concat(l.view.slice(q.index)),l.viewTo+=n):Kr(e)}var te=l.externalMeasured;te&&(r=l.lineN&&t=n.viewTo)return;var k=n.view[qr(e,t)];if(k.node==null)return;var Y=k.changes||(k.changes=[]);ae(Y,r)==-1&&Y.push(r)}function Kr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ji(e,t,r,n){var l=qr(e,t),k,Y=e.display.view;if(!bn||r==e.doc.first+e.doc.size)return{index:l,lineN:r};for(var Z=e.display.viewFrom,q=0;q0){if(l==Y.length-1)return null;k=Z+Y[l].size-t,l++}else k=Z-t;t+=k,r+=k}for(;xr(e.doc,r)!=r;){if(l==(n<0?0:Y.length-1))return null;r+=n*Y[l-(n<0?1:0)].size,l+=n}return{index:l,lineN:r}}function Vs(e,t,r){var n=e.display,l=n.view;l.length==0||t>=n.viewTo||r<=n.viewFrom?(n.view=cn(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=cn(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,qr(e,r)))),n.viewTo=r}function bo(e){for(var t=e.display.view,r=0,n=0;n=e.display.viewTo||Z.to().line0?t.blinker=setInterval(function(){e.hasFocus()||ui(e),t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Co(e){e.state.focused||(e.display.input.focus(),Ra(e))}function So(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,ui(e))},100)}function Ra(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(De(e,"focus",e,t),e.state.focused=!0,B(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),E&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Da(e)}function ui(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(De(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Zi(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n.005||me<-.005)&&(ht(l.line,Y),To(l.line),l.rest))for(var Ee=0;Eee.display.sizerWidth){var Ne=Math.ceil(Z/li(e.display));Ne>e.display.maxLineLength&&(e.display.maxLineLength=Ne,e.display.maxLine=l.line,e.display.maxLineChanged=!0)}}}function To(e){if(e.widgets)for(var t=0;t=Y&&(k=Xt(t,nr(Dt(t,q))-e.wrapper.clientHeight),Y=q)}return{from:k,to:Math.max(Y,k+1)}}function Ys(e,t){if(We(e,"scrollCursorIntoView"))return;var r=e.display,n=r.sizer.getBoundingClientRect(),l=null;if(t.top+n.top<0?l=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(l=!1),l!=null&&!p){var k=s("div","\u200B",null,`position: absolute; top: `+(t.top-r.viewOffset-Yi(e.display))+`px; height: `+(t.bottom-t.top+kr(e)+r.barHeight)+`px; left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(k),k.scrollIntoView(l),e.display.lineSpace.removeChild(k)}}function $s(e,t,r,n){n==null&&(n=0);var l;!e.options.lineWrapping&&t==r&&(t=t.ch?Je(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,r=t.sticky=="before"?Je(t.line,t.ch+1,"before"):t);for(var k=0;k<5;k++){var Y=!1,Z=Lr(e,t),q=!r||r==t?Z:Lr(e,r);l={left:Math.min(Z.left,q.left),top:Math.min(Z.top,q.top)-n,right:Math.max(Z.left,q.left),bottom:Math.max(Z.bottom,q.bottom)+n};var te=La(e,l),me=e.doc.scrollTop,Ee=e.doc.scrollLeft;if(te.scrollTop!=null&&(Ai(e,te.scrollTop),Math.abs(e.doc.scrollTop-me)>1&&(Y=!0)),te.scrollLeft!=null&&(ei(e,te.scrollLeft),Math.abs(e.doc.scrollLeft-Ee)>1&&(Y=!0)),!Y)break}return l}function Js(e,t){var r=La(e,t);r.scrollTop!=null&&Ai(e,r.scrollTop),r.scrollLeft!=null&&ei(e,r.scrollLeft)}function La(e,t){var r=e.display,n=si(e.display);t.top<0&&(t.top=0);var l=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:r.scroller.scrollTop,k=ba(e),Y={};t.bottom-t.top>k&&(t.bottom=t.top+k);var Z=e.doc.height+ya(r),q=t.topZ-n;if(t.topl+k){var me=Math.min(t.top,(te?Z:t.bottom)-k);me!=l&&(Y.scrollTop=me)}var Ee=e.options.fixedGutter?0:r.gutters.offsetWidth,Ne=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:r.scroller.scrollLeft-Ee,Pe=Jr(e)-r.gutters.offsetWidth,et=t.right-t.left>Pe;return et&&(t.right=t.left+Pe),t.left<10?Y.scrollLeft=0:t.leftPe+Ne-3&&(Y.scrollLeft=t.right+(et?0:10)-Pe),Y}function Ma(e,t){if(t==null)return;ea(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function di(e){ea(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Oi(e,t,r){(t!=null||r!=null)&&ea(e),t!=null&&(e.curOp.scrollLeft=t),r!=null&&(e.curOp.scrollTop=r)}function Qs(e,t){ea(e),e.curOp.scrollToPos=t}function ea(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=mo(e,t.from),n=mo(e,t.to);wo(e,r,n,t.margin)}}function wo(e,t,r,n){var l=La(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Oi(e,l.scrollLeft,l.scrollTop)}function Ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;R||ka(e,{top:t}),_o(e,t,!0),R&&ka(e),Li(e,100)}function _o(e,t,r){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!r)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function ei(e,t,r,n){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n)return;e.doc.scrollLeft=t,Lo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function Di(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+ya(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?r:0,docHeight:n,scrollHeight:n+kr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var ti=function(e,t,r){this.cm=r;var n=this.vert=s("div",[s("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),l=this.horiz=s("div",[s("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=l.tabIndex=-1,e(n),e(l),xe(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),xe(l,"scroll",function(){l.clientWidth&&t(l.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,U&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ti.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var l=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+l)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var k=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(n==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},ti.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ti.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ti.prototype.zeroWidthHack=function(){var e=u&&!O?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new re,this.disableVert=new re},ti.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto";function n(){var l=e.getBoundingClientRect(),k=r=="vert"?document.elementFromPoint(l.right-1,(l.top+l.bottom)/2):document.elementFromPoint((l.right+l.left)/2,l.bottom-1);k!=e?e.style.pointerEvents="none":t.set(1e3,n)}t.set(1e3,n)},ti.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ri=function(){};Ri.prototype.update=function(){return{bottom:0,right:0}},Ri.prototype.setScrollLeft=function(){},Ri.prototype.setScrollTop=function(){},Ri.prototype.clear=function(){};function ci(e,t){t||(t=Di(e));var r=e.display.barWidth,n=e.display.barHeight;Oo(e,t);for(var l=0;l<4&&r!=e.display.barWidth||n!=e.display.barHeight;l++)r!=e.display.barWidth&&e.options.lineWrapping&&Zi(e),Oo(e,Di(e)),r=e.display.barWidth,n=e.display.barHeight}function Oo(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}var Ao={native:ti,null:Ri};function Do(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),xe(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){r=="horizontal"?ei(e,t):Ai(e,t)},e),e.display.scrollbars.addClass&&B(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function ni(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},zt(e.curOp)}function ri(e){var t=e.curOp;t&&jt(t,function(r){for(var n=0;n=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ta(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Pa(e.cm,e.update)}function nl(e){var t=e.cm,r=t.display;e.updatedDisplay&&Zi(t),e.barMeasure=Di(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=oo(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+kr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Jr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function rl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft=e.display.viewTo)return;var r=+new Date+e.options.workTime,n=Me(e,t.highlightFrontier),l=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(k){if(n.line>=e.display.viewFrom){var Y=k.styles,Z=k.text.length>e.options.maxHighlightLength?Lt(t.mode,n.state):null,q=ve(e,k,n,!0);Z&&(n.state=Z),k.styles=q.styles;var te=k.styleClasses,me=q.classes;me?k.styleClasses=me:te&&(k.styleClasses=null);for(var Ee=!Y||Y.length!=k.styles.length||te!=me&&(!te||!me||te.bgClass!=me.bgClass||te.textClass!=me.textClass),Ne=0;!Ee&&Ner)return Li(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),l.length&&Cr(e,function(){for(var k=0;k=r.viewFrom&&t.visible.to<=r.viewTo&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&bo(e)==0)return!1;Mo(e)&&(Kr(e),t.dims=_a(e));var l=n.first+n.size,k=Math.max(t.visible.from-e.options.viewportMargin,n.first),Y=Math.min(l,t.visible.to+e.options.viewportMargin);r.viewFromY&&r.viewTo-Y<20&&(Y=Math.min(l,r.viewTo)),bn&&(k=xr(e.doc,k),Y=Ur(e.doc,Y));var Z=k!=r.viewFrom||Y!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Vs(e,k,Y),r.viewOffset=nr(Dt(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var q=bo(e);if(!Z&&q==0&&!t.force&&r.renderedView==r.view&&(r.updateLineNumbers==null||r.updateLineNumbers>=r.viewTo))return!1;var te=sl(e);return q>4&&(r.lineDiv.style.display="none"),ul(e,r.updateLineNumbers,t.dims),q>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,ll(te),d(r.cursorDiv),d(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,Z&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Li(e,400)),r.updateLineNumbers=null,!0}function Ro(e,t){for(var r=t.viewport,n=!0;;n=!1){if(!n||!e.options.lineWrapping||t.oldDisplayWidth==Jr(e)){if(r&&r.top!=null&&(r={top:Math.min(e.doc.height+ya(e.display)-ba(e),r.top)}),t.visible=qi(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else n&&(t.visible=qi(e.display,e.doc,r));if(!Pa(e,t))break;Zi(e);var l=Di(e);_i(e),ci(e,l),Na(e,l),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 ka(e,t){var r=new ta(e,t);if(Pa(e,r)){Zi(e),Ro(e,r);var n=Di(e);_i(e),ci(e,n),Na(e,n),r.finish()}}function ul(e,t,r){var n=e.display,l=e.options.lineNumbers,k=n.lineDiv,Y=k.firstChild;function Z(et){var ct=et.nextSibling;return E&&u&&e.display.currentWheelTarget==et?et.style.display="none":et.parentNode.removeChild(et),ct}for(var q=n.view,te=n.viewFrom,me=0;me-1&&(Pe=!1),Rr(e,Ee,te,r)),Pe&&(d(Ee.lineNumber),Ee.lineNumber.appendChild(document.createTextNode(un(e.options,te)))),Y=Ee.node.nextSibling}te+=Ee.size}for(;Y;)Y=Z(Y)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Na(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+kr(e)+"px"}function Lo(e){var t=e.display,r=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var n=Oa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,l=t.gutters.offsetWidth,k=n+"px",Y=0;YY.clientWidth,q=Y.scrollHeight>Y.clientHeight;if(!(n&&Z||l&&q))return;if(l&&u&&E){e:for(var te=t.target,me=k.view;te!=Y;te=te.parentNode)for(var Ee=0;Ee=0&&ft(e,n.to())<=0)return r}return-1};var Cn=function(e,t){this.anchor=e,this.head=t};Cn.prototype.from=function(){return Zt(this.anchor,this.head)},Cn.prototype.to=function(){return Gt(this.anchor,this.head)},Cn.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Mr(e,t,r){var n=e&&e.options.selectionsMayTouch,l=t[r];t.sort(function(Ne,Pe){return ft(Ne.from(),Pe.from())}),r=ae(t,l);for(var k=1;k0:q>=0){var te=Zt(Z.from(),Y.from()),me=Gt(Z.to(),Y.to()),Ee=Z.empty()?Y.from()==Y.head:Z.from()==Z.head;k<=r&&--r,t.splice(--k,2,new Cn(Ee?me:te,Ee?te:me))}}return new _r(t,r)}function zr(e,t){return new _r([new Cn(e,t||e)],0)}function Gr(e){return e.text?Je(e.from.line+e.text.length-1,Re(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function No(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Gr(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Gr(t).ch-t.to.ch),Je(r,n)}function Ba(e,t){for(var r=[],n=0;n1&&e.remove(Z.line+1,et-1),e.insert(Z.line+1,_t)}Ht(e,"change",e,t)}function Vr(e,t,r){function n(l,k,Y){if(l.linked)for(var Z=0;Z1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Re(e.done)}function Ho(e,t,r,n){var l=e.history;l.undone.length=0;var k=+new Date,Y,Z;if((l.lastOp==n||l.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&l.lastModTime>k-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(Y=pl(l,l.lastOp==n)))Z=Re(Y.changes),ft(t.from,t.to)==0&&ft(t.from,Z.to)==0?Z.to=Gr(t):Y.changes.push(Wa(e,t));else{var q=Re(l.done);for((!q||!q.ranges)&&ia(e.sel,l.done),Y={changes:[Wa(e,t)],generation:l.generation},l.done.push(Y);l.done.length>l.undoDepth;)l.done.shift(),l.done[0].ranges||l.done.shift()}l.done.push(r),l.generation=++l.maxGeneration,l.lastModTime=l.lastSelTime=k,l.lastOp=l.lastSelOp=n,l.lastOrigin=l.lastSelOrigin=t.origin,Z||De(e,"historyAdded")}function ml(e,t,r,n){var l=t.charAt(0);return l=="*"||l=="+"&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,r,n){var l=e.history,k=n&&n.origin;r==l.lastSelOp||k&&l.lastSelOrigin==k&&(l.lastModTime==l.lastSelTime&&l.lastOrigin==k||ml(e,k,Re(l.done),t))?l.done[l.done.length-1]=t:ia(t,l.done),l.lastSelTime=+new Date,l.lastSelOrigin=k,l.lastSelOp=r,n&&n.clearRedo!==!1&&Wo(l.undone)}function ia(e,t){var r=Re(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Ko(e,t,r,n){var l=t["spans_"+e.id],k=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(Y){Y.markedSpans&&((l||(l=t["spans_"+e.id]={}))[k]=Y.markedSpans),++k})}function vl(e){if(!e)return null;for(var t,r=0;r-1&&(Re(Z)[Ee]=te[Ee],delete te[Ee]))}}return n}function Ha(e,t,r,n){if(n){var l=e.anchor;if(r){var k=ft(t,l)<0;k!=ft(r,l)<0?(l=t,t=r):k!=ft(t,r)<0&&(t=r)}return new Cn(l,t)}else return new Cn(r||t,t)}function aa(e,t,r,n,l){l==null&&(l=e.cm&&(e.cm.display.shift||e.extend)),or(e,new _r([Ha(e.sel.primary(),t,r,l)],0),n)}function Go(e,t,r){for(var n=[],l=e.cm&&(e.cm.display.shift||e.extend),k=0;k=t.ch:Z.to>t.ch))){if(l&&(De(q,"beforeCursorEnter"),q.explicitlyCleared))if(k.markedSpans){--Y;continue}else break;if(!q.atomic)continue;if(r){var Ee=q.find(n<0?1:-1),Ne=void 0;if((n<0?me:te)&&(Ee=Qo(e,Ee,-n,Ee&&Ee.line==t.line?k:null)),Ee&&Ee.line==t.line&&(Ne=ft(Ee,r))&&(n<0?Ne<0:Ne>0))return fi(e,Ee,t,n,l)}var Pe=q.find(n<0?-1:1);return(n<0?te:me)&&(Pe=Qo(e,Pe,n,Pe.line==t.line?k:null)),Pe?fi(e,Pe,t,n,l):null}}return t}function sa(e,t,r,n,l){var k=n||1,Y=fi(e,t,r,k,l)||!l&&fi(e,t,r,k,!0)||fi(e,t,r,-k,l)||!l&&fi(e,t,r,-k,!0);return Y||(e.cantEdit=!0,Je(e.first,0))}function Qo(e,t,r,n){return r<0&&t.ch==0?t.line>e.first?m(e,Je(t.line-1)):null:r>0&&t.ch==(n||Dt(e,t.line)).text.length?t.line=0;--l)es(e,{from:n[l].from,to:n[l].to,text:l?[""]:t.text,origin:t.origin});else es(e,t)}function es(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var r=Ba(e,t);Ho(e,t,r,e.cm?e.cm.curOp.id:NaN),ki(e,t,r,on(e,t));var n=[];Vr(e,function(l,k){!k&&ae(n,l.history)==-1&&(is(l.history,t),n.push(l.history)),ki(l,t,null,on(l,t))})}function la(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(n&&!r)return;for(var l=e.history,k,Y=e.sel,Z=t=="undo"?l.done:l.undone,q=t=="undo"?l.undone:l.done,te=0;te=0;--Pe){var et=Ne(Pe);if(et)return et.v}}function ts(e,t){if(t==0)return;if(e.first+=t,e.sel=new _r(ot(e.sel.ranges,function(l){return new Cn(Je(l.anchor.line+t,l.anchor.ch),Je(l.head.line+t,l.head.ch))}),e.sel.primIndex),e.cm){fr(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())return;if(t.from.linek&&(t={from:t.from,to:Je(k,Dt(e,k).text.length),text:[t.text[0]],origin:t.origin}),t.removed=xn(e,t.from,t.to),r||(r=Ba(e,t)),e.cm?El(e.cm,t,n):Fa(e,t,n),oa(e,r,ye),e.cantEdit&&sa(e,Je(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,r){var n=e.doc,l=e.display,k=t.from,Y=t.to,Z=!1,q=k.line;e.options.lineWrapping||(q=St(Bn(Dt(n,k.line))),n.iter(q,Y.line+1,function(Pe){if(Pe==l.maxLine)return Z=!0,!0})),n.sel.contains(t.from,t.to)>-1&&ge(e),Fa(n,t,r,yo(e)),e.options.lineWrapping||(n.iter(q,k.line+t.text.length,function(Pe){var et=Dr(Pe);et>l.maxLineLength&&(l.maxLine=Pe,l.maxLineLength=et,l.maxLineChanged=!0,Z=!1)}),Z&&(e.curOp.updateMaxLine=!0)),yn(n,k.line),Li(e,400);var te=t.text.length-(Y.line-k.line)-1;t.full?fr(e):k.line==Y.line&&t.text.length==1&&!Bo(e.doc,t)?Hr(e,k.line,"text"):fr(e,k.line,Y.line+1,te);var me=de(e,"changes"),Ee=de(e,"change");if(Ee||me){var Ne={from:k,to:Y,text:t.text,removed:t.removed,origin:t.origin};Ee&&Ht(e,"change",e,Ne),me&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ne)}e.display.selForContextMenu=null}function mi(e,t,r,n,l){var k;n||(n=r),ft(n,r)<0&&(k=[n,r],r=k[0],n=k[1]),typeof t=="string"&&(t=e.splitLines(t)),pi(e,{from:r,to:n,text:t,origin:l})}function ns(e,t,r,n){r1||!(this.children[0]instanceof Ni))){var Z=[];this.collapse(Z),this.children=[new Ni(Z)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var Y=l.lines.length%25+25,Z=Y;Z10);e.parent.maybeSpill()},iterN:function(e,t,r){for(var n=0;ne.display.maxLineLength&&(e.display.maxLine=te,e.display.maxLineLength=me,e.display.maxLineChanged=!0)}n!=null&&e&&this.collapsed&&fr(e,n,l+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&$o(e.doc)),e&&Ht(e,"markerCleared",e,this,n,l),t&&ri(e),this.parent&&this.parent.clear()},Xr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var r,n,l=0;l0||Y==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=_("span",[k.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(Un(e,t.line,t,r,k)||t.line!=r.line&&Un(e,r.line,t,r,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");Sn()}k.addToHistory&&Ho(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var Z=t.line,q=e.cm,te;if(e.iter(Z,r.line+1,function(Ee){q&&k.collapsed&&!q.options.lineWrapping&&Bn(Ee)==q.display.maxLine&&(te=!0),k.collapsed&&Z!=t.line&&ht(Ee,0),er(Ee,new Tn(k,Z==t.line?t.ch:null,Z==r.line?r.ch:null)),++Z}),k.collapsed&&e.iter(t.line,r.line+1,function(Ee){hr(e,Ee)&&ht(Ee,0)}),k.clearOnEnter&&xe(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(fn(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++os,k.atomic=!0),q){if(te&&(q.curOp.updateMaxLine=!0),k.collapsed)fr(q,t.line,r.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var me=t.line;me<=r.line;me++)Hr(q,me,"text");k.atomic&&$o(q.doc),Ht(q,"markerAdded",q,k)}return k}var ji=function(e,t){this.markers=e,this.primary=t;for(var r=0;r=0;q--)pi(this,n[q]);Z?Xo(this,Z):this.cm&&di(this.cm)}),undo:Qn(function(){la(this,"undo")}),redo:Qn(function(){la(this,"redo")}),undoSelection:Qn(function(){la(this,"undo",!0)}),redoSelection:Qn(function(){la(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(l.marker.parent||l.marker)}return t},findMarks:function(e,t,r){e=m(this,e),t=m(this,t);var n=[],l=e.line;return this.iter(e.line,t.line+1,function(k){var Y=k.markedSpans;if(Y)for(var Z=0;Z=q.to||q.from==null&&l!=e.line||q.from!=null&&l==t.line&&q.from>=t.ch)&&(!r||r(q.marker))&&n.push(q.marker.parent||q.marker)}++l}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne)return t=e,!0;e-=k,++r}),m(this,Je(r,t))},indexFromPos:function(e){e=m(this,e);var t=e.ch;if(e.linet&&(t=e.from),e.to!=null&&e.to-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var me=e.dataTransfer.getData("Text");if(me){var Ee;if(t.state.draggingText&&!t.state.draggingText.copy&&(Ee=t.listSelections()),oa(t.doc,zr(r,r)),Ee)for(var Ne=0;Ne=0;Z--)mi(e.doc,"",n[Z].from,n[Z].to,"+delete");di(e)})}function za(e,t,r){var n=rt(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ga(e,t,r){var n=za(e,t.ch,r);return n==null?null:new Je(t.line,n,r<0?"after":"before")}function Va(e,t,r,n,l){if(e){t.doc.direction=="rtl"&&(l=-l);var k=Et(r,t.doc.direction);if(k){var Y=l<0?Re(k):k[0],Z=l<0==(Y.level==1),q=Z?"after":"before",te;if(Y.level>0||t.doc.direction=="rtl"){var me=oi(t,r);te=l<0?r.text.length-1:0;var Ee=Ir(t,me,te).top;te=Rt(function(Ne){return Ir(t,me,Ne).top==Ee},l<0==(Y.level==1)?Y.from:Y.to-1,te),q=="before"&&(te=za(r,te,1))}else te=l<0?Y.to:Y.from;return new Je(n,te,q)}}return new Je(n,l<0?r.text.length:0,l<0?"before":"after")}function kl(e,t,r,n){var l=Et(t,e.doc.direction);if(!l)return Ga(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var k=yt(l,r.ch,r.sticky),Y=l[k];if(e.doc.direction=="ltr"&&Y.level%2==0&&(n>0?Y.to>r.ch:Y.from=Y.from&&Ne>=me.begin)){var Pe=Ee?"before":"after";return new Je(r.line,Ne,Pe)}}var et=function(_t,Pt,Ot){for(var Ut=function(Ln,Zn){return Zn?new Je(r.line,Z(Ln,1),"before"):new Je(r.line,Ln,"after")};_t>=0&&_t0==(Yt.level!=1),ln=Vt?Ot.begin:Z(Ot.end,-1);if(Yt.from<=ln&&ln0?me.end:Z(me.begin,-1);return vt!=null&&!(n>0&&vt==t.text.length)&&(ct=et(n>0?0:l.length-1,n,te(vt)),ct)?ct:null}var Hi={selectAll:Zo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ye)},killLine:function(e){return yi(e,function(t){if(t.empty()){var r=Dt(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)l=new Je(l.line,l.ch+1),e.replaceRange(k.charAt(l.ch-1)+k.charAt(l.ch-2),Je(l.line,l.ch-2),l,"+transpose");else if(l.line>e.doc.first){var Y=Dt(e.doc,l.line-1).text;Y&&(l=new Je(l.line,1),e.replaceRange(k.charAt(0)+e.doc.lineSeparator()+Y.charAt(Y.length-1),Je(l.line-1,Y.length-1),l,"+transpose"))}}r.push(new Cn(l,l))}e.setSelections(r)})},newlineAndIndent:function(e){return Cr(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;ne&&ft(t,this.pos)==0&&r==this.button};var zi,Gi;function Wl(e,t){var r=+new Date;return Gi&&Gi.compare(r,e,t)?(zi=Gi=null,"triple"):zi&&zi.compare(r,e,t)?(Gi=new Ya(r,e,t),zi=null,"double"):(zi=new Ya(r,e,t),Gi=null,"single")}function Cs(e){var t=this,r=t.display;if(We(t,e)||r.activeTouch&&r.input.supportsTouch())return;if(r.input.ensurePolled(),r.shift=e.shiftKey,Br(r,e)){E||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));return}if($a(t,e))return;var n=Zr(t,e),l=ke(e),k=n?Wl(n,l):"single";if(window.focus(),l==1&&t.state.selectingText&&t.state.selectingText(e),n&&Hl(t,l,n,k,e))return;l==1?n?zl(t,n,k,e):we(e)==r.scroller&&ne(e):l==2?(n&&aa(t.doc,n),setTimeout(function(){return r.input.focus()},20)):l==3&&(D?t.display.input.onContextMenu(e):So(t))}function Hl(e,t,r,n,l){var k="Click";return n=="double"?k="Double"+k:n=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,Ki(e,fs(k,l),l,function(Y){if(typeof Y=="string"&&(Y=Hi[Y]),!Y)return!1;var Z=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Z=Y(e,r)!=Se}finally{e.state.suppressEdits=!1}return Z})}function Kl(e,t,r){var n=e.getOption("configureMouse"),l=n?n(e,t,r):{};if(l.unit==null){var k=h?r.shiftKey&&r.metaKey:r.altKey;l.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(l.extend==null||e.doc.extend)&&(l.extend=e.doc.extend||r.shiftKey),l.addNew==null&&(l.addNew=u?r.metaKey:r.ctrlKey),l.moveOnDrag==null&&(l.moveOnDrag=!(u?r.altKey:r.ctrlKey)),l}function zl(e,t,r,n){U?setTimeout(V(Co,e),0):e.curOp.focus=M();var l=Kl(e,r,n),k=e.doc.sel,Y;e.options.dragDrop&&Ze&&!e.isReadOnly()&&r=="single"&&(Y=k.contains(t))>-1&&(ft((Y=k.ranges[Y]).from(),t)<0||t.xRel>0)&&(ft(Y.to(),t)>0||t.xRel<0)?Gl(e,n,t,l):Vl(e,n,t,l)}function Gl(e,t,r,n){var l=e.display,k=!1,Y=Jn(e,function(te){E&&(l.scroller.draggable=!1),e.state.draggingText=!1,Ve(l.wrapper.ownerDocument,"mouseup",Y),Ve(l.wrapper.ownerDocument,"mousemove",Z),Ve(l.scroller,"dragstart",q),Ve(l.scroller,"drop",Y),k||(ne(te),n.addNew||aa(e.doc,r,null,null,n.extend),E&&!P||U&&N==9?setTimeout(function(){l.wrapper.ownerDocument.body.focus({preventScroll:!0}),l.input.focus()},20):l.input.focus())}),Z=function(te){k=k||Math.abs(t.clientX-te.clientX)+Math.abs(t.clientY-te.clientY)>=10},q=function(){return k=!0};E&&(l.scroller.draggable=!0),e.state.draggingText=Y,Y.copy=!n.moveOnDrag,l.scroller.dragDrop&&l.scroller.dragDrop(),xe(l.wrapper.ownerDocument,"mouseup",Y),xe(l.wrapper.ownerDocument,"mousemove",Z),xe(l.scroller,"dragstart",q),xe(l.scroller,"drop",Y),So(e),setTimeout(function(){return l.input.focus()},20)}function Ss(e,t,r){if(r=="char")return new Cn(t,t);if(r=="word")return e.findWordAt(t);if(r=="line")return new Cn(Je(t.line,0),m(e.doc,Je(t.line+1,0)));var n=r(e,t);return new Cn(n.from,n.to)}function Vl(e,t,r,n){var l=e.display,k=e.doc;ne(t);var Y,Z,q=k.sel,te=q.ranges;if(n.addNew&&!n.extend?(Z=k.sel.contains(r),Z>-1?Y=te[Z]:Y=new Cn(r,r)):(Y=k.sel.primary(),Z=k.sel.primIndex),n.unit=="rectangle")n.addNew||(Y=new Cn(r,r)),r=Zr(e,t,!0,!0),Z=-1;else{var me=Ss(e,r,n.unit);n.extend?Y=Ha(Y,me.anchor,me.head,n.extend):Y=me}n.addNew?Z==-1?(Z=te.length,or(k,Mr(e,te.concat([Y]),Z),{scroll:!1,origin:"*mouse"})):te.length>1&&te[Z].empty()&&n.unit=="char"&&!n.extend?(or(k,Mr(e,te.slice(0,Z).concat(te.slice(Z+1)),0),{scroll:!1,origin:"*mouse"}),q=k.sel):Ka(k,Z,Y,be):(Z=0,or(k,new _r([Y],0),be),q=k.sel);var Ee=r;function Ne(Ot){if(ft(Ee,Ot)==0)return;if(Ee=Ot,n.unit=="rectangle"){for(var Ut=[],Yt=e.options.tabSize,Vt=$(Dt(k,r.line).text,r.ch,Yt),ln=$(Dt(k,Ot.line).text,Ot.ch,Yt),Ln=Math.min(Vt,ln),Zn=Math.max(Vt,ln),jn=Math.min(r.line,Ot.line),Sr=Math.min(e.lastLine(),Math.max(r.line,Ot.line));jn<=Sr;jn++){var mr=Dt(k,jn).text,Vn=_e(mr,Ln,Yt);Ln==Zn?Ut.push(new Cn(Je(jn,Vn),Je(jn,Vn))):mr.length>Vn&&Ut.push(new Cn(Je(jn,Vn),Je(jn,_e(mr,Zn,Yt))))}Ut.length||Ut.push(new Cn(r,r)),or(k,Mr(e,q.ranges.slice(0,Z).concat(Ut),Z),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ot)}else{var gr=Y,rr=Ss(e,Ot,n.unit),$n=gr.anchor,Xn;ft(rr.anchor,$n)>0?(Xn=rr.head,$n=Zt(gr.from(),rr.anchor)):(Xn=rr.anchor,$n=Gt(gr.to(),rr.head));var Fn=q.ranges.slice(0);Fn[Z]=Xl(e,new Cn(m(k,$n),Xn)),or(k,Mr(e,Fn,Z),be)}}var Pe=l.wrapper.getBoundingClientRect(),et=0;function ct(Ot){var Ut=++et,Yt=Zr(e,Ot,!0,n.unit=="rectangle");if(!Yt)return;if(ft(Yt,Ee)!=0){e.curOp.focus=M(),Ne(Yt);var Vt=qi(l,k);(Yt.line>=Vt.to||Yt.linePe.bottom?20:0;ln&&setTimeout(Jn(e,function(){if(et!=Ut)return;l.scroller.scrollTop+=ln,ct(Ot)}),50)}}function vt(Ot){e.state.selectingText=!1,et=Infinity,Ot&&(ne(Ot),l.input.focus()),Ve(l.wrapper.ownerDocument,"mousemove",_t),Ve(l.wrapper.ownerDocument,"mouseup",Pt),k.history.lastSelOrigin=null}var _t=Jn(e,function(Ot){Ot.buttons===0||!ke(Ot)?vt(Ot):ct(Ot)}),Pt=Jn(e,vt);e.state.selectingText=Pt,xe(l.wrapper.ownerDocument,"mousemove",_t),xe(l.wrapper.ownerDocument,"mouseup",Pt)}function Xl(e,t){var r=t.anchor,n=t.head,l=Dt(e.doc,r.line);if(ft(r,n)==0&&r.sticky==n.sticky)return t;var k=Et(l);if(!k)return t;var Y=yt(k,r.ch,r.sticky),Z=k[Y];if(Z.from!=r.ch&&Z.to!=r.ch)return t;var q=Y+(Z.from==r.ch==(Z.level!=1)?0:1);if(q==0||q==k.length)return t;var te;if(n.line!=r.line)te=(n.line-r.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var me=yt(k,n.ch,n.sticky),Ee=me-Y||(n.ch-r.ch)*(Z.level==1?-1:1);me==q-1||me==q?te=Ee<0:te=Ee>0}var Ne=k[q+(te?-1:0)],Pe=te==(Ne.level==1),et=Pe?Ne.from:Ne.to,ct=Pe?"after":"before";return r.ch==et&&r.sticky==ct?t:new Cn(new Je(r.line,et,ct),n)}function Ts(e,t,r,n){var l,k;if(t.touches)l=t.touches[0].clientX,k=t.touches[0].clientY;else try{l=t.clientX,k=t.clientY}catch(Ne){return!1}if(l>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&ne(t);var Y=e.display,Z=Y.lineDiv.getBoundingClientRect();if(k>Z.bottom||!de(e,r))return oe(t);k-=Z.top-Y.viewOffset;for(var q=0;q=l){var me=Xt(e.doc,k),Ee=e.display.gutterSpecs[q];return De(e,r,e,me,Ee.className,t),oe(t)}}}function $a(e,t){return Ts(e,t,"gutterClick",!0)}function ws(e,t){if(Br(e.display,t)||Yl(e,t))return;if(We(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function _s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),wi(e)}var bi={toString:function(){return"CodeMirror.Init"}},Os={},ha={};function $l(e){var t=e.optionHandlers;function r(n,l,k,Y){e.defaults[n]=l,k&&(t[n]=Y?function(Z,q,te){te!=bi&&k(Z,q,te)}:k)}e.defineOption=r,e.Init=bi,r("value","",function(n,l){return n.setValue(l)},!0),r("mode",null,function(n,l){n.doc.modeOption=l,ja(n)},!0),r("indentUnit",2,ja,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(n){Pi(n),wi(n),fr(n)},!0),r("lineSeparator",null,function(n,l){if(n.doc.lineSep=l,!l)return;var k=[],Y=n.doc.first;n.doc.iter(function(q){for(var te=0;;){var me=q.text.indexOf(l,te);if(me==-1)break;te=me+l.length,k.push(Je(Y,me))}Y++});for(var Z=k.length-1;Z>=0;Z--)mi(n.doc,l,k[Z],Je(k[Z].line,k[Z].ch+l.length))}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(n,l,k){n.state.specialChars=new RegExp(l.source+(l.test(" ")?"":"| "),"g"),k!=bi&&n.refresh()}),r("specialCharPlaceholder",Mt,function(n){return n.refresh()},!0),r("electricChars",!0),r("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(n,l){return n.getInputField().spellcheck=l},!0),r("autocorrect",!1,function(n,l){return n.getInputField().autocorrect=l},!0),r("autocapitalize",!1,function(n,l){return n.getInputField().autocapitalize=l},!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",function(n){_s(n),Mi(n)},!0),r("keyMap","default",function(n,l,k){var Y=da(l),Z=k!=bi&&da(k);Z&&Z.detach&&Z.detach(n,Y),Y.attach&&Y.attach(n,Z||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ql,!0),r("gutters",[],function(n,l){n.display.gutterSpecs=Ua(l,n.options.lineNumbers),Mi(n)},!0),r("fixedGutter",!0,function(n,l){n.display.gutters.style.left=l?Oa(n.display)+"px":"0",n.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(n){return ci(n)},!0),r("scrollbarStyle","native",function(n){Do(n),ci(n),n.display.scrollbars.setScrollTop(n.doc.scrollTop),n.display.scrollbars.setScrollLeft(n.doc.scrollLeft)},!0),r("lineNumbers",!1,function(n,l){n.display.gutterSpecs=Ua(n.options.gutters,l),Mi(n)},!0),r("firstLineNumber",1,Mi,!0),r("lineNumberFormatter",function(n){return n},Mi,!0),r("showCursorWhenSelecting",!1,_i,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,function(n,l){l=="nocursor"&&(ui(n),n.display.input.blur()),n.display.input.readOnlyChanged(l)}),r("screenReaderLabel",null,function(n,l){l=l===""?null:l,n.display.input.screenReaderLabelChanged(l)}),r("disableInput",!1,function(n,l){l||n.display.input.reset()},!0),r("dragDrop",!0,Jl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,_i,!0),r("singleCursorHeightPerLine",!0,_i,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Pi,!0),r("addModeClass",!1,Pi,!0),r("pollInterval",100),r("undoDepth",200,function(n,l){return n.doc.history.undoDepth=l}),r("historyEventDelay",1250),r("viewportMargin",10,function(n){return n.refresh()},!0),r("maxHighlightLength",1e4,Pi,!0),r("moveInputWithCursor",!0,function(n,l){l||n.display.input.resetPosition()}),r("tabindex",null,function(n,l){return n.display.input.getField().tabIndex=l||""}),r("autofocus",null),r("direction","ltr",function(n,l){return n.doc.setDirection(l)},!0),r("phrases",null)}function Jl(e,t,r){var n=r&&r!=bi;if(!t!=!n){var l=e.display.dragFunctions,k=t?xe:Ve;k(e.display.scroller,"dragstart",l.start),k(e.display.scroller,"dragenter",l.enter),k(e.display.scroller,"dragover",l.over),k(e.display.scroller,"dragleave",l.leave),k(e.display.scroller,"drop",l.drop)}}function Ql(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),ir(e)),Aa(e),fr(e),wi(e),setTimeout(function(){return ci(e)},100)}function Nn(e,t){var r=this;if(!(this instanceof Nn))return new Nn(e,t);this.options=t=t?W(t):{},W(Os,t,!1);var n=t.value;typeof n=="string"?n=new pr(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var l=new Nn.inputStyles[t.inputStyle](this),k=this.display=new dl(e,n,l,t);k.wrapper.CodeMirror=this,_s(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Do(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 re,keySeq:null,specialChars:null},t.autofocus&&!a&&k.input.focus(),U&&N<11&&setTimeout(function(){return r.display.input.reset(!0)},20),Zl(this),Dl(),ni(this),this.curOp.forceUpdate=!0,jo(this,n),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){r.hasFocus()&&!r.state.focused&&Ra(r)},20):ui(this);for(var Y in ha)ha.hasOwnProperty(Y)&&ha[Y](this,t[Y],bi);Mo(this),t.finishInit&&t.finishInit(this);for(var Z=0;Z20*20}xe(t.scroller,"touchstart",function(q){if(!We(e,q)&&!k(q)&&!$a(e,q)){t.input.ensurePolled(),clearTimeout(r);var te=+new Date;t.activeTouch={start:te,moved:!1,prev:te-n.end<=300?n:null},q.touches.length==1&&(t.activeTouch.left=q.touches[0].pageX,t.activeTouch.top=q.touches[0].pageY)}}),xe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),xe(t.scroller,"touchend",function(q){var te=t.activeTouch;if(te&&!Br(t,q)&&te.left!=null&&!te.moved&&new Date-te.start<300){var me=e.coordsChar(t.activeTouch,"page"),Ee;!te.prev||Y(te,te.prev)?Ee=new Cn(me,me):!te.prev.prev||Y(te,te.prev.prev)?Ee=e.findWordAt(me):Ee=new Cn(Je(me.line,0),m(e.doc,Je(me.line+1,0))),e.setSelection(Ee.anchor,Ee.head),e.focus(),ne(q)}l()}),xe(t.scroller,"touchcancel",l),xe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Ai(e,t.scroller.scrollTop),ei(e,t.scroller.scrollLeft,!0),De(e,"scroll",e))}),xe(t.scroller,"mousewheel",function(q){return Io(e,q)}),xe(t.scroller,"DOMMouseScroll",function(q){return Io(e,q)}),xe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(q){We(e,q)||ue(q)},over:function(q){We(e,q)||(Al(e,q),ue(q))},start:function(q){return Ol(e,q)},drop:Jn(e,_l),leave:function(q){We(e,q)||us(e)}};var Z=t.input.getField();xe(Z,"keyup",function(q){return Es.call(e,q)}),xe(Z,"keydown",Jn(e,bs)),xe(Z,"keypress",Jn(e,xs)),xe(Z,"focus",function(q){return Ra(e,q)}),xe(Z,"blur",function(q){return ui(e,q)})}var Ja=[];Nn.defineInitHook=function(e){return Ja.push(e)};function Vi(e,t,r,n){var l=e.doc,k;r==null&&(r="add"),r=="smart"&&(l.mode.indent?k=Me(e,t).state:r="prev");var Y=e.options.tabSize,Z=Dt(l,t),q=$(Z.text,null,Y);Z.stateAfter&&(Z.stateAfter=null);var te=Z.text.match(/^\s*/)[0],me;if(!n&&!/\S/.test(Z.text))me=0,r="not";else if(r=="smart"&&(me=l.mode.indent(k,Z.text.slice(te.length),Z.text),me==Se||me>150)){if(!n)return;r="prev"}r=="prev"?t>l.first?me=$(Dt(l,t-1).text,null,Y):me=0:r=="add"?me=q+e.options.indentUnit:r=="subtract"?me=q-e.options.indentUnit:typeof r=="number"&&(me=q+r),me=Math.max(0,me);var Ee="",Ne=0;if(e.options.indentWithTabs)for(var Pe=Math.floor(me/Y);Pe;--Pe)Ne+=Y,Ee+=" ";if(NeY,q=Be(t),te=null;if(Z&&n.ranges.length>1)if(Pr&&Pr.text.join(` `)==t){if(n.ranges.length%Pr.text.length==0){te=[];for(var me=0;me=0;Ne--){var Pe=n.ranges[Ne],et=Pe.from(),ct=Pe.to();Pe.empty()&&(r&&r>0?et=Je(et.line,et.ch-r):e.state.overwrite&&!Z?ct=Je(ct.line,Math.min(Dt(k,ct.line).text.length,ct.ch+Re(q).length)):Z&&Pr&&Pr.lineWise&&Pr.text.join(` `)==q.join(` `)&&(et=ct=Je(et.line,0)));var vt={from:et,to:ct,text:te?te[Ne%te.length]:q,origin:l||(Z?"paste":e.state.cutIncoming>Y?"cut":"+input")};pi(e.doc,vt),Ht(e,"inputRead",e,vt)}t&&!Z&&Ds(e,t),di(e),e.curOp.updateInput<2&&(e.curOp.updateInput=Ee),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Cr(t,function(){return Qa(t,r,0,null,"paste")}),!0}function Ds(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var l=r.ranges[n];if(l.head.ch>100||n&&r.ranges[n-1].head.line==l.head.line)continue;var k=e.getModeAt(l.head),Y=!1;if(k.electricChars){for(var Z=0;Z-1){Y=Vi(e,l.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(Dt(e.doc,l.head.line).text.slice(0,l.head.ch))&&(Y=Vi(e,l.head.line,"smart")));Y&&Ht(e,"electricInput",e,l.head.line)}}function Rs(e){for(var t=[],r=[],n=0;nk&&(Vi(this,Z.head.line,n,!0),k=Z.head.line,Y==this.doc.sel.primIndex&&di(this));else{var q=Z.from(),te=Z.to(),me=Math.max(k,q.line);k=Math.min(this.lastLine(),te.line-(te.ch?0:1))+1;for(var Ee=me;Ee0&&Ka(this.doc,Y,new Cn(q,Ne[Y].to()),ye)}}}),getTokenAt:function(n,l){return tn(this,n,l)},getLineTokens:function(n,l){return tn(this,Je(n),l,!0)},getTokenTypeAt:function(n){n=m(this.doc,n);var l=Xe(this,Dt(this.doc,n.line)),k=0,Y=(l.length-1)/2,Z=n.ch,q;if(Z==0)q=l[2];else for(;;){var te=k+Y>>1;if((te?l[te*2-1]:0)>=Z)Y=te;else if(l[te*2+1]q&&(n=q,Y=!0),Z=Dt(this.doc,n)}else Z=n;return $i(this,Z,{top:0,left:0},l||"page",k||Y).top+(Y?this.doc.height-nr(Z):0)},defaultTextHeight:function(){return si(this.display)},defaultCharWidth:function(){return li(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(n,l,k,Y,Z){var q=this.display;n=Lr(this,m(this.doc,n));var te=n.bottom,me=n.left;if(l.style.position="absolute",l.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(l),q.sizer.appendChild(l),Y=="over")te=n.top;else if(Y=="above"||Y=="near"){var Ee=Math.max(q.wrapper.clientHeight,this.doc.height),Ne=Math.max(q.sizer.clientWidth,q.lineSpace.clientWidth);(Y=="above"||n.bottom+l.offsetHeight>Ee)&&n.top>l.offsetHeight?te=n.top-l.offsetHeight:n.bottom+l.offsetHeight<=Ee&&(te=n.bottom),me+l.offsetWidth>Ne&&(me=Ne-l.offsetWidth)}l.style.top=te+"px",l.style.left=l.style.right="",Z=="right"?(me=q.sizer.clientWidth-l.offsetWidth,l.style.right="0px"):(Z=="left"?me=0:Z=="middle"&&(me=(q.sizer.clientWidth-l.offsetWidth)/2),l.style.left=me+"px"),k&&Js(this,{left:me,top:te,right:me+l.offsetWidth,bottom:te+l.offsetHeight})},triggerOnKeyDown:ur(bs),triggerOnKeyPress:ur(xs),triggerOnKeyUp:Es,triggerOnMouseDown:ur(Cs),execCommand:function(n){if(Hi.hasOwnProperty(n))return Hi[n].call(null,this)},triggerElectric:ur(function(n){Ds(this,n)}),findPosH:function(n,l,k,Y){var Z=1;l<0&&(Z=-1,l=-l);for(var q=m(this.doc,n),te=0;te0&&me(k.charAt(Y-1));)--Y;for(;Z.5||this.options.lineWrapping)&&Aa(this),De(this,"refresh",this)}),swapDoc:ur(function(n){var l=this.doc;return l.cm=null,this.state.selectingText&&this.state.selectingText(),jo(this,n),wi(this),this.display.input.reset(),Oi(this,n.scrollLeft,n.scrollTop),this.curOp.forceScroll=!0,Ht(this,"swapDoc",this,l),l}),phrase:function(n){var l=this.options.phrases;return l&&Object.prototype.hasOwnProperty.call(l,n)?l[n]:n},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ce(e),e.registerHelper=function(n,l,k){r.hasOwnProperty(n)||(r[n]=e[n]={_global:[]}),r[n][l]=k},e.registerGlobalHelper=function(n,l,k,Y){e.registerHelper(n,l,Y),r[n]._global.push({pred:k,val:Y})}}function Za(e,t,r,n,l){var k=t,Y=r,Z=Dt(e,t.line),q=l&&e.direction=="rtl"?-r:r;function te(){var Pt=t.line+q;return Pt=e.first+e.size?!1:(t=new Je(Pt,t.ch,t.sticky),Z=Dt(e,Pt))}function me(Pt){var Ot;if(n=="codepoint"){var Ut=Z.text.charCodeAt(t.ch+(n>0?0:-1));isNaN(Ut)?Ot=null:Ot=new Je(t.line,Math.max(0,Math.min(Z.text.length,t.ch+r*(Ut>=55296&&Ut<56320?2:1))),-r)}else l?Ot=kl(e.cm,Z,t,r):Ot=Ga(Z,t,r);if(Ot==null)if(!Pt&&te())t=Va(l,e.cm,Z,t.line,q);else return!1;else t=Ot;return!0}if(n=="char"||n=="codepoint")me();else if(n=="column")me(!0);else if(n=="word"||n=="group")for(var Ee=null,Ne=n=="group",Pe=e.cm&&e.cm.getHelper(t,"wordChars"),et=!0;!(r<0&&!me(!et));et=!1){var ct=Z.text.charAt(t.ch)||` `,vt=ut(ct,Pe)?"w":Ne&&ct==` `?"n":!Ne||/\s/.test(ct)?null:"p";if(Ne&&!et&&!vt&&(vt="s"),Ee&&Ee!=vt){r<0&&(r=1,me(),t.sticky="after");break}if(vt&&(Ee=vt),r>0&&!me(!et))break}var _t=sa(e,t,k,Y,!0);return kt(k,_t)&&(_t.hitSide=!0),_t}function Ps(e,t,r,n){var l=e.doc,k=t.left,Y;if(n=="page"){var Z=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),q=Math.max(Z-.5*si(e.display),3);Y=(r>0?t.bottom:t.top)+r*q}else n=="line"&&(Y=r>0?t.bottom+3:t.top-3);for(var te;!(te=Ta(e,k,Y),!te.outside);){if(r<0?Y<=0:Y>=l.height){te.hitSide=!0;break}Y+=r*5}return te}var An=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new re,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};An.prototype.init=function(e){var t=this,r=this,n=r.cm,l=r.div=e.lineDiv;Ls(l,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize);function k(Z){for(var q=Z.target;q;q=q.parentNode){if(q==l)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(q.className))break}return!1}xe(l,"paste",function(Z){if(!k(Z)||We(n,Z)||As(Z,n))return;N<=11&&setTimeout(Jn(n,function(){return t.updateFromDOM()}),20)}),xe(l,"compositionstart",function(Z){t.composing={data:Z.data,done:!1}}),xe(l,"compositionupdate",function(Z){t.composing||(t.composing={data:Z.data,done:!1})}),xe(l,"compositionend",function(Z){t.composing&&(Z.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),xe(l,"touchstart",function(){return r.forceCompositionEnd()}),xe(l,"input",function(){t.composing||t.readFromDOMSoon()});function Y(Z){if(!k(Z)||We(n,Z))return;if(n.somethingSelected())fa({lineWise:!1,text:n.getSelections()}),Z.type=="cut"&&n.replaceSelection("",null,"cut");else if(n.options.lineWiseCopyCut){var q=Rs(n);fa({lineWise:!0,text:q.text}),Z.type=="cut"&&n.operation(function(){n.setSelections(q.ranges,0,ye),n.replaceSelection("",null,"cut")})}else return;if(Z.clipboardData){Z.clipboardData.clearData();var te=Pr.text.join(` `);if(Z.clipboardData.setData("Text",te),Z.clipboardData.getData("Text")==te){Z.preventDefault();return}}var me=Ms(),Ee=me.firstChild;n.display.lineSpace.insertBefore(me,n.display.lineSpace.firstChild),Ee.value=Pr.text.join(` `);var Ne=document.activeElement;Q(Ee),setTimeout(function(){n.display.lineSpace.removeChild(me),Ne.focus(),Ne==l&&r.showPrimarySelection()},50)}xe(l,"copy",Y),xe(l,"cut",Y)},An.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},An.prototype.prepareSelection=function(){var e=Eo(this.cm,!1);return e.focus=document.activeElement==this.div,e},An.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},An.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},An.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),l=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||l.line=t.display.viewFrom&&ks(t,n)||{node:Z[0].measure.map[2],offset:0},te=l.linee.firstLine()&&(n=Je(n.line-1,Dt(e.doc,n.line-1).length)),l.ch==Dt(e.doc,l.line).text.length&&l.linet.viewTo-1)return!1;var k,Y,Z;n.line==t.viewFrom||(k=qr(e,n.line))==0?(Y=St(t.view[0].line),Z=t.view[0].node):(Y=St(t.view[k].line),Z=t.view[k-1].node.nextSibling);var q=qr(e,l.line),te,me;if(q==t.view.length-1?(te=t.viewTo-1,me=t.lineDiv.lastChild):(te=St(t.view[q+1].line)-1,me=t.view[q+1].node.previousSibling),!Z)return!1;for(var Ee=e.doc.splitLines(tu(e,Z,me,Y,te)),Ne=xn(e.doc,Je(Y,0),Je(te,Dt(e.doc,te).text.length));Ee.length>1&&Ne.length>1;)if(Re(Ee)==Re(Ne))Ee.pop(),Ne.pop(),te--;else if(Ee[0]==Ne[0])Ee.shift(),Ne.shift(),Y++;else break;for(var Pe=0,et=0,ct=Ee[0],vt=Ne[0],_t=Math.min(ct.length,vt.length);Pe<_t&&ct.charCodeAt(Pe)==vt.charCodeAt(Pe);)++Pe;for(var Pt=Re(Ee),Ot=Re(Ne),Ut=Math.min(Pt.length-(Ee.length==1?Pe:0),Ot.length-(Ne.length==1?Pe:0));etn.ch&&Pt.charCodeAt(Pt.length-et-1)==Ot.charCodeAt(Ot.length-et-1);)Pe--,et++;Ee[Ee.length-1]=Pt.slice(0,Pt.length-et).replace(/^\u200b+/,""),Ee[0]=Ee[0].slice(Pe).replace(/\u200b+$/,"");var Yt=Je(Y,Pe),Vt=Je(te,Ne.length?Re(Ne).length-et:0);if(Ee.length>1||Ee[0]||ft(Yt,Vt))return mi(e.doc,Ee,Yt,Vt,"+input"),!0},An.prototype.ensurePolled=function(){this.forceCompositionEnd()},An.prototype.reset=function(){this.forceCompositionEnd()},An.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},An.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)},An.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Cr(this.cm,function(){return fr(e.cm)})},An.prototype.setUneditable=function(e){e.contentEditable="false"},An.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Jn(this.cm,Qa)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},An.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},An.prototype.onContextMenu=function(){},An.prototype.resetPosition=function(){},An.prototype.needsContentAttribute=!0;function ks(e,t){var r=Ea(e,t.line);if(!r||r.hidden)return null;var n=Dt(e.doc,t.line),l=ao(r,n,t.line),k=Et(n,e.doc.direction),Y="left";if(k){var Z=yt(k,t.ch);Y=Z%2?"right":"left"}var q=lo(l.map,t.ch,Y);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 Ei(e,t){return t&&(e.bad=!0),e}function tu(e,t,r,n,l){var k="",Y=!1,Z=e.doc.lineSeparator(),q=!1;function te(Pe){return function(et){return et.id==Pe}}function me(){Y&&(k+=Z,q&&(k+=Z),Y=q=!1)}function Ee(Pe){Pe&&(me(),k+=Pe)}function Ne(Pe){if(Pe.nodeType==1){var et=Pe.getAttribute("cm-text");if(et){Ee(et);return}var ct=Pe.getAttribute("cm-marker"),vt;if(ct){var _t=e.findMarks(Je(n,0),Je(l+1,0),te(+ct));_t.length&&(vt=_t[0].find(0))&&Ee(xn(e.doc,vt.from,vt.to).join(Z));return}if(Pe.getAttribute("contenteditable")=="false")return;var Pt=/^(pre|div|p|li|table|br)$/i.test(Pe.nodeName);if(!/^br$/i.test(Pe.nodeName)&&Pe.textContent.length==0)return;Pt&&me();for(var Ot=0;Ot=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),xe(l,"paste",function(Y){if(We(n,Y)||As(Y,n))return;n.state.pasteIncoming=+new Date,r.fastPoll()});function k(Y){if(We(n,Y))return;if(n.somethingSelected())fa({lineWise:!1,text:n.getSelections()});else if(n.options.lineWiseCopyCut){var Z=Rs(n);fa({lineWise:!0,text:Z.text}),Y.type=="cut"?n.setSelections(Z.ranges,null,ye):(r.prevInput="",l.value=Z.text.join(` `),Q(l))}else return;Y.type=="cut"&&(n.state.cutIncoming=+new Date)}xe(l,"cut",k),xe(l,"copy",k),xe(e.scroller,"paste",function(Y){if(Br(e,Y)||We(n,Y))return;if(!l.dispatchEvent){n.state.pasteIncoming=+new Date,r.focus();return}var Z=new Event("paste");Z.clipboardData=Y.clipboardData,l.dispatchEvent(Z)}),xe(e.lineSpace,"selectstart",function(Y){Br(e,Y)||ne(Y)}),xe(l,"compositionstart",function(){var Y=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:Y,range:n.markText(Y,n.getCursor("to"),{className:"CodeMirror-composing"})}}),xe(l,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Kn.prototype.createField=function(e){this.wrapper=Ms(),this.textarea=this.wrapper.firstChild},Kn.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Kn.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Eo(e);if(e.options.moveInputWithCursor){var l=Lr(e,r.sel.primary().head,"div"),k=t.wrapper.getBoundingClientRect(),Y=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,l.top+Y.top-k.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,l.left+Y.left-k.left))}return n},Kn.prototype.showSelection=function(e){var t=this.cm,r=t.display;o(r.cursorDiv,e.cursors),o(r.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Kn.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&Q(this.textarea),U&&N>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",U&&N>=9&&(this.hasSelection=null))},Kn.prototype.getField=function(){return this.textarea},Kn.prototype.supportsTouch=function(){return!1},Kn.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Kn.prototype.blur=function(){this.textarea.blur()},Kn.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Kn.prototype.receivedFocus=function(){this.slowPoll()},Kn.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()})},Kn.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function r(){var n=t.poll();!n&&!e?(e=!0,t.polling.set(60,r)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,r)},Kn.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ue(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var l=r.value;if(l==n&&!t.somethingSelected())return!1;if(U&&N>=9&&this.hasSelection===l||u&&/[\uf700-\uf7ff]/.test(l))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=l.charCodeAt(0);if(k==8203&&!n&&(n="\u200B"),k==8666)return this.reset(),this.cm.execCommand("undo")}for(var Y=0,Z=Math.min(n.length,l.length);Y1e3||l.indexOf(` `)>-1?r.value=e.prevInput="":e.prevInput=l,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Kn.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Kn.prototype.onKeyPress=function(){U&&N>=9&&(this.hasSelection=null),this.fastPoll()},Kn.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,l=t.textarea;t.contextMenuPending&&t.contextMenuPending();var k=Zr(r,e),Y=n.scroller.scrollTop;if(!k||T)return;var Z=r.options.resetSelectionOnContextMenu;Z&&r.doc.sel.contains(k)==-1&&Jn(r,or)(r.doc,zr(k),ye);var q=l.style.cssText,te=t.wrapper.style.cssText,me=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",l.style.cssText=`position: absolute; width: 30px; height: 30px; top: `+(e.clientY-me.top-5)+"px; left: "+(e.clientX-me.left-5)+`px; z-index: 1000; background: `+(U?"rgba(255, 255, 255, .05)":"transparent")+`; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var Ee;E&&(Ee=window.scrollY),n.input.focus(),E&&window.scrollTo(null,Ee),n.input.reset(),r.somethingSelected()||(l.value=t.prevInput=" "),t.contextMenuPending=Pe,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll);function Ne(){if(l.selectionStart!=null){var ct=r.somethingSelected(),vt="\u200B"+(ct?l.value:"");l.value="\u21DA",l.value=vt,t.prevInput=ct?"":"\u200B",l.selectionStart=1,l.selectionEnd=vt.length,n.selForContextMenu=r.doc.sel}}function Pe(){if(t.contextMenuPending!=Pe)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=te,l.style.cssText=q,U&&N<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=Y),l.selectionStart!=null){(!U||U&&N<9)&&Ne();var ct=0,vt=function(){n.selForContextMenu==r.doc.sel&&l.selectionStart==0&&l.selectionEnd>0&&t.prevInput=="\u200B"?Jn(r,Zo)(r):ct++<10?n.detectingSelectAll=setTimeout(vt,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(vt,200)}}if(U&&N>=9&&Ne(),D){ue(e);var et=function(){Ve(window,"mouseup",et),setTimeout(Pe,20)};xe(window,"mouseup",et)}else setTimeout(Pe,50)},Kn.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Kn.prototype.setUneditable=function(){},Kn.prototype.needsContentAttribute=!1;function ru(e,t){if(t=t?W(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 r=M();t.autofocus=r==e||e.getAttribute("autofocus")!=null&&r==document.body}function n(){e.value=Z.getValue()}var l;if(e.form&&(xe(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var k=e.form;l=k.submit;try{var Y=k.submit=function(){n(),k.submit=l,k.submit(),k.submit=Y}}catch(q){}}t.finishInit=function(q){q.save=n,q.getTextArea=function(){return e},q.toTextArea=function(){q.toTextArea=isNaN,n(),e.parentNode.removeChild(q.getWrapperElement()),e.style.display="",e.form&&(Ve(e.form,"submit",n),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=l))}},e.style.display="none";var Z=Nn(function(q){return e.parentNode.insertBefore(q,e.nextSibling)},t);return Z}function iu(e){e.off=Ve,e.on=xe,e.wheelEventPixels=cl,e.Doc=pr,e.splitLines=Be,e.countColumn=$,e.findColumn=_e,e.isWordChar=Ye,e.Pass=Se,e.signal=De,e.Line=ar,e.changeEnd=Gr,e.scrollbarModel=Ao,e.Pos=Je,e.cmpPos=ft,e.modes=je,e.mimeModes=Ie,e.resolveMode=Ae,e.getMode=tt,e.modeExtensions=mt,e.extendMode=gt,e.copyState=Lt,e.startState=hn,e.innerMode=mn,e.commands=Hi,e.keyMap=jr,e.keyName=ps,e.isModifierKey=hs,e.lookupKey=vi,e.normalizeKeyMap=Pl,e.StringStream=en,e.SharedTextMarker=ji,e.TextMarker=Xr,e.LineWidget=Bi,e.e_preventDefault=ne,e.e_stopPropagation=ie,e.e_stop=ue,e.addClass=B,e.contains=y,e.rmClass=f,e.keyNames=Yr}$l(Nn),ql(Nn);var au="iter insert remove copy getEditor constructor".split(" ");for(var ma in pr.prototype)pr.prototype.hasOwnProperty(ma)&&ae(au,ma)<0&&(Nn.prototype[ma]=function(e){return function(){return e.apply(this.doc,arguments)}}(pr.prototype[ma]));return ce(pr),Nn.inputStyles={textarea:Kn,contenteditable:An},Nn.defineMode=function(e){!Nn.defaults.mode&&e!="null"&&(Nn.defaults.mode=e),dt.apply(this,arguments)},Nn.defineMIME=lt,Nn.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Nn.defineMIME("text/plain","null"),Nn.defineExtension=function(e,t){Nn.prototype[e]=t},Nn.defineDocExtension=function(e,t){pr.prototype[e]=t},Nn.fromTextArea=ru,iu(Nn),Nn.version="5.58.2",Nn})},WaYH:function(Fe,Ce,j){"use strict";var J=j("rePB"),K=j("Ff2n"),R=j("VTBJ"),H=j("1OyB"),I=j("vuIU"),x=j("JX7q"),U=j("Ji7U"),N=j("LK+K"),E=j("q1tI"),L=j("TSYQ"),c=j.n(L),T=j("sboe"),P=j("OZM5"),O=function(D){var S=D.prefixCls,f=D.level,d=D.isStart,o=D.isEnd;if(!f)return null;for(var s="".concat(S,"-indent-unit"),_=[],C=0;C1&&arguments[1]!==void 0?arguments[1]:!1,Oe=ye.getAttribute("id")||ye.getAttribute("data-reactid")||ye.getAttribute("name");if(be&&M[Oe])return M[Oe];var _e=window.getComputedStyle(ye),fe=_e.getPropertyValue("box-sizing")||_e.getPropertyValue("-moz-box-sizing")||_e.getPropertyValue("-webkit-box-sizing"),le=parseFloat(_e.getPropertyValue("padding-bottom"))+parseFloat(_e.getPropertyValue("padding-top")),Re=parseFloat(_e.getPropertyValue("border-bottom-width"))+parseFloat(_e.getPropertyValue("border-top-width")),ot=y.map(function(nt){return"".concat(nt,":").concat(_e.getPropertyValue(nt))}).join(";"),st={sizingStyle:ot,paddingSize:le,borderSize:Re,boxSizing:fe};return be&&Oe&&(M[Oe]=st),st}function Q(ye){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Oe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,_e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),ye.getAttribute("wrap")?B.setAttribute("wrap",ye.getAttribute("wrap")):B.removeAttribute("wrap");var fe=F(ye,be),le=fe.paddingSize,Re=fe.borderSize,ot=fe.boxSizing,st=fe.sizingStyle;B.setAttribute("style","".concat(st,";").concat(C)),B.value=ye.value||ye.placeholder||"";var nt=Number.MIN_SAFE_INTEGER,$e=Number.MAX_SAFE_INTEGER,Ke=B.scrollHeight,Ye;if(ot==="border-box"?Ke+=Re:ot==="content-box"&&(Ke-=le),Oe!==null||_e!==null){B.value=" ";var ut=B.scrollHeight-le;Oe!==null&&(nt=ut*Oe,ot==="border-box"&&(nt=nt+le+Re),Ke=Math.max(nt,Ke)),_e!==null&&($e=ut*_e,ot==="border-box"&&($e=$e+le+Re),Ye=Ke>$e?"":"hidden",Ke=Math.min($e,Ke))}return{height:Ke,minHeight:nt,maxHeight:$e,overflowY:Ye,resize:"none"}}var V=j("Gytx"),W=j.n(V),$;(function(ye){ye[ye.NONE=0]="NONE",ye[ye.RESIZING=1]="RESIZING",ye[ye.RESIZED=2]="RESIZED"})($||($={}));var re=function(ye){Object(H.a)(Oe,ye);var be=Object(I.a)(Oe);function Oe(_e){var fe;return Object(K.a)(this,Oe),fe=be.call(this,_e),fe.nextFrameActionId=void 0,fe.resizeFrameId=void 0,fe.textArea=void 0,fe.saveTextArea=function(le){fe.textArea=le},fe.handleResize=function(le){var Re=fe.state.resizeStatus,ot=fe.props,st=ot.autoSize,nt=ot.onResize;if(Re!==$.NONE)return;typeof nt=="function"&&nt(le),st&&fe.resizeOnNextFrame()},fe.resizeOnNextFrame=function(){cancelAnimationFrame(fe.nextFrameActionId),fe.nextFrameActionId=requestAnimationFrame(fe.resizeTextarea)},fe.resizeTextarea=function(){var le=fe.props.autoSize;if(!le||!fe.textArea)return;var Re=le.minRows,ot=le.maxRows,st=Q(fe.textArea,!1,Re,ot);fe.setState({textareaStyles:st,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(fe.resizeFrameId),fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:$.RESIZED},function(){fe.resizeFrameId=requestAnimationFrame(function(){fe.setState({resizeStatus:$.NONE}),fe.fixFirefoxAutoScroll()})})})})},fe.renderTextArea=function(){var le=fe.props,Re=le.prefixCls,ot=Re===void 0?"rc-textarea":Re,st=le.autoSize,nt=le.onResize,$e=le.className,Ke=le.disabled,Ye=fe.state,ut=Ye.textareaStyles,pt=Ye.resizeStatus,at=Object(o.a)(fe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Qe=_()(ot,$e,Object(N.a)({},"".concat(ot,"-disabled"),Ke));"value"in at&&(at.value=at.value||"");var rt=Object(U.a)(Object(U.a)(Object(U.a)({},fe.props.style),ut),pt===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return x.createElement(d,{onResize:fe.handleResize,disabled:!(st||nt)},x.createElement("textarea",Object(J.a)({},at,{className:Qe,style:rt,ref:fe.saveTextArea})))},fe.state={textareaStyles:{},resizeStatus:$.NONE},fe}return Object(R.a)(Oe,[{key:"componentDidUpdate",value:function(fe){(fe.value!==this.props.value||!W()(fe.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 fe=this.textArea.selectionStart,le=this.textArea.selectionEnd;this.textArea.setSelectionRange(fe,le)}}catch(Re){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Oe}(x.Component),ae=re,he=function(ye){Object(H.a)(Oe,ye);var be=Object(I.a)(Oe);function Oe(_e){var fe;Object(K.a)(this,Oe),fe=be.call(this,_e),fe.resizableTextArea=void 0,fe.focus=function(){fe.resizableTextArea.textArea.focus()},fe.saveTextArea=function(Re){fe.resizableTextArea=Re},fe.handleChange=function(Re){var ot=fe.props.onChange;fe.setValue(Re.target.value,function(){fe.resizableTextArea.resizeTextarea()}),ot&&ot(Re)},fe.handleKeyDown=function(Re){var ot=fe.props,st=ot.onPressEnter,nt=ot.onKeyDown;Re.keyCode===13&&st&&st(Re),nt&&nt(Re)};var le=typeof _e.value=="undefined"||_e.value===null?_e.defaultValue:_e.value;return fe.state={value:le},fe}return Object(R.a)(Oe,[{key:"setValue",value:function(fe,le){"value"in this.props||this.setState({value:fe},le)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return x.createElement(ae,Object(J.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(fe){return"value"in fe?{value:fe.value}:null}}]),Oe}(x.Component),Se=Ce.default=he},ZD9Y:function(Fe,Ce,j){"use strict";var J=j("BoS7"),K=j("Sdc0"),R=j("OaEy"),H=j("2fM7"),I=j("q1tI"),x=j.n(I),U=j("lOMy"),N=j.n(U),E=H.a.Option;Ce.a=function(L){var c=L.onFontSizeChange,T=L.cmFontSize,P=L.cmCodeMode,O=L.onCodeModeChange,p=L.onTabToSpace,g=L.className,i=g===void 0?"":g,a=L.tabToSpace,u=L.children;return x.a.createElement("div",{className:"tpi-code-setting ".concat(i)},x.a.createElement("h3",null,"\u4EE3\u7801\u7F16\u8F91\u5668"),x.a.createElement("section",null,x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u98CE\u683C\u5207\u6362"),x.a.createElement(H.a,{bordered:!1,size:"small",value:P,onChange:O},x.a.createElement(E,{value:"vs"},"\u6D45\u8272\u98CE\u683C"),x.a.createElement(E,{value:"vs-dark"},"\u6DF1\u8272\u98CE\u683C"))),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u5B57\u4F53\u5927\u5C0F"),x.a.createElement(H.a,{bordered:!1,size:"small",value:T,onChange:c},x.a.createElement(E,{value:12},"12px"),x.a.createElement(E,{value:14},"14px"),x.a.createElement(E,{value:16},"16px"),x.a.createElement(E,{value:18},"18px"),x.a.createElement(E,{value:20},"20px"),x.a.createElement(E,{value:22},"22px"))),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"Tab\u8F6C\u6362"),x.a.createElement(K.a,{checked:a,onChange:p}))),x.a.createElement("h3",null,"\u5FEB\u6377\u952E"),x.a.createElement("section",null,x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u4FDD\u5B58\u4EE3\u7801"),x.a.createElement("span",null,"Ctrl + S")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u5524\u51FA\u5FEB\u6377\u952E\u5217\u8868"),x.a.createElement("span",null,"F1 / Alt + F1")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u5DE6\u53F3\u7F29\u8FDB"),x.a.createElement("span",null,"Ctrl + ]/[")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u8DF3\u5230\u5339\u914D\u7684\u62EC\u53F7"),x.a.createElement("span",null,"Ctrl + Shift + \\")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u8F6C\u5230\u884C\u9996"),x.a.createElement("span",null,"Home")),x.a.createElement("div",{className:"file-item"},x.a.createElement("b",null,"\u8F6C\u5230\u884C\u5C3E"),x.a.createElement("span",null,"End"))),u)}},ZW9T:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return w});var J=j("k1fw"),K=j("miYZ"),R=j("tsqr"),H=j("rAM+"),I=j("tJVT"),x=j("PpiC"),U=j("q1tI"),N=j.n(U),E=j("bdgK");function L(b,v,D,S,f){var d=v.getWordUntilPosition(D),o={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:d.startColumn,endColumn:d.endColumn},s=S.map(function(_){return{label:_,kind:b.languages.CompletionItemKind.Keyword,insertText:_,insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}});return f.map(function(_){s.push(Object(J.a)(Object(J.a)({},_),{},{range:o}))}),s}var c=function(b){var v={label:"ifelse",kind:b.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(` `),insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet},D=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];b.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(o,s){var _=L(b,o,s,D,[v]);return{suggestions:_}}});var S=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];b.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(o,s){var _=[{label:"print",kind:b.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(` `),insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet}],C=L(b,o,s,S,_);return{suggestions:C}}});var f=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];b.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(o,s){var _=[v,{label:"main",kind:b.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(` `),insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:b.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(` `),insertTextRules:b.languages.CompletionItemInsertTextRule.InsertAsSnippet}],C=L(b,o,s,f,_);return{suggestions:C}}})},T="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=j("LvDl");function O(b){return/^\d+$/.test(b)?"".concat(b,"px"):b}function p(){}var g=!1,i={"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 a(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],v=b;if(Array.isArray(b)){for(var D=0;D0||Ze.target.offsetWidth>0)&&$e.current.instance.layout()}}catch(bt){we.e(bt)}finally{we.f()}}),oe.observe(nt.current)),oe}function Ct(){R.b.warn(decodeURIComponent(T))}var xt=function(){var ue=$e.current.instance;if(d!=null&&ue&&Qe){var we=ue.getModel();we&&d!==we.getValue()&&(g=!0,we.setValue(d),ue.layout(),g=!1)}};Object(U.useEffect)(function(){Ke.current&&clearTimeout(Ke.current),Ke.current=setTimeout(function(){xt()},500)},[d,Qe,$e.current]);function yt(){var oe=$e.current.instance;if(oe){var ue=oe.getSelection(),we=$e.current.pastePos||{},ke=new u.Range(we.startLineNumber||ue.endLineNumber,we.startColumn||ue.endColumn,we.endLineNumber||ue.endLineNumber,we.endColumn||ue.endColumn);setTimeout(function(){oe.executeEdits("",[{range:ke,text:""}])},300)}}function wt(oe){(window.navigator.platform.match("Mac")?oe.metaKey:oe.ctrlKey)&&oe.keyCode==83&&(oe.preventDefault(),$())}var Et=function(){if(ae&&$e.current.instance){var ue=$e.current.instance.getContentHeight();ne(ue0||Oe.target.offsetWidth>0)&&ae.layout()}}catch(_e){ye.e(_e)}finally{ye.f()}}),he.observe(y.current)),he}Object(U.useEffect)(function(){y.current&&j.e(27).then(j.t.bind(null,"M/lh",7)).then(function(ae){u=ae;var he=u.editor.createDiffEditor(y.current,Object(J.a)(Object(J.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},C),{},{wordWrap:!0}));Q(he);var Se=V(he);return function(){he.dispose();var ye=he.getModel();ye&&ye.dispose(),Se.unobserve(y.current)}})},[]),Object(U.useEffect)(function(){F&&F.setModel({original:u.editor.createModel(d,s),modified:u.editor.createModel(o,s)})},[d,o,s,F]);var W=O(D),$=O(f),re={width:W,height:$};return N.a.createElement("div",{className:"my-diff-editor",ref:y,style:re})}},ZpRC:function(Fe,Ce,j){"use strict";function J(c){return typeof c=="object"&&c!=null&&c.nodeType===1}function K(c,T){return(!T||c!=="hidden")&&c!=="visible"&&c!=="clip"}function R(c,T){if(c.clientHeightT||g>c&&i=T&&a>=P?g-c-O:i>T&&aP?i-T+p:0}var I=function(c,T){var P=window,O=T.scrollMode,p=T.block,g=T.inline,i=T.boundary,a=T.skipOverflowHiddenElements,u=typeof i=="function"?i:function(ut){return ut!==i};if(!J(c))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,w=[],b=c;J(b)&&u(b);){if((b=b.parentElement)===h){w.push(b);break}b!=null&&b===document.body&&R(b)&&!R(document.documentElement)||b!=null&&R(b,a)&&w.push(b)}for(var v=P.visualViewport?P.visualViewport.width:innerWidth,D=P.visualViewport?P.visualViewport.height:innerHeight,S=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,d=c.getBoundingClientRect(),o=d.height,s=d.width,_=d.top,C=d.right,y=d.bottom,M=d.left,B=p==="start"||p==="nearest"?_:p==="end"?y:_+o/2,F=g==="center"?M+s/2:g==="end"?C:M,Q=[],V=0;V=0&&M>=0&&y<=D&&C<=v&&_>=he&&y<=ye&&M>=be&&C<=Se)return Q;var Oe=getComputedStyle(W),_e=parseInt(Oe.borderLeftWidth,10),fe=parseInt(Oe.borderTopWidth,10),le=parseInt(Oe.borderRightWidth,10),Re=parseInt(Oe.borderBottomWidth,10),ot=0,st=0,nt="offsetWidth"in W?W.offsetWidth-W.clientWidth-_e-le:0,$e="offsetHeight"in W?W.offsetHeight-W.clientHeight-fe-Re:0;if(h===W)ot=p==="start"?B:p==="end"?B-D:p==="nearest"?H(f,f+D,D,fe,Re,f+B,f+B+o,o):B-D/2,st=g==="start"?F:g==="center"?F-v/2:g==="end"?F-v:H(S,S+v,v,_e,le,S+F,S+F+s,s),ot=Math.max(0,ot+f),st=Math.max(0,st+S);else{ot=p==="start"?B-he-fe:p==="end"?B-ye+Re+$e:p==="nearest"?H(he,ye,re,fe,Re+$e,B,B+o,o):B-(he+re/2)+$e/2,st=g==="start"?F-be-_e:g==="center"?F-(be+ae/2)+nt/2:g==="end"?F-Se+le+nt:H(be,Se,ae,_e,le+nt,F,F+s,s);var Ke=W.scrollLeft,Ye=W.scrollTop;B+=Ye-(ot=Math.max(0,Math.min(Ye+ot,W.scrollHeight-re+$e))),F+=Ke-(st=Math.max(0,Math.min(Ke+st,W.scrollWidth-ae+nt)))}Q.push({el:W,top:ot,left:st})}return Q};function x(c){return c===Object(c)&&Object.keys(c).length!==0}function U(c,T){T===void 0&&(T="auto");var P="scrollBehavior"in document.body.style;c.forEach(function(O){var p=O.el,g=O.top,i=O.left;p.scroll&&P?p.scroll({top:g,left:i,behavior:T}):(p.scrollTop=g,p.scrollLeft=i)})}function N(c){return c===!1?{block:"end",inline:"nearest"}:x(c)?c:{block:"start",inline:"nearest"}}function E(c,T){var P=!c.ownerDocument.documentElement.contains(c);if(x(T)&&typeof T.behavior=="function")return T.behavior(P?[]:I(c,T));if(P)return;var O=N(T);return U(I(c,O),O.behavior)}var L=Ce.a=E},a4uL:function(Fe,Ce,j){},aRTE:function(Fe,Ce){Fe.exports={L:1,M:0,Q:3,H:2}},bCnd:function(Fe,Ce,j){"use strict";j.d(Ce,"b",function(){return H}),j.d(Ce,"a",function(){return I});var J=j("je13"),K=j.n(J),R=!1;function H(x,U){var N=K.a.get("__ec");N||(N={}),N[x]=U,K.a.set("__ec",N)}function I(x,U){var N=K.a.get("__ec");return N?N[x]===void 0?U:N[x]:U}},bT9E:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return K});var J=j("VTBJ");function K(R,H){var I=Object(J.a)({},R);return Array.isArray(H)&&H.forEach(function(x){delete I[x]}),I}},biw7:function(Fe,Ce,j){"use strict";var J=j("q1tI"),K=j.n(J),R=J.createContext(null);Ce.a=R},c5Ni:function(Fe,Ce,j){},cDPC:function(Fe,Ce,j){"use strict";var J=j("tJVT"),K=j("q1tI"),R=j.n(K),H=j("i3hx"),I=j.n(H);Ce.a=function(x){var U=x.defaultX,N=U===void 0?"40%":U,E=x.leftChild,L=x.rightChild,c=x.className,T=x.hideResize,P=T===void 0?!1:T,O=Object(K.useState)(N),p=Object(J.a)(O,2),g=p[0],i=p[1],a=Object(K.useRef)();function u(){a.current=!0}Object(K.useEffect)(function(){function b(D){a.current&&i(D.pageX)}function v(){a.current=!1}return window.addEventListener("mousemove",b),window.addEventListener("mouseup",v),function(){window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",v)}},[]);var h=typeof g=="number"&&g!==.01?"".concat(g,"px"):N,w="calc(100% - ".concat(P?"0px":"4px"," - ").concat(h,")");return R.a.createElement("div",{className:"split-panel-container ".concat(c)},R.a.createElement("section",{style:{width:h,display:g===.01?"none":""}},E),R.a.createElement("section",{className:"resize-x-bar",onMouseDown:u},R.a.createElement("a",{className:"btn-resize"},R.a.createElement("svg",{width:"16",height:"13",viewBox:"0 0 16 13"},R.a.createElement("path",{d:"M12.245 7.53H5.647v1.882h6.598v2.823L16 8.471l-3.755-3.765V7.53zM10.353 4.706H3.755v2.823L0 3.765 3.755 0v2.824h6.598v1.882z"})))),R.a.createElement("section",{style:{width:w}},L))}},dQei:function(Fe,Ce){for(var j={glog:function(K){if(K<1)throw new Error("glog("+K+")");return j.LOG_TABLE[K]},gexp:function(K){for(;K<0;)K+=255;for(;K>=256;)K-=255;return j.EXP_TABLE[K]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},J=0;J<8;J++)j.EXP_TABLE[J]=1<1?ae-1:0),Se=1;Se1?V-1:0),$=1;$=0)return parseInt(Q.slice(Q.indexOf("e-")+2),10);var V=0;return Q.indexOf(".")>=0&&(V=Q.length-Q.indexOf(".")-1),V},y.getInputDisplayValue=function(F){var Q=F||y.state,V=Q.focused,W=Q.inputValue,$=Q.value,re;V?re=W:re=y.toPrecisionAsStep($),re==null&&(re="");var ae=y.formatWrapper(re);return v(y.props.decimalSeparator)&&(ae=ae.toString().replace(".",y.props.decimalSeparator)),ae},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(F){}},y.restoreByAfter=function(F){if(F===void 0)return!1;var Q=y.input.value,V=Q.lastIndexOf(F);if(V===-1)return!1;var W=y.cursorBefore.length;return y.lastKeyCode===T.a.DELETE&&y.cursorBefore.charAt(W-1)===F[0]?(y.fixCaret(W,W),!0):V+F.length===Q.length?(y.fixCaret(V,V),!0):!1},y.partRestoreByAfter=function(F){return F===void 0?!1:Array.prototype.some.call(F,function(Q,V){var W=F.substring(V);return y.restoreByAfter(W)})},y.isNotCompleteNumber=function(F){return isNaN(F)||F===""||F===null||F&&F.toString().indexOf(".")===F.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(F,Q,V){y.pressingUpOrDown=!0,y.step("down",F,Q,V)},y.up=function(F,Q,V){y.pressingUpOrDown=!0,y.step("up",F,Q,V)},y.saveInput=function(F){y.input=F};var M=C.value;M===void 0&&(M=C.defaultValue),y.state={focused:C.autoFocus};var B=y.getValidValue(y.toNumber(M));return y.state=O(O({},y.state),{},{inputValue:y.toPrecisionAsStep(B),value:B}),y}return Object(H.a)(_,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var M=this.props,B=M.value,F=M.onChange,Q=M.max,V=M.min,W=this.state.focused;if(y){if(!D(y.value,B)||!D(y.max,Q)||!D(y.min,V)){var $=W?B:this.getValidValue(B),re;this.pressingUpOrDown?re=$:this.inputting?re=this.rawInput:re=this.toPrecisionAsStep($),this.setState({value:$,inputValue:re})}var ae="value"in this.props?B:this.state.value;"max"in this.props&&y.max!==Q&&typeof ae=="number"&&ae>Q&&F&&F(Q),"min"in this.props&&y.min!==V&&typeof ae=="number"&&ae1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,F=parseFloat(y);return isNaN(F)?y:(FB&&(F=B),F)}},{key:"setValue",value:function(y,M){var B=this.props.precision,F=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),Q=this.state.value,V=Q===void 0?null:Q,W=this.state.inputValue,$=W===void 0?null:W,re=typeof F=="number"?F.toFixed(B):"".concat(F),ae=F!==V||re!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},M)):this.setState({value:F,inputValue:this.toPrecisionAsStep(y)},M),ae&&this.props.onChange(F),F}},{key:"getMaxPrecision",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,F=B.precision,Q=B.step;if(v(F))return F;var V=this.getPrecision(M),W=this.getPrecision(Q),$=this.getPrecision(y);return y?Math.max($,V+W):V+W}},{key:"getPrecisionFactor",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(y,M);return Math.pow(10,B)}},{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(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var M=Math.abs(this.getMaxPrecision(y));return isNaN(M)?y.toString():Number(y).toFixed(M)}},{key:"toNumber",value:function(y){var M=this.props.precision,B=this.state.focused,F=y&&y.length>16&&B;return this.isNotCompleteNumber(y)||F?y:v(M)?Math.round(y*Math.pow(10,M))/Math.pow(10,M):Number(y)}},{key:"upStep",value:function(y,M){var B=this.props.step,F=this.getPrecisionFactor(y,M),Q=Math.abs(this.getMaxPrecision(y,M)),V=((F*y+F*B*M)/F).toFixed(Q);return this.toNumber(V)}},{key:"downStep",value:function(y,M){var B=this.props.step,F=this.getPrecisionFactor(y,M),Q=Math.abs(this.getMaxPrecision(y,M)),V=((F*y-F*B*M)/F).toFixed(Q);return this.toNumber(V)}},{key:"step",value:function(y,M){var B=this,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Q=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var V=this.props;if(V.disabled)return;var W=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(W))return;var $=this["".concat(y,"Step")](W,F),re=$>V.max||$V.max?$=V.max:$=he),We=(wt||wt===0)&&(isNaN(wt)||Number(wt)<=Se),ge=De||F||Q,de=We||F||Q,ce=c()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object(K.a)({},"".concat(B,"-handler-up-disabled"),ge)),ne=c()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object(K.a)({},"".concat(B,"-handler-down-disabled"),de)),ie=V?{onTouchStart:ge?i:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?i:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},oe=V?{onTouchStart:de?i:this.down,onTouchEnd:this.stop}:{onMouseDown:de?i:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return E.a.createElement("div",{className:Te,style:ye,title:be,onMouseEnter:Oe,onMouseLeave:_e,onMouseOver:fe,onMouseOut:le,onFocus:function(){return null},onBlur:function(){return null}},E.a.createElement("div",{className:"".concat(B,"-handler-wrap")},E.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:ce}),$||E.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-up-inner"),onClick:a})),E.a.createElement("span",Object.assign({unselectable:"on"},oe,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:ne}),re||E.a.createElement("span",{unselectable:"on",className:"".concat(B,"-handler-down-inner"),onClick:a}))),E.a.createElement("div",{className:"".concat(B,"-input-wrap")},E.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Se,"aria-valuemax":he,"aria-valuenow":wt,required:Re,type:nt,placeholder:$e,onPaste:Rt,onClick:ot,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:st,autoComplete:W,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ze?this.onKeyDown:i,onKeyUp:ze?this.onKeyUp:i,autoFocus:Qe,maxLength:at,readOnly:Q,disabled:F,max:he,min:Se,step:pt,name:rt,title:be,id:Ke,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ve),pattern:ut,inputMode:Ye,onInput:Ct},xe))))}}]),_}(E.a.Component);S.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:b,min:-b,step:1,style:{},onChange:i,onKeyDown:i,onPressEnter:i,onFocus:i,onBlur:i,parser:u,required:!1,autoComplete:"off"};var f=S,d=Ce.a=f},f4xo:function(Fe,Ce,j){var J=j("nVVt");function K(R){this.mode=J.MODE_8BIT_BYTE,this.data=R}K.prototype={getLength:function(R){return this.data.length},write:function(R){for(var H=0;H=he&&$<0||V.scrollTop<=0&&$>0))||ae&&(!fe||fe&&(V.scrollLeft>=Se&&W<0||V.scrollLeft<=0&&W>0))?F(Q,V.parentNode,W,$):!1};function S(F){var Q=f();return function(){var W=Object(x.a)(F),$;if(Q){var re=Object(x.a)(this).constructor;$=Reflect.construct(W,arguments,re)}else $=W.apply(this,arguments);return Object(I.a)(this,$)}}function f(){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(F){return!1}}var d={},o=function(F){Object(H.a)(V,F);var Q=S(V);function V(W){var $;return Object(K.a)(this,V),$=Q.call(this,W),$.domFocus=function(){$.dom&&$.dom.focus()},$.removeStartHandler=function(re){if(re.touches.length>1)return;$.startPos={x:re.touches[0].clientX,y:re.touches[0].clientY}},$.removeMoveHandler=function(re){if(re.changedTouches.length>1)return;var ae=re.currentTarget,he=re.changedTouches[0].clientX-$.startPos.x,Se=re.changedTouches[0].clientY-$.startPos.y;(ae===$.maskDom||ae===$.handlerDom||ae===$.contentDom&&D(ae,re.target,he,Se))&&re.cancelable&&re.preventDefault()},$.transitionEnd=function(re){var ae=re.target;h(ae,a,$.transitionEnd),ae.style.transition=""},$.onKeyDown=function(re){if(re.keyCode===O.a.ESC){var ae=$.props.onClose;re.stopPropagation(),ae&&ae(re)}},$.onWrapperTransitionEnd=function(re){var ae=$.props,he=ae.open,Se=ae.afterVisibleChange;re.target===$.contentWrapper&&re.propertyName.match(/transform$/)&&($.dom.style.transition="",!he&&$.getCurrentDrawerSome()&&(document.body.style.overflowX="",$.maskDom&&($.maskDom.style.left="",$.maskDom.style.width="")),Se&&Se(!!he))},$.openLevelTransition=function(){var re=$.props,ae=re.open,he=re.width,Se=re.height,ye=$.getHorizontalBoolAndPlacementName(),be=ye.isHorizontal,Oe=ye.placementName,_e=$.contentDom?$.contentDom.getBoundingClientRect()[be?"width":"height"]:0,fe=(be?he:Se)||_e;$.setLevelAndScrolling(ae,Oe,fe)},$.setLevelTransform=function(re,ae,he,Se){var ye=$.props,be=ye.placement,Oe=ye.levelMove,_e=ye.duration,fe=ye.ease,le=ye.showMask;$.levelDom.forEach(function(Re){Re.style.transition="transform ".concat(_e," ").concat(fe),u(Re,a,$.transitionEnd);var ot=re?he:0;if(Oe){var st=w(Oe,{target:Re,open:re});ot=re?st[0]:st[1]||0}var nt=typeof ot=="number"?"".concat(ot,"px"):ot,$e=be==="left"||be==="top"?nt:"-".concat(nt);$e=le&&be==="right"&&Se?"calc(".concat($e," + ").concat(Se,"px)"):$e,Re.style.transform=ot?"".concat(ae,"(").concat($e,")"):""})},$.setLevelAndScrolling=function(re,ae,he){var Se=$.props.onChange;if(!v){var ye=document.body.scrollHeight>(window.innerHeight||document.documentElement.clientHeight)&&window.innerWidth>document.body.offsetWidth?Object(P.a)(!0):0;$.setLevelTransform(re,ae,he,ye),$.toggleScrollingToDrawerAndBody(ye)}Se&&Se(re)},$.toggleScrollingToDrawerAndBody=function(re){var ae=$.props,he=ae.getOpenCount,Se=ae.getContainer,ye=ae.showMask,be=ae.open,Oe=Se&&Se(),_e=he&&he();if(Oe&&Oe.parentNode===document.body&&ye){var fe=["touchstart"],le=[document.body,$.maskDom,$.handlerDom,$.contentDom];be&&document.body.style.overflow!=="hidden"?(re&&$.addScrollingEffect(re),_e===1&&(document.body.style.overflow="hidden"),document.body.style.touchAction="none",le.forEach(function(Re,ot){if(!Re)return;u(Re,fe[ot]||"touchmove",ot?$.removeMoveHandler:$.removeStartHandler,$.passive)})):$.getCurrentDrawerSome()&&(_e||(document.body.style.overflow=""),document.body.style.touchAction="",re&&$.remScrollingEffect(re),le.forEach(function(Re,ot){if(!Re)return;h(Re,fe[ot]||"touchmove",ot?$.removeMoveHandler:$.removeStartHandler,$.passive)}))}},$.addScrollingEffect=function(re){var ae=$.props,he=ae.placement,Se=ae.duration,ye=ae.ease,be=ae.getOpenCount,Oe=ae.switchScrollingEffect,_e=be&&be();_e===1&&Oe();var fe="width ".concat(Se," ").concat(ye),le="transform ".concat(Se," ").concat(ye);$.dom.style.transition="none";switch(he){case"right":$.dom.style.transform="translateX(-".concat(re,"px)");break;case"top":case"bottom":$.dom.style.width="calc(100% - ".concat(re,"px)"),$.dom.style.transform="translateZ(0)";break;default:break}clearTimeout($.timeout),$.timeout=setTimeout(function(){$.dom&&($.dom.style.transition="".concat(le,",").concat(fe),$.dom.style.width="",$.dom.style.transform="")})},$.remScrollingEffect=function(re){var ae=$.props,he=ae.placement,Se=ae.duration,ye=ae.ease,be=ae.getOpenCount,Oe=ae.switchScrollingEffect,_e=be&&be();_e||Oe(!0),i&&(document.body.style.overflowX="hidden"),$.dom.style.transition="none";var fe,le="width ".concat(Se," ").concat(ye),Re="transform ".concat(Se," ").concat(ye);switch(he){case"left":{$.dom.style.width="100%",le="width 0s ".concat(ye," ").concat(Se);break}case"right":{$.dom.style.transform="translateX(".concat(re,"px)"),$.dom.style.width="100%",le="width 0s ".concat(ye," ").concat(Se),$.maskDom&&($.maskDom.style.left="-".concat(re,"px"),$.maskDom.style.width="calc(100% + ".concat(re,"px)"));break}case"top":case"bottom":{$.dom.style.width="calc(100% + ".concat(re,"px)"),$.dom.style.height="100%",$.dom.style.transform="translateZ(0)",fe="height 0s ".concat(ye," ").concat(Se);break}default:break}clearTimeout($.timeout),$.timeout=setTimeout(function(){$.dom&&($.dom.style.transition="".concat(Re,",").concat(fe?"".concat(fe,","):"").concat(le),$.dom.style.transform="",$.dom.style.width="",$.dom.style.height="")})},$.getCurrentDrawerSome=function(){return!Object.keys(d).some(function(re){return d[re]})},$.getLevelDom=function(re){var ae=re.level,he=re.getContainer;if(v)return;var Se=he&&he(),ye=Se?Se.parentNode:null;if($.levelDom=[],ae==="all"){var be=ye?Array.prototype.slice.call(ye.children):[];be.forEach(function(Oe){Oe.nodeName!=="SCRIPT"&&Oe.nodeName!=="STYLE"&&Oe.nodeName!=="LINK"&&Oe!==Se&&$.levelDom.push(Oe)})}else ae&&p(ae).forEach(function(Oe){document.querySelectorAll(Oe).forEach(function(_e){$.levelDom.push(_e)})})},$.getHorizontalBoolAndPlacementName=function(){var re=$.props.placement,ae=re==="left"||re==="right",he="translate".concat(ae?"X":"Y");return{isHorizontal:ae,placementName:he}},$.state={_self:Object(L.a)($)},$}return Object(R.a)(V,[{key:"componentDidMount",value:function(){var $=this;if(!v){var re=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){return re=!0,null}}))}catch(be){}this.passive=re?{passive:!1}:!1}var ae=this.props,he=ae.open,Se=ae.getContainer,ye=Se&&Se();this.drawerId="drawer_id_".concat(Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)),this.getLevelDom(this.props),he&&(ye&&ye.parentNode===document.body&&(d[this.drawerId]=he),this.openLevelTransition(),this.forceUpdate(function(){$.domFocus()}))}},{key:"componentDidUpdate",value:function($){var re=this.props,ae=re.open,he=re.getContainer,Se=he&&he();ae!==$.open&&(ae&&this.domFocus(),Se&&Se.parentNode===document.body&&(d[this.drawerId]=!!ae),this.openLevelTransition())}},{key:"componentWillUnmount",value:function(){var $=this.props,re=$.getOpenCount,ae=$.open,he=$.switchScrollingEffect,Se=typeof re=="function"&&re();delete d[this.drawerId],ae&&(this.setLevelTransform(!1),document.body.style.touchAction=""),Se||(document.body.style.overflow="",he(!0))}},{key:"render",value:function(){var $,re=this,ae=this.props,he=ae.className,Se=ae.children,ye=ae.style,be=ae.width,Oe=ae.height,_e=ae.defaultOpen,fe=ae.open,le=ae.prefixCls,Re=ae.placement,ot=ae.level,st=ae.levelMove,nt=ae.ease,$e=ae.duration,Ke=ae.getContainer,Ye=ae.handler,ut=ae.onChange,pt=ae.afterVisibleChange,at=ae.showMask,Qe=ae.maskClosable,rt=ae.maskStyle,Rt=ae.onClose,Ct=ae.onHandleClick,xt=ae.keyboard,yt=ae.getOpenCount,wt=ae.switchScrollingEffect,Et=Object(J.a)(ae,["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"]),Te=this.dom?fe:!1,xe=T()(le,($={},Object(E.a)($,"".concat(le,"-").concat(Re),!0),Object(E.a)($,"".concat(le,"-open"),Te),Object(E.a)($,he||"",!!he),Object(E.a)($,"no-mask",!at),$)),ze=this.getHorizontalBoolAndPlacementName(),Ve=ze.placementName,De=Re==="left"||Re==="top"?"-100%":"100%",We=Te?"":"".concat(Ve,"(").concat(De,")"),ge=Ye&&N.cloneElement(Ye,{onClick:function(ce){Ye.props.onClick&&Ye.props.onClick(),Ct&&Ct(ce)},ref:function(ce){re.handlerDom=ce}});return N.createElement("div",Object.assign({},Et,{tabIndex:-1,className:xe,style:ye,ref:function(ce){re.dom=ce},onKeyDown:Te&&xt?this.onKeyDown:void 0,onTransitionEnd:this.onWrapperTransitionEnd}),at&&N.createElement("div",{className:"".concat(le,"-mask"),onClick:Qe?Rt:void 0,style:rt,ref:function(ce){re.maskDom=ce}}),N.createElement("div",{className:"".concat(le,"-content-wrapper"),style:{transform:We,msTransform:We,width:b(be)?"".concat(be,"px"):be,height:b(Oe)?"".concat(Oe,"px"):Oe},ref:function(ce){re.contentWrapper=ce}},N.createElement("div",{className:"".concat(le,"-content"),ref:function(ce){re.contentDom=ce},onTouchStart:Te&&at?this.removeStartHandler:void 0,onTouchMove:Te&&at?this.removeMoveHandler:void 0},Se),ge))}}],[{key:"getDerivedStateFromProps",value:function($,re){var ae=re.prevProps,he=re._self,Se={prevProps:$};if(ae!==void 0){var ye=$.placement,be=$.level;ye!==ae.placement&&(he.contentDom=null),be!==ae.level&&he.getLevelDom($)}return Se}}]),V}(N.Component);o.defaultProps={switchScrollingEffect:function(){}};var s=o;function _(F){var Q=C();return function(){var W=Object(x.a)(F),$;if(Q){var re=Object(x.a)(this).constructor;$=Reflect.construct(W,arguments,re)}else $=W.apply(this,arguments);return Object(I.a)(this,$)}}function C(){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(F){return!1}}var y=function(F){Object(H.a)(V,F);var Q=_(V);function V(W){var $;Object(K.a)(this,V),$=Q.call(this,W),$.onHandleClick=function(ae){var he=$.props,Se=he.onHandleClick,ye=he.open;if(Se&&Se(ae),typeof ye=="undefined"){var be=$.state.open;$.setState({open:!be})}},$.onClose=function(ae){var he=$.props,Se=he.onClose,ye=he.open;Se&&Se(ae),typeof ye=="undefined"&&$.setState({open:!1})};var re=typeof W.open!="undefined"?W.open:!!W.defaultOpen;return $.state={open:re},"onMaskClick"in W&&console.warn("`onMaskClick` are removed, please use `onClose` instead."),$}return Object(R.a)(V,[{key:"render",value:function(){var $=this,re=this.props,ae=re.defaultOpen,he=re.getContainer,Se=re.wrapperClassName,ye=re.forceRender,be=re.handler,Oe=Object(J.a)(re,["defaultOpen","getContainer","wrapperClassName","forceRender","handler"]),_e=this.state.open;if(!he)return N.createElement("div",{className:Se,ref:function(Re){$.dom=Re}},N.createElement(s,Object.assign({},Oe,{open:_e,handler:be,getContainer:function(){return $.dom},onClose:this.onClose,onHandleClick:this.onHandleClick})));var fe=!!be||ye;return N.createElement(U.a,{visible:_e,forceRender:fe,getContainer:he,wrapperClassName:Se},function(le){var Re=le.visible,ot=le.afterClose,st=Object(J.a)(le,["visible","afterClose"]);return N.createElement(s,Object.assign({},Oe,st,{open:Re!==void 0?Re:_e,afterVisibleChange:ot!==void 0?ot:Oe.afterVisibleChange,handler:be,onClose:$.onClose,onHandleClick:$.onHandleClick}))})}}],[{key:"getDerivedStateFromProps",value:function($,re){var ae=re.prevProps,he={prevProps:$};return typeof ae!="undefined"&&$.open!==ae.open&&(he.open=$.open),he}}]),V}(N.Component);y.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:N.createElement("div",{className:"drawer-handle"},N.createElement("i",{className:"drawer-handle-icon"})),showMask:!0,maskClosable:!0,maskStyle:{},wrapperClassName:"",className:"",keyboard:!0,forceRender:!1};var M=y,B=Ce.a=M},fcyK:function(Fe,Ce,j){},fyJ8:function(Fe,Ce,j){"use strict";var J=j("rePB"),K=j("VTBJ"),R=j("Ff2n"),H=j("U8pU"),I=j("q1tI"),x=j.n(I),U=j("TSYQ"),N=j.n(U),E=j("c+Xe"),L=j("sR1s");function c(g){return g&&Object(H.a)(g)==="object"&&!Array.isArray(g)&&!I.isValidElement(g)}function T(g){return typeof g=="string"?!0:Object(E.c)(g)}function P(g,i){var a,u=g.prefixCls,h=g.className,w=g.record,b=g.index,v=g.dataIndex,D=g.render,S=g.children,f=g.component,d=f===void 0?"td":f,o=g.colSpan,s=g.rowSpan,_=g.fixLeft,C=g.fixRight,y=g.firstFixLeft,M=g.lastFixLeft,B=g.firstFixRight,F=g.lastFixRight,Q=g.appendNode,V=g.additionalProps,W=V===void 0?{}:V,$=g.ellipsis,re=g.align,ae=g.rowType,he=g.isSticky,Se="".concat(u,"-cell"),ye,be;if(S)be=S;else{var Oe=Object(L.b)(w,v);if(be=Oe,D){var _e=D(Oe,w,b);c(_e)?(be=_e.children,ye=_e.props):be=_e}}Object(H.a)(be)==="object"&&!Array.isArray(be)&&!I.isValidElement(be)&&(be=null),$&&(M||B)&&(be=I.createElement("span",{className:"".concat(Se,"-content")},be));var fe=ye||{},le=fe.colSpan,Re=fe.rowSpan,ot=fe.style,st=fe.className,nt=Object(R.a)(fe,["colSpan","rowSpan","style","className"]),$e=le!==void 0?le:o,Ke=Re!==void 0?Re:s;if($e===0||Ke===0)return null;var Ye={},ut=typeof _=="number",pt=typeof C=="number";ut&&(Ye.position="sticky",Ye.left=_),pt&&(Ye.position="sticky",Ye.right=C);var at={};re&&(at.textAlign=re);var Qe,rt=$===!0?{showTitle:!0}:$;rt&&(rt.showTitle||ae==="header")&&(typeof be=="string"||typeof be=="number"?Qe=be.toString():I.isValidElement(be)&&typeof be.props.children=="string"&&(Qe=be.props.children));var Rt=Object(K.a)(Object(K.a)(Object(K.a)({title:Qe},nt),W),{},{colSpan:$e&&$e!==1?$e:null,rowSpan:Ke&&Ke!==1?Ke:null,className:N()(Se,h,(a={},Object(J.a)(a,"".concat(Se,"-fix-left"),ut),Object(J.a)(a,"".concat(Se,"-fix-left-first"),y),Object(J.a)(a,"".concat(Se,"-fix-left-last"),M),Object(J.a)(a,"".concat(Se,"-fix-right"),pt),Object(J.a)(a,"".concat(Se,"-fix-right-first"),B),Object(J.a)(a,"".concat(Se,"-fix-right-last"),F),Object(J.a)(a,"".concat(Se,"-ellipsis"),$),Object(J.a)(a,"".concat(Se,"-with-append"),Q),Object(J.a)(a,"".concat(Se,"-fix-sticky"),(ut||pt)&&he),a),W.className,st),style:Object(K.a)(Object(K.a)(Object(K.a)(Object(K.a)({},W.style),at),Ye),ot),ref:T(d)?i:null});return I.createElement(d,Object.assign({},Rt),Q,be)}var O=I.forwardRef(P);O.displayName="Cell";var p=I.memo(O,function(g,i){return i.shouldCellUpdate?!i.shouldCellUpdate(i.record,g.record):!1});Ce.a=p},gRFJ:function(Fe,Ce,j){Fe.exports=[j("rdUC"),j("ynwM"),j("RELg"),j("DlR+"),j("CrYA"),j("PD8m")]},gaXo:function(module,exports){typeof JSON!="object"&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;function f(Fe){return Fe<10?"0"+Fe:Fe}function this_value(){return this.valueOf()}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;function quote(Fe){return rx_escapable.lastIndex=0,rx_escapable.test(Fe)?'"'+Fe.replace(rx_escapable,function(Ce){var j=meta[Ce];return typeof j=="string"?j:"\\u"+("0000"+Ce.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+Fe+'"'}function str(Fe,Ce){var j,J,K,R,H=gap,I,x=Ce[Fe];x&&typeof x=="object"&&typeof x.toJSON=="function"&&(x=x.toJSON(Fe)),typeof rep=="function"&&(x=rep.call(Ce,Fe,x));switch(typeof x){case"string":return quote(x);case"number":return isFinite(x)?String(x):"null";case"boolean":case"null":return String(x);case"object":if(!x)return"null";if(gap+=indent,I=[],Object.prototype.toString.apply(x)==="[object Array]"){for(R=x.length,j=0;j` "'(~:]+/,p=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,g=/^\s*\[[^\]]+?\]:.*$/,i=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,a=" ";function u(V,W,$){return W.f=W.inline=$,$(V,W)}function h(V,W,$){return W.f=W.block=$,$(V,W)}function w(V){return!V||!/\S/.test(V.string)}function b(V){if(V.linkTitle=!1,V.linkHref=!1,V.linkText=!1,V.em=!1,V.strong=!1,V.strikethrough=!1,V.quote=0,V.indentedCode=!1,V.f==D){var W=I;if(!W){var $=J.innerMode(H,V.htmlState);W=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}W&&(V.f=o,V.block=v,V.htmlState=null)}return V.trailingSpace=0,V.trailingSpaceNewLine=!1,V.prevLine=V.thisLine,V.thisLine={stream:null},null}function v(V,W){var $=V.column()===W.indentation,re=w(W.prevLine.stream),ae=W.indentedCode,he=W.prevLine.hr,Se=W.list!==!1,ye=(W.listStack[W.listStack.length-1]||0)+3;W.indentedCode=!1;var be=W.indentation;if(W.indentationDiff===null&&(W.indentationDiff=W.indentation,Se)){for(W.list=null;be=4&&(ae||W.prevLine.fencedCodeEnd||W.prevLine.header||re))return V.skipToEnd(),W.indentedCode=!0,U.code;if(V.eatSpace())return null;if($&&W.indentation<=ye&&(fe=V.match(T))&&fe[1].length<=6)return W.quote=0,W.header=fe[1].length,W.thisLine.header=!0,R.highlightFormatting&&(W.formatting="header"),W.f=W.inline,f(W);if(W.indentation<=ye&&V.eat(">"))return W.quote=$?1:W.quote+1,R.highlightFormatting&&(W.formatting="quote"),V.eatSpace(),f(W);if(!_e&&!W.setext&&$&&W.indentation<=ye&&(fe=V.match(L))){var le=fe[1]?"ol":"ul";return W.indentation=be+V.current().length,W.list=!0,W.quote=0,W.listStack.push(W.indentation),W.em=!1,W.strong=!1,W.code=!1,W.strikethrough=!1,R.taskLists&&V.match(c,!1)&&(W.taskList=!0),W.f=W.inline,R.highlightFormatting&&(W.formatting=["list","list-"+le]),f(W)}else{if($&&W.indentation<=ye&&(fe=V.match(p,!0)))return W.quote=0,W.fencedEndRE=new RegExp(fe[1]+"+ *$"),W.localMode=R.fencedCodeBlockHighlighting&&x(fe[2]||R.fencedCodeBlockDefaultMode),W.localMode&&(W.localState=J.startState(W.localMode)),W.f=W.block=S,R.highlightFormatting&&(W.formatting="code-block"),W.code=-1,f(W);if(W.setext||(!Oe||!Se)&&!W.quote&&W.list===!1&&!W.code&&!_e&&!g.test(V.string)&&(fe=V.lookAhead(1))&&(fe=fe.match(P)))return W.setext?(W.header=W.setext,W.setext=0,V.skipToEnd(),R.highlightFormatting&&(W.formatting="header")):(W.header=fe[0].charAt(0)=="="?1:2,W.setext=W.header),W.thisLine.header=!0,W.f=W.inline,f(W);if(_e)return V.skipToEnd(),W.hr=!0,W.thisLine.hr=!0,U.hr;if(V.peek()==="[")return u(V,W,M)}return u(V,W,W.inline)}function D(V,W){var $=H.token(V,W.htmlState);if(!I){var re=J.innerMode(H,W.htmlState);(re.mode.name=="xml"&&re.state.tagStart===null&&!re.state.context&&re.state.tokenize.isInText||W.md_inside&&V.current().indexOf(">")>-1)&&(W.f=o,W.block=v,W.htmlState=null)}return $}function S(V,W){var $=W.listStack[W.listStack.length-1]||0,re=W.indentation<$,ae=$+3;if(W.fencedEndRE&&W.indentation<=ae&&(re||V.match(W.fencedEndRE))){R.highlightFormatting&&(W.formatting="code-block");var he;return re||(he=f(W)),W.localMode=W.localState=null,W.block=v,W.f=o,W.fencedEndRE=null,W.code=0,W.thisLine.fencedCodeEnd=!0,re?h(V,W,W.block):he}else return W.localMode?W.localMode.token(V,W.localState):(V.skipToEnd(),U.code)}function f(V){var W=[];if(V.formatting){W.push(U.formatting),typeof V.formatting=="string"&&(V.formatting=[V.formatting]);for(var $=0;$=V.quote?W.push(U.formatting+"-"+V.formatting[$]+"-"+V.quote):W.push("error"))}if(V.taskOpen)return W.push("meta"),W.length?W.join(" "):null;if(V.taskClosed)return W.push("property"),W.length?W.join(" "):null;if(V.linkHref?W.push(U.linkHref,"url"):(V.strong&&W.push(U.strong),V.em&&W.push(U.em),V.strikethrough&&W.push(U.strikethrough),V.emoji&&W.push(U.emoji),V.linkText&&W.push(U.linkText),V.code&&W.push(U.code),V.image&&W.push(U.image),V.imageAltText&&W.push(U.imageAltText,"link"),V.imageMarker&&W.push(U.imageMarker)),V.header&&W.push(U.header,U.header+"-"+V.header),V.quote&&(W.push(U.quote),!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=V.quote?W.push(U.quote+"-"+V.quote):W.push(U.quote+"-"+R.maxBlockquoteDepth)),V.list!==!1){var re=(V.listStack.length-1)%3;re?re===1?W.push(U.list2):W.push(U.list3):W.push(U.list1)}return V.trailingSpaceNewLine?W.push("trailing-space-new-line"):V.trailingSpace&&W.push("trailing-space-"+(V.trailingSpace%2?"a":"b")),W.length?W.join(" "):null}function d(V,W){return V.match(O,!0)?f(W):void 0}function o(V,W){var $=W.text(V,W);if(typeof $!="undefined")return $;if(W.list)return W.list=null,f(W);if(W.taskList){var re=V.match(c,!0)[1]===" ";return re?W.taskOpen=!0:W.taskClosed=!0,R.highlightFormatting&&(W.formatting="task"),W.taskList=!1,f(W)}if(W.taskOpen=!1,W.taskClosed=!1,W.header&&V.match(/^#+$/,!0))return R.highlightFormatting&&(W.formatting="header"),f(W);var ae=V.next();if(W.linkTitle){W.linkTitle=!1;var he=ae;ae==="("&&(he=")"),he=(he+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Se="^\\s*(?:[^"+he+"\\\\]+|\\\\\\\\|\\\\.)"+he;if(V.match(new RegExp(Se),!0))return U.linkHref}if(ae==="`"){var ye=W.formatting;R.highlightFormatting&&(W.formatting="code"),V.eatWhile("`");var be=V.current().length;if(W.code==0&&(!W.quote||be==1))return W.code=be,f(W);if(be==W.code){var Oe=f(W);return W.code=0,Oe}else return W.formatting=ye,f(W)}else if(W.code)return f(W);if(ae==="\\"&&(V.next(),R.highlightFormatting)){var _e=f(W),fe=U.formatting+"-escape";return _e?_e+" "+fe:fe}if(ae==="!"&&V.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return W.imageMarker=!0,W.image=!0,R.highlightFormatting&&(W.formatting="image"),f(W);if(ae==="["&&W.imageMarker&&V.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return W.imageMarker=!1,W.imageAltText=!0,R.highlightFormatting&&(W.formatting="image"),f(W);if(ae==="]"&&W.imageAltText){R.highlightFormatting&&(W.formatting="image");var _e=f(W);return W.imageAltText=!1,W.image=!1,W.inline=W.f=_,_e}if(ae==="["&&!W.image)return W.linkText&&V.match(/^.*?\]/)||(W.linkText=!0,R.highlightFormatting&&(W.formatting="link")),f(W);if(ae==="]"&&W.linkText){R.highlightFormatting&&(W.formatting="link");var _e=f(W);return W.linkText=!1,W.inline=W.f=V.match(/\(.*?\)| ?\[.*?\]/,!1)?_:o,_e}if(ae==="<"&&V.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=s,R.highlightFormatting&&(W.formatting="link");var _e=f(W);return _e?_e+=" ":_e="",_e+U.linkInline}if(ae==="<"&&V.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){W.f=W.inline=s,R.highlightFormatting&&(W.formatting="link");var _e=f(W);return _e?_e+=" ":_e="",_e+U.linkEmail}if(R.xml&&ae==="<"&&V.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var le=V.string.indexOf(">",V.pos);if(le!=-1){var Re=V.string.substring(V.start,le);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Re)&&(W.md_inside=!0)}return V.backUp(1),W.htmlState=J.startState(H),h(V,W,D)}if(R.xml&&ae==="<"&&V.match(/^\/\w*?>/))return W.md_inside=!1,"tag";if(ae==="*"||ae==="_"){for(var ot=1,st=V.pos==1?" ":V.string.charAt(V.pos-2);ot<3&&V.eat(ae);)ot++;var nt=V.peek()||" ",$e=!/\s/.test(nt)&&(!i.test(nt)||/\s/.test(st)||i.test(st)),Ke=!/\s/.test(st)&&(!i.test(st)||/\s/.test(nt)||i.test(nt)),Ye=null,ut=null;if(ot%2&&(!W.em&&$e&&(ae==="*"||!Ke||i.test(st))?Ye=!0:W.em==ae&&Ke&&(ae==="*"||!$e||i.test(nt))&&(Ye=!1)),ot>1&&(!W.strong&&$e&&(ae==="*"||!Ke||i.test(st))?ut=!0:W.strong==ae&&Ke&&(ae==="*"||!$e||i.test(nt))&&(ut=!1)),ut!=null||Ye!=null){R.highlightFormatting&&(W.formatting=Ye==null?"strong":ut==null?"em":"strong em"),Ye===!0&&(W.em=ae),ut===!0&&(W.strong=ae);var Oe=f(W);return Ye===!1&&(W.em=!1),ut===!1&&(W.strong=!1),Oe}}else if(ae===" "&&(V.eat("*")||V.eat("_"))){if(V.peek()===" ")return f(W);V.backUp(1)}if(R.strikethrough){if(ae==="~"&&V.eatWhile(ae)){if(W.strikethrough){R.highlightFormatting&&(W.formatting="strikethrough");var Oe=f(W);return W.strikethrough=!1,Oe}else if(V.match(/^[^\s]/,!1))return W.strikethrough=!0,R.highlightFormatting&&(W.formatting="strikethrough"),f(W)}else if(ae===" "&&V.match(/^~~/,!0)){if(V.peek()===" ")return f(W);V.backUp(2)}}if(R.emoji&&ae===":"&&V.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){W.emoji=!0,R.highlightFormatting&&(W.formatting="emoji");var pt=f(W);return W.emoji=!1,pt}return ae===" "&&(V.match(/^ +$/,!1)?W.trailingSpace++:W.trailingSpace&&(W.trailingSpaceNewLine=!0)),f(W)}function s(V,W){var $=V.next();if($===">"){W.f=W.inline=o,R.highlightFormatting&&(W.formatting="link");var re=f(W);return re?re+=" ":re="",re+U.linkInline}return V.match(/^[^>]+/,!0),U.linkInline}function _(V,W){if(V.eatSpace())return null;var $=V.next();return $==="("||$==="["?(W.f=W.inline=y($==="("?")":"]"),R.highlightFormatting&&(W.formatting="link-string"),W.linkHref=!0,f(W)):"error"}var C={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(V){return function(W,$){var re=W.next();if(re===V){$.f=$.inline=o,R.highlightFormatting&&($.formatting="link-string");var ae=f($);return $.linkHref=!1,ae}return W.match(C[V]),$.linkHref=!0,f($)}}function M(V,W){return V.match(/^([^\]\\]|\\.)*\]:/,!1)?(W.f=B,V.next(),R.highlightFormatting&&(W.formatting="link"),W.linkText=!0,f(W)):u(V,W,o)}function B(V,W){if(V.match(/^\]:/,!0)){W.f=W.inline=F,R.highlightFormatting&&(W.formatting="link");var $=f(W);return W.linkText=!1,$}return V.match(/^([^\]\\]|\\.)+/,!0),U.linkText}function F(V,W){return V.eatSpace()?null:(V.match(/^[^\s]+/,!0),V.peek()===void 0?W.linkTitle=!0:V.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),W.f=W.inline=o,U.linkHref+" url")}var Q={startState:function(){return{f:v,prevLine:{stream:null},thisLine:{stream:null},block:v,htmlState:null,indentation:0,inline:o,text:d,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(V){return{f:V.f,prevLine:V.prevLine,thisLine:V.thisLine,block:V.block,htmlState:V.htmlState&&J.copyState(H,V.htmlState),indentation:V.indentation,localMode:V.localMode,localState:V.localMode?J.copyState(V.localMode,V.localState):null,inline:V.inline,text:V.text,formatting:!1,linkText:V.linkText,linkTitle:V.linkTitle,linkHref:V.linkHref,code:V.code,em:V.em,strong:V.strong,strikethrough:V.strikethrough,emoji:V.emoji,header:V.header,setext:V.setext,hr:V.hr,taskList:V.taskList,list:V.list,listStack:V.listStack.slice(0),quote:V.quote,indentedCode:V.indentedCode,trailingSpace:V.trailingSpace,trailingSpaceNewLine:V.trailingSpaceNewLine,md_inside:V.md_inside,fencedEndRE:V.fencedEndRE}},token:function(V,W){if(W.formatting=!1,V!=W.thisLine.stream){if(W.header=0,W.hr=!1,V.match(/^\s*$/,!0))return b(W),null;if(W.prevLine=W.thisLine,W.thisLine={stream:V},W.taskList=!1,W.trailingSpace=0,W.trailingSpaceNewLine=!1,!W.localState&&(W.f=W.block,W.f!=D)){var $=V.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(W.indentation=$,W.indentationDiff=null,$>0)return null}}return W.f(V,W)},innerMode:function(V){return V.block==D?{state:V.htmlState,mode:H}:V.localState?{state:V.localState,mode:V.localMode}:{state:V,mode:Q}},indent:function(V,W,$){return V.block==D&&H.indent?H.indent(V.htmlState,W,$):V.localState&&V.localMode.indent?V.localMode.indent(V.localState,W,$):J.Pass},blankLine:b,getType:f,blockCommentStart:"",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Q},"xml"),J.defineMIME("text/markdown","markdown"),J.defineMIME("text/x-markdown","markdown")})},n6Qo:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return N});var J=j("q1tI"),K=j("biw7"),R=j("fyJ8");function H(E){var L=E.className,c=E.index,T=E.children,P=E.colSpan,O=E.rowSpan,p=J.useContext(K.a),g=p.prefixCls,i=p.fixedInfoList,a=i[c];return J.createElement(R.a,Object.assign({className:L,index:c,component:"td",prefixCls:g,record:null,dataIndex:null,render:function(){return{children:T,props:{colSpan:P,rowSpan:O}}}},a))}function I(E){return J.createElement("tr",Object.assign({},E))}function x(E){var L=E.children,c=J.useContext(K.a),T=c.prefixCls;return J.createElement("tfoot",{className:"".concat(T,"-summary")},L)}var U=Ce.b=x,N={Cell:H,Row:I}},nVVt:function(Fe,Ce){Fe.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},nWbc:function(Fe,Ce,j){},osHv:function(Fe,Ce,j){(function(J){J(j("VrN/"))})(function(J){"use strict";var K=J.Pos;function R(i,a){return i.line-a.line||i.ch-a.ch}var H="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",I=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",x=new RegExp("<(/?)(["+H+"]["+I+"]*)","g");function U(i,a,u,h){this.line=a,this.ch=u,this.cm=i,this.text=i.getLine(a),this.min=h?Math.max(h.from,i.firstLine()):i.firstLine(),this.max=h?Math.min(h.to-1,i.lastLine()):i.lastLine()}function N(i,a){var u=i.cm.getTokenTypeAt(K(i.line,a));return u&&/\btag\b/.test(u)}function E(i){return i.line>=i.max?void 0:(i.ch=0,i.text=i.cm.getLine(++i.line),!0)}function L(i){return i.line<=i.min?void 0:(i.text=i.cm.getLine(--i.line),i.ch=i.text.length,!0)}function c(i){for(;;){var a=i.text.indexOf(">",i.ch);if(a==-1){if(E(i))continue;return}if(!N(i,a+1)){i.ch=a+1;continue}var u=i.text.lastIndexOf("/",a),h=u>-1&&!/\S/.test(i.text.slice(u+1,a));return i.ch=a+1,h?"selfClose":"regular"}}function T(i){for(;;){var a=i.ch?i.text.lastIndexOf("<",i.ch-1):-1;if(a==-1){if(L(i))continue;return}if(!N(i,a+1)){i.ch=a;continue}x.lastIndex=a,i.ch=a;var u=x.exec(i.text);if(u&&u.index==a)return u}}function P(i){for(;;){x.lastIndex=i.ch;var a=x.exec(i.text);if(!a){if(E(i))continue;return}if(!N(i,a.index+1)){i.ch=a.index+1;continue}return i.ch=a.index+a[0].length,a}}function O(i){for(;;){var a=i.ch?i.text.lastIndexOf(">",i.ch-1):-1;if(a==-1){if(L(i))continue;return}if(!N(i,a+1)){i.ch=a;continue}var u=i.text.lastIndexOf("/",a),h=u>-1&&!/\S/.test(i.text.slice(u+1,a));return i.ch=a+1,h?"selfClose":"regular"}}function p(i,a){for(var u=[];;){var h=P(i),w,b=i.line,v=i.ch-(h?h[0].length:0);if(!h||!(w=c(i)))return;if(w=="selfClose")continue;if(h[1]){for(var D=u.length-1;D>=0;--D)if(u[D]==h[2]){u.length=D;break}if(D<0&&(!a||a==h[2]))return{tag:h[2],from:K(b,v),to:K(i.line,i.ch)}}else u.push(h[2])}}function g(i,a){for(var u=[];;){var h=O(i);if(!h)return;if(h=="selfClose"){T(i);continue}var w=i.line,b=i.ch,v=T(i);if(!v)return;if(v[1])u.push(v[2]);else{for(var D=u.length-1;D>=0;--D)if(u[D]==v[2]){u.length=D;break}if(D<0&&(!a||a==v[2]))return{tag:v[2],from:K(i.line,i.ch),to:K(w,b)}}}}J.registerHelper("fold","xml",function(i,a){for(var u=new U(i,a.line,0);;){var h=P(u);if(!h||u.line!=a.line)return;var w=c(u);if(!w)return;if(!h[1]&&w!="selfClose"){var b=K(u.line,u.ch),v=p(u,h[2]);return v&&R(v.from,b)>0?{from:b,to:v.from}:null}}}),J.findMatchingTag=function(i,a,u){var h=new U(i,a.line,a.ch,u);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var w=c(h),b=w&&K(h.line,h.ch),v=w&&T(h);if(!w||!v||R(h,a)>0)return;var D={from:K(h.line,h.ch),to:b,tag:v[2]};return w=="selfClose"?{open:D,close:null,at:"open"}:v[1]?{open:g(h,v[2]),close:D,at:"close"}:(h=new U(i,b.line,b.ch,u),{open:D,close:p(h,v[2]),at:"open"})},J.findEnclosingTag=function(i,a,u,h){for(var w=new U(i,a.line,a.ch,u);;){var b=g(w,h);if(!b)break;var v=new U(i,a.line,a.ch,u),D=p(v,b.tag);if(D)return{open:b,close:D}}},J.scanForClosingTag=function(i,a,u,h){var w=new U(i,a.line,a.ch,h?{from:0,to:h}:null);return p(w,u)}})},"p/48":function(Fe,Ce,j){},p5ED:function(Fe,Ce,j){"use strict";var J=j("+L6B"),K=j("2/Rp"),R=j("5Dmo"),H=j("3S7+"),I=j("k1fw"),x=j("9og8"),U=j("tJVT"),N=j("WmNS"),E=j.n(N),L=j("q1tI"),c=j.n(L),T=j("vHTk"),P=j.n(T),O=j("yEEn"),p=j("ZW9T"),g=j("1vsH"),i=j("V0Rq"),a=j("m3rI"),u=function(w){var b=w.name,v=w.data,D=w.theme,S=w.type,f=w.filename,d=w.monacoEditor,o=w.className,s=w.style,_=w.close,C=w.onClose,y=w.hasMask,M=w.otherData,B=M===void 0?{}:M,F=Object(L.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),Q=Object(U.a)(F,2),V=Q[0],W=Q[1],$=Object(L.useState)(""),re=Object(U.a)($,2),ae=re[0],he=re[1],Se=Object(L.useState)(),ye=Object(U.a)(Se,2),be=ye[0],Oe=ye[1],_e,fe=1024*1024,le=10*fe,Re=Object(L.useRef)();S==="office"&&(S="other",_e=Object(g.R)(v).filesize,_e>le&&(S="other")),f&&(d.filename=f),Object(L.useEffect)(function(){var $e,Ke,Ye=($e=document.cookie)===null||$e===void 0||((Ke=$e.replace(/\s/g,""))===null||Ke===void 0)?void 0:Ke.split(";");Ye==null||Ye.map(function(ut){var pt=ut.split("=");pt[0]==="_educoder_session"&&he(pt[1])})},[]),Object(L.useEffect)(function(){S==="office"&&ot()},[S]);var ot=function(){var $e=Object(x.a)(E.a.mark(function Ke(){var Ye,ut,pt;return E.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:return console.log("data:",v),Ye=v,v.startsWith("http")||(Ye=location.origin+Ye),ut=new URL(Ye).pathname.split("/").pop(),Qe.next=6,Object(i.U)({attachment_id:ut});case 6:pt=Qe.sent,Oe(pt);case 8:case"end":return Qe.stop()}},Ke)}));return function(){return $e.apply(this,arguments)}}(),st=function(){if(v.startsWith("http")||v.startsWith("blob:")){nt();return}Object(g.x)(f||"educoder",v,f)},nt=function(){Object(g.v)(f||"educoder",decodeURIComponent(v))};return c.a.createElement("div",{style:Object(I.a)({},s||{}),className:"".concat(y&&P.a.bgBlack," ").concat(S?P.a.wrp:"hide")},_&&c.a.createElement("div",{className:P.a.close,ref:Re},c.a.createElement(H.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return Re.current}},c.a.createElement("span",{onClick:nt},c.a.createElement("i",{className:"icon-quxiaozhiding"}))),c.a.createElement(H.a,{title:"\u5173\u95ED",getPopupContainer:function(){return Re.current}},c.a.createElement("span",{className:"",onClick:function(){C(),Oe(null)}},c.a.createElement("i",{className:"icon-guanbi1"})))),c.a.createElement("div",{className:"".concat(P.a[o]," ").concat(o," ").concat(P.a.monaco," ").concat(S==="txt"?"show":"hide")},S==="txt"&&c.a.createElement(p.b,d)),S==="audio"&&c.a.createElement("audio",{src:"".concat((v==null?void 0:v.indexOf("http://"))>-1||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(v),autoPlay:!0}),S==="video"&&c.a.createElement(c.a.Fragment,null,(v==null?void 0:v.indexOf("http"))>-1?c.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):c.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),S==="office"&&be&&c.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(be.key,"&url=").concat(a.a.API_SERVER+be.url,"&callbackUrl=").concat(a.a.API_SERVER+be.callbackUrl,"&fileType=").concat(be.fileType,"&title=").concat(be.title,"&model=view")}),(S==="xlsx"||S==="doc"||S==="pptx"||S==="docx")&&c.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(B.key,"&url=").concat(a.a.API_SERVER+B.url,"&callbackUrl=").concat(a.a.API_SERVER+B.callbackUrl,"&fileType=").concat(B.fileType,"&title=").concat(B.title,"&model=").concat(B.model)}),S==="html"&&c.a.createElement("iframe",{src:v+"&disposition=inline"}),S==="pdf"&&c.a.createElement("embed",{className:P.a.embed,src:v,type:"application/pdf"}),S==="image"&&c.a.createElement("img",{src:"".concat((v==null?void 0:v.indexOf("http://"))>-1||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)}),S==="other"&&c.a.createElement("div",null,c.a.createElement(K.a,{type:"primary",size:"large",onClick:st},c.a.createElement(O.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),S==="download"&&c.a.createElement(K.a,{type:"primary",size:"large",onClick:st},c.a.createElement(O.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};Ce.a=u},"p77/":function(Fe,Ce,j){},pPuO:function(Fe,Ce,j){Fe.exports={desc:"desc___2o_2w",info:"info___Uro3x","commit-info":"commit-info___o2-Ex"}},"qJ4+":function(Fe,Ce,j){},"rAM+":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return K});var J=j("Qw5x");function K(R,H){var I;if(typeof Symbol=="undefined"||R[Symbol.iterator]==null){if(Array.isArray(R)||(I=Object(J.a)(R))||H&&R&&typeof R.length=="number"){I&&(R=I);var x=0,U=function(){};return{s:U,n:function(){return x>=R.length?{done:!0}:{done:!1,value:R[x++]}},e:function(T){throw T},f:U}}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 N=!0,E=!1,L;return{s:function(){I=R[Symbol.iterator]()},n:function(){var T=I.next();return N=T.done,T},e:function(T){E=!0,L=T},f:function(){try{!N&&I.return!=null&&I.return()}finally{if(E)throw L}}}}},rUJ1:function(Fe,Ce){const j=/[&<>"']/,J=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,H={"&":"&","<":"<",">":">",'"':""","'":"'"},I=S=>H[S];function x(S,f){if(f){if(j.test(S))return S.replace(J,I)}else if(K.test(S))return S.replace(R,I);return S}const U=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(S){return S.replace(U,(f,d)=>(d=d.toLowerCase(),d==="colon"?":":d.charAt(0)==="#"?d.charAt(1)==="x"?String.fromCharCode(parseInt(d.substring(2),16)):String.fromCharCode(+d.substring(1)):""))}const E=/(^|[^\[])\^/g;function L(S,f){S=S.source||S,f=f||"";const d={replace:(o,s)=>(s=s.source||s,s=s.replace(E,"$1"),S=S.replace(o,s),d),getRegex:()=>new RegExp(S,f)};return d}const c=/[^\w:]/g,T=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(S,f,d){if(S){let o;try{o=decodeURIComponent(N(d)).replace(c,"").toLowerCase()}catch(s){return null}if(o.indexOf("javascript:")===0||o.indexOf("vbscript:")===0||o.indexOf("data:")===0)return null}f&&!T.test(d)&&(d=a(f,d));try{d=encodeURI(d).replace(/%25/g,"%")}catch(o){return null}return d}const O={},p=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,i=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(S,f){O[" "+S]||(p.test(S)?O[" "+S]=S+"/":O[" "+S]=b(S,"/",!0)),S=O[" "+S];const d=S.indexOf(":")===-1;return f.substring(0,2)==="//"?d?f:S.replace(g,"$1")+f:f.charAt(0)==="/"?d?f:S.replace(i,"$1")+f:S+f}const u={exec:function(){}};function h(S){let f=1,d,o;for(;f{let M=!1,B=C;for(;--B>=0&&y[B]==="\\";)M=!M;return M?"|":" |"}),o=d.split(/ \|/);let s=0;if(o.length>f)o.splice(f);else for(;o.length=0;L--){var c=R().key(L);E(H(c),c)}}function U(E){return R().removeItem(E)}function N(){return R().clear()}},sR1s:function(Fe,Ce,j){"use strict";j.d(Ce,"b",function(){return H}),j.d(Ce,"a",function(){return I}),j.d(Ce,"c",function(){return x}),j.d(Ce,"d",function(){return U});var J=j("U8pU"),K="RC_TABLE_KEY";function R(N){return N==null?[]:Array.isArray(N)?N:[N]}function H(N,E){if(!E&&typeof E!="number")return N;for(var L=R(E),c=N,T=0;T1)Object(L.a)(!1,"Find more than one child node with `children` in ResizeObserver. Will only observe first one.");else if(h.length===0)return Object(L.a)(!1,"`children` of ResizeObserver is empty. Nothing is in observe."),null;var w=h[0];if(x.isValidElement(w)&&Object(c.c)(w)){var b=w.ref;h[0]=x.cloneElement(w,{ref:Object(c.a)(b,this.setChildNode)})}return h.length===1?h[0]:h.map(function(v,D){return!x.isValidElement(v)||"key"in v&&v.key!==null?v:x.cloneElement(v,{key:"".concat(P,"-").concat(D)})})}}]),i}(x.Component);O.displayName="ResizeObserver",Ce.a=O},uD2n:function(Fe,Ce,j){Fe.exports={"dis-input-editor-container":"dis-input-editor-container___3uf7A",active:"active___20tmT","input-mask":"input-mask___1kijM","text-area":"text-area___2gTEA","tip-container":"tip-container___2tKkE",hide:"hide___3jIwM","md-container":"md-container___14zRI","btn-send":"btn-send___3TabT"}},uMZB:function(Fe,Ce,j){Fe.exports={header:"header___3a50V",checkboxs:"checkboxs___3TnBC",field:"field___SHW6f","oj-form-container":"oj-form-container___36KBv","oj-left-panel":"oj-left-panel___3Fdj5","oj-form-info":"oj-form-info___dilPb",footer:"footer___1Ie9U","test-case-name":"test-case-name___356US","btn-remove-case":"btn-remove-case___1Z5cd","icon-tag":"icon-tag___3zUaP",btn_back:"btn_back___2UBbR",testJi:"testJi___1dyLk",upBtn:"upBtn___1I0SJ"}},uQRt:function(Fe,Ce,j){Fe.exports=J;function J(){return j("gaXo"),{}}},ulZh:function(Fe,Ce,j){typeof window!="undefined"&&function(K,R){Fe.exports=R()}(this,function(){return function(J){var K={};function R(H){if(K[H])return K[H].exports;var I=K[H]={i:H,l:!1,exports:{}};return J[H].call(I.exports,I,I.exports,R),I.l=!0,I.exports}return R.m=J,R.c=K,R.d=function(H,I,x){R.o(H,I)||Object.defineProperty(H,I,{enumerable:!0,get:x})},R.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},R.t=function(H,I){if(I&1&&(H=R(H)),I&8)return H;if(I&4&&typeof H=="object"&&H&&H.__esModule)return H;var x=Object.create(null);if(R.r(x),Object.defineProperty(x,"default",{enumerable:!0,value:H}),I&2&&typeof H!="string")for(var U in H)R.d(x,U,function(N){return H[N]}.bind(null,U));return x},R.n=function(H){var I=H&&H.__esModule?function(){return H.default}:function(){return H};return R.d(I,"a",I),I},R.o=function(H,I){return Object.prototype.hasOwnProperty.call(H,I)},R.p="/dist/",R(R.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(J,K,R){"use strict";var H=Object.prototype.hasOwnProperty,I="~";function x(){}Object.create&&(x.prototype=Object.create(null),new x().__proto__||(I=!1));function U(c,T,P){this.fn=c,this.context=T,this.once=P||!1}function N(c,T,P,O,p){if(typeof P!="function")throw new TypeError("The listener must be a function");var g=new U(P,O||c,p),i=I?I+T:T;return c._events[i]?c._events[i].fn?c._events[i]=[c._events[i],g]:c._events[i].push(g):(c._events[i]=g,c._eventsCount++),c}function E(c,T){--c._eventsCount===0?c._events=new x:delete c._events[T]}function L(){this._events=new x,this._eventsCount=0}L.prototype.eventNames=function(){var T=[],P,O;if(this._eventsCount===0)return T;for(O in P=this._events)H.call(P,O)&&T.push(I?O.slice(1):O);return Object.getOwnPropertySymbols?T.concat(Object.getOwnPropertySymbols(P)):T},L.prototype.listeners=function(T){var P=I?I+T:T,O=this._events[P];if(!O)return[];if(O.fn)return[O.fn];for(var p=0,g=O.length,i=new Array(g);p0},!1)}function c(T,P){for(var O={main:[P]},p={main:[]},g={main:{}};L(O);)for(var i=Object.keys(O),a=0;a=2*D/f||y<=B)return;var F=Number.POSITIVE_INFINITY,Q;for(Q=i.level-1;Q>o;Q--){var V=d[Q].maxBitrate;if(F=D*V/(8*.8*C),F=y)return;var W=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+i.sn+(a?" part "+a.index:"")+" of level "+i.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+Q+` Current BW estimate: `+(Object(H.isFiniteNumber)(W)?(W/1024).toFixed(3):"Unknown")+` Kb/s Estimated load time for current fragment: `+y.toFixed(3)+` s Estimated load time for the next fragment: `+F.toFixed(3)+` s Time to underbuffer: `+B.toFixed(3)+" s"),u.nextLoadLevel=Q,this.bwEstimator.sample(S,v.loaded),this.clearTimer(),i.loader&&(this.fragCurrent=this.partCurrent=null,i.loader.abort()),u.trigger(x.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:i,part:a,stats:v})},p.onFragLoaded=function(i,a){var u=a.frag,h=a.part;if(u.type===E.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(u.sn)){var w=h?h.stats:u.stats,b=h?h.duration:u.duration;if(this.clearTimer(),this.lastLoadedFragLevel=u.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var v=this.hls.levels[u.level],D=(v.loaded?v.loaded.bytes:0)+w.loaded,S=(v.loaded?v.loaded.duration:0)+b;v.loaded={bytes:D,duration:S},v.realBitrate=Math.round(8*D/S)}if(u.bitrateTest){var f={stats:w,frag:u,part:h,id:u.type};this.onFragBuffered(x.Events.FRAG_BUFFERED,f),u.bitrateTest=!1}}},p.onFragBuffered=function(i,a){var u=a.frag,h=a.part,w=h?h.stats:u.stats;if(w.aborted)return;if(u.type!==E.PlaylistLevelType.MAIN||u.sn==="initSegment")return;var b=w.parsing.end-w.loading.start;this.bwEstimator.sample(b,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),u.bitrateTest?this.bitrateTestDelay=b/1e3:this.bitrateTestDelay=0},p.onError=function(i,a){switch(a.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},p.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},p.getNextABRAutoLevel=function(){var i=this.fragCurrent,a=this.partCurrent,u=this.hls,h=u.maxAutoLevel,w=u.config,b=u.minAutoLevel,v=u.media,D=a?a.duration:i?i.duration:0,S=v?v.currentTime:0,f=v&&v.playbackRate!==0?Math.abs(v.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,o=(U.BufferHelper.bufferInfo(v,S,w.maxBufferHole).end-S)/f,s=this.findBestLevel(d,b,h,o,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(s>=0)return s;L.logger.trace((o?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var _=D?Math.min(D,w.maxStarvationDelay):w.maxStarvationDelay,C=w.abrBandWidthFactor,y=w.abrBandWidthUpFactor;if(!o){var M=this.bitrateTestDelay;if(M){var B=D?Math.min(D,w.maxLoadingDelay):w.maxLoadingDelay;_=B-M,L.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*_)+" ms"),C=y=1}}return s=this.findBestLevel(d,b,h,o+_,C,y),Math.max(s,0)},p.findBestLevel=function(i,a,u,h,w,b){for(var v,D=this.fragCurrent,S=this.partCurrent,f=this.lastLoadedFragLevel,d=this.hls.levels,o=d[f],s=!!(o!=null&&(v=o.details)!==null&&v!==void 0&&v.live),_=o==null?void 0:o.codecSet,C=S?S.duration:D?D.duration:0,y=u;y>=a;y--){var M=d[y];if(!M||_&&M.codecSet!==_)continue;var B=M.details,F=(S?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||C,Q=void 0;y<=f?Q=w*i:Q=b*i;var V=d[y].maxBitrate,W=V*F/Q;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(Q)+"/"+V+"/"+F+"/"+h+"/"+W),Q>V&&(!W||s&&!this.bitrateTestDelay||W0&&o===-1?(this.log("Override startPosition with lastCurrentTime @"+s.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=o,this.tick()},f.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var o,s=this.levels,_=this.trackId,C=s==null||((o=s[_])===null||o===void 0)?void 0:o.details;if(C){if(this.waitForCdnTuneIn(C))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var y,M=performance.now(),B=this.retryDate;(!B||M>=B||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var F=this.waitingData;if(F){var Q=F.frag,V=F.part,W=F.cache,$=F.complete;if(this.initPTS[Q.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var re=W.flush(),ae={frag:Q,part:V,payload:re,networkDetails:null};this._handleFragmentLoadProgress(ae),$&&D.prototype._handleFragmentLoadComplete.call(this,ae)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+Q.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var he=this.getLoadPosition(),Se=U.BufferHelper.bufferInfo(this.mediaBuffer,he,this.config.maxBufferHole),ye=Object(p.fragmentWithinToleranceTest)(Se.end,this.config.maxFragLookUpTolerance,Q);ye<0&&(a.logger.log("Waiting fragment cc ("+Q.cc+") @ "+Q.start+" cancelled because another fragment at "+Se.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var o=this.waitingData;o&&(this.fragmentTracker.removeFragment(o.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.IDLE)},f.onTickEnd=function(){var o=this.media;if(!o||!o.readyState)return;var s=this.mediaBuffer?this.mediaBuffer:o,_=s.buffered;!this.loadedmetadata&&_.length&&(this.loadedmetadata=!0),this.lastCurrentTime=o.currentTime},f.doTickIdle=function(){var o,s,_=this.hls,C=this.levels,y=this.media,M=this.trackId,B=_.config;if(!C||!C[M])return;if(!y&&(this.startFragRequested||!B.startFragPrefetch))return;var F=C[M],Q=F.details;if(!Q||Q.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(Q)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,c.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var V=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(V===null)return;var W=V.len,$=this.getMaxBufferLength(),re=this.audioSwitch;if(W>=$&&!re)return;if(!re&&this._streamEnded(V,Q)){_.trigger(x.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var ae=Q.fragments,he=ae[0].start,Se=V.end;if(re){var ye=this.getLoadPosition();Se=ye,Q.PTSKnown&&yehe||V.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=he+.05))}var be=this.getNextFragment(Se,Q);if(!be){this.bufferFlushed=!0;return}((o=be.decryptdata)===null||o===void 0?void 0:o.keyFormat)==="identity"&&!((s=be.decryptdata)!==null&&s!==void 0&&s.key)?this.loadKey(be,Q):this.loadFragment(be,Q,Se)},f.getMaxBufferLength=function(){var o=D.prototype.getMaxBufferLength.call(this),s=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return s===null?o:Math.max(o,s.len)},f.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(o,s){var _=s.audioTracks;this.resetTransmuxer(),this.levels=_.map(function(C){return new E.Level(C)})},f.onAudioTrackSwitching=function(o,s){var _=!!s.url;this.trackId=s.id;var C=this.fragCurrent;C!=null&&C.loader&&C.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),_?this.setInterval(b):this.resetTransmuxer(),_?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(o,s){this.mainDetails=s.details},f.onAudioTrackLoaded=function(o,s){var _,C=this.levels,y=s.details,M=s.id;if(!C){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var B=C[M],F=0;if(y.live||(_=B.details)!==null&&_!==void 0&&_.live){var Q=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!Q)return;!B.details&&y.hasProgramDateTime&&Q.hasProgramDateTime?(Object(g.alignMediaPlaylistByPDT)(y,Q),F=y.fragments[0].start):F=this.alignPlaylists(y,B.details)}B.details=y,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(B.details,F),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=I.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(o){var s,_=o.frag,C=o.part,y=o.payload,M=this.config,B=this.trackId,F=this.levels;if(!F){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+_.sn+" of level "+_.level+" will not be buffered");return}var Q=F[B];console.assert(Q,"Audio track is defined on fragment load progress");var V=Q.details;console.assert(V,"Audio track details are defined on fragment load progress");var W=M.defaultAudioCodec||Q.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new P.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var re=this.initPTS[_.cc],ae=(s=_.initSegment)===null||s===void 0?void 0:s.data;if(re!==void 0){var he=!1,Se=C?C.index:-1,ye=Se!==-1,be=new O.ChunkMetadata(_.level,_.sn,_.stats.chunkCount,y.byteLength,Se,ye);$.push(y,ae,W,"",_,C,V.totalduration,he,be,re)}else{a.logger.log("Unknown video PTS for cc "+_.cc+", waiting for video PTS before demuxing audio frag "+_.sn+" of ["+V.startSN+" ,"+V.endSN+"],track "+B);var Oe=this.waitingData=this.waitingData||{frag:_,part:C,cache:new T.default,complete:!1},_e=Oe.cache;_e.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=I.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(o){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,o)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(o,s){var _=s.tracks.audio;_&&(this.mediaBuffer=_.buffer),s.tracks.video&&(this.videoBuffer=s.tracks.video.buffer)},f.onFragBuffered=function(o,s){var _=s.frag,C=s.part;if(_.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(_)){this.warn("Fragment "+_.sn+(C?" p: "+C.index:"")+" of level "+_.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}_.sn!=="initSegment"&&(this.fragPrevious=_,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(x.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(_,C)},f.onError=function(o,s){switch(s.details){case i.ErrorDetails.FRAG_LOAD_ERROR:case i.ErrorDetails.FRAG_LOAD_TIMEOUT:case i.ErrorDetails.KEY_LOAD_ERROR:case i.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,s);break;case i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case i.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=s.fatal?I.State.ERROR:I.State.IDLE,this.warn(s.details+" while loading frag, switching to "+this.state+" state"));break;case i.ErrorDetails.BUFFER_FULL_ERROR:if(s.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var _=!0,C=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);C&&C.len>.5&&(_=!this.reduceMaxBufferLength(C.len)),_&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(o,s){var _=s.type;_===c.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(o){var s,_="audio",C=this.hls,y=o.remuxResult,M=o.chunkMeta,B=this.getCurrentContext(M);if(!B){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var F=B.frag,Q=B.part,V=y.audio,W=y.text,$=y.id3,re=y.initSegment;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,this.audioSwitch&&V&&this.completeAudioSwitch(),re!=null&&re.tracks&&(this._bufferInitSegment(re.tracks,F,M),C.trigger(x.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:_,tracks:re.tracks})),V){var ae=V.startPTS,he=V.endPTS,Se=V.startDTS,ye=V.endDTS;Q&&(Q.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:ae,endPTS:he,startDTS:Se,endDTS:ye}),F.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,ae,he,Se,ye),this.bufferFragmentData(V,F,Q,M)}if($!=null&&(s=$.samples)!==null&&s!==void 0&&s.length){var be=u({frag:F,id:_},$);C.trigger(x.Events.FRAG_PARSING_METADATA,be)}if(W){var Oe=u({frag:F,id:_},W);C.trigger(x.Events.FRAG_PARSING_USERDATA,Oe)}},f._bufferInitSegment=function(o,s,_){if(this.state!==I.State.PARSING)return;o.video&&delete o.video;var C=o.audio;if(!C)return;C.levelCodec=C.codec,C.id="audio",this.log("Init audio buffer, container:"+C.container+", codecs[parsed]=["+C.codec+"]"),this.hls.trigger(x.Events.BUFFER_CODECS,o);var y=C.initSegment;if(y!=null&&y.byteLength){var M={type:"audio",frag:s,part:null,chunkMeta:_,parent:s.type,data:y};this.hls.trigger(x.Events.BUFFER_APPENDING,M)}this.tick()},f.loadFragment=function(o,s,_){var C=this.fragmentTracker.getState(o);this.fragCurrent=o,(this.audioSwitch||C===N.FragmentState.NOT_LOADED||C===N.FragmentState.PARTIAL)&&(o.sn==="initSegment"?this._loadInitSegment(o):s.live&&!Object(H.isFiniteNumber)(this.initPTS[o.cc])?(this.log("Waiting for video PTS in continuity counter "+o.cc+" of live stream before loading audio fragment "+o.sn+" of level "+this.trackId),this.state=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,o,s,_)))},f.completeAudioSwitch=function(){var o=this.hls,s=this.media,_=this.trackId;s&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,o.trigger(x.Events.AUDIO_TRACK_SWITCHED,{id:_})},S}(I.default);K.default=v},"./src/controller/audio-track-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts"),I=R("./src/errors.ts"),x=R("./src/controller/base-playlist-controller.ts"),U=R("./src/types/loader.ts");function N(P,O){for(var p=0;p=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var u=a[this.trackId];this.log("Now switching to audio-track index "+i);var h=a[i],w=h.id,b=h.groupId,v=b===void 0?"":b,D=h.name,S=h.type,f=h.url;if(this.trackId=i,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:v,name:D,type:S,url:f}),h.details&&!h.details.live)return;var d=this.switchParams(h.url,u==null?void 0:u.details);this.loadPlaylist(d)},p.selectInitialTrack=function(){var i=this.tracksInGroup;console.assert(i.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,u=this.findTrackId(a)||this.findTrackId();u!==-1?this.setAudioTrack(u):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},p.findTrackId=function(i){for(var a=this.tracksInGroup,u=0;uO.partTarget&&(h+=1)}if(Object(H.isFiniteNumber)(u))return new I.HlsUrlParameters(u,Object(H.isFiniteNumber)(h)?h:void 0,I.HlsSkip.No)}}},c.loadPlaylist=function(P){},c.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},c.playlistLoaded=function(P,O,p){var g=this,i=O.details,a=O.stats,u=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(i.advancedDateTime=Date.now()-u,i.live||p!=null&&p.live){if(i.reloaded(p),p&&this.log("live playlist "+P+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),p&&i.fragments.length>0&&Object(x.mergeDetails)(p,i),!this.canLoad||!i.live)return;var h,w=void 0,b=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var v=this.hls.config.lowLatencyMode,D=i.lastPartSn,S=i.endSN,f=i.lastPartIndex,d=f!==-1,o=D===S,s=v?0:f;d?(w=o?S+1:D,b=o?s:f+1):w=S+1;var _=i.age,C=_+i.ageHeader,y=Math.min(C-i.partTarget,i.targetduration*1.5);if(y>0){if(p&&y>p.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+p.tuneInGoal+" to: "+y+" with playlist age: "+i.age),y=0;else{var M=Math.floor(y/i.targetduration);if(w+=M,b!==void 0){var B=Math.round(y%i.targetduration/i.partTarget);b+=B}this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+_.toFixed(2)+"s goal: "+y+" skip sn "+M+" to part "+b)}i.tuneInGoal=y}if(h=this.getDeliveryDirectives(i,O.deliveryDirectives,w,b),v||!o){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(i,O.deliveryDirectives,w,b);var F=Object(x.computeReloadInterval)(i,a);w!==void 0&&i.canBlockReload&&(F-=i.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(F)+" ms"),this.timer=self.setTimeout(function(){return g.loadPlaylist(h)},F)}else this.clearTimer()},c.getDeliveryDirectives=function(P,O,p,g){var i=Object(I.getSkipValue)(P,p);return O!=null&&O.skip&&P.deltaUpdateFailed&&(p=O.msn,g=O.part,i=I.HlsSkip.No),new I.HlsUrlParameters(p,g,i)},c.retryLoadingOrFail=function(P){var O=this,p=this.hls.config,g=this.retryCount-1&&(i=P.context)!==null&&i!==void 0&&i.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*p.levelLoadingRetryDelay,p.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return O.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return g},L}()},"./src/controller/base-stream-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"State",function(){return S}),R.d(K,"default",function(){return f});var H=R("./src/polyfills/number.ts"),I=R("./src/task-loop.ts"),x=R("./src/controller/fragment-tracker.ts"),U=R("./src/utils/buffer-helper.ts"),N=R("./src/utils/logger.ts"),E=R("./src/events.ts"),L=R("./src/errors.ts"),c=R("./src/types/transmuxer.ts"),T=R("./src/utils/mp4-tools.ts"),P=R("./src/utils/discontinuities.ts"),O=R("./src/controller/fragment-finders.ts"),p=R("./src/controller/level-helper.ts"),g=R("./src/loader/fragment-loader.ts"),i=R("./src/crypt/decrypter.ts"),a=R("./src/utils/time-ranges.ts"),u=R("./src/types/loader.ts");function h(d,o){for(var s=0;sre;(Q<$||ae)&&(ae&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=Q),!this.loadedmetadata&&!V.len&&(this.nextLoadPosition=this.startPosition=Q),this.tickImmediate()},s.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},s.onKeyLoaded=function(C,y){if(this.state!==S.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=S.IDLE;var M=this.levels[y.frag.level].details;M&&this.loadFragment(y.frag,M,y.frag.start)},s.onHandlerDestroying=function(){this.stopLoad(),d.prototype.onHandlerDestroying.call(this)},s.onHandlerDestroyed=function(){this.state=S.STOPPED,this.hls.off(E.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,d.prototype.onHandlerDestroyed.call(this)},s.loadKey=function(C,y){this.log("Loading key for "+C.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+C.level),this.state=S.KEY_LOADING,this.fragCurrent=C,this.hls.trigger(E.Events.KEY_LOADING,{frag:C})},s.loadFragment=function(C,y,M){this._loadFragForPlayback(C,y,M)},s._loadFragForPlayback=function(C,y,M){var B=this,F=function(V){if(B.fragContextChanged(C)){B.warn("Fragment "+C.sn+(V.part?" p: "+V.part.index:"")+" of level "+C.level+" was dropped during download."),B.fragmentTracker.removeFragment(C);return}C.stats.chunkCount++,B._handleFragmentLoadProgress(V)};this._doFragLoad(C,y,M,F).then(function(Q){if(!Q)return;B.fragLoadError=0;var V=B.state;if(B.fragContextChanged(C)){(V===S.FRAG_LOADING||V===S.BACKTRACKING||!B.fragCurrent&&V===S.PARSING)&&(B.fragmentTracker.removeFragment(C),B.state=S.IDLE);return}if("payload"in Q&&(B.log("Loaded fragment "+C.sn+" of level "+C.level),B.hls.trigger(E.Events.FRAG_LOADED,Q),B.state===S.BACKTRACKING)){B.fragmentTracker.backtrack(C,Q),B.resetFragmentLoading(C);return}B._handleFragmentLoadComplete(Q)}).catch(function(Q){B.warn(Q),B.resetFragmentLoading(C)})},s.flushMainBuffer=function(C,y,M){if(M===void 0&&(M=null),!(C-y))return;var B={startOffset:C,endOffset:y,type:M};this.fragLoadError=0,this.hls.trigger(E.Events.BUFFER_FLUSHING,B)},s._loadInitSegment=function(C){var y=this;this._doFragLoad(C).then(function(M){if(!M||y.fragContextChanged(C)||!y.levels)throw new Error("init load aborted");return M}).then(function(M){var B=y.hls,F=M.payload,Q=C.decryptdata;if(F&&F.byteLength>0&&Q&&Q.key&&Q.iv&&Q.method==="AES-128"){var V=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(F),Q.key.buffer,Q.iv.buffer).then(function(W){var $=self.performance.now();return B.trigger(E.Events.FRAG_DECRYPTED,{frag:C,payload:W,stats:{tstart:V,tdecrypt:$}}),M.payload=W,M})}return M}).then(function(M){var B=y.fragCurrent,F=y.hls,Q=y.levels;if(!Q)throw new Error("init load aborted, missing levels");var V=Q[C.level].details;console.assert(V,"Level details are defined when init segment is loaded");var W=C.stats;y.state=S.IDLE,y.fragLoadError=0,C.data=new Uint8Array(M.payload),W.parsing.start=W.buffering.start=self.performance.now(),W.parsing.end=W.buffering.end=self.performance.now(),M.frag===B&&F.trigger(E.Events.FRAG_BUFFERED,{stats:W,frag:B,part:null,id:C.type}),y.tick()}).catch(function(M){y.warn(M),y.resetFragmentLoading(C)})},s.fragContextChanged=function(C){var y=this.fragCurrent;return!C||!y||C.level!==y.level||C.sn!==y.sn||C.urlId!==y.urlId},s.fragBufferedComplete=function(C,y){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+C.type+" sn: "+C.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+C.level+" "+a.default.toString(U.BufferHelper.getBuffered(M))),this.state=S.IDLE,this.tick()},s._handleFragmentLoadComplete=function(C){var y=this.transmuxer;if(!y)return;var M=C.frag,B=C.part,F=C.partsLoaded,Q=!F||F.length===0||F.some(function(W){return!W}),V=new c.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,B?B.index:-1,!Q);y.flush(V)},s._handleFragmentLoadProgress=function(C){},s._doFragLoad=function(C,y,M,B){var F=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(C.start,M||0),this.config.lowLatencyMode&&y){var Q=y.partList;if(Q&&B){M>C.end&&y.fragmentHint&&(C=y.fragmentHint);var V=this.getNextPart(Q,C,M);if(V>-1){var W=Q[V];return this.log("Loading part sn: "+C.sn+" p: "+W.index+" cc: "+C.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+V+"-"+(Q.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+C.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=W.start+W.duration,this.state=S.FRAG_LOADING,this.hls.trigger(E.Events.FRAG_LOADING,{frag:C,part:Q[V],targetBufferTime:M}),this.doFragPartsLoad(C,Q,V,B).catch(function($){return F.handleFragLoadError($)})}else if(!C.url||this.loadedEndOfParts(Q,M))return Promise.resolve(null)}}return this.log("Loading fragment "+C.sn+" cc: "+C.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+C.level+", target: "+parseFloat(M.toFixed(3))),Object(H.isFiniteNumber)(C.sn)&&!this.bitrateTest&&(this.nextLoadPosition=C.start+C.duration),this.state=S.FRAG_LOADING,this.hls.trigger(E.Events.FRAG_LOADING,{frag:C,targetBufferTime:M}),this.fragmentLoader.load(C,B).catch(function($){return F.handleFragLoadError($)})},s.doFragPartsLoad=function(C,y,M,B){var F=this;return new Promise(function(Q,V){var W=[],$=function re(ae){var he=y[ae];F.fragmentLoader.loadPart(C,he,B).then(function(Se){W[he.index]=Se;var ye=Se.part;F.hls.trigger(E.Events.FRAG_LOADED,Se);var be=y[ae+1];if(be&&be.fragment===C)re(ae+1);else return Q({frag:C,part:ye,partsLoaded:W})}).catch(V)};$(M)})},s.handleFragLoadError=function(C){var y=C.data;return y&&y.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(E.Events.ERROR,y),null},s._handleTransmuxerFlush=function(C){var y=this.getCurrentContext(C);if(!y||this.state!==S.PARSING){this.fragCurrent||(this.state=S.IDLE);return}var M=y.frag,B=y.part,F=y.level,Q=self.performance.now();M.stats.parsing.end=Q,B&&(B.stats.parsing.end=Q),this.updateLevelTiming(M,B,F,C.partial)},s.getCurrentContext=function(C){var y=this.levels,M=C.level,B=C.sn,F=C.part;if(!y||!y[M])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+M+". The current chunk will not be buffered."),null;var Q=y[M],V=F>-1?Object(p.getPartWith)(Q,B,F):null,W=V?V.fragment:Object(p.getFragmentWithSN)(Q,B,this.fragCurrent);return W?{frag:W,part:V,level:Q}:null},s.bufferFragmentData=function(C,y,M,B){if(!C||this.state!==S.PARSING)return;var F=C.data1,Q=C.data2,V=F;if(F&&Q&&(V=Object(T.appendUint8Array)(F,Q)),!V||!V.length)return;var W={type:C.type,frag:y,part:M,chunkMeta:B,parent:y.type,data:V};this.hls.trigger(E.Events.BUFFER_APPENDING,W),C.dropped&&C.independent&&!M&&this.flushBufferGap(y)},s.flushBufferGap=function(C){var y=this.media;if(!y)return;if(!U.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,C.start);return}var M=y.currentTime,B=U.BufferHelper.bufferInfo(y,M,0),F=C.duration,Q=Math.min(this.config.maxFragLookUpTolerance*2,F*.25),V=Math.max(Math.min(C.start-Q,B.end-Q),M+Q);C.start-V>Q&&this.flushMainBuffer(V,C.start)},s.getFwdBufferInfo=function(C,y){var M=this.config,B=this.getLoadPosition();if(!Object(H.isFiniteNumber)(B))return null;var F=U.BufferHelper.bufferInfo(C,B,M.maxBufferHole);if(F.len===0&&F.nextStart!==void 0){var Q=this.fragmentTracker.getBufferedFrag(B,y);if(Q&&F.nextStart=M?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},s.getNextFragment=function(C,y){var M,B,F=y.fragments,Q=F.length;if(!Q)return null;var V=this.config,W=F[0].start,$;if(y.live){var re=V.initialLiveManifestSize;if(Q-1&&M<$.start)break;var re=$.loaded;!re&&(F||$.independent||Q)&&$.fragment===y&&(B=V),F=re}return B},s.loadedEndOfParts=function(C,y){var M=C[C.length-1];return M&&y>M.start&&M.loaded},s.getInitialLiveFragment=function(C,y){var M=this.fragPrevious,B=null;if(M){if(C.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),B=Object(O.findFragmentByPDT)(y,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var F=M.sn+1;if(F>=C.startSN&&F<=C.endSN){var Q=y[F-C.startSN];M.cc===Q.cc&&(B=Q,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(O.findFragWithCC)(y,M.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var V=this.hls.liveSyncPosition;V!==null&&(B=this.getFragmentAtPosition(V,this.bitrateTest?C.fragmentEnd:C.edge,C))}return B},s.getFragmentAtPosition=function(C,y,M){var B=this.config,F=this.fragPrevious,Q=M.fragments,V=M.endSN,W=M.fragmentHint,$=B.maxFragLookUpTolerance,re=!!(B.lowLatencyMode&&M.partList&&W);re&&W&&!this.bitrateTest&&(Q=Q.concat(W),V=W.sn);var ae;if(Cy-$?0:$;ae=Object(O.findFragmentByPTS)(F,Q,C,he)}else ae=Q[Q.length-1];if(ae){var Se=ae.sn-M.startSN,ye=F&&ae.level===F.level,be=Q[Se+1],Oe=this.fragmentTracker.getState(ae);if(Oe===x.FragmentState.BACKTRACKED){ae=null;for(var _e=Se;Q[_e]&&this.fragmentTracker.getState(Q[_e])===x.FragmentState.BACKTRACKED;)F?ae=Q[_e--]:ae=Q[--_e];ae||(ae=be)}else F&&ae.sn===F.sn&&!re&&(ye&&(ae.sn=Q-y.maxFragLookUpTolerance&&F<=V;if(B!==null&&M.duration>B&&(F"+C.startSN+" prev-sn: "+(F?F.sn:"na")+" fragments: "+V),ae}return W},s.waitForCdnTuneIn=function(C){var y=3;return C.live&&C.canBlockReload&&C.tuneInGoal>Math.max(C.partHoldBack,C.partTarget*y)},s.setStartPosition=function(C,y){var M=this.startPosition;if(M"+C))}}]),o}(I.default)},"./src/controller/buffer-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return O});var H=R("./src/polyfills/number.ts"),I=R("./src/events.ts"),x=R("./src/utils/logger.ts"),U=R("./src/errors.ts"),N=R("./src/utils/buffer-helper.ts"),E=R("./src/utils/mediasource-helper.ts"),L=R("./src/loader/fragment.ts"),c=R("./src/controller/buffer-operation-queue.ts"),T=Object(E.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,O=function(){function p(i){var a=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=a.hls,h=a.media,w=a.mediaSource;x.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),u.trigger(I.Events.MEDIA_ATTACHED,{media:h})),w&&w.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){x.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){x.logger.log("[buffer-controller]: Media source ended")},this.hls=i,this._initSourceBuffer(),this.registerListeners()}var g=p.prototype;return g.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},g.destroy=function(){this.unregisterListeners(),this.details=null},g.registerListeners=function(){var a=this.hls;a.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(I.Events.BUFFER_RESET,this.onBufferReset,this),a.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(I.Events.BUFFER_EOS,this.onBufferEos,this),a.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(I.Events.FRAG_PARSED,this.onFragParsed,this),a.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g.unregisterListeners=function(){var a=this.hls;a.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(I.Events.BUFFER_RESET,this.onBufferReset,this),a.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(I.Events.BUFFER_EOS,this.onBufferEos,this),a.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(I.Events.FRAG_PARSED,this.onFragParsed,this),a.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},g._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},g.onManifestParsed=function(a,u){var h=2;(u.audio&&!u.video||!u.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,x.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},g.onMediaAttaching=function(a,u){var h=this.media=u.media;if(h&&T){var w=this.mediaSource=new T;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(w),this._objectUrl=h.src}},g.onMediaDetaching=function(){var a=this.media,u=this.mediaSource,h=this._objectUrl;if(u){if(x.logger.log("[buffer-controller]: media source detaching"),u.readyState==="open")try{u.endOfStream()}catch(w){x.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),u.removeEventListener("sourceopen",this._onMediaSourceOpen),u.removeEventListener("sourceended",this._onMediaSourceEnded),u.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(h&&self.URL.revokeObjectURL(h),a.src===h?(a.removeAttribute("src"),a.load()):x.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},g.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(u){var h=a.sourceBuffer[u];try{h&&(a.removeBufferListeners(u),a.mediaSource&&a.mediaSource.removeSourceBuffer(h),a.sourceBuffer[u]=void 0)}catch(w){x.logger.warn("[buffer-controller]: Failed to reset the "+u+" buffer",w)}}),this._initSourceBuffer()},g.onBufferCodecs=function(a,u){var h=this,w=this.getSourceBufferTypes().length;if(Object.keys(u).forEach(function(b){if(w){var v=h.tracks[b];if(v&&typeof v.buffer.changeType=="function"){var D=u[b],S=D.codec,f=D.levelCodec,d=D.container,o=(v.levelCodec||v.codec).replace(P,"$1"),s=(f||S).replace(P,"$1");if(o!==s){var _=d+";codecs="+(f||S);h.appendChangeType(b,_)}}}else h.pendingTracks[b]=u[b]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},g.appendChangeType=function(a,u){var h=this,w=this.operationQueue,b={execute:function(){var D=h.sourceBuffer[a];D&&(x.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+u),D.changeType(u)),w.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){x.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};w.append(b,a)},g.onBufferAppending=function(a,u){var h=this,w=this.hls,b=this.operationQueue,v=this.tracks,D=u.data,S=u.type,f=u.frag,d=u.part,o=u.chunkMeta,s=o.buffering[S],_=self.performance.now();s.start=_;var C=f.stats.buffering,y=d?d.stats.buffering:null;C.start===0&&(C.start=_),y&&y.start===0&&(y.start=_);var M=v.audio,B=S==="audio"&&o.id===1&&(M==null?void 0:M.container)==="audio/mpeg",F={execute:function(){if(s.executeStart=self.performance.now(),B){var V=h.sourceBuffer[S];if(V){var W=f.start-V.timestampOffset;Math.abs(W)>=.1&&(x.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+W+") sn: "+f.sn+")"),V.timestampOffset=f.start)}}h.appendExecutor(D,S)},onStart:function(){},onComplete:function(){var V=self.performance.now();s.executeEnd=s.end=V,C.first===0&&(C.first=V),y&&y.first===0&&(y.first=V);var W=h.sourceBuffer,$={};for(var re in W)$[re]=N.BufferHelper.getBuffered(W[re]);h.appendError=0,h.hls.trigger(I.Events.BUFFER_APPENDED,{type:S,frag:f,part:d,chunkMeta:o,parent:f.type,timeRanges:$})},onError:function(V){x.logger.error("[buffer-controller]: Error encountered while trying to append to the "+S+" SourceBuffer",V);var W={type:U.ErrorTypes.MEDIA_ERROR,parent:f.type,details:U.ErrorDetails.BUFFER_APPEND_ERROR,err:V,fatal:!1};V.code===DOMException.QUOTA_EXCEEDED_ERR?W.details=U.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,W.details=U.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>w.config.appendErrorMaxRetry&&(x.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),W.fatal=!0)),w.trigger(I.Events.ERROR,W)}};b.append(F,S)},g.onBufferFlushing=function(a,u){var h=this,w=this.operationQueue,b=function(D){return{execute:h.removeExecutor.bind(h,D,u.startOffset,u.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(I.Events.BUFFER_FLUSHED,{type:D})},onError:function(f){x.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",f)}}};u.type?w.append(b(u.type),u.type):this.getSourceBufferTypes().forEach(function(v){w.append(b(v),v)})},g.onFragParsed=function(a,u){var h=this,w=u.frag,b=u.part,v=[],D=b?b.elementaryStreams:w.elementaryStreams;D[L.ElementaryStreamTypes.AUDIOVIDEO]?v.push("audiovideo"):(D[L.ElementaryStreamTypes.AUDIO]&&v.push("audio"),D[L.ElementaryStreamTypes.VIDEO]&&v.push("video"));var S=function(){var d=self.performance.now();w.stats.buffering.end=d,b&&(b.stats.buffering.end=d);var o=b?b.stats:w.stats;h.hls.trigger(I.Events.FRAG_BUFFERED,{frag:w,part:b,stats:o,id:w.type})};v.length===0&&x.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(S,v)},g.onFragChanged=function(a,u){this.flushBackBuffer()},g.onBufferEos=function(a,u){var h=this,w=this.getSourceBufferTypes().reduce(function(b,v){var D=h.sourceBuffer[v];return(!u.type||u.type===v)&&(D&&!D.ended&&(D.ended=!0,x.logger.log("[buffer-controller]: "+v+" sourceBuffer now EOS"))),b&&!!(!D||D.ended)},!0);w&&this.blockBuffers(function(){var b=h.mediaSource;if(!b||b.readyState!=="open")return;b.endOfStream()})},g.onLevelUpdated=function(a,u){var h=u.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},g.flushBackBuffer=function(){var a=this.hls,u=this.details,h=this.media,w=this.sourceBuffer;if(!h||u===null)return;var b=this.getSourceBufferTypes();if(!b.length)return;var v=u.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(H.isFiniteNumber)(v)||v<0)return;var D=h.currentTime,S=u.levelTargetDuration,f=Math.max(v,S),d=Math.floor(D/S)*S-f;b.forEach(function(o){var s=w[o];if(s){var _=N.BufferHelper.getBuffered(s);_.length>0&&d>_.start(0)&&(a.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),u.live&&a.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),a.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:o}))}})},g.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,u=this.hls,h=this.media,w=this.mediaSource,b=a.fragments[0].start+a.totalduration,v=h.duration,D=Object(H.isFiniteNumber)(w.duration)?w.duration:0;a.live&&u.config.liveDurationInfinity?(x.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(a)):(b>D&&b>v||!Object(H.isFiniteNumber)(v))&&(x.logger.log("[buffer-controller]: Updating Media Source duration to "+b.toFixed(3)),w.duration=b)},g.updateSeekableRange=function(a){var u=this.mediaSource,h=a.fragments,w=h.length;if(w&&a.live&&u!==null&&u!==void 0&&u.setLiveSeekableRange){var b=Math.max(0,h[0].start),v=Math.max(b,b+a.totalduration);u.setLiveSeekableRange(b,v)}},g.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,u=this.operationQueue,h=this.pendingTracks,w=Object.keys(h).length;if(w&&!a||w===2){this.createSourceBuffers(h),this.pendingTracks={};var b=this.getSourceBufferTypes();if(b.length===0){this.hls.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}b.forEach(function(v){u.executeNext(v)})}},g.createSourceBuffers=function(a){var u=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var b in a)if(!u[b]){var v=a[b];if(!v)throw Error("source buffer exists for track "+b+", however track does not");var D=v.levelCodec||v.codec,S=v.container+";codecs="+D;x.logger.log("[buffer-controller]: creating sourceBuffer("+S+")");try{var f=u[b]=h.addSourceBuffer(S),d=b;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[b]={buffer:f,codec:D,container:v.container,levelCodec:v.levelCodec,id:v.id},w++}catch(o){x.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+o.message),this.hls.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:o,mimeType:S})}}w&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},g._onSBUpdateStart=function(a){var u=this.operationQueue,h=u.current(a);h.onStart()},g._onSBUpdateEnd=function(a){var u=this.operationQueue,h=u.current(a);h.onComplete(),u.shiftAndExecuteNext(a)},g._onSBUpdateError=function(a,u){x.logger.error("[buffer-controller]: "+a+" SourceBuffer error",u),this.hls.trigger(I.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(a);h&&h.onError(u)},g.removeExecutor=function(a,u,h){var w=this.media,b=this.mediaSource,v=this.operationQueue,D=this.sourceBuffer,S=D[a];if(!w||!b||!S){x.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),v.shiftAndExecuteNext(a);return}var f=Object(H.isFiniteNumber)(w.duration)?w.duration:Infinity,d=Object(H.isFiniteNumber)(b.duration)?b.duration:Infinity,o=Math.max(0,u),s=Math.min(h,f,d);s>o?(x.logger.log("[buffer-controller]: Removing ["+o+","+s+"] from the "+a+" SourceBuffer"),console.assert(!S.updating,a+" sourceBuffer must not be updating"),S.remove(o,s)):v.shiftAndExecuteNext(a)},g.appendExecutor=function(a,u){var h=this.operationQueue,w=this.sourceBuffer,b=w[u];if(!b){x.logger.warn("[buffer-controller]: Attempting to append to the "+u+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(u);return}b.ended=!1,console.assert(!b.updating,u+" sourceBuffer must not be updating"),b.appendBuffer(a)},g.blockBuffers=function(a,u){var h=this;if(u===void 0&&(u=this.getSourceBufferTypes()),!u.length){x.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var w=this.operationQueue,b=u.map(function(v){return w.appendBlocker(v)});Promise.all(b).then(function(){a(),u.forEach(function(v){var D=h.sourceBuffer[v];(!D||!D.updating)&&w.shiftAndExecuteNext(v)})})},g.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},g.addBufferListener=function(a,u,h){var w=this.sourceBuffer[a];if(!w)return;var b=h.bind(this,a);this.listeners[a].push({event:u,listener:b}),w.addEventListener(u,b)},g.removeBufferListeners=function(a){var u=this.sourceBuffer[a];if(!u)return;this.listeners[a].forEach(function(h){u.removeEventListener(h.event,h.listener)})},p}()},"./src/controller/buffer-operation-queue.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return I});var H=R("./src/utils/logger.ts"),I=function(){function x(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var U=x.prototype;return U.append=function(E,L){var c=this.queues[L];c.push(E),c.length===1&&this.buffers[L]&&this.executeNext(L)},U.insertAbort=function(E,L){var c=this.queues[L];c.unshift(E),this.executeNext(L)},U.appendBlocker=function(E){var L,c=new Promise(function(P){L=P}),T={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(T,E),c},U.executeNext=function(E){var L=this.buffers,c=this.queues,T=L[E],P=c[E];if(P.length){var O=P[0];try{O.execute()}catch(p){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),O.onError(p),(!T||!T.updating)&&(P.shift(),this.executeNext(E))}}},U.shiftAndExecuteNext=function(E){this.queues[E].shift(),this.executeNext(E)},U.current=function(E){return this.queues[E][0]},x}()},"./src/controller/cap-level-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts");function I(N,E){for(var L=0;L0&&this.mediaWidth>0){var c=this.hls.levels;if(c.length){var T=this.hls;T.autoLevelCapping=this.getMaxLevel(c.length-1),T.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=T.autoLevelCapping}}},E.getMaxLevel=function(c){var T=this,P=this.hls.levels;if(!P.length)return-1;var O=P.filter(function(p,g){return N.isLevelAllowed(g,T.restrictedLevels)&&g<=c});return this.clientRect=null,N.getMaxLevelByMediaSize(O,this.mediaWidth,this.mediaHeight)},E.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()},E.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},E.getDimensions=function(){if(this.clientRect)return this.clientRect;var c=this.media,T={width:0,height:0};if(c){var P=c.getBoundingClientRect();T.width=P.width,T.height=P.height,!T.width&&!T.height&&(T.width=P.right-P.left||c.width||0,T.height=P.bottom-P.top||c.height||0)}return this.clientRect=T,T},N.isLevelAllowed=function(c,T){return T===void 0&&(T=[]),T.indexOf(c)===-1},N.getMaxLevelByMediaSize=function(c,T,P){if(!c||!c.length)return-1;for(var O=function(u,h){return h?u.width!==h.width||u.height!==h.height:!0},p=c.length-1,g=0;g=T||i.height>=P)&&O(i,c[g+1])){p=g;break}}return p},x(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var c=1;try{c=self.devicePixelRatio}catch(T){}return c}}]),N}();K.default=U},"./src/controller/cmcd-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return O});var H=R("./src/events.ts"),I=R("./src/types/cmcd.ts"),x=R("./src/utils/buffer-helper.ts"),U=R("./src/utils/logger.ts");function N(p,g){for(var i=0;i=p.length?{done:!0}:{done:!1,value:p[a++]}}}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 c(p,g){if(!p)return;if(typeof p=="string")return T(p,g);var i=Object.prototype.toString.call(p).slice(8,-1);if(i==="Object"&&p.constructor&&(i=p.constructor.name),i==="Map"||i==="Set")return Array.from(p);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return T(p,g)}function T(p,g){(g==null||g>p.length)&&(g=p.length);for(var i=0,a=new Array(g);iu&&(u=v.bitrate)}return u>0?u:NaN},g.getBufferLength=function(a){var u=this.hls.media,h=a===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!u)return NaN;var w=x.BufferHelper.bufferInfo(h,u.currentTime,this.config.maxBufferHole);return w.len*1e3},g.createPlaylistLoader=function(){var a=this.config.pLoader,u=this.applyPlaylistData,h=a||this.config.loader;return function(){function w(v){this.loader=void 0,this.loader=new h(v)}var b=w.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(D,S,f){u(D),this.loader.load(D,S,f)},E(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},g.createFragmentLoader=function(){var a=this.config.fLoader,u=this.applyFragmentData,h=a||this.config.loader;return function(){function w(v){this.loader=void 0,this.loader=new h(v)}var b=w.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(D,S,f){u(D),this.loader.load(D,S,f)},E(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},p.uuid=function(){var a=URL.createObjectURL(new Blob),u=a.toString();return URL.revokeObjectURL(a),u.substr(u.lastIndexOf("/")+1)},p.serialize=function(a){for(var u=[],h=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},w=function(B){return Math.round(B)},b=function(B){return w(B/100)*100},v=function(B){return encodeURIComponent(B)},D={br:w,d:w,bl:b,dl:b,mtp:b,nor:v,rtp:b,tb:w},S=Object.keys(a||{}).sort(),f=L(S),d;!(d=f()).done;){var o=d.value,s=a[o];if(!h(s))continue;if(o==="v"&&s===1)continue;if(o=="pr"&&s===1)continue;var _=D[o];_&&(s=_(s));var C=typeof s,y=void 0;o==="ot"||o==="sf"||o==="st"?y=o+"="+s:C==="boolean"?y=o:C==="number"?y=o+"="+s:y=o+"="+JSON.stringify(s),u.push(y)}return u.join(",")},p.toHeaders=function(a){for(var u=Object.keys(a),h={},w=["Object","Request","Session","Status"],b=[{},{},{},{}],v={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},D=0,S=u;DL){this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var v=L-this._requestLicenseFailureCount+1;x.logger.warn("Retrying license request, "+v+" attempts left"),this._requestLicense(u,h)}break}},p._generateLicenseRequestChallenge=function(i,a){switch(i.mediaKeySystemDomain){case U.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+i.mediaKeySystemDomain)},p._requestLicense=function(i,a){x.logger.log("Requesting content license for key-system");var u=this._mediaKeysList[0];if(!u){x.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(u.mediaKeySystemDomain),w=this._createLicenseXhr(h,i,a);x.logger.log("Sending license request to URL: "+h);var b=this._generateLicenseRequestChallenge(u,i);w.send(b)}catch(v){x.logger.error("Failure requesting DRM license: "+v),this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},p.onMediaAttached=function(i,a){if(!this._emeEnabled)return;var u=a.media;this._media=u,u.addEventListener("encrypted",this._onMediaEncrypted)},p.onMediaDetached=function(){var i=this._media,a=this._mediaKeysList;if(!i)return;i.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(u){if(u.mediaKeysSession)return u.mediaKeysSession.close().catch(function(){})})).then(function(){return i.setMediaKeys(null)}).catch(function(){})},p.onManifestParsed=function(i,a){if(!this._emeEnabled)return;var u=a.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),h=a.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(U.KeySystems.WIDEVINE,u,h)},E(O,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),O}();K.default=P},"./src/controller/fps-controller.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/events.ts"),I=R("./src/utils/logger.ts"),x=function(){function U(E){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=E,this.registerListeners()}var N=U.prototype;return N.setStreamController=function(L){this.streamController=L},N.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(L,c){var T=this.hls.config;if(T.capLevelOnFPSDrop){var P=c.media instanceof self.HTMLVideoElement?c.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),T.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(L,c,T){var P=performance.now();if(c){if(this.lastTime){var O=P-this.lastTime,p=T-this.lastDroppedFrames,g=c-this.lastDecodedFrames,i=1e3*p/O,a=this.hls;if(a.trigger(H.Events.FPS_DROP,{currentDropped:p,currentDecoded:g,totalDroppedFrames:T}),i>0&&p>a.config.fpsDroppedMonitoringThreshold*g){var u=a.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=u)&&(u=u-1,a.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:a.currentLevel}),a.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=T,this.lastDecodedFrames=c}},N.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var c=L.getVideoPlaybackQuality();this.checkFPS(L,c.totalVideoFrames,c.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},U}();K.default=x},"./src/controller/fragment-finders.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"findFragmentByPDT",function(){return x}),R.d(K,"findFragmentByPTS",function(){return U}),R.d(K,"fragmentWithinToleranceTest",function(){return N}),R.d(K,"pdtWithinToleranceTest",function(){return E}),R.d(K,"findFragWithCC",function(){return L});var H=R("./src/polyfills/number.ts"),I=R("./src/utils/binary-search.ts");function x(c,T,P){if(T===null||!Array.isArray(c)||!c.length||!Object(H.isFiniteNumber)(T))return null;var O=c[0].programDateTime;if(T<(O||0))return null;var p=c[c.length-1].endProgramDateTime;if(T>=(p||0))return null;P=P||0;for(var g=0;gc&&P.start?-1:0}function E(c,T,P){var O=Math.min(T,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,p=P.endProgramDateTime||0;return p-O>c}function L(c,T){return I.default.search(c,function(P){return P.ccT?-1:0})}},"./src/controller/fragment-tracker.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"FragmentState",function(){return x}),R.d(K,"FragmentTracker",function(){return U});var H=R("./src/events.ts"),I=R("./src/types/loader.ts"),x;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(x||(x={}));var U=function(){function L(T){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=T,this._registerListeners()}var c=L.prototype;return c._registerListeners=function(){var P=this.hls;P.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},c._unregisterListeners=function(){var P=this.hls;P.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},c.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},c.getAppendedFrag=function(P,O){if(O===I.PlaylistLevelType.MAIN){var p=this.activeFragment,g=this.activeParts;if(!p)return null;if(g)for(var i=g.length;i--;){var a=g[i],u=a?a.end:p.appendedPTS;if(a.start<=P&&u!==void 0&&P<=u)return i>9&&(this.activeParts=g.slice(i-9)),a}else if(p.start<=P&&p.appendedPTS!==void 0&&P<=p.appendedPTS)return p}return this.getBufferedFrag(P,O)},c.getBufferedFrag=function(P,O){for(var p=this.fragments,g=Object.keys(p),i=g.length;i--;){var a=p[g[i]];if((a==null?void 0:a.body.type)===O&&a.buffered){var u=a.body;if(u.start<=P&&P<=u.end)return u}}return null},c.detectEvictedFragments=function(P,O,p){var g=this;Object.keys(this.fragments).forEach(function(i){var a=g.fragments[i];if(!a)return;if(!a.buffered){a.body.type===p&&g.removeFragment(a.body);return}var u=a.range[P];if(!u)return;u.time.some(function(h){var w=!g.isTimeBuffered(h.startPTS,h.endPTS,O);return w&&g.removeFragment(a.body),w})})},c.detectPartialFragments=function(P){var O=this,p=this.timeRanges,g=P.frag,i=P.part;if(!p||g.sn==="initSegment")return;var a=E(g),u=this.fragments[a];if(!u)return;Object.keys(p).forEach(function(h){var w=g.elementaryStreams[h];if(!w)return;var b=p[h],v=i!==null||w.partial===!0;u.range[h]=O.getBufferedTimes(g,i,v,b)}),u.backtrack=u.loaded=null,Object.keys(u.range).length?u.buffered=!0:this.removeFragment(u.body)},c.fragBuffered=function(P){var O=E(P),p=this.fragments[O];p&&(p.backtrack=p.loaded=null,p.buffered=!0)},c.getBufferedTimes=function(P,O,p,g){for(var i={time:[],partial:p},a=O?O.start:P.start,u=O?O.end:P.end,h=P.minEndPTS||u,w=P.maxStartPTS||a,b=0;b=v&&h<=D){i.time.push({startPTS:Math.max(a,g.start(b)),endPTS:Math.min(u,g.end(b))});break}else if(av)i.partial=!0,i.time.push({startPTS:Math.max(a,g.start(b)),endPTS:Math.min(u,g.end(b))});else if(u<=v)break}return i},c.getPartialFragment=function(P){var O=null,p,g,i,a=0,u=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(w){var b=h[w];if(!b)return;N(b)&&(g=b.body.start-u,i=b.body.end+u,P>=g&&P<=i&&(p=Math.min(P-g,i-P),a<=p&&(O=b.body,a=p)))}),O},c.getState=function(P){var O=E(P),p=this.fragments[O];return p?p.buffered?N(p)?x.PARTIAL:x.OK:p.backtrack?x.BACKTRACKED:x.APPENDING:x.NOT_LOADED},c.backtrack=function(P,O){var p=E(P),g=this.fragments[p];if(!g||g.backtrack)return null;var i=g.backtrack=O||g.loaded;return g.loaded=null,i},c.getBacktrackData=function(P){var O=E(P),p=this.fragments[O];if(p){var g,i=p.backtrack;if(i!=null&&(g=i.payload)!==null&&g!==void 0&&g.byteLength)return i;this.removeFragment(P)}return null},c.isTimeBuffered=function(P,O,p){for(var g,i,a=0;a=g&&O<=i)return!0;if(O<=g)return!1}return!1},c.onFragLoaded=function(P,O){var p=O.frag,g=O.part;if(p.sn==="initSegment"||p.bitrateTest||g)return;var i=E(p);this.fragments[i]={body:p,loaded:O,backtrack:null,buffered:!1,range:Object.create(null)}},c.onBufferAppended=function(P,O){var p=this,g=O.frag,i=O.part,a=O.timeRanges;if(g.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=g,i){var u=this.activeParts;u||(this.activeParts=u=[]),u.push(i)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var w=a[h];if(p.detectEvictedFragments(h,w),!i)for(var b=0;bP&&g.removeFragment(u)}})},c.removeFragment=function(P){var O=E(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[O]},c.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function N(L){var c,T;return L.buffered&&(((c=L.range.video)===null||c===void 0?void 0:c.partial)||((T=L.range.audio)===null||T===void 0?void 0:T.partial))}function E(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"STALL_MINIMUM_DURATION_MS",function(){return N}),R.d(K,"MAX_START_GAP_JUMP",function(){return E}),R.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),R.d(K,"SKIP_BUFFER_RANGE_START",function(){return c}),R.d(K,"default",function(){return T});var H=R("./src/utils/buffer-helper.ts"),I=R("./src/errors.ts"),x=R("./src/events.ts"),U=R("./src/utils/logger.ts"),N=250,E=2,L=.1,c=.05,T=function(){function P(p,g,i,a){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=p,this.media=g,this.fragmentTracker=i,this.hls=a}var O=P.prototype;return O.destroy=function(){this.hls=this.fragmentTracker=this.media=null},O.poll=function(g){var i=this.config,a=this.media,u=this.stalled,h=a.currentTime,w=a.seeking,b=this.seeking&&!w,v=!this.seeking&&w;if(this.seeking=w,h!==g){if(this.moved=!0,u!==null){if(this.stallReported){var D=self.performance.now()-u;U.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((v||b)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!H.BufferHelper.getBuffered(a).length)return;var S=H.BufferHelper.bufferInfo(a,h,0),f=S.len>0,d=S.nextStart||0;if(!f&&!d)return;if(w){var o=S.len>E,s=!d||d-h>E&&!this.fragmentTracker.getPartialFragment(h);if(o||s)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var _,C=Math.max(d,S.start||0)-h,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=y==null||((_=y.details)===null||_===void 0)?void 0:_.live,B=M?y.details.targetduration*2:E;if(C>0&&C<=B){this._trySkipBufferHole(null);return}}var F=self.performance.now();if(u===null){this.stalled=F;return}var Q=F-u;!w&&Q>=N&&this._reportStall(S.len);var V=H.BufferHelper.bufferInfo(a,h,i.maxBufferHole);this._tryFixBufferStall(V,Q)},O._tryFixBufferStall=function(g,i){var a=this.config,u=this.fragmentTracker,h=this.media,w=h.currentTime,b=u.getPartialFragment(w);if(b){var v=this._trySkipBufferHole(b);if(v)return}g.len>a.maxBufferHole&&i>a.highBufferWatchdogPeriod*1e3&&(U.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},O._reportStall=function(g){var i=this.hls,a=this.media,u=this.stallReported;u||(this.stallReported=!0,U.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+g+")"),i.trigger(x.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:g}))},O._trySkipBufferHole=function(g){for(var i=this.config,a=this.hls,u=this.media,h=u.currentTime,w=0,b=H.BufferHelper.getBuffered(u),v=0;v=w&&h.05&&this.forwardBufferLength>1){var v=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;P.playbackRate=Math.min(v,Math.max(1,D))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},c.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},c.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},N(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,O=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:O?P.liveMaxLatencyDurationCount*O.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var O=P.holdBack,p=P.partHoldBack,g=P.targetduration,i=this.config,a=i.liveSyncDuration,u=i.liveSyncDurationCount,h=i.lowLatencyMode,w=this.hls.userConfig,b=h&&p||O;(w.liveSyncDuration||w.liveSyncDurationCount||b===0)&&(b=a!==void 0?a:u*g);var v=g,D=1;return b+Math.min(this.stallCount*D,v)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),O=this.targetLatency,p=this.levelDetails;if(P===null||O===null||p===null)return null;var g=p.edge,i=P-O-this.edgeStalled,a=g-p.totalduration,u=g-(this.config.lowLatencyMode&&p.partTarget||p.targetduration);return Math.min(Math.max(a,i),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 O=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-O,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,O=this.levelDetails;if(!P||!O)return 0;var p=P.buffered.length;return p?P.buffered.end(p-1):O.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return i});var H=R("./src/types/level.ts"),I=R("./src/events.ts"),x=R("./src/errors.ts"),U=R("./src/utils/codecs.ts"),N=R("./src/controller/level-helper.ts"),E=R("./src/controller/base-playlist-controller.ts"),L=R("./src/types/loader.ts");function c(){return c=Object.assign||function(a){for(var u=1;u0){d=D[0].bitrate,D.sort(function(Q,V){return Q.bitrate-V.bitrate}),this._levels=D;for(var M=0;Mthis.hls.config.fragLoadingMaxRetry&&(o=v.frag.level)):o=v.frag.level}break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(d=!1),o=D.level),f=!0;break;case x.ErrorDetails.REMUX_ALLOC_ERROR:o=v.level,f=!0;break}o!==void 0&&this.recoverLevel(v,o,f,d)},h.recoverLevel=function(b,v,D,S){var f=b.details,d=this._levels[v];if(d.loadError++,D){var o=this.retryLoadingOrFail(b);if(o)b.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(S){var s=d.url.length;if(s>1&&d.loadError1){var S=(v.urlId+1)%D;this.warn("Switching to redundant URL-id "+S),this._levels.forEach(function(f){f.urlId=S}),this.level=b}},h.onFragLoaded=function(b,v){var D=v.frag;if(D!==void 0&&D.type===L.PlaylistLevelType.MAIN){var S=this._levels[D.level];S!==void 0&&(S.fragmentError=0,S.loadError=0)}},h.onLevelLoaded=function(b,v){var D,S=v.level,f=v.details,d=this._levels[S];if(!d){var o;this.warn("Invalid level index "+S),(o=v.deliveryDirectives)!==null&&o!==void 0&&o.skip&&(f.deltaUpdateFailed=!0);return}S===this.currentLevelIndex?(d.fragmentError===0&&(d.loadError=0,this.retryCount=0),this.playlistLoaded(S,v,d.details)):(D=v.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(f.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(b,v){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var S=-1,f=this.hls.audioTracks[v.id].groupId,d=0;d0){var S=D.urlId,f=D.url[S];if(b)try{f=b.addDirectives(f)}catch(d){this.warn("Could not construct new URL with HLS Delivery Directives: "+d)}this.log("Attempt loading level index "+v+(b?" at sn "+b.msn+" part "+b.part:"")+" with URL-id "+S+" "+f),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:f,level:v,id:S,deliveryDirectives:b||null})}},h.removeLevel=function(b,v){var D=function(d,o){return o!==v},S=this._levels.filter(function(f,d){return d!==b?!0:f.url.length>1&&v!==void 0?(f.url=f.url.filter(D),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(D)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(D)),f.urlId=0,!0):!1}).map(function(f,d){var o=f.details;return o!=null&&o.fragments&&o.fragments.forEach(function(s){s.level=d}),f});this._levels=S,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:S})},P(u,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(b){var v,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===b&&(v=D[b])!==null&&v!==void 0&&v.details)return;if(b<0||b>=D.length){var S=b<0;if(this.hls.trigger(I.Events.ERROR,{type:x.ErrorTypes.OTHER_ERROR,details:x.ErrorDetails.LEVEL_SWITCH_ERROR,level:b,fatal:S,reason:"invalid level idx"}),S)return;b=Math.min(b,D.length-1)}this.clearTimer();var f=this.currentLevelIndex,d=D[f],o=D[b];this.log("switching to level "+b+" from "+f),this.currentLevelIndex=b;var s=c({},o,{level:b,maxBitrate:o.maxBitrate,uri:o.uri,urlId:o.urlId});delete s._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,s);var _=o.details;if(!_||_.live){var C=this.switchParams(o.uri,d==null?void 0:d.details);this.loadPlaylist(C)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(b){this.manualLevelIndex=b,this._startLevel===void 0&&(this._startLevel=b),b!==-1&&(this.level=b)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(b){this._firstLevel=b}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var b=this.hls.config.startLevel;return b!==void 0?b:this._firstLevel}else return this._startLevel},set:function(b){this._startLevel=b}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(b){this.level=b,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=b)}}]),u}(E.default)},"./src/controller/level-helper.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"addGroupId",function(){return x}),R.d(K,"assignTrackIdsByGroup",function(){return U}),R.d(K,"updatePTS",function(){return N}),R.d(K,"updateFragPTSDTS",function(){return L}),R.d(K,"mergeDetails",function(){return c}),R.d(K,"mapPartIntersection",function(){return T}),R.d(K,"mapFragmentIntersection",function(){return P}),R.d(K,"adjustSliding",function(){return O}),R.d(K,"addSliding",function(){return p}),R.d(K,"computeReloadInterval",function(){return g}),R.d(K,"getFragmentWithSN",function(){return i}),R.d(K,"getPartWith",function(){return a});var H=R("./src/polyfills/number.ts"),I=R("./src/utils/logger.ts");function x(u,h,w){switch(h){case"audio":u.audioGroupIds||(u.audioGroupIds=[]),u.audioGroupIds.push(w);break;case"text":u.textGroupIds||(u.textGroupIds=[]),u.textGroupIds.push(w);break}}function U(u){var h={};u.forEach(function(w){var b=w.groupId||"";w.id=h[b]=h[b]||0,h[b]++})}function N(u,h,w){var b=u[h],v=u[w];E(b,v)}function E(u,h){var w=h.startPTS;if(Object(H.isFiniteNumber)(w)){var b=0,v;h.sn>u.sn?(b=w-u.start,v=u):(b=u.start-w,v=h),v.duration!==b&&(v.duration=b)}else if(h.sn>u.sn){var D=u.cc===h.cc;D&&u.minEndPTS?h.start=u.start+(u.minEndPTS-u.start):h.start=u.start+u.duration}else h.start=Math.max(u.start-h.duration,0)}function L(u,h,w,b,v,D){var S=b-w;S<=0&&(I.logger.warn("Fragment should have a positive duration",h),b=w+h.duration,D=v+h.duration);var f=w,d=b,o=h.startPTS,s=h.endPTS;if(Object(H.isFiniteNumber)(o)){var _=Math.abs(o-w);Object(H.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(_,h.deltaPTS):h.deltaPTS=_,f=Math.max(w,o),w=Math.min(w,o),v=Math.min(v,h.startDTS),d=Math.min(b,s),b=Math.max(b,s),D=Math.max(D,h.endDTS)}h.duration=b-w;var C=w-h.start;h.appendedPTS=b,h.start=h.startPTS=w,h.maxStartPTS=f,h.startDTS=v,h.endPTS=b,h.minEndPTS=d,h.endDTS=D;var y=h.sn;if(!u||yu.endSN)return 0;var M,B=y-u.startSN,F=u.fragments;for(F[B]=h,M=B;M>0;M--)E(F[M],F[M-1]);for(M=B;M=0;v--){var D=b[v].initSegment;if(D){w=D;break}}u.fragmentHint&&delete u.fragmentHint.endPTS;var S=0,f;if(P(u,h,function(M,B){M.relurl&&(S=M.cc-B.cc),Object(H.isFiniteNumber)(M.startPTS)&&Object(H.isFiniteNumber)(M.endPTS)&&(B.start=B.startPTS=M.startPTS,B.startDTS=M.startDTS,B.appendedPTS=M.appendedPTS,B.maxStartPTS=M.maxStartPTS,B.endPTS=M.endPTS,B.endDTS=M.endDTS,B.minEndPTS=M.minEndPTS,B.duration=M.endPTS-M.startPTS,B.duration&&(f=B),h.PTSKnown=h.alignedSliding=!0),B.elementaryStreams=M.elementaryStreams,B.loader=M.loader,B.stats=M.stats,B.urlId=M.urlId,M.initSegment&&(B.initSegment=M.initSegment,w=M.initSegment)}),w){var d=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;d.forEach(function(M){var B;(!M.initSegment||M.initSegment.relurl===((B=w)===null||B===void 0?void 0:B.relurl))&&(M.initSegment=w)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(M){return!M}),h.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var o=h.skippedSegments;o--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var s=h.fragments;if(S){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var _=0;_=b.length)return;p(h,b[w].start)}function p(u,h){if(h){for(var w=u.fragments,b=u.skippedSegments;b0&&v0&&d===-1&&(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),d=o),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},S.stopLoad=function(){this._forceStartLoad=!1,v.prototype.stopLoad.call(this)},S.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var d,o=this.levels,s=this.level,_=o==null||((d=o[s])===null||d===void 0)?void 0:d.details;if(_&&(!_.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(_))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var C,y=self.performance.now(),M=this.retryDate;(!M||y>=M||(C=this.media)!==null&&C!==void 0&&C.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},S.onTickEnd=function(){v.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},S.doTickIdle=function(){var d,o,s=this.hls,_=this.levelLastLoaded,C=this.levels,y=this.media,M=s.config,B=s.nextLoadLevel;if(_===null||!y&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!C||!C[B])return;var F=C[B];this.level=s.nextLoadLevel=B;var Q=F.details;if(!Q||this.state===I.State.WAITING_LEVEL||Q.live&&this.levelLastLoaded!==B){this.state=I.State.WAITING_LEVEL;return}var V=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,L.PlaylistLevelType.MAIN);if(V===null)return;var W=V.len,$=this.getMaxBufferLength(F.maxBitrate);if(W>=$)return;if(this._streamEnded(V,Q)){var re={};this.altAudio&&(re.type="video"),this.hls.trigger(U.Events.BUFFER_EOS,re),this.state=I.State.ENDED;return}var ae=V.end,he=this.getNextFragment(ae,Q);if(this.couldBacktrack&&!this.fragPrevious&&he&&he.sn!=="initSegment"){var Se=he.sn-Q.startSN;Se>1&&(he=Q.fragments[Se-1],this.fragmentTracker.removeFragment(he))}if(he&&this.fragmentTracker.getState(he)===E.FragmentState.OK&&this.nextLoadPosition>ae){var ye=this.audioOnly&&!this.altAudio?c.ElementaryStreamTypes.AUDIO:c.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,ye,L.PlaylistLevelType.MAIN),he=this.getNextFragment(this.nextLoadPosition,Q)}if(!he)return;he.initSegment&&!he.initSegment.data&&!this.bitrateTest&&(he=he.initSegment),((d=he.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=he.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(he,Q):this.loadFragment(he,Q,ae)},S.loadFragment=function(d,o,s){var _,C=this.fragmentTracker.getState(d);if(this.fragCurrent=d,C===E.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(d);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else C=E.FragmentState.NOT_LOADED}C===E.FragmentState.NOT_LOADED||C===E.FragmentState.PARTIAL?d.sn==="initSegment"?this._loadInitSegment(d):this.bitrateTest?(d.bitrateTest=!0,this.log("Fragment "+d.sn+" of level "+d.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(d)):(this.startFragRequested=!0,v.prototype.loadFragment.call(this,d,o,s)):C===E.FragmentState.APPENDING?this.reduceMaxBufferLength(d.duration)&&this.fragmentTracker.removeFragment(d):((_=this.media)===null||_===void 0?void 0:_.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},S.getAppendedFrag=function(d){var o=this.fragmentTracker.getAppendedFrag(d,L.PlaylistLevelType.MAIN);return o&&"fragment"in o?o.fragment:o},S.getBufferedFrag=function(d){return this.fragmentTracker.getBufferedFrag(d,L.PlaylistLevelType.MAIN)},S.followingBufferedFrag=function(d){return d?this.getBufferedFrag(d.end+.5):null},S.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},S.nextLevelSwitch=function(){var d=this.levels,o=this.media;if(o!=null&&o.readyState){var s,_=this.getAppendedFrag(o.currentTime);if(_&&_.start>1&&this.flushMainBuffer(0,_.start-1),!o.paused&&d){var C=this.hls.nextLoadLevel,y=d[C],M=this.fragLastKbps;M&&this.fragCurrent?s=this.fragCurrent.duration*y.maxBitrate/(1e3*M)+1:s=0}else s=0;var B=this.getBufferedFrag(o.currentTime+s);if(B){var F=this.followingBufferedFrag(B);if(F){this.abortCurrentFrag();var Q=F.maxStartPTS?F.maxStartPTS:F.start,V=F.duration,W=Math.max(B.end,Q+Math.min(Math.max(V-this.config.maxFragLookUpTolerance,V*.5),V*.75));this.flushMainBuffer(W,Number.POSITIVE_INFINITY)}}}},S.abortCurrentFrag=function(){var d=this.fragCurrent;this.fragCurrent=null,d!=null&&d.loader&&d.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},S.flushMainBuffer=function(d,o){v.prototype.flushMainBuffer.call(this,d,o,this.altAudio?"video":null)},S.onMediaAttached=function(d,o){v.prototype.onMediaAttached.call(this,d,o);var s=o.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),s.addEventListener("playing",this.onvplaying),s.addEventListener("seeked",this.onvseeked),this.gapController=new O.default(this.config,s,this.fragmentTracker,this.hls)},S.onMediaDetaching=function(){var d=this.media;d&&(d.removeEventListener("playing",this.onvplaying),d.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),v.prototype.onMediaDetaching.call(this)},S.onMediaPlaying=function(){this.tick()},S.onMediaSeeked=function(){var d=this.media,o=d?d.currentTime:null;Object(H.isFiniteNumber)(o)&&this.log("Media seeked to "+o.toFixed(3)),this.tick()},S.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(U.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},S.onManifestParsed=function(d,o){var s=!1,_=!1,C;o.levels.forEach(function(y){C=y.audioCodec,C&&(C.indexOf("mp4a.40.2")!==-1&&(s=!0),C.indexOf("mp4a.40.5")!==-1&&(_=!0))}),this.audioCodecSwitch=s&&_&&!Object(x.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=o.levels,this.startFragRequested=!1},S.onLevelLoading=function(d,o){var s=this.levels;if(!s||this.state!==I.State.IDLE)return;var _=s[o.level];(!_.details||_.details.live&&this.levelLastLoaded!==o.level||this.waitForCdnTuneIn(_.details))&&(this.state=I.State.WAITING_LEVEL)},S.onLevelLoaded=function(d,o){var s,_=this.levels,C=o.level,y=o.details,M=y.totalduration;if(!_){this.warn("Levels were reset while loading level "+C);return}this.log("Level "+C+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+M);var B=this.fragCurrent;B&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==o.level&&B.loader&&(this.state=I.State.IDLE,B.loader.abort()));var F=_[C],Q=0;if(y.live||(s=F.details)!==null&&s!==void 0&&s.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;Q=this.alignPlaylists(y,F.details)}if(F.details=y,this.levelLastLoaded=C,this.hls.trigger(U.Events.LEVEL_UPDATED,{details:y,level:C}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=I.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,Q),this.tick()},S._handleFragmentLoadProgress=function(d){var o,s=d.frag,_=d.part,C=d.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+s.sn+" of level "+s.level+" will not be buffered");return}var M=y[s.level],B=M.details;if(!B){this.warn("Dropping fragment "+s.sn+" of level "+s.level+" after level details were reset");return}var F=M.videoCodec,Q=B.PTSKnown||!B.live,V=(o=s.initSegment)===null||o===void 0?void 0:o.data,W=this._getAudioCodec(M),$=this.transmuxer=this.transmuxer||new T.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),re=_?_.index:-1,ae=re!==-1,he=new P.ChunkMetadata(s.level,s.sn,s.stats.chunkCount,C.byteLength,re,ae),Se=this.initPTS[s.cc];$.push(C,V,W,F,s,_,B.totalduration,Q,he,Se)},S.onAudioTrackSwitching=function(d,o){var s=this.altAudio,_=!!o.url,C=o.id;if(!_){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;s&&M.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(U.Events.AUDIO_TRACK_SWITCHED,{id:C})}},S.onAudioTrackSwitched=function(d,o){var s=o.id,_=!!this.hls.audioTracks[s].url;if(_){var C=this.videoBuffer;C&&this.mediaBuffer!==C&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=C)}this.altAudio=_,this.tick()},S.onBufferCreated=function(d,o){var s=o.tracks,_,C,y=!1;for(var M in s){var B=s[M];if(B.id==="main"){if(C=M,_=B,M==="video"){var F=s[M];F&&(this.videoBuffer=F.buffer)}}else y=!0}y&&_?(this.log("Alternate track found, use "+C+".buffered to schedule main fragment loading"),this.mediaBuffer=_.buffer):this.mediaBuffer=this.media},S.onFragBuffered=function(d,o){var s=o.frag,_=o.part;if(s&&s.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(s)){this.warn("Fragment "+s.sn+(_?" p: "+_.index:"")+" of level "+s.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var C=_?_.stats:s.stats;this.fragLastKbps=Math.round(8*C.total/(C.buffering.end-C.loading.first)),s.sn!=="initSegment"&&(this.fragPrevious=s),this.fragBufferedComplete(s,_)},S.onError=function(d,o){switch(o.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,o);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(o.fatal?(this.warn(""+o.details),this.state=I.State.ERROR):!o.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var s=!0,_=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);_&&_.len>.5&&(s=!this.reduceMaxBufferLength(_.len)),s&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},S.checkBuffer=function(){var d=this.media,o=this.gapController;if(!d||!o||!d.readyState)return;var s=N.BufferHelper.getBuffered(d);!this.loadedmetadata&&s.length?(this.loadedmetadata=!0,this.seekToStartPos()):o.poll(this.lastCurrentTime),this.lastCurrentTime=d.currentTime},S.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},S.onBufferFlushed=function(d,o){var s=o.type;if(s!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var _=(s===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(_,s,L.PlaylistLevelType.MAIN)}},S.onLevelsUpdated=function(d,o){this.levels=o.levels},S.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},S.seekToStartPos=function(){var d=this.media,o=d.currentTime,s=this.startPosition;if(s>=0&&o0&&(y1&&d.seeking===!1){var s=d.currentTime;if(N.BufferHelper.isBuffered(d,s)?o=this.getAppendedFrag(s):N.BufferHelper.isBuffered(d,s+.1)&&(o=this.getAppendedFrag(s+.1)),o){var _=this.fragPlaying,C=o.level;(!_||o.sn!==_.sn||_.level!==C||o.urlId!==_.urlId)&&(this.hls.trigger(U.Events.FRAG_CHANGED,{frag:o}),(!_||_.level!==C)&&this.hls.trigger(U.Events.LEVEL_SWITCHED,{level:C}),this.fragPlaying=o)}}},a(D,[{key:"nextLevel",get:function(){var d=this.nextBufferedFrag;return d?d.level:-1}},{key:"currentLevel",get:function(){var d=this.media;if(d){var o=this.getAppendedFrag(d.currentTime);if(o)return o.level}return-1}},{key:"nextBufferedFrag",get:function(){var d=this.media;if(d){var o=this.getAppendedFrag(d.currentTime);return this.followingBufferedFrag(o)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"SubtitleStreamController",function(){return u});var H=R("./src/events.ts"),I=R("./src/utils/logger.ts"),x=R("./src/utils/buffer-helper.ts"),U=R("./src/controller/fragment-finders.ts"),N=R("./src/utils/discontinuities.ts"),E=R("./src/controller/level-helper.ts"),L=R("./src/controller/fragment-tracker.ts"),c=R("./src/controller/base-stream-controller.ts"),T=R("./src/types/loader.ts"),P=R("./src/types/level.ts");function O(h,w){for(var b=0;b=o[C].start&&_<=o[C].end){s=o[C];break}var y=f.start+f.duration;s?s.end=y:(s={start:_,end:y},o.push(s)),this.fragmentTracker.fragBuffered(f)},b.onBufferFlushing=function(D,S){var f=S.startOffset,d=S.endOffset;if(f===0&&d!==Number.POSITIVE_INFINITY){var o=this.currentTrackId,s=this.levels;if(!s.length||!s[o]||!s[o].details)return;var _=s[o].details,C=_.targetduration,y=d-C;if(y<=0)return;S.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(M){for(var B=0;B=_.length||o!==s||!C)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,d.live||(f=C.details)!==null&&f!==void 0&&f.live){var y=this.mainDetails;if(d.deltaUpdateFailed||!y)return;var M=y.fragments[0];if(!C.details)d.hasProgramDateTime&&y.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(d,y):M&&Object(E.addSliding)(d,M.start);else{var B=this.alignPlaylists(d,C.details);B===0&&M&&Object(E.addSliding)(d,M.start)}}if(C.details=d,this.levelLastLoaded=o,this.tick(),d.live&&!this.fragCurrent&&this.media&&this.state===c.State.IDLE){var F=Object(U.findFragmentByPTS)(null,d.fragments,this.media.currentTime,0);F||(this.warn("Subtitle playlist not aligned with playback"),C.details=void 0)}},b._handleFragmentLoadComplete=function(D){var S=D.frag,f=D.payload,d=S.decryptdata,o=this.hls;if(this.fragContextChanged(S))return;if(f&&f.byteLength>0&&d&&d.key&&d.iv&&d.method==="AES-128"){var s=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),d.key.buffer,d.iv.buffer).then(function(_){var C=performance.now();o.trigger(H.Events.FRAG_DECRYPTED,{frag:S,payload:_,stats:{tstart:s,tdecrypt:C}})})}},b.doTick=function(){if(!this.media){this.state=c.State.IDLE;return}if(this.state===c.State.IDLE){var D,S=this.currentTrackId,f=this.levels;if(!f.length||!f[S]||!f[S].details)return;var d=f[S].details,o=d.targetduration,s=this.config,_=this.media,C=x.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,_.currentTime-o,s.maxBufferHole),y=C.end,M=C.len,B=this.getMaxBufferLength()+o;if(M>B)return;console.assert(d,"Subtitle track details are defined on idle subtitle stream controller tick");var F=d.fragments,Q=F.length,V=d.edge,W,$=this.fragPrevious;if(y-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)},g.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},g.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 a=P(this.media.textTracks);a.forEach(function(u){Object(I.clearCurrentCues)(u)}),this.subtitleTrack=-1,this.media=null},g.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},g.onManifestParsed=function(a,u){this.tracks=u.subtitleTracks},g.onSubtitleTrackLoaded=function(a,u){var h=u.id,w=u.details,b=this.trackId,v=this.tracksInGroup[b];if(!v){this.warn("Invalid subtitle track id "+h);return}var D=v.details;v.details=u.details,this.log("subtitle track "+h+" loaded ["+w.startSN+"-"+w.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,u,D))},g.onLevelLoading=function(a,u){this.switchLevel(u.level)},g.onLevelSwitching=function(a,u){this.switchLevel(u.level)},g.switchLevel=function(a){var u=this.hls.levels[a];if(!(u!=null&&u.textGroupIds))return;var h=u.textGroupIds[u.urlId];if(this.groupId!==h){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,b=this.tracks.filter(function(S){return!h||S.groupId===h});this.tracksInGroup=b;var v=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=h;var D={subtitleTracks:b};this.log("Updating subtitle tracks, "+b.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,D),v!==-1&&this.setSubtitleTrack(v,w)}},g.findTrackId=function(a){for(var u=this.tracksInGroup,h=0;h=w.length)return;this.clearTimer();var b=w[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,b){var v=b.id,D=b.groupId,S=D===void 0?"":D,f=b.name,d=b.type,o=b.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:v,groupId:S,name:f,type:d,url:o});var s=this.switchParams(b.url,u==null?void 0:u.details);this.loadPlaylist(s)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:a})},g.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,u=P(this.media.textTracks),h=0;h=0&&(d[0]=Math.min(d[0],w),d[1]=Math.max(d[1],b),S=!0,o/(b-w)>.5))return}if(S||D.push([w,b]),this.config.renderTextTracksNatively){var s=this.captionsTracks[h];this.Cues.newCue(s,w,b,v)}else{var _=this.Cues.newCue(null,w,b,v);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:_,track:h})}},a.onInitPtsFound=function(h,w){var b=this,v=w.frag,D=w.id,S=w.initPTS,f=w.timescale,d=this.unparsedVttFrags;D==="main"&&(this.initPTS[v.cc]=S,this.timescale[v.cc]=f),d.length&&(this.unparsedVttFrags=[],d.forEach(function(o){b.onFragLoaded(I.Events.FRAG_LOADED,o)}))},a.getExistingTrack=function(h){var w=this.media;if(w)for(var b=0;b>>8^f&255^99,L[v]=f,c[f]=v;var d=b[v],o=b[d],s=b[o],_=b[f]*257^f*16843008;P[v]=_<<24|_>>>8,O[v]=_<<16|_>>>16,p[v]=_<<8|_>>>24,g[v]=_,_=s*16843009^o*65537^d*257^v*16843008,a[f]=_<<24|_>>>8,u[f]=_<<16|_>>>16,h[f]=_<<8|_>>>24,w[f]=_,v?(v=d^b[b[b[s^d]]],D^=b[b[D]]):v=D=1}},N.expandKey=function(L){for(var c=this.uint8ArrayToUint32Array_(L),T=!0,P=0;P>>6)+1;var _=(h[w+2]&60)>>>2;if(_>s.length-1){u.trigger(x.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+_});return}return S=(h[w+2]&1)<<2,S|=(h[w+3]&192)>>>6,H.logger.log("manifest codec:"+b+", ADTS type:"+v+", samplingIndex:"+_),/firefox/i.test(d)?_>=6?(v=5,f=new Array(4),D=_-3):(v=2,f=new Array(2),D=_):d.indexOf("android")!==-1?(v=2,f=new Array(2),D=_):(v=5,f=new Array(4),b&&(b.indexOf("mp4a.40.29")!==-1||b.indexOf("mp4a.40.5")!==-1)||!b&&_>=6?D=_-3:((b&&b.indexOf("mp4a.40.2")!==-1&&(_>=6&&S===1||/vivaldi/i.test(d))||!b&&S===1)&&(v=2,f=new Array(2)),D=_)),f[0]=v<<3,f[0]|=(_&14)>>1,f[1]|=(_&1)<<7,f[1]|=S<<3,v===5&&(f[1]|=(D&14)>>1,f[2]=(D&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:s[_],channelCount:S,codec:"mp4a.40."+v,manifestCodec:o}}function N(u,h){return u[h]===255&&(u[h+1]&246)===240}function E(u,h){return u[h+1]&1?7:9}function L(u,h){return(u[h+3]&3)<<11|u[h+4]<<3|(u[h+5]&224)>>>5}function c(u,h){return h+5=u.length)return!1;var b=L(u,h);if(b<=w)return!1;var v=h+b;return v===u.length||T(u,v)}return!1}function p(u,h,w,b,v){if(!u.samplerate){var D=U(h,w,b,v);if(!D)return;u.config=D.config,u.samplerate=D.samplerate,u.channelCount=D.channelCount,u.codec=D.codec,u.manifestCodec=D.manifestCodec,H.logger.log("parsed codec:"+u.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function g(u){return 1024*9e4/u}function i(u,h,w,b,v){var D=E(u,h),S=L(u,h);if(S-=D,S>0){var f=w+b*v;return{headerLength:D,frameLength:S,stamp:f}}}function a(u,h,w,b,v){var D=g(u.samplerate),S=i(h,w,b,v,D);if(S){var f=S.frameLength,d=S.headerLength,o=S.stamp,s=d+f,_=Math.max(0,w+s-h.length),C;_?(C=new Uint8Array(s-d),C.set(h.subarray(w+d,h.length),0)):C=h.subarray(w+d,w+s);var y={unit:C,pts:o};return _||u.samples.push(y),{sample:y,length:s,missing:_}}}},"./src/demux/base-audio-demuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"initPTSFn",function(){return L});var H=R("./src/polyfills/number.ts"),I=R("./src/demux/id3.ts"),x=R("./src/demux/dummy-demuxed-track.ts"),U=R("./src/utils/mp4-tools.ts"),N=R("./src/utils/typed-array.ts"),E=function(){function c(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var T=c.prototype;return T.resetInitSegment=function(O,p,g){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},T.resetTimeStamp=function(){},T.resetContiguity=function(){},T.canParse=function(O,p){return!1},T.appendFrame=function(O,p,g){},T.demux=function(O,p){this.cachedData&&(O=Object(U.appendUint8Array)(this.cachedData,O),this.cachedData=null);var g=I.getID3Data(O,0),i=g?g.length:0,a,u,h=this._audioTrack,w=this._id3Track,b=g?I.getTimeStamp(g):void 0,v=O.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(b,p)),g&&g.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:g}),u=this.initPTS;iE?(this.word<<=E,this.bitsAvailable-=E):(E-=this.bitsAvailable,L=E>>3,E-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=E,this.bitsAvailable-=E)},U.readBits=function(E){var L=Math.min(this.bitsAvailable,E),c=this.word>>>32-L;return E>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=E-L,L>0&&this.bitsAvailable?c<>>E)!==0)return this.word<<=E,this.bitsAvailable-=E,E;return this.loadWord(),E+this.skipLZ()},U.skipUEG=function(){this.skipBits(1+this.skipLZ())},U.skipEG=function(){this.skipBits(1+this.skipLZ())},U.readUEG=function(){var E=this.skipLZ();return this.readBits(E+1)-1},U.readEG=function(){var E=this.readUEG();return 1&E?1+E>>>1:-1*(E>>>1)},U.readBoolean=function(){return this.readBits(1)===1},U.readUByte=function(){return this.readBits(8)},U.readUShort=function(){return this.readBits(16)},U.readUInt=function(){return this.readBits(32)},U.skipScalingList=function(E){for(var L=8,c=8,T,P=0;P0?v.subarray(S,S+f):void 0},U=function(v,D){var S=0;return S=(v[D]&127)<<21,S|=(v[D+1]&127)<<14,S|=(v[D+2]&127)<<7,S|=v[D+3]&127,S},N=function(v,D){return H(v,D)&&U(v,D+6)+10<=v.length-D},E=function(v){for(var D=T(v),S=0;S>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(s);break;case 12:case 13:_=v[M++],y+=String.fromCharCode((s&31)<<6|_&63);break;case 14:_=v[M++],C=v[M++],y+=String.fromCharCode((s&15)<<12|(_&63)<<6|(C&63)<<0);break;default:}}return y},u={decodeTextFrame:p},h;function w(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/demux/base-audio-demuxer.ts"),I=R("./src/demux/id3.ts"),x=R("./src/utils/logger.ts"),U=R("./src/demux/mpegaudio.ts");function N(c,T){c.prototype=Object.create(T.prototype),c.prototype.constructor=c,E(c,T)}function E(c,T){return E=Object.setPrototypeOf||function(O,p){return O.__proto__=p,O},E(c,T)}var L=function(c){N(T,c);function T(){return c.apply(this,arguments)||this}var P=T.prototype;return P.resetInitSegment=function(p,g,i){c.prototype.resetInitSegment.call(this,p,g,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:p,duration:i,inputTimeScale:9e4,dropped:0}},T.probe=function(p){if(!p)return!1;for(var g=I.getID3Data(p,0)||[],i=g.length,a=p.length;i0},N.demux=function(L){var c=L,T=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(c=Object(H.appendUint8Array)(this.remainderData,L));var P=Object(H.segmentValidRange)(c);this.remainderData=P.remainder,T.samples=P.valid||new Uint8Array}else T.samples=c;return{audioTrack:Object(I.dummyTrack)(),avcTrack:T,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.flush=function(){var L=Object(I.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:L,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},N.demuxSampleAes=function(L,c,T){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},U}();x.minProbeByteLength=1024,K.default=x},"./src/demux/mpegaudio.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"appendFrame",function(){return E}),R.d(K,"parseHeader",function(){return L}),R.d(K,"isHeaderPattern",function(){return c}),R.d(K,"isHeader",function(){return T}),R.d(K,"canParse",function(){return P}),R.d(K,"probe",function(){return O});var H=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],x=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],U=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function E(p,g,i,a,u){if(i+24>g.length)return;var h=L(g,i);if(h&&i+h.frameLength<=g.length){var w=h.samplesPerFrame*9e4/h.sampleRate,b=a+u*w,v={unit:g.subarray(i,i+h.frameLength),pts:b,dts:b};return p.config=[],p.channelCount=h.channelCount,p.samplerate=h.sampleRate,p.samples.push(v),{sample:v,length:h.frameLength,missing:0}}}function L(p,g){var i=p[g+1]>>3&3,a=p[g+1]>>1&3,u=p[g+2]>>4&15,h=p[g+2]>>2&3;if(i!==1&&u!==0&&u!==15&&h!==3){var w=p[g+2]>>1&1,b=p[g+3]>>6,v=i===3?3-a:a===3?3:4,D=I[v*14+u-1]*1e3,S=i===3?0:i===2?1:2,f=x[S*3+h],d=b===3?1:2,o=U[i][a],s=N[a],_=o*8*s,C=Math.floor(o*D/f+w)*s;if(H===null){var y=navigator.userAgent||"",M=y.match(/Chrome\/(\d+)/i);H=M?parseInt(M[1]):0}var B=!!H&&H<=87;return B&&a===2&&D>=224e3&&b===0&&(p[g+3]=p[g+3]|128),{sampleRate:f,channelCount:d,frameLength:C,samplesPerFrame:_}}}function c(p,g){return p[g]===255&&(p[g+1]&224)===224&&(p[g+1]&6)!==0}function T(p,g){return g+1=L.length){T();return}if(L[c].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(L,c,T,P),!P)return}},N.getAvcEncryptedData=function(L){for(var c=Math.floor((L.length-48)/160)*16+16,T=new Int8Array(c),P=0,O=32;O<=L.length-16;O+=160,P+=16)T.set(L.subarray(O,O+16),P);return T},N.getAvcDecryptedUnit=function(L,c){for(var T=new Uint8Array(c),P=0,O=32;O<=L.length-16;O+=160,P+=16)L.set(T.subarray(P,P+16),O);return L},N.decryptAvcSample=function(L,c,T,P,O,p){var g=Object(I.discardEPB)(O.data),i=this.getAvcEncryptedData(g),a=this;this.decryptBuffer(i.buffer,function(u){O.data=a.getAvcDecryptedUnit(g,u),p||a.decryptAvcSamples(L,c,T+1,P)})},N.decryptAvcSamples=function(L,c,T,P){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;c++,T=0){if(c>=L.length){P();return}for(var O=L[c].units;!(T>=O.length);T++){var p=O[T];if(p.data.length<=48||p.type!==1&&p.type!==5)continue;var g=this.decrypter.isSync();if(this.decryptAvcSample(L,c,T,P,p,g),!g)return}}},U}();K.default=x},"./src/demux/transmuxer-interface.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return O});var H=R("./node_modules/webworkify-webpack/index.js"),I=R.n(H),x=R("./src/events.ts"),U=R("./src/demux/transmuxer.ts"),N=R("./src/utils/logger.ts"),E=R("./src/errors.ts"),L=R("./src/utils/mediasource-helper.ts"),c=R("./node_modules/eventemitter3/index.js"),T=R.n(c),P=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},O=function(){function p(i,a,u,h){var w=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=i,this.id=a,this.onTransmuxComplete=u,this.onFlush=h;var b=i.config,v=function(o,s){s=s||{},s.frag=w.frag,s.id=w.id,i.trigger(o,s)};this.observer=new c.EventEmitter,this.observer.on(x.Events.FRAG_DECRYPTED,v),this.observer.on(x.Events.ERROR,v);var D={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},S=navigator.vendor;if(b.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var f;try{f=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(d){i.trigger(x.Events.ERROR,{type:E.ErrorTypes.OTHER_ERROR,details:E.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(d.message+" ("+d.filename+":"+d.lineno+")")})},f.postMessage({cmd:"init",typeSupported:D,vendor:S,id:a,config:JSON.stringify(b)})}catch(d){N.logger.warn("Error in worker:",d),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new U.default(this.observer,D,b,S,a),this.worker=null}}else this.transmuxer=new U.default(this.observer,D,b,S,a)}var g=p.prototype;return g.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var u=this.transmuxer;u&&(u.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},g.push=function(a,u,h,w,b,v,D,S,f,d){var o=this;f.transmuxing.start=self.performance.now();var s=this.transmuxer,_=this.worker,C=v?v.start:b.start,y=b.decryptdata,M=this.frag,B=!(M&&b.cc===M.cc),F=!(M&&f.level===M.level),Q=M?f.sn-M.sn:-1,V=this.part?f.part-this.part.index:1,W=!F&&(Q===1||Q===0&&V===1),$=self.performance.now();(F||Q||b.stats.parsing.start===0)&&(b.stats.parsing.start=$),v&&(V||!W)&&(v.stats.parsing.start=$);var re=new U.TransmuxState(B,W,S,F,C);if(!W||B){N.logger.log("[transmuxer-interface, "+b.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+` discontinuity: `+B+` trackSwitch: `+F+` contiguous: `+W+` accurateTimeOffset: `+S+` timeOffset: `+C);var ae=new U.TransmuxConfig(h,w,u,D,d);this.configureTransmuxer(ae)}if(this.frag=b,this.part=v,_)_.postMessage({cmd:"demux",data:a,decryptdata:y,chunkMeta:f,state:re},a instanceof ArrayBuffer?[a]:[]);else if(s){var he=s.push(a,y,f,re);Object(U.isPromise)(he)?he.then(function(Se){o.handleTransmuxComplete(Se)}):this.handleTransmuxComplete(he)}},g.flush=function(a){var u=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:a});else if(h){var b=h.flush(a);Object(U.isPromise)(b)?b.then(function(v){u.handleFlushResult(v,a)}):this.handleFlushResult(b,a)}},g.handleFlushResult=function(a,u){var h=this;a.forEach(function(w){h.handleTransmuxComplete(w)}),this.onFlush(u)},g.onWorkerMessage=function(a){var u=a.data,h=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,h.trigger(u.event,u.data);break}}},g.configureTransmuxer=function(a){var u=this.worker,h=this.transmuxer;u?u.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},g.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},p}()},"./src/demux/transmuxer-worker.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return E});var H=R("./src/demux/transmuxer.ts"),I=R("./src/events.ts"),x=R("./src/utils/logger.ts"),U=R("./node_modules/eventemitter3/index.js"),N=R.n(U);function E(O){var p=new U.EventEmitter,g=function(a,u){O.postMessage({event:a,data:u})};p.on(I.Events.FRAG_DECRYPTED,g),p.on(I.Events.ERROR,g),O.addEventListener("message",function(i){var a=i.data;switch(a.cmd){case"init":{var u=JSON.parse(a.config);O.transmuxer=new H.default(p,a.typeSupported,u,a.vendor,a.id),Object(x.enableLogs)(u.debug),g("init",null);break}case"configure":{O.transmuxer.configure(a.config);break}case"demux":{var h=O.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(H.isPromise)(h)?h.then(function(v){L(O,v)}):L(O,h);break}case"flush":{var w=a.chunkMeta,b=O.transmuxer.flush(w);Object(H.isPromise)(b)?b.then(function(v){T(O,v,w)}):T(O,b,w);break}default:break}})}function L(O,p){if(P(p.remuxResult))return;var g=[],i=p.remuxResult,a=i.audio,u=i.video;a&&c(g,a),u&&c(g,u),O.postMessage({event:"transmuxComplete",data:p},g)}function c(O,p){p.data1&&O.push(p.data1.buffer),p.data2&&O.push(p.data2.buffer)}function T(O,p,g){p.forEach(function(i){L(O,i)}),O.postMessage({event:"flush",data:g})}function P(O){return!O.audio&&!O.video&&!O.text&&!O.id3&&!O.initSegment}},"./src/demux/transmuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return u}),R.d(K,"isPromise",function(){return b}),R.d(K,"TransmuxConfig",function(){return v}),R.d(K,"TransmuxState",function(){return D});var H=R("./src/events.ts"),I=R("./src/errors.ts"),x=R("./src/crypt/decrypter.ts"),U=R("./src/demux/aacdemuxer.ts"),N=R("./src/demux/mp4demuxer.ts"),E=R("./src/demux/tsdemuxer.ts"),L=R("./src/demux/mp3demuxer.ts"),c=R("./src/remux/mp4-remuxer.ts"),T=R("./src/remux/passthrough-remuxer.ts"),P=R("./src/demux/chunk-cache.ts"),O=R("./src/utils/mp4-tools.ts"),p=R("./src/utils/logger.ts"),g;try{g=self.performance.now.bind(self.performance)}catch(S){p.logger.debug("Unable to use Performance API on this environment"),g=self.Date.now}var i=[{demux:E.default,remux:c.default},{demux:N.default,remux:T.default},{demux:U.default,remux:c.default},{demux:L.default,remux:c.default}],a=1024;i.forEach(function(S){var f=S.demux;a=Math.max(a,f.minProbeByteLength)});var u=function(){function S(d,o,s,_,C){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=d,this.typeSupported=o,this.config=s,this.vendor=_,this.id=C}var f=S.prototype;return f.configure=function(o){this.transmuxConfig=o,this.decrypter&&this.decrypter.reset()},f.push=function(o,s,_,C){var y=this,M=_.transmuxing;M.executeStart=g();var B=new Uint8Array(o),F=this.cache,Q=this.config,V=this.currentTransmuxState,W=this.transmuxConfig;C&&(this.currentTransmuxState=C);var $=h(B,s);if($&&$.method==="AES-128"){var re=this.getDecrypter();if(Q.enableSoftwareAES){var ae=re.softwareDecrypt(B,$.key.buffer,$.iv.buffer);if(!ae)return M.executeEnd=g(),w(_);B=new Uint8Array(ae)}else return this.decryptionPromise=re.webCryptoDecrypt(B,$.key.buffer,$.iv.buffer).then(function(Ye){var ut=y.push(Ye,null,_);return y.decryptionPromise=null,ut}),this.decryptionPromise}var he=C||V,Se=he.contiguous,ye=he.discontinuity,be=he.trackSwitch,Oe=he.accurateTimeOffset,_e=he.timeOffset,fe=W.audioCodec,le=W.videoCodec,Re=W.defaultInitPts,ot=W.duration,st=W.initSegmentData;if((ye||be)&&this.resetInitSegment(st,fe,le,ot),ye&&this.resetInitialTimestamp(Re),Se||this.resetContiguity(),this.needsProbing(B,ye,be)){if(F.dataLength){var nt=F.flush();B=Object(O.appendUint8Array)(nt,B)}this.configureTransmuxer(B,W)}var $e=this.transmux(B,$,_e,Oe,_),Ke=this.currentTransmuxState;return Ke.contiguous=!0,Ke.discontinuity=!1,Ke.trackSwitch=!1,M.executeEnd=g(),$e},f.flush=function(o){var s=this,_=o.transmuxing;_.executeStart=g();var C=this.decrypter,y=this.cache,M=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return s.flush(o)});var F=[],Q=M.timeOffset;if(C){var V=C.flush();V&&F.push(this.push(V,null,o))}var W=y.dataLength;y.reset();var $=this.demuxer,re=this.remuxer;if(!$||!re)return W>=a&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),_.executeEnd=g(),[w(o)];var ae=$.flush(Q);return b(ae)?ae.then(function(he){return s.flushRemux(F,he,o),F}):(this.flushRemux(F,ae,o),F)},f.flushRemux=function(o,s,_){var C=s.audioTrack,y=s.avcTrack,M=s.id3Track,B=s.textTrack,F=this.currentTransmuxState,Q=F.accurateTimeOffset,V=F.timeOffset;p.logger.log("[transmuxer.ts]: Flushed fragment "+_.sn+(_.part>-1?" p: "+_.part:"")+" of level "+_.level);var W=this.remuxer.remux(C,y,M,B,V,Q,!0,this.id);o.push({remuxResult:W,chunkMeta:_}),_.transmuxing.executeEnd=g()},f.resetInitialTimestamp=function(o){var s=this.demuxer,_=this.remuxer;if(!s||!_)return;s.resetTimeStamp(o),_.resetTimeStamp(o)},f.resetContiguity=function(){var o=this.demuxer,s=this.remuxer;if(!o||!s)return;o.resetContiguity(),s.resetNextTimestamp()},f.resetInitSegment=function(o,s,_,C){var y=this.demuxer,M=this.remuxer;if(!y||!M)return;y.resetInitSegment(s,_,C),M.resetInitSegment(o,s,_)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(o,s,_,C,y){var M;return s&&s.method==="SAMPLE-AES"?M=this.transmuxSampleAes(o,s,_,C,y):M=this.transmuxUnencrypted(o,_,C,y),M},f.transmuxUnencrypted=function(o,s,_,C){var y=this.demuxer.demux(o,s,!1,!this.config.progressive),M=y.audioTrack,B=y.avcTrack,F=y.id3Track,Q=y.textTrack,V=this.remuxer.remux(M,B,F,Q,s,_,!1,this.id);return{remuxResult:V,chunkMeta:C}},f.transmuxSampleAes=function(o,s,_,C,y){var M=this;return this.demuxer.demuxSampleAes(o,s,_).then(function(B){var F=M.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,_,C,!1,M.id);return{remuxResult:F,chunkMeta:y}})},f.configureTransmuxer=function(o,s){for(var _=this.config,C=this.observer,y=this.typeSupported,M=this.vendor,B=s.audioCodec,F=s.defaultInitPts,Q=s.duration,V=s.initSegmentData,W=s.videoCodec,$,re=0,ae=i.length;re0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(d=f),d}var w=function(f){return{remuxResult:{},chunkMeta:f}};function b(S){return"then"in S&&S.then instanceof Function}var v=function(f,d,o,s,_){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=d,this.initSegmentData=o,this.duration=s,this.defaultInitPts=_},D=function(f,d,o,s,_){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=d,this.accurateTimeOffset=o,this.trackSwitch=s,this.timeOffset=_}},"./src/demux/tsdemuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"discardEPB",function(){return w});var H=R("./src/demux/adts.ts"),I=R("./src/demux/mpegaudio.ts"),x=R("./src/demux/exp-golomb.ts"),U=R("./src/demux/id3.ts"),N=R("./src/demux/sample-aes.ts"),E=R("./src/events.ts"),L=R("./src/utils/mp4-tools.ts"),c=R("./src/utils/logger.ts"),T=R("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},O=function(){function b(D,S,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=D,this.config=S,this.typeSupported=f}b.probe=function(S){var f=b.syncOffset(S);return f<0?!1:(f&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},b.syncOffset=function(S){for(var f=Math.min(1e3,S.length-3*188),d=0;d>4,fe=void 0;if(_e>1){if(fe=ye+5+S[ye+4],fe===ye+188)continue}else fe=ye+4;switch(Oe){case M:be&&(B&&(s=a(B))&&this.parseAVCPES(s,!1),B={data:[],size:0}),B&&(B.data.push(S.subarray(fe,ye+188)),B.size+=ye+188-fe);break;case F:be&&(V&&(s=a(V))&&(C.isAAC?this.parseAACPES(s):this.parseMPEGPES(s)),V={data:[],size:0}),V&&(V.data.push(S.subarray(fe,ye+188)),V.size+=ye+188-fe);break;case Q:be&&(W&&(s=a(W))&&this.parseID3PES(s),W={data:[],size:0}),W&&(W.data.push(S.subarray(fe,ye+188)),W.size+=ye+188-fe);break;case 0:be&&(fe+=S[fe]+1),ae=this._pmtId=g(S,fe);break;case ae:{be&&(fe+=S[fe]+1);var le=i(S,fe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,d);M=le.avc,M>0&&(_.pid=M),F=le.audio,F>0&&(C.pid=F,C.isAAC=le.isAAC),Q=le.id3,Q>0&&(y.pid=Q),$&&!re&&(c.logger.log("reparse from beginning"),$=!1,ye=Se-188),re=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(E.Events.ERROR,E.Events.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});_.pesData=B,C.pesData=V,y.pesData=W;var Re={audioTrack:C,avcTrack:_,id3Track:y,textTrack:this._txtTrack};return o&&this.extractRemainingSamples(Re),Re},v.flush=function(){var S=this.remainderData;this.remainderData=null;var f;return S?f=this.demux(S,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},v.extractRemainingSamples=function(S){var f=S.audioTrack,d=S.avcTrack,o=S.id3Track,s=d.pesData,_=f.pesData,C=o.pesData,y;s&&(y=a(s))?(this.parseAVCPES(y,!0),d.pesData=null):d.pesData=s,_&&(y=a(_))?(f.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),f.pesData=null):(_!=null&&_.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=_),C&&(y=a(C))?(this.parseID3PES(y),o.pesData=null):o.pesData=C},v.demuxSampleAes=function(S,f,d){var o=this.demux(S,d,!0,!this.config.progressive),s=this.sampleAes=new N.default(this.observer,this.config,f);return this.decrypt(o,s)},v.decrypt=function(S,f){return new Promise(function(d){var o=S.audioTrack,s=S.avcTrack;o.samples&&o.isAAC?f.decryptAacSamples(o.samples,0,function(){s.samples?f.decryptAvcSamples(s.samples,0,0,function(){d(S)}):d(S)}):s.samples&&f.decryptAvcSamples(s.samples,0,0,function(){d(S)})})},v.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},v.parseAVCPES=function(S,f){var d=this,o=this._avcTrack,s=this.parseAVCNALu(S.data),_=!1,C=this.avcSample,y,M=!1;S.data=null,C&&s.length&&!o.audFound&&(u(C,o),C=this.avcSample=p(!1,S.pts,S.dts,"")),s.forEach(function(B){switch(B.type){case 1:{y=!0,C||(C=d.avcSample=p(!0,S.pts,S.dts,"")),_&&(C.debug+="NDR "),C.frame=!0;var F=B.data;if(M&&F.length>4){var Q=new x.default(F).readSliceType();(Q===2||Q===4||Q===7||Q===9)&&(C.key=!0)}break}case 5:y=!0,C||(C=d.avcSample=p(!0,S.pts,S.dts,"")),_&&(C.debug+="IDR "),C.key=!0,C.frame=!0;break;case 6:{y=!0,_&&C&&(C.debug+="SEI ");var V=new x.default(w(B.data));V.readUByte();for(var W=0,$=0,re=!1,ae=0;!re&&V.bytesAvailable>1;){W=0;do ae=V.readUByte(),W+=ae;while(ae===255);$=0;do ae=V.readUByte(),$+=ae;while(ae===255);if(W===4&&V.bytesAvailable!==0){re=!0;var he=V.readUByte();if(he===181){var Se=V.readUShort();if(Se===49){var ye=V.readUInt();if(ye===1195456820){var be=V.readUByte();if(be===3){for(var Oe=V.readUByte(),_e=V.readUByte(),fe=31&Oe,le=[Oe,_e],Re=0;Re16){for(var ot=[],st=0;st<16;st++)ot.push(V.readUByte().toString(16)),(st===3||st===5||st===7||st===9)&&ot.push("-");for(var nt=$-16,$e=new Uint8Array(nt),Ke=0;Ke=0){var V={data:S.subarray(F,C-o-1),type:Q};_.push(V)}else{var W=this.getLastNalUnit();if(W&&(s&&C<=4-s&&(W.state&&(W.data=W.data.subarray(0,W.data.byteLength-s))),M=C-o-1,M>0)){var $=new Uint8Array(W.data.byteLength+M);$.set(W.data,0),$.set(S.subarray(0,M),W.data.byteLength),W.data=$,W.state=0}}C=0&&o>=0){var re={data:S.subarray(F,f),type:Q,state:o};_.push(re)}if(_.length===0){var ae=this.getLastNalUnit();if(ae){var he=new Uint8Array(ae.data.byteLength+S.byteLength);he.set(ae.data,0),he.set(S,ae.data.byteLength),ae.data=he}}return d.naluState=o,_},v.parseAACPES=function(S){var f=0,d=this._audioTrack,o=this.aacOverFlow,s=S.data;if(o){this.aacOverFlow=null;var _=o.sample.unit.byteLength,C=Math.min(o.missing,_),y=_-C;o.sample.unit.set(s.subarray(0,C),y),d.samples.push(o.sample),f=o.missing}var M,B;for(M=f,B=s.length;M1;){var _=new Uint8Array(s[0].length+s[1].length);_.set(s[0]),_.set(s[1],s[0].length),s[0]=_,s.splice(1,1)}D=s[0];var C=(D[0]<<16)+(D[1]<<8)+D[2];if(C===1){if(S=(D[4]<<8)+D[5],S&&S>b.size-6)return null;var y=D[7];y&192&&(d=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,y&64?(o=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,d-o>60*9e4&&(c.logger.warn(Math.round((d-o)/9e4)+"s delta between PTS and DTS, align them"),d=o)):o=d),f=D[8];var M=f+9;if(b.size<=M)return null;b.size-=M;for(var B=new Uint8Array(b.size),F=0,Q=s.length;FV){M-=V;continue}else D=D.subarray(M),V-=M,M=0;B.set(D,v),v+=V}return S&&(S-=f+3),{data:B,pts:d,dts:o,len:S}}return null}function u(b,v){if(b.units.length&&b.frame){if(b.pts===void 0){var D=v.samples,S=D.length;if(S){var f=D[S-1];b.pts=f.pts,b.dts=f.dts}else{v.dropped++;return}}v.samples.push(b)}b.debug.length&&c.logger.log(b.pts+"/"+b.dts+":"+b.debug)}function h(b,v){var D=b.length;if(D>0){if(v.pts>=b[D-1].pts)b.push(v);else for(var S=D-1;S>=0;S--)if(v.ptsd)return s;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,d=this.autoLevelCapping,o;return d===-1&&f&&f.length?o=f.length-1:o=d,o}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var d=this.audioTrackController;d&&(d.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var d=this.subtitleTrackController;d&&(d.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var d=this.subtitleTrackController;d&&(d.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{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 a.Events}},{key:"ErrorTypes",get:function(){return u.ErrorTypes}},{key:"ErrorDetails",get:function(){return u.ErrorDetails}},{key:"DefaultConfig",get:function(){return v.defaultConfig?v.defaultConfig:p.hlsDefaultConfig},set:function(f){v.defaultConfig=f}}]),v}();b.defaultConfig=void 0},"./src/is-supported.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"isSupported",function(){return x}),R.d(K,"changeTypeSupported",function(){return U});var H=R("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function x(){var N=Object(H.getMediaSource)();if(!N)return!1;var E=I(),L=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),c=!E||E.prototype&&typeof E.prototype.appendBuffer=="function"&&typeof E.prototype.remove=="function";return!!L&&!!c}function U(){var N,E=I();return typeof(E==null||((N=E.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return O}),R.d(K,"LoadError",function(){return g});var H=R("./src/polyfills/number.ts"),I=R("./src/errors.ts");function x(i,a){i.prototype=Object.create(a.prototype),i.prototype.constructor=i,c(i,a)}function U(i){var a=typeof Map=="function"?new Map:void 0;return U=function(h){if(h===null||!L(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(h))return a.get(h);a.set(h,w)}function w(){return N(h,arguments,T(this).constructor)}return w.prototype=Object.create(h.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),c(w,h)},U(i)}function N(i,a,u){return E()?N=Reflect.construct:N=function(w,b,v){var D=[null];D.push.apply(D,b);var S=Function.bind.apply(w,D),f=new S;return v&&c(f,v.prototype),f},N.apply(null,arguments)}function E(){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(i){return!1}}function L(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function c(i,a){return c=Object.setPrototypeOf||function(h,w){return h.__proto__=w,h},c(i,a)}function T(i){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(u){return u.__proto__||Object.getPrototypeOf(u)},T(i)}var P=Math.pow(2,17),O=function(){function i(u){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=u}var a=i.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(h,w){var b=this,v=h.url;if(!v)return Promise.reject(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(v?"part list":"url")));this.abort();var D=this.config,S=D.fLoader,f=D.loader;return new Promise(function(d,o){b.loader&&b.loader.destroy();var s=b.loader=h.loader=S?new S(D):new f(D),_=p(h),C={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};h.stats=s.stats,s.load(_,C,{onSuccess:function(M,B,F,Q){b.resetLoader(h,s),d({frag:h,part:null,payload:M.data,networkDetails:Q})},onError:function(M,B,F){b.resetLoader(h,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:M,networkDetails:F}))},onAbort:function(M,B,F){b.resetLoader(h,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:F}))},onTimeout:function(M,B,F){b.resetLoader(h,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:F}))},onProgress:function(M,B,F,Q){w&&w({frag:h,part:null,payload:F,networkDetails:Q})}})})},a.loadPart=function(h,w,b){var v=this;this.abort();var D=this.config,S=D.fLoader,f=D.loader;return new Promise(function(d,o){v.loader&&v.loader.destroy();var s=v.loader=h.loader=S?new S(D):new f(D),_=p(h,w),C={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};w.stats=s.stats,s.load(_,C,{onSuccess:function(M,B,F,Q){v.resetLoader(h,s),v.updateStatsFromPart(h,w);var V={frag:h,part:w,payload:M.data,networkDetails:Q};b(V),d(V)},onError:function(M,B,F){v.resetLoader(h,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:w,response:M,networkDetails:F}))},onAbort:function(M,B,F){h.stats.aborted=w.stats.aborted,v.resetLoader(h,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:w,networkDetails:F}))},onTimeout:function(M,B,F){v.resetLoader(h,s),o(new g({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:w,networkDetails:F}))}})})},a.updateStatsFromPart=function(h,w){var b=h.stats,v=w.stats,D=v.total;if(b.loaded+=v.loaded,D){var S=Math.round(h.duration/w.duration),f=Math.min(Math.round(b.loaded/D),S),d=S-f,o=d*Math.round(b.loaded/f);b.total=b.loaded+o}else b.total=Math.max(b.loaded,b.total);var s=b.loading,_=v.loading;s.start?s.first+=_.first-_.start:(s.start=_.start,s.first=_.first),s.end=_.end},a.resetLoader=function(h,w){h.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},i}();function p(i,a){a===void 0&&(a=null);var u=a||i,h={frag:i,part:a,responseType:"arraybuffer",url:u.url,headers:{},rangeStart:0,rangeEnd:0},w=u.byteRangeStartOffset,b=u.byteRangeEndOffset;return Object(H.isFiniteNumber)(w)&&Object(H.isFiniteNumber)(b)&&(h.rangeStart=w,h.rangeEnd=b),h}var g=function(i){x(a,i);function a(u){for(var h,w=arguments.length,b=new Array(w>1?w-1:0),v=1;v>8*(15-D)&255;return v},h.setDecryptDataFromLevelKey=function(b,v){var D=b;return(b==null?void 0:b.method)==="AES-128"&&b.uri&&!b.iv&&(D=N.LevelKey.fromURI(b.uri),D.method=b.method,D.iv=this.createInitializationVector(v),D.keyFormat="identity"),D},h.setElementaryStreamInfo=function(b,v,D,S,f,d){d===void 0&&(d=!1);var o=this.elementaryStreams,s=o[b];if(!s){o[b]={startPTS:v,endPTS:D,startDTS:S,endDTS:f,partial:d};return}s.startPTS=Math.min(s.startPTS,v),s.endPTS=Math.max(s.endPTS,D),s.startDTS=Math.min(s.startDTS,S),s.endDTS=Math.max(s.endDTS,f)},h.clearElementaryStreamInfo=function(){var b=this.elementaryStreams;b[O.AUDIO]=null,b[O.VIDEO]=null,b[O.AUDIOVIDEO]=null},P(u,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var b=this.sn;typeof b!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&U.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),b=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,b)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var b=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+b*1e3}},{key:"encrypted",get:function(){var b;return!!((b=this.decryptdata)!==null&&b!==void 0&&b.keyFormat&&this.decryptdata.uri)}}]),u}(p),i=function(a){L(u,a);function u(h,w,b,v,D){var S;S=a.call(this,b)||this,S.fragOffset=0,S.duration=0,S.gap=!1,S.independent=!1,S.relurl=void 0,S.fragment=void 0,S.index=void 0,S.stats=new E.LoadStats,S.duration=h.decimalFloatingPoint("DURATION"),S.gap=h.bool("GAP"),S.independent=h.bool("INDEPENDENT"),S.relurl=h.enumeratedString("URI"),S.fragment=w,S.index=v;var f=h.enumeratedString("BYTERANGE");return f&&S.setByteRange(f,D),D&&(S.fragOffset=D.fragOffset+D.duration),S}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 w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),u}(p)},"./src/loader/key-loader.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return U});var H=R("./src/events.ts"),I=R("./src/errors.ts"),x=R("./src/utils/logger.ts"),U=function(){function N(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var E=N.prototype;return E._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},E._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},E.destroy=function(){this._unregisterListeners();for(var c in this.loaders){var T=this.loaders[c];T&&T.destroy()}this.loaders={}},E.onKeyLoading=function(c,T){var P=T.frag,O=P.type,p=this.loaders[O];if(!P.decryptdata){x.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var g=P.decryptdata.uri;if(g!==this.decrypturl||this.decryptkey===null){var i=this.hls.config;if(p&&(x.logger.warn("abort previous key loader for type:"+O),p.abort()),!g){x.logger.warn("key uri is falsy");return}var a=i.loader,u=P.loader=this.loaders[O]=new a(i);this.decrypturl=g,this.decryptkey=null;var h={url:g,frag:P,responseType:"arraybuffer"},w={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:i.fragLoadingRetryDelay,maxRetryDelay:i.fragLoadingMaxRetryTimeout,highWaterMark:0},b={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};u.load(h,w,b)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:P}))},E.loadsuccess=function(c,T,P){var O=P.frag;if(!O.decryptdata){x.logger.error("after key load, decryptdata unset");return}this.decryptkey=O.decryptdata.key=new Uint8Array(c.data),O.loader=null,delete this.loaders[O.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:O})},E.loaderror=function(c,T){var P=T.frag,O=P.loader;O&&O.abort(),delete this.loaders[P.type],this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:c})},E.loadtimeout=function(c,T){var P=T.frag,O=P.loader;O&&O.abort(),delete this.loaders[P.type],this.hls.trigger(H.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},N}()},"./src/loader/level-details.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"LevelDetails",function(){return N});var H=R("./src/polyfills/number.ts");function I(E,L){for(var c=0;cT.endSN||P>0||P===0&&O>0,this.updated||this.advanced?this.misses=Math.floor(T.misses*.6):this.misses=T.misses+1,this.availabilityDelay=T.availabilityDelay},x(E,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||U}},{key:"drift",get:function(){var T=this.driftEndTime-this.driftStartTime;if(T>0){var P=this.driftEnd-this.driftStart;return P*1e3/T}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var T;return(T=this.fragments)!==null&&T!==void 0&&T.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var T;return(T=this.partList)!==null&&T!==void 0&&T.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),E}()},"./src/loader/level-key.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"LevelKey",function(){return N});var H=R("./node_modules/url-toolkit/src/url-toolkit.js"),I=R.n(H);function x(E,L){for(var c=0;c2){var o=d.shift()+".";return o+=parseInt(d.shift()).toString(16),o+=("000"+parseInt(d.shift()).toString(16)).substr(-4),o}return f},D.resolve=function(f,d){return I.buildAbsoluteURL(d,f,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(f,d){var o=[],s={},_=!1;P.lastIndex=0;for(var C;(C=P.exec(f))!=null;)if(C[1]){var y=new L.AttrList(C[1]),M={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:D.resolve(C[2],d)},B=y.decimalResolution("RESOLUTION");B&&(M.width=B.width,M.height=B.height),h((y.CODECS||"").split(/[ ,]+/).filter(function(Q){return Q}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=D.convertAVC1ToAVCOTI(M.videoCodec)),o.push(M)}else if(C[3]){var F=new L.AttrList(C[3]);F["DATA-ID"]&&(_=!0,s[F["DATA-ID"]]=F)}return{levels:o,sessionData:_?s:null}},D.parseMasterPlaylistMedia=function(f,d,o,s){s===void 0&&(s=[]);var _,C=[],y=0;for(O.lastIndex=0;(_=O.exec(f))!==null;){var M=new L.AttrList(_[1]);if(M.TYPE===o){var B={attrs:M,bitrate:0,id:y++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:o,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?D.resolve(M.URI,d):""};if(s.length){var F=D.findGroup(s,B.groupId)||s[0];w(B,F,"audioCodec"),w(B,F,"textCodec")}C.push(B)}}return C},D.parseLevelPlaylist=function(f,d,o,s,_){var C=new N.LevelDetails(d),y=C.fragments,M=null,B=0,F=0,Q=0,V=0,W=null,$=new U.Fragment(s,d),re,ae,he,Se=-1,ye=!1;for(p.lastIndex=0,C.m3u8=f;(re=p.exec(f))!==null;){ye&&(ye=!1,$=new U.Fragment(s,d),$.start=Q,$.sn=B,$.cc=V,$.level=o,M&&($.initSegment=M,$.rawProgramDateTime=M.rawProgramDateTime));var be=re[1];if(be){$.duration=parseFloat(be);var Oe=(" "+re[2]).slice(1);$.title=Oe||null,$.tagList.push(Oe?["INF",be,Oe]:["INF",be])}else if(re[3])Object(H.isFiniteNumber)($.duration)&&($.start=Q,he&&($.levelkey=he),$.sn=B,$.level=o,$.cc=V,$.urlId=_,y.push($),$.relurl=(" "+re[3]).slice(1),v($,W),W=$,Q+=$.duration,B++,F=0,ye=!0);else if(re[4]){var _e=(" "+re[4]).slice(1);W?$.setByteRange(_e,W):$.setByteRange(_e)}else if(re[5])$.rawProgramDateTime=(" "+re[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Se===-1&&(Se=y.length);else{if(re=re[0].match(g),!re){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(ae=1;ae-1){c.logger.warn("Keyformat "+Rt+" is not supported from the manifest");continue}else if(Rt!=="identity")continue;ut&&(he=E.LevelKey.fromURL(d,pt),pt&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(ut)>=0&&(he.method=ut,he.keyFormat=Rt,rt&&(he.keyID=rt),Qe&&(he.keyFormatVersions=Qe),he.iv=at));break}case"START":{var xt=new L.AttrList(le),yt=xt.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(yt)&&(C.startTimeOffset=yt);break}case"MAP":{var wt=new L.AttrList(le);$.relurl=wt.URI,wt.BYTERANGE&&$.setByteRange(wt.BYTERANGE),$.level=o,$.sn="initSegment",he&&($.levelkey=he),$.initSegment=null,M=$,ye=!0;break}case"SERVER-CONTROL":{var Et=new L.AttrList(le);C.canBlockReload=Et.bool("CAN-BLOCK-RELOAD"),C.canSkipUntil=Et.optionalFloat("CAN-SKIP-UNTIL",0),C.canSkipDateRanges=C.canSkipUntil>0&&Et.bool("CAN-SKIP-DATERANGES"),C.partHoldBack=Et.optionalFloat("PART-HOLD-BACK",0),C.holdBack=Et.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Te=new L.AttrList(le);C.partTarget=Te.decimalFloatingPoint("PART-TARGET");break}case"PART":{var xe=C.partList;xe||(xe=C.partList=[]);var ze=F>0?xe[xe.length-1]:void 0,Ve=F++,De=new U.Part(new L.AttrList(le),$,d,Ve,ze);xe.push(De),$.duration+=De.duration;break}case"PRELOAD-HINT":{var We=new L.AttrList(le);C.preloadHint=We;break}case"RENDITION-REPORT":{var ge=new L.AttrList(le);C.renditionReports=C.renditionReports||[],C.renditionReports.push(ge);break}default:c.logger.warn("line parsed but not handled: "+re);break}}}W&&!W.relurl?(y.pop(),Q-=W.duration,C.partList&&(C.fragmentHint=W)):C.partList&&(v($,W),$.cc=V,C.fragmentHint=$);var de=y.length,ce=y[0],ne=y[de-1];if(Q+=C.skippedSegments*C.targetduration,Q>0&&de&&ne){C.averagetargetduration=Q/de;var ie=ne.sn;C.endSN=ie!=="initSegment"?ie:0,ce&&(C.startCC=ce.cc,ce.initSegment||C.fragments.every(function(oe){return oe.relurl&&a(oe.relurl)})&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new U.Fragment(s,d),$.relurl=ne.relurl,$.level=o,$.sn="initSegment",ce.initSegment=$,C.needSidxRanges=!0))}else C.endSN=0,C.startCC=0;return C.fragmentHint&&(Q+=C.fragmentHint.duration),C.totalduration=Q,C.endCC=V,Se>0&&b(y,Se),C},D}();function h(D,S){["video","audio","text"].forEach(function(f){var d=D.filter(function(s){return Object(T.isCodecType)(s,f)});if(d.length){var o=d.filter(function(s){return s.lastIndexOf("avc1",0)===0||s.lastIndexOf("mp4a",0)===0});S[f+"Codec"]=o.length>0?o[0]:d[0],D=D.filter(function(s){return d.indexOf(s)===-1})}}),S.unknownCodecs=D}function w(D,S,f){var d=S[f];d&&(D[f]=d)}function b(D,S){for(var f=D[S],d=S;d--;){var o=D[d];if(!o)return;o.programDateTime=f.programDateTime-o.duration*1e3,f=o}}function v(D,S){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):S!=null&&S.programDateTime&&(D.programDateTime=S.endProgramDateTime),Object(H.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/polyfills/number.ts"),I=R("./src/events.ts"),x=R("./src/errors.ts"),U=R("./src/utils/logger.ts"),N=R("./src/utils/mp4-tools.ts"),E=R("./src/loader/m3u8-parser.ts"),L=R("./src/types/loader.ts"),c=R("./src/utils/attr-list.ts");function T(p){var g=p.type;switch(g){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(p,g){var i=p.url;return(i===void 0||i.indexOf("data:")===0)&&(i=g.url),i}var O=function(){function p(i){this.hls=void 0,this.loaders=Object.create(null),this.hls=i,this.registerListeners()}var g=p.prototype;return g.registerListeners=function(){var a=this.hls;a.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.unregisterListeners=function(){var a=this.hls;a.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},g.createInternalLoader=function(a){var u=this.hls.config,h=u.pLoader,w=u.loader,b=h||w,v=new b(u);return a.loader=v,this.loaders[a.type]=v,v},g.getInternalLoader=function(a){return this.loaders[a.type]},g.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},g.destroyInternalLoaders=function(){for(var a in this.loaders){var u=this.loaders[a];u&&u.destroy(),this.resetInternalLoader(a)}},g.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},g.onManifestLoading=function(a,u){var h=u.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},g.onLevelLoading=function(a,u){var h=u.id,w=u.level,b=u.url,v=u.deliveryDirectives;this.load({id:h,groupId:null,level:w,responseType:"text",type:L.PlaylistContextType.LEVEL,url:b,deliveryDirectives:v})},g.onAudioTrackLoading=function(a,u){var h=u.id,w=u.groupId,b=u.url,v=u.deliveryDirectives;this.load({id:h,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:b,deliveryDirectives:v})},g.onSubtitleTrackLoading=function(a,u){var h=u.id,w=u.groupId,b=u.url,v=u.deliveryDirectives;this.load({id:h,groupId:w,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:b,deliveryDirectives:v})},g.load=function(a){var u,h=this.hls.config,w=this.getInternalLoader(a);if(w){var b=w.context;if(b&&b.url===a.url){U.logger.trace("[playlist-loader]: playlist request ongoing");return}U.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),w.abort()}var v,D,S,f;switch(a.type){case L.PlaylistContextType.MANIFEST:v=h.manifestLoadingMaxRetry,D=h.manifestLoadingTimeOut,S=h.manifestLoadingRetryDelay,f=h.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:v=0,D=h.levelLoadingTimeOut;break;default:v=h.levelLoadingMaxRetry,D=h.levelLoadingTimeOut,S=h.levelLoadingRetryDelay,f=h.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(a),(u=a.deliveryDirectives)!==null&&u!==void 0&&u.part){var d;if(a.type===L.PlaylistContextType.LEVEL&&a.level!==null?d=this.hls.levels[a.level].details:a.type===L.PlaylistContextType.AUDIO_TRACK&&a.id!==null?d=this.hls.audioTracks[a.id].details:a.type===L.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(d=this.hls.subtitleTracks[a.id].details),d){var o=d.partTarget,s=d.targetduration;o&&s&&(D=Math.min(Math.max(o*3,s*.8)*1e3,D))}}var _={timeout:D,maxRetry:v,retryDelay:S,maxRetryDelay:f,highWaterMark:0},C={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(a,_,C)},g.loadsuccess=function(a,u,h,w){if(w===void 0&&(w=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,u,h,w);return}this.resetInternalLoader(h.type);var b=a.data;if(b.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",w);return}u.parsing.start=performance.now(),b.indexOf("#EXTINF:")>0||b.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,u,h,w):this.handleMasterPlaylist(a,u,h,w)},g.loaderror=function(a,u,h){h===void 0&&(h=null),this.handleNetworkError(u,h,!1,a)},g.loadtimeout=function(a,u,h){h===void 0&&(h=null),this.handleNetworkError(u,h,!0)},g.handleMasterPlaylist=function(a,u,h,w){var b=this.hls,v=a.data,D=P(a,h),S=E.default.parseMasterPlaylist(v,D),f=S.levels,d=S.sessionData;if(!f.length){this.handleManifestParsingError(a,h,"no level found in manifest",w);return}var o=f.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),s=f.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),_=E.default.parseMasterPlaylistMedia(v,D,"AUDIO",o),C=E.default.parseMasterPlaylistMedia(v,D,"SUBTITLES",s),y=E.default.parseMasterPlaylistMedia(v,D,"CLOSED-CAPTIONS");if(_.length){var M=_.some(function(B){return!B.url});!M&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(U.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),_.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))}b.trigger(I.Events.MANIFEST_LOADED,{levels:f,audioTracks:_,subtitles:C,captions:y,url:D,stats:u,networkDetails:w,sessionData:d})},g.handleTrackOrLevelPlaylist=function(a,u,h,w){var b=this.hls,v=h.id,D=h.level,S=h.type,f=P(a,h),d=Object(H.isFiniteNumber)(v)?v:0,o=Object(H.isFiniteNumber)(D)?D:d,s=T(h),_=E.default.parseLevelPlaylist(a.data,f,o,s,d);if(!_.fragments.length){b.trigger(I.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(S===L.PlaylistContextType.MANIFEST){var C={attrs:new c.AttrList({}),bitrate:0,details:_,name:"",url:f};b.trigger(I.Events.MANIFEST_LOADED,{levels:[C],audioTracks:[],url:f,stats:u,networkDetails:w,sessionData:null})}if(u.parsing.end=performance.now(),_.needSidxRanges){var y,M=(y=_.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:M,isSidxRequest:!0,type:S,level:D,levelDetails:_,id:v,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=_,this.handlePlaylistLoaded(a,u,h,w)},g.handleSidxRequest=function(a,u){var h=Object(N.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var w=h.references,b=u.levelDetails;w.forEach(function(v,D){var S=v.info,f=b.fragments[D];f.byteRange.length===0&&f.setByteRange(String(1+S.end-S.start)+"@"+String(S.start)),f.initSegment&&f.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},g.handleManifestParsingError=function(a,u,h,w){this.hls.trigger(I.Events.ERROR,{type:x.ErrorTypes.NETWORK_ERROR,details:x.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:u.type===L.PlaylistContextType.MANIFEST,url:a.url,reason:h,response:a,context:u,networkDetails:w})},g.handleNetworkError=function(a,u,h,w){h===void 0&&(h=!1),U.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var b=x.ErrorDetails.UNKNOWN,v=!1,D=this.getInternalLoader(a);switch(a.type){case L.PlaylistContextType.MANIFEST:b=h?x.ErrorDetails.MANIFEST_LOAD_TIMEOUT:x.ErrorDetails.MANIFEST_LOAD_ERROR,v=!0;break;case L.PlaylistContextType.LEVEL:b=h?x.ErrorDetails.LEVEL_LOAD_TIMEOUT:x.ErrorDetails.LEVEL_LOAD_ERROR,v=!1;break;case L.PlaylistContextType.AUDIO_TRACK:b=h?x.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:x.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,v=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:b=h?x.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:x.ErrorDetails.SUBTITLE_LOAD_ERROR,v=!1;break}D&&this.resetInternalLoader(a.type);var S={type:x.ErrorTypes.NETWORK_ERROR,details:b,fatal:v,url:a.url,loader:D,context:a,networkDetails:u};w&&(S.response=w),this.hls.trigger(I.Events.ERROR,S)},g.handlePlaylistLoaded=function(a,u,h,w){var b=h.type,v=h.level,D=h.id,S=h.groupId,f=h.loader,d=h.levelDetails,o=h.deliveryDirectives;if(!(d!=null&&d.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",w);return}if(!f)return;d.live&&(f.getCacheAge&&(d.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(d.ageHeader))&&(d.ageHeader=0));switch(b){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:d,level:v||0,id:D||0,stats:u,networkDetails:w,deliveryDirectives:o});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:d,id:D||0,groupId:S||"",stats:u,networkDetails:w,deliveryDirectives:o});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:d,id:D||0,groupId:S||"",stats:u,networkDetails:w,deliveryDirectives:o});break}},p}();K.default=O},"./src/polyfills/number.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"isFiniteNumber",function(){return H}),R.d(K,"MAX_SAFE_INTEGER",function(){return I});var H=Number.isFinite||function(x){return typeof x=="number"&&isFinite(x)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(J,K,R){"use strict";R.r(K);var H=function(){function I(){}return I.getSilentFrame=function(U,N){switch(U){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(N===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(N===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(N===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},I}();K.default=H},"./src/remux/mp4-generator.ts":function(J,K,R){"use strict";R.r(K);var H=Math.pow(2,32)-1,I=function(){function x(){}return x.init=function(){x.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in x.types)x.types.hasOwnProperty(N)&&(x.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var E=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]);x.HDLR_TYPES={video:E,audio:L};var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),T=new Uint8Array([0,0,0,0,0,0,0,0]);x.STTS=x.STSC=x.STCO=T,x.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),x.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),x.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),x.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),O=new Uint8Array([97,118,99,49]),p=new Uint8Array([0,0,0,1]);x.FTYP=x.box(x.types.ftyp,P,p,P,O),x.DINF=x.box(x.types.dinf,x.box(x.types.dref,c))},x.box=function(N){for(var E=8,L=arguments.length,c=new Array(L>1?L-1:0),T=1;T>24&255,p[1]=E>>16&255,p[2]=E>>8&255,p[3]=E&255,p.set(N,4),P=0,E=8;P>24&255,N>>16&255,N>>8&255,N&255,L>>24,L>>16&255,L>>8&255,L&255,c>>24,c>>16&255,c>>8&255,c&255,85,196,0,0]))},x.mdia=function(N){return x.box(x.types.mdia,x.mdhd(N.timescale,N.duration),x.hdlr(N.type),x.minf(N))},x.mfhd=function(N){return x.box(x.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},x.minf=function(N){return N.type==="audio"?x.box(x.types.minf,x.box(x.types.smhd,x.SMHD),x.DINF,x.stbl(N)):x.box(x.types.minf,x.box(x.types.vmhd,x.VMHD),x.DINF,x.stbl(N))},x.moof=function(N,E,L){return x.box(x.types.moof,x.mfhd(N),x.traf(L,E))},x.moov=function(N){for(var E=N.length,L=[];E--;)L[E]=x.trak(N[E]);return x.box.apply(null,[x.types.moov,x.mvhd(N[0].timescale,N[0].duration)].concat(L).concat(x.mvex(N)))},x.mvex=function(N){for(var E=N.length,L=[];E--;)L[E]=x.trex(N[E]);return x.box.apply(null,[x.types.mvex].concat(L))},x.mvhd=function(N,E){E*=N;var L=Math.floor(E/(H+1)),c=Math.floor(E%(H+1)),T=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,L>>24,L>>16&255,L>>8&255,L&255,c>>24,c>>16&255,c>>8&255,c&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 x.box(x.types.mvhd,T)},x.sdtp=function(N){var E=N.samples||[],L=new Uint8Array(4+E.length),c,T;for(c=0;c>>8&255),E.push(P&255),E=E.concat(Array.prototype.slice.call(T));for(c=0;c>>8&255),L.push(P&255),L=L.concat(Array.prototype.slice.call(T));var O=x.box(x.types.avcC,new Uint8Array([1,E[3],E[4],E[5],252|3,224|N.sps.length].concat(E).concat([N.pps.length]).concat(L))),p=N.width,g=N.height,i=N.pixelRatio[0],a=N.pixelRatio[1];return x.box(x.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,p>>8&255,p&255,g>>8&255,g&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]),O,x.box(x.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),x.box(x.types.pasp,new Uint8Array([i>>24,i>>16&255,i>>8&255,i&255,a>>24,a>>16&255,a>>8&255,a&255])))},x.esds=function(N){var E=N.config.length;return new Uint8Array([0,0,0,0,3,23+E,0,1,0,4,15+E,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([E]).concat(N.config).concat([6,1,2]))},x.mp4a=function(N){var E=N.samplerate;return x.box(x.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,E>>8&255,E&255,0,0]),x.box(x.types.esds,x.esds(N)))},x.mp3=function(N){var E=N.samplerate;return x.box(x.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,E>>8&255,E&255,0,0]))},x.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?x.box(x.types.stsd,x.STSD,x.mp3(N)):x.box(x.types.stsd,x.STSD,x.mp4a(N)):x.box(x.types.stsd,x.STSD,x.avc1(N))},x.tkhd=function(N){var E=N.id,L=N.duration*N.timescale,c=N.width,T=N.height,P=Math.floor(L/(H+1)),O=Math.floor(L%(H+1));return x.box(x.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,E>>24&255,E>>16&255,E>>8&255,E&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,O>>24,O>>16&255,O>>8&255,O&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,c>>8&255,c&255,0,0,T>>8&255,T&255,0,0]))},x.traf=function(N,E){var L=x.sdtp(N),c=N.id,T=Math.floor(E/(H+1)),P=Math.floor(E%(H+1));return x.box(x.types.traf,x.box(x.types.tfhd,new Uint8Array([0,0,0,0,c>>24,c>>16&255,c>>8&255,c&255])),x.box(x.types.tfdt,new Uint8Array([1,0,0,0,T>>24,T>>16&255,T>>8&255,T&255,P>>24,P>>16&255,P>>8&255,P&255])),x.trun(N,L.length+16+20+8+16+8+8),L)},x.trak=function(N){return N.duration=N.duration||4294967295,x.box(x.types.trak,x.tkhd(N),x.mdia(N))},x.trex=function(N){var E=N.id;return x.box(x.types.trex,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,E&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},x.trun=function(N,E){var L=N.samples||[],c=L.length,T=12+16*c,P=new Uint8Array(T),O,p,g,i,a,u;for(E+=8+T,P.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,c&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255],0),O=0;O>>24&255,g>>>16&255,g>>>8&255,g&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,u>>>24&255,u>>>16&255,u>>>8&255,u&255],12+16*O);return x.box(x.types.trun,P)},x.initSegment=function(N){x.types||x.init();var E=x.moov(N),L=new Uint8Array(x.FTYP.byteLength+E.byteLength);return L.set(x.FTYP),L.set(E,x.FTYP.byteLength),L},x}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,K.default=I},"./src/remux/mp4-remuxer.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return u}),R.d(K,"normalizePts",function(){return h});var H=R("./src/polyfills/number.ts"),I=R("./src/remux/aac-helper.ts"),x=R("./src/remux/mp4-generator.ts"),U=R("./src/events.ts"),N=R("./src/errors.ts"),E=R("./src/utils/logger.ts"),L=R("./src/types/loader.ts"),c=R("./src/utils/timescale-conversion.ts");function T(){return T=Object.assign||function(D){for(var S=1;S0?_:C.pts},d[0].pts);return o&&E.logger.debug("PTS rollover detected"),s},S.remux=function(d,o,s,_,C,y,M,B){var F,Q,V,W,$,re,ae=C,he=C,Se=d.pid>-1,ye=o.pid>-1,be=o.samples.length,Oe=d.samples.length>0,_e=be>1,fe=(!Se||Oe)&&(!ye||_e)||this.ISGenerated||M;if(fe){this.ISGenerated||(V=this.generateIS(d,o,C));var le=this.isVideoContiguous,Re=-1;if(_e&&(Re=w(o.samples),!le&&this.config.forceKeyFrameOnDiscontinuity))if(re=!0,Re>0){E.logger.warn("[mp4-remuxer]: Dropped "+Re+" out of "+be+" video samples due to a missing keyframe");var ot=this.getVideoStartPts(o.samples);o.samples=o.samples.slice(Re),o.dropped+=Re,he+=(o.samples[0].pts-ot)/(o.timescale||9e4)}else Re===-1&&(E.logger.warn("[mp4-remuxer]: No keyframe found out of "+be+" video samples"),re=!1);if(this.ISGenerated){if(Oe&&_e){var st=this.getVideoStartPts(o.samples),nt=h(d.samples[0].pts,st)-st,$e=nt/o.inputTimeScale;ae+=Math.max(0,$e),he+=Math.max(0,-$e)}if(Oe){if(d.samplerate||(E.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),V=this.generateIS(d,o,C)),Q=this.remuxAudio(d,ae,this.isAudioContiguous,y,ye||_e||B===L.PlaylistLevelType.AUDIO?he:void 0),_e){var Ke=Q?Q.endPTS-Q.startPTS:0;o.inputTimeScale||(E.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),V=this.generateIS(d,o,C)),F=this.remuxVideo(o,he,le,Ke)}}else _e&&(F=this.remuxVideo(o,he,le,0));F&&(F.firstKeyFrame=Re,F.independent=Re!==-1)}}return this.ISGenerated&&(s.samples.length&&($=this.remuxID3(s,C)),_.samples.length&&(W=this.remuxText(_,C))),{audio:Q,video:F,initSegment:V,independent:re,text:W,id3:$}},S.generateIS=function(d,o,s){var _=d.samples,C=o.samples,y=this.typeSupported,M={},B=!Object(H.isFiniteNumber)(this._initPTS),F="audio/mp4",Q,V,W;if(B&&(Q=V=Infinity),d.config&&_.length&&(d.timescale=d.samplerate,d.isAAC||(y.mpeg?(F="audio/mpeg",d.codec=""):y.mp3&&(d.codec="mp3")),M.audio={id:"audio",container:F,codec:d.codec,initSegment:!d.isAAC&&y.mpeg?new Uint8Array(0):x.default.initSegment([d]),metadata:{channelCount:d.channelCount}},B&&(W=d.inputTimeScale,Q=V=_[0].pts-Math.round(W*s))),o.sps&&o.pps&&C.length&&(o.timescale=o.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:o.codec,initSegment:x.default.initSegment([o]),metadata:{width:o.width,height:o.height}},B)){W=o.inputTimeScale;var $=this.getVideoStartPts(C),re=Math.round(W*s);V=Math.min(V,h(C[0].dts,$)-re),Q=Math.min(Q,$-re)}if(Object.keys(M).length)return this.ISGenerated=!0,B&&(this._initPTS=Q,this._initDTS=V),{tracks:M,initPTS:Q,timescale:W}},S.remuxVideo=function(d,o,s,_){var C=d.inputTimeScale,y=d.samples,M=[],B=y.length,F=this._initPTS,Q=this.nextAvcDts,V=8,W,$,re,ae=Number.POSITIVE_INFINITY,he=Number.NEGATIVE_INFINITY,Se=0,ye=!1;if(!s||Q===null){var be=o*C,Oe=y[0].pts-h(y[0].dts,y[0].pts);Q=be-Oe}for(var _e=0;_efe.pts){var le=9e4*.2;Se=Math.max(Math.min(Se,fe.pts-fe.dts),-1*le)}fe.dts0?_e-1:_e].dts&&(ye=!0)}ye&&y.sort(function(it,Be){var Ue=it.dts-Be.dts,Le=it.pts-Be.pts;return Ue||Le}),$=y[0].dts,re=y[y.length-1].dts;var Re=Math.round((re-$)/(B-1));if(Se<0){if(SeRe,Ye=$e<-1;if(Ke||Ye){Ke?E.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)($e,!0)+" ms ("+$e+"dts) hole between fragments detected, filling it"):E.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(-$e,!0)+" ms ("+$e+"dts) overlapping between fragments detected"),$=Q;var ut=y[0].pts-$e;y[0].dts=$,y[0].pts=ut,E.logger.log("Video: First PTS/DTS adjusted: "+Object(c.toMsFromMpegTsClock)(ut,!0)+"/"+Object(c.toMsFromMpegTsClock)($,!0)+", delta: "+Object(c.toMsFromMpegTsClock)($e,!0)+" ms")}}a&&($=Math.max(0,$));for(var pt=0,at=0,Qe=0;Qe0?xe-1:xe].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var ue=Math.floor(ie.maxBufferHole*C),we=(_?ae+_*C:this.nextAudioPts)-ze.pts;we>ue?(W=we-oe,W<0&&(W=oe),E.logger.log("[mp4-remuxer]: It is approximately "+we/90+" ms to the next segment; using duration "+W/90+" ms for the last video frame.")):W=oe}else W=oe}var ke=Math.round(ze.pts-ze.dts);M.push(new b(ze.key,W,De,ke))}if(M.length&&g&&g<70){var Ze=M[0].flags;Ze.dependsOn=2,Ze.isNonSync=0}console.assert(W!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=Q=re+W,this.isVideoContiguous=!0;var bt=x.default.moof(d.sequenceNumber++,$,T({},d,{samples:M})),It="video",Ge={data1:bt,data2:Et,startPTS:ae/C,endPTS:(he+W)/C,startDTS:$/C,endDTS:Q/C,type:It,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:d.dropped};return d.samples=[],d.dropped=0,console.assert(Et.length,"MDAT length must not be zero"),Ge},S.remuxAudio=function(d,o,s,_,C){var y=d.inputTimeScale,M=d.samplerate?d.samplerate:y,B=y/M,F=d.isAAC?O:p,Q=F*B,V=this._initPTS,W=!d.isAAC&&this.typeSupported.mpeg,$=[],re=d.samples,ae=W?0:8,he=this.nextAudioPts||-1,Se=o*y;if(this.isAudioContiguous=s=s||re.length&&he>0&&(_&&Math.abs(Se-he)<9e3||Math.abs(h(re[0].pts-V,Se)-he)<20*Q),re.forEach(function(ce){ce.pts=h(ce.pts-V,Se)}),!s||he<0){if(re=re.filter(function(ce){return ce.pts>=0}),!re.length)return;C===0?he=0:_?he=Math.max(0,Se):he=re[0].pts}if(d.isAAC)for(var ye=C!==void 0,be=this.config.maxAudioFramesDrift,Oe=0,_e=he;Oe=be*Q&&ot0){at+=ae;try{pt=new Uint8Array(at)}catch(ce){this.observer.emit(U.Events.ERROR,U.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:at,reason:"fail allocating audio mdat "+at});return}if(!W){var Et=new DataView(pt.buffer);Et.setUint32(0,at),pt.set(x.default.types.mdat,4)}}else return;pt.set(xt,ae);var Te=xt.byteLength;ae+=Te,$.push(new b(!0,F,Te,0)),ut=yt}var xe=$.length;if(!xe)return;var ze=$[$.length-1];this.nextAudioPts=he=ut+B*ze.duration;var Ve=W?new Uint8Array(0):x.default.moof(d.sequenceNumber++,Ye/B,T({},d,{samples:$}));d.samples=[];var De=Ye/y,We=he/y,ge="audio",de={data1:Ve,data2:pt,startPTS:De,endPTS:We,startDTS:De,endDTS:We,type:ge,hasAudio:!0,hasVideo:!1,nb:xe};return this.isAudioContiguous=!0,console.assert(pt.length,"MDAT length must not be zero"),de},S.remuxEmptyAudio=function(d,o,s,_){var C=d.inputTimeScale,y=d.samplerate?d.samplerate:C,M=C/y,B=this.nextAudioPts,F=(B!==null?B:_.startDTS*C)+this._initDTS,Q=_.endDTS*C+this._initDTS,V=M*O,W=Math.ceil((Q-F)/V),$=I.default.getSilentFrame(d.manifestCodec||d.codec,d.channelCount);if(E.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){E.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var re=[],ae=0;ae4294967296;)D+=f;return D}function w(D){for(var S=0;S0?this.lastEndDTS=d:(U.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var o=!!D.audio,s=!!D.video,_="";o&&(_+="audio"),s&&(_+="video");var C={data1:b,startPTS:f,startDTS:f,endPTS:d,endDTS:d,type:_,hasAudio:o,hasVideo:s,nb:1,dropped:0};return w.audio=C.type==="audio"?C:void 0,w.video=C.type!=="audio"?C:void 0,w.text=i,w.id3=g,w.initSegment=v,w},c}(),E=function(T,P,O){return Object(I.getStartDTS)(T,P)-O};function L(c,T){var P=c==null?void 0:c.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||T===x.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=N},"./src/task-loop.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"default",function(){return H});var H=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var x=I.prototype;return x.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},x.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},x.onHandlerDestroyed=function(){},x.hasInterval=function(){return!!this._tickInterval},x.hasNextTick=function(){return!!this._tickTimer},x.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},x.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},x.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},x.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},x.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},x.doTick=function(){},I}()},"./src/types/cmcd.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"CMCDVersion",function(){return H}),R.d(K,"CMCDObjectType",function(){return I}),R.d(K,"CMCDStreamingFormat",function(){return x}),R.d(K,"CMCDStreamType",function(){return U});var H=1,I;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(I||(I={}));var x;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(x||(x={}));var U;(function(N){N.VOD="v",N.LIVE="l"})(U||(U={}))},"./src/types/level.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"HlsSkip",function(){return x}),R.d(K,"getSkipValue",function(){return U}),R.d(K,"HlsUrlParameters",function(){return N}),R.d(K,"Level",function(){return E});function H(L,c){for(var T=0;TNumber.MAX_SAFE_INTEGER?Infinity:c},N.hexadecimalInteger=function(L){if(this[L]){var c=(this[L]||"0x").slice(2);c=(c.length&1?"0":"")+c;for(var T=new Uint8Array(c.length/2),P=0;PNumber.MAX_SAFE_INTEGER?Infinity:c},N.decimalFloatingPoint=function(L){return parseFloat(this[L])},N.optionalFloat=function(L,c){var T=this[L];return T?parseFloat(T):c},N.enumeratedString=function(L){return this[L]},N.bool=function(L){return this[L]==="YES"},N.decimalResolution=function(L){var c=H.exec(this[L]);return c===null?void 0:{width:parseInt(c[1],10),height:parseInt(c[2],10)}},U.parseAttrList=function(L){var c,T={},P='"';for(I.lastIndex=0;(c=I.exec(L))!==null;){var O=c[2];O.indexOf(P)===0&&O.lastIndexOf(P)===O.length-1&&(O=O.slice(1,-1)),T[c[1]]=O}return T},U}()},"./src/utils/binary-search.ts":function(J,K,R){"use strict";R.r(K);var H={search:function(x,U){for(var N=0,E=x.length-1,L=null,c=null;N<=E;){L=(N+E)/2|0,c=x[L];var T=U(c);if(T>0)N=L+1;else if(T<0)E=L-1;else return c}return null}};K.default=H},"./src/utils/buffer-helper.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"BufferHelper",function(){return x});var H=R("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},x=function(){function U(){}return U.isBuffered=function(E,L){try{if(E){for(var c=U.getBuffered(E),T=0;T=c.start(T)&&L<=c.end(T))return!0}}catch(P){}return!1},U.bufferInfo=function(E,L,c){try{if(E){var T=U.getBuffered(E),P=[],O;for(O=0;Op&&(T[O-1].end=E[P].end):T.push(E[P])}else T.push(E[P])}else T=E;for(var g=0,i,a=L,u=L,h=0;h=w&&L=s&&H.logger.log(this.time+" ["+s+"] "+_)},f}(),g=function(d){for(var o=[],s=0;sN&&(this.logger.log(O.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},d.moveCursor=function(s){var _=this.pos+s;if(s>1)for(var C=this.pos+1;C<_+1;C++)this.chars[C].setPenState(this.currPenState);this.setCursor(_)},d.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},d.insertChar=function(s){s>=144&&this.backSpace();var _=x(s);if(this.pos>=N){this.logger.log(O.ERROR,"Cannot insert "+s.toString(16)+" ("+_+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(_,this.currPenState),this.moveCursor(1)},d.clearFromPos=function(s){var _;for(_=s;_0&&(s?C="["+_.join(" | ")+"]":C=_.join(` `)),C},d.getTextAndFormat=function(){return this.rows},f}(),w=function(){function f(o,s,_){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=o,this.outputFilter=s,this.mode=null,this.verbose=0,this.displayedMemory=new h(_),this.nonDisplayedMemory=new h(_),this.lastOutputScreen=new h(_),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=_}var d=f.prototype;return d.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[U-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},d.getHandler=function(){return this.outputFilter},d.setHandler=function(s){this.outputFilter=s},d.setPAC=function(s){this.writeScreen.setPAC(s)},d.setBkgData=function(s){this.writeScreen.setBkgData(s)},d.setMode=function(s){if(s===this.mode)return;this.mode=s,this.logger.log(O.INFO,"MODE="+s),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=s},d.insertChars=function(s){for(var _=0;_=46,_.italics)_.foreground="white";else{var C=Math.floor(s/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];_.foreground=y[C]}this.logger.log(O.INFO,"MIDROW: "+JSON.stringify(_)),this.writeScreen.setPen(_)},d.outputDataUpdate=function(s){s===void 0&&(s=!1);var _=this.logger.time;if(_===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=_:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,_,this.lastOutputScreen),s&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:_),this.lastOutputScreen.copy(this.displayedMemory))},d.cueSplitAtTime=function(s){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,s,this.displayedMemory),this.cueStartTime=s))},f}(),b=function(){function f(o,s,_){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var C=new p;this.channels=[null,new w(o,s,C),new w(o+1,_,C)],this.cmdHistory=S(),this.logger=C}var d=f.prototype;return d.getHandler=function(s){return this.channels[s].getHandler()},d.setHandler=function(s,_){this.channels[s].setHandler(_)},d.addData=function(s,_){var C,y,M,B=!1;this.logger.time=s;for(var F=0;F<_.length;F+=2){if(y=_[F]&127,M=_[F+1]&127,y===0&&M===0)continue;if(this.logger.log(O.DATA,"["+g([_[F],_[F+1]])+"] -> ("+g([y,M])+")"),C=this.parseCmd(y,M),C||(C=this.parseMidrow(y,M)),C||(C=this.parsePAC(y,M)),C||(C=this.parseBackgroundAttributes(y,M)),!C&&(B=this.parseChars(y,M),B)){var Q=this.currentChannel;if(Q&&Q>0){var V=this.channels[Q];V.insertChars(B)}else this.logger.log(O.WARNING,"No channel found yet. TEXT-MODE?")}!C&&!B&&this.logger.log(O.WARNING,"Couldn't parse cleaned data "+g([y,M])+" orig: "+g([_[F],_[F+1]]))}},d.parseCmd=function(s,_){var C=this.cmdHistory,y=(s===20||s===28||s===21||s===29)&&_>=32&&_<=47,M=(s===23||s===31)&&_>=33&&_<=35;if(!(y||M))return!1;if(D(s,_,C))return v(null,null,C),this.logger.log(O.DEBUG,"Repeated command ("+g([s,_])+") is dropped"),!0;var B=s===20||s===21||s===23?1:2,F=this.channels[B];return s===20||s===21||s===28||s===29?_===32?F.ccRCL():_===33?F.ccBS():_===34?F.ccAOF():_===35?F.ccAON():_===36?F.ccDER():_===37?F.ccRU(2):_===38?F.ccRU(3):_===39?F.ccRU(4):_===40?F.ccFON():_===41?F.ccRDC():_===42?F.ccTR():_===43?F.ccRTD():_===44?F.ccEDM():_===45?F.ccCR():_===46?F.ccENM():_===47&&F.ccEOC():F.ccTO(_-32),v(s,_,C),this.currentChannel=B,!0},d.parseMidrow=function(s,_){var C=0;if((s===17||s===25)&&_>=32&&_<=47){if(s===17?C=1:C=2,C!==this.currentChannel)return this.logger.log(O.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[C];return y?(y.ccMIDROW(_),this.logger.log(O.DEBUG,"MIDROW ("+g([s,_])+")"),!0):!1}return!1},d.parsePAC=function(s,_){var C,y=this.cmdHistory,M=(s>=17&&s<=23||s>=25&&s<=31)&&_>=64&&_<=127,B=(s===16||s===24)&&_>=64&&_<=95;if(!(M||B))return!1;if(D(s,_,y))return v(null,null,y),!0;var F=s<=23?1:2;_>=64&&_<=95?C=F===1?E[s]:c[s]:C=F===1?L[s]:T[s];var Q=this.channels[F];return Q?(Q.setPAC(this.interpretPAC(C,_)),v(s,_,y),this.currentChannel=F,!0):!1},d.interpretPAC=function(s,_){var C,y={color:null,italics:!1,indent:null,underline:!1,row:s};return _>95?C=_-96:C=_-64,y.underline=(C&1)===1,C<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(C/2)]:C<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((C-16)/2)*4,y},d.parseChars=function(s,_){var C,y=null,M=null;if(s>=25?(C=2,M=s-8):(C=1,M=s),M>=17&&M<=19){var B;M===17?B=_+80:M===18?B=_+112:B=_+144,this.logger.log(O.INFO,"Special char '"+x(B)+"' in channel "+C),y=[B]}else s>=32&&s<=127&&(y=_===0?[s]:[s,_]);if(y){var F=g(y);this.logger.log(O.DEBUG,"Char codes = "+F.join(",")),v(s,_,this.cmdHistory)}return y},d.parseBackgroundAttributes=function(s,_){var C=(s===16||s===24)&&_>=32&&_<=47,y=(s===23||s===31)&&_>=45&&_<=47;if(!(C||y))return!1;var M,B={};s===16||s===24?(M=Math.floor((_-32)/2),B.background=P[M],_%2===1&&(B.background=B.background+"_semi")):_===45?B.background="transparent":(B.foreground="black",_===47&&(B.underline=!0));var F=s<=23?1:2,Q=this.channels[F];return Q.setBkgData(B),v(s,_,this.cmdHistory),!0},d.reset=function(){for(var s=0;s=16?a--:a++;var v=Object(H.fixLineBreaks)(u.trim()),D=Object(I.generateCueId)(c,T,v);(!L||!L.cues||!L.cues.getCueById(D))&&(g=new h(c,T,v),g.id=D,g.line=w+1,g.align="left",g.position=10+Math.min(80,Math.floor(a*8/32)*10),O.push(g))}return L&&O.length&&(O.sort(function(S,f){return S.line==="auto"||f.line==="auto"?0:S.line>8&&f.line>8?f.line-S.line:S.line-f.line}),O.forEach(function(S){return Object(x.addCueToTrack)(L,S)})),O}};K.default=N},"./src/utils/discontinuities.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"findFirstFragWithCC",function(){return U}),R.d(K,"shouldAlignOnDiscontinuities",function(){return N}),R.d(K,"findDiscontinuousReferenceFrag",function(){return E}),R.d(K,"adjustSlidingStart",function(){return c}),R.d(K,"alignStream",function(){return T}),R.d(K,"alignPDT",function(){return O}),R.d(K,"alignFragmentByPDTDelta",function(){return p}),R.d(K,"alignMediaPlaylistByPDT",function(){return g});var H=R("./src/polyfills/number.ts"),I=R("./src/utils/logger.ts"),x=R("./src/controller/level-helper.ts");function U(i,a){for(var u=null,h=0,w=i.length;hu.startCC||i&&i.cc=this.minWeight_},U.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},U.destroy=function(){},x}();K.default=I},"./src/utils/ewma.ts":function(J,K,R){"use strict";R.r(K);var H=function(){function I(U,N,E){N===void 0&&(N=0),E===void 0&&(E=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=U,this.alpha_=U?Math.exp(Math.log(.5)/U):0,this.estimate_=N,this.totalWeight_=E}var x=I.prototype;return x.sample=function(N,E){var L=Math.pow(this.alpha_,N);this.estimate_=E*(1-L)+L*this.estimate_,this.totalWeight_+=N},x.getTotalWeight=function(){return this.totalWeight_},x.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},I}();K.default=H},"./src/utils/fetch-loader.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"fetchSupported",function(){return p});var H=R("./src/polyfills/number.ts"),I=R("./src/loader/load-stats.ts"),x=R("./src/demux/chunk-cache.ts");function U(h,w){h.prototype=Object.create(w.prototype),h.prototype.constructor=h,T(h,w)}function N(h){var w=typeof Map=="function"?new Map:void 0;return N=function(v){if(v===null||!c(v))return v;if(typeof v!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(v))return w.get(v);w.set(v,D)}function D(){return E(v,arguments,P(this).constructor)}return D.prototype=Object.create(v.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),T(D,v)},N(h)}function E(h,w,b){return L()?E=Reflect.construct:E=function(D,S,f){var d=[null];d.push.apply(d,S);var o=Function.bind.apply(D,d),s=new o;return f&&T(s,f.prototype),s},E.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(h){return!1}}function c(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function T(h,w){return T=Object.setPrototypeOf||function(v,D){return v.__proto__=D,v},T(h,w)}function P(h){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(b){return b.__proto__||Object.getPrototypeOf(b)},P(h)}function O(){return O=Object.assign||function(h){for(var w=1;w=f&&d(D,S,o.flush(),v)):d(D,S,M,v),C()}).catch(function(){return Promise.reject()})};return _()},h}();function i(h,w){var b={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(O({},h.headers))};return h.rangeEnd&&b.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),b}function a(h,w){return new self.Request(h.url,w)}var u=function(h){U(w,h);function w(b,v,D){var S;return S=h.call(this,b)||this,S.code=void 0,S.details=void 0,S.code=v,S.details=D,S}return w}(N(Error));K.default=g},"./src/utils/imsc1-ttml-parser.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"IMSC1_CODEC",function(){return c}),R.d(K,"parseIMSC1",function(){return p});var H=R("./src/utils/mp4-tools.ts"),I=R("./src/utils/vttparser.ts"),x=R("./src/utils/vttcue.ts"),U=R("./src/demux/id3.ts"),N=R("./src/utils/timescale-conversion.ts"),E=R("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(f){for(var d=1;d"):H}function N(c){for(var T=arguments.length,P=new Array(T>1?T-1:0),O=1;O>24,w[b+1]=v>>16&255,w[b+2]=v>>8&255,w[b+3]=v&255}function T(w,b){var v=[];if(!b.length)return v;var D,S,f;"data"in w?(D=w.data,S=w.start,f=w.end):(D=w,S=0,f=D.byteLength);for(var d=S;d1?d+o:f;if(s===b[0])if(b.length===1)v.push({data:D,start:d+8,end:_});else{var C=T({data:D,start:d+8,end:_},b.slice(1));C.length&&U.apply(v,C)}d=_}return v}function P(w){var b=T(w,["moov"]),v=b[0],D=v?v.end:null,S=T(w,["sidx"]);if(!S||!S[0])return null;var f=[],d=S[0],o=d.data[0],s=o===0?8:16,_=L(d,s);s+=4;var C=0,y=0;o===0?s+=8:s+=16,s+=2;var M=d.end+y,B=E(d,s);s+=2;for(var F=0;F>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var re=L(d,Q);Q+=4,f.push({referenceSize:W,subsegmentDuration:re,info:{duration:re/_,start:M,end:M+W-1}}),M+=W,Q+=4,s=Q}return{earliestPresentationTime:C,timescale:_,version:o,referencesCount:B,references:f,moovEndOffset:D}}function O(w){for(var b=[],v=T(w,["moov","trak"]),D=0;DN)&&(this.startTime=N),this.endTime=E,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},x.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"sendAddTrackEvent",function(){return I}),R.d(K,"addCueToTrack",function(){return x}),R.d(K,"clearCurrentCues",function(){return U}),R.d(K,"removeCuesInRange",function(){return N}),R.d(K,"getCuesInRange",function(){return L});var H=R("./src/utils/logger.ts");function I(c,T){var P;try{P=new Event("addtrack")}catch(O){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=c,T.dispatchEvent(P)}function x(c,T){var P=c.mode;if(P==="disabled"&&(c.mode="hidden"),c.cues&&!c.cues.getCueById(T.id))try{if(c.addCue(T),!c.cues.getCueById(T.id))throw new Error("addCue is failed for: "+T)}catch(p){H.logger.debug("[texttrack-utils]: "+p);var O=new self.TextTrackCue(T.startTime,T.endTime,T.text);O.id=T.id,c.addCue(O)}P==="disabled"&&(c.mode=P)}function U(c){var T=c.mode;if(T==="disabled"&&(c.mode="hidden"),c.cues)for(var P=c.cues.length;P--;)c.removeCue(c.cues[P]);T==="disabled"&&(c.mode=T)}function N(c,T,P){var O=c.mode;if(O==="disabled"&&(c.mode="hidden"),c.cues&&c.cues.length>0)for(var p=L(c.cues,T,P),g=0;gc[P].endTime)return-1;for(var O=0,p=P;O<=p;){var g=Math.floor((p+O)/2);if(Tc[g].startTime&&O-1)for(var g=p,i=c.length;g=T&&a.endTime<=P)O.push(a);else if(a.startTime>P)return O}return O}},"./src/utils/time-ranges.ts":function(J,K,R){"use strict";R.r(K);var H={toString:function(x){for(var U="",N=x.length,E=0;E1?T-1:0),O=1;O100)throw new Error("Position must be between 0 and 100.");f=C,this.hasBeenReset=!0}})),Object.defineProperty(O,"positionAlign",E({},p,{get:function(){return d},set:function(C){var y=N(C);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");d=y,this.hasBeenReset=!0}})),Object.defineProperty(O,"size",E({},p,{get:function(){return o},set:function(C){if(C<0||C>100)throw new Error("Size must be between 0 and 100.");o=C,this.hasBeenReset=!0}})),Object.defineProperty(O,"align",E({},p,{get:function(){return s},set:function(C){var y=N(C);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");s=y,this.hasBeenReset=!0}})),O.displayState=void 0}return L.prototype.getCueAsHTML=function(){var c=self.WebVTT;return c.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"parseTimeStamp",function(){return x}),R.d(K,"fixLineBreaks",function(){return T}),R.d(K,"VTTParser",function(){return P});var H=R("./src/utils/vttcue.ts"),I=function(){function O(){}var p=O.prototype;return p.decode=function(i,a){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))},O}();function x(O){function p(i,a,u,h){return(i|0)*3600+(a|0)*60+(u|0)+parseFloat(h||0)}var g=O.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return g?parseFloat(g[2])>59?p(g[2],g[3],0,g[4]):p(g[1],g[2],g[3],g[4]):null}var U=function(){function O(){this.values=Object.create(null)}var p=O.prototype;return p.set=function(i,a){!this.get(i)&&a!==""&&(this.values[i]=a)},p.get=function(i,a,u){return u?this.has(i)?this.values[i]:a[u]:this.has(i)?this.values[i]:a},p.has=function(i){return i in this.values},p.alt=function(i,a,u){for(var h=0;h=0&&u<=100)return this.set(i,u),!0}return!1},O}();function N(O,p,g,i){var a=i?O.split(i):[O];for(var u in a){if(typeof a[u]!="string")continue;var h=a[u].split(g);if(h.length!==2)continue;var w=h[0],b=h[1];p(w,b)}}var E=new H.default(0,0,""),L=E.align==="middle"?"middle":"center";function c(O,p,g){var i=O;function a(){var w=x(O);if(w===null)throw new Error("Malformed timestamp: "+i);return O=O.replace(/^[^\sa-zA-Z-]+/,""),w}function u(w,b){var v=new U;N(w,function(f,d){var o;switch(f){case"region":for(var s=g.length-1;s>=0;s--)if(g[s].id===d){v.set(f,g[s].region);break}break;case"vertical":v.alt(f,d,["rl","lr"]);break;case"line":o=d.split(","),v.integer(f,o[0]),v.percent(f,o[0])&&v.set("snapToLines",!1),v.alt(f,o[0],["auto"]),o.length===2&&v.alt("lineAlign",o[1],["start",L,"end"]);break;case"position":o=d.split(","),v.percent(f,o[0]),o.length===2&&v.alt("positionAlign",o[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":v.percent(f,d);break;case"align":v.alt(f,d,["start",L,"end","left","right"]);break}},/:/,/\s/),b.region=v.get("region",null),b.vertical=v.get("vertical","");var D=v.get("line","auto");D==="auto"&&E.line===-1&&(D=-1),b.line=D,b.lineAlign=v.get("lineAlign","start"),b.snapToLines=v.get("snapToLines",!0),b.size=v.get("size",100),b.align=v.get("align",L);var S=v.get("position","auto");S==="auto"&&E.position===50&&(S=b.align==="start"||b.align==="left"?0:b.align==="end"||b.align==="right"?100:50),b.position=S}function h(){O=O.replace(/^\s+/,"")}if(h(),p.startTime=a(),h(),O.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+i);O=O.substr(3),h(),p.endTime=a(),h(),u(O,p)}function T(O){return O.replace(//gi,` `)}var P=function(){function O(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var p=O.prototype;return p.parse=function(i){var a=this;i&&(a.buffer+=a.decoder.decode(i,{stream:!0}));function u(){var S=a.buffer,f=0;for(S=T(S);f")===-1){a.cue.id=w;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{c(w,a.cue,a.regionList)}catch(S){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=w.indexOf("-->")!==-1;if(!w||D&&(v=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=` `),a.cue.text+=w}continue;case"BADCUE":w||(a.state="ID")}}}catch(S){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},p.flush=function(){var i=this;try{if((i.cue||i.state==="HEADER")&&(i.buffer+=` `,i.parse()),i.state==="INITIAL"||i.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){i.onparsingerror&&i.onparsingerror(a)}return i.onflush&&i.onflush(),this},O}()},"./src/utils/webvtt-parser.ts":function(J,K,R){"use strict";R.r(K),R.d(K,"generateCueId",function(){return P}),R.d(K,"parseWebVTT",function(){return p});var H=R("./src/polyfills/number.ts"),I=R("./src/utils/vttparser.ts"),x=R("./src/demux/id3.ts"),U=R("./src/utils/timescale-conversion.ts"),N=R("./src/remux/mp4-remuxer.ts"),E=/\r\n|\n\r|\n|\r/g,L=function(i,a,u){return u===void 0&&(u=0),i.substr(u,a.length)===a},c=function(i){var a=parseInt(i.substr(-3)),u=parseInt(i.substr(-6,2)),h=parseInt(i.substr(-9,2)),w=i.length>9?parseInt(i.substr(0,i.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(a)||!Object(H.isFiniteNumber)(u)||!Object(H.isFiniteNumber)(h)||!Object(H.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+i);return a+=1e3*u,a+=60*1e3*h,a+=60*60*1e3*w,a},T=function(i){for(var a=5381,u=i.length;u;)a=a*33^i.charCodeAt(--u);return(a>>>0).toString()};function P(g,i,a){return T(g.toString())+T(i.toString())+T(a)}var O=function(i,a,u){var h=i[a],w=i[h.prevCC];if(!w||!w.new&&h.new){i.ccOffset=i.presentationOffset=h.start,h.new=!1;return}for(;(b=w)!==null&&b!==void 0&&b.new;){var b;i.ccOffset+=h.start-w.start,h.new=!1,h=w,w=i[h.prevCC]}i.presentationOffset=u};function p(g,i,a,u,h,w,b,v){var D=new I.VTTParser,S=Object(x.utf8ArrayToStr)(new Uint8Array(g)).trim().replace(E,` `).split(` `),f=[],d=Object(U.toMpegTsClockFromTimescale)(i,a),o="00:00.000",s=0,_=0,C,y=!0,M=!1;D.oncue=function(B){var F=u[h],Q=u.ccOffset,V=(s-d)/9e4;if(F!=null&&F.new&&(_!==void 0?Q=u.ccOffset=F.start:O(u,h,V)),V&&(Q=V-u.presentationOffset),M){var W=B.endTime-B.startTime,$=Object(N.normalizePts)((B.startTime+Q-_)*9e4,w*9e4)/9e4;B.startTime=$,B.endTime=$+W}var re=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(re)),B.id||(B.id=P(B.startTime,B.endTime,re)),B.endTime>0&&f.push(B)},D.onparsingerror=function(B){C=B},D.onflush=function(){if(C){v(C);return}b(f)},S.forEach(function(B){if(y)if(L(B,"X-TIMESTAMP-MAP=")){y=!1,M=!0,B.substr(16).split(",").forEach(function(F){L(F,"LOCAL:")?o=F.substr(6):L(F,"MPEGTS:")&&(s=parseInt(F.substr(7)))});try{_=c(o)/1e3}catch(F){M=!1,C=F}return}else B===""&&(y=!1);D.parse(B+` `)}),D.flush()}},"./src/utils/xhr-loader.ts":function(J,K,R){"use strict";R.r(K);var H=R("./src/utils/logger.ts"),I=R("./src/loader/load-stats.ts"),x=/^age:\s*[\d.]+\s*$/m,U=function(){function N(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 I.LoadStats,this.retryDelay=0}var E=N.prototype;return E.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},E.abortInternal=function(){var c=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),c&&(c.onreadystatechange=null,c.onprogress=null,c.readyState!==4&&(this.stats.aborted=!0,c.abort()))},E.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},E.load=function(c,T,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=c,this.config=T,this.callbacks=P,this.retryDelay=T.retryDelay,this.loadInternal()},E.loadInternal=function(){var c=this.config,T=this.context;if(!c)return;var P=this.loader=new self.XMLHttpRequest,O=this.stats;O.loading.first=0,O.loaded=0;var p=this.xhrSetup;try{if(p)try{p(P,T.url)}catch(a){P.open("GET",T.url,!0),p(P,T.url)}P.readyState||P.open("GET",T.url,!0);var g=this.context.headers;if(g)for(var i in g)P.setRequestHeader(i,g[i])}catch(a){this.callbacks.onError({code:P.status,text:a.message},T,P);return}T.rangeEnd&&P.setRequestHeader("Range","bytes="+T.rangeStart+"-"+(T.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=T.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),c.timeout),P.send()},E.readystatechange=function(){var c=this.context,T=this.loader,P=this.stats;if(!c||!T)return;var O=T.readyState,p=this.config;if(P.aborted)return;if(O>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),O===4){T.onreadystatechange=null,T.onprogress=null;var g=T.status;if(g>=200&&g<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var i,a;if(c.responseType==="arraybuffer"?(i=T.response,a=i.byteLength):(i=T.responseText,a=i.length),P.loaded=P.total=a,!this.callbacks)return;var u=this.callbacks.onProgress;if(u&&u(P,c,i,T),!this.callbacks)return;var h={url:T.responseURL,data:i};this.callbacks.onSuccess(h,P,c,T)}else P.retry>=p.maxRetry||g>=400&&g<499?(H.logger.error(g+" while loading "+c.url),this.callbacks.onError({code:g,text:T.statusText},c,T)):(H.logger.warn(g+" while loading "+c.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,p.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),p.timeout)},E.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var c=this.callbacks;c&&(this.abortInternal(),c.onTimeout(this.stats,this.context,this.loader))},E.loadprogress=function(c){var T=this.stats;T.loaded=c.loaded,c.lengthComputable&&(T.total=c.total)},E.getCacheAge=function(){var c=null;if(this.loader&&x.test(this.loader.getAllResponseHeaders())){var T=this.loader.getResponseHeader("age");c=T?parseFloat(T):null}return c},N}();K.default=U}}).default})},vHTk:function(Fe,Ce,j){Fe.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wCXF:function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return xt});var J=j("rePB"),K=j("VTBJ"),R=j("KQm4"),H=j("U8pU"),I=j("ODXe"),x=j("q1tI"),U=j("TSYQ"),N=j.n(U),E=j("Gytx"),L=j.n(E),c=j("Kwbf"),T=j("t23M"),P=j("qx4F"),O=j("6eGT"),p=j("IBYe"),g=j("Ff2n"),i=j("c+Xe"),a=j("fyJ8"),u=j("biw7");function h(Te,xe,ze,Ve,De){var We=ze[Te]||{},ge=ze[xe]||{},de,ce;We.fixed==="left"?de=Ve.left[Te]:ge.fixed==="right"&&(ce=Ve.right[xe]);var ne=!1,ie=!1,oe=!1,ue=!1,we=ze[xe+1],ke=ze[Te-1];if(De==="rtl"){if(de!==void 0){var Ze=ke&&ke.fixed==="left";ue=!Ze}else if(ce!==void 0){var bt=we&&we.fixed==="right";oe=!bt}}else if(de!==void 0){var It=we&&we.fixed==="left";ne=!It}else if(ce!==void 0){var Ge=ke&&ke.fixed==="right";ie=!Ge}return{fixLeft:de,fixRight:ce,lastFixLeft:ne,firstFixRight:ie,lastFixRight:oe,firstFixLeft:ue,isSticky:Ve.isSticky}}var w=j("sR1s");function b(Te){var xe=Te.cells,ze=Te.stickyOffsets,Ve=Te.flattenColumns,De=Te.rowComponent,We=Te.cellComponent,ge=Te.onHeaderRow,de=Te.index,ce=x.useContext(u.a),ne=ce.prefixCls,ie=ce.direction,oe;ge&&(oe=ge(xe.map(function(we){return we.column}),de));var ue=Object(w.a)(xe.map(function(we){return we.column}));return x.createElement(De,Object.assign({},oe),xe.map(function(we,ke){var Ze=we.column,bt=h(we.colStart,we.colEnd,Ve,ze,ie),It;return Ze&&Ze.onHeaderCell&&(It=we.column.onHeaderCell(Ze)),x.createElement(a.a,Object.assign({},we,{ellipsis:Ze.ellipsis,align:Ze.align,component:We,prefixCls:ne,key:ue[ke]},bt,{additionalProps:It,rowType:"header"}))}))}b.displayName="HeaderRow";var v=b;function D(Te){var xe=[];function ze(ge,de){var ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;xe[ce]=xe[ce]||[];var ne=de,ie=ge.filter(Boolean).map(function(oe){var ue={key:oe.key,className:oe.className||"",children:oe.title,column:oe,colStart:ne},we=1,ke=oe.children;return ke&&ke.length>0&&(we=ze(ke,ne,ce+1).reduce(function(Ze,bt){return Ze+bt},0),ue.hasSubColumns=!0),"colSpan"in oe&&(we=oe.colSpan),"rowSpan"in oe&&(ue.rowSpan=oe.rowSpan),ue.colSpan=we,ue.colEnd=ue.colStart+we-1,xe[ce].push(ue),ne+=we,we});return ie}ze(Te,0);for(var Ve=xe.length,De=function(de){xe[de].forEach(function(ce){!("rowSpan"in ce)&&!ce.hasSubColumns&&(ce.rowSpan=Ve-de)})},We=0;We=0;de-=1){var ce=xe[de],ne=ze&&ze[de],ie=ne&&ne[d.a];(ce||ie||ge)&&(De.unshift(x.createElement("col",Object.assign({key:de,style:{width:ce,minWidth:ce}},ie))),ge=!0)}return x.createElement("colgroup",null,De)}var s=o;function _(Te,xe){return Object(x.useMemo)(function(){for(var ze=[],Ve=0;Ve1?G-1:0),X=1;X=oe&&(Lt=oe-ue),ge({scrollLeft:Lt/oe*(ie+2)}),Ge.current.x=Ae.pageX},Ie=function(){var Ae=Object(pt.b)(We.current).top,tt=Ae+We.current.offsetHeight,mt=document.documentElement.scrollTop+window.innerHeight;tt-Object(P.a)()<=mt||Ae>=mt-de?It(function(gt){return Object(K.a)(Object(K.a)({},gt),{},{isHiddenScrollBar:!0})}):It(function(gt){return Object(K.a)(Object(K.a)({},gt),{},{isHiddenScrollBar:!1})})},dt=function(Ae){It(function(tt){return Object(K.a)(Object(K.a)({},tt),{},{scrollLeft:Ae/ie*oe||0})})};return x.useImperativeHandle(ze,function(){return{setScrollLeft:dt}}),x.useEffect(function(){var lt=Object(ut.a)(document.body,"mouseup",se,!1),Ae=Object(ut.a)(document.body,"mousemove",je,!1);return Ie(),function(){lt.remove(),Ae.remove()}},[ue,Ue]),x.useEffect(function(){var lt=Object(ut.a)(window,"scroll",Ie,!1),Ae=Object(ut.a)(window,"resize",Ie,!1);return function(){lt.remove(),Ae.remove()}},[]),x.useEffect(function(){bt.isHiddenScrollBar||It(function(lt){var Ae,tt;return Object(K.a)(Object(K.a)({},lt),{},{scrollLeft:We.current.scrollLeft/((Ae=We.current)===null||Ae===void 0?void 0:Ae.scrollWidth)*((tt=We.current)===null||tt===void 0?void 0:tt.clientWidth)})})},[bt.isHiddenScrollBar]),ie<=oe||!ue||bt.isHiddenScrollBar?null:x.createElement("div",{style:{height:Object(P.a)(),width:oe,bottom:de},className:"".concat(ne,"-sticky-scroll")},x.createElement("div",{onMouseDown:pe,ref:we,className:N()("".concat(ne,"-sticky-scroll-bar"),Object(J.a)({},"".concat(ne,"-sticky-scroll-bar-active"),Ue)),style:{width:"".concat(ue,"px"),transform:"translate3d(".concat(bt.scrollLeft,"px, 0, 0)")}}))},Qe=x.forwardRef(at);function rt(Te,xe){return x.useMemo(function(){var ze=!!Te;return{isSticky:ze,stickyClassName:ze?"".concat(xe,"-sticky-header"):"",offsetHeader:Object(H.a)(Te)==="object"&&Te.offsetHeader||0,offsetScroll:Object(H.a)(Te)==="object"&&Te.offsetScroll||0}},[Te,xe])}var Rt=[],Ct={},xt="rc-table-internal-hook",yt=x.memo(function(Te){var xe=Te.children;return xe},function(Te,xe){return L()(Te.props,xe.props)?Te.pingLeft!==xe.pingLeft||Te.pingRight!==xe.pingRight:!1});function wt(Te){var xe,ze=Te.prefixCls,Ve=Te.className,De=Te.rowClassName,We=Te.style,ge=Te.data,de=Te.rowKey,ce=Te.scroll,ne=Te.tableLayout,ie=Te.direction,oe=Te.title,ue=Te.footer,we=Te.summary,ke=Te.id,Ze=Te.showHeader,bt=Te.components,It=Te.emptyText,Ge=Te.onRow,it=Te.onHeaderRow,Be=Te.internalHooks,Ue=Te.transformColumns,Le=Te.internalRefs,se=Te.sticky,pe=ge||Rt,je=!!pe.length,Ie=x.useState(0),dt=Object(I.a)(Ie,2),lt=dt[0],Ae=dt[1];x.useEffect(function(){Ae(Object(P.a)())});var tt=x.useMemo(function(){return Object(w.c)(bt,{})},[bt]),mt=x.useCallback(function(jt,Qt){return Object(w.b)(tt,jt)||Qt},[tt]),gt=x.useMemo(function(){return typeof de=="function"?de:function(jt){var Qt=jt&&jt[de];return Qt}},[de]),Lt=Object(d.c)(Te),mn=Lt.expandIcon,hn=Lt.expandedRowKeys,en=Lt.defaultExpandedRowKeys,Dt=Lt.defaultExpandAllRows,xn=Lt.expandedRowRender,He=Lt.onExpand,ht=Lt.onExpandedRowsChange,St=Lt.expandRowByClick,Xt=Lt.rowExpandable,an=Lt.expandIconColumnIndex,un=Lt.expandedRowClassName,Je=Lt.childrenColumnName,ft=Lt.indentSize,kt=mn||Ke,vn=Je||"children",Gt=x.useMemo(function(){return xn?"row":Te.expandable&&Be===xt&&Te.expandable.__PARENT_RENDER_ICON__||pe.some(function(jt){return jt&&Object(H.a)(jt)==="object"&&jt[vn]})?"nest":!1},[!!xn,pe]),Zt=x.useState(function(){return en||(Dt?Ye(pe,gt,vn):[])}),z=Object(I.a)(Zt,2),m=z[0],A=z[1],G=x.useMemo(function(){return new Set(hn||m||[])},[hn,m]),ee=x.useCallback(function(jt){var Qt=gt(jt,pe.indexOf(jt)),Ht,In=G.has(Qt);In?(G.delete(Qt),Ht=Object(R.a)(G)):Ht=[].concat(Object(R.a)(G),[Qt]),A(Ht),He&&He(!In,jt),ht&&ht(Ht)},[gt,G,pe,He,ht]),X=x.useState(0),ve=Object(I.a)(X,2),Xe=ve[0],Me=ve[1],At=Object(be.b)(Object(K.a)(Object(K.a)(Object(K.a)({},Te),Lt),{},{expandable:!!xn,expandedKeys:G,getRowKey:gt,onTriggerExpand:ee,expandIcon:kt,expandIconColumnIndex:an,direction:ie}),Be===xt?Ue:null),qe=Object(I.a)(At,2),Bt=qe[0],Ft=qe[1],tn=x.useMemo(function(){return{columns:Bt,flattenColumns:Ft}},[Bt,Ft]),zn=x.useRef(),Wn=x.useRef(),$t=x.useRef(),yn=x.useState(!1),Mn=Object(I.a)(yn,2),bn=Mn[0],fn=Mn[1],Sn=x.useState(!1),Tn=Object(I.a)(Sn,2),Hn=Tn[0],Gn=Tn[1],er=fe(new Map),Dn=Object(I.a)(er,2),Or=Dn[0],on=Dn[1],Yn=Object(w.a)(Ft),Ar=Yn.map(function(jt){return Or.get(jt)}),yr=x.useMemo(function(){return Ar},[Ar.join("_")]),br=ot(yr,Ft.length,ie),pn=ce&&Object(w.d)(ce.y),nn=ce&&Object(w.d)(ce.x),Pn=nn&&Ft.some(function(jt){var Qt=jt.fixed;return Qt}),dn=x.useRef(),kn=rt(se,ze),gn=kn.isSticky,Er=kn.offsetHeader,Un=kn.offsetScroll,Bn=kn.stickyClassName,tr,cr,xr;pn&&(cr={overflowY:"scroll",maxHeight:ce.y}),nn&&(tr={overflowX:"auto"},pn||(cr={overflowY:"hidden"}),xr={width:ce.x===!0?"auto":ce.x,minWidth:"100%"});var Ur=x.useCallback(function(jt,Qt){on(function(Ht){var In=new Map(Ht);return In.set(jt,Qt),In})},[]),hr=le(null),Tr=Object(I.a)(hr,2),nr=Tr[0],Dr=Tr[1];function ir(jt,Qt){if(!Qt)return;typeof Qt=="function"?Qt(jt):Qt.scrollLeft!==jt&&(Qt.scrollLeft=jt)}var ar=function(Qt){var Ht=Qt.currentTarget,In=Qt.scrollLeft,Rr=typeof In=="number"?In:Ht.scrollLeft,Wr=Ht||Ct;if(!Dr()||Dr()===Wr){var Si;nr(Wr),ir(Rr,Wn.current),ir(Rr,$t.current),ir(Rr,(Si=dn.current)===null||Si===void 0?void 0:Si.setScrollLeft)}if(Ht){var Xi=Ht.scrollWidth,ga=Ht.clientWidth;fn(Rr>0),Gn(Rr0?[].concat(Object(K.a)(g),Object(K.a)(c(h).map(function(w){return Object(R.a)({fixed:u},w)}))):[].concat(Object(K.a)(g),[Object(R.a)(Object(R.a)({},i),{},{fixed:u})])},[])}function T(p){for(var g=!0,i=0;i=0;h-=1){var w=p[h];if(u&&w.fixed!=="right")u=!1;else if(!u&&w.fixed==="right"){Object(U.a)(!1,"Index ".concat(h+1," of `columns` missing `fixed='right'` prop."));break}}}function P(p){return p.map(function(g){var i=g.fixed,a=Object(H.a)(g,["fixed"]),u=i;return i==="left"?u="right":i==="right"&&(u="left"),Object(R.a)({fixed:u},a)})}function O(p,g){var i=p.prefixCls,a=p.columns,u=p.children,h=p.expandable,w=p.expandedKeys,b=p.getRowKey,v=p.onTriggerExpand,D=p.expandIcon,S=p.rowExpandable,f=p.expandIconColumnIndex,d=p.direction,o=p.expandRowByClick,s=I.useMemo(function(){return a||L(u)},[a,u]),_=I.useMemo(function(){if(h){var M,B=f||0,F=s[B],Q=(M={},Object(J.a)(M,E.a,{className:"".concat(i,"-expand-icon-col")}),Object(J.a)(M,"title",""),Object(J.a)(M,"fixed",F?F.fixed:null),Object(J.a)(M,"className","".concat(i,"-row-expand-icon-cell")),Object(J.a)(M,"render",function($,re,ae){var he=b(re,ae),Se=w.has(he),ye=S?S(re):!0,be=D({prefixCls:i,expanded:Se,expandable:ye,record:re,onExpand:v});return o?I.createElement("span",{onClick:function(_e){return _e.stopPropagation()}},be):be}),M),V=s.slice();return B>=0&&V.splice(B,0,Q),V}return s},[h,s,b,w,D,d]),C=I.useMemo(function(){var M=_;return g&&(M=g(M)),M.length||(M=[{render:function(){return null}}]),M},[g,_,d]),y=I.useMemo(function(){return d==="rtl"?P(c(C)):c(C)},[C,d]);return[C,y]}Ce.b=O},wU8J:function(Fe,Ce){function j(){this.buffer=new Array,this.length=0}j.prototype={get:function(J){var K=Math.floor(J/8);return(this.buffer[K]>>>7-J%8&1)==1},put:function(J,K){for(var R=0;R>>K-R-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(J){var K=Math.floor(this.length/8);this.buffer.length<=K&&this.buffer.push(0),J&&(this.buffer[K]|=128>>>this.length%8),this.length++}},Fe.exports=j},"y0+3":function(Fe,Ce,j){"use strict";j.d(Ce,"a",function(){return c}),j.d(Ce,"b",function(){return P});var J=/margin|padding|width|height|max|min|offset/,K={left:!0,top:!0},R={cssFloat:1,styleFloat:1,float:1};function H(O){return O.nodeType===1?O.ownerDocument.defaultView.getComputedStyle(O,null):{}}function I(O,p,g){if(p=p.toLowerCase(),g==="auto"){if(p==="height")return O.offsetHeight;if(p==="width")return O.offsetWidth}return p in K||(K[p]=J.test(p)),K[p]?parseFloat(g)||0:g}function x(O,p){var g=arguments.length,i=H(O);return p=R[p]?"cssFloat"in O.style?"cssFloat":"styleFloat":p,g===1?i:I(O,p,i[p]||O.style[p])}function U(O,p,g){var i=arguments.length;if(p=R[p]?"cssFloat"in O.style?"cssFloat":"styleFloat":p,i===3)return typeof g=="number"&&J.test(p)&&(g="".concat(g,"px")),O.style[p]=g,g;for(var a in p)p.hasOwnProperty(a)&&U(O,a,p[a]);return H(O)}function N(O){return O===document.body?document.documentElement.clientWidth:O.offsetWidth}function E(O){return O===document.body?window.innerHeight||document.documentElement.clientHeight:O.offsetHeight}function L(){var O=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),p=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);return{width:O,height:p}}function c(){var O=document.documentElement.clientWidth,p=window.innerHeight||document.documentElement.clientHeight;return{width:O,height:p}}function T(){return{scrollLeft:Math.max(document.documentElement.scrollLeft,document.body.scrollLeft),scrollTop:Math.max(document.documentElement.scrollTop,document.body.scrollTop)}}function P(O){var p=O.getBoundingClientRect(),g=document.documentElement;return{left:p.left+(window.pageXOffset||g.scrollLeft)-(g.clientLeft||document.body.clientLeft||0),top:p.top+(window.pageYOffset||g.scrollTop)-(g.clientTop||document.body.clientTop||0)}}},ynwM:function(Fe,Ce,j){var J=j("MFOe"),K=J.Global;Fe.exports={name:"oldFF-globalStorage",read:H,write:I,each:x,remove:U,clearAll:N};var R=K.globalStorage;function H(E){return R[E]}function I(E,L){R[E]=L}function x(E){for(var L=R.length-1;L>=0;L--){var c=R.key(L);E(R[c],c)}}function U(E){return R.removeItem(E)}function N(){x(function(E,L){delete R[E]})}}}]);