@prefecthq/graphs 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/graphs.umd.js
CHANGED
|
@@ -1172,6 +1172,6 @@ void main(void)\r
|
|
|
1172
1172
|
* Subject to the terms at https://gsap.com/standard-license or for
|
|
1173
1173
|
* Club GSAP members, the agreement issued with that membership.
|
|
1174
1174
|
* @author: Jack Doyle, jack@greensock.com
|
|
1175
|
-
*/var kg,Nr,cn,Xu,ms,Og,Zu,JC=function(){return typeof window<"u"},nr={},gs=180/Math.PI,un=Math.PI/180,dn=Math.atan2,Bg=1e8,Vu=/([A-Z])/g,$C=/(left|right|width|margin|padding|x)/i,QC=/[\s,\(]\S/,Ni={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Hu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},qC=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},tE=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},eE=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},Wg=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Ug=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},iE=function(t,e,i){return t.style[e]=i},rE=function(t,e,i){return t.style.setProperty(e,i)},sE=function(t,e,i){return t._gsap[e]=i},nE=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},oE=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},aE=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Xt="transform",Re=Xt+"Origin",hE=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in nr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Ni[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=or(s,a)}):this.tfm[t]=o.x?o[t]:or(s,t),t===Re&&(this.tfm.zOrigin=o.zOrigin);else return Ni.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Xt)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Re,e,"")),t=Xt}(n||e)&&this.props.push(t,e,n[t])},Xg=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},lE=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(Vu,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=Zu(),(!n||!n.isStart)&&!i[Xt]&&(Xg(i),s.zOrigin&&i[Re]&&(i[Re]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},Zg=function(t,e){var i={target:t,props:[],revert:lE,save:hE};return t._gsap||Ae.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},Vg,Ku=function(t,e){var i=Nr.createElementNS?Nr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Nr.createElement(t);return i&&i.style?i:Nr.createElement(t)},Di=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Vu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,fn(e)||e,1)||""},Hg="O,Moz,ms,Ms,Webkit".split(","),fn=function(t,e,i){var s=e||ms,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(Hg[o]+t in n););return o<0?null:(o===3?"ms":o>=0?Hg[o]:"")+t},Yu=function(){JC()&&window.document&&(kg=window,Nr=kg.document,cn=Nr.documentElement,ms=Ku("div")||{style:{}},Ku("div"),Xt=fn(Xt),Re=Xt+"Origin",ms.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Vg=!!fn("perspective"),Zu=Ae.core.reverting,Xu=1)},zu=function r(t){var e=Ku("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(cn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),cn.removeChild(e),this.style.cssText=n,o},Kg=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},Yg=function(t){var e;try{e=t.getBBox()}catch{e=zu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===zu||(e=zu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Kg(t,["x","cx","x1"])||0,y:+Kg(t,["y","cy","y1"])||0,width:0,height:0}:e},zg=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Yg(t))},ys=function(t,e){if(e){var i=t.style,s;e in nr&&e!==Re&&(e=Xt),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Vu,"-$1").toLowerCase())):i.removeAttribute(e)}},Dr=function(t,e,i,s,n,o){var a=new Ie(t._pt,e,i,0,1,o?Ug:Wg);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},jg={deg:1,rad:1,turn:1},cE={grid:1,flex:1},kr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ms.style,h=$C.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",m,p,g,y;if(s===o||!n||jg[s]||jg[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&zg(t),(f||o==="%")&&(nr[e]||~e.indexOf("adius")))return m=y?t.getBBox()[h?"width":"height"]:t[c],zt(f?n/m*u:n/100*m);if(a[h?"width":"height"]=u+(d?o:s),p=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(p=(t.ownerSVGElement||{}).parentNode),(!p||p===Nr||!p.appendChild)&&(p=Nr.body),g=p._gsap,g&&f&&g.width&&h&&g.time===We.time&&!g.uncache)return zt(n/g.width*u);if(f&&(e==="height"||e==="width")){var _=t.style[e];t.style[e]=u+s,m=t[c],_?t.style[e]=_:ys(t,e)}else(f||o==="%")&&!cE[Di(p,"display")]&&(a.position=Di(t,"position")),p===t&&(a.position="static"),p.appendChild(ms),m=ms[c],p.removeChild(ms),a.position="absolute";return h&&f&&(g=ls(p),g.time=We.time,g.width=p[c]),zt(d?m*n/u:m&&n?u/m*n:0)},or=function(t,e,i,s){var n;return Xu||Yu(),e in Ni&&e!=="transform"&&(e=Ni[e],~e.indexOf(",")&&(e=e.split(",")[0])),nr[e]&&e!=="transform"?(n=go(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:xh(Di(t,Re))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=bh[e]&&bh[e](t,e,i)||Di(t,e)||q0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?kr(t,e,n,i)+i:n},uE=function(t,e,i,s){if(!i||i==="none"){var n=fn(e,t,1),o=n&&Di(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Di(t,"borderTopColor"))}var a=new Ie(this._pt,t.style,e,0,1,Gg),h=0,l=0,c,u,d,f,m,p,g,y,_,b,v,w;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(p=t.style[e],t.style[e]=s,s=Di(t,e)||s,p?t.style[e]=p:ys(t,e)),c=[i,s],wg(c),i=c[0],s=c[1],d=i.match(sn)||[],w=s.match(sn)||[],w.length){for(;u=sn.exec(s);)g=u[0],_=s.substring(h,u.index),m?m=(m+1)%5:(_.substr(-5)==="rgba("||_.substr(-5)==="hsla(")&&(m=1),g!==(p=d[l++]||"")&&(f=parseFloat(p)||0,v=p.substr((f+"").length),g.charAt(1)==="="&&(g=nn(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=sn.lastIndex-b.length,b||(b=b||De.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=kr(t,e,p,b)||0),a._pt={_next:a._pt,p:_||l===1?_:",",s:f,c:y-f,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?Ug:Wg;return K0.test(s)&&(a.e=0),this._pt=a,a},Jg={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},dE=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=Jg[i]||i,e[1]=Jg[s]||s,e.join(" ")},fE=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],nr[a]&&(h=1,a=a==="transformOrigin"?Re:Xt),ys(i,a);h&&(ys(i,Xt),o&&(o.svg&&i.removeAttribute("transform"),go(i,1),o.uncache=1,Xg(s)))}},bh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Ie(t._pt,e,i,0,0,fE);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},mo=[1,0,0,1,0,0],$g={},Qg=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},qg=function(t){var e=Di(t,Xt);return Qg(e)?mo:e.substr(7).match(H0).map(zt)},ju=function(t,e){var i=t._gsap||ls(t),s=t.style,n=qg(t),o,a,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?mo:n):(n===mo&&!t.offsetParent&&t!==cn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,cn.appendChild(t)),n=qg(t),h?s.display=h:ys(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):cn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Ju=function(t,e,i,s,n,o){var a=t._gsap,h=n||ju(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],m=h[1],p=h[2],g=h[3],y=h[4],_=h[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,C,E,A,R;i?h!==mo&&(E=f*g-m*p)&&(A=v*(g/E)+w*(-p/E)+(p*_-g*y)/E,R=v*(-m/E)+w*(f/E)-(f*_-m*y)/E,v=A,w=R):(C=Yg(t),v=C.x+(~b[0].indexOf("%")?v/100*C.width:v),w=C.y+(~(b[1]||b[0]).indexOf("%")?w/100*C.height:w)),s||s!==!1&&a.smooth?(y=v-l,_=w-c,a.xOffset=u+(y*f+_*p)-y,a.yOffset=d+(y*m+_*g)-_):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Re]="0px 0px",o&&(Dr(o,a,"xOrigin",l,v),Dr(o,a,"yOrigin",c,w),Dr(o,a,"xOffset",u,a.xOffset),Dr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},go=function(t,e){var i=t._gsap||new Ig(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Di(t,Re)||"0",c,u,d,f,m,p,g,y,_,b,v,w,C,E,A,R,G,N,P,I,D,X,H,Z,j,O,k,F,V,$,dt,ot;return c=u=d=p=g=y=_=b=v=0,f=m=1,i.svg=!!(t.getCTM&&zg(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Xt]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Xt]!=="none"?h[Xt]:"")),s.scale=s.rotate=s.translate="none"),E=ju(t,i.svg),i.svg&&(i.uncache?(j=t.getBBox(),l=i.xOrigin-j.x+"px "+(i.yOrigin-j.y)+"px",Z=""):Z=!e&&t.getAttribute("data-svg-origin"),Ju(t,Z||l,!!Z||i.originIsAbsolute,i.smooth!==!1,E)),w=i.xOrigin||0,C=i.yOrigin||0,E!==mo&&(N=E[0],P=E[1],I=E[2],D=E[3],c=X=E[4],u=H=E[5],E.length===6?(f=Math.sqrt(N*N+P*P),m=Math.sqrt(D*D+I*I),p=N||P?dn(P,N)*gs:0,_=I||D?dn(I,D)*gs+p:0,_&&(m*=Math.abs(Math.cos(_*un))),i.svg&&(c-=w-(w*N+C*I),u-=C-(w*P+C*D))):(ot=E[6],$=E[7],k=E[8],F=E[9],V=E[10],dt=E[11],c=E[12],u=E[13],d=E[14],A=dn(ot,V),g=A*gs,A&&(R=Math.cos(-A),G=Math.sin(-A),Z=X*R+k*G,j=H*R+F*G,O=ot*R+V*G,k=X*-G+k*R,F=H*-G+F*R,V=ot*-G+V*R,dt=$*-G+dt*R,X=Z,H=j,ot=O),A=dn(-I,V),y=A*gs,A&&(R=Math.cos(-A),G=Math.sin(-A),Z=N*R-k*G,j=P*R-F*G,O=I*R-V*G,dt=D*G+dt*R,N=Z,P=j,I=O),A=dn(P,N),p=A*gs,A&&(R=Math.cos(A),G=Math.sin(A),Z=N*R+P*G,j=X*R+H*G,P=P*R-N*G,H=H*R-X*G,N=Z,X=j),g&&Math.abs(g)+Math.abs(p)>359.9&&(g=p=0,y=180-y),f=zt(Math.sqrt(N*N+P*P+I*I)),m=zt(Math.sqrt(H*H+ot*ot)),A=dn(X,H),_=Math.abs(A)>2e-4?A*gs:0,v=dt?1/(dt<0?-dt:dt):0),i.svg&&(Z=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Qg(Di(t,Xt)),Z&&t.setAttribute("transform",Z))),Math.abs(_)>90&&Math.abs(_)<270&&(n?(f*=-1,_+=p<=0?180:-180,p+=p<=0?180:-180):(m*=-1,_+=_<=0?180:-180)),e=e||i.uncache,i.x=c-((i.xPercent=c&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=u-((i.yPercent=u&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=zt(f),i.scaleY=zt(m),i.rotation=zt(p)+a,i.rotationX=zt(g)+a,i.rotationY=zt(y)+a,i.skewX=_+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Re]=xh(l)),i.xOffset=i.yOffset=0,i.force3D=De.force3D,i.renderTransform=i.svg?mE:Vg?ty:pE,i.uncache=0,i},xh=function(t){return(t=t.split(" "))[0]+" "+t[1]},$u=function(t,e,i){var s=me(e);return zt(parseFloat(e)+parseFloat(kr(t,"x",i+"px",s)))+s},pE=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,ty(t,e)},bs="0deg",yo="0px",xs=") ",ty=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,c=i.rotationY,u=i.rotationX,d=i.skewX,f=i.skewY,m=i.scaleX,p=i.scaleY,g=i.transformPerspective,y=i.force3D,_=i.target,b=i.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==bs||c!==bs)){var C=parseFloat(c)*un,E=Math.sin(C),A=Math.cos(C),R;C=parseFloat(u)*un,R=Math.cos(C),o=$u(_,o,E*R*-b),a=$u(_,a,-Math.sin(C)*-b),h=$u(_,h,A*R*-b+b)}g!==yo&&(v+="perspective("+g+xs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(w||o!==yo||a!==yo||h!==yo)&&(v+=h!==yo||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+xs),l!==bs&&(v+="rotate("+l+xs),c!==bs&&(v+="rotateY("+c+xs),u!==bs&&(v+="rotateX("+u+xs),(d!==bs||f!==bs)&&(v+="skew("+d+", "+f+xs),(m!==1||p!==1)&&(v+="scale("+m+", "+p+xs),_.style[Xt]=v||"translate(0, 0)"},mE=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,c=i.skewY,u=i.scaleX,d=i.scaleY,f=i.target,m=i.xOrigin,p=i.yOrigin,g=i.xOffset,y=i.yOffset,_=i.forceCSS,b=parseFloat(o),v=parseFloat(a),w,C,E,A,R;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=un,l*=un,w=Math.cos(h)*u,C=Math.sin(h)*u,E=Math.sin(h-l)*-d,A=Math.cos(h-l)*d,l&&(c*=un,R=Math.tan(l-c),R=Math.sqrt(1+R*R),E*=R,A*=R,c&&(R=Math.tan(c),R=Math.sqrt(1+R*R),w*=R,C*=R)),w=zt(w),C=zt(C),E=zt(E),A=zt(A)):(w=u,A=d,C=E=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=kr(f,"x",o,"px"),v=kr(f,"y",a,"px")),(m||p||g||y)&&(b=zt(b+m-(m*w+p*E)+g),v=zt(v+p-(m*C+p*A)+y)),(s||n)&&(R=f.getBBox(),b=zt(b+s/100*R.width),v=zt(v+n/100*R.height)),R="matrix("+w+","+C+","+E+","+A+","+b+","+v+")",f.setAttribute("transform",R),_&&(f.style[Xt]=R)},gE=function(t,e,i,s,n){var o=360,a=ne(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?gs:1),l=h-s,c=s+l+"deg",u,d;return a&&(u=n.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*Bg)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*Bg)%o-~~(l/o)*o)),t._pt=d=new Ie(t._pt,e,i,s,l,qC),d.e=c,d.u="deg",t._props.push(i),d},ey=function(t,e){for(var i in e)t[i]=e[i];return t},yE=function(t,e,i){var s=ey({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Xt]=e,a=go(i,1),ys(i,Xt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Xt],o[Xt]=e,a=go(i,1),o[Xt]=l);for(h in nr)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=me(l),m=me(c),u=f!==m?kr(i,h,l,m):parseFloat(l),d=parseFloat(c),t._pt=new Ie(t._pt,a,h,u,d-u,Hu),t._pt.u=m||0,t._props.push(h));ey(a,s)};Ee("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});bh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(m){return or(a,m,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(m,p){return f[m]=d[p]=d[p]||d[(p-1)/2|0]}),a.init(h,f,u)}});var iy={name:"css",register:Yu,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,c,u,d,f,m,p,g,y,_,b,v,w,C,E,A;Xu||Yu(),this.styles=this.styles||Zg(t),A=this.styles.props,this.tween=i;for(p in e)if(p!=="autoRound"&&(c=e[p],!(Oe[p]&&Ag(p,e,i,s,t,n)))){if(f=typeof c,m=bh[p],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=ho(c)),m)m(this,t,p,c,i)&&(E=1);else if(p.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(p)+"").trim(),c+="",Gr.lastIndex=0,Gr.test(l)||(g=me(l),y=me(c)),y?g!==y&&(l=kr(t,p,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,p),o.push(p),A.push(p,0,a[p]);else if(f!=="undefined"){if(h&&p in h?(l=typeof h[p]=="function"?h[p].call(i,s,t,n):h[p],ne(l)&&~l.indexOf("random(")&&(l=ho(l)),me(l+"")||l==="auto"||(l+=De.units[p]||me(or(t,p))||""),(l+"").charAt(1)==="="&&(l=or(t,p))):l=or(t,p),d=parseFloat(l),_=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),_&&(c=c.substr(2)),u=parseFloat(c),p in Ni&&(p==="autoAlpha"&&(d===1&&or(t,"visibility")==="hidden"&&u&&(d=0),A.push("visibility",0,a.visibility),Dr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),p!=="scale"&&p!=="transform"&&(p=Ni[p],~p.indexOf(",")&&(p=p.split(",")[0]))),b=p in nr,b){if(this.styles.save(p),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||go(t,e.parseTransform),C=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Ie(this._pt,a,Xt,0,1,w.renderTransform,w,0,-1),v.dep=1),p==="scale")this._pt=new Ie(this._pt,w,"scaleY",w.scaleY,(_?nn(w.scaleY,_+u):u)-w.scaleY||0,Hu),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){A.push(Re,0,a[Re]),c=dE(c),w.svg?Ju(t,c,0,C,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Dr(this,w,"zOrigin",w.zOrigin,y),Dr(this,a,p,xh(l),xh(c)));continue}else if(p==="svgOrigin"){Ju(t,c,1,C,0,this);continue}else if(p in $g){gE(this,w,p,d,_?nn(d,_+c):c);continue}else if(p==="smoothOrigin"){Dr(this,w,"smooth",w.smooth,c);continue}else if(p==="force3D"){w[p]=c;continue}else if(p==="transform"){yE(this,c,t);continue}}else p in a||(p=fn(p)||p);if(b||(u||u===0)&&(d||d===0)&&!QC.test(c)&&p in a)g=(l+"").substr((d+"").length),u||(u=0),y=me(c)||(p in De.units?De.units[p]:g),g!==y&&(d=kr(t,p,l,y)),this._pt=new Ie(this._pt,b?w:a,p,d,(_?nn(d,_+u):u)-d,!b&&(y==="px"||p==="zIndex")&&e.autoRound!==!1?eE:Hu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=tE);else if(p in a)uE.call(this,t,p,l,_?_+c:c);else if(p in t)this.add(t,p,l||t[p],_?_+c:c,s,n);else if(p!=="parseTransform"){xu(p,c);continue}b||(p in a?A.push(p,0,a[p]):A.push(p,1,l||t[p])),o.push(p)}}E&&Fg(this)},render:function(t,e){if(e.tween._time||!Zu())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:or,aliases:Ni,getSetter:function(t,e,i){var s=Ni[e];return s&&s.indexOf(",")<0&&(e=s),e in nr&&e!==Re&&(t._gsap.x||or(t,"x"))?i&&Og===i?e==="scale"?nE:sE:(Og=i||{})&&(e==="scale"?oE:aE):t.style&&!fu(t.style[e])?iE:~e.indexOf("-")?rE:ku(t,e)},core:{_removeProperty:ys,_getMatrix:ju}};Ae.utils.checkPrefix=fn,Ae.core.getStyleSaver=Zg,function(r,t,e,i){var s=Ee(r+","+t+","+e,function(n){nr[n]=1});Ee(t,function(n){De.units[n]="deg",$g[n]=1}),Ni[s[13]]=r+","+t,Ee(i,function(n){var o=n.split(":");Ni[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ee("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){De.units[r]="px"}),Ae.registerPlugin(iy);var ry=Ae.registerPlugin(iy)||Ae;ry.core.Tween;const _s=new pt;class bE{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,_s),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=_s.right>t.left&&_s.left<t.right&&_s.bottom>t.top&&_s.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(_s):e.getBounds(!0,_s);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}var _h={exports:{}};_h.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",m="[object GeneratorFunction]",p="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",C="[object Set]",E="[object String]",A="[object Symbol]",R="[object Undefined]",G="[object WeakMap]",N="[object ArrayBuffer]",P="[object DataView]",I="[object Float32Array]",D="[object Float64Array]",X="[object Int8Array]",H="[object Int16Array]",Z="[object Int32Array]",j="[object Uint8Array]",O="[object Uint8ClampedArray]",k="[object Uint16Array]",F="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,$=/^\[object .+?Constructor\]$/,dt=/^(?:0|[1-9]\d*)$/,ot={};ot[I]=ot[D]=ot[X]=ot[H]=ot[Z]=ot[j]=ot[O]=ot[k]=ot[F]=!0,ot[a]=ot[h]=ot[N]=ot[c]=ot[P]=ot[u]=ot[d]=ot[f]=ot[p]=ot[g]=ot[_]=ot[w]=ot[C]=ot[E]=ot[G]=!1;var Et=typeof xe=="object"&&xe&&xe.Object===Object&&xe,Mt=typeof self=="object"&&self&&self.Object===Object&&self,_t=Et||Mt||Function("return this")(),Y=t&&!t.nodeType&&t,tt=Y&&!0&&r&&!r.nodeType&&r,et=tt&&tt.exports===Y,B=et&&Et.process,xt=function(){try{return B&&B.binding&&B.binding("util")}catch{}}(),yt=xt&&xt.isTypedArray;function Lt(T,M){for(var x=-1,S=T==null?0:T.length,L=0,U=[];++x<S;){var lt=T[x];M(lt,x,T)&&(U[L++]=lt)}return U}function Zt(T,M){for(var x=-1,S=M.length,L=T.length;++x<S;)T[L+x]=M[x];return T}function Xe(T,M){for(var x=-1,S=T==null?0:T.length;++x<S;)if(M(T[x],x,T))return!0;return!1}function pi(T,M){for(var x=-1,S=Array(T);++x<T;)S[x]=M(x);return S}function Fd(T){return function(M){return T(M)}}function Tn(T,M){return T.has(M)}function No(T,M){return T==null?void 0:T[M]}function wn(T){var M=-1,x=Array(T.size);return T.forEach(function(S,L){x[++M]=[L,S]}),x}function mi(T,M){return function(x){return T(M(x))}}function Kh(T){var M=-1,x=Array(T.size);return T.forEach(function(S){x[++M]=S}),x}var Yh=Array.prototype,Nd=Function.prototype,Sn=Object.prototype,Wr=_t["__core-js_shared__"],Do=Nd.toString,Ze=Sn.hasOwnProperty,ko=function(){var T=/[^.]+$/.exec(Wr&&Wr.keys&&Wr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Oo=Sn.toString,zh=RegExp("^"+Do.call(Ze).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jh=et?_t.Buffer:void 0,Cn=_t.Symbol,Wi=_t.Uint8Array,As=Sn.propertyIsEnumerable,Dd=Yh.splice,Ui=Cn?Cn.toStringTag:void 0,Jh=Object.getOwnPropertySymbols,$h=jh?jh.isBuffer:void 0,Rs=mi(Object.keys,Object),Bo=pr(_t,"DataView"),Ve=pr(_t,"Map"),Wo=pr(_t,"Promise"),Uo=pr(_t,"Set"),Xo=pr(_t,"WeakMap"),Ms=pr(Object,"create"),kd=yi(Bo),gi=yi(Ve),Od=yi(Wo),Bd=yi(Uo),Wd=yi(Xo),Qh=Cn?Cn.prototype:void 0,Zo=Qh?Qh.valueOf:void 0;function Pe(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Ud(){this.__data__=Ms?Ms(null):{},this.size=0}function Xd(T){var M=this.has(T)&&delete this.__data__[T];return this.size-=M?1:0,M}function Zd(T){var M=this.__data__;if(Ms){var x=M[T];return x===i?void 0:x}return Ze.call(M,T)?M[T]:void 0}function Vd(T){var M=this.__data__;return Ms?M[T]!==void 0:Ze.call(M,T)}function Hd(T,M){var x=this.__data__;return this.size+=this.has(T)?0:1,x[T]=Ms&&M===void 0?i:M,this}Pe.prototype.clear=Ud,Pe.prototype.delete=Xd,Pe.prototype.get=Zd,Pe.prototype.has=Vd,Pe.prototype.set=Hd;function ye(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Kd(){this.__data__=[],this.size=0}function Yd(T){var M=this.__data__,x=In(M,T);if(x<0)return!1;var S=M.length-1;return x==S?M.pop():Dd.call(M,x,1),--this.size,!0}function zd(T){var M=this.__data__,x=In(M,T);return x<0?void 0:M[x][1]}function jd(T){return In(this.__data__,T)>-1}function Jd(T,M){var x=this.__data__,S=In(x,T);return S<0?(++this.size,x.push([T,M])):x[S][1]=M,this}ye.prototype.clear=Kd,ye.prototype.delete=Yd,ye.prototype.get=zd,ye.prototype.has=jd,ye.prototype.set=Jd;function dr(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Vo(){this.size=0,this.__data__={hash:new Pe,map:new(Ve||ye),string:new Pe}}function $d(T){var M=Rn(this,T).delete(T);return this.size-=M?1:0,M}function En(T){return Rn(this,T).get(T)}function Ho(T){return Rn(this,T).has(T)}function Qd(T,M){var x=Rn(this,T),S=x.size;return x.set(T,M),this.size+=x.size==S?0:1,this}dr.prototype.clear=Vo,dr.prototype.delete=$d,dr.prototype.get=En,dr.prototype.has=Ho,dr.prototype.set=Qd;function fr(T){var M=-1,x=T==null?0:T.length;for(this.__data__=new dr;++M<x;)this.add(T[M])}function qh(T){return this.__data__.set(T,i),this}function qd(T){return this.__data__.has(T)}fr.prototype.add=fr.prototype.push=qh,fr.prototype.has=qd;function Xi(T){var M=this.__data__=new ye(T);this.size=M.size}function tf(){this.__data__=new ye,this.size=0}function tl(T){var M=this.__data__,x=M.delete(T);return this.size=M.size,x}function ef(T){return this.__data__.get(T)}function rf(T){return this.__data__.has(T)}function sf(T,M){var x=this.__data__;if(x instanceof ye){var S=x.__data__;if(!Ve||S.length<e-1)return S.push([T,M]),this.size=++x.size,this;x=this.__data__=new dr(S)}return x.set(T,M),this.size=x.size,this}Xi.prototype.clear=tf,Xi.prototype.delete=tl,Xi.prototype.get=ef,Xi.prototype.has=rf,Xi.prototype.set=sf;function nf(T,M){var x=Pn(T),S=!x&&zo(T),L=!x&&!S&&Ps(T),U=!x&&!S&&!L&&ll(T),lt=x||S||L||U,mt=lt?pi(T.length,String):[],bt=mt.length;for(var at in T)(M||Ze.call(T,at))&&!(lt&&(at=="length"||L&&(at=="offset"||at=="parent")||U&&(at=="buffer"||at=="byteLength"||at=="byteOffset")||Yo(at,bt)))&&mt.push(at);return mt}function In(T,M){for(var x=T.length;x--;)if(Ln(T[x][0],M))return x;return-1}function of(T,M,x){var S=M(T);return Pn(T)?S:Zt(S,x(T))}function Ls(T){return T==null?T===void 0?R:y:Ui&&Ui in Object(T)?cf(T):Mn(T)}function el(T){return Xr(T)&&Ls(T)==a}function il(T,M,x,S,L){return T===M?!0:T==null||M==null||!Xr(T)&&!Xr(M)?T!==T&&M!==M:af(T,M,x,S,il,L)}function af(T,M,x,S,L,U){var lt=Pn(T),mt=Pn(M),bt=lt?h:Zi(T),at=mt?h:Zi(M);bt=bt==a?_:bt,at=at==a?_:at;var vt=bt==_,kt=at==_,Rt=bt==at;if(Rt&&Ps(T)){if(!Ps(M))return!1;lt=!0,vt=!1}if(Rt&&!vt)return U||(U=new Xi),lt||ll(T)?rl(T,M,x,S,L,U):sl(T,M,bt,x,S,L,U);if(!(x&s)){var he=vt&&Ze.call(T,"__wrapped__"),be=kt&&Ze.call(M,"__wrapped__");if(he||be){var ii=he?T.value():T,ri=be?M.value():M;return U||(U=new Xi),L(ii,ri,x,S,U)}}return Rt?(U||(U=new Xi),lf(T,M,x,S,L,U)):!1}function An(T){if(!hl(T)||ff(T))return!1;var M=Vi(T)?zh:$;return M.test(yi(T))}function Ko(T){return Xr(T)&&Ur(T.length)&&!!ot[Ls(T)]}function hf(T){if(!pf(T))return Rs(T);var M=[];for(var x in Object(T))Ze.call(T,x)&&x!="constructor"&&M.push(x);return M}function rl(T,M,x,S,L,U){var lt=x&s,mt=T.length,bt=M.length;if(mt!=bt&&!(lt&&bt>mt))return!1;var at=U.get(T);if(at&&U.get(M))return at==M;var vt=-1,kt=!0,Rt=x&n?new fr:void 0;for(U.set(T,M),U.set(M,T);++vt<mt;){var he=T[vt],be=M[vt];if(S)var ii=lt?S(be,he,vt,M,T,U):S(he,be,vt,T,M,U);if(ii!==void 0){if(ii)continue;kt=!1;break}if(Rt){if(!Xe(M,function(ri,Gs){if(!Tn(Rt,Gs)&&(he===ri||L(he,ri,x,S,U)))return Rt.push(Gs)})){kt=!1;break}}else if(!(he===be||L(he,be,x,S,U))){kt=!1;break}}return U.delete(T),U.delete(M),kt}function sl(T,M,x,S,L,U,lt){switch(x){case P:if(T.byteLength!=M.byteLength||T.byteOffset!=M.byteOffset)return!1;T=T.buffer,M=M.buffer;case N:return!(T.byteLength!=M.byteLength||!U(new Wi(T),new Wi(M)));case c:case u:case g:return Ln(+T,+M);case d:return T.name==M.name&&T.message==M.message;case w:case E:return T==M+"";case p:var mt=wn;case C:var bt=S&s;if(mt||(mt=Kh),T.size!=M.size&&!bt)return!1;var at=lt.get(T);if(at)return at==M;S|=n,lt.set(T,M);var vt=rl(mt(T),mt(M),S,L,U,lt);return lt.delete(T),vt;case A:if(Zo)return Zo.call(T)==Zo.call(M)}return!1}function lf(T,M,x,S,L,U){var lt=x&s,mt=nl(T),bt=mt.length,at=nl(M),vt=at.length;if(bt!=vt&&!lt)return!1;for(var kt=bt;kt--;){var Rt=mt[kt];if(!(lt?Rt in M:Ze.call(M,Rt)))return!1}var he=U.get(T);if(he&&U.get(M))return he==M;var be=!0;U.set(T,M),U.set(M,T);for(var ii=lt;++kt<bt;){Rt=mt[kt];var ri=T[Rt],Gs=M[Rt];if(S)var Pb=lt?S(Gs,ri,Rt,M,T,U):S(ri,Gs,Rt,T,M,U);if(!(Pb===void 0?ri===Gs||L(ri,Gs,x,S,U):Pb)){be=!1;break}ii||(ii=Rt=="constructor")}if(be&&!ii){var ul=T.constructor,dl=M.constructor;ul!=dl&&"constructor"in T&&"constructor"in M&&!(typeof ul=="function"&&ul instanceof ul&&typeof dl=="function"&&dl instanceof dl)&&(be=!1)}return U.delete(T),U.delete(M),be}function nl(T){return of(T,cl,uf)}function Rn(T,M){var x=T.__data__;return df(M)?x[typeof M=="string"?"string":"hash"]:x.map}function pr(T,M){var x=No(T,M);return An(x)?x:void 0}function cf(T){var M=Ze.call(T,Ui),x=T[Ui];try{T[Ui]=void 0;var S=!0}catch{}var L=Oo.call(T);return S&&(M?T[Ui]=x:delete T[Ui]),L}var uf=Jh?function(T){return T==null?[]:(T=Object(T),Lt(Jh(T),function(M){return As.call(T,M)}))}:mf,Zi=Ls;(Bo&&Zi(new Bo(new ArrayBuffer(1)))!=P||Ve&&Zi(new Ve)!=p||Wo&&Zi(Wo.resolve())!=b||Uo&&Zi(new Uo)!=C||Xo&&Zi(new Xo)!=G)&&(Zi=function(T){var M=Ls(T),x=M==_?T.constructor:void 0,S=x?yi(x):"";if(S)switch(S){case kd:return P;case gi:return p;case Od:return b;case Bd:return C;case Wd:return G}return M});function Yo(T,M){return M=M??o,!!M&&(typeof T=="number"||dt.test(T))&&T>-1&&T%1==0&&T<M}function df(T){var M=typeof T;return M=="string"||M=="number"||M=="symbol"||M=="boolean"?T!=="__proto__":T===null}function ff(T){return!!ko&&ko in T}function pf(T){var M=T&&T.constructor,x=typeof M=="function"&&M.prototype||Sn;return T===x}function Mn(T){return Oo.call(T)}function yi(T){if(T!=null){try{return Do.call(T)}catch{}try{return T+""}catch{}}return""}function Ln(T,M){return T===M||T!==T&&M!==M}var zo=el(function(){return arguments}())?el:function(T){return Xr(T)&&Ze.call(T,"callee")&&!As.call(T,"callee")},Pn=Array.isArray;function ol(T){return T!=null&&Ur(T.length)&&!Vi(T)}var Ps=$h||gf;function al(T,M){return il(T,M)}function Vi(T){if(!hl(T))return!1;var M=Ls(T);return M==f||M==m||M==l||M==v}function Ur(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function hl(T){var M=typeof T;return T!=null&&(M=="object"||M=="function")}function Xr(T){return T!=null&&typeof T=="object"}var ll=yt?Fd(yt):Ko;function cl(T){return ol(T)?nf(T):hf(T)}function mf(){return[]}function gf(){return!1}r.exports=al}(_h,_h.exports);var xE=_h.exports;const sy=Ds(xE);var _E=Object.defineProperty,vE=(r,t,e)=>t in r?_E(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W=(r,t,e)=>(vE(r,typeof t!="symbol"?t+"":t,e),e);class qe{constructor(t){W(this,"parent"),W(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var TE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ny={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(TE)})(ny);const oy=ny.exports;function vh(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return oy[r]}else return oy[t]}const wE={removeOnInterrupt:!1,ease:"linear",time:1e3};class SE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"startX"),W(this,"startY"),W(this,"deltaX"),W(this,"deltaY"),W(this,"keepCenter"),W(this,"startWidth",null),W(this,"startHeight",null),W(this,"deltaWidth",null),W(this,"deltaHeight",null),W(this,"width",null),W(this,"height",null),W(this,"time",0),this.options=Object.assign({},wE,e),this.options.ease=vh(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new ut(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new ut(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const CE={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class EE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"underflowX"),W(this,"underflowY"),W(this,"ease"),W(this,"toX"),W(this,"toY"),this.options=Object.assign({},CE,e),this.ease=vh(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new ut(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new ut(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new ut(0,0),bottomRight:new ut(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const IE={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class AE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"last"),W(this,"noUnderflow"),W(this,"underflowX"),W(this,"underflowY"),this.options=Object.assign({},IE,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new ut(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const RE={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class ME extends qe{constructor(t,e={}){super(t),W(this,"options"),this.options=Object.assign({},RE,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const LE={friction:.98,bounce:.8,minSpeed:.01},Or=16;class PE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"x"),W(this,"y"),W(this,"percentChangeX"),W(this,"percentChangeY"),W(this,"saved"),W(this,"timeSinceRelease"),this.options=Object.assign({},LE,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Or/o*(Math.pow(n,s/Or)-Math.pow(n,i/Or)),this.x*=Math.pow(this.percentChangeX,t/Or)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Or/o*(Math.pow(n,s/Or)-Math.pow(n,i/Or)),this.y*=Math.pow(this.percentChangeY,t/Or)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const GE={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class FE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"moved"),W(this,"reverse"),W(this,"xDirection"),W(this,"yDirection"),W(this,"keyIsPressed"),W(this,"mouse"),W(this,"underflowX"),W(this,"underflowY"),W(this,"last"),W(this,"current"),W(this,"windowEventHandlers",[]),this.options=Object.assign({},GE,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new ut(this.last.x,this.last.y),world:this.parent.toWorld(new ut(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new ut(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const NE={speed:0,acceleration:null,radius:null};class DE extends qe{constructor(t,e,i={}){super(t),W(this,"options"),W(this,"target"),W(this,"velocity"),this.target=e,this.options=Object.assign({},NE,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,f=Math.abs(u)>Math.abs(o)?s:e.y+u;this.parent.moveCenter(d,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(c,u),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const kE={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class OE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"reverse"),W(this,"radiusSquared"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"horizontal"),W(this,"vertical"),this.options=Object.assign({},kE,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const BE={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class WE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"active",!1),W(this,"pinching",!1),W(this,"moved",!1),W(this,"lastCenter"),this.options=Object.assign({},BE,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new ut(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const f=this.parent.toGlobal(h);this.parent.x+=(l.x-f.x)*this.options.factor,this.parent.y+=(l.y-f.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const UE={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class XE extends qe{constructor(t,e,i,s={}){super(t),W(this,"options"),W(this,"ease"),W(this,"x"),W(this,"y"),W(this,"percent"),W(this,"snapping"),W(this,"deltaX"),W(this,"deltaY"),W(this,"startX"),W(this,"startY"),this.options=Object.assign({},UE,s),this.ease=vh(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const c=this.ease(e.time,0,1,this.options.time);s=o+h*c,n=a+l*c}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const ZE={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class VE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"ease"),W(this,"xScale"),W(this,"yScale"),W(this,"xIndependent"),W(this,"yIndependent"),W(this,"snapping"),this.options=Object.assign({},ZE,e),this.ease=vh(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const HE={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class KE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"smoothing"),W(this,"smoothingCenter"),W(this,"smoothingCount"),W(this,"keyIsPressed"),this.options=Object.assign({},HE,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class YE{constructor(t){W(this,"viewport"),W(this,"clickedAvailable"),W(this,"isMouseDown"),W(this,"last"),W(this,"wheelFunction"),W(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new pt(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new ut;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const bo=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class zE{constructor(t){W(this,"plugins"),W(this,"list"),W(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=bo.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=bo.indexOf(t);n!==-1&&bo.splice(n,1),bo.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of bo)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const jE={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:ve.shared,allowPreserveDragOutside:!1};class JE extends At{constructor(t){super(),W(this,"moving"),W(this,"screenWidth"),W(this,"screenHeight"),W(this,"threshold"),W(this,"input"),W(this,"plugins"),W(this,"zooming"),W(this,"lastViewport"),W(this,"options"),W(this,"_dirty"),W(this,"_forceHitArea"),W(this,"_hitAreaDefault"),W(this,"_pause"),W(this,"tickerFunction"),W(this,"_worldWidth"),W(this,"_worldHeight"),W(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...jE,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new YE(this),this.plugins=new zE(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new pt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new pt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new ut(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new ut(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new ut(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new ut(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new VE(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new ut(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new pt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new FE(this,t)),this}clamp(t){return this.plugins.add("clamp",new AE(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new PE(this,t)),this}bounce(t){return this.plugins.add("bounce",new EE(this,t)),this}pinch(t){return this.plugins.add("pinch",new WE(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new XE(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new DE(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new KE(this,t)),this}animate(t){return this.plugins.add("animate",new SE(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new ME(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new OE(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function Th(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function $E(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Qu(r){let t,e,i;r.length!==2?(t=Th,e=(a,h)=>Th(r(a),h),i=(a,h)=>r(a)-h):(t=r===Th||r===$E?r:QE,e=r,i=r);function s(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<0?l=u+1:c=u}while(l<c)}return l}function n(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<=0?l=u+1:c=u}while(l<c)}return l}function o(a,h,l=0,c=a.length){const u=s(a,h,l,c-1);return u>l&&i(a[u-1],h)>-i(a[u],h)?u-1:u}return{left:s,center:o,right:n}}function QE(){return 0}function qE(r){return r===null?NaN:+r}const tI=Qu(Th).right;Qu(qE).center;const eI=tI,iI=Math.sqrt(50),rI=Math.sqrt(10),sI=Math.sqrt(2);function wh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=iI?10:n>=rI?5:n>=sI?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?wh(r,t,e*2):[a,h,l]}function nI(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?wh(t,r,e):wh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function qu(r,t,e){return t=+t,r=+r,e=+e,wh(r,t,e)[2]}function td(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?qu(t,r,e):qu(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ed(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function ay(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function xo(){}var _o=.7,Sh=1/_o,pn="\\s*([+-]?\\d+)\\s*",vo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ki="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oI=/^#([0-9a-f]{3,8})$/,aI=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),hI=new RegExp(`^rgb\\(${ki},${ki},${ki}\\)$`),lI=new RegExp(`^rgba\\(${pn},${pn},${pn},${vo}\\)$`),cI=new RegExp(`^rgba\\(${ki},${ki},${ki},${vo}\\)$`),uI=new RegExp(`^hsl\\(${vo},${ki},${ki}\\)$`),dI=new RegExp(`^hsla\\(${vo},${ki},${ki},${vo}\\)$`),hy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ed(xo,To,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ly,formatHex:ly,formatHex8:fI,formatHsl:pI,formatRgb:cy,toString:cy});function ly(){return this.rgb().formatHex()}function fI(){return this.rgb().formatHex8()}function pI(){return my(this).formatHsl()}function cy(){return this.rgb().formatRgb()}function To(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=oI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?uy(t):e===3?new Me(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Ch(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Ch(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=aI.exec(r))?new Me(t[1],t[2],t[3],1):(t=hI.exec(r))?new Me(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lI.exec(r))?Ch(t[1],t[2],t[3],t[4]):(t=cI.exec(r))?Ch(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=uI.exec(r))?py(t[1],t[2]/100,t[3]/100,1):(t=dI.exec(r))?py(t[1],t[2]/100,t[3]/100,t[4]):hy.hasOwnProperty(r)?uy(hy[r]):r==="transparent"?new Me(NaN,NaN,NaN,0):null}function uy(r){return new Me(r>>16&255,r>>8&255,r&255,1)}function Ch(r,t,e,i){return i<=0&&(r=t=e=NaN),new Me(r,t,e,i)}function mI(r){return r instanceof xo||(r=To(r)),r?(r=r.rgb(),new Me(r.r,r.g,r.b,r.opacity)):new Me}function id(r,t,e,i){return arguments.length===1?mI(r):new Me(r,t,e,i??1)}function Me(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ed(Me,id,ay(xo,{brighter(r){return r=r==null?Sh:Math.pow(Sh,r),new Me(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?_o:Math.pow(_o,r),new Me(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Me(vs(this.r),vs(this.g),vs(this.b),Eh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dy,formatHex:dy,formatHex8:gI,formatRgb:fy,toString:fy}));function dy(){return`#${Ts(this.r)}${Ts(this.g)}${Ts(this.b)}`}function gI(){return`#${Ts(this.r)}${Ts(this.g)}${Ts(this.b)}${Ts((isNaN(this.opacity)?1:this.opacity)*255)}`}function fy(){const r=Eh(this.opacity);return`${r===1?"rgb(":"rgba("}${vs(this.r)}, ${vs(this.g)}, ${vs(this.b)}${r===1?")":`, ${r})`}`}function Eh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function vs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ts(r){return r=vs(r),(r<16?"0":"")+r.toString(16)}function py(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new di(r,t,e,i)}function my(r){if(r instanceof di)return new di(r.h,r.s,r.l,r.opacity);if(r instanceof xo||(r=To(r)),!r)return new di;if(r instanceof di)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new di(o,a,h,r.opacity)}function yI(r,t,e,i){return arguments.length===1?my(r):new di(r,t,e,i??1)}function di(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ed(di,yI,ay(xo,{brighter(r){return r=r==null?Sh:Math.pow(Sh,r),new di(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?_o:Math.pow(_o,r),new di(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Me(rd(r>=240?r-240:r+120,s,i),rd(r,s,i),rd(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new di(gy(this.h),Ih(this.s),Ih(this.l),Eh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=Eh(this.opacity);return`${r===1?"hsl(":"hsla("}${gy(this.h)}, ${Ih(this.s)*100}%, ${Ih(this.l)*100}%${r===1?")":`, ${r})`}`}}));function gy(r){return r=(r||0)%360,r<0?r+360:r}function Ih(r){return Math.max(0,Math.min(1,r||0))}function rd(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const sd=r=>()=>r;function bI(r,t){return function(e){return r+e*t}}function xI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function _I(r){return(r=+r)==1?yy:function(t,e){return e-t?xI(t,e,r):sd(isNaN(t)?e:t)}}function yy(r,t){var e=t-r;return e?bI(r,e):sd(isNaN(r)?t:r)}const by=function r(t){var e=_I(t);function i(s,n){var o=e((s=id(s)).r,(n=id(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=yy(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function vI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function TI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function wI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=ad(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function SI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Ah(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function CI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=ad(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var nd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,od=new RegExp(nd.source,"g");function EI(r){return function(){return r}}function II(r){return function(t){return r(t)+""}}function AI(r,t){var e=nd.lastIndex=od.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=nd.exec(r))&&(s=od.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:Ah(i,s)})),e=od.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?II(h[0].x):EI(t):(t=h.length,function(l){for(var c=0,u;c<t;++c)a[(u=h[c]).i]=u.x(l);return a.join("")})}function ad(r,t){var e=typeof t,i;return t==null||e==="boolean"?sd(t):(e==="number"?Ah:e==="string"?(i=To(t))?(t=i,by):AI:t instanceof To?by:t instanceof Date?SI:TI(t)?vI:Array.isArray(t)?wI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?CI:Ah)(r,t)}function RI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function MI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Rh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function mn(r){return r=Rh(Math.abs(r)),r?r[1]:NaN}function LI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function PI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var GI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Mh(r){if(!(t=GI.exec(r)))throw new Error("invalid format: "+r);var t;return new hd({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Mh.prototype=hd.prototype;function hd(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}hd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function FI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var xy;function NI(r,t){var e=Rh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(xy=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+Rh(r,Math.max(0,t+n-1))[0]}function _y(r,t){var e=Rh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const vy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:MI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>_y(r*100,t),r:_y,s:NI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ty(r){return r}var wy=Array.prototype.map,Sy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function DI(r){var t=r.grouping===void 0||r.thousands===void 0?Ty:LI(wy.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?Ty:PI(wy.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(u){u=Mh(u);var d=u.fill,f=u.align,m=u.sign,p=u.symbol,g=u.zero,y=u.width,_=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(_=!0,w="g"):vy[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var C=p==="$"?e:p==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",E=p==="$"?i:/[%p]/.test(w)?o:"",A=vy[w],R=/[defgprs%]/.test(w);b=b===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function G(N){var P=C,I=E,D,X,H;if(w==="c")I=A(N)+I,N="";else{N=+N;var Z=N<0||1/N<0;if(N=isNaN(N)?h:A(Math.abs(N),b),v&&(N=FI(N)),Z&&+N==0&&m!=="+"&&(Z=!1),P=(Z?m==="("?m:a:m==="-"||m==="("?"":m)+P,I=(w==="s"?Sy[8+xy/3]:"")+I+(Z&&m==="("?")":""),R){for(D=-1,X=N.length;++D<X;)if(H=N.charCodeAt(D),48>H||H>57){I=(H===46?s+N.slice(D+1):N.slice(D))+I,N=N.slice(0,D);break}}}_&&!g&&(N=t(N,1/0));var j=P.length+N.length+I.length,O=j<y?new Array(y-j+1).join(d):"";switch(_&&g&&(N=t(O+N,O.length?y-I.length:1/0),O=""),f){case"<":N=P+N+I+O;break;case"=":N=P+O+N+I;break;case"^":N=O.slice(0,j=O.length>>1)+P+N+I+O.slice(j);break;default:N=O+P+N+I;break}return n(N)}return G.toString=function(){return u+""},G}function c(u,d){var f=l((u=Mh(u),u.type="f",u)),m=Math.max(-8,Math.min(8,Math.floor(mn(d)/3)))*3,p=Math.pow(10,-m),g=Sy[8+m/3];return function(y){return f(p*y)+g}}return{format:l,formatPrefix:c}}var Lh,Cy,Ey;kI({thousands:",",grouping:[3],currency:["$",""]});function kI(r){return Lh=DI(r),Cy=Lh.format,Ey=Lh.formatPrefix,Lh}function OI(r){return Math.max(0,-mn(Math.abs(r)))}function BI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(mn(t)/3)))*3-mn(Math.abs(r)))}function WI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,mn(t)-mn(r))+1}function Iy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function UI(r){return function(){return r}}function XI(r){return+r}var Ay=[0,1];function gn(r){return r}function ld(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:UI(isNaN(t)?NaN:.5)}function ZI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function VI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=ld(s,i),n=e(o,n)):(i=ld(i,s),n=e(n,o)),function(a){return n(i(a))}}function HI(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=ld(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=eI(r,a,1,i)-1;return n[h](s[h](a))}}function Ry(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function KI(){var r=Ay,t=Ay,e=ad,i,s,n,o=gn,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==gn&&(o=ZI(r[0],r[d-1])),a=d>2?HI:VI,h=l=null,u}function u(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return u.invert=function(d){return o(s((l||(l=a(t,r.map(i),Ah)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,XI),c()):r.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),e=RI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:gn,c()):o!==gn},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(n=d,u):n},function(d,f){return i=d,s=f,c()}}function My(){return KI()(gn,gn)}function YI(r,t,e,i){var s=td(r,t,e),n;switch(i=Mh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=BI(s,o))&&(i.precision=n),Ey(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=WI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=OI(s))&&(i.precision=n-(i.type==="%")*2);break}}return Cy(i)}function zI(r){var t=r.domain;return r.ticks=function(e){var i=t();return nI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return YI(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,c=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);c-- >0;){if(l=qu(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Ly(){var r=My();return r.copy=function(){return Ry(r,Ly())},Iy.apply(r,arguments),zI(r)}function jI(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const cd=new Date,ud=new Date;function te(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>te(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(cd.setTime(+n),ud.setTime(+o),r(cd),r(ud),Math.floor(e(cd,ud))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Ph=te(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Ph.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?te(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Ph),Ph.range;const ar=1e3,ti=ar*60,hr=ti*60,lr=hr*24,dd=lr*7,Py=lr*30,fd=lr*365,yn=te(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*ar)},(r,t)=>(t-r)/ar,r=>r.getUTCSeconds());yn.range;const pd=te(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*ar)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getMinutes());pd.range,te(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getUTCMinutes()).range;const md=te(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*ar-r.getMinutes()*ti)},(r,t)=>{r.setTime(+r+t*hr)},(r,t)=>(t-r)/hr,r=>r.getHours());md.range,te(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*hr)},(r,t)=>(t-r)/hr,r=>r.getUTCHours()).range;const wo=te(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ti)/lr,r=>r.getDate()-1);wo.range;const gd=te(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/lr,r=>r.getUTCDate()-1);gd.range,te(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/lr,r=>Math.floor(r/lr)).range;function ws(r){return te(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ti)/dd)}const Gh=ws(0),Fh=ws(1),JI=ws(2),$I=ws(3),bn=ws(4),QI=ws(5),qI=ws(6);Gh.range,Fh.range,JI.range,$I.range,bn.range,QI.range,qI.range;function Ss(r){return te(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/dd)}const Gy=Ss(0),Nh=Ss(1),t2=Ss(2),e2=Ss(3),xn=Ss(4),i2=Ss(5),r2=Ss(6);Gy.range,Nh.range,t2.range,e2.range,xn.range,i2.range,r2.range;const yd=te(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());yd.range,te(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const cr=te(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());cr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:te(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),cr.range;const Cs=te(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());Cs.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:te(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),Cs.range;function s2(r,t,e,i,s,n){const o=[[yn,1,ar],[yn,5,5*ar],[yn,15,15*ar],[yn,30,30*ar],[n,1,ti],[n,5,5*ti],[n,15,15*ti],[n,30,30*ti],[s,1,hr],[s,3,3*hr],[s,6,6*hr],[s,12,12*hr],[i,1,lr],[i,2,2*lr],[e,1,dd],[t,1,Py],[t,3,3*Py],[r,1,fd]];function a(l,c,u){const d=c<l;d&&([l,c]=[c,l]);const f=u&&typeof u.range=="function"?u:h(l,c,u),m=f?f.range(l,+c+1):[];return d?m.reverse():m}function h(l,c,u){const d=Math.abs(c-l)/u,f=Qu(([,,g])=>g).right(o,d);if(f===o.length)return r.every(td(l/fd,c/fd,u));if(f===0)return Ph.every(Math.max(td(l,c,u),1));const[m,p]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return m.every(p)}return[a,h]}const[n2,o2]=s2(cr,yd,Gh,wo,md,pd);function bd(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function xd(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function So(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function a2(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=Co(s),c=Eo(s),u=Co(n),d=Eo(n),f=Co(o),m=Eo(o),p=Co(a),g=Eo(a),y=Co(h),_=Eo(h),b={a:Z,A:j,b:O,B:k,c:null,d:By,e:By,f:M2,g:W2,G:X2,H:I2,I:A2,j:R2,L:Wy,m:L2,M:P2,p:F,q:V,Q:Ky,s:Yy,S:G2,u:F2,U:N2,V:D2,w:k2,W:O2,x:null,X:null,y:B2,Y:U2,Z:Z2,"%":Hy},v={a:$,A:dt,b:ot,B:Et,c:null,d:Xy,e:Xy,f:Y2,g:rA,G:nA,H:V2,I:H2,j:K2,L:Zy,m:z2,M:j2,p:Mt,q:_t,Q:Ky,s:Yy,S:J2,u:$2,U:Q2,V:q2,w:tA,W:eA,x:null,X:null,y:iA,Y:sA,Z:oA,"%":Hy},w={a:G,A:N,b:P,B:I,c:D,d:ky,e:ky,f:w2,g:Dy,G:Ny,H:Oy,I:Oy,j:x2,L:T2,m:b2,M:_2,p:R,q:y2,Q:C2,s:E2,S:v2,u:d2,U:f2,V:p2,w:u2,W:m2,x:X,X:H,y:Dy,Y:Ny,Z:g2,"%":S2};b.x=C(e,b),b.X=C(i,b),b.c=C(t,b),v.x=C(e,v),v.X=C(i,v),v.c=C(t,v);function C(Y,tt){return function(et){var B=[],xt=-1,yt=0,Lt=Y.length,Zt,Xe,pi;for(et instanceof Date||(et=new Date(+et));++xt<Lt;)Y.charCodeAt(xt)===37&&(B.push(Y.slice(yt,xt)),(Xe=Fy[Zt=Y.charAt(++xt)])!=null?Zt=Y.charAt(++xt):Xe=Zt==="e"?" ":"0",(pi=tt[Zt])&&(Zt=pi(et,Xe)),B.push(Zt),yt=xt+1);return B.push(Y.slice(yt,xt)),B.join("")}}function E(Y,tt){return function(et){var B=So(1900,void 0,1),xt=A(B,Y,et+="",0),yt,Lt;if(xt!=et.length)return null;if("Q"in B)return new Date(B.Q);if("s"in B)return new Date(B.s*1e3+("L"in B?B.L:0));if(tt&&!("Z"in B)&&(B.Z=0),"p"in B&&(B.H=B.H%12+B.p*12),B.m===void 0&&(B.m="q"in B?B.q:0),"V"in B){if(B.V<1||B.V>53)return null;"w"in B||(B.w=1),"Z"in B?(yt=xd(So(B.y,0,1)),Lt=yt.getUTCDay(),yt=Lt>4||Lt===0?Nh.ceil(yt):Nh(yt),yt=gd.offset(yt,(B.V-1)*7),B.y=yt.getUTCFullYear(),B.m=yt.getUTCMonth(),B.d=yt.getUTCDate()+(B.w+6)%7):(yt=bd(So(B.y,0,1)),Lt=yt.getDay(),yt=Lt>4||Lt===0?Fh.ceil(yt):Fh(yt),yt=wo.offset(yt,(B.V-1)*7),B.y=yt.getFullYear(),B.m=yt.getMonth(),B.d=yt.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Lt="Z"in B?xd(So(B.y,0,1)).getUTCDay():bd(So(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Lt+5)%7:B.w+B.U*7-(Lt+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,xd(B)):bd(B)}}function A(Y,tt,et,B){for(var xt=0,yt=tt.length,Lt=et.length,Zt,Xe;xt<yt;){if(B>=Lt)return-1;if(Zt=tt.charCodeAt(xt++),Zt===37){if(Zt=tt.charAt(xt++),Xe=w[Zt in Fy?tt.charAt(xt++):Zt],!Xe||(B=Xe(Y,et,B))<0)return-1}else if(Zt!=et.charCodeAt(B++))return-1}return B}function R(Y,tt,et){var B=l.exec(tt.slice(et));return B?(Y.p=c.get(B[0].toLowerCase()),et+B[0].length):-1}function G(Y,tt,et){var B=f.exec(tt.slice(et));return B?(Y.w=m.get(B[0].toLowerCase()),et+B[0].length):-1}function N(Y,tt,et){var B=u.exec(tt.slice(et));return B?(Y.w=d.get(B[0].toLowerCase()),et+B[0].length):-1}function P(Y,tt,et){var B=y.exec(tt.slice(et));return B?(Y.m=_.get(B[0].toLowerCase()),et+B[0].length):-1}function I(Y,tt,et){var B=p.exec(tt.slice(et));return B?(Y.m=g.get(B[0].toLowerCase()),et+B[0].length):-1}function D(Y,tt,et){return A(Y,t,tt,et)}function X(Y,tt,et){return A(Y,e,tt,et)}function H(Y,tt,et){return A(Y,i,tt,et)}function Z(Y){return o[Y.getDay()]}function j(Y){return n[Y.getDay()]}function O(Y){return h[Y.getMonth()]}function k(Y){return a[Y.getMonth()]}function F(Y){return s[+(Y.getHours()>=12)]}function V(Y){return 1+~~(Y.getMonth()/3)}function $(Y){return o[Y.getUTCDay()]}function dt(Y){return n[Y.getUTCDay()]}function ot(Y){return h[Y.getUTCMonth()]}function Et(Y){return a[Y.getUTCMonth()]}function Mt(Y){return s[+(Y.getUTCHours()>=12)]}function _t(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var tt=C(Y+="",b);return tt.toString=function(){return Y},tt},parse:function(Y){var tt=E(Y+="",!1);return tt.toString=function(){return Y},tt},utcFormat:function(Y){var tt=C(Y+="",v);return tt.toString=function(){return Y},tt},utcParse:function(Y){var tt=E(Y+="",!0);return tt.toString=function(){return Y},tt}}}var Fy={"-":"",_:" ",0:"0"},ae=/^\s*\d+/,h2=/^%/,l2=/[\\^$*+?|[\]().{}]/g;function It(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function c2(r){return r.replace(l2,"\\$&")}function Co(r){return new RegExp("^(?:"+r.map(c2).join("|")+")","i")}function Eo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function u2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function d2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function f2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function p2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function m2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Ny(r,t,e){var i=ae.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Dy(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function g2(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function y2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function b2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function ky(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function x2(r,t,e){var i=ae.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Oy(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function _2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function v2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function T2(r,t,e){var i=ae.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function w2(r,t,e){var i=ae.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function S2(r,t,e){var i=h2.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function C2(r,t,e){var i=ae.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function E2(r,t,e){var i=ae.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function By(r,t){return It(r.getDate(),t,2)}function I2(r,t){return It(r.getHours(),t,2)}function A2(r,t){return It(r.getHours()%12||12,t,2)}function R2(r,t){return It(1+wo.count(cr(r),r),t,3)}function Wy(r,t){return It(r.getMilliseconds(),t,3)}function M2(r,t){return Wy(r,t)+"000"}function L2(r,t){return It(r.getMonth()+1,t,2)}function P2(r,t){return It(r.getMinutes(),t,2)}function G2(r,t){return It(r.getSeconds(),t,2)}function F2(r){var t=r.getDay();return t===0?7:t}function N2(r,t){return It(Gh.count(cr(r)-1,r),t,2)}function Uy(r){var t=r.getDay();return t>=4||t===0?bn(r):bn.ceil(r)}function D2(r,t){return r=Uy(r),It(bn.count(cr(r),r)+(cr(r).getDay()===4),t,2)}function k2(r){return r.getDay()}function O2(r,t){return It(Fh.count(cr(r)-1,r),t,2)}function B2(r,t){return It(r.getFullYear()%100,t,2)}function W2(r,t){return r=Uy(r),It(r.getFullYear()%100,t,2)}function U2(r,t){return It(r.getFullYear()%1e4,t,4)}function X2(r,t){var e=r.getDay();return r=e>=4||e===0?bn(r):bn.ceil(r),It(r.getFullYear()%1e4,t,4)}function Z2(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+It(t/60|0,"0",2)+It(t%60,"0",2)}function Xy(r,t){return It(r.getUTCDate(),t,2)}function V2(r,t){return It(r.getUTCHours(),t,2)}function H2(r,t){return It(r.getUTCHours()%12||12,t,2)}function K2(r,t){return It(1+gd.count(Cs(r),r),t,3)}function Zy(r,t){return It(r.getUTCMilliseconds(),t,3)}function Y2(r,t){return Zy(r,t)+"000"}function z2(r,t){return It(r.getUTCMonth()+1,t,2)}function j2(r,t){return It(r.getUTCMinutes(),t,2)}function J2(r,t){return It(r.getUTCSeconds(),t,2)}function $2(r){var t=r.getUTCDay();return t===0?7:t}function Q2(r,t){return It(Gy.count(Cs(r)-1,r),t,2)}function Vy(r){var t=r.getUTCDay();return t>=4||t===0?xn(r):xn.ceil(r)}function q2(r,t){return r=Vy(r),It(xn.count(Cs(r),r)+(Cs(r).getUTCDay()===4),t,2)}function tA(r){return r.getUTCDay()}function eA(r,t){return It(Nh.count(Cs(r)-1,r),t,2)}function iA(r,t){return It(r.getUTCFullYear()%100,t,2)}function rA(r,t){return r=Vy(r),It(r.getUTCFullYear()%100,t,2)}function sA(r,t){return It(r.getUTCFullYear()%1e4,t,4)}function nA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?xn(r):xn.ceil(r),It(r.getUTCFullYear()%1e4,t,4)}function oA(){return"+0000"}function Hy(){return"%"}function Ky(r){return+r}function Yy(r){return Math.floor(+r/1e3)}var _n,zy;aA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function aA(r){return _n=a2(r),zy=_n.format,_n.parse,_n.utcFormat,_n.utcParse,_n}function hA(r){return new Date(r)}function lA(r){return r instanceof Date?+r:+new Date(+r)}function jy(r,t,e,i,s,n,o,a,h,l){var c=My(),u=c.invert,d=c.domain,f=l(".%L"),m=l(":%S"),p=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),_=l("%b %d"),b=l("%B"),v=l("%Y");function w(C){return(h(C)<C?f:a(C)<C?m:o(C)<C?p:n(C)<C?g:i(C)<C?s(C)<C?y:_:e(C)<C?b:v)(C)}return c.invert=function(C){return new Date(u(C))},c.domain=function(C){return arguments.length?d(Array.from(C,lA)):d().map(hA)},c.ticks=function(C){var E=d();return r(E[0],E[E.length-1],C??10)},c.tickFormat=function(C,E){return E==null?w:l(E)},c.nice=function(C){var E=d();return(!C||typeof C.range!="function")&&(C=t(E[0],E[E.length-1],C??10)),C?d(jI(E,C)):c},c.copy=function(){return Ry(c,jy(r,t,e,i,s,n,o,a,h,l))},c}function cA(){return Iy.apply(jy(n2,o2,cr,yd,Gh,wo,md,pd,yn,zy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Io(r,t,e){this.k=r,this.x=t,this.y=e}Io.prototype={constructor:Io,scale:function(r){return r===1?this:new Io(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new Io(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Io.prototype;function Jy(r){return r.mode==="temporal"||r.mode==="left-aligned"?uA(r):dA(r)}function uA({domain:r,range:t}){return cA().domain(r).range(t)}function dA({domain:r,range:t}){return Ly().domain(r).range(t)}function _d(r){return{mode:ct.horizontal,range:$R(),domain:QR(r)}}function fA(){return{mode:ct.vertical}}let vn=null;async function pA(){const r=await Go();$y(r.start_time),nt.on("layoutSettingsUpdated",()=>$y(r.start_time))}function mA(){vn=null}async function Es(){return vn||await Fe("scaleCreated")}async function $y(r){await Ue();const t=vn?"scaleUpdated":"scaleCreated",e=_d(r);vn=Jy(e),nt.emit(t,vn)}let Le=null,vd=null;async function gA(){const r=await de(),t=await cu();Le=new JE({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Le.zIndex=1,Le.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Le.on("moved",()=>{nt.emit("viewportMoved",null)}).on("moved-end",()=>{nt.emit("viewportMoved",null)}),r.stage.addChild(Le),nt.emit("viewportCreated",Le),nt.on("applicationResized",vA),nt.on("scaleUpdated",()=>Dh()),xA()}function yA(){Le=null,vd=null}async function Td({animate:r}={}){const t=await we(),e=await Yt(),i=t.getChildByName(Cf);if(!i)throw new Error("Nodes container not found");const s=e.styles.guideTextSize+e.styles.guideTextTopPadding;SA();const{x:n,y:o,width:a,height:h}=i.getLocalBounds(),l=a+e.styles.columnGap*2,c=h+e.styles.rowGap*2+s*2,u=t.findFit(l,c);!a||!h||t.animate({position:{x:n+a/2,y:o+h/2-s},scale:Math.min(u,1),time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{wd(),Dh()}})}async function we(){return Le||await Fe("viewportCreated")}function Qy(r){sy(vd,r)||(vd=r,nt.emit("viewportDateRangeUpdated",r))}function bA({xOffset:r,yOffset:t}){if(!Le)return;const{x:e,y:i}=Le.transform.position;Le.setTransform(e+r,i+t,Le.transform.scale.x,Le.transform.scale.y)}async function xA(){const r=await we();Dh(),r.on("moved",()=>Dh())}async function Dh(){const r=await qy();r&&Qy(r)}async function qy(){const r=await we(),t=await Es(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function _A(r){const t=await qy(),e=await Ue();if(r===void 0||e.isDependency()||sy(r,t))return;const i=await we(),s=await Es(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;Qy(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function vA(){const r=await de(),t=await we(),e=await cu(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),bA({xOffset:a,yOffset:h})}class kh{constructor(){yf(this,"status","visible");yf(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Oi=null,ei=null,Bi=null,ur=null,fi=null;async function TA(){const r=await we(),t=await de();Oi=new bE({toggle:"renderable"}),ei=new kh,Bi=new kh,fi=new kh,ur=new kh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2,n=r.scale.x>.2;fi==null||fi.toggle(e),ei==null||ei.toggle(i),Bi==null||Bi.toggle(s),ur==null||ur.toggle(n),Oi==null||Oi.cull(t.renderer.screen),r.dirty=!1}}),nt.emit("cullCreated",Oi),nt.emit("labelCullCreated",ei),nt.emit("iconCullCreated",ei),nt.emit("edgeCullCreated",fi),nt.emit("toggleCullCreated",ur)}function wA(){Oi=null,ei==null||ei.clear(),ei=null,Bi==null||Bi.clear(),Bi=null,fi==null||fi.clear(),fi=null,ur==null||ur.clear(),ur=null}async function wd(){const r=await we();r.dirty=!0}function SA(){Oi&&Oi.uncull()}async function tb(){return Oi||await Fe("cullCreated")}async function CA(){return fi||await Fe("edgeCullCreated")}async function eb(){return ei||await Fe("labelCullCreated")}async function EA(){return Bi||await Fe("iconCullCreated")}async function ib(){const r=await Ue(),t=await Yt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ry.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{wd()}})}return{animate:e}}let Oh=new Map;function IA(){Oh=new Map}async function Bh(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Oh.has(e))return Oh.get(e);const i=await r(...t);return Oh.set(e,i),i}async function AA({size:r,stroke:t=1,radius:e=0}){const i=await de(),s=new io;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new pt(0,0,r,r),resolution:10})}async function rb(r){return await Bh(AA,[r])}var Wh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Wh||{});function sb(){const r=new qt;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await rb(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function RA(){const r=await de(),t=new io;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:_i.REPEAT})}async function Sd(){return await Bh(RA,[])}function Cd(r,t){return Array.from({length:r},(e,i)=>t(i))}const MA=8,LA=2;async function PA(){const r=await Yt(),t=await tb(),e=await CA(),{animate:i}=await ib(),s=new At,{element:n,render:o}=await sb(),a=await Sd(),h=Cd(20,()=>new ut),l=new uS(a,h);let c=!1;s.name=Ob,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Wh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,p){const g=f(p);c||await u();for(const[y,_]of h.entries()){const{x:b,y:v}=g[y];i(_,{x:b,y:v},!c)}i(s,{x:m.x,y:m.y},!c),i(n,{x:p.x-MA,y:p.y},!c),c=!0}function f({x:m,y:p}){const g=[],y={x:0,y:0},_={x:m-LA,y:p},b={x:nb(y.x,{source:y,target:_}),y:y.y},v={x:nb(_.x,{source:y,target:_},!0),y:_.y};for(const[w]of h.entries()){if(w===h.length-1){g[w]=_;continue}const C=GA(w,{source:y,target:_,sourceBezier:b,targetBezier:v});g[w]=C}return g}return{element:s,render:u,setPosition:d}}function nb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function GA(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,c=n.y+(o.y-n.y)*e,u=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,f=a+(l-a)*e,m=h+(c-h)*e,p=l+(u-l)*e,g=c+(d-c)*e,y=f+(p-f)*e,_=m+(g-m)*e;return{x:y,y:_}}async function FA({height:r,radius:t}){const e=await de(),i=new io;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new pt(0,0,t,r),resolution:10})}async function NA(r){return await Bh(FA,[r])}function DA(){const r=new qt,t=new qt;async function e(i){const s=await NA(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function Ao(){const r=await Sd();return new qt(r)}async function Ed(){const r=new At,t=await Ao(),{left:e,right:i,render:s}=await DA();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:c,visible:u}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=u,t.width=l,t.height=h.height,t.x=c,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),c=o(h.capRight,h.radius);let u=0;l&&(u+=h.radius),c&&(u+=h.radius);const d=Math.max(h.width-u,0),f=d>0,m=l?h.radius:0;return{width:d,visible:f,x:m}}return{element:r,render:n}}function Id(){const r=new At,t=new qt,e=new qt,i=new qt,s=new qt,n=new qt,o=new qt,a=new qt,h=new qt;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(f){const{radius:m=0,color:p="#fff",stroke:g,width:y,height:_}=f,b=Math.min(y,_),v=m*2>b?b/2:m,C=await rb({size:v,radius:m,stroke:g}),E=await Sd();return c({texture:C,width:y,height:_,size:v}),u({texture:E,width:y,height:_,size:v,stroke:g}),d(p),r}function c({texture:f,width:m,height:p,size:g}){t.texture=f,e.texture=f,i.texture=f,s.texture=f,t.position.set(0,0),e.position.set(m-g,0),i.position.set(0,p-g),s.position.set(m-g,p-g)}function u({texture:f,size:m,width:p,height:g,stroke:y}){const _=Math.max(g-m*2,0),b=Math.max(p-m*2,0);a.texture=f,n.texture=f,o.texture=f,h.texture=f,n.position.set(0,m),n.height=_,n.width=y,o.position.set(p-y,m),o.height=_,o.width=y,a.position.set(m,0),a.width=b,a.height=y,h.position.set(m,g-y),h.width=b,h.height=y}function d(f){t.tint=f,e.tint=f,i.tint=f,s.tint=f,a.tint=f,n.tint=f,o.tint=f,h.tint=f}return{element:r,render:l}}async function ob(){const r=await Yt(),t=new At,{element:e,render:i}=await Id();async function s({selected:n,width:o,height:a}){if(!n)return t.removeChild(e),t;const{selectedBorderColor:h,selectedBorderWidth:l,selectedBorderOffset:c,selectedBorderRadius:u}=r.styles;return e.position.set(-c,-c),t.addChild(e),await i({stroke:l,radius:u,width:o+c*2,height:a+c*2,color:h}),t}return{element:t,render:s}}async function kA(){const r=await Yt(),t=new At,{element:e,render:i}=await Ed(),{element:s,render:n}=await ob();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r.styles,d={width:h,height:l,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([i(d),n({selected:a,width:h,height:l})]),t}return{element:t,render:o}}const OA=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15.7984%207.99134L12.7215%2012.9913C12.5599%2013.2539%2012.2797%2013.4202%2011.9718%2013.4362C11.664%2013.4523%2011.3679%2013.3159%2011.18%2013.0716L9.25692%2010.5716L10.7431%209.4284L11.8372%2010.8508L14.2016%207.00866L15.7984%207.99134Z'%20fill='white'/%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15%207.1875H10V5.3125H15V7.1875ZM15%2010.9375H10V9.0625H15V10.9375ZM10%2014.6875H12.5V12.8125H10V14.6875Z'%20fill='white'/%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM9.52483%206.61458C9.7035%205.94774%2010.3889%205.55202%2011.0558%205.73069C11.7226%205.90937%2012.1183%206.59479%2011.9396%207.26162C11.761%207.92846%2011.0755%208.32418%2010.4087%208.14551C9.74188%207.96683%209.34615%207.28141%209.52483%206.61458ZM13.0604%2012.7383C13.239%2012.0715%2013.9245%2011.6757%2014.5913%2011.8544C15.2581%2012.0331%2015.6539%2012.7185%2015.4752%2013.3854C15.2965%2014.0522%2014.6111%2014.4479%2013.9442%2014.2692C13.2774%2014.0906%2012.8817%2013.4051%2013.0604%2012.7383ZM10.78%2014.27L15.78%206.77002L14.2199%205.72996L9.21995%2013.23L10.78%2014.27Z'%20fill='white'/%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM10%207.1875H11.875V5.3125H10V7.1875ZM10%2010.9375H11.875V9.0625H10V10.9375ZM11.875%2014.6875H10V12.8125H11.875V14.6875ZM13.125%207.1875H15V5.3125H13.125V7.1875ZM15%2010.9375H13.125V9.0625H15V10.9375ZM13.125%2014.6875H15V12.8125H13.125V14.6875Z'%20fill='white'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function BA(r){const t={resolution:4};return rt.from(OA[r],t)}async function WA(r){return await Bh(BA,[r])}async function UA({cullAtZoomThreshold:r=!0}={}){const t=await EA(),e=new qt;r&&t.add(e);async function i(s){const n=await WA(s);return e.texture=n,e}return{element:e,render:i}}var ab={exports:{}};(function(r){(function(){function t(p,g){document.addEventListener?p.addEventListener("scroll",g,!1):p.attachEvent("scroll",g)}function e(p){document.body?p():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),p()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),p())})}function i(p){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(p)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(p,g){p.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(p){var g=p.g.offsetWidth,y=g+100;return p.j.style.width=y+"px",p.i.scrollLeft=y,p.h.scrollLeft=p.h.scrollWidth+100,p.l!==g?(p.l=g,!0):!1}function o(p,g){function y(){var b=_;n(b)&&b.g.parentNode!==null&&g(b.l)}var _=p;t(p.h,y),t(p.i,y),n(p)}function a(p,g,y){g=g||{},y=y||window,this.family=p,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,c=null,u=null;function d(p){return l===null&&(f(p)&&/Apple/.test(window.navigator.vendor)?(p=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!p&&603>parseInt(p[1],10)):l=!1),l}function f(p){return u===null&&(u=!!p.document.fonts),u}function m(p,g){var y=p.style,_=p.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,_,c?p.stretch:"","100px",g].join(" ")}a.prototype.load=function(p,g){var y=this,_=p||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(C,E){if(f(y.context)&&!d(y.context)){var A=new Promise(function(G,N){function P(){new Date().getTime()-w>=v?N(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),_).then(function(I){1<=I.length?G():setTimeout(P,25)},N)}P()}),R=new Promise(function(G,N){b=setTimeout(function(){N(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([R,A]).then(function(){clearTimeout(b),C(y)},E)}else e(function(){function G(){var V;(V=X!=-1&&H!=-1||X!=-1&&Z!=-1||H!=-1&&Z!=-1)&&((V=X!=H&&X!=Z&&H!=Z)||(h===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=h&&(X==j&&H==j&&Z==j||X==O&&H==O&&Z==O||X==k&&H==k&&Z==k)),V=!V),V&&(F.parentNode!==null&&F.parentNode.removeChild(F),clearTimeout(b),C(y))}function N(){if(new Date().getTime()-w>=v)F.parentNode!==null&&F.parentNode.removeChild(F),E(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(X=P.g.offsetWidth,H=I.g.offsetWidth,Z=D.g.offsetWidth,G()),b=setTimeout(N,50)}}var P=new i(_),I=new i(_),D=new i(_),X=-1,H=-1,Z=-1,j=-1,O=-1,k=-1,F=document.createElement("div");F.dir="ltr",s(P,m(y,"sans-serif")),s(I,m(y,"serif")),s(D,m(y,"monospace")),F.appendChild(P.g),F.appendChild(I.g),F.appendChild(D.g),y.context.document.body.appendChild(F),j=P.g.offsetWidth,O=I.g.offsetWidth,k=D.g.offsetWidth,N(),o(P,function(V){X=V,G()}),s(P,m(y,'"'+y.family+'",sans-serif')),o(I,function(V){H=V,G()}),s(I,m(y,'"'+y.family+'",serif')),o(D,function(V){Z=V,G()}),s(D,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(ab);var XA=ab.exports;const ZA=Ds(XA),hb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},lb={resolution:4,chars:ui.ASCII},cb="sans-serif",ub={inter:YA(hb.inter)};let Ad=!1;async function VA(){const r=Object.values(hb);await Promise.all(r.map(t=>HA(t))),Ad=!0,nt.emit("fontsLoaded",ub)}async function HA(r){const{fontFamily:t,...e}=r,i=new ZA(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${cb}`),ui.from(t,{fontFamily:cb,...e},lb);return}ui.from(t,r,lb)}function KA(){Ad=!1}async function db(){return Ad?ub:await Fe("fontsLoaded")}function YA(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new BS(s,i)}async function Rd({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await db(),e=await eb(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const zA=["result","markdown","table","unknown"],fb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},Uh=["flow-run","task-run"];function jA(r){return Uh.includes(r)}function Md(r){return Uh.includes(r.kind)}function pb(r){return r.kind==="artifact"}function mb(r){return r.kind==="artifacts"}async function gb({cullAtZoomThreshold:r}){const t=await Yt(),e=new At,i=new At,{element:s,render:n}=await UA({cullAtZoomThreshold:r}),{element:o,render:a}=await Rd({cullAtZoomThreshold:r}),{element:h,render:l}=await kA();let c=!1,u=null,d=null;i.addChild(s),i.addChild(o),e.addChild(h),e.addChild(i);async function f(y){if(y){const{selected:_,name:b,type:v}=y;c=_??c,u=b??u,d=v??d}return await Promise.all([m(),p()]),await g(),e}async function m(){if(!d)return s;const y=fb[d],{artifactIconSize:_,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,C=await n(y);return C.position={x:v,y:w},C.width=_,C.height=_,C.tint=b,C}async function p(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:_,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,C=y+v+w,E=_;return o.tint=b,o.scale.set(.75),o.position={x:C,y:E},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:_,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+_,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let ge=null,Xh=!1;async function JA(){const r=await we();r.on("click",()=>Ro(null)),r.on("drag-start",()=>{Xh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Xh=!1})})}function $A(){ge=null,Xh=!1}function Ro(r){if(!Xh&&!(!r&&!ge||r&&Mo(r))){if(ge=r,r===null){nt.emit("itemSelected",null);return}nt.emit("itemSelected",r)}}function Mo(r){if(ge===null)return!1;const{kind:t}=r;switch(t){case"task-run":return Md(ge)&&ge.id===r.id;case"flow-run":return Md(ge)&&ge.id===r.id;case"artifact":return pb(ge)&&ge.id===r.id;case"artifacts":return mb(ge)&&ge.ids.length===r.ids.length&&ge.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function QA(){return ge&&Uh.includes(ge.kind)?ge:null}async function yb(r,{cullAtZoomThreshold:t=!0}={}){const{element:e,render:i}=await gb({cullAtZoomThreshold:t});let s=!1;e.eventMode="static",e.cursor="pointer",e.on("click",l=>{l.stopPropagation(),Ro({kind:"artifact",id:r.id})}),nt.on("itemSelected",()=>{const l=Mo({kind:"artifact",id:r.id});l!==s&&(s=l,n())});async function n(){await i({selected:s,name:r.key,type:r.type})}function o(){return s}function a(){return r.created}function h(){return r.id}return{element:e,render:n,getSelected:o,getDate:a,getId:h}}async function qA(){const r=await Yt(),t=await eb(),e=new At,{element:i,render:s}=await sb(),{element:n,render:o}=await Ed(),{element:a,render:h}=await Id();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:m}){l=f;const p={size:10,stroke:2,rotate:m?Wh.Up:Wh.Down},g=await s(p),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},_=await o(y);_.alpha=f?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:_.height/2,x:_.width/2},w=p.size/4;return g.x=v.x,g.y=m?v.y+w:v.y-w,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function bb(){const r=await Yt(),t=await Ue(),e=new At,{element:i,render:s}=await Ed(),{element:n,render:o}=await ob();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.styles.node(l),{nodeHeight:u,nodeRadius:d}=r.styles,f=Mo({kind:l.kind,id:l.id}),m=h(l,d),p=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:m,height:u,radius:d,background:c,capRight:p}),o({selected:f,width:m,height:u})]),i}function h(l,c){const u=Pd();if(ct.isTemporal()||ct.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,p=Ef(f,d)/ta*u;return Math.max(p,c*2)}return u}return{element:e,render:a}}class xb extends At{updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function tR(r){const t=new xb,e=await Yt(),{element:i,render:s}=await bb(),{element:n,render:o}=await Rd(),{element:a,render:h,getSize:l,stopWorker:c}=await Mb(),{element:u,render:d}=await qA(),{element:f,render:m}=await Id(),{start:p,stop:g}=await U0(r.id,P=>{h(P)});let y=r,_=!1;t.addChild(f),t.addChild(i),t.addChild(n),t.addChild(u),u.on("click",P=>{P.stopPropagation(),v()}),a.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},a.on("rendered",()=>{wd(),G()});async function b(P){return y=P,await s(P),await A(),await R(P),await w(P),t}async function v(){_?await E():await C()}async function w(P){const{background:I="#fff"}=e.styles.node(P),D=4,{width:X,height:H}=l(),Z=H+e.styles.nodeHeight+e.styles.nodesPadding*2+D*2,j=e.styles.nodeHeight,O=_?-D:D,k=Math.max(i.width,X),F=_?k+D*2:i.width-D*2;(await m({width:F,height:_?Z:j,stroke:_?2:1,radius:e.styles.nodeBorderRadius,color:I})).position.set(O,O)}async function C(){_=!0,t.addChild(a),await Promise.all([p(),b(y)]),G()}async function E(){_=!1,t.removeChild(a),c(),await Promise.all([g(),b(y)]),G()}async function A(){const P=e.styles.nodeToggleSize,I=e.styles.nodeHeight-P,D=i.width>P,X=await d({inside:D,isOpen:_});return X.x=D?I/2:i.width+e.styles.nodePadding,X.y=I/2,X}async function R(P){const I=await o(P.label),D=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,X=e.styles.nodePadding,H=u.x+u.width+X,Z=i.width+X,j=i.width>H+I.width+X,O=e.styles.nodeHeight/2-I.height/2,k=j?H:Math.max(Z,H);return I.position={x:k,y:O},I.tint=j?D:e.styles.textDefault,I}function G(){w(y);const P=N();t.emit("resized",P)}function N(){const P=l(),I=_?P.height+e.styles.nodesPadding*2:0,D=_?P.width:0;return{height:e.styles.nodeHeight+I,width:Math.max(D,t.width)}}return{kind:"flow-run",element:t,bar:i,render:b}}async function eR(){const r=await Yt(),t=new xb,{element:e,render:i}=await Rd(),{element:s,render:n}=await bb();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,c=s.width>l+e.width+l,u=c?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}var _b="Expected a function",vb=NaN,iR="[object Symbol]",rR=/^\s+|\s+$/g,sR=/^[-+]0x[0-9a-f]+$/i,nR=/^0b[01]+$/i,oR=/^0o[0-7]+$/i,aR=parseInt,hR=typeof xe=="object"&&xe&&xe.Object===Object&&xe,lR=typeof self=="object"&&self&&self.Object===Object&&self,cR=hR||lR||Function("return this")(),uR=Object.prototype,dR=uR.toString,fR=Math.max,pR=Math.min,Ld=function(){return cR.Date.now()};function mR(r,t,e){var i,s,n,o,a,h,l=0,c=!1,u=!1,d=!0;if(typeof r!="function")throw new TypeError(_b);t=Tb(t)||0,Zh(e)&&(c=!!e.leading,u="maxWait"in e,n=u?fR(Tb(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(C){var E=i,A=s;return i=s=void 0,l=C,o=r.apply(A,E),o}function m(C){return l=C,a=setTimeout(y,t),c?f(C):o}function p(C){var E=C-h,A=C-l,R=t-E;return u?pR(R,n-A):R}function g(C){var E=C-h,A=C-l;return h===void 0||E>=t||E<0||u&&A>=n}function y(){var C=Ld();if(g(C))return _(C);a=setTimeout(y,p(C))}function _(C){return a=void 0,d&&i?f(C):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function v(){return a===void 0?o:_(Ld())}function w(){var C=Ld(),E=g(C);if(i=arguments,s=this,h=C,E){if(a===void 0)return m(h);if(u)return a=setTimeout(y,t),f(h)}return a===void 0&&(a=setTimeout(y,t)),o}return w.cancel=b,w.flush=v,w}function gR(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(_b);return Zh(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),mR(r,t,{leading:i,maxWait:t,trailing:s})}function Zh(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function yR(r){return!!r&&typeof r=="object"}function bR(r){return typeof r=="symbol"||yR(r)&&dR.call(r)==iR}function Tb(r){if(typeof r=="number")return r;if(bR(r))return vb;if(Zh(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=Zh(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(rR,"");var e=nR.test(r);return e||oR.test(r)?aR(r.slice(2),e?2:8):sR.test(r)?vb:+r}var xR=gR;const _R=Ds(xR);async function vR(){const{element:r,render:t}=await gb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",r.on("click",l=>{l.stopPropagation();const c={x:r.position.x+r.width/2,y:r.position.y+r.height};Ro({kind:"artifacts",ids:i,position:c})}),nt.on("itemSelected",()=>{const l=Mo({kind:"artifacts",ids:i});l!==s&&e&&(s=l,n({ids:i,date:e}))});async function n(l){if(!l){e=null,i=[],r.visible=!1;return}const{ids:c,date:u}=l;e=u,i=c,await t({selected:s,type:"unknown",name:c.length.toString()}),r.visible=!0}function o(){return s}function a(){return e}function h(){return i}return{element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function wb(r){const t=await de(),e=await we(),i=await Yt(),s=await Ue();let n=await Es();const o=await h();nt.on("scaleUpdated",c=>{n=c,l()}),nt.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="artifact"?await yb(r.artifact,{cullAtZoomThreshold:!1}):await vR()}function l(){const c=o.getDate();if(!c||!ct.isTemporal()||s.disableArtifacts)return;const u=o.getSelected(),{element:d}=o;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:_}=i.styles;f=y+_*2}const p=n(c)*e.scale._x+e.worldTransform.tx-(d.width-f)/2,g=t.screen.height-(d.height-f)-10;d.position.set(p,g)}return{...o,render:a}}async function TR(){const r=await de(),t=await we(),e=await Yt(),i=await Ue(),s=new Map,n=[];let o=null,a=null,h=!1;nt.on("viewportMoved",()=>d());async function l(b){if(o&&(o.visible=!i.disableArtifacts),i.disableArtifacts||(b&&(a=b),!a))return;o||u();const v=[];for(const w of a)v.push(c(w));await Promise.all(v)}async function c(b){if(s.has(b.id))return s.get(b.id).render();const v=await wb({type:"artifact",artifact:b});return s.set(b.id,v),o.addChild(v.element),v.render()}function u(){o=new At,o.zIndex=3,r.stage.addChild(o)}function d(){if(!(!o||i.disableArtifacts)){if(!ct.isTemporal()){h||(y(),_(),h=!0),o.position.x=t.scale._x+t.worldTransform.tx;return}h=!1,o.position.x=0,f()}}const f=_R(async()=>{const b=[...s.values()],v=[...n];b.sort((w,C)=>w.element.x-C.element.x),await m(b,v);for(const w of v)w.render()},250);async function m(b,v,w){let C,E=null,A=null;for(let R=w??0;R<b.length;R++){const G=b[R],N=G.element.x;if(G.element.visible=!0,E!==null&&C&&N<C){A=R;break}E=R,C=N+G.element.width}if(A!==null&&E!==null){const R=b[E],G=b[A];R.element.visible=!1,G.element.visible=!1;const N=await p(R,G,v);N&&(b.splice(E,1,N),b.splice(A,1)),m(b,v,E)}}async function p(b,v,w){const C=b.getDate(),E=v.getDate(),A="getId"in b?[b.getId()]:b.getIds(),R="getId"in v?[v.getId()]:v.getIds();if(!C||!E)return console.error("flowRunArtifacts: visible item is missing date"),null;let G;if("isCluster"in b)G=b;else if("isCluster"in v)G=v;else if(w.length>0)G=w.pop();else{const I=await wb({type:"cluster"});o.addChild(I.element),n.push(I),G=I}const N=[...A,...R],P=g(N);return G.render({ids:N,date:P}),G}function g(b){const v=b.reduce((E,A)=>{const R=s.get(A);return R&&E.push(R.getDate().getTime()),E},[]),w=Math.min(...v),C=Math.max(...v);return new Date((w+C)/2)}function y(){for(const b of n)b.render();for(const b of s.values())b.element.visible=!0}function _(){const{artifactContentGap:b}=e.styles;let v=0;for(const w of s.values())w.element.x=v,v+=w.element.width+b}return{render:l}}async function wR(){const r=await Go(),{render:t}=await TR();function e(i){t(i==null?void 0:i.artifacts)}r.artifacts&&e(r),nt.on("runDataCreated",i=>e(i)),nt.on("runDataUpdated",i=>e(i)),nt.on("configUpdated",()=>e()),nt.on("layoutSettingsUpdated",()=>e())}function UM(){}async function SR(r,t){const e=await de(),i=await we(),s=await Yt();let n=await Es();const o=new At,a=await Ao(),h=await Ao();let l=(t==null?void 0:t.end)??null;o.addChild(h),o.addChild(a),nt.on("viewportMoved",()=>c()),nt.on("scaleUpdated",m=>{n=m,c()});function c(m){if(m){const{end:g}=m;l=g}if(!ct.isTemporal()){o.visible=!1;return}const p=u();d(p),f(p)}function u(){const{background:m="#fff"}=s.styles.state(r),p=Math.max(n(r.occurred)*i.scale._x+i.worldTransform.tx,0),g=l?n(l)*i.scale._x+i.worldTransform.tx-p:e.screen.width-p;return{x:p,width:Math.max(g,0),background:m}}function d({x:m,width:p,background:g}){const{flowStateBarHeight:y}=s.styles;a.x=m,a.y=e.screen.height-y,a.width=p,a.height=y,a.tint=g}function f({x:m,width:p,background:g}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:y,flowStateAreaAlpha:_}=s.styles;h.x=m,h.y=0,h.width=p,h.height=e.screen.height-y,h.tint=g,h.alpha=_}return{element:o,render:c}}function CR(){const r=new At,t=new Map;let e=null;r.zIndex=2;async function i(n){if(n&&(e=n),!e)return;const o=[];for(let a=0;a<e.length;a++)o.push(s(e[a],a));await Promise.all(o)}async function s(n,o){const a=e&&e.length>=o+1&&e[o+1],h=a?{end:a.occurred}:void 0;if(t.has(n.id))return t.get(n.id).render(h);const l=await SR(n,h);return t.set(n.id,l),r.addChild(l.element),l.render()}return{element:r,render:i}}async function ER(){const r=await de(),t=await Go(),{element:e,render:i}=await CR();r.stage.addChild(e);function s(n){i(n==null?void 0:n.state_events)}t.state_events&&s(t),nt.on("runDataUpdated",n=>s(n)),nt.on("configUpdated",()=>s()),nt.on("layoutSettingsUpdated",()=>s())}function XM(){}async function IR(){const r=await de(),t=await we(),e=await Ue(),i=await Yt(),{inter:s}=await db(),n=new At,o=await Ao();n.addChild(o);const a=s("");n.addChild(a);let h=await Es(),l,c;nt.on("scaleUpdated",p=>h=p),nt.on("viewportMoved",()=>{e.disableGuides||(m(),n.height!==r.screen.height&&d())});function u(p,g){l=p,c=g,d(),f(p)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(p){a.text=c(p),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function m(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class Sb extends Error{constructor(){super("Layout is not temporal")}}function AR(r){return r.toLocaleTimeString()}function Cb(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function RR(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function MR(r){return r.getHours()===0&&r.getMinutes()===0?`${Vh.date(r)}
|
|
1175
|
+
*/var kg,Nr,cn,Xu,ms,Og,Zu,JC=function(){return typeof window<"u"},nr={},gs=180/Math.PI,un=Math.PI/180,dn=Math.atan2,Bg=1e8,Vu=/([A-Z])/g,$C=/(left|right|width|margin|padding|x)/i,QC=/[\s,\(]\S/,Ni={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Hu=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},qC=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},tE=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},eE=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},Wg=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Ug=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},iE=function(t,e,i){return t.style[e]=i},rE=function(t,e,i){return t.style.setProperty(e,i)},sE=function(t,e,i){return t._gsap[e]=i},nE=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},oE=function(t,e,i,s,n){var o=t._gsap;o.scaleX=o.scaleY=i,o.renderTransform(n,o)},aE=function(t,e,i,s,n){var o=t._gsap;o[e]=i,o.renderTransform(n,o)},Xt="transform",Re=Xt+"Origin",hE=function r(t,e){var i=this,s=this.target,n=s.style,o=s._gsap;if(t in nr&&n){if(this.tfm=this.tfm||{},t!=="transform")t=Ni[t]||t,~t.indexOf(",")?t.split(",").forEach(function(a){return i.tfm[a]=or(s,a)}):this.tfm[t]=o.x?o[t]:or(s,t),t===Re&&(this.tfm.zOrigin=o.zOrigin);else return Ni.transform.split(",").forEach(function(a){return r.call(i,a,e)});if(this.props.indexOf(Xt)>=0)return;o.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(Re,e,"")),t=Xt}(n||e)&&this.props.push(t,e,n[t])},Xg=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},lE=function(){var t=this.props,e=this.target,i=e.style,s=e._gsap,n,o;for(n=0;n<t.length;n+=3)t[n+1]?e[t[n]]=t[n+2]:t[n+2]?i[t[n]]=t[n+2]:i.removeProperty(t[n].substr(0,2)==="--"?t[n]:t[n].replace(Vu,"-$1").toLowerCase());if(this.tfm){for(o in this.tfm)s[o]=this.tfm[o];s.svg&&(s.renderTransform(),e.setAttribute("data-svg-origin",this.svgo||"")),n=Zu(),(!n||!n.isStart)&&!i[Xt]&&(Xg(i),s.zOrigin&&i[Re]&&(i[Re]+=" "+s.zOrigin+"px",s.zOrigin=0,s.renderTransform()),s.uncache=1)}},Zg=function(t,e){var i={target:t,props:[],revert:lE,save:hE};return t._gsap||Ae.core.getCache(t),e&&e.split(",").forEach(function(s){return i.save(s)}),i},Vg,Ku=function(t,e){var i=Nr.createElementNS?Nr.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Nr.createElement(t);return i&&i.style?i:Nr.createElement(t)},Di=function r(t,e,i){var s=getComputedStyle(t);return s[e]||s.getPropertyValue(e.replace(Vu,"-$1").toLowerCase())||s.getPropertyValue(e)||!i&&r(t,fn(e)||e,1)||""},Hg="O,Moz,ms,Ms,Webkit".split(","),fn=function(t,e,i){var s=e||ms,n=s.style,o=5;if(t in n&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);o--&&!(Hg[o]+t in n););return o<0?null:(o===3?"ms":o>=0?Hg[o]:"")+t},Yu=function(){JC()&&window.document&&(kg=window,Nr=kg.document,cn=Nr.documentElement,ms=Ku("div")||{style:{}},Ku("div"),Xt=fn(Xt),Re=Xt+"Origin",ms.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Vg=!!fn("perspective"),Zu=Ae.core.reverting,Xu=1)},zu=function r(t){var e=Ku("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,s=this.nextSibling,n=this.style.cssText,o;if(cn.appendChild(e),e.appendChild(this),this.style.display="block",t)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(o=this._gsapBBox());return i&&(s?i.insertBefore(this,s):i.appendChild(this)),cn.removeChild(e),this.style.cssText=n,o},Kg=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},Yg=function(t){var e;try{e=t.getBBox()}catch{e=zu.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===zu||(e=zu.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Kg(t,["x","cx","x1"])||0,y:+Kg(t,["y","cy","y1"])||0,width:0,height:0}:e},zg=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Yg(t))},ys=function(t,e){if(e){var i=t.style,s;e in nr&&e!==Re&&(e=Xt),i.removeProperty?(s=e.substr(0,2),(s==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),i.removeProperty(s==="--"?e:e.replace(Vu,"-$1").toLowerCase())):i.removeAttribute(e)}},Dr=function(t,e,i,s,n,o){var a=new Ie(t._pt,e,i,0,1,o?Ug:Wg);return t._pt=a,a.b=s,a.e=n,t._props.push(i),a},jg={deg:1,rad:1,turn:1},cE={grid:1,flex:1},kr=function r(t,e,i,s){var n=parseFloat(i)||0,o=(i+"").trim().substr((n+"").length)||"px",a=ms.style,h=$C.test(e),l=t.tagName.toLowerCase()==="svg",c=(l?"client":"offset")+(h?"Width":"Height"),u=100,d=s==="px",f=s==="%",m,p,g,y;if(s===o||!n||jg[s]||jg[o])return n;if(o!=="px"&&!d&&(n=r(t,e,i,"px")),y=t.getCTM&&zg(t),(f||o==="%")&&(nr[e]||~e.indexOf("adius")))return m=y?t.getBBox()[h?"width":"height"]:t[c],zt(f?n/m*u:n/100*m);if(a[h?"width":"height"]=u+(d?o:s),p=~e.indexOf("adius")||s==="em"&&t.appendChild&&!l?t:t.parentNode,y&&(p=(t.ownerSVGElement||{}).parentNode),(!p||p===Nr||!p.appendChild)&&(p=Nr.body),g=p._gsap,g&&f&&g.width&&h&&g.time===We.time&&!g.uncache)return zt(n/g.width*u);if(f&&(e==="height"||e==="width")){var _=t.style[e];t.style[e]=u+s,m=t[c],_?t.style[e]=_:ys(t,e)}else(f||o==="%")&&!cE[Di(p,"display")]&&(a.position=Di(t,"position")),p===t&&(a.position="static"),p.appendChild(ms),m=ms[c],p.removeChild(ms),a.position="absolute";return h&&f&&(g=ls(p),g.time=We.time,g.width=p[c]),zt(d?m*n/u:m&&n?u/m*n:0)},or=function(t,e,i,s){var n;return Xu||Yu(),e in Ni&&e!=="transform"&&(e=Ni[e],~e.indexOf(",")&&(e=e.split(",")[0])),nr[e]&&e!=="transform"?(n=go(t,s),n=e!=="transformOrigin"?n[e]:n.svg?n.origin:xh(Di(t,Re))+" "+n.zOrigin+"px"):(n=t.style[e],(!n||n==="auto"||s||~(n+"").indexOf("calc("))&&(n=bh[e]&&bh[e](t,e,i)||Di(t,e)||q0(t,e)||(e==="opacity"?1:0))),i&&!~(n+"").trim().indexOf(" ")?kr(t,e,n,i)+i:n},uE=function(t,e,i,s){if(!i||i==="none"){var n=fn(e,t,1),o=n&&Di(t,n,1);o&&o!==i?(e=n,i=o):e==="borderColor"&&(i=Di(t,"borderTopColor"))}var a=new Ie(this._pt,t.style,e,0,1,Gg),h=0,l=0,c,u,d,f,m,p,g,y,_,b,v,w;if(a.b=i,a.e=s,i+="",s+="",s==="auto"&&(p=t.style[e],t.style[e]=s,s=Di(t,e)||s,p?t.style[e]=p:ys(t,e)),c=[i,s],wg(c),i=c[0],s=c[1],d=i.match(sn)||[],w=s.match(sn)||[],w.length){for(;u=sn.exec(s);)g=u[0],_=s.substring(h,u.index),m?m=(m+1)%5:(_.substr(-5)==="rgba("||_.substr(-5)==="hsla(")&&(m=1),g!==(p=d[l++]||"")&&(f=parseFloat(p)||0,v=p.substr((f+"").length),g.charAt(1)==="="&&(g=nn(f,g)+v),y=parseFloat(g),b=g.substr((y+"").length),h=sn.lastIndex-b.length,b||(b=b||De.units[e]||v,h===s.length&&(s+=b,a.e+=b)),v!==b&&(f=kr(t,e,p,b)||0),a._pt={_next:a._pt,p:_||l===1?_:",",s:f,c:y-f,m:m&&m<4||e==="zIndex"?Math.round:0});a.c=h<s.length?s.substring(h,s.length):""}else a.r=e==="display"&&s==="none"?Ug:Wg;return K0.test(s)&&(a.e=0),this._pt=a,a},Jg={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},dE=function(t){var e=t.split(" "),i=e[0],s=e[1]||"50%";return(i==="top"||i==="bottom"||s==="left"||s==="right")&&(t=i,i=s,s=t),e[0]=Jg[i]||i,e[1]=Jg[s]||s,e.join(" ")},fE=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i=e.t,s=i.style,n=e.u,o=i._gsap,a,h,l;if(n==="all"||n===!0)s.cssText="",h=1;else for(n=n.split(","),l=n.length;--l>-1;)a=n[l],nr[a]&&(h=1,a=a==="transformOrigin"?Re:Xt),ys(i,a);h&&(ys(i,Xt),o&&(o.svg&&i.removeAttribute("transform"),go(i,1),o.uncache=1,Xg(s)))}},bh={clearProps:function(t,e,i,s,n){if(n.data!=="isFromStart"){var o=t._pt=new Ie(t._pt,e,i,0,0,fE);return o.u=s,o.pr=-10,o.tween=n,t._props.push(i),1}}},mo=[1,0,0,1,0,0],$g={},Qg=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},qg=function(t){var e=Di(t,Xt);return Qg(e)?mo:e.substr(7).match(H0).map(zt)},ju=function(t,e){var i=t._gsap||ls(t),s=t.style,n=qg(t),o,a,h,l;return i.svg&&t.getAttribute("transform")?(h=t.transform.baseVal.consolidate().matrix,n=[h.a,h.b,h.c,h.d,h.e,h.f],n.join(",")==="1,0,0,1,0,0"?mo:n):(n===mo&&!t.offsetParent&&t!==cn&&!i.svg&&(h=s.display,s.display="block",o=t.parentNode,(!o||!t.offsetParent)&&(l=1,a=t.nextElementSibling,cn.appendChild(t)),n=qg(t),h?s.display=h:ys(t,"display"),l&&(a?o.insertBefore(t,a):o?o.appendChild(t):cn.removeChild(t))),e&&n.length>6?[n[0],n[1],n[4],n[5],n[12],n[13]]:n)},Ju=function(t,e,i,s,n,o){var a=t._gsap,h=n||ju(t,!0),l=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,d=a.yOffset||0,f=h[0],m=h[1],p=h[2],g=h[3],y=h[4],_=h[5],b=e.split(" "),v=parseFloat(b[0])||0,w=parseFloat(b[1])||0,C,E,A,R;i?h!==mo&&(E=f*g-m*p)&&(A=v*(g/E)+w*(-p/E)+(p*_-g*y)/E,R=v*(-m/E)+w*(f/E)-(f*_-m*y)/E,v=A,w=R):(C=Yg(t),v=C.x+(~b[0].indexOf("%")?v/100*C.width:v),w=C.y+(~(b[1]||b[0]).indexOf("%")?w/100*C.height:w)),s||s!==!1&&a.smooth?(y=v-l,_=w-c,a.xOffset=u+(y*f+_*p)-y,a.yOffset=d+(y*m+_*g)-_):a.xOffset=a.yOffset=0,a.xOrigin=v,a.yOrigin=w,a.smooth=!!s,a.origin=e,a.originIsAbsolute=!!i,t.style[Re]="0px 0px",o&&(Dr(o,a,"xOrigin",l,v),Dr(o,a,"yOrigin",c,w),Dr(o,a,"xOffset",u,a.xOffset),Dr(o,a,"yOffset",d,a.yOffset)),t.setAttribute("data-svg-origin",v+" "+w)},go=function(t,e){var i=t._gsap||new Ig(t);if("x"in i&&!e&&!i.uncache)return i;var s=t.style,n=i.scaleX<0,o="px",a="deg",h=getComputedStyle(t),l=Di(t,Re)||"0",c,u,d,f,m,p,g,y,_,b,v,w,C,E,A,R,G,N,P,I,D,X,H,Z,j,O,k,F,V,$,dt,ot;return c=u=d=p=g=y=_=b=v=0,f=m=1,i.svg=!!(t.getCTM&&zg(t)),h.translate&&((h.translate!=="none"||h.scale!=="none"||h.rotate!=="none")&&(s[Xt]=(h.translate!=="none"?"translate3d("+(h.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(h.rotate!=="none"?"rotate("+h.rotate+") ":"")+(h.scale!=="none"?"scale("+h.scale.split(" ").join(",")+") ":"")+(h[Xt]!=="none"?h[Xt]:"")),s.scale=s.rotate=s.translate="none"),E=ju(t,i.svg),i.svg&&(i.uncache?(j=t.getBBox(),l=i.xOrigin-j.x+"px "+(i.yOrigin-j.y)+"px",Z=""):Z=!e&&t.getAttribute("data-svg-origin"),Ju(t,Z||l,!!Z||i.originIsAbsolute,i.smooth!==!1,E)),w=i.xOrigin||0,C=i.yOrigin||0,E!==mo&&(N=E[0],P=E[1],I=E[2],D=E[3],c=X=E[4],u=H=E[5],E.length===6?(f=Math.sqrt(N*N+P*P),m=Math.sqrt(D*D+I*I),p=N||P?dn(P,N)*gs:0,_=I||D?dn(I,D)*gs+p:0,_&&(m*=Math.abs(Math.cos(_*un))),i.svg&&(c-=w-(w*N+C*I),u-=C-(w*P+C*D))):(ot=E[6],$=E[7],k=E[8],F=E[9],V=E[10],dt=E[11],c=E[12],u=E[13],d=E[14],A=dn(ot,V),g=A*gs,A&&(R=Math.cos(-A),G=Math.sin(-A),Z=X*R+k*G,j=H*R+F*G,O=ot*R+V*G,k=X*-G+k*R,F=H*-G+F*R,V=ot*-G+V*R,dt=$*-G+dt*R,X=Z,H=j,ot=O),A=dn(-I,V),y=A*gs,A&&(R=Math.cos(-A),G=Math.sin(-A),Z=N*R-k*G,j=P*R-F*G,O=I*R-V*G,dt=D*G+dt*R,N=Z,P=j,I=O),A=dn(P,N),p=A*gs,A&&(R=Math.cos(A),G=Math.sin(A),Z=N*R+P*G,j=X*R+H*G,P=P*R-N*G,H=H*R-X*G,N=Z,X=j),g&&Math.abs(g)+Math.abs(p)>359.9&&(g=p=0,y=180-y),f=zt(Math.sqrt(N*N+P*P+I*I)),m=zt(Math.sqrt(H*H+ot*ot)),A=dn(X,H),_=Math.abs(A)>2e-4?A*gs:0,v=dt?1/(dt<0?-dt:dt):0),i.svg&&(Z=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Qg(Di(t,Xt)),Z&&t.setAttribute("transform",Z))),Math.abs(_)>90&&Math.abs(_)<270&&(n?(f*=-1,_+=p<=0?180:-180,p+=p<=0?180:-180):(m*=-1,_+=_<=0?180:-180)),e=e||i.uncache,i.x=c-((i.xPercent=c&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-c)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+o,i.y=u-((i.yPercent=u&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-u)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+o,i.z=d+o,i.scaleX=zt(f),i.scaleY=zt(m),i.rotation=zt(p)+a,i.rotationX=zt(g)+a,i.rotationY=zt(y)+a,i.skewX=_+a,i.skewY=b+a,i.transformPerspective=v+o,(i.zOrigin=parseFloat(l.split(" ")[2])||!e&&i.zOrigin||0)&&(s[Re]=xh(l)),i.xOffset=i.yOffset=0,i.force3D=De.force3D,i.renderTransform=i.svg?mE:Vg?ty:pE,i.uncache=0,i},xh=function(t){return(t=t.split(" "))[0]+" "+t[1]},$u=function(t,e,i){var s=me(e);return zt(parseFloat(e)+parseFloat(kr(t,"x",i+"px",s)))+s},pE=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,ty(t,e)},bs="0deg",yo="0px",xs=") ",ty=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.z,l=i.rotation,c=i.rotationY,u=i.rotationX,d=i.skewX,f=i.skewY,m=i.scaleX,p=i.scaleY,g=i.transformPerspective,y=i.force3D,_=i.target,b=i.zOrigin,v="",w=y==="auto"&&t&&t!==1||y===!0;if(b&&(u!==bs||c!==bs)){var C=parseFloat(c)*un,E=Math.sin(C),A=Math.cos(C),R;C=parseFloat(u)*un,R=Math.cos(C),o=$u(_,o,E*R*-b),a=$u(_,a,-Math.sin(C)*-b),h=$u(_,h,A*R*-b+b)}g!==yo&&(v+="perspective("+g+xs),(s||n)&&(v+="translate("+s+"%, "+n+"%) "),(w||o!==yo||a!==yo||h!==yo)&&(v+=h!==yo||w?"translate3d("+o+", "+a+", "+h+") ":"translate("+o+", "+a+xs),l!==bs&&(v+="rotate("+l+xs),c!==bs&&(v+="rotateY("+c+xs),u!==bs&&(v+="rotateX("+u+xs),(d!==bs||f!==bs)&&(v+="skew("+d+", "+f+xs),(m!==1||p!==1)&&(v+="scale("+m+", "+p+xs),_.style[Xt]=v||"translate(0, 0)"},mE=function(t,e){var i=e||this,s=i.xPercent,n=i.yPercent,o=i.x,a=i.y,h=i.rotation,l=i.skewX,c=i.skewY,u=i.scaleX,d=i.scaleY,f=i.target,m=i.xOrigin,p=i.yOrigin,g=i.xOffset,y=i.yOffset,_=i.forceCSS,b=parseFloat(o),v=parseFloat(a),w,C,E,A,R;h=parseFloat(h),l=parseFloat(l),c=parseFloat(c),c&&(c=parseFloat(c),l+=c,h+=c),h||l?(h*=un,l*=un,w=Math.cos(h)*u,C=Math.sin(h)*u,E=Math.sin(h-l)*-d,A=Math.cos(h-l)*d,l&&(c*=un,R=Math.tan(l-c),R=Math.sqrt(1+R*R),E*=R,A*=R,c&&(R=Math.tan(c),R=Math.sqrt(1+R*R),w*=R,C*=R)),w=zt(w),C=zt(C),E=zt(E),A=zt(A)):(w=u,A=d,C=E=0),(b&&!~(o+"").indexOf("px")||v&&!~(a+"").indexOf("px"))&&(b=kr(f,"x",o,"px"),v=kr(f,"y",a,"px")),(m||p||g||y)&&(b=zt(b+m-(m*w+p*E)+g),v=zt(v+p-(m*C+p*A)+y)),(s||n)&&(R=f.getBBox(),b=zt(b+s/100*R.width),v=zt(v+n/100*R.height)),R="matrix("+w+","+C+","+E+","+A+","+b+","+v+")",f.setAttribute("transform",R),_&&(f.style[Xt]=R)},gE=function(t,e,i,s,n){var o=360,a=ne(n),h=parseFloat(n)*(a&&~n.indexOf("rad")?gs:1),l=h-s,c=s+l+"deg",u,d;return a&&(u=n.split("_")[1],u==="short"&&(l%=o,l!==l%(o/2)&&(l+=l<0?o:-o)),u==="cw"&&l<0?l=(l+o*Bg)%o-~~(l/o)*o:u==="ccw"&&l>0&&(l=(l-o*Bg)%o-~~(l/o)*o)),t._pt=d=new Ie(t._pt,e,i,s,l,qC),d.e=c,d.u="deg",t._props.push(i),d},ey=function(t,e){for(var i in e)t[i]=e[i];return t},yE=function(t,e,i){var s=ey({},i._gsap),n="perspective,force3D,transformOrigin,svgOrigin",o=i.style,a,h,l,c,u,d,f,m;s.svg?(l=i.getAttribute("transform"),i.setAttribute("transform",""),o[Xt]=e,a=go(i,1),ys(i,Xt),i.setAttribute("transform",l)):(l=getComputedStyle(i)[Xt],o[Xt]=e,a=go(i,1),o[Xt]=l);for(h in nr)l=s[h],c=a[h],l!==c&&n.indexOf(h)<0&&(f=me(l),m=me(c),u=f!==m?kr(i,h,l,m):parseFloat(l),d=parseFloat(c),t._pt=new Ie(t._pt,a,h,u,d-u,Hu),t._pt.u=m||0,t._props.push(h));ey(a,s)};Ee("padding,margin,Width,Radius",function(r,t){var e="Top",i="Right",s="Bottom",n="Left",o=(t<3?[e,i,s,n]:[e+n,e+i,s+i,s+n]).map(function(a){return t<2?r+a:"border"+a+r});bh[t>1?"border"+r:r]=function(a,h,l,c,u){var d,f;if(arguments.length<4)return d=o.map(function(m){return or(a,m,l)}),f=d.join(" "),f.split(d[0]).length===5?d[0]:f;d=(c+"").split(" "),f={},o.forEach(function(m,p){return f[m]=d[p]=d[p]||d[(p-1)/2|0]}),a.init(h,f,u)}});var iy={name:"css",register:Yu,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,s,n){var o=this._props,a=t.style,h=i.vars.startAt,l,c,u,d,f,m,p,g,y,_,b,v,w,C,E,A;Xu||Yu(),this.styles=this.styles||Zg(t),A=this.styles.props,this.tween=i;for(p in e)if(p!=="autoRound"&&(c=e[p],!(Oe[p]&&Ag(p,e,i,s,t,n)))){if(f=typeof c,m=bh[p],f==="function"&&(c=c.call(i,s,t,n),f=typeof c),f==="string"&&~c.indexOf("random(")&&(c=ho(c)),m)m(this,t,p,c,i)&&(E=1);else if(p.substr(0,2)==="--")l=(getComputedStyle(t).getPropertyValue(p)+"").trim(),c+="",Gr.lastIndex=0,Gr.test(l)||(g=me(l),y=me(c)),y?g!==y&&(l=kr(t,p,l,y)+y):g&&(c+=g),this.add(a,"setProperty",l,c,s,n,0,0,p),o.push(p),A.push(p,0,a[p]);else if(f!=="undefined"){if(h&&p in h?(l=typeof h[p]=="function"?h[p].call(i,s,t,n):h[p],ne(l)&&~l.indexOf("random(")&&(l=ho(l)),me(l+"")||l==="auto"||(l+=De.units[p]||me(or(t,p))||""),(l+"").charAt(1)==="="&&(l=or(t,p))):l=or(t,p),d=parseFloat(l),_=f==="string"&&c.charAt(1)==="="&&c.substr(0,2),_&&(c=c.substr(2)),u=parseFloat(c),p in Ni&&(p==="autoAlpha"&&(d===1&&or(t,"visibility")==="hidden"&&u&&(d=0),A.push("visibility",0,a.visibility),Dr(this,a,"visibility",d?"inherit":"hidden",u?"inherit":"hidden",!u)),p!=="scale"&&p!=="transform"&&(p=Ni[p],~p.indexOf(",")&&(p=p.split(",")[0]))),b=p in nr,b){if(this.styles.save(p),v||(w=t._gsap,w.renderTransform&&!e.parseTransform||go(t,e.parseTransform),C=e.smoothOrigin!==!1&&w.smooth,v=this._pt=new Ie(this._pt,a,Xt,0,1,w.renderTransform,w,0,-1),v.dep=1),p==="scale")this._pt=new Ie(this._pt,w,"scaleY",w.scaleY,(_?nn(w.scaleY,_+u):u)-w.scaleY||0,Hu),this._pt.u=0,o.push("scaleY",p),p+="X";else if(p==="transformOrigin"){A.push(Re,0,a[Re]),c=dE(c),w.svg?Ju(t,c,0,C,0,this):(y=parseFloat(c.split(" ")[2])||0,y!==w.zOrigin&&Dr(this,w,"zOrigin",w.zOrigin,y),Dr(this,a,p,xh(l),xh(c)));continue}else if(p==="svgOrigin"){Ju(t,c,1,C,0,this);continue}else if(p in $g){gE(this,w,p,d,_?nn(d,_+c):c);continue}else if(p==="smoothOrigin"){Dr(this,w,"smooth",w.smooth,c);continue}else if(p==="force3D"){w[p]=c;continue}else if(p==="transform"){yE(this,c,t);continue}}else p in a||(p=fn(p)||p);if(b||(u||u===0)&&(d||d===0)&&!QC.test(c)&&p in a)g=(l+"").substr((d+"").length),u||(u=0),y=me(c)||(p in De.units?De.units[p]:g),g!==y&&(d=kr(t,p,l,y)),this._pt=new Ie(this._pt,b?w:a,p,d,(_?nn(d,_+u):u)-d,!b&&(y==="px"||p==="zIndex")&&e.autoRound!==!1?eE:Hu),this._pt.u=y||0,g!==y&&y!=="%"&&(this._pt.b=l,this._pt.r=tE);else if(p in a)uE.call(this,t,p,l,_?_+c:c);else if(p in t)this.add(t,p,l||t[p],_?_+c:c,s,n);else if(p!=="parseTransform"){xu(p,c);continue}b||(p in a?A.push(p,0,a[p]):A.push(p,1,l||t[p])),o.push(p)}}E&&Fg(this)},render:function(t,e){if(e.tween._time||!Zu())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:or,aliases:Ni,getSetter:function(t,e,i){var s=Ni[e];return s&&s.indexOf(",")<0&&(e=s),e in nr&&e!==Re&&(t._gsap.x||or(t,"x"))?i&&Og===i?e==="scale"?nE:sE:(Og=i||{})&&(e==="scale"?oE:aE):t.style&&!fu(t.style[e])?iE:~e.indexOf("-")?rE:ku(t,e)},core:{_removeProperty:ys,_getMatrix:ju}};Ae.utils.checkPrefix=fn,Ae.core.getStyleSaver=Zg,function(r,t,e,i){var s=Ee(r+","+t+","+e,function(n){nr[n]=1});Ee(t,function(n){De.units[n]="deg",$g[n]=1}),Ni[s[13]]=r+","+t,Ee(i,function(n){var o=n.split(":");Ni[o[1]]=s[o[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"),Ee("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){De.units[r]="px"}),Ae.registerPlugin(iy);var ry=Ae.registerPlugin(iy)||Ae;ry.core.Tween;const _s=new pt;class bE{constructor(t={}){this._recursive=typeof t.recursive=="boolean"?t.recursive:!0,this._toggle=t.toggle||"visible",this._targetList=new Set}add(t){return this._targetList.add(t),this}addAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.add(t[e]);return this}remove(t){return this._targetList.delete(t),this}removeAll(t){for(let e=0,i=t.length;e<i;e++)this._targetList.delete(t[e]);return this}clear(){return this._targetList.clear(),this}cull(t,e=!1){return e||this.uncull(),this._targetList.forEach(i=>{e||i.getBounds(!1,_s),this._recursive?this.cullRecursive(t,i,e):(e&&i._bounds.getRectangle(t),i[this._toggle]=_s.right>t.left&&_s.left<t.right&&_s.bottom>t.top&&_s.top<t.bottom)}),this}uncull(){return this._targetList.forEach(t=>{this._recursive?this.uncullRecursive(t):t[this._toggle]=!1}),this}cullRecursive(t,e,i){const s=i?e._bounds.getRectangle(_s):e.getBounds(!0,_s);if(e[this._toggle]=s.right>t.left&&s.left<t.right&&s.bottom>t.top&&s.top<t.bottom,!(s.left>=t.left&&s.top>=t.top&&s.right<=t.right&&s.bottom<=t.bottom)&&e[this._toggle]&&e.children&&e.children.length){const o=e.children;for(let a=0,h=o.length;a<h;a++)this.cullRecursive(t,o[a])}}uncullRecursive(t){if(t[this._toggle]=!0,t.children&&t.children.length){const e=t.children;for(let i=0,s=e.length;i<s;i++)this.uncullRecursive(e[i])}}}var _h={exports:{}};_h.exports,function(r,t){var e=200,i="__lodash_hash_undefined__",s=1,n=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",l="[object AsyncFunction]",c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Function]",m="[object GeneratorFunction]",p="[object Map]",g="[object Number]",y="[object Null]",_="[object Object]",b="[object Promise]",v="[object Proxy]",w="[object RegExp]",C="[object Set]",E="[object String]",A="[object Symbol]",R="[object Undefined]",G="[object WeakMap]",N="[object ArrayBuffer]",P="[object DataView]",I="[object Float32Array]",D="[object Float64Array]",X="[object Int8Array]",H="[object Int16Array]",Z="[object Int32Array]",j="[object Uint8Array]",O="[object Uint8ClampedArray]",k="[object Uint16Array]",F="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,$=/^\[object .+?Constructor\]$/,dt=/^(?:0|[1-9]\d*)$/,ot={};ot[I]=ot[D]=ot[X]=ot[H]=ot[Z]=ot[j]=ot[O]=ot[k]=ot[F]=!0,ot[a]=ot[h]=ot[N]=ot[c]=ot[P]=ot[u]=ot[d]=ot[f]=ot[p]=ot[g]=ot[_]=ot[w]=ot[C]=ot[E]=ot[G]=!1;var Et=typeof xe=="object"&&xe&&xe.Object===Object&&xe,Mt=typeof self=="object"&&self&&self.Object===Object&&self,_t=Et||Mt||Function("return this")(),Y=t&&!t.nodeType&&t,tt=Y&&!0&&r&&!r.nodeType&&r,et=tt&&tt.exports===Y,B=et&&Et.process,xt=function(){try{return B&&B.binding&&B.binding("util")}catch{}}(),yt=xt&&xt.isTypedArray;function Lt(T,M){for(var x=-1,S=T==null?0:T.length,L=0,U=[];++x<S;){var lt=T[x];M(lt,x,T)&&(U[L++]=lt)}return U}function Zt(T,M){for(var x=-1,S=M.length,L=T.length;++x<S;)T[L+x]=M[x];return T}function Xe(T,M){for(var x=-1,S=T==null?0:T.length;++x<S;)if(M(T[x],x,T))return!0;return!1}function pi(T,M){for(var x=-1,S=Array(T);++x<T;)S[x]=M(x);return S}function Fd(T){return function(M){return T(M)}}function Tn(T,M){return T.has(M)}function No(T,M){return T==null?void 0:T[M]}function wn(T){var M=-1,x=Array(T.size);return T.forEach(function(S,L){x[++M]=[L,S]}),x}function mi(T,M){return function(x){return T(M(x))}}function Kh(T){var M=-1,x=Array(T.size);return T.forEach(function(S){x[++M]=S}),x}var Yh=Array.prototype,Nd=Function.prototype,Sn=Object.prototype,Wr=_t["__core-js_shared__"],Do=Nd.toString,Ze=Sn.hasOwnProperty,ko=function(){var T=/[^.]+$/.exec(Wr&&Wr.keys&&Wr.keys.IE_PROTO||"");return T?"Symbol(src)_1."+T:""}(),Oo=Sn.toString,zh=RegExp("^"+Do.call(Ze).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jh=et?_t.Buffer:void 0,Cn=_t.Symbol,Wi=_t.Uint8Array,As=Sn.propertyIsEnumerable,Dd=Yh.splice,Ui=Cn?Cn.toStringTag:void 0,Jh=Object.getOwnPropertySymbols,$h=jh?jh.isBuffer:void 0,Rs=mi(Object.keys,Object),Bo=pr(_t,"DataView"),Ve=pr(_t,"Map"),Wo=pr(_t,"Promise"),Uo=pr(_t,"Set"),Xo=pr(_t,"WeakMap"),Ms=pr(Object,"create"),kd=yi(Bo),gi=yi(Ve),Od=yi(Wo),Bd=yi(Uo),Wd=yi(Xo),Qh=Cn?Cn.prototype:void 0,Zo=Qh?Qh.valueOf:void 0;function Pe(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Ud(){this.__data__=Ms?Ms(null):{},this.size=0}function Xd(T){var M=this.has(T)&&delete this.__data__[T];return this.size-=M?1:0,M}function Zd(T){var M=this.__data__;if(Ms){var x=M[T];return x===i?void 0:x}return Ze.call(M,T)?M[T]:void 0}function Vd(T){var M=this.__data__;return Ms?M[T]!==void 0:Ze.call(M,T)}function Hd(T,M){var x=this.__data__;return this.size+=this.has(T)?0:1,x[T]=Ms&&M===void 0?i:M,this}Pe.prototype.clear=Ud,Pe.prototype.delete=Xd,Pe.prototype.get=Zd,Pe.prototype.has=Vd,Pe.prototype.set=Hd;function ye(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Kd(){this.__data__=[],this.size=0}function Yd(T){var M=this.__data__,x=In(M,T);if(x<0)return!1;var S=M.length-1;return x==S?M.pop():Dd.call(M,x,1),--this.size,!0}function zd(T){var M=this.__data__,x=In(M,T);return x<0?void 0:M[x][1]}function jd(T){return In(this.__data__,T)>-1}function Jd(T,M){var x=this.__data__,S=In(x,T);return S<0?(++this.size,x.push([T,M])):x[S][1]=M,this}ye.prototype.clear=Kd,ye.prototype.delete=Yd,ye.prototype.get=zd,ye.prototype.has=jd,ye.prototype.set=Jd;function dr(T){var M=-1,x=T==null?0:T.length;for(this.clear();++M<x;){var S=T[M];this.set(S[0],S[1])}}function Vo(){this.size=0,this.__data__={hash:new Pe,map:new(Ve||ye),string:new Pe}}function $d(T){var M=Rn(this,T).delete(T);return this.size-=M?1:0,M}function En(T){return Rn(this,T).get(T)}function Ho(T){return Rn(this,T).has(T)}function Qd(T,M){var x=Rn(this,T),S=x.size;return x.set(T,M),this.size+=x.size==S?0:1,this}dr.prototype.clear=Vo,dr.prototype.delete=$d,dr.prototype.get=En,dr.prototype.has=Ho,dr.prototype.set=Qd;function fr(T){var M=-1,x=T==null?0:T.length;for(this.__data__=new dr;++M<x;)this.add(T[M])}function qh(T){return this.__data__.set(T,i),this}function qd(T){return this.__data__.has(T)}fr.prototype.add=fr.prototype.push=qh,fr.prototype.has=qd;function Xi(T){var M=this.__data__=new ye(T);this.size=M.size}function tf(){this.__data__=new ye,this.size=0}function tl(T){var M=this.__data__,x=M.delete(T);return this.size=M.size,x}function ef(T){return this.__data__.get(T)}function rf(T){return this.__data__.has(T)}function sf(T,M){var x=this.__data__;if(x instanceof ye){var S=x.__data__;if(!Ve||S.length<e-1)return S.push([T,M]),this.size=++x.size,this;x=this.__data__=new dr(S)}return x.set(T,M),this.size=x.size,this}Xi.prototype.clear=tf,Xi.prototype.delete=tl,Xi.prototype.get=ef,Xi.prototype.has=rf,Xi.prototype.set=sf;function nf(T,M){var x=Pn(T),S=!x&&zo(T),L=!x&&!S&&Ps(T),U=!x&&!S&&!L&&ll(T),lt=x||S||L||U,mt=lt?pi(T.length,String):[],bt=mt.length;for(var at in T)(M||Ze.call(T,at))&&!(lt&&(at=="length"||L&&(at=="offset"||at=="parent")||U&&(at=="buffer"||at=="byteLength"||at=="byteOffset")||Yo(at,bt)))&&mt.push(at);return mt}function In(T,M){for(var x=T.length;x--;)if(Ln(T[x][0],M))return x;return-1}function of(T,M,x){var S=M(T);return Pn(T)?S:Zt(S,x(T))}function Ls(T){return T==null?T===void 0?R:y:Ui&&Ui in Object(T)?cf(T):Mn(T)}function el(T){return Xr(T)&&Ls(T)==a}function il(T,M,x,S,L){return T===M?!0:T==null||M==null||!Xr(T)&&!Xr(M)?T!==T&&M!==M:af(T,M,x,S,il,L)}function af(T,M,x,S,L,U){var lt=Pn(T),mt=Pn(M),bt=lt?h:Zi(T),at=mt?h:Zi(M);bt=bt==a?_:bt,at=at==a?_:at;var vt=bt==_,kt=at==_,Rt=bt==at;if(Rt&&Ps(T)){if(!Ps(M))return!1;lt=!0,vt=!1}if(Rt&&!vt)return U||(U=new Xi),lt||ll(T)?rl(T,M,x,S,L,U):sl(T,M,bt,x,S,L,U);if(!(x&s)){var he=vt&&Ze.call(T,"__wrapped__"),be=kt&&Ze.call(M,"__wrapped__");if(he||be){var ii=he?T.value():T,ri=be?M.value():M;return U||(U=new Xi),L(ii,ri,x,S,U)}}return Rt?(U||(U=new Xi),lf(T,M,x,S,L,U)):!1}function An(T){if(!hl(T)||ff(T))return!1;var M=Vi(T)?zh:$;return M.test(yi(T))}function Ko(T){return Xr(T)&&Ur(T.length)&&!!ot[Ls(T)]}function hf(T){if(!pf(T))return Rs(T);var M=[];for(var x in Object(T))Ze.call(T,x)&&x!="constructor"&&M.push(x);return M}function rl(T,M,x,S,L,U){var lt=x&s,mt=T.length,bt=M.length;if(mt!=bt&&!(lt&&bt>mt))return!1;var at=U.get(T);if(at&&U.get(M))return at==M;var vt=-1,kt=!0,Rt=x&n?new fr:void 0;for(U.set(T,M),U.set(M,T);++vt<mt;){var he=T[vt],be=M[vt];if(S)var ii=lt?S(be,he,vt,M,T,U):S(he,be,vt,T,M,U);if(ii!==void 0){if(ii)continue;kt=!1;break}if(Rt){if(!Xe(M,function(ri,Gs){if(!Tn(Rt,Gs)&&(he===ri||L(he,ri,x,S,U)))return Rt.push(Gs)})){kt=!1;break}}else if(!(he===be||L(he,be,x,S,U))){kt=!1;break}}return U.delete(T),U.delete(M),kt}function sl(T,M,x,S,L,U,lt){switch(x){case P:if(T.byteLength!=M.byteLength||T.byteOffset!=M.byteOffset)return!1;T=T.buffer,M=M.buffer;case N:return!(T.byteLength!=M.byteLength||!U(new Wi(T),new Wi(M)));case c:case u:case g:return Ln(+T,+M);case d:return T.name==M.name&&T.message==M.message;case w:case E:return T==M+"";case p:var mt=wn;case C:var bt=S&s;if(mt||(mt=Kh),T.size!=M.size&&!bt)return!1;var at=lt.get(T);if(at)return at==M;S|=n,lt.set(T,M);var vt=rl(mt(T),mt(M),S,L,U,lt);return lt.delete(T),vt;case A:if(Zo)return Zo.call(T)==Zo.call(M)}return!1}function lf(T,M,x,S,L,U){var lt=x&s,mt=nl(T),bt=mt.length,at=nl(M),vt=at.length;if(bt!=vt&&!lt)return!1;for(var kt=bt;kt--;){var Rt=mt[kt];if(!(lt?Rt in M:Ze.call(M,Rt)))return!1}var he=U.get(T);if(he&&U.get(M))return he==M;var be=!0;U.set(T,M),U.set(M,T);for(var ii=lt;++kt<bt;){Rt=mt[kt];var ri=T[Rt],Gs=M[Rt];if(S)var Pb=lt?S(Gs,ri,Rt,M,T,U):S(ri,Gs,Rt,T,M,U);if(!(Pb===void 0?ri===Gs||L(ri,Gs,x,S,U):Pb)){be=!1;break}ii||(ii=Rt=="constructor")}if(be&&!ii){var ul=T.constructor,dl=M.constructor;ul!=dl&&"constructor"in T&&"constructor"in M&&!(typeof ul=="function"&&ul instanceof ul&&typeof dl=="function"&&dl instanceof dl)&&(be=!1)}return U.delete(T),U.delete(M),be}function nl(T){return of(T,cl,uf)}function Rn(T,M){var x=T.__data__;return df(M)?x[typeof M=="string"?"string":"hash"]:x.map}function pr(T,M){var x=No(T,M);return An(x)?x:void 0}function cf(T){var M=Ze.call(T,Ui),x=T[Ui];try{T[Ui]=void 0;var S=!0}catch{}var L=Oo.call(T);return S&&(M?T[Ui]=x:delete T[Ui]),L}var uf=Jh?function(T){return T==null?[]:(T=Object(T),Lt(Jh(T),function(M){return As.call(T,M)}))}:mf,Zi=Ls;(Bo&&Zi(new Bo(new ArrayBuffer(1)))!=P||Ve&&Zi(new Ve)!=p||Wo&&Zi(Wo.resolve())!=b||Uo&&Zi(new Uo)!=C||Xo&&Zi(new Xo)!=G)&&(Zi=function(T){var M=Ls(T),x=M==_?T.constructor:void 0,S=x?yi(x):"";if(S)switch(S){case kd:return P;case gi:return p;case Od:return b;case Bd:return C;case Wd:return G}return M});function Yo(T,M){return M=M??o,!!M&&(typeof T=="number"||dt.test(T))&&T>-1&&T%1==0&&T<M}function df(T){var M=typeof T;return M=="string"||M=="number"||M=="symbol"||M=="boolean"?T!=="__proto__":T===null}function ff(T){return!!ko&&ko in T}function pf(T){var M=T&&T.constructor,x=typeof M=="function"&&M.prototype||Sn;return T===x}function Mn(T){return Oo.call(T)}function yi(T){if(T!=null){try{return Do.call(T)}catch{}try{return T+""}catch{}}return""}function Ln(T,M){return T===M||T!==T&&M!==M}var zo=el(function(){return arguments}())?el:function(T){return Xr(T)&&Ze.call(T,"callee")&&!As.call(T,"callee")},Pn=Array.isArray;function ol(T){return T!=null&&Ur(T.length)&&!Vi(T)}var Ps=$h||gf;function al(T,M){return il(T,M)}function Vi(T){if(!hl(T))return!1;var M=Ls(T);return M==f||M==m||M==l||M==v}function Ur(T){return typeof T=="number"&&T>-1&&T%1==0&&T<=o}function hl(T){var M=typeof T;return T!=null&&(M=="object"||M=="function")}function Xr(T){return T!=null&&typeof T=="object"}var ll=yt?Fd(yt):Ko;function cl(T){return ol(T)?nf(T):hf(T)}function mf(){return[]}function gf(){return!1}r.exports=al}(_h,_h.exports);var xE=_h.exports;const sy=Ds(xE);var _E=Object.defineProperty,vE=(r,t,e)=>t in r?_E(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W=(r,t,e)=>(vE(r,typeof t!="symbol"?t+"":t,e),e);class qe{constructor(t){W(this,"parent"),W(this,"paused"),this.parent=t,this.paused=!1}destroy(){}down(t){return!1}move(t){return!1}up(t){return!1}wheel(t){return!1}update(t){}resize(){}reset(){}pause(){this.paused=!0}resume(){this.paused=!1}}var TE=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ny={exports:{}};(function(r,t){(function(){var e,i;i=function(s){return r.exports=s},e={linear:function(s,n,o,a){return o*s/a+n},easeInQuad:function(s,n,o,a){return o*(s/=a)*s+n},easeOutQuad:function(s,n,o,a){return-o*(s/=a)*(s-2)+n},easeInOutQuad:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s+n:-o/2*(--s*(s-2)-1)+n},easeInCubic:function(s,n,o,a){return o*(s/=a)*s*s+n},easeOutCubic:function(s,n,o,a){return o*((s=s/a-1)*s*s+1)+n},easeInOutCubic:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s+n:o/2*((s-=2)*s*s+2)+n},easeInQuart:function(s,n,o,a){return o*(s/=a)*s*s*s+n},easeOutQuart:function(s,n,o,a){return-o*((s=s/a-1)*s*s*s-1)+n},easeInOutQuart:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s+n:-o/2*((s-=2)*s*s*s-2)+n},easeInQuint:function(s,n,o,a){return o*(s/=a)*s*s*s*s+n},easeOutQuint:function(s,n,o,a){return o*((s=s/a-1)*s*s*s*s+1)+n},easeInOutQuint:function(s,n,o,a){return(s/=a/2)<1?o/2*s*s*s*s*s+n:o/2*((s-=2)*s*s*s*s+2)+n},easeInSine:function(s,n,o,a){return-o*Math.cos(s/a*(Math.PI/2))+o+n},easeOutSine:function(s,n,o,a){return o*Math.sin(s/a*(Math.PI/2))+n},easeInOutSine:function(s,n,o,a){return-o/2*(Math.cos(Math.PI*s/a)-1)+n},easeInExpo:function(s,n,o,a){return s===0?n:o*Math.pow(2,10*(s/a-1))+n},easeOutExpo:function(s,n,o,a){return s===a?n+o:o*(-Math.pow(2,-10*s/a)+1)+n},easeInOutExpo:function(s,n,o,a){return(s/=a/2)<1?o/2*Math.pow(2,10*(s-1))+n:o/2*(-Math.pow(2,-10*--s)+2)+n},easeInCirc:function(s,n,o,a){return-o*(Math.sqrt(1-(s/=a)*s)-1)+n},easeOutCirc:function(s,n,o,a){return o*Math.sqrt(1-(s=s/a-1)*s)+n},easeInOutCirc:function(s,n,o,a){return(s/=a/2)<1?-o/2*(Math.sqrt(1-s*s)-1)+n:o/2*(Math.sqrt(1-(s-=2)*s)+1)+n},easeInElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),-(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n},easeOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a),l||(l=a*.3),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),h*Math.pow(2,-10*s)*Math.sin((s*a-c)*(2*Math.PI)/l)+o+n},easeInOutElastic:function(s,n,o,a){var h,l,c;return c=1.70158,l=0,h=o,s===0||(s/=a/2),l||(l=a*(.3*1.5)),h<Math.abs(o)?(h=o,c=l/4):c=l/(2*Math.PI)*Math.asin(o/h),s<1?-.5*(h*Math.pow(2,10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l))+n:h*Math.pow(2,-10*(s-=1))*Math.sin((s*a-c)*(2*Math.PI)/l)*.5+o+n},easeInBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*(s/=a)*s*((h+1)*s-h)+n},easeOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),o*((s=s/a-1)*s*((h+1)*s+h)+1)+n},easeInOutBack:function(s,n,o,a,h){return h===void 0&&(h=1.70158),(s/=a/2)<1?o/2*(s*s*(((h*=1.525)+1)*s-h))+n:o/2*((s-=2)*s*(((h*=1.525)+1)*s+h)+2)+n},easeInBounce:function(s,n,o,a){var h;return h=e.easeOutBounce(a-s,0,o,a),o-h+n},easeOutBounce:function(s,n,o,a){return(s/=a)<1/2.75?o*(7.5625*s*s)+n:s<2/2.75?o*(7.5625*(s-=1.5/2.75)*s+.75)+n:s<2.5/2.75?o*(7.5625*(s-=2.25/2.75)*s+.9375)+n:o*(7.5625*(s-=2.625/2.75)*s+.984375)+n},easeInOutBounce:function(s,n,o,a){var h;return s<a/2?(h=e.easeInBounce(s*2,0,o,a),h*.5+n):(h=e.easeOutBounce(s*2-a,0,o,a),h*.5+o*.5+n)}},i(e)}).call(TE)})(ny);const oy=ny.exports;function vh(r,t){if(r){if(typeof r=="function")return r;if(typeof r=="string")return oy[r]}else return oy[t]}const wE={removeOnInterrupt:!1,ease:"linear",time:1e3};class SE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"startX"),W(this,"startY"),W(this,"deltaX"),W(this,"deltaY"),W(this,"keepCenter"),W(this,"startWidth",null),W(this,"startHeight",null),W(this,"deltaWidth",null),W(this,"deltaHeight",null),W(this,"width",null),W(this,"height",null),W(this,"time",0),this.options=Object.assign({},wE,e),this.options.ease=vh(this.options.ease),this.setupPosition(),this.setupZoom(),this.time=0}setupPosition(){typeof this.options.position<"u"?(this.startX=this.parent.center.x,this.startY=this.parent.center.y,this.deltaX=this.options.position.x-this.parent.center.x,this.deltaY=this.options.position.y-this.parent.center.y,this.keepCenter=!1):this.keepCenter=!0}setupZoom(){this.width=null,this.height=null,typeof this.options.scale<"u"?this.width=this.parent.screenWidth/this.options.scale:typeof this.options.scaleX<"u"||typeof this.options.scaleY<"u"?(typeof this.options.scaleX<"u"&&(this.width=this.parent.screenWidth/this.options.scaleX),typeof this.options.scaleY<"u"&&(this.height=this.parent.screenHeight/this.options.scaleY)):(typeof this.options.width<"u"&&(this.width=this.options.width),typeof this.options.height<"u"&&(this.height=this.options.height)),this.width!==null&&(this.startWidth=this.parent.screenWidthInWorldPixels,this.deltaWidth=this.width-this.startWidth),this.height!==null&&(this.startHeight=this.parent.screenHeightInWorldPixels,this.deltaHeight=this.height-this.startHeight)}down(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("animate"),!1}complete(){this.parent.plugins.remove("animate"),this.width!==null&&this.parent.fitWidth(this.width,this.keepCenter,this.height===null),this.height!==null&&this.parent.fitHeight(this.height,this.keepCenter,this.width===null),!this.keepCenter&&this.options.position&&this.parent.moveCenter(this.options.position),this.parent.emit("animate-end",this.parent),this.options.callbackOnComplete&&this.options.callbackOnComplete(this.parent)}update(t){if(this.paused)return;this.time+=t;const e=new ut(this.parent.scale.x,this.parent.scale.y);if(this.time>=this.options.time){const i=this.parent.width,s=this.parent.height;this.complete(),(i!==this.parent.width||s!==this.parent.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}else{const i=this.options.ease(this.time,0,1,this.options.time);if(this.width!==null){const s=this.startWidth,n=this.deltaWidth;this.parent.fitWidth(s+n*i,this.keepCenter,this.height===null)}if(this.height!==null){const s=this.startHeight,n=this.deltaHeight;this.parent.fitHeight(s+n*i,this.keepCenter,this.width===null)}if(this.width===null?this.parent.scale.x=this.parent.scale.y:this.height===null&&(this.parent.scale.y=this.parent.scale.x),!this.keepCenter){const s=this.startX,n=this.startY,o=this.deltaX,a=this.deltaY,h=new ut(this.parent.x,this.parent.y);this.parent.moveCenter(s+o*i,n+a*i),this.parent.emit("moved",{viewport:this.parent,original:h,type:"animate"})}(this.width||this.height)&&this.parent.emit("zoomed",{viewport:this.parent,original:e,type:"animate"})}}}const CE={sides:"all",friction:.5,time:150,ease:"easeInOutSine",underflow:"center",bounceBox:null};class EE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"underflowX"),W(this,"underflowY"),W(this,"ease"),W(this,"toX"),W(this,"toY"),this.options=Object.assign({},CE,e),this.ease=vh(this.options.ease,"easeInOutSine"),this.options.sides?this.options.sides==="all"?this.top=this.bottom=this.left=this.right=!0:this.options.sides==="horizontal"?(this.right=this.left=!0,this.top=this.bottom=!1):this.options.sides==="vertical"?(this.left=this.right=!1,this.top=this.bottom=!0):(this.top=this.options.sides.indexOf("top")!==-1,this.bottom=this.options.sides.indexOf("bottom")!==-1,this.left=this.options.sides.indexOf("left")!==-1,this.right=this.options.sides.indexOf("right")!==-1):this.left=this.top=this.right=this.bottom=!1;const i=this.options.underflow.toLowerCase();i==="center"?(this.underflowX=0,this.underflowY=0):(this.underflowX=i.indexOf("left")!==-1?-1:i.indexOf("right")!==-1?1:0,this.underflowY=i.indexOf("top")!==-1?-1:i.indexOf("bottom")!==-1?1:0),this.reset()}isActive(){return this.toX!==null||this.toY!==null}down(){return this.toX=this.toY=null,!1}up(){return this.bounce(),!1}update(t){if(!this.paused){if(this.bounce(),this.toX){const e=this.toX;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-x"}),e.time>=this.options.time?(this.parent.x=e.end,this.toX=null,this.parent.emit("bounce-x-end",this.parent)):this.parent.x=this.ease(e.time,e.start,e.delta,this.options.time)}if(this.toY){const e=this.toY;e.time+=t,this.parent.emit("moved",{viewport:this.parent,type:"bounce-y"}),e.time>=this.options.time?(this.parent.y=e.end,this.toY=null,this.parent.emit("bounce-y-end",this.parent)):this.parent.y=this.ease(e.time,e.start,e.delta,this.options.time)}}}calcUnderflowX(){let t;switch(this.underflowX){case-1:t=0;break;case 1:t=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:t=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}return t}calcUnderflowY(){let t;switch(this.underflowY){case-1:t=0;break;case 1:t=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:t=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}return t}oob(){const t=this.options.bounceBox;if(t){const e=typeof t.x>"u"?0:t.x,i=typeof t.y>"u"?0:t.y,s=typeof t.width>"u"?this.parent.worldWidth:t.width,n=typeof t.height>"u"?this.parent.worldHeight:t.height;return{left:this.parent.left<e,right:this.parent.right>s,top:this.parent.top<i,bottom:this.parent.bottom>n,topLeft:new ut(e*this.parent.scale.x,i*this.parent.scale.y),bottomRight:new ut(s*this.parent.scale.x-this.parent.screenWidth,n*this.parent.scale.y-this.parent.screenHeight)}}return{left:this.parent.left<0,right:this.parent.right>this.parent.worldWidth,top:this.parent.top<0,bottom:this.parent.bottom>this.parent.worldHeight,topLeft:new ut(0,0),bottomRight:new ut(this.parent.worldWidth*this.parent.scale.x-this.parent.screenWidth,this.parent.worldHeight*this.parent.scale.y-this.parent.screenHeight)}}bounce(){var t,e;if(this.paused)return;let i,s=this.parent.plugins.get("decelerate",!0);s&&(s.x||s.y)&&(s.x&&s.percentChangeX===((t=s.options)==null?void 0:t.friction)||s.y&&s.percentChangeY===((e=s.options)==null?void 0:e.friction))&&(i=this.oob(),(i.left&&this.left||i.right&&this.right)&&(s.percentChangeX=this.options.friction),(i.top&&this.top||i.bottom&&this.bottom)&&(s.percentChangeY=this.options.friction));const n=this.parent.plugins.get("drag",!0)||{},o=this.parent.plugins.get("pinch",!0)||{};if(s=s||{},!(n!=null&&n.active)&&!(o!=null&&o.active)&&(!this.toX||!this.toY)&&(!s.x||!s.y)){i=i||this.oob();const a=i.topLeft,h=i.bottomRight;if(!this.toX&&!s.x){let l=null;i.left&&this.left?l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-a.x:i.right&&this.right&&(l=this.parent.screenWorldWidth<this.parent.screenWidth?this.calcUnderflowX():-h.x),l!==null&&this.parent.x!==l&&(this.toX={time:0,start:this.parent.x,delta:l-this.parent.x,end:l},this.parent.emit("bounce-x-start",this.parent))}if(!this.toY&&!s.y){let l=null;i.top&&this.top?l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-a.y:i.bottom&&this.bottom&&(l=this.parent.screenWorldHeight<this.parent.screenHeight?this.calcUnderflowY():-h.y),l!==null&&this.parent.y!==l&&(this.toY={time:0,start:this.parent.y,delta:l-this.parent.y,end:l},this.parent.emit("bounce-y-start",this.parent))}}}reset(){this.toX=this.toY=null,this.bounce()}}const IE={left:!1,right:!1,top:!1,bottom:!1,direction:null,underflow:"center"};class AE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"last"),W(this,"noUnderflow"),W(this,"underflowX"),W(this,"underflowY"),this.options=Object.assign({},IE,e),this.options.direction&&(this.options.left=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.right=this.options.direction==="x"||this.options.direction==="all"?!0:null,this.options.top=this.options.direction==="y"||this.options.direction==="all"?!0:null,this.options.bottom=this.options.direction==="y"||this.options.direction==="all"?!0:null),this.parseUnderflow(),this.last={x:null,y:null,scaleX:null,scaleY:null},this.update()}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="none"?this.noUnderflow=!0:t==="center"?(this.underflowX=this.underflowY=0,this.noUnderflow=!1):(this.underflowX=t.indexOf("left")!==-1?-1:t.indexOf("right")!==-1?1:0,this.underflowY=t.indexOf("top")!==-1?-1:t.indexOf("bottom")!==-1?1:0,this.noUnderflow=!1)}move(){return this.update(),!1}update(){if(this.paused||this.parent.x===this.last.x&&this.parent.y===this.last.y&&this.parent.scale.x===this.last.scaleX&&this.parent.scale.y===this.last.scaleY)return;const t=new ut(this.parent.x,this.parent.y),e=this.parent.plugins.decelerate||{};if(this.options.left!==null||this.options.right!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x!==0&&(this.parent.x=0,i=!0);break;case 1:this.parent.x!==this.parent.screenWidth-this.parent.screenWorldWidth&&(this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth,i=!0);break;default:this.parent.x!==(this.parent.screenWidth-this.parent.screenWorldWidth)/2&&(this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2,i=!0)}else this.options.left!==null&&this.parent.left<(this.options.left===!0?0:this.options.left)&&(this.parent.x=-(this.options.left===!0?0:this.options.left)*this.parent.scale.x,e.x=0,i=!0),this.options.right!==null&&this.parent.right>(this.options.right===!0?this.parent.worldWidth:this.options.right)&&(this.parent.x=-(this.options.right===!0?this.parent.worldWidth:this.options.right)*this.parent.scale.x+this.parent.screenWidth,e.x=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-x"})}if(this.options.top!==null||this.options.bottom!==null){let i=!1;if(!this.noUnderflow&&this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y!==0&&(this.parent.y=0,i=!0);break;case 1:this.parent.y!==this.parent.screenHeight-this.parent.screenWorldHeight&&(this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight,i=!0);break;default:this.parent.y!==(this.parent.screenHeight-this.parent.screenWorldHeight)/2&&(this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2,i=!0)}else this.options.top!==null&&this.parent.top<(this.options.top===!0?0:this.options.top)&&(this.parent.y=-(this.options.top===!0?0:this.options.top)*this.parent.scale.y,e.y=0,i=!0),this.options.bottom!==null&&this.parent.bottom>(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)&&(this.parent.y=-(this.options.bottom===!0?this.parent.worldHeight:this.options.bottom)*this.parent.scale.y+this.parent.screenHeight,e.y=0,i=!0);i&&this.parent.emit("moved",{viewport:this.parent,original:t,type:"clamp-y"})}this.last.x=this.parent.x,this.last.y=this.parent.y,this.last.scaleX=this.parent.scale.x,this.last.scaleY=this.parent.scale.y}reset(){this.update()}}const RE={minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,minScale:null,maxScale:null};class ME extends qe{constructor(t,e={}){super(t),W(this,"options"),this.options=Object.assign({},RE,e),this.clamp()}resize(){this.clamp()}clamp(){if(!this.paused){if(this.options.minWidth||this.options.minHeight||this.options.maxWidth||this.options.maxHeight){let t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight;if(this.options.minWidth!==null&&t<this.options.minWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.minWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxWidth!==null&&t>this.options.maxWidth){const i=this.parent.scale.x;this.parent.fitWidth(this.options.maxWidth,!1,!1,!0),this.parent.scale.y*=this.parent.scale.x/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.minHeight!==null&&e<this.options.minHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.minHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}if(this.options.maxHeight!==null&&e>this.options.maxHeight){const i=this.parent.scale.y;this.parent.fitHeight(this.options.maxHeight,!1,!1,!0),this.parent.scale.x*=this.parent.scale.y/i,this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"})}}else if(this.options.minScale||this.options.maxScale){const t={x:null,y:null},e={x:null,y:null};if(typeof this.options.minScale=="number")t.x=this.options.minScale,t.y=this.options.minScale;else if(this.options.minScale!==null){const n=this.options.minScale;t.x=typeof n.x>"u"?null:n.x,t.y=typeof n.y>"u"?null:n.y}if(typeof this.options.maxScale=="number")e.x=this.options.maxScale,e.y=this.options.maxScale;else if(this.options.maxScale!==null){const n=this.options.maxScale;e.x=typeof n.x>"u"?null:n.x,e.y=typeof n.y>"u"?null:n.y}let i=this.parent.scale.x,s=this.parent.scale.y;t.x!==null&&i<t.x&&(i=t.x),e.x!==null&&i>e.x&&(i=e.x),t.y!==null&&s<t.y&&(s=t.y),e.y!==null&&s>e.y&&(s=e.y),(i!==this.parent.scale.x||s!==this.parent.scale.y)&&(this.parent.scale.set(i,s),this.parent.emit("zoomed",{viewport:this.parent,type:"clamp-zoom"}))}}}reset(){this.clamp()}}const LE={friction:.98,bounce:.8,minSpeed:.01},Or=16;class PE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"x"),W(this,"y"),W(this,"percentChangeX"),W(this,"percentChangeY"),W(this,"saved"),W(this,"timeSinceRelease"),this.options=Object.assign({},LE,e),this.saved=[],this.timeSinceRelease=0,this.reset(),this.parent.on("moved",i=>this.handleMoved(i))}down(){return this.saved=[],this.x=this.y=null,!1}isActive(){return!!(this.x||this.y)}move(){if(this.paused)return!1;const t=this.parent.input.count();return(t===1||t>1&&!this.parent.plugins.get("pinch",!0))&&(this.saved.push({x:this.parent.x,y:this.parent.y,time:performance.now()}),this.saved.length>60&&this.saved.splice(0,30)),!1}handleMoved(t){if(this.saved.length){const e=this.saved[this.saved.length-1];t.type==="clamp-x"&&t.original?e.x===t.original.x&&(e.x=this.parent.x):t.type==="clamp-y"&&t.original&&e.y===t.original.y&&(e.y=this.parent.y)}}up(){if(this.parent.input.count()===0&&this.saved.length){const t=performance.now();for(const e of this.saved)if(e.time>=t-100){const i=t-e.time;this.x=(this.parent.x-e.x)/i,this.y=(this.parent.y-e.y)/i,this.percentChangeX=this.percentChangeY=this.options.friction,this.timeSinceRelease=0;break}}return!1}activate(t){t=t||{},typeof t.x<"u"&&(this.x=t.x,this.percentChangeX=this.options.friction),typeof t.y<"u"&&(this.y=t.y,this.percentChangeY=this.options.friction)}update(t){if(this.paused)return;const e=this.x||this.y,i=this.timeSinceRelease,s=this.timeSinceRelease+t;if(this.x){const n=this.percentChangeX,o=Math.log(n);this.parent.x+=this.x*Or/o*(Math.pow(n,s/Or)-Math.pow(n,i/Or)),this.x*=Math.pow(this.percentChangeX,t/Or)}if(this.y){const n=this.percentChangeY,o=Math.log(n);this.parent.y+=this.y*Or/o*(Math.pow(n,s/Or)-Math.pow(n,i/Or)),this.y*=Math.pow(this.percentChangeY,t/Or)}this.timeSinceRelease+=t,this.x&&this.y?Math.abs(this.x)<this.options.minSpeed&&Math.abs(this.y)<this.options.minSpeed&&(this.x=0,this.y=0):(Math.abs(this.x||0)<this.options.minSpeed&&(this.x=0),Math.abs(this.y||0)<this.options.minSpeed&&(this.y=0)),e&&this.parent.emit("moved",{viewport:this.parent,type:"decelerate"})}reset(){this.x=this.y=null}}const GE={direction:"all",pressDrag:!0,wheel:!0,wheelScroll:1,reverse:!1,clampWheel:!1,underflow:"center",factor:1,mouseButtons:"all",keyToPress:null,ignoreKeyToPressOnTouch:!1,lineHeight:20,wheelSwapAxes:!1};class FE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"moved"),W(this,"reverse"),W(this,"xDirection"),W(this,"yDirection"),W(this,"keyIsPressed"),W(this,"mouse"),W(this,"underflowX"),W(this,"underflowY"),W(this,"last"),W(this,"current"),W(this,"windowEventHandlers",[]),this.options=Object.assign({},GE,e),this.moved=!1,this.reverse=this.options.reverse?1:-1,this.xDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="x",this.yDirection=!this.options.direction||this.options.direction==="all"||this.options.direction==="y",this.keyIsPressed=!1,this.parseUnderflow(),this.mouseButtons(this.options.mouseButtons),this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){const e=s=>{t.includes(s.code)&&(this.keyIsPressed=!0)},i=s=>{t.includes(s.code)&&(this.keyIsPressed=!1)};this.addWindowEventHandler("keyup",i),this.addWindowEventHandler("keydown",e)}addWindowEventHandler(t,e){window.addEventListener(t,e),this.windowEventHandlers.push({event:t,handler:e})}destroy(){this.windowEventHandlers.forEach(({event:t,handler:e})=>{window.removeEventListener(t,e)})}mouseButtons(t){!t||t==="all"?this.mouse=[!0,!0,!0]:this.mouse=[t.indexOf("left")!==-1,t.indexOf("middle")!==-1,t.indexOf("right")!==-1]}parseUnderflow(){const t=this.options.underflow.toLowerCase();t==="center"?(this.underflowX=0,this.underflowY=0):(t.includes("left")?this.underflowX=-1:t.includes("right")?this.underflowX=1:this.underflowX=0,t.includes("top")?this.underflowY=-1:t.includes("bottom")?this.underflowY=1:this.underflowY=0)}checkButtons(t){const e=t.pointerType==="mouse",i=this.parent.input.count();return!!((i===1||i>1&&!this.parent.plugins.get("pinch",!0))&&(!e||this.mouse[t.button]))}checkKeyPress(t){return!this.options.keyToPress||this.keyIsPressed||this.options.ignoreKeyToPressOnTouch&&t.data.pointerType==="touch"}down(t){return this.paused||!this.options.pressDrag?!1:this.checkButtons(t)&&this.checkKeyPress(t)?(this.last={x:t.global.x,y:t.global.y},this.current=t.pointerId,!0):(this.last=null,!1)}get active(){return this.moved}move(t){if(this.paused||!this.options.pressDrag)return!1;if(this.last&&this.current===t.data.pointerId){const e=t.global.x,i=t.global.y,s=this.parent.input.count();if(s===1||s>1&&!this.parent.plugins.get("pinch",!0)){const n=e-this.last.x,o=i-this.last.y;if(this.moved||this.xDirection&&this.parent.input.checkThreshold(n)||this.yDirection&&this.parent.input.checkThreshold(o)){const a={x:e,y:i};return this.xDirection&&(this.parent.x+=(a.x-this.last.x)*this.options.factor),this.yDirection&&(this.parent.y+=(a.y-this.last.y)*this.options.factor),this.last=a,this.moved||this.parent.emit("drag-start",{event:t,screen:new ut(this.last.x,this.last.y),world:this.parent.toWorld(new ut(this.last.x,this.last.y)),viewport:this.parent}),this.moved=!0,this.parent.emit("moved",{viewport:this.parent,type:"drag"}),!0}}else this.moved=!1}return!1}up(t){if(this.paused)return!1;const e=this.parent.input.touches;if(e.length===1){const i=e[0];return i.last&&(this.last={x:i.last.x,y:i.last.y},this.current=i.id),this.moved=!1,!0}else if(this.last&&this.moved){const i=new ut(this.last.x,this.last.y);return this.parent.emit("drag-end",{event:t,screen:i,world:this.parent.toWorld(i),viewport:this.parent}),this.last=null,this.moved=!1,!0}return!1}wheel(t){if(this.paused)return!1;if(this.options.wheel){const e=this.parent.plugins.get("wheel",!0);if(!e||!e.options.wheelZoom&&!t.ctrlKey){const i=t.deltaMode?this.options.lineHeight:1,s=[t.deltaX,t.deltaY],[n,o]=this.options.wheelSwapAxes?s.reverse():s;return this.xDirection&&(this.parent.x+=n*i*this.options.wheelScroll*this.reverse),this.yDirection&&(this.parent.y+=o*i*this.options.wheelScroll*this.reverse),this.options.clampWheel&&this.clamp(),this.parent.emit("wheel-scroll",this.parent),this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.options.passiveWheel||t.preventDefault(),this.parent.options.stopPropagation&&t.stopPropagation(),!0}}return!1}resume(){this.last=null,this.paused=!1}clamp(){const t=this.parent.plugins.get("decelerate",!0)||{};if(this.options.clampWheel!=="y")if(this.parent.screenWorldWidth<this.parent.screenWidth)switch(this.underflowX){case-1:this.parent.x=0;break;case 1:this.parent.x=this.parent.screenWidth-this.parent.screenWorldWidth;break;default:this.parent.x=(this.parent.screenWidth-this.parent.screenWorldWidth)/2}else this.parent.left<0?(this.parent.x=0,t.x=0):this.parent.right>this.parent.worldWidth&&(this.parent.x=-this.parent.worldWidth*this.parent.scale.x+this.parent.screenWidth,t.x=0);if(this.options.clampWheel!=="x")if(this.parent.screenWorldHeight<this.parent.screenHeight)switch(this.underflowY){case-1:this.parent.y=0;break;case 1:this.parent.y=this.parent.screenHeight-this.parent.screenWorldHeight;break;default:this.parent.y=(this.parent.screenHeight-this.parent.screenWorldHeight)/2}else this.parent.top<0&&(this.parent.y=0,t.y=0),this.parent.bottom>this.parent.worldHeight&&(this.parent.y=-this.parent.worldHeight*this.parent.scale.y+this.parent.screenHeight,t.y=0)}}const NE={speed:0,acceleration:null,radius:null};class DE extends qe{constructor(t,e,i={}){super(t),W(this,"options"),W(this,"target"),W(this,"velocity"),this.target=e,this.options=Object.assign({},NE,i),this.velocity={x:0,y:0}}update(t){if(this.paused)return;const e=this.parent.center;let i=this.target.x,s=this.target.y;if(this.options.radius)if(Math.sqrt(Math.pow(this.target.y-e.y,2)+Math.pow(this.target.x-e.x,2))>this.options.radius){const a=Math.atan2(this.target.y-e.y,this.target.x-e.x);i=this.target.x-Math.cos(a)*this.options.radius,s=this.target.y-Math.sin(a)*this.options.radius}else return;const n=i-e.x,o=s-e.y;if(n||o)if(this.options.speed)if(this.options.acceleration){const a=Math.atan2(s-e.y,i-e.x),h=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));if(h){const l=(Math.pow(this.velocity.x,2)+Math.pow(this.velocity.y,2))/(2*this.options.acceleration);h>l?this.velocity={x:Math.min(this.velocity.x+(this.options.acceleration*t,this.options.speed)),y:Math.min(this.velocity.y+(this.options.acceleration*t,this.options.speed))}:this.velocity={x:Math.max(this.velocity.x-this.options.acceleration*this.options.speed,0),y:Math.max(this.velocity.y-this.options.acceleration*this.options.speed,0)};const c=Math.cos(a)*this.velocity.x,u=Math.sin(a)*this.velocity.y,d=Math.abs(c)>Math.abs(n)?i:e.x+c,f=Math.abs(u)>Math.abs(o)?s:e.y+u;this.parent.moveCenter(d,f),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}else{const a=Math.atan2(s-e.y,i-e.x),h=Math.cos(a)*this.options.speed,l=Math.sin(a)*this.options.speed,c=Math.abs(h)>Math.abs(n)?i:e.x+h,u=Math.abs(l)>Math.abs(o)?s:e.y+l;this.parent.moveCenter(c,u),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}else this.parent.moveCenter(i,s),this.parent.emit("moved",{viewport:this.parent,type:"follow"})}}const kE={radius:null,distance:null,top:null,bottom:null,left:null,right:null,speed:8,reverse:!1,noDecelerate:!1,linear:!1,allowButtons:!1};class OE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"reverse"),W(this,"radiusSquared"),W(this,"left"),W(this,"top"),W(this,"right"),W(this,"bottom"),W(this,"horizontal"),W(this,"vertical"),this.options=Object.assign({},kE,e),this.reverse=this.options.reverse?1:-1,this.radiusSquared=typeof this.options.radius=="number"?Math.pow(this.options.radius,2):null,this.resize()}resize(){const t=this.options.distance;t!==null?(this.left=t,this.top=t,this.right=this.parent.screenWidth-t,this.bottom=this.parent.screenHeight-t):this.options.radius||(this.left=this.options.left,this.top=this.options.top,this.right=this.options.right===null?null:this.parent.screenWidth-this.options.right,this.bottom=this.options.bottom===null?null:this.parent.screenHeight-this.options.bottom)}down(){return this.paused||this.options.allowButtons||(this.horizontal=this.vertical=null),!1}move(t){if(this.paused||t.pointerType!=="mouse"&&t.pointerId!==1||!this.options.allowButtons&&t.buttons!==0)return!1;const e=t.global.x,i=t.global.y;if(this.radiusSquared){const s=this.parent.toScreen(this.parent.center);if(Math.pow(s.x-e,2)+Math.pow(s.y-i,2)>=this.radiusSquared){const n=Math.atan2(s.y-i,s.x-e);this.options.linear?(this.horizontal=Math.round(Math.cos(n))*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.round(Math.sin(n))*this.options.speed*this.reverse*(60/1e3)):(this.horizontal=Math.cos(n)*this.options.speed*this.reverse*(60/1e3),this.vertical=Math.sin(n)*this.options.speed*this.reverse*(60/1e3))}else this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=0}else this.left!==null&&e<this.left?this.horizontal=Number(this.reverse)*this.options.speed*(60/1e3):this.right!==null&&e>this.right?this.horizontal=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateHorizontal(),this.horizontal=0),this.top!==null&&i<this.top?this.vertical=Number(this.reverse)*this.options.speed*(60/1e3):this.bottom!==null&&i>this.bottom?this.vertical=-1*this.reverse*this.options.speed*(60/1e3):(this.decelerateVertical(),this.vertical=0);return!1}decelerateHorizontal(){const t=this.parent.plugins.get("decelerate",!0);this.horizontal&&t&&!this.options.noDecelerate&&t.activate({x:this.horizontal*this.options.speed*this.reverse/(1e3/60)})}decelerateVertical(){const t=this.parent.plugins.get("decelerate",!0);this.vertical&&t&&!this.options.noDecelerate&&t.activate({y:this.vertical*this.options.speed*this.reverse/(1e3/60)})}up(){return this.paused||(this.horizontal&&this.decelerateHorizontal(),this.vertical&&this.decelerateVertical(),this.horizontal=this.vertical=null),!1}update(){if(!this.paused&&(this.horizontal||this.vertical)){const t=this.parent.center;this.horizontal&&(t.x+=this.horizontal*this.options.speed),this.vertical&&(t.y+=this.vertical*this.options.speed),this.parent.moveCenter(t),this.parent.emit("moved",{viewport:this.parent,type:"mouse-edges"})}}}const BE={noDrag:!1,percent:1,center:null,factor:1,axis:"all"};class WE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"active",!1),W(this,"pinching",!1),W(this,"moved",!1),W(this,"lastCenter"),this.options=Object.assign({},BE,e)}down(){return this.parent.input.count()>=2?(this.active=!0,!0):!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}move(t){if(this.paused||!this.active)return!1;const e=t.global.x,i=t.global.y,s=this.parent.input.touches;if(s.length>=2){const n=s[0],o=s[1],a=n.last&&o.last?Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2)):null;if(n.id===t.pointerId?n.last={x:e,y:i,data:t}:o.id===t.pointerId&&(o.last={x:e,y:i,data:t}),a){let h;const l=new ut(n.last.x+(o.last.x-n.last.x)/2,n.last.y+(o.last.y-n.last.y)/2);this.options.center||(h=this.parent.toLocal(l));let c=Math.sqrt(Math.pow(o.last.x-n.last.x,2)+Math.pow(o.last.y-n.last.y,2));c=c===0?c=1e-10:c;const u=(1-a/c)*this.options.percent*(this.isAxisX()?this.parent.scale.x:this.parent.scale.y);this.isAxisX()&&(this.parent.scale.x+=u),this.isAxisY()&&(this.parent.scale.y+=u),this.parent.emit("zoomed",{viewport:this.parent,type:"pinch",center:l});const d=this.parent.plugins.get("clamp-zoom",!0);if(d&&d.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const f=this.parent.toGlobal(h);this.parent.x+=(l.x-f.x)*this.options.factor,this.parent.y+=(l.y-f.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})}!this.options.noDrag&&this.lastCenter&&(this.parent.x+=(l.x-this.lastCenter.x)*this.options.factor,this.parent.y+=(l.y-this.lastCenter.y)*this.options.factor,this.parent.emit("moved",{viewport:this.parent,type:"pinch"})),this.lastCenter=l,this.moved=!0}else this.pinching||(this.parent.emit("pinch-start",this.parent),this.pinching=!0);return!0}return!1}up(){return this.pinching&&this.parent.input.touches.length<=1?(this.active=!1,this.lastCenter=null,this.pinching=!1,this.moved=!1,this.parent.emit("pinch-end",this.parent),!0):!1}}const UE={topLeft:!1,friction:.8,time:1e3,ease:"easeInOutSine",interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1};class XE extends qe{constructor(t,e,i,s={}){super(t),W(this,"options"),W(this,"ease"),W(this,"x"),W(this,"y"),W(this,"percent"),W(this,"snapping"),W(this,"deltaX"),W(this,"deltaY"),W(this,"startX"),W(this,"startY"),this.options=Object.assign({},UE,s),this.ease=vh(s.ease,"easeInOutSine"),this.x=e,this.y=i,this.options.forceStart&&this.snapStart()}snapStart(){this.percent=0,this.snapping={time:0};const t=this.options.topLeft?this.parent.corner:this.parent.center;this.deltaX=this.x-t.x,this.deltaY=this.y-t.y,this.startX=t.x,this.startY=t.y,this.parent.emit("snap-start",this.parent)}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap"):this.options.interrupt&&(this.snapping=null),!1}up(){if(this.parent.input.count()===0){const t=this.parent.plugins.get("decelerate",!0);t&&(t.x||t.y)&&(t.percentChangeX=t.percentChangeY=this.options.friction)}return!1}update(t){if(!this.paused&&!(this.options.interrupt&&this.parent.input.count()!==0))if(this.snapping){const e=this.snapping;e.time+=t;let i,s,n;const o=this.startX,a=this.startY,h=this.deltaX,l=this.deltaY;if(e.time>this.options.time)i=!0,s=o+h,n=a+l;else{const c=this.ease(e.time,0,1,this.options.time);s=o+h*c,n=a+l*c}this.options.topLeft?this.parent.moveCorner(s,n):this.parent.moveCenter(s,n),this.parent.emit("moved",{viewport:this.parent,type:"snap"}),i&&(this.options.removeOnComplete&&this.parent.plugins.remove("snap"),this.parent.emit("snap-end",this.parent),this.snapping=null)}else{const e=this.options.topLeft?this.parent.corner:this.parent.center;(e.x!==this.x||e.y!==this.y)&&this.snapStart()}}}const ZE={width:0,height:0,time:1e3,ease:"easeInOutSine",center:null,interrupt:!0,removeOnComplete:!1,removeOnInterrupt:!1,forceStart:!1,noMove:!1};class VE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"ease"),W(this,"xScale"),W(this,"yScale"),W(this,"xIndependent"),W(this,"yIndependent"),W(this,"snapping"),this.options=Object.assign({},ZE,e),this.ease=vh(this.options.ease),this.xIndependent=!1,this.yIndependent=!1,this.xScale=0,this.yScale=0,this.options.width>0&&(this.xScale=t.screenWidth/this.options.width,this.xIndependent=!0),this.options.height>0&&(this.yScale=t.screenHeight/this.options.height,this.yIndependent=!0),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale,this.options.time===0?(t.container.scale.x=this.xScale,t.container.scale.y=this.yScale,this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom")):e.forceStart&&this.createSnapping()}createSnapping(){const t=this.parent.worldScreenWidth,e=this.parent.worldScreenHeight,i=this.parent.screenWidth/this.xScale,s=this.parent.screenHeight/this.yScale;this.snapping={time:0,startX:t,startY:e,deltaX:i-t,deltaY:s-e},this.parent.emit("snap-zoom-start",this.parent)}resize(){this.snapping=null,this.options.width>0&&(this.xScale=this.parent.screenWidth/this.options.width),this.options.height>0&&(this.yScale=this.parent.screenHeight/this.options.height),this.xScale=this.xIndependent?this.xScale:this.yScale,this.yScale=this.yIndependent?this.yScale:this.xScale}wheel(){return this.options.removeOnInterrupt&&this.parent.plugins.remove("snap-zoom"),!1}down(){return this.options.removeOnInterrupt?this.parent.plugins.remove("snap-zoom"):this.options.interrupt&&(this.snapping=null),!1}update(t){if(this.paused||this.options.interrupt&&this.parent.input.count()!==0)return;let e;if(!this.options.center&&!this.options.noMove&&(e=this.parent.center),!this.snapping)(this.parent.scale.x!==this.xScale||this.parent.scale.y!==this.yScale)&&this.createSnapping();else if(this.snapping){const i=this.snapping;if(i.time+=t,i.time>=this.options.time)this.parent.scale.set(this.xScale,this.yScale),this.options.removeOnComplete&&this.parent.plugins.remove("snap-zoom"),this.parent.emit("snap-zoom-end",this.parent),this.snapping=null;else{const n=this.snapping,o=this.ease(n.time,n.startX,n.deltaX,this.options.time),a=this.ease(n.time,n.startY,n.deltaY,this.options.time);this.parent.scale.x=this.parent.screenWidth/o,this.parent.scale.y=this.parent.screenHeight/a}const s=this.parent.plugins.get("clamp-zoom",!0);s&&s.clamp(),this.options.noMove||(this.options.center?this.parent.moveCenter(this.options.center):this.parent.moveCenter(e))}}resume(){this.snapping=null,super.resume()}}const HE={percent:.1,smooth:!1,interrupt:!0,reverse:!1,center:null,lineHeight:20,axis:"all",keyToPress:null,trackpadPinch:!1,wheelZoom:!0};class KE extends qe{constructor(t,e={}){super(t),W(this,"options"),W(this,"smoothing"),W(this,"smoothingCenter"),W(this,"smoothingCount"),W(this,"keyIsPressed"),this.options=Object.assign({},HE,e),this.keyIsPressed=!1,this.options.keyToPress&&this.handleKeyPresses(this.options.keyToPress)}handleKeyPresses(t){window.addEventListener("keydown",e=>{t.includes(e.code)&&(this.keyIsPressed=!0)}),window.addEventListener("keyup",e=>{t.includes(e.code)&&(this.keyIsPressed=!1)})}checkKeyPress(){return!this.options.keyToPress||this.keyIsPressed}down(){return this.options.interrupt&&(this.smoothing=null),!1}isAxisX(){return["all","x"].includes(this.options.axis)}isAxisY(){return["all","y"].includes(this.options.axis)}update(){if(this.smoothing){const t=this.smoothingCenter,e=this.smoothing;let i;this.options.center||(i=this.parent.toLocal(t)),this.isAxisX()&&(this.parent.scale.x+=e.x),this.isAxisY()&&(this.parent.scale.y+=e.y),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const s=this.parent.plugins.get("clamp-zoom",!0);if(s&&s.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const n=this.parent.toGlobal(i);this.parent.x+=t.x-n.x,this.parent.y+=t.y-n.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.smoothingCount++,this.smoothingCount>=this.options.smooth&&(this.smoothing=null)}}pinch(t){if(this.paused)return;const e=this.parent.input.getPointerPosition(t),i=-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/200,s=Math.pow(2,(1+this.options.percent)*i);let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}wheel(t){if(this.paused||!this.checkKeyPress())return!1;if(t.ctrlKey&&this.options.trackpadPinch)this.pinch(t);else if(this.options.wheelZoom){const e=this.parent.input.getPointerPosition(t),i=(this.options.reverse?-1:1)*-t.deltaY*(t.deltaMode?this.options.lineHeight:1)/500,s=Math.pow(2,(1+this.options.percent)*i);if(this.options.smooth){const n={x:this.smoothing?this.smoothing.x*(this.options.smooth-this.smoothingCount):0,y:this.smoothing?this.smoothing.y*(this.options.smooth-this.smoothingCount):0};this.smoothing={x:((this.parent.scale.x+n.x)*s-this.parent.scale.x)/this.options.smooth,y:((this.parent.scale.y+n.y)*s-this.parent.scale.y)/this.options.smooth},this.smoothingCount=0,this.smoothingCenter=e}else{let n;this.options.center||(n=this.parent.toLocal(e)),this.isAxisX()&&(this.parent.scale.x*=s),this.isAxisY()&&(this.parent.scale.y*=s),this.parent.emit("zoomed",{viewport:this.parent,type:"wheel"});const o=this.parent.plugins.get("clamp-zoom",!0);if(o&&o.clamp(),this.options.center)this.parent.moveCenter(this.options.center);else{const a=this.parent.toGlobal(n);this.parent.x+=e.x-a.x,this.parent.y+=e.y-a.y}}this.parent.emit("moved",{viewport:this.parent,type:"wheel"}),this.parent.emit("wheel-start",{event:t,viewport:this.parent})}return!this.parent.options.passiveWheel}}class YE{constructor(t){W(this,"viewport"),W(this,"clickedAvailable"),W(this,"isMouseDown"),W(this,"last"),W(this,"wheelFunction"),W(this,"touches"),this.viewport=t,this.touches=[],this.addListeners()}addListeners(){this.viewport.interactive=!0,this.viewport.forceHitArea||(this.viewport.hitArea=new pt(0,0,this.viewport.worldWidth,this.viewport.worldHeight)),this.viewport.on("pointerdown",this.down,this),this.viewport.options.allowPreserveDragOutside?this.viewport.on("globalpointermove",this.move,this):this.viewport.on("pointermove",this.move,this),this.viewport.on("pointerup",this.up,this),this.viewport.on("pointerupoutside",this.up,this),this.viewport.on("pointercancel",this.up,this),this.viewport.options.allowPreserveDragOutside||this.viewport.on("pointerleave",this.up,this),this.wheelFunction=t=>this.handleWheel(t),this.viewport.options.events.domElement.addEventListener("wheel",this.wheelFunction,{passive:this.viewport.options.passiveWheel}),this.isMouseDown=!1}destroy(){this.viewport.options.events.domElement.removeEventListener("wheel",this.wheelFunction)}down(t){if(!(this.viewport.pause||!this.viewport.worldVisible)){if(t.pointerType==="mouse"?this.isMouseDown=!0:this.get(t.pointerId)||this.touches.push({id:t.pointerId,last:null}),this.count()===1){this.last=t.global.clone();const e=this.viewport.plugins.get("decelerate",!0),i=this.viewport.plugins.get("bounce",!0);(!e||!e.isActive())&&(!i||!i.isActive())?this.clickedAvailable=!0:this.clickedAvailable=!1}else this.clickedAvailable=!1;this.viewport.plugins.down(t)&&this.viewport.options.stopPropagation&&t.stopPropagation()}}clear(){this.isMouseDown=!1,this.touches=[],this.last=null}checkThreshold(t){return Math.abs(t)>=this.viewport.threshold}move(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.plugins.move(t);if(this.clickedAvailable&&this.last){const i=t.global.x-this.last.x,s=t.global.y-this.last.y;(this.checkThreshold(i)||this.checkThreshold(s))&&(this.clickedAvailable=!1)}e&&this.viewport.options.stopPropagation&&t.stopPropagation()}up(t){if(this.viewport.pause||!this.viewport.worldVisible)return;t.pointerType==="mouse"&&(this.isMouseDown=!1),t.pointerType!=="mouse"&&this.remove(t.pointerId);const e=this.viewport.plugins.up(t);this.clickedAvailable&&this.count()===0&&this.last&&(this.viewport.emit("clicked",{event:t,screen:this.last,world:this.viewport.toWorld(this.last),viewport:this.viewport}),this.clickedAvailable=!1),e&&this.viewport.options.stopPropagation&&t.stopPropagation()}getPointerPosition(t){const e=new ut;return this.viewport.options.events.mapPositionToPoint(e,t.clientX,t.clientY),e}handleWheel(t){if(this.viewport.pause||!this.viewport.worldVisible)return;const e=this.viewport.toLocal(this.getPointerPosition(t));this.viewport.left<=e.x&&e.x<=this.viewport.right&&this.viewport.top<=e.y&&e.y<=this.viewport.bottom&&this.viewport.plugins.wheel(t)&&!this.viewport.options.passiveWheel&&t.preventDefault()}pause(){this.touches=[],this.isMouseDown=!1}get(t){for(const e of this.touches)if(e.id===t)return e;return null}remove(t){for(let e=0;e<this.touches.length;e++)if(this.touches[e].id===t){this.touches.splice(e,1);return}}count(){return(this.isMouseDown?1:0)+this.touches.length}}const bo=["drag","pinch","wheel","follow","mouse-edges","decelerate","animate","bounce","snap-zoom","clamp-zoom","snap","clamp"];class zE{constructor(t){W(this,"plugins"),W(this,"list"),W(this,"viewport"),this.viewport=t,this.list=[],this.plugins={}}add(t,e,i=bo.length){const s=this.plugins[t];s&&s.destroy(),this.plugins[t]=e;const n=bo.indexOf(t);n!==-1&&bo.splice(n,1),bo.splice(i,0,t),this.sort()}get(t,e){var i;return e&&(i=this.plugins[t])!=null&&i.paused?null:this.plugins[t]}update(t){for(const e of this.list)e.update(t)}resize(){for(const t of this.list)t.resize()}reset(){for(const t of this.list)t.reset()}removeAll(){this.list.forEach(t=>{t.destroy()}),this.plugins={},this.sort()}remove(t){var e;this.plugins[t]&&((e=this.plugins[t])==null||e.destroy(),delete this.plugins[t],this.viewport.emit("plugin-remove",t),this.sort())}pause(t){var e;(e=this.plugins[t])==null||e.pause()}resume(t){var e;(e=this.plugins[t])==null||e.resume()}sort(){this.list=[];for(const t of bo)this.plugins[t]&&this.list.push(this.plugins[t])}down(t){let e=!1;for(const i of this.list)i.down(t)&&(e=!0);return e}move(t){let e=!1;for(const i of this.viewport.plugins.list)i.move(t)&&(e=!0);return e}up(t){let e=!1;for(const i of this.list)i.up(t)&&(e=!0);return e}wheel(t){let e=!1;for(const i of this.list)i.wheel(t)&&(e=!0);return e}}const jE={screenWidth:window.innerWidth,screenHeight:window.innerHeight,worldWidth:null,worldHeight:null,threshold:5,passiveWheel:!0,stopPropagation:!1,forceHitArea:null,noTicker:!1,disableOnContextMenu:!1,ticker:ve.shared,allowPreserveDragOutside:!1};class JE extends At{constructor(t){super(),W(this,"moving"),W(this,"screenWidth"),W(this,"screenHeight"),W(this,"threshold"),W(this,"input"),W(this,"plugins"),W(this,"zooming"),W(this,"lastViewport"),W(this,"options"),W(this,"_dirty"),W(this,"_forceHitArea"),W(this,"_hitAreaDefault"),W(this,"_pause"),W(this,"tickerFunction"),W(this,"_worldWidth"),W(this,"_worldHeight"),W(this,"_disableOnContextMenu",e=>e.preventDefault()),this.options={...jE,...t},this.screenWidth=this.options.screenWidth,this.screenHeight=this.options.screenHeight,this._worldWidth=this.options.worldWidth,this._worldHeight=this.options.worldHeight,this.forceHitArea=this.options.forceHitArea,this.threshold=this.options.threshold,this.options.disableOnContextMenu&&this.options.events.domElement.addEventListener("contextmenu",this._disableOnContextMenu),this.options.noTicker||(this.tickerFunction=()=>this.update(this.options.ticker.elapsedMS),this.options.ticker.add(this.tickerFunction)),this.input=new YE(this),this.plugins=new zE(this)}destroy(t){!this.options.noTicker&&this.tickerFunction&&this.options.ticker.remove(this.tickerFunction),this.options.disableOnContextMenu&&this.options.events.domElement.removeEventListener("contextmenu",this._disableOnContextMenu),this.input.destroy(),super.destroy(t)}update(t){this.pause||(this.plugins.update(t),this.lastViewport&&(this.lastViewport.x!==this.x||this.lastViewport.y!==this.y?this.moving=!0:this.moving&&(this.emit("moved-end",this),this.moving=!1),this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y?this.zooming=!0:this.zooming&&(this.emit("zoomed-end",this),this.zooming=!1)),this.forceHitArea||(this._hitAreaDefault=new pt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight),this.hitArea=this._hitAreaDefault),this._dirty=this._dirty||!this.lastViewport||this.lastViewport.x!==this.x||this.lastViewport.y!==this.y||this.lastViewport.scaleX!==this.scale.x||this.lastViewport.scaleY!==this.scale.y,this.lastViewport={x:this.x,y:this.y,scaleX:this.scale.x,scaleY:this.scale.y},this.emit("frame-end",this))}resize(t=window.innerWidth,e=window.innerHeight,i,s){this.screenWidth=t,this.screenHeight=e,typeof i<"u"&&(this._worldWidth=i),typeof s<"u"&&(this._worldHeight=s),this.plugins.resize(),this.dirty=!0}get worldWidth(){return this._worldWidth?this._worldWidth:this.width/this.scale.x}set worldWidth(t){this._worldWidth=t,this.plugins.resize()}get worldHeight(){return this._worldHeight?this._worldHeight:this.height/this.scale.y}set worldHeight(t){this._worldHeight=t,this.plugins.resize()}getVisibleBounds(){return new pt(this.left,this.top,this.worldScreenWidth,this.worldScreenHeight)}toWorld(t,e){return arguments.length===2?this.toLocal(new ut(t,e)):this.toLocal(t)}toScreen(t,e){return arguments.length===2?this.toGlobal(new ut(t,e)):this.toGlobal(t)}get worldScreenWidth(){return this.screenWidth/this.scale.x}get worldScreenHeight(){return this.screenHeight/this.scale.y}get screenWorldWidth(){return this.worldWidth*this.scale.x}get screenWorldHeight(){return this.worldHeight*this.scale.y}get center(){return new ut(this.worldScreenWidth/2-this.x/this.scale.x,this.worldScreenHeight/2-this.y/this.scale.y)}set center(t){this.moveCenter(t)}moveCenter(...t){let e,i;typeof t[0]=="number"?(e=t[0],i=t[1]):(e=t[0].x,i=t[0].y);const s=(this.worldScreenWidth/2-e)*this.scale.x,n=(this.worldScreenHeight/2-i)*this.scale.y;return(this.x!==s||this.y!==n)&&(this.position.set(s,n),this.plugins.reset(),this.dirty=!0),this}get corner(){return new ut(-this.x/this.scale.x,-this.y/this.scale.y)}set corner(t){this.moveCorner(t)}moveCorner(...t){let e,i;return t.length===1?(e=-t[0].x*this.scale.x,i=-t[0].y*this.scale.y):(e=-t[0]*this.scale.x,i=-t[1]*this.scale.y),(e!==this.x||i!==this.y)&&(this.position.set(e,i),this.plugins.reset(),this.dirty=!0),this}get screenWidthInWorldPixels(){return this.screenWidth/this.scale.x}get screenHeightInWorldPixels(){return this.screenHeight/this.scale.y}findFitWidth(t){return this.screenWidth/t}findFitHeight(t){return this.screenHeight/t}findFit(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.min(i,s)}findCover(t,e){const i=this.screenWidth/t,s=this.screenHeight/e;return Math.max(i,s)}fitWidth(t=this.worldWidth,e,i=!0,s){let n;e&&(n=this.center),this.scale.x=this.screenWidth/t,i&&(this.scale.y=this.scale.x);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitHeight(t=this.worldHeight,e,i=!0,s){let n;e&&(n=this.center),this.scale.y=this.screenHeight/t,i&&(this.scale.x=this.scale.y);const o=this.plugins.get("clamp-zoom",!0);return!s&&o&&o.clamp(),e&&n&&this.moveCenter(n),this}fitWorld(t){let e;t&&(e=this.center),this.scale.x=this.screenWidth/this.worldWidth,this.scale.y=this.screenHeight/this.worldHeight,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const i=this.plugins.get("clamp-zoom",!0);return i&&i.clamp(),t&&e&&this.moveCenter(e),this}fit(t,e=this.worldWidth,i=this.worldHeight){let s;t&&(s=this.center),this.scale.x=this.screenWidth/e,this.scale.y=this.screenHeight/i,this.scale.x<this.scale.y?this.scale.y=this.scale.x:this.scale.x=this.scale.y;const n=this.plugins.get("clamp-zoom",!0);return n&&n.clamp(),t&&s&&this.moveCenter(s),this}setZoom(t,e){let i;e&&(i=this.center),this.scale.set(t);const s=this.plugins.get("clamp-zoom",!0);return s&&s.clamp(),e&&i&&this.moveCenter(i),this}zoomPercent(t,e){return this.setZoom(this.scale.x+this.scale.x*t,e)}zoom(t,e){return this.fitWidth(t+this.worldScreenWidth,e),this}get scaled(){return this.scale.x}set scaled(t){this.setZoom(t,!0)}snapZoom(t){return this.plugins.add("snap-zoom",new VE(this,t)),this}OOB(){return{left:this.left<0,right:this.right>this.worldWidth,top:this.top<0,bottom:this.bottom>this.worldHeight,cornerPoint:new ut(this.worldWidth*this.scale.x-this.screenWidth,this.worldHeight*this.scale.y-this.screenHeight)}}get right(){return-this.x/this.scale.x+this.worldScreenWidth}set right(t){this.x=-t*this.scale.x+this.screenWidth,this.plugins.reset()}get left(){return-this.x/this.scale.x}set left(t){this.x=-t*this.scale.x,this.plugins.reset()}get top(){return-this.y/this.scale.y}set top(t){this.y=-t*this.scale.y,this.plugins.reset()}get bottom(){return-this.y/this.scale.y+this.worldScreenHeight}set bottom(t){this.y=-t*this.scale.y+this.screenHeight,this.plugins.reset()}get dirty(){return!!this._dirty}set dirty(t){this._dirty=t}get forceHitArea(){return this._forceHitArea}set forceHitArea(t){t?(this._forceHitArea=t,this.hitArea=t):(this._forceHitArea=null,this.hitArea=new pt(0,0,this.worldWidth,this.worldHeight))}drag(t){return this.plugins.add("drag",new FE(this,t)),this}clamp(t){return this.plugins.add("clamp",new AE(this,t)),this}decelerate(t){return this.plugins.add("decelerate",new PE(this,t)),this}bounce(t){return this.plugins.add("bounce",new EE(this,t)),this}pinch(t){return this.plugins.add("pinch",new WE(this,t)),this}snap(t,e,i){return this.plugins.add("snap",new XE(this,t,e,i)),this}follow(t,e){return this.plugins.add("follow",new DE(this,t,e)),this}wheel(t){return this.plugins.add("wheel",new KE(this,t)),this}animate(t){return this.plugins.add("animate",new SE(this,t)),this}clampZoom(t){return this.plugins.add("clamp-zoom",new ME(this,t)),this}mouseEdges(t){return this.plugins.add("mouse-edges",new OE(this,t)),this}get pause(){return!!this._pause}set pause(t){this._pause=t,this.lastViewport=null,this.moving=!1,this.zooming=!1,t&&this.input.pause()}ensureVisible(t,e,i,s,n){n&&(i>this.worldScreenWidth||s>this.worldScreenHeight)&&(this.fit(!0,i,s),this.emit("zoomed",{viewport:this,type:"ensureVisible"}));let o=!1;t<this.left?(this.left=t,o=!0):t+i>this.right&&(this.right=t+i,o=!0),e<this.top?(this.top=e,o=!0):e+s>this.bottom&&(this.bottom=e+s,o=!0),o&&this.emit("moved",{viewport:this,type:"ensureVisible"})}}function Th(r,t){return r==null||t==null?NaN:r<t?-1:r>t?1:r>=t?0:NaN}function $E(r,t){return r==null||t==null?NaN:t<r?-1:t>r?1:t>=r?0:NaN}function Qu(r){let t,e,i;r.length!==2?(t=Th,e=(a,h)=>Th(r(a),h),i=(a,h)=>r(a)-h):(t=r===Th||r===$E?r:QE,e=r,i=r);function s(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<0?l=u+1:c=u}while(l<c)}return l}function n(a,h,l=0,c=a.length){if(l<c){if(t(h,h)!==0)return c;do{const u=l+c>>>1;e(a[u],h)<=0?l=u+1:c=u}while(l<c)}return l}function o(a,h,l=0,c=a.length){const u=s(a,h,l,c-1);return u>l&&i(a[u-1],h)>-i(a[u],h)?u-1:u}return{left:s,center:o,right:n}}function QE(){return 0}function qE(r){return r===null?NaN:+r}const tI=Qu(Th).right;Qu(qE).center;const eI=tI,iI=Math.sqrt(50),rI=Math.sqrt(10),sI=Math.sqrt(2);function wh(r,t,e){const i=(t-r)/Math.max(0,e),s=Math.floor(Math.log10(i)),n=i/Math.pow(10,s),o=n>=iI?10:n>=rI?5:n>=sI?2:1;let a,h,l;return s<0?(l=Math.pow(10,-s)/o,a=Math.round(r*l),h=Math.round(t*l),a/l<r&&++a,h/l>t&&--h,l=-l):(l=Math.pow(10,s)*o,a=Math.round(r/l),h=Math.round(t/l),a*l<r&&++a,h*l>t&&--h),h<a&&.5<=e&&e<2?wh(r,t,e*2):[a,h,l]}function nI(r,t,e){if(t=+t,r=+r,e=+e,!(e>0))return[];if(r===t)return[r];const i=t<r,[s,n,o]=i?wh(t,r,e):wh(r,t,e);if(!(n>=s))return[];const a=n-s+1,h=new Array(a);if(i)if(o<0)for(let l=0;l<a;++l)h[l]=(n-l)/-o;else for(let l=0;l<a;++l)h[l]=(n-l)*o;else if(o<0)for(let l=0;l<a;++l)h[l]=(s+l)/-o;else for(let l=0;l<a;++l)h[l]=(s+l)*o;return h}function qu(r,t,e){return t=+t,r=+r,e=+e,wh(r,t,e)[2]}function td(r,t,e){t=+t,r=+r,e=+e;const i=t<r,s=i?qu(t,r,e):qu(r,t,e);return(i?-1:1)*(s<0?1/-s:s)}function ed(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function ay(r,t){var e=Object.create(r.prototype);for(var i in t)e[i]=t[i];return e}function xo(){}var _o=.7,Sh=1/_o,pn="\\s*([+-]?\\d+)\\s*",vo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ki="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oI=/^#([0-9a-f]{3,8})$/,aI=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),hI=new RegExp(`^rgb\\(${ki},${ki},${ki}\\)$`),lI=new RegExp(`^rgba\\(${pn},${pn},${pn},${vo}\\)$`),cI=new RegExp(`^rgba\\(${ki},${ki},${ki},${vo}\\)$`),uI=new RegExp(`^hsl\\(${vo},${ki},${ki}\\)$`),dI=new RegExp(`^hsla\\(${vo},${ki},${ki},${vo}\\)$`),hy={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};ed(xo,To,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ly,formatHex:ly,formatHex8:fI,formatHsl:pI,formatRgb:cy,toString:cy});function ly(){return this.rgb().formatHex()}function fI(){return this.rgb().formatHex8()}function pI(){return my(this).formatHsl()}function cy(){return this.rgb().formatRgb()}function To(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=oI.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?uy(t):e===3?new Me(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Ch(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Ch(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=aI.exec(r))?new Me(t[1],t[2],t[3],1):(t=hI.exec(r))?new Me(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lI.exec(r))?Ch(t[1],t[2],t[3],t[4]):(t=cI.exec(r))?Ch(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=uI.exec(r))?py(t[1],t[2]/100,t[3]/100,1):(t=dI.exec(r))?py(t[1],t[2]/100,t[3]/100,t[4]):hy.hasOwnProperty(r)?uy(hy[r]):r==="transparent"?new Me(NaN,NaN,NaN,0):null}function uy(r){return new Me(r>>16&255,r>>8&255,r&255,1)}function Ch(r,t,e,i){return i<=0&&(r=t=e=NaN),new Me(r,t,e,i)}function mI(r){return r instanceof xo||(r=To(r)),r?(r=r.rgb(),new Me(r.r,r.g,r.b,r.opacity)):new Me}function id(r,t,e,i){return arguments.length===1?mI(r):new Me(r,t,e,i??1)}function Me(r,t,e,i){this.r=+r,this.g=+t,this.b=+e,this.opacity=+i}ed(Me,id,ay(xo,{brighter(r){return r=r==null?Sh:Math.pow(Sh,r),new Me(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?_o:Math.pow(_o,r),new Me(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Me(vs(this.r),vs(this.g),vs(this.b),Eh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:dy,formatHex:dy,formatHex8:gI,formatRgb:fy,toString:fy}));function dy(){return`#${Ts(this.r)}${Ts(this.g)}${Ts(this.b)}`}function gI(){return`#${Ts(this.r)}${Ts(this.g)}${Ts(this.b)}${Ts((isNaN(this.opacity)?1:this.opacity)*255)}`}function fy(){const r=Eh(this.opacity);return`${r===1?"rgb(":"rgba("}${vs(this.r)}, ${vs(this.g)}, ${vs(this.b)}${r===1?")":`, ${r})`}`}function Eh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function vs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ts(r){return r=vs(r),(r<16?"0":"")+r.toString(16)}function py(r,t,e,i){return i<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new di(r,t,e,i)}function my(r){if(r instanceof di)return new di(r.h,r.s,r.l,r.opacity);if(r instanceof xo||(r=To(r)),!r)return new di;if(r instanceof di)return r;r=r.rgb();var t=r.r/255,e=r.g/255,i=r.b/255,s=Math.min(t,e,i),n=Math.max(t,e,i),o=NaN,a=n-s,h=(n+s)/2;return a?(t===n?o=(e-i)/a+(e<i)*6:e===n?o=(i-t)/a+2:o=(t-e)/a+4,a/=h<.5?n+s:2-n-s,o*=60):a=h>0&&h<1?0:o,new di(o,a,h,r.opacity)}function yI(r,t,e,i){return arguments.length===1?my(r):new di(r,t,e,i??1)}function di(r,t,e,i){this.h=+r,this.s=+t,this.l=+e,this.opacity=+i}ed(di,yI,ay(xo,{brighter(r){return r=r==null?Sh:Math.pow(Sh,r),new di(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?_o:Math.pow(_o,r),new di(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,i=e+(e<.5?e:1-e)*t,s=2*e-i;return new Me(rd(r>=240?r-240:r+120,s,i),rd(r,s,i),rd(r<120?r+240:r-120,s,i),this.opacity)},clamp(){return new di(gy(this.h),Ih(this.s),Ih(this.l),Eh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=Eh(this.opacity);return`${r===1?"hsl(":"hsla("}${gy(this.h)}, ${Ih(this.s)*100}%, ${Ih(this.l)*100}%${r===1?")":`, ${r})`}`}}));function gy(r){return r=(r||0)%360,r<0?r+360:r}function Ih(r){return Math.max(0,Math.min(1,r||0))}function rd(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}const sd=r=>()=>r;function bI(r,t){return function(e){return r+e*t}}function xI(r,t,e){return r=Math.pow(r,e),t=Math.pow(t,e)-r,e=1/e,function(i){return Math.pow(r+i*t,e)}}function _I(r){return(r=+r)==1?yy:function(t,e){return e-t?xI(t,e,r):sd(isNaN(t)?e:t)}}function yy(r,t){var e=t-r;return e?bI(r,e):sd(isNaN(r)?t:r)}const by=function r(t){var e=_I(t);function i(s,n){var o=e((s=id(s)).r,(n=id(n)).r),a=e(s.g,n.g),h=e(s.b,n.b),l=yy(s.opacity,n.opacity);return function(c){return s.r=o(c),s.g=a(c),s.b=h(c),s.opacity=l(c),s+""}}return i.gamma=r,i}(1);function vI(r,t){t||(t=[]);var e=r?Math.min(t.length,r.length):0,i=t.slice(),s;return function(n){for(s=0;s<e;++s)i[s]=r[s]*(1-n)+t[s]*n;return i}}function TI(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function wI(r,t){var e=t?t.length:0,i=r?Math.min(e,r.length):0,s=new Array(i),n=new Array(e),o;for(o=0;o<i;++o)s[o]=ad(r[o],t[o]);for(;o<e;++o)n[o]=t[o];return function(a){for(o=0;o<i;++o)n[o]=s[o](a);return n}}function SI(r,t){var e=new Date;return r=+r,t=+t,function(i){return e.setTime(r*(1-i)+t*i),e}}function Ah(r,t){return r=+r,t=+t,function(e){return r*(1-e)+t*e}}function CI(r,t){var e={},i={},s;(r===null||typeof r!="object")&&(r={}),(t===null||typeof t!="object")&&(t={});for(s in t)s in r?e[s]=ad(r[s],t[s]):i[s]=t[s];return function(n){for(s in e)i[s]=e[s](n);return i}}var nd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,od=new RegExp(nd.source,"g");function EI(r){return function(){return r}}function II(r){return function(t){return r(t)+""}}function AI(r,t){var e=nd.lastIndex=od.lastIndex=0,i,s,n,o=-1,a=[],h=[];for(r=r+"",t=t+"";(i=nd.exec(r))&&(s=od.exec(t));)(n=s.index)>e&&(n=t.slice(e,n),a[o]?a[o]+=n:a[++o]=n),(i=i[0])===(s=s[0])?a[o]?a[o]+=s:a[++o]=s:(a[++o]=null,h.push({i:o,x:Ah(i,s)})),e=od.lastIndex;return e<t.length&&(n=t.slice(e),a[o]?a[o]+=n:a[++o]=n),a.length<2?h[0]?II(h[0].x):EI(t):(t=h.length,function(l){for(var c=0,u;c<t;++c)a[(u=h[c]).i]=u.x(l);return a.join("")})}function ad(r,t){var e=typeof t,i;return t==null||e==="boolean"?sd(t):(e==="number"?Ah:e==="string"?(i=To(t))?(t=i,by):AI:t instanceof To?by:t instanceof Date?SI:TI(t)?vI:Array.isArray(t)?wI:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?CI:Ah)(r,t)}function RI(r,t){return r=+r,t=+t,function(e){return Math.round(r*(1-e)+t*e)}}function MI(r){return Math.abs(r=Math.round(r))>=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function Rh(r,t){if((e=(r=t?r.toExponential(t-1):r.toExponential()).indexOf("e"))<0)return null;var e,i=r.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+r.slice(e+1)]}function mn(r){return r=Rh(Math.abs(r)),r?r[1]:NaN}function LI(r,t){return function(e,i){for(var s=e.length,n=[],o=0,a=r[0],h=0;s>0&&a>0&&(h+a+1>i&&(a=Math.max(1,i-h)),n.push(e.substring(s-=a,s+a)),!((h+=a+1)>i));)a=r[o=(o+1)%r.length];return n.reverse().join(t)}}function PI(r){return function(t){return t.replace(/[0-9]/g,function(e){return r[+e]})}}var GI=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Mh(r){if(!(t=GI.exec(r)))throw new Error("invalid format: "+r);var t;return new hd({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Mh.prototype=hd.prototype;function hd(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}hd.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function FI(r){t:for(var t=r.length,e=1,i=-1,s;e<t;++e)switch(r[e]){case".":i=s=e;break;case"0":i===0&&(i=e),s=e;break;default:if(!+r[e])break t;i>0&&(i=0);break}return i>0?r.slice(0,i)+r.slice(s+1):r}var xy;function NI(r,t){var e=Rh(r,t);if(!e)return r+"";var i=e[0],s=e[1],n=s-(xy=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=i.length;return n===o?i:n>o?i+new Array(n-o+1).join("0"):n>0?i.slice(0,n)+"."+i.slice(n):"0."+new Array(1-n).join("0")+Rh(r,Math.max(0,t+n-1))[0]}function _y(r,t){var e=Rh(r,t);if(!e)return r+"";var i=e[0],s=e[1];return s<0?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}const vy={"%":(r,t)=>(r*100).toFixed(t),b:r=>Math.round(r).toString(2),c:r=>r+"",d:MI,e:(r,t)=>r.toExponential(t),f:(r,t)=>r.toFixed(t),g:(r,t)=>r.toPrecision(t),o:r=>Math.round(r).toString(8),p:(r,t)=>_y(r*100,t),r:_y,s:NI,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function Ty(r){return r}var wy=Array.prototype.map,Sy=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function DI(r){var t=r.grouping===void 0||r.thousands===void 0?Ty:LI(wy.call(r.grouping,Number),r.thousands+""),e=r.currency===void 0?"":r.currency[0]+"",i=r.currency===void 0?"":r.currency[1]+"",s=r.decimal===void 0?".":r.decimal+"",n=r.numerals===void 0?Ty:PI(wy.call(r.numerals,String)),o=r.percent===void 0?"%":r.percent+"",a=r.minus===void 0?"−":r.minus+"",h=r.nan===void 0?"NaN":r.nan+"";function l(u){u=Mh(u);var d=u.fill,f=u.align,m=u.sign,p=u.symbol,g=u.zero,y=u.width,_=u.comma,b=u.precision,v=u.trim,w=u.type;w==="n"?(_=!0,w="g"):vy[w]||(b===void 0&&(b=12),v=!0,w="g"),(g||d==="0"&&f==="=")&&(g=!0,d="0",f="=");var C=p==="$"?e:p==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",E=p==="$"?i:/[%p]/.test(w)?o:"",A=vy[w],R=/[defgprs%]/.test(w);b=b===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function G(N){var P=C,I=E,D,X,H;if(w==="c")I=A(N)+I,N="";else{N=+N;var Z=N<0||1/N<0;if(N=isNaN(N)?h:A(Math.abs(N),b),v&&(N=FI(N)),Z&&+N==0&&m!=="+"&&(Z=!1),P=(Z?m==="("?m:a:m==="-"||m==="("?"":m)+P,I=(w==="s"?Sy[8+xy/3]:"")+I+(Z&&m==="("?")":""),R){for(D=-1,X=N.length;++D<X;)if(H=N.charCodeAt(D),48>H||H>57){I=(H===46?s+N.slice(D+1):N.slice(D))+I,N=N.slice(0,D);break}}}_&&!g&&(N=t(N,1/0));var j=P.length+N.length+I.length,O=j<y?new Array(y-j+1).join(d):"";switch(_&&g&&(N=t(O+N,O.length?y-I.length:1/0),O=""),f){case"<":N=P+N+I+O;break;case"=":N=P+O+N+I;break;case"^":N=O.slice(0,j=O.length>>1)+P+N+I+O.slice(j);break;default:N=O+P+N+I;break}return n(N)}return G.toString=function(){return u+""},G}function c(u,d){var f=l((u=Mh(u),u.type="f",u)),m=Math.max(-8,Math.min(8,Math.floor(mn(d)/3)))*3,p=Math.pow(10,-m),g=Sy[8+m/3];return function(y){return f(p*y)+g}}return{format:l,formatPrefix:c}}var Lh,Cy,Ey;kI({thousands:",",grouping:[3],currency:["$",""]});function kI(r){return Lh=DI(r),Cy=Lh.format,Ey=Lh.formatPrefix,Lh}function OI(r){return Math.max(0,-mn(Math.abs(r)))}function BI(r,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(mn(t)/3)))*3-mn(Math.abs(r)))}function WI(r,t){return r=Math.abs(r),t=Math.abs(t)-r,Math.max(0,mn(t)-mn(r))+1}function Iy(r,t){switch(arguments.length){case 0:break;case 1:this.range(r);break;default:this.range(t).domain(r);break}return this}function UI(r){return function(){return r}}function XI(r){return+r}var Ay=[0,1];function gn(r){return r}function ld(r,t){return(t-=r=+r)?function(e){return(e-r)/t}:UI(isNaN(t)?NaN:.5)}function ZI(r,t){var e;return r>t&&(e=r,r=t,t=e),function(i){return Math.max(r,Math.min(t,i))}}function VI(r,t,e){var i=r[0],s=r[1],n=t[0],o=t[1];return s<i?(i=ld(s,i),n=e(o,n)):(i=ld(i,s),n=e(n,o)),function(a){return n(i(a))}}function HI(r,t,e){var i=Math.min(r.length,t.length)-1,s=new Array(i),n=new Array(i),o=-1;for(r[i]<r[0]&&(r=r.slice().reverse(),t=t.slice().reverse());++o<i;)s[o]=ld(r[o],r[o+1]),n[o]=e(t[o],t[o+1]);return function(a){var h=eI(r,a,1,i)-1;return n[h](s[h](a))}}function Ry(r,t){return t.domain(r.domain()).range(r.range()).interpolate(r.interpolate()).clamp(r.clamp()).unknown(r.unknown())}function KI(){var r=Ay,t=Ay,e=ad,i,s,n,o=gn,a,h,l;function c(){var d=Math.min(r.length,t.length);return o!==gn&&(o=ZI(r[0],r[d-1])),a=d>2?HI:VI,h=l=null,u}function u(d){return d==null||isNaN(d=+d)?n:(h||(h=a(r.map(i),t,e)))(i(o(d)))}return u.invert=function(d){return o(s((l||(l=a(t,r.map(i),Ah)))(d)))},u.domain=function(d){return arguments.length?(r=Array.from(d,XI),c()):r.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),e=RI,c()},u.clamp=function(d){return arguments.length?(o=d?!0:gn,c()):o!==gn},u.interpolate=function(d){return arguments.length?(e=d,c()):e},u.unknown=function(d){return arguments.length?(n=d,u):n},function(d,f){return i=d,s=f,c()}}function My(){return KI()(gn,gn)}function YI(r,t,e,i){var s=td(r,t,e),n;switch(i=Mh(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(r),Math.abs(t));return i.precision==null&&!isNaN(n=BI(s,o))&&(i.precision=n),Ey(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(n=WI(s,Math.max(Math.abs(r),Math.abs(t))))&&(i.precision=n-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(n=OI(s))&&(i.precision=n-(i.type==="%")*2);break}}return Cy(i)}function zI(r){var t=r.domain;return r.ticks=function(e){var i=t();return nI(i[0],i[i.length-1],e??10)},r.tickFormat=function(e,i){var s=t();return YI(s[0],s[s.length-1],e??10,i)},r.nice=function(e){e==null&&(e=10);var i=t(),s=0,n=i.length-1,o=i[s],a=i[n],h,l,c=10;for(a<o&&(l=o,o=a,a=l,l=s,s=n,n=l);c-- >0;){if(l=qu(o,a,e),l===h)return i[s]=o,i[n]=a,t(i);if(l>0)o=Math.floor(o/l)*l,a=Math.ceil(a/l)*l;else if(l<0)o=Math.ceil(o*l)/l,a=Math.floor(a*l)/l;else break;h=l}return r},r}function Ly(){var r=My();return r.copy=function(){return Ry(r,Ly())},Iy.apply(r,arguments),zI(r)}function jI(r,t){r=r.slice();var e=0,i=r.length-1,s=r[e],n=r[i],o;return n<s&&(o=e,e=i,i=o,o=s,s=n,n=o),r[e]=t.floor(s),r[i]=t.ceil(n),r}const cd=new Date,ud=new Date;function te(r,t,e,i){function s(n){return r(n=arguments.length===0?new Date:new Date(+n)),n}return s.floor=n=>(r(n=new Date(+n)),n),s.ceil=n=>(r(n=new Date(n-1)),t(n,1),r(n),n),s.round=n=>{const o=s(n),a=s.ceil(n);return n-o<a-n?o:a},s.offset=(n,o)=>(t(n=new Date(+n),o==null?1:Math.floor(o)),n),s.range=(n,o,a)=>{const h=[];if(n=s.ceil(n),a=a==null?1:Math.floor(a),!(n<o)||!(a>0))return h;let l;do h.push(l=new Date(+n)),t(n,a),r(n);while(l<n&&n<o);return h},s.filter=n=>te(o=>{if(o>=o)for(;r(o),!n(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;t(o,-1),!n(o););else for(;--a>=0;)for(;t(o,1),!n(o););}),e&&(s.count=(n,o)=>(cd.setTime(+n),ud.setTime(+o),r(cd),r(ud),Math.floor(e(cd,ud))),s.every=n=>(n=Math.floor(n),!isFinite(n)||!(n>0)?null:n>1?s.filter(i?o=>i(o)%n===0:o=>s.count(0,o)%n===0):s)),s}const Ph=te(()=>{},(r,t)=>{r.setTime(+r+t)},(r,t)=>t-r);Ph.every=r=>(r=Math.floor(r),!isFinite(r)||!(r>0)?null:r>1?te(t=>{t.setTime(Math.floor(t/r)*r)},(t,e)=>{t.setTime(+t+e*r)},(t,e)=>(e-t)/r):Ph),Ph.range;const ar=1e3,ti=ar*60,hr=ti*60,lr=hr*24,dd=lr*7,Py=lr*30,fd=lr*365,yn=te(r=>{r.setTime(r-r.getMilliseconds())},(r,t)=>{r.setTime(+r+t*ar)},(r,t)=>(t-r)/ar,r=>r.getUTCSeconds());yn.range;const pd=te(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*ar)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getMinutes());pd.range,te(r=>{r.setUTCSeconds(0,0)},(r,t)=>{r.setTime(+r+t*ti)},(r,t)=>(t-r)/ti,r=>r.getUTCMinutes()).range;const md=te(r=>{r.setTime(r-r.getMilliseconds()-r.getSeconds()*ar-r.getMinutes()*ti)},(r,t)=>{r.setTime(+r+t*hr)},(r,t)=>(t-r)/hr,r=>r.getHours());md.range,te(r=>{r.setUTCMinutes(0,0,0)},(r,t)=>{r.setTime(+r+t*hr)},(r,t)=>(t-r)/hr,r=>r.getUTCHours()).range;const wo=te(r=>r.setHours(0,0,0,0),(r,t)=>r.setDate(r.getDate()+t),(r,t)=>(t-r-(t.getTimezoneOffset()-r.getTimezoneOffset())*ti)/lr,r=>r.getDate()-1);wo.range;const gd=te(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/lr,r=>r.getUTCDate()-1);gd.range,te(r=>{r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCDate(r.getUTCDate()+t)},(r,t)=>(t-r)/lr,r=>Math.floor(r/lr)).range;function ws(r){return te(t=>{t.setDate(t.getDate()-(t.getDay()+7-r)%7),t.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+e*7)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ti)/dd)}const Gh=ws(0),Fh=ws(1),JI=ws(2),$I=ws(3),bn=ws(4),QI=ws(5),qI=ws(6);Gh.range,Fh.range,JI.range,$I.range,bn.range,QI.range,qI.range;function Ss(r){return te(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-r)%7),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e*7)},(t,e)=>(e-t)/dd)}const Gy=Ss(0),Nh=Ss(1),t2=Ss(2),e2=Ss(3),xn=Ss(4),i2=Ss(5),r2=Ss(6);Gy.range,Nh.range,t2.range,e2.range,xn.range,i2.range,r2.range;const yd=te(r=>{r.setDate(1),r.setHours(0,0,0,0)},(r,t)=>{r.setMonth(r.getMonth()+t)},(r,t)=>t.getMonth()-r.getMonth()+(t.getFullYear()-r.getFullYear())*12,r=>r.getMonth());yd.range,te(r=>{r.setUTCDate(1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCMonth(r.getUTCMonth()+t)},(r,t)=>t.getUTCMonth()-r.getUTCMonth()+(t.getUTCFullYear()-r.getUTCFullYear())*12,r=>r.getUTCMonth()).range;const cr=te(r=>{r.setMonth(0,1),r.setHours(0,0,0,0)},(r,t)=>{r.setFullYear(r.getFullYear()+t)},(r,t)=>t.getFullYear()-r.getFullYear(),r=>r.getFullYear());cr.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:te(t=>{t.setFullYear(Math.floor(t.getFullYear()/r)*r),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e*r)}),cr.range;const Cs=te(r=>{r.setUTCMonth(0,1),r.setUTCHours(0,0,0,0)},(r,t)=>{r.setUTCFullYear(r.getUTCFullYear()+t)},(r,t)=>t.getUTCFullYear()-r.getUTCFullYear(),r=>r.getUTCFullYear());Cs.every=r=>!isFinite(r=Math.floor(r))||!(r>0)?null:te(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/r)*r),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e*r)}),Cs.range;function s2(r,t,e,i,s,n){const o=[[yn,1,ar],[yn,5,5*ar],[yn,15,15*ar],[yn,30,30*ar],[n,1,ti],[n,5,5*ti],[n,15,15*ti],[n,30,30*ti],[s,1,hr],[s,3,3*hr],[s,6,6*hr],[s,12,12*hr],[i,1,lr],[i,2,2*lr],[e,1,dd],[t,1,Py],[t,3,3*Py],[r,1,fd]];function a(l,c,u){const d=c<l;d&&([l,c]=[c,l]);const f=u&&typeof u.range=="function"?u:h(l,c,u),m=f?f.range(l,+c+1):[];return d?m.reverse():m}function h(l,c,u){const d=Math.abs(c-l)/u,f=Qu(([,,g])=>g).right(o,d);if(f===o.length)return r.every(td(l/fd,c/fd,u));if(f===0)return Ph.every(Math.max(td(l,c,u),1));const[m,p]=o[d/o[f-1][2]<o[f][2]/d?f-1:f];return m.every(p)}return[a,h]}const[n2,o2]=s2(cr,yd,Gh,wo,md,pd);function bd(r){if(0<=r.y&&r.y<100){var t=new Date(-1,r.m,r.d,r.H,r.M,r.S,r.L);return t.setFullYear(r.y),t}return new Date(r.y,r.m,r.d,r.H,r.M,r.S,r.L)}function xd(r){if(0<=r.y&&r.y<100){var t=new Date(Date.UTC(-1,r.m,r.d,r.H,r.M,r.S,r.L));return t.setUTCFullYear(r.y),t}return new Date(Date.UTC(r.y,r.m,r.d,r.H,r.M,r.S,r.L))}function So(r,t,e){return{y:r,m:t,d:e,H:0,M:0,S:0,L:0}}function a2(r){var t=r.dateTime,e=r.date,i=r.time,s=r.periods,n=r.days,o=r.shortDays,a=r.months,h=r.shortMonths,l=Co(s),c=Eo(s),u=Co(n),d=Eo(n),f=Co(o),m=Eo(o),p=Co(a),g=Eo(a),y=Co(h),_=Eo(h),b={a:Z,A:j,b:O,B:k,c:null,d:By,e:By,f:M2,g:W2,G:X2,H:I2,I:A2,j:R2,L:Wy,m:L2,M:P2,p:F,q:V,Q:Ky,s:Yy,S:G2,u:F2,U:N2,V:D2,w:k2,W:O2,x:null,X:null,y:B2,Y:U2,Z:Z2,"%":Hy},v={a:$,A:dt,b:ot,B:Et,c:null,d:Xy,e:Xy,f:Y2,g:rA,G:nA,H:V2,I:H2,j:K2,L:Zy,m:z2,M:j2,p:Mt,q:_t,Q:Ky,s:Yy,S:J2,u:$2,U:Q2,V:q2,w:tA,W:eA,x:null,X:null,y:iA,Y:sA,Z:oA,"%":Hy},w={a:G,A:N,b:P,B:I,c:D,d:ky,e:ky,f:w2,g:Dy,G:Ny,H:Oy,I:Oy,j:x2,L:T2,m:b2,M:_2,p:R,q:y2,Q:C2,s:E2,S:v2,u:d2,U:f2,V:p2,w:u2,W:m2,x:X,X:H,y:Dy,Y:Ny,Z:g2,"%":S2};b.x=C(e,b),b.X=C(i,b),b.c=C(t,b),v.x=C(e,v),v.X=C(i,v),v.c=C(t,v);function C(Y,tt){return function(et){var B=[],xt=-1,yt=0,Lt=Y.length,Zt,Xe,pi;for(et instanceof Date||(et=new Date(+et));++xt<Lt;)Y.charCodeAt(xt)===37&&(B.push(Y.slice(yt,xt)),(Xe=Fy[Zt=Y.charAt(++xt)])!=null?Zt=Y.charAt(++xt):Xe=Zt==="e"?" ":"0",(pi=tt[Zt])&&(Zt=pi(et,Xe)),B.push(Zt),yt=xt+1);return B.push(Y.slice(yt,xt)),B.join("")}}function E(Y,tt){return function(et){var B=So(1900,void 0,1),xt=A(B,Y,et+="",0),yt,Lt;if(xt!=et.length)return null;if("Q"in B)return new Date(B.Q);if("s"in B)return new Date(B.s*1e3+("L"in B?B.L:0));if(tt&&!("Z"in B)&&(B.Z=0),"p"in B&&(B.H=B.H%12+B.p*12),B.m===void 0&&(B.m="q"in B?B.q:0),"V"in B){if(B.V<1||B.V>53)return null;"w"in B||(B.w=1),"Z"in B?(yt=xd(So(B.y,0,1)),Lt=yt.getUTCDay(),yt=Lt>4||Lt===0?Nh.ceil(yt):Nh(yt),yt=gd.offset(yt,(B.V-1)*7),B.y=yt.getUTCFullYear(),B.m=yt.getUTCMonth(),B.d=yt.getUTCDate()+(B.w+6)%7):(yt=bd(So(B.y,0,1)),Lt=yt.getDay(),yt=Lt>4||Lt===0?Fh.ceil(yt):Fh(yt),yt=wo.offset(yt,(B.V-1)*7),B.y=yt.getFullYear(),B.m=yt.getMonth(),B.d=yt.getDate()+(B.w+6)%7)}else("W"in B||"U"in B)&&("w"in B||(B.w="u"in B?B.u%7:"W"in B?1:0),Lt="Z"in B?xd(So(B.y,0,1)).getUTCDay():bd(So(B.y,0,1)).getDay(),B.m=0,B.d="W"in B?(B.w+6)%7+B.W*7-(Lt+5)%7:B.w+B.U*7-(Lt+6)%7);return"Z"in B?(B.H+=B.Z/100|0,B.M+=B.Z%100,xd(B)):bd(B)}}function A(Y,tt,et,B){for(var xt=0,yt=tt.length,Lt=et.length,Zt,Xe;xt<yt;){if(B>=Lt)return-1;if(Zt=tt.charCodeAt(xt++),Zt===37){if(Zt=tt.charAt(xt++),Xe=w[Zt in Fy?tt.charAt(xt++):Zt],!Xe||(B=Xe(Y,et,B))<0)return-1}else if(Zt!=et.charCodeAt(B++))return-1}return B}function R(Y,tt,et){var B=l.exec(tt.slice(et));return B?(Y.p=c.get(B[0].toLowerCase()),et+B[0].length):-1}function G(Y,tt,et){var B=f.exec(tt.slice(et));return B?(Y.w=m.get(B[0].toLowerCase()),et+B[0].length):-1}function N(Y,tt,et){var B=u.exec(tt.slice(et));return B?(Y.w=d.get(B[0].toLowerCase()),et+B[0].length):-1}function P(Y,tt,et){var B=y.exec(tt.slice(et));return B?(Y.m=_.get(B[0].toLowerCase()),et+B[0].length):-1}function I(Y,tt,et){var B=p.exec(tt.slice(et));return B?(Y.m=g.get(B[0].toLowerCase()),et+B[0].length):-1}function D(Y,tt,et){return A(Y,t,tt,et)}function X(Y,tt,et){return A(Y,e,tt,et)}function H(Y,tt,et){return A(Y,i,tt,et)}function Z(Y){return o[Y.getDay()]}function j(Y){return n[Y.getDay()]}function O(Y){return h[Y.getMonth()]}function k(Y){return a[Y.getMonth()]}function F(Y){return s[+(Y.getHours()>=12)]}function V(Y){return 1+~~(Y.getMonth()/3)}function $(Y){return o[Y.getUTCDay()]}function dt(Y){return n[Y.getUTCDay()]}function ot(Y){return h[Y.getUTCMonth()]}function Et(Y){return a[Y.getUTCMonth()]}function Mt(Y){return s[+(Y.getUTCHours()>=12)]}function _t(Y){return 1+~~(Y.getUTCMonth()/3)}return{format:function(Y){var tt=C(Y+="",b);return tt.toString=function(){return Y},tt},parse:function(Y){var tt=E(Y+="",!1);return tt.toString=function(){return Y},tt},utcFormat:function(Y){var tt=C(Y+="",v);return tt.toString=function(){return Y},tt},utcParse:function(Y){var tt=E(Y+="",!0);return tt.toString=function(){return Y},tt}}}var Fy={"-":"",_:" ",0:"0"},ae=/^\s*\d+/,h2=/^%/,l2=/[\\^$*+?|[\]().{}]/g;function It(r,t,e){var i=r<0?"-":"",s=(i?-r:r)+"",n=s.length;return i+(n<e?new Array(e-n+1).join(t)+s:s)}function c2(r){return r.replace(l2,"\\$&")}function Co(r){return new RegExp("^(?:"+r.map(c2).join("|")+")","i")}function Eo(r){return new Map(r.map((t,e)=>[t.toLowerCase(),e]))}function u2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.w=+i[0],e+i[0].length):-1}function d2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.u=+i[0],e+i[0].length):-1}function f2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.U=+i[0],e+i[0].length):-1}function p2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.V=+i[0],e+i[0].length):-1}function m2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.W=+i[0],e+i[0].length):-1}function Ny(r,t,e){var i=ae.exec(t.slice(e,e+4));return i?(r.y=+i[0],e+i[0].length):-1}function Dy(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function g2(r,t,e){var i=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(e,e+6));return i?(r.Z=i[1]?0:-(i[2]+(i[3]||"00")),e+i[0].length):-1}function y2(r,t,e){var i=ae.exec(t.slice(e,e+1));return i?(r.q=i[0]*3-3,e+i[0].length):-1}function b2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.m=i[0]-1,e+i[0].length):-1}function ky(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.d=+i[0],e+i[0].length):-1}function x2(r,t,e){var i=ae.exec(t.slice(e,e+3));return i?(r.m=0,r.d=+i[0],e+i[0].length):-1}function Oy(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.H=+i[0],e+i[0].length):-1}function _2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.M=+i[0],e+i[0].length):-1}function v2(r,t,e){var i=ae.exec(t.slice(e,e+2));return i?(r.S=+i[0],e+i[0].length):-1}function T2(r,t,e){var i=ae.exec(t.slice(e,e+3));return i?(r.L=+i[0],e+i[0].length):-1}function w2(r,t,e){var i=ae.exec(t.slice(e,e+6));return i?(r.L=Math.floor(i[0]/1e3),e+i[0].length):-1}function S2(r,t,e){var i=h2.exec(t.slice(e,e+1));return i?e+i[0].length:-1}function C2(r,t,e){var i=ae.exec(t.slice(e));return i?(r.Q=+i[0],e+i[0].length):-1}function E2(r,t,e){var i=ae.exec(t.slice(e));return i?(r.s=+i[0],e+i[0].length):-1}function By(r,t){return It(r.getDate(),t,2)}function I2(r,t){return It(r.getHours(),t,2)}function A2(r,t){return It(r.getHours()%12||12,t,2)}function R2(r,t){return It(1+wo.count(cr(r),r),t,3)}function Wy(r,t){return It(r.getMilliseconds(),t,3)}function M2(r,t){return Wy(r,t)+"000"}function L2(r,t){return It(r.getMonth()+1,t,2)}function P2(r,t){return It(r.getMinutes(),t,2)}function G2(r,t){return It(r.getSeconds(),t,2)}function F2(r){var t=r.getDay();return t===0?7:t}function N2(r,t){return It(Gh.count(cr(r)-1,r),t,2)}function Uy(r){var t=r.getDay();return t>=4||t===0?bn(r):bn.ceil(r)}function D2(r,t){return r=Uy(r),It(bn.count(cr(r),r)+(cr(r).getDay()===4),t,2)}function k2(r){return r.getDay()}function O2(r,t){return It(Fh.count(cr(r)-1,r),t,2)}function B2(r,t){return It(r.getFullYear()%100,t,2)}function W2(r,t){return r=Uy(r),It(r.getFullYear()%100,t,2)}function U2(r,t){return It(r.getFullYear()%1e4,t,4)}function X2(r,t){var e=r.getDay();return r=e>=4||e===0?bn(r):bn.ceil(r),It(r.getFullYear()%1e4,t,4)}function Z2(r){var t=r.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+It(t/60|0,"0",2)+It(t%60,"0",2)}function Xy(r,t){return It(r.getUTCDate(),t,2)}function V2(r,t){return It(r.getUTCHours(),t,2)}function H2(r,t){return It(r.getUTCHours()%12||12,t,2)}function K2(r,t){return It(1+gd.count(Cs(r),r),t,3)}function Zy(r,t){return It(r.getUTCMilliseconds(),t,3)}function Y2(r,t){return Zy(r,t)+"000"}function z2(r,t){return It(r.getUTCMonth()+1,t,2)}function j2(r,t){return It(r.getUTCMinutes(),t,2)}function J2(r,t){return It(r.getUTCSeconds(),t,2)}function $2(r){var t=r.getUTCDay();return t===0?7:t}function Q2(r,t){return It(Gy.count(Cs(r)-1,r),t,2)}function Vy(r){var t=r.getUTCDay();return t>=4||t===0?xn(r):xn.ceil(r)}function q2(r,t){return r=Vy(r),It(xn.count(Cs(r),r)+(Cs(r).getUTCDay()===4),t,2)}function tA(r){return r.getUTCDay()}function eA(r,t){return It(Nh.count(Cs(r)-1,r),t,2)}function iA(r,t){return It(r.getUTCFullYear()%100,t,2)}function rA(r,t){return r=Vy(r),It(r.getUTCFullYear()%100,t,2)}function sA(r,t){return It(r.getUTCFullYear()%1e4,t,4)}function nA(r,t){var e=r.getUTCDay();return r=e>=4||e===0?xn(r):xn.ceil(r),It(r.getUTCFullYear()%1e4,t,4)}function oA(){return"+0000"}function Hy(){return"%"}function Ky(r){return+r}function Yy(r){return Math.floor(+r/1e3)}var _n,zy;aA({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function aA(r){return _n=a2(r),zy=_n.format,_n.parse,_n.utcFormat,_n.utcParse,_n}function hA(r){return new Date(r)}function lA(r){return r instanceof Date?+r:+new Date(+r)}function jy(r,t,e,i,s,n,o,a,h,l){var c=My(),u=c.invert,d=c.domain,f=l(".%L"),m=l(":%S"),p=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),_=l("%b %d"),b=l("%B"),v=l("%Y");function w(C){return(h(C)<C?f:a(C)<C?m:o(C)<C?p:n(C)<C?g:i(C)<C?s(C)<C?y:_:e(C)<C?b:v)(C)}return c.invert=function(C){return new Date(u(C))},c.domain=function(C){return arguments.length?d(Array.from(C,lA)):d().map(hA)},c.ticks=function(C){var E=d();return r(E[0],E[E.length-1],C??10)},c.tickFormat=function(C,E){return E==null?w:l(E)},c.nice=function(C){var E=d();return(!C||typeof C.range!="function")&&(C=t(E[0],E[E.length-1],C??10)),C?d(jI(E,C)):c},c.copy=function(){return Ry(c,jy(r,t,e,i,s,n,o,a,h,l))},c}function cA(){return Iy.apply(jy(n2,o2,cr,yd,Gh,wo,md,pd,yn,zy).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Io(r,t,e){this.k=r,this.x=t,this.y=e}Io.prototype={constructor:Io,scale:function(r){return r===1?this:new Io(this.k*r,this.x,this.y)},translate:function(r,t){return r===0&t===0?this:new Io(this.k,this.x+this.k*r,this.y+this.k*t)},apply:function(r){return[r[0]*this.k+this.x,r[1]*this.k+this.y]},applyX:function(r){return r*this.k+this.x},applyY:function(r){return r*this.k+this.y},invert:function(r){return[(r[0]-this.x)/this.k,(r[1]-this.y)/this.k]},invertX:function(r){return(r-this.x)/this.k},invertY:function(r){return(r-this.y)/this.k},rescaleX:function(r){return r.copy().domain(r.range().map(this.invertX,this).map(r.invert,r))},rescaleY:function(r){return r.copy().domain(r.range().map(this.invertY,this).map(r.invert,r))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Io.prototype;function Jy(r){return r.mode==="temporal"||r.mode==="left-aligned"?uA(r):dA(r)}function uA({domain:r,range:t}){return cA().domain(r).range(t)}function dA({domain:r,range:t}){return Ly().domain(r).range(t)}function _d(r){return{mode:ct.horizontal,range:$R(),domain:QR(r)}}function fA(){return{mode:ct.vertical}}let vn=null;async function pA(){const r=await Go();$y(r.start_time),nt.on("layoutSettingsUpdated",()=>$y(r.start_time))}function mA(){vn=null}async function Es(){return vn||await Fe("scaleCreated")}async function $y(r){await Ue();const t=vn?"scaleUpdated":"scaleCreated",e=_d(r);vn=Jy(e),nt.emit(t,vn)}let Le=null,vd=null;async function gA(){const r=await de(),t=await cu();Le=new JE({screenHeight:t.clientHeight,screenWidth:t.clientWidth,events:r.renderer.events,passiveWheel:!1}),Le.zIndex=1,Le.drag().pinch().wheel({trackpadPinch:!0}).decelerate({friction:.9}).clampZoom({minWidth:t.clientWidth/2}),Le.on("moved",()=>{nt.emit("viewportMoved",null)}).on("moved-end",()=>{nt.emit("viewportMoved",null)}),r.stage.addChild(Le),nt.emit("viewportCreated",Le),nt.on("applicationResized",vA),nt.on("scaleUpdated",()=>Dh()),xA()}function yA(){Le=null,vd=null}async function Td({animate:r}={}){const t=await we(),e=await Yt(),i=t.getChildByName(Cf);if(!i)throw new Error("Nodes container not found");const s=e.styles.guideTextSize+e.styles.guideTextTopPadding;SA();const{x:n,y:o,width:a,height:h}=i.getLocalBounds(),l=a+e.styles.columnGap*2,c=h+e.styles.rowGap*2+s*2,u=t.findFit(l,c);!a||!h||t.animate({position:{x:n+a/2,y:o+h/2-s},scale:Math.min(u,1),time:r?e.animationDuration:0,ease:"easeInOutQuad",removeOnInterrupt:!0,callbackOnComplete:()=>{wd(),Dh()}})}async function we(){return Le||await Fe("viewportCreated")}function Qy(r){sy(vd,r)||(vd=r,nt.emit("viewportDateRangeUpdated",r))}function bA({xOffset:r,yOffset:t}){if(!Le)return;const{x:e,y:i}=Le.transform.position;Le.setTransform(e+r,i+t,Le.transform.scale.x,Le.transform.scale.y)}async function xA(){const r=await we();Dh(),r.on("moved",()=>Dh())}async function Dh(){const r=await qy();r&&Qy(r)}async function qy(){const r=await we(),t=await Es(),e=t.invert(r.left),i=t.invert(r.right);return e instanceof Date&&i instanceof Date?[e,i]:null}async function _A(r){const t=await qy(),e=await Ue();if(r===void 0||e.isDependency()||sy(r,t))return;const i=await we(),s=await Es(),[n,o]=r,a=s(n),h=s(o),l=a+(h-a)/2;Qy(r),i.fitWidth(h-a,!0),i.moveCenter(l,i.center.y)}async function vA(){const r=await de(),t=await we(),e=await cu(),i=t.screenWidth,s=t.screenHeight,n=e.clientWidth,o=e.clientHeight,a=(n-i)/2,h=(o-s)/2;t.resize(r.screen.width,r.screen.height),bA({xOffset:a,yOffset:h})}class kh{constructor(){yf(this,"status","visible");yf(this,"labels",new Set)}get visible(){return this.status==="visible"}get hidden(){return this.status==="hidden"}show(){if(this.status!=="visible"){for(const t of this.labels)t.visible=!0;this.status="visible"}}hide(){if(this.status!=="hidden"){for(const t of this.labels)t.visible=!1;this.status="hidden"}}toggle(t){t?this.show():this.hide()}add(t){this.labels.add(t),t.visible=this.visible}clear(){this.labels.clear()}}let Oi=null,ei=null,Bi=null,ur=null,fi=null;async function TA(){const r=await we(),t=await de();Oi=new bE({toggle:"renderable"}),ei=new kh,Bi=new kh,fi=new kh,ur=new kh,t.ticker.add(()=>{if(r.dirty){const e=r.scale.x>.1,i=r.scale.x>.2,s=r.scale.x>.2,n=r.scale.x>.2;fi==null||fi.toggle(e),ei==null||ei.toggle(i),Bi==null||Bi.toggle(s),ur==null||ur.toggle(n),Oi==null||Oi.cull(t.renderer.screen),r.dirty=!1}}),nt.emit("cullCreated",Oi),nt.emit("labelCullCreated",ei),nt.emit("iconCullCreated",ei),nt.emit("edgeCullCreated",fi),nt.emit("toggleCullCreated",ur)}function wA(){Oi=null,ei==null||ei.clear(),ei=null,Bi==null||Bi.clear(),Bi=null,fi==null||fi.clear(),fi=null,ur==null||ur.clear(),ur=null}async function wd(){const r=await we();r.dirty=!0}function SA(){Oi&&Oi.uncull()}async function tb(){return Oi||await Fe("cullCreated")}async function CA(){return fi||await Fe("edgeCullCreated")}async function eb(){return ei||await Fe("labelCullCreated")}async function EA(){return Bi||await Fe("iconCullCreated")}async function ib(){const r=await Ue(),t=await Yt();function e(i,s,n){const a=r.disableAnimations||n?0:t.animationDuration/1e3;return ry.to(i,{...s,duration:a,ease:"power1.out",onUpdate:()=>{wd()}})}return{animate:e}}let Oh=new Map;function IA(){Oh=new Map}async function Bh(r,t){const e=`${r.toString()}-${JSON.stringify(t)}`;if(Oh.has(e))return Oh.get(e);const i=await r(...t);return Oh.set(e,i),i}async function AA({size:r,stroke:t=1,radius:e=0}){const i=await de(),s=new io;return s.lineStyle(t,"#fff",1,0),s.drawRoundedRect(0,0,r*2,r*2,e),i.renderer.generateTexture(s,{region:new pt(0,0,r,r),resolution:10})}async function rb(r){return await Bh(AA,[r])}var Wh=(r=>(r[r.Up=0]="Up",r[r.Down=180]="Down",r[r.Left=270]="Left",r[r.Right=90]="Right",r))(Wh||{});function sb(){const r=new qt;async function t(e){const{rotate:i=0}=e,s={size:e.size,radius:e.radius,stroke:e.stroke},n=await rb(s);return r.texture=n,r.anchor.set(.5,.5),r.angle=45+i,r}return{element:r,render:t}}async function RA(){const r=await de(),t=new io;return t.beginFill("#fff"),t.drawRect(0,0,1,1),t.endFill(),r.renderer.generateTexture(t,{wrapMode:_i.REPEAT})}async function Sd(){return await Bh(RA,[])}function Cd(r,t){return Array.from({length:r},(e,i)=>t(i))}const MA=8,LA=2;async function PA(){const r=await Yt(),t=await tb(),e=await CA(),{animate:i}=await ib(),s=new At,{element:n,render:o}=await sb(),a=await Sd(),h=Cd(20,()=>new ut),l=new uS(a,h);let c=!1;s.name=Ob,s.addChild(n),s.addChild(l),t.addAll([n,l]),e.add(s);async function u(){return await o({size:10,rotate:Wh.Right}),n.tint=r.styles.edgeColor,l.tint=r.styles.edgeColor,s}async function d(m,p){const g=f(p);c||await u();for(const[y,_]of h.entries()){const{x:b,y:v}=g[y];i(_,{x:b,y:v},!c)}i(s,{x:m.x,y:m.y},!c),i(n,{x:p.x-MA,y:p.y},!c),c=!0}function f({x:m,y:p}){const g=[],y={x:0,y:0},_={x:m-LA,y:p},b={x:nb(y.x,{source:y,target:_}),y:y.y},v={x:nb(_.x,{source:y,target:_},!0),y:_.y};for(const[w]of h.entries()){if(w===h.length-1){g[w]=_;continue}const C=GA(w,{source:y,target:_,sourceBezier:b,targetBezier:v});g[w]=C}return g}return{element:s,render:u,setPosition:d}}function nb(r,{source:t,target:e},i){const s=(e.x-t.x)/2;return r+(s>64?s:64)*(i?-1:1)}function GA(r,t){const e=r/20,{source:i,target:s,sourceBezier:n,targetBezier:o}=t,a=i.x+(n.x-i.x)*e,h=i.y+(n.y-i.y)*e,l=n.x+(o.x-n.x)*e,c=n.y+(o.y-n.y)*e,u=o.x+(s.x-o.x)*e,d=o.y+(s.y-o.y)*e,f=a+(l-a)*e,m=h+(c-h)*e,p=l+(u-l)*e,g=c+(d-c)*e,y=f+(p-f)*e,_=m+(g-m)*e;return{x:y,y:_}}async function FA({height:r,radius:t}){const e=await de(),i=new io;return i.beginFill("#fff"),i.drawRoundedRect(0,0,t*2,r,t),i.endFill(),e.renderer.generateTexture(i,{region:new pt(0,0,t,r),resolution:10})}async function NA(r){return await Bh(FA,[r])}function DA(){const r=new qt,t=new qt;async function e(i){const s=await NA(i);return r.texture=s,t.texture=s,t.anchor.x=1,t.scale.x=-1,{left:r,right:t}}return{left:r,right:t,render:e}}async function Ao(){const r=await Sd();return new qt(r)}async function Ed(){const r=new At,t=await Ao(),{left:e,right:i,render:s}=await DA();r.addChild(t),r.addChild(e),r.addChild(i);async function n(h){const{width:l,x:c,visible:u}=a(h);return await s({height:h.height,radius:h.radius}),t.visible=u,t.width=l,t.height=h.height,t.x=c,e.visible=o(h.capLeft,h.radius),i.visible=o(h.capRight,h.radius),i.x=h.radius+l,t.tint=h.background,e.tint=h.background,i.tint=h.background,r}function o(h,l){return l===0?!1:h??!0}function a(h){const l=o(h.capLeft,h.radius),c=o(h.capRight,h.radius);let u=0;l&&(u+=h.radius),c&&(u+=h.radius);const d=Math.max(h.width-u,0),f=d>0,m=l?h.radius:0;return{width:d,visible:f,x:m}}return{element:r,render:n}}function Id(){const r=new At,t=new qt,e=new qt,i=new qt,s=new qt,n=new qt,o=new qt,a=new qt,h=new qt;t.name="border-corner-top-left",e.name="border-corner-top-right",i.name="border-corner-bottom-left",s.name="border-corner-bottom-right",n.name="border-corner-left",o.name="border-corner-right",a.name="border-corner-top",h.name="border-corner-bottom",e.anchor.x=1,e.scale.x=-1,i.anchor.y=1,i.scale.y=-1,s.anchor.x=1,s.scale.x=-1,s.anchor.y=1,s.scale.y=-1,r.addChild(t),r.addChild(e),r.addChild(i),r.addChild(s),r.addChild(n),r.addChild(o),r.addChild(a),r.addChild(h);async function l(f){const{radius:m=0,color:p="#fff",stroke:g,width:y,height:_}=f,b=Math.min(y,_),v=m*2>b?b/2:m,C=await rb({size:v,radius:m,stroke:g}),E=await Sd();return c({texture:C,width:y,height:_,size:v}),u({texture:E,width:y,height:_,size:v,stroke:g}),d(p),r}function c({texture:f,width:m,height:p,size:g}){t.texture=f,e.texture=f,i.texture=f,s.texture=f,t.position.set(0,0),e.position.set(m-g,0),i.position.set(0,p-g),s.position.set(m-g,p-g)}function u({texture:f,size:m,width:p,height:g,stroke:y}){const _=Math.max(g-m*2,0),b=Math.max(p-m*2,0);a.texture=f,n.texture=f,o.texture=f,h.texture=f,n.position.set(0,m),n.height=_,n.width=y,o.position.set(p-y,m),o.height=_,o.width=y,a.position.set(m,0),a.width=b,a.height=y,h.position.set(m,g-y),h.width=b,h.height=y}function d(f){t.tint=f,e.tint=f,i.tint=f,s.tint=f,a.tint=f,n.tint=f,o.tint=f,h.tint=f}return{element:r,render:l}}async function ob(){const r=await Yt(),t=new At,{element:e,render:i}=await Id();async function s({selected:n,width:o,height:a}){if(!n)return t.removeChild(e),t;const{selectedBorderColor:h,selectedBorderWidth:l,selectedBorderOffset:c,selectedBorderRadius:u}=r.styles;return e.position.set(-c,-c),t.addChild(e),await i({stroke:l,radius:u,width:o+c*2,height:a+c*2,color:h}),t}return{element:t,render:s}}async function kA(){const r=await Yt(),t=new At,{element:e,render:i}=await Ed(),{element:s,render:n}=await ob();t.addChild(e),t.addChild(s);async function o({selected:a,width:h,height:l}){const{artifactBgColor:c,artifactBorderRadius:u}=r.styles,d={width:h,height:l,background:c,radius:u,capLeft:!0,capRight:!0};return await Promise.all([i(d),n({selected:a,width:h,height:l})]),t}return{element:t,render:o}}const OA=Object.freeze(Object.defineProperty({__proto__:null,Artifact:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15.7984%207.99134L12.7215%2012.9913C12.5599%2013.2539%2012.2797%2013.4202%2011.9718%2013.4362C11.664%2013.4523%2011.3679%2013.3159%2011.18%2013.0716L9.25692%2010.5716L10.7431%209.4284L11.8372%2010.8508L14.2016%207.00866L15.7984%207.99134Z'%20fill='white'/%3e%3c/svg%3e",ArtifactMarkdown:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM15%207.1875H10V5.3125H15V7.1875ZM15%2010.9375H10V9.0625H15V10.9375ZM10%2014.6875H12.5V12.8125H10V14.6875Z'%20fill='white'/%3e%3c/svg%3e",ArtifactResult:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM9.52483%206.61458C9.7035%205.94774%2010.3889%205.55202%2011.0558%205.73069C11.7226%205.90937%2012.1183%206.59479%2011.9396%207.26162C11.761%207.92846%2011.0755%208.32418%2010.4087%208.14551C9.74188%207.96683%209.34615%207.28141%209.52483%206.61458ZM13.0604%2012.7383C13.239%2012.0715%2013.9245%2011.6757%2014.5913%2011.8544C15.2581%2012.0331%2015.6539%2012.7185%2015.4752%2013.3854C15.2965%2014.0522%2014.6111%2014.4479%2013.9442%2014.2692C13.2774%2014.0906%2012.8817%2013.4051%2013.0604%2012.7383ZM10.78%2014.27L15.78%206.77002L14.2199%205.72996L9.21995%2013.23L10.78%2014.27Z'%20fill='white'/%3e%3c/svg%3e",ArtifactTable:"data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.5%203.875C7.5%203.11561%208.11561%202.5%208.875%202.5H16.125C16.8844%202.5%2017.5%203.11561%2017.5%203.875V16.125C17.5%2016.8844%2016.8844%2017.5%2016.125%2017.5H8.875C8.11561%2017.5%207.5%2016.8844%207.5%2016.125V10.9375H6.66449C6.31341%2011.6765%205.56012%2012.1875%204.6875%2012.1875C3.47938%2012.1875%202.5%2011.2081%202.5%2010C2.5%208.79188%203.47938%207.8125%204.6875%207.8125C5.56012%207.8125%206.31341%208.32345%206.66449%209.0625H7.5V3.875ZM10%207.1875H11.875V5.3125H10V7.1875ZM10%2010.9375H11.875V9.0625H10V10.9375ZM11.875%2014.6875H10V12.8125H11.875V14.6875ZM13.125%207.1875H15V5.3125H13.125V7.1875ZM15%2010.9375H13.125V9.0625H15V10.9375ZM13.125%2014.6875H15V12.8125H13.125V14.6875Z'%20fill='white'/%3e%3c/svg%3e"},Symbol.toStringTag,{value:"Module"}));function BA(r){const t={resolution:4};return rt.from(OA[r],t)}async function WA(r){return await Bh(BA,[r])}async function UA({cullAtZoomThreshold:r=!0}={}){const t=await EA(),e=new qt;r&&t.add(e);async function i(s){const n=await WA(s);return e.texture=n,e}return{element:e,render:i}}var ab={exports:{}};(function(r){(function(){function t(p,g){document.addEventListener?p.addEventListener("scroll",g,!1):p.attachEvent("scroll",g)}function e(p){document.body?p():document.addEventListener?document.addEventListener("DOMContentLoaded",function g(){document.removeEventListener("DOMContentLoaded",g),p()}):document.attachEvent("onreadystatechange",function g(){(document.readyState=="interactive"||document.readyState=="complete")&&(document.detachEvent("onreadystatechange",g),p())})}function i(p){this.g=document.createElement("div"),this.g.setAttribute("aria-hidden","true"),this.g.appendChild(document.createTextNode(p)),this.h=document.createElement("span"),this.i=document.createElement("span"),this.m=document.createElement("span"),this.j=document.createElement("span"),this.l=-1,this.h.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.i.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.j.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.m.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.h.appendChild(this.m),this.i.appendChild(this.j),this.g.appendChild(this.h),this.g.appendChild(this.i)}function s(p,g){p.g.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+g+";"}function n(p){var g=p.g.offsetWidth,y=g+100;return p.j.style.width=y+"px",p.i.scrollLeft=y,p.h.scrollLeft=p.h.scrollWidth+100,p.l!==g?(p.l=g,!0):!1}function o(p,g){function y(){var b=_;n(b)&&b.g.parentNode!==null&&g(b.l)}var _=p;t(p.h,y),t(p.i,y),n(p)}function a(p,g,y){g=g||{},y=y||window,this.family=p,this.style=g.style||"normal",this.weight=g.weight||"normal",this.stretch=g.stretch||"normal",this.context=y}var h=null,l=null,c=null,u=null;function d(p){return l===null&&(f(p)&&/Apple/.test(window.navigator.vendor)?(p=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent),l=!!p&&603>parseInt(p[1],10)):l=!1),l}function f(p){return u===null&&(u=!!p.document.fonts),u}function m(p,g){var y=p.style,_=p.weight;if(c===null){var b=document.createElement("div");try{b.style.font="condensed 100px sans-serif"}catch{}c=b.style.font!==""}return[y,_,c?p.stretch:"","100px",g].join(" ")}a.prototype.load=function(p,g){var y=this,_=p||"BESbswy",b=0,v=g||3e3,w=new Date().getTime();return new Promise(function(C,E){if(f(y.context)&&!d(y.context)){var A=new Promise(function(G,N){function P(){new Date().getTime()-w>=v?N(Error(""+v+"ms timeout exceeded")):y.context.document.fonts.load(m(y,'"'+y.family+'"'),_).then(function(I){1<=I.length?G():setTimeout(P,25)},N)}P()}),R=new Promise(function(G,N){b=setTimeout(function(){N(Error(""+v+"ms timeout exceeded"))},v)});Promise.race([R,A]).then(function(){clearTimeout(b),C(y)},E)}else e(function(){function G(){var V;(V=X!=-1&&H!=-1||X!=-1&&Z!=-1||H!=-1&&Z!=-1)&&((V=X!=H&&X!=Z&&H!=Z)||(h===null&&(V=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),h=!!V&&(536>parseInt(V[1],10)||parseInt(V[1],10)===536&&11>=parseInt(V[2],10))),V=h&&(X==j&&H==j&&Z==j||X==O&&H==O&&Z==O||X==k&&H==k&&Z==k)),V=!V),V&&(F.parentNode!==null&&F.parentNode.removeChild(F),clearTimeout(b),C(y))}function N(){if(new Date().getTime()-w>=v)F.parentNode!==null&&F.parentNode.removeChild(F),E(Error(""+v+"ms timeout exceeded"));else{var V=y.context.document.hidden;(V===!0||V===void 0)&&(X=P.g.offsetWidth,H=I.g.offsetWidth,Z=D.g.offsetWidth,G()),b=setTimeout(N,50)}}var P=new i(_),I=new i(_),D=new i(_),X=-1,H=-1,Z=-1,j=-1,O=-1,k=-1,F=document.createElement("div");F.dir="ltr",s(P,m(y,"sans-serif")),s(I,m(y,"serif")),s(D,m(y,"monospace")),F.appendChild(P.g),F.appendChild(I.g),F.appendChild(D.g),y.context.document.body.appendChild(F),j=P.g.offsetWidth,O=I.g.offsetWidth,k=D.g.offsetWidth,N(),o(P,function(V){X=V,G()}),s(P,m(y,'"'+y.family+'",sans-serif')),o(I,function(V){H=V,G()}),s(I,m(y,'"'+y.family+'",serif')),o(D,function(V){Z=V,G()}),s(D,m(y,'"'+y.family+'",monospace'))})})},r.exports=a})()})(ab);var XA=ab.exports;const ZA=Ds(XA),hb={inter:{fontFamily:"InterVariable",fontSize:16,lineHeight:20,fill:16777215}},lb={resolution:4,chars:ui.ASCII},cb="sans-serif",ub={inter:YA(hb.inter)};let Ad=!1;async function VA(){const r=Object.values(hb);await Promise.all(r.map(t=>HA(t))),Ad=!0,nt.emit("fontsLoaded",ub)}async function HA(r){const{fontFamily:t,...e}=r,i=new ZA(t);try{await i.load()}catch(s){console.error(s),console.warn(`fonts: font ${t} failed to load, falling back to ${cb}`),ui.from(t,{fontFamily:cb,...e},lb);return}ui.from(t,r,lb)}function KA(){Ad=!1}async function db(){return Ad?ub:await Fe("fontsLoaded")}function YA(r){const{fontFamily:t,...e}=r,i={fontName:t,...e};return s=>new BS(s,i)}async function Rd({cullAtZoomThreshold:r=!0}={}){const{inter:t}=await db(),e=await eb(),i=t("");r&&e.add(i);async function s(n){return i.text=n,await i}return{element:i,render:s}}const zA=["result","markdown","table","unknown"],fb={markdown:"ArtifactMarkdown",table:"ArtifactTable",result:"ArtifactResult",unknown:"Artifact"},Uh=["flow-run","task-run"];function jA(r){return Uh.includes(r)}function Md(r){return Uh.includes(r.kind)}function pb(r){return r.kind==="artifact"}function mb(r){return r.kind==="artifacts"}async function gb({cullAtZoomThreshold:r}){const t=await Yt(),e=new At,i=new At,{element:s,render:n}=await UA({cullAtZoomThreshold:r}),{element:o,render:a}=await Rd({cullAtZoomThreshold:r}),{element:h,render:l}=await kA();let c=!1,u=null,d=null;i.addChild(s),i.addChild(o),e.addChild(h),e.addChild(i);async function f(y){if(y){const{selected:_,name:b,type:v}=y;c=_??c,u=b??u,d=v??d}return await Promise.all([m(),p()]),await g(),e}async function m(){if(!d)return s;const y=fb[d],{artifactIconSize:_,artifactIconColor:b,artifactPaddingLeft:v,artifactPaddingY:w}=t.styles,C=await n(y);return C.position={x:v,y:w},C.width=_,C.height=_,C.tint=b,C}async function p(){if(!u)return o.visible=!1,o;await a(u);const{artifactPaddingLeft:y,artifactPaddingY:_,artifactTextColor:b,artifactIconSize:v,artifactContentGap:w}=t.styles,C=y+v+w,E=_;return o.tint=b,o.scale.set(.75),o.position={x:C,y:E},o.visible=!0,o}async function g(){const{artifactPaddingLeft:y,artifactPaddingRight:_,artifactPaddingY:b}=t.styles,v={selected:c,width:i.width+y+_,height:i.height+b*2};return await l(v)}return{element:e,render:f}}let ge=null,Xh=!1;async function JA(){const r=await we();r.on("click",()=>Ro(null)),r.on("drag-start",()=>{Xh=!0}),r.on("drag-end",()=>{setTimeout(()=>{Xh=!1})})}function $A(){ge=null,Xh=!1}function Ro(r){if(!Xh&&!(!r&&!ge||r&&Mo(r))){if(ge=r,r===null){nt.emit("itemSelected",null);return}nt.emit("itemSelected",r)}}function Mo(r){if(ge===null)return!1;const{kind:t}=r;switch(t){case"task-run":return Md(ge)&&ge.id===r.id;case"flow-run":return Md(ge)&&ge.id===r.id;case"artifact":return pb(ge)&&ge.id===r.id;case"artifacts":return mb(ge)&&ge.ids.length===r.ids.length&&ge.ids.every(i=>r.ids.includes(i));default:const e=t;throw new Error(`switch does not have case for value: ${e}`)}}function QA(){return ge&&Uh.includes(ge.kind)?ge:null}async function yb(r,{cullAtZoomThreshold:t=!0}={}){const{element:e,render:i}=await gb({cullAtZoomThreshold:t});let s=!1;e.eventMode="static",e.cursor="pointer",e.on("click",l=>{l.stopPropagation(),Ro({kind:"artifact",id:r.id})}),nt.on("itemSelected",()=>{const l=Mo({kind:"artifact",id:r.id});l!==s&&(s=l,n())});async function n(){await i({selected:s,name:r.key,type:r.type})}function o(){return s}function a(){return r.created}function h(){return r.id}return{element:e,render:n,getSelected:o,getDate:a,getId:h}}async function qA(){const r=await Yt(),t=await eb(),e=new At,{element:i,render:s}=await sb(),{element:n,render:o}=await Ed(),{element:a,render:h}=await Id();t.add(e);let l=!1;e.eventMode="static",e.cursor="pointer",e.addChild(n),e.addChild(i),e.addChild(a),e.on("mouseover",u),e.on("mouseout",d);async function c({inside:f,isOpen:m}){l=f;const p={size:10,stroke:2,rotate:m?Wh.Up:Wh.Down},g=await s(p),y={width:r.styles.nodeToggleSize,height:r.styles.nodeToggleSize,background:r.styles.nodeToggleBgColor,radius:r.styles.nodeToggleBorderRadius},_=await o(y);_.alpha=f?0:.5;const b=await h({width:y.width,height:y.height,radius:y.radius,stroke:1,color:r.styles.nodeToggleBorderColor});b.alpha=f?0:1;const v={y:_.height/2,x:_.width/2},w=p.size/4;return g.x=v.x,g.y=m?v.y+w:v.y-w,e}function u(){n.alpha=l?.5:1}function d(){n.alpha=l?0:.5}return{element:e,render:c}}async function bb(){const r=await Yt(),t=await Ue(),e=new At,{element:i,render:s}=await Ed(),{element:n,render:o}=await ob();e.addChild(i),e.addChild(n);async function a(l){const{background:c="#fff"}=r.styles.node(l),{nodeHeight:u,nodeRadius:d}=r.styles,f=Mo({kind:l.kind,id:l.id}),m=h(l,d),p=l.state_type!=="RUNNING"||t.isDependency();return await Promise.all([s({width:m,height:u,radius:d,background:c,capRight:p}),o({selected:f,width:m,height:u})]),i}function h(l,c){const u=Pd();if(ct.isTemporal()||ct.isLeftAligned()){const d=l.start_time,f=l.end_time??new Date,p=Ef(f,d)/ta*u;return Math.max(p,c*2)}return u}return{element:e,render:a}}class xb extends At{updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t<e;++t)this.children[t].updateTransform()}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(const t of this.children)if(t.calculateBounds(),t._mask){const e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds);this._bounds.updateID=this._boundsID}}async function tR(r){const t=new xb,e=await Yt(),{element:i,render:s}=await bb(),{element:n,render:o}=await Rd(),{element:a,render:h,getSize:l,stopWorker:c}=await Mb(),{element:u,render:d}=await qA(),{element:f,render:m}=await Id(),{start:p,stop:g}=await U0(r.id,P=>{h(P)});let y=r,_=!1;t.addChild(f),t.addChild(i),t.addChild(n),t.addChild(u),u.on("click",P=>{P.stopPropagation(),v()}),a.position={x:0,y:e.styles.nodeHeight+e.styles.nodesPadding},a.on("rendered",()=>{wd(),G()});async function b(P){return y=P,await s(P),await A(),await R(P),await w(P),t}async function v(){_?await E():await C()}async function w(P){const{background:I="#fff"}=e.styles.node(P),D=4,{width:X,height:H}=l(),Z=H+e.styles.nodeHeight+e.styles.nodesPadding*2+D*2,j=e.styles.nodeHeight,O=_?-D:D,k=Math.max(i.width,X),F=_?k+D*2:i.width-D*2;(await m({width:F,height:_?Z:j,stroke:_?2:1,radius:e.styles.nodeBorderRadius,color:I})).position.set(O,O)}async function C(){_=!0,t.addChild(a),await Promise.all([p(),b(y)]),G()}async function E(){_=!1,t.removeChild(a),c(),await Promise.all([g(),b(y)]),G()}async function A(){const P=e.styles.nodeToggleSize,I=e.styles.nodeHeight-P,D=i.width>P,X=await d({inside:D,isOpen:_});return X.x=D?I/2:i.width+e.styles.nodePadding,X.y=I/2,X}async function R(P){const I=await o(P.label),D=e.styles.colorMode==="dark"?e.styles.textDefault:e.styles.textInverse,X=e.styles.nodePadding,H=u.x+u.width+X,Z=i.width+X,j=i.width>H+I.width+X,O=e.styles.nodeHeight/2-I.height/2,k=j?H:Math.max(Z,H);return I.position={x:k,y:O},I.tint=j?D:e.styles.textDefault,I}function G(){w(y);const P=N();t.emit("resized",P)}function N(){const P=l(),I=_?P.height+e.styles.nodesPadding*2:0,D=_?P.width:0;return{height:e.styles.nodeHeight+I,width:Math.max(D,t.width)}}return{kind:"flow-run",element:t,bar:i,render:b}}async function eR(){const r=await Yt(),t=new xb,{element:e,render:i}=await Rd(),{element:s,render:n}=await bb();t.addChild(s),t.addChild(e);async function o(h){return await Promise.all([n(h),i(h.label)]),a(),t}function a(){const h=r.styles.colorMode==="dark"?r.styles.textDefault:r.styles.textInverse,l=r.styles.nodePadding,c=s.width>l+e.width+l,u=c?l:s.width+l,d=r.styles.nodeHeight/2-e.height/2;e.position={x:u,y:d},e.tint=c?h:r.styles.textDefault}return{kind:"task-run",element:t,render:o,bar:s}}var _b="Expected a function",vb=NaN,iR="[object Symbol]",rR=/^\s+|\s+$/g,sR=/^[-+]0x[0-9a-f]+$/i,nR=/^0b[01]+$/i,oR=/^0o[0-7]+$/i,aR=parseInt,hR=typeof xe=="object"&&xe&&xe.Object===Object&&xe,lR=typeof self=="object"&&self&&self.Object===Object&&self,cR=hR||lR||Function("return this")(),uR=Object.prototype,dR=uR.toString,fR=Math.max,pR=Math.min,Ld=function(){return cR.Date.now()};function mR(r,t,e){var i,s,n,o,a,h,l=0,c=!1,u=!1,d=!0;if(typeof r!="function")throw new TypeError(_b);t=Tb(t)||0,Zh(e)&&(c=!!e.leading,u="maxWait"in e,n=u?fR(Tb(e.maxWait)||0,t):n,d="trailing"in e?!!e.trailing:d);function f(C){var E=i,A=s;return i=s=void 0,l=C,o=r.apply(A,E),o}function m(C){return l=C,a=setTimeout(y,t),c?f(C):o}function p(C){var E=C-h,A=C-l,R=t-E;return u?pR(R,n-A):R}function g(C){var E=C-h,A=C-l;return h===void 0||E>=t||E<0||u&&A>=n}function y(){var C=Ld();if(g(C))return _(C);a=setTimeout(y,p(C))}function _(C){return a=void 0,d&&i?f(C):(i=s=void 0,o)}function b(){a!==void 0&&clearTimeout(a),l=0,i=h=s=a=void 0}function v(){return a===void 0?o:_(Ld())}function w(){var C=Ld(),E=g(C);if(i=arguments,s=this,h=C,E){if(a===void 0)return m(h);if(u)return a=setTimeout(y,t),f(h)}return a===void 0&&(a=setTimeout(y,t)),o}return w.cancel=b,w.flush=v,w}function gR(r,t,e){var i=!0,s=!0;if(typeof r!="function")throw new TypeError(_b);return Zh(e)&&(i="leading"in e?!!e.leading:i,s="trailing"in e?!!e.trailing:s),mR(r,t,{leading:i,maxWait:t,trailing:s})}function Zh(r){var t=typeof r;return!!r&&(t=="object"||t=="function")}function yR(r){return!!r&&typeof r=="object"}function bR(r){return typeof r=="symbol"||yR(r)&&dR.call(r)==iR}function Tb(r){if(typeof r=="number")return r;if(bR(r))return vb;if(Zh(r)){var t=typeof r.valueOf=="function"?r.valueOf():r;r=Zh(t)?t+"":t}if(typeof r!="string")return r===0?r:+r;r=r.replace(rR,"");var e=nR.test(r);return e||oR.test(r)?aR(r.slice(2),e?2:8):sR.test(r)?vb:+r}var xR=gR;const _R=Ds(xR);async function vR(){const{element:r,render:t}=await gb({cullAtZoomThreshold:!1});let e=null,i=[],s=!1;r.eventMode="static",r.cursor="pointer",r.on("click",l=>{l.stopPropagation();const c={x:r.position.x,y:r.position.y,width:r.width,height:r.height};Ro({kind:"artifacts",ids:i,position:c})}),nt.on("itemSelected",()=>{const l=Mo({kind:"artifacts",ids:i});l!==s&&e&&(s=l,n({ids:i,date:e}))});async function n(l){if(!l){e=null,i=[],r.visible=!1;return}const{ids:c,date:u}=l;e=u,i=c,await t({selected:s,type:"unknown",name:c.length.toString()}),r.visible=!0}function o(){return s}function a(){return e}function h(){return i}return{element:r,render:n,getSelected:o,getDate:a,getIds:h,isCluster:!0}}async function wb(r){const t=await de(),e=await we(),i=await Yt(),s=await Ue();let n=await Es();const o=await h();nt.on("scaleUpdated",c=>{n=c,l()}),nt.on("viewportMoved",()=>l());async function a(c){await o.render(c),l()}async function h(){return r.type==="artifact"?await yb(r.artifact,{cullAtZoomThreshold:!1}):await vR()}function l(){const c=o.getDate();if(!c||!ct.isTemporal()||s.disableArtifacts)return;const u=o.getSelected(),{element:d}=o;let f=0;if(u){const{selectedBorderOffset:y,selectedBorderWidth:_}=i.styles;f=y+_*2}const p=n(c)*e.scale._x+e.worldTransform.tx-(d.width-f)/2,g=t.screen.height-(d.height-f)-10;d.position.set(p,g)}return{...o,render:a}}async function TR(){const r=await de(),t=await we(),e=await Yt(),i=await Ue(),s=new Map,n=[];let o=null,a=null,h=!1;nt.on("viewportMoved",()=>d());async function l(b){if(o&&(o.visible=!i.disableArtifacts),i.disableArtifacts||(b&&(a=b),!a))return;o||u();const v=[];for(const w of a)v.push(c(w));await Promise.all(v)}async function c(b){if(s.has(b.id))return s.get(b.id).render();const v=await wb({type:"artifact",artifact:b});return s.set(b.id,v),o.addChild(v.element),v.render()}function u(){o=new At,o.zIndex=3,r.stage.addChild(o)}function d(){if(!(!o||i.disableArtifacts)){if(!ct.isTemporal()){h||(y(),_(),h=!0),o.position.x=t.scale._x+t.worldTransform.tx;return}h=!1,o.position.x=0,f()}}const f=_R(async()=>{const b=[...s.values()],v=[...n];b.sort((w,C)=>w.element.x-C.element.x),await m(b,v);for(const w of v)w.render()},250);async function m(b,v,w){let C,E=null,A=null;for(let R=w??0;R<b.length;R++){const G=b[R],N=G.element.x;if(G.element.visible=!0,E!==null&&C&&N<C){A=R;break}E=R,C=N+G.element.width}if(A!==null&&E!==null){const R=b[E],G=b[A];R.element.visible=!1,G.element.visible=!1;const N=await p(R,G,v);N&&(b.splice(E,1,N),b.splice(A,1)),m(b,v,E)}}async function p(b,v,w){const C=b.getDate(),E=v.getDate(),A="getId"in b?[b.getId()]:b.getIds(),R="getId"in v?[v.getId()]:v.getIds();if(!C||!E)return console.error("flowRunArtifacts: visible item is missing date"),null;let G;if("isCluster"in b)G=b;else if("isCluster"in v)G=v;else if(w.length>0)G=w.pop();else{const I=await wb({type:"cluster"});o.addChild(I.element),n.push(I),G=I}const N=[...A,...R],P=g(N);return G.render({ids:N,date:P}),G}function g(b){const v=b.reduce((E,A)=>{const R=s.get(A);return R&&E.push(R.getDate().getTime()),E},[]),w=Math.min(...v),C=Math.max(...v);return new Date((w+C)/2)}function y(){for(const b of n)b.render();for(const b of s.values())b.element.visible=!0}function _(){const{artifactContentGap:b}=e.styles;let v=0;for(const w of s.values())w.element.x=v,v+=w.element.width+b}return{render:l}}async function wR(){const r=await Go(),{render:t}=await TR();function e(i){t(i==null?void 0:i.artifacts)}r.artifacts&&e(r),nt.on("runDataCreated",i=>e(i)),nt.on("runDataUpdated",i=>e(i)),nt.on("configUpdated",()=>e()),nt.on("layoutSettingsUpdated",()=>e())}function UM(){}async function SR(r,t){const e=await de(),i=await we(),s=await Yt();let n=await Es();const o=new At,a=await Ao(),h=await Ao();let l=(t==null?void 0:t.end)??null;o.addChild(h),o.addChild(a),nt.on("viewportMoved",()=>c()),nt.on("scaleUpdated",m=>{n=m,c()});function c(m){if(m){const{end:g}=m;l=g}if(!ct.isTemporal()){o.visible=!1;return}const p=u();d(p),f(p)}function u(){const{background:m="#fff"}=s.styles.state(r),p=Math.max(n(r.occurred)*i.scale._x+i.worldTransform.tx,0),g=l?n(l)*i.scale._x+i.worldTransform.tx-p:e.screen.width-p;return{x:p,width:Math.max(g,0),background:m}}function d({x:m,width:p,background:g}){const{flowStateBarHeight:y}=s.styles;a.x=m,a.y=e.screen.height-y,a.width=p,a.height=y,a.tint=g}function f({x:m,width:p,background:g}){if(r.type==="RUNNING"){h.visible=!1;return}const{flowStateBarHeight:y,flowStateAreaAlpha:_}=s.styles;h.x=m,h.y=0,h.width=p,h.height=e.screen.height-y,h.tint=g,h.alpha=_}return{element:o,render:c}}function CR(){const r=new At,t=new Map;let e=null;r.zIndex=2;async function i(n){if(n&&(e=n),!e)return;const o=[];for(let a=0;a<e.length;a++)o.push(s(e[a],a));await Promise.all(o)}async function s(n,o){const a=e&&e.length>=o+1&&e[o+1],h=a?{end:a.occurred}:void 0;if(t.has(n.id))return t.get(n.id).render(h);const l=await SR(n,h);return t.set(n.id,l),r.addChild(l.element),l.render()}return{element:r,render:i}}async function ER(){const r=await de(),t=await Go(),{element:e,render:i}=await CR();r.stage.addChild(e);function s(n){i(n==null?void 0:n.state_events)}t.state_events&&s(t),nt.on("runDataUpdated",n=>s(n)),nt.on("configUpdated",()=>s()),nt.on("layoutSettingsUpdated",()=>s())}function XM(){}async function IR(){const r=await de(),t=await we(),e=await Ue(),i=await Yt(),{inter:s}=await db(),n=new At,o=await Ao();n.addChild(o);const a=s("");n.addChild(a);let h=await Es(),l,c;nt.on("scaleUpdated",p=>h=p),nt.on("viewportMoved",()=>{e.disableGuides||(m(),n.height!==r.screen.height&&d())});function u(p,g){l=p,c=g,d(),f(p)}function d(){o.width=i.styles.guideLineWidth,o.height=r.screen.height,o.tint=i.styles.guideLineColor}function f(p){a.text=c(p),a.fontSize=i.styles.guideTextSize,a.tint=i.styles.guideTextColor,a.position.set(i.styles.guideTextLeftPadding,i.styles.guideTextTopPadding)}function m(){l!==void 0&&(n.position.x=h(l)*t.scale._x+t.worldTransform.tx)}return{element:n,render:u}}class Sb extends Error{constructor(){super("Layout is not temporal")}}function AR(r){return r.toLocaleTimeString()}function Cb(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{timeStyle:"short"}).format(r)}function RR(r){const t=navigator.language;return new Intl.DateTimeFormat(t,{dateStyle:"short"}).format(r)}function MR(r){return r.getHours()===0&&r.getMinutes()===0?`${Vh.date(r)}
|
|
1176
1176
|
${Cb(r)}`:Cb(r)}const Vh={timeBySeconds:AR,timeByMinutesWithDates:MR,date:RR},ee={seconds:"seconds",minutes:"minutes",date:"date"},Lo={day:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.getTime()},week:r=>{const t=new Date(r.getTime());return t.setHours(0,0,0,0),t.setDate(r.getDate()-r.getDay()+1),t.getTime()}},Ct={second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},Eb=[{ceiling:Ct.second*4,increment:Ct.second,labelFormat:ee.seconds},{ceiling:Ct.second*8,increment:Ct.second*5,labelFormat:ee.seconds},{ceiling:Ct.second*13,increment:Ct.second*10,labelFormat:ee.seconds},{ceiling:Ct.second*20,increment:Ct.second*15,labelFormat:ee.seconds},{ceiling:Ct.second*45,increment:Ct.second*30,labelFormat:ee.seconds},{ceiling:Ct.minute*4,increment:Ct.minute,labelFormat:ee.minutes},{ceiling:Ct.minute*8,increment:Ct.minute*5,labelFormat:ee.minutes},{ceiling:Ct.minute*13,increment:Ct.minute*10,labelFormat:ee.minutes},{ceiling:Ct.minute*28,increment:Ct.minute*15,labelFormat:ee.minutes},{ceiling:Ct.hour*1.24,increment:Ct.minute*30,labelFormat:ee.minutes},{ceiling:Ct.hour*3,increment:Ct.hour,labelFormat:ee.minutes},{ceiling:Ct.hour*8,increment:Ct.hour*2,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Ct.hour*13,increment:Ct.hour*6,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Ct.hour*22,increment:Ct.hour*12,getAnchor:Lo.day,labelFormat:ee.minutes},{ceiling:Ct.day*4,increment:Ct.day,getAnchor:Lo.day,labelFormat:ee.date},{ceiling:Ct.week*2,increment:Ct.week,getAnchor:Lo.week,labelFormat:ee.date},{ceiling:1/0,increment:Ct.week*4,labelFormat:ee.date}],LR=300;async function PR(){const r=await we(),t=await Ue(),e=new At,i=new Map;let s=await Es();nt.on("scaleUpdated",d=>s=d),await o();function n(){if(e.visible=!t.disableGuides,!t.disableGuides)try{const{anchor:d,increment:f,labelFormat:m}=a(),p=u(d,f);c(p,m)}catch(d){if(d instanceof Sb)return;console.error(d)}}async function o(){const d=[];Cd(30,async f=>{const m=IR();d.push(m);const p=await m;e.addChild(p.element),i.set(f,p)}),await Promise.all(d)}function a(){const d=r.left-LR,f=s.invert(d),m=s.invert(d+260/r.scale.x);if(!(f instanceof Date)||!(m instanceof Date))throw new Sb;const p=m.getTime()-f.getTime(),{increment:g,getAnchor:y,labelFormat:_}=h(p);return{anchor:y(f),increment:g,labelFormat:l(_)}}function h(d){const f=Eb.find(m=>m.ceiling>d)??Eb[0];return f.getAnchor||(f.getAnchor=m=>Math.floor(m.getTime()/f.increment)*f.increment),f}function l(d){switch(d){case ee.minutes:return Vh.timeByMinutesWithDates;case ee.date:return Vh.date;default:return Vh.timeBySeconds}}function c(d,f){const m=new Map(i.entries()),p=Array.from(m.keys()).filter(g=>!d.includes(g));i.clear();for(const g of d){if(m.has(g)){const _=m.get(g);i.set(g,_),_.render(new Date(g),f);continue}const y=m.get(p.pop()??-1);if(y===void 0){console.warn("Guides: No unused guides available to render.");continue}y.render(new Date(g),f),i.set(g,y)}}function u(d,f){return Cd(30,m=>d+f*m)}return{element:e,render:n}}async function GR(){const r=await de(),{element:t,render:e}=await PR();r.stage.addChild(t),e(),nt.on("viewportDateRangeUpdated",()=>e()),nt.on("layoutSettingsUpdated",()=>e()),nt.on("configUpdated",()=>e())}function ZM(){}const FR=80;async function NR(){const r=await de(),t=await we(),e=await Ue(),i=await Yt(),s=await Ao();let n=await Es();nt.on("scaleUpdated",h=>n=h);function o(){if(!e.isTemporal()){s.visible=!1;return}s.width=i.styles.playheadWidth,s.height=r.stage.height,s.tint=i.styles.playheadColor,s.position.x=n(new Date)*t.scale.x+t.worldTransform.tx,a()}function a(){if(t.moving||!(s.position.x>0&&s.position.x<r.screen.width)||!(s.position.x>r.screen.width-FR))return;const c=t.left;t.zoomPercent(-.1,!0),t.left=c}return{element:s,render:o}}async function DR(){const r=await de(),t=await Go(),{element:e,render:i}=await NR();t.end_time||(r.stage.addChild(e),r.ticker.add(i)),nt.on("runDataUpdated",({end_time:s})=>{s&&(r.ticker.remove(i),r.stage.removeChild(e))})}function VM(){}function kR({stage:r,props:t}){HS(),gA(),pA(),GR(),ZR(),wR(),ER(),DR(),$S(),VA(),ZS(r),eC(t),TA(),jR(),JA()}function OR(){nt.clear();try{KS(),yA(),mA(),VS(),VR(),iC(),QS(),KA(),wA(),JR(),$A(),IA()}catch(r){console.error(r)}}async function BR(r){const t=await Yt(),e=await de(),i=await tb(),s=await Ue();let n=null;const o=new Map,{animate:a}=await ib(),{element:h,render:l,bar:c}=await E(r);let u=r,d=null,f=!1,m=!1;i.add(h),h.eventMode="static",h.cursor="pointer",h.name=kb,h.on("click",G=>{G.stopPropagation(),Ro({kind:u.kind,id:u.id})}),r.end_time||v(),nt.on("itemSelected",()=>{const G=Mo({kind:u.kind,id:u.id});G!==f&&(f=G,l(u))});async function p(G){u=G;const N=A(G);return N===d||(d=N,await Promise.all([l(G),g(G.artifacts)]),n&&(n.visible=!s.disableArtifacts),G.end_time&&w()),h}async function g(G){if(!G||s.disableArtifacts)return;n||_();const N=[];for(const P of G)N.push(y(P));await Promise.all(N),b()}async function y(G){if(o.has(G.id))return o.get(G.id).render();const N=await yb(G);return o.set(G.id,N),n.addChild(N.element),N.render()}function _(){n=new At,h.addChild(n)}function b(){if(!n)return;const{artifactsGap:G,artifactsNodeOverlap:N}=t.styles;let P=0;for(const I of o.values())I.element.position.x=P,P+=I.element.width+G;n.position.y=-n.height+N,n.width<c.width&&(n.position.x=c.width-n.width)}function v(){e.ticker.add(C)}function w(){e.ticker.remove(C)}function C(){p(r)}async function E(G){const{kind:N}=G;switch(N){case"task-run":return await eR();case"flow-run":return await tR(G);default:const P=N;throw new Error(`switch does not have case for value: ${P}`)}}function A(G){var D;const N=G.end_time??new Date,P=((D=G.artifacts)==null?void 0:D.length)??0;return[G.state_type,N.getTime(),P,ct.horizontal,ct.horizontalScaleMultiplier,t.styles.colorMode].join("-")}function R({x:G,y:N}){a(h,{x:G,y:N},!m),m=!0}return{element:h,render:p,bar:c,setPosition:R}}function Ib({gap:r=0,minimum:t=0}={}){const e=new Map;function i(c){const u=e.get(c)??[];return Math.max(...u.values(),z.toValue(t))+z.toValue(r)}function s(c){let u=0;for(let d=0;d<c;d++)u+=i(d);return u}function n(c){return s(c+1)-z.toValue(r)}function o({axis:c,nodeId:u,offset:d}){const f=e.get(c)??new Map;f.set(u,d),e.set(c,f)}function a({axis:c,nodeId:u}){let d,f;for(const[m,p]of e.entries())if(p.has(u)){d=m,f=p.get(u);break}d===c||d===void 0||f===void 0||(h({axis:d,nodeId:u}),o({axis:c,nodeId:u,offset:f}))}function h({axis:c,nodeId:u}){var d;(d=e.get(c))==null||d.delete(u)}function l(){e.clear()}return{getOffset:i,getTotalOffset:s,getTotalValue:n,setOffset:o,updateNodeAxis:a,removeOffset:h,clear:l}}function WR(r){throw new Error(`switch does not have case for value: ${r}`)}const Ab="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2Z1bmN0aW9uIEtlKG4pe3Rocm93IG5ldyBFcnJvcihgc3dpdGNoIGRvZXMgbm90IGhhdmUgY2FzZSBmb3IgdmFsdWU6ICR7bn1gKX1mdW5jdGlvbiBDbihuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjpuPGU/LTE6bj5lPzE6bj49ZT8wOk5hTn1mdW5jdGlvbiBudChuLGUpe3JldHVybiBuPT1udWxsfHxlPT1udWxsP05hTjplPG4/LTE6ZT5uPzE6ZT49bj8wOk5hTn1mdW5jdGlvbiBSbihuKXtsZXQgZSx0LHI7bi5sZW5ndGghPT0yPyhlPUNuLHQ9KHUsbCk9PkNuKG4odSksbCkscj0odSxsKT0+bih1KS1sKTooZT1uPT09Q258fG49PT1udD9uOmV0LHQ9bixyPW4pO2Z1bmN0aW9uIG8odSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTwwP2Y9bSsxOmc9bX13aGlsZShmPGcpfXJldHVybiBmfWZ1bmN0aW9uIGkodSxsLGY9MCxnPXUubGVuZ3RoKXtpZihmPGcpe2lmKGUobCxsKSE9PTApcmV0dXJuIGc7ZG97Y29uc3QgbT1mK2c+Pj4xO3QodVttXSxsKTw9MD9mPW0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WUoKTpuZXcgRGF0ZSgpLmdldFRpbWUoKSktaS5zdGFydF90aW1lLmdldFRpbWUoKS1hfSk7bGV0IHI9MDtmb3IoY29uc3QgbyBvZiB0KWUuc2V0KG8uaWQscisrKTtyZXR1cm4gZX1vbm1lc3NhZ2U9RG87ZnVuY3Rpb24gRG8oe2RhdGE6bn0pe2NvbnN0e3R5cGU6ZX09bjtzd2l0Y2goZSl7Y2FzZSJsYXlvdXQiOlNvKG4pO3JldHVybjtkZWZhdWx0OktlKGUpfX1mdW5jdGlvbiBrbyhuKXtwb3N0TWVzc2FnZShuKX1hc3luYyBmdW5jdGlvbiBTbyhuKXtjb25zdHtkYXRhOmV9PW4sdD13byhuKSxyPWF3YWl0IENvKG4sdCksbz1uZXcgTWFwO2xldCBpPTAsYT0wO2Zvcihjb25zdFt1LGxdb2YgZS5ub2Rlcyl7Y29uc3QgZj10LmdldCh1KSxnPXIuZ2V0KHUpO2lmKGY9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiBob3Jpem9udGFsIGxheW91dDogU2tpcHBpbmcgJHtsLmxhYmVsfWApO2NvbnRpbnVlfWlmKGc9PT12b2lkIDApe2NvbnNvbGUud2FybihgTm9kZUlkIG5vdCBmb3VuZCBpbiB2ZXJ0aWNhbCBsYXlvdXQ6IFNraXBwaW5nICR7bC5sYWJlbH1gKTtjb250aW51ZX1pPU1hdGgubWF4KGksZyksYT1NYXRoLm1heChhLGYuY29sdW1uKSxvLnNldCh1LHsuLi5mLHk6Zyxyb3c6Z30pfWtvKHt0eXBlOiJsYXlvdXQiLGxheW91dDp7bWF4Um93OmksbWF4Q29sdW1uOmEscG9zaXRpb25zOm99fSl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9cnVuR3JhcGgud29ya2VyLXNkX0hraDUwLmpzLm1hcAo=",Rb=typeof window<"u"&&window.Blob&&new Blob([atob(Ab)],{type:"text/javascript;charset=utf-8"});function UR(r){let t;try{if(t=Rb&&(window.URL||window.webkitURL).createObjectURL(Rb),!t)throw"";const e=new Worker(t,{name:r==null?void 0:r.name});return e.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),e}catch{return new Worker("data:text/javascript;base64,"+Ab,{name:r==null?void 0:r.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}function XR(r){const t=new UR;return t.onmessage=r,t}async function Mb(){const r=new Map,t=new Map,e=new At,i=new At,s=await Yt();let n=null;const o=Ib({gap:()=>s.styles.rowGap,minimum:()=>s.styles.nodeHeight}),a=Ib({gap:()=>s.styles.columnGap,minimum:()=>Pd()});let h=null,l=null;e.name=Cf,nt.on("layoutUpdated",()=>{o.clear(),a.clear()}),nt.on("layoutSettingsUpdated",()=>{l&&e.parent&&c(l),I()}),nt.on("itemSelected",()=>{I()});async function c(O){u(),l=O,h=null,await Promise.all([f(O),p(O)]),y(O)}function u(){n||(n=XR(N))}function d(){n&&(n.terminate(),n=null)}async function f(O){const k=[];for(const F of O.nodes.values())k.push(m(F));await Promise.all(k)}async function m(O){const{render:k}=await v(O);return await k(O)}async function p(O){if((await Ue()).disableEdges){e.removeChild(i);return}e.addChildAt(i,0);const F=[];for(const[V,{children:$}]of O.nodes)for(const{id:dt}of $)F.push(g(V,dt));await Promise.all(F)}async function g(O,k){const F=`${O}_${k}`;if(t.has(F))return;const V=await PA();t.has(F)||(t.set(F,V),i.addChild(V.element))}function y(O){if(!n)throw new Error("Layout worker not initialized");const k=new Map;for(const[F,{element:V}]of r)k.set(F,V.width);n.postMessage({type:"layout",data:O,widths:k,horizontalSettings:_d(O.start_time),verticalSettings:fA()})}function _(){if(h)for(const[O,k]of t){const[F,V]=O.split("_"),$=h.positions.get(F),dt=h.positions.get(V),ot=r.get(F);if(!$||!dt){console.warn(`Could not find edge in layout: Skipping ${O}`);continue}if(!ot){console.warn(`Could not find parent node in nodes: Skipping ${F}`);continue}const Et=ot.bar.width,Mt=C($),_t={x:Mt.x+Et,y:Mt.y+s.styles.nodeHeight/2},Y=C(dt),tt={x:Y.x-_t.x,y:Y.y-_t.y+s.styles.nodeHeight/2};k.setPosition(_t,tt)}}function b(){if(h){for(const[O,k]of r){const F=h.positions.get(O);if(!F){console.warn(`Could not find node in layout: Skipping ${O}`);continue}const V=C(F);k.setPosition(V),o.updateNodeAxis({nodeId:O,axis:F.y}),a.updateNodeAxis({nodeId:O,axis:F.column})}_(),e.emit("rendered"),e.emit("resized",G())}}async function v(O){const k=r.get(O.id);if(k)return k;const F=await BR(O);return F.element.on("resized",V=>w(O.id,V)),r.set(O.id,F),e.addChild(F.element),F}function w(O,k){if(!h)return;const F=r.get(O),V=h.positions.get(O);!F||!V||(o.setOffset({nodeId:O,axis:V.y,offset:k.height}),a.setOffset({nodeId:O,axis:V.column,offset:k.width}),b())}function C(O){const k=o.getTotalOffset(O.y);return{x:E(O),y:k}}function E(O){return ct.isDependency()?a.getTotalOffset(O.column):O.x}function A(){return h?o.getTotalValue(h.maxRow):0}function R(){if(!h||!l)return 0;if(ct.isDependency())return a.getTotalValue(h.maxColumn);const O=_d(l.start_time),k=Jy(O),F=k(l.end_time??new Date),V=k(l.start_time);return F-V}function G(){return{width:R(),height:A()}}function N({data:O}){const{type:k}=O;switch(k){case"layout":P(O);return;default:WR(k)}}function P(O){h=O.layout,b()}async function I(){const O=await Ue(),k=QA();if(!k||O.disableEdges){D([]);return}const F=Z(k.id);D(F)}function D(O){X(O),H(O)}function X(O){for(const[k,{element:F}]of r){if(O.length===0||O.includes(k)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function H(O){for(const[k,{element:F}]of t){const[V,$]=k.split("_");if(O.length===0||O.includes(V)&&O.includes($)){F.alpha=1;continue}F.alpha=s.styles.nodeUnselectedAlpha}}function Z(O){const k=j(O,"parents"),F=j(O,"children");return[O,...k,...F]}function j(O,k){const F=l==null?void 0:l.nodes.get(O);if(!F)return[];const V=[];for(const{id:$}of F[k])V.push($),V.push(...j($,k));return V}return{element:e,stopWorker:d,getSize:G,render:c}}let Po=null,Br=null,Is=null;async function ZR(){const r=await we(),t=await Yt(),{element:e,render:i}=await Mb();r.addChild(e),e.alpha=0;const s=await U0(t.runId,async n=>{const o=Br?"runDataUpdated":"runDataCreated";Br=n,nt.emit(o,Br),await Ue(),i(n)});nt.on("configUpdated",()=>{Br&&i(Br)}),Is=e,Po=s.stop,Is.once("rendered",()=>HR()),nt.on("layoutUpdated",()=>KR()),s.start()}function VR(){Po==null||Po(),Po=null,Is=null,Br=null}async function Go(){return Br||await Fe("runDataCreated")}function HR(){Td(),ve.shared.addOnce(()=>{Is&&(Is.alpha=1)})}async function KR(){if(!Is)return;const r=await Yt();Is.once("rendered",()=>{setTimeout(()=>{Td({animate:!0})},r.animationDuration)})}function YR(r){let t=0;for(const[,{children:e}]of r)t+=e.length;return t}function zR({start_time:r,end_time:t,nodes:e},i,s){const n=Math.max(Zb(t??new Date,r),1),o=i.styles.nodeHeight+i.styles.rowGap,a=.5;return e.size*o*a*s/(n*20)}async function jR(){const r=await Go(),t=await Yt(),e=await de(),i=e.view.width/e.view.height,s=zR(r,t,i);Hh(s,!0),r.nodes.size>t.disableAnimationsThreshold&&(ct.disableAnimations=!0),YR(r.nodes)>t.disableEdgesThreshold&&(ct.disableEdges=!0)}function JR(){ct.horizontal="temporal",ct.vertical="nearest-parent",ct.horizontalScaleMultiplierDefault=0,ct.horizontalScaleMultiplier=0,ct.disableAnimations=!1,ct.disableGuides=!1,ct.disableEdges=!1,ct.disableArtifacts=!1}const ct=z.reactive({horizontal:"temporal",vertical:"nearest-parent",horizontalScaleMultiplierDefault:0,horizontalScaleMultiplier:0,disableAnimations:!1,disableGuides:!1,disableEdges:!1,disableArtifacts:!1,isTemporal(){return this.horizontal==="temporal"},isDependency(){return this.horizontal==="dependency"},isWaterfall(){return this.vertical==="waterfall"},isNearestParent(){return this.vertical==="nearest-parent"},isLeftAligned(){return this.horizontal==="left-aligned"}});async function Ue(){return Gd()?ct:await Fe("layoutSettingsCreated")}function Pd(){return ct.isDependency()?200:20*ct.horizontalScaleMultiplier}function $R(){return[0,Pd()]}function QR(r){if(ct.isDependency())return[0,1];const t=r,e=Ub(t,1);return[t,e]}function Hh(r,t=!1){if(ct.horizontalScaleMultiplier===r)return;const e=Fo();ct.horizontalScaleMultiplier=r,t&&(ct.horizontalScaleMultiplierDefault=r),e()}function qR(){Hh(ct.horizontalScaleMultiplierDefault)}function tM(r){if(ct.horizontal===r)return;const t=Fo();ct.horizontal=r,ct.disableGuides=ct.isDependency()||ct.isLeftAligned(),t()}function eM(r){if(ct.vertical===r)return;const t=Fo();ct.vertical=r,t()}function iM(r){if(ct.disableEdges===r)return;const t=Fo();ct.disableEdges=r,t()}function rM(r){if(ct.disableArtifacts===r)return;const t=Fo();ct.disableArtifacts=r,t()}function Fo(){const r=Gd()?"layoutSettingsUpdated":"layoutSettingsCreated",{horizontal:t,vertical:e}=ct;return()=>{Gd()&&nt.emit(r,ct),(t!==ct.horizontal||e!==ct.vertical)&&nt.emit("layoutUpdated")}}function Gd(){return ct.horizontalScaleMultiplier!==0}function Lb(r){if(!(r instanceof HTMLElement))return!1;const t=r.tagName.toLowerCase();return["input","textarea"].includes(t)}const sM={class:"flex items-center gap-2"},nM=z.defineComponent({__name:"RunGraphSettings",setup(r){const t=[Ki.positions.topRight,Ki.positions.bottomRight,Ki.positions.topLeft,Ki.positions.bottomLeft],e=[{label:"Temporal dependency",value:"temporal_nearest-parent"},{label:"Temporal sequence",value:"temporal_waterfall"},{label:"Dependency grid",value:"dependency_nearest-parent"},{label:"Sequential grid",value:"dependency_waterfall"},{label:"Comparative duration",value:"left-aligned_duration-sorted"}],i=z.computed({get(){return`${ct.horizontal}_${ct.vertical}`},set(c){const[u,d]=c.split("_");tM(u),eM(d)}}),s=z.computed({get(){return ct.disableEdges},set(c){iM(c)}}),n=z.computed({get(){return ct.disableArtifacts},set(c){rM(c)}});function o(){const u=ct.horizontalScaleMultiplier*1.25;Hh(u)}function a(){const c=Math.abs(-.75),u=ct.horizontalScaleMultiplier*c;Hh(u)}mr.useKeyDown(["-","="],h);function h(c){if(!(Lb(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"-":a();break;case"=":o();break}}function l(){qR()}return(c,u)=>{const d=z.resolveComponent("p-radio-group"),f=z.resolveComponent("p-label"),m=z.resolveComponent("p-divider"),p=z.resolveComponent("p-checkbox"),g=z.resolveComponent("p-overflow-menu");return z.openBlock(),z.createBlock(z.unref(Ki.PPopOver),{class:"run-graph-settings","auto-close":"",placement:t},{target:z.withCtx(({toggle:y})=>[z.createVNode(z.unref(Ki.PButton),{"aria-label":"Run Graph Options",icon:"CogIcon",flat:"",onClick:y},null,8,["onClick"])]),default:z.withCtx(()=>[z.createVNode(g,{class:"run-graph-settings__menu"},{default:z.withCtx(()=>[z.createVNode(f,{label:"Layout"},{default:z.withCtx(()=>[z.createVNode(d,{modelValue:i.value,"onUpdate:modelValue":u[0]||(u[0]=y=>i.value=y),options:e},{label:z.withCtx(({option:y})=>[z.createTextVNode(z.toDisplayString(y.label),1)]),_:1},8,["modelValue"])]),_:1}),z.unref(ct).isTemporal()||z.unref(ct).isLeftAligned()?(z.openBlock(),z.createElementBlock(z.Fragment,{key:0},[z.createVNode(m),z.createVNode(f,{label:"Scaling"},{default:z.withCtx(()=>[z.createElementVNode("div",sM,[z.createVNode(z.unref(Ki.PButton),{title:"Decrease scale (-)",small:"",icon:"MinusIcon",onClick:a}),z.createVNode(z.unref(Ki.PButton),{title:"Increase scale (+)",small:"",icon:"PlusIcon",onClick:o}),z.createVNode(z.unref(Ki.PButton),{small:"",onClick:l},{default:z.withCtx(()=>[z.createTextVNode(" Reset ")]),_:1})])]),_:1})],64)):z.createCommentVNode("",!0),z.createVNode(m),z.createVNode(p,{modelValue:s.value,"onUpdate:modelValue":u[1]||(u[1]=y=>s.value=y),label:"Hide dependency arrows"},null,8,["modelValue"]),z.createVNode(p,{modelValue:n.value,"onUpdate:modelValue":u[2]||(u[2]=y=>n.value=y),label:"Hide artifacts"},null,8,["modelValue"])]),_:1})]),_:1})}}}),oM={class:"run-graph__actions"},aM=z.defineComponent({__name:"RunGraph",props:{config:{},viewport:{},fullscreen:{type:[Boolean,null],default:null},selected:{default:null}},emits:["update:viewport","update:fullscreen","update:selected"],setup(r,{emit:t}){const e=r,i=z.ref(),s=z.ref(!1),n=z.computed({get(){return e.fullscreen??s.value},set(c){s.value=c,t("update:fullscreen",c)}});z.watch(()=>e.selected,c=>Ro(c)),nt.on("itemSelected",c=>t("update:selected",c)),z.watch(()=>e.viewport,c=>_A(c));const o=z.computed(()=>({root:{"run-graph--fullscreen":n.value}}));nt.on("viewportDateRangeUpdated",c=>t("update:viewport",c));function a(){Td({animate:!0})}function h(){n.value=!n.value}z.onMounted(()=>{if(!i.value)throw new Error("Stage does not exist");kR({stage:i.value,props:e})}),z.onBeforeUnmount(()=>{OR()}),mr.useKeyDown(["c","f","Escape"],l);function l(c){if(!(Lb(c.target)||c.metaKey||c.ctrlKey))switch(c.key){case"c":a();break;case"f":h();break;case"Escape":n.value&&h();break}}return(c,u)=>{const d=z.resolveComponent("p-button");return z.openBlock(),z.createElementBlock("div",{class:z.normalizeClass(["run-graph",o.value.root])},[z.createElementVNode("div",{ref_key:"stage",ref:i,class:"run-graph__stage"},null,512),z.createElementVNode("div",oM,[z.createVNode(d,{title:"Recenter graph (c)",icon:"Target",flat:"",onClick:a}),z.createVNode(d,{title:"Toggle fullscreen (f)",icon:"ArrowsPointingOutIcon",flat:"",onClick:h}),z.createVNode(nM)])],2)}}});Vt.RunGraph=aM,Vt.artifactTypeIconMap=fb,Vt.artifactTypes=zA,Vt.isArtifactSelection=pb,Vt.isArtifactsSelection=mb,Vt.isNodeSelection=Md,Vt.isRunGraphNodeType=jA,Vt.runGraphNodeKinds=Uh,Object.defineProperty(Vt,Symbol.toStringTag,{value:"Module"})});
|
|
1177
1177
|
//# sourceMappingURL=graphs.umd.js.map
|