@malloy-publisher/server 0.3.0 → 0.4.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/dist/app/api-doc.yaml +140 -44
- package/dist/app/assets/{EnvironmentPage-D6kQraU3.js → EnvironmentPage-BnxD6uzV.js} +1 -1
- package/dist/app/assets/{HomePage-BZbuE5jv.js → HomePage-D_srvBnZ.js} +1 -1
- package/dist/app/assets/{LightMode-BxZdPcNr.js → LightMode-DCsTKw61.js} +1 -1
- package/dist/app/assets/MainPage-CzHkstrF.js +2 -0
- package/dist/app/assets/ModelPage-CoQ07DHX.js +2 -0
- package/dist/app/assets/PackagePage-CUeUHOnm.js +1 -0
- package/dist/app/assets/RenderedResult-BnPzJ9Jf.es-Dme58kt1.js +116 -0
- package/dist/app/assets/RouteError-gRAhsKGi.js +1 -0
- package/dist/app/assets/ThemeEditorPage-C2gOJTU1.js +1 -0
- package/dist/app/assets/ToggleButtonGroup-CoIPitu6.js +1 -0
- package/dist/app/assets/index-BhkeAzTe.js +453 -0
- package/dist/app/assets/index-BswZnpqD.js +1322 -0
- package/dist/app/assets/index-CRAwrhYM.js +2 -0
- package/dist/app/assets/index-DKvKsj6c.js +442 -0
- package/dist/app/assets/{index-By-g8wiC.js → index-DTfS9vNi.js} +1 -1
- package/dist/app/assets/index-hVLQwLRj.js +1 -0
- package/dist/app/assets/index.es-D0L4_L8o.js +106 -0
- package/dist/app/index.html +1 -1
- package/dist/package_load_worker.mjs +20 -1
- package/dist/server.mjs +1033 -683
- package/package.json +3 -3
- package/dist/app/assets/MainPage-DrczCw4J.js +0 -2
- package/dist/app/assets/MaterializationsPage-BFLHLEuk.js +0 -1
- package/dist/app/assets/ModelPage-CFnfQ6BL.js +0 -1
- package/dist/app/assets/PackagePage-DHsVf_mP.js +0 -1
- package/dist/app/assets/RouteError-CHq8ubhy.js +0 -1
- package/dist/app/assets/ThemeEditorPage-B2y8Y64Y.js +0 -1
- package/dist/app/assets/index-BVv6KQ93.js +0 -557
- package/dist/app/assets/index-Bqrhk3ff.js +0 -2
- package/dist/app/assets/index-CawCwLK3.js +0 -1774
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BswZnpqD.js","assets/index-DKvKsj6c.js","assets/index-DUqldpo0.css","assets/index-w_0OQJgZ.js","assets/index-CRAwrhYM.js","assets/index-DTfS9vNi.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as S,aM as ru,aN as Qn,j as v,aa as ae,aO as iu,at as ts,N as ce,aP as su,U as al,ar as ou,aQ as au,aR as Fr,aS as lu,a4 as ll,a0 as cu,ay as pe,a5 as cl,aT as dl,a8 as aa,aU as ns,aV as du,aW as Nr,F as Ve,aX as ul,aY as _t,aZ as rs,G as dn,I as is,O as Zs,T as J,a_ as uu,a$ as hu,ax as yi,am as ke,aq as ut,b0 as ss,an as hl,Y as fl,b1 as fu,b2 as pu,Q as gu,W as mu,b3 as vu,b4 as bu,b5 as yu,b6 as xu,b7 as wu,b8 as pl,b9 as os,ba as as,bb as ku,bc as Su,aI as ju}from"./index-DKvKsj6c.js";import{T as $u,a as la}from"./ToggleButtonGroup-CoIPitu6.js";var ca={},Ou=Symbol.for("preact-signals");function xi(){if(ht>1)ht--;else{var e,t=!1;for((function(){var i=ti;for(ti=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}})();tr!==void 0;){var n=tr;for(tr=void 0,ei++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ml(n))try{n.c()}catch(i){t||(e=i,t=!0)}n=r}}if(ei=0,ht--,t)throw e}}function se(e){if(ht>0)return e();ls=++Cu,ht++;try{return e()}finally{xi()}}var er,Q=void 0;function N(e){var t=Q,n=er;Q=void 0,er=void 0;try{return e()}finally{Q=t,er=n}}var tr=void 0,ht=0,ei=0,Cu=0,ls=0,ti=void 0,ni=0;function gl(e){if(Q!==void 0){var t=e.n;if(t===void 0||t.t!==Q)return t={i:0,S:e,p:Q.s,n:void 0,t:Q,e:void 0,x:void 0,r:t},Q.s!==void 0&&(Q.s.n=t),Q.s=t,e.n=t,32&Q.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=Q.s,t.n=void 0,Q.s.n=t,Q.s=t),t}}function Ee(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}Ee.prototype.brand=Ou;Ee.prototype.h=function(){return!0};Ee.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:N(function(){var r;(r=t.W)==null||r.call(t)}))};Ee.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&&N(function(){var i;(i=t.Z)==null||i.call(t)}))}};Ee.prototype.subscribe=function(e){var t=this;return Ye(function(){var n=t.value;N(function(){return e(n)})},{name:"sub"})};Ee.prototype.valueOf=function(){return this.value};Ee.prototype.toString=function(){return this.value+""};Ee.prototype.toJSON=function(){return this.value};Ee.prototype.peek=function(){var e=this;return N(function(){return e.value})};Object.defineProperty(Ee.prototype,"value",{get:function(){var e=gl(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ei>100)throw new Error("Cycle detected");(function(n){ht!==0&&ei===0&&n.l!==ls&&(n.l=ls,ti={S:n,v:n.v,i:n.i,o:ti})})(this),this.v=e,this.i++,ni++,ht++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{xi()}}}});function wn(e,t){return new Ee(e,t)}function ml(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 vl(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 bl(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 qt(e,t){Ee.call(this,void 0,t),this.x=e,this.s=void 0,this.g=ni-1,this.f=4}qt.prototype=new Ee;qt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===ni))return!0;if(this.g=ni,this.f|=1,this.i>0&&!ml(this))return this.f&=-2,!0;var e=Q;try{vl(this),Q=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 Q=e,bl(this),this.f&=-2,!0};qt.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)}Ee.prototype.S.call(this,e)};qt.prototype.U=function(e){if(this.t!==void 0&&(Ee.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)}};qt.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(qt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=gl(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function da(e,t){return new qt(e,t)}function yl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){ht++;var n=Q;Q=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,Js(e),r}finally{Q=n,xi()}}}function Js(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,yl(e)}function Mu(e){if(Q!==this)throw new Error("Out-of-order effect");bl(this),Q=e,this.f&=-2,8&this.f&&Js(this),xi()}function kn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,er&&er.push(this)}kn.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()}};kn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,yl(this),vl(this),ht++;var e=Q;return Q=this,Mu.bind(this,e)};kn.prototype.N=function(){2&this.f||(this.f|=2,this.u=tr,tr=this)};kn.prototype.d=function(){this.f|=8,1&this.f||Js(this)};kn.prototype.dispose=function(){this.d()};function Ye(e,t){var n=new kn(e,t);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Eu=Object.create,Qs=Object.defineProperty,Au=Object.defineProperties,Tu=Object.getOwnPropertyDescriptor,Du=Object.getOwnPropertyDescriptors,ua=Object.getOwnPropertySymbols,Pu=Object.prototype.hasOwnProperty,Ru=Object.prototype.propertyIsEnumerable,zu=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Sn=e=>{throw TypeError(e)},cs=(e,t,n)=>t in e?Qs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wu=(e,t)=>{for(var n in t||(t={}))Pu.call(t,n)&&cs(e,n,t[n]);if(ua)for(var n of ua(t))Ru.call(t,n)&&cs(e,n,t[n]);return e},Iu=(e,t)=>Au(e,Du(t)),ha=(e,t)=>Qs(e,"name",{value:t,configurable:!0}),Lu=e=>{var t;return[,,,Eu((t=void 0)!=null?t:null)]},xl=["class","method","getter","setter","accessor","field","value","get","set"],In=e=>e!==void 0&&typeof e!="function"?Sn("Function expected"):e,Fu=(e,t,n,r,i)=>({kind:xl[e],name:t,metadata:r,addInitializer:s=>n._?Sn("Already initialized"):i.push(In(s||null))}),wl=(e,t)=>cs(t,zu("metadata"),e[3]),Ct=(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},jn=(e,t,n,r,i,s)=>{var o,a,l,c,u,d=t&7,h=!!(t&8),f=!!(t&16),g=d>3?e.length+1:d?h?1:2:0,b=xl[d+5],w=d>3&&(e[g-1]=[]),m=e[g]||(e[g]=[]),p=d&&(!f&&!h&&(i=i.prototype),d<5&&(d>3||!f)&&Tu(d<4?i:{get[n](){return Ne(this,s)},set[n](y){return xt(this,s,y)}},n));d?f&&d<4&&ha(s,(d>2?"set ":d>1?"get ":"")+n):ha(i,n);for(var x=r.length-1;x>=0;x--)c=Fu(d,n,l={},e[3],m),d&&(c.static=h,c.private=f,u=c.access={has:f?y=>Nu(i,y):y=>n in y},d^3&&(u.get=f?y=>(d^1?Ne:_u)(y,i,d^4?s:p.get):y=>y[n]),d>2&&(u.set=f?(y,k)=>xt(y,i,k,d^4?s:p.set):(y,k)=>y[n]=k)),a=(0,r[x])(d?d<4?f?s:p[b]:d>4?void 0:{get:p.get,set:p.set}:i,c),l._=1,d^4||a===void 0?In(a)&&(d>4?w.unshift(a):d?f?s=a:p[b]=a:i=a):typeof a!="object"||a===null?Sn("Object expected"):(In(o=a.get)&&(p.get=o),In(o=a.set)&&(p.set=o),In(o=a.init)&&w.unshift(o));return d||wl(e,i),p&&Qs(i,n,p),f?d^4?s:p:i},eo=(e,t,n)=>t.has(e)||Sn("Cannot "+n),Nu=(e,t)=>Object(t)!==t?Sn('Cannot use the "in" operator on this value'):e.has(t),Ne=(e,t,n)=>(eo(e,t,"read from private field"),n?n.call(e):t.get(e)),Ln=(e,t,n)=>t.has(e)?Sn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),xt=(e,t,n,r)=>(eo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),_u=(e,t,n)=>(eo(e,t,"access private method"),n);function ds(e,t){if(t){let n;return da(()=>{const r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return da(e)}function Ge(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)=>!Ge(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=>!Ge(e[i],t[i]))}return!1}function _({get:e},t){return{init(n){return wn(n)},get(){return e.call(this).value},set(n){const r=e.call(this);r.peek()!==n&&(r.value=n)}}}function le(e,t){const n=new WeakMap;return function(){let r=n.get(this);return r||(r=ds(e.bind(this)),n.set(this,r)),r.value}}function Ii(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,Iu(Wu({},i),{enumerable:e}))})}}function mr(...e){const t=e.map(n=>Ye(n));return()=>t.forEach(n=>n())}var kl,Sl,jl,$l,Ol,Cl,Oe,to,Li,us,hs,we,no,Fi,Ml,fs,ro,Ni,ps,gs;Cl=[_],Ol=[_],$l=[_],jl=[Ii()],Sl=[Ii()],kl=[Ii()];var Ht=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,Ct(Oe,5,this),Ln(this,we),Ln(this,to,Ct(Oe,8,this)),Ct(Oe,11,this),Ln(this,no,Ct(Oe,12,this)),Ct(Oe,15,this),Ln(this,ro,Ct(Oe,16,this)),Ct(Oe,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return Ne(this,we,ps)}get initial(){return Ne(this,we,us)}get previous(){return Ne(this,we,Ml)}set current(e){const t=N(()=>Ne(this,we,ps));e&&t&&this.equals(t,e)||se(()=>{Ne(this,we,us)||xt(this,we,e,hs),xt(this,we,t,fs),xt(this,we,e,gs)})}reset(e=this.defaultValue){se(()=>{xt(this,we,void 0,fs),xt(this,we,e,hs),xt(this,we,e,gs)})}};Oe=Lu();to=new WeakMap;we=new WeakSet;no=new WeakMap;ro=new WeakMap;Li=jn(Oe,20,"#initial",Cl,we,to),us=Li.get,hs=Li.set;Fi=jn(Oe,20,"#previous",Ol,we,no),Ml=Fi.get,fs=Fi.set;Ni=jn(Oe,20,"#current",$l,we,ro),ps=Ni.get,gs=Ni.set;jn(Oe,2,"current",jl,Ht);jn(Oe,2,"initial",Sl,Ht);jn(Oe,2,"previous",kl,Ht);wl(Oe,Ht);function _i(e){return N(()=>{const t={};for(const n in e)t[n]=e[n];return t})}var Mt,qu=class{constructor(){Ln(this,Mt,new WeakMap)}get(e,t){var n;return e?(n=Ne(this,Mt).get(e))==null?void 0:n.get(t):void 0}set(e,t,n){var r;if(e)return Ne(this,Mt).has(e)||Ne(this,Mt).set(e,new Map),(r=Ne(this,Mt).get(e))==null?void 0:r.set(t,n)}clear(e){var t;return e?(t=Ne(this,Mt).get(e))==null?void 0:t.clear():void 0}};Mt=new WeakMap;var Hu=Object.create,El=Object.defineProperty,Vu=Object.getOwnPropertyDescriptor,fa=Object.getOwnPropertySymbols,Yu=Object.prototype.hasOwnProperty,Uu=Object.prototype.propertyIsEnumerable,Al=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),wi=e=>{throw TypeError(e)},pa=Math.pow,ms=(e,t,n)=>t in e?El(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xu=(e,t)=>{for(var n in t||(t={}))Yu.call(t,n)&&ms(e,n,t[n]);if(fa)for(var n of fa(t))Uu.call(t,n)&&ms(e,n,t[n]);return e},Gu=e=>{var t;return[,,,Hu((t=e?.[Al("metadata")])!=null?t:null)]},Tl=["class","method","getter","setter","accessor","field","value","get","set"],Dl=e=>e!==void 0&&typeof e!="function"?wi("Function expected"):e,Bu=(e,t,n,r,i)=>({kind:Tl[e],name:t,metadata:r,addInitializer:s=>n._?wi("Already initialized"):i.push(Dl(s||null))}),Ku=(e,t)=>ms(t,Al("metadata"),e[3]),Zu=(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},Pl=(e,t,n,r,i,s)=>{for(var o,a,l,c,u=t&7,d=!1,h=!1,f=2,g=Tl[u+5],b=e[f]||(e[f]=[]),w=(i=i.prototype,Vu(i,n)),m=r.length-1;m>=0;m--)l=Bu(u,n,a={},e[3],b),l.static=d,l.private=h,c=l.access={has:p=>n in p},c.get=p=>p[n],o=(0,r[m])(w[g],l),a._=1,Dl(o)&&(w[g]=o);return w&&El(i,n,w),i},Rl=(e,t,n)=>t.has(e)||wi("Cannot "+n),Ju=(e,t,n)=>(Rl(e,t,"read from private field"),t.get(e)),Qu=(e,t,n)=>t.has(e)?wi("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),eh=(e,t,n,r)=>(Rl(e,t,"write to private field"),t.set(e,n),n),_e=class vs{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new vs(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 vs(t,n)}},rt=class Et{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 Et(i+t,r+n,s,o);return l.scale=Xu({},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 _e((t+r)/2,(n+i)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Et))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 Et?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 Et(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,c=o==="x"?s.width:s.height;return a=="start"?l:a=="end"?l+c:l+c/2};return _e.delta({x:i(t,"x"),y:i(t,"y")},{x:i(n,"x"),y:i(n,"y")})}static intersectionRatio(t,n){return Et.from(t).intersectionRatio(Et.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,Wl,bs,_r,vr,ki=class extends(bs=Ht,Wl=[le],zl=[le],bs){constructor(e){const t=_e.from(e);super(t,(n,r)=>_e.equals(n,r)),Zu(vr,5,this),Qu(this,_r,0),this.velocity={x:0,y:0}}get delta(){return _e.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=_e.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),s=i-Ju(this,_r),o=a=>Math.round(a/s*100);se(()=>{eh(this,_r,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(_e.from(e)),this.velocity={x:0,y:0}}};vr=Gu(bs);_r=new WeakMap;Pl(vr,2,"delta",Wl,ki);Pl(vr,2,"direction",zl,ki);Ku(vr,ki);function ys({x:e,y:t},n){const r=Math.abs(e),i=Math.abs(t);return typeof n=="number"?Math.sqrt(pa(r,2)+pa(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 Il=(e=>(e.Horizontal="x",e.Vertical="y",e))(Il||{}),Ll=Object.values(Il),nh=Object.create,io=Object.defineProperty,rh=Object.defineProperties,ih=Object.getOwnPropertyDescriptor,sh=Object.getOwnPropertyDescriptors,ri=Object.getOwnPropertySymbols,Fl=Object.prototype.hasOwnProperty,Nl=Object.prototype.propertyIsEnumerable,_l=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),$n=e=>{throw TypeError(e)},xs=(e,t,n)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,so=(e,t)=>{for(var n in t||(t={}))Fl.call(t,n)&&xs(e,n,t[n]);if(ri)for(var n of ri(t))Nl.call(t,n)&&xs(e,n,t[n]);return e},oo=(e,t)=>rh(e,sh(t)),ga=(e,t)=>io(e,"name",{value:t,configurable:!0}),ql=(e,t)=>{var n={};for(var r in e)Fl.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ri)for(var r of ri(e))t.indexOf(r)<0&&Nl.call(e,r)&&(n[r]=e[r]);return n},On=e=>{var t;return[,,,nh((t=e?.[_l("metadata")])!=null?t:null)]},Hl=["class","method","getter","setter","accessor","field","value","get","set"],Fn=e=>e!==void 0&&typeof e!="function"?$n("Function expected"):e,oh=(e,t,n,r,i)=>({kind:Hl[e],name:t,metadata:r,addInitializer:s=>n._?$n("Already initialized"):i.push(Fn(s||null))}),Vt=(e,t)=>xs(t,_l("metadata"),e[3]),F=(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},q=(e,t,n,r,i,s)=>{var o,a,l,c,u,d=t&7,h=!!(t&8),f=!!(t&16),g=d>3?e.length+1:d?h?1:2:0,b=Hl[d+5],w=d>3&&(e[g-1]=[]),m=e[g]||(e[g]=[]),p=d&&(!f&&!h&&(i=i.prototype),d<5&&(d>3||!f)&&ih(d<4?i:{get[n](){return oe(this,s)},set[n](y){return Le(this,s,y)}},n));d?f&&d<4&&ga(s,(d>2?"set ":d>1?"get ":"")+n):ga(i,n);for(var x=r.length-1;x>=0;x--)c=oh(d,n,l={},e[3],m),d&&(c.static=h,c.private=f,u=c.access={has:f?y=>ah(i,y):y=>n in y},d^3&&(u.get=f?y=>(d^1?oe:Vl)(y,i,d^4?s:p.get):y=>y[n]),d>2&&(u.set=f?(y,k)=>Le(y,i,k,d^4?s:p.set):(y,k)=>y[n]=k)),a=(0,r[x])(d?d<4?f?s:p[b]:d>4?void 0:{get:p.get,set:p.set}:i,c),l._=1,d^4||a===void 0?Fn(a)&&(d>4?w.unshift(a):d?f?s=a:p[b]=a:i=a):typeof a!="object"||a===null?$n("Object expected"):(Fn(o=a.get)&&(p.get=o),Fn(o=a.set)&&(p.set=o),Fn(o=a.init)&&w.unshift(o));return d||Vt(e,i),p&&io(i,n,p),f?d^4?s:p:i},ao=(e,t,n)=>t.has(e)||$n("Cannot "+n),ah=(e,t)=>Object(t)!==t?$n('Cannot use the "in" operator on this value'):e.has(t),oe=(e,t,n)=>(ao(e,t,"read from private field"),n?n.call(e):t.get(e)),V=(e,t,n)=>t.has(e)?$n("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Le=(e,t,n,r)=>(ao(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Vl=(e,t,n)=>(ao(e,t,"access private method"),n);function Yl(e,t){return{plugin:e,options:t}}function br(e){return t=>Yl(e,t)}function ar(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var Ul,lr,lo,qr;Ul=[_];var Se=class{constructor(e,t){this.manager=e,this.options=t,V(this,lo,F(lr,8,this,!1)),F(lr,11,this),V(this,qr,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return N(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){const t=Ye(e.bind(this));return oe(this,qr).add(t),t}destroy(){oe(this,qr).forEach(e=>e())}static configure(e){return Yl(this,e)}};lr=On(null);lo=new WeakMap;qr=new WeakMap;q(lr,4,"disabled",Ul,Se,lo);Vt(lr,Se);var yr=class extends Se{},Hr,qi=class{constructor(e){this.manager=e,this.instances=new Map,V(this,Hr,[])}get values(){return Array.from(this.instances.values())}set values(e){const t=e.map(ar).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 oe(this,Hr))if(!n.includes(r)){if(r.prototype instanceof yr)continue;this.unregister(r)}for(const{plugin:r,options:i}of t)this.register(r,i);Le(this,Hr,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()}};Hr=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 Cr=[],en,tn,ch=class extends Se{constructor(e){super(e),V(this,en),V(this,tn),this.computeCollisions=this.computeCollisions.bind(this),Le(this,tn,wn(Cr)),this.destroy=mr(()=>{const t=this.computeCollisions(),n=N(()=>this.manager.dragOperation.position.current);if(t!==Cr){const r=oe(this,en);if(Le(this,en,n),r&&n.x==r.x&&n.y==r.y)return}else Le(this,en,void 0);oe(this,tn).value=t},()=>{const{dragOperation:t}=this.manager;t.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){N(()=>{e?oe(this,tn).value=this.computeCollisions():Le(this,en,void 0)})}computeCollisions(e,t){const{registry:n,dragOperation:r}=this.manager,{source:i,shape:s,status:o}=r;if(!o.initialized||!s)return Cr;const a=[],l=[];for(const c of e??n.droppables){if(c.disabled||i&&!c.accepts(i))continue;const u=t??c.collisionDetector;if(!u)continue;l.push(c),c.shape;const d=N(()=>u({droppable:c,dragOperation:r}));d&&(c.collisionPriority!=null&&(d.priority=c.collisionPriority),a.push(d))}return l.length===0?Cr:(a.sort(lh),a)}get collisions(){return oe(this,tn).value}};en=new WeakMap;tn=new WeakMap;var Xl,Gl,Bl,co,Kl,Be,uo,ln,ho,fo;Bl=[_],Gl=[_],Xl=[_];var pt=class At{constructor(t,n){V(this,uo,F(Be,8,this)),F(Be,11,this),V(this,ln),V(this,ho,F(Be,12,this)),F(Be,15,this),V(this,fo,F(Be,16,this)),F(Be,19,this);const{effects:r,id:i,data:s={},disabled:o=!1,register:a=!0}=t;let l=i;Le(this,ln,wn(i)),this.manager=n,this.data=s,this.disabled=o,this.effects=()=>{var c;return[()=>{const{id:u,manager:d}=this;if(u!==l)return l=u,d?.registry.register(this),()=>d?.registry.unregister(this)},...(c=r?.())!=null?c:[]]},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=oe(this,ln).value;return(n=(t=At.pendingIdChanges)==null?void 0:t.get(this))!=null?n:r}set id(t){var n,r;const i=(r=(n=At.pendingIdChanges)==null?void 0:n.get(this))!=null?r:oe(this,ln).peek();t!==i&&(At.pendingIdChanges||(At.pendingIdChanges=new Map,queueMicrotask(()=>{var s;return Vl(s=At,co,Kl).call(s)})),At.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)}};Be=On(null);co=new WeakSet;Kl=function(){const e=pt.pendingIdChanges;pt.pendingIdChanges=null,e&&se(()=>{for(const[t,n]of e)oe(t,ln).value=n})};uo=new WeakMap;ln=new WeakMap;ho=new WeakMap;fo=new WeakMap;q(Be,4,"manager",Bl,pt,uo);q(Be,4,"data",Gl,pt,ho);q(Be,4,"disabled",Xl,pt,fo);V(pt,co);Vt(Be,pt);pt.pendingIdChanges=null;var Si=pt,ma=class{constructor(){this.map=wn(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=mr(...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}},Zl,Jl,Ql,ec,tc,nc,ws,Ce,po,go,mo,it=class extends(ws=Si,nc=[_],tc=[_],ec=[_],Ql=[le],Jl=[le],Zl=[le],ws){constructor(e,t){var n=e,{modifiers:r,type:i,sensors:s,plugins:o,effects:a}=n,l=ql(n,["modifiers","type","sensors","plugins","effects"]);super(oo(so({},l),{effects:()=>{var c;return[...(c=a?.())!=null?c:[],()=>{const{manager:u,plugins:d}=this;if(!(!u||!d))for(const h of d){const{plugin:f}=ar(h);u.registry.plugins.register(f)}}]}}),t),F(Ce,5,this),V(this,po,F(Ce,8,this)),F(Ce,11,this),V(this,go,F(Ce,12,this)),F(Ce,15,this),V(this,mo,F(Ce,16,this,this.isDragSource?"dragging":"idle")),F(Ce,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=ar(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}};Ce=On(ws);po=new WeakMap;go=new WeakMap;mo=new WeakMap;q(Ce,4,"type",nc,it,po);q(Ce,4,"modifiers",tc,it,go);q(Ce,4,"status",ec,it,mo);q(Ce,2,"isDropping",Ql,it);q(Ce,2,"isDragging",Jl,it);q(Ce,2,"isDragSource",Zl,it);Vt(Ce,it);var rc,ic,sc,oc,ac,lc,ks,ue,vo,bo,yo,xo,wo,st=class extends(ks=Si,lc=[_],ac=[_],oc=[_],sc=[_],ic=[_],rc=[le],ks){constructor(e,t){var n=e,{accept:r,collisionDetector:i,collisionPriority:s,type:o}=n,a=ql(n,["accept","collisionDetector","collisionPriority","type"]);super(a,t),F(ue,5,this),V(this,vo,F(ue,8,this)),F(ue,11,this),V(this,bo,F(ue,12,this)),F(ue,15,this),V(this,yo,F(ue,16,this)),F(ue,19,this),V(this,xo,F(ue,20,this)),F(ue,23,this),V(this,wo,F(ue,24,this)),F(ue,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}};ue=On(ks);vo=new WeakMap;bo=new WeakMap;yo=new WeakMap;xo=new WeakMap;wo=new WeakMap;q(ue,4,"accept",lc,st,vo);q(ue,4,"type",ac,st,bo);q(ue,4,"collisionDetector",oc,st,yo);q(ue,4,"collisionPriority",sc,st,xo);q(ue,4,"shape",ic,st,wo);q(ue,2,"isDropTarget",rc,st);Vt(ue,st);var dh=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)}},uh=class extends dh{constructor(e){super(),this.manager=e}dispatch(e,t){const n=[t,this.manager];super.dispatch(e,...n)}};function Vr(e,t=!0){let n=!1;return oo(so({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var hh=class extends yr{constructor(e){super(e);const t=(r,i)=>r.map(({id:s})=>s).join("")===i.map(({id:s})=>s).join("");let n=[];this.destroy=mr(()=>{const{dragOperation:r,collisionObserver:i}=e;r.status.initializing&&(n=[],i.enable())},()=>{const{collisionObserver:r,monitor:i}=e,{collisions:s}=r;if(r.isDisabled()||Si.pendingIdChanges)return;const o=Vr({collisions:s});if(i.dispatch("collision",o),o.defaultPrevented||t(s,n))return;n=s;const[a]=s;N(()=>{var l;a?.id!==((l=e.dragOperation.target)==null?void 0:l.id)&&(r.disable(),e.actions.setDropTarget(a?.id).then(()=>{r.enable()}))})})}},Cn=(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))(Cn||{}),Mn=(e=>(e[e.Collision=0]="Collision",e[e.ShapeIntersection=1]="ShapeIntersection",e[e.PointerIntersection=2]="PointerIntersection",e))(Mn||{}),cc,dc,uc,hc,fc,pc,gc,He,ko;gc=[_],pc=[le],fc=[le],hc=[le],uc=[le],dc=[le],cc=[le];var gt=class{constructor(){F(He,5,this),V(this,ko,F(He,8,this,"idle")),F(He,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}};He=On(null);ko=new WeakMap;q(He,4,"value",gc,gt,ko);q(He,2,"current",pc,gt);q(He,2,"idle",fc,gt);q(He,2,"initializing",hc,gt);q(He,2,"initialized",uc,gt);q(He,2,"dragging",dc,gt);q(He,2,"dropped",cc,gt);Vt(He,gt);var fh=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 N(()=>{const{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;const r=Vr({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return N(()=>{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;se(()=>{t.status.set("initialization-pending"),t.shape=null,t.canceled=!1,t.activatorEvent=r??null,t.position.reset(i)});const s=Vr({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"&&se(()=>{t.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:r,operation:t.snapshot(),cancelable:!1})})}),n)})}move(e){return N(()=>{var t,n;const{dragOperation:r}=this.manager,{status:i,controller:s}=r;if(!i.dragging||!s||s.signal.aborted)return;const o=Vr({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,c,u,d;if(o.defaultPrevented)return;const h=(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+((u=(c=e.by)==null?void 0:c.y)!=null?u:0)};r.position.current=h})})}stop(e={}){return N(()=>{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((c,u)=>{l.resume=c,l.abort=u}),l};i.abort();const a=()=>{this.manager.renderer.rendering.then(()=>{r.status.set("dropped");const l=N(()=>{var u;return((u=r.source)==null?void 0:u.status)==="dropping"}),c=()=>{r.controller===i&&(r.controller=void 0),r.reset()};if(l){const{source:u}=r,d=Ye(()=>{u?.status==="idle"&&(d(),c())})}else this.manager.renderer.rendering.then(c)})};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()})}},pn=class extends Se{constructor(e,t){super(e,t),this.manager=e,this.options=t}},ph=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)}},Yr,mc=class{constructor(e){this.options=e,V(this,Yr)}set controller(e){Le(this,Yr,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var t;(t=oe(this,Yr))==null||t.activate(e)}};Yr=new WeakMap;var va=class extends Se{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},gh=class{constructor(e){this.draggables=new ma,this.droppables=new ma,this.plugins=new qi(e),this.sensors=new qi(e),this.modifiers=new qi(e)}register(e,t){if(e instanceof it)return this.draggables.register(e.id,e);if(e instanceof st)return this.droppables.register(e.id,e);if(e.prototype instanceof va)return this.modifiers.register(e,t);if(e.prototype instanceof pn)return this.sensors.register(e,t);if(e.prototype instanceof Se)return this.plugins.register(e,t);throw new Error("Invalid instance type")}unregister(e){if(e instanceof Si)return e instanceof it?this.draggables.unregister(e.id,e):e instanceof st?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof va)return this.modifiers.unregister(e);if(e.prototype instanceof pn)return this.sensors.unregister(e);if(e.prototype instanceof Se)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()}},vc,bc,yc,xc,wc,kc,Sc,jc,$c,Nn,Ur,nn,ie,So,jo,$o,Oo,Co,_n;$c=[le],jc=[_],Sc=[_],kc=[_],wc=[_],xc=[_],yc=[le],bc=[le],vc=[le];var Ze=class{constructor(e){F(ie,5,this),V(this,Nn),V(this,Ur),V(this,nn,new Ht(void 0,(t,n)=>t&&n?t.equals(n):t===n)),this.status=new gt,V(this,So,F(ie,8,this,!1)),F(ie,11,this),V(this,jo,F(ie,12,this,null)),F(ie,15,this),V(this,$o,F(ie,16,this,null)),F(ie,19,this),V(this,Oo,F(ie,20,this,null)),F(ie,23,this),V(this,Co,F(ie,24,this,[])),F(ie,27,this),this.position=new ki({x:0,y:0}),V(this,_n,{x:0,y:0}),Le(this,Nn,e)}get shape(){const{current:e,initial:t,previous:n}=oe(this,nn);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?oe(this,nn).current=e:oe(this,nn).reset()}get source(){var e;const t=this.sourceIdentifier;if(t==null)return null;const n=oe(this,Nn).registry.draggables.get(t);return n&&Le(this,Ur,n),(e=n??oe(this,Ur))!=null?e:null}get target(){var e;const t=this.targetIdentifier;return t!=null&&(e=oe(this,Nn).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(oo(so({},this.snapshot()),{transform:n}));return Le(this,_n,n),n}snapshot(){return N(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:oe(this,_n),shape:this.shape?_i(this.shape):null,position:_i(this.position),status:_i(this.status),canceled:this.canceled}))}reset(){se(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,oe(this,nn).reset(),this.position.reset({x:0,y:0}),Le(this,_n,{x:0,y:0}),this.modifiers=[]})}};ie=On(null);Nn=new WeakMap;Ur=new WeakMap;nn=new WeakMap;So=new WeakMap;jo=new WeakMap;$o=new WeakMap;Oo=new WeakMap;Co=new WeakMap;_n=new WeakMap;q(ie,2,"shape",$c,Ze);q(ie,4,"canceled",jc,Ze,So);q(ie,4,"activatorEvent",Sc,Ze,jo);q(ie,4,"sourceIdentifier",kc,Ze,$o);q(ie,4,"targetIdentifier",wc,Ze,Oo);q(ie,4,"modifiers",xc,Ze,Co);q(ie,2,"source",yc,Ze);q(ie,2,"target",bc,Ze);q(ie,2,"transform",vc,Ze);Vt(ie,Ze);var mh={get rendering(){return Promise.resolve()}};function Ke(e,t){return typeof e=="function"?e(t):e??t}var vh=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=Ke(n.plugins,[]),i=Ke(n.sensors,[]),s=Ke(n.modifiers,[]),o=(t=n.renderer)!=null?t:mh,a=new uh(this),l=new gh(this);this.registry=l,this.monitor=a,this.renderer=o,this.actions=new fh(this),this.dragOperation=new Ze(this),this.collisionObserver=new ch(this),this.plugins=[hh,...r],this.modifiers=s,this.sensors=i;const{destroy:c}=this,u=mr(()=>{var d,h,f;const g=N(()=>this.dragOperation.modifiers),b=this.modifiers;for(const w of g)b.includes(w)||w.destroy();this.dragOperation.modifiers=(f=(h=(d=this.dragOperation.source)==null?void 0:d.modifiers)==null?void 0:h.map(w=>{const{plugin:m,options:p}=ar(w);return new m(this,p)}))!=null?f:b});this.destroy=()=>{u(),c()}}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}},Oc=e=>{throw TypeError(e)},Mo=(e,t,n)=>t.has(e)||Oc("Cannot "+n),L=(e,t,n)=>(Mo(e,t,"read from private field"),t.get(e)),De=(e,t,n)=>t.has(e)?Oc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ie=(e,t,n,r)=>(Mo(e,t,"write to private field"),t.set(e,n),n),Cc=(e,t,n)=>(Mo(e,t,"access private method"),n);function ji(e){return e?e instanceof KeyframeEffect?!0:"getKeyframes"in e&&typeof e.getKeyframes=="function":!1}function Mc(e,t){const n=e.getAnimations();let r=null;for(const i of n){if(i.playState!=="running")continue;const{effect:s}=i,o=(ji(s)?s.getKeyframes():[]).filter(t);o.length>0&&(r=[o[o.length-1],i])}return r}function $i(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 Eo(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function xr(e){return"nodeType"in e}function Fe(e){var t,n,r;return e?Eo(e)?e:xr(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 Ao(e){const{Document:t}=Fe(e);return e instanceof t||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function $t(e){return!e||Eo(e)?!1:e instanceof Fe(e).HTMLElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("html")}function Ec(e){return e instanceof Fe(e).SVGElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("svg")}function En(e){return e?Eo(e)?e.document:xr(e)?Ao(e)?e:$t(e)||Ec(e)?e.ownerDocument:document:document:document}function bh(e){var t,n,r,i;const{documentElement:s}=En(e),o=Fe(e).visualViewport,a=(t=o?.width)!=null?t:s.clientWidth,l=(n=o?.height)!=null?n:s.clientHeight,c=(r=o?.offsetTop)!=null?r:0,u=(i=o?.offsetLeft)!=null?i:0;return{top:c,left:u,right:u+a,bottom:c+l,width:a,height:l}}function yh(e,t){if(xh(e)&&e.open===!1)return!1;const{overflow:n,overflowX:r,overflowY:i}=getComputedStyle(e);return n==="visible"&&r==="visible"&&i==="visible"}function xh(e){return e.tagName==="DETAILS"}function cr(e,t=e.getBoundingClientRect(),n=0){var r,i,s,o,a;let l=t;const{ownerDocument:c}=e,u=(r=c.defaultView)!=null?r:window;let d=e.parentElement;for(;d&&d!==c.documentElement;){if(!yh(d)){const x=d.getBoundingClientRect(),y=n*(x.bottom-x.top),k=n*(x.right-x.left),M=n*(x.bottom-x.top),j=n*(x.right-x.left);l={top:Math.max(l.top,x.top-y),right:Math.min(l.right,x.right+k),bottom:Math.min(l.bottom,x.bottom+M),left:Math.max(l.left,x.left-j),width:0,height:0},l.width=l.right-l.left,l.height=l.bottom-l.top}d=d.parentElement}const h=u.visualViewport,f=(i=h?.offsetTop)!=null?i:0,g=(s=h?.offsetLeft)!=null?s:0,b=(o=h?.width)!=null?o:u.innerWidth,w=(a=h?.height)!=null?a:u.innerHeight,m=n*w,p=n*b;return l={top:Math.max(l.top,f-m),right:Math.min(l.right,g+b+p),bottom:Math.min(l.bottom,f+w+m),left:Math.max(l.left,g-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 gn(e){return{x:e.clientX,y:e.clientY}}var Ac=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ss(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(...Ss(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(...Ss(i.document,t))}}catch{}return n}function To(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Tc(){var e,t;const n=To()?window.visualViewport:null;return{x:(e=n?.offsetLeft)!=null?e:0,y:(t=n?.offsetTop)!=null?t:0}}function Do(e){return!e||!xr(e)?!1:e instanceof Fe(e).ShadowRoot}function ii(e){if(e&&xr(e)){let t=e.getRootNode();if(Do(t)||t instanceof Document)return t}return En(e)}function Po(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function wh(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];ba(i)&&ba(o)&&(i.type!=="file"&&(i.value=o.value),i.type==="radio"&&i.name&&(i.name=`Cloned__${i.name}`)),ya(i)&&ya(o)&&o.width>0&&o.height>0&&i.getContext("2d")?.drawImage(o,0,0)}),n}function ba(e){return"value"in e}function ya(e){return e.tagName==="CANVAS"}function Dc(e,{x:t,y:n}){const r=e.elementFromPoint(t,n);if(kh(r)){const{contentDocument:i}=r;if(i){const{left:s,top:o}=r.getBoundingClientRect();return Dc(i,{x:t-s,y:n-o})}}return r}function kh(e){return e?.tagName==="IFRAME"}var js=new WeakMap;function Sh(e){return e.closest(`
|
|
3
|
+
input:not([disabled]),
|
|
4
|
+
select:not([disabled]),
|
|
5
|
+
textarea:not([disabled]),
|
|
6
|
+
button:not([disabled]),
|
|
7
|
+
a[href],
|
|
8
|
+
[contenteditable]:not([contenteditable="false"])
|
|
9
|
+
`)}var Pc=class{constructor(){this.entries=new Set,this.clear=()=>{for(const e of this.entries){const[t,{type:n,listener:r,options:i}]=e;t.removeEventListener(n,r,i)}this.entries.clear()}}bind(e,t){const n=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t],i=[];for(const o of n)for(const a of r){const{type:l,listener:c,options:u}=a,d=[o,a];o.addEventListener(l,c,u),this.entries.add(d),i.push(d)}const s=this.entries;return function(){for(const o of i){const[a,{type:l,listener:c,options:u}]=o;a.removeEventListener(l,c,u),s.delete(o)}}}};function mn(e){const t=e?.ownerDocument.defaultView;if(t&&t.self!==t.parent)return t.frameElement}function jh(e){const t=new Set;let n=mn(e);for(;n;)t.add(n),n=mn(n);return t}function $h(e,t){const n=setTimeout(e,t);return()=>clearTimeout(n)}function Rc(e,t){const n=()=>performance.now();let r,i;return function(...s){const o=this;i?(r?.(),r=$h(()=>{e.apply(o,s),i=n()},t-(n()-i))):(e.apply(o,s),i=n())}}function Oh(e,t){return e===t?!0:!e||!t?!1:e.top==t.top&&e.left==t.left&&e.right==t.right&&e.bottom==t.bottom}function Ch(e,t=e.getBoundingClientRect()){const{width:n,height:r}=cr(e,t);return n>0&&r>0}var Mh=Ac?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},Xr,Eh=class extends Mh{constructor(e){super(t=>{if(!L(this,Xr)){Ie(this,Xr,!0);return}e(t,this)}),De(this,Xr,!1)}};Xr=new WeakMap;var xa=Array.from({length:100},(e,t)=>t/100),zc=75,Tt,si,bt,Dt,qn,ve,nr,Hn,oi,Wc,Ic,Lc=class{constructor(e,t,n={debug:!1,skipInitial:!1}){this.element=e,this.callback=t,De(this,oi),this.disconnect=()=>{var s,o,a;Ie(this,nr,!0),(s=L(this,bt))==null||s.disconnect(),(o=L(this,Dt))==null||o.disconnect(),L(this,qn).disconnect(),(a=L(this,ve))==null||a.remove()},De(this,Tt,!0),De(this,si),De(this,bt),De(this,Dt),De(this,qn),De(this,ve),De(this,nr,!1),De(this,Hn,Rc(()=>{var s,o,a;const{element:l}=this;if((s=L(this,Dt))==null||s.disconnect(),L(this,nr)||!L(this,Tt)||!l.isConnected)return;const c=(o=l.ownerDocument)!=null?o:document,{innerHeight:u,innerWidth:d}=(a=c.defaultView)!=null?a:window,h=l.getBoundingClientRect(),f=cr(l,h),{top:g,left:b,bottom:w,right:m}=f,p=-Math.floor(g),x=-Math.floor(b),y=-Math.floor(d-m),k=-Math.floor(u-w),M=`${p}px ${y}px ${k}px ${x}px`;this.boundingClientRect=h,Ie(this,Dt,new IntersectionObserver(j=>{const[T]=j,{intersectionRect:D}=T;(T.intersectionRatio!==1?T.intersectionRatio:rt.intersectionRatio(D,cr(l)))!==1&&L(this,Hn).call(this)},{threshold:xa,rootMargin:M,root:c})),L(this,Dt).observe(l),Cc(this,oi,Wc).call(this)},zc)),this.boundingClientRect=e.getBoundingClientRect(),Ie(this,Tt,Ch(e,this.boundingClientRect));let r=!0;this.callback=s=>{r&&(r=!1,n.skipInitial)||t(s)};const i=e.ownerDocument;n?.debug&&(Ie(this,ve,document.createElement("div")),L(this,ve).style.background="rgba(0,0,0,0.15)",L(this,ve).style.position="fixed",L(this,ve).style.pointerEvents="none",i.body.appendChild(L(this,ve))),Ie(this,qn,new IntersectionObserver(s=>{var o,a;const l=s[s.length-1],{boundingClientRect:c,isIntersecting:u}=l,{width:d,height:h}=c,f=L(this,Tt);Ie(this,Tt,u),!(!d&&!h)&&(f&&!u?((o=L(this,Dt))==null||o.disconnect(),this.callback(null),(a=L(this,bt))==null||a.disconnect(),Ie(this,bt,void 0),L(this,ve)&&(L(this,ve).style.visibility="hidden")):L(this,Hn).call(this),u&&!L(this,bt)&&(Ie(this,bt,new Eh(L(this,Hn))),L(this,bt).observe(e)))},{threshold:xa,root:i})),L(this,Tt)&&!n.skipInitial&&this.callback(this.boundingClientRect),L(this,qn).observe(e)}};Tt=new WeakMap;si=new WeakMap;bt=new WeakMap;Dt=new WeakMap;qn=new WeakMap;ve=new WeakMap;nr=new WeakMap;Hn=new WeakMap;oi=new WeakSet;Wc=function(){L(this,nr)||(Cc(this,oi,Ic).call(this),!Oh(this.boundingClientRect,L(this,si))&&(this.callback(this.boundingClientRect),Ie(this,si,this.boundingClientRect)))};Ic=function(){if(L(this,ve)){const{top:e,left:t,width:n,height:r}=cr(this.element);L(this,ve).style.overflow="hidden",L(this,ve).style.visibility="visible",L(this,ve).style.top=`${Math.floor(e)}px`,L(this,ve).style.left=`${Math.floor(t)}px`,L(this,ve).style.width=`${Math.floor(n)}px`,L(this,ve).style.height=`${Math.floor(r)}px`}};var Mr=new WeakMap,Er=new WeakMap;function Ah(e,t){let n=Mr.get(e);return n||(n={disconnect:new Lc(e,r=>{const i=Mr.get(e);i&&i.callbacks.forEach(s=>s(r))},{skipInitial:!0}).disconnect,callbacks:new Set}),n.callbacks.add(t),Mr.set(e,n),()=>{n.callbacks.delete(t),n.callbacks.size===0&&(Mr.delete(e),n.disconnect())}}function Th(e,t){const n=new Set;for(const r of e){const i=Ah(r,t);n.add(i)}return()=>n.forEach(r=>r())}function Dh(e,t){var n;const r=e.ownerDocument;if(!Er.has(r)){const o=new AbortController,a=new Set;document.addEventListener("scroll",l=>a.forEach(c=>c(l)),{capture:!0,passive:!0,signal:o.signal}),Er.set(r,{disconnect:()=>o.abort(),listeners:a})}const{listeners:i,disconnect:s}=(n=Er.get(r))!=null?n:{};return!i||!s?()=>{}:(i.add(t),()=>{i.delete(t),i.size===0&&(s(),Er.delete(r))})}var Vn,Yn,Gr,$s,Ph=class{constructor(e,t,n){this.callback=t,De(this,Vn),De(this,Yn,!1),De(this,Gr),De(this,$s,Rc(o=>{if(!L(this,Yn)&&o.target&&"contains"in o.target&&typeof o.target.contains=="function"){for(const a of L(this,Gr))if(o.target.contains(a)){this.callback(L(this,Vn).boundingClientRect);break}}},zc));const r=jh(e),i=Th(r,t),s=Dh(e,L(this,$s));Ie(this,Gr,r),Ie(this,Vn,new Lc(e,t,n)),this.disconnect=()=>{L(this,Yn)||(Ie(this,Yn,!0),i(),s(),L(this,Vn).disconnect())}}};Vn=new WeakMap;Yn=new WeakMap;Gr=new WeakMap;$s=new WeakMap;function Os(e){return"showPopover"in e&&"hidePopover"in e&&typeof e.showPopover=="function"&&typeof e.hidePopover=="function"}function un(e){try{Os(e)&&e.isConnected&&e.hasAttribute("popover")&&!e.matches(":popover-open")&&e.showPopover()}catch{}}function wa(e){return!Ac||!e?!1:e===En(e).scrollingElement}function Fc(e){var t,n;const r=Fe(e),i=wa(e)?bh(e):$i(e),s=r.visualViewport,o=wa(e)?{height:(t=s?.height)!=null?t:r.innerHeight,width:(n=s?.width)!=null?n:r.innerWidth}:{height:e.clientHeight,width:e.clientWidth},a={current:{x:e.scrollLeft,y:e.scrollTop},max:{x:e.scrollWidth-o.width,y:e.scrollHeight-o.height}},l=a.current.y<=0,c=a.current.x<=0,u=a.current.y>=a.max.y,d=a.current.x>=a.max.x;return{rect:i,position:a,isTop:l,isLeft:c,isBottom:u,isRight:d}}function Rh(e,t){const{isTop:n,isBottom:r,isLeft:i,isRight:s,position:o}=Fc(e),{x:a,y:l}=t??{x:0,y:0},c=!n&&o.current.y+l>0,u=!r&&o.current.y+l<o.max.y,d=!i&&o.current.x+a>0,h=!s&&o.current.x+a<o.max.x;return{top:c,bottom:u,left:d,right:h,x:d||h,y:c||u}}var Ro=class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{const{tasks:t,resolvers:n}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(const r of t)r();for(const r of n)r()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(t=>this.resolvers.add(t))}},ai=new Ro(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(e):e()}),zh=new Ro(e=>setTimeout(e,50)),li=new Map,Wh=li.clear.bind(li);function ot(e,t=!1){if(!t)return ka(e);let n=li.get(e);return n||(n=ka(e),li.set(e,n),zh.schedule(Wh),n)}function ka(e){return Fe(e).getComputedStyle(e)}function Ih(e,t=ot(e,!0)){return t.position==="fixed"||t.position==="sticky"}function Lh(e,t=ot(e,!0)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(r=>{const i=t[r];return typeof i=="string"?n.test(i):!1})}var Fh={excludeElement:!0,escapeShadowDOM:!0};function Cs(e,t=Fh){const{limit:n,excludeElement:r,escapeShadowDOM:i}=t,s=new Set;function o(a){if(n!=null&&s.size>=n||!a)return s;if(Ao(a)&&a.scrollingElement!=null&&!s.has(a.scrollingElement))return s.add(a.scrollingElement),s;if(i&&Do(a))return o(a.host);if(!$t(a))return Ec(a)?o(a.parentElement):s;if(s.has(a))return s;const l=ot(a,!0);if(r&&a===e||Lh(a,l)&&s.add(a),Ih(a,l)){const{scrollingElement:c}=a.ownerDocument;return c&&s.add(c),s}return o(a.parentNode)}return e?o(e):s}function vn(e,t=window.frameElement){const n={x:0,y:0,scaleX:1,scaleY:1};if(!e)return n;let r=mn(e);for(;r;){if(r===t)return n;const i=$i(r),{x:s,y:o}=Nh(r,i);n.x=n.x+i.left,n.y=n.y+i.top,n.scaleX=n.scaleX*s,n.scaleY=n.scaleY*o,r=mn(r)}return n}function Nh(e,t=$i(e)){const n=Math.round(t.width),r=Math.round(t.height);if($t(e))return{x:n/e.offsetWidth,y:r/e.offsetHeight};const i=ot(e,!0);return{x:(parseFloat(i.width)||n)/n,y:(parseFloat(i.height)||r)/r}}function _h(e){if(!e||e==="none")return null;const t=e.split(" "),n=parseFloat(t[0]),r=parseFloat(t[1]);return isNaN(n)&&isNaN(r)?null:{x:isNaN(n)?r:n,y:isNaN(r)?n:r}}function dr(e){if(!e||e==="none")return null;const[t,n,r="0"]=e.split(" "),i={x:parseFloat(t),y:parseFloat(n),z:parseInt(r,10)};return isNaN(i.x)&&isNaN(i.y)?null:{x:isNaN(i.x)?0:i.x,y:isNaN(i.y)?0:i.y,z:isNaN(i.z)?0:i.z}}function Oi(e){var t,n,r,i,s,o,a,l,c;const{scale:u,transform:d,translate:h}=e,f=_h(u),g=dr(h),b=qh(d);if(!b&&!f&&!g)return null;const w={x:(t=f?.x)!=null?t:1,y:(n=f?.y)!=null?n:1},m={x:(r=g?.x)!=null?r:0,y:(i=g?.y)!=null?i:0},p={x:(s=b?.x)!=null?s:0,y:(o=b?.y)!=null?o:0,scaleX:(a=b?.scaleX)!=null?a:1,scaleY:(l=b?.scaleY)!=null?l:1};return{x:m.x+p.x,y:m.y+p.y,z:(c=g?.z)!=null?c:0,scaleX:w.x*p.scaleX,scaleY:w.y*p.scaleY}}function qh(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}var qe=(e=>(e[e.Idle=0]="Idle",e[e.Forward=1]="Forward",e[e.Reverse=-1]="Reverse",e))(qe||{}),Hh={x:.2,y:.2},Vh={x:10,y:10};function Yh(e,t,n,r=25,i=Hh,s=Vh){const{x:o,y:a}=t,{rect:l,isTop:c,isBottom:u,isLeft:d,isRight:h}=Fc(e),f=vn(e),g=ot(e,!0),b=Oi(g),w=b!==null?b?.scaleX<0:!1,m=b!==null?b?.scaleY<0:!1,p=new rt(l.left*f.scaleX+f.x,l.top*f.scaleY+f.y,l.width*f.scaleX,l.height*f.scaleY),x={x:0,y:0},y={x:0,y:0},k={height:p.height*i.y,width:p.width*i.x};return k.height>0&&(!c||m&&!u)&&a<=p.top+k.height&&n?.y!==1&&o>=p.left-s.x&&o<=p.right+s.x?(x.y=m?1:-1,y.y=r*Math.abs((p.top+k.height-a)/k.height)):k.height>0&&(!u||m&&!c)&&a>=p.bottom-k.height&&n?.y!==-1&&o>=p.left-s.x&&o<=p.right+s.x&&(x.y=m?-1:1,y.y=r*Math.abs((p.bottom-k.height-a)/k.height)),k.width>0&&(!h||w&&!d)&&o>=p.right-k.width&&n?.x!==-1&&a>=p.top-s.y&&a<=p.bottom+s.y?(x.x=w?-1:1,y.x=r*Math.abs((p.right-k.width-o)/k.width)):k.width>0&&(!d||w&&!h)&&o<=p.left+k.width&&n?.x!==1&&a>=p.top-s.y&&a<=p.bottom+s.y&&(x.x=w?1:-1,y.x=r*Math.abs((p.left+k.width-o)/k.width)),{direction:x,speed:y}}function Nc(e,{block:t="nearest",inline:n="nearest"}={}){if(!$t(e))return;const r=Cs(e),i=[];for(const s of r){if(!$t(s))continue;const{top:o,left:a}=Uh(e,s);let l=o,c=a;for(const u of i)l-=u.scrollTop,c-=u.scrollLeft;if(t!=="none"){const u=l<s.scrollTop,d=l+e.offsetHeight>s.scrollTop+s.clientHeight;u!==d&&(t==="center"?s.scrollTop=l-s.clientHeight/2+e.offsetHeight/2:u?s.scrollTop=l:s.scrollTop=l+e.offsetHeight-s.clientHeight)}if(n!=="none"){const u=c<s.scrollLeft,d=c+e.offsetWidth>s.scrollLeft+s.clientWidth;u!==d&&(n==="center"?s.scrollLeft=c-s.clientWidth/2+e.offsetWidth/2:u?s.scrollLeft=c:s.scrollLeft=c+e.offsetWidth-s.clientWidth)}i.push(s)}}function Sa(e){let t=0,n=0,r=e;for(;r;){t+=r.offsetTop,n+=r.offsetLeft;const i=r.offsetParent;if(!$t(i))break;t+=i.clientTop,n+=i.clientLeft,r=i}return{top:t,left:n}}function Uh(e,t){const n=Sa(e),r=Sa(t);return{top:n.top-r.top-t.clientTop,left:n.left-r.left-t.clientLeft}}function Xh(e,t,n){const{scaleX:r,scaleY:i,x:s,y:o}=t,a=e.left+s+(1-r)*parseFloat(n),l=e.top+o+(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width*r:e.width,u=i?e.height*i:e.height;return{width:c,height:u,top:l,right:a+c,bottom:l+u,left:a}}function Gh(e,t,n){const{scaleX:r,scaleY:i,x:s,y:o}=t,a=e.left-s-(1-r)*parseFloat(n),l=e.top-o-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),c=r?e.width/r:e.width,u=i?e.height/i:e.height;return{width:c,height:u,top:l,right:a+c,bottom:l+u,left:a}}function _c({element:e,keyframes:t,options:n}){return e.animate(t,n).finished}function ja(e,t=ot(e).translate,n=!0){if(n){const r=Mc(e,i=>"translate"in i);if(r){const{translate:i=""}=r[0];if(typeof i=="string"){const s=dr(i);if(s)return s}}}if(t){const r=dr(t);if(r)return r}return{x:0,y:0,z:0}}var Bh=new Ro(e=>setTimeout(e,0)),rr=new Map,Kh=rr.clear.bind(rr);function Zh(e){const t=e.ownerDocument;let n=rr.get(t);if(n)return n;n=t.getAnimations(),rr.set(t,n),Bh.schedule(Kh);const r=n.filter(i=>ji(i.effect)&&i.effect.target===e);return rr.set(e,r),n}function Jh(e,t){const n=Zh(e).filter(r=>{var i,s;if(ji(r.effect)){const{target:o}=r.effect;if((s=o&&((i=t.isValidTarget)==null?void 0:i.call(t,o)))==null||s)return r.effect.getKeyframes().some(a=>{for(const l of t.properties)if(a[l])return!0})}}).map(r=>{const{effect:i,currentTime:s}=r,o=i?.getComputedTiming().duration;if(!(r.pending||r.playState==="finished")&&typeof o=="number"&&typeof s=="number"&&s<o)return r.currentTime=o,()=>{r.currentTime=s}});if(n.length>0)return()=>n.forEach(r=>r?.())}var nt=class extends rt{constructor(e,t={}){var n,r,i,s;const{frameTransform:o=vn(e),ignoreTransforms:a,getBoundingClientRect:l=$i}=t,c=Jh(e,{properties:["transform","translate","scale","width","height"],isValidTarget:k=>(k!==e||To())&&k.contains(e)}),u=l(e);let{top:d,left:h,width:f,height:g}=u,b;const w=ot(e),m=Oi(w),p={x:(n=m?.scaleX)!=null?n:1,y:(r=m?.scaleY)!=null?r:1},x=Qh(e,w);c?.(),m&&(b=Gh(u,m,w.transformOrigin),(a||x)&&(d=b.top,h=b.left,f=b.width,g=b.height));const y={width:(i=b?.width)!=null?i:f,height:(s=b?.height)!=null?s:g};if(x&&!a&&b){const k=Xh(b,x,w.transformOrigin);d=k.top,h=k.left,f=k.width,g=k.height,p.x=x.scaleX,p.y=x.scaleY}o&&(a||(h*=o.scaleX,f*=o.scaleX,d*=o.scaleY,g*=o.scaleY),h+=o.x,d+=o.y),super(h,d,f,g),this.scale=p,this.intrinsicWidth=y.width,this.intrinsicHeight=y.height}};function Qh(e,t){const n=e.getAnimations();if(!n.length)return null;let r,i,s,o=!1;for(const a of n){if(a.playState!=="running")continue;const l=ji(a.effect)?a.effect.getKeyframes():[],c=l[l.length-1];if(!c)continue;const{transform:u,translate:d,scale:h}=c;typeof u=="string"&&u&&(r=u,o=!0),typeof d=="string"&&d&&(i=d,o=!0),typeof h=="string"&&h&&(s=h,o=!0)}return o?Oi({transform:r??t.transform,translate:i??t.translate,scale:s??t.scale}):null}function ir(e){return"style"in e&&typeof e.style=="object"&&e.style!==null&&"setProperty"in e.style&&"removeProperty"in e.style&&typeof e.style.setProperty=="function"&&typeof e.style.removeProperty=="function"}var ef=class{constructor(e){this.element=e,this.initial=new Map}set(e,t=""){const{element:n}=this;if(ir(n))for(const[r,i]of Object.entries(e)){const s=`${t}${r}`;this.initial.has(s)||this.initial.set(s,n.style.getPropertyValue(s)),n.style.setProperty(s,typeof i=="string"?i:`${i}px`)}}remove(e,t=""){const{element:n}=this;if(ir(n))for(const r of e){const i=`${t}${r}`;n.style.removeProperty(i)}}reset(){const{element:e}=this;if(ir(e)){for(const[t,n]of this.initial)e.style.setProperty(t,n);e.getAttribute("style")===""&&e.removeAttribute("style")}}};function Lt(e){return e?e instanceof Fe(e).Element||xr(e)&&e.nodeType===Node.ELEMENT_NODE:!1}function ur(e){if(!e)return!1;const{KeyboardEvent:t}=Fe(e.target);return e instanceof t}function tf(e){if(!e)return!1;const{PointerEvent:t}=Fe(e.target);return e instanceof t}function nf(e){if(!Lt(e))return!1;const{tagName:t}=e;return t==="INPUT"||t==="TEXTAREA"||rf(e)}function rf(e){return e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")!=="false"}var Hi={};function Ms(e){const t=Hi[e]==null?0:Hi[e]+1;return Hi[e]=t,`${e}-${t}`}var zo=({dragOperation:e,droppable:t})=>{const n=e.position.current;if(!n)return null;const{id:r}=t;if(!t.shape)return null;if(t.shape.containsPoint(n)){const i=_e.distance(t.shape.center,n);return{id:r,value:1/i,type:Mn.PointerIntersection,priority:Cn.High}}return null},sf=({dragOperation:e,droppable:t})=>{const{shape:n}=e;if(!t.shape||!n?.current)return null;const r=n.current.intersectionArea(t.shape);if(r){const{position:i}=e,s=_e.distance(t.shape.center,i.current),o=r/(n.current.area+t.shape.area-r)/s;return{id:t.id,value:o,type:Mn.ShapeIntersection,priority:Cn.Normal}}return null},qc=e=>{var t;return(t=zo(e))!=null?t:sf(e)},of=e=>{const{dragOperation:t,droppable:n}=e,{shape:r,position:i}=t;if(!n.shape)return null;const s=r?rt.from(r.current.boundingRectangle).corners:void 0,o=rt.from(n.shape.boundingRectangle).corners.reduce((a,l,c)=>{var u;return a+_e.distance(_e.from(l),(u=s?.[c])!=null?u:i.current)},0)/4;return{id:n.id,value:1/o,type:Mn.Collision,priority:Cn.Normal}},af=Object.create,Wo=Object.defineProperty,lf=Object.defineProperties,cf=Object.getOwnPropertyDescriptor,df=Object.getOwnPropertyDescriptors,ci=Object.getOwnPropertySymbols,Hc=Object.prototype.hasOwnProperty,Vc=Object.prototype.propertyIsEnumerable,Yc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),An=e=>{throw TypeError(e)},Es=(e,t,n)=>t in e?Wo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hr=(e,t)=>{for(var n in t||(t={}))Hc.call(t,n)&&Es(e,n,t[n]);if(ci)for(var n of ci(t))Vc.call(t,n)&&Es(e,n,t[n]);return e},Io=(e,t)=>lf(e,df(t)),$a=(e,t)=>Wo(e,"name",{value:t,configurable:!0}),Uc=(e,t)=>{var n={};for(var r in e)Hc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ci)for(var r of ci(e))t.indexOf(r)<0&&Vc.call(e,r)&&(n[r]=e[r]);return n},Tn=e=>{var t;return[,,,af((t=e?.[Yc("metadata")])!=null?t:null)]},Xc=["class","method","getter","setter","accessor","field","value","get","set"],Un=e=>e!==void 0&&typeof e!="function"?An("Function expected"):e,uf=(e,t,n,r,i)=>({kind:Xc[e],name:t,metadata:r,addInitializer:s=>n._?An("Already initialized"):i.push(Un(s||null))}),Yt=(e,t)=>Es(t,Yc("metadata"),e[3]),he=(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},Ue=(e,t,n,r,i,s)=>{var o,a,l,c,u,d=t&7,h=!!(t&8),f=!!(t&16),g=d>3?e.length+1:d?h?1:2:0,b=Xc[d+5],w=d>3&&(e[g-1]=[]),m=e[g]||(e[g]=[]),p=d&&(!f&&!h&&(i=i.prototype),d<5&&(d>3||!f)&&cf(d<4?i:{get[n](){return B(this,s)},set[n](y){return Me(this,s,y)}},n));d?f&&d<4&&$a(s,(d>2?"set ":d>1?"get ":"")+n):$a(i,n);for(var x=r.length-1;x>=0;x--)c=uf(d,n,l={},e[3],m),d&&(c.static=h,c.private=f,u=c.access={has:f?y=>hf(i,y):y=>n in y},d^3&&(u.get=f?y=>(d^1?B:Ft)(y,i,d^4?s:p.get):y=>y[n]),d>2&&(u.set=f?(y,k)=>Me(y,i,k,d^4?s:p.set):(y,k)=>y[n]=k)),a=(0,r[x])(d?d<4?f?s:p[b]:d>4?void 0:{get:p.get,set:p.set}:i,c),l._=1,d^4||a===void 0?Un(a)&&(d>4?w.unshift(a):d?f?s=a:p[b]=a:i=a):typeof a!="object"||a===null?An("Object expected"):(Un(o=a.get)&&(p.get=o),Un(o=a.set)&&(p.set=o),Un(o=a.init)&&w.unshift(o));return d||Yt(e,i),p&&Wo(i,n,p),f?d^4?s:p:i},Lo=(e,t,n)=>t.has(e)||An("Cannot "+n),hf=(e,t)=>Object(t)!==t?An('Cannot use the "in" operator on this value'):e.has(t),B=(e,t,n)=>(Lo(e,t,"read from private field"),n?n.call(e):t.get(e)),de=(e,t,n)=>t.has(e)?An("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Me=(e,t,n,r)=>(Lo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ft=(e,t,n)=>(Lo(e,t,"access private method"),n),Oa={role:"button",roleDescription:"draggable"},ff="dnd-kit-description",pf="dnd-kit-announcement",gf={draggable:"To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item in a given direction. Press space again to drop the item in its new position, or press escape to cancel."},mf={dragstart({operation:{source:e}}){if(e)return`Picked up draggable item ${e.id}.`},dragover({operation:{source:e,target:t}}){if(!(!e||e.id===t?.id))return t?`Draggable item ${e.id} was moved over droppable target ${t.id}.`:`Draggable item ${e.id} is no longer over a droppable target.`},dragend({operation:{source:e,target:t},canceled:n}){if(e)return n?`Dragging was cancelled. Draggable item ${e.id} was dropped.`:t?`Draggable item ${e.id} was dropped over droppable target ${t.id}`:`Draggable item ${e.id} was dropped.`}};function vf(e){const t=e.tagName.toLowerCase();return["input","select","textarea","a","button"].includes(t)}function bf(e,t){const n=document.createElement("div");return n.id=e,n.style.setProperty("display","none"),n.textContent=t,n}function yf(e){const t=document.createElement("div");return t.id=e,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),t.style.setProperty("position","fixed"),t.style.setProperty("width","1px"),t.style.setProperty("height","1px"),t.style.setProperty("margin","-1px"),t.style.setProperty("border","0"),t.style.setProperty("padding","0"),t.style.setProperty("overflow","hidden"),t.style.setProperty("clip","rect(0 0 0 0)"),t.style.setProperty("clip-path","inset(100%)"),t.style.setProperty("white-space","nowrap"),t}var xf=["dragover","dragmove"],wf=class extends Se{constructor(e,t){super(e);const{id:n,idPrefix:{description:r=ff,announcement:i=pf}={},announcements:s=mf,screenReaderInstructions:o=gf,debounce:a=500}=t??{},l=n?`${r}-${n}`:Ms(r),c=n?`${i}-${n}`:Ms(i);let u,d,h,f;const g=(k=f)=>{!h||!k||h?.nodeValue!==k&&(h.nodeValue=k)},b=()=>ai.schedule(g),w=kf(b,a),m=Object.entries(s).map(([k,M])=>this.manager.monitor.addEventListener(k,(j,T)=>{const D=h;if(!D)return;const A=M?.(j,T);A&&D.nodeValue!==A&&(f=A,xf.includes(k)?w():(b(),w.cancel()))})),p=()=>{let k=[];u?.isConnected||(u=bf(l,o.draggable),k.push(u)),d?.isConnected||(d=yf(c),h=document.createTextNode(""),d.appendChild(h),k.push(d)),k.length>0&&document.body.append(...k)},x=new Set;function y(){for(const k of x)k()}this.registerEffect(()=>{var k;x.clear();for(const M of this.manager.registry.draggables.value){const j=(k=M.handle)!=null?k:M.element;if(j){(!u||!d)&&x.add(p),(!vf(j)||To())&&!j.hasAttribute("tabindex")&&x.add(()=>j.setAttribute("tabindex","0")),!j.hasAttribute("role")&&j.tagName.toLowerCase()!=="button"&&x.add(()=>j.setAttribute("role",Oa.role)),j.hasAttribute("aria-roledescription")||x.add(()=>j.setAttribute("aria-roledescription",Oa.roleDescription)),j.hasAttribute("aria-describedby")||x.add(()=>j.setAttribute("aria-describedby",l));for(const D of["aria-pressed","aria-grabbed"]){const A=String(M.isDragging);j.getAttribute(D)!==A&&x.add(()=>j.setAttribute(D,A))}const T=String(M.disabled);j.getAttribute("aria-disabled")!==T&&x.add(()=>j.setAttribute("aria-disabled",T))}}x.size>0&&ai.schedule(y)}),this.destroy=()=>{super.destroy(),u?.remove(),d?.remove(),m.forEach(k=>k())}}};function kf(e,t){let n;const r=()=>{clearTimeout(n),n=setTimeout(e,t)};return r.cancel=()=>clearTimeout(n),r}var di=new Map,Gc,Bc,Kc,Zc,As,sr,ft,Fo,bn,Jc,Qc,ed,td,Ot=class extends(As=yr,Zc=[_],Kc=[le],Bc=[le],Gc=[le],As){constructor(e,t){super(e,t),he(ft,5,this),de(this,bn),de(this,sr,new Set),de(this,Fo,he(ft,8,this,new Set)),he(ft,11,this),this.registerEffect(Ft(this,bn,Jc))}register(e){return B(this,sr).add(e),()=>{B(this,sr).delete(e)}}addRoot(e){return N(()=>{const t=new Set(this.additionalRoots);t.add(e),this.additionalRoots=t}),()=>{N(()=>{const t=new Set(this.additionalRoots);t.delete(e),this.additionalRoots=t})}}get sourceRoot(){var e;const{source:t}=this.manager.dragOperation;return ii((e=t?.element)!=null?e:null)}get targetRoot(){var e;const{target:t}=this.manager.dragOperation;return ii((e=t?.element)!=null?e:null)}get roots(){const{status:e}=this.manager.dragOperation;if(e.initializing||e.initialized){const t=[this.sourceRoot,this.targetRoot].filter(n=>n!=null);return new Set([...t,...this.additionalRoots])}return new Set}};ft=Tn(As);sr=new WeakMap;Fo=new WeakMap;bn=new WeakSet;Jc=function(){const{roots:e}=this,t=[];for(const n of e)for(const r of B(this,sr))t.push(Ft(this,bn,Qc).call(this,n,r));return()=>{for(const n of t)n()}};Qc=function(e,t){let n=di.get(e);n||(n=new Map,di.set(e,n));let r=n.get(t);if(!r){const s=Ao(e)?Ft(this,bn,ed).call(this,e,n,t):Ft(this,bn,td).call(this,e,n,t);if(!s)return()=>{};r=s,n.set(t,r)}r.refCount++;let i=!1;return()=>{i||(i=!0,r.refCount--,r.refCount===0&&r.cleanup())}};ed=function(e,t,n){var r;const i=e.createElement("style"),{nonce:s}=(r=this.options)!=null?r:{};s&&i.setAttribute("nonce",s),i.textContent=n,e.head.prepend(i);const o=new MutationObserver(a=>{for(const l of a)for(const c of Array.from(l.removedNodes))if(c===i){e.head.prepend(i);return}});return o.observe(e.head,{childList:!0}),{refCount:0,cleanup:()=>{o.disconnect(),i.remove(),t.delete(n),t.size===0&&di.delete(e)}}};td=function(e,t,n){"adoptedStyleSheets"in e&&Array.isArray(e.adoptedStyleSheets);const r=e.ownerDocument.defaultView,{CSSStyleSheet:i}=r??{};if(!i)return null;const s=new i;return s.replaceSync(n),e.adoptedStyleSheets.push(s),{refCount:0,cleanup:()=>{var o;if(Do(e)&&(o=e.host)!=null&&o.isConnected){const a=e.adoptedStyleSheets.indexOf(s);a!==-1&&e.adoptedStyleSheets.splice(a,1)}t.delete(n),t.size===0&&di.delete(e)}}};Ue(ft,4,"additionalRoots",Zc,Ot,Fo);Ue(ft,2,"sourceRoot",Kc,Ot);Ue(ft,2,"targetRoot",Bc,Ot);Ue(ft,2,"roots",Gc,Ot);Yt(ft,Ot);Ot.configure=br(Ot);var Ci=Ot,Sf=class extends Se{constructor(e,t){super(e,t),this.manager=e;const{cursor:n="grabbing"}=t??{},r=e.registry.plugins.get(Ci),i=r?.register(`* { cursor: ${n} !important; }`);if(i){const s=this.destroy.bind(this);this.destroy=()=>{i(),s()}}}},wr="data-dnd-",Ts=`${wr}dropping`,me="--dnd-",tt=`${wr}dragging`,ui=`${wr}placeholder`,jf=[tt,ui,"popover","aria-pressed","aria-grabbing"],$f=["view-transition-name"],Of=`
|
|
10
|
+
:is(:root,:host) [${tt}] {
|
|
11
|
+
position: fixed !important;
|
|
12
|
+
pointer-events: none !important;
|
|
13
|
+
touch-action: none;
|
|
14
|
+
z-index: calc(infinity);
|
|
15
|
+
will-change: translate;
|
|
16
|
+
top: var(${me}top, 0px) !important;
|
|
17
|
+
left: var(${me}left, 0px) !important;
|
|
18
|
+
right: unset !important;
|
|
19
|
+
bottom: unset !important;
|
|
20
|
+
width: var(${me}width, auto);
|
|
21
|
+
max-width: var(${me}width, auto);
|
|
22
|
+
height: var(${me}height, auto);
|
|
23
|
+
max-height: var(${me}height, auto);
|
|
24
|
+
transform: var(${me}transform, none) !important;
|
|
25
|
+
transition: var(${me}transition) !important;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:is(:root,:host) [${ui}] {
|
|
29
|
+
transition: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:is(:root,:host) [${ui}='hidden'] {
|
|
33
|
+
visibility: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[${tt}] * {
|
|
37
|
+
pointer-events: none !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[${tt}]:not([${Ts}]) {
|
|
41
|
+
translate: var(${me}translate) !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[${tt}][style*='${me}scale'] {
|
|
45
|
+
scale: var(${me}scale) !important;
|
|
46
|
+
transform-origin: var(${me}transform-origin) !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@layer dnd-kit {
|
|
50
|
+
:where([${tt}][popover]) {
|
|
51
|
+
overflow: visible;
|
|
52
|
+
background: unset;
|
|
53
|
+
border: unset;
|
|
54
|
+
margin: unset;
|
|
55
|
+
padding: unset;
|
|
56
|
+
color: inherit;
|
|
57
|
+
|
|
58
|
+
&:is(input, button) {
|
|
59
|
+
border: revert;
|
|
60
|
+
background: revert;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
[${tt}]::backdrop, [${wr}overlay]:not([${tt}]) {
|
|
65
|
+
display: none;
|
|
66
|
+
visibility: hidden;
|
|
67
|
+
}
|
|
68
|
+
`.replace(/\n+/g," ").replace(/\s+/g," ").trim();function Cf(e,t="hidden"){return N(()=>{const{element:n,manager:r}=e;if(!n||!r)return;const i=Mf(n,r.registry.droppables),s=[],o=wh(n),{remove:a}=o;return Ef(i,o,s),Af(o,t),o.remove=()=>{s.forEach(l=>l()),a.call(o)},o})}function Mf(e,t){const n=new Map;for(const r of t)if(r.element&&(e===r.element||e.contains(r.element))){const i=`${wr}${Ms("dom-id")}`;r.element.setAttribute(i,""),n.set(r,i)}return n}function Ef(e,t,n){for(const[r,i]of e){if(!r.element)continue;const s=`[${i}]`,o=t.matches(s)?t:t.querySelector(s);if(r.element.removeAttribute(i),!o)continue;const a=r.element;r.proxy=o,o.removeAttribute(i),js.set(a,o),n.push(()=>{js.delete(a),r.proxy=void 0})}}function Af(e,t="hidden"){e.setAttribute("inert","true"),e.setAttribute("tab-index","-1"),e.setAttribute("aria-hidden","true"),e.setAttribute(ui,t)}function nd(e,t){return e===t?!0:mn(e)===mn(t)}function Ca(e){const{target:t}=e;"newState"in e&&e.newState==="closed"&&Lt(t)&&t.hasAttribute("popover")&&requestAnimationFrame(()=>un(t))}function Ds(e){return e.tagName==="TR"}function Tf(e,t,n){const r=new MutationObserver(i=>{let s=!1;for(const o of i){if(o.target!==e){s=!0;continue}if(o.type!=="attributes")continue;const a=o.attributeName;if(a.startsWith("aria-")||jf.includes(a))continue;const l=e.getAttribute(a);if(a==="style"){if(ir(e)&&ir(t)){const c=e.style;for(const u of Array.from(t.style))c.getPropertyValue(u)===""&&t.style.removeProperty(u);for(const u of Array.from(c)){if($f.includes(u)||u.startsWith(me))continue;const d=c.getPropertyValue(u);t.style.setProperty(u,d)}}}else l!==null?t.setAttribute(a,l):t.removeAttribute(a)}s&&n&&t.replaceChildren(...e.cloneNode(!0).childNodes)});return r.observe(e,{attributes:!0,subtree:!0,childList:!0}),r}function Df(e,t,n){const r=new MutationObserver(i=>{for(const s of i)if(s.addedNodes.length!==0)for(const o of Array.from(s.addedNodes)){if(o.contains(e)&&e.nextElementSibling!==t){e.insertAdjacentElement("afterend",t),un(n);return}if(o.contains(t)&&t.previousElementSibling!==e){t.insertAdjacentElement("beforebegin",e),un(n);return}}e.isConnected&&t.isConnected&&e.nextElementSibling!==t&&(e.insertAdjacentElement("afterend",t),un(n))});return r.observe(e.ownerDocument.body,{childList:!0,subtree:!0}),r}function Pf(e){return new ResizeObserver(()=>{var t,n,r;const i=new nt(e.placeholder,{frameTransform:e.frameTransform,ignoreTransforms:!0}),s=(t=e.transformOrigin)!=null?t:{x:1,y:1},o=(e.width-i.width)*s.x+e.delta.x,a=(e.height-i.height)*s.y+e.delta.y,l=Tc();if(e.styles.set({width:i.width-e.widthOffset,height:i.height-e.heightOffset,top:e.top+a+l.y,left:e.left+o+l.x},me),(n=e.getElementMutationObserver())==null||n.takeRecords(),Ds(e.element)&&Ds(e.placeholder)){const b=Array.from(e.element.cells),w=Array.from(e.placeholder.cells);e.getSavedCellWidths()||e.setSavedCellWidths(b.map(m=>m.style.width));for(const[m,p]of b.entries()){const x=w[m];p.style.width=`${x.getBoundingClientRect().width}px`}}const c=(r=e.getTranslate())!=null?r:{x:0,y:0},u=e.left+o+l.x+c.x,d=e.top+a+l.y+c.y,h=i.width-e.widthOffset,f=i.height-e.heightOffset,g=e.frameTransform;e.dragOperation.shape=new rt(u*g.scaleX+g.x,d*g.scaleY+g.y,h*g.scaleX,f*g.scaleY)})}var Rf=250,zf="ease";function Wf(e){var t,n,r,i;const{animation:s}=e;if(typeof s=="function"){const p=s({source:e.source,element:e.element,feedbackElement:e.feedbackElement,placeholder:e.placeholder,translate:e.translate,moved:e.moved});Promise.resolve(p).then(()=>{e.cleanup(),requestAnimationFrame(e.restoreFocus)});return}const{duration:o=Rf,easing:a=zf}=s??{};un(e.feedbackElement);const[,l]=(t=Mc(e.feedbackElement,p=>"translate"in p))!=null?t:[];l?.pause();const c=(n=e.placeholder)!=null?n:e.element,u={frameTransform:nd(e.feedbackElement,c)?null:void 0},d=new nt(e.feedbackElement,u),h=(r=dr(ot(e.feedbackElement).translate))!=null?r:e.translate,f=new nt(c,u),g=rt.delta(d,f,e.alignment),b={x:h.x-g.x,y:h.y-g.y},w=Math.round(d.intrinsicHeight)!==Math.round(f.intrinsicHeight)?{minHeight:[`${d.intrinsicHeight}px`,`${f.intrinsicHeight}px`],maxHeight:[`${d.intrinsicHeight}px`,`${f.intrinsicHeight}px`]}:{},m=Math.round(d.intrinsicWidth)!==Math.round(f.intrinsicWidth)?{minWidth:[`${d.intrinsicWidth}px`,`${f.intrinsicWidth}px`],maxWidth:[`${d.intrinsicWidth}px`,`${f.intrinsicWidth}px`]}:{};e.styles.set({transition:e.transition},me),e.feedbackElement.setAttribute(Ts,""),(i=e.getElementMutationObserver())==null||i.takeRecords(),_c({element:e.feedbackElement,keyframes:Io(hr(hr({},w),m),{translate:[`${h.x}px ${h.y}px 0`,`${b.x}px ${b.y}px 0`]}),options:{duration:Po(Fe(e.feedbackElement))?0:e.moved||e.feedbackElement!==e.element?o:0,easing:a}}).then(()=>{e.feedbackElement.removeAttribute(Ts),l?.finish(),e.cleanup(),requestAnimationFrame(e.restoreFocus)})}var rd,Ps,fr,No,Br,id,sd,yn=class extends(Ps=Se,rd=[_],Ps){constructor(e,t){super(e,t),de(this,Br),de(this,No,he(fr,8,this)),he(fr,11,this),this.state={initial:{},current:{}};const n=e.registry.plugins.get(Ci),r=n?.register(Of);if(r){const i=this.destroy.bind(this);this.destroy=()=>{r(),i()}}this.registerEffect(Ft(this,Br,id).bind(this,n)),this.registerEffect(Ft(this,Br,sd))}};fr=Tn(Ps);No=new WeakMap;Br=new WeakSet;id=function(e){const{overlay:t}=this;if(!t||!e)return;const n=ii(t);if(n)return e.addRoot(n)};sd=function(){var e,t,n,r,i,s,o;const{state:a,manager:l,options:c}=this,{dragOperation:u}=l,{position:d,source:h,status:f}=u;if(f.idle){a.current={},a.initial={};return}if(!h)return;const{element:g}=h,b=h.pluginConfig(yn),w=(t=(e=b?.feedback)!=null?e:c?.feedback)!=null?t:"default",m=typeof w=="function"?w(h,l):w;if(!g||m==="none"||!f.initialized||f.initializing)return;const{initial:p}=a,x=(n=this.overlay)!=null?n:g,y=vn(x),k=vn(g),M=!nd(g,x),j=new nt(g,{frameTransform:M?k:null,ignoreTransforms:!M}),T={x:k.scaleX/y.scaleX,y:k.scaleY/y.scaleY};let{width:D,height:A,top:O,left:P}=j;M&&(D=D/T.x,A=A/T.y);const R=new ef(x),Y=ot(g),{transition:Ae,translate:Te,boxSizing:be,paddingBlockStart:X,paddingBlockEnd:Je,paddingInlineStart:Qe,paddingInlineEnd:ye,borderInlineStartWidth:Pe,borderInlineEndWidth:G,borderBlockStartWidth:U,borderBlockEndWidth:ee}=Y,xe=Ae.split(",").filter(Z=>!/^\s*(transform|translate|scale)\b/.test(Z)).join(","),Re=Oi(Y),I=Y.transform,H=m==="clone",je=be==="content-box",te=je?parseInt(Qe)+parseInt(ye)+parseInt(Pe)+parseInt(G):0,Xe=je?parseInt(X)+parseInt(Je)+parseInt(U)+parseInt(ee):0,ne=m!=="move"&&!this.overlay?Cf(h,H?"clone":"hidden"):null,mt=N(()=>ur(l.dragOperation.activatorEvent));if(!p.translate){if(this.overlay&&Re)p.translate={x:Re.x,y:Re.y};else if(Te!=="none"){const Z=dr(Te);Z&&(p.translate=Z)}}if(!p.transformOrigin){const Z=N(()=>d.current),fe=P+((r=Re?.x)!=null?r:0),We=O+((i=Re?.y)!=null?i:0);p.transformOrigin={x:(Z.x-fe*y.scaleX-y.x)/(D*y.scaleX),y:(Z.y-We*y.scaleY-y.y)/(A*y.scaleY)}}const{transformOrigin:et}=p,Ut=O*y.scaleY+y.y,E=P*y.scaleX+y.x;if(!p.coordinates&&(p.coordinates={x:E,y:Ut},T.x!==1||T.y!==1)){const{scaleX:Z,scaleY:fe}=k,{x:We,y:vt}=et;p.coordinates.x+=(D*Z-D)*We,p.coordinates.y+=(A*fe-A)*vt}p.dimensions||(p.dimensions={width:D,height:A}),p.frameTransform||(p.frameTransform=y);const W={x:p.coordinates.x-E,y:p.coordinates.y-Ut},$={width:(p.dimensions.width*p.frameTransform.scaleX-D*y.scaleX)*et.x,height:(p.dimensions.height*p.frameTransform.scaleY-A*y.scaleY)*et.y},C={x:W.x/y.scaleX+$.width,y:W.y/y.scaleY+$.height},z={left:P+C.x,top:O+C.y};x.setAttribute(tt,"true");const K=N(()=>u.transform),at=(s=p.translate)!=null?s:{x:0,y:0},$e=K.x*y.scaleX+at.x,ze=K.y*y.scaleY+at.y,lt=Tc();R.set({width:D-te,height:A-Xe,top:z.top+lt.y,left:z.left+lt.x,translate:`${$e}px ${ze}px 0`,transform:this.overlay?"none":I,transition:xe?`${xe}, translate 0ms linear`:"translate 0ms linear",scale:M?`${T.x} ${T.y}`:"","transform-origin":`${et.x*100}% ${et.y*100}%`},me),ne&&(g.insertAdjacentElement("afterend",ne),c?.rootElement&&(typeof c.rootElement=="function"?c.rootElement(h):c.rootElement).appendChild(g)),Os(x)&&(x.hasAttribute("popover")||x.setAttribute("popover","manual"),un(x),x.addEventListener("beforetoggle",Ca));let Pn,Qo,$r;const ea=Pf({placeholder:ne,element:g,feedbackElement:x,frameTransform:y,transformOrigin:et,width:D,height:A,top:O,left:P,widthOffset:te,heightOffset:Xe,delta:C,styles:R,dragOperation:u,getTranslate:()=>a.current.translate,getElementMutationObserver:()=>Pn,getSavedCellWidths:()=>$r,setSavedCellWidths:Z=>{$r=Z}}),ta=new nt(x);N(()=>u.shape=ta);const Di=Fe(x),na=Z=>{this.manager.actions.stop({event:Z})},Jd=Po(Di);mt&&Di.addEventListener("resize",na),N(()=>h.status)==="idle"&&requestAnimationFrame(()=>h.status="dragging"),ne&&(ea.observe(ne),Pn=Tf(g,ne,H),Qo=Df(g,ne,x));const ra=(o=l.dragOperation.source)==null?void 0:o.id,Qd=()=>{var Z;if(!mt||ra==null)return;const fe=l.registry.draggables.get(ra),We=(Z=fe?.handle)!=null?Z:fe?.element;$t(We)&&We.focus()},Pi=()=>{Pn?.disconnect(),Qo?.disconnect(),ea.disconnect(),Di.removeEventListener("resize",na),Os(x)&&(x.removeEventListener("beforetoggle",Ca),x.removeAttribute("popover")),x.removeAttribute(tt),R.reset();const Z=()=>{var fe;if($r&&Ds(g)){const Ri=Array.from(g.cells);for(const[Or,Xt]of Ri.entries())Xt.style.width=(fe=$r[Or])!=null?fe:""}h.status="idle";const We=a.current.translate!=null,vt=u.status.dragging;ne&&(!vt&&We||ne.parentElement!==x.parentElement)&&x.isConnected&&ne.replaceWith(x),ne?.remove()};x===this.overlay?setTimeout(Z,0):Z()},eu=c?.dropAnimation,ia=this,tu=mr(()=>{var Z,fe,We;const{transform:vt,status:Ri}=u;if(!(!vt.x&&!vt.y&&!a.current.translate)&&Ri.dragging){const Or=(Z=p.translate)!=null?Z:{x:0,y:0},Xt={x:vt.x/y.scaleX+Or.x,y:vt.y/y.scaleY+Or.y},sa=a.current.translate,nu=N(()=>u.modifiers),zi=N(()=>{var Rn;return(Rn=u.shape)==null?void 0:Rn.current}),Wi=c?.keyboardTransition,oa=mt&&!Jd&&Wi!==null?`${(fe=Wi?.duration)!=null?fe:250}ms ${(We=Wi?.easing)!=null?We:"cubic-bezier(0.25, 1, 0.5, 1)"}`:"0ms linear";if(R.set({transition:xe?`${xe}, translate ${oa}`:`translate ${oa}`,translate:`${Xt.x}px ${Xt.y}px 0`},me),Pn?.takeRecords(),zi&&zi!==ta&&sa&&!nu.length){const Rn=_e.delta(Xt,sa);u.shape=rt.from(zi.boundingRectangle).translate(Rn.x*y.scaleX,Rn.y*y.scaleY)}else u.shape=new nt(x);a.current.translate=Xt}},function(){if(u.status.dropped){this.dispose(),h.status="dropping";const Z=b?.dropAnimation!==void 0?b.dropAnimation:ia.dropAnimation!==void 0?ia.dropAnimation:eu;let fe=a.current.translate;const We=fe!=null;if(!fe&&g!==x&&(fe={x:0,y:0}),!fe||Z===null){Pi();return}l.renderer.rendering.then(()=>{Wf({source:h,element:g,feedbackElement:x,placeholder:ne,translate:fe,moved:We,transition:Ae,alignment:h.alignment,styles:R,animation:Z??void 0,getElementMutationObserver:()=>Pn,cleanup:Pi,restoreFocus:Qd})})}});return()=>{Pi(),tu()}};Ue(fr,4,"overlay",rd,yn,No);Yt(fr,yn);yn.configure=br(yn);var _o=yn,zn=!0,If=!1,od,ad,ld,cd,wt,qo,Ho;cd=(ld=[_],qe.Forward),ad=(od=[_],qe.Reverse);var pr=class{constructor(){de(this,qo,he(wt,8,this,zn)),he(wt,11,this),de(this,Ho,he(wt,12,this,zn)),he(wt,15,this)}isLocked(e){return e===qe.Idle?!1:e==null?this[qe.Forward]===zn&&this[qe.Reverse]===zn:this[e]===zn}unlock(e){e!==qe.Idle&&(this[e]=If)}};wt=Tn(null);qo=new WeakMap;Ho=new WeakMap;Ue(wt,4,cd,ld,pr,qo);Ue(wt,4,ad,od,pr,Ho);Yt(wt,pr);var Lf=[qe.Forward,qe.Reverse],Ma=class{constructor(){this.x=new pr,this.y=new pr}isLocked(){return this.x.isLocked()&&this.y.isLocked()}},Ff=class extends Se{constructor(e){super(e);const t=wn(new Ma);let n=null;this.signal=t,Ye(()=>{const{status:r}=e.dragOperation;if(!r.initialized){n=null,t.value=new Ma;return}const{delta:i}=e.dragOperation.position;if(n){const s={x:Ea(i.x,n.x),y:Ea(i.y,n.y)},o=t.peek();se(()=>{for(const a of Ll)for(const l of Lf)s[a]===l&&o[a].unlock(l);t.value=o})}n=i})}get current(){return this.signal.peek()}};function Ea(e,t){return Math.sign(e-t)}var dd,Rs,gr,Vo,yt,zs,kr=class extends(Rs=yr,dd=[_],Rs){constructor(e){super(e),de(this,Vo,he(gr,8,this,!1)),he(gr,11,this),de(this,yt),de(this,zs,()=>{if(!B(this,yt))return;const{element:s,by:o}=B(this,yt);o.y&&(s.scrollTop+=o.y),o.x&&(s.scrollLeft+=o.x)}),this.scroll=(s,o)=>{var a;if(this.disabled)return!1;const l=this.getScrollableElements();if(!l)return Me(this,yt,void 0),!1;const{position:c}=this.manager.dragOperation,u=c?.current;if(u){const{by:d}=s??{},h=d?{x:Aa(d.x),y:Aa(d.y)}:void 0,f=h?void 0:this.scrollIntentTracker.current;if(f?.isLocked())return!1;for(const g of l){const b=Rh(g,d);if(b.x||b.y){const{speed:w,direction:m}=Yh(g,u,h,o?.acceleration,o?.threshold);if(f)for(const p of Ll)f[p].isLocked(m[p])&&(w[p]=0,m[p]=0);if(m.x||m.y){const{x:p,y:x}=d??m,y=p*w.x,k=x*w.y;if(y||k){const M=(a=B(this,yt))==null?void 0:a.by;if(this.autoScrolling&&M&&(M.x&&!y||M.y&&!k))continue;return Me(this,yt,{element:g,by:{x:y,y:k}}),ai.schedule(B(this,zs)),!0}}}}}return Me(this,yt,void 0),!1};let t=null,n=null;const r=ds(()=>{const{position:s,source:o}=e.dragOperation;if(!s)return null;const a=Dc(ii(o?.element),s.current);return a&&(t=a),a??t}),i=ds(()=>{const s=r.value,{documentElement:o}=En(s);if(!s||s===o){const{target:a}=e.dragOperation,l=a?.element;if(l){const c=Cs(l,{excludeElement:!1});return n=c,c}}if(s){const a=Cs(s,{excludeElement:!1});return this.autoScrolling&&n&&a.size<n?.size?n:(n=a,a)}return n=null,null},Ge);this.getScrollableElements=()=>i.value,this.scrollIntentTracker=new Ff(e),this.destroy=e.monitor.addEventListener("dragmove",s=>{this.disabled||s.defaultPrevented||!ur(e.dragOperation.activatorEvent)||!s.by||this.scroll({by:s.by})&&s.preventDefault()})}};gr=Tn(Rs);Vo=new WeakMap;yt=new WeakMap;zs=new WeakMap;Ue(gr,4,"autoScrolling",dd,kr,Vo);Yt(gr,kr);function Aa(e){return e>0?qe.Forward:e<0?qe.Reverse:qe.Idle}var Nf=class{constructor(e){this.scheduler=e,this.pending=!1,this.tasks=new Set,this.resolvers=new Set,this.flush=()=>{const{tasks:t,resolvers:n}=this;this.pending=!1,this.tasks=new Set,this.resolvers=new Set;for(const r of t)r();for(const r of n)r()}}schedule(e){return this.tasks.add(e),this.pending||(this.pending=!0,this.scheduler(this.flush)),new Promise(t=>this.resolvers.add(t))}},_f=new Nf(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(e):e()}),qf=10,Ws=class extends Se{constructor(e,t){super(e,t);const n=e.registry.plugins.get(kr);if(!n)throw new Error("AutoScroller plugin depends on Scroller plugin");this.destroy=Ye(()=>{var r,i,s;if(this.disabled)return;const{position:o,status:a}=e.dragOperation;if(a.dragging){const l={acceleration:(r=this.options)==null?void 0:r.acceleration,threshold:typeof((i=this.options)==null?void 0:i.threshold)=="number"?{x:this.options.threshold,y:this.options.threshold}:(s=this.options)==null?void 0:s.threshold};if(n.scroll(void 0,l)){n.autoScrolling=!0;const c=setInterval(()=>_f.schedule(()=>n.scroll(void 0,l)),qf);return()=>{clearInterval(c)}}else n.autoScrolling=!1}})}};Ws.configure=br(Ws);var ud=Ws,Ta={capture:!0,passive:!0},Xn,Hf=class extends yr{constructor(e){super(e),de(this,Xn),this.handleScroll=()=>{B(this,Xn)==null&&Me(this,Xn,setTimeout(()=>{this.manager.collisionObserver.forceUpdate(!1),Me(this,Xn,void 0)},50))};const{dragOperation:t}=this.manager;this.destroy=Ye(()=>{var n,r,i;if(t.status.dragging){const s=(i=(r=(n=t.source)==null?void 0:n.element)==null?void 0:r.ownerDocument)!=null?i:document;return s.addEventListener("scroll",this.handleScroll,Ta),()=>{s.removeEventListener("scroll",this.handleScroll,Ta)}}})}};Xn=new WeakMap;var Vf="* { user-select: none !important; -webkit-user-select: none !important; }",Yf=class extends Se{constructor(e){super(e),this.manager=e;const t=e.registry.plugins.get(Ci),n=t?.register(Vf);if(this.destroy=Ye(()=>{const{dragOperation:r}=this.manager;if(r.status.initialized)return Vi(),document.addEventListener("selectionchange",Vi,{capture:!0}),()=>{document.removeEventListener("selectionchange",Vi,{capture:!0})}}),n){const r=this.destroy.bind(this);this.destroy=()=>{n(),r()}}}};function Vi(){var e;(e=document.getSelection())==null||e.removeAllRanges()}var Gn=Object.freeze({offset:10,keyboardCodes:{start:["Space","Enter"],cancel:["Escape"],end:["Space","Enter","Tab"],up:["ArrowUp"],down:["ArrowDown"],left:["ArrowLeft"],right:["ArrowRight"]},preventActivation(e,t){var n;const r=(n=t.handle)!=null?n:t.element;return e.target!==r}}),rn,hi=class extends pn{constructor(e,t){super(e),this.manager=e,this.options=t,de(this,rn,[]),this.listeners=new Pc,this.handleSourceKeyDown=(n,r,i)=>{if(this.disabled||n.defaultPrevented||!Lt(n.target)||r.disabled)return;const{keyboardCodes:s=Gn.keyboardCodes,preventActivation:o=Gn.preventActivation}=i??{};s.start.includes(n.code)&&this.manager.dragOperation.status.idle&&(o?.(n,r)||this.handleStart(n,r,i))}}bind(e,t=this.options){return Ye(()=>{var n;const r=(n=e.handle)!=null?n:e.element,i=s=>{ur(s)&&this.handleSourceKeyDown(s,e,t)};if(r)return r.addEventListener("keydown",i),()=>{r.removeEventListener("keydown",i)}})}handleStart(e,t,n){const{element:r}=t;if(!r)throw new Error("Source draggable does not have an associated element");e.preventDefault(),e.stopImmediatePropagation(),Nc(r);const{center:i}=new nt(r);if(this.manager.actions.start({event:e,coordinates:{x:i.x,y:i.y},source:t}).signal.aborted)return this.cleanup();this.sideEffects();const s=En(r),o=[this.listeners.bind(s,[{type:"keydown",listener:a=>this.handleKeyDown(a,t,n),options:{capture:!0}}])];B(this,rn).push(...o)}handleKeyDown(e,t,n){const{keyboardCodes:r=Gn.keyboardCodes}=n??{};if(Gt(e,[...r.end,...r.cancel])){e.preventDefault();const i=Gt(e,r.cancel);this.handleEnd(e,i);return}Gt(e,r.up)?this.handleMove("up",e):Gt(e,r.down)&&this.handleMove("down",e),Gt(e,r.left)?this.handleMove("left",e):Gt(e,r.right)&&this.handleMove("right",e)}handleEnd(e,t){this.manager.actions.stop({event:e,canceled:t}),this.cleanup()}handleMove(e,t){var n,r;const{shape:i}=this.manager.dragOperation,s=t.shiftKey?5:1;let o={x:0,y:0},a=(r=(n=this.options)==null?void 0:n.offset)!=null?r:Gn.offset;if(typeof a=="number"&&(a={x:a,y:a}),!!i){switch(e){case"up":o={x:0,y:-a.y*s};break;case"down":o={x:0,y:a.y*s};break;case"left":o={x:-a.x*s,y:0};break;case"right":o={x:a.x*s,y:0};break}(o.x||o.y)&&(t.preventDefault(),this.manager.actions.move({event:t,by:o}))}}sideEffects(){const e=this.manager.registry.plugins.get(ud);e?.disabled===!1&&(e.disable(),B(this,rn).push(()=>{e.enable()}))}cleanup(){B(this,rn).forEach(e=>e()),Me(this,rn,[])}destroy(){this.cleanup(),this.listeners.clear()}};rn=new WeakMap;hi.configure=br(hi);hi.defaults=Gn;var hd=hi;function Gt(e,t){return t.includes(e.code)}var Pt,Uf=class extends mc{constructor(){super(...arguments),de(this,Pt)}onEvent(e){switch(e.type){case"pointerdown":Me(this,Pt,gn(e));break;case"pointermove":if(!B(this,Pt))return;const{x:t,y:n}=gn(e),r={x:t-B(this,Pt).x,y:n-B(this,Pt).y},{tolerance:i}=this.options;if(i&&ys(r,i)){this.abort();return}ys(r,this.options.value)&&this.activate(e);break;case"pointerup":this.abort();break}}abort(){Me(this,Pt,void 0)}};Pt=new WeakMap;var sn,Rt,Xf=class extends mc{constructor(){super(...arguments),de(this,sn),de(this,Rt)}onEvent(e){switch(e.type){case"pointerdown":Me(this,Rt,gn(e)),Me(this,sn,setTimeout(()=>this.activate(e),this.options.value));break;case"pointermove":if(!B(this,Rt))return;const{x:t,y:n}=gn(e),r={x:t-B(this,Rt).x,y:n-B(this,Rt).y};ys(r,this.options.tolerance)&&this.abort();break;case"pointerup":this.abort();break}}abort(){B(this,sn)&&(clearTimeout(B(this,sn)),Me(this,Rt,void 0),Me(this,sn,void 0))}};sn=new WeakMap;Rt=new WeakMap;var cn=class{};cn.Delay=Xf;cn.Distance=Uf;var Is=Object.freeze({activationConstraints(e,t){var n;const{pointerType:r,target:i}=e;if(!(r==="mouse"&&Lt(i)&&(t.handle===i||(n=t.handle)!=null&&n.contains(i))))return r==="touch"?[new cn.Delay({value:250,tolerance:5})]:nf(i)&&!e.defaultPrevented?[new cn.Delay({value:200,tolerance:0})]:[new cn.Delay({value:200,tolerance:10}),new cn.Distance({value:5})]},preventActivation(e,t){var n;const{target:r}=e;if(r===t.element||r===t.handle||!Lt(r)||(n=t.handle)!=null&&n.contains(r))return!1;const i=Sh(r);return i===t.element?!1:!!i}}),on,fi=class extends pn{constructor(e,t){super(e),this.manager=e,this.options=t,de(this,on,new Set),this.listeners=new Pc,this.latest={event:void 0,coordinates:void 0},this.handleMove=()=>{const{event:n,coordinates:r}=this.latest;!n||!r||this.manager.actions.move({event:n,to:r})},this.handleCancel=this.handleCancel.bind(this),this.handlePointerUp=this.handlePointerUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}activationConstraints(e,t,n=this.options){const{activationConstraints:r=Is.activationConstraints}=n??{};return typeof r=="function"?r(e,t):r}bind(e,t=this.options){return Ye(()=>{var n;const r=new AbortController,{signal:i}=r,s=a=>{tf(a)&&this.handlePointerDown(a,e,t)};let o=[(n=e.handle)!=null?n:e.element];t?.activatorElements&&(Array.isArray(t.activatorElements)?o=t.activatorElements:o=t.activatorElements(e));for(const a of o)a&&(Kf(a.ownerDocument.defaultView),a.addEventListener("pointerdown",s,{signal:i}));return()=>r.abort()})}handlePointerDown(e,t,n){if(this.disabled||!e.isPrimary||e.button!==0||!Lt(e.target)||t.disabled||Gf(e)||!this.manager.dragOperation.status.idle)return;const{preventActivation:r=Is.preventActivation}=n??{};if(r?.(e,t))return;const{target:i}=e,s=$t(i)&&i.draggable&&i.getAttribute("draggable")==="true",o=vn(t.element),{x:a,y:l}=gn(e);this.initialCoordinates={x:a*o.scaleX+o.x,y:l*o.scaleY+o.y};const c=this.activationConstraints(e,t,n);e.sensor=this;const u=new ph(c,g=>this.handleStart(t,g));u.signal.onabort=()=>this.handleCancel(e),u.onEvent(e),this.controller=u;const d=Ss(),h=this.listeners.bind(d,[{type:"pointermove",listener:g=>this.handlePointerMove(g,t)},{type:"pointerup",listener:this.handlePointerUp,options:{capture:!0}},{type:"pointercancel",listener:this.handleCancel},{type:"dragstart",listener:s?this.handleCancel:Ar,options:{capture:!0}}]),f=()=>{h(),this.initialCoordinates=void 0};B(this,on).add(f)}handlePointerMove(e,t){var n,r;if(((n=this.controller)==null?void 0:n.activated)===!1){(r=this.controller)==null||r.onEvent(e);return}if(this.manager.dragOperation.status.dragging){const i=gn(e),s=vn(t.element);i.x=i.x*s.scaleX+s.x,i.y=i.y*s.scaleY+s.y,e.preventDefault(),e.stopPropagation(),this.latest.event=e,this.latest.coordinates=i,ai.schedule(this.handleMove)}}handlePointerUp(e){const{status:t}=this.manager.dragOperation;if(!t.idle){e.preventDefault(),e.stopPropagation();const n=!t.initialized;this.manager.actions.stop({event:e,canceled:n})}this.cleanup()}handleKeyDown(e){e.key==="Escape"&&(e.preventDefault(),this.handleCancel(e))}handleStart(e,t){const{manager:n,initialCoordinates:r}=this;if(!r||!n.dragOperation.status.idle||t.defaultPrevented)return;if(n.actions.start({coordinates:r,event:t,source:e}).signal.aborted)return this.cleanup();t.preventDefault();const i=En(t.target).body;try{i.setPointerCapture(t.pointerId)}catch{this.handleCancel(t);return}const s=Lt(t.target)?[t.target,i]:i,o=this.listeners.bind(s,[{type:"touchmove",listener:Ar,options:{passive:!1}},{type:"click",listener:Ar},{type:"contextmenu",listener:Ar},{type:"keydown",listener:this.handleKeyDown}]);B(this,on).add(o)}handleCancel(e){const{dragOperation:t}=this.manager;t.status.initialized&&this.manager.actions.stop({event:e,canceled:!0}),this.cleanup()}cleanup(){const{controller:e}=this;this.controller=void 0,e&&!e.signal.aborted&&e.abort(),this.latest={event:void 0,coordinates:void 0},B(this,on).forEach(t=>t()),B(this,on).clear()}destroy(){this.cleanup(),this.listeners.clear()}};on=new WeakMap;fi.configure=br(fi);fi.defaults=Is;var Ls=fi;function Gf(e){return"sensor"in e}function Ar(e){e.preventDefault()}function Bf(){}var Da=new WeakSet;function Kf(e){!e||Da.has(e)||(e.addEventListener("touchmove",Bf,{capture:!1,passive:!1}),Da.add(e))}var hn={modifiers:[],plugins:[wf,ud,Sf,_o,Yf],sensors:[Ls,hd]},fd=class extends vh{constructor(e={}){const t=Ke(e.plugins,hn.plugins),n=Ke(e.sensors,hn.sensors),r=Ke(e.modifiers,hn.modifiers);super(Io(hr({},e),{plugins:[Hf,kr,Ci,...t],sensors:n,modifiers:r}))}},pd,gd,Fs,kt,Yo,Uo,Mi=class extends(Fs=it,gd=[_],pd=[_],Fs){constructor(e,t){var n=e,{element:r,effects:i=()=>[],handle:s}=n,o=Uc(n,["element","effects","handle"]);super(hr({effects:()=>[...i(),()=>{var a,l;const{manager:c}=this;if(!c)return;const u=((l=(a=this.sensors)==null?void 0:a.map(ar))!=null?l:[...c.sensors]).map(d=>{const h=d instanceof pn?d:c.registry.register(d.plugin),f=d instanceof pn?void 0:d.options;return h.bind(this,f)});return function(){u.forEach(d=>d())}}]},o),t),de(this,Yo,he(kt,8,this)),he(kt,11,this),de(this,Uo,he(kt,12,this)),he(kt,15,this),this.element=r,this.handle=s}};kt=Tn(Fs);Yo=new WeakMap;Uo=new WeakMap;Ue(kt,4,"handle",gd,Mi,Yo);Ue(kt,4,"element",pd,Mi,Uo);Yt(kt,Mi);var md,vd,Ns,St,Xo,Yi,bd,yd,or,Go,Ei=class extends(Ns=st,vd=[_],md=[_],Ns){constructor(e,t){var n=e,{element:r,effects:i=()=>[]}=n,s=Uc(n,["element","effects"]);const{collisionDetector:o=qc}=s,a=c=>{const{manager:u,element:d}=this;if(!d||c===null){this.shape=void 0;return}if(!u)return;const h=new nt(d),f=N(()=>this.shape);return h&&f?.equals(h)?f:(this.shape=h,h)},l=wn(!1);super(Io(hr({},s),{collisionDetector:o,effects:()=>[...i(),()=>{const{element:c,manager:u}=this;if(!u)return;const{dragOperation:d}=u,{source:h}=d;l.value=!!(h&&d.status.initialized&&c&&!this.disabled&&this.accepts(h))},()=>{const{element:c}=this;if(l.value&&c){const u=new Ph(c,a);return()=>{u.disconnect(),this.shape=void 0}}},()=>{var c;if((c=this.manager)!=null&&c.dragOperation.status.initialized)return()=>{this.shape=void 0}}]}),t),de(this,or),de(this,Xo,he(St,8,this)),he(St,11,this),de(this,Go,he(St,12,this)),he(St,15,this),this.element=r,this.refreshShape=()=>a()}set element(e){Me(this,or,e,yd)}get element(){var e;return(e=this.proxy)!=null?e:B(this,or,bd)}};St=Tn(Ns);Xo=new WeakMap;or=new WeakSet;Go=new WeakMap;Yi=Ue(St,20,"#element",vd,or,Xo),bd=Yi.get,yd=Yi.set;Ue(St,4,"proxy",md,Ei,Go);Yt(St,Ei);function Zf(e){return e!=null&&typeof e=="object"&&"current"in e}function fn(e){var t;if(e!=null)return Zf(e)?(t=e.current)!=null?t:void 0:e}var Jf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Dn=Jf?S.useLayoutEffect:S.useEffect;function Qf(){const e=S.useState(0)[1];return S.useCallback(()=>{e(t=>t+1)},[e])}function xd(e,t){const n=S.useRef(new Map),r=Qf();return Dn(()=>{if(!e){n.current.clear();return}return Ye(()=>{var i;let s=!1,o=!1;for(const a of n.current){const[l]=a,c=N(()=>a[1]),u=e[l];c!==u&&(s=!0,n.current.set(l,u),o=(i=t?.(l,c,u))!=null?i:!1)}s&&(o?queueMicrotask(()=>ju.flushSync(r)):r())})},[e]),S.useMemo(()=>e&&new Proxy(e,{get(i,s){const o=i[s];return n.current.set(s,o),o}}),[e])}function ep(e,t){e()}function Bt(e){const t=S.useRef(e);return Dn(()=>{t.current=e},[e]),t}function re(e,t,n=S.useEffect,r=Object.is){const i=S.useRef(e);n(()=>{const s=i.current;r(e,s)||(i.current=e,t(e,s))},[t,e])}function Kr(e,t){const n=S.useRef(fn(e));Dn(()=>{const r=fn(e);r!==n.current&&(n.current=r,t(r))})}var tp=Object.defineProperty,np=Object.defineProperties,rp=Object.getOwnPropertyDescriptors,pi=Object.getOwnPropertySymbols,wd=Object.prototype.hasOwnProperty,kd=Object.prototype.propertyIsEnumerable,Pa=(e,t,n)=>t in e?tp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ip=(e,t)=>{for(var n in t||(t={}))wd.call(t,n)&&Pa(e,n,t[n]);if(pi)for(var n of pi(t))kd.call(t,n)&&Pa(e,n,t[n]);return e},sp=(e,t)=>np(e,rp(t)),op=(e,t)=>{var n={};for(var r in e)wd.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pi)for(var r of pi(e))t.indexOf(r)<0&&kd.call(e,r)&&(n[r]=e[r]);return n},ap=new fd,Sd=S.createContext(ap),lp=S.memo(S.forwardRef(({children:e},t)=>{const[n,r]=S.useState(0),i=S.useRef(null),s=S.useRef(null),o=S.useMemo(()=>({renderer:{get rendering(){var a;return(a=i.current)!=null?a:Promise.resolve()}},trackRendering(a){i.current||(i.current=new Promise(l=>{s.current=l})),S.startTransition(()=>{a(),r(l=>l+1)})}}),[]);return Dn(()=>{var a;(a=s.current)==null||a.call(s),i.current=null},[e,n]),S.useImperativeHandle(t,()=>o),null})),Ui=[void 0,Ge];function cp(e){var t=e,{children:n,onCollision:r,onBeforeDragStart:i,onDragStart:s,onDragMove:o,onDragOver:a,onDragEnd:l}=t,c=op(t,["children","onCollision","onBeforeDragStart","onDragStart","onDragMove","onDragOver","onDragEnd"]);const u=S.useRef(null),{plugins:d,modifiers:h,sensors:f}=c,g=Ke(d,hn.plugins),b=Ke(f,hn.sensors),w=Ke(h,hn.modifiers),m=Bt(i),p=Bt(s),x=Bt(a),y=Bt(o),k=Bt(l),M=Bt(r),j=dp(()=>{var T;return(T=c.manager)!=null?T:new fd(c)});return S.useEffect(()=>{if(!u.current)throw new Error("Renderer not found");const{renderer:T,trackRendering:D}=u.current,{monitor:A}=j;j.renderer=T;const O=[A.addEventListener("beforedragstart",P=>{const R=m.current;R&&D(()=>R(P,j))}),A.addEventListener("dragstart",P=>{var R;return(R=p.current)==null?void 0:R.call(p,P,j)}),A.addEventListener("dragover",P=>{const R=x.current;R&&D(()=>R(P,j))}),A.addEventListener("dragmove",P=>{const R=y.current;R&&D(()=>R(P,j))}),A.addEventListener("dragend",P=>{const R=k.current;R&&D(()=>R(P,j))}),A.addEventListener("collision",P=>{var R;return(R=M.current)==null?void 0:R.call(M,P,j)})];return()=>O.forEach(P=>P())},[j]),re(g,()=>j&&(j.plugins=g),...Ui),re(b,()=>j&&(j.sensors=b),...Ui),re(w,()=>j&&(j.modifiers=w),...Ui),v.jsxs(Sd.Provider,{value:j,children:[v.jsx(lp,{ref:u,children:n}),n]})}function dp(e){const t=S.useRef(null);return t.current||(t.current=e()),S.useInsertionEffect(()=>()=>{var n;return(n=t.current)==null?void 0:n.destroy()},[]),t.current}function up(){return S.useContext(Sd)}function jd(e){var t;const n=(t=up())!=null?t:void 0,[r]=S.useState(()=>e(n));return r.manager!==n&&(r.manager=n),Dn(r.register,[n,r]),r}var hp=Object.create,$d=Object.defineProperty,fp=Object.getOwnPropertyDescriptor,Od=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Ai=e=>{throw TypeError(e)},pp=(e,t,n)=>t in e?$d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gp=e=>{var t;return[,,,hp((t=e?.[Od("metadata")])!=null?t:null)]},Cd=["class","method","getter","setter","accessor","field","value","get","set"],Md=e=>e!==void 0&&typeof e!="function"?Ai("Function expected"):e,mp=(e,t,n,r,i)=>({kind:Cd[e],name:t,metadata:r,addInitializer:s=>n._?Ai("Already initialized"):i.push(Md(s||null))}),vp=(e,t)=>pp(t,Od("metadata"),e[3]),bp=(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},Ed=(e,t,n,r,i,s)=>{for(var o,a,l,c,u=t&7,d=!1,h=!1,f=2,g=Cd[u+5],b=e[f]||(e[f]=[]),w=(i=i.prototype,fp(i,n)),m=r.length-1;m>=0;m--)l=mp(u,n,a={},e[3],b),l.static=d,l.private=h,c=l.access={has:p=>n in p},c.get=p=>p[n],o=(0,r[m])(w[g],l),a._=1,Md(o)&&(w[g]=o);return w&&$d(i,n,w),i},Ad=(e,t,n)=>t.has(e)||Ai("Cannot "+n),yp=(e,t,n)=>(Ad(e,t,"read from private field"),t.get(e)),xp=(e,t,n)=>t.has(e)?Ai("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),wp=(e,t,n,r)=>(Ad(e,t,"write to private field"),t.set(e,n),n),Wt=class _s{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new _s(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 _s(t,n)}},Td,Dd,qs,Zr,Sr,Bo=class extends(qs=Ht,Dd=[le],Td=[le],qs){constructor(e){const t=Wt.from(e);super(t,(n,r)=>Wt.equals(n,r)),bp(Sr,5,this),xp(this,Zr,0),this.velocity={x:0,y:0}}get delta(){return Wt.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=Wt.from(e),r={x:n.x-t.x,y:n.y-t.y},i=Date.now(),s=i-yp(this,Zr),o=a=>Math.round(a/s*100);se(()=>{wp(this,Zr,i),this.velocity={x:o(r.x),y:o(r.y)},super.current=n})}reset(e=this.defaultValue){super.reset(Wt.from(e)),this.velocity={x:0,y:0}}};Sr=gp(qs);Zr=new WeakMap;Ed(Sr,2,"delta",Dd,Bo);Ed(Sr,2,"direction",Td,Bo);vp(Sr,Bo);var Pd=(e=>(e.Horizontal="x",e.Vertical="y",e))(Pd||{});Object.values(Pd);var kp=({dragOperation:e,droppable:t})=>{const n=e.position.current;if(!n)return null;const{id:r}=t;if(!t.shape)return null;if(t.shape.containsPoint(n)){const i=Wt.distance(t.shape.center,n);return{id:r,value:1/i,type:Mn.PointerIntersection,priority:Cn.High}}return null},Sp=({dragOperation:e,droppable:t})=>{const{shape:n}=e;if(!t.shape||!n?.current)return null;const r=n.current.intersectionArea(t.shape);if(r){const{position:i}=e,s=Wt.distance(t.shape.center,i.current),o=r/(n.current.area+t.shape.area-r)/s;return{id:t.id,value:o,type:Mn.ShapeIntersection,priority:Cn.Normal}}return null},jp=e=>{var t;return(t=kp(e))!=null?t:Sp(e)};function $p(e){const{collisionDetector:t,data:n,disabled:r,element:i,id:s,accept:o,type:a}=e,l=jd(u=>new Ei(sp(ip({},e),{register:!1,element:fn(i)}),u)),c=xd(l);return re(s,()=>l.id=s),Kr(i,u=>l.element=u),re(o,()=>l.accept=o,void 0,Ge),re(t,()=>l.collisionDetector=t??jp),re(n,()=>n&&(l.data=n)),re(r,()=>l.disabled=r===!0),re(a,()=>l.type=a),{droppable:c,get isDropTarget(){return c.isDropTarget},ref:S.useCallback(u=>{var d,h;!u&&(d=l.element)!=null&&d.isConnected&&!((h=l.manager)!=null&&h.dragOperation.status.idle)||(l.element=u??void 0)},[l])}}function Op(e,t=[]){const n=new Map;for(const s of e.tiles)for(const o of s.filters??[])n.set(o.given,(n.get(o.given)??0)+1);const r=[],i=new Set;for(const s of e.localGivens??[])i.add(s.name),r.push({name:s.name,...s.label===void 0?{}:{label:s.label},type:s.type,...s.suggest?{field:s.suggest.dimension}:{},origin:"dashboard",local:s,boundTiles:n.get(s.name)??0});for(const s of t)i.has(s.name)||(i.add(s.name),r.push({...s,origin:"model",boundTiles:n.get(s.name)??0}));for(const[s,o]of n)i.has(s)||r.push({name:s,origin:"model",boundTiles:o});return r}function gi(e){if(!(e===void 0||e.startsWith("filter<")))return e==="string"||e==="boolean"?"=":">="}function Cp(e){if(e)return/^filter<(.+)>$/.exec(e)?.[1]??e}function Jr(e,t){const n=Cp(e),r=t?.replace(/_type$/,"");if(!n||!r)return!0;const i=new Set(["date","timestamp"]);return i.has(n)?i.has(r):n===r}function Ra(e){switch(e?.replace(/_type$/,"")){case"string":return"text";case"number":return"a number";case"date":return"a date";case"timestamp":return"a timestamp";case"boolean":return"true or false";default:return e??"an unknown type"}}function Mp(e){switch(e?.replace(/_type$/,"")){case"number":return"number";case"date":case"timestamp":return"date";default:return"select"}}const Ep=[{op:"~",label:"matches"},{op:"=",label:"equals"},{op:">=",label:"at least"},{op:"<=",label:"at most"},{op:">",label:"more than"},{op:"<",label:"less than"}];function Ap(e,t){const n=(e.split(".").at(-1)??"").split(/[^A-Za-z0-9]+/).filter(Boolean).join("_").toUpperCase()||"FILTER",r=/^[A-Z_]/.test(n)?n:`F_${n}`,i=new Set(t);if(!i.has(r))return r;for(let s=2;;s++)if(!i.has(`${r}_${s}`))return`${r}_${s}`}const za=[{kind:"select",label:"Pick one",hint:"A dropdown of the field's values"},{kind:"multiselect",label:"Pick several",hint:"The same, taking more than one"},{kind:"text",label:"Text",hint:"A box taking Malloy filter syntax"},{kind:"number",label:"Number range",hint:"A slider over the field's values"},{kind:"date",label:"Since a date",hint:"A date picker; tiles keep rows on or after it"}];function Tr(e){const t=e.label.trim()||e.name,n=e.field.split(".").at(-1)??e.field;switch(e.kind){case"select":case"multiselect":return{name:e.name,type:"filter<string>",default:"f''",label:t,control:e.kind,...e.source?{suggest:{source:e.source,dimension:n}}:{}};case"text":return{name:e.name,type:"filter<string>",default:"f''",label:t};case"number":return{name:e.name,type:"filter<number>",default:"f''",label:t,...e.range?{rangeMin:e.range.min,rangeMax:e.range.max}:{}};case"date":return{name:e.name,type:"date",default:`@${e.dateDefault??new Date().toISOString().slice(0,10)}`,label:t}}}const Hs=e=>e.declaration.kind==="reference";function Tp(e,t){return e.tiles.map(n=>{const r=(n.filters??[]).find(i=>i.given===t.name);return{include:r!==void 0,field:r?.field??t.field??t.name.toLowerCase(),...r?.op!==void 0?{op:r.op}:gi(t.type)!==void 0?{op:gi(t.type)}:{}}})}function Dp(e,t,n){n.forEach((r,i)=>{const s=e.tiles[i];if(!s||!Hs(s))return;const o=(s.filters??[]).filter(l=>l.given!==t),a=r.include?[...o,{field:r.field.trim()||t.toLowerCase(),given:t,...r.op&&r.op!=="~"?{op:r.op}:{}}]:o;a.length>0?s.filters=a:delete s.filters})}function Pp(e,t){const n=(e.localGivens??[]).filter(s=>s.name!==t.name),r=(e.localGivens??[]).findIndex(s=>s.name===t.name),i=[...n];i.splice(r>=0?r:i.length,0,t),e.localGivens=i}function Rp(e,t){for(const r of e.tiles){const i=(r.filters??[]).filter(s=>s.given!==t);i.length>0?r.filters=i:delete r.filters}const n=(e.localGivens??[]).filter(r=>r.name!==t);n.length>0?e.localGivens=n:delete e.localGivens}const zp=_t(v.jsx("path",{d:"M3 17v2h6v-2zM3 5v2h10V5zm10 16v-2h8v-2h-8v-2h-2v6zM7 9v2H3v2h4v2h2V9zm14 4v-2H11v2zm-6-4h2V7h4V5h-4V3h-2z"})),Wp=_t(v.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"})),Ip=_t(v.jsx("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z"})),Lp=_t(v.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"})),Vs=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),Xi=Vs?"⌘":"Ctrl+",Fp=e=>{if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"};function Np(e){const t=S.useRef(e);S.useEffect(()=>{t.current=e}),S.useEffect(()=>{const n=r=>{const i=t.current,s=Vs?r.metaKey:r.ctrlKey,o=r.key.toLowerCase();if(r.key==="Escape"){i.escape();return}if(!Fp(r.target)){if(s&&o==="z"){r.preventDefault(),r.shiftKey?i.redo():i.undo();return}if(!Vs&&s&&o==="y"){r.preventDefault(),i.redo();return}if(s&&o==="s"){r.preventDefault(),i.save?.();return}!s&&!r.altKey&&!r.shiftKey&&(r.key==="ArrowLeft"||r.key==="ArrowRight")&&(r.preventDefault(),i.nudge(r.key==="ArrowRight"?1:-1))}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[])}function _p({canUndo:e,canRedo:t,onUndo:n,onRedo:r,dirty:i,saving:s,onSave:o,actions:a,onAddTile:l,onSettings:c}){const{theme:u}=Ve();return v.jsxs(ll,{left:v.jsx(Zs,{size:"medium",variant:"outlined",icon:v.jsx(Wp,{sx:{fontSize:20}}),label:"Editing",sx:{height:37,fontSize:"0.875rem",fontWeight:500,border:u.border,color:u.tileTitle,"& .MuiChip-icon":{color:"inherit"},"& .MuiChip-label":{fontSize:"0.875rem"}}}),children:[l&&v.jsx(pe,{startIcon:v.jsx(ul,{}),onClick:l,"aria-label":"Add tile",children:"Tile"}),v.jsx(pe,{startIcon:v.jsx(zp,{}),onClick:d=>c(d.currentTarget),children:"Settings"}),v.jsx(rs,{orientation:"vertical",flexItem:!0,sx:{mx:.5}}),v.jsx(dn,{title:`Undo (${Xi}Z)`,children:v.jsx("span",{children:v.jsx(is,{"aria-label":"Undo",disabled:!e,onClick:n,sx:{width:37,height:37},children:v.jsx(Lp,{fontSize:"small"})})})}),v.jsx(dn,{title:`Redo (${Xi}⇧Z)`,children:v.jsx("span",{children:v.jsx(is,{"aria-label":"Redo",disabled:!t,onClick:r,sx:{width:37,height:37},children:v.jsx(Ip,{fontSize:"small"})})})}),o&&v.jsx(v.Fragment,{children:v.jsx(dn,{title:i?`Save (${Xi}S)`:"",children:v.jsx("span",{children:v.jsx(pe,{variant:i?"contained":"outlined",disabled:!i||s,onClick:o,startIcon:!i&&!s?v.jsx(dl,{}):void 0,sx:{minWidth:124},children:s?"Saving…":i?"Save changes":"Saved"})})})}),a&&v.jsxs(v.Fragment,{children:[v.jsx(rs,{orientation:"vertical",flexItem:!0,sx:{mx:.5}}),a]})]})}const qp=["bar_chart","line_chart","scatter_chart","shape_map","segment_map","big_value","sparkline"];function Dr(e){for(const t of e??[]){const n=/^#\(doc\)\s*(.*)$/s.exec(t.trim());if(n)return n[1].trim()}}function Wa(e){for(const t of e??[]){const n=/^#\s*([a-z_]+)/.exec(t.trim())?.[1];if(n&&qp.includes(n))return n}}const Hp=1;function Rd(e,t,n){const r=[];for(const i of e??[]){const s=i.name,o=i.kind;if(typeof s=="string"){if(o==="dimension"||o==="measure"){const a=i.type?.kind;r.push({name:t+s,kind:o,...a?{type:a}:{}})}else if(o==="join"&&n>0){const a=i.schema?.fields;r.push(...Rd(a,`${t}${s}.`,n-1))}}}return r}function Vp(e){const t=new Map;for(const n of e.sourceInfos??[]){let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{continue}const i=r;i?.name&&t.set(i.name,Rd(i.schema?.fields,"",Hp))}return t}function Ia(e,t){return!e||t===void 0?void 0:e.sources.find(n=>n.name===t)?.fields.filter(n=>n.kind==="dimension")}const Yp=e=>(e??"").startsWith("dashboards/"),Up=e=>e.modelPath??e.path??"";function Xp(e){const t=[],n=new Set;for(const r of e){const i=Up(r);if(Yp(i))continue;const s=Vp(r);for(const o of r.sources??[]){const a=o.name;if(!a||n.has(a))continue;n.add(a);const l=(o.givens??[]).map(c=>c.name).filter(c=>typeof c=="string");t.push({name:a,modelPath:i,...Dr(o.annotations)?{description:Dr(o.annotations)}:{},views:(o.views??[]).filter(c=>typeof c.name=="string").map(c=>({name:c.name,...Dr(c.annotations)?{description:Dr(c.annotations)}:{},...Wa(c.annotations)?{chart:Wa(c.annotations)}:{}})),givens:l,fields:s.get(a)??[]})}}return{sources:t}}const ct=e=>`${e.source}.${e.name}`;function Gp(e,t){if(!t)return[];const n=new Set;for(const r of e.sources)n.add(r.base);for(const r of e.imports)if(r.kind==="names")for(const i of r.names)n.add(i);return t.sources.filter(r=>n.has(r.name))}function Bp({open:e,document:t,catalog:n,columns:r,onClose:i,onAdd:s}){const{theme:o}=Ve(),a=S.useMemo(()=>Gp(t,n),[t,n]),[l,c]=S.useState(""),[u,d]=S.useState(""),[h,f]=S.useState(""),[g,b]=S.useState(Math.ceil(r/2));S.useEffect(()=>{e&&(c(t.sources[0]?.base??a[0]?.name??""),d(""),f(""),b(Math.ceil(r/2)))},[e,t,a,r]);const w=a.find(m=>m.name===l);return v.jsx(yi,{open:e,onClose:i,title:"Add a tile",description:"A tile shows one view of one source this dashboard imports.",actions:v.jsxs(v.Fragment,{children:[v.jsx(pe,{onClick:i,children:"Cancel"}),v.jsx(pe,{variant:"contained",disabled:!(l!==""&&u!==""),onClick:()=>s({base:l,view:u,...h.trim()?{label:h.trim()}:{},colspan:g}),children:"Add tile"})]}),children:v.jsx(ae,{sx:{gap:2,pt:1},children:a.length===0?v.jsx(J,{variant:"body2",sx:{color:o.tileTitle},children:n?"This dashboard imports no source by name, so there is nothing to put a tile on. Import a source in the file first.":"The package's sources are still loading."}):v.jsxs(v.Fragment,{children:[v.jsx(ke,{select:!0,size:"small",label:"Source",value:l,onChange:m=>{c(m.target.value),d("")},inputProps:{"aria-label":"Source"},children:a.map(m=>v.jsxs(ut,{value:m.name,children:[m.name,m.description&&v.jsx(J,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:m.description})]},m.name))}),v.jsxs(ce,{children:[v.jsx(J,{variant:"subtitle2",sx:{mb:.5},children:"View"}),v.jsxs(gu,{dense:!0,disablePadding:!0,"aria-label":"Views",sx:{maxHeight:280,overflowY:"auto",border:o.border,borderRadius:1},children:[(w?.views??[]).map(m=>v.jsxs(mu,{selected:u===m.name,onClick:()=>d(m.name),"aria-label":`View ${m.name}`,children:[v.jsx(fl,{primary:m.name,secondary:m.description,primaryTypographyProps:{fontFamily:"ui-monospace, monospace",fontSize:13}}),m.chart&&v.jsx(Zs,{size:"small",variant:"outlined",label:m.chart.replace(/_chart$/,"")})]},m.name)),w&&w.views.length===0&&v.jsx(J,{variant:"body2",sx:{p:1.5,color:o.tileTitle},children:"This source declares no views."})]})]}),v.jsxs(ae,{direction:"row",sx:{gap:1.5},children:[v.jsx(ke,{size:"small",label:"Title",placeholder:"Uses the view's name",value:h,onChange:m=>f(m.target.value),inputProps:{"aria-label":"Tile title"},sx:{flex:1}}),v.jsx(ke,{size:"small",type:"number",label:`Width (of ${r})`,value:g,onChange:m=>b(Math.min(Math.max(Number(m.target.value)||1,1),r)),inputProps:{min:1,max:r,"aria-label":"Tile width"},sx:{width:140}})]})]})})})}const La=4e3;function Kp(e,t){const n=e.split(`
|
|
69
|
+
`),r=t.split(`
|
|
70
|
+
`);if(n.length>La||r.length>La)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 c=r.length-1;c>=0;c--)i[l][c]=n[l]===r[c]?i[l+1][c+1]+1:Math.max(i[l+1][c],i[l][c+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 Zp(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 Jp({open:e,before:t,after:n,onConfirm:r,onClose:i}){const{theme:s}=Ve(),o=S.useMemo(()=>e?Zp(Kp(t,n)):[],[e,t,n]),a=o.filter(c=>c.kind==="add").length,l=o.filter(c=>c.kind==="del").length;return v.jsx(yi,{open:e,onClose:i,maxWidth:"md",title:"Review the change to the file",description:v.jsxs(v.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."," ",v.jsxs(ce,{component:"span",sx:{fontVariantNumeric:"tabular-nums"},children:["+",a," −",l]})]}),actions:v.jsxs(v.Fragment,{children:[v.jsx(pe,{onClick:i,children:"Keep editing"}),v.jsx(pe,{variant:"contained",onClick:r,children:"Save this"})]}),children:v.jsx(ce,{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((c,u)=>c.kind==="fold"?v.jsx(ce,{component:"span",sx:{display:"block",opacity:.55,py:.25},children:`⋯ ${c.count} unchanged line${c.count===1?"":"s"}`},u):v.jsxs(ce,{component:"span",sx:{display:"block",mx:-2,px:2,whiteSpace:"pre",bgcolor:c.kind==="add"?"rgba(46, 125, 91, 0.16)":c.kind==="del"?"rgba(168, 41, 31, 0.14)":"transparent",textDecoration:c.kind==="del"?"line-through":"none",opacity:c.kind==="del"?.8:1},children:[c.kind==="add"?"+ ":c.kind==="del"?"− ":" ",c.text]},u))})})}const Gi="self";function Qp({open:e,document:t,source:n,givenNames:r,dashboards:i,onClose:s,onApply:o}){const{theme:a}=Ve(),[l,c]=S.useState([]);S.useEffect(()=>{if(!e||!n)return;const f=(t.drills??[]).filter(g=>g.source===n.name);c((n.dimensions??[]).map(g=>{const b=f.find(w=>w.name===g.name);return{name:g.name,expression:g.expression,to:b?.to??[],given:b?.given??""}}))},[e,n,t]);const u=(f,g)=>c(b=>b.map((w,m)=>{if(m!==f)return w;const p={...w};return g(p),p})),d=[Gi,...i.filter(f=>f!==Gi)],h=f=>f===Gi?"This dashboard":f;return v.jsx(yi,{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:v.jsxs(v.Fragment,{children:[v.jsx(pe,{onClick:s,children:"Cancel"}),v.jsx(pe,{variant:"contained",onClick:()=>{n&&(o(l.filter(f=>f.to.length>0).map(f=>({source:n.name,name:f.name,expression:f.expression,to:f.to,...f.given?{given:f.given}:{}}))),s())},disabled:l.length===0,children:"Apply"})]}),children:v.jsx(ae,{sx:{gap:2,pt:1},children:l.length===0?v.jsx(J,{variant:"body2",sx:{color:a.tileTitle},children:n?v.jsxs(v.Fragment,{children:[v.jsx(ce,{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"," ",v.jsx(ce,{component:"code",children:n.name})," and group by it."]}):"This tile's source is not declared in this file."}):l.map((f,g)=>v.jsxs(ce,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr)"},gap:1.5,alignItems:"start"},children:[v.jsxs(ce,{sx:{minWidth:0,pt:.75},children:[v.jsx(J,{variant:"body2",sx:{fontFamily:"ui-monospace, monospace",fontSize:13},children:f.name}),v.jsxs(J,{variant:"caption",sx:{color:a.tileTitle,display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:f.expression,children:["is ",f.expression]})]}),v.jsx(ke,{select:!0,size:"small",label:"Clicks go to",value:f.to,inputProps:{"aria-label":`Where ${f.name} goes`},SelectProps:{multiple:!0,renderValue:b=>b.length===0?"Not clickable":b.map(h).join(", "),displayEmpty:!0},InputLabelProps:{shrink:!0},onChange:b=>u(g,w=>{const m=b.target.value;w.to=Array.isArray(m)?m:String(m).split(",").filter(Boolean)}),children:d.map(b=>v.jsxs(ut,{value:b,children:[v.jsx(ss,{size:"small",checked:f.to.includes(b),sx:{p:0,mr:1}}),v.jsx(fl,{primary:h(b)})]},b))}),v.jsxs(ke,{select:!0,size:"small",label:"Sets the control",value:f.given,disabled:f.to.length===0,inputProps:{"aria-label":`Control ${f.name} sets`},SelectProps:{displayEmpty:!0},InputLabelProps:{shrink:!0},helperText:f.given===""?`Named ${f.name}, like the dimension`:void 0,onChange:b=>u(g,w=>{w.given=b.target.value}),children:[v.jsx(ut,{value:"",children:v.jsx("em",{children:"Same name as the dimension"})}),r.map(b=>v.jsx(ut,{value:b,children:b},b))]})]},f.name))})})}const zd=e=>e.charAt(0)+e.slice(1).toLowerCase().replace(/_/g," ");function eg({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,[c,u]=S.useState({kind:"new"}),[d,h]=S.useState(""),[f,g]=S.useState("select"),[b,w]=S.useState(""),[m,p]=S.useState(""),[x,y]=S.useState([]),[k,M]=S.useState(!1),j=E=>t.sources.find(W=>W.name===E.source)?.base??E.source;S.useEffect(()=>{if(e)if(n){u({kind:"existing",name:n.name}),h(n.label??"");const E=Tp(t,n);y(E);const W=E.filter(C=>C.include),$=new Set(W.map(C=>C.field));p($.size===1?W[0].field:n.field??""),M($.size>1)}else u({kind:"new"}),h(""),g("select"),p(""),w(new Date().toISOString().slice(0,10)),y(t.tiles.map(E=>({include:Hs(E),field:""}))),M(!1)},[e,n,t]);const T=S.useMemo(()=>[...(t.localGivens??[]).map(E=>E.name),...r.map(E=>E.name)],[t,r]),D=S.useMemo(()=>m.trim()?Ap(m.trim(),T):"",[m,T]),A=c.kind==="existing"?n??r.find(E=>E.name===c.name):D?{name:D,type:Tr({name:D,label:d,kind:f,field:m}).type}:void 0,O=A?.type!==void 0&&!A.type.startsWith("filter<"),P=x.find(E=>E.include)?.op??gi(A?.type),R=(E,W)=>y($=>$.map((C,z)=>z===E?{...C,...W}:C)),Y=E=>y(W=>W.map($=>({...$,op:E}))),Ae=E=>{const W=gi(E);y($=>$.map(({op:C,...z})=>W?{...z,op:W}:z))},Te=E=>{u({kind:"existing",name:E.name}),p(E.field??""),Ae(E.type)},be=E=>{g(E),Ae(Tr({name:"X",label:d,kind:E,field:m}).type)},X=t.tiles.map(Hs),Je=X.filter(Boolean).length,Qe=x.filter((E,W)=>E.include&&X[W]).length,ye=t.tiles.filter((E,W)=>(x[W]?.include??!1)&&X[W]),Pe=ye.length>0?ye:t.tiles.filter((E,W)=>X[W]),G=S.useMemo(()=>{const E=new Map;let W=!1;for(const $ of Pe){const C=i?.($);if(C){W=!0;for(const z of C)E.has(z.name)||E.set(z.name,z)}}return W?[...E.values()]:void 0},[x,t.tiles,i]),U=(()=>{const E=m.trim();for(const W of ye){const $=i?.(W);if(!$||$.some(C=>C.name===E))return j(W)}return ye[0]?j(ye[0]):t.sources[0]?.base})(),ee=E=>y(W=>W.map(($,C)=>({...$,include:E&&X[C]}))),xe=S.useMemo(()=>k?x:x.map(E=>({...E,field:m})),[k,x,m]),Re=E=>{for(const W of Pe){const $=i?.(W)?.find(C=>C.name===E.trim());if($?.type)return $.type}},I=E=>Jr(A?.type,E.type),H=(E,W)=>{if(E.trim()==="")return"Pick the field this filter compares.";const $=W?i?.(W):void 0;if(!$)return;const C=$.find(z=>z.name===E.trim());if(!C)return`Not a field of ${W?j(W):"the tiles' source"}.`;if(C.type&&!Jr(A?.type,C.type))return`${E.trim()} is ${Ra(C.type)}; this filter compares ${Ra(A?.type?.replace(/^filter<(.+)>$/,"$1"))}.`},je=E=>{if(p(E),l||c.kind!=="new")return;const W=Re(E),$=Tr({name:"X",label:d,kind:f,field:E}).type;W&&!Jr($,W)&&be(Mp(W))},te=xe.map((E,W)=>E.include&&X[W]?H(E.field,t.tiles[W]):void 0),Xe=te.every(E=>E===void 0),ne=!k&&Qe>0?ye.map(E=>H(m,E)).find(Boolean):void 0,mt=A!==void 0&&Xe&&(c.kind==="existing"||m.trim()!==""&&D!==""),et=()=>{if(!(!A||!mt))if(c.kind==="new")s(A.name,xe,Tr({name:A.name,label:d.trim()||zd(A.name),kind:f,field:m.trim(),...U?{source:U}:{},...b?{dateDefault:b}:{}}));else if(n?.origin==="dashboard"&&n.local){const E=d.trim(),W=E!==(n.local.label??"");s(A.name,xe,W?{...n.local,...E?{label:E}:{}}:void 0)}else s(A.name,xe)},Ut=l&&a.origin==="model";return{editing:l,shown:a,fromModel:Ut,source:c,setSource:u,label:d,setLabel:h,kind:f,dateDefault:b,setDateDefault:w,field:m,rows:x,setRows:y,perTile:k,setPerTile:M,newName:D,target:A,valueTyped:O,commonOp:P,setRow:R,setCommonOp:Y,pickExisting:Te,pickKind:be,bindable:X,bindableCount:Je,included:Qe,commonFields:G,setAll:ee,accepts:I,pickField:je,rowProblems:te,commonProblem:ne,canApply:mt,apply:et}}function Fa({value:e,onChange:t,fields:n,accepts:r,label:i,ariaLabel:s,error:o,helperText:a,disabled:l,autoFocus:c,placeholder:u,sx:d}){const h=S.useMemo(()=>(n??[]).filter(g=>r?.(g)??!0).map(g=>g.name),[n,r]),f=S.useMemo(()=>new Map((n??[]).map(g=>[g.name,g.type])),[n]);return v.jsx(ku,{freeSolo:!0,size:"small",options:h,inputValue:e,onInputChange:(g,b)=>t(b),value:e,onChange:(g,b)=>t(typeof b=="string"?b:""),disabled:l,disableClearable:!0,renderOption:(g,b)=>S.createElement("li",{...g,key:b},v.jsx(J,{variant:"body2",sx:{flex:1},children:b}),f.get(b)&&v.jsx(J,{variant:"caption",sx:{opacity:.6},children:f.get(b)?.replace(/_type$/,"")})),renderInput:g=>v.jsx(ke,{...g,label:i,placeholder:u,autoFocus:c,error:o,helperText:a,inputProps:{...g.inputProps,"aria-label":s}}),sx:d})}function tg({open:e,document:t,control:n,available:r,fieldsFor:i,onClose:s,onApply:o,onRemove:a}){const{theme:l}=Ve(),{editing:c,shown:u,fromModel:d,source:h,setSource:f,label:g,setLabel:b,kind:w,dateDefault:m,setDateDefault:p,field:x,rows:y,setRows:k,perTile:M,setPerTile:j,newName:T,target:D,valueTyped:A,commonOp:O,setRow:P,setCommonOp:R,pickExisting:Y,pickKind:Ae,bindable:Te,bindableCount:be,included:X,commonFields:Je,setAll:Qe,accepts:ye,pickField:Pe,rowProblems:G,commonProblem:U,canApply:ee,apply:xe}=eg({open:e,document:t,control:n,available:r,fieldsFor:i,onApply:o}),Re=(I,H,je)=>v.jsx(ke,{select:!0,size:"small",label:"Compares",value:I??">=",onChange:te=>H(te.target.value),inputProps:{"aria-label":je},sx:{width:130},children:Ep.filter(te=>te.op!=="~").map(te=>v.jsx(ut,{value:te.op,children:te.label},te.op))});return v.jsx(yi,{open:e,onClose:s,title:c?u.label??u.name:"Add a filter",description:c?v.jsxs(v.Fragment,{children:[v.jsxs(ce,{component:"span",sx:{fontFamily:"ui-monospace, monospace"},children:["$",u.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:v.jsxs(v.Fragment,{children:[c&&v.jsx(pe,{color:"error",onClick:()=>a(u.name),"aria-label":`Remove control ${u.name}`,sx:{mr:"auto"},children:"Remove from dashboard"}),v.jsx(pe,{onClick:s,children:"Cancel"}),v.jsx(dn,{title:ee||D===void 0?"":"A ticked tile has no field, or names one its source does not have.",children:v.jsx("span",{children:v.jsx(pe,{variant:"contained",onClick:xe,disabled:!ee,children:c?"Apply":"Add filter"})})})]}),children:v.jsxs(ae,{sx:{gap:2.5,pt:1},children:[!c&&r.length>0&&v.jsxs($u,{exclusive:!0,size:"small",value:h.kind,onChange:(I,H)=>{H==="new"?f({kind:"new"}):H==="existing"&&r[0]&&Y(r[0])},"aria-label":"Where the filter comes from",children:[v.jsx(la,{value:"new",children:"New in this dashboard"}),v.jsx(la,{value:"existing",children:"From the model"})]}),!c&&h.kind==="existing"?v.jsx(ke,{select:!0,size:"small",label:"Control",value:h.name,onChange:I=>{const H=r.find(je=>je.name===I.target.value);H&&Y(H)},children:r.map(I=>v.jsxs(ut,{value:I.name,children:[I.label??I.name,v.jsxs(J,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:["$",I.name]})]},I.name))}):null,v.jsxs(ae,{direction:"row",sx:{gap:1.5,flexWrap:"wrap"},children:[!M&&v.jsx(Fa,{value:x,onChange:Pe,fields:Je,accepts:ye,label:"Field to filter",ariaLabel:"Field to filter",placeholder:"category",autoFocus:!c,error:U!==void 0,helperText:U??(!c&&T?`Declared as $${T}`:void 0),sx:{flex:1,minWidth:200}}),!d&&v.jsx(ke,{size:"small",label:"Label",placeholder:T?zd(T):"",value:g,onChange:I=>b(I.target.value),inputProps:{"aria-label":"Control label"},sx:{flex:1,minWidth:160}}),A&&!M&&Re(O,R,"Comparison")]}),!c&&h.kind==="new"&&v.jsxs(ae,{direction:"row",sx:{gap:1.5},children:[v.jsx(ke,{select:!0,size:"small",label:"Control",value:w,onChange:I=>Ae(I.target.value),inputProps:{"aria-label":"Kind of control"},slotProps:{select:{renderValue:I=>za.find(H=>H.kind===I)?.label??String(I)}},sx:{flex:1},children:za.map(I=>v.jsxs(ut,{value:I.kind,children:[I.label,v.jsx(J,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:I.hint})]},I.kind))}),w==="date"&&v.jsx(ke,{size:"small",type:"date",label:"Starts at",value:m,onChange:I=>p(I.target.value),InputLabelProps:{shrink:!0},sx:{flex:1}})]}),v.jsxs(ce,{children:[v.jsxs(ae,{direction:"row",sx:{alignItems:"center",gap:.5},children:[v.jsx(ss,{size:"small",checked:be>0&&X===be,indeterminate:X>0&&X<be,disabled:be===0,onChange:I=>Qe(I.target.checked),inputProps:{"aria-label":"All tiles"}}),v.jsxs(J,{variant:"subtitle2",sx:{flex:1},children:["Applies to ",X," of ",t.tiles.length," tiles"]}),v.jsx(pe,{size:"small",onClick:()=>{M||k(I=>I.map(H=>({...H,field:x}))),j(I=>!I)},children:M?"Same field for all":"Adjust per tile"})]}),v.jsx(ae,{sx:{gap:M?1:0},children:t.tiles.map((I,H)=>{const je=y[H],te=I.label??I.name,Xe=M?G[H]:void 0;return v.jsxs(ae,{direction:"row",sx:{gap:1,alignItems:M?"flex-start":"center",opacity:Te[H]?1:.6},children:[v.jsx(ss,{size:"small",disabled:!Te[H],checked:(je?.include??!1)&&Te[H],inputProps:{"aria-label":`Filter ${te}`},onChange:ne=>P(H,{include:ne.target.checked})}),v.jsx(J,{variant:"body2",sx:{flex:1,minWidth:0,pt:M?1:0},noWrap:!0,children:te}),Te[H]?M&&v.jsxs(v.Fragment,{children:[A&&Re(je?.op,ne=>P(H,{op:ne}),`Comparison for ${te}`),v.jsx(Fa,{value:je?.field??"",onChange:ne=>P(H,{field:ne}),fields:i?.(I),accepts:ye,label:"Field",ariaLabel:`Field for ${te}`,disabled:!je?.include,error:Xe!==void 0,helperText:Xe,sx:{width:220}})]}):v.jsx(dn,{title:I.declaration.kind==="inherited"?"Declared on its source, which this dashboard does not write.":"Its query is written out here rather than named, so a filter cannot be added to it.",children:v.jsx(J,{variant:"caption",sx:{color:l.tileTitle},children:I.declaration.kind==="inherited"?"From the model":"Inline query"})})]},`${I.source}.${I.name}`)})}),X===0&&v.jsx(J,{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 Wd(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 ng=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}}),Bi=[2,3,4,6,8,12,16,24];function rg({anchor:e,settings:t,onClose:n,onCommit:r}){const{theme:i}=Ve(),{draft:s,patch:o,close:a}=Wd(t,e!==null,r,n),l=s?.columns!==void 0&&!Bi.includes(s.columns)?[...Bi,s.columns].sort((c,u)=>c-u):Bi;return v.jsx(hl,{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&&v.jsxs(ae,{sx:{gap:1.5},children:[v.jsx(J,{variant:"overline",sx:{color:i.tileTitle,lineHeight:1.5},children:"Dashboard"}),v.jsx(ke,{size:"small",label:"Title",value:s.title,autoFocus:!0,inputProps:{"aria-label":"Dashboard title"},onChange:c=>o(u=>{u.title=c.target.value})}),v.jsx(ke,{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:c=>o(u=>{const d=c.target.value;d.trim()===""?delete u.description:u.description=d})}),v.jsxs(ke,{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:c=>o(u=>{const d=Number(c.target.value);d?u.columns=d:delete u.columns}),children:[v.jsx(ut,{value:"",children:"Default (2)"}),l.map(c=>v.jsx(ut,{value:c,children:c},c))]}),v.jsx(fu,{control:v.jsx(pu,{size:"small",checked:s.autorun!==!1,slotProps:{input:{"aria-label":"Run as controls change"}},onChange:c=>o(u=>{c.target.checked?delete u.autorun:u.autorun=!1})}),label:v.jsxs(J,{variant:"body2",children:["Run as controls change",v.jsx(J,{component:"span",variant:"caption",sx:{display:"block",opacity:.7},children:"Off, readers press Apply. For a page whose queries are slow."})]})})]})})}const ig=_t(v.jsx("path",{d:"M10 18h4v-2h-4zM3 6v2h18V6zm3 7h12v-2H6z"}));function sg({controls:e,tileCount:t,unknownFieldsOf:n,onEdit:r,onAdd:i,children:s}){const{theme:o}=Ve();return v.jsx(v.Fragment,{children:v.jsxs(ae,{sx:{gap:1},children:[v.jsxs(ae,{direction:"row","aria-label":"Filters",sx:{gap:1,alignItems:"center",flexWrap:"wrap",minHeight:32},children:[v.jsx(ig,{sx:{fontSize:18,color:o.tileTitle,opacity:.7}}),v.jsx(J,{variant:"subtitle2",sx:{color:o.tileTitle,mr:.5},children:"Filters"}),e.length===0&&v.jsx(J,{variant:"body2",sx:{color:o.tileTitle,opacity:.8},children:"None yet."}),e.map(a=>{const l=n(a.name,a.type);return v.jsx(dn,{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:v.jsx(Zs,{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)}),v.jsx(ce,{sx:{ml:"auto"},children:v.jsx(cl,{label:"Filter",icon:v.jsx(ul,{}),onClick:()=>i(),ariaLabel:"Add filter",ariaHasPopup:"dialog"})})]}),s]})})}const og=(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}),ag=(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},Id=(e,t)=>({kind:"tile",tile:e,index:t,colspan:e.colspan,break:e.break}),Ld=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:ct(e[o-1]),colspan:t-r}),l&&(r=0),n.push(Id(s,o)),r+=a});const i=e.at(-1);return i&&r<t&&n.push({kind:"gap",after:ct(i),colspan:t-r}),n};var cg=Object.create,Fd=Object.defineProperty,dg=Object.defineProperties,ug=Object.getOwnPropertyDescriptor,hg=Object.getOwnPropertyDescriptors,mi=Object.getOwnPropertySymbols,Nd=Object.prototype.hasOwnProperty,_d=Object.prototype.propertyIsEnumerable,fg=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),jr=e=>{throw TypeError(e)},Ys=(e,t,n)=>t in e?Fd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ki=(e,t)=>{for(var n in t||(t={}))Nd.call(t,n)&&Ys(e,n,t[n]);if(mi)for(var n of mi(t))_d.call(t,n)&&Ys(e,n,t[n]);return e},Zi=(e,t)=>dg(e,hg(t)),pg=(e,t)=>{var n={};for(var r in e)Nd.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&mi)for(var r of mi(e))t.indexOf(r)<0&&_d.call(e,r)&&(n[r]=e[r]);return n},gg=e=>{var t;return[,,,cg((t=void 0)!=null?t:null)]},qd=["class","method","getter","setter","accessor","field","value","get","set"],Bn=e=>e!==void 0&&typeof e!="function"?jr("Function expected"):e,mg=(e,t,n,r,i)=>({kind:qd[e],name:t,metadata:r,addInitializer:s=>n._?jr("Already initialized"):i.push(Bn(s||null))}),vg=(e,t)=>Ys(t,fg("metadata"),e[3]),Pr=(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},Hd=(e,t,n,r,i,s)=>{for(var o,a,l,c,u,d=t&7,h=!1,f=!1,g=e.length+1,b=qd[d+5],w=e[g-1]=[],m=e[g]||(e[g]=[]),p=(i=i.prototype,ug({get[n](){return Kn(this,s)},set[n](y){return zt(this,s,y)}},n)),x=r.length-1;x>=0;x--)c=mg(d,n,l={},e[3],m),c.static=h,c.private=f,u=c.access={has:y=>n in y},u.get=y=>y[n],u.set=(y,k)=>y[n]=k,a=(0,r[x])({get:p.get,set:p.set},c),l._=1,a===void 0?Bn(a)&&(p[b]=a):typeof a!="object"||a===null?jr("Object expected"):(Bn(o=a.get)&&(p.get=o),Bn(o=a.set)&&(p.set=o),Bn(o=a.init)&&w.unshift(o));return p&&Fd(i,n,p),i},Vd=(e,t,n)=>t.has(e)||jr("Cannot "+n),Kn=(e,t,n)=>(Vd(e,t,"read from private field"),t.get(e)),Wn=(e,t,n)=>t.has(e)?jr("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),zt=(e,t,n,r)=>(Vd(e,t,"write to private field"),t.set(e,n),n);function It(e){return e instanceof Jo||e instanceof Gd}var Rr=10,bg=class extends Se{constructor(e){super(e);const t=Ye(()=>{const{dragOperation:r}=e;if(ur(r.activatorEvent)&&It(r.source)&&r.status.initialized){const i=e.registry.plugins.get(kr);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(!ur(r.nativeEvent)||!It(s.source)||!s.shape)return;const{actions:o,collisionObserver:a,registry:l}=i,{by:c}=r;if(!c)return;const u=yg(c),{source:d,target:h}=s,{center:f}=s.shape.current,g=[],b=[];se(()=>{for(const k of l.droppables){const{id:M}=k;if(!k.accepts(d)||M===h?.id&&It(k)||!k.element)continue;let j=k.shape;const T=new nt(k.element,{getBoundingClientRect:D=>cr(D,void 0,.2)});!T.height||!T.width||(u=="down"&&f.y+Rr<T.center.y||u=="up"&&f.y-Rr>T.center.y||u=="left"&&f.x-Rr>T.center.x||u=="right"&&f.x+Rr<T.center.x)&&(g.push(k),k.shape=T,b.push(()=>k.shape=j))}}),r.preventDefault(),a.disable();const w=a.computeCollisions(g,of);se(()=>b.forEach(k=>k()));const[m]=w;if(!m)return;const{id:p}=m,{index:x,group:y}=d.sortable;o.setDropTarget(p).then(()=>{const{source:k,target:M,shape:j}=s;if(!k||!It(k)||!j)return;const{index:T,group:D,target:A}=k.sortable,O=x!==T||y!==D,P=O?A:M?.element;if(!P)return;Nc(P);const R=new nt(P);if(!R)return;const Y=rt.delta(R,rt.from(j.current.boundingRectangle),k.alignment);o.move({by:Y}),O?o.setDropTarget(k.id).then(()=>a.enable()):a.enable()})})});this.destroy=()=>{n(),t()}}};function yg(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 xg=Object.defineProperty,wg=Object.defineProperties,kg=Object.getOwnPropertyDescriptors,Na=Object.getOwnPropertySymbols,Sg=Object.prototype.hasOwnProperty,jg=Object.prototype.propertyIsEnumerable,_a=(e,t,n)=>t in e?xg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kt=(e,t)=>{for(var n in t||(t={}))Sg.call(t,n)&&_a(e,n,t[n]);if(Na)for(var n of Na(t))jg.call(t,n)&&_a(e,n,t[n]);return e},Zt=(e,t)=>wg(e,kg(t));function $g(e,t,n){if(t===n)return e;const r=e.slice();return r.splice(n,0,r.splice(t,1)[0]),r}function zr(e,t){const n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function Ji(e){return"initialIndex"in e&&typeof e.initialIndex=="number"&&"index"in e&&typeof e.index=="number"}function Og(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(y=>l(y,s.id)),x=e.findIndex(y=>l(y,o.id));if(p===-1||x===-1){if(Ji(s)){const y=s.initialIndex,k=s.index;return y===k||y<0||y>=e.length?("preventDefault"in t&&t.preventDefault(),e):n(e,y,k)}return e}if(!a&&"index"in s&&typeof s.index=="number"){const y=s.index;if(y!==p)return n(e,p,y)}return n(e,p,x)}const c=Object.entries(e);let u=-1,d,h=-1,f;for(const[p,x]of c)if(u===-1&&(u=x.findIndex(y=>l(y,s.id)),u!==-1&&(d=p)),h===-1&&(h=x.findIndex(y=>l(y,o.id)),h!==-1&&(f=p)),u!==-1&&h!==-1)break;if(u===-1&&Ji(s)){const p=s.initialGroup==null?void 0:zr(e,s.initialGroup),x=s.initialIndex,y=s.group==null?void 0:zr(e,s.group),k=s.index;if(p==null||y==null||p===y&&x===k)return"preventDefault"in t&&t.preventDefault(),e;if(p===y)return Zt(Kt({},e),{[p]:n(e[p],x,k)});const M=e[p][x];return Zt(Kt({},e),{[p]:[...e[p].slice(0,x),...e[p].slice(x+1)],[y]:[...e[y].slice(0,k),M,...e[y].slice(k)]})}if(!s.manager)return e;const{dragOperation:g}=s.manager,b=(i=(r=g.shape)==null?void 0:r.current.center)!=null?i:g.position.current;if(f==null){const p=zr(e,o.id);if(p!=null){const x=o.shape&&b.y>o.shape.center.y?e[p].length:0;f=p,h=x}}if(d==null||f==null||d===f&&u===h){if(d!=null&&d===f&&u===h&&Ji(s)){const p=s.group==null?void 0:zr(e,s.group),x=s.group!=null&&p!==d,y=s.index!==u;if(x||y){const k=s.group==null?d:p;if(k!=null){if(d===k)return Zt(Kt({},e),{[d]:n(e[d],u,s.index)});const M=e[d][u];return Zt(Kt({},e),{[d]:[...e[d].slice(0,u),...e[d].slice(u+1)],[k]:[...e[k].slice(0,s.index),M,...e[k].slice(s.index)]})}}}return"preventDefault"in t&&t.preventDefault(),e}if(d===f)return Zt(Kt({},e),{[d]:n(e[d],u,h)});const w=o.shape&&Math.round(b.y)>Math.round(o.shape.center.y)?1:0,m=e[d][u];return Zt(Kt({},e),{[d]:[...e[d].slice(0,u),...e[d].slice(u+1)],[f]:[...e[f].slice(0,h+w),m,...e[f].slice(h+w)]})}function Cg(e,t){return Og(e,t,$g)}function qa(e){const t=new Map;for(const[,n]of e)for(const r of n)t.set(r.id,r.index);return t}function Ha(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 Va="__default__",Mg=class extends Se{constructor(e){super(e);const t=()=>{const r=new Map;for(const i of e.registry.droppables)if(i instanceof Jo){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(!It(o)||!It(a)||o.sortable===a.sortable)return;const l=t(),c=qa(l),u=o.sortable.group===a.sortable.group,d=l.get(o.sortable.group),h=u?d:l.get(a.sortable.group);!d||!h||queueMicrotask(()=>{r.defaultPrevented||i.renderer.rendering.then(()=>{var f,g;const b=t();if(Ha(c,l,b))return;const w=o.sortable.element,m=a.sortable.element;if(!m||!w||!u&&a.id===o.sortable.group)return;const p=Wr(d),x=u?p:Wr(h),y=(f=o.sortable.group)!=null?f:Va,k=(g=a.sortable.group)!=null?g:Va,M={[y]:p,[k]:x},j=Cg(M,r);if(M===j)return;const T=j[k].indexOf(o.sortable),D=j[k].indexOf(a.sortable);i.collisionObserver.disable(),Ya(w,T,m,D),se(()=>{for(const[A,O]of j[y].entries())O.index=A;if(!u)for(const[A,O]of j[k].entries())O.group=a.sortable.group,O.index=A}),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;It(o)&&(o.sortable.initialIndex===o.sortable.index&&o.sortable.initialGroup===o.sortable.group||queueMicrotask(()=>{const a=t(),l=qa(a),c=a.get(o.sortable.initialGroup);c&&i.renderer.rendering.then(()=>{const u=t();if(Ha(l,a,u))return;const d=Wr(c),h=Wr(c,Ag),f=o.sortable.element,g=h.indexOf(o.sortable),b=d[g],w=b?.element;!b||!w||!f||(Ya(f,b.index,w,o.index),se(()=>{for(const m of a.values()){const p=Array.from(m).values();for(const x of p)x.index=x.initialIndex,x.group=x.initialGroup}}))})}))})];this.destroy=()=>{for(const r of n)r()}}};function Ya(e,t,n,r){const i=r<t?"afterend":"beforebegin";n.insertAdjacentElement(i,e)}function Eg(e,t){return e.index-t.index}function Ag(e,t){return e.initialIndex-t.initialIndex}function Wr(e,t=Eg){return Array.from(e).sort(t)}var Ua=[bg,Mg],Yd={duration:250,easing:"cubic-bezier(0.25, 1, 0.5, 1)",idle:!1};function Xa(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 Ir=new qu,Ud,Xd,jt,Ko,Zn,Jn,Zo,an;Xd=[_],Ud=[_];var Ti=class{constructor(e,t){Wn(this,Ko,Pr(jt,8,this)),Pr(jt,11,this),Wn(this,Zn),Wn(this,Jn),Wn(this,Zo,Pr(jt,12,this)),Pr(jt,15,this),Wn(this,an),this.register=()=>(se(()=>{var g,b;(g=this.manager)==null||g.registry.register(this.droppable),(b=this.manager)==null||b.registry.register(this.draggable)}),()=>this.unregister()),this.unregister=()=>{se(()=>{var g,b;(g=this.manager)==null||g.registry.unregister(this.droppable),(b=this.manager)==null||b.registry.unregister(this.draggable)})},this.destroy=()=>{se(()=>{this.droppable.destroy(),this.draggable.destroy()})};var n=e,{effects:r=()=>[],disabled:i,group:s,index:o,sensors:a,type:l,transition:c=Yd,plugins:u}=n,d=pg(n,["effects","disabled","group","index","sensors","type","transition","plugins"]);const h=Ke(u,Ua),f=Xa(i);this.droppable=new Jo(Zi(Ki({},d),{disabled:f.droppable}),t,this),this.draggable=new Gd(Zi(Ki({},d),{disabled:f.draggable,plugins:h,effects:()=>[()=>{var g,b,w;const m=(g=this.manager)==null?void 0:g.dragOperation.status;m?.initializing&&this.id===((w=(b=this.manager)==null?void 0:b.dragOperation.source)==null?void 0:w.id)&&Ir.clear(this.manager),m?.dragging&&Ir.set(this.manager,this.id,N(()=>({initialIndex:this.index,initialGroup:this.group})))},()=>{const{index:g,group:b,manager:w}=this,m=Kn(this,Jn),p=Kn(this,Zn);(g!==m||b!==p)&&(zt(this,Jn,g),zt(this,Zn,b),this.animate())},()=>{var g,b;const{target:w}=this,{isDragSource:m}=this.draggable;((b=(g=this.draggable.pluginConfig(_o))==null?void 0:g.feedback)!=null?b:"default")==="move"&&m&&(this.droppable.disabled=!w)},...r()],type:l,sensors:a}),t,this),zt(this,an,d.element),this.manager=t,this.index=o,zt(this,Jn,o),this.group=s,zt(this,Zn,s),this.type=l,this.transition=c}get initialIndex(){var e,t;return(t=(e=Ir.get(this.manager,this.id))==null?void 0:e.initialIndex)!=null?t:this.index}get initialGroup(){var e,t;return(t=(e=Ir.get(this.manager,this.id))==null?void 0:e.initialGroup)!=null?t:this.group}animate(){N(()=>{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 u of i.getAnimations())"transitionProperty"in u&&(u.transitionProperty==="transform"||u.transitionProperty==="translate"||u.transitionProperty==="scale")&&u.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}=ot(i),l=ja(i,a,!1),c=ja(i,a);if(o.x||o.y){const u=Po(Fe(i))?Zi(Ki({},t),{duration:0}):t;_c({element:i,keyframes:{translate:[`${l.x+o.x}px ${l.y+o.y}px ${l.z}`,`${c.x}px ${c.y}px ${c.z}`]},options:u}).then(()=>{e.dragOperation.status.dragging||(this.droppable.shape=void 0)})}})})}get manager(){return this.draggable.manager}set manager(e){se(()=>{this.draggable.manager=e,this.droppable.manager=e})}set element(e){se(()=>{const t=Kn(this,an),n=this.droppable.element,r=this.draggable.element;(!n||n===t)&&(this.droppable.element=e),(!r||r===t)&&(this.draggable.element=e),zt(this,an,e)})}get element(){var e,t;const n=Kn(this,an);if(n)return(t=(e=js.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=Ke(e,Ua)}set disabled(e){const t=Xa(e);se(()=>{this.droppable.disabled=t.droppable,this.draggable.disabled=t.draggable})}set data(e){se(()=>{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??qc}set alignment(e){this.draggable.alignment=e}get alignment(){return this.draggable.alignment}set type(e){se(()=>{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)}};jt=gg();Ko=new WeakMap;Zn=new WeakMap;Jn=new WeakMap;Zo=new WeakMap;an=new WeakMap;Hd(jt,4,"index",Xd,Ti,Ko);Hd(jt,4,"group",Ud,Ti,Zo);vg(jt,Ti);var Gd=class extends Mi{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}},Jo=class extends Ei{constructor(e,t,n){super(e,t),this.sortable=n}get index(){return this.sortable.index}get group(){return this.sortable.group}},Tg=Object.defineProperty,Dg=Object.defineProperties,Pg=Object.getOwnPropertyDescriptors,Ga=Object.getOwnPropertySymbols,Rg=Object.prototype.hasOwnProperty,zg=Object.prototype.propertyIsEnumerable,Ba=(e,t,n)=>t in e?Tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qi=(e,t)=>{for(var n in t||(t={}))Rg.call(t,n)&&Ba(e,n,t[n]);if(Ga)for(var n of Ga(t))zg.call(t,n)&&Ba(e,n,t[n]);return e},Wg=(e,t)=>Dg(e,Pg(t));function Ig(e){const{accept:t,collisionDetector:n,collisionPriority:r,id:i,data:s,element:o,handle:a,index:l,group:c,disabled:u,modifiers:d,sensors:h,target:f,type:g,plugins:b}=e,w=Qi(Qi({},Yd),e.transition),m=jd(x=>new Ti(Wg(Qi({},e),{transition:w,register:!1,handle:fn(a),element:fn(o),target:fn(f)}),x)),p=xd(m,Lg);return re(i,()=>m.id=i),Dn(()=>{se(()=>{m.group=c,m.index=l})},[m,c,l]),re(g,()=>m.type=g),re(t,()=>m.accept=t,void 0,Ge),re(s,()=>s&&(m.data=s)),re(l,()=>{var x;(x=m.manager)!=null&&x.dragOperation.status.idle&&w?.idle&&m.refreshShape()},ep),Kr(a,x=>m.handle=x),Kr(o,x=>m.element=x),Kr(f,x=>m.target=x),re(u,()=>m.disabled=u??!1,void 0,Ge),re(h,()=>m.sensors=h,void 0,Ge),re(n,()=>m.collisionDetector=n),re(r,()=>m.collisionPriority=r),re(b,()=>m.plugins=b,void 0,Ge),re(w,()=>m.transition=w,void 0,Ge),re(d,()=>m.modifiers=d,void 0,Ge),re(e.alignment,()=>m.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=>{m.handle=x??void 0},[m]),ref:S.useCallback(x=>{var y,k;!x&&(y=m.element)!=null&&y.isConnected&&!((k=m.manager)!=null&&k.dragOperation.status.idle)||(m.element=x??void 0)},[m]),sourceRef:S.useCallback(x=>{var y,k;!x&&(y=m.source)!=null&&y.isConnected&&!((k=m.manager)!=null&&k.dragOperation.status.idle)||(m.source=x??void 0)},[m]),targetRef:S.useCallback(x=>{var y,k;!x&&(y=m.target)!=null&&y.isConnected&&!((k=m.manager)!=null&&k.dragOperation.status.idle)||(m.target=x??void 0)},[m])}}function Lg(e,t,n){return!!(e==="isDragSource"&&!n&&t)}const Us="tile",Bd="gap",Fg='[role="separator"]',Ng=[Ls.configure({activatorElements:e=>[e.element],preventActivation:(e,t)=>(Ls.defaults.preventActivation?.(e,t)??!1)||e.target instanceof Element&&e.target.closest(Fg)!==null}),hd],_g=e=>[...e,_o.configure({feedback:"clone"})];function qg({id:e,index:t,children:n}){const{ref:r,handleRef:i,isDragSource:s}=Ig({id:e,index:t,type:Us,accept:Us,collisionDetector:zo,plugins:_g});return v.jsx(v.Fragment,{children:n({ref:r,handleRef:i,isDragSource:s})})}function Hg({id:e,after:t,children:n}){const{ref:r,isDropTarget:i}=$p({id:e,type:Bd,accept:Us,collisionDetector:zo,data:{after:t}});return v.jsx(v.Fragment,{children:n({ref:r,isDropTarget:i})})}const Vg=_t(v.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"})),Yg=_t(v.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 Ug({tile:e,index:t,selected:n,menuOpen:r,resizeSpan:i,columns:s,onSelect:o,onOpenMenu:a,onResizeStart:l,onResizeMove:c,onResizeEnd:u,children:d}){const{theme:h}=Ve();return v.jsx(qg,{id:ct(e),index:t,children:({ref:f,handleRef:g,isDragSource:b})=>v.jsxs(ce,{ref:f,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 ${h.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 ${h.drillLink}`,boxShadow:"none"},"&:hover .builder-affordance, &:focus-within .builder-affordance":{opacity:1},"&:hover":{outlineColor:n?h.drillLink:h.border,boxShadow:"0 2px 10px rgba(0, 0, 0, 0.10)"}},children:[d,v.jsx(ce,{ref:g,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:h.tileTitle,bgcolor:h.tile,opacity:b||n?.9:0,transition:"opacity 120ms","&:hover":{opacity:1},"&:active":{cursor:"grabbing"},"&:focus-visible":{opacity:1,outline:`2px solid ${h.drillLink}`,outlineOffset:1}},children:v.jsx(Vg,{sx:{fontSize:16}})}),i===void 0&&v.jsx(is,{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:h.tileTitle,bgcolor:h.tile,opacity:n||r?.9:0,transition:"opacity 120ms","&:hover":{opacity:1,bgcolor:h.tile}},children:v.jsx(Yg,{sx:{fontSize:16}})}),i!==void 0&&v.jsxs(ce,{"aria-hidden":!0,sx:{position:"absolute",top:"6px",right:"6px",px:.75,py:.25,borderRadius:"4px",bgcolor:h.drillLink,color:h.tile,fontSize:11,fontVariantNumeric:"tabular-nums",zIndex:4,pointerEvents:"none"},children:[i," of ",s," ·"," ",Math.round(i/s*100),"%"]}),e.declaration.kind!=="inherited"&&v.jsx(ce,{className:"builder-affordance",role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e.label??e.name}`,onPointerDown:l,onPointerMove:c,onPointerUp:u,onPointerCancel:u,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:h.drillLink}}})]})})}function Xg({tile:e}){const{theme:t}=Ve();return v.jsxs(uu,{sx:{minHeight:140},children:[v.jsx(hu,{title:e.label??e.name,subtitle:e.subtitle}),v.jsxs(J,{variant:"caption",sx:{display:"block",color:t.tileTitle,opacity:.7},children:[e.source," → ",e.name]})]})}function Gg({after:e}){const{theme:t}=Ve();return v.jsx(Hg,{id:Ld(e),after:e,children:({ref:n,isDropTarget:r})=>v.jsx(ce,{ref:n,"aria-hidden":!0,sx:{minHeight:48,borderRadius:1,border:`1px dashed ${t.drillLink}`,bgcolor:r?t.tile:"transparent",opacity:r?.95:.4,transition:"opacity 120ms, background-color 120ms"}})})}function Bg({columns:e}){const{theme:t}=Ve();return v.jsx(ce,{"aria-hidden":!0,sx:{position:"absolute",inset:0,pointerEvents:"none",zIndex:3,display:"grid",gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`,gap:`${Nr}px`},children:Array.from({length:e},(n,r)=>v.jsx(ce,{sx:{borderLeft:`1px dashed ${t.drillLink}`,borderRight:r===e-1?`1px dashed ${t.drillLink}`:"none",opacity:.35}},r))})}var Kg=Object.defineProperty,Zg=Object.defineProperties,Jg=Object.getOwnPropertyDescriptors,Ka=Object.getOwnPropertySymbols,Qg=Object.prototype.hasOwnProperty,em=Object.prototype.propertyIsEnumerable,Za=(e,t,n)=>t in e?Kg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jt=(e,t)=>{for(var n in t||(t={}))Qg.call(t,n)&&Za(e,n,t[n]);if(Ka)for(var n of Ka(t))em.call(t,n)&&Za(e,n,t[n]);return e},Qt=(e,t)=>Zg(e,Jg(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 Lr(e,t){const n=String(t);return Object.prototype.hasOwnProperty.call(e,n)?n:void 0}function es(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(y=>l(y,s.id)),x=e.findIndex(y=>l(y,o.id));if(p===-1||x===-1){if(es(s)){const y=s.initialIndex,k=s.index;return y===k||y<0||y>=e.length?("preventDefault"in t&&t.preventDefault(),e):n(e,y,k)}return e}if(!a&&"index"in s&&typeof s.index=="number"){const y=s.index;if(y!==p)return n(e,p,y)}return n(e,p,x)}const c=Object.entries(e);let u=-1,d,h=-1,f;for(const[p,x]of c)if(u===-1&&(u=x.findIndex(y=>l(y,s.id)),u!==-1&&(d=p)),h===-1&&(h=x.findIndex(y=>l(y,o.id)),h!==-1&&(f=p)),u!==-1&&h!==-1)break;if(u===-1&&es(s)){const p=s.initialGroup==null?void 0:Lr(e,s.initialGroup),x=s.initialIndex,y=s.group==null?void 0:Lr(e,s.group),k=s.index;if(p==null||y==null||p===y&&x===k)return"preventDefault"in t&&t.preventDefault(),e;if(p===y)return Qt(Jt({},e),{[p]:n(e[p],x,k)});const M=e[p][x];return Qt(Jt({},e),{[p]:[...e[p].slice(0,x),...e[p].slice(x+1)],[y]:[...e[y].slice(0,k),M,...e[y].slice(k)]})}if(!s.manager)return e;const{dragOperation:g}=s.manager,b=(i=(r=g.shape)==null?void 0:r.current.center)!=null?i:g.position.current;if(f==null){const p=Lr(e,o.id);if(p!=null){const x=o.shape&&b.y>o.shape.center.y?e[p].length:0;f=p,h=x}}if(d==null||f==null||d===f&&u===h){if(d!=null&&d===f&&u===h&&es(s)){const p=s.group==null?void 0:Lr(e,s.group),x=s.group!=null&&p!==d,y=s.index!==u;if(x||y){const k=s.group==null?d:p;if(k!=null){if(d===k)return Qt(Jt({},e),{[d]:n(e[d],u,s.index)});const M=e[d][u];return Qt(Jt({},e),{[d]:[...e[d].slice(0,u),...e[d].slice(u+1)],[k]:[...e[k].slice(0,s.index),M,...e[k].slice(s.index)]})}}}return"preventDefault"in t&&t.preventDefault(),e}if(d===f)return Qt(Jt({},e),{[d]:n(e[d],u,h)});const w=o.shape&&Math.round(b.y)>Math.round(o.shape.center.y)?1:0,m=e[d][u];return Qt(Jt({},e),{[d]:[...e[d].slice(0,u),...e[d].slice(u+1)],[f]:[...e[f].slice(0,h+w),m,...e[f].slice(h+w)]})}function rm(e,t){return nm(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:c,target:u}=l.operation;if(!c||!u)return;const d=s.current??e;let h;if(u.type===Bd){const{after:f}=u.data,g=d.findIndex(w=>ct(w)===c.id);if(g<0||f===c.id)return;const b=d.filter((w,m)=>m!==g).findIndex(w=>ct(w)===f)+1;h=ag(d,g,b)}else{const f=d.map(ct),g=rm(f,l);if(g.every((w,m)=>w===f[m]))return;const b=new Map(d.map(w=>[ct(w),w]));h=og(g.map(w=>b.get(w)),e.map(w=>w.break??!1))}s.current=h,i(h)},onDragEnd:l=>{a(!1);const c=s.current;if(s.current=void 0,i(void 0),l.canceled||!c)return;t(c);const u=c.findIndex(d=>ct(d)===l.operation.source?.id);u>=0&&n(u)}}}const Ja=e=>{const t=window.document.body;t.style.userSelect=e?"none":"",t.style.cursor=e?"grabbing":""};function sm({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 c=o.current?.getBoundingClientRect(),u=a.currentTarget.parentElement?.getBoundingClientRect();!c||!u||(a.stopPropagation(),a.preventDefault(),a.currentTarget.setPointerCapture(a.pointerId),Ja(!0),n(l),s({index:l,span:e[l]?.colspan??1,left:u.left,track:(c.width-Nr*(t-1))/t}))},onResize:a=>{if(!i)return;const l=a.clientX-i.left,c=Math.round((l+Nr)/(i.track+Nr)),u=Math.min(Math.max(c,1),t);u!==i.span&&s({...i,span:u})},endResize:a=>{if(a.currentTarget.hasPointerCapture(a.pointerId)&&a.currentTarget.releasePointerCapture(a.pointerId),Ja(!1),!i)return;const{index:l,span:c}=i;s(void 0),r(l,c)}}}function om({anchor:e,tile:t,onClose:n,onCommit:r,onRemove:i,columns:s,onDrills:o}){const{theme:a}=Ve(),{draft:l,patch:c,close:u,discard:d}=Wd(t,e!==null,r,n),h=l!==void 0&&l.declaration.kind!=="inherited";return v.jsx(hl,{open:e!==null&&l!==void 0,anchorEl:e,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{width:320,p:2}}},children:l&&v.jsxs(ae,{sx:{gap:1.5},children:[v.jsxs(J,{variant:"overline",sx:{color:a.tileTitle,lineHeight:1.5},children:[l.source," → ",l.name]}),h?v.jsxs(v.Fragment,{children:[v.jsx(ke,{size:"small",label:"Title",value:l.label??"",autoFocus:!0,inputProps:{"aria-label":"Tile title"},onChange:f=>c(g=>{const b=f.target.value;b===""?delete g.label:g.label=b})}),v.jsx(ke,{size:"small",label:"Subtitle",value:l.subtitle??"",inputProps:{"aria-label":"Tile subtitle"},onChange:f=>c(g=>{const b=f.target.value;b===""?delete g.subtitle:g.subtitle=b})}),v.jsxs(ae,{direction:"row",sx:{gap:.5,alignItems:"center"},children:[v.jsx(J,{variant:"caption",sx:{color:a.tileTitle,mr:.5},children:"Width"}),[["Full",1],["½",2],["⅓",3],["¼",4]].map(([f,g])=>{const b=Math.max(1,Math.round(s/g)),w=(l.colspan??1)===b;return v.jsx(pe,{size:"small",variant:w?"contained":"outlined","aria-label":`Width ${f}`,"aria-pressed":w,onClick:()=>c(m=>{m.colspan=b}),sx:{minWidth:40,px:1},children:f},f)})]})]}):v.jsx(J,{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."}),v.jsx(rs,{}),v.jsxs(ae,{direction:"row",sx:{justifyContent:"space-between"},children:[h?v.jsx(pe,{size:"small",onClick:()=>{u(),o()},children:"Clickable cells…"}):v.jsx("span",{}),v.jsx(pe,{color:"error",size:"small",onClick:()=>{d(),i()},children:"Remove tile"})]})]})})}const Xs=e=>e.ok===!1;function Nt(e,t){let n=t;for(let i=t-1;i>=0;i--){const s=e[i].trim();if(s==="")break;if(s.startsWith("#")||s.startsWith("//"))n=i;else break}const r=[];for(let i=n;i<t;i++){const s=e[i].trim();s.startsWith("#")&&!s.startsWith("##")&&r.push({line:i,text:s})}return{start:n,tags:r}}const Gs=e=>e.map(t=>t.text);function am(e){const t=[],n=[];for(const r of e){const i=r.trim();if(i.startsWith('##"'))t.push(i.slice(3).trim());else{if(i.startsWith("##!"))continue;i.startsWith("##")&&n.push(i)}}return{description:t.length>0?t.join(`
|
|
71
|
+
`):void 0,artifact:n}}function lm(e,t){return new RegExp(`source:\\s*${t}\\s+is\\s+([A-Za-z_][A-Za-z0-9_.]*)`).exec(e)?.[1]}function cm(e,t){const n=new RegExp(`view:\\s*${t}\\s+is\\s+([A-Za-z_][A-Za-z0-9_.]*)\\s*(\\+\\s*\\{[\\s\\S]*\\})?`).exec(e);if(n)return{kind:"reference",from:n[1],refinement:n[2]?.trim()};if(new RegExp(`view:\\s*${t}\\s+is\\s*\\{`).test(e))return{kind:"inline"}}const Kd=/where:\s*([A-Za-z_][A-Za-z0-9_.]*)\s*(~|>=|<=|!=|=|>|<)\s*\$([A-Za-z_][A-Za-z0-9_]*)/g;function dm(e){if(!e)return;const t=[];for(const n of e.matchAll(Kd))t.push({field:n[1],given:n[3],...n[2]==="~"?{}:{op:n[2]}});return t.length>0?t:void 0}function um(e,t){const n=[];for(const r of pl(e).values()){const i=/^([A-Z_][A-Z0-9_]*)\s*::\s*(\S+)\s+is\s+(.+)$/.exec(r.declaration);i&&n.push({name:i[1],type:i[2],default:i[3].trim(),...hm(t(Gs(Nt(e,r.line).tags)).tag)})}return n.length>0?n:void 0}function hm(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 fm(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 Bs(e){const{Malloy:t}=await aa(async()=>{const{Malloy:y}=await import("./index-BswZnpqD.js").then(k=>k.i);return{Malloy:y}},__vite__mapDeps([0,1,2,3,4])),{parseAnnotation:n}=await aa(async()=>{const{parseAnnotation:y}=await import("./index-DTfS9vNi.js").then(k=>k.i);return{parseAnnotation:y}},__vite__mapDeps([5,1,2,3])),r=e.split(`
|
|
72
|
+
`);let i;try{i=t.parse({source:e}).symbols}catch(y){return{ok:!1,reason:`This file is not valid Malloy: ${y}`}}const{description:s,artifact:o}=am(r),a=o.find(y=>y.includes("artifact"));if(a===void 0)return{ok:!1,reason:"No `## artifact { … }` tag, so this file is not a composite dashboard."};const l=n([a.replace(/^##\s*/,"# ")]).tag,c=l?.tag("artifact"),u=fm(a);if(u.length===0)return{ok:!1,reason:"The `## artifact` tag names no tiles, so there is nothing to lay out."};const d=[],h=[],f=[],g=new Map;for(const y of i){if(y.type==="import"){const A=(y.children??[]).filter(O=>O.type==="import_item").map(O=>String(O.name));d.push(A.length>0?{kind:"names",names:A,from:String(y.name)}:{kind:"all",from:String(y.name)});continue}if(y.type!=="explore")continue;const k=String(y.name),M=r[y.range.start.line]??"",j=lm(M,k);if(j===void 0)return{ok:!1,reason:`Could not read what source \`${k}\` extends.`,line:y.range.start.line+1};h.push({name:k,base:j});const T=ns(r,k,"view"),D=ns(r,k,"dimension");D.size>0&&(h[h.length-1].dimensions=[...D].map(([A,O])=>({name:A,expression:O.rest})));for(const[A,O]of D){const{tags:P}=Nt(r,O.line),R=n(Gs(P)).tag?.tag("drill");if(!R)continue;const Y=R.textArray("to")??[R.text("to")??""];f.push({source:k,name:A,expression:O.rest,to:Y.filter(Boolean),...R.text("given")?{given:R.text("given")}:{}})}g.set(k,T)}const b=[];for(const y of u){const k=du(y);if(!k)return{ok:!1,reason:`The tile \`${y}\` is not a \`source -> view\` expression, which is the only form the builder can lay out.`};const{source:M,view:j}=k,T=g.get(M)?.get(j)?.line;if(T===void 0){b.push({name:j,source:M,declaration:{kind:"inherited"}});continue}const D=cm(r[T],j);if(D===void 0)return{ok:!1,reason:`Could not read what view \`${j}\` is declared from.`,line:T+1};const{tags:A}=Nt(r,T),O=n(Gs(A)).tag,P=D.kind==="reference"?dm(D.refinement):void 0;b.push({name:j,source:M,declaration:D.kind==="reference"?{kind:"reference",from:D.from}:{kind:"inline"},...P?{filters:P}:{},...O?.text("label")?{label:O.text("label")}:{},...O?.text("subtitle")?{subtitle:O.text("subtitle")}:{},...O?.numeric("colspan")!==void 0?{colspan:O.numeric("colspan")}:{},...O?.has("break")?{break:!0}:{},...O?.has("borderless")?{borderless:!0}:{}})}const w=um(r,n),m={},p=c?.tag("givens");for(const y of Object.keys(p?.dict??{})){const k=p?.text(y);k!==void 0&&(m[y]=k)}const x=l?.tag("dashboard")?.numeric("columns");return{ok:!0,document:{title:c?.text("title")??"",...s?{description:s}:{},...x===void 0?{}:{columns:x},...c?.has("autorun")?{autorun:c.isTrue("autorun")}:{},imports:d,sources:h,...w?{localGivens:w}:{},...Object.keys(m).length>0?{startingGivens:m}:{},...f.length>0?{drills:f}:{},tiles:b}}}const Qa=e=>e.ok===!1;function ge(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 pm(e){const t=[0];for(let n=0;n<e.length;n++)e[n]===`
|
|
73
|
+
`&&t.push(n+1);return t}function gm(e,t){let n=e;for(const r of[...t].sort((i,s)=>s.start-i.start))n=n.slice(0,r.start)+r.text+n.slice(r.end);return n}function Zd(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=${xn(e.label)}`),e.subtitle!==void 0&&t.push(`# subtitle=${xn(e.subtitle)}`),t}function Qr(e){return/^#\s*([a-z_]+)/.exec(e)?.[1]}const mm=new Set(["colspan","break","borderless","label","subtitle"]),vm=new Set(["label","description","control","suggest","range_min","range_max"]),bm=(e,t)=>ge(e.imports)===ge(t.imports);function el(e){const t=[];if(e.label!==void 0&&t.push(`label=${xn(e.label)}`),e.description!==void 0&&t.push(`description=${xn(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 tl=e=>`given: ${e.name} :: ${e.type} is ${e.default}`;function vi(e,t){let n=0,r=!1;for(let i=t;i<e.length;i++){for(const s of e[i])s==="{"?(n++,r=!0):s==="}"&&n--;if(r&&n<=0||!r&&i===t)return i}return e.length-1}const nl=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function ym(e,t,n){const r=e.findIndex(o=>new RegExp(`\\bsource:\\s*${nl(t)}\\s+is\\b`).test(o));if(r<0)return-1;const i=vi(e,r),s=new RegExp(`\\bview:\\s*${nl(n)}\\s+is\\b`);for(let o=r;o<=i;o++)if(s.test(e[o]))return o;return-1}function rl(e){return`# drill { to=${e.to.length===1?e.to[0]:`[${e.to.map(t=>`"${t}"`).join(", ")}]`}${e.given?` given=${e.given}`:""} }`}const bi=e=>`${e.source}.${e.name}`,xn=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ks=e=>ge([e.name,e.source,e.declaration]),dt=Ks,il=e=>ge(e.tiles.map(dt));function xm(e,t){const n=new Set(e.tiles.map(dt)),r=new Set(t.tiles.map(dt)),i=e.tiles.filter(u=>!r.has(dt(u))),s=t.tiles.filter(u=>!n.has(dt(u))),o=i.length>0||s.length>0||il(e)!==il(t);for(const u of s)if(u.declaration.kind!=="reference")return{ok:!1,reason:`A new tile names a view of a source; \`${u.name}\` is ${u.declaration.kind==="inline"?"an inline query":"not declared here"}, which the builder cannot write.`};const a=new Map(e.sources.map(u=>[u.name,u])),l=new Set(e.imports.flatMap(u=>u.kind==="names"?u.names:[]));for(const u of e.sources)l.add(u.base);const c=t.sources.filter(u=>!a.has(u.name));for(const u of e.sources){const d=t.sources.find(h=>h.name===u.name);if(!d||d.base!==u.base)return{ok:!1,reason:`The source \`${u.name}\` cannot be changed or removed here.`}}for(const u of c){if(!s.some(d=>d.source===u.name))return{ok:!1,reason:`A new source \`${u.name}\` needs a tile on it.`};if(!l.has(u.base))return{ok:!1,reason:`\`${u.base}\` is not imported by name in this file, so a tile cannot be put on it. The builder does not add imports: import { ${u.base} } from the model first.`}}return bm(e,t)?{currentKeys:n,nextKeys:r,removedTiles:i,addedTiles:s,newSources:c,currentSources:a,reordered:o}:{ok:!1,reason:"The dashboard's imports cannot be changed here."}}function wm(e){const{lines:t,wholeLine:n,next:r,reordered:i,currentKeys:s,nextKeys:o,edits:a}=e;if(i){const l=os(t);if(l<0)return{ok:!1,reason:"Could not find the `## artifact` tag to reorder."};const c=[...t[l].matchAll(/"([^"]+)"/g)].map(g=>g[1]),u=new Map;for(const g of c){const b=g.split("->").map(w=>w.trim());b.length===2&&u.set(`${b[0]}->${b[1]}`,g)}const d=r.tiles.map(g=>u.get(`${g.source}->${g.name}`)??(o.has(dt(g))&&!s.has(dt(g))?`${g.source} -> ${g.name}`:void 0));if(d.some(g=>g===void 0))return{ok:!1,reason:"A tile in the new order is not one the `## artifact` tag names."};const h=`tiles=[${d.map(g=>`"${g}"`).join(", ")}]`,f=t[l].replace(/tiles\s*=\s*\[[\s\S]*?\]/,h);f!==t[l]&&a.push({...n(l),text:`${f}
|
|
74
|
+
`})}}function km(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||ge(r.startingGivens)!==ge(i.startingGivens)){const o=os(t);if(o<0)return{ok:!1,reason:"Could not find the `## artifact` tag to change the page's settings."};const a=s.find(b=>b.start===n(o).start&&b.end===n(o).end);let l=a?a.text.replace(/\n$/,""):t[o];const c=l.indexOf("artifact"),u=l.indexOf("{",c);let d=0,h=-1;for(let b=u;b<l.length;b++)if(l[b]==="{")d++;else if(l[b]==="}"&&--d===0){h=b;break}if(u<0||h<0)return{ok:!1,reason:"Could not read the `## artifact { … }` tag."};let f=l.slice(u+1,h);const g=(b,w)=>{const m=new RegExp(`\\s*\\b${b}=(?:"(?:[^"\\\\]|\\\\.)*"|[^\\s}]+)`);w===void 0?f=f.replace(m,""):m.test(f)?f=f.replace(m,` ${b}=${w}`):f=`${f.replace(/\s+$/,"")} ${b}=${w} `};if(r.title!==i.title&&g("title",i.title?xn(i.title):void 0),r.autorun!==i.autorun&&g("autorun",i.autorun===void 0?void 0:String(i.autorun)),ge(r.startingGivens)!==ge(i.startingGivens)){f=f.replace(/\s*\bgivens\s*\{[^}]*\}/,"");const b=Object.entries(i.startingGivens??{});b.length>0&&(f=`${f.replace(/\s+$/,"")} givens { ${b.map(([w,m])=>`${w}=${xn(m)}`).join(" ")} }`)}f=f.replace(/\s{2,}/g," "),l=`${l.slice(0,u+1)}${f.startsWith(" ")?f:` ${f}`}${f.endsWith(" ")?"":" "}${l.slice(h)}`,r.columns!==i.columns&&(l=l.replace(/\s*dashboard\s*\{[^}]*\}/,""),i.columns!==void 0&&(l=`${l.trimEnd()} dashboard { columns=${i.columns} }`)),a?a.text=`${l}
|
|
75
|
+
`:s.push({...n(o),text:`${l}
|
|
76
|
+
`})}if(r.description!==i.description){const o=t.map((l,c)=>l.trim().startsWith('##"')?c:-1).filter(l=>l>=0),a=(i.description??"").split(`
|
|
77
|
+
`).map(l=>l.trim()===""?'##"':`##" ${l.trim()}`).join(`
|
|
78
|
+
`);if(o.length>0){const l=o[0],c=o[o.length-1];s.push({start:n(l).start,end:n(c).end,text:i.description===void 0?"":`${a}
|
|
79
|
+
`})}else if(i.description!==void 0){const l=os(t),c=n(l).start;s.push({start:c,end:c,text:`${a}
|
|
80
|
+
`})}}}function Sm(e){const{lines:t,wholeLine:n,indentOf:r,current:i,next:s,edits:o}=e,a=new Map((i.localGivens??[]).map(h=>[h.name,h])),l=new Map((s.localGivens??[]).map(h=>[h.name,h])),c=pl(t),u=new Set;for(const[h,f]of a){const g=l.get(h);if(g!==void 0&&ge(g)===ge(f))continue;const b=c.get(h);if(b===void 0)return{ok:!1,reason:`Could not find where the given \`${h}\` is declared.`};const{tags:w}=Nt(t,b.line),m=g===void 0?w:w.filter(k=>{const M=Qr(k.text);return M!==void 0&&vm.has(M)});for(const k of m)o.push({...n(k.line),text:""}),u.add(k.line);if(g===void 0){o.push({...n(b.line),text:""}),u.add(b.line);const k=Math.min(b.line,...w.map(A=>A.line)),M=b.blockHeader??k,j=(t[b.line+1]??"x").trim()==="",T=M===0||t[M-1].trim()==="",D=b.blockHeader===void 0||![...c.values()].some(A=>A.blockHeader===b.blockHeader&&A.line>b.line&&l.has([...c.entries()].find(([,O])=>O===A)?.[0]??""));j&&T&&D&&!u.has(b.line+1)&&(o.push({...n(b.line+1),text:""}),u.add(b.line+1));continue}const p=r(b.line),x=el(g),y=g.type!==f.type||g.default!==f.default?b.blockHeader===void 0?tl(g):`${g.name} :: ${g.type} is ${g.default}`:t[b.line].trim();o.push({...n(b.line),text:(x?`${p}${x}
|
|
81
|
+
`:"")+`${p}${y}
|
|
82
|
+
`})}for(const[h,f]of c)f.blockHeader===void 0||l.has(h)||![...c.values()].some(g=>g.blockHeader===f.blockHeader&&!u.has(g.line))&&!u.has(f.blockHeader)&&(o.push({...n(f.blockHeader),text:""}),u.add(f.blockHeader));const d=[...l.values()].filter(h=>!a.has(h.name));if(d.length>0){const h=Math.max(-1,...[...c.values()].map(m=>m.line)),f=(()=>{let m=-1;for(let p=0;p<t.length;p++){const x=t[p].trim();(x.startsWith("import ")||m>=0&&/^}\s*from\s/.test(x))&&(m=p)}return m})(),g=h>=0?h:f,b=d.map(m=>{const p=el(m);return(p?`${p}
|
|
83
|
+
`:"")+`${tl(m)}
|
|
84
|
+
`}).join(`
|
|
85
|
+
`),w=g>=0?n(g).end:n(0).end;o.push({start:w,end:w,text:`
|
|
86
|
+
${b}`}),t.some(m=>m.trim().startsWith("##! experimental.givens"))||o.push({start:0,end:0,text:`##! experimental.givens
|
|
87
|
+
`})}}function jm(e){const{lines:t,wholeLine:n,indentOf:r,current:i,next:s,edits:o}=e,a=new Map((i.drills??[]).map(c=>[bi(c),c])),l=new Map((s.drills??[]).map(c=>[bi(c),c]));for(const c of new Set([...a.keys(),...l.keys()])){const u=a.get(c),d=l.get(c);if(u&&d&&ge(u)===ge(d))continue;const h=d??u;if(d&&d.to.length===0)return{ok:!1,reason:`The drill on \`${c}\` names no destination.`};const f=ns(t,h.source,"dimension").get(h.name);if(f===void 0)return{ok:!1,reason:`\`${h.name}\` is not a dimension \`${h.source}\` declares in this file, so a drill cannot be put on it here.`};const{tags:g}=Nt(t,f.line),b=g.find(m=>/^#\s*drill\b/.test(m.text)),w=r(f.line);if(d===void 0)b&&o.push({...n(b.line),text:""});else if(b)o.push({...n(b.line),text:`${w}${rl(d)}
|
|
88
|
+
`});else{const m=n(f.line).start;o.push({start:m,end:m,text:`${w}${rl(d)}
|
|
89
|
+
`})}}}function $m(e){const{lines:t,wholeLine:n,removedTiles:r,edits:i}=e;for(const s of r){if(s.declaration.kind==="inherited")continue;const o=as(t,"view",s.name);if(o<0)return{ok:!1,reason:`Could not find where \`${s.name}\` is declared.`};const a=vi(t,o),{tags:l}=Nt(t,o),c=Math.min(o,...l.map(d=>d.line));for(const d of l)i.push({...n(d.line),text:""});i.push({start:n(o).start,end:n(a).end,text:""});const u=c===0?"":t[c-1].trim();(t[a+1]??"x").trim()===""&&(c===0||u===""||u.endsWith("{"))&&i.push({...n(a+1),text:""})}}function Om(e){const{sourceText:t,lines:n,wholeLine:r,current:i,addedTiles:s,newSources:o,currentSources:a,edits:l}=e,c=new Map;for(const h of s){const f=c.get(h.source)??[];f.push(h),c.set(h.source,f)}const u=(h,f)=>{const g=h.declaration.kind==="reference"?h.declaration.from:h.name,b=(h.filters??[]).map(w=>`where: ${w.field} ${w.op??"~"} $${w.given}`).join(", ");return[...Zd(h).map(w=>`${f}${w}`),`${f}view: ${h.name} is ${g}${b?` + { ${b} }`:""}`].join(`
|
|
90
|
+
`)};let d=-1;for(const h of i.sources){const f=as(n,"source",h.name);f>=0&&(d=Math.max(d,vi(n,f)))}for(const[h,f]of c)if(a.has(h)){const g=as(n,"source",h);if(g<0)return{ok:!1,reason:`Could not find where the source \`${h}\` is declared.`};const b=vi(n,g);let w=" ";for(let x=g+1;x<b;x++){const y=/^(\s+)view:/.exec(n[x]);if(y){w=y[1];break}}const m=r(b).start,p=(n[b-1]??"").trim()==="";l.push({start:m,end:m,text:(p?"":`
|
|
91
|
+
`)+f.map(x=>u(x,w)).join(`
|
|
92
|
+
|
|
93
|
+
`)+`
|
|
94
|
+
`})}else{const g=o.find(x=>x.name===h);if(!g)return{ok:!1,reason:`The tile's source \`${h}\` is not declared.`};const b=`
|
|
95
|
+
source: ${g.name} is ${g.base} extend {
|
|
96
|
+
`+f.map(x=>u(x," ")).join(`
|
|
97
|
+
|
|
98
|
+
`)+`
|
|
99
|
+
}
|
|
100
|
+
`;let w=d;if(w<0)for(let x=0;x<n.length;x++){const y=n[x].trim();(/^(import\s|given:|}\s*from\s)/.test(y)||/^[A-Z_]+\s*::/.test(y))&&(w=x)}const m=w>=0?r(w).end:t.length,p=m===t.length&&!t.endsWith(`
|
|
101
|
+
`)?`
|
|
102
|
+
`:"";l.push({start:m,end:m,text:p+b}),d=w}}function Cm(e){const{lines:t,starts:n,wholeLine:r,indentOf:i,current:s,next:o,edits:a}=e,l=new Map(s.tiles.map(c=>[dt(c),c]));for(const c of o.tiles){const u=l.get(dt(c));if(u===void 0||ge(u)===ge(c))continue;if(c.declaration.kind==="inherited")return{ok:!1,reason:`\`${c.source} -> ${c.name}\` is declared on its source, not in this dashboard, so its presentation cannot be changed here.`};const d=ym(t,c.source,c.name);if(d<0)return{ok:!1,reason:`Could not find where \`${c.name}\` is declared inside \`${c.source}\`.`};const{tags:h}=Nt(t,d),f=i(d),g=Zd(c),b=new Map(g.map(j=>[Qr(j)??j,j])),w=new Set;for(const j of h){const T=Qr(j.text);if(T===void 0||!mm.has(T))continue;const D=b.get(T);if(D===void 0){a.push({...r(j.line),text:""});continue}w.add(T),D!==j.text&&a.push({...r(j.line),text:`${f}${D}
|
|
103
|
+
`})}const m=g.filter(j=>!w.has(Qr(j)??j));if(m.length>0){const j=n[d];a.push({start:j,end:j,text:m.map(T=>`${f}${T}
|
|
104
|
+
`).join("")})}const p=(/\+\s*\{([\s\S]*)\}\s*$/.exec(t[d])?.[1]??"").replace(Kd,"").replace(/\s*,\s*,\s*/g,", ").replace(/^[\s,;]+|[\s,;]+$/g,""),x=(c.filters??[]).map(j=>`where: ${j.field} ${j.op??"~"} $${j.given}`),y=[...p?[p]:[],...x],k=t[d].replace(/\s*\+\s*\{[\s\S]*\}\s*$/,""),M=y.length===0?k:`${k} + { ${y.join(", ")} }`;M!==t[d]&&a.push({...r(d),text:`${M}
|
|
105
|
+
`})}}async function sl(e,t){const n=await Bs(e);if(Xs(n))return{ok:!1,reason:`Cannot edit a file that will not open: ${n.reason}`};const r=n.document,i=xm(r,t);if("reason"in i)return i;const s=e.split(`
|
|
106
|
+
`),o=pm(e),a=g=>({start:o[g],end:g+1<o.length?o[g+1]:e.length}),l=g=>/^\s*/.exec(s[g])?.[0]??"",c=[],u={...i,sourceText:e,lines:s,starts:o,wholeLine:a,indentOf:l,current:r,next:t,edits:c};for(const g of[wm,km,Sm,jm,$m,Om,Cm]){const b=g(u);if(b)return b}const d=g=>{const{drills:b,localGivens:w,...m}=g,p=g.tiles.map(x=>{if(x.filters?.length)return x;const{filters:y,...k}=x;return k});return{...m,tiles:p,...b?.length?{drills:[...b].sort((x,y)=>bi(x).localeCompare(bi(y)))}:{},...w?.length?{localGivens:w}:{}}};if(c.length===0)return ge(d(r))!==ge(d(t))?{ok:!1,reason:"The edit did not produce the dashboard that was asked for, so it was not written. Your changes are still here."}:{ok:!0,source:e};const h=gm(e,c),f=await Bs(h);return Xs(f)?{ok:!1,reason:`The edit produced a file that cannot be read back: ${f.reason}`}:ge(d(f.document))!==ge(d(t))?{ok:!1,reason:"The edit did not produce the dashboard that was asked for, so it was not written. Your changes are still here."}:{ok:!0,source:h}}function Mm(e){const[t,n]=S.useState({stack:[e.document],index:0}),[r,i]=S.useState(e.source),[s,o]=S.useState(void 0),[a,l]=S.useState(e.document),c=t.stack[t.index],u=S.useCallback(m=>{o(void 0),n(p=>{const x=structuredClone(p.stack[p.index]);if(m(x),JSON.stringify(x)===JSON.stringify(p.stack[p.index]))return p;const y=[...p.stack.slice(0,p.index+1),x].slice(-100);return{stack:y,index:y.length-1}})},[]),d=S.useCallback(()=>{o(void 0),n(m=>m.index>0?{...m,index:m.index-1}:m)},[]),h=S.useCallback(()=>{o(void 0),n(m=>m.index<m.stack.length-1?{...m,index:m.index+1}:m)},[]),f=S.useCallback(async()=>{const m=await sl(r,c);if(Qa(m))return o(m.reason),{ok:!1,reason:m.reason};try{await e.onSave?.(m.source)}catch(p){const x=`Could not save: ${p}`;return o(x),{ok:!1,reason:x}}return i(m.source),l(c),o(void 0),{ok:!0}},[c,e,r]),g=S.useMemo(()=>JSON.stringify(c)!==JSON.stringify(a),[c,a]),b=S.useMemo(()=>{const m=new Set(a.tiles.map(Ks)),p=new Set(c.tiles.map(Ks));return[...m].some(x=>!p.has(x))||[...p].some(x=>!m.has(x))},[c,a]),w=S.useCallback(async()=>{const m=await sl(r,c);return Qa(m)?{ok:!1,reason:m.reason}:{ok:!0,source:m.source}},[c,r]);return{document:c,source:r,canUndo:t.index>0,canRedo:t.index<t.stack.length-1,dirty:g,...s===void 0?{}:{error:s},update:u,undo:d,redo:h,save:f,preview:w,structural:b}}function Em({source:e,document:t,onSave:n,onChange:r,renderTile:i,controls:s,givens:o,catalog:a,toolbar:l,dashboards:c,onEvent:u,savesTo:d="package"}){const h=Mm({source:e,document:t,...n?{onSave:n}:{}}),[f,g]=S.useState(void 0),[b,w]=S.useState(!1),m=h.document.columns??ru,{resize:p,gridBox:x,startResize:y,onResize:k,endResize:M}=sm({tiles:h.document.tiles,columns:m,onStart:g,commit:($,C)=>h.update(z=>{z.tiles[$].colspan=C})}),{dragging:j,preview:T,onDragStart:D,onDragOver:A,onDragEnd:O}=im({tiles:h.document.tiles,commit:$=>h.update(C=>{C.tiles=$}),onLanded:g}),[P,R]=S.useState(void 0),[Y,Ae]=S.useState(void 0),[Te,be]=S.useState(!1),[X,Je]=S.useState(void 0),[Qe,ye]=S.useState(null),[Pe,G]=S.useState(void 0);S.useEffect(()=>{r?.(h.document)},[h.document,r]);const U=S.useMemo(()=>ng(h.document),[h.document]),ee=S.useMemo(()=>{const $=new Set((t.localGivens??[]).map(C=>C.name));return(o??[]).filter(C=>!$.has(C.name))},[t,o]),xe=S.useMemo(()=>Op(h.document,ee),[h.document,ee]),Re=S.useMemo(()=>new Map(h.document.sources.map($=>[$.name,Ia(a,$.base)])),[a,h.document.sources]),I=S.useCallback($=>Re.get($.source)??Ia(a,$.source),[Re,a]),H=($,C)=>{const z=[];for(const K of h.document.tiles){const at=I(K);if(!at)continue;const $e=new Map(at.map(ze=>[ze.name,ze.type]));for(const ze of K.filters??[])ze.given===$&&(!$e.has(ze.field)||!Jr(C,$e.get(ze.field)))&&z.push(`${ze.field} on ${K.label??K.name} (${h.document.sources.find(lt=>lt.name===K.source)?.base??K.source})`)}return z},je=S.useMemo(()=>xe.filter($=>$.origin==="model"&&$.boundTiles===0),[xe]),te=S.useCallback(()=>{G(void 0),w(!0);const $=Qn(),{structural:C}=h,z=h.document.tiles.length;h.save().then(K=>{K.ok===!0?u?.({type:"dashboard.saved",tiles:z,structural:C,where:d,durationMs:Qn()-$}):u?.({type:"dashboard.save_refused",reason:K.reason})}).finally(()=>w(!1))},[h,u,d]),Xe=S.useCallback(()=>{if(!(!n||!h.dirty||b)){if(!h.structural){te();return}h.preview().then($=>{$.ok?G({before:h.source,after:$.source}):te()})}},[n,h,b,te]),ne=$=>{be(!1),h.update(C=>{let z=C.sources.find($e=>$e.base===$.base);if(!z){const $e=new Set(C.sources.map(lt=>lt.name));let ze=`${$.base}_tiles`;for(let lt=2;$e.has(ze);lt++)ze=`${$.base}_tiles_${lt}`;z={name:ze,base:$.base},C.sources.push(z)}const K=new Set(C.tiles.filter($e=>$e.source===z.name).map($e=>$e.name));let at=`${$.view}_tile`;for(let $e=2;K.has(at);$e++)at=`${$.view}_tile_${$e}`;C.tiles.push({name:at,source:z.name,declaration:{kind:"reference",from:$.view},colspan:$.colspan,...$.label?{label:$.label}:{}})}),g(h.document.tiles.length)},mt=$=>{Ae(void 0),g(void 0),h.update(C=>{C.tiles.splice($,1)})};Np(S.useMemo(()=>({undo:h.undo,redo:h.redo,...n?{save:Xe}:{},escape:()=>{!Y&&!P&&g(void 0)},nudge:$=>{if(f===void 0)return;const C=h.document.tiles[f];if(!C||C.declaration.kind==="inherited")return;const z=Math.min(Math.max((C.colspan??1)+$,1),m);z!==(C.colspan??1)&&h.update(K=>{K.tiles[f].colspan=z})}}),[h,n,Xe,Y,P,f,m]));const et=($,C,z)=>{R(void 0),h.update(K=>{z&&Pp(K,z),Dp(K,$,C)})},Ut=$=>{R(void 0),h.update(C=>Rp(C,$))},E=(()=>{const $=h.document.tiles;return p!==void 0?$.map((C,z)=>z===p.index?{...C,colspan:p.span}:C):T??$})(),W=j?lg(E,m):E.map(Id);return v.jsxs(ae,{sx:{gap:0},children:[v.jsx(_p,{canUndo:h.canUndo,canRedo:h.canRedo,onUndo:h.undo,onRedo:h.redo,dirty:h.dirty,saving:b,...n?{onSave:Xe}:{},...l?{actions:l}:{},...a?{onAddTile:()=>be(!0)}:{},onSettings:ye}),v.jsxs(ae,{sx:{gap:2,px:"4px",pb:"4px"},children:[v.jsx(iu,{title:h.document.title||"Untitled dashboard",...h.document.description?{description:h.document.description}:{}}),v.jsx(sg,{controls:xe,tileCount:h.document.tiles.length,unknownFieldsOf:H,onEdit:$=>R({control:$}),onAdd:()=>R({}),children:s}),h.error&&v.jsx(ts,{severity:"warning",children:h.error}),v.jsx(cp,{sensors:Ng,onDragStart:D,onDragOver:A,onDragEnd:O,children:v.jsxs(ce,{ref:x,sx:{position:"relative"},children:[(p!==void 0||j)&&v.jsx(Bg,{columns:m}),v.jsx(su,{tiles:W,columns:m,keyOf:$=>$.kind==="gap"?Ld($.after):ct($.tile),renderTile:$=>{if($.kind==="gap")return v.jsx(Gg,{after:$.after});const{tile:C,index:z}=$;return v.jsx(Ug,{tile:C,index:z,selected:z===f,menuOpen:Y?.index===z,resizeSpan:p?.index===z?p.span:void 0,columns:m,onSelect:()=>g(z),onOpenMenu:K=>{g(z),Ae({anchor:K,index:z})},onResizeStart:K=>y(K,z),onResizeMove:k,onResizeEnd:M,children:i?i(C):v.jsx(Xg,{tile:C})})}})]})}),v.jsx(tg,{open:P!==void 0,document:h.document,...P?.control?{control:P.control}:{},available:je,...a?{fieldsFor:I}:{},onClose:()=>R(void 0),onApply:et,onRemove:Ut}),v.jsx(om,{anchor:Y?.anchor??null,tile:Y===void 0?void 0:h.document.tiles[Y.index],onClose:()=>Ae(void 0),onCommit:$=>{const C=Y?.index;C!==void 0&&h.update(z=>{z.tiles[C]=$})},onRemove:()=>{Y!==void 0&&mt(Y.index)},columns:m,onDrills:()=>{Y!==void 0&&Je(h.document.tiles[Y.index]?.source)}}),v.jsx(Qp,{open:X!==void 0,document:h.document,source:h.document.sources.find($=>$.name===X),givenNames:xe.map($=>$.name),dashboards:c??[],onClose:()=>Je(void 0),onApply:$=>h.update(C=>{const z=[...(C.drills??[]).filter(K=>K.source!==X),...$];z.length===0?delete C.drills:C.drills=z})}),v.jsx(rg,{anchor:Qe,settings:U,onClose:()=>ye(null),onCommit:$=>h.update(C=>{C.title=$.title,$.description===void 0?delete C.description:C.description=$.description,$.columns===void 0?delete C.columns:C.columns=$.columns,$.autorun===void 0?delete C.autorun:C.autorun=$.autorun})}),v.jsx(Bp,{open:Te,document:h.document,catalog:a,columns:m,onClose:()=>be(!1),onAdd:ne}),v.jsx(Jp,{open:Pe!==void 0,before:Pe?.before??"",after:Pe?.after??"",onConfirm:te,onClose:()=>G(void 0)})]})]})}function Am(e,t){const n=new Set;for(const s of e.tiles)for(const o of s.filters??[])n.add(o.given);const r=[],i=new Set;for(const s of e.localGivens??[])n.has(s.name)&&(i.add(s.name),r.push(Tm(s)));for(const s of t)s.name===void 0||i.has(s.name)||!n.has(s.name)||(i.add(s.name),r.push(s));return r}function Tm(e){return{name:e.name,type:e.type,default:e.default,...e.label===void 0?{}:{label:e.label},...e.description===void 0?{}:{description:e.description},...e.control===void 0?{}:{control:e.control},...e.suggest?{suggest:{...e.suggest.source===void 0?{}:{source:e.suggest.source},...e.suggest.query===void 0?{}:{query:e.suggest.query},dimension:e.suggest.dimension}}:{},...e.rangeMin===void 0?{}:{rangeMin:e.rangeMin},...e.rangeMax===void 0?{}:{rangeMax:e.rangeMax}}}function Dm(e,t,n,r=new Map){if(t.declaration.kind!=="reference")return{expression:`${t.source} -> ${t.name}`,givenNames:t.declaration.kind==="inherited"?void 0:[]};const i=t.source,s=new Map((e.localGivens??[]).map(c=>[c.name,c.type])),o=[],a=[];for(const c of t.filters??[]){const u=`where: ${c.field} ${c.op??"~"}`;if(n.has(c.given)){o.push(c.given),a.push(`${u} $${c.given}`);continue}if(!s.has(c.given))continue;const d=Su(r.get(c.given),s.get(c.given));d!==void 0&&a.push(`${u} ${d}`)}const l=a.join(", ");return{expression:`${i} -> ${t.declaration.from}`+(l?` + { ${l} }`:""),givenNames:o}}async function Pm(e){const t=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return Array.from(new Uint8Array(t),n=>n.toString(16).padStart(2,"0")).join("")}const ol=(e,t,n,r)=>({workspace:e,type:"dashboard",path:`${t}/${n}/${r}`});function Lm({environmentName:e,packageName:t,dashboardName:n,onExit:r,onEvent:i}){const{apiClients:s,mutable:o}=al(),a=ou(),l=S.useRef(Qn()),c=S.useRef(i);c.current=i;const u=au()?.documentStorage,d=`dashboards/${n}.malloy`,h=Fr({queryKey:["dashboard-editor-model",e,t,d],queryFn:()=>s.models.getModel(e,t,d)}),f=h.data?.data?.sourceText,[g,b]=S.useState(void 0);S.useEffect(()=>{if(f===void 0)return;let G=!1;return Pm(f).then(U=>{G||b(U)}),()=>{G=!0}},[f]);const[w,m]=S.useState(void 0),[p,x]=S.useState(void 0),[y,k]=S.useState(u===void 0),[M,j]=S.useState(!1);S.useEffect(()=>{if(!u)return;let G=!1;return(async()=>{const U=(await u.listWorkspaces(!0))[0]?.name;if(G)return;if(m(U),U===void 0){k(!0);return}const ee=await u.getDocument(ol(U,e,t,d)).catch(()=>{});G||(x(ee),j(ee!==void 0),k(!0))})(),()=>{G=!0}},[u,e,t,d]);const[T,D]=S.useState(void 0),A=T===!0&&p!==void 0,O=A?p:f,P=S.useRef("package");P.current=A?"draft":"package";const[R,Y]=S.useState(void 0),[Ae,Te]=S.useState(void 0),be=S.useRef(void 0);S.useEffect(()=>{if(O===void 0||O===be.current)return;let G=!1;return Bs(O).then(U=>{if(!G){if(Xs(U)){const ee=U.line?`${U.reason} (line ${U.line})`:U.reason;Te(ee),c.current?.({type:"dashboard.open_refused",reason:ee});return}Te(void 0),Y(ee=>({source:O,document:U.document,generation:(ee?.generation??0)+1})),c.current?.({type:"dashboard.opened",from:P.current,tiles:U.document.tiles.length,durationMs:Qn()-l.current})}}),()=>{G=!0}},[O]);const X=w===void 0?void 0:ol(w,e,t,d),Je=S.useCallback(async G=>{if(!u||!X)throw new Error("This host keeps no documents, so there is nowhere to save.");await u.saveDocument(X,G),x(G),D(U=>U??!1)},[u,X]),Qe=S.useCallback(async G=>{if(g===void 0)throw new Error("The package file is still loading; try again.");let U;try{U=await s.models.updateModelSource(e,t,d,{source:G,expectedHash:g})}catch(ee){throw new Error(zm(ee))}be.current=G,b(U.data.contentHash),u&&X&&(await u.deleteDocument(X).catch(()=>{}),x(void 0),j(!1)),D(ee=>ee??!1),await a.invalidateQueries({queryKey:["dashboard-editor-model",e,t,d]});for(const ee of["dashboard-editor-manifest","dashboards","dashboard"])a.invalidateQueries({queryKey:[ee]})},[s,e,t,d,g,u,X,a]),ye=o?Qe:u&&X?Je:void 0,Pe=G=>{l.current=Qn(),D(G)};return h.isError?v.jsx(lu,{error:h.error,context:"Opening the dashboard"}):!f||!y?v.jsxs(ae,{sx:{gap:2},children:[v.jsx(ll,{}),v.jsx(cu,{text:"Opening the dashboard…"})]}):Ae?v.jsxs(ts,{severity:"error",sx:{m:2},children:["This dashboard cannot be opened in the builder: ",Ae]}):v.jsxs(ae,{sx:{gap:2},children:[M&&p!==void 0&&p!==f&&T===void 0&&v.jsx(ts,{severity:"info",action:v.jsxs(ae,{direction:"row",sx:{gap:1},children:[v.jsx(pe,{size:"small",onClick:()=>Pe(!0),children:"Resume"}),v.jsx(pe,{size:"small",onClick:()=>Pe(!1),children:"Start from the package"})]}),children:"You have edits to this dashboard saved in this browser that the package does not have."}),R&&v.jsx(Rm,{environmentName:e,packageName:t,modelPath:d,slug:n,opened:R,onSave:ye,savesTo:o?"package":"browser",...i?{onEvent:i}:{},toolbar:r&&v.jsx(cl,{label:"Done editing",icon:v.jsx(dl,{}),onClick:r}),note:o?"Save writes the file into the package.":u?"Saved in this browser: this server does not take writes.":"This server does not take writes."},R.generation)]})}function Rm({environmentName:e,packageName:t,modelPath:n,slug:r,opened:i,onSave:s,onEvent:o,savesTo:a,toolbar:l,note:c}){const{apiClients:u}=al(),{data:d,isSuccess:h}=Fr({queryKey:["dashboard-editor-manifest",e,t,r],queryFn:()=>u.dashboards.getDashboard(e,t,r,void 0)}),f=d?.data,{data:g}=Fr({queryKey:["dashboard-editor-dashboards",e,t],queryFn:()=>u.dashboards.listDashboards(e,t,void 0)}),b=S.useMemo(()=>(g?.data??[]).map(O=>O.name).filter(O=>!!O&&O!==r),[g,r]),w=S.useMemo(()=>{const O=n.slice(0,n.lastIndexOf("/")+1),P=new Set;for(const R of i.document.imports){const Y=new URL(R.from,`https://malloy.invalid/${O}`);P.add(Y.pathname.slice(1))}return[...P]},[i.document.imports,n]),{data:m}=Fr({queryKey:["dashboard-editor-catalog",e,t,...w],queryFn:async()=>{const O=await Promise.all(w.map(P=>u.models.getModel(e,t,P).then(R=>R.data)));return Xp(O)},enabled:w.length>0}),[p,x]=S.useState(i.document);S.useEffect(()=>x(i.document),[i.document]);const y=S.useMemo(()=>f?.givens??[],[f]),k=S.useMemo(()=>new Set(y.map(O=>O.name).filter(O=>O!==void 0)),[y]),M=S.useMemo(()=>Am(p,y),[p,y]),{declaredTypes:j,applied:T,panel:D}=vu({specs:M,loaded:h,startingValues:f?.startingGivens,documentKey:`${e}/${t}/${r}/edit`,autorun:f?.autorun!==!1,environmentName:e,packageName:t,modelPath:f?.path,documentName:r}),A=S.useMemo(()=>function(O){const P=Dm(p,O,k,T);return v.jsx(bu,{environmentName:e,packageName:t,modelPath:n,tile:P.expression,label:O.label??xu(`${O.source} -> ${O.name}`),subtitle:O.subtitle,borderless:O.borderless,givens:T,declaredTypes:j,givenNames:P.givenNames,height:yu})},[p,k,e,t,n,T,j]);return v.jsxs(ae,{sx:{gap:1},children:[v.jsx(Em,{source:i.source,document:i.document,renderTile:A,givens:M.filter(O=>O.name!==void 0).map(O=>({name:O.name,...O.label?{label:O.label}:{},...O.type?{type:O.type}:{},...O.suggest?.dimension?{field:O.suggest.dimension}:{}})),onChange:x,...m?{catalog:m}:{},dashboards:b,...o?{onEvent:o}:{},toolbar:l,controls:h?v.jsx(wu,{...D,layout:"bar"}):void 0,...s?{onSave:s}:{},savesTo:a}),v.jsx(ce,{sx:{px:.5},children:v.jsx(J,{variant:"caption",sx:{opacity:.7},children:c})})]})}function zm(e){const t=e.response?.data;return t?.message?t.message:e instanceof Error?e.message:String(e)}typeof globalThis.process>"u"?globalThis.process={env:{}}:ca===void 0&&(ca={});export{Em as DashboardBuilder,Lm as DashboardEditor,Xp as buildCatalog,Bs as readDashboardDocument,Xs as readFailed,sl as spliceDashboardDocument,Qa as spliceFailed};
|
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-DKvKsj6c.js"></script>
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/assets/index-DUqldpo0.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|