!(function(){var $s=Math.pow;var Za=(It,Ue,Q)=>new Promise((he,fe)=>{var i=p=>{try{E(Q.next(p))}catch(g){fe(g)}},M=p=>{try{E(Q.throw(p))}catch(g){fe(g)}},E=p=>p.done?he(p.value):Promise.resolve(p.value).then(i,M);E((Q=Q.apply(It,Ue)).next())});(self.webpackChunk=self.webpackChunk||[]).push([[3178],{55304:function(It,Ue,Q){"use strict";Q.d(Ue,{Z:function(){return g}});var he=Q(87462),fe=Q(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z"}}]},name:"exclamation-circle",theme:"outlined"},M=i,E=Q(84089),p=function(h,v){return fe.createElement(E.Z,(0,he.Z)({},h,{ref:v,icon:M}))},g=fe.forwardRef(p)},38308:function(It,Ue,Q){"use strict";Q.d(Ue,{Z:function(){return g}});var he=Q(87462),fe=Q(67294),i={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},M=i,E=Q(84089),p=function(h,v){return fe.createElement(E.Z,(0,he.Z)({},h,{ref:v,icon:M}))},g=fe.forwardRef(p)},71749:function(){"use strict"},30483:function(){"use strict"},56448:function(It){(function(Ue){(function(Q){if(1)It.exports=Q();else var he})(function(){var Q,he,fe;return function(){function i(M,E,p){function g(v,d){if(!E[v]){if(!M[v]){var o=void 0;if(!d&&o)return require(v,!0);if(l)return l(v,!0);var s=new Error("Cannot find module '"+v+"'");throw s.code="MODULE_NOT_FOUND",s}var u=E[v]={exports:{}};M[v][0].call(u.exports,function(m){var y=M[v][1][m];return g(y||m)},u,u.exports,i,M,E,p)}return E[v].exports}for(var l=void 0,h=0;h
=3&&(_=y),g.call(u)==="[object Array]"?h(u,m,_):typeof u=="string"?v(u,m,_):d(u,m,_)};M.exports=o},{"is-callable":367}],346:[function(i,M,E){"use strict";var p="Function.prototype.bind called on incompatible ",g=Array.prototype.slice,l=Object.prototype.toString,h="[object Function]";M.exports=function(d){var o=this;if(typeof o!="function"||l.call(o)!==h)throw new TypeError(p+o);for(var s=g.call(arguments,1),u,m=function(){if(this instanceof u){var w=o.apply(this,s.concat(g.call(arguments)));return Object(w)===w?w:this}else return o.apply(d,s.concat(g.call(arguments)))},y=Math.max(0,o.length-s.length),_=[],x=0;x>1,y=-7,_=l?v-1:0,x=l?-1:1,S=p[g+_];for(_+=x,d=S&(1<<-y)-1,S>>=-y,y+=s;y>0;d=d*256+p[g+_],_+=x,y-=8);for(o=d&(1<<-y)-1,d>>=-y,y+=h;y>0;o=o*256+p[g+_],_+=x,y-=8);if(d===0)d=1-m;else{if(d===u)return o?NaN:(S?-1:1)*(1/0);o=o+Math.pow(2,h),d=d-m}return(S?-1:1)*o*Math.pow(2,d-h)},E.write=function(p,g,l,h,v,d){var o,s,u,m=d*8-v-1,y=(1<1)for(var A=1;AB(o/z)&&G("overflow"),T*=z;be=Le.length+1,Be=ye(Te-te,be,te==0),B(Te/be)>o-Ae&&G("overflow"),Ae+=B(Te/be),Te%=be,Le.splice(Te++,0,Ae)}return $(Le)}function le(we){var Le,de,be,Te,Ae,Be,Pe,_e,ne,te,T,I=[],re,q,z,W;for(we=Z(we),re=we.length,Le=S,de=0,Ae=x,Be=0;Be
-1?l:h.nextTick,s;D.WritableState=R;var u=Object.create(i("core-util-is"));u.inherits=i("inherits");var m={deprecate:i("util-deprecate")},y=i("./internal/streams/stream"),_=i("safe-buffer").Buffer,x=g.Uint8Array||function(){};function S(de){return _.from(de)}function w(de){return _.isBuffer(de)||de instanceof x}var A=i("./internal/streams/destroy");u.inherits(D,y);function H(){}function R(de,be){s=s||i("./_stream_duplex"),de=de||{};var Te=be instanceof s;this.objectMode=!!de.objectMode,Te&&(this.objectMode=this.objectMode||!!de.writableObjectMode);var Ae=de.highWaterMark,Be=de.writableHighWaterMark,Pe=this.objectMode?16:16*1024;Ae||Ae===0?this.highWaterMark=Ae:Te&&(Be||Be===0)?this.highWaterMark=Be:this.highWaterMark=Pe,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var _e=de.decodeStrings===!1;this.decodeStrings=!_e,this.defaultEncoding=de.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ne){$(be,ne)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new d(this)}R.prototype.getBuffer=function(){for(var be=this.bufferedRequest,Te=[];be;)Te.push(be),be=be.next;return Te},function(){try{Object.defineProperty(R.prototype,"buffer",{get:m.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(de){}}();var F;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(F=Function.prototype[Symbol.hasInstance],Object.defineProperty(D,Symbol.hasInstance,{value:function(de){return F.call(this,de)?!0:this!==D?!1:de&&de._writableState instanceof R}})):F=function(de){return de instanceof this};function D(de){if(s=s||i("./_stream_duplex"),!F.call(D,this)&&!(this instanceof s))return new D(de);this._writableState=new R(de,this),this.writable=!0,de&&(typeof de.write=="function"&&(this._write=de.write),typeof de.writev=="function"&&(this._writev=de.writev),typeof de.destroy=="function"&&(this._destroy=de.destroy),typeof de.final=="function"&&(this._final=de.final)),y.call(this)}D.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function B(de,be){var Te=new Error("write after end");de.emit("error",Te),h.nextTick(be,Te)}function P(de,be,Te,Ae){var Be=!0,Pe=!1;return Te===null?Pe=new TypeError("May not write null values to stream"):typeof Te!="string"&&Te!==void 0&&!be.objectMode&&(Pe=new TypeError("Invalid non-string/buffer chunk")),Pe&&(de.emit("error",Pe),h.nextTick(Ae,Pe),Be=!1),Be}D.prototype.write=function(de,be,Te){var Ae=this._writableState,Be=!1,Pe=!Ae.objectMode&&w(de);return Pe&&!_.isBuffer(de)&&(de=S(de)),typeof be=="function"&&(Te=be,be=null),Pe?be="buffer":be||(be=Ae.defaultEncoding),typeof Te!="function"&&(Te=H),Ae.ended?B(this,Te):(Pe||P(this,Ae,de,Te))&&(Ae.pendingcb++,Be=G(this,Ae,Pe,de,be,Te)),Be},D.prototype.cork=function(){var de=this._writableState;de.corked++},D.prototype.uncork=function(){var de=this._writableState;de.corked&&(de.corked--,!de.writing&&!de.corked&&!de.finished&&!de.bufferProcessing&&de.bufferedRequest&&ye(this,de))},D.prototype.setDefaultEncoding=function(be){if(typeof be=="string"&&(be=be.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((be+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+be);return this._writableState.defaultEncoding=be,this};function U(de,be,Te){return!de.objectMode&&de.decodeStrings!==!1&&typeof be=="string"&&(be=_.from(be,Te)),be}Object.defineProperty(D.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function G(de,be,Te,Ae,Be,Pe){if(!Te){var _e=U(be,Ae,Be);Ae!==_e&&(Te=!0,Be="buffer",Ae=_e)}var ne=be.objectMode?1:Ae.length;be.length+=ne;var te=be.length
0;return s(F,B,P,function(U){H||(H=U),U&&R.forEach(u),!B&&(R.forEach(u),A(H))})});return S.reduce(m)}M.exports=_},{"../../../errors":399,"./end-of-stream":408}],411:[function(i,M,E){"use strict";var p=i("../../../errors").codes.ERR_INVALID_OPT_VALUE;function g(h,v,d){return h.highWaterMark!=null?h.highWaterMark:v?h[d]:null}function l(h,v,d,o){var s=g(v,o,d);if(s!=null){if(!(isFinite(s)&&Math.floor(s)===s)||s<0){var u=o?d:"highWaterMark";throw new p(u,s)}return Math.floor(s)}return h.objectMode?16:16*1024}M.exports={getHighWaterMark:l}},{"../../../errors":399}],412:[function(i,M,E){arguments[4][393][0].apply(E,arguments)},{dup:393,events:344}],413:[function(i,M,E){"use strict";var p=i("safe-buffer").Buffer,g=p.isEncoding||function(R){switch(R=""+R,R&&R.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function l(R){if(!R)return"utf8";for(var F;;)switch(R){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return R;default:if(F)return;R=(""+R).toLowerCase(),F=!0}}function h(R){var F=l(R);if(typeof F!="string"&&(p.isEncoding===g||!g(R)))throw new Error("Unknown encoding: "+R);return F||R}E.StringDecoder=v;function v(R){this.encoding=h(R);var F;switch(this.encoding){case"utf16le":this.text=_,this.end=x,F=4;break;case"utf8":this.fillLast=u,F=4;break;case"base64":this.text=S,this.end=w,F=3;break;default:this.write=A,this.end=H;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=p.allocUnsafe(F)}v.prototype.write=function(R){if(R.length===0)return"";var F,D;if(this.lastNeed){if(F=this.fillLast(R),F===void 0)return"";D=this.lastNeed,this.lastNeed=0}else D=0;return D"),this.stream.write(this.endline(u,m,y)),m.state=g.None,this.closeNode(u,m,y)},s.prototype.element=function(u,m,y){var _,x,S,w,A,H,R,F,D,B;y||(y=0),this.openNode(u,m,y),m.state=g.OpenTag,this.stream.write(this.indent(u,m,y)+"<"+u.name),D=u.attribs;for(R in D)d.call(D,R)&&(_=D[R],this.attribute(_,m,y));if(S=u.children.length,w=S===0?null:u.children[0],S===0||u.children.every(function(P){return(P.type===p.Text||P.type===p.Raw)&&P.value===""}))m.allowEmpty?(this.stream.write(">"),m.state=g.CloseTag,this.stream.write(""+u.name+">")):(m.state=g.CloseTag,this.stream.write(m.spaceBeforeSlash+"/>"));else if(m.pretty&&S===1&&(w.type===p.Text||w.type===p.Raw)&&w.value!=null)this.stream.write(">"),m.state=g.InsideTag,m.suppressPrettyCount++,F=!0,this.writeChildNode(w,m,y+1),m.suppressPrettyCount--,F=!1,m.state=g.CloseTag,this.stream.write(""+u.name+">");else{for(this.stream.write(">"+this.endline(u,m,y)),m.state=g.InsideTag,B=u.children,A=0,H=B.length;A
',"select"),this.addActionButton(re,'',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(re,'',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(re,'',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(re,'',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(re,'',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(re,'',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(re,'',"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(z){var W=document.createElement("div");W.className=""+I.toolbarButtonStyleClass.name,W.setAttribute("data-type-name",z.typeName),W.innerHTML=z.icon,W.addEventListener("click",function(){I.markerToolbarButtonClicked(W,z)}),I.buttons.push(W),I.markerButtons.push(W)}),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 q=document.createElement("div");q.className=this.toolbarBlockStyleClass.name,q.style.whiteSpace="nowrap",q.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(q),this.addActionButton(q,'',"render"),this.addActionButton(q,'',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},te.prototype.addButtonClickListener=function(T){this.buttonClickListeners.push(T)},te.prototype.removeButtonClickListener=function(T){this.buttonClickListeners.indexOf(T)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(T),1)},te.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},te.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var T=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var I=0;I 0&&this.buttonClickListeners.forEach(function(re){return re("marker",I)}),this.markerButtonOverflowBlock.style.display="none"},te.prototype.actionToolbarButtonClicked=function(T,I){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(re){return re("action",I)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},te.prototype.setActiveButton=function(T){this.resetButtonStyles(),T.className=T.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),T.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},te.prototype.setActiveMarkerButton=function(T){var I=this.markerButtons.find(function(re){return re.getAttribute("data-type-name")===T});I&&this.setActiveButton(I)},te.prototype.setCurrentMarker=function(T){var I=this;this.currentMarker=T,this.buttons.filter(function(re){return/delete|notes/.test(re.getAttribute("data-action"))}).forEach(function(re){I.currentMarker===void 0?(re.style.fillOpacity="0.4",re.style.pointerEvents="none"):(re.style.fillOpacity="1",re.style.pointerEvents="all")})},te}(),u=function(){function te(T,I,re,q){this.panels=[],this.panelButtons=[],this.markerjsContainer=T,this.displayMode=I,this.uiStyleSettings=re,this.styles=q,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return te.prototype.addStyles=function(){var T;this.toolboxStyleClass=this.styles.addClass(new o("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 o("toolbox_colors",` color: `+this.uiStyleSettings.toolboxColor+`; `));var I=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new o("toolbox-button-row",` display: flex; cursor: default; box-sizing: content-box; `)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new o("toolbox-button-row_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`; `)),this.toolboxPanelRowStyleClass=this.styles.addClass(new o("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 o("toolbox-panel-row_colors",` background-color: `+((T=this.uiStyleSettings.toolboxBackgroundColor)!==null&&T!==void 0?T:this.uiStyleSettings.toolbarBackgroundHoverColor)+`; `)),this.toolboxButtonStyleClass=this.styles.addClass(new o("toolbox_button",` display: inline-block; width: `+(this.uiStyleSettings.toolbarHeight-2*I)+`px; height: `+(this.uiStyleSettings.toolbarHeight-2*I)+`px; padding: `+I+`px; box-sizing: content-box; `)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new o("toolbox-button_colors",` fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new o("toolbox-active-button_colors",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`; fill: `+this.uiStyleSettings.toolbarColor+`; `)),this.styles.addRule(new d("."+this.toolboxButtonStyleColorsClass.name+":hover",` background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+` `)),this.styles.addRule(new d("."+this.toolboxButtonStyleClass.name+" svg",` height: `+this.uiStyleSettings.toolbarHeight/2+`px; `))},te.prototype.show=function(T){var I;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=T,this.uiContainer.className=this.toolboxStyleClass.name+" "+((I=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&I!==void 0?I:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},te.prototype.setPanelButtons=function(T){var I,re,q=this;this.panels=T,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((I=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&I!==void 0?I:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((re=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&re!==void 0?re:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(z){var W;z.uiStyleSettings=q.uiStyleSettings;var V=document.createElement("div");V.className=q.toolboxButtonStyleClass.name+" "+((W=q.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&W!==void 0?W:q.toolboxButtonStyleColorsClass.name),V.innerHTML=z.icon,V.title=z.title,V.addEventListener("click",function(){q.panelButtonClick(z)}),q.panelButtons.push(V),q.buttonRow.appendChild(V)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},te.prototype.panelButtonClick=function(T){var I=this,re=-1;if(T!==this.activePanel){re=this.panels.indexOf(T),this.panelRow.innerHTML="";var q=T.getUi();q.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(q),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=T}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){I.displayMode==="inline"?I.panelRow.style.display="none":I.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(z,W){var V,se;z.className=I.toolboxButtonStyleClass.name+" "+(W===re?""+((V=I.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&V!==void 0?V:I.toolboxActiveButtonStyleColorsClass.name):""+((se=I.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&se!==void 0?se:I.toolboxButtonStyleColorsClass.name))})},te}(),m=function(te,T){this.title=te,this.icon=T},y=function(te){function T(I,re,q,z){var W=te.call(this,I,z||'')||this;return W.colors=[],W.addTransparent=!1,W.colorBoxes=[],W.colors=re,W.currentColor=q,W.setCurrentColor=W.setCurrentColor.bind(W),W.getColorBox=W.getColorBox.bind(W),W}return fe(T,te),T.prototype.getUi=function(){var I=this,re=document.createElement("div");return re.style.overflow="hidden",re.style.whiteSpace="nowrap",this.colors.forEach(function(q){var z=I.getColorBox(q);re.appendChild(z),I.colorBoxes.push(z)}),re},T.prototype.getColorBox=function(I){var re=this,q=this.uiStyleSettings.toolbarHeight/4,z=this.uiStyleSettings.toolbarHeight-q,W=document.createElement("div");W.style.display="inline-block",W.style.boxSizing="content-box",W.style.width=z-2+"px",W.style.height=z-2+"px",W.style.padding="1px",W.style.marginRight="2px",W.style.marginBottom="2px",W.style.borderWidth="2px",W.style.borderStyle="solid",W.style.borderRadius=(z+2)/2+"px",W.style.borderColor=I===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",W.addEventListener("click",function(){re.setCurrentColor(I,W)});var V=document.createElement("div");return V.style.display="inline-block",V.style.width=z-2+"px",V.style.height=z-2+"px",V.style.backgroundColor=I,V.style.borderRadius=z/2+"px",I==="transparent"&&(V.style.fill=this.uiStyleSettings.toolboxAccentColor,V.innerHTML=``),W.appendChild(V),W},T.prototype.setCurrentColor=function(I,re){var q=this;this.currentColor=I,this.colorBoxes.forEach(function(z){z.style.borderColor=z===re?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(I)},T}(m),_=function(){function te(T,I,re){this._state="new",this._isSelected=!1,this._container=T,this._overlayContainer=I,this.globalSettings=re,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(te.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),te.prototype.ownsTarget=function(T){return!1},Object.defineProperty(te.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),te.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},te.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},te.prototype.pointerDown=function(T,I){},te.prototype.dblClick=function(T,I){},te.prototype.manipulate=function(T){},te.prototype.pointerUp=function(T){this.stateChanged()},te.prototype.dispose=function(){},te.prototype.addMarkerVisualToContainer=function(T){this.container.childNodes.length>0?this.container.insertBefore(T,this.container.childNodes[0]):this.container.appendChild(T)},te.prototype.getState=function(){return{typeName:te.typeName,state:this.state,notes:this.notes}},te.prototype.restoreState=function(T){this._state=T.state,this.notes=T.notes},te.prototype.scale=function(T,I){},te.prototype.colorChanged=function(T){this.onColorChanged&&this.onColorChanged(T),this.stateChanged()},te.prototype.fillColorChanged=function(T){this.onFillColorChanged&&this.onFillColorChanged(T),this.stateChanged()},te.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var T=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),T.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(T)&&this.onStateChanged(this)}},te.typeName="MarkerBase",te}(),x=function(){function te(){this.findGripByVisual=this.findGripByVisual.bind(this)}return te.prototype.findGripByVisual=function(T){return this.topLeft.ownsTarget(T)?this.topLeft:this.topCenter.ownsTarget(T)?this.topCenter:this.topRight.ownsTarget(T)?this.topRight:this.centerLeft.ownsTarget(T)?this.centerLeft:this.centerRight.ownsTarget(T)?this.centerRight:this.bottomLeft.ownsTarget(T)?this.bottomLeft:this.bottomCenter.ownsTarget(T)?this.bottomCenter:this.bottomRight.ownsTarget(T)?this.bottomRight:void 0},te}(),S=function(){function te(){this.GRIP_SIZE=10,this.visual=p.createGroup(),this.visual.appendChild(p.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(p.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return te.prototype.ownsTarget=function(T){return T===this.visual||T===this.visual.childNodes[0]||T===this.visual.childNodes[1]},te}(),w=function(){function te(){}return te.toITransformMatrix=function(T){return{a:T.a,b:T.b,c:T.c,d:T.d,e:T.e,f:T.f}},te.toSVGMatrix=function(T,I){return T.a=I.a,T.b=I.b,T.c=I.c,T.d=I.d,T.e=I.e,T.f=I.f,T},te}(),A=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.left=0,z.top=0,z.width=0,z.height=0,z.defaultSize={x:50,y:20},z.offsetX=0,z.offsetY=0,z.rotationAngle=0,z.CB_DISTANCE=10,z._suppressMarkerCreateEvent=!1,z.container.transform.baseVal.appendItem(p.createTransform()),z.setupControlBox(),z}return fe(T,te),Object.defineProperty(T.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"visual",{get:function(){return this._visual},set:function(I){this._visual=I;var re=p.createTransform();this._visual.transform.baseVal.appendItem(re)},enumerable:!1,configurable:!0}),T.prototype.ownsTarget=function(I){return!!te.prototype.ownsTarget.call(this,I)||!!(this.controlGrips.findGripByVisual(I)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(I))},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.state==="new"&&(this.left=I.x,this.top=I.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var q=this.unrotatePoint(I);if(this.manipulationStartX=q.x,this.manipulationStartY=q.y,this.offsetX=q.x-this.left,this.offsetY=q.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(re),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(re)){this.activeGrip=this.rotatorGrip;var z=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=z.x-this.width/2,this.top=z.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var W=this.container.transform.baseVal.getItem(0);W.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(W,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},T.prototype.pointerUp=function(I){var re=this.state;te.prototype.pointerUp.call(this,I),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(I),this._state="select",re==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},T.prototype.moveVisual=function(I){this.visual.style.transform="translate("+I.x+"px, "+I.y+"px)"},T.prototype.manipulate=function(I){var re=this.unrotatePoint(I);this.state==="creating"?this.resize(I):this.state==="move"?(this.left=this.manipulationStartLeft+(re.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(re.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(re):this.state==="rotate"&&this.rotate(I)},T.prototype.resize=function(I){var re=this.manipulationStartLeft,q=this.manipulationStartWidth,z=this.manipulationStartTop,W=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:re=this.manipulationStartLeft+I.x-this.manipulationStartX,q=this.manipulationStartWidth+this.manipulationStartLeft-re;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:q=this.manipulationStartWidth+I.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:z=this.manipulationStartTop+I.y-this.manipulationStartY,W=this.manipulationStartHeight+this.manipulationStartTop-z;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:W=this.manipulationStartHeight+I.y-this.manipulationStartY}q>=0?(this.left=re,this.width=q):(this.left=re+q,this.width=-q),W>=0?(this.top=z,this.height=W):(this.top=z+W,this.height=-W),this.setSize()},T.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},T.prototype.rotate=function(I){if(Math.abs(I.x-this.centerX)>.1){var re=Math.sign(I.x-this.centerX);this.rotationAngle=180*Math.atan((I.y-this.centerY)/(I.x-this.centerX))/Math.PI+90*re,this.applyRotation()}},T.prototype.applyRotation=function(){var I=this.container.transform.baseVal.getItem(0);I.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(I,0)},T.prototype.rotatePoint=function(I){if(this.rotationAngle===0)return I;var re=this.container.getCTM(),q=p.createPoint(I.x,I.y);return{x:(q=q.matrixTransform(re)).x,y:q.y}},T.prototype.unrotatePoint=function(I){if(this.rotationAngle===0)return I;var re=this.container.getCTM();re=re.inverse();var q=p.createPoint(I.x,I.y);return{x:(q=q.matrixTransform(re)).x,y:q.y}},T.prototype.select=function(){te.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},T.prototype.deselect=function(){te.prototype.deselect.call(this),this.controlBox.style.display="none"},T.prototype.setupControlBox=function(){this.controlBox=p.createGroup();var I=p.createTransform();I.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(I),this.container.appendChild(this.controlBox),this.controlRect=p.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=p.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 x,this.addControlGrips(),this.controlBox.style.display="none"},T.prototype.adjustControlBox=function(){var I=this.controlBox.transform.baseVal.getItem(0);I.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(I,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()},T.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()},T.prototype.createGrip=function(){var I=new S;return I.visual.transform.baseVal.appendItem(p.createTransform()),this.controlBox.appendChild(I.visual),I},T.prototype.positionGrips=function(){var I=this.controlGrips.topLeft.GRIP_SIZE,re=-I/2,q=re,z=(this.width+this.CB_DISTANCE)/2-I/2,W=(this.height+this.CB_DISTANCE)/2-I/2,V=this.height+this.CB_DISTANCE-I/2,se=this.width+this.CB_DISTANCE-I/2;this.positionGrip(this.controlGrips.topLeft.visual,re,q),this.positionGrip(this.controlGrips.topCenter.visual,z,q),this.positionGrip(this.controlGrips.topRight.visual,se,q),this.positionGrip(this.controlGrips.centerLeft.visual,re,W),this.positionGrip(this.controlGrips.centerRight.visual,se,W),this.positionGrip(this.controlGrips.bottomLeft.visual,re,V),this.positionGrip(this.controlGrips.bottomCenter.visual,z,V),this.positionGrip(this.controlGrips.bottomRight.visual,se,V),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,z,q-3*this.CB_DISTANCE)},T.prototype.positionGrip=function(I,re,q){var z=I.transform.baseVal.getItem(0);z.setTranslate(re,q),I.transform.baseVal.replaceItem(z,0)},T.prototype.hideControlBox=function(){this.controlBox.style.display="none"},T.prototype.showControlBox=function(){this.controlBox.style.display=""},T.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:w.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:w.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},te.prototype.getState.call(this))},T.prototype.restoreState=function(I){te.prototype.restoreState.call(this,I);var re=I;this.left=re.left,this.top=re.top,this.width=re.width,this.height=re.height,this.rotationAngle=re.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(w.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,re.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(w.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,re.containerTransformMatrix))},T.prototype.scale=function(I,re){te.prototype.scale.call(this,I,re);var q=this.rotatePoint({x:this.left,y:this.top}),z=this.unrotatePoint({x:q.x*I,y:q.y*re});this.left=z.x,this.top=z.y,this.width=this.width*I,this.height=this.height*re,this.adjustControlBox()},T}(_),H=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.createVisual=z.createVisual.bind(z),z}return fe(T,te),T.prototype.ownsTarget=function(I){return!(!te.prototype.ownsTarget.call(this,I)&&I!==this.visual)},T.prototype.createVisual=function(){this.visual=p.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)},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.state==="new"&&(this.createVisual(),this.moveVisual(I),this._state="creating")},T.prototype.manipulate=function(I){te.prototype.manipulate.call(this,I)},T.prototype.resize=function(I){te.prototype.resize.call(this,I),this.setSize()},T.prototype.setSize=function(){te.prototype.setSize.call(this),p.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},T.prototype.pointerUp=function(I){te.prototype.pointerUp.call(this,I),this.setSize()},T.prototype.setStrokeColor=function(I){this.strokeColor=I,this.visual&&p.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(I),this.stateChanged()},T.prototype.setFillColor=function(I){this.fillColor=I,this.visual&&p.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},T.prototype.setStrokeWidth=function(I){this.strokeWidth=I,this.visual&&p.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},T.prototype.setStrokeDasharray=function(I){this.strokeDasharray=I,this.visual&&p.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},T.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},te.prototype.getState.call(this))},T.prototype.restoreState=function(I){var re=I;this.fillColor=re.fillColor,this.strokeColor=re.strokeColor,this.strokeWidth=re.strokeWidth,this.strokeDasharray=re.strokeDasharray,this.opacity=re.opacity,this.createVisual(),te.prototype.restoreState.call(this,I),this.setSize()},T.prototype.scale=function(I,re){te.prototype.scale.call(this,I,re),this.setSize()},T.title="Rectangle marker",T}(A),R=function(te){function T(I,re,q,z){var W=te.call(this,I,z||'')||this;return W.widths=[],W.widthBoxes=[],W.widths=re,W.currentWidth=q,W.setCurrentWidth=W.setCurrentWidth.bind(W),W}return fe(T,te),T.prototype.getUi=function(){var I=this,re=document.createElement("div");return re.style.display="flex",re.style.overflow="hidden",re.style.flexGrow="2",this.widths.forEach(function(q){var z=document.createElement("div");z.style.display="flex",z.style.flexGrow="2",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=q===I.currentWidth?I.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){I.setCurrentWidth(q,z)}),re.appendChild(z);var W=document.createElement("div");W.innerText=q.toString(),W.style.marginRight="5px",z.appendChild(W);var V=document.createElement("div");V.style.minHeight="20px",V.style.flexGrow="2",V.style.display="flex",V.style.alignItems="center";var se=document.createElement("hr");se.style.minWidth="20px",se.style.border="0px",se.style.borderTop=q+"px solid "+I.uiStyleSettings.toolboxColor,se.style.flexGrow="2",V.appendChild(se),z.appendChild(V),I.widthBoxes.push(z)}),re},T.prototype.setCurrentWidth=function(I,re){var q=this;this.currentWidth=I,this.widthBoxes.forEach(function(z){z.style.borderColor=z===re?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},T}(m),F=function(te){function T(I,re,q,z){var W=te.call(this,I,z||'')||this;return W.styles=[],W.styleBoxes=[],W.styles=re,W.currentStyle=q,W.setCurrentStyle=W.setCurrentStyle.bind(W),W}return fe(T,te),T.prototype.getUi=function(){var I=this,re=document.createElement("div");return re.style.display="flex",re.style.overflow="hidden",re.style.flexGrow="2",this.styles.forEach(function(q){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/I.styles.length-5+"%",z.style.borderColor=q===I.currentStyle?I.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){I.setCurrentStyle(q,z)}),re.appendChild(z);var W=document.createElement("div");W.style.minHeight="20px",W.style.flexGrow="2",W.style.overflow="hidden";var V=``;W.innerHTML=V,z.appendChild(W),I.styleBoxes.push(z)}),re},T.prototype.setCurrentStyle=function(I,re){var q=this;this.currentStyle=I,this.styleBoxes.forEach(function(z){z.style.borderColor=z===re?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},T}(m),D=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.strokeColor=q.defaultColor,z.strokeWidth=q.defaultStrokeWidth,z.strokeDasharray=q.defaultStrokeDasharray,z.strokePanel=new y("Line color",q.defaultColorSet,q.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new R("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new F("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return fe(T,te),Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=te.prototype.getState.call(this);return I.typeName=T.typeName,I},T.typeName="FrameMarker",T.title="Frame marker",T.icon='',T}(H),B=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,this.defaultCaptionFontSize="1rem",this.defaultCaptionText="Text"},P=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.x1=0,z.y1=0,z.x2=0,z.y2=0,z.defaultLength=50,z.manipulationStartX=0,z.manipulationStartY=0,z.manipulationStartX1=0,z.manipulationStartY1=0,z.manipulationStartX2=0,z.manipulationStartY2=0,z.setupControlBox(),z}return fe(T,te),T.prototype.ownsTarget=function(I){return!!te.prototype.ownsTarget.call(this,I)||!(!this.grip1.ownsTarget(I)&&!this.grip2.ownsTarget(I))},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.manipulationStartX=I.x,this.manipulationStartY=I.y,this.state==="new"&&(this.x1=I.x,this.y1=I.y,this.x2=I.x,this.y2=I.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(re)?this.activeGrip=this.grip1:this.grip2.ownsTarget(re)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},T.prototype.pointerUp=function(I){var re=this.state;te.prototype.pointerUp.call(this,I),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(I),this._state="select",re==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},T.prototype.adjustVisual=function(){},T.prototype.manipulate=function(I){this.state==="creating"?this.resize(I):this.state==="move"?(this.x1=this.manipulationStartX1+I.x-this.manipulationStartX,this.y1=this.manipulationStartY1+I.y-this.manipulationStartY,this.x2=this.manipulationStartX2+I.x-this.manipulationStartX,this.y2=this.manipulationStartY2+I.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(I)},T.prototype.resize=function(I){switch(this.activeGrip){case this.grip1:this.x1=I.x,this.y1=I.y;break;case this.grip2:case void 0:this.x2=I.x,this.y2=I.y}this.adjustVisual(),this.adjustControlBox()},T.prototype.select=function(){te.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},T.prototype.deselect=function(){te.prototype.deselect.call(this),this.controlBox.style.display="none"},T.prototype.setupControlBox=function(){this.controlBox=p.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},T.prototype.adjustControlBox=function(){this.positionGrips()},T.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},T.prototype.createGrip=function(){var I=new S;return I.visual.transform.baseVal.appendItem(p.createTransform()),this.controlBox.appendChild(I.visual),I},T.prototype.positionGrips=function(){var I=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-I/2,this.y1-I/2),this.positionGrip(this.grip2.visual,this.x2-I/2,this.y2-I/2)},T.prototype.positionGrip=function(I,re,q){var z=I.transform.baseVal.getItem(0);z.setTranslate(re,q),I.transform.baseVal.replaceItem(z,0)},T.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},te.prototype.getState.call(this))},T.prototype.restoreState=function(I){te.prototype.restoreState.call(this,I);var re=I;this.x1=re.x1,this.y1=re.y1,this.x2=re.x2,this.y2=re.y2},T.prototype.scale=function(I,re){te.prototype.scale.call(this,I,re),this.x1=this.x1*I,this.y1=this.y1*re,this.x2=this.x2*I,this.y2=this.y2*re,this.adjustVisual(),this.adjustControlBox()},T}(_),U=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.strokeColor=q.defaultColor,z.strokeWidth=q.defaultStrokeWidth,z.strokeDasharray=q.defaultStrokeDasharray,z.strokePanel=new y("Line color",q.defaultColorSet,q.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new R("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new F("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return fe(T,te),T.prototype.ownsTarget=function(I){return!(!te.prototype.ownsTarget.call(this,I)&&I!==this.visual&&I!==this.selectorLine&&I!==this.visibleLine)},T.prototype.createVisual=function(){this.visual=p.createGroup(),this.selectorLine=p.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=p.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)},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},T.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()),p.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),p.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),p.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},T.prototype.setStrokeColor=function(I){this.strokeColor=I,this.adjustVisual(),this.colorChanged(I)},T.prototype.setStrokeWidth=function(I){this.strokeWidth=I,this.adjustVisual()},T.prototype.setStrokeDasharray=function(I){this.strokeDasharray=I,this.adjustVisual(),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},te.prototype.getState.call(this));return I.typeName=T.typeName,I},T.prototype.restoreState=function(I){te.prototype.restoreState.call(this,I);var re=I;this.strokeColor=re.strokeColor,this.strokeWidth=re.strokeWidth,this.strokeDasharray=re.strokeDasharray,this.createVisual(),this.adjustVisual()},T.typeName="LineMarker",T.title="Line marker",T.icon='',T}(P),G=function(te){function T(I,re,q,z){var W=te.call(this,I,z||'')||this;return W.fonts=[],W.fontBoxes=[],W.fonts=re,W.currentFont=q,W.setCurrentFont=W.setCurrentFont.bind(W),W}return fe(T,te),T.prototype.getUi=function(){var I=this,re=document.createElement("div");return re.style.overflow="hidden",re.style.flexGrow="2",this.fonts.forEach(function(q){var z=document.createElement("div");z.style.display="inline-block",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/I.fonts.length-5+"%",z.style.borderColor=q===I.currentFont?I.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){I.setCurrentFont(q,z)}),re.appendChild(z);var W=document.createElement("div");W.style.display="flex",W.style.minHeight="20px",W.style.flexGrow="2",W.style.fontFamily=q,W.style.overflow="hidden";var V=document.createElement("div");V.style.whiteSpace="nowrap",V.style.overflow="hidden",V.style.textOverflow="ellipsis",V.innerHTML="The quick brown fox jumps over the lazy dog",W.appendChild(V),z.appendChild(W),I.fontBoxes.push(z)}),re},T.prototype.setCurrentFont=function(I,re){var q=this;this.currentFont=I,this.fontBoxes.forEach(function(z){z.style.borderColor=z===re?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},T}(m),ee=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.color="transparent",z.padding=5,z.DEFAULT_TEXT="\u8BF7\u8F93\u5165\u6587\u672C",z.text=z.DEFAULT_TEXT,z.isMoved=!1,z.color=q.defaultColor,z.fontFamily=q.defaultFontFamily,z.defaultSize={x:100,y:30},z.setColor=z.setColor.bind(z),z.setFont=z.setFont.bind(z),z.renderText=z.renderText.bind(z),z.sizeText=z.sizeText.bind(z),z.textEditDivClicked=z.textEditDivClicked.bind(z),z.showTextEditor=z.showTextEditor.bind(z),z.setSize=z.setSize.bind(z),z.positionTextEditor=z.positionTextEditor.bind(z),z.colorPanel=new y("Color",q.defaultColorSet,q.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.fontFamilyPanel=new G("Font",q.defaultFontFamilies,q.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z}return fe(T,te),T.prototype.ownsTarget=function(I){if(te.prototype.ownsTarget.call(this,I)||I===this.visual||I===this.textElement||I===this.bgRectangle)return!0;var re=!1;return this.textElement.childNodes.forEach(function(q){q===I&&(re=!0)}),re},T.prototype.createVisual=function(){this.visual=p.createGroup(),this.bgRectangle=p.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=p.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(p.createTransform()),this.textElement.transform.baseVal.appendItem(p.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.isMoved=!1,this.pointerDownPoint=I,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(I),this._state="creating")},T.prototype.renderText=function(){var I=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(re){I.textElement.appendChild(p.createTSpan(re.trim()===""?" ":re.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},T.prototype.getTextScale=function(){var I=this.textElement.getBBox(),re=1;if(I.width>0&&I.height>0){var q=(1*this.width-this.width*this.padding*2/100)/I.width,z=(1*this.height-this.height*this.padding*2/100)/I.height;re=Math.min(q,z)}return re},T.prototype.getTextPosition=function(I){var re=this.textElement.getBBox(),q=0,z=0;return re.width>0&&re.height>0&&(q=(this.width-re.width*I)/2,z=this.height/2-re.height*I/2),{x:q,y:z}},T.prototype.sizeText=function(){var I=this.textElement.getBBox(),re=this.getTextScale(),q=this.getTextPosition(re);q.y-=I.y*re,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+q.x+"px, "+q.y+"px) scale("+re+", "+re+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(q.x,q.y),this.textElement.transform.baseVal.getItem(1).setScale(re,re))},T.prototype.manipulate=function(I){te.prototype.manipulate.call(this,I),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(I.x-this.pointerDownPoint.x)>5||Math.abs(I.y-this.pointerDownPoint.y)>5)},T.prototype.resize=function(I){te.prototype.resize.call(this,I),this.isMoved=!0,this.setSize(),this.sizeText()},T.prototype.setSize=function(){te.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(p.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),p.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},T.prototype.pointerUp=function(I){var re=this.state;re==="creating"&&(this._suppressMarkerCreateEvent=!0),te.prototype.pointerUp.call(this,I),this.setSize(),(re==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},T.prototype.showTextEditor=function(){var I=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(re){re.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var re=Number.parseFloat(I.textEditor.style.fontSize);I.textEditor.clientWidth>=Number.parseInt(I.textEditor.style.maxWidth)&&re>.9;)re-=.1,I.textEditor.style.fontSize=Math.max(re,.9)+"em"}),this.textEditor.addEventListener("keyup",function(re){re.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(re){if(re.clipboardData){var q=re.clipboardData.getData("text"),z=window.getSelection();if(!z.rangeCount)return!1;z.deleteFromDocument(),z.getRangeAt(0).insertNode(document.createTextNode(q)),re.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){I.textEditDivClicked(I.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},T.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var I=this.getTextScale(),re=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),q=this.textElement.getBBox(),z={x:q.width*I,y:q.height*I};re.x-=z.x/2,re.y-=z.y/2,this.textEditor.style.top=re.y+"px",this.textEditor.style.left=re.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-re.x+"px",this.textEditor.style.fontSize=Math.max(16*I,12)+"px",this.textElement.style.display="none"}},T.prototype.textEditDivClicked=function(I){this.text=I.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},T.prototype.select=function(){te.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},T.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),te.prototype.deselect.call(this)},T.prototype.dblClick=function(I,re){te.prototype.dblClick.call(this,I,re),this.showTextEditor()},T.prototype.setColor=function(I){this.textElement&&p.setAttributes(this.textElement,[["fill",I]]),this.color=I,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(I)},T.prototype.setFont=function(I){this.textElement&&p.setAttributes(this.textElement,[["font-family",I]]),this.fontFamily=I,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},T.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},T.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},te.prototype.getState.call(this));return I.typeName=T.typeName,I},T.prototype.restoreState=function(I){var re=I;this.color=re.color,this.fontFamily=re.fontFamily,this.padding=re.padding,this.text=re.text,this.createVisual(),te.prototype.restoreState.call(this,I),this.setSize()},T.prototype.scale=function(I,re){te.prototype.scale.call(this,I,re),this.setSize(),this.sizeText(),this.positionTextEditor()},T.typeName="TextMarker",T.title="Text marker",T.icon='',T}(A),K=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.color="transparent",z.lineWidth=3,z.drawing=!1,z.pixelRatio=1,z.color=q.defaultColor,z.lineWidth=q.defaultStrokeWidth,z.pixelRatio=q.freehandPixelRatio,z.setColor=z.setColor.bind(z),z.addCanvas=z.addCanvas.bind(z),z.finishCreation=z.finishCreation.bind(z),z.setLineWidth=z.setLineWidth.bind(z),z.colorPanel=new y("Color",q.defaultColorSet,q.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.lineWidthPanel=new R("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),z.lineWidthPanel.onWidthChanged=z.setLineWidth,z}return fe(T,te),T.prototype.ownsTarget=function(I){return!(!te.prototype.ownsTarget.call(this,I)&&I!==this.visual&&I!==this.drawingImage)},T.prototype.createVisual=function(){this.visual=p.createGroup(),this.drawingImage=p.createImage(),this.visual.appendChild(this.drawingImage);var I=p.createTransform();this.visual.transform.baseVal.appendItem(I),this.addMarkerVisualToContainer(this.visual)},T.prototype.pointerDown=function(I,re){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(I.x,I.y),this.drawing=!0):te.prototype.pointerDown.call(this,I,re)},T.prototype.manipulate=function(I){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(I.x,I.y),this.canvasContext.stroke()):te.prototype.manipulate.call(this,I)},T.prototype.resize=function(I){te.prototype.resize.call(this,I),p.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),p.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},T.prototype.pointerUp=function(I){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):te.prototype.pointerUp.call(this,I)},T.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)},T.prototype.select=function(){this.state==="creating"&&this.finishCreation(),te.prototype.select.call(this)},T.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),te.prototype.deselect.call(this)},T.prototype.finishCreation=function(){for(var I=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),re=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],q=re[0],z=re[1],W=re[2],V=re[3],se=!1,ge=0;ge 0&&(se=!0,ge V&&(V=ge),Me>W&&(W=Me));if(se){this.left=q/this.pixelRatio,this.top=z/this.pixelRatio,this.width=(W-q)/this.pixelRatio,this.height=(V-z)/this.pixelRatio;var Fe=document.createElement("canvas");Fe.width=W-q,Fe.height=V-z,Fe.getContext("2d").putImageData(this.canvasContext.getImageData(q,z,W-q,V-z),0,0),this.drawingImgUrl=Fe.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},T.prototype.setDrawingImage=function(){p.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),p.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},T.prototype.setColor=function(I){this.color=I,this.colorChanged(I)},T.prototype.setLineWidth=function(I){this.lineWidth=I},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=Object.assign({drawingImgUrl:this.drawingImgUrl},te.prototype.getState.call(this));return I.typeName=T.typeName,I},T.prototype.restoreState=function(I){this.createVisual(),te.prototype.restoreState.call(this,I),this.drawingImgUrl=I.drawingImgUrl,this.setDrawingImage()},T.prototype.scale=function(I,re){te.prototype.scale.call(this,I,re),this.setDrawingImage()},T.typeName="FreehandMarker",T.title="Freehand marker",T.icon='',T}(A),Z=function(te){function T(I,re,q){var z=te.call(this,I,q||'')||this;return z.typeBoxes=[],z.currentType=re,z.setCurrentType=z.setCurrentType.bind(z),z}return fe(T,te),T.prototype.getUi=function(){var I=this,re=document.createElement("div");re.style.display="flex",re.style.overflow="hidden",re.style.flexGrow="2";for(var q=function(V){var se="both";switch(V){case 0:se="both";break;case 1:se="start";break;case 2:se="end";break;case 3:se="none"}var ge=document.createElement("div");if(ge.style.display="flex",ge.style.flexGrow="2",ge.style.alignItems="center",ge.style.justifyContent="space-between",ge.style.padding="5px",ge.style.borderWidth="2px",ge.style.borderStyle="solid",ge.style.borderColor=se===z.currentType?z.uiStyleSettings.toolboxAccentColor:"transparent",ge.addEventListener("click",function(){I.setCurrentType(se,ge)}),re.appendChild(ge),se==="both"||se==="start"){var Me=document.createElement("div");Me.style.display="flex",Me.style.alignItems="center",Me.style.minHeight="20px",Me.innerHTML=``,Me.style.marginLeft="5px",ge.appendChild(Me)}var Fe=document.createElement("div");Fe.style.display="flex",Fe.style.alignItems="center",Fe.style.minHeight="20px",Fe.style.flexGrow="2";var Re=document.createElement("hr");if(Re.style.minWidth="20px",Re.style.border="0px",Re.style.borderTop="3px solid "+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee"),Re.style.flexGrow="2",Fe.appendChild(Re),ge.appendChild(Fe),se==="both"||se==="end"){var $e=document.createElement("div");$e.style.display="flex",$e.style.alignItems="center",$e.style.minHeight="20px",$e.innerHTML=``,$e.style.marginRight="5px",ge.appendChild($e)}z.typeBoxes.push(ge)},z=this,W=0;W<4;W++)q(W);return re},T.prototype.setCurrentType=function(I,re){var q=this;this.currentType=I,this.typeBoxes.forEach(function(z){z.style.borderColor=z===re?q.uiStyleSettings!==void 0?q.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},T}(m),$=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.arrowType="end",z.arrowBaseHeight=10,z.arrowBaseWidth=10,z.getArrowPoints=z.getArrowPoints.bind(z),z.setArrowType=z.setArrowType.bind(z),z.arrowTypePanel=new Z("Arrow type","end"),z.arrowTypePanel.onArrowTypeChanged=z.setArrowType,z}return fe(T,te),T.prototype.ownsTarget=function(I){return!(!te.prototype.ownsTarget.call(this,I)&&I!==this.arrow1&&I!==this.arrow2)},T.prototype.getArrowPoints=function(I,re){var q=this.arrowBaseWidth+2*this.strokeWidth,z=this.arrowBaseHeight+2*this.strokeWidth;return I-q/2+","+(re+z/2)+" "+I+","+(re-z/2)+" "+(I+q/2)+","+(re+z/2)},T.prototype.createTips=function(){this.arrow1=p.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(p.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=p.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(p.createTransform()),this.visual.appendChild(this.arrow2)},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.state==="creating"&&this.createTips()},T.prototype.adjustVisual=function(){if(te.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",p.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),p.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]);var I=0;Math.abs(this.x1-this.x2)>.1&&(I=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2));var re=this.arrow1.transform.baseVal.getItem(0);re.setRotate(I,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(re,0);var q=this.arrow2.transform.baseVal.getItem(0);q.setRotate(I+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(q,0)}},T.prototype.setArrowType=function(I){this.arrowType=I,this.adjustVisual(),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=Object.assign({arrowType:this.arrowType},te.prototype.getState.call(this));return I.typeName=T.typeName,I},T.prototype.restoreState=function(I){te.prototype.restoreState.call(this,I);var re=I;this.arrowType=re.arrowType,this.createTips(),this.adjustVisual()},T.typeName="ArrowMarker",T.title="Arrow marker",T.icon='',T}(U),oe=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.fillColor=q.defaultFillColor,z.strokeWidth=0,z.fillPanel=new y("Color",q.defaultColorSet,q.defaultFillColor),z.fillPanel.onColorChanged=z.setFillColor,z}return fe(T,te),Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=te.prototype.getState.call(this);return I.typeName=T.typeName,I},T.typeName="CoverMarker",T.title="Cover marker",T.icon='',T}(H),ae=function(te){function T(I,re,q,z){var W=te.call(this,I,z||'')||this;return W.opacities=[],W.opacityBoxes=[],W.opacities=re,W.currentOpacity=q,W.setCurrentOpacity=W.setCurrentOpacity.bind(W),W}return fe(T,te),T.prototype.getUi=function(){var I=this,re=document.createElement("div");return re.style.display="flex",re.style.overflow="hidden",re.style.flexGrow="2",re.style.justifyContent="space-between",this.opacities.forEach(function(q){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="center",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=q===I.currentOpacity?I.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){I.setCurrentOpacity(q,z)}),re.appendChild(z);var W=document.createElement("div");W.innerText=100*q+"%",z.appendChild(W),I.opacityBoxes.push(z)}),re},T.prototype.setCurrentOpacity=function(I,re){var q=this;this.currentOpacity=I,this.opacityBoxes.forEach(function(z){z.style.borderColor=z===re?q.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},T}(m),ye=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.setOpacity=z.setOpacity.bind(z),z.fillColor=q.defaultHighlightColor,z.strokeWidth=0,z.opacity=q.defaultHighlightOpacity,z.fillPanel=new y("Color",q.defaultColorSet,z.fillColor),z.fillPanel.onColorChanged=z.setFillColor,z.opacityPanel=new ae("Opacity",q.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return fe(T,te),T.prototype.setOpacity=function(I){this.opacity=I,this.visual&&p.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=te.prototype.getState.call(this);return I.typeName=T.typeName,I},T.typeName="HighlightMarker",T.title="Highlight marker",T.icon='',T}(oe),Y='',le='',xe=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.bgColor="transparent",z.tipPosition={x:0,y:0},z.tipBase1Position={x:0,y:0},z.tipBase2Position={x:0,y:0},z.tipMoving=!1,z.color=q.defaultStrokeColor,z.bgColor=q.defaultFillColor,z.fontFamily=q.defaultFontFamily,z.defaultSize={x:100,y:30},z.setBgColor=z.setBgColor.bind(z),z.getTipPoints=z.getTipPoints.bind(z),z.positionTip=z.positionTip.bind(z),z.setTipPoints=z.setTipPoints.bind(z),z.colorPanel=new y("Text color",q.defaultColorSet,z.color,Y),z.colorPanel.onColorChanged=z.setColor,z.bgColorPanel=new y("Fill color",q.defaultColorSet,z.bgColor,le),z.bgColorPanel.onColorChanged=z.setBgColor,z.fontFamilyPanel=new G("Font",q.defaultFontFamilies,q.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z.tipGrip=new S,z.tipGrip.visual.transform.baseVal.appendItem(p.createTransform()),z.controlBox.appendChild(z.tipGrip.visual),z}return fe(T,te),T.prototype.ownsTarget=function(I){return te.prototype.ownsTarget.call(this,I)||this.tipGrip.ownsTarget(I)||this.tip===I},T.prototype.createTip=function(){p.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=p.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},T.prototype.pointerDown=function(I,re){this.state==="new"&&te.prototype.pointerDown.call(this,I,re),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(re)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):te.prototype.pointerDown.call(this,I,re)},T.prototype.pointerUp=function(I){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,te.prototype.pointerUp.call(this,I);else{var re=this.state==="creating";te.prototype.pointerUp.call(this,I),this.setTipPoints(re),this.positionTip()}},T.prototype.manipulate=function(I){if(this.tipMoving){var re=this.unrotatePoint(I);this.tipPosition={x:re.x-this.manipulationStartLeft,y:re.y-this.manipulationStartTop},this.positionTip()}else te.prototype.manipulate.call(this,I)},T.prototype.setBgColor=function(I){this.bgRectangle&&this.tip&&(p.setAttributes(this.bgRectangle,[["fill",I]]),p.setAttributes(this.tip,[["fill",I]])),this.bgColor=I,this.fillColorChanged(I)},T.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},T.prototype.setTipPoints=function(I){I===void 0&&(I=!1);var re=Math.min(this.height/2,15),q=this.height/5;I&&(this.tipPosition={x:re+q/2,y:this.height+20});var z=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?z ',T}(ee),Ce=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.strokeColor=q.defaultColor,z.strokeWidth=q.defaultStrokeWidth,z.strokeDasharray=q.defaultStrokeDasharray,z.fillColor=q.defaultFillColor,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.setOpacity=z.setOpacity.bind(z),z.createVisual=z.createVisual.bind(z),z.strokePanel=new y("Line color",E(q.defaultColorSet,["transparent"]),q.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.fillPanel=new y("Fill color",E(q.defaultColorSet,["transparent"]),z.fillColor,le),z.fillPanel.onColorChanged=z.setFillColor,z.strokeWidthPanel=new R("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new F("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z.opacityPanel=new ae("Opacity",q.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return fe(T,te),T.prototype.ownsTarget=function(I){return!(!te.prototype.ownsTarget.call(this,I)&&I!==this.visual)},T.prototype.createVisual=function(){this.visual=p.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.state==="new"&&(this.createVisual(),this.moveVisual(I),this._state="creating")},T.prototype.manipulate=function(I){te.prototype.manipulate.call(this,I)},T.prototype.resize=function(I){te.prototype.resize.call(this,I),this.setSize()},T.prototype.setSize=function(){te.prototype.setSize.call(this),p.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},T.prototype.pointerUp=function(I){te.prototype.pointerUp.call(this,I),this.setSize()},T.prototype.setStrokeColor=function(I){this.strokeColor=I,this.visual&&p.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(I),this.stateChanged()},T.prototype.setFillColor=function(I){this.fillColor=I,this.visual&&p.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(I),this.stateChanged()},T.prototype.setStrokeWidth=function(I){this.strokeWidth=I,this.visual&&p.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},T.prototype.setStrokeDasharray=function(I){this.strokeDasharray=I,this.visual&&p.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},T.prototype.setOpacity=function(I){this.opacity=I,this.visual&&p.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},te.prototype.getState.call(this));return I.typeName=T.typeName,I},T.prototype.restoreState=function(I){var re=I;this.fillColor=re.fillColor,this.strokeColor=re.strokeColor,this.strokeWidth=re.strokeWidth,this.strokeDasharray=re.strokeDasharray,this.opacity=re.opacity,this.createVisual(),te.prototype.restoreState.call(this,I),this.setSize()},T.prototype.scale=function(I,re){te.prototype.scale.call(this,I,re),this.setSize()},T.typeName="EllipseMarker",T.title="Ellipse marker",T.icon='',T}(A),we=function(te){function T(I,re,q){return te.call(this,I,re,q)||this}return fe(T,te),Object.defineProperty(T.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),T.prototype.ownsTarget=function(I){return!(!te.prototype.ownsTarget.call(this,I)&&I!==this.tip1&&I!==this.tip2)},T.prototype.createTips=function(){this.tip1=p.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(p.createTransform()),this.visual.appendChild(this.tip1),this.tip2=p.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(p.createTransform()),this.visual.appendChild(this.tip2)},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.state==="creating"&&this.createTips()},T.prototype.adjustVisual=function(){if(te.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(p.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),p.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var I=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),re=this.tip1.transform.baseVal.getItem(0);re.setRotate(I,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(re,0);var q=this.tip2.transform.baseVal.getItem(0);q.setRotate(I+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(q,0)}},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=te.prototype.getState.call(this);return I.typeName=T.typeName,I},T.prototype.restoreState=function(I){te.prototype.restoreState.call(this,I),this.createTips(),this.adjustVisual()},T.typeName="MeasurementMarker",T.title="Measurement marker",T.icon='',T}(U),Le=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.strokePanel.colors=q.defaultColorSet,z.fillColor="transparent",z}return fe(T,te),Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=te.prototype.getState.call(this);return I.typeName=T.typeName,I},T.typeName="EllipseFrameMarker",T.title="Ellipse frame marker",T.icon='',T}(Ce),de=function(){function te(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(te.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),te.prototype.addUndoStep=function(T){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(T)||(this.undoStack.push(T),JSON.stringify(this.lastRedoStep)!==JSON.stringify(T)&&this.redoStack.splice(0,this.redoStack.length))},te.prototype.replaceLastUndoStep=function(T){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=T)},te.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},te.prototype.undo=function(){if(this.undoStack.length>1){var T=this.undoStack.pop();return T!==void 0&&this.redoStack.push(T),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},te.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},te}(),be=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.curveX=0,z.curveY=0,z.manipulationStartCurveX=0,z.manipulationStartCurveY=0,z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.positionGrips=z.positionGrips.bind(z),z.addControlGrips=z.addControlGrips.bind(z),z.adjustVisual=z.adjustVisual.bind(z),z.setupControlBox=z.setupControlBox.bind(z),z.resize=z.resize.bind(z),z.strokeColor=q.defaultColor,z.strokeWidth=q.defaultStrokeWidth,z.strokeDasharray=q.defaultStrokeDasharray,z.strokePanel=new y("Line color",q.defaultColorSet,q.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new R("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new F("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return fe(T,te),T.prototype.ownsTarget=function(I){return!(!te.prototype.ownsTarget.call(this,I)&&I!==this.visual&&I!==this.selectorCurve&&I!==this.visibleCurve&&!this.curveGrip.ownsTarget(I))},T.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},T.prototype.createVisual=function(){this.visual=p.createGroup(),this.selectorCurve=p.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=p.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)},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=I.x,this.curveY=I.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(re)&&(this.activeGrip=this.curveGrip,this._state="resize")},T.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),p.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),p.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),p.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},T.prototype.setupControlBox=function(){te.prototype.setupControlBox.call(this),this.curveControlLine1=p.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=p.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)},T.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,te.prototype.addControlGrips.call(this)},T.prototype.positionGrips=function(){te.prototype.positionGrips.call(this);var I=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-I/2,this.curveY-I/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()))},T.prototype.manipulate=function(I){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+I.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+I.y-this.manipulationStartY),te.prototype.manipulate.call(this,I)},T.prototype.resize=function(I){this.activeGrip===this.curveGrip&&(this.curveX=I.x,this.curveY=I.y),te.prototype.resize.call(this,I),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},T.prototype.setStrokeColor=function(I){this.strokeColor=I,this.adjustVisual(),this.colorChanged(I)},T.prototype.setStrokeWidth=function(I){this.strokeWidth=I,this.adjustVisual()},T.prototype.setStrokeDasharray=function(I){this.strokeDasharray=I,this.adjustVisual()},T.prototype.scale=function(I,re){this.curveX=this.curveX*I,this.curveY=this.curveY*re,te.prototype.scale.call(this,I,re)},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},te.prototype.getState.call(this));return I.typeName=T.typeName,I},T.prototype.restoreState=function(I){te.prototype.restoreState.call(this,I);var re=I;this.strokeColor=re.strokeColor,this.strokeWidth=re.strokeWidth,this.strokeDasharray=re.strokeDasharray,this.curveX=re.curveX,this.curveY=re.curveY,this.createVisual(),this.adjustVisual()},T.typeName="CurveMarker",T.title="Curve marker",T.icon='',T}(P),Te=function(te){function T(I,re,q){var z=te.call(this,I,re,q)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.textColor="transparent",z.fontSize="1rem",z.isMoved=!1,z.captionText="Caption",z.PADDING=5,z.captionBoxWidth=0,z.captionBoxHeight=0,z.strokeColor=q.defaultColor,z.strokeWidth=q.defaultStrokeWidth,z.strokeDasharray=q.defaultStrokeDasharray,z.fillColor=q.defaultFillColor,z.textColor=q.defaultStrokeColor,z.fontFamily=q.defaultFontFamily,z.fontSize=q.defaultCaptionFontSize,z.captionText=q.defaultCaptionText,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.createVisual=z.createVisual.bind(z),z.sizeCaption=z.sizeCaption.bind(z),z.setCaptionText=z.setCaptionText.bind(z),z.showTextEditor=z.showTextEditor.bind(z),z.positionTextEditor=z.positionTextEditor.bind(z),z.finishTextEditing=z.finishTextEditing.bind(z),z.setFont=z.setFont.bind(z),z.setTextColor=z.setTextColor.bind(z),z.strokePanel=new y("Line color",E(q.defaultColorSet,["transparent"]),z.strokeColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.fillPanel=new y("Fill color",E(q.defaultColorSet,["transparent"]),z.fillColor,le),z.fillPanel.onColorChanged=z.setFillColor,z.strokeWidthPanel=new R("Line width",q.defaultStrokeWidths,q.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new F("Line style",q.defaultStrokeDasharrays,q.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z.fontFamilyPanel=new G("Font",q.defaultFontFamilies,q.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z.textColorPanel=new y("Text color",q.defaultColorSet,z.textColor,Y),z.textColorPanel.onColorChanged=z.setTextColor,z}return fe(T,te),T.prototype.ownsTarget=function(I){return!(!te.prototype.ownsTarget.call(this,I)&&I!==this.visual&&I!==this.frame&&I!==this.captionBg&&I!==this.captionElement)},T.prototype.createVisual=function(){this.visual=p.createGroup(),this.addMarkerVisualToContainer(this.visual),this.captionBg=p.createRect(1,1,[["fill",this.fillColor]]),this.visual.appendChild(this.captionBg),this.captionElement=p.createText([["fill",this.textColor],["font-family",this.fontFamily]]),this.captionElement.style.fontSize=this.fontSize,this.captionElement.style.textAnchor="start",this.captionElement.style.dominantBaseline="text-before-edge",this.captionElement.textContent=this.captionText,this.visual.appendChild(this.captionElement),this.frame=p.createRect(this.width,this.height,[["fill","transparent"],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray]]),this.visual.appendChild(this.frame),this.sizeCaption()},T.prototype.setCaptionText=function(I){this.captionText=I,this.captionElement.textContent=this.captionText,this.sizeCaption()},T.prototype.pointerDown=function(I,re){te.prototype.pointerDown.call(this,I,re),this.isMoved=!1,this.pointerDownPoint=I,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(I),this._state="creating")},T.prototype.manipulate=function(I){te.prototype.manipulate.call(this,I),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(I.x-this.pointerDownPoint.x)>5||Math.abs(I.y-this.pointerDownPoint.y)>5)},T.prototype.resize=function(I){te.prototype.resize.call(this,I),this.setSize()},T.prototype.sizeCaption=function(){var I=this.captionElement.getBBox();this.captionText.trim()!==""?(this.captionBoxWidth=I.width+2*this.PADDING,this.captionBoxHeight=I.height+2*this.PADDING):(this.captionBoxWidth=0,this.captionBoxHeight=0),p.setAttributes(this.captionBg,[["width",this.captionBoxWidth.toString()],["height",this.captionBoxHeight.toString()],["clip-path","path('M0,0 H"+this.width+" V"+this.height+" H"+-this.width+" Z')"]]),p.setAttributes(this.captionElement,[["x",this.PADDING.toString()],["y",this.PADDING.toString()],["clip-path","path('M0,0 H"+(this.width-this.PADDING)+" V"+this.height+" H"+(-this.width-this.PADDING)+" Z')"]])},T.prototype.showTextEditor=function(){var I=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.textEditBox=document.createElement("input"),this.textEditBox.style.position="absolute",this.textEditBox.style.width=this.width+"px",this.captionBoxHeight>0&&(this.textEditBox.style.height=this.captionBoxHeight+"px"),this.textEditBox.style.fontSize=this.fontSize,this.textEditBox.style.fontFamily=this.fontFamily,this.textEditBox.style.backgroundColor=this.fillColor,this.textEditBox.style.color=this.textColor,this.textEditBox.style.borderWidth="0",this.textEditBox.setAttribute("value",this.captionText),this.textEditBox.select(),this.textEditDiv.appendChild(this.textEditBox),this.overlayContainer.appendChild(this.textEditDiv),this.textEditBox.addEventListener("pointerup",function(re){re.stopPropagation()}),this.textEditBox.addEventListener("keypress",function(re){re.key==="Enter"&&I.finishTextEditing(I.textEditBox.value)}),this.textEditBox.addEventListener("keyup",function(re){re.cancelBubble=!0}),this.textEditBox.addEventListener("blur",function(){I.finishTextEditing(I.textEditBox.value)}),this.textEditDiv.addEventListener("pointerup",function(){I.finishTextEditing(I.textEditBox.value)}),this.positionTextEditor(),this.textEditBox.focus()},T.prototype.positionTextEditor=function(){this.state==="edit"&&(this.textEditBox===void 0?this.showTextEditor():(this.textEditBox.style.left=this.left+"px",this.textEditBox.style.top=this.top+"px",this.textEditBox.style.transform="rotate("+this.rotationAngle+"deg)",this.textEditBox.style.transformOrigin=this.width/2+"px "+this.height/2+"px"))},T.prototype.finishTextEditing=function(I){this.setCaptionText(I.trim()),this.overlayContainer.innerHTML="",this.stateChanged()},T.prototype.setFont=function(I){this.captionElement&&p.setAttributes(this.captionElement,[["font-family",I]]),this.fontFamily=I,this.textEditBox&&(this.textEditBox.style.fontFamily=this.fontFamily),this.sizeCaption(),this.stateChanged()},T.prototype.setTextColor=function(I){this.captionElement&&p.setAttributes(this.captionElement,[["fill",I]]),this.textColor=I,this.textEditBox&&(this.textEditBox.style.color=this.textColor),this.stateChanged()},T.prototype.setSize=function(){te.prototype.setSize.call(this),p.setAttributes(this.frame,[["width",this.width.toString()],["height",this.height.toString()]]),this.sizeCaption()},T.prototype.pointerUp=function(I){te.prototype.pointerUp.call(this,I),this.setSize(),!this.isMoved&&Date.now()-this.pointerDownTimestamp>500&&this.showTextEditor(),this.pointerDownPoint=void 0},T.prototype.dblClick=function(I,re){te.prototype.dblClick.call(this,I,re),this.showTextEditor()},T.prototype.setStrokeColor=function(I){this.strokeColor=I,this.frame&&p.setAttributes(this.frame,[["stroke",this.strokeColor]]),this.colorChanged(I),this.stateChanged()},T.prototype.setFillColor=function(I){this.fillColor=I,this.captionBg&&p.setAttributes(this.captionBg,[["fill",this.fillColor]]),this.fillColorChanged(I),this.stateChanged()},T.prototype.setStrokeWidth=function(I){this.strokeWidth=I,this.frame&&p.setAttributes(this.frame,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},T.prototype.setStrokeDasharray=function(I){this.strokeDasharray=I,this.frame&&p.setAttributes(this.frame,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},Object.defineProperty(T.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.fontFamilyPanel,this.textColorPanel]},enumerable:!1,configurable:!0}),T.prototype.getState=function(){var I=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:1,textColor:this.textColor,fontFamily:this.fontFamily,fontSize:this.fontSize,captionText:this.captionText},te.prototype.getState.call(this));return I.typeName=this.typeName,I},T.prototype.restoreState=function(I){var re=I;this.fillColor=re.fillColor,this.strokeColor=re.strokeColor,this.strokeWidth=re.strokeWidth,this.strokeDasharray=re.strokeDasharray,this.textColor=re.textColor,this.fontFamily=re.fontFamily,this.captionText=re.captionText,this.fontSize=re.fontSize,this.createVisual(),te.prototype.restoreState.call(this,I),this.setSize()},T.prototype.scale=function(I,re){te.prototype.scale.call(this,I,re),this.setSize()},T.typeName="CaptionFrameMarker",T.title="Caption frame marker",T.icon='',T}(A),Ae=function(){function te(T,I){I===void 0&&(I=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=T,this.cancelable=I}return Object.defineProperty(te.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),te.prototype.preventDefault=function(){this._defaultPrevented=!0},te}(),Be=function(te){function T(I,re,q){var z=te.call(this,I,!1)||this;return z.dataUrl=re,z.state=q,z}return fe(T,te),T}(Ae),Pe=function(te){function T(I,re,q){q===void 0&&(q=!1);var z=te.call(this,I,q)||this;return z.marker=re,z}return fe(T,te),T}(Ae),_e=function(){function te(){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 te.prototype.addEventListener=function(T,I){this[T].push(I)},te.prototype.removeEventListener=function(T,I){var re=this[T].indexOf(I);re>-1&&this[T].splice(re,1)},te}(),ne=function(){function te(T){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new B,this._isOpen=!1,this.undoRedoManager=new de,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new _e,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=te.instanceCounter++,this.styles=new v(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=T,this.targetRoot=document.body,this.width=T.clientWidth,this.height=T.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(te.prototype,"ALL_MARKER_TYPES",{get:function(){return[D,K,$,ee,Le,Ce,ye,xe,we,oe,U,be,Te]},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[D,K,$,ee,Ce,ye,xe]},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"BASIC_MARKER_TYPES",{get:function(){return[D,K,$,ee,ye]},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(T){var I=this;this._availableMarkerTypes.splice(0),T.forEach(function(re){if(typeof re=="string"){var q=I.ALL_MARKER_TYPES.find(function(z){return z.typeName===re});q!==void 0&&I._availableMarkerTypes.push(q)}else I._availableMarkerTypes.push(re)})},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(te.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(T){this._zoomLevel=T,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(te.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),te.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),g.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},te.prototype.show=function(){var T=this;this.styles.styleSheetRoot===void 0&&h.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=h.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(I){return I(new Ae(T))})},te.prototype.render=function(){return i(this,void 0,void 0,function(){var T;return M(this,function(I){switch(I.label){case 0:return this.setCurrentMarker(),(T=new l).naturalSize=this.renderAtNaturalSize,T.imageType=this.renderImageType,T.imageQuality=this.renderImageQuality,T.markersOnly=this.renderMarkersOnly,T.width=this.renderWidth,T.height=this.renderHeight,[4,T.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return I.sent(),[4,T.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,I.sent()]}})})},te.prototype.close=function(T){var I=this;if(T===void 0&&(T=!1),this.isOpen){var re=!1;T||this.eventListeners.beforeclose.forEach(function(q){var z=new Ae(I,!0);q(z),z.defaultPrevented&&(re=!0)}),re||(this.coverDiv&&this.closeUI(),this.targetObserver&&(this.targetObserver.unobserve(this.target),this.targetObserver.unobserve(this.editorCanvas)),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(q){return q(new Ae(I))}),this.detachEvents(),this._isOpen=!1)}},te.prototype.addMarkersToToolbar=function(){for(var T,I=[],re=0;re this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*T:this.editorCanvas.clientWidth,re=I ',T.title="Powered by marker.js",T.style.display="grid",T.style.alignItems="center",T.style.justifyItems="center",T.style.padding="3px",T.style.width="20px",T.style.height="20px",this.logoUI.appendChild(T),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},te.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")},te.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"},te.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},te.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 T=this.settings.uiOffsetTop!==void 0?this.target.offsetTop+this.settings.uiOffsetTop:this.target.offsetTop>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=T+"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 s(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.settings.uiOffsetTop===void 0&&this.target.offsetTop -1&&this.markers.splice(this.markers.indexOf(T),1),T.dispose()},te.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())},te.prototype.toolbarButtonClicked=function(T,I){if(T==="marker"&&I!==void 0)this.createNewMarker(I);else if(T==="action")switch(I){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()}},te.prototype.deleteSelectedMarker=function(){var T=this;if(this._currentMarker!==void 0){var I=!1;if(this.eventListeners.markerbeforedelete.forEach(function(q){var z=new Pe(T,T._currentMarker,!0);q(z),z.defaultPrevented&&(I=!0)}),!I){var re=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(q){return q(new Pe(T,re))})}}},te.prototype.clear=function(){var T=this,I=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(W){var V=new Pe(T,void 0,!0);W(V),V.defaultPrevented&&(I=!0)}),!I)){this.setCurrentMarker();for(var re=function(W){var V=q.markers[W];q.setCurrentMarker(q.markers[W]),q._currentMarker.dispose(),q.markerImage.removeChild(q._currentMarker.container),q.markers.splice(q.markers.indexOf(q._currentMarker),1),q.eventListeners.markerdelete.forEach(function(se){return se(new Pe(T,V))})},q=this,z=this.markers.length-1;z>=0;z--)re(z);this.addUndoStep()}},Object.defineProperty(te.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),te.prototype.showNotesEditor=function(){var T;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=(T=this._currentMarker.notes)!==null&&T!==void 0?T:"",this.overlayContainer.appendChild(this.notesArea))},te.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)},te.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},te.prototype.addUndoStep=function(){var T=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var I=this.getState(),re=this.undoRedoManager.getLastUndoStep();if(!re||re.width===I.width&&re.height===I.height){var q=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(I),q 1&&this.panTo({x:T.clientX,y:T.clientY}))},te.prototype.onPointerUp=function(T){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(T.clientX,T.clientY)),this.isDragging=!1,this.addUndoStep()},te.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},te.prototype.onKeyUp=function(T){this._currentMarker===void 0||this.notesArea!==void 0||T.key!=="Delete"&&T.key!=="Backspace"||this.deleteSelectedMarker()},te.prototype.clientToLocalCoordinates=function(T,I){var re=this.markerImage.getBoundingClientRect();return{x:(T-re.left)/this.zoomLevel,y:(I-re.top)/this.zoomLevel}},te.prototype.onWindowResize=function(){this.positionUI()},te.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var T=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=T+"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()},te.prototype.addLicenseKey=function(T){g.addKey(T)},te.prototype.addEventListener=function(T,I){this.eventListeners.addEventListener(T,I)},te.prototype.removeEventListener=function(T,I){this.eventListeners.removeEventListener(T,I)},te.prototype.renderState=function(T){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(T),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(te.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),te.prototype.focus=function(){var T=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(I){return I(new Ae(T))}))},te.prototype.blur=function(){var T=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(I){return I(new Ae(T))}))},te.instanceCounter=0,te}()},58971:function(It,Ue,Q){var he=Q(62195),fe=Q(39015),i=[Q(19257)];It.exports=he.createStore(fe,i)},19257:function(It,Ue,Q){It.exports=he;function he(){return Q(55703),{}}},55703:function(){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(It){return It<10?"0"+It:It}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(It){return rx_escapable.lastIndex=0,rx_escapable.test(It)?'"'+It.replace(rx_escapable,function(Ue){var Q=meta[Ue];return typeof Q=="string"?Q:"\\u"+("0000"+Ue.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+It+'"'}function str(It,Ue){var Q,he,fe,i,M=gap,E,p=Ue[It];switch(p&&typeof p=="object"&&typeof p.toJSON=="function"&&(p=p.toJSON(It)),typeof rep=="function"&&(p=rep.call(Ue,It,p)),typeof p){case"string":return quote(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";if(gap+=indent,E=[],Object.prototype.toString.apply(p)==="[object Array]"){for(i=p.length,Q=0;Q=0;s--)if(i(o[s])){var u=o[s].split("="),m=unescape(u[0]),y=unescape(u[1]);d(y,m)}}function g(d,o){d&&(M.cookie=escape(d)+"="+escape(o)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function l(d){!d||!v(d)||(M.cookie=escape(d)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function h(){p(function(d,o){l(o)})}function v(d){return new RegExp("(?:^|;\\s*)"+escape(d).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(M.cookie)}},39627:function(It,Ue,Q){var he=Q(69078),fe=he.Global;It.exports={name:"localStorage",read:M,write:E,each:p,remove:g,clearAll:l};function i(){return fe.localStorage}function M(h){return i().getItem(h)}function E(h,v){return i().setItem(h,v)}function p(h){for(var v=i().length-1;v>=0;v--){var d=i().key(v);h(M(d),d)}}function g(h){return i().removeItem(h)}function l(){return i().clear()}},8728:function(It){It.exports={name:"memoryStorage",read:Q,write:he,each:fe,remove:i,clearAll:M};var Ue={};function Q(E){return Ue[E]}function he(E,p){Ue[E]=p}function fe(E){for(var p in Ue)Ue.hasOwnProperty(p)&&E(Ue[p],p)}function i(E){delete Ue[E]}function M(E){Ue={}}},95347:function(It,Ue,Q){var he=Q(69078),fe=he.Global;It.exports={name:"oldFF-globalStorage",read:M,write:E,each:p,remove:g,clearAll:l};var i=fe.globalStorage;function M(h){return i[h]}function E(h,v){i[h]=v}function p(h){for(var v=i.length-1;v>=0;v--){var d=i.key(v);h(i[d],d)}}function g(h){return i.removeItem(h)}function l(){p(function(h,v){delete i[h]})}},34524:function(It,Ue,Q){var he=Q(69078),fe=he.Global;It.exports={name:"oldIE-userDataStorage",write:g,read:l,each:h,remove:v,clearAll:d};var i="storejs",M=fe.document,E=u(),p=(fe.navigator?fe.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function g(m,y){if(!p){var _=s(m);E(function(x){x.setAttribute(_,y),x.save(i)})}}function l(m){if(!p){var y=s(m),_=null;return E(function(x){_=x.getAttribute(y)}),_}}function h(m){E(function(y){for(var _=y.XMLDocument.documentElement.attributes,x=_.length-1;x>=0;x--){var S=_[x];m(y.getAttribute(S.name),S.name)}})}function v(m){var y=s(m);E(function(_){_.removeAttribute(y),_.save(i)})}function d(){E(function(m){var y=m.XMLDocument.documentElement.attributes;m.load(i);for(var _=y.length-1;_>=0;_--)m.removeAttribute(y[_].name);m.save(i)})}var o=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function s(m){return m.replace(/^\d/,"___$&").replace(o,"___")}function u(){if(!M||!M.documentElement||!M.documentElement.addBehavior)return null;var m="script",y,_,x;try{_=new ActiveXObject("htmlfile"),_.open(),_.write("<"+m+">document.w=window"+m+'>'),_.close(),y=_.w.frames[0].document,x=y.createElement("div")}catch(S){x=M.createElement("div"),y=M.body}return function(S){var w=[].slice.call(arguments,0);w.unshift(x),y.appendChild(x),x.addBehavior("#default#userData"),x.load(i),S.apply(this,w),y.removeChild(x)}}},58855:function(It,Ue,Q){var he=Q(69078),fe=he.Global;It.exports={name:"sessionStorage",read:M,write:E,each:p,remove:g,clearAll:l};function i(){return fe.sessionStorage}function M(h){return i().getItem(h)}function E(h,v){return i().setItem(h,v)}function p(h){for(var v=i().length-1;v>=0;v--){var d=i().key(v);h(M(d),d)}}function g(h){return i().removeItem(h)}function l(){return i().clear()}},12320:function(It){(function(Ue,Q){if(1)It.exports=Q();else var he,fe})(window,function(){return function(Ue){var Q={};function he(fe){if(Q[fe])return Q[fe].exports;var i=Q[fe]={i:fe,l:!1,exports:{}};return Ue[fe].call(i.exports,i,i.exports,he),i.l=!0,i.exports}return he.m=Ue,he.c=Q,he.d=function(fe,i,M){he.o(fe,i)||Object.defineProperty(fe,i,{enumerable:!0,get:M})},he.r=function(fe){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(fe,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(fe,"__esModule",{value:!0})},he.t=function(fe,i){if(1&i&&(fe=he(fe)),8&i||4&i&&typeof fe=="object"&&fe&&fe.__esModule)return fe;var M=Object.create(null);if(he.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:fe}),2&i&&typeof fe!="string")for(var E in fe)he.d(M,E,function(p){return fe[p]}.bind(null,E));return M},he.n=function(fe){var i=fe&&fe.__esModule?function(){return fe.default}:function(){return fe};return he.d(i,"a",i),i},he.o=function(fe,i){return Object.prototype.hasOwnProperty.call(fe,i)},he.p="",he(he.s=34)}([function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.forwardEvent=Q.EventEmitter=void 0;var fe=function(){function i(){this._listeners=[],this._disposed=!1}return Object.defineProperty(i.prototype,"event",{get:function(){var M=this;return this._event||(this._event=function(E){return M._listeners.push(E),{dispose:function(){if(!M._disposed){for(var p=0;p >22},h.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?M.stringFromCodePoint(2097151&this.content):""},h.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},h.prototype.setFromCharData=function(v){this.fg=v[E.CHAR_DATA_ATTR_INDEX],this.bg=0;var d=!1;if(v[E.CHAR_DATA_CHAR_INDEX].length>2)d=!0;else if(v[E.CHAR_DATA_CHAR_INDEX].length===2){var o=v[E.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=o&&o<=56319){var s=v[E.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(o-55296)+s-56320+65536|v[E.CHAR_DATA_WIDTH_INDEX]<<22:d=!0}else d=!0}else this.content=v[E.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[E.CHAR_DATA_WIDTH_INDEX]<<22;d&&(this.combinedData=v[E.CHAR_DATA_CHAR_INDEX],this.content=2097152|v[E.CHAR_DATA_WIDTH_INDEX]<<22)},h.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},h}(p.AttributeData);Q.CellData=g},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.ISoundService=Q.ISelectionService=Q.IRenderService=Q.IMouseService=Q.ICoreBrowserService=Q.ICharSizeService=void 0;var fe=he(14);Q.ICharSizeService=fe.createDecorator("CharSizeService"),Q.ICoreBrowserService=fe.createDecorator("CoreBrowserService"),Q.IMouseService=fe.createDecorator("MouseService"),Q.IRenderService=fe.createDecorator("RenderService"),Q.ISelectionService=fe.createDecorator("SelectionService"),Q.ISoundService=fe.createDecorator("SoundService")},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.ExtendedAttrs=Q.AttributeData=void 0;var fe=function(){function M(){this.fg=0,this.bg=0,this.extended=new i}return M.toColorRGB=function(E){return[E>>>16&255,E>>>8&255,255&E]},M.fromColorRGB=function(E){return(255&E[0])<<16|(255&E[1])<<8|255&E[2]},M.prototype.clone=function(){var E=new M;return E.fg=this.fg,E.bg=this.bg,E.extended=this.extended.clone(),E},M.prototype.isInverse=function(){return 67108864&this.fg},M.prototype.isBold=function(){return 134217728&this.fg},M.prototype.isUnderline=function(){return 268435456&this.fg},M.prototype.isBlink=function(){return 536870912&this.fg},M.prototype.isInvisible=function(){return 1073741824&this.fg},M.prototype.isItalic=function(){return 67108864&this.bg},M.prototype.isDim=function(){return 134217728&this.bg},M.prototype.getFgColorMode=function(){return 50331648&this.fg},M.prototype.getBgColorMode=function(){return 50331648&this.bg},M.prototype.isFgRGB=function(){return(50331648&this.fg)==50331648},M.prototype.isBgRGB=function(){return(50331648&this.bg)==50331648},M.prototype.isFgPalette=function(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432},M.prototype.isBgPalette=function(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432},M.prototype.isFgDefault=function(){return(50331648&this.fg)==0},M.prototype.isBgDefault=function(){return(50331648&this.bg)==0},M.prototype.isAttributeDefault=function(){return this.fg===0&&this.bg===0},M.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},M.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},M.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},M.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},M.prototype.getUnderlineColor=function(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()},M.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},M.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()},M.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()},M.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()},M.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},M}();Q.AttributeData=fe;var i=function(){function M(E,p){E===void 0&&(E=0),p===void 0&&(p=-1),this.underlineStyle=E,this.underlineColor=p}return M.prototype.clone=function(){return new M(this.underlineStyle,this.underlineColor)},M.prototype.isEmpty=function(){return this.underlineStyle===0},M}();Q.ExtendedAttrs=i},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.addDisposableDomListener=void 0,Q.addDisposableDomListener=function(fe,i,M,E){fe.addEventListener(i,M,E);var p=!1;return{dispose:function(){p||(p=!0,fe.removeEventListener(i,M,E))}}}},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.Utf8ToUtf32=Q.StringToUtf32=Q.utf32ToString=Q.stringFromCodePoint=void 0,Q.stringFromCodePoint=function(M){return M>65535?(M-=65536,String.fromCharCode(55296+(M>>10))+String.fromCharCode(M%1024+56320)):String.fromCharCode(M)},Q.utf32ToString=function(M,E,p){E===void 0&&(E=0),p===void 0&&(p=M.length);for(var g="",l=E;l 65535?(h-=65536,g+=String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):g+=String.fromCharCode(h)}return g};var fe=function(){function M(){this._interim=0}return M.prototype.clear=function(){this._interim=0},M.prototype.decode=function(E,p){var g=E.length;if(!g)return 0;var l=0,h=0;this._interim&&(56320<=(o=E.charCodeAt(h++))&&o<=57343?p[l++]=1024*(this._interim-55296)+o-56320+65536:(p[l++]=this._interim,p[l++]=o),this._interim=0);for(var v=h;v
=g)return this._interim=d,l;var o;56320<=(o=E.charCodeAt(v))&&o<=57343?p[l++]=1024*(d-55296)+o-56320+65536:(p[l++]=d,p[l++]=o)}else p[l++]=d}return l},M}();Q.StringToUtf32=fe;var i=function(){function M(){this.interim=new Uint8Array(3)}return M.prototype.clear=function(){this.interim.fill(0)},M.prototype.decode=function(E,p){var g=E.length;if(!g)return 0;var l,h,v,d,o=0,s=0,u=0;if(this.interim[0]){var m=!1,y=this.interim[0];y&=(224&y)==192?31:(240&y)==224?15:7;for(var _=0,x=void 0;(x=63&this.interim[++_])&&_<4;)y<<=6,y|=x;for(var S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,w=S-_;u =g)return 0;if((192&(x=E[u++]))!=128){u--,m=!0;break}this.interim[_++]=x,y<<=6,y|=63&x}m||(S===2?y<128?u--:p[o++]=y:S===3?y<2048||y>=55296&&y<=57343||(p[o++]=y):y<65536||y>1114111||(p[o++]=y)),this.interim.fill(0)}for(var A=g-4,H=u;H =g)return this.interim[0]=l,o;if((192&(h=E[H++]))!=128){H--;continue}if((s=(31&l)<<6|63&h)<128){H--;continue}p[o++]=s}else if((240&l)==224){if(H>=g)return this.interim[0]=l,o;if((192&(h=E[H++]))!=128){H--;continue}if(H>=g)return this.interim[0]=l,this.interim[1]=h,o;if((192&(v=E[H++]))!=128){H--;continue}if((s=(15&l)<<12|(63&h)<<6|63&v)<2048||s>=55296&&s<=57343)continue;p[o++]=s}else if((248&l)==240){if(H>=g)return this.interim[0]=l,o;if((192&(h=E[H++]))!=128){H--;continue}if(H>=g)return this.interim[0]=l,this.interim[1]=h,o;if((192&(v=E[H++]))!=128){H--;continue}if(H>=g)return this.interim[0]=l,this.interim[1]=h,this.interim[2]=v,o;if((192&(d=E[H++]))!=128){H--;continue}if((s=(7&l)<<18|(63&h)<<12|(63&v)<<6|63&d)<65536||s>1114111)continue;p[o++]=s}}return o},M}();Q.Utf8ToUtf32=i},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.CHAR_ATLAS_CELL_SPACING=Q.DIM_OPACITY=Q.INVERTED_DEFAULT_COLOR=void 0,Q.INVERTED_DEFAULT_COLOR=257,Q.DIM_OPACITY=.5,Q.CHAR_ATLAS_CELL_SPACING=1},function(Ue,Q,he){"use strict";var fe,i,M,E;function p(l){var h=l.toString(16);return h.length<2?"0"+h:h}function g(l,h){return l >>0}}(fe=Q.channels||(Q.channels={})),(i=Q.color||(Q.color={})).blend=function(l,h){var v=(255&h.rgba)/255;if(v===1)return{css:h.css,rgba:h.rgba};var d=h.rgba>>24&255,o=h.rgba>>16&255,s=h.rgba>>8&255,u=l.rgba>>24&255,m=l.rgba>>16&255,y=l.rgba>>8&255,_=u+Math.round((d-u)*v),x=m+Math.round((o-m)*v),S=y+Math.round((s-y)*v);return{css:fe.toCss(_,x,S),rgba:fe.toRgba(_,x,S)}},i.isOpaque=function(l){return(255&l.rgba)==255},i.ensureContrastRatio=function(l,h,v){var d=E.ensureContrastRatio(l.rgba,h.rgba,v);if(d)return E.toColor(d>>24&255,d>>16&255,d>>8&255)},i.opaque=function(l){var h=(255|l.rgba)>>>0,v=E.toChannels(h),d=v[0],o=v[1],s=v[2];return{css:fe.toCss(d,o,s),rgba:h}},i.opacity=function(l,h){var v=Math.round(255*h),d=E.toChannels(l.rgba),o=d[0],s=d[1],u=d[2];return{css:fe.toCss(o,s,u,v),rgba:fe.toRgba(o,s,u,v)}},(Q.css||(Q.css={})).toColor=function(l){switch(l.length){case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(l){function h(v,d,o){var s=v/255,u=d/255,m=o/255;return .2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4))+.0722*(m<=.03928?m/12.92:Math.pow((m+.055)/1.055,2.4))}l.relativeLuminance=function(v){return h(v>>16&255,v>>8&255,255&v)},l.relativeLuminance2=h}(M=Q.rgb||(Q.rgb={})),function(l){function h(d,o,s){for(var u=d>>24&255,m=d>>16&255,y=d>>8&255,_=o>>24&255,x=o>>16&255,S=o>>8&255,w=g(M.relativeLuminance2(_,S,x),M.relativeLuminance2(u,m,y));w 0||x>0||S>0);)_-=Math.max(0,Math.ceil(.1*_)),x-=Math.max(0,Math.ceil(.1*x)),S-=Math.max(0,Math.ceil(.1*S)),w=g(M.relativeLuminance2(_,S,x),M.relativeLuminance2(u,m,y));return(_<<24|x<<16|S<<8|255)>>>0}function v(d,o,s){for(var u=d>>24&255,m=d>>16&255,y=d>>8&255,_=o>>24&255,x=o>>16&255,S=o>>8&255,w=g(M.relativeLuminance2(_,S,x),M.relativeLuminance2(u,m,y));w>>0}l.ensureContrastRatio=function(d,o,s){var u=M.relativeLuminance(d>>8),m=M.relativeLuminance(o>>8);if(g(u,m)>24&255,d>>16&255,d>>8&255,255&d]},l.toColor=function(d,o,s){return{css:fe.toCss(d,o,s),rgba:fe.toRgba(d,o,s)}}}(E=Q.rgba||(Q.rgba={})),Q.toPaddedHex=p,Q.contrastRatio=g},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.isLinux=Q.isWindows=Q.isIphone=Q.isIpad=Q.isMac=Q.isSafari=Q.isFirefox=void 0;var fe=typeof navigator=="undefined",i=fe?"node":navigator.userAgent,M=fe?"node":navigator.platform;function E(p,g){return p.indexOf(g)>=0}Q.isFirefox=!!~i.indexOf("Firefox"),Q.isSafari=/^((?!chrome|android).)*safari/i.test(i),Q.isMac=E(["Macintosh","MacIntel","MacPPC","Mac68K"],M),Q.isIpad=M==="iPad",Q.isIphone=M==="iPhone",Q.isWindows=E(["Windows","Win16","Win32","WinCE"],M),Q.isLinux=M.indexOf("Linux")>=0},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.C1=Q.C0=void 0,function(fe){fe.NUL="\0",fe.SOH="",fe.STX="",fe.ETX="",fe.EOT="",fe.ENQ="",fe.ACK="",fe.BEL="\x07",fe.BS="\b",fe.HT=" ",fe.LF=` `,fe.VT="\v",fe.FF="\f",fe.CR="\r",fe.SO="",fe.SI="",fe.DLE="",fe.DC1="",fe.DC2="",fe.DC3="",fe.DC4="",fe.NAK="",fe.SYN="",fe.ETB="",fe.CAN="",fe.EM="",fe.SUB="",fe.ESC="\x1B",fe.FS="",fe.GS="",fe.RS="",fe.US="",fe.SP=" ",fe.DEL="\x7F"}(Q.C0||(Q.C0={})),function(fe){fe.PAD="\x80",fe.HOP="\x81",fe.BPH="\x82",fe.NBH="\x83",fe.IND="\x84",fe.NEL="\x85",fe.SSA="\x86",fe.ESA="\x87",fe.HTS="\x88",fe.HTJ="\x89",fe.VTS="\x8A",fe.PLD="\x8B",fe.PLU="\x8C",fe.RI="\x8D",fe.SS2="\x8E",fe.SS3="\x8F",fe.DCS="\x90",fe.PU1="\x91",fe.PU2="\x92",fe.STS="\x93",fe.CCH="\x94",fe.MW="\x95",fe.SPA="\x96",fe.EPA="\x97",fe.SOS="\x98",fe.SGCI="\x99",fe.SCI="\x9A",fe.CSI="\x9B",fe.ST="\x9C",fe.OSC="\x9D",fe.PM="\x9E",fe.APC="\x9F"}(Q.C1||(Q.C1={}))},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.BaseRenderLayer=void 0;var fe=he(3),i=he(9),M=he(25),E=he(6),p=he(28),g=he(10),l=he(17),h=function(){function v(d,o,s,u,m,y,_,x){this._container=d,this._alpha=u,this._colors=m,this._rendererId=y,this._bufferService=_,this._optionsService=x,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+o+"-layer"),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return v.prototype.dispose=function(){var d;l.removeElementFromParent(this._canvas),(d=this._charAtlas)===null||d===void 0||d.dispose()},v.prototype._initCanvas=function(){this._ctx=p.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},v.prototype.onOptionsChanged=function(){},v.prototype.onBlur=function(){},v.prototype.onFocus=function(){},v.prototype.onCursorMove=function(){},v.prototype.onGridChanged=function(d,o){},v.prototype.onSelectionChanged=function(d,o,s){s===void 0&&(s=!1)},v.prototype.setColors=function(d){this._refreshCharAtlas(d)},v.prototype._setTransparency=function(d){if(d!==this._alpha){var o=this._canvas;this._alpha=d,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,o),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},v.prototype._refreshCharAtlas=function(d){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=M.acquireCharAtlas(this._optionsService.options,this._rendererId,d,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},v.prototype.resize=function(d){this._scaledCellWidth=d.scaledCellWidth,this._scaledCellHeight=d.scaledCellHeight,this._scaledCharWidth=d.scaledCharWidth,this._scaledCharHeight=d.scaledCharHeight,this._scaledCharLeft=d.scaledCharLeft,this._scaledCharTop=d.scaledCharTop,this._canvas.width=d.scaledCanvasWidth,this._canvas.height=d.scaledCanvasHeight,this._canvas.style.width=d.canvasWidth+"px",this._canvas.style.height=d.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},v.prototype._fillCells=function(d,o,s,u){this._ctx.fillRect(d*this._scaledCellWidth,o*this._scaledCellHeight,s*this._scaledCellWidth,u*this._scaledCellHeight)},v.prototype._fillBottomLineAtCells=function(d,o,s){s===void 0&&(s=1),this._ctx.fillRect(d*this._scaledCellWidth,(o+1)*this._scaledCellHeight-window.devicePixelRatio-1,s*this._scaledCellWidth,window.devicePixelRatio)},v.prototype._fillLeftLineAtCell=function(d,o,s){this._ctx.fillRect(d*this._scaledCellWidth,o*this._scaledCellHeight,window.devicePixelRatio*s,this._scaledCellHeight)},v.prototype._strokeRectAtCell=function(d,o,s,u){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(d*this._scaledCellWidth+window.devicePixelRatio/2,o*this._scaledCellHeight+window.devicePixelRatio/2,s*this._scaledCellWidth-window.devicePixelRatio,u*this._scaledCellHeight-window.devicePixelRatio)},v.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},v.prototype._clearCells=function(d,o,s,u){this._alpha?this._ctx.clearRect(d*this._scaledCellWidth,o*this._scaledCellHeight,s*this._scaledCellWidth,u*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(d*this._scaledCellWidth,o*this._scaledCellHeight,s*this._scaledCellWidth,u*this._scaledCellHeight))},v.prototype._fillCharTrueColor=function(d,o,s){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(s),this._ctx.fillText(d.getChars(),o*this._scaledCellWidth+this._scaledCharLeft,s*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},v.prototype._drawChars=function(d,o,s){var u,m,y=this._getContrastColor(d);y||d.isFgRGB()||d.isBgRGB()?this._drawUncachedChars(d,o,s,y):(d.isInverse()?(u=d.isBgDefault()?i.INVERTED_DEFAULT_COLOR:d.getBgColor(),m=d.isFgDefault()?i.INVERTED_DEFAULT_COLOR:d.getFgColor()):(m=d.isBgDefault()?fe.DEFAULT_COLOR:d.getBgColor(),u=d.isFgDefault()?fe.DEFAULT_COLOR:d.getFgColor()),u+=this._optionsService.options.drawBoldTextInBrightColors&&d.isBold()&&u<8?8:0,this._currentGlyphIdentifier.chars=d.getChars()||fe.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=d.getCode()||fe.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=m,this._currentGlyphIdentifier.fg=u,this._currentGlyphIdentifier.bold=!!d.isBold(),this._currentGlyphIdentifier.dim=!!d.isDim(),this._currentGlyphIdentifier.italic=!!d.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,o*this._scaledCellWidth+this._scaledCharLeft,s*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(d,o,s))},v.prototype._drawUncachedChars=function(d,o,s,u){if(this._ctx.save(),this._ctx.font=this._getFont(!!d.isBold(),!!d.isItalic()),this._ctx.textBaseline="middle",d.isInverse())if(u)this._ctx.fillStyle=u.css;else if(d.isBgDefault())this._ctx.fillStyle=g.color.opaque(this._colors.background).css;else if(d.isBgRGB())this._ctx.fillStyle="rgb("+E.AttributeData.toColorRGB(d.getBgColor()).join(",")+")";else{var m=d.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&d.isBold()&&m<8&&(m+=8),this._ctx.fillStyle=this._colors.ansi[m].css}else if(u)this._ctx.fillStyle=u.css;else if(d.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(d.isFgRGB())this._ctx.fillStyle="rgb("+E.AttributeData.toColorRGB(d.getFgColor()).join(",")+")";else{var y=d.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&d.isBold()&&y<8&&(y+=8),this._ctx.fillStyle=this._colors.ansi[y].css}this._clipRow(s),d.isDim()&&(this._ctx.globalAlpha=i.DIM_OPACITY),this._ctx.fillText(d.getChars(),o*this._scaledCellWidth+this._scaledCharLeft,s*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},v.prototype._clipRow=function(d){this._ctx.beginPath(),this._ctx.rect(0,d*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},v.prototype._getFont=function(d,o){return(o?"italic":"")+" "+(d?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},v.prototype._getContrastColor=function(d){if(this._optionsService.options.minimumContrastRatio!==1){var o=this._colors.contrastCache.getColor(d.bg,d.fg);if(o!==void 0)return o||void 0;var s=d.getFgColor(),u=d.getFgColorMode(),m=d.getBgColor(),y=d.getBgColorMode(),_=!!d.isInverse(),x=!!d.isInverse();if(_){var S=s;s=m,m=S;var w=u;u=y,y=w}var A=this._resolveBackgroundRgba(y,m,_),H=this._resolveForegroundRgba(u,s,_,x),R=g.rgba.ensureContrastRatio(A,H,this._optionsService.options.minimumContrastRatio);if(R){var F={css:g.channels.toCss(R>>24&255,R>>16&255,R>>8&255),rgba:R};return this._colors.contrastCache.setColor(d.bg,d.fg,F),F}this._colors.contrastCache.setColor(d.bg,d.fg,null)}},v.prototype._resolveBackgroundRgba=function(d,o,s){switch(d){case 16777216:case 33554432:return this._colors.ansi[o].rgba;case 50331648:return o<<8;case 0:default:return s?this._colors.foreground.rgba:this._colors.background.rgba}},v.prototype._resolveForegroundRgba=function(d,o,s,u){switch(d){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&u&&o<8&&(o+=8),this._colors.ansi[o].rgba;case 50331648:return o<<8;case 0:default:return s?this._colors.background.rgba:this._colors.foreground.rgba}},v}();Q.BaseRenderLayer=h},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.createDecorator=Q.getServiceDependencies=Q.serviceRegistry=void 0;function fe(i,M,E){M.di$target===M?M.di$dependencies.push({id:i,index:E}):(M.di$dependencies=[{id:i,index:E}],M.di$target=M)}Q.serviceRegistry=new Map,Q.getServiceDependencies=function(i){return i.di$dependencies||[]},Q.createDecorator=function(i){if(Q.serviceRegistry.has(i))return Q.serviceRegistry.get(i);var M=function(E,p,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");fe(M,E,g)};return M.toString=function(){return i},Q.serviceRegistry.set(i,M),M}},function(Ue,Q,he){"use strict";function fe(i,M,E,p){if(E===void 0&&(E=0),p===void 0&&(p=i.length),E>=i.length)return i;E=(i.length+E)%i.length,p=p>=i.length?i.length:(i.length+p)%i.length;for(var g=E;g>22,2097152&h?this._combined[l].charCodeAt(this._combined[l].length-1):v]},g.prototype.set=function(l,h){this._data[3*l+1]=h[i.CHAR_DATA_ATTR_INDEX],h[i.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[l]=h[1],this._data[3*l+0]=2097152|l|h[i.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*l+0]=h[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|h[i.CHAR_DATA_WIDTH_INDEX]<<22},g.prototype.getWidth=function(l){return this._data[3*l+0]>>22},g.prototype.hasWidth=function(l){return 12582912&this._data[3*l+0]},g.prototype.getFg=function(l){return this._data[3*l+1]},g.prototype.getBg=function(l){return this._data[3*l+2]},g.prototype.hasContent=function(l){return 4194303&this._data[3*l+0]},g.prototype.getCodePoint=function(l){var h=this._data[3*l+0];return 2097152&h?this._combined[l].charCodeAt(this._combined[l].length-1):2097151&h},g.prototype.isCombined=function(l){return 2097152&this._data[3*l+0]},g.prototype.getString=function(l){var h=this._data[3*l+0];return 2097152&h?this._combined[l]:2097151&h?fe.stringFromCodePoint(2097151&h):""},g.prototype.loadCell=function(l,h){var v=3*l;return h.content=this._data[v+0],h.fg=this._data[v+1],h.bg=this._data[v+2],2097152&h.content&&(h.combinedData=this._combined[l]),268435456&h.bg&&(h.extended=this._extendedAttrs[l]),h},g.prototype.setCell=function(l,h){2097152&h.content&&(this._combined[l]=h.combinedData),268435456&h.bg&&(this._extendedAttrs[l]=h.extended),this._data[3*l+0]=h.content,this._data[3*l+1]=h.fg,this._data[3*l+2]=h.bg},g.prototype.setCellFromCodePoint=function(l,h,v,d,o,s){268435456&o&&(this._extendedAttrs[l]=s),this._data[3*l+0]=h|v<<22,this._data[3*l+1]=d,this._data[3*l+2]=o},g.prototype.addCodepointToCell=function(l,h){var v=this._data[3*l+0];2097152&v?this._combined[l]+=fe.stringFromCodePoint(h):(2097151&v?(this._combined[l]=fe.stringFromCodePoint(2097151&v)+fe.stringFromCodePoint(h),v&=-2097152,v|=2097152):v=h|1<<22,this._data[3*l+0]=v)},g.prototype.insertCells=function(l,h,v,d){if((l%=this.length)&&this.getWidth(l-1)===2&&this.setCellFromCodePoint(l-1,0,1,(d==null?void 0:d.fg)||0,(d==null?void 0:d.bg)||0,(d==null?void 0:d.extended)||new E.ExtendedAttrs),h
=0;--s)this.setCell(l+h+s,this.loadCell(l+s,o));for(s=0;s this.length){var v=new Uint32Array(3*l);this.length&&(3*l =l&&delete this._combined[s]}}else this._data=new Uint32Array(0),this._combined={};this.length=l}},g.prototype.fill=function(l){this._combined={},this._extendedAttrs={};for(var h=0;h =0;--l)if(4194303&this._data[3*l+0])return l+(this._data[3*l+0]>>22);return 0},g.prototype.copyCellsFrom=function(l,h,v,d,o){var s=l._data;if(o)for(var u=d-1;u>=0;u--)for(var m=0;m<3;m++)this._data[3*(v+u)+m]=s[3*(h+u)+m];else for(u=0;u =h&&(this._combined[_-h+v]=l._combined[_])}},g.prototype.translateToString=function(l,h,v){l===void 0&&(l=!1),h===void 0&&(h=0),v===void 0&&(v=this.length),l&&(v=Math.min(v,this.getTrimmedLength()));for(var d="";h >22||1}return d},g}();Q.BufferLine=p},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.removeElementFromParent=void 0,Q.removeElementFromParent=function(){for(var fe,i=[],M=0;M 24)return R.setWinLines||!1;switch(H){case 1:return!!R.restoreWin;case 2:return!!R.minimizeWin;case 3:return!!R.setWinPosition;case 4:return!!R.setWinSizePixels;case 5:return!!R.raiseWin;case 6:return!!R.lowerWin;case 7:return!!R.refreshWin;case 8:return!!R.setWinSizeChars;case 9:return!!R.maximizeWin;case 10:return!!R.fullscreenWin;case 11:return!!R.getWinState;case 13:return!!R.getWinPosition;case 14:return!!R.getWinSizePixels;case 15:return!!R.getScreenSizePixels;case 16:return!!R.getCellSizePixels;case 18:return!!R.getWinSizeChars;case 19:return!!R.getScreenSizeChars;case 20:return!!R.getIconTitle;case 21:return!!R.getWinTitle;case 22:return!!R.pushTitle;case 23:return!!R.popTitle;case 24:return!!R.setWinLines}return!1}(function(H){H[H.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",H[H.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(M=Q.WindowsOptionsReportType||(Q.WindowsOptionsReportType={}));var w=function(){function H(R,F,D,B){this._bufferService=R,this._coreService=F,this._logService=D,this._optionsService=B,this._data=new Uint32Array(0)}return H.prototype.hook=function(R){this._data=new Uint32Array(0)},H.prototype.put=function(R,F,D){this._data=h.concat(this._data,R.subarray(F,D))},H.prototype.unhook=function(R){if(R){var F=v.utf32ToString(this._data);switch(this._data=new Uint32Array(0),F){case'"q':return this._coreService.triggerDataEvent(E.C0.ESC+'P1$r0"q'+E.C0.ESC+"\\");case'"p':return this._coreService.triggerDataEvent(E.C0.ESC+'P1$r61;1"p'+E.C0.ESC+"\\");case"r":var D=this._bufferService.buffer.scrollTop+1+";"+(this._bufferService.buffer.scrollBottom+1)+"r";return this._coreService.triggerDataEvent(E.C0.ESC+"P1$r"+D+E.C0.ESC+"\\");case"m":return this._coreService.triggerDataEvent(E.C0.ESC+"P1$r0m"+E.C0.ESC+"\\");case" q":var B={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];return B-=this._optionsService.options.cursorBlink?1:0,this._coreService.triggerDataEvent(E.C0.ESC+"P1$r"+B+" q"+E.C0.ESC+"\\");default:this._logService.debug("Unknown DCS $q %s",F),this._coreService.triggerDataEvent(E.C0.ESC+"P0$r"+E.C0.ESC+"\\")}}else this._data=new Uint32Array(0)},H}(),A=function(H){function R(F,D,B,P,U,G,ee,K,Z){Z===void 0&&(Z=new g.EscapeSequenceParser);var $=H.call(this)||this;$._bufferService=F,$._charsetService=D,$._coreService=B,$._dirtyRowService=P,$._logService=U,$._optionsService=G,$._coreMouseService=ee,$._unicodeService=K,$._parser=Z,$._parseBuffer=new Uint32Array(4096),$._stringDecoder=new v.StringToUtf32,$._utf8Decoder=new v.Utf8ToUtf32,$._workCell=new u.CellData,$._windowTitle="",$._iconName="",$._windowTitleStack=[],$._iconNameStack=[],$._curAttrData=d.DEFAULT_ATTR_DATA.clone(),$._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),$._onRequestBell=new o.EventEmitter,$._onRequestRefreshRows=new o.EventEmitter,$._onRequestReset=new o.EventEmitter,$._onRequestScroll=new o.EventEmitter,$._onRequestSyncScrollBar=new o.EventEmitter,$._onRequestWindowsOptionsReport=new o.EventEmitter,$._onA11yChar=new o.EventEmitter,$._onA11yTab=new o.EventEmitter,$._onCursorMove=new o.EventEmitter,$._onLineFeed=new o.EventEmitter,$._onScroll=new o.EventEmitter,$._onTitleChange=new o.EventEmitter,$.register($._parser),$._parser.setCsiHandlerFallback(function(Y,le){$._logService.debug("Unknown CSI code: ",{identifier:$._parser.identToString(Y),params:le.toArray()})}),$._parser.setEscHandlerFallback(function(Y){$._logService.debug("Unknown ESC code: ",{identifier:$._parser.identToString(Y)})}),$._parser.setExecuteHandlerFallback(function(Y){$._logService.debug("Unknown EXECUTE code: ",{code:Y})}),$._parser.setOscHandlerFallback(function(Y,le,xe){$._logService.debug("Unknown OSC code: ",{identifier:Y,action:le,data:xe})}),$._parser.setDcsHandlerFallback(function(Y,le,xe){le==="HOOK"&&(xe=xe.toArray()),$._logService.debug("Unknown DCS code: ",{identifier:$._parser.identToString(Y),action:le,payload:xe})}),$._parser.setPrintHandler(function(Y,le,xe){return $.print(Y,le,xe)}),$._parser.setCsiHandler({final:"@"},function(Y){return $.insertChars(Y)}),$._parser.setCsiHandler({intermediates:" ",final:"@"},function(Y){return $.scrollLeft(Y)}),$._parser.setCsiHandler({final:"A"},function(Y){return $.cursorUp(Y)}),$._parser.setCsiHandler({intermediates:" ",final:"A"},function(Y){return $.scrollRight(Y)}),$._parser.setCsiHandler({final:"B"},function(Y){return $.cursorDown(Y)}),$._parser.setCsiHandler({final:"C"},function(Y){return $.cursorForward(Y)}),$._parser.setCsiHandler({final:"D"},function(Y){return $.cursorBackward(Y)}),$._parser.setCsiHandler({final:"E"},function(Y){return $.cursorNextLine(Y)}),$._parser.setCsiHandler({final:"F"},function(Y){return $.cursorPrecedingLine(Y)}),$._parser.setCsiHandler({final:"G"},function(Y){return $.cursorCharAbsolute(Y)}),$._parser.setCsiHandler({final:"H"},function(Y){return $.cursorPosition(Y)}),$._parser.setCsiHandler({final:"I"},function(Y){return $.cursorForwardTab(Y)}),$._parser.setCsiHandler({final:"J"},function(Y){return $.eraseInDisplay(Y)}),$._parser.setCsiHandler({prefix:"?",final:"J"},function(Y){return $.eraseInDisplay(Y)}),$._parser.setCsiHandler({final:"K"},function(Y){return $.eraseInLine(Y)}),$._parser.setCsiHandler({prefix:"?",final:"K"},function(Y){return $.eraseInLine(Y)}),$._parser.setCsiHandler({final:"L"},function(Y){return $.insertLines(Y)}),$._parser.setCsiHandler({final:"M"},function(Y){return $.deleteLines(Y)}),$._parser.setCsiHandler({final:"P"},function(Y){return $.deleteChars(Y)}),$._parser.setCsiHandler({final:"S"},function(Y){return $.scrollUp(Y)}),$._parser.setCsiHandler({final:"T"},function(Y){return $.scrollDown(Y)}),$._parser.setCsiHandler({final:"X"},function(Y){return $.eraseChars(Y)}),$._parser.setCsiHandler({final:"Z"},function(Y){return $.cursorBackwardTab(Y)}),$._parser.setCsiHandler({final:"`"},function(Y){return $.charPosAbsolute(Y)}),$._parser.setCsiHandler({final:"a"},function(Y){return $.hPositionRelative(Y)}),$._parser.setCsiHandler({final:"b"},function(Y){return $.repeatPrecedingCharacter(Y)}),$._parser.setCsiHandler({final:"c"},function(Y){return $.sendDeviceAttributesPrimary(Y)}),$._parser.setCsiHandler({prefix:">",final:"c"},function(Y){return $.sendDeviceAttributesSecondary(Y)}),$._parser.setCsiHandler({final:"d"},function(Y){return $.linePosAbsolute(Y)}),$._parser.setCsiHandler({final:"e"},function(Y){return $.vPositionRelative(Y)}),$._parser.setCsiHandler({final:"f"},function(Y){return $.hVPosition(Y)}),$._parser.setCsiHandler({final:"g"},function(Y){return $.tabClear(Y)}),$._parser.setCsiHandler({final:"h"},function(Y){return $.setMode(Y)}),$._parser.setCsiHandler({prefix:"?",final:"h"},function(Y){return $.setModePrivate(Y)}),$._parser.setCsiHandler({final:"l"},function(Y){return $.resetMode(Y)}),$._parser.setCsiHandler({prefix:"?",final:"l"},function(Y){return $.resetModePrivate(Y)}),$._parser.setCsiHandler({final:"m"},function(Y){return $.charAttributes(Y)}),$._parser.setCsiHandler({final:"n"},function(Y){return $.deviceStatus(Y)}),$._parser.setCsiHandler({prefix:"?",final:"n"},function(Y){return $.deviceStatusPrivate(Y)}),$._parser.setCsiHandler({intermediates:"!",final:"p"},function(Y){return $.softReset(Y)}),$._parser.setCsiHandler({intermediates:" ",final:"q"},function(Y){return $.setCursorStyle(Y)}),$._parser.setCsiHandler({final:"r"},function(Y){return $.setScrollRegion(Y)}),$._parser.setCsiHandler({final:"s"},function(Y){return $.saveCursor(Y)}),$._parser.setCsiHandler({final:"t"},function(Y){return $.windowOptions(Y)}),$._parser.setCsiHandler({final:"u"},function(Y){return $.restoreCursor(Y)}),$._parser.setCsiHandler({intermediates:"'",final:"}"},function(Y){return $.insertColumns(Y)}),$._parser.setCsiHandler({intermediates:"'",final:"~"},function(Y){return $.deleteColumns(Y)}),$._parser.setExecuteHandler(E.C0.BEL,function(){return $.bell()}),$._parser.setExecuteHandler(E.C0.LF,function(){return $.lineFeed()}),$._parser.setExecuteHandler(E.C0.VT,function(){return $.lineFeed()}),$._parser.setExecuteHandler(E.C0.FF,function(){return $.lineFeed()}),$._parser.setExecuteHandler(E.C0.CR,function(){return $.carriageReturn()}),$._parser.setExecuteHandler(E.C0.BS,function(){return $.backspace()}),$._parser.setExecuteHandler(E.C0.HT,function(){return $.tab()}),$._parser.setExecuteHandler(E.C0.SO,function(){return $.shiftOut()}),$._parser.setExecuteHandler(E.C0.SI,function(){return $.shiftIn()}),$._parser.setExecuteHandler(E.C1.IND,function(){return $.index()}),$._parser.setExecuteHandler(E.C1.NEL,function(){return $.nextLine()}),$._parser.setExecuteHandler(E.C1.HTS,function(){return $.tabSet()}),$._parser.setOscHandler(0,new y.OscHandler(function(Y){$.setTitle(Y),$.setIconName(Y)})),$._parser.setOscHandler(1,new y.OscHandler(function(Y){return $.setIconName(Y)})),$._parser.setOscHandler(2,new y.OscHandler(function(Y){return $.setTitle(Y)})),$._parser.setEscHandler({final:"7"},function(){return $.saveCursor()}),$._parser.setEscHandler({final:"8"},function(){return $.restoreCursor()}),$._parser.setEscHandler({final:"D"},function(){return $.index()}),$._parser.setEscHandler({final:"E"},function(){return $.nextLine()}),$._parser.setEscHandler({final:"H"},function(){return $.tabSet()}),$._parser.setEscHandler({final:"M"},function(){return $.reverseIndex()}),$._parser.setEscHandler({final:"="},function(){return $.keypadApplicationMode()}),$._parser.setEscHandler({final:">"},function(){return $.keypadNumericMode()}),$._parser.setEscHandler({final:"c"},function(){return $.fullReset()}),$._parser.setEscHandler({final:"n"},function(){return $.setgLevel(2)}),$._parser.setEscHandler({final:"o"},function(){return $.setgLevel(3)}),$._parser.setEscHandler({final:"|"},function(){return $.setgLevel(3)}),$._parser.setEscHandler({final:"}"},function(){return $.setgLevel(2)}),$._parser.setEscHandler({final:"~"},function(){return $.setgLevel(1)}),$._parser.setEscHandler({intermediates:"%",final:"@"},function(){return $.selectDefaultCharset()}),$._parser.setEscHandler({intermediates:"%",final:"G"},function(){return $.selectDefaultCharset()});var oe=function(Y){ae._parser.setEscHandler({intermediates:"(",final:Y},function(){return $.selectCharset("("+Y)}),ae._parser.setEscHandler({intermediates:")",final:Y},function(){return $.selectCharset(")"+Y)}),ae._parser.setEscHandler({intermediates:"*",final:Y},function(){return $.selectCharset("*"+Y)}),ae._parser.setEscHandler({intermediates:"+",final:Y},function(){return $.selectCharset("+"+Y)}),ae._parser.setEscHandler({intermediates:"-",final:Y},function(){return $.selectCharset("-"+Y)}),ae._parser.setEscHandler({intermediates:".",final:Y},function(){return $.selectCharset("."+Y)}),ae._parser.setEscHandler({intermediates:"/",final:Y},function(){return $.selectCharset("/"+Y)})},ae=this;for(var ye in p.CHARSETS)oe(ye);return $._parser.setEscHandler({intermediates:"#",final:"8"},function(){return $.screenAlignmentPattern()}),$._parser.setErrorHandler(function(Y){return $._logService.error("Parsing error: ",Y),Y}),$._parser.setDcsHandler({intermediates:"$",final:"q"},new w($._bufferService,$._coreService,$._logService,$._optionsService)),$}return i(R,H),Object.defineProperty(R.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(R.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),R.prototype.dispose=function(){H.prototype.dispose.call(this)},R.prototype.parse=function(F){var D=this._bufferService.buffer,B=D.x,P=D.y;if(this._logService.debug("parsing data",F),this._parseBuffer.length 131072)for(var U=0;U 0&&ye.getWidth(G.x-1)===2&&ye.setCellFromCodePoint(G.x-1,0,1,ae.fg,ae.bg,ae.extended);for(var Y=D;Y=Z){if($){for(;G.x =this._bufferService.rows&&(G.y=this._bufferService.rows-1),G.lines.get(G.ybase+G.y).isWrapped=!0),ye=G.lines.get(G.ybase+G.y)}else if(G.x=Z-1,U===2)continue}if(oe&&(ye.insertCells(G.x,U,G.getNullCell(ae),ae),ye.getWidth(Z-1)===2&&ye.setCellFromCodePoint(Z-1,s.NULL_CELL_CODE,s.NULL_CELL_WIDTH,ae.fg,ae.bg,ae.extended)),ye.setCellFromCodePoint(G.x++,P,U,ae.fg,ae.bg,ae.extended),U>0)for(;--U;)ye.setCellFromCodePoint(G.x++,0,0,ae.fg,ae.bg,ae.extended)}else ye.getWidth(G.x-1)?ye.addCodepointToCell(G.x-1,P):ye.addCodepointToCell(G.x-2,P)}B-D>0&&(ye.loadCell(G.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),G.x 0&&ye.getWidth(G.x)===0&&!ye.hasContent(G.x)&&ye.setCellFromCodePoint(G.x,0,1,ae.fg,ae.bg,ae.extended),this._dirtyRowService.markDirty(G.y)},R.prototype.addCsiHandler=function(F,D){var B=this;return F.final!=="t"||F.prefix||F.intermediates?this._parser.addCsiHandler(F,D):this._parser.addCsiHandler(F,function(P){return!S(P.params[0],B._optionsService.options.windowOptions)||D(P)})},R.prototype.addDcsHandler=function(F,D){return this._parser.addDcsHandler(F,new _.DcsHandler(D))},R.prototype.addEscHandler=function(F,D){return this._parser.addEscHandler(F,D)},R.prototype.addOscHandler=function(F,D){return this._parser.addOscHandler(F,new y.OscHandler(D))},R.prototype.bell=function(){this._onRequestBell.fire()},R.prototype.lineFeed=function(){var F=this._bufferService.buffer;this._dirtyRowService.markDirty(F.y),this._optionsService.options.convertEol&&(F.x=0),F.y++,F.y===F.scrollBottom+1?(F.y--,this._onRequestScroll.fire(this._eraseAttrData())):F.y>=this._bufferService.rows&&(F.y=this._bufferService.rows-1),F.x>=this._bufferService.cols&&F.x--,this._dirtyRowService.markDirty(F.y),this._onLineFeed.fire()},R.prototype.carriageReturn=function(){this._bufferService.buffer.x=0},R.prototype.backspace=function(){var F,D=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),void(D.x>0&&D.x--);if(this._restrictCursor(this._bufferService.cols),D.x>0)D.x--;else if(D.x===0&&D.y>D.scrollTop&&D.y<=D.scrollBottom&&(!((F=D.lines.get(D.ybase+D.y))===null||F===void 0)&&F.isWrapped)){D.lines.get(D.ybase+D.y).isWrapped=!1,D.y--,D.x=this._bufferService.cols-1;var B=D.lines.get(D.ybase+D.y);B.hasWidth(D.x)&&!B.hasContent(D.x)&&D.x--}this._restrictCursor()},R.prototype.tab=function(){if(!(this._bufferService.buffer.x>=this._bufferService.cols)){var F=this._bufferService.buffer.x;this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-F)}},R.prototype.shiftOut=function(){this._charsetService.setgLevel(1)},R.prototype.shiftIn=function(){this._charsetService.setgLevel(0)},R.prototype._restrictCursor=function(F){F===void 0&&(F=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(F,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},R.prototype._setCursor=function(F,D){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=F,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+D):(this._bufferService.buffer.x=F,this._bufferService.buffer.y=D),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},R.prototype._moveCursor=function(F,D){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+F,this._bufferService.buffer.y+D)},R.prototype.cursorUp=function(F){var D=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;D>=0?this._moveCursor(0,-Math.min(D,F.params[0]||1)):this._moveCursor(0,-(F.params[0]||1))},R.prototype.cursorDown=function(F){var D=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;D>=0?this._moveCursor(0,Math.min(D,F.params[0]||1)):this._moveCursor(0,F.params[0]||1)},R.prototype.cursorForward=function(F){this._moveCursor(F.params[0]||1,0)},R.prototype.cursorBackward=function(F){this._moveCursor(-(F.params[0]||1),0)},R.prototype.cursorNextLine=function(F){this.cursorDown(F),this._bufferService.buffer.x=0},R.prototype.cursorPrecedingLine=function(F){this.cursorUp(F),this._bufferService.buffer.x=0},R.prototype.cursorCharAbsolute=function(F){this._setCursor((F.params[0]||1)-1,this._bufferService.buffer.y)},R.prototype.cursorPosition=function(F){this._setCursor(F.length>=2?(F.params[1]||1)-1:0,(F.params[0]||1)-1)},R.prototype.charPosAbsolute=function(F){this._setCursor((F.params[0]||1)-1,this._bufferService.buffer.y)},R.prototype.hPositionRelative=function(F){this._moveCursor(F.params[0]||1,0)},R.prototype.linePosAbsolute=function(F){this._setCursor(this._bufferService.buffer.x,(F.params[0]||1)-1)},R.prototype.vPositionRelative=function(F){this._moveCursor(0,F.params[0]||1)},R.prototype.hVPosition=function(F){this.cursorPosition(F)},R.prototype.tabClear=function(F){var D=F.params[0];D===0?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:D===3&&(this._bufferService.buffer.tabs={})},R.prototype.cursorForwardTab=function(F){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var D=F.params[0]||1;D--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop()},R.prototype.cursorBackwardTab=function(F){if(!(this._bufferService.buffer.x>=this._bufferService.cols))for(var D=F.params[0]||1,B=this._bufferService.buffer;D--;)B.x=B.prevStop()},R.prototype._eraseInBufferLine=function(F,D,B,P){P===void 0&&(P=!1);var U=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+F);U.replaceCells(D,B,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),P&&(U.isWrapped=!1)},R.prototype._resetBufferLine=function(F){var D=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+F);D.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),D.isWrapped=!1},R.prototype.eraseInDisplay=function(F){var D;switch(this._restrictCursor(),F.params[0]){case 0:for(D=this._bufferService.buffer.y,this._dirtyRowService.markDirty(D),this._eraseInBufferLine(D++,this._bufferService.buffer.x,this._bufferService.cols,this._bufferService.buffer.x===0);D =this._bufferService.cols&&(this._bufferService.buffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D);this._dirtyRowService.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowService.markDirty(D-1);D--;)this._resetBufferLine(D);this._dirtyRowService.markDirty(0);break;case 3:var B=this._bufferService.buffer.lines.length-this._bufferService.rows;B>0&&(this._bufferService.buffer.lines.trimStart(B),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-B,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-B,0),this._onScroll.fire(0))}},R.prototype.eraseInLine=function(F){switch(this._restrictCursor(),F.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}this._dirtyRowService.markDirty(this._bufferService.buffer.y)},R.prototype.insertLines=function(F){this._restrictCursor();var D=F.params[0]||1,B=this._bufferService.buffer;if(!(B.y>B.scrollBottom||B.y B.scrollBottom||B.y D.scrollBottom||D.y D.scrollBottom||D.y D.scrollBottom||D.y D.scrollBottom||D.y 0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(E.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(E.C0.ESC+"[?6c"))},R.prototype.sendDeviceAttributesSecondary=function(F){F.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(E.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(E.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(F.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(E.C0.ESC+"[>83;40003;0c"))},R.prototype._is=function(F){return(this._optionsService.options.termName+"").indexOf(F)===0},R.prototype.setMode=function(F){for(var D=0;D =2||P[1]===2&&G+U>=5)break;P[1]&&(U=1)}while(++G+D 5)&&(F=1),D.extended.underlineStyle=F,D.fg|=268435456,F===0&&(D.fg&=-268435457),D.updateExtended()},R.prototype.charAttributes=function(F){if(F.length===1&&F.params[0]===0)return this._curAttrData.fg=d.DEFAULT_ATTR_DATA.fg,void(this._curAttrData.bg=d.DEFAULT_ATTR_DATA.bg);for(var D,B=F.length,P=this._curAttrData,U=0;U=30&&D<=37?(P.fg&=-50331904,P.fg|=16777216|D-30):D>=40&&D<=47?(P.bg&=-50331904,P.bg|=16777216|D-40):D>=90&&D<=97?(P.fg&=-50331904,P.fg|=16777224|D-90):D>=100&&D<=107?(P.bg&=-50331904,P.bg|=16777224|D-100):D===0?(P.fg=d.DEFAULT_ATTR_DATA.fg,P.bg=d.DEFAULT_ATTR_DATA.bg):D===1?P.fg|=134217728:D===3?P.bg|=67108864:D===4?(P.fg|=268435456,this._processUnderline(F.hasSubParams(U)?F.getSubParams(U)[0]:1,P)):D===5?P.fg|=536870912:D===7?P.fg|=67108864:D===8?P.fg|=1073741824:D===2?P.bg|=134217728:D===21?this._processUnderline(2,P):D===22?(P.fg&=-134217729,P.bg&=-134217729):D===23?P.bg&=-67108865:D===24?P.fg&=-268435457:D===25?P.fg&=-536870913:D===27?P.fg&=-67108865:D===28?P.fg&=-1073741825:D===39?(P.fg&=-67108864,P.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):D===49?(P.bg&=-67108864,P.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?U+=this._extractColor(F,U,P):D===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):D===100?(P.fg&=-67108864,P.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D)},R.prototype.deviceStatus=function(F){switch(F.params[0]){case 5:this._coreService.triggerDataEvent(E.C0.ESC+"[0n");break;case 6:var D=this._bufferService.buffer.y+1,B=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(E.C0.ESC+"["+D+";"+B+"R")}},R.prototype.deviceStatusPrivate=function(F){switch(F.params[0]){case 6:var D=this._bufferService.buffer.y+1,B=this._bufferService.buffer.x+1;this._coreService.triggerDataEvent(E.C0.ESC+"[?"+D+";"+B+"R")}},R.prototype.softReset=function(F){this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1},R.prototype.setCursorStyle=function(F){var D=F.params[0]||1;switch(D){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}var B=D%2==1;this._optionsService.options.cursorBlink=B},R.prototype.setScrollRegion=function(F){var D,B=F.params[0]||1;(F.length<2||(D=F.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>B&&(this._bufferService.buffer.scrollTop=B-1,this._bufferService.buffer.scrollBottom=D-1,this._setCursor(0,0))},R.prototype.windowOptions=function(F){if(S(F.params[0],this._optionsService.options.windowOptions)){var D=F.length>1?F.params[1]:0;switch(F.params[0]){case 14:D!==2&&this._onRequestWindowsOptionsReport.fire(M.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(M.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(E.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:D!==0&&D!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),D!==0&&D!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:D!==0&&D!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),D!==0&&D!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}}},R.prototype.saveCursor=function(F){this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset},R.prototype.restoreCursor=function(F){this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor()},R.prototype.setTitle=function(F){this._windowTitle=F,this._onTitleChange.fire(F)},R.prototype.setIconName=function(F){this._iconName=F},R.prototype.nextLine=function(){this._bufferService.buffer.x=0,this.index()},R.prototype.keypadApplicationMode=function(){this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire()},R.prototype.keypadNumericMode=function(){this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire()},R.prototype.selectDefaultCharset=function(){this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,p.DEFAULT_CHARSET)},R.prototype.selectCharset=function(F){F.length===2?F[0]!=="/"&&this._charsetService.setgCharset(x[F[0]],p.CHARSETS[F[1]]||p.DEFAULT_CHARSET):this.selectDefaultCharset()},R.prototype.index=function(){this._restrictCursor();var F=this._bufferService.buffer;this._bufferService.buffer.y++,F.y===F.scrollBottom+1?(F.y--,this._onRequestScroll.fire(this._eraseAttrData())):F.y>=this._bufferService.rows&&(F.y=this._bufferService.rows-1),this._restrictCursor()},R.prototype.tabSet=function(){this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0},R.prototype.reverseIndex=function(){this._restrictCursor();var F=this._bufferService.buffer;if(F.y===F.scrollTop){var D=F.scrollBottom-F.scrollTop;F.lines.shiftElements(F.ybase+F.y,D,1),F.lines.set(F.ybase+F.y,F.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(F.scrollTop,F.scrollBottom)}else F.y--,this._restrictCursor()},R.prototype.fullReset=function(){this._parser.reset(),this._onRequestReset.fire()},R.prototype.reset=function(){this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()},R.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},R.prototype.setgLevel=function(F){this._charsetService.setgLevel(F)},R.prototype.screenAlignmentPattern=function(){var F=new u.CellData;F.content=1<<22|69,F.fg=this._curAttrData.fg,F.bg=this._curAttrData.bg;var D=this._bufferService.buffer;this._setCursor(0,0);for(var B=0;B 256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(M),this.length=0,this._subParams=new Int32Array(E),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(M),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return i.fromArray=function(M){var E=new i;if(!M.length)return E;for(var p=M[0]instanceof Array?1:0;p >8,g=255&this._subParamsIdx[E];g-p>0&&M.push(Array.prototype.slice.call(this._subParams,p,g))}return M},i.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},i.prototype.addParam=function(M){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(M<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=M>2147483647?2147483647:M}},i.prototype.addSubParam=function(M){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(M<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=M>2147483647?2147483647:M,this._subParamsIdx[this.length-1]++}},i.prototype.hasSubParams=function(M){return(255&this._subParamsIdx[M])-(this._subParamsIdx[M]>>8)>0},i.prototype.getSubParams=function(M){var E=this._subParamsIdx[M]>>8,p=255&this._subParamsIdx[M];return p-E>0?this._subParams.subarray(E,p):null},i.prototype.getSubParamsAll=function(){for(var M={},E=0;E >8,g=255&this._subParamsIdx[E];g-p>0&&(M[E]=this._subParams.slice(p,g))}return M},i.prototype.addDigit=function(M){var E;if(!(this._rejectDigits||!(E=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var p=this._digitIsSub?this._subParams:this.params,g=p[E-1];p[E-1]=~g?Math.min(10*g+M,2147483647):M}},i}();Q.Params=fe},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.OscHandler=Q.OscParser=void 0;var fe=he(23),i=he(8),M=function(){function p(){this._state=0,this._id=-1,this._handlers=Object.create(null),this._handlerFb=function(){}}return p.prototype.addHandler=function(g,l){this._handlers[g]===void 0&&(this._handlers[g]=[]);var h=this._handlers[g];return h.push(l),{dispose:function(){var v=h.indexOf(l);v!==-1&&h.splice(v,1)}}},p.prototype.setHandler=function(g,l){this._handlers[g]=[l]},p.prototype.clearHandler=function(g){this._handlers[g]&&delete this._handlers[g]},p.prototype.setHandlerFallback=function(g){this._handlerFb=g},p.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},p.prototype.reset=function(){this._state===2&&this.end(!1),this._id=-1,this._state=0},p.prototype._start=function(){var g=this._handlers[this._id];if(g)for(var l=g.length-1;l>=0;l--)g[l].start();else this._handlerFb(this._id,"START")},p.prototype._put=function(g,l,h){var v=this._handlers[this._id];if(v)for(var d=v.length-1;d>=0;d--)v[d].put(g,l,h);else this._handlerFb(this._id,"PUT",i.utf32ToString(g,l,h))},p.prototype._end=function(g){var l=this._handlers[this._id];if(l){for(var h=l.length-1;h>=0&&l[h].end(g)===!1;h--);for(h--;h>=0;h--)l[h].end(!1)}else this._handlerFb(this._id,"END",g)},p.prototype.start=function(){this.reset(),this._id=-1,this._state=1},p.prototype.put=function(g,l,h){if(this._state!==3){if(this._state===1)for(;l 0&&this._put(g,l,h)}},p.prototype.end=function(g){this._state!==0&&(this._state!==3&&(this._state===1&&this._start(),this._end(g)),this._id=-1,this._state=0)},p}();Q.OscParser=M;var E=function(){function p(g){this._handler=g,this._data="",this._hitLimit=!1}return p.prototype.start=function(){this._data="",this._hitLimit=!1},p.prototype.put=function(g,l,h){this._hitLimit||(this._data+=i.utf32ToString(g,l,h),this._data.length>fe.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},p.prototype.end=function(g){var l;return this._hitLimit?l=!1:g&&(l=this._handler(this._data)),this._data="",this._hitLimit=!1,l},p}();Q.OscHandler=E},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.PAYLOAD_LIMIT=void 0,Q.PAYLOAD_LIMIT=1e7},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.DcsHandler=Q.DcsParser=void 0;var fe=he(8),i=he(21),M=he(23),E=[],p=function(){function l(){this._handlers=Object.create(null),this._active=E,this._ident=0,this._handlerFb=function(){}}return l.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){}},l.prototype.addHandler=function(h,v){this._handlers[h]===void 0&&(this._handlers[h]=[]);var d=this._handlers[h];return d.push(v),{dispose:function(){var o=d.indexOf(v);o!==-1&&d.splice(o,1)}}},l.prototype.setHandler=function(h,v){this._handlers[h]=[v]},l.prototype.clearHandler=function(h){this._handlers[h]&&delete this._handlers[h]},l.prototype.setHandlerFallback=function(h){this._handlerFb=h},l.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=E,this._ident=0},l.prototype.hook=function(h,v){if(this.reset(),this._ident=h,this._active=this._handlers[h]||E,this._active.length)for(var d=this._active.length-1;d>=0;d--)this._active[d].hook(v);else this._handlerFb(this._ident,"HOOK",v)},l.prototype.put=function(h,v,d){if(this._active.length)for(var o=this._active.length-1;o>=0;o--)this._active[o].put(h,v,d);else this._handlerFb(this._ident,"PUT",fe.utf32ToString(h,v,d))},l.prototype.unhook=function(h){if(this._active.length){for(var v=this._active.length-1;v>=0&&this._active[v].unhook(h)===!1;v--);for(v--;v>=0;v--)this._active[v].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",h);this._active=E,this._ident=0},l}();Q.DcsParser=p;var g=function(){function l(h){this._handler=h,this._data="",this._hitLimit=!1}return l.prototype.hook=function(h){this._params=h.clone(),this._data="",this._hitLimit=!1},l.prototype.put=function(h,v,d){this._hitLimit||(this._data+=fe.utf32ToString(h,v,d),this._data.length>M.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},l.prototype.unhook=function(h){var v;return this._hitLimit?v=!1:h&&(v=this._handler(this._data,this._params||new i.Params)),this._params=void 0,this._data="",this._hitLimit=!1,v},l}();Q.DcsHandler=g},function(Ue,Q,he){"use strict";Object.defineProperty(Q,"__esModule",{value:!0}),Q.removeTerminalFromCache=Q.acquireCharAtlas=void 0;var fe=he(26),i=he(43),M=[];Q.acquireCharAtlas=function(E,p,g,l,h){for(var v=fe.generateConfig(l,h,E,g),d=0;d =0){if(fe.configEquals(s.config,v))return s.atlas;s.ownedBy.length===1?(s.atlas.dispose(),M.splice(d,1)):s.ownedBy.splice(o,1);break}}for(d=0;d 1)for(var w=this._getJoinedRanges(s,y,m,d,u),A=0;A 1)for(w=this._getJoinedRanges(s,y,m,d,u),A=0;A =this._line.length))return m?(this._line.loadCell(u,m),m):this._line.loadCell(u,new fe.CellData)},s.prototype.translateToString=function(u,m,y){return this._line.translateToString(u,m,y)},s}(),d=function(){function s(u){this._core=u}return s.prototype.registerCsiHandler=function(u,m){return this._core.addCsiHandler(u,function(y){return m(y.toArray())})},s.prototype.addCsiHandler=function(u,m){return this.registerCsiHandler(u,m)},s.prototype.registerDcsHandler=function(u,m){return this._core.addDcsHandler(u,function(y,_){return m(y,_.toArray())})},s.prototype.addDcsHandler=function(u,m){return this.registerDcsHandler(u,m)},s.prototype.registerEscHandler=function(u,m){return this._core.addEscHandler(u,m)},s.prototype.addEscHandler=function(u,m){return this.registerEscHandler(u,m)},s.prototype.registerOscHandler=function(u,m){return this._core.addOscHandler(u,m)},s.prototype.addOscHandler=function(u,m){return this.registerOscHandler(u,m)},s}(),o=function(){function s(u){this._core=u}return s.prototype.register=function(u){this._core.unicodeService.register(u)},Object.defineProperty(s.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(u){this._core.unicodeService.activeVersion=u},enumerable:!1,configurable:!0}),s}()},function(Ue,Q,he){"use strict";var fe,i=this&&this.__extends||(fe=function(Z,$){return(fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(oe,ae){oe.__proto__=ae}||function(oe,ae){for(var ye in ae)ae.hasOwnProperty(ye)&&(oe[ye]=ae[ye])})(Z,$)},function(Z,$){function oe(){this.constructor=Z}fe(Z,$),Z.prototype=$===null?Object.create($):(oe.prototype=$.prototype,new oe)});Object.defineProperty(Q,"__esModule",{value:!0}),Q.Terminal=void 0;var M=he(36),E=he(37),p=he(38),g=he(12),l=he(19),h=he(40),v=he(50),d=he(51),o=he(11),s=he(7),u=he(18),m=he(54),y=he(55),_=he(56),x=he(57),S=he(59),w=he(0),A=he(16),H=he(27),R=he(60),F=he(5),D=he(61),B=he(62),P=he(63),U=he(64),G=he(65),ee=typeof window!="undefined"?window.document:null,K=function(Z){function $(oe){oe===void 0&&(oe={});var ae=Z.call(this,oe)||this;return ae.browser=o,ae._keyDownHandled=!1,ae._onCursorMove=new w.EventEmitter,ae._onKey=new w.EventEmitter,ae._onRender=new w.EventEmitter,ae._onSelectionChange=new w.EventEmitter,ae._onTitleChange=new w.EventEmitter,ae._onFocus=new w.EventEmitter,ae._onBlur=new w.EventEmitter,ae._onA11yCharEmitter=new w.EventEmitter,ae._onA11yTabEmitter=new w.EventEmitter,ae._setup(),ae.linkifier=ae._instantiationService.createInstance(v.Linkifier),ae.linkifier2=ae.register(ae._instantiationService.createInstance(P.Linkifier2)),ae.register(ae._inputHandler.onRequestBell(function(){return ae.bell()})),ae.register(ae._inputHandler.onRequestRefreshRows(function(ye,Y){return ae.refresh(ye,Y)})),ae.register(ae._inputHandler.onRequestReset(function(){return ae.reset()})),ae.register(ae._inputHandler.onRequestScroll(function(ye,Y){return ae.scroll(ye,Y||void 0)})),ae.register(ae._inputHandler.onRequestWindowsOptionsReport(function(ye){return ae._reportWindowsOptions(ye)})),ae.register(w.forwardEvent(ae._inputHandler.onCursorMove,ae._onCursorMove)),ae.register(w.forwardEvent(ae._inputHandler.onTitleChange,ae._onTitleChange)),ae.register(w.forwardEvent(ae._inputHandler.onA11yChar,ae._onA11yCharEmitter)),ae.register(w.forwardEvent(ae._inputHandler.onA11yTab,ae._onA11yTabEmitter)),ae.register(ae._bufferService.onResize(function(ye){return ae._afterResize(ye.cols,ye.rows)})),ae}return i($,Z),Object.defineProperty($.prototype,"options",{get:function(){return this.optionsService.options},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onKey",{get:function(){return this._onKey.event},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onRender",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onFocus",{get:function(){return this._onFocus.event},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onBlur",{get:function(){return this._onBlur.event},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onA11yChar",{get:function(){return this._onA11yCharEmitter.event},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"onA11yTab",{get:function(){return this._onA11yTabEmitter.event},enumerable:!1,configurable:!0}),$.prototype.dispose=function(){var oe,ae,ye;this._isDisposed||(Z.prototype.dispose.call(this),(oe=this._renderService)===null||oe===void 0||oe.dispose(),this._customKeyEventHandler=void 0,this.write=function(){},(ye=(ae=this.element)===null||ae===void 0?void 0:ae.parentNode)===null||ye===void 0||ye.removeChild(this.element))},$.prototype._setup=function(){Z.prototype._setup.call(this),this._customKeyEventHandler=void 0},Object.defineProperty($.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),$.prototype.focus=function(){this.textarea&&this.textarea.focus({preventScroll:!0})},$.prototype._updateOptions=function(oe){var ae,ye,Y,le;switch(Z.prototype._updateOptions.call(this,oe),oe){case"fontFamily":case"fontSize":(ae=this._renderService)===null||ae===void 0||ae.clear(),(ye=this._charSizeService)===null||ye===void 0||ye.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"rendererType":this._renderService&&(this._renderService.setRenderer(this._createRenderer()),this._renderService.onResize(this.cols,this.rows));break;case"scrollback":(Y=this.viewport)===null||Y===void 0||Y.syncScrollArea();break;case"screenReaderMode":this.optionsService.options.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new _.AccessibilityManager(this,this._renderService)):((le=this._accessibilityManager)===null||le===void 0||le.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.options.theme)}},$.prototype._onTextAreaFocus=function(oe){this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(g.C0.ESC+"[I"),this.updateCursorStyle(oe),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()},$.prototype.blur=function(){var oe;return(oe=this.textarea)===null||oe===void 0?void 0:oe.blur()},$.prototype._onTextAreaBlur=function(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this._coreService.decPrivateModes.sendFocus&&this._coreService.triggerDataEvent(g.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()},$.prototype._syncTextArea=function(){if(this.textarea&&this.buffer.isCursorInViewport&&!this._compositionHelper.isComposing){var oe=Math.ceil(this._charSizeService.height*this.optionsService.options.lineHeight),ae=this._bufferService.buffer.y*oe,ye=this._bufferService.buffer.x*this._charSizeService.width;this.textarea.style.left=ye+"px",this.textarea.style.top=ae+"px",this.textarea.style.width=this._charSizeService.width+"px",this.textarea.style.height=oe+"px",this.textarea.style.lineHeight=oe+"px",this.textarea.style.zIndex="-5"}},$.prototype._initGlobal=function(){var oe=this;this._bindKeys(),this.register(s.addDisposableDomListener(this.element,"copy",function(ye){oe.hasSelection()&&p.copyHandler(ye,oe._selectionService)}));var ae=function(ye){return p.handlePasteEvent(ye,oe.textarea,oe._coreService)};this.register(s.addDisposableDomListener(this.textarea,"paste",ae)),this.register(s.addDisposableDomListener(this.element,"paste",ae)),o.isFirefox?this.register(s.addDisposableDomListener(this.element,"mousedown",function(ye){ye.button===2&&p.rightClickHandler(ye,oe.textarea,oe.screenElement,oe._selectionService,oe.options.rightClickSelectsWord)})):this.register(s.addDisposableDomListener(this.element,"contextmenu",function(ye){p.rightClickHandler(ye,oe.textarea,oe.screenElement,oe._selectionService,oe.options.rightClickSelectsWord)})),o.isLinux&&this.register(s.addDisposableDomListener(this.element,"auxclick",function(ye){ye.button===1&&p.moveTextAreaUnderMouseCursor(ye,oe.textarea,oe.screenElement)}))},$.prototype._bindKeys=function(){var oe=this;this.register(s.addDisposableDomListener(this.textarea,"keyup",function(ae){return oe._keyUp(ae)},!0)),this.register(s.addDisposableDomListener(this.textarea,"keydown",function(ae){return oe._keyDown(ae)},!0)),this.register(s.addDisposableDomListener(this.textarea,"keypress",function(ae){return oe._keyPress(ae)},!0)),this.register(s.addDisposableDomListener(this.textarea,"compositionstart",function(){return oe._compositionHelper.compositionstart()})),this.register(s.addDisposableDomListener(this.textarea,"compositionupdate",function(ae){return oe._compositionHelper.compositionupdate(ae)})),this.register(s.addDisposableDomListener(this.textarea,"compositionend",function(){return oe._compositionHelper.compositionend()})),this.register(this.onRender(function(){return oe._compositionHelper.updateCompositionElements()})),this.register(this.onRender(function(ae){return oe._queueLinkification(ae.start,ae.end)}))},$.prototype.open=function(oe){var ae=this;if(!oe)throw new Error("Terminal requires a parent element.");ee.body.contains(oe)||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=oe.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),oe.appendChild(this.element);var ye=ee.createDocumentFragment();this._viewportElement=ee.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),ye.appendChild(this._viewportElement),this._viewportScrollArea=ee.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=ee.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=ee.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),ye.appendChild(this.screenElement),this.textarea=ee.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",u.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register(s.addDisposableDomListener(this.textarea,"focus",function(xe){return ae._onTextAreaFocus(xe)})),this.register(s.addDisposableDomListener(this.textarea,"blur",function(){return ae._onTextAreaBlur()})),this._helperContainer.appendChild(this.textarea);var Y=this._instantiationService.createInstance(U.CoreBrowserService,this.textarea);this._instantiationService.setService(F.ICoreBrowserService,Y),this._charSizeService=this._instantiationService.createInstance(D.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(F.ICharSizeService,this._charSizeService),this._compositionView=ee.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(M.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(ye),this._theme=this.options.theme||this._theme,this._colorManager=new H.ColorManager(ee,this.options.allowTransparency),this.register(this.optionsService.onOptionChange(function(xe){return ae._colorManager.onOptionsChange(xe)})),this._colorManager.setTheme(this._theme);var le=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,le,this.rows,this.screenElement)),this._instantiationService.setService(F.IRenderService,this._renderService),this.register(this._renderService.onRenderedBufferChange(function(xe){return ae._onRender.fire(xe)})),this.onResize(function(xe){return ae._renderService.resize(xe.cols,xe.rows)}),this._soundService=this._instantiationService.createInstance(m.SoundService),this._instantiationService.setService(F.ISoundService,this._soundService),this._mouseService=this._instantiationService.createInstance(B.MouseService),this._instantiationService.setService(F.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(E.Viewport,function(xe,Ce){return ae.scrollLines(xe,Ce)},this._viewportElement,this._viewportScrollArea),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(function(){return ae.viewport.syncScrollArea()})),this.register(this.viewport),this.register(this.onCursorMove(function(){ae._renderService.onCursorMove(),ae._syncTextArea()})),this.register(this.onResize(function(){return ae._renderService.onResize(ae.cols,ae.rows)})),this.register(this.onBlur(function(){return ae._renderService.onBlur()})),this.register(this.onFocus(function(){return ae._renderService.onFocus()})),this.register(this._renderService.onDimensionsChange(function(){return ae.viewport.syncScrollArea()})),this._selectionService=this.register(this._instantiationService.createInstance(d.SelectionService,this.element,this.screenElement)),this._instantiationService.setService(F.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(function(xe){return ae.scrollLines(xe.amount,xe.suppressScrollEvent)})),this.register(this._selectionService.onSelectionChange(function(){return ae._onSelectionChange.fire()})),this.register(this._selectionService.onRequestRedraw(function(xe){return ae._renderService.onSelectionChanged(xe.start,xe.end,xe.columnSelectMode)})),this.register(this._selectionService.onLinuxMouseSelection(function(xe){ae.textarea.value=xe,ae.textarea.focus(),ae.textarea.select()})),this.register(this.onScroll(function(){ae.viewport.syncScrollArea(),ae._selectionService.refresh()})),this.register(s.addDisposableDomListener(this._viewportElement,"scroll",function(){return ae._selectionService.refresh()})),this._mouseZoneManager=this._instantiationService.createInstance(y.MouseZoneManager,this.element,this.screenElement),this.register(this._mouseZoneManager),this.register(this.onScroll(function(){return ae._mouseZoneManager.clearAll()})),this.linkifier.attachToDom(this.element,this._mouseZoneManager),this.linkifier2.attachToDom(this.element,this._mouseService,this._renderService),this.register(s.addDisposableDomListener(this.element,"mousedown",function(xe){return ae._selectionService.onMouseDown(xe)})),this._coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new _.AccessibilityManager(this,this._renderService)),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()},$.prototype._createRenderer=function(){switch(this.options.rendererType){case"canvas":return this._instantiationService.createInstance(h.Renderer,this._colorManager.colors,this.screenElement,this.linkifier,this.linkifier2);case"dom":return this._instantiationService.createInstance(x.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier,this.linkifier2);default:throw new Error('Unrecognized rendererType "'+this.options.rendererType+'"')}},$.prototype._setTheme=function(oe){var ae,ye,Y;this._theme=oe,(ae=this._colorManager)===null||ae===void 0||ae.setTheme(oe),(ye=this._renderService)===null||ye===void 0||ye.setColors(this._colorManager.colors),(Y=this.viewport)===null||Y===void 0||Y.onThemeChange(this._colorManager.colors)},$.prototype.bindMouse=function(){var oe=this,ae=this,ye=this.element;function Y(de){var be,Te,Ae=ae._mouseService.getRawByteCoords(de,ae.screenElement,ae.cols,ae.rows);if(!Ae)return!1;switch(de.overrideType||de.type){case"mousemove":Te=32,de.buttons===void 0?(be=3,de.button!==void 0&&(be=de.button<3?de.button:3)):be=1&de.buttons?0:4&de.buttons?1:2&de.buttons?2:3;break;case"mouseup":Te=0,be=de.button<3?de.button:3;break;case"mousedown":Te=1,be=de.button<3?de.button:3;break;case"wheel":de.deltaY!==0&&(Te=de.deltaY<0?0:1),be=4;break;default:return!1}return!(Te===void 0||be===void 0||be>4)&&ae._coreMouseService.triggerMouseEvent({col:Ae.x-33,row:Ae.y-33,button:be,action:Te,ctrl:de.ctrlKey,alt:de.altKey,shift:de.shiftKey})}var le={mouseup:null,wheel:null,mousedrag:null,mousemove:null},xe=function(de){return Y(de),de.buttons||(oe._document.removeEventListener("mouseup",le.mouseup),le.mousedrag&&oe._document.removeEventListener("mousemove",le.mousedrag)),oe.cancel(de)},Ce=function(de){return Y(de),de.preventDefault(),oe.cancel(de)},we=function(de){de.buttons&&Y(de)},Le=function(de){de.buttons||Y(de)};this.register(this._coreMouseService.onProtocolChange(function(de){de?(oe.optionsService.options.logLevel==="debug"&&oe._logService.debug("Binding to mouse events:",oe._coreMouseService.explainEvents(de)),oe.element.classList.add("enable-mouse-events"),oe._selectionService.disable()):(oe._logService.debug("Unbinding from mouse events."),oe.element.classList.remove("enable-mouse-events"),oe._selectionService.enable()),8&de?le.mousemove||(ye.addEventListener("mousemove",Le),le.mousemove=Le):(ye.removeEventListener("mousemove",le.mousemove),le.mousemove=null),16&de?le.wheel||(ye.addEventListener("wheel",Ce,{passive:!1}),le.wheel=Ce):(ye.removeEventListener("wheel",le.wheel),le.wheel=null),2&de?le.mouseup||(le.mouseup=xe):(oe._document.removeEventListener("mouseup",le.mouseup),le.mouseup=null),4&de?le.mousedrag||(le.mousedrag=we):(oe._document.removeEventListener("mousemove",le.mousedrag),le.mousedrag=null)})),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(s.addDisposableDomListener(ye,"mousedown",function(de){if(de.preventDefault(),oe.focus(),oe._coreMouseService.areMouseEventsActive&&!oe._selectionService.shouldForceSelection(de))return Y(de),le.mouseup&&oe._document.addEventListener("mouseup",le.mouseup),le.mousedrag&&oe._document.addEventListener("mousemove",le.mousedrag),oe.cancel(de)})),this.register(s.addDisposableDomListener(ye,"wheel",function(de){if(!le.wheel){if(!oe.buffer.hasScrollback){var be=oe.viewport.getLinesScrolled(de);if(be===0)return;for(var Te=g.C0.ESC+(oe._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(de.deltaY<0?"A":"B"),Ae="",Be=0;Be