@malloy-publisher/server 0.8.5 → 0.9.0
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/README.docker.md +45 -2
- package/dist/app/assets/{EnvironmentPage-D0689eMH.js → EnvironmentPage-UMS7Py4Q.js} +1 -1
- package/dist/app/assets/{HomePage-CQwxmRju.js → HomePage-D3MvQaZn.js} +1 -1
- package/dist/app/assets/{LightMode-DzUuDGQu.js → LightMode-e1lNBfpL.js} +1 -1
- package/dist/app/assets/{MainPage-CWebuoie.js → MainPage-B0ozqtQO.js} +1 -1
- package/dist/app/assets/{ModelPage-DddcQtR_.js → ModelPage-lQj4Axqu.js} +2 -2
- package/dist/app/assets/{PackagePage-B_6x-Kp1.js → PackagePage-BT0YKNKU.js} +1 -1
- package/dist/app/assets/{RenderedResult-BRgIgxWh.es-B6GsiQaB.js → RenderedResult-BRgIgxWh.es-DiE7kPNX.js} +2 -2
- package/dist/app/assets/{RouteError-D85c0IXR.js → RouteError-BQnzPJvb.js} +1 -1
- package/dist/app/assets/{ThemeEditorPage-DPFZnuXS.js → ThemeEditorPage-D6t7w9Js.js} +1 -1
- package/dist/app/assets/{ToggleButtonGroup-B2KkD7kC.js → ToggleButtonGroup-CJT2JKTC.js} +1 -1
- package/dist/app/assets/index-ByieDZlo.js +23 -0
- package/dist/app/assets/{index-BbrJd6fQ.js → index-CCNqF0-G.js} +1 -1
- package/dist/app/assets/{index-125-Lr5Z.js → index-CKmZ4HG7.js} +388 -388
- package/dist/app/assets/{index-mS-LEGFh.js → index-CdExa3Pk.js} +1 -1
- package/dist/app/assets/{index-BSBGZfIc.js → index-TiWjmdoW.js} +4 -4
- package/dist/app/assets/{index-DSoCUF-f.js → index-ireHUsv_.js} +419 -422
- package/dist/app/assets/{index-BK_RS5eN.js → index-ufFZR_K-.js} +1 -1
- package/dist/app/assets/{index.es-Dixkq2YH.js → index.es-iUV0gCYk.js} +4 -4
- package/dist/app/index.html +1 -1
- package/dist/package_load_worker.mjs +11 -66
- package/dist/server.mjs +326 -675
- package/package.json +14 -14
- package/dist/app/assets/index-w_0OQJgZ.js +0 -23
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{r as S,aM as ju,aN as yn,j as b,a9 as he,aO as Cu,at as Wt,N as pe,aP as Ou,aQ as Mu,U as $l,ar as Eu,aR as Du,aS as ri,aT as xa,aU as Tu,a4 as jl,a0 as Pu,ay as ke,a5 as Cl,aV as Au,a8 as Ol,aW as Iu,aX as ii,G as tt,aY as Ml,aZ as ks,H as kn,I as Ss,O as mo,T as ne,a_ as Ru,a$ as Wu,ax as Ni,am as Te,aq as bt,b0 as $s,an as El,Y as Dl,b1 as zu,b2 as Lu,Q as Nu,W as _u,b3 as Fu,b4 as Hu,b5 as qu,b6 as Uu,b7 as Vu,b8 as Gu,b9 as Yu,ba as Xu,bb as Ku,bc as Tl,bd as Bu,be as si,bf as Qu,bg as Qt,bh as Zu,bi as Ju,aI as eh}from"./index-BSBGZfIc.js";import{T as th,a as wa}from"./ToggleButtonGroup-B2KkD7kC.js";var ka={},nh=Symbol.for("preact-signals");function _i(){if(yt>1)yt--;else{var e,t=!1;for((function(){var i=wi;for(wi=void 0;i!==void 0;){var s=i.S;if(s.v===i.v)for(var o=s.t;o!==void 0;o=o.x)o.i===i.i&&(o.i=s.i);i=i.o}})();pr!==void 0;){var n=pr;for(pr=void 0,xi++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Al(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=r}}if(xi=0,yt--,t)throw e}}function de(e){if(yt>0)return e();js=++rh,yt++;try{return e()}finally{_i()}}var fr,ie=void 0;function q(e){var t=ie,n=fr;ie=void 0,fr=void 0;try{return e()}finally{ie=t,fr=n}}var pr=void 0,yt=0,xi=0,rh=0,js=0,wi=void 0,ki=0;function Pl(e){if(ie!==void 0){var t=e.n;if(t===void 0||t.t!==ie)return t={i:0,S:e,p:ie.s,n:void 0,t:ie,e:void 0,x:void 0,r:t},ie.s!==void 0&&(ie.s.n=t),ie.s=t,e.n=t,32&ie.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=ie.s,t.n=void 0,ie.s.n=t,ie.s=t),t}}function Le(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Le.prototype.brand=nh;Le.prototype.h=function(){return!0};Le.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:q(function(){var r;(r=t.W)==null||r.call(t)}))};Le.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&q(function(){var i;(i=t.Z)==null||i.call(t)}))}};Le.prototype.subscribe=function(e){var t=this;return nt(function(){var n=t.value;q(function(){return e(n)})},{name:"sub"})};Le.prototype.valueOf=function(){return this.value};Le.prototype.toString=function(){return this.value+""};Le.prototype.toJSON=function(){return this.value};Le.prototype.peek=function(){var e=this;return q(function(){return e.value})};Object.defineProperty(Le.prototype,"value",{get:function(){var e=Pl(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(xi>100)throw new Error("Cycle detected");(function(n){yt!==0&&xi===0&&n.l!==js&&(n.l=js,wi={S:n,v:n.v,i:n.i,o:wi})})(this),this.v=e,this.i++,ki++,yt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{_i()}}}});function An(e,t){return new Le(e,t)}function Al(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Il(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Rl(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Zt(e,t){Le.call(this,void 0,t),this.x=e,this.s=void 0,this.g=ki-1,this.f=4}Zt.prototype=new Le;Zt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ki))return!0;if(this.g=ki,this.f|=1,this.i>0&&!Al(this))return this.f&=-2,!0;var e=ie;try{Il(this),ie=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return ie=e,Rl(this),this.f&=-2,!0};Zt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Le.prototype.S.call(this,e)};Zt.prototype.U=function(e){if(this.t!==void 0&&(Le.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Zt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Zt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Pl(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Sa(e,t){return new Zt(e,t)}function Wl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){yt++;var n=ie;ie=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,vo(e),r}finally{ie=n,_i()}}}function vo(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Wl(e)}function ih(e){if(ie!==this)throw new Error("Out-of-order effect");Rl(this),ie=e,this.f&=-2,8&this.f&&vo(this),_i()}function In(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,fr&&fr.push(this)}In.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};In.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Wl(this),Il(this),yt++;var e=ie;return ie=this,ih.bind(this,e)};In.prototype.N=function(){2&this.f||(this.f|=2,this.u=pr,pr=this)};In.prototype.d=function(){this.f|=8,1&this.f||vo(this)};In.prototype.dispose=function(){this.d()};function nt(e,t){var n=new In(e,t);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var sh=Object.create,bo=Object.defineProperty,oh=Object.defineProperties,ah=Object.getOwnPropertyDescriptor,lh=Object.getOwnPropertyDescriptors,$a=Object.getOwnPropertySymbols,ch=Object.prototype.hasOwnProperty,dh=Object.prototype.propertyIsEnumerable,uh=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Rn=e=>{throw TypeError(e)},Cs=(e,t,n)=>t in e?bo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hh=(e,t)=>{for(var n in t||(t={}))ch.call(t,n)&&Cs(e,n,t[n]);if($a)for(var n of $a(t))dh.call(t,n)&&Cs(e,n,t[n]);return e},fh=(e,t)=>oh(e,lh(t)),ja=(e,t)=>bo(e,"name",{value:t,configurable:!0}),ph=e=>{var t;return[,,,sh((t=void 0)!=null?t:null)]},zl=["class","method","getter","setter","accessor","field","value","get","set"],Qn=e=>e!==void 0&&typeof e!="function"?Rn("Function expected"):e,gh=(e,t,n,r,i)=>({kind:zl[e],name:t,metadata:r,addInitializer:s=>n._?Rn("Already initialized"):i.push(Qn(s||null))}),Ll=(e,t)=>Cs(t,uh("metadata"),e[3]),Rt=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},Wn=(e,t,n,r,i,s)=>{var o,a,l,u,c,d=t&7,f=!!(t&8),h=!!(t&16),v=d>3?e.length+1:d?f?1:2:0,g=zl[d+5],w=d>3&&(e[v-1]=[]),y=e[v]||(e[v]=[]),p=d&&(!h&&!f&&(i=i.prototype),d<5&&(d>3||!h)&&ah(d<4?i:{get[n](){return Qe(this,s)},set[n](m){return Ct(this,s,m)}},n));d?h&&d<4&&ja(s,(d>2?"set ":d>1?"get ":"")+n):ja(i,n);for(var x=r.length-1;x>=0;x--)u=gh(d,n,l={},e[3],y),d&&(u.static=f,u.private=h,c=u.access={has:h?m=>mh(i,m):m=>n in m},d^3&&(c.get=h?m=>(d^1?Qe:vh)(m,i,d^4?s:p.get):m=>m[n]),d>2&&(c.set=h?(m,k)=>Ct(m,i,k,d^4?s:p.set):(m,k)=>m[n]=k)),a=(0,r[x])(d?d<4?h?s:p[g]:d>4?void 0:{get:p.get,set:p.set}:i,u),l._=1,d^4||a===void 0?Qn(a)&&(d>4?w.unshift(a):d?h?s=a:p[g]=a:i=a):typeof a!="object"||a===null?Rn("Object expected"):(Qn(o=a.get)&&(p.get=o),Qn(o=a.set)&&(p.set=o),Qn(o=a.init)&&w.unshift(o));return d||Ll(e,i),p&&bo(i,n,p),h?d^4?s:p:i},yo=(e,t,n)=>t.has(e)||Rn("Cannot "+n),mh=(e,t)=>Object(t)!==t?Rn('Cannot use the "in" operator on this value'):e.has(t),Qe=(e,t,n)=>(yo(e,t,"read from private field"),n?n.call(e):t.get(e)),Zn=(e,t,n)=>t.has(e)?Rn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ct=(e,t,n,r)=>(yo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),vh=(e,t,n)=>(yo(e,t,"access private method"),n);function Os(e,t){if(t){let n;return Sa(()=>{const r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return Sa(e)}function st(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e=="function"&&typeof t=="function")return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((n,r)=>!st(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:!n.some(i=>!st(e[i],t[i]))}return!1}function U({get:e},t){return{init(n){return An(n)},get(){return e.call(this).value},set(n){const r=e.call(this);r.peek()!==n&&(r.value=n)}}}function fe(e,t){const n=new WeakMap;return function(){let r=n.get(this);return r||(r=Os(e.bind(this)),n.set(this,r)),r.value}}function is(e=!0){return function(t,n){n.addInitializer(function(){const r=n.kind==="field"?this:n.static?this:Object.getPrototypeOf(this),i=Object.getOwnPropertyDescriptor(r,n.name);i&&Object.defineProperty(r,n.name,fh(hh({},i),{enumerable:e}))})}}function Dr(...e){const t=e.map(n=>nt(n));return()=>t.forEach(n=>n())}var Nl,_l,Fl,Hl,ql,Ul,Re,xo,ss,Ms,Es,De,wo,os,Vl,Ds,ko,as,Ts,Ps;Ul=[U],ql=[U],Hl=[U],Fl=[is()],_l=[is()],Nl=[is()];var Jt=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,Rt(Re,5,this),Zn(this,De),Zn(this,xo,Rt(Re,8,this)),Rt(Re,11,this),Zn(this,wo,Rt(Re,12,this)),Rt(Re,15,this),Zn(this,ko,Rt(Re,16,this)),Rt(Re,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return Qe(this,De,Ts)}get initial(){return Qe(this,De,Ms)}get previous(){return Qe(this,De,Vl)}set current(e){const t=q(()=>Qe(this,De,Ts));e&&t&&this.equals(t,e)||de(()=>{Qe(this,De,Ms)||Ct(this,De,e,Es),Ct(this,De,t,Ds),Ct(this,De,e,Ps)})}reset(e=this.defaultValue){de(()=>{Ct(this,De,void 0,Ds),Ct(this,De,e,Es),Ct(this,De,e,Ps)})}};Re=ph();xo=new WeakMap;De=new WeakSet;wo=new WeakMap;ko=new WeakMap;ss=Wn(Re,20,"#initial",Ul,De,xo),Ms=ss.get,Es=ss.set;os=Wn(Re,20,"#previous",ql,De,wo),Vl=os.get,Ds=os.set;as=Wn(Re,20,"#current",Hl,De,ko),Ts=as.get,Ps=as.set;Wn(Re,2,"current",Fl,Jt);Wn(Re,2,"initial",_l,Jt);Wn(Re,2,"previous",Nl,Jt);Ll(Re,Jt);function ls(e){return q(()=>{const t={};for(const n in e)t[n]=e[n];return t})}var zt,bh=class{constructor(){Zn(this,zt,new WeakMap)}get(e,t){var n;return e?(n=Qe(this,zt).get(e))==null?void 0:n.get(t):void 0}set(e,t,n){var r;if(e)return Qe(this,zt).has(e)||Qe(this,zt).set(e,new Map),(r=Qe(this,zt).get(e))==null?void 0:r.set(t,n)}clear(e){var t;return e?(t=Qe(this,zt).get(e))==null?void 0:t.clear():void 0}};zt=new WeakMap;var yh=Object.create,Gl=Object.defineProperty,xh=Object.getOwnPropertyDescriptor,Ca=Object.getOwnPropertySymbols,wh=Object.prototype.hasOwnProperty,kh=Object.prototype.propertyIsEnumerable,Yl=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Fi=e=>{throw TypeError(e)},Oa=Math.pow,As=(e,t,n)=>t in e?Gl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sh=(e,t)=>{for(var n in t||(t={}))wh.call(t,n)&&As(e,n,t[n]);if(Ca)for(var n of Ca(t))kh.call(t,n)&&As(e,n,t[n]);return e},$h=e=>{var t;return[,,,yh((t=e?.[Yl("metadata")])!=null?t:null)]},Xl=["class","method","getter","setter","accessor","field","value","get","set"],Kl=e=>e!==void 0&&typeof e!="function"?Fi("Function expected"):e,jh=(e,t,n,r,i)=>({kind:Xl[e],name:t,metadata:r,addInitializer:s=>n._?Fi("Already initialized"):i.push(Kl(s||null))}),Ch=(e,t)=>As(t,Yl("metadata"),e[3]),Oh=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Bl=(e,t,n,r,i,s)=>{for(var o,a,l,u,c=t&7,d=!1,f=!1,h=2,v=Xl[c+5],g=e[h]||(e[h]=[]),w=(i=i.prototype,xh(i,n)),y=r.length-1;y>=0;y--)l=jh(c,n,a={},e[3],g),l.static=d,l.private=f,u=l.access={has:p=>n in p},u.get=p=>p[n],o=(0,r[y])(w[v],l),a._=1,Kl(o)&&(w[v]=o);return w&&Gl(i,n,w),i},Ql=(e,t,n)=>t.has(e)||Fi("Cannot "+n),Mh=(e,t,n)=>(Ql(e,t,"read from private field"),t.get(e)),Eh=(e,t,n)=>t.has(e)?Fi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Dh=(e,t,n,r)=>(Ql(e,t,"write to private field"),t.set(e,n),n),Ze=class Is{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new Is(t.x-n.x,t.y-n.y)}static distance(t,n){return Math.hypot(t.x-n.x,t.y-n.y)}static equals(t,n){return t.x===n.x&&t.y===n.y}static from({x:t,y:n}){return new Is(t,n)}},ht=class Lt{constructor(t,n,r,i){this.left=t,this.top=n,this.width=r,this.height=i,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){const{top:r,left:i,width:s,height:o,scale:a}=this,l=new Lt(i+t,r+n,s,o);return l.scale=Sh({},a),l}get boundingRectangle(){const{width:t,height:n,left:r,top:i,right:s,bottom:o}=this;return{width:t,height:n,left:r,top:i,right:s,bottom:o}}get center(){const{left:t,top:n,right:r,bottom:i}=this;return new Ze((t+r)/2,(n+i)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Lt))return!1;const{left:n,top:r,width:i,height:s}=this;return n===t.left&&r===t.top&&i===t.width&&s===t.height}containsPoint(t){const{top:n,left:r,bottom:i,right:s}=this;return n<=t.y&&t.y<=i&&r<=t.x&&t.x<=s}intersectionArea(t){return t instanceof Lt?Th(this,t):0}intersectionRatio(t){const{area:n}=this,r=this.intersectionArea(t);return r/(t.area+n-r)}get bottom(){const{top:t,height:n}=this;return t+n}get right(){const{left:t,width:n}=this;return t+n}get aspectRatio(){const{width:t,height:n}=this;return t/n}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new Lt(n,t,r,i)}static delta(t,n,r={x:"center",y:"center"}){const i=(s,o)=>{const a=r[o],l=o==="x"?s.left:s.top,u=o==="x"?s.width:s.height;return a=="start"?l:a=="end"?l+u:l+u/2};return Ze.delta({x:i(t,"x"),y:i(t,"y")},{x:i(n,"x"),y:i(n,"y")})}static intersectionRatio(t,n){return Lt.from(t).intersectionRatio(Lt.from(n))}};function Th(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,a=s-n;return r<i&&n<s?o*a:0}var Zl,Jl,Rs,oi,Tr,Hi=class extends(Rs=Jt,Jl=[fe],Zl=[fe],Rs){constructor(e){const t=Ze.from(e);super(t,(n,r)=>Ze.equals(n,r)),Oh(Tr,5,this),Eh(this,oi,0),this.velocity={x:0,y:0}}get delta(){return Ze.delta(this.current,this.initial)}get direction(){const{current:e,previous:t}=this;if(!t)return null;const n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?"right":"left":n.y>0?"down":"up"}get current(){return super.current}set current(e){const{current:t}=this,n=Ze.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),s=i-Mh(this,oi),o=a=>Math.round(a/s*100);de(()=>{Dh(this,oi,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(Ze.from(e)),this.velocity={x:0,y:0}}};Tr=$h(Rs);oi=new WeakMap;Bl(Tr,2,"delta",Jl,Hi);Bl(Tr,2,"direction",Zl,Hi);Ch(Tr,Hi);function Ws({x:e,y:t},n){const r=Math.abs(e),i=Math.abs(t);return typeof n=="number"?Math.sqrt(Oa(r,2)+Oa(i,2))>n:"x"in n&&"y"in n?r>n.x&&i>n.y:"x"in n?r>n.x:"y"in n?i>n.y:!1}var ec=(e=>(e.Horizontal="x",e.Vertical="y",e))(ec||{}),tc=Object.values(ec),Ph=Object.create,So=Object.defineProperty,Ah=Object.defineProperties,Ih=Object.getOwnPropertyDescriptor,Rh=Object.getOwnPropertyDescriptors,Si=Object.getOwnPropertySymbols,nc=Object.prototype.hasOwnProperty,rc=Object.prototype.propertyIsEnumerable,ic=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),zn=e=>{throw TypeError(e)},zs=(e,t,n)=>t in e?So(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t)=>{for(var n in t||(t={}))nc.call(t,n)&&zs(e,n,t[n]);if(Si)for(var n of Si(t))rc.call(t,n)&&zs(e,n,t[n]);return e},jo=(e,t)=>Ah(e,Rh(t)),Ma=(e,t)=>So(e,"name",{value:t,configurable:!0}),sc=(e,t)=>{var n={};for(var r in e)nc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Si)for(var r of Si(e))t.indexOf(r)<0&&rc.call(e,r)&&(n[r]=e[r]);return n},Ln=e=>{var t;return[,,,Ph((t=e?.[ic("metadata")])!=null?t:null)]},oc=["class","method","getter","setter","accessor","field","value","get","set"],Jn=e=>e!==void 0&&typeof e!="function"?zn("Function expected"):e,Wh=(e,t,n,r,i)=>({kind:oc[e],name:t,metadata:r,addInitializer:s=>n._?zn("Already initialized"):i.push(Jn(s||null))}),en=(e,t)=>zs(t,ic("metadata"),e[3]),N=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},V=(e,t,n,r,i,s)=>{var o,a,l,u,c,d=t&7,f=!!(t&8),h=!!(t&16),v=d>3?e.length+1:d?f?1:2:0,g=oc[d+5],w=d>3&&(e[v-1]=[]),y=e[v]||(e[v]=[]),p=d&&(!h&&!f&&(i=i.prototype),d<5&&(d>3||!h)&&Ih(d<4?i:{get[n](){return ue(this,s)},set[n](m){return Ye(this,s,m)}},n));d?h&&d<4&&Ma(s,(d>2?"set ":d>1?"get ":"")+n):Ma(i,n);for(var x=r.length-1;x>=0;x--)u=Wh(d,n,l={},e[3],y),d&&(u.static=f,u.private=h,c=u.access={has:h?m=>zh(i,m):m=>n in m},d^3&&(c.get=h?m=>(d^1?ue:ac)(m,i,d^4?s:p.get):m=>m[n]),d>2&&(c.set=h?(m,k)=>Ye(m,i,k,d^4?s:p.set):(m,k)=>m[n]=k)),a=(0,r[x])(d?d<4?h?s:p[g]:d>4?void 0:{get:p.get,set:p.set}:i,u),l._=1,d^4||a===void 0?Jn(a)&&(d>4?w.unshift(a):d?h?s=a:p[g]=a:i=a):typeof a!="object"||a===null?zn("Object expected"):(Jn(o=a.get)&&(p.get=o),Jn(o=a.set)&&(p.set=o),Jn(o=a.init)&&w.unshift(o));return d||en(e,i),p&&So(i,n,p),h?d^4?s:p:i},Co=(e,t,n)=>t.has(e)||zn("Cannot "+n),zh=(e,t)=>Object(t)!==t?zn('Cannot use the "in" operator on this value'):e.has(t),ue=(e,t,n)=>(Co(e,t,"read from private field"),n?n.call(e):t.get(e)),Q=(e,t,n)=>t.has(e)?zn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ye=(e,t,n,r)=>(Co(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ac=(e,t,n)=>(Co(e,t,"access private method"),n);function lc(e,t){return{plugin:e,options:t}}function Pr(e){return t=>lc(e,t)}function xr(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var cc,wr,Oo,ai;cc=[U];var Pe=class{constructor(e,t){this.manager=e,this.options=t,Q(this,Oo,N(wr,8,this,!1)),N(wr,11,this),Q(this,ai,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return q(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){const t=nt(e.bind(this));return ue(this,ai).add(t),t}destroy(){ue(this,ai).forEach(e=>e())}static configure(e){return lc(this,e)}};wr=Ln(null);Oo=new WeakMap;ai=new WeakMap;V(wr,4,"disabled",cc,Pe,Oo);en(wr,Pe);var Ar=class extends Pe{},li,cs=class{constructor(e){this.manager=e,this.instances=new Map,Q(this,li,[])}get values(){return Array.from(this.instances.values())}set values(e){const t=e.map(xr).reduce((r,i)=>{const s=r.find(({plugin:o})=>o===i.plugin);return s?(s.options=i.options,r):[...r,i]},[]),n=t.map(({plugin:r})=>r);for(const r of ue(this,li))if(!n.includes(r)){if(r.prototype instanceof Ar)continue;this.unregister(r)}for(const{plugin:r,options:i}of t)this.register(r,i);Ye(this,li,n)}get(e){return this.instances.get(e)}register(e,t){const n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;const r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){const t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(const e of this.instances.values())e.destroy();this.instances.clear()}};li=new WeakMap;function Lh(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var Vr=[],hn,fn,Nh=class extends Pe{constructor(e){super(e),Q(this,hn),Q(this,fn),this.computeCollisions=this.computeCollisions.bind(this),Ye(this,fn,An(Vr)),this.destroy=Dr(()=>{const t=this.computeCollisions(),n=q(()=>this.manager.dragOperation.position.current);if(t!==Vr){const r=ue(this,hn);if(Ye(this,hn,n),r&&n.x==r.x&&n.y==r.y)return}else Ye(this,hn,void 0);ue(this,fn).value=t},()=>{const{dragOperation:t}=this.manager;t.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){q(()=>{e?ue(this,fn).value=this.computeCollisions():Ye(this,hn,void 0)})}computeCollisions(e,t){const{registry:n,dragOperation:r}=this.manager,{source:i,shape:s,status:o}=r;if(!o.initialized||!s)return Vr;const a=[],l=[];for(const u of e??n.droppables){if(u.disabled||i&&!u.accepts(i))continue;const c=t??u.collisionDetector;if(!c)continue;l.push(u),u.shape;const d=q(()=>c({droppable:u,dragOperation:r}));d&&(u.collisionPriority!=null&&(d.priority=u.collisionPriority),a.push(d))}return l.length===0?Vr:(a.sort(Lh),a)}get collisions(){return ue(this,fn).value}};hn=new WeakMap;fn=new WeakMap;var dc,uc,hc,Mo,fc,ot,Eo,xn,Do,To;hc=[U],uc=[U],dc=[U];var wt=class Nt{constructor(t,n){Q(this,Eo,N(ot,8,this)),N(ot,11,this),Q(this,xn),Q(this,Do,N(ot,12,this)),N(ot,15,this),Q(this,To,N(ot,16,this)),N(ot,19,this);const{effects:r,id:i,data:s={},disabled:o=!1,register:a=!0}=t;let l=i;Ye(this,xn,An(i)),this.manager=n,this.data=s,this.disabled=o,this.effects=()=>{var u;return[()=>{const{id:c,manager:d}=this;if(c!==l)return l=c,d?.registry.register(this),()=>d?.registry.unregister(this)},...(u=r?.())!=null?u:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),n&&a&&queueMicrotask(this.register)}get id(){var t,n;const r=ue(this,xn).value;return(n=(t=Nt.pendingIdChanges)==null?void 0:t.get(this))!=null?n:r}set id(t){var n,r;const i=(r=(n=Nt.pendingIdChanges)==null?void 0:n.get(this))!=null?r:ue(this,xn).peek();t!==i&&(Nt.pendingIdChanges||(Nt.pendingIdChanges=new Map,queueMicrotask(()=>{var s;return ac(s=Nt,Mo,fc).call(s)})),Nt.pendingIdChanges.set(this,t))}register(){var t;return(t=this.manager)==null?void 0:t.registry.register(this)}unregister(){var t;(t=this.manager)==null||t.registry.unregister(this)}destroy(){var t;(t=this.manager)==null||t.registry.unregister(this)}};ot=Ln(null);Mo=new WeakSet;fc=function(){const e=wt.pendingIdChanges;wt.pendingIdChanges=null,e&&de(()=>{for(const[t,n]of e)ue(t,xn).value=n})};Eo=new WeakMap;xn=new WeakMap;Do=new WeakMap;To=new WeakMap;V(ot,4,"manager",hc,wt,Eo);V(ot,4,"data",uc,wt,Do);V(ot,4,"disabled",dc,wt,To);Q(wt,Mo);en(ot,wt);wt.pendingIdChanges=null;var qi=wt,Ea=class{constructor(){this.map=An(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{const n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));const s=new Map(n);for(const[a,l]of n)if(l===t&&a!==e){s.delete(a);break}s.set(e,t),this.map.value=s;const o=Dr(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{const n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);const i=new Map(n);i.delete(e),this.map.value=i}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(const e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},pc,gc,mc,vc,bc,yc,Ls,We,Po,Ao,Io,ft=class extends(Ls=qi,yc=[U],bc=[U],vc=[U],mc=[fe],gc=[fe],pc=[fe],Ls){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:s,plugins:o,effects:a}=n,l=sc(n,["modifiers","type","sensors","plugins","effects"]);super(jo($o({},l),{effects:()=>{var u;return[...(u=a?.())!=null?u:[],()=>{const{manager:c,plugins:d}=this;if(!(!c||!d))for(const f of d){const{plugin:h}=xr(f);c.registry.plugins.register(h)}}]}}),t),N(We,5,this),Q(this,Po,N(We,8,this)),N(We,11,this),Q(this,Ao,N(We,12,this)),N(We,15,this),Q(this,Io,N(We,16,this,this.isDragSource?"dragging":"idle")),N(We,19,this),this.type=i,this.sensors=s,this.modifiers=r,this.alignment=l.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(const t of this.plugins){const n=xr(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status==="dropping"&&this.isDragSource}get isDragging(){return this.status==="dragging"&&this.isDragSource}get isDragSource(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.source)==null?void 0:t.id)===this.id}};We=Ln(Ls);Po=new WeakMap;Ao=new WeakMap;Io=new WeakMap;V(We,4,"type",yc,ft,Po);V(We,4,"modifiers",bc,ft,Ao);V(We,4,"status",vc,ft,Io);V(We,2,"isDropping",mc,ft);V(We,2,"isDragging",gc,ft);V(We,2,"isDragSource",pc,ft);en(We,ft);var xc,wc,kc,Sc,$c,jc,Ns,we,Ro,Wo,zo,Lo,No,pt=class extends(Ns=qi,jc=[U],$c=[U],Sc=[U],kc=[U],wc=[U],xc=[fe],Ns){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:s,type:o}=n,a=sc(n,["accept","collisionDetector","collisionPriority","type"]);super(a,t),N(we,5,this),Q(this,Ro,N(we,8,this)),N(we,11,this),Q(this,Wo,N(we,12,this)),N(we,15,this),Q(this,zo,N(we,16,this)),N(we,19,this),Q(this,Lo,N(we,20,this)),N(we,23,this),Q(this,No,N(we,24,this)),N(we,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=s,this.type=o}accepts(e){const{accept:t}=this;return t?typeof t=="function"?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.target)==null?void 0:t.id)===this.id}};we=Ln(Ns);Ro=new WeakMap;Wo=new WeakMap;zo=new WeakMap;Lo=new WeakMap;No=new WeakMap;V(we,4,"accept",jc,pt,Ro);V(we,4,"type",$c,pt,Wo);V(we,4,"collisionDetector",Sc,pt,zo);V(we,4,"collisionPriority",kc,pt,Lo);V(we,4,"shape",wc,pt,No);V(we,2,"isDropTarget",xc,pt);en(we,pt);var _h=class{constructor(){this.registry=new Map}addEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){const{registry:n}=this,r=n.get(e);if(r)for(const i of r)i(...t)}},Fh=class extends _h{constructor(e){super(),this.manager=e}dispatch(e,t){const n=[t,this.manager];super.dispatch(e,...n)}};function ci(e,t=!0){let n=!1;return jo($o({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var Hh=class extends Ar{constructor(e){super(e);const t=(r,i)=>r.map(({id:s})=>s).join("")===i.map(({id:s})=>s).join("");let n=[];this.destroy=Dr(()=>{const{dragOperation:r,collisionObserver:i}=e;r.status.initializing&&(n=[],i.enable())},()=>{const{collisionObserver:r,monitor:i}=e,{collisions:s}=r;if(r.isDisabled()||qi.pendingIdChanges)return;const o=ci({collisions:s});if(i.dispatch("collision",o),o.defaultPrevented||t(s,n))return;n=s;const[a]=s;q(()=>{var l;a?.id!==((l=e.dragOperation.target)==null?void 0:l.id)&&(r.disable(),e.actions.setDropTarget(a?.id).then(()=>{r.enable()}))})})}},Nn=(e=>(e[e.Lowest=0]="Lowest",e[e.Low=1]="Low",e[e.Normal=2]="Normal",e[e.High=3]="High",e[e.Highest=4]="Highest",e))(Nn||{}),_n=(e=>(e[e.Collision=0]="Collision",e[e.ShapeIntersection=1]="ShapeIntersection",e[e.PointerIntersection=2]="PointerIntersection",e))(_n||{}),Cc,Oc,Mc,Ec,Dc,Tc,Pc,et,_o;Pc=[U],Tc=[fe],Dc=[fe],Ec=[fe],Mc=[fe],Oc=[fe],Cc=[fe];var kt=class{constructor(){N(et,5,this),Q(this,_o,N(et,8,this,"idle")),N(et,11,this)}get current(){return this.value}get idle(){return this.value==="idle"}get initializing(){return this.value==="initializing"}get initialized(){const{value:e}=this;return e!=="idle"&&e!=="initialization-pending"}get dragging(){return this.value==="dragging"}get dropped(){return this.value==="dropped"}set(e){this.value=e}};et=Ln(null);_o=new WeakMap;V(et,4,"value",Pc,kt,_o);V(et,2,"current",Tc,kt);V(et,2,"idle",Dc,kt);V(et,2,"initializing",Ec,kt);V(et,2,"initialized",Mc,kt);V(et,2,"dragging",Oc,kt);V(et,2,"dropped",Cc,kt);en(et,kt);var qh=class{constructor(e){this.manager=e}setDragSource(e){const{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e=="string"||typeof e=="number"?e:e.id}setDropTarget(e){return q(()=>{const{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;const r=ci({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return q(()=>{const{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw new Error("Cannot start a drag operation without a drag source");if(!t.status.idle)throw new Error("Cannot start a drag operation while another is active");const n=new AbortController,{event:r,coordinates:i}=e;de(()=>{t.status.set("initialization-pending"),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});const s=ci({operation:t.snapshot()});return this.manager.monitor.dispatch("beforedragstart",s),s.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set("initializing"),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;const{status:o}=t;o.current==="initializing"&&de(()=>{t.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return q(()=>{var t,n;const{dragOperation:r}=this.manager,{status:i,controller:s}=r;if(!i.dragging||!s||s.signal.aborted)return;const o=ci({nativeEvent:e.event,operation:r.snapshot(),by:e.by,to:e.to},(t=e.cancelable)!=null?t:!0);((n=e.propagate)==null||n)&&this.manager.monitor.dispatch("dragmove",o),queueMicrotask(()=>{var a,l,u,c,d;if(o.defaultPrevented)return;const f=(d=e.to)!=null?d:{x:r.position.current.x+((l=(a=e.by)==null?void 0:a.x)!=null?l:0),y:r.position.current.y+((c=(u=e.by)==null?void 0:u.y)!=null?c:0)};r.position.current=f})})}stop(e={}){return q(()=>{var t,n;const{dragOperation:r}=this.manager,{controller:i}=r;if(!i||i.signal.aborted)return;let s;const o=()=>{const l={resume:()=>{},abort:()=>{}};return s=new Promise((u,c)=>{l.resume=u,l.abort=c}),l};i.abort();const a=()=>{this.manager.renderer.rendering.then(()=>{r.status.set("dropped");const l=q(()=>{var c;return((c=r.source)==null?void 0:c.status)==="dropping"}),u=()=>{r.controller===i&&(r.controller=void 0),r.reset()};if(l){const{source:c}=r,d=nt(()=>{c?.status==="idle"&&(d(),u())})}else this.manager.renderer.rendering.then(u)})};r.canceled=(t=e.canceled)!=null?t:!1,this.manager.monitor.dispatch("dragend",{nativeEvent:e.event,operation:r.snapshot(),canceled:(n=e.canceled)!=null?n:!1,suspend:o}),s?s.then(a).catch(()=>r.reset()):a()})}},Cn=class extends Pe{constructor(e,t){super(e,t),this.manager=e,this.options=t}},Uh=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(const n of e??[])n.controller=this}onEvent(e){var t;if(!this.activated)if((t=this.constraints)!=null&&t.length)for(const n of this.constraints)n.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},di,Ac=class{constructor(e){this.options=e,Q(this,di)}set controller(e){Ye(this,di,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var t;(t=ue(this,di))==null||t.activate(e)}};di=new WeakMap;var Da=class extends Pe{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},Vh=class{constructor(e){this.draggables=new Ea,this.droppables=new Ea,this.plugins=new cs(e),this.sensors=new cs(e),this.modifiers=new cs(e)}register(e,t){if(e instanceof ft)return this.draggables.register(e.id,e);if(e instanceof pt)return this.droppables.register(e.id,e);if(e.prototype instanceof Da)return this.modifiers.register(e,t);if(e.prototype instanceof Cn)return this.sensors.register(e,t);if(e.prototype instanceof Pe)return this.plugins.register(e,t);throw new Error("Invalid instance type")}unregister(e){if(e instanceof qi)return e instanceof ft?this.draggables.unregister(e.id,e):e instanceof pt?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Da)return this.modifiers.unregister(e);if(e.prototype instanceof Cn)return this.sensors.unregister(e);if(e.prototype instanceof Pe)return this.plugins.unregister(e);throw new Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},Ic,Rc,Wc,zc,Lc,Nc,_c,Fc,Hc,er,ui,pn,le,Fo,Ho,qo,Uo,Vo,tr;Hc=[fe],Fc=[U],_c=[U],Nc=[U],Lc=[U],zc=[U],Wc=[fe],Rc=[fe],Ic=[fe];var lt=class{constructor(e){N(le,5,this),Q(this,er),Q(this,ui),Q(this,pn,new Jt(void 0,(t,n)=>t&&n?t.equals(n):t===n)),this.status=new kt,Q(this,Fo,N(le,8,this,!1)),N(le,11,this),Q(this,Ho,N(le,12,this,null)),N(le,15,this),Q(this,qo,N(le,16,this,null)),N(le,19,this),Q(this,Uo,N(le,20,this,null)),N(le,23,this),Q(this,Vo,N(le,24,this,[])),N(le,27,this),this.position=new Hi({x:0,y:0}),Q(this,tr,{x:0,y:0}),Ye(this,er,e)}get shape(){const{current:e,initial:t,previous:n}=ue(this,pn);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?ue(this,pn).current=e:ue(this,pn).reset()}get source(){var e;const t=this.sourceIdentifier;if(t==null)return null;const n=ue(this,er).registry.draggables.get(t);return n&&Ye(this,ui,n),(e=n??ue(this,ui))!=null?e:null}get target(){var e;const t=this.targetIdentifier;return t!=null&&(e=ue(this,er).registry.droppables.get(t))!=null?e:null}get transform(){const{x:e,y:t}=this.position.delta;let n={x:e,y:t};for(const r of this.modifiers)n=r.apply(jo($o({},this.snapshot()),{transform:n}));return Ye(this,tr,n),n}snapshot(){return q(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:ue(this,tr),shape:this.shape?ls(this.shape):null,position:ls(this.position),status:ls(this.status),canceled:this.canceled}))}reset(){de(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,ue(this,pn).reset(),this.position.reset({x:0,y:0}),Ye(this,tr,{x:0,y:0}),this.modifiers=[]})}};le=Ln(null);er=new WeakMap;ui=new WeakMap;pn=new WeakMap;Fo=new WeakMap;Ho=new WeakMap;qo=new WeakMap;Uo=new WeakMap;Vo=new WeakMap;tr=new WeakMap;V(le,2,"shape",Hc,lt);V(le,4,"canceled",Fc,lt,Fo);V(le,4,"activatorEvent",_c,lt,Ho);V(le,4,"sourceIdentifier",Nc,lt,qo);V(le,4,"targetIdentifier",Lc,lt,Uo);V(le,4,"modifiers",zc,lt,Vo);V(le,2,"source",Wc,lt);V(le,2,"target",Rc,lt);V(le,2,"transform",Ic,lt);en(le,lt);var Gh={get rendering(){return Promise.resolve()}};function at(e,t){return typeof e=="function"?e(t):e??t}var Yh=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(d=>d.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};var t;const n=e??{},r=at(n.plugins,[]),i=at(n.sensors,[]),s=at(n.modifiers,[]),o=(t=n.renderer)!=null?t:Gh,a=new Fh(this),l=new Vh(this);this.registry=l,this.monitor=a,this.renderer=o,this.actions=new qh(this),this.dragOperation=new lt(this),this.collisionObserver=new Nh(this),this.plugins=[Hh,...r],this.modifiers=s,this.sensors=i;const{destroy:u}=this,c=Dr(()=>{var d,f,h;const v=q(()=>this.dragOperation.modifiers),g=this.modifiers;for(const w of v)g.includes(w)||w.destroy();this.dragOperation.modifiers=(h=(f=(d=this.dragOperation.source)==null?void 0:d.modifiers)==null?void 0:f.map(w=>{const{plugin:y,options:p}=xr(w);return new y(this,p)}))!=null?h:g});this.destroy=()=>{c(),u()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},qc=e=>{throw TypeError(e)},Go=(e,t,n)=>t.has(e)||qc("Cannot "+n),L=(e,t,n)=>(Go(e,t,"read from private field"),t.get(e)),qe=(e,t,n)=>t.has(e)?qc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ge=(e,t,n,r)=>(Go(e,t,"write to private field"),t.set(e,n),n),Uc=(e,t,n)=>(Go(e,t,"access private method"),n);function Ui(e){return e?e instanceof KeyframeEffect?!0:"getKeyframes"in e&&typeof e.getKeyframes=="function":!1}function Vc(e,t){const n=e.getAnimations();let r=null;for(const i of n){if(i.playState!=="running")continue;const{effect:s}=i,o=(Ui(s)?s.getKeyframes():[]).filter(t);o.length>0&&(r=[o[o.length-1],i])}return r}function Vi(e){const{width:t,height:n,top:r,left:i,bottom:s,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:s,right:o}}function Yo(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ir(e){return"nodeType"in e}function Xe(e){var t,n,r;return e?Yo(e)?e:Ir(e)?"defaultView"in e?(t=e.defaultView)!=null?t:window:(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window:window:window}function Xo(e){const{Document:t}=Xe(e);return e instanceof t||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function Tt(e){return!e||Yo(e)?!1:e instanceof Xe(e).HTMLElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("html")}function Gc(e){return e instanceof Xe(e).SVGElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("svg")}function Fn(e){return e?Yo(e)?e.document:Ir(e)?Xo(e)?e:Tt(e)||Gc(e)?e.ownerDocument:document:document:document}function Xh(e){var t,n,r,i;const{documentElement:s}=Fn(e),o=Xe(e).visualViewport,a=(t=o?.width)!=null?t:s.clientWidth,l=(n=o?.height)!=null?n:s.clientHeight,u=(r=o?.offsetTop)!=null?r:0,c=(i=o?.offsetLeft)!=null?i:0;return{top:u,left:c,right:c+a,bottom:u+l,width:a,height:l}}function Kh(e,t){if(Bh(e)&&e.open===!1)return!1;const{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n==="visible"&&r==="visible"&&i==="visible"}function Bh(e){return e.tagName==="DETAILS"}function kr(e,t=e.getBoundingClientRect(),n=0){var r,i,s,o,a;let l=t;const{ownerDocument:u}=e,c=(r=u.defaultView)!=null?r:window;let d=e.parentElement;for(;d&&d!==u.documentElement;){if(!Kh(d)){const x=d.getBoundingClientRect(),m=n*(x.bottom-x.top),k=n*(x.right-x.left),$=n*(x.bottom-x.top),C=n*(x.right-x.left);l={top:Math.max(l.top,x.top-m),right:Math.min(l.right,x.right+k),bottom:Math.min(l.bottom,x.bottom+$),left:Math.max(l.left,x.left-C),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top}d=d.parentElement}const f=c.visualViewport,h=(i=f?.offsetTop)!=null?i:0,v=(s=f?.offsetLeft)!=null?s:0,g=(o=f?.width)!=null?o:c.innerWidth,w=(a=f?.height)!=null?a:c.innerHeight,y=n*w,p=n*g;return l={top:Math.max(l.top,h-y),right:Math.min(l.right,v+g+p),bottom:Math.min(l.bottom,h+w+y),left:Math.max(l.left,v-p),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l}function On(e){return{x:e.clientX,y:e.clientY}}var Yc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _s(e=document,t=new Set){if(t.has(e))return[];t.add(e);const n=[e];for(const r of Array.from(e.querySelectorAll("iframe, frame")))try{const i=r.contentDocument;i&&!t.has(i)&&n.push(..._s(i,t))}catch{}try{const r=e.defaultView;if(r&&r!==window.top){const i=r.parent;i&&i.document&&i.document!==e&&n.push(..._s(i.document,t))}}catch{}return n}function Ko(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Xc(){var e,t;const n=Ko()?window.visualViewport:null;return{x:(e=n?.offsetLeft)!=null?e:0,y:(t=n?.offsetTop)!=null?t:0}}function Bo(e){return!e||!Ir(e)?!1:e instanceof Xe(e).ShadowRoot}function $i(e){if(e&&Ir(e)){let t=e.getRootNode();if(Bo(t)||t instanceof Document)return t}return Fn(e)}function Qo(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function Qh(e){const t="input, textarea, select, canvas, [contenteditable]",n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((i,s)=>{const o=r[s];Ta(i)&&Ta(o)&&(i.type!=="file"&&(i.value=o.value),i.type==="radio"&&i.name&&(i.name=`Cloned__${i.name}`)),Pa(i)&&Pa(o)&&o.width>0&&o.height>0&&i.getContext("2d")?.drawImage(o,0,0)}),n}function Ta(e){return"value"in e}function Pa(e){return e.tagName==="CANVAS"}function Kc(e,{x:t,y:n}){const r=e.elementFromPoint(t,n);if(Zh(r)){const{contentDocument:i}=r;if(i){const{left:s,top:o}=r.getBoundingClientRect();return Kc(i,{x:t-s,y:n-o})}}return r}function Zh(e){return e?.tagName==="IFRAME"}var Fs=new WeakMap;function Jh(e){return e.closest(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CKmZ4HG7.js","assets/index-TiWjmdoW.js","assets/index-DUqldpo0.css","assets/index-ByieDZlo.js","assets/index-CRAwrhYM.js","assets/index-CdExa3Pk.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as S,aM as ju,aN as yn,j as b,a9 as he,aO as Cu,at as Wt,N as pe,aP as Ou,aQ as Mu,U as $l,ar as Eu,aR as Du,aS as ri,aT as xa,aU as Tu,a4 as jl,a0 as Pu,ay as ke,a5 as Cl,aV as Au,a8 as Ol,aW as Iu,aX as ii,G as tt,aY as Ml,aZ as ks,H as kn,I as Ss,O as mo,T as ne,a_ as Ru,a$ as Wu,ax as Ni,am as Te,aq as bt,b0 as $s,an as El,Y as Dl,b1 as zu,b2 as Lu,Q as Nu,W as _u,b3 as Fu,b4 as Hu,b5 as qu,b6 as Uu,b7 as Vu,b8 as Gu,b9 as Yu,ba as Xu,bb as Ku,bc as Tl,bd as Bu,be as si,bf as Qu,bg as Qt,bh as Zu,bi as Ju,aI as eh}from"./index-TiWjmdoW.js";import{T as th,a as wa}from"./ToggleButtonGroup-CJT2JKTC.js";var ka={},nh=Symbol.for("preact-signals");function _i(){if(yt>1)yt--;else{var e,t=!1;for((function(){var i=wi;for(wi=void 0;i!==void 0;){var s=i.S;if(s.v===i.v)for(var o=s.t;o!==void 0;o=o.x)o.i===i.i&&(o.i=s.i);i=i.o}})();pr!==void 0;){var n=pr;for(pr=void 0,xi++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Al(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=r}}if(xi=0,yt--,t)throw e}}function de(e){if(yt>0)return e();js=++rh,yt++;try{return e()}finally{_i()}}var fr,ie=void 0;function q(e){var t=ie,n=fr;ie=void 0,fr=void 0;try{return e()}finally{ie=t,fr=n}}var pr=void 0,yt=0,xi=0,rh=0,js=0,wi=void 0,ki=0;function Pl(e){if(ie!==void 0){var t=e.n;if(t===void 0||t.t!==ie)return t={i:0,S:e,p:ie.s,n:void 0,t:ie,e:void 0,x:void 0,r:t},ie.s!==void 0&&(ie.s.n=t),ie.s=t,e.n=t,32&ie.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=ie.s,t.n=void 0,ie.s.n=t,ie.s=t),t}}function Le(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Le.prototype.brand=nh;Le.prototype.h=function(){return!0};Le.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:q(function(){var r;(r=t.W)==null||r.call(t)}))};Le.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&q(function(){var i;(i=t.Z)==null||i.call(t)}))}};Le.prototype.subscribe=function(e){var t=this;return nt(function(){var n=t.value;q(function(){return e(n)})},{name:"sub"})};Le.prototype.valueOf=function(){return this.value};Le.prototype.toString=function(){return this.value+""};Le.prototype.toJSON=function(){return this.value};Le.prototype.peek=function(){var e=this;return q(function(){return e.value})};Object.defineProperty(Le.prototype,"value",{get:function(){var e=Pl(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(xi>100)throw new Error("Cycle detected");(function(n){yt!==0&&xi===0&&n.l!==js&&(n.l=js,wi={S:n,v:n.v,i:n.i,o:wi})})(this),this.v=e,this.i++,ki++,yt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{_i()}}}});function An(e,t){return new Le(e,t)}function Al(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Il(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Rl(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Zt(e,t){Le.call(this,void 0,t),this.x=e,this.s=void 0,this.g=ki-1,this.f=4}Zt.prototype=new Le;Zt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ki))return!0;if(this.g=ki,this.f|=1,this.i>0&&!Al(this))return this.f&=-2,!0;var e=ie;try{Il(this),ie=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return ie=e,Rl(this),this.f&=-2,!0};Zt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Le.prototype.S.call(this,e)};Zt.prototype.U=function(e){if(this.t!==void 0&&(Le.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Zt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Zt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Pl(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Sa(e,t){return new Zt(e,t)}function Wl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){yt++;var n=ie;ie=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,vo(e),r}finally{ie=n,_i()}}}function vo(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Wl(e)}function ih(e){if(ie!==this)throw new Error("Out-of-order effect");Rl(this),ie=e,this.f&=-2,8&this.f&&vo(this),_i()}function In(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,fr&&fr.push(this)}In.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};In.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Wl(this),Il(this),yt++;var e=ie;return ie=this,ih.bind(this,e)};In.prototype.N=function(){2&this.f||(this.f|=2,this.u=pr,pr=this)};In.prototype.d=function(){this.f|=8,1&this.f||vo(this)};In.prototype.dispose=function(){this.d()};function nt(e,t){var n=new In(e,t);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var sh=Object.create,bo=Object.defineProperty,oh=Object.defineProperties,ah=Object.getOwnPropertyDescriptor,lh=Object.getOwnPropertyDescriptors,$a=Object.getOwnPropertySymbols,ch=Object.prototype.hasOwnProperty,dh=Object.prototype.propertyIsEnumerable,uh=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Rn=e=>{throw TypeError(e)},Cs=(e,t,n)=>t in e?bo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hh=(e,t)=>{for(var n in t||(t={}))ch.call(t,n)&&Cs(e,n,t[n]);if($a)for(var n of $a(t))dh.call(t,n)&&Cs(e,n,t[n]);return e},fh=(e,t)=>oh(e,lh(t)),ja=(e,t)=>bo(e,"name",{value:t,configurable:!0}),ph=e=>{var t;return[,,,sh((t=void 0)!=null?t:null)]},zl=["class","method","getter","setter","accessor","field","value","get","set"],Qn=e=>e!==void 0&&typeof e!="function"?Rn("Function expected"):e,gh=(e,t,n,r,i)=>({kind:zl[e],name:t,metadata:r,addInitializer:s=>n._?Rn("Already initialized"):i.push(Qn(s||null))}),Ll=(e,t)=>Cs(t,uh("metadata"),e[3]),Rt=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},Wn=(e,t,n,r,i,s)=>{var o,a,l,u,c,d=t&7,f=!!(t&8),h=!!(t&16),v=d>3?e.length+1:d?f?1:2:0,g=zl[d+5],w=d>3&&(e[v-1]=[]),y=e[v]||(e[v]=[]),p=d&&(!h&&!f&&(i=i.prototype),d<5&&(d>3||!h)&&ah(d<4?i:{get[n](){return Qe(this,s)},set[n](m){return Ct(this,s,m)}},n));d?h&&d<4&&ja(s,(d>2?"set ":d>1?"get ":"")+n):ja(i,n);for(var x=r.length-1;x>=0;x--)u=gh(d,n,l={},e[3],y),d&&(u.static=f,u.private=h,c=u.access={has:h?m=>mh(i,m):m=>n in m},d^3&&(c.get=h?m=>(d^1?Qe:vh)(m,i,d^4?s:p.get):m=>m[n]),d>2&&(c.set=h?(m,k)=>Ct(m,i,k,d^4?s:p.set):(m,k)=>m[n]=k)),a=(0,r[x])(d?d<4?h?s:p[g]:d>4?void 0:{get:p.get,set:p.set}:i,u),l._=1,d^4||a===void 0?Qn(a)&&(d>4?w.unshift(a):d?h?s=a:p[g]=a:i=a):typeof a!="object"||a===null?Rn("Object expected"):(Qn(o=a.get)&&(p.get=o),Qn(o=a.set)&&(p.set=o),Qn(o=a.init)&&w.unshift(o));return d||Ll(e,i),p&&bo(i,n,p),h?d^4?s:p:i},yo=(e,t,n)=>t.has(e)||Rn("Cannot "+n),mh=(e,t)=>Object(t)!==t?Rn('Cannot use the "in" operator on this value'):e.has(t),Qe=(e,t,n)=>(yo(e,t,"read from private field"),n?n.call(e):t.get(e)),Zn=(e,t,n)=>t.has(e)?Rn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ct=(e,t,n,r)=>(yo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),vh=(e,t,n)=>(yo(e,t,"access private method"),n);function Os(e,t){if(t){let n;return Sa(()=>{const r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return Sa(e)}function st(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e=="function"&&typeof t=="function")return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((n,r)=>!st(n,t[r]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:!n.some(i=>!st(e[i],t[i]))}return!1}function U({get:e},t){return{init(n){return An(n)},get(){return e.call(this).value},set(n){const r=e.call(this);r.peek()!==n&&(r.value=n)}}}function fe(e,t){const n=new WeakMap;return function(){let r=n.get(this);return r||(r=Os(e.bind(this)),n.set(this,r)),r.value}}function is(e=!0){return function(t,n){n.addInitializer(function(){const r=n.kind==="field"?this:n.static?this:Object.getPrototypeOf(this),i=Object.getOwnPropertyDescriptor(r,n.name);i&&Object.defineProperty(r,n.name,fh(hh({},i),{enumerable:e}))})}}function Dr(...e){const t=e.map(n=>nt(n));return()=>t.forEach(n=>n())}var Nl,_l,Fl,Hl,ql,Ul,Re,xo,ss,Ms,Es,De,wo,os,Vl,Ds,ko,as,Ts,Ps;Ul=[U],ql=[U],Hl=[U],Fl=[is()],_l=[is()],Nl=[is()];var Jt=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,Rt(Re,5,this),Zn(this,De),Zn(this,xo,Rt(Re,8,this)),Rt(Re,11,this),Zn(this,wo,Rt(Re,12,this)),Rt(Re,15,this),Zn(this,ko,Rt(Re,16,this)),Rt(Re,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return Qe(this,De,Ts)}get initial(){return Qe(this,De,Ms)}get previous(){return Qe(this,De,Vl)}set current(e){const t=q(()=>Qe(this,De,Ts));e&&t&&this.equals(t,e)||de(()=>{Qe(this,De,Ms)||Ct(this,De,e,Es),Ct(this,De,t,Ds),Ct(this,De,e,Ps)})}reset(e=this.defaultValue){de(()=>{Ct(this,De,void 0,Ds),Ct(this,De,e,Es),Ct(this,De,e,Ps)})}};Re=ph();xo=new WeakMap;De=new WeakSet;wo=new WeakMap;ko=new WeakMap;ss=Wn(Re,20,"#initial",Ul,De,xo),Ms=ss.get,Es=ss.set;os=Wn(Re,20,"#previous",ql,De,wo),Vl=os.get,Ds=os.set;as=Wn(Re,20,"#current",Hl,De,ko),Ts=as.get,Ps=as.set;Wn(Re,2,"current",Fl,Jt);Wn(Re,2,"initial",_l,Jt);Wn(Re,2,"previous",Nl,Jt);Ll(Re,Jt);function ls(e){return q(()=>{const t={};for(const n in e)t[n]=e[n];return t})}var zt,bh=class{constructor(){Zn(this,zt,new WeakMap)}get(e,t){var n;return e?(n=Qe(this,zt).get(e))==null?void 0:n.get(t):void 0}set(e,t,n){var r;if(e)return Qe(this,zt).has(e)||Qe(this,zt).set(e,new Map),(r=Qe(this,zt).get(e))==null?void 0:r.set(t,n)}clear(e){var t;return e?(t=Qe(this,zt).get(e))==null?void 0:t.clear():void 0}};zt=new WeakMap;var yh=Object.create,Gl=Object.defineProperty,xh=Object.getOwnPropertyDescriptor,Ca=Object.getOwnPropertySymbols,wh=Object.prototype.hasOwnProperty,kh=Object.prototype.propertyIsEnumerable,Yl=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Fi=e=>{throw TypeError(e)},Oa=Math.pow,As=(e,t,n)=>t in e?Gl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sh=(e,t)=>{for(var n in t||(t={}))wh.call(t,n)&&As(e,n,t[n]);if(Ca)for(var n of Ca(t))kh.call(t,n)&&As(e,n,t[n]);return e},$h=e=>{var t;return[,,,yh((t=e?.[Yl("metadata")])!=null?t:null)]},Xl=["class","method","getter","setter","accessor","field","value","get","set"],Kl=e=>e!==void 0&&typeof e!="function"?Fi("Function expected"):e,jh=(e,t,n,r,i)=>({kind:Xl[e],name:t,metadata:r,addInitializer:s=>n._?Fi("Already initialized"):i.push(Kl(s||null))}),Ch=(e,t)=>As(t,Yl("metadata"),e[3]),Oh=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Bl=(e,t,n,r,i,s)=>{for(var o,a,l,u,c=t&7,d=!1,f=!1,h=2,v=Xl[c+5],g=e[h]||(e[h]=[]),w=(i=i.prototype,xh(i,n)),y=r.length-1;y>=0;y--)l=jh(c,n,a={},e[3],g),l.static=d,l.private=f,u=l.access={has:p=>n in p},u.get=p=>p[n],o=(0,r[y])(w[v],l),a._=1,Kl(o)&&(w[v]=o);return w&&Gl(i,n,w),i},Ql=(e,t,n)=>t.has(e)||Fi("Cannot "+n),Mh=(e,t,n)=>(Ql(e,t,"read from private field"),t.get(e)),Eh=(e,t,n)=>t.has(e)?Fi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Dh=(e,t,n,r)=>(Ql(e,t,"write to private field"),t.set(e,n),n),Ze=class Is{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new Is(t.x-n.x,t.y-n.y)}static distance(t,n){return Math.hypot(t.x-n.x,t.y-n.y)}static equals(t,n){return t.x===n.x&&t.y===n.y}static from({x:t,y:n}){return new Is(t,n)}},ht=class Lt{constructor(t,n,r,i){this.left=t,this.top=n,this.width=r,this.height=i,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){const{top:r,left:i,width:s,height:o,scale:a}=this,l=new Lt(i+t,r+n,s,o);return l.scale=Sh({},a),l}get boundingRectangle(){const{width:t,height:n,left:r,top:i,right:s,bottom:o}=this;return{width:t,height:n,left:r,top:i,right:s,bottom:o}}get center(){const{left:t,top:n,right:r,bottom:i}=this;return new Ze((t+r)/2,(n+i)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Lt))return!1;const{left:n,top:r,width:i,height:s}=this;return n===t.left&&r===t.top&&i===t.width&&s===t.height}containsPoint(t){const{top:n,left:r,bottom:i,right:s}=this;return n<=t.y&&t.y<=i&&r<=t.x&&t.x<=s}intersectionArea(t){return t instanceof Lt?Th(this,t):0}intersectionRatio(t){const{area:n}=this,r=this.intersectionArea(t);return r/(t.area+n-r)}get bottom(){const{top:t,height:n}=this;return t+n}get right(){const{left:t,width:n}=this;return t+n}get aspectRatio(){const{width:t,height:n}=this;return t/n}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:i}){return new Lt(n,t,r,i)}static delta(t,n,r={x:"center",y:"center"}){const i=(s,o)=>{const a=r[o],l=o==="x"?s.left:s.top,u=o==="x"?s.width:s.height;return a=="start"?l:a=="end"?l+u:l+u/2};return Ze.delta({x:i(t,"x"),y:i(t,"y")},{x:i(n,"x"),y:i(n,"y")})}static intersectionRatio(t,n){return Lt.from(t).intersectionRatio(Lt.from(n))}};function Th(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,a=s-n;return r<i&&n<s?o*a:0}var Zl,Jl,Rs,oi,Tr,Hi=class extends(Rs=Jt,Jl=[fe],Zl=[fe],Rs){constructor(e){const t=Ze.from(e);super(t,(n,r)=>Ze.equals(n,r)),Oh(Tr,5,this),Eh(this,oi,0),this.velocity={x:0,y:0}}get delta(){return Ze.delta(this.current,this.initial)}get direction(){const{current:e,previous:t}=this;if(!t)return null;const n={x:e.x-t.x,y:e.y-t.y};return!n.x&&!n.y?null:Math.abs(n.x)>Math.abs(n.y)?n.x>0?"right":"left":n.y>0?"down":"up"}get current(){return super.current}set current(e){const{current:t}=this,n=Ze.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),s=i-Mh(this,oi),o=a=>Math.round(a/s*100);de(()=>{Dh(this,oi,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(Ze.from(e)),this.velocity={x:0,y:0}}};Tr=$h(Rs);oi=new WeakMap;Bl(Tr,2,"delta",Jl,Hi);Bl(Tr,2,"direction",Zl,Hi);Ch(Tr,Hi);function Ws({x:e,y:t},n){const r=Math.abs(e),i=Math.abs(t);return typeof n=="number"?Math.sqrt(Oa(r,2)+Oa(i,2))>n:"x"in n&&"y"in n?r>n.x&&i>n.y:"x"in n?r>n.x:"y"in n?i>n.y:!1}var ec=(e=>(e.Horizontal="x",e.Vertical="y",e))(ec||{}),tc=Object.values(ec),Ph=Object.create,So=Object.defineProperty,Ah=Object.defineProperties,Ih=Object.getOwnPropertyDescriptor,Rh=Object.getOwnPropertyDescriptors,Si=Object.getOwnPropertySymbols,nc=Object.prototype.hasOwnProperty,rc=Object.prototype.propertyIsEnumerable,ic=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),zn=e=>{throw TypeError(e)},zs=(e,t,n)=>t in e?So(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t)=>{for(var n in t||(t={}))nc.call(t,n)&&zs(e,n,t[n]);if(Si)for(var n of Si(t))rc.call(t,n)&&zs(e,n,t[n]);return e},jo=(e,t)=>Ah(e,Rh(t)),Ma=(e,t)=>So(e,"name",{value:t,configurable:!0}),sc=(e,t)=>{var n={};for(var r in e)nc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Si)for(var r of Si(e))t.indexOf(r)<0&&rc.call(e,r)&&(n[r]=e[r]);return n},Ln=e=>{var t;return[,,,Ph((t=e?.[ic("metadata")])!=null?t:null)]},oc=["class","method","getter","setter","accessor","field","value","get","set"],Jn=e=>e!==void 0&&typeof e!="function"?zn("Function expected"):e,Wh=(e,t,n,r,i)=>({kind:oc[e],name:t,metadata:r,addInitializer:s=>n._?zn("Already initialized"):i.push(Jn(s||null))}),en=(e,t)=>zs(t,ic("metadata"),e[3]),N=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},V=(e,t,n,r,i,s)=>{var o,a,l,u,c,d=t&7,f=!!(t&8),h=!!(t&16),v=d>3?e.length+1:d?f?1:2:0,g=oc[d+5],w=d>3&&(e[v-1]=[]),y=e[v]||(e[v]=[]),p=d&&(!h&&!f&&(i=i.prototype),d<5&&(d>3||!h)&&Ih(d<4?i:{get[n](){return ue(this,s)},set[n](m){return Ye(this,s,m)}},n));d?h&&d<4&&Ma(s,(d>2?"set ":d>1?"get ":"")+n):Ma(i,n);for(var x=r.length-1;x>=0;x--)u=Wh(d,n,l={},e[3],y),d&&(u.static=f,u.private=h,c=u.access={has:h?m=>zh(i,m):m=>n in m},d^3&&(c.get=h?m=>(d^1?ue:ac)(m,i,d^4?s:p.get):m=>m[n]),d>2&&(c.set=h?(m,k)=>Ye(m,i,k,d^4?s:p.set):(m,k)=>m[n]=k)),a=(0,r[x])(d?d<4?h?s:p[g]:d>4?void 0:{get:p.get,set:p.set}:i,u),l._=1,d^4||a===void 0?Jn(a)&&(d>4?w.unshift(a):d?h?s=a:p[g]=a:i=a):typeof a!="object"||a===null?zn("Object expected"):(Jn(o=a.get)&&(p.get=o),Jn(o=a.set)&&(p.set=o),Jn(o=a.init)&&w.unshift(o));return d||en(e,i),p&&So(i,n,p),h?d^4?s:p:i},Co=(e,t,n)=>t.has(e)||zn("Cannot "+n),zh=(e,t)=>Object(t)!==t?zn('Cannot use the "in" operator on this value'):e.has(t),ue=(e,t,n)=>(Co(e,t,"read from private field"),n?n.call(e):t.get(e)),Q=(e,t,n)=>t.has(e)?zn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ye=(e,t,n,r)=>(Co(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),ac=(e,t,n)=>(Co(e,t,"access private method"),n);function lc(e,t){return{plugin:e,options:t}}function Pr(e){return t=>lc(e,t)}function xr(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var cc,wr,Oo,ai;cc=[U];var Pe=class{constructor(e,t){this.manager=e,this.options=t,Q(this,Oo,N(wr,8,this,!1)),N(wr,11,this),Q(this,ai,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return q(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){const t=nt(e.bind(this));return ue(this,ai).add(t),t}destroy(){ue(this,ai).forEach(e=>e())}static configure(e){return lc(this,e)}};wr=Ln(null);Oo=new WeakMap;ai=new WeakMap;V(wr,4,"disabled",cc,Pe,Oo);en(wr,Pe);var Ar=class extends Pe{},li,cs=class{constructor(e){this.manager=e,this.instances=new Map,Q(this,li,[])}get values(){return Array.from(this.instances.values())}set values(e){const t=e.map(xr).reduce((r,i)=>{const s=r.find(({plugin:o})=>o===i.plugin);return s?(s.options=i.options,r):[...r,i]},[]),n=t.map(({plugin:r})=>r);for(const r of ue(this,li))if(!n.includes(r)){if(r.prototype instanceof Ar)continue;this.unregister(r)}for(const{plugin:r,options:i}of t)this.register(r,i);Ye(this,li,n)}get(e){return this.instances.get(e)}register(e,t){const n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;const r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){const t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(const e of this.instances.values())e.destroy();this.instances.clear()}};li=new WeakMap;function Lh(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var Vr=[],hn,fn,Nh=class extends Pe{constructor(e){super(e),Q(this,hn),Q(this,fn),this.computeCollisions=this.computeCollisions.bind(this),Ye(this,fn,An(Vr)),this.destroy=Dr(()=>{const t=this.computeCollisions(),n=q(()=>this.manager.dragOperation.position.current);if(t!==Vr){const r=ue(this,hn);if(Ye(this,hn,n),r&&n.x==r.x&&n.y==r.y)return}else Ye(this,hn,void 0);ue(this,fn).value=t},()=>{const{dragOperation:t}=this.manager;t.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){q(()=>{e?ue(this,fn).value=this.computeCollisions():Ye(this,hn,void 0)})}computeCollisions(e,t){const{registry:n,dragOperation:r}=this.manager,{source:i,shape:s,status:o}=r;if(!o.initialized||!s)return Vr;const a=[],l=[];for(const u of e??n.droppables){if(u.disabled||i&&!u.accepts(i))continue;const c=t??u.collisionDetector;if(!c)continue;l.push(u),u.shape;const d=q(()=>c({droppable:u,dragOperation:r}));d&&(u.collisionPriority!=null&&(d.priority=u.collisionPriority),a.push(d))}return l.length===0?Vr:(a.sort(Lh),a)}get collisions(){return ue(this,fn).value}};hn=new WeakMap;fn=new WeakMap;var dc,uc,hc,Mo,fc,ot,Eo,xn,Do,To;hc=[U],uc=[U],dc=[U];var wt=class Nt{constructor(t,n){Q(this,Eo,N(ot,8,this)),N(ot,11,this),Q(this,xn),Q(this,Do,N(ot,12,this)),N(ot,15,this),Q(this,To,N(ot,16,this)),N(ot,19,this);const{effects:r,id:i,data:s={},disabled:o=!1,register:a=!0}=t;let l=i;Ye(this,xn,An(i)),this.manager=n,this.data=s,this.disabled=o,this.effects=()=>{var u;return[()=>{const{id:c,manager:d}=this;if(c!==l)return l=c,d?.registry.register(this),()=>d?.registry.unregister(this)},...(u=r?.())!=null?u:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),n&&a&&queueMicrotask(this.register)}get id(){var t,n;const r=ue(this,xn).value;return(n=(t=Nt.pendingIdChanges)==null?void 0:t.get(this))!=null?n:r}set id(t){var n,r;const i=(r=(n=Nt.pendingIdChanges)==null?void 0:n.get(this))!=null?r:ue(this,xn).peek();t!==i&&(Nt.pendingIdChanges||(Nt.pendingIdChanges=new Map,queueMicrotask(()=>{var s;return ac(s=Nt,Mo,fc).call(s)})),Nt.pendingIdChanges.set(this,t))}register(){var t;return(t=this.manager)==null?void 0:t.registry.register(this)}unregister(){var t;(t=this.manager)==null||t.registry.unregister(this)}destroy(){var t;(t=this.manager)==null||t.registry.unregister(this)}};ot=Ln(null);Mo=new WeakSet;fc=function(){const e=wt.pendingIdChanges;wt.pendingIdChanges=null,e&&de(()=>{for(const[t,n]of e)ue(t,xn).value=n})};Eo=new WeakMap;xn=new WeakMap;Do=new WeakMap;To=new WeakMap;V(ot,4,"manager",hc,wt,Eo);V(ot,4,"data",uc,wt,Do);V(ot,4,"disabled",dc,wt,To);Q(wt,Mo);en(ot,wt);wt.pendingIdChanges=null;var qi=wt,Ea=class{constructor(){this.map=An(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{const n=this.map.peek(),r=n.get(e),i=()=>this.unregister(e,t);if(r===t)return i;r&&r.id===e&&(this.cleanupFunctions.get(r)?.(),this.cleanupFunctions.delete(r));const s=new Map(n);for(const[a,l]of n)if(l===t&&a!==e){s.delete(a);break}s.set(e,t),this.map.value=s;const o=Dr(...t.effects());return this.cleanupFunctions.set(t,o),i},this.unregister=(e,t)=>{const n=this.map.peek();if(n.get(e)!==t)return;this.cleanupFunctions.get(t)?.(),this.cleanupFunctions.delete(t);const i=new Map(n);i.delete(e),this.map.value=i}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(const e of this)this.cleanupFunctions.get(e)?.(),e.destroy();this.map.value=new Map}},pc,gc,mc,vc,bc,yc,Ls,We,Po,Ao,Io,ft=class extends(Ls=qi,yc=[U],bc=[U],vc=[U],mc=[fe],gc=[fe],pc=[fe],Ls){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:s,plugins:o,effects:a}=n,l=sc(n,["modifiers","type","sensors","plugins","effects"]);super(jo($o({},l),{effects:()=>{var u;return[...(u=a?.())!=null?u:[],()=>{const{manager:c,plugins:d}=this;if(!(!c||!d))for(const f of d){const{plugin:h}=xr(f);c.registry.plugins.register(h)}}]}}),t),N(We,5,this),Q(this,Po,N(We,8,this)),N(We,11,this),Q(this,Ao,N(We,12,this)),N(We,15,this),Q(this,Io,N(We,16,this,this.isDragSource?"dragging":"idle")),N(We,19,this),this.type=i,this.sensors=s,this.modifiers=r,this.alignment=l.alignment,this.plugins=o}pluginConfig(e){if(this.plugins)for(const t of this.plugins){const n=xr(t);if(n.plugin===e)return n.options}}get isDropping(){return this.status==="dropping"&&this.isDragSource}get isDragging(){return this.status==="dragging"&&this.isDragSource}get isDragSource(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.source)==null?void 0:t.id)===this.id}};We=Ln(Ls);Po=new WeakMap;Ao=new WeakMap;Io=new WeakMap;V(We,4,"type",yc,ft,Po);V(We,4,"modifiers",bc,ft,Ao);V(We,4,"status",vc,ft,Io);V(We,2,"isDropping",mc,ft);V(We,2,"isDragging",gc,ft);V(We,2,"isDragSource",pc,ft);en(We,ft);var xc,wc,kc,Sc,$c,jc,Ns,we,Ro,Wo,zo,Lo,No,pt=class extends(Ns=qi,jc=[U],$c=[U],Sc=[U],kc=[U],wc=[U],xc=[fe],Ns){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:s,type:o}=n,a=sc(n,["accept","collisionDetector","collisionPriority","type"]);super(a,t),N(we,5,this),Q(this,Ro,N(we,8,this)),N(we,11,this),Q(this,Wo,N(we,12,this)),N(we,15,this),Q(this,zo,N(we,16,this)),N(we,19,this),Q(this,Lo,N(we,20,this)),N(we,23,this),Q(this,No,N(we,24,this)),N(we,27,this),this.accept=r,this.collisionDetector=i,this.collisionPriority=s,this.type=o}accepts(e){const{accept:t}=this;return t?typeof t=="function"?t(e):e.type?Array.isArray(t)?t.includes(e.type):e.type===t:!1:!0}get isDropTarget(){var e,t;return((t=(e=this.manager)==null?void 0:e.dragOperation.target)==null?void 0:t.id)===this.id}};we=Ln(Ns);Ro=new WeakMap;Wo=new WeakMap;zo=new WeakMap;Lo=new WeakMap;No=new WeakMap;V(we,4,"accept",jc,pt,Ro);V(we,4,"type",$c,pt,Wo);V(we,4,"collisionDetector",Sc,pt,zo);V(we,4,"collisionPriority",kc,pt,Lo);V(we,4,"shape",wc,pt,No);V(we,2,"isDropTarget",xc,pt);en(we,pt);var _h=class{constructor(){this.registry=new Map}addEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){const{registry:n}=this,r=n.get(e);if(r)for(const i of r)i(...t)}},Fh=class extends _h{constructor(e){super(),this.manager=e}dispatch(e,t){const n=[t,this.manager];super.dispatch(e,...n)}};function ci(e,t=!0){let n=!1;return jo($o({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var Hh=class extends Ar{constructor(e){super(e);const t=(r,i)=>r.map(({id:s})=>s).join("")===i.map(({id:s})=>s).join("");let n=[];this.destroy=Dr(()=>{const{dragOperation:r,collisionObserver:i}=e;r.status.initializing&&(n=[],i.enable())},()=>{const{collisionObserver:r,monitor:i}=e,{collisions:s}=r;if(r.isDisabled()||qi.pendingIdChanges)return;const o=ci({collisions:s});if(i.dispatch("collision",o),o.defaultPrevented||t(s,n))return;n=s;const[a]=s;q(()=>{var l;a?.id!==((l=e.dragOperation.target)==null?void 0:l.id)&&(r.disable(),e.actions.setDropTarget(a?.id).then(()=>{r.enable()}))})})}},Nn=(e=>(e[e.Lowest=0]="Lowest",e[e.Low=1]="Low",e[e.Normal=2]="Normal",e[e.High=3]="High",e[e.Highest=4]="Highest",e))(Nn||{}),_n=(e=>(e[e.Collision=0]="Collision",e[e.ShapeIntersection=1]="ShapeIntersection",e[e.PointerIntersection=2]="PointerIntersection",e))(_n||{}),Cc,Oc,Mc,Ec,Dc,Tc,Pc,et,_o;Pc=[U],Tc=[fe],Dc=[fe],Ec=[fe],Mc=[fe],Oc=[fe],Cc=[fe];var kt=class{constructor(){N(et,5,this),Q(this,_o,N(et,8,this,"idle")),N(et,11,this)}get current(){return this.value}get idle(){return this.value==="idle"}get initializing(){return this.value==="initializing"}get initialized(){const{value:e}=this;return e!=="idle"&&e!=="initialization-pending"}get dragging(){return this.value==="dragging"}get dropped(){return this.value==="dropped"}set(e){this.value=e}};et=Ln(null);_o=new WeakMap;V(et,4,"value",Pc,kt,_o);V(et,2,"current",Tc,kt);V(et,2,"idle",Dc,kt);V(et,2,"initializing",Ec,kt);V(et,2,"initialized",Mc,kt);V(et,2,"dragging",Oc,kt);V(et,2,"dropped",Cc,kt);en(et,kt);var qh=class{constructor(e){this.manager=e}setDragSource(e){const{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e=="string"||typeof e=="number"?e:e.id}setDropTarget(e){return q(()=>{const{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;const r=ci({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return q(()=>{const{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw new Error("Cannot start a drag operation without a drag source");if(!t.status.idle)throw new Error("Cannot start a drag operation while another is active");const n=new AbortController,{event:r,coordinates:i}=e;de(()=>{t.status.set("initialization-pending"),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});const s=ci({operation:t.snapshot()});return this.manager.monitor.dispatch("beforedragstart",s),s.defaultPrevented?(t.reset(),n.abort(),n):(t.status.set("initializing"),t.controller=n,this.manager.renderer.rendering.then(()=>{if(n.signal.aborted)return;const{status:o}=t;o.current==="initializing"&&de(()=>{t.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return q(()=>{var t,n;const{dragOperation:r}=this.manager,{status:i,controller:s}=r;if(!i.dragging||!s||s.signal.aborted)return;const o=ci({nativeEvent:e.event,operation:r.snapshot(),by:e.by,to:e.to},(t=e.cancelable)!=null?t:!0);((n=e.propagate)==null||n)&&this.manager.monitor.dispatch("dragmove",o),queueMicrotask(()=>{var a,l,u,c,d;if(o.defaultPrevented)return;const f=(d=e.to)!=null?d:{x:r.position.current.x+((l=(a=e.by)==null?void 0:a.x)!=null?l:0),y:r.position.current.y+((c=(u=e.by)==null?void 0:u.y)!=null?c:0)};r.position.current=f})})}stop(e={}){return q(()=>{var t,n;const{dragOperation:r}=this.manager,{controller:i}=r;if(!i||i.signal.aborted)return;let s;const o=()=>{const l={resume:()=>{},abort:()=>{}};return s=new Promise((u,c)=>{l.resume=u,l.abort=c}),l};i.abort();const a=()=>{this.manager.renderer.rendering.then(()=>{r.status.set("dropped");const l=q(()=>{var c;return((c=r.source)==null?void 0:c.status)==="dropping"}),u=()=>{r.controller===i&&(r.controller=void 0),r.reset()};if(l){const{source:c}=r,d=nt(()=>{c?.status==="idle"&&(d(),u())})}else this.manager.renderer.rendering.then(u)})};r.canceled=(t=e.canceled)!=null?t:!1,this.manager.monitor.dispatch("dragend",{nativeEvent:e.event,operation:r.snapshot(),canceled:(n=e.canceled)!=null?n:!1,suspend:o}),s?s.then(a).catch(()=>r.reset()):a()})}},Cn=class extends Pe{constructor(e,t){super(e,t),this.manager=e,this.options=t}},Uh=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(const n of e??[])n.controller=this}onEvent(e){var t;if(!this.activated)if((t=this.constraints)!=null&&t.length)for(const n of this.constraints)n.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},di,Ac=class{constructor(e){this.options=e,Q(this,di)}set controller(e){Ye(this,di,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var t;(t=ue(this,di))==null||t.activate(e)}};di=new WeakMap;var Da=class extends Pe{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},Vh=class{constructor(e){this.draggables=new Ea,this.droppables=new Ea,this.plugins=new cs(e),this.sensors=new cs(e),this.modifiers=new cs(e)}register(e,t){if(e instanceof ft)return this.draggables.register(e.id,e);if(e instanceof pt)return this.droppables.register(e.id,e);if(e.prototype instanceof Da)return this.modifiers.register(e,t);if(e.prototype instanceof Cn)return this.sensors.register(e,t);if(e.prototype instanceof Pe)return this.plugins.register(e,t);throw new Error("Invalid instance type")}unregister(e){if(e instanceof qi)return e instanceof ft?this.draggables.unregister(e.id,e):e instanceof pt?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Da)return this.modifiers.unregister(e);if(e.prototype instanceof Cn)return this.sensors.unregister(e);if(e.prototype instanceof Pe)return this.plugins.unregister(e);throw new Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},Ic,Rc,Wc,zc,Lc,Nc,_c,Fc,Hc,er,ui,pn,le,Fo,Ho,qo,Uo,Vo,tr;Hc=[fe],Fc=[U],_c=[U],Nc=[U],Lc=[U],zc=[U],Wc=[fe],Rc=[fe],Ic=[fe];var lt=class{constructor(e){N(le,5,this),Q(this,er),Q(this,ui),Q(this,pn,new Jt(void 0,(t,n)=>t&&n?t.equals(n):t===n)),this.status=new kt,Q(this,Fo,N(le,8,this,!1)),N(le,11,this),Q(this,Ho,N(le,12,this,null)),N(le,15,this),Q(this,qo,N(le,16,this,null)),N(le,19,this),Q(this,Uo,N(le,20,this,null)),N(le,23,this),Q(this,Vo,N(le,24,this,[])),N(le,27,this),this.position=new Hi({x:0,y:0}),Q(this,tr,{x:0,y:0}),Ye(this,er,e)}get shape(){const{current:e,initial:t,previous:n}=ue(this,pn);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?ue(this,pn).current=e:ue(this,pn).reset()}get source(){var e;const t=this.sourceIdentifier;if(t==null)return null;const n=ue(this,er).registry.draggables.get(t);return n&&Ye(this,ui,n),(e=n??ue(this,ui))!=null?e:null}get target(){var e;const t=this.targetIdentifier;return t!=null&&(e=ue(this,er).registry.droppables.get(t))!=null?e:null}get transform(){const{x:e,y:t}=this.position.delta;let n={x:e,y:t};for(const r of this.modifiers)n=r.apply(jo($o({},this.snapshot()),{transform:n}));return Ye(this,tr,n),n}snapshot(){return q(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:ue(this,tr),shape:this.shape?ls(this.shape):null,position:ls(this.position),status:ls(this.status),canceled:this.canceled}))}reset(){de(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,ue(this,pn).reset(),this.position.reset({x:0,y:0}),Ye(this,tr,{x:0,y:0}),this.modifiers=[]})}};le=Ln(null);er=new WeakMap;ui=new WeakMap;pn=new WeakMap;Fo=new WeakMap;Ho=new WeakMap;qo=new WeakMap;Uo=new WeakMap;Vo=new WeakMap;tr=new WeakMap;V(le,2,"shape",Hc,lt);V(le,4,"canceled",Fc,lt,Fo);V(le,4,"activatorEvent",_c,lt,Ho);V(le,4,"sourceIdentifier",Nc,lt,qo);V(le,4,"targetIdentifier",Lc,lt,Uo);V(le,4,"modifiers",zc,lt,Vo);V(le,2,"source",Wc,lt);V(le,2,"target",Rc,lt);V(le,2,"transform",Ic,lt);en(le,lt);var Gh={get rendering(){return Promise.resolve()}};function at(e,t){return typeof e=="function"?e(t):e??t}var Yh=class{constructor(e){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(d=>d.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};var t;const n=e??{},r=at(n.plugins,[]),i=at(n.sensors,[]),s=at(n.modifiers,[]),o=(t=n.renderer)!=null?t:Gh,a=new Fh(this),l=new Vh(this);this.registry=l,this.monitor=a,this.renderer=o,this.actions=new qh(this),this.dragOperation=new lt(this),this.collisionObserver=new Nh(this),this.plugins=[Hh,...r],this.modifiers=s,this.sensors=i;const{destroy:u}=this,c=Dr(()=>{var d,f,h;const v=q(()=>this.dragOperation.modifiers),g=this.modifiers;for(const w of v)g.includes(w)||w.destroy();this.dragOperation.modifiers=(h=(f=(d=this.dragOperation.source)==null?void 0:d.modifiers)==null?void 0:f.map(w=>{const{plugin:y,options:p}=xr(w);return new y(this,p)}))!=null?h:g});this.destroy=()=>{c(),u()}}get plugins(){return this.registry.plugins.values}set plugins(e){this.registry.plugins.values=e}get modifiers(){return this.registry.modifiers.values}set modifiers(e){this.registry.modifiers.values=e}get sensors(){return this.registry.sensors.values}set sensors(e){this.registry.sensors.values=e}},qc=e=>{throw TypeError(e)},Go=(e,t,n)=>t.has(e)||qc("Cannot "+n),L=(e,t,n)=>(Go(e,t,"read from private field"),t.get(e)),qe=(e,t,n)=>t.has(e)?qc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ge=(e,t,n,r)=>(Go(e,t,"write to private field"),t.set(e,n),n),Uc=(e,t,n)=>(Go(e,t,"access private method"),n);function Ui(e){return e?e instanceof KeyframeEffect?!0:"getKeyframes"in e&&typeof e.getKeyframes=="function":!1}function Vc(e,t){const n=e.getAnimations();let r=null;for(const i of n){if(i.playState!=="running")continue;const{effect:s}=i,o=(Ui(s)?s.getKeyframes():[]).filter(t);o.length>0&&(r=[o[o.length-1],i])}return r}function Vi(e){const{width:t,height:n,top:r,left:i,bottom:s,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:i,bottom:s,right:o}}function Yo(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ir(e){return"nodeType"in e}function Xe(e){var t,n,r;return e?Yo(e)?e:Ir(e)?"defaultView"in e?(t=e.defaultView)!=null?t:window:(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window:window:window}function Xo(e){const{Document:t}=Xe(e);return e instanceof t||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function Tt(e){return!e||Yo(e)?!1:e instanceof Xe(e).HTMLElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("html")}function Gc(e){return e instanceof Xe(e).SVGElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("svg")}function Fn(e){return e?Yo(e)?e.document:Ir(e)?Xo(e)?e:Tt(e)||Gc(e)?e.ownerDocument:document:document:document}function Xh(e){var t,n,r,i;const{documentElement:s}=Fn(e),o=Xe(e).visualViewport,a=(t=o?.width)!=null?t:s.clientWidth,l=(n=o?.height)!=null?n:s.clientHeight,u=(r=o?.offsetTop)!=null?r:0,c=(i=o?.offsetLeft)!=null?i:0;return{top:u,left:c,right:c+a,bottom:u+l,width:a,height:l}}function Kh(e,t){if(Bh(e)&&e.open===!1)return!1;const{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n==="visible"&&r==="visible"&&i==="visible"}function Bh(e){return e.tagName==="DETAILS"}function kr(e,t=e.getBoundingClientRect(),n=0){var r,i,s,o,a;let l=t;const{ownerDocument:u}=e,c=(r=u.defaultView)!=null?r:window;let d=e.parentElement;for(;d&&d!==u.documentElement;){if(!Kh(d)){const x=d.getBoundingClientRect(),m=n*(x.bottom-x.top),k=n*(x.right-x.left),$=n*(x.bottom-x.top),C=n*(x.right-x.left);l={top:Math.max(l.top,x.top-m),right:Math.min(l.right,x.right+k),bottom:Math.min(l.bottom,x.bottom+$),left:Math.max(l.left,x.left-C),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top}d=d.parentElement}const f=c.visualViewport,h=(i=f?.offsetTop)!=null?i:0,v=(s=f?.offsetLeft)!=null?s:0,g=(o=f?.width)!=null?o:c.innerWidth,w=(a=f?.height)!=null?a:c.innerHeight,y=n*w,p=n*g;return l={top:Math.max(l.top,h-y),right:Math.min(l.right,v+g+p),bottom:Math.min(l.bottom,h+w+y),left:Math.max(l.left,v-p),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top,l.width<0&&(l.width=0),l.height<0&&(l.height=0),l}function On(e){return{x:e.clientX,y:e.clientY}}var Yc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _s(e=document,t=new Set){if(t.has(e))return[];t.add(e);const n=[e];for(const r of Array.from(e.querySelectorAll("iframe, frame")))try{const i=r.contentDocument;i&&!t.has(i)&&n.push(..._s(i,t))}catch{}try{const r=e.defaultView;if(r&&r!==window.top){const i=r.parent;i&&i.document&&i.document!==e&&n.push(..._s(i.document,t))}}catch{}return n}function Ko(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Xc(){var e,t;const n=Ko()?window.visualViewport:null;return{x:(e=n?.offsetLeft)!=null?e:0,y:(t=n?.offsetTop)!=null?t:0}}function Bo(e){return!e||!Ir(e)?!1:e instanceof Xe(e).ShadowRoot}function $i(e){if(e&&Ir(e)){let t=e.getRootNode();if(Bo(t)||t instanceof Document)return t}return Fn(e)}function Qo(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function Qh(e){const t="input, textarea, select, canvas, [contenteditable]",n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((i,s)=>{const o=r[s];Ta(i)&&Ta(o)&&(i.type!=="file"&&(i.value=o.value),i.type==="radio"&&i.name&&(i.name=`Cloned__${i.name}`)),Pa(i)&&Pa(o)&&o.width>0&&o.height>0&&i.getContext("2d")?.drawImage(o,0,0)}),n}function Ta(e){return"value"in e}function Pa(e){return e.tagName==="CANVAS"}function Kc(e,{x:t,y:n}){const r=e.elementFromPoint(t,n);if(Zh(r)){const{contentDocument:i}=r;if(i){const{left:s,top:o}=r.getBoundingClientRect();return Kc(i,{x:t-s,y:n-o})}}return r}function Zh(e){return e?.tagName==="IFRAME"}var Fs=new WeakMap;function Jh(e){return e.closest(`
|
|
3
3
|
input:not([disabled]),
|
|
4
4
|
select:not([disabled]),
|
|
5
5
|
textarea:not([disabled]),
|
|
@@ -70,8 +70,8 @@ import{r as S,aM as ju,aN as yn,j as b,a9 as he,aO as Cu,at as Wt,N as pe,aP as
|
|
|
70
70
|
`);if(n.length>Qa||r.length>Qa)return[...n.map(l=>({kind:"del",text:l})),...r.map(l=>({kind:"add",text:l}))];const i=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let l=n.length-1;l>=0;l--)for(let u=r.length-1;u>=0;u--)i[l][u]=n[l]===r[u]?i[l+1][u+1]+1:Math.max(i[l+1][u],i[l][u+1]);const s=[];let o=0,a=0;for(;o<n.length&&a<r.length;)n[o]===r[a]?(s.push({kind:"same",text:n[o]}),o++,a++):i[o+1][a]>=i[o][a+1]?s.push({kind:"del",text:n[o++]}):s.push({kind:"add",text:r[a++]});for(;o<n.length;)s.push({kind:"del",text:n[o++]});for(;a<r.length;)s.push({kind:"add",text:r[a++]});return s}function Og(e,t=3){const n=new Array(e.length).fill(!1);e.forEach((s,o)=>{if(s.kind!=="same")for(let a=Math.max(0,o-t);a<=Math.min(e.length-1,o+t);a++)n[a]=!0});const r=[];let i=0;return e.forEach((s,o)=>{n[o]?(i>0&&r.push({kind:"fold",count:i}),i=0,r.push(s)):i++}),i>0&&r.push({kind:"fold",count:i}),r}function Mg({open:e,before:t,after:n,onConfirm:r,onClose:i}){const{theme:s}=tt(),o=S.useMemo(()=>e?Og(Cg(t,n)):[],[e,t,n]),a=o.filter(u=>u.kind==="add").length,l=o.filter(u=>u.kind==="del").length;return b.jsx(Ni,{open:e,onClose:i,maxWidth:"md",title:"Review the change to the file",description:b.jsxs(b.Fragment,{children:["A tile was added or removed, which moves declarations. Lines the builder does not own — comments, other Malloy — are left where they were; check they still read right."," ",b.jsxs(pe,{component:"span",sx:{fontVariantNumeric:"tabular-nums"},children:["+",a," −",l]})]}),actions:b.jsxs(b.Fragment,{children:[b.jsx(ke,{onClick:i,children:"Keep editing"}),b.jsx(ke,{variant:"contained",onClick:r,children:"Save this"})]}),children:b.jsx(pe,{component:"pre","aria-label":"File changes",sx:{m:0,px:2,py:1,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12,lineHeight:1.6,overflowX:"auto",bgcolor:s.background,color:s.foreground},children:o.map((u,c)=>u.kind==="fold"?b.jsx(pe,{component:"span",sx:{display:"block",opacity:.55,py:.25},children:`⋯ ${u.count} unchanged line${u.count===1?"":"s"}`},c):b.jsxs(pe,{component:"span",sx:{display:"block",mx:-2,px:2,whiteSpace:"pre",bgcolor:u.kind==="add"?"rgba(46, 125, 91, 0.16)":u.kind==="del"?"rgba(168, 41, 31, 0.14)":"transparent",textDecoration:u.kind==="del"?"line-through":"none",opacity:u.kind==="del"?.8:1},children:[u.kind==="add"?"+ ":u.kind==="del"?"− ":" ",u.text]},c))})})}const gs="self";function Eg({open:e,document:t,source:n,givenNames:r,dashboards:i,onClose:s,onApply:o}){const{theme:a}=tt(),[l,u]=S.useState([]);S.useEffect(()=>{if(!e||!n)return;const h=(t.drills??[]).filter(v=>v.source===n.name);u((n.dimensions??[]).map(v=>{const g=h.find(w=>w.name===v.name);return{name:v.name,expression:v.expression,to:g?.to??[],given:g?.given??""}}))},[e,n,t]);const c=(h,v)=>u(g=>g.map((w,y)=>{if(y!==h)return w;const p={...w};return v(p),p})),d=[gs,...i.filter(h=>h!==gs)],f=h=>h===gs?"This dashboard":h;return b.jsx(Ni,{open:e,onClose:s,title:"Clickable cells",description:"A cell in a column that groups by one of these dimensions becomes a link. Clicking it writes the value into a control — here, or on the dashboard it opens.",actions:b.jsxs(b.Fragment,{children:[b.jsx(ke,{onClick:s,children:"Cancel"}),b.jsx(ke,{variant:"contained",onClick:()=>{n&&(o(l.filter(h=>h.to.length>0).map(h=>({source:n.name,name:h.name,expression:h.expression,to:h.to,...h.given?{given:h.given}:{}}))),s())},disabled:l.length===0,children:"Apply"})]}),children:b.jsx(he,{sx:{gap:2,pt:1},children:l.length===0?b.jsx(ne,{variant:"body2",sx:{color:a.tileTitle},children:n?b.jsxs(b.Fragment,{children:[b.jsx(pe,{component:"code",children:n.name})," declares no dimensions of its own in this file. A drill is a tag on the dimension's declaration, so a dimension the model declares is made clickable in the model; to make one clickable here, declare it in"," ",b.jsx(pe,{component:"code",children:n.name})," and group by it."]}):"This tile's source is not declared in this file."}):l.map((h,v)=>b.jsxs(pe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr)"},gap:1.5,alignItems:"start"},children:[b.jsxs(pe,{sx:{minWidth:0,pt:.75},children:[b.jsx(ne,{variant:"body2",sx:{fontFamily:"ui-monospace, monospace",fontSize:13},children:h.name}),b.jsxs(ne,{variant:"caption",sx:{color:a.tileTitle,display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:h.expression,children:["is ",h.expression]})]}),b.jsx(Te,{select:!0,size:"small",label:"Clicks go to",value:h.to,inputProps:{"aria-label":`Where ${h.name} goes`},SelectProps:{multiple:!0,renderValue:g=>g.length===0?"Not clickable":g.map(f).join(", "),displayEmpty:!0},InputLabelProps:{shrink:!0},onChange:g=>c(v,w=>{const y=g.target.value;w.to=Array.isArray(y)?y:String(y).split(",").filter(Boolean)}),children:d.map(g=>b.jsxs(bt,{value:g,children:[b.jsx($s,{size:"small",checked:h.to.includes(g),sx:{p:0,mr:1}}),b.jsx(Dl,{primary:f(g)})]},g))}),b.jsxs(Te,{select:!0,size:"small",label:"Sets the control",value:h.given,disabled:h.to.length===0,inputProps:{"aria-label":`Control ${h.name} sets`},SelectProps:{displayEmpty:!0},InputLabelProps:{shrink:!0},helperText:h.given===""?`Named ${h.name}, like the dimension`:void 0,onChange:g=>c(v,w=>{w.given=g.target.value}),children:[b.jsx(bt,{value:"",children:b.jsx("em",{children:"Same name as the dimension"})}),r.map(g=>b.jsx(bt,{value:g,children:g},g))]})]},h.name))})})}const Jd=e=>e.charAt(0)+e.slice(1).toLowerCase().replace(/_/g," ");function Dg({open:e,document:t,control:n,available:r,fieldsFor:i,onApply:s}){const o=S.useRef(n);e&&(o.current=n);const a=e?n:o.current,l=a!==void 0,[u,c]=S.useState({kind:"new"}),[d,f]=S.useState(""),[h,v]=S.useState("select"),[g,w]=S.useState(""),[y,p]=S.useState(""),[x,m]=S.useState([]),[k,$]=S.useState(!1),C=E=>t.sources.find(A=>A.name===E.source)?.base??E.source;S.useEffect(()=>{if(e)if(n){c({kind:"existing",name:n.name}),f(n.label??"");const E=ag(t,n);m(E);const A=E.filter(j=>j.include),H=new Set(A.map(j=>j.field));p(H.size===1?A[0].field:n.field??""),$(H.size>1)}else c({kind:"new"}),f(""),v("select"),p(""),w(new Date().toISOString().slice(0,10)),m(t.tiles.map(E=>({include:oo(E),field:""}))),$(!1)},[e,n,t]);const M=S.useMemo(()=>[...(t.localGivens??[]).map(E=>E.name),...r.map(E=>E.name)],[t,r]),T=S.useMemo(()=>y.trim()?og(y.trim(),M):"",[y,M]),P=u.kind==="existing"?n??r.find(E=>E.name===u.name):T?{name:T,type:Kr({name:T,label:d,kind:h,field:y}).type}:void 0,G=P?.type!==void 0&&!P.type.startsWith("filter<"),R=x.find(E=>E.include)?.op??Ri(P?.type),O=(E,A)=>m(H=>H.map((j,D)=>D===E?{...j,...A}:j)),_=E=>m(A=>A.map(H=>({...H,op:E}))),Y=E=>{const A=Ri(E);m(H=>H.map(({op:j,...D})=>A?{...D,op:A}:D))},me=E=>{c({kind:"existing",name:E.name}),p(E.field??""),Y(E.type)},Ae=E=>{v(E),Y(Kr({name:"X",label:d,kind:E,field:y}).type)},oe=t.tiles.map(oo),Ne=oe.filter(Boolean).length,Ue=x.filter((E,A)=>E.include&&oe[A]).length,Ee=t.tiles.filter((E,A)=>(x[A]?.include??!1)&&oe[A]),Ke=Ee.length>0?Ee:t.tiles.filter((E,A)=>oe[A]),Ve=S.useMemo(()=>{const E=new Map;let A=!1;for(const H of Ke){const j=i?.(H);if(j){A=!0;for(const D of j)E.has(D.name)||E.set(D.name,D)}}return A?[...E.values()]:void 0},[x,t.tiles,i]),_e=(()=>{const E=y.trim();for(const A of Ee){const H=i?.(A);if(!H||H.some(j=>j.name===E))return C(A)}return Ee[0]?C(Ee[0]):t.sources[0]?.base})(),Be=E=>m(A=>A.map((H,j)=>({...H,include:E&&oe[j]}))),Ce=S.useMemo(()=>k?x:x.map(E=>({...E,field:y})),[k,x,y]),xe=E=>{for(const A of Ke){const H=i?.(A)?.find(j=>j.name===E.trim());if(H?.type)return H.type}},I=E=>vi(P?.type,E.type),F=(E,A)=>{if(E.trim()==="")return"Pick the field this filter compares.";const H=A?i?.(A):void 0;if(!H)return;const j=H.find(D=>D.name===E.trim());if(!j)return`Not a field of ${A?C(A):"the tiles' source"}.`;if(j.type&&!vi(P?.type,j.type))return`${E.trim()} is ${Ya(j.type)}; this filter compares ${Ya(P?.type?.replace(/^filter<(.+)>$/,"$1"))}.`},$e=E=>{if(p(E),l||u.kind!=="new")return;const A=xe(E),H=Kr({name:"X",label:d,kind:h,field:E}).type;A&&!vi(H,A)&&Ae(ig(A))},B=Ce.map((E,A)=>E.include&&oe[A]?F(E.field,t.tiles[A]):void 0),Fe=B.every(E=>E===void 0),ee=!k&&Ue>0?Ee.map(E=>F(y,E)).find(Boolean):void 0,ct=P!==void 0&&Fe&&(u.kind==="existing"||y.trim()!==""&&T!==""),He=()=>{if(!(!P||!ct))if(u.kind==="new")s(P.name,Ce,Kr({name:P.name,label:d.trim()||Jd(P.name),kind:h,field:y.trim(),..._e?{source:_e}:{},...g?{dateDefault:g}:{}}));else if(n?.origin==="dashboard"&&n.local){const E=d.trim(),A=E!==(n.local.label??"");s(P.name,Ce,A?{...n.local,...E?{label:E}:{}}:void 0)}else s(P.name,Ce)},St=l&&a.origin==="model";return{editing:l,shown:a,fromModel:St,source:u,setSource:c,label:d,setLabel:f,kind:h,dateDefault:g,setDateDefault:w,field:y,rows:x,setRows:m,perTile:k,setPerTile:$,newName:T,target:P,valueTyped:G,commonOp:R,setRow:O,setCommonOp:_,pickExisting:me,pickKind:Ae,bindable:oe,bindableCount:Ne,included:Ue,commonFields:Ve,setAll:Be,accepts:I,pickField:$e,rowProblems:B,commonProblem:ee,canApply:ct,apply:He}}function Za({value:e,onChange:t,fields:n,accepts:r,label:i,ariaLabel:s,error:o,helperText:a,disabled:l,autoFocus:u,placeholder:c,sx:d}){const f=S.useMemo(()=>(n??[]).filter(v=>r?.(v)??!0).map(v=>v.name),[n,r]),h=S.useMemo(()=>new Map((n??[]).map(v=>[v.name,v.type])),[n]);return b.jsx(Zu,{freeSolo:!0,size:"small",options:f,inputValue:e,onInputChange:(v,g)=>t(g),value:e,onChange:(v,g)=>t(typeof g=="string"?g:""),disabled:l,disableClearable:!0,renderOption:(v,g)=>S.createElement("li",{...v,key:g},b.jsx(ne,{variant:"body2",sx:{flex:1},children:g}),h.get(g)&&b.jsx(ne,{variant:"caption",sx:{opacity:.6},children:h.get(g)?.replace(/_type$/,"")})),renderInput:v=>b.jsx(Te,{...v,label:i,placeholder:c,autoFocus:u,error:o,helperText:a,inputProps:{...v.inputProps,"aria-label":s}}),sx:d})}const Ja=e=>e?.declaration.kind==="opaque"?{label:"Not bindable",reason:`Its body is ${e.declaration.why}, so a filter has no single place to go.`}:{label:"From the model",reason:"Declared on its source, which this dashboard does not write."};function Tg({open:e,document:t,control:n,available:r,fieldsFor:i,onClose:s,onApply:o,onRemove:a}){const{theme:l}=tt(),{editing:u,shown:c,fromModel:d,source:f,setSource:h,label:v,setLabel:g,kind:w,dateDefault:y,setDateDefault:p,field:x,rows:m,setRows:k,perTile:$,setPerTile:C,newName:M,target:T,valueTyped:P,commonOp:G,setRow:R,setCommonOp:O,pickExisting:_,pickKind:Y,bindable:me,bindableCount:Ae,included:oe,commonFields:Ne,setAll:Ue,accepts:Ee,pickField:Ke,rowProblems:Ve,commonProblem:_e,canApply:Be,apply:Ce}=Dg({open:e,document:t,control:n,available:r,fieldsFor:i,onApply:o}),xe=(I,F,$e)=>b.jsx(Te,{select:!0,size:"small",label:"Compares",value:I??">=",onChange:B=>F(B.target.value),inputProps:{"aria-label":$e},sx:{width:130},children:sg.filter(B=>B.op!=="~").map(B=>b.jsx(bt,{value:B.op,children:B.label},B.op))});return b.jsx(Ni,{open:e,onClose:s,title:u?c.label??c.name:"Add a filter",description:u?b.jsxs(b.Fragment,{children:[b.jsxs(pe,{component:"span",sx:{fontFamily:"ui-monospace, monospace"},children:["$",c.name]}),d?" · declared in the model, so its label and options are set there":" · declared in this dashboard"]}):"A control on the page, and the tiles it filters.",actions:b.jsxs(b.Fragment,{children:[u&&b.jsx(ke,{color:"error",onClick:()=>a(c.name),"aria-label":`Remove control ${c.name}`,sx:{mr:"auto"},children:"Remove from dashboard"}),b.jsx(ke,{onClick:s,children:"Cancel"}),b.jsx(kn,{title:Be||T===void 0?"":"A ticked tile has no field, or names one its source does not have.",children:b.jsx("span",{children:b.jsx(ke,{variant:"contained",onClick:Ce,disabled:!Be,children:u?"Apply":"Add filter"})})})]}),children:b.jsxs(he,{sx:{gap:2.5,pt:1},children:[!u&&r.length>0&&b.jsxs(th,{exclusive:!0,size:"small",value:f.kind,onChange:(I,F)=>{F==="new"?h({kind:"new"}):F==="existing"&&r[0]&&_(r[0])},"aria-label":"Where the filter comes from",children:[b.jsx(wa,{value:"new",children:"New in this dashboard"}),b.jsx(wa,{value:"existing",children:"From the model"})]}),!u&&f.kind==="existing"?b.jsx(Te,{select:!0,size:"small",label:"Control",value:f.name,onChange:I=>{const F=r.find($e=>$e.name===I.target.value);F&&_(F)},children:r.map(I=>b.jsxs(bt,{value:I.name,children:[I.label??I.name,b.jsxs(ne,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:["$",I.name]})]},I.name))}):null,b.jsxs(he,{direction:"row",sx:{gap:1.5,flexWrap:"wrap"},children:[!$&&b.jsx(Za,{value:x,onChange:Ke,fields:Ne,accepts:Ee,label:"Field to filter",ariaLabel:"Field to filter",placeholder:"category",autoFocus:!u,error:_e!==void 0,helperText:_e??(!u&&M?`Declared as $${M}`:void 0),sx:{flex:1,minWidth:200}}),!d&&b.jsx(Te,{size:"small",label:"Label",placeholder:M?Jd(M):"",value:v,onChange:I=>g(I.target.value),inputProps:{"aria-label":"Control label"},sx:{flex:1,minWidth:160}}),P&&!$&&xe(G,O,"Comparison")]}),!u&&f.kind==="new"&&b.jsxs(he,{direction:"row",sx:{gap:1.5},children:[b.jsx(Te,{select:!0,size:"small",label:"Control",value:w,onChange:I=>Y(I.target.value),inputProps:{"aria-label":"Kind of control"},slotProps:{select:{renderValue:I=>Xa.find(F=>F.kind===I)?.label??String(I)}},sx:{flex:1},children:Xa.map(I=>b.jsxs(bt,{value:I.kind,children:[I.label,b.jsx(ne,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:I.hint})]},I.kind))}),w==="date"&&b.jsx(Te,{size:"small",type:"date",label:"Starts at",value:y,onChange:I=>p(I.target.value),InputLabelProps:{shrink:!0},sx:{flex:1}})]}),b.jsxs(pe,{children:[b.jsxs(he,{direction:"row",sx:{alignItems:"center",gap:.5},children:[b.jsx($s,{size:"small",checked:Ae>0&&oe===Ae,indeterminate:oe>0&&oe<Ae,disabled:Ae===0,onChange:I=>Ue(I.target.checked),inputProps:{"aria-label":"All tiles"}}),b.jsxs(ne,{variant:"subtitle2",sx:{flex:1},children:["Applies to ",oe," of ",t.tiles.length," tiles"]}),b.jsx(ke,{size:"small",onClick:()=>{$||k(I=>I.map(F=>({...F,field:x}))),C(I=>!I)},children:$?"Same field for all":"Adjust per tile"})]}),b.jsx(he,{sx:{gap:$?1:0},children:t.tiles.map((I,F)=>{const $e=m[F],B=I.label??I.name,Fe=$?Ve[F]:void 0;return b.jsxs(he,{direction:"row",sx:{gap:1,alignItems:$?"flex-start":"center",opacity:me[F]?1:.6},children:[b.jsx($s,{size:"small",disabled:!me[F],checked:($e?.include??!1)&&me[F],inputProps:{"aria-label":`Filter ${B}`},onChange:ee=>R(F,{include:ee.target.checked})}),b.jsx(ne,{variant:"body2",sx:{flex:1,minWidth:0,pt:$?1:0},noWrap:!0,children:B}),me[F]?$&&b.jsxs(b.Fragment,{children:[P&&xe($e?.op,ee=>R(F,{op:ee}),`Comparison for ${B}`),b.jsx(Za,{value:$e?.field??"",onChange:ee=>R(F,{field:ee}),fields:i?.(I),accepts:Ee,label:"Field",ariaLabel:`Field for ${B}`,disabled:!$e?.include,error:Fe!==void 0,helperText:Fe,sx:{width:220}})]}):b.jsx(kn,{title:Ja(t.tiles[F]).reason,children:b.jsx(ne,{variant:"caption",sx:{color:l.tileTitle},children:Ja(t.tiles[F]).label})})]},`${I.source}.${I.name}`)})}),oe===0&&b.jsx(ne,{variant:"caption",sx:{color:"warning.main",display:"block",mt:1},children:"No tile is ticked, so this control will not appear on the dashboard."})]})]})})}function eu(e,t,n,r){const[i,s]=S.useState(void 0);return S.useEffect(()=>{t&&e!==void 0&&s(structuredClone(e))},[t,e]),{draft:i,patch:o=>s(a=>{if(a===void 0)return a;const l=structuredClone(a);return o(l),l}),close:()=>{i!==void 0&&e!==void 0&&JSON.stringify(i)!==JSON.stringify(e)&&n(i),r()},discard:()=>s(void 0)}}const Pg=e=>({title:e.title,...e.description===void 0?{}:{description:e.description},...e.columns===void 0?{}:{columns:e.columns},...e.autorun===void 0?{}:{autorun:e.autorun}}),ms=[2,3,4,6,8,12,16,24];function Ag({anchor:e,settings:t,onClose:n,onCommit:r}){const{theme:i}=tt(),{draft:s,patch:o,close:a}=eu(t,e!==null,r,n),l=s?.columns!==void 0&&!ms.includes(s.columns)?[...ms,s.columns].sort((u,c)=>u-c):ms;return b.jsx(El,{open:e!==null&&s!==void 0,anchorEl:e,onClose:a,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:380,p:2}}},children:s&&b.jsxs(he,{sx:{gap:1.5},children:[b.jsx(ne,{variant:"overline",sx:{color:i.tileTitle,lineHeight:1.5},children:"Dashboard"}),b.jsx(Te,{size:"small",label:"Title",value:s.title,autoFocus:!0,inputProps:{"aria-label":"Dashboard title"},onChange:u=>o(c=>{c.title=u.target.value})}),b.jsx(Te,{size:"small",label:"Description",multiline:!0,minRows:3,maxRows:10,value:s.description??"",helperText:"Markdown. A blank line starts a new paragraph.",inputProps:{"aria-label":"Dashboard description"},onChange:u=>o(c=>{const d=u.target.value;d.trim()===""?delete c.description:c.description=d})}),b.jsxs(Te,{select:!0,size:"small",label:"Grid width",value:s.columns??"",helperText:"Columns across the page. Tiles are placed in these.",inputProps:{"aria-label":"Grid width"},onChange:u=>o(c=>{const d=Number(u.target.value);d?c.columns=d:delete c.columns}),children:[b.jsx(bt,{value:"",children:"Default (2)"}),l.map(u=>b.jsx(bt,{value:u,children:u},u))]}),b.jsx(zu,{control:b.jsx(Lu,{size:"small",checked:s.autorun!==!1,slotProps:{input:{"aria-label":"Run as controls change"}},onChange:u=>o(c=>{u.target.checked?delete c.autorun:c.autorun=!1})}),label:b.jsxs(ne,{variant:"body2",children:["Run as controls change",b.jsx(ne,{component:"span",variant:"caption",sx:{display:"block",opacity:.7},children:"Off, readers press Apply. For a page whose queries are slow."})]})})]})})}const Ig=Qt(b.jsx("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}));function Rg({controls:e,tileCount:t,unknownFieldsOf:n,onEdit:r,onAdd:i,children:s}){const{theme:o}=tt();return b.jsx(b.Fragment,{children:b.jsxs(he,{sx:{gap:1},children:[b.jsxs(he,{direction:"row","aria-label":"Filters",sx:{gap:1,alignItems:"center",flexWrap:"wrap",minHeight:32},children:[b.jsx(Ig,{sx:{fontSize:18,color:o.tileTitle,opacity:.7}}),b.jsx(ne,{variant:"subtitle2",sx:{color:o.tileTitle,mr:.5},children:"Filters"}),e.length===0&&b.jsx(ne,{variant:"body2",sx:{color:o.tileTitle,opacity:.8},children:"None yet."}),e.map(a=>{const l=n(a.name,a.type);return b.jsx(kn,{title:l.length>0?`$${a.name} · cannot filter on: ${l.join(", ")}`:`$${a.name} · ${a.origin==="dashboard"?"declared here":"from the model"} · ${a.boundTiles} of ${t} tiles`,children:b.jsx(mo,{size:"small",label:a.label??a.name,"aria-label":`Edit filter ${a.name}`,color:l.length>0?"warning":"default",variant:a.origin==="dashboard"?"filled":"outlined",onClick:()=>r(a),sx:{opacity:a.boundTiles===0?.6:1,cursor:"pointer",transition:"opacity 120ms"}})},a.name)}),b.jsx(pe,{sx:{ml:"auto"},children:b.jsx(Cl,{label:"Filter",icon:b.jsx(Ml,{}),onClick:()=>i(),ariaLabel:"Add filter",ariaHasPopup:"dialog"})})]}),s]})})}const Wg=(e,t)=>e.map((n,r)=>{const i=t[r]??!1;if(i===(n.break??!1))return n;const s={...n};return i?s.break=!0:delete s.break,s}),zg=(e,t,n)=>{const r=[...e],[i]=r.splice(t,1);if(!i)return[...e];const s=r[t];i.break&&s&&!s.break&&(r[t]={...s,break:!0});const o={...i};return delete o.break,r.splice(n,0,o),r},tu=(e,t)=>({kind:"tile",tile:e,index:t,colspan:e.colspan,break:e.break}),nu=e=>`gap.${e}`,Lg=(e,t)=>{const n=[];let r=0;e.forEach((s,o)=>{const a=Math.min(s.colspan??1,t),l=o===0||s.break===!0||r+a>t;l&&o>0&&r<t&&n.push({kind:"gap",after:mt(e[o-1]),colspan:t-r}),l&&(r=0),n.push(tu(s,o)),r+=a});const i=e.at(-1);return i&&r<t&&n.push({kind:"gap",after:mt(i),colspan:t-r}),n};var Ng=Object.create,ru=Object.defineProperty,_g=Object.defineProperties,Fg=Object.getOwnPropertyDescriptor,Hg=Object.getOwnPropertyDescriptors,Wi=Object.getOwnPropertySymbols,iu=Object.prototype.hasOwnProperty,su=Object.prototype.propertyIsEnumerable,qg=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Lr=e=>{throw TypeError(e)},lo=(e,t,n)=>t in e?ru(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vs=(e,t)=>{for(var n in t||(t={}))iu.call(t,n)&&lo(e,n,t[n]);if(Wi)for(var n of Wi(t))su.call(t,n)&&lo(e,n,t[n]);return e},bs=(e,t)=>_g(e,Hg(t)),Ug=(e,t)=>{var n={};for(var r in e)iu.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Wi)for(var r of Wi(e))t.indexOf(r)<0&&su.call(e,r)&&(n[r]=e[r]);return n},Vg=e=>{var t;return[,,,Ng((t=void 0)!=null?t:null)]},ou=["class","method","getter","setter","accessor","field","value","get","set"],cr=e=>e!==void 0&&typeof e!="function"?Lr("Function expected"):e,Gg=(e,t,n,r,i)=>({kind:ou[e],name:t,metadata:r,addInitializer:s=>n._?Lr("Already initialized"):i.push(cr(s||null))}),Yg=(e,t)=>lo(t,qg("metadata"),e[3]),Qr=(e,t,n,r)=>{for(var i=0,s=e[t>>1],o=s&&s.length;i<o;i++)t&1?s[i].call(n):r=s[i].call(n,r);return r},au=(e,t,n,r,i,s)=>{for(var o,a,l,u,c,d=t&7,f=!1,h=!1,v=e.length+1,g=ou[d+5],w=e[v-1]=[],y=e[v]||(e[v]=[]),p=(i=i.prototype,Fg({get[n](){return dr(this,s)},set[n](m){return Ut(this,s,m)}},n)),x=r.length-1;x>=0;x--)u=Gg(d,n,l={},e[3],y),u.static=f,u.private=h,c=u.access={has:m=>n in m},c.get=m=>m[n],c.set=(m,k)=>m[n]=k,a=(0,r[x])({get:p.get,set:p.set},u),l._=1,a===void 0?cr(a)&&(p[g]=a):typeof a!="object"||a===null?Lr("Object expected"):(cr(o=a.get)&&(p.get=o),cr(o=a.set)&&(p.set=o),cr(o=a.init)&&w.unshift(o));return p&&ru(i,n,p),i},lu=(e,t,n)=>t.has(e)||Lr("Cannot "+n),dr=(e,t,n)=>(lu(e,t,"read from private field"),t.get(e)),Bn=(e,t,n)=>t.has(e)?Lr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ut=(e,t,n,r)=>(lu(e,t,"write to private field"),t.set(e,n),n);function Gt(e){return e instanceof ma||e instanceof hu}var Zr=10,Xg=class extends Pe{constructor(e){super(e);const t=nt(()=>{const{dragOperation:r}=e;if($r(r.activatorEvent)&&Gt(r.source)&&r.status.initialized){const i=e.registry.plugins.get(Wr);if(i)return i.disable(),()=>i.enable()}}),n=e.monitor.addEventListener("dragmove",(r,i)=>{queueMicrotask(()=>{if(this.disabled||r.defaultPrevented||!r.nativeEvent)return;const{dragOperation:s}=i;if(!$r(r.nativeEvent)||!Gt(s.source)||!s.shape)return;const{actions:o,collisionObserver:a,registry:l}=i,{by:u}=r;if(!u)return;const c=Kg(u),{source:d,target:f}=s,{center:h}=s.shape.current,v=[],g=[];de(()=>{for(const k of l.droppables){const{id:$}=k;if(!k.accepts(d)||$===f?.id&&Gt(k)||!k.element)continue;let C=k.shape;const M=new ut(k.element,{getBoundingClientRect:T=>kr(T,void 0,.2)});!M.height||!M.width||(c=="down"&&h.y+Zr<M.center.y||c=="up"&&h.y-Zr>M.center.y||c=="left"&&h.x-Zr>M.center.x||c=="right"&&h.x+Zr<M.center.x)&&(v.push(k),k.shape=M,g.push(()=>k.shape=C))}}),r.preventDefault(),a.disable();const w=a.computeCollisions(v,Wf);de(()=>g.forEach(k=>k()));const[y]=w;if(!y)return;const{id:p}=y,{index:x,group:m}=d.sortable;o.setDropTarget(p).then(()=>{const{source:k,target:$,shape:C}=s;if(!k||!Gt(k)||!C)return;const{index:M,group:T,target:P}=k.sortable,G=x!==M||m!==T,R=G?P:$?.element;if(!R)return;rd(R);const O=new ut(R);if(!O)return;const _=ht.delta(O,ht.from(C.current.boundingRectangle),k.alignment);o.move({by:_}),G?o.setDropTarget(k.id).then(()=>a.enable()):a.enable()})})});this.destroy=()=>{n(),t()}}};function Kg(e){const{x:t,y:n}=e;if(t>0)return"right";if(t<0)return"left";if(n>0)return"down";if(n<0)return"up"}var Bg=Object.defineProperty,Qg=Object.defineProperties,Zg=Object.getOwnPropertyDescriptors,el=Object.getOwnPropertySymbols,Jg=Object.prototype.hasOwnProperty,em=Object.prototype.propertyIsEnumerable,tl=(e,t,n)=>t in e?Bg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ln=(e,t)=>{for(var n in t||(t={}))Jg.call(t,n)&&tl(e,n,t[n]);if(el)for(var n of el(t))em.call(t,n)&&tl(e,n,t[n]);return e},cn=(e,t)=>Qg(e,Zg(t));function tm(e,t,n){if(t===n)return e;const r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function Jr(e,t){const n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function ys(e){return"initialIndex"in e&&typeof e.initialIndex=="number"&&"index"in e&&typeof e.index=="number"}function nm(e,t,n){var r,i;const{source:s,target:o,canceled:a}=t.operation;if(!s||!o||a)return"preventDefault"in t&&t.preventDefault(),e;const l=(p,x)=>p===x||p!==null&&typeof p=="object"&&"id"in p&&p.id===x;if(Array.isArray(e)){const p=e.findIndex(m=>l(m,s.id)),x=e.findIndex(m=>l(m,o.id));if(p===-1||x===-1){if(ys(s)){const m=s.initialIndex,k=s.index;return m===k||m<0||m>=e.length?("preventDefault"in t&&t.preventDefault(),e):n(e,m,k)}return e}if(!a&&"index"in s&&typeof s.index=="number"){const m=s.index;if(m!==p)return n(e,p,m)}return n(e,p,x)}const u=Object.entries(e);let c=-1,d,f=-1,h;for(const[p,x]of u)if(c===-1&&(c=x.findIndex(m=>l(m,s.id)),c!==-1&&(d=p)),f===-1&&(f=x.findIndex(m=>l(m,o.id)),f!==-1&&(h=p)),c!==-1&&f!==-1)break;if(c===-1&&ys(s)){const p=s.initialGroup==null?void 0:Jr(e,s.initialGroup),x=s.initialIndex,m=s.group==null?void 0:Jr(e,s.group),k=s.index;if(p==null||m==null||p===m&&x===k)return"preventDefault"in t&&t.preventDefault(),e;if(p===m)return cn(ln({},e),{[p]:n(e[p],x,k)});const $=e[p][x];return cn(ln({},e),{[p]:[...e[p].slice(0,x),...e[p].slice(x+1)],[m]:[...e[m].slice(0,k),$,...e[m].slice(k)]})}if(!s.manager)return e;const{dragOperation:v}=s.manager,g=(i=(r=v.shape)==null?void 0:r.current.center)!=null?i:v.position.current;if(h==null){const p=Jr(e,o.id);if(p!=null){const x=o.shape&&g.y>o.shape.center.y?e[p].length:0;h=p,f=x}}if(d==null||h==null||d===h&&c===f){if(d!=null&&d===h&&c===f&&ys(s)){const p=s.group==null?void 0:Jr(e,s.group),x=s.group!=null&&p!==d,m=s.index!==c;if(x||m){const k=s.group==null?d:p;if(k!=null){if(d===k)return cn(ln({},e),{[d]:n(e[d],c,s.index)});const $=e[d][c];return cn(ln({},e),{[d]:[...e[d].slice(0,c),...e[d].slice(c+1)],[k]:[...e[k].slice(0,s.index),$,...e[k].slice(s.index)]})}}}return"preventDefault"in t&&t.preventDefault(),e}if(d===h)return cn(ln({},e),{[d]:n(e[d],c,f)});const w=o.shape&&Math.round(g.y)>Math.round(o.shape.center.y)?1:0,y=e[d][c];return cn(ln({},e),{[d]:[...e[d].slice(0,c),...e[d].slice(c+1)],[h]:[...e[h].slice(0,f+w),y,...e[h].slice(f+w)]})}function rm(e,t){return nm(e,t,tm)}function nl(e){const t=new Map;for(const[,n]of e)for(const r of n)t.set(r.id,r.index);return t}function rl(e,t,n){var r;for(const[i,s]of t)for(const o of s){const a=e.get(o.id);if(o.index!==a||o.group!==i||!((r=n.get(i))!=null&&r.has(o)))return!0}return!1}var il="__default__",im=class extends Pe{constructor(e){super(e);const t=()=>{const r=new Map;for(const i of e.registry.droppables)if(i instanceof ma){const{sortable:s}=i,{group:o}=s;let a=r.get(o);a||(a=new Set,r.set(o,a)),a.add(s)}return r},n=[e.monitor.addEventListener("dragover",(r,i)=>{if(this.disabled)return;const{dragOperation:s}=i,{source:o,target:a}=s;if(!Gt(o)||!Gt(a)||o.sortable===a.sortable)return;const l=t(),u=nl(l),c=o.sortable.group===a.sortable.group,d=l.get(o.sortable.group),f=c?d:l.get(a.sortable.group);!d||!f||queueMicrotask(()=>{r.defaultPrevented||i.renderer.rendering.then(()=>{var h,v;const g=t();if(rl(u,l,g))return;const w=o.sortable.element,y=a.sortable.element;if(!y||!w||!c&&a.id===o.sortable.group)return;const p=ei(d),x=c?p:ei(f),m=(h=o.sortable.group)!=null?h:il,k=(v=a.sortable.group)!=null?v:il,$={[m]:p,[k]:x},C=rm($,r);if($===C)return;const M=C[k].indexOf(o.sortable),T=C[k].indexOf(a.sortable);i.collisionObserver.disable(),sl(w,M,y,T),de(()=>{for(const[P,G]of C[m].entries())G.index=P;if(!c)for(const[P,G]of C[k].entries())G.group=a.sortable.group,G.index=P}),i.actions.setDropTarget(o.id).then(()=>i.collisionObserver.enable())})})}),e.monitor.addEventListener("dragend",(r,i)=>{if(!r.canceled)return;const{dragOperation:s}=i,{source:o}=s;Gt(o)&&(o.sortable.initialIndex===o.sortable.index&&o.sortable.initialGroup===o.sortable.group||queueMicrotask(()=>{const a=t(),l=nl(a),u=a.get(o.sortable.initialGroup);u&&i.renderer.rendering.then(()=>{const c=t();if(rl(l,a,c))return;const d=ei(u),f=ei(u,om),h=o.sortable.element,v=f.indexOf(o.sortable),g=d[v],w=g?.element;!g||!w||!h||(sl(h,g.index,w,o.index),de(()=>{for(const y of a.values()){const p=Array.from(y).values();for(const x of p)x.index=x.initialIndex,x.group=x.initialGroup}}))})}))})];this.destroy=()=>{for(const r of n)r()}}};function sl(e,t,n,r){const i=r<t?"afterend":"beforebegin";n.insertAdjacentElement(i,e)}function sm(e,t){return e.index-t.index}function om(e,t){return e.initialIndex-t.initialIndex}function ei(e,t=sm){return Array.from(e).sort(t)}var ol=[Xg,im],cu={duration:250,easing:"cubic-bezier(0.25, 1, 0.5, 1)",idle:!1};function al(e){var t,n;return typeof e=="boolean"?{draggable:e,droppable:e}:{draggable:(t=e?.draggable)!=null?t:!1,droppable:(n=e?.droppable)!=null?n:!1}}var ti=new bh,du,uu,Dt,pa,ur,hr,ga,bn;uu=[U],du=[U];var Qi=class{constructor(e,t){Bn(this,pa,Qr(Dt,8,this)),Qr(Dt,11,this),Bn(this,ur),Bn(this,hr),Bn(this,ga,Qr(Dt,12,this)),Qr(Dt,15,this),Bn(this,bn),this.register=()=>(de(()=>{var v,g;(v=this.manager)==null||v.registry.register(this.droppable),(g=this.manager)==null||g.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{de(()=>{var v,g;(v=this.manager)==null||v.registry.unregister(this.droppable),(g=this.manager)==null||g.registry.unregister(this.draggable)})},this.destroy=()=>{de(()=>{this.droppable.destroy(),this.draggable.destroy()})};var n=e,{effects:r=()=>[],disabled:i,group:s,index:o,sensors:a,type:l,transition:u=cu,plugins:c}=n,d=Ug(n,["effects","disabled","group","index","sensors","type","transition","plugins"]);const f=at(c,ol),h=al(i);this.droppable=new ma(bs(vs({},d),{disabled:h.droppable}),t,this),this.draggable=new hu(bs(vs({},d),{disabled:h.draggable,plugins:f,effects:()=>[()=>{var v,g,w;const y=(v=this.manager)==null?void 0:v.dragOperation.status;y?.initializing&&this.id===((w=(g=this.manager)==null?void 0:g.dragOperation.source)==null?void 0:w.id)&&ti.clear(this.manager),y?.dragging&&ti.set(this.manager,this.id,q(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{const{index:v,group:g,manager:w}=this,y=dr(this,hr),p=dr(this,ur);(v!==y||g!==p)&&(Ut(this,hr,v),Ut(this,ur,g),this.animate())},()=>{var v,g;const{target:w}=this,{isDragSource:y}=this.draggable;((g=(v=this.draggable.pluginConfig(sa))==null?void 0:v.feedback)!=null?g:"default")==="move"&&y&&(this.droppable.disabled=!w)},...r()],type:l,sensors:a}),t,this),Ut(this,bn,d.element),this.manager=t,this.index=o,Ut(this,hr,o),this.group=s,Ut(this,ur,s),this.type=l,this.transition=u}get initialIndex(){var e,t;return(t=(e=ti.get(this.manager,this.id))==null?void 0:e.initialIndex)!=null?t:this.index}get initialGroup(){var e,t;return(t=(e=ti.get(this.manager,this.id))==null?void 0:e.initialGroup)!=null?t:this.group}animate(){q(()=>{const{manager:e,transition:t}=this,{shape:n}=this.droppable;if(!e)return;const{idle:r}=e.dragOperation.status;!n||!t||r&&!t.idle||e.renderer.rendering.then(()=>{const{element:i}=this;if(!i)return;for(const c of i.getAnimations())"transitionProperty"in c&&(c.transitionProperty==="transform"||c.transitionProperty==="translate"||c.transitionProperty==="scale")&&c.cancel();const s=this.refreshShape();if(!s)return;const o={x:n.boundingRectangle.left-s.boundingRectangle.left,y:n.boundingRectangle.top-s.boundingRectangle.top},{translate:a}=gt(i),l=za(i,a,!1),u=za(i,a);if(o.x||o.y){const c=Qo(Xe(i))?bs(vs({},t),{duration:0}):t;id({element:i,keyframes:{translate:[`${l.x+o.x}px ${l.y+o.y}px ${l.z}`,`${u.x}px ${u.y}px ${u.z}`]},options:c}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){de(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){de(()=>{const t=dr(this,bn),n=this.droppable.element,r=this.draggable.element;(!n||n===t)&&(this.droppable.element=e),(!r||r===t)&&(this.draggable.element=e),Ut(this,bn,e)})}get element(){var e,t;const n=dr(this,bn);if(n)return(t=(e=Fs.get(n))!=null?e:n)!=null?t:this.droppable.element}set target(e){this.droppable.element=e}get target(){return this.droppable.element}set source(e){this.draggable.element=e}get source(){return this.draggable.element}get disabled(){const{disabled:e}=this.draggable,{disabled:t}=this.droppable;return e===t?e:{draggable:e,droppable:t}}set plugins(e){this.draggable.plugins=at(e,ol)}set disabled(e){const t=al(e);de(()=>{this.droppable.disabled=t.droppable,this.draggable.disabled=t.draggable})}set data(e){de(()=>{this.droppable.data=e,this.draggable.data=e})}set handle(e){this.draggable.handle=e}set id(e){this.droppable.id=e,this.draggable.id=e}get id(){return this.droppable.id}set sensors(e){this.draggable.sensors=e}set modifiers(e){this.draggable.modifiers=e}set collisionPriority(e){this.droppable.collisionPriority=e}set collisionDetector(e){this.droppable.collisionDetector=e??sd}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){de(()=>{this.droppable.type=e,this.draggable.type=e})}get type(){return this.draggable.type}set accept(e){this.droppable.accept=e}get accept(){return this.droppable.accept}get isDropTarget(){return this.droppable.isDropTarget}get isDragSource(){return this.draggable.isDragSource}get isDragging(){return this.draggable.isDragging}get isDropping(){return this.draggable.isDropping}get status(){return this.draggable.status}refreshShape(){return this.droppable.refreshShape()}accepts(e){return this.droppable.accepts(e)}};Dt=Vg();pa=new WeakMap;ur=new WeakMap;hr=new WeakMap;ga=new WeakMap;bn=new WeakMap;au(Dt,4,"index",uu,Qi,pa);au(Dt,4,"group",du,Qi,ga);Yg(Dt,Qi);var hu=class extends Xi{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get initialIndex(){return this.sortable.initialIndex}get group(){return this.sortable.group}get initialGroup(){return this.sortable.initialGroup}},ma=class extends Ki{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},am=Object.defineProperty,lm=Object.defineProperties,cm=Object.getOwnPropertyDescriptors,ll=Object.getOwnPropertySymbols,dm=Object.prototype.hasOwnProperty,um=Object.prototype.propertyIsEnumerable,cl=(e,t,n)=>t in e?am(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xs=(e,t)=>{for(var n in t||(t={}))dm.call(t,n)&&cl(e,n,t[n]);if(ll)for(var n of ll(t))um.call(t,n)&&cl(e,n,t[n]);return e},hm=(e,t)=>lm(e,cm(t));function fm(e){const{accept:t,collisionDetector:n,collisionPriority:r,id:i,data:s,element:o,handle:a,index:l,group:u,disabled:c,modifiers:d,sensors:f,target:h,type:v,plugins:g}=e,w=xs(xs({},cu),e.transition),y=Fd(x=>new Qi(hm(xs({},e),{transition:w,register:!1,handle:jn(a),element:jn(o),target:jn(h)}),x)),p=zd(y,pm);return ae(i,()=>y.id=i),Un(()=>{de(()=>{y.group=u,y.index=l})},[y,u,l]),ae(v,()=>y.type=v),ae(t,()=>y.accept=t,void 0,st),ae(s,()=>s&&(y.data=s)),ae(l,()=>{var x;(x=y.manager)!=null&&x.dragOperation.status.idle&&w?.idle&&y.refreshShape()},Dp),gi(a,x=>y.handle=x),gi(o,x=>y.element=x),gi(h,x=>y.target=x),ae(c,()=>y.disabled=c??!1,void 0,st),ae(f,()=>y.sensors=f,void 0,st),ae(n,()=>y.collisionDetector=n),ae(r,()=>y.collisionPriority=r),ae(g,()=>y.plugins=g,void 0,st),ae(w,()=>y.transition=w,void 0,st),ae(d,()=>y.modifiers=d,void 0,st),ae(e.alignment,()=>y.alignment=e.alignment),{sortable:p,get isDragging(){return p.isDragging},get isDropping(){return p.isDropping},get isDragSource(){return p.isDragSource},get isDropTarget(){return p.isDropTarget},handleRef:S.useCallback(x=>{y.handle=x??void 0},[y]),ref:S.useCallback(x=>{var m,k;!x&&(m=y.element)!=null&&m.isConnected&&!((k=y.manager)!=null&&k.dragOperation.status.idle)||(y.element=x??void 0)},[y]),sourceRef:S.useCallback(x=>{var m,k;!x&&(m=y.source)!=null&&m.isConnected&&!((k=y.manager)!=null&&k.dragOperation.status.idle)||(y.source=x??void 0)},[y]),targetRef:S.useCallback(x=>{var m,k;!x&&(m=y.target)!=null&&m.isConnected&&!((k=y.manager)!=null&&k.dragOperation.status.idle)||(y.target=x??void 0)},[y])}}function pm(e,t,n){return!!(e==="isDragSource"&&!n&&t)}const co="tile",fu="gap",gm='[role="separator"]',mm=[to.configure({activatorElements:e=>[e.element],preventActivation:(e,t)=>(to.defaults.preventActivation?.(e,t)??!1)||e.target instanceof Element&&e.target.closest(gm)!==null}),Ed],vm=e=>[...e,sa.configure({feedback:"clone"})];function bm({id:e,index:t,children:n}){const{ref:r,handleRef:i,isDragSource:s}=fm({id:e,index:t,type:co,accept:co,collisionDetector:Jo,plugins:vm});return b.jsx(b.Fragment,{children:n({ref:r,handleRef:i,isDragSource:s})})}function ym({id:e,after:t,children:n}){const{ref:r,isDropTarget:i}=tg({id:e,type:fu,accept:co,collisionDetector:Jo,data:{after:t}});return b.jsx(b.Fragment,{children:n({ref:r,isDropTarget:i})})}const xm=Qt(b.jsx("path",{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2m-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})),wm=Qt(b.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"}));function km({tile:e,index:t,selected:n,menuOpen:r,resizeSpan:i,columns:s,onSelect:o,onOpenMenu:a,onResizeStart:l,onResizeMove:u,onResizeEnd:c,children:d}){const{theme:f}=tt();return b.jsx(bm,{id:mt(e),index:t,children:({ref:h,handleRef:v,isDragSource:g})=>b.jsxs(pe,{ref:h,onClick:o,onPointerDown:w=>{w.button===0&&o()},"aria-label":`Tile ${e.name}`,"aria-current":n,sx:{position:"relative",display:"grid",minWidth:0,cursor:"grab",borderRadius:1,outline:n?`2px solid ${f.drillLink}`:"2px solid transparent",outlineOffset:2,transition:"outline-color 120ms, opacity 120ms, box-shadow 120ms","&&[data-dnd-dragging]":{opacity:1,outline:"none",boxShadow:"0 12px 32px rgba(0, 0, 0, 0.22)"},"&&[data-dnd-placeholder]":{opacity:.45,outline:`2px dashed ${f.drillLink}`,boxShadow:"none"},"&:hover .builder-affordance, &:focus-within .builder-affordance":{opacity:1},"&:hover":{outlineColor:n?f.drillLink:f.cardBorder,boxShadow:"0 2px 10px rgba(0, 0, 0, 0.10)"}},children:[d,b.jsx(pe,{ref:v,className:"builder-affordance","aria-label":`Move ${e.label??e.name}`,sx:{position:"absolute",top:"2px",left:"2px",display:"grid",placeItems:"center",width:"22px",height:"22px",borderRadius:"4px",cursor:"grab",touchAction:"none",zIndex:2,color:f.tileTitle,bgcolor:f.tile,opacity:g||n?.9:0,transition:"opacity 120ms","&:hover":{opacity:1},"&:active":{cursor:"grabbing"},"&:focus-visible":{opacity:1,outline:`2px solid ${f.drillLink}`,outlineOffset:1}},children:b.jsx(xm,{sx:{fontSize:16}})}),i===void 0&&b.jsx(Ss,{className:"builder-affordance",size:"small","aria-label":`Settings for ${e.label??e.name}`,onClick:w=>{w.stopPropagation(),a(w.currentTarget)},sx:{position:"absolute",top:"2px",right:"2px",width:22,height:22,zIndex:2,color:f.tileTitle,bgcolor:f.tile,opacity:n||r?.9:0,transition:"opacity 120ms","&:hover":{opacity:1,bgcolor:f.tile}},children:b.jsx(wm,{sx:{fontSize:16}})}),i!==void 0&&b.jsxs(pe,{"aria-hidden":!0,sx:{position:"absolute",top:"6px",right:"6px",px:.75,py:.25,borderRadius:"4px",bgcolor:f.drillLink,color:f.tile,fontSize:11,fontVariantNumeric:"tabular-nums",zIndex:4,pointerEvents:"none"},children:[i," of ",s," ·"," ",Math.round(i/s*100),"%"]}),e.declaration.kind!=="inherited"&&b.jsx(pe,{className:"builder-affordance",role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e.label??e.name}`,onPointerDown:l,onPointerMove:u,onPointerUp:c,onPointerCancel:c,sx:{position:"absolute",top:0,bottom:0,right:"-5px",width:"10px",cursor:"col-resize",touchAction:"none",zIndex:1,opacity:i!==void 0||n?1:0,transition:"opacity 120ms","&:hover":{opacity:1},"&::after":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"4px",height:"28px",borderRadius:"2px",bgcolor:f.drillLink}}})]})})}function Sm({tile:e}){const{theme:t}=tt();return b.jsxs(Ru,{sx:{minHeight:140},children:[b.jsx(Wu,{title:e.label??e.name,subtitle:e.subtitle}),b.jsxs(ne,{variant:"caption",sx:{display:"block",color:t.tileTitle,opacity:.7},children:[e.source," → ",e.name]})]})}function $m({after:e}){const{theme:t}=tt();return b.jsx(ym,{id:nu(e),after:e,children:({ref:n,isDropTarget:r})=>b.jsx(pe,{ref:n,"aria-hidden":!0,sx:{minHeight:48,borderRadius:1,border:`1px dashed ${t.drillLink}`,bgcolor:r?`color-mix(in srgb, ${t.drillLink} 12%, transparent)`:"transparent",opacity:r?.95:.4,transition:"opacity 120ms, background-color 120ms"}})})}function jm({columns:e}){const{theme:t}=tt();return b.jsx(pe,{"aria-hidden":!0,sx:{position:"absolute",inset:0,pointerEvents:"none",zIndex:3,display:"grid",gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`,gap:`${ii}px`},children:Array.from({length:e},(n,r)=>b.jsx(pe,{sx:{borderLeft:`1px dashed ${t.drillLink}`,borderRight:r===e-1?`1px dashed ${t.drillLink}`:"none",opacity:.35}},r))})}var Cm=Object.defineProperty,Om=Object.defineProperties,Mm=Object.getOwnPropertyDescriptors,dl=Object.getOwnPropertySymbols,Em=Object.prototype.hasOwnProperty,Dm=Object.prototype.propertyIsEnumerable,ul=(e,t,n)=>t in e?Cm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dn=(e,t)=>{for(var n in t||(t={}))Em.call(t,n)&&ul(e,n,t[n]);if(dl)for(var n of dl(t))Dm.call(t,n)&&ul(e,n,t[n]);return e},un=(e,t)=>Om(e,Mm(t));function Tm(e,t,n){if(t===n)return e;const r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function ni(e,t){const n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function ws(e){return"initialIndex"in e&&typeof e.initialIndex=="number"&&"index"in e&&typeof e.index=="number"}function Pm(e,t,n){var r,i;const{source:s,target:o,canceled:a}=t.operation;if(!s||!o||a)return"preventDefault"in t&&t.preventDefault(),e;const l=(p,x)=>p===x||p!==null&&typeof p=="object"&&"id"in p&&p.id===x;if(Array.isArray(e)){const p=e.findIndex(m=>l(m,s.id)),x=e.findIndex(m=>l(m,o.id));if(p===-1||x===-1){if(ws(s)){const m=s.initialIndex,k=s.index;return m===k||m<0||m>=e.length?("preventDefault"in t&&t.preventDefault(),e):n(e,m,k)}return e}if(!a&&"index"in s&&typeof s.index=="number"){const m=s.index;if(m!==p)return n(e,p,m)}return n(e,p,x)}const u=Object.entries(e);let c=-1,d,f=-1,h;for(const[p,x]of u)if(c===-1&&(c=x.findIndex(m=>l(m,s.id)),c!==-1&&(d=p)),f===-1&&(f=x.findIndex(m=>l(m,o.id)),f!==-1&&(h=p)),c!==-1&&f!==-1)break;if(c===-1&&ws(s)){const p=s.initialGroup==null?void 0:ni(e,s.initialGroup),x=s.initialIndex,m=s.group==null?void 0:ni(e,s.group),k=s.index;if(p==null||m==null||p===m&&x===k)return"preventDefault"in t&&t.preventDefault(),e;if(p===m)return un(dn({},e),{[p]:n(e[p],x,k)});const $=e[p][x];return un(dn({},e),{[p]:[...e[p].slice(0,x),...e[p].slice(x+1)],[m]:[...e[m].slice(0,k),$,...e[m].slice(k)]})}if(!s.manager)return e;const{dragOperation:v}=s.manager,g=(i=(r=v.shape)==null?void 0:r.current.center)!=null?i:v.position.current;if(h==null){const p=ni(e,o.id);if(p!=null){const x=o.shape&&g.y>o.shape.center.y?e[p].length:0;h=p,f=x}}if(d==null||h==null||d===h&&c===f){if(d!=null&&d===h&&c===f&&ws(s)){const p=s.group==null?void 0:ni(e,s.group),x=s.group!=null&&p!==d,m=s.index!==c;if(x||m){const k=s.group==null?d:p;if(k!=null){if(d===k)return un(dn({},e),{[d]:n(e[d],c,s.index)});const $=e[d][c];return un(dn({},e),{[d]:[...e[d].slice(0,c),...e[d].slice(c+1)],[k]:[...e[k].slice(0,s.index),$,...e[k].slice(s.index)]})}}}return"preventDefault"in t&&t.preventDefault(),e}if(d===h)return un(dn({},e),{[d]:n(e[d],c,f)});const w=o.shape&&Math.round(g.y)>Math.round(o.shape.center.y)?1:0,y=e[d][c];return un(dn({},e),{[d]:[...e[d].slice(0,c),...e[d].slice(c+1)],[h]:[...e[h].slice(0,f+w),y,...e[h].slice(f+w)]})}function Am(e,t){return Pm(e,t,Tm)}function Im({tiles:e,commit:t,onLanded:n}){const[r,i]=S.useState(void 0),s=S.useRef(void 0),[o,a]=S.useState(!1);return{dragging:o,preview:r,onDragStart:()=>{a(!0),s.current=e},onDragOver:l=>{const{source:u,target:c}=l.operation;if(!u||!c)return;const d=s.current??e;let f;if(c.type===fu){const{after:h}=c.data,v=d.findIndex(w=>mt(w)===u.id);if(v<0||h===u.id)return;const g=d.filter((w,y)=>y!==v).findIndex(w=>mt(w)===h)+1;f=zg(d,v,g)}else{const h=d.map(mt),v=Am(h,l);if(v.every((w,y)=>w===h[y]))return;const g=new Map(d.map(w=>[mt(w),w]));f=Wg(v.map(w=>g.get(w)),e.map(w=>w.break??!1))}s.current=f,i(f)},onDragEnd:l=>{a(!1);const u=s.current;if(s.current=void 0,i(void 0),l.canceled||!u)return;t(u);const c=u.findIndex(d=>mt(d)===l.operation.source?.id);c>=0&&n(c)}}}const hl=e=>{const t=window.document.body;t.style.userSelect=e?"none":"",t.style.cursor=e?"grabbing":""};function Rm({tiles:e,columns:t,onStart:n,commit:r}){const[i,s]=S.useState(void 0),o=S.useRef(null);return{resize:i,gridBox:o,startResize:(a,l)=>{const u=o.current?.getBoundingClientRect(),c=a.currentTarget.parentElement?.getBoundingClientRect();!u||!c||(a.stopPropagation(),a.preventDefault(),a.currentTarget.setPointerCapture(a.pointerId),hl(!0),n(l),s({index:l,span:e[l]?.colspan??1,left:c.left,track:(u.width-ii*(t-1))/t}))},onResize:a=>{if(!i)return;const l=a.clientX-i.left,u=Math.round((l+ii)/(i.track+ii)),c=Math.min(Math.max(u,1),t);c!==i.span&&s({...i,span:c})},endResize:a=>{if(a.currentTarget.hasPointerCapture(a.pointerId)&&a.currentTarget.releasePointerCapture(a.pointerId),hl(!1),!i)return;const{index:l,span:u}=i;s(void 0),r(l,u)}}}function Wm({anchor:e,tile:t,onClose:n,onCommit:r,onRemove:i,columns:s,onDrills:o}){const{theme:a}=tt(),{draft:l,patch:u,close:c,discard:d}=eu(t,e!==null,r,n),f=l!==void 0&&l.declaration.kind!=="inherited";return b.jsx(El,{open:e!==null&&l!==void 0,anchorEl:e,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:320,p:2}}},children:l&&b.jsxs(he,{sx:{gap:1.5},children:[b.jsxs(ne,{variant:"overline",sx:{color:a.tileTitle,lineHeight:1.5},children:[l.source," → ",l.name]}),f?b.jsxs(b.Fragment,{children:[b.jsx(Te,{size:"small",label:"Title",value:l.label??"",autoFocus:!0,inputProps:{"aria-label":"Tile title"},onChange:h=>u(v=>{const g=h.target.value;g===""?delete v.label:v.label=g})}),b.jsx(Te,{size:"small",label:"Subtitle",value:l.subtitle??"",inputProps:{"aria-label":"Tile subtitle"},onChange:h=>u(v=>{const g=h.target.value;g===""?delete v.subtitle:v.subtitle=g})}),b.jsxs(he,{direction:"row",sx:{gap:.5,alignItems:"center"},children:[b.jsx(ne,{variant:"caption",sx:{color:a.tileTitle,mr:.5},children:"Width"}),[["Full",1],["½",2],["⅓",3],["¼",4]].map(([h,v])=>{const g=Math.max(1,Math.round(s/v)),w=(l.colspan??1)===g;return b.jsx(ke,{size:"small",variant:w?"contained":"outlined","aria-label":`Width ${h}`,"aria-pressed":w,onClick:()=>u(y=>{y.colspan=g}),sx:{minWidth:40,px:1},children:h},h)})]})]}):b.jsx(ne,{variant:"body2",sx:{color:a.tileTitle},children:"Declared on its source, so its title and layout are set in the model. It can still be moved."}),l?.declaration.kind==="opaque"&&b.jsxs(ne,{variant:"body2",sx:{color:a.tileTitle},children:["Its body is ",l.declaration.why,", so a filter has no single place to go. Everything else here is editable."]}),b.jsx(ks,{}),b.jsxs(he,{direction:"row",sx:{justifyContent:"space-between"},children:[f?b.jsx(ke,{size:"small",onClick:()=>{c(),o()},children:"Clickable cells…"}):b.jsx("span",{}),b.jsx(ke,{color:"error",size:"small",onClick:()=>{d(),i()},children:"Remove tile"})]})]})})}const pu=e=>e.ok===!1,ve=(e,...t)=>t.every(n=>typeof e?.[n]=="function"),Zi=e=>e!==void 0&&e.ruleIndex!==void 0&&(e.childCount??0)>0,ce={sourceDefinition:e=>ve(e,"sourceNameDef","isDefine","sqExplore"),exploreQueryDef:e=>ve(e,"exploreQueryNameDef","isDefine","vExpr"),defExploreQuery:e=>ve(e,"VIEW","subQueryDefList"),defDimension:e=>ve(e,"defList","DIMENSION"),exploreProperties:e=>ve(e,"exploreStatement","OCURLY","CCURLY"),queryProperties:e=>ve(e,"queryStatement","OCURLY","CCURLY"),queryStatement:e=>ve(e,"whereStatement","aggregateStatement","nestStatement"),whereStatement:e=>ve(e,"WHERE","filterClauseList"),givenDef:e=>ve(e,"givenNameDef"),givenStatement:e=>ve(e,"GIVEN","givenDefList"),importStatement:e=>ve(e,"IMPORT","importURL"),vArrow:e=>ve(e,"ARROW","vExpr","segExpr"),segRefine:e=>ve(e,"PLUS","segExpr"),segOps:e=>ve(e,"queryProperties"),segField:e=>ve(e,"fieldPath")&&!ve(e,"segExpr"),segParen:e=>ve(e,"OPAREN","CPAREN","vExpr"),compare:e=>ve(e,"fieldExpr","compareOp"),givenRef:e=>ve(e,"GIVEN_REF")};function zm(e){const t=new Int32Array([...e].length+1);let n=0;for(let r=0;r<e.length;)t[n++]=r,r+=e.codePointAt(r)>65535?2:1;return t[n]=e.length,t}function Lm(e){const t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
71
71
|
`&&t.push(n+1);return t}class Nm{constructor(t){this.text=t,this.map=zm(t),this.lineStarts=Lm(t)}map;lineStarts;commentLines=new Set;proseLines=new Set;blocks=[];span(t){if(!Zi(t))return;const n=t.start,r=t.stop;if(!n||!r)return;const i=this.map[n.startIndex],s=this.map[r.stopIndex+1];if(!(i===void 0||s===void 0||s<i))return{start:i,end:s}}terminal(t){const n=t?.symbol;if(!n)return;const r=this.map[n.startIndex],i=this.map[n.stopIndex+1];if(!(r===void 0||i===void 0||i<r))return{start:r,end:i}}utf16(t){return this.map[t]}text_(t){const n=this.span(t);return n&&this.text.slice(n.start,n.end)}line(t){let n=0,r=this.lineStarts.length-1;for(;n<r;){const i=n+r+1>>1;this.lineStarts[i]<=t?n=i:r=i-1}return n}positioned(t){const n=this.span(t);return n&&{span:n,line:this.line(n.start)}}indentAt(t){const n=this.lineStarts[this.line(t)];return/^[ \t]*/.exec(this.text.slice(n))?.[0]??""}}function Nr(e,t,n=[]){Zi(e)&&t(e)&&n.push(e);for(let r=0;r<(e.childCount??0);r++)Nr(e.getChild(r),t,n);return n}const _m=e=>ve(e,"OCURLY","CCURLY");function Er(e,t){const n=[],r=i=>{if(Zi(i)){if(t(i)){n.push(i);return}if(!_m(i))for(let s=0;s<(i.childCount??0);s++)r(i.getChild(s))}};for(let i=0;i<(e.childCount??0);i++)r(e.getChild(i));return n}const be=(e,t)=>e[t]?.call(e),Kt=(e,t)=>e[t]?.call(e)??[];function Fm(e,t){if(!ce.compare(t)||(t.childCount??0)!==3)return;const n=t.getChild(2);if(!ce.givenRef(n))return;const r=e.text_(t.getChild(0)),i=e.text_(t.getChild(1)),s=e.text_(n)??"";if(!(r===void 0||i===void 0))return{field:r,op:i.trim(),given:s.replace(/^\$/,"")}}function gu(e,t){const n=e.positioned(t);if(!n)return;const r=be(t,"filterClauseList"),i=[];for(const s of r?Kt(r,"fieldExpr"):[]){const o=e.positioned(s);if(!o)continue;const a=Nr(s,ce.givenRef).map(l=>e.text_(l)).filter(l=>l!==void 0).map(l=>l.replace(/^\$/,""));i.push({...o,givens:a,binding:Fm(e,s)})}return{...n,clauses:i}}function uo(e,t){const n=e.span(t);if(!n)return;const r=[],i=[];for(const u of Er(t,ce.queryStatement)){const c=e.positioned(u);c&&r.push(c);const d=be(u,"whereStatement");if(d&&ce.whereStatement(d)){const f=gu(e,d);f&&i.push(f)}}const s=n.start+1,o=n.end-1,a=!e.text.slice(n.start,n.end).includes(`
|
|
72
72
|
`),l=r.length?e.indentAt(r[0].span.start):e.indentAt(n.start)+" ";return{span:n,openEnd:s,closeStart:o,statements:r,wheres:i,indent:l,oneLine:a}}function va(e,t,n){const r=[],i=e.line(t.start),s=e.line(n);for(let o=i;o<s;o++){if(e.commentLines.has(o)||e.proseLines.has(o))continue;const a=e.text.slice(e.lineStarts[o],e.lineStarts[o+1]??e.text.length).trim();a.startsWith("#")&&!a.startsWith("##")&&r.push({line:o,text:a})}return r}function Hm(e,t){const n=be(t,"segExpr");if(!n)return{kind:"unsupported",why:"an unreadable expression"};const r=ce.vArrow(t);if(ce.segOps(n)){const i=be(n,"queryProperties"),s=i&&uo(e,i);return s?{kind:"inline",stage:s,...r?{pipeline:!0}:{}}:{kind:"unsupported",why:"an unreadable body"}}if(r)return{kind:"unsupported",why:"a `->` pipeline from a named view"};if(ce.segField(n)){const i=e.span(n);return i?{kind:"reference",from:e.text.slice(i.start,i.end),fromSpan:i}:{kind:"unsupported",why:"an unreadable name"}}if(ce.segRefine(n)){const i=Kt(n,"segExpr"),s=i[0],o=i[i.length-1];let a=s;for(;ce.segRefine(a);){const f=Kt(a,"segExpr");if(f.some(h=>ce.segOps(h)||ce.segParen(h)))return{kind:"unsupported",why:"a chained refinement"};a=f[0]}if(!a||!ce.segField(a))return{kind:"unsupported",why:"a `{ … } + { … }` compound refinement"};const l=e.span(s);if(!l||!o)return{kind:"unsupported",why:"an unreadable refinement"};if(!ce.segOps(o)){const f=e.span(n);return f?{kind:"reference",from:e.text.slice(f.start,f.end),fromSpan:f}:{kind:"unsupported",why:"an unreadable refinement"}}const u=e.text.slice(l.start,l.end),c=be(o,"queryProperties"),d=c&&uo(e,c);return d?{kind:"reference",from:u,fromSpan:l,refinement:d}:{kind:"reference",from:u,fromSpan:l}}return{kind:"unsupported",why:"a parenthesized expression"}}function qm(e,t){const n=[];for(const r of Er(t,ce.defExploreQuery)){const i=e.span(r),s=be(r,"subQueryDefList");if(!i||!s)continue;const o=Kt(s,"exploreQueryDef").filter(ce.exploreQueryDef),a=e.terminal(be(r,"VIEW"));for(const l of o){const u=e.span(l),c=be(l,"exploreQueryNameDef"),d=e.text_(c),f=be(l,"vExpr");!u||!d||!f||n.push({name:d,span:u,line:e.line(u.start),statement:i,tags:va(e,i,a?.start??u.start),siblings:o.length,body:Hm(e,f)})}}return n}function Um(e,t){const n=[];for(const r of Er(t,ce.defDimension)){const i=e.span(r),s=be(r,"defList");if(!i||!s)continue;const o=e.terminal(be(r,"DIMENSION"));for(const a of Kt(s,"fieldDef")){const l=e.span(a),u=e.text_(be(a,"fieldNameDef"))?.trim(),c=e.text_(be(a,"fieldExpr"))?.trim();!l||!u||c===void 0||n.push({name:u,expression:c,span:l,line:e.line(l.start),statement:i,tags:va(e,i,o?.start??l.start)})}}return n}function Vm(e,t){const n=[];for(const r of Nr(t,ce.sourceDefinition)){const i=e.span(r),s=e.text_(be(r,"sourceNameDef")),o=be(r,"sqExplore");if(!i||!s||!o)continue;const a=e.span(o),l=a?e.text.slice(a.start,a.end):"",u=(/^\s*(`[^`]*`|[A-Za-z_][A-Za-z0-9_.]*)/.exec(l)?.[1]??"").trim(),c=Er(o,ce.exploreProperties)[0],d=c&&uo(e,c),f={start:e.lineStarts[e.line(i.start)],end:i.end},h=[];if(c)for(const v of Er(c,ce.whereStatement)){const g=gu(e,v);g&&h.push(g)}n.push({name:s,base:u,span:i,line:e.line(i.start),statement:f,...d?{properties:d}:{},views:c?qm(e,c):[],dimensions:c?Um(e,c):[],wheres:h})}return n}function Gm(e,t){const n=[];for(const r of Nr(t,ce.givenStatement)){const i=e.terminal(be(r,"GIVEN")),s=be(r,"givenDefList"),o=i?e.line(i.start):void 0;for(const a of s?Kt(s,"givenDef"):[]){const l=e.span(a),u=e.span(be(a,"givenNameDef")),c=u&&e.text.slice(u.start,u.end);if(!l||!u||!c)continue;const d={start:u.start,end:l.end},f=e.line(d.start);n.push({name:c,declaration:e.text.slice(d.start,d.end),span:d,line:f,statement:{start:e.lineStarts[f],end:d.end},tags:va(e,l,d.start),...o!==void 0&&o!==f?{blockHeader:o}:{}})}}return n}function Ym(e,t){const n=[];for(const r of Nr(t,ce.importStatement)){const i=e.span(r),s=e.text_(be(r,"importURL"));if(!i||s===void 0)continue;const o=be(r,"importSelect"),a=o?Kt(o,"importItem").map(l=>e.text_(l)).filter(l=>l!==void 0).map(l=>l.trim()):void 0;n.push({from:s.replace(/^['"]|['"]$/g,""),...a&&a.length>0?{names:a}:{},span:i,line:e.line(i.start),statement:i})}return n}async function mu(e){let t;try{t=await vu(e,"file://dashboard-builder.malloy")}catch(f){return{ok:!1,reason:`Malloy could not read this file: ${f}`}}const n=t.problems.filter(f=>f.code==="syntax-error");if(n.length>0)return{ok:!1,reason:`This file has a Malloy syntax error, so it cannot be edited here: ${n[0].message??"unknown"}`};const r=t.parse,i=r?.root;if(!i||!Zi(i)||typeof i.getChild!="function")return{ok:!1,reason:`This build of Malloy does not expose a parse tree the builder can read (malloy ${r?.malloyVersion??"unknown"}), so editing is off.`};const s=r?.tokenStream??{},o=typeof s.getTokens=="function"?s.getTokens():void 0;if(!o||typeof s.tokenSource?.vocabulary?.getSymbolicName!="function"||o.length===0&&e.trim()!=="")return{ok:!1,reason:`This build of Malloy does not expose a token stream the builder can read (malloy ${r?.malloyVersion??"unknown"}), so it cannot tell a comment from code and editing is off.`};const a=new Nm(e),l=Xm(a,s);a.commentLines=l.lines;const u=e.split(`
|
|
73
|
-
`),c=f=>l.lines.has(f);a.proseLines=Gu(u,c),a.blocks=Yu(u,c).filter(([f])=>!u[f].trimStart().startsWith("##"));const d=Vm(a,i);return d.length===0&&/^\s*source:/m.test(e)?{ok:!1,reason:`The builder could not locate this file's sources in Malloy's parse tree (malloy ${r?.malloyVersion??"unknown"}), so editing is off.`}:{ok:!0,parsed:{text:e,lineStarts:a.lineStarts,imports:Ym(a,i),sources:d,givens:Gm(a,i),trailingComment:f=>l.trailing.get(f),comments:l.all,commentLine:f=>l.lines.has(f),proseLine:f=>a.proseLines.has(f),commentIn:f=>l.all.find(h=>h.start>=f.start&&h.start<f.end),blockStart:f=>Km(a,l.lines,f)}}}async function vu(e,t){const{MalloyTranslator:n}=await Ol(async()=>{const{MalloyTranslator:i}=await import("./index-
|
|
74
|
-
`||e.text[h-1]==="\r");)h--;i.push({start:f,end:h})}}const o=[...i].sort((c,d)=>c.start-d.start);let a="",l=0;for(const c of o)a+=e.text.slice(l,Math.max(l,c.start)),a+=e.text.slice(Math.max(l,c.start),Math.max(l,c.end)).replace(/[^\n\r]/g," "),l=Math.max(l,c.end);a+=e.text.slice(l);const u=c=>a.slice(e.lineStarts[c],e.lineStarts[c+1]??a.length);for(const c of i){const d=e.line(c.start),f=e.line(c.end-1);for(let g=d;g<=f;g++)u(g).trim()===""&&r.add(g);const h=a.slice(e.lineStarts[d],c.start).trim(),v=a.slice(c.end,e.lineStarts[f+1]??a.length).trim();h!==""&&v===""&&n.set(f,c)}return{trailing:n,lines:r,all:i}}function Km(e,t,n){const r=s=>e.text.slice(e.lineStarts[s],e.lineStarts[s+1]??e.text.length).trim();let i=n;for(let s=n-1;s>=0;s--){const o=r(s),a=e.blocks.find(([,l])=>l===s);if(a){i=s=a[0];continue}if(o===""&&!t.has(s))break;if(o.startsWith("#")||t.has(s))i=s;else break}return i}const ho=e=>e.ok===!1;function _r(e,t,n){const r=e.blockStart(n),i=[],s=[];for(let o=r;o<n;o++){if(e.commentLine(o))continue;if(e.proseLine(o)){s.push(o);continue}const a=t[o].trim();a.startsWith("#")&&!a.startsWith("##")&&i.push({line:o,text:a})}return{start:r,tags:i,prose:s}}const fo=e=>e.map(t=>t.text);function Bm(e){const t=[],n=Xu(e);for(const[r,i]of e.entries()){if(n.has(r))continue;const s=i.trim(),o=Ku(s);s.startsWith("##")&&!s.startsWith('##"')&&!s.startsWith("##!")&&!(o?.level===2&&!o.block)&&t.push(s)}return{description:Tl(e).text,artifact:t}}function Qm(e){if(!e)return;const t=[];for(const n of e.wheres)for(const r of n.clauses){if(!r.binding)continue;const{field:i,op:s,given:o}=r.binding;t.push({field:i,given:o,...s==="~"?{}:{op:s}})}return t.length>0?t:void 0}function Zm(e,t,n){const r=[];for(const i of e.givens){const s=/^([A-Za-z_][A-Za-z0-9_]*)\s*::\s*(\S+)\s+is\s+([\s\S]+)$/.exec(i.declaration);s&&r.push({name:s[1],type:s[2],default:s[3].trim(),...Jm(n(fo(_r(e,t,i.line).tags)).tag)})}return r.length>0?r:void 0}function Jm(e){if(!e)return{};const t=e.tag("suggest"),n=t?.text("dimension"),r=e.numeric("range_min"),i=e.numeric("range_max");return{...e.text("label")===void 0?{}:{label:e.text("label")},...e.text("description")===void 0?{}:{description:e.text("description")},...e.text("control")===void 0?{}:{control:e.text("control")},...t&&n?{suggest:{...t.text("source")===void 0?{}:{source:t.text("source")},...t.text("query")===void 0?{}:{query:t.text("query")},dimension:n}}:{},...r===void 0?{}:{rangeMin:r},...i===void 0?{}:{rangeMax:i}}}function fl(e,t){const n=e?.text(t)?.trim();if(n===void 0||!/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(n))return;const r=Number(n);return Number.isInteger(r)&&r>=1?r:void 0}function ev(e){const t=e.search(/tiles\s*=\s*\[/);if(t<0)return[];const n=e.indexOf("[",t),r=e.indexOf("]",n);return r<0?[]:[...e.slice(n+1,r).matchAll(/"([^"]+)"/g)].map(i=>i[1])}async function po(e){const{parseAnnotation:t}=await Ol(async()=>{const{parseAnnotation:m}=await import("./index-
|
|
73
|
+
`),c=f=>l.lines.has(f);a.proseLines=Gu(u,c),a.blocks=Yu(u,c).filter(([f])=>!u[f].trimStart().startsWith("##"));const d=Vm(a,i);return d.length===0&&/^\s*source:/m.test(e)?{ok:!1,reason:`The builder could not locate this file's sources in Malloy's parse tree (malloy ${r?.malloyVersion??"unknown"}), so editing is off.`}:{ok:!0,parsed:{text:e,lineStarts:a.lineStarts,imports:Ym(a,i),sources:d,givens:Gm(a,i),trailingComment:f=>l.trailing.get(f),comments:l.all,commentLine:f=>l.lines.has(f),proseLine:f=>a.proseLines.has(f),commentIn:f=>l.all.find(h=>h.start>=f.start&&h.start<f.end),blockStart:f=>Km(a,l.lines,f)}}}async function vu(e,t){const{MalloyTranslator:n}=await Ol(async()=>{const{MalloyTranslator:i}=await import("./index-CKmZ4HG7.js").then(s=>s.i);return{MalloyTranslator:i}},__vite__mapDeps([0,1,2,3,4])),r=new n(t,null,{urls:{[t]:e}});return{problems:r.translate().problems??[],parse:r.parseStep?.response?.parse}}function Xm(e,t){const n=new Map,r=new Set,i=[],s=t.tokenSource?.vocabulary;for(const c of t.getTokens?.()??[]){const d=s?.getSymbolicName(c.type);if(d!=="COMMENT_TO_EOL"&&d!=="BLOCK_COMMENT")continue;const f=e.utf16(c.startIndex);let h=e.utf16(c.stopIndex+1);if(!(f===void 0||h===void 0||h<f)){for(;h>f&&(e.text[h-1]===`
|
|
74
|
+
`||e.text[h-1]==="\r");)h--;i.push({start:f,end:h})}}const o=[...i].sort((c,d)=>c.start-d.start);let a="",l=0;for(const c of o)a+=e.text.slice(l,Math.max(l,c.start)),a+=e.text.slice(Math.max(l,c.start),Math.max(l,c.end)).replace(/[^\n\r]/g," "),l=Math.max(l,c.end);a+=e.text.slice(l);const u=c=>a.slice(e.lineStarts[c],e.lineStarts[c+1]??a.length);for(const c of i){const d=e.line(c.start),f=e.line(c.end-1);for(let g=d;g<=f;g++)u(g).trim()===""&&r.add(g);const h=a.slice(e.lineStarts[d],c.start).trim(),v=a.slice(c.end,e.lineStarts[f+1]??a.length).trim();h!==""&&v===""&&n.set(f,c)}return{trailing:n,lines:r,all:i}}function Km(e,t,n){const r=s=>e.text.slice(e.lineStarts[s],e.lineStarts[s+1]??e.text.length).trim();let i=n;for(let s=n-1;s>=0;s--){const o=r(s),a=e.blocks.find(([,l])=>l===s);if(a){i=s=a[0];continue}if(o===""&&!t.has(s))break;if(o.startsWith("#")||t.has(s))i=s;else break}return i}const ho=e=>e.ok===!1;function _r(e,t,n){const r=e.blockStart(n),i=[],s=[];for(let o=r;o<n;o++){if(e.commentLine(o))continue;if(e.proseLine(o)){s.push(o);continue}const a=t[o].trim();a.startsWith("#")&&!a.startsWith("##")&&i.push({line:o,text:a})}return{start:r,tags:i,prose:s}}const fo=e=>e.map(t=>t.text);function Bm(e){const t=[],n=Xu(e);for(const[r,i]of e.entries()){if(n.has(r))continue;const s=i.trim(),o=Ku(s);s.startsWith("##")&&!s.startsWith('##"')&&!s.startsWith("##!")&&!(o?.level===2&&!o.block)&&t.push(s)}return{description:Tl(e).text,artifact:t}}function Qm(e){if(!e)return;const t=[];for(const n of e.wheres)for(const r of n.clauses){if(!r.binding)continue;const{field:i,op:s,given:o}=r.binding;t.push({field:i,given:o,...s==="~"?{}:{op:s}})}return t.length>0?t:void 0}function Zm(e,t,n){const r=[];for(const i of e.givens){const s=/^([A-Za-z_][A-Za-z0-9_]*)\s*::\s*(\S+)\s+is\s+([\s\S]+)$/.exec(i.declaration);s&&r.push({name:s[1],type:s[2],default:s[3].trim(),...Jm(n(fo(_r(e,t,i.line).tags)).tag)})}return r.length>0?r:void 0}function Jm(e){if(!e)return{};const t=e.tag("suggest"),n=t?.text("dimension"),r=e.numeric("range_min"),i=e.numeric("range_max");return{...e.text("label")===void 0?{}:{label:e.text("label")},...e.text("description")===void 0?{}:{description:e.text("description")},...e.text("control")===void 0?{}:{control:e.text("control")},...t&&n?{suggest:{...t.text("source")===void 0?{}:{source:t.text("source")},...t.text("query")===void 0?{}:{query:t.text("query")},dimension:n}}:{},...r===void 0?{}:{rangeMin:r},...i===void 0?{}:{rangeMax:i}}}function fl(e,t){const n=e?.text(t)?.trim();if(n===void 0||!/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/.test(n))return;const r=Number(n);return Number.isInteger(r)&&r>=1?r:void 0}function ev(e){const t=e.search(/tiles\s*=\s*\[/);if(t<0)return[];const n=e.indexOf("[",t),r=e.indexOf("]",n);return r<0?[]:[...e.slice(n+1,r).matchAll(/"([^"]+)"/g)].map(i=>i[1])}async function po(e){const{parseAnnotation:t}=await Ol(async()=>{const{parseAnnotation:m}=await import("./index-CdExa3Pk.js").then(k=>k.i);return{parseAnnotation:m}},__vite__mapDeps([5,1,2,3])),n=e.split(`
|
|
75
75
|
`),r=await mu(e);if(pu(r))return{ok:!1,reason:r.reason,...r.line?{line:r.line}:{}};const i=r.parsed,{description:s,artifact:o}=Bm(n),a=o.find(m=>Bu.test(m));if(a===void 0)return{ok:!1,reason:"No `## artifact { … }` tag, so this file is not a composite dashboard."};const l=t([a.replace(/^##\s*/,"# ")]).tag,u=l?.tag("artifact"),c=ev(a);if(c.length===0)return{ok:!1,reason:"The `## artifact` tag names no tiles, so there is nothing to lay out."};const d=i.imports.map(m=>m.names?{kind:"names",names:m.names,from:m.from}:{kind:"all",from:m.from}),f=[],h=[],v=new Map;for(const m of i.sources){const k={name:m.name,base:m.base};m.dimensions.length>0&&(k.dimensions=m.dimensions.map($=>({name:$.name,expression:$.expression}))),f.push(k);for(const $ of m.dimensions){const C=t(fo(_r(i,n,$.line).tags)).tag?.tag("drill");if(!C)continue;const M=C.textArray("to")??[C.text("to")??""];h.push({source:m.name,name:$.name,expression:$.expression,to:M.filter(Boolean),...C.text("given")?{given:C.text("given")}:{}})}v.set(m.name,new Map(m.views.map($=>[$.name,$])))}const g=[];for(const m of c){const k=Iu(m);if(!k)return{ok:!1,reason:`The tile \`${m}\` is not a \`source -> view\` expression, which is the only form the builder can lay out.`};const{source:$,view:C}=k,M=v.get($)?.get(C);if(M===void 0){g.push({name:C,source:$,declaration:{kind:"inherited"}});continue}const T=t(fo(M.tags)).tag,P=M.body.kind==="reference"?{kind:"reference",from:M.body.from}:M.body.kind==="inline"?{kind:"inline"}:void 0;if(P===void 0){g.push({name:C,source:$,declaration:{kind:"opaque",why:M.body.kind==="unsupported"?M.body.why:"unreadable"},...T?.text("label")?{label:T.text("label")}:{},...T?.text("subtitle")?{subtitle:T.text("subtitle")}:{},...T?.numeric("colspan")!==void 0?{colspan:T.numeric("colspan")}:{},...T?.has("break")?{break:!0}:{},...T?.has("borderless")?{borderless:!0}:{}});continue}const G=Qm(M.body.kind==="reference"?M.body.refinement:M.body.kind==="inline"?M.body.stage:void 0);g.push({name:C,source:$,declaration:P,...G?{filters:G}:{},...T?.text("label")?{label:T.text("label")}:{},...T?.text("subtitle")?{subtitle:T.text("subtitle")}:{},...T?.numeric("colspan")!==void 0?{colspan:T.numeric("colspan")}:{},...T?.has("break")?{break:!0}:{},...T?.has("borderless")?{borderless:!0}:{}})}const w=Zm(i,n,t),y={},p=u?.tag("givens");for(const m of Object.keys(p?.dict??{})){const k=p?.text(m);k!==void 0&&(y[m]=k)}const x=l?.tag("dashboard")?.has("columns")?fl(l.tag("dashboard"),"columns"):u?.array("tiles")?fl(u,"dashboard_columns"):void 0;return{ok:!0,document:{title:u?.text("title")??"",...s?{description:s}:{},...x===void 0?{}:{columns:x},...u?.has("autorun")?{autorun:u.isTrue("autorun")}:{},imports:d,sources:f,...w?{localGivens:w}:{},...Object.keys(y).length>0?{startingGivens:y}:{},...h.length>0?{drills:h}:{},tiles:g}}}async function pl(e){const{problems:t}=await vu(e,"file://splice-check.malloy");return t.filter(n=>n.code==="syntax-error").map(n=>n.message??"").sort()}const gl=e=>e.ok===!1;function ye(e){const t=n=>{if(Array.isArray(n))return n.map(t);if(n&&typeof n=="object"){const r={};for(const i of Object.keys(n).sort())r[i]=t(n[i]);return r}return n};return JSON.stringify(t(e))}function tv(e){const t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
76
76
|
`&&t.push(n+1);return t}function nv(e,t){let n=e;for(const r of[...t].sort((i,s)=>s.start-i.start||s.end-i.end))n=n.slice(0,r.start)+r.text+n.slice(r.end);return n}function bu(e){const t=[];return e.colspan!==void 0&&t.push(`# colspan=${e.colspan}`),e.break&&t.push("# break"),e.borderless&&t.push("# borderless"),e.label!==void 0&&t.push(`# label=${Pn(e.label)}`),e.subtitle!==void 0&&t.push(`# subtitle=${Pn(e.subtitle)}`),t}function bi(e){return/^#\s*([a-z_]+)/.exec(e)?.[1]}const rv=new Set(["colspan","break","borderless","label","subtitle"]),iv=new Set(["label","description","control","suggest","range_min","range_max"]),sv=(e,t)=>ye(e.imports)===ye(t.imports);function ml(e){const t=[];if(e.label!==void 0&&t.push(`label=${Pn(e.label)}`),e.description!==void 0&&t.push(`description=${Pn(e.description)}`),e.control!==void 0&&t.push(`control=${e.control}`),e.suggest){const n=e.suggest.source!==void 0?`source=${e.suggest.source}`:e.suggest.query!==void 0?`query=${e.suggest.query}`:void 0;t.push(`suggest { ${n?`${n} `:""}dimension=${e.suggest.dimension} }`)}return e.rangeMin!==void 0&&t.push(`range_min=${e.rangeMin}`),e.rangeMax!==void 0&&t.push(`range_max=${e.rangeMax}`),t.length>0?`# ${t.join(" ")}`:void 0}const vl=e=>`given: ${e.name} :: ${e.type} is ${e.default}`;function ov(e,t,n){const r=e.sources.find(i=>i.name===t)?.views.find(i=>i.name===n);return r?r.line:-1}function bl(e){return`# drill { to=${e.to.length===1?e.to[0]:`[${e.to.map(t=>`"${t}"`).join(", ")}]`}${e.given?` given=${e.given}`:""} }`}const zi=e=>`${e.source}.${e.name}`,Pn=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,go=e=>ye([e.name,e.source,e.declaration]),vt=go,yl=e=>ye(e.tiles.map(vt));function av(e,t){const n=new Set(e.tiles.map(vt)),r=new Set(t.tiles.map(vt)),i=e.tiles.filter(c=>!r.has(vt(c))),s=t.tiles.filter(c=>!n.has(vt(c))),o=i.length>0||s.length>0||yl(e)!==yl(t);for(const c of s)if(c.declaration.kind!=="reference")return{ok:!1,reason:`A new tile names a view of a source; \`${c.name}\` is ${c.declaration.kind==="inline"?"an inline query":"not declared here"}, which the builder cannot write.`};const a=new Map(e.sources.map(c=>[c.name,c])),l=new Set(e.imports.flatMap(c=>c.kind==="names"?c.names:[]));for(const c of e.sources)l.add(c.base);const u=t.sources.filter(c=>!a.has(c.name));for(const c of e.sources){const d=t.sources.find(f=>f.name===c.name);if(!d||d.base!==c.base)return{ok:!1,reason:`The source \`${c.name}\` cannot be changed or removed here.`}}for(const c of u){if(!s.some(d=>d.source===c.name))return{ok:!1,reason:`A new source \`${c.name}\` needs a tile on it.`};if(!l.has(c.base))return{ok:!1,reason:`\`${c.base}\` is not imported by name in this file, so a tile cannot be put on it. The builder does not add imports: import { ${c.base} } from the model first.`}}return sv(e,t)?{currentKeys:n,nextKeys:r,removedTiles:i,addedTiles:s,newSources:u,currentSources:a,reordered:o}:{ok:!1,reason:"The dashboard's imports cannot be changed here."}}function lv(e){const{lines:t,wholeLine:n,next:r,reordered:i,currentKeys:s,nextKeys:o,edits:a}=e;if(i){const l=si(t);if(l<0)return{ok:!1,reason:"Could not find the `## artifact` tag to reorder."};if(Qu(t[l]))return{ok:!1,reason:"The `tiles=[…]` list holds an entry the builder does not model, such as a text tile, and rewriting the list would drop it. Reorder, add and remove tiles in the file's text."};const u=[...t[l].matchAll(/"([^"]+)"/g)].map(v=>v[1]),c=new Map;for(const v of u){const g=v.split("->").map(w=>w.trim());g.length===2&&c.set(`${g[0]}->${g[1]}`,v)}const d=r.tiles.map(v=>c.get(`${v.source}->${v.name}`)??(o.has(vt(v))&&!s.has(vt(v))?`${v.source} -> ${v.name}`:void 0));if(d.some(v=>v===void 0))return{ok:!1,reason:"A tile in the new order is not one the `## artifact` tag names."};const f=`tiles=[${d.map(v=>`"${v}"`).join(", ")}]`,h=t[l].replace(/tiles\s*=\s*\[[\s\S]*?\]/,f);h!==t[l]&&a.push({...n(l),text:`${h}
|
|
77
77
|
`})}}function cv(e,t){let n=0,r=0;for(let i=0;i<e.length;i++){const s=e[i];if(s==='"')i=Li(e,i);else if(s==="{"||s==="[")n++===0&&r++;else if(s==="}"||s==="]")n--;else if(r===1&&n===1&&e.startsWith(t,i)&&!/[A-Za-z0-9_]/.test(e[i-1]??" ")){const o=/^\s*=\s*/.exec(e.slice(i+t.length));if(!o)continue;const a=i+t.length+o[0].length,l=e[a]==='"'?Li(e,a)+1:a+(/^[^\s}]*/.exec(e.slice(a))?.[0].length??0),u=i-(/\s*$/.exec(e.slice(0,i))?.[0].length??0);return e.slice(0,u)+e.slice(l)}}return e}function dv(e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];if(r==='"')n=Li(e,n);else if(r==="{"||r==="[")t++;else if(r==="}"||r==="]")t--;else if(t===0&&e.startsWith("dashboard",n)&&!/[A-Za-z0-9_]/.test(e[n-1]??" ")){const i=/^dashboard\s*\{/.exec(e.slice(n));if(!i)continue;let s=1,o=n+i[0].length;for(;o<e.length&&s>0;o++)e[o]==='"'?o=Li(e,o):e[o]==="{"?s++:e[o]==="}"&&s--;const a=n-(/\s*$/.exec(e.slice(0,n))?.[0].length??0);return e.slice(0,a)+e.slice(o)}}return e}function Li(e,t){for(let n=t+1;n<e.length;n++)if(e[n]==="\\")n++;else if(e[n]==='"')return n;return e.length}function uv(e){const{lines:t,wholeLine:n,current:r,next:i,edits:s}=e;if(r.title!==i.title||r.autorun!==i.autorun||r.columns!==i.columns||ye(r.startingGivens)!==ye(i.startingGivens)){const o=si(t);if(o<0)return{ok:!1,reason:"Could not find the `## artifact` tag to change the page's settings."};const a=s.find(g=>g.start===n(o).start&&g.end===n(o).end);let l=a?a.text.replace(/\n$/,""):t[o];const u=l.indexOf("artifact"),c=l.indexOf("{",u);let d=0,f=-1;for(let g=c;g<l.length;g++)if(l[g]==="{")d++;else if(l[g]==="}"&&--d===0){f=g;break}if(c<0||f<0)return{ok:!1,reason:"Could not read the `## artifact { … }` tag."};let h=l.slice(c+1,f);const v=(g,w)=>{const y=new RegExp(`\\s*\\b${g}=(?:"(?:[^"\\\\]|\\\\.)*"|[^\\s}]+)`);w===void 0?h=h.replace(y,""):y.test(h)?h=h.replace(y,` ${g}=${w}`):h=`${h.replace(/\s+$/,"")} ${g}=${w} `};if(r.title!==i.title&&v("title",i.title?Pn(i.title):void 0),r.autorun!==i.autorun&&v("autorun",i.autorun===void 0?void 0:String(i.autorun)),ye(r.startingGivens)!==ye(i.startingGivens)){h=h.replace(/\s*\bgivens\s*\{[^}]*\}/,"");const g=Object.entries(i.startingGivens??{});g.length>0&&(h=`${h.replace(/\s+$/,"")} givens { ${g.map(([w,y])=>`${w}=${Pn(y)}`).join(" ")} }`)}h=h.replace(/\s{2,}/g," "),l=`${l.slice(0,c+1)}${h.startsWith(" ")?h:` ${h}`}${h.endsWith(" ")?"":" "}${l.slice(f)}`,r.columns!==i.columns&&(l=cv(l,"dashboard_columns"),l=dv(l),i.columns!==void 0&&(l=`${l.trimEnd()} dashboard { columns=${i.columns} }`)),a?a.text=`${l}
|
package/dist/app/index.html
CHANGED
|
@@ -16,7 +16,7 @@ SPDX-License-Identifier: MIT
|
|
|
16
16
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
|
|
17
17
|
/>
|
|
18
18
|
<title>Malloy Publisher</title>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-TiWjmdoW.js"></script>
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/assets/index-DUqldpo0.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
@@ -15384,72 +15384,21 @@ function onMotlyRoute(text) {
|
|
|
15384
15384
|
function hasEnvReference(annotation) {
|
|
15385
15385
|
return annotation.includes("@env.");
|
|
15386
15386
|
}
|
|
15387
|
-
function
|
|
15388
|
-
const targets = [Object.prototype];
|
|
15389
|
-
for (const key of Object.getOwnPropertyNames(Object.prototype)) {
|
|
15390
|
-
const descriptor = Object.getOwnPropertyDescriptor(Object.prototype, key);
|
|
15391
|
-
if (!descriptor)
|
|
15392
|
-
continue;
|
|
15393
|
-
let value;
|
|
15394
|
-
if ("value" in descriptor) {
|
|
15395
|
-
value = descriptor.value;
|
|
15396
|
-
} else {
|
|
15397
|
-
if (BUILT_IN_PROTO_GETTER === undefined || descriptor.get !== BUILT_IN_PROTO_GETTER) {
|
|
15398
|
-
return;
|
|
15399
|
-
}
|
|
15400
|
-
continue;
|
|
15401
|
-
}
|
|
15402
|
-
if ((typeof value === "object" || typeof value === "function") && value !== null && !targets.includes(value)) {
|
|
15403
|
-
targets.push(value);
|
|
15404
|
-
}
|
|
15405
|
-
}
|
|
15406
|
-
return targets;
|
|
15407
|
-
}
|
|
15408
|
-
function parseGuarded(texts) {
|
|
15409
|
-
const targets = pollutionTargets();
|
|
15410
|
-
if (targets === undefined) {
|
|
15411
|
-
return { tag: undefined, messages: [UNSAFE_TO_PARSE] };
|
|
15412
|
-
}
|
|
15413
|
-
let unreadable = false;
|
|
15414
|
-
const ownNames = (target) => {
|
|
15415
|
-
try {
|
|
15416
|
-
return Object.getOwnPropertyNames(target);
|
|
15417
|
-
} catch {
|
|
15418
|
-
unreadable = true;
|
|
15419
|
-
return [];
|
|
15420
|
-
}
|
|
15421
|
-
};
|
|
15422
|
-
const before = targets.map(ownNames);
|
|
15423
|
-
if (unreadable)
|
|
15424
|
-
return { tag: undefined, messages: [UNSAFE_TO_PARSE] };
|
|
15425
|
-
const undoPollution = () => {
|
|
15426
|
-
let polluted = false;
|
|
15427
|
-
targets.forEach((target, index) => {
|
|
15428
|
-
for (const key of ownNames(target)) {
|
|
15429
|
-
if (before[index].includes(key))
|
|
15430
|
-
continue;
|
|
15431
|
-
polluted = true;
|
|
15432
|
-
try {
|
|
15433
|
-
delete target[key];
|
|
15434
|
-
} catch {}
|
|
15435
|
-
}
|
|
15436
|
-
});
|
|
15437
|
-
return polluted || unreadable;
|
|
15438
|
-
};
|
|
15387
|
+
function parseBounded(texts) {
|
|
15439
15388
|
if (texts.some((text) => text.length > MAX_ANNOTATION_CHARS)) {
|
|
15440
15389
|
return { tag: undefined, messages: [ANNOTATION_TOO_LONG] };
|
|
15441
15390
|
}
|
|
15442
15391
|
try {
|
|
15443
15392
|
const result = parseAnnotation([...texts]);
|
|
15444
|
-
if (undoPollution())
|
|
15445
|
-
return { tag: undefined, messages: [UNSAFE_TO_PARSE] };
|
|
15446
15393
|
return {
|
|
15447
15394
|
tag: result.tag,
|
|
15448
15395
|
messages: result.log.map((error) => error.message)
|
|
15449
15396
|
};
|
|
15450
|
-
} catch {
|
|
15451
|
-
|
|
15452
|
-
|
|
15397
|
+
} catch (error) {
|
|
15398
|
+
return {
|
|
15399
|
+
tag: undefined,
|
|
15400
|
+
messages: [error instanceof Error ? error.message : String(error)]
|
|
15401
|
+
};
|
|
15453
15402
|
}
|
|
15454
15403
|
}
|
|
15455
15404
|
function docCommentText(texts) {
|
|
@@ -15581,16 +15530,16 @@ function parseMotly(texts) {
|
|
|
15581
15530
|
const envErrors = envDropped > 0 ? [ENV_REFERENCE_DROPPED] : [];
|
|
15582
15531
|
if (motly.length === 0)
|
|
15583
15532
|
return { tag: undefined, errors: envErrors };
|
|
15584
|
-
const direct =
|
|
15533
|
+
const direct = parseBounded(motly);
|
|
15585
15534
|
if (direct.messages.length === 0)
|
|
15586
15535
|
return { tag: direct.tag, errors: envErrors };
|
|
15587
15536
|
const rescued = motly.map((text) => {
|
|
15588
|
-
if (
|
|
15537
|
+
if (parseBounded([text]).messages.length === 0)
|
|
15589
15538
|
return text;
|
|
15590
15539
|
const rewritten = quoteFilterLiterals(text);
|
|
15591
|
-
return
|
|
15540
|
+
return parseBounded([rewritten]).messages.length === 0 ? rewritten : text;
|
|
15592
15541
|
});
|
|
15593
|
-
const after =
|
|
15542
|
+
const after = parseBounded(rescued);
|
|
15594
15543
|
return { tag: after.tag, errors: [...envErrors, ...after.messages] };
|
|
15595
15544
|
}
|
|
15596
15545
|
function tagText(tag, ...path) {
|
|
@@ -15656,9 +15605,8 @@ function readStartingGivens(tag, declaredType) {
|
|
|
15656
15605
|
}
|
|
15657
15606
|
return Object.keys(collected).length > 0 ? collected : undefined;
|
|
15658
15607
|
}
|
|
15659
|
-
var
|
|
15608
|
+
var MAX_ANNOTATION_CHARS = 8192, ANNOTATION_TOO_LONG, ENV_REFERENCE_DROPPED = "annotation dropped for carrying an @env. reference";
|
|
15660
15609
|
var init_motly = __esm(() => {
|
|
15661
|
-
BUILT_IN_PROTO_GETTER = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__")?.get;
|
|
15662
15610
|
ANNOTATION_TOO_LONG = `annotation exceeds ${MAX_ANNOTATION_CHARS} characters and was not parsed`;
|
|
15663
15611
|
});
|
|
15664
15612
|
|
|
@@ -23391,9 +23339,6 @@ function lintDashboard(facts, manifest) {
|
|
|
23391
23339
|
return findings;
|
|
23392
23340
|
}
|
|
23393
23341
|
function describeParseFailure(message) {
|
|
23394
|
-
if (message === UNSAFE_TO_PARSE) {
|
|
23395
|
-
return `was refused rather than parsed (${message}), which can be caused by something outside this file`;
|
|
23396
|
-
}
|
|
23397
23342
|
if (message === ENV_REFERENCE_DROPPED) {
|
|
23398
23343
|
return `was dropped rather than parsed (${message}), so nothing on that line took effect`;
|
|
23399
23344
|
}
|