mira-app-server
Version:
Mira Server - standalone server application using mira-app-core
1 lines • 327 kB
JavaScript
import{aJ as fn,be as oa,cl as Ft,c5 as Yr,c8 as Je,al as pe,cw as Qs,cv as ot,bP as Va,bV as Di,dm as el,bY as tl,bQ as gr,dl as Me,bZ as he,ax as Le,cc as Rn,x as Fn,cb as ni,bL as qt,cB as Pt,av as kt,bN as Bi,cy as aa,bW as nl,c7 as sa,bJ as wt,c2 as la,cx as Mr,at as Nt,aD as il,dq as at,bB as Fo,dr as rl,di as ol,aH as dt,bb as ft,aK as al,i as _r,cR as so,a1 as Ln,as as re,cr as Ee,dt as lo,br as ua,az as sl,ak as mr,B as Ua,cU as ll,d1 as ul,bE as cl,t as qa,p as Ya,n as Xa,l as Ka,j as Ga,aG as Pn,o as dl,f as fl,e as pl,d as gl,c as ml,b as vl,a as hl,X as yl,cg as bl}from"./index-OOzZz4T6.js";import{C as wl}from"./PopoverTrigger-xdplOlgm.js";import{C as xl,o as Ja,e as Il,a as ca,n as da,b as fa,S as Sl}from"./SchemaForm-BEBLGVyw.js";import{S as Cl}from"./StatusImage-ijC2Qank.js";import{I as kl}from"./Input-CZG1tOaA.js";import{a as El,A as Ol}from"./FileUpload-DAQxSw5N.js";import"./SelectValue-BTic8Ggd.js";import"./Collection-xoV-DHwv.js";import"./usePrimitiveElement-CCN0lZVt.js";import"./TooltipTrigger-BN8IaDgz.js";import"./Checkbox-BfEXYDtx.js";import"./TabsTrigger-BT8zVtVt.js";import"./Switch-QckDRkQW.js";import"./Slider-IdZsXzZo.js";import"./Label-bwL3QO2u.js";import"./useKbd-kRIii9yh.js";import"./RadioGroupItem-nNNjlV9J.js";import"./createLucideIcon-DGRAKu_b.js";var ue=class extends TypeError{name="GridLayoutValidationError";code;path;cause;constructor(i,o){super(i),this.code=o.code,this.path=o.path,this.cause=o.cause}},Jt=class extends Error{name="GridLayoutExtensionError";code;source;path;cause;constructor(i,o){super(i),this.code=o.code,this.source=o.source,this.path=o.path??null,this.cause=o.cause}};function pa(e,i=t=>t,o="config.transferConfig"){if(e==null)return null;let t=It(i(e),{code:"invalid-config",path:o,allowedKeys:["group"]});if(typeof t.group!="string"||t.group.trim().length===0)throw st("invalid-config",`${o}.group`,t.group);return Object.freeze({group:t.group})}function uo(e,i,o){Object.defineProperty(e,i,{configurable:!0,enumerable:!0,value:o,writable:!0})}function st(e,i,o){return new ue(`Invalid value at ${i}`,{code:e,path:i,cause:o})}var Dl=new Set(["n","ne","e","se","s","sw","w","nw"]);function Za(e,i="config.resizeConfig.handles",o="invalid-config"){if(!Array.isArray(e))throw st(o,i,e);let t=Gn(e,"length",o,i).value;if(!Number.isSafeInteger(t)||t<0)throw st(o,i,t);let l=new Set(Array.from({length:t},(d,g)=>String(g)));l.add("length");for(let d of vr(e,o,i)){if(typeof d=="symbol")throw st(o,`${i}.<symbol>`,d);if(!l.has(d))throw st(o,Ci(i,d),d)}let f=[],c=new Set;for(let d=0;d<t;d++){let g=`${i}[${d}]`,m=Gn(e,String(d),o,g);if(!m.enumerable||!("value"in m))throw st(o,g,m);let b=m.value;if(typeof b!="string"||!Dl.has(b))throw st(o,g,b);c.has(b)||(c.add(b),f.push(b))}return Object.freeze(f)}function Ci(e,i){return/^[A-Za-z_$][\w$]*$/.test(i)?`${e}.${i}`:`${e}[${JSON.stringify(i)}]`}function Qa(e,i,o){try{return Object.getPrototypeOf(e)}catch(t){throw st(i,o,t)}}function vr(e,i,o){try{return Reflect.ownKeys(e)}catch(t){throw st(i,o,t)}}function Gn(e,i,o,t){try{let l=Object.getOwnPropertyDescriptor(e,i);if(!l)throw st(o,t,i);return l}catch(l){throw l instanceof ue?l:st(o,t,l)}}function It(e,i){let{code:o,path:t,allowedKeys:l,requiredKeys:f=[]}=i;if(typeof e!="object"||!e||Array.isArray(e))throw st(o,t,e);let c=Qa(e,o,t);if(c!==Object.prototype&&c!==null)throw st(o,t,c);let d=l?new Set(l):null,g=Object.create(null);for(let m of vr(e,o,t)){if(typeof m=="symbol")throw st(o,`${t}.<symbol>`,m);let b=Ci(t,m);if(d&&!d.has(m))throw st(o,b,m);let S=Gn(e,m,o,b);if(!S.enumerable||!("value"in S))throw st(o,b,S);uo(g,m,S.value)}for(let m of f)if(!Object.hasOwn(g,m))throw st(o,Ci(t,m),void 0);return g}function es(e,i){if(typeof e!="boolean")throw st("invalid-config",i,e)}function ki(e,i,o="invalid-config"){if(!Number.isSafeInteger(e)||e<=0)throw st(o,i,e)}function ts(e,i,o="invalid-config"){if(!Number.isSafeInteger(e)||e<0)throw st(o,i,e)}function Ei(e,i){if(typeof e!="number"||!Number.isFinite(e)||e<0)throw st("invalid-config",i,e)}function Xr(e,i="config.compactor"){let o=It(e,{code:"invalid-config",path:i,allowedKeys:["type","compact","allowOverlap"],requiredKeys:["compact"]}),t=o.type;if(t!==void 0&&t!=="vertical"&&t!=="horizontal")throw st("invalid-config",`${i}.type`,t);if(typeof o.compact!="function")throw st("invalid-config",`${i}.compact`,o.compact);if(o.allowOverlap!==void 0&&typeof o.allowOverlap!="boolean")throw st("invalid-config",`${i}.allowOverlap`,o.allowOverlap);let l=o.compact;return{...t===void 0?{}:{type:t},compact:l,...o.allowOverlap===void 0?{}:{allowOverlap:o.allowOverlap}}}function ns(e,i="config.positionStrategy"){let o=It(e,{code:"invalid-config",path:i,allowedKeys:["usesCssTransforms","transformScale","getStyle","getRtlStyle"],requiredKeys:["usesCssTransforms","getStyle","getRtlStyle"]});if(es(o.usesCssTransforms,`${i}.usesCssTransforms`),o.transformScale!==void 0&&(typeof o.transformScale!="number"||!Number.isFinite(o.transformScale)||o.transformScale<=0))throw st("invalid-config",`${i}.transformScale`,o.transformScale);if(typeof o.getStyle!="function")throw st("invalid-config",`${i}.getStyle`,o.getStyle);if(typeof o.getRtlStyle!="function")throw st("invalid-config",`${i}.getRtlStyle`,o.getRtlStyle);return Object.freeze({usesCssTransforms:o.usesCssTransforms,...o.transformScale===void 0?{}:{transformScale:o.transformScale},getStyle:o.getStyle,getRtlStyle:o.getRtlStyle})}function Pl(e,i,o){let t=It(o(e),{code:"invalid-config",path:i,allowedKeys:["w","h"],requiredKeys:["w","h"]});return ki(t.w,`${i}.w`),ki(t.h,`${i}.h`),Object.freeze({w:t.w,h:t.h})}function ga(e,i=t=>t,o="config.dropConfig"){if(e===void 0)return Object.freeze({});let t=It(i(e),{code:"invalid-config",path:o,allowedKeys:["isDroppable","dropItem","onDragOver","createItem"]});if(t.isDroppable!==void 0&&typeof t.isDroppable!="boolean")throw st("invalid-config",`${o}.isDroppable`,t.isDroppable);if(t.onDragOver!==void 0&&typeof t.onDragOver!="function")throw st("invalid-config",`${o}.onDragOver`,t.onDragOver);if(t.createItem!==void 0&&typeof t.createItem!="function")throw st("invalid-config",`${o}.createItem`,t.createItem);let l=t.dropItem===void 0?void 0:Pl(t.dropItem,`${o}.dropItem`,i);return Object.freeze({...t.isDroppable===void 0?{}:{isDroppable:t.isDroppable},...l===void 0?{}:{dropItem:l},...t.onDragOver===void 0?{}:{onDragOver:t.onDragOver},...t.createItem===void 0?{}:{createItem:t.createItem}})}function Rl(e,i=o=>o){let o;try{o=It(i(e),{code:"invalid-config",path:"dropResult",allowedKeys:["w","h"]})}catch(t){let l=t instanceof ue?t:null;throw new Jt("Invalid drop callback result",{code:"extension-invalid-result",source:"drop-config",path:l?.path??"dropResult",cause:l?.cause??t})}for(let t of["w","h"]){let l=o[t];if(l!==void 0&&(typeof l!="number"||!Number.isSafeInteger(l)||l<=0))throw new Jt("Invalid drop callback size",{code:"extension-invalid-result",source:"drop-config",path:`dropResult.${t}`,cause:l})}return Object.freeze({...o.w===void 0?{}:{w:o.w},...o.h===void 0?{}:{h:o.h}})}var is=Symbol("LAYOUT_KEY"),rs=Symbol("EMITTER_KEY"),os=["i","x","y","w","h"],zl=new Set([...os,"minW","minH","maxW","maxH","moved","static","isDraggable","isResizable","resizeHandles","autoHeight","zIndex"]);function Rt(e,i){throw new ue(`Invalid layout value at ${e}`,{code:"invalid-layout",path:e,cause:i})}function Ll(e){return Object.is(e,-0)?0:e}function tr(e,i,o={}){let{positive:t=!1,allowNegative:l=!1}=o;(!Number.isSafeInteger(e)||(t?e<=0:!l&&e<0))&&Rt(i,e)}function nr(e,i){e!==void 0&&typeof e!="boolean"&&Rt(i,e)}function $r(e,i){e!==void 0&&e!==1/0&&(!Number.isSafeInteger(e)||e<=0)&&Rt(i,e)}function Kr(e,i,o){let t=e+i;return(!Number.isSafeInteger(t)||t<0)&&Rt(o,t),t}function Tl(e,i="layout"){e.forEach((o,t)=>{Kr(o.x,o.w,`${i}[${t}].w`),Kr(o.y,o.h,`${i}[${t}].h`)})}function Lo(e,i,o){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&Number.isFinite(e))return e;(typeof e!="object"||!e)&&Rt(i,e),o.has(e)&&Rt(i,e),o.add(e);try{if(Array.isArray(e)){let f=vr(e,"invalid-layout",i),c=Gn(e,"length","invalid-layout",i).value;(!Number.isSafeInteger(c)||c<0)&&Rt(i,c);let d=new Set(Array.from({length:c},(m,b)=>String(b)));d.add("length");for(let m of f)typeof m=="symbol"&&Rt(`${i}.<symbol>`,m),d.has(m)||Rt(Ci(i,m),m);let g=Array(c);for(let m=0;m<c;m++){let b=`${i}[${m}]`,S=Gn(e,String(m),"invalid-layout",b);(!S.enumerable||!("value"in S))&&Rt(b,S),g[m]=Lo(S.value,b,o)}return g}let t=It(e,{code:"invalid-layout",path:i}),l=Qa(e,"invalid-layout",i)===null?Object.create(null):{};for(let f of Object.keys(t))uo(l,f,Lo(t[f],Ci(i,f),o));return l}finally{o.delete(e)}}function as(e,i,o={}){let t=It(e,{code:"invalid-layout",path:i,requiredKeys:os}),l=t.i;(typeof l!="string"||l.length===0)&&(typeof l!="number"||!Number.isSafeInteger(l)||Object.is(l,-0))&&Rt(`${i}.i`,l),tr(t.x,`${i}.x`,{allowNegative:o.allowNegativeX}),tr(t.y,`${i}.y`),tr(t.w,`${i}.w`,{positive:!0}),tr(t.h,`${i}.h`,{positive:!0}),$r(t.minW,`${i}.minW`),$r(t.minH,`${i}.minH`),$r(t.maxW,`${i}.maxW`),$r(t.maxH,`${i}.maxH`),nr(t.moved,`${i}.moved`),nr(t.static,`${i}.static`),nr(t.isDraggable,`${i}.isDraggable`),nr(t.isResizable,`${i}.isResizable`),nr(t.autoHeight,`${i}.autoHeight`);let f=t.resizeHandles===void 0?void 0:Za(t.resizeHandles,`${i}.resizeHandles`,"invalid-layout");t.zIndex!==void 0&&tr(t.zIndex,`${i}.zIndex`,{allowNegative:!0});let c=t.minW??1,d=t.minH??1,g=t.maxW??1/0,m=t.maxH??1/0;c>g&&Rt(`${i}.minW`,c),d>m&&Rt(`${i}.minH`,d);let b={},S=new Set([e]);for(let x of Object.keys(t)){if(x==="moved")continue;let C=Ci(i,x),I=t[x],y=zl.has(x)?x==="resizeHandles"?f:(x==="x"||x==="y"||x==="zIndex")&&typeof I=="number"?Ll(I):I:Lo(I,C,S);uo(b,x,y)}return b}function No(e,i="layout",o={}){Array.isArray(e)||Rt(i,e);let t=Gn(e,"length","invalid-layout",i).value;(!Number.isSafeInteger(t)||t<0)&&Rt(i,t);let l=new Set(Array.from({length:t},(g,m)=>String(m)));l.add("length");for(let g of vr(e,"invalid-layout",i))typeof g=="symbol"&&Rt(`${i}.<symbol>`,g),l.has(g)||Rt(Ci(i,g),g);let f=Array(t),c=Array(t),d=new Set;for(let g=0;g<t;g++){let m=`${i}[${g}]`,b=Gn(e,String(g),"invalid-layout",m);(!b.enumerable||!("value"in b))&&Rt(m,b);let S=as(b.value,m,o);d.has(S.i)&&Rt(`${m}.i`,S.i),d.add(S.i),f[g]=S,c[g]=b.value}return{layout:f,sources:c}}function jl(e,i){return!Object.is(e.i,i.i)&&!(e.x+e.w<=i.x||e.x>=i.x+i.w||e.y+e.h<=i.y||e.y>=i.y+i.h)}function Al(e,i){for(let o=0;o<e.length;o++)if(jl(e[o],i))return e[o]}function Ml(e){return new Map(e.map((i,o)=>[i.i,o]))}function _l(e,i){return Array.from(e).sort((o,t)=>o.y-t.y||o.x-t.x||i.get(o.i)-i.get(t.i))}function $l(e){let i=No(e).layout,o=0;for(let t=0;t<i.length;t++){let l=Kr(i[t].y,i[t].h,`layout[${t}].h`);l>o&&(o=l)}return o}function U(e){return No(e).layout}function Fl(e){return as(e,"layoutItem")}function Nl(e,i=!0,o){if(typeof i!="boolean")throw new ue("Invalid verticalCompact",{code:"invalid-config",path:"config.verticalCompact",cause:i});let t=No(e).layout;Tl(t);let l=Ml(t),f=t.filter(d=>d.static),c=_l(t,l);for(let d of c){if(d.static)continue;d.y=i?0:d.y;let g;for(;g=Al(f,d);)d.y=Kr(g.y,g.h,`layout[${l.get(d.i)}].y`);f.push(d)}return t}function Nn(e,i){for(let o=0,t=e.length;o<t;o++)if(Object.is(e[o].i,i))return e[o]}function Hl(e,i="vgl"){let o=()=>`${i}-${e}`;return{b:o,be:t=>`${o()}__${t}`,bm:t=>`${o()}--${t}`,bem:(t,l)=>`${o()}__${t}--${l}`}}function Bl(e,i){throw new ue(`Invalid layout value at ${e}`,{code:"invalid-layout",path:e,cause:i})}function ma(e,i,o){let t=e+i;return(!Number.isSafeInteger(t)||t<0)&&Bl(o,t),t}function ss(e,i){ki(i,"config.cols");let o=U(e);for(let t=0;t<o.length;t++)ma(o[t].x,o[t].w,`layout[${t}].w`),ma(o[t].y,o[t].h,`layout[${t}].h`);return o}var ls={type:"vertical",compact(e,i){return ss(e,i),Nl(e,!0)}},To={type:"vertical",compact(e,i){return ss(e,i)}};function xi(e,i){throw new ue(`Invalid layout value at ${e}`,{code:"invalid-layout",path:e,cause:i})}function Mi(e,i){throw new Jt("Compactor evaluation failed",{code:e,source:"compactor",path:null,cause:i})}function $i(e,i,o){let t=e+i;return(!Number.isSafeInteger(t)||t<0)&&xi(o,t),t}function co(e,i){return!Object.is(e.i,i.i)&&!(e.x+e.w<=i.x||e.x>=i.x+i.w||e.y+e.h<=i.y||e.y>=i.y+i.h)}function us(e){return new Map(e.map((i,o)=>[i.i,o]))}function cs(e,i,o){return Array.from(e).sort((t,l)=>(i==="horizontal"?t.x-l.x||t.y-l.y:t.y-l.y||t.x-l.x)||o.get(t.i)-o.get(l.i))}function va(e,i,o,t){return cs(e,o,t).find(l=>co(l,i))}function Wl(e,i,o,t){let l=e.minW??1,f=e.minH??1,c=e.maxW??1/0,d=e.maxH??1/0;l>o&&xi(`layout[${i}].minW`,l),t!==1/0&&f>t&&xi(`layout[${i}].minH`,f),e.w=Math.min(Math.max(e.w,l),c,o),e.h=Math.min(Math.max(e.h,f),d,t),e.x=Math.min(e.x,o-e.w),t!==1/0&&(e.y=Math.min(e.y,t-e.h)),$i(e.x,e.w,`layout[${i}].w`),$i(e.y,e.h,`layout[${i}].h`)}function Vl(e,i,o,t){let l=us(e),f=e.filter(g=>g.static);for(let g=0;g<f.length;g++)f.slice(0,g).find(m=>co(m,f[g]))&&xi(`layout[${l.get(f[g].i)}]`,f[g]);let c=Array.from(f),d=cs(e.filter(g=>!g.static),t,l);for(let g of d){let m=l.get(g.i),b=va(c,g,t,l);for(;b;)t==="horizontal"?(g.x=$i(b.x,b.w,`layout[${m}].x`),$i(g.x,g.w,`layout[${m}].w`)>i&&xi(`layout[${m}]`,g)):(g.y=$i(b.y,b.h,`layout[${m}].y`),o!==1/0&&$i(g.y,g.h,`layout[${m}].h`)>o&&xi(`layout[${m}]`,g)),b=va(c,g,t,l);c.push(g)}return e}function Gr(e,i){if(Object.is(e,i))return!0;if(Array.isArray(e)||Array.isArray(i))return!Array.isArray(e)||!Array.isArray(i)||e.length!==i.length?!1:e.every((c,d)=>Gr(c,i[d]));if(typeof e!="object"||!e||typeof i!="object"||!i||Object.getPrototypeOf(e)!==Object.getPrototypeOf(i))return!1;let o=e,t=i,l=Object.keys(o).sort(),f=Object.keys(t).sort();return l.length===f.length&&l.every((c,d)=>c===f[d]&&Gr(o[c],t[c]))}function Ul(e,i){let o={...e},t={...i};return delete o.x,delete o.y,delete t.x,delete t.y,Gr(o,t)}function ql(e,i){return e.length===i.length&&e.every((o,t)=>Gr(o,i[t]))}function Yl(e,i,o,t,l){let f,c;try{f=U(i),c=U(e)}catch{Mi("extension-invalid-result",e)}(!ql(f,o)||e===i)&&Mi("extension-invalid-result",e),c.length!==o.length&&Mi("extension-invalid-result",e);let d=us(o);for(let g=0;g<c.length;g++){let m=c[g],b=o[g],S=m.x+m.w,x=m.y+m.h;(!Object.is(m.i,b.i)||d.get(m.i)!==g||!Ul(m,b)||b.static&&(m.x!==b.x||m.y!==b.y)||!Number.isSafeInteger(S)||S>t||!Number.isSafeInteger(x)||l!==1/0&&x>l)&&Mi("extension-invalid-result",e)}for(let g=0;g<c.length;g++)for(let m=0;m<g;m++)co(c[g],c[m])&&Mi("extension-invalid-result",e);return c}function Xl(e,i,o,t){let l=U(i),f=U(l),c;try{c=e.compact(l,o)}catch(d){Mi("extension-error",d)}return Yl(c,l,f,o,t)}function ds(e,i){let o=U(e),t=It(i,{code:"invalid-config",path:"config",allowedKeys:["cols","maxRows","collisionMode","compactor"],requiredKeys:["cols"]});ki(t.cols,"config.cols");let l=t.cols,f=t.maxRows===void 0?1/0:t.maxRows;if(f!==1/0&&(!Number.isSafeInteger(f)||f<=0))throw new ue("Invalid maxRows",{code:"invalid-config",path:"config.maxRows",cause:f});let c=t.collisionMode===void 0?"push":t.collisionMode;if(c!=="push"&&c!=="prevent"&&c!=="overlap")throw new ue("Invalid collisionMode",{code:"invalid-config",path:"config.collisionMode",cause:c});let d=t.compactor===void 0?ls:t.compactor,g=Xr(d);if(o.forEach((b,S)=>{Wl(b,S,l,f)}),c==="overlap")return o;for(let b=0;b<o.length;b++)for(let S=0;S<b;S++)co(o[b],o[S])&&c==="prevent"&&xi(`layout[${b}]`,o[b]);if(c==="prevent")return o;let m=Vl(o,l,f,g.type??"vertical");return d===To?m:Xl(g,m,l,f)}function Zt(e,i){throw new ue(`Invalid geometry value at ${e}`,{code:"invalid-config",path:e,cause:i})}var fs=new WeakSet;function Fr(e,i){throw new ue(`Invalid layout value at ${e}`,{code:"invalid-layout",path:e,cause:i})}function cr(e,i){let o=new ue(`Derived geometry overflow at ${e}`,{code:"invalid-config",path:e,cause:i});throw fs.add(o),o}function Jr(e){return e instanceof ue&&fs.has(e)}function cn(e){return Object.is(e,-0)?0:e}function ha(e,i){Array.isArray(e)||Zt(i,e);let o=vr(e,"invalid-config",i);(o.length!==3||!o.includes("0")||!o.includes("1")||!o.includes("length"))&&Zt(i,e);let t=Gn(e,"0","invalid-config",`${i}[0]`),l=Gn(e,"1","invalid-config",`${i}[1]`);return(!t.enumerable||!("value"in t)||!l.enumerable||!("value"in l))&&Zt(!t.enumerable||!("value"in t)?`${i}[0]`:`${i}[1]`,!t.enumerable||!("value"in t)?t:l),Ei(t.value,`${i}[0]`),Ei(l.value,`${i}[1]`),[cn(t.value),cn(l.value)]}function Kn(e,i){return(typeof e!="number"||!Number.isFinite(e))&&Zt(i,e),cn(e)}function ya(e,i){let o=Kn(e,i);return o<=0&&Zt(i,e),o}function tt(e,i){return Number.isFinite(e)||cr(i,e),cn(e)}function Ho(e,i){let o=It(e,{code:"invalid-config",path:"geometry",allowedKeys:["width","cols","rowHeight","gap","containerPadding","rtl","effectiveScale"],requiredKeys:["width","cols","rowHeight","gap","containerPadding","rtl","effectiveScale"]}),t=ya(o.width,"geometry.width");ki(o.cols,"geometry.cols"),Ei(o.rowHeight,"geometry.rowHeight");let l=ha(o.gap,"geometry.gap"),f=ha(o.containerPadding,"geometry.containerPadding");es(o.rtl,"geometry.rtl");let c=ya(o.effectiveScale,"geometry.effectiveScale"),d=o.cols,g=cn(o.rowHeight),m=tt(2*f[0],"geometry.containerPadding[0]");tt(2*f[1],"geometry.containerPadding[1]");let b=tt((d-1)*l[0],"geometry.gap[0]"),S=tt(tt(t-m,"geometry.width")-b,"geometry.width");S<0&&Zt("geometry.width",S);let x=tt(S/d,"geometry.width"),C=tt(x+l[0],"geometry.gap[0]"),I=tt(g+l[1],"geometry.gap[1]");return i&&C<=0&&Zt("geometry.width",C),i&&I<=0&&Zt("geometry.rowHeight",I),{width:t,cols:d,rowHeight:g,gap:l,containerPadding:f,rtl:o.rtl,effectiveScale:c,availableWidth:S,cellWidth:x,pitchX:C,pitchY:I}}function Kl(e){let i=Fl(e),o=i.minW??1,t=i.minH??1,l=i.maxW??1/0,f=i.maxH??1/0;(i.w<o||i.w>l)&&Fr("layoutItem.w",i.w),(i.h<t||i.h>f)&&Fr("layoutItem.h",i.h);let c=i.x+i.w;Number.isSafeInteger(c)||Fr("layoutItem.w",c);let d=i.y+i.h;return Number.isSafeInteger(d)||Fr("layoutItem.h",d),i}function Gl(e){let i=It(e,{code:"invalid-config",path:"containerRect",allowedKeys:["left","right","top","bottom","width","height"],requiredKeys:["left","right","top","bottom","width","height"]}),o=Kn(i.left,"containerRect.left"),t=Kn(i.right,"containerRect.right"),l=Kn(i.top,"containerRect.top"),f=Kn(i.bottom,"containerRect.bottom"),c=Kn(i.width,"containerRect.width"),d=Kn(i.height,"containerRect.height");return t<o&&Zt("containerRect.right",t),f<l&&Zt("containerRect.bottom",f),c<0&&Zt("containerRect.width",c),d<0&&Zt("containerRect.height",d),Math.abs(t-o-c)>1e-6&&Zt("containerRect.width",c),Math.abs(f-l-d)>1e-6&&Zt("containerRect.height",d),{left:o,right:t,top:l,bottom:f,width:c,height:d}}function fo(e,i){let o=Ho(i,!1),t=Kl(e),l=tt(t.x*o.pitchX,"layoutItem.x"),f=tt(t.y*o.pitchY,"layoutItem.y"),c=tt(t.w*o.cellWidth,"layoutItem.w"),d=tt(t.h*o.rowHeight,"layoutItem.h"),g=tt(o.containerPadding[0]+l,"geometry.containerPadding[0]"),m=tt(o.containerPadding[1]+f,"geometry.containerPadding[1]"),b=tt(c+tt((t.w-1)*o.gap[0],"geometry.gap[0]"),"geometry.gap[0]"),S=tt(d+tt((t.h-1)*o.gap[1],"geometry.gap[1]"),"geometry.gap[1]");return Object.freeze({top:m,inlineStart:g,width:b,height:S})}function Bo(e){let i=It(e,{code:"invalid-config",path:"pointer",allowedKeys:["clientX","clientY","containerRect","anchor","geometry"],requiredKeys:["clientX","clientY","containerRect","anchor","geometry"]}),o=Ho(i.geometry,!0),t=Kn(i.clientX,"pointer.clientX"),l=Kn(i.clientY,"pointer.clientY"),f=Gl(i.containerRect),c=It(i.anchor,{code:"invalid-config",path:"anchor",allowedKeys:["inline","block"],requiredKeys:["inline","block"]});Ei(c.inline,"anchor.inline"),Ei(c.block,"anchor.block");let d=cn(c.inline),g=cn(c.block),m=tt(o.rtl?f.right-t:t-f.left,"pointer.clientX"),b=tt(l-f.top,"pointer.clientY"),S=tt(m/o.effectiveScale,"geometry.effectiveScale"),x=tt(b/o.effectiveScale,"geometry.effectiveScale"),C=tt(S-d,"anchor.inline"),I=tt(x-g,"anchor.block"),y=tt(C-o.containerPadding[0],"geometry.containerPadding[0]"),v=tt(I-o.containerPadding[1],"geometry.containerPadding[1]"),O=tt(y/o.pitchX,"geometry.width"),z=Math.round(O);Number.isSafeInteger(z)||cr("geometry.width",z);let B=tt(v/o.pitchY,"geometry.rowHeight"),H=Math.round(B);return Number.isSafeInteger(H)||cr("geometry.rowHeight",H),Object.freeze({x:cn(z),y:cn(H)})}function ba(e){let i=It(e,{code:"invalid-config",path:"size",allowedKeys:["width","height","geometry"],requiredKeys:["width","height","geometry"]}),o=Ho(i.geometry,!0);Ei(i.width,"size.width"),Ei(i.height,"size.height");let t=cn(i.width),l=cn(i.height),f=tt(t+o.gap[0],"size.width"),c=tt(l+o.gap[1],"size.height"),d=tt(f/o.pitchX,"geometry.width"),g=Math.round(d);Number.isSafeInteger(g)||cr("geometry.width",g);let m=tt(c/o.pitchY,"geometry.rowHeight"),b=Math.round(m);return Number.isSafeInteger(b)||cr("geometry.rowHeight",b),Object.freeze({w:cn(g),h:cn(b)})}var Jl=new Set(["position","top","left","right","width","height","transform"]);function ii(e){let i=Object.is(e,-0)?0:e,o=i<0?"-":"",t=String(Math.abs(i));if(!/[eE]/.test(t))return`${o}${t}`;let[l,f]=t.toLowerCase().split("e"),c=Number(f),[d,g=""]=l.split("."),m=`${d}${g}`,b=d.length+c,S;return S=b<=0?`0.${"0".repeat(-b)}${m}`:b>=m.length?`${m}${"0".repeat(b-m.length)}`:`${m.slice(0,b)}.${m.slice(b)}`,`${o}${S}`}function ps(e,i,o,t,l,f){let c=[["top",e],[l==="ltr"?"left":"right",i],["width",o],["height",t]],d=[];for(let[g,[m,b]]of c.entries()){let S=f&&g<2;if(typeof b!="number"||!Number.isFinite(b)||!S&&b<0)throw new ue(`Invalid position geometry ${m}`,{code:"invalid-config",path:`geometry.${m}`,cause:b});d.push(Object.is(b,-0)?0:b)}return{top:d[0],inlineStart:d[1],width:d[2],height:d[3]}}function Zr(e,i,o,t,l){return ps(e,i,o,t,l,!1)}function Zl(e,i,o,t,l){return ps(e,i,o,t,l,!0)}function Qr(e,i){let o=ii(e.top);return{transform:`translate3d(${ii(i==="rtl"?-e.inlineStart:e.inlineStart)}px, ${o}px, 0)`,width:`${ii(e.width)}px`,height:`${ii(e.height)}px`,position:"absolute"}}function gs(e,i){return{top:`${ii(e.top)}px`,[i==="ltr"?"left":"right"]:`${ii(e.inlineStart)}px`,width:`${ii(e.width)}px`,height:`${ii(e.height)}px`,position:"absolute"}}function ir(e,i){return`${e}[${JSON.stringify(i)}]`}function wa(e,i,o,t,l){if(!e||typeof e!="object")return{ok:!1,path:l,cause:e};let f,c;try{f=Object.getPrototypeOf(e),c=Reflect.ownKeys(e)}catch(S){return{ok:!1,path:l,cause:S}}if(f!==Object.prototype&&f!==null)return{ok:!1,path:l,cause:e};let d=i?new Set(["position","transform","width","height"]):o==="ltr"?new Set(["position","top","left","width","height"]):new Set(["position","top","right","width","height"]),g=Object.create(null);for(let S of c){if(typeof S!="string")return{ok:!1,path:`${l}.<symbol>`,cause:S};if(!Jl.has(S)||!d.has(S))return{ok:!1,path:ir(l,S),cause:e};let x;try{x=Object.getOwnPropertyDescriptor(e,S)}catch(C){return{ok:!1,path:ir(l,S),cause:C}}if(!x||x.enumerable!==!0||!Object.prototype.hasOwnProperty.call(x,"value")||typeof x.value!="string")return{ok:!1,path:ir(l,S),cause:x};g[S]=x.value}let m=i?["transform","width","height"]:o==="ltr"?["top","left","width","height"]:["top","right","width","height"];for(let S of m)if(!Object.prototype.hasOwnProperty.call(g,S))return{ok:!1,path:ir(l,S),cause:e};let b=i?Qr(t,o):gs(t,o);for(let[S,x]of Object.entries(g))if(b[S]!==x)return{ok:!1,path:ir(l,S),cause:x};return{ok:!0,style:g}}function xa(e){return Ql(e)}function Ql(e){let i=e.target?.offsetParent||document.body,o=e.offsetParent===document.body?{left:0,top:0}:i.getBoundingClientRect();return{x:e.clientX+i.scrollLeft-o.left,y:e.clientY+i.scrollTop-o.top}}function Ia(e,i,o,t){return eu(e)?{deltaX:o-e,deltaY:t-i,lastX:e,lastY:i,x:o,y:t}:{deltaX:0,deltaY:0,lastX:o,lastY:t,x:o,y:t}}function eu(e){return typeof e=="number"&&!Number.isNaN(e)}var eo=new Set(["i","x","y","w","h","minW","minH","maxW","maxH","static","isDraggable","isResizable","resizeHandles","autoHeight","zIndex","moved"]),Qe=class{reason;candidate;failure;constructor(i,o=null,t=null){this.reason=i,this.candidate=o,this.failure=t}};function xt(e,i,o="invalid-config"){throw new ue(`Invalid value at ${e}`,{code:o,path:e,cause:i})}function xn(e){return Object.is(e,-0)?0:e}function ri(e){return typeof e=="string"&&e.length>0||typeof e=="number"&&Number.isSafeInteger(e)&&!Object.is(e,-0)}function vi(e,i=!1){return Number.isSafeInteger(e)&&(i?e>0:e>=0)}function Qt(e,i,o){let t=e+i;return(!Number.isSafeInteger(t)||t<0)&&xt(o,t,"invalid-layout"),t}function Sa(e,i){Array.isArray(e)||xt(i,e);let o,t,l;try{Reflect.ownKeys(e).some(d=>typeof d=="symbol"||d!=="0"&&d!=="1"&&d!=="length")&&xt(i,e),o=Reflect.getOwnPropertyDescriptor(e,"length"),t=Reflect.getOwnPropertyDescriptor(e,"0"),l=Reflect.getOwnPropertyDescriptor(e,"1")}catch(d){xt(i,d)}(!o||!("value"in o)||o.value!==2||!t||!t.enumerable||!("value"in t)||!l||!l.enumerable||!("value"in l))&&xt(i,{length:o,first:t,second:l});let f=t.value,c=l.value;return(typeof f!="number"||!Number.isFinite(f)||f<0)&&xt(`${i}[0]`,f),(typeof c!="number"||!Number.isFinite(c)||c<0)&&xt(`${i}[1]`,c),[xn(f),xn(c)]}function Wi(e){(!Number.isSafeInteger(e.cols)||e.cols<=0)&&xt("config.cols",e.cols),e.maxRows!==1/0&&(!Number.isSafeInteger(e.maxRows)||e.maxRows<=0)&&xt("config.maxRows",e.maxRows),(typeof e.rowHeight!="number"||!Number.isFinite(e.rowHeight)||e.rowHeight<0)&&xt("config.rowHeight",e.rowHeight),e.collisionMode!=="push"&&e.collisionMode!=="prevent"&&e.collisionMode!=="overlap"&&xt("config.collisionMode",e.collisionMode);for(let i of["isDraggable","isResizable","restoreOnDrag","bringToFrontOnInteract"])typeof e[i]!="boolean"&&xt(`config.${i}`,e[i]);return{cols:e.cols,rowHeight:xn(e.rowHeight),gap:Sa(e.gap,"config.gap"),containerPadding:Sa(e.containerPadding,"config.containerPadding"),maxRows:e.maxRows,compactor:Xr(e.compactor),collisionMode:e.collisionMode,isDraggable:e.isDraggable,isResizable:e.isResizable,restoreOnDrag:e.restoreOnDrag,bringToFrontOnInteract:e.bringToFrontOnInteract}}function Vi(e,i){return!Object.is(e.i,i.i)&&!(e.x+e.w<=i.x||e.x>=i.x+i.w||e.y+e.h<=i.y||e.y>=i.y+i.h)}function to(e,i){if(Object.is(e,i))return!0;if(Array.isArray(e)||Array.isArray(i))return Array.isArray(e)&&Array.isArray(i)&&e.length===i.length&&e.every((c,d)=>to(c,i[d]));if(typeof e!="object"||!e||typeof i!="object"||!i||Object.getPrototypeOf(e)!==Object.getPrototypeOf(i))return!1;let o=e,t=i,l=Object.keys(o).sort(),f=Object.keys(t).sort();return l.length===f.length&&l.every((c,d)=>c===f[d]&&to(o[c],t[c]))}function Ca(e,i){let o=e;return i==="minW"||i==="minH"?o[i]??1:i==="maxW"||i==="maxH"?o[i]??1/0:i==="static"||i==="autoHeight"?o[i]??!1:i==="zIndex"?o[i]??0:o[i]}function Wo(e,i){for(let o of["i","x","y","w","h","minW","minH","maxW","maxH","static","isDraggable","isResizable","resizeHandles","autoHeight","zIndex"]){let t=Ca(e,o),l=Ca(i,o);if(o==="resizeHandles"?!to(t,l):!Object.is(t,l))return!1}return!0}function ms(e,i){let o=e,t=i,l=new Set([...Object.keys(o).filter(f=>!eo.has(f)),...Object.keys(t).filter(f=>!eo.has(f))]);for(let f of l)if(!Object.hasOwn(o,f)||!Object.hasOwn(t,f)||!to(o[f],t[f]))return!1;return!0}function qr(e,i){return e.length===i.length&&e.every((o,t)=>Wo(o,i[t]))}function en(e,i){return qr(e,i)&&e.every((o,t)=>ms(o,i[t]))}function ka(e,i){return e.cols===i.cols&&e.rowHeight===i.rowHeight&&e.gap[0]===i.gap[0]&&e.gap[1]===i.gap[1]&&e.containerPadding[0]===i.containerPadding[0]&&e.containerPadding[1]===i.containerPadding[1]&&e.maxRows===i.maxRows&&e.compactor.type===i.compactor.type&&e.compactor.compact===i.compactor.compact&&e.compactor.allowOverlap===i.compactor.allowOverlap&&e.collisionMode===i.collisionMode&&e.isDraggable===i.isDraggable&&e.isResizable===i.isResizable&&e.restoreOnDrag===i.restoreOnDrag&&e.bringToFrontOnInteract===i.bringToFrontOnInteract}function bi(e,i){let o=0;for(let g=0;g<e.length;g++){let m=e[g],b=m.y+m.h;if(!Number.isSafeInteger(b)||b<0)throw new ue("Invalid layout extent",{code:"invalid-layout",path:`layout[${g}].y`,cause:{y:m.y,h:m.h}});o=Math.max(o,b)}let t=2*i.containerPadding[1];if(Number.isFinite(t)||xt("config.containerPadding[1]",t),o===0)return{rows:o,height:xn(t)};let l=o*i.rowHeight;Number.isFinite(l)||xt("config.rowHeight",l);let f=t+l;Number.isFinite(f)||xt("config.rowHeight",f);let c=(o-1)*i.gap[1];Number.isFinite(c)||xt("config.gap[1]",c);let d=f+c;return(!Number.isFinite(d)||d<0)&&xt("config.gap[1]",d),{rows:o,height:xn(d)}}function no(e,i,o,t=!1){let l=U(e),f=Wi(i);for(let c=0;c<l.length;c++){let d=l[c],g=d.minW??1,m=d.minH??1,b=d.maxW??1/0,S=d.maxH??1/0,x=Qt(d.x,d.w,`layout[${c}].w`),C=Qt(d.y,d.h,`layout[${c}].y`);(!o&&g>f.cols||d.w<g||d.w>b||!o&&x>f.cols)&&xt(`layout[${c}].w`,d.w,"invalid-layout"),(f.maxRows!==1/0&&m>f.maxRows||d.h<m||d.h>S||f.maxRows!==1/0&&C>f.maxRows)&&xt(`layout[${c}].h`,d.h,"invalid-layout")}if(!t&&f.collisionMode!=="overlap")for(let c=0;c<l.length;c++)for(let d=0;d<c;d++)Vi(l[c],l[d])&&xt(`layout[${c}]`,l[c],"invalid-layout");return bi(l,f),l}function po(e,i){return no(e,i,!1)}function tu(e,i){return no(e,i,!0)}function io(e){return U([e])[0]}function Vo(e,i,o,t,l,f,c){let d=U(l),g=U(f),m=null;if(c&&t!==null)if(o==="remove")m=d.find(b=>Object.is(b.i,t))??io(c);else{let b=g.find(S=>Object.is(S.i,t));m=b&&Wo(b,c)&&ms(b,c)?b:io(c)}return e==="accepted"?{operation:o,id:t,previousLayout:d,layout:g,candidate:m,status:e,reason:"applied"}:e==="unchanged"?{operation:o,id:t,previousLayout:d,layout:g,candidate:m,status:e,reason:"same-value"}:{operation:o,id:t,previousLayout:d,layout:g,candidate:m,status:e,reason:i}}function un(e,i,o,t,l=null){return Vo("rejected",t,e,i,o,o,l)}function Ro(e,i,o){let t=e.minW??1,l=e.minH??1,f=e.maxW??1/0,c=e.maxH??1/0;if(t>o.cols)throw new Qe("out-of-bounds",e);if(o.maxRows!==1/0&&l>o.maxRows)throw new Qe("max-rows",e);try{Qt(e.x,e.w,`layout[${i}].w`)}catch{throw new Qe("invalid-input",e)}try{Qt(e.y,e.h,"layoutItem.y")}catch(d){throw d instanceof ue?new Qe("invalid-input",e,{kind:"geometry",error:d}):d}e.w=Math.min(Math.max(e.w,t),f,o.cols),e.h=Math.min(Math.max(e.h,l),c,o.maxRows),e.x=Math.min(Math.max(xn(e.x),0),o.cols-e.w),e.y=o.maxRows===1/0?Math.max(xn(e.y),0):Math.min(Math.max(xn(e.y),0),o.maxRows-e.h),Qt(e.x,e.w,`layout[${i}].w`);try{Qt(e.y,e.h,"layoutItem.y")}catch(d){throw d instanceof ue?new Qe("invalid-input",e,{kind:"geometry",error:d}):d}return e}function Ea(e,i,o){let t=i.compactor.type??"vertical";return Array.from(e).sort((l,f)=>(t==="horizontal"?l.x-f.x||l.y-f.y:l.y-f.y||l.x-f.x)||o.get(l.i)-o.get(f.i))}function Oa(e,i){let o=Qt(e.x,e.w,"layoutItem.x"),t=Qt(e.y,e.h,"layoutItem.y");if(o>i.cols)throw new Qe("out-of-bounds",e);if(i.maxRows!==1/0&&t>i.maxRows)throw new Qe("max-rows",e)}function nu(e,i,o){let t=new Map(e.map((d,g)=>[d.i,g])),l=e.find(d=>Object.is(d.i,i)),f=[l],c=new Set([l.i]);for(;f.length;){let d=f.shift();c.delete(d.i);let g=Ea(e.filter(m=>!Object.is(m.i,d.i)&&Vi(m,d)),o,t)[0];for(;g;)g.static?((o.compactor.type??"vertical")==="horizontal"?d.x=Qt(g.x,g.w,"layoutItem.x"):d.y=Qt(g.y,g.h,"layoutItem.y"),Oa(d,o)):((o.compactor.type??"vertical")==="horizontal"?g.x=Qt(d.x,d.w,"layoutItem.x"):g.y=Qt(d.y,d.h,"layoutItem.y"),Oa(g,o),c.has(g.i)||(f.push(g),c.add(g.i))),g=Ea(e.filter(m=>!Object.is(m.i,d.i)&&Vi(m,d)),o,t)[0]}return e}function vs(e){return e.some((i,o)=>e.slice(0,o).some(t=>Vi(i,t)))}function iu(e){let i=e.filter(o=>o.static);return i.some((o,t)=>i.slice(0,t).some(l=>Vi(o,l)))}function _i(e,i){let o;try{o=U(e),o.forEach((t,l)=>{Qt(t.x,t.w,`layout[${l}].w`);try{Qt(t.y,t.h,`layout[${l}].y`)}catch(f){throw f instanceof ue?new Qe("invalid-input",t,{kind:"geometry",error:f}):f}})}catch(t){throw t instanceof Qe?t:new Qe("invalid-input")}if(i.collisionMode==="prevent"&&vs(o)||i.collisionMode==="push"&&iu(o))throw new Qe("collision");try{return ds(o,{cols:i.cols,maxRows:i.maxRows,collisionMode:i.collisionMode,compactor:i.compactor.compact===To.compact&&(i.compactor.type??"vertical")==="vertical"?To:i.compactor})}catch(t){if(t instanceof Jt)throw new Qe(t.code,null,{kind:"extension",error:t});if(t instanceof ue){let l=i.compactor.type??"vertical",f=t.path??"";throw new Qe(t.code==="invalid-config"?"invalid-input":f.endsWith(".minW")?"out-of-bounds":f.endsWith(".minH")?"max-rows":/\]\.(x|y|w|h)$/.test(f)?"invalid-input":l==="horizontal"?"out-of-bounds":"max-rows")}throw t}}function ru(e,i,o){let t=e.find(g=>Object.is(g.i,i)),l=Object.hasOwn(t,"static"),f=t.static;t.static=!0;let c=_i(e,o),d=c.find(g=>Object.is(g.i,i));return l?d.static=f:delete d.static,c}function ou(e,i){let o=e.map((t,l)=>({item:t,index:l})).sort((t,l)=>(t.item.zIndex??0)-(l.item.zIndex??0)||t.index-l.index);return Object.is(o.at(-1)?.item.i,i)}function Da(e,i,o,t=!1){let l=e.find(d=>Object.is(d.i,i));if(t&&o==="front"&&ou(e,i))return l;let f=Math.max(...e.map(d=>d.zIndex??0)),c=Math.min(...e.map(d=>d.zIndex??0));return(o==="front"&&f===2**53-1||o==="back"&&c===-9007199254740991)&&(e.map((d,g)=>({item:d,index:g})).sort((d,g)=>(d.item.zIndex??0)-(g.item.zIndex??0)||d.index-g.index).forEach((d,g)=>{d.item.zIndex=g}),f=e.length-1,c=0),l.zIndex=o==="front"?f+1:c-1,l}function au(e,i){let o=U(e),t=new Map(i.map(l=>[l.i,l]));for(let l of o){let f=t.get(l.i);f&&(Object.hasOwn(f,"zIndex")?l.zIndex=f.zIndex:delete l.zIndex)}return o}function hs(e){return e.type==="config"?"set":e.type==="auto-resize"?"resize":e.type}function ys(e){return e.type==="set"||e.type==="config"||e.type==="add"||e.type==="auto-resize"?null:ri(e.id)?e.id:null}function su(e){try{let i=Object.getOwnPropertyDescriptor(e,"i");return i&&"value"in i&&ri(i.value)?i.value:null}catch{return null}}function Pa(e,i,o,t,l=i,f=!1,c=!1){let d=hs(t),g=ys(t),m=null,b=!1,S=o;try{let x;if(t.type==="config"){S=Wi(t.config);let y=o.collisionMode!=="overlap"&&S.collisionMode==="overlap",v=o.collisionMode==="overlap"&&S.collisionMode==="prevent",O=o.cols!==S.cols||o.maxRows!==S.maxRows,z=o.compactor.type!==S.compactor.type||o.compactor.compact!==S.compactor.compact,B=O||S.collisionMode==="push"&&z||o.collisionMode==="overlap"&&S.collisionMode==="push";if(y&&!B)x=U(e);else if(v&&!B){if(vs(e))throw new Qe("collision");x=U(e)}else x=B?_i(e,S):U(e)}else if(t.type==="set")S=t.config?Wi(t.config):o,x=_i(t.layout,S);else if(t.type==="auto-resize"){let y=U(e),v=new Set;for(let O of t.changes){if(!ri(O.id)||!vi(O.h,!0)||v.has(O.id))throw new Qe("invalid-input");v.add(O.id);let z=y.findIndex(H=>Object.is(H.i,O.id));if(z<0)throw new Qe("item-not-found");let B=y[z];B.h=o.maxRows===1/0?O.h:Math.min(O.h,o.maxRows-B.y),Ro(B,z,o)}x=o.collisionMode==="overlap"?y:_i(y,o)}else if(t.type==="remove"){if(!ri(t.id))throw new Qe("invalid-input");g=t.id;let y=U(e),v=y.findIndex(O=>Object.is(O.i,g));if(v<0)throw new Qe("item-not-found");m=io(y[v]),y.splice(v,1),x=o.collisionMode==="push"?_i(y,o):y}else if(t.type==="layer"){if(!ri(t.id))throw new Qe("invalid-input");g=t.id;let y=U(e),v=y.find(O=>Object.is(O.i,g));if(!v)throw new Qe("item-not-found");if(o.collisionMode!=="overlap")throw new Qe("disabled",v);m=Da(y,g,t.direction),x=y}else{let y=U(e);if(t.type==="add"){g=su(t.item);let v=io(t.item);if(y.some(O=>Object.is(O.i,v.i)))throw new Qe("invalid-input");g=v.i,y.push(v),m=Ro(v,y.length-1,o)}else{if(!ri(t.id))throw new Qe("invalid-input");g=t.id;let v=y.findIndex(z=>Object.is(z.i,g));if(v<0)throw new Qe("item-not-found");let O=y[v];if(O.static)throw new Qe("static-item",O);if(t.type==="move"){if(!vi(t.x)||!vi(t.y))throw new Qe("invalid-input");O.x=xn(t.x),O.y=xn(t.y)}else{let z=t.x!==void 0||t.y!==void 0;if(!vi(t.w,!0)||!vi(t.h,!0)||z&&(!vi(t.x)||!vi(t.y)))throw new Qe("invalid-input");z&&(O.x=xn(t.x),O.y=xn(t.y)),O.w=t.w,O.h=t.h}m=Ro(O,v,o),b=Wo(e[v],m)}if(f&&o.collisionMode==="overlap"&&o.bringToFrontOnInteract&&(Da(y,g,"front",!0),m=y.find(v=>Object.is(v.i,g))),b)x=y;else if(o.collisionMode==="prevent"){if(y.some(v=>!Object.is(v.i,g)&&Vi(v,m)))throw new Qe("collision",m);x=y}else if(o.collisionMode==="overlap")x=y;else{try{x=nu(y,g,o)}catch(v){throw v instanceof ue?new Qe("invalid-input",m,{kind:"geometry",error:v}):v}m=x.find(v=>Object.is(v.i,g)),x=c&&t.type==="move"&&o.restoreOnDrag?ru(x,g,o):_i(x,o),m=x.find(v=>Object.is(v.i,g))}}let C;try{C=bi(x,S)}catch(y){throw y instanceof ue?new Qe("invalid-input",m,{kind:"geometry",error:y}):y}let I=en(x,l)?"unchanged":"accepted";return{result:Vo(I,I==="accepted"?"applied":"same-value",d,g,i,x,t.type==="set"||t.type==="config"||t.type==="auto-resize"?null:m),nextLayout:U(x),nextConfig:S,metrics:C,failure:null}}catch(x){let C=x instanceof Qe?x:x instanceof Jt?new Qe(x.code,m,{kind:"extension",error:x}):new Qe("invalid-input",m),I=t.type==="set"||t.type==="config"||t.type==="auto-resize"?null:m??C.candidate,y=bi(i,o);return{result:un(d,g,i,C.reason,I),nextLayout:U(i),nextConfig:o,metrics:y,failure:C.failure}}}function Ii(e,i){let o=U(e),t=U(i),l=new Map(t.map(f=>[f.i,f]));for(let f of o){let c=l.get(f.i);if(!c)continue;let d=f,g=c;for(let m of Object.keys(d))eo.has(m)||delete d[m];for(let m of Object.keys(g))eo.has(m)||uo(d,m,g[m])}return o}function Nr(e){let i=e+1;return(!Number.isSafeInteger(i)||i>=2**53-1)&&xt('config.counter["engineVersion"]',{reason:"counter-exhausted",counter:"engineVersion",limit:2**53-1-1}),i}function bs(e,i,o={}){let t=Wi(i),l=no(e,t,o.deferHorizontalBounds??!1,o.allowInitialCollisions??!1),f=1,c=0,d=null,g=new WeakMap,m=new WeakMap;function b(C,I=f){let y={baseVersion:I,result:C.result,nextConfig:C.nextConfig,metrics:C.metrics,failure:C.failure};return g.set(y,{evaluation:y,nextLayout:C.nextLayout,nextConfig:C.nextConfig,changesConfig:!ka(t,C.nextConfig),state:"pending",finalResult:null}),y}function S(C){C.active&&(C.active=!1,C.workingEvaluation=null,d===C&&(d=null))}function x(C){let I=C.interactionRecord;if(!I?.active||I.workingEvaluation!==C.evaluation||!C.previousWorking)return;let y=C.previousWorking,v=C.previousLayerIntent,O=C.previousWorkingEvaluation,z=O?g.get(O):void 0;for(;z?.state==="rolled-back"&&z.previousWorking;)y=z.previousWorking,v=z.previousLayerIntent,O=z.previousWorkingEvaluation,z=O?g.get(O):void 0;I.latestWorking=U(y),I.layerIntent=v??I.layerIntent,I.workingEvaluation=O&&z?.state==="pending"?O:null}return{evaluate(C){let I=f;return d&&C.type!=="config"?b({result:un(hs(C),ys(C),l,"interaction-active"),nextLayout:U(l),nextConfig:t,metrics:bi(l,t),failure:null},I):b(Pa(l,l,t,C),I)},beginInteraction(C){if(d)return{status:"rejected",result:un(C.type==="drag"?"move":"resize",ri(C.id)?C.id:null,l,"interaction-active")};let I=C.type==="drag"?"move":"resize";if(!ri(C.id))return{status:"rejected",result:un(I,null,l,"invalid-input")};let y=l.find(z=>Object.is(z.i,C.id));if(!y)return{status:"rejected",result:un(I,C.id,l,"item-not-found")};if(y.static)return{status:"rejected",result:un(I,C.id,l,"static-item",y)};if(!(C.type==="drag"?y.isDraggable??t.isDraggable:y.isResizable??t.isResizable))return{status:"rejected",result:un(I,C.id,l,"disabled",y)};c=Nr(c);let v={sessionId:c,beginVersion:f,baseLayout:U(l),baseConfig:t},O={session:v,type:C.type,id:C.id,baseLayout:U(l),latestWorking:U(l),workingEvaluation:null,active:!0,layerIntent:t.collisionMode==="overlap"&&t.bringToFrontOnInteract};return m.set(v,O),d=O,{status:"accepted",session:v}},evaluateInteraction(C,I){let y=f,v=t,O=m.get(C),z=I.type==="drag"?"move":"resize";if(!O||!O.active||d!==O)return b({result:un(z,null,l,"cancelled"),nextLayout:U(l),nextConfig:t,metrics:bi(l,t),failure:null},y);if(O.type!==I.type)return b({result:un(z,O.id,l,"invalid-input"),nextLayout:U(l),nextConfig:t,metrics:bi(l,t),failure:null},y);let B=I.type==="drag"?{type:"move",id:O.id,x:I.x,y:I.y}:{type:"resize",id:O.id,...I.x===void 0?{}:{x:I.x},...I.y===void 0?{}:{y:I.y},w:I.w,h:I.h},H=U(O.latestWorking),F=O.workingEvaluation,J=O.layerIntent,R=Pa(O.session.baseConfig.collisionMode==="overlap"&&!O.layerIntent?au(O.baseLayout,O.latestWorking):O.baseLayout,l,O.session.baseConfig,B,O.latestWorking,O.layerIntent,I.terminal!==!0),W={...R,nextConfig:v,metrics:bi(R.nextLayout,v)},G=b(W,y);if(W.result.status==="accepted"){O.latestWorking=U(W.nextLayout),O.workingEvaluation=G,O.layerIntent=!1;let te=g.get(G);te.interactionRecord=O,te.previousWorking=H,te.previousWorkingEvaluation=F,te.previousLayerIntent=J}return G},closeInteraction(C){let I=m.get(C);I&&S(I)},replaceExternal(C,I,y={}){let v,O;try{v=Wi(I),O=no(C,v,y.deferHorizontalBounds??!1)}catch{return un("set",null,l,"invalid-input")}d&&S(d);let z=!en(O,l)||!ka(v,t),B=Vo(z?"accepted":"unchanged",z?"applied":"same-value","set",null,l,O,null);return z&&(l=U(O),t=v,f=Nr(f)),B},mergeExternalMetadata(C){let I=Ii(l,C);return l=I,d&&(d.baseLayout=Ii(d.baseLayout,I),d.latestWorking=Ii(d.latestWorking,I)),f=Nr(f),U(l)},confirm(C){let I=g.get(C);return I?I.state==="pending"?C.baseVersion===f?C.result.status==="rejected"?(x(I),I.state="rolled-back",I.finalResult=C.result,I.finalResult):((C.result.status==="accepted"||I.changesConfig)&&(l=U(I.nextLayout),t=I.nextConfig,f=Nr(f)),I.interactionRecord?.workingEvaluation===C&&(I.interactionRecord.workingEvaluation=null),I.state="confirmed",I.finalResult=C.result,I.finalResult):(x(I),I.state="rolled-back",I.finalResult=un(C.result.operation,C.result.id,l,"superseded"),I.finalResult):I.finalResult:un("set",null,l,"superseded")},rollback(C){let I=g.get(C);return I?.state==="pending"&&(x(I),I.state="rolled-back",I.finalResult=un(C.result.operation,C.result.id,l,"cancelled")),U(l)}}}function lu(e,i,o={}){return bs(e,i,{deferHorizontalBounds:o.deferHorizontalBounds})}function uu(e,i){let o=bs(e,i,{allowInitialCollisions:!0}),t=o.evaluate({type:"set",layout:e});if(t.result.status==="rejected")throw o.rollback(t),t.failure?t.failure.error:new ue("Initial layout normalization failed",{code:"invalid-layout",path:"layout",cause:t.result});let l=o.confirm(t);if(l.status==="rejected")throw new ue("Initial layout normalization was superseded",{code:"invalid-layout",path:"layout",cause:l});return{engine:o,layout:U(l.layout),metrics:t.metrics,changed:l.status==="accepted"}}var cu=new Set(["__proto__","prototype","constructor"]);function wi(e,i){throw new ue(`Invalid responsive value at ${e}`,{code:"invalid-config",path:e,cause:i})}function ai(){return Object.create(null)}function dn(e,i){return`${e}[${JSON.stringify(i)}]`}function Ni(e,i){(e.length===0||cu.has(e))&&wi(dn(i,e),e)}function du(e,i){return e.length===i.length&&e.every(o=>i.includes(o))&&i.every(o=>e.includes(o))}function Si(e){return Object.freeze(e)}function sr(e,i){let o=It(e,{code:"invalid-config",path:"config.breakpoints"}),t=It(i,{code:"invalid-config",path:"config.cols"}),l=Object.keys(o),f=Object.keys(t);if(l.length===0&&wi("config.breakpoints",e),!du(l,f)){let b=l.find(C=>!f.includes(C)),S=f.find(C=>!l.includes(C)),x=b??S;wi(dn(b?"config.cols":"config.breakpoints",x),x)}let c=ai(),d=ai(),g=new Set;for(let b of l){Ni(b,"config.breakpoints");let S=o[b];ts(S,dn("config.breakpoints",b)),g.has(S)&&wi(dn("config.breakpoints",b),S),g.add(S),c[b]=Object.is(S,-0)?0:S,Ni(b,"config.cols");let x=t[b];ki(x,dn("config.cols",b)),d[b]=x}g.has(0)||wi("config.breakpoints",e);let m=[...l].sort((b,S)=>c[b]-c[S]);return Object.freeze({breakpoints:Si(c),cols:Si(d),keys:Object.freeze([...l]),sorted:Object.freeze(m)})}function si(e,i,o){let t=It(e,{code:"invalid-config",path:"responsiveLayouts"}),l=ai();for(let f of Object.keys(t)){Ni(f,"responsiveLayouts"),i.keys.includes(f)||wi(dn("responsiveLayouts",f),f);try{l[f]=Object.freeze(po(t[f],{cols:i.cols[f],maxRows:o.maxRows,collisionMode:o.collisionMode,compactor:o.compactor,rowHeight:0,gap:[0,0],containerPadding:[0,0],isDraggable:!0,isResizable:!0,restoreOnDrag:!1,bringToFrontOnInteract:!0}))}catch(c){throw!(c instanceof ue)||!c.path.startsWith("layout")?c:new ue(c.message,{code:c.code,path:`${dn("responsiveLayouts",f)}${c.path.slice(6)}`,cause:c.cause})}}return Si(l)}function ws(e,i,o){let t=It(e,{code:"invalid-config",path:"config.breakpoints"}),l=It(i,{code:"invalid-config",path:"config.cols"}),f=It(o,{code:"invalid-config",path:"responsiveLayouts"}),c=ai(),d=ai(),g=ai();for(let m of Object.keys(t)){Ni(m,"config.breakpoints");let b=t[m];ts(b,dn("config.breakpoints",m)),c[m]=Object.is(b,-0)?0:b}for(let m of Object.keys(l)){Ni(m,"config.cols");let b=l[m];ki(b,dn("config.cols",m)),d[m]=b}for(let m of Object.keys(f)){Ni(m,"responsiveLayouts");try{g[m]=Object.freeze(U(f[m]))}catch(b){throw!(b instanceof ue)||!b.path.startsWith("layout")?b:new ue(b.message,{code:b.code,path:`${dn("responsiveLayouts",m)}${b.path.slice(6)}`,cause:b.cause})}}return Object.freeze({breakpoints:Si(c),cols:Si(d),layouts:Si(g)})}function ei(e){let i=ai();for(let o of Object.keys(e)){let t=e[o];t&&(i[o]=U(t))}return i}function fu(e,i,o){let t=o.sorted.indexOf(e);for(let l=t+1;l<o.sorted.length;l++){let f=o.sorted[l],c=i[f];if(c)return{key:f,layout:c}}for(let l=t-1;l>=0;l--){let f=o.sorted[l],c=i[f];if(c)return{key:f,layout:c}}return null}function pu(e,i,o,t,l){try{return ds(e,{cols:t.cols[o],maxRows:l.maxRows,collisionMode:l.collisionMode,compactor:l.compactor})}catch(f){if(!(f instanceof ue)||!f.path.startsWith("layout"))throw f;let c=/^layout\[(\d+)\]/.exec(f.path);throw f.path.endsWith(".minW")&&c?new ue(f.message,{code:"invalid-config",path:dn("config.cols",o),cause:U([e[Number(c[1])]])[0]}):new ue(f.message,{code:f.code,path:`${i}${f.path.slice(6)}`,cause:f.cause})}}function Ra(e,i,o,t,l="initialFallback"){let f=ai();for(let c of o.keys){let d=e[c];if(d){f[c]=Object.freeze(U(d));continue}let g=fu(c,e,o),m=g?.layout??i,b=g?dn("responsiveLayouts",g.key):l;f[c]=Object.freeze(pu(m,b,c,o,t))}return Si(f)}function ro(e,i){let o=mu(e),t=o[0];for(let l=1;l<o.length;l++){let f=o[l];i>=e[f]&&(t=f)}return t}function gu(e,i){let o=i[e];return o||wi(dn("config.cols",e),o),o}function mu(e){return Object.keys(e).sort((i,o)=>e[i]-e[o])}function vu(){return typeof document<"u"}function jo(){return vu()?document.dir===void 0?document.getElementsByTagName("html")[0].getAttribute("dir"):document.dir:"auto"}var xs=new Set(["mouseButtons","hold","autoScroll"]),hu=new Set(["lockAxis","startAxis",...xs]);function hi(e,i){throw new ue(`Invalid GridItem interaction option at ${e}`,{code:"invalid-config",path:e,cause:i})}function Hr(e,i){return i===void 0?`gridItem.${e}`:typeof i=="symbol"?`gridItem.${e}.<symbol>`:`gridItem.${e}[${JSON.stringify(i)}]`}function yu(e,i,o){return i==="lockAxis"?e==="dragOption"&&["x","y","xy","start"].includes(o):i==="startAxis"?e==="dragOption"&&["x","y","xy"].includes(o):i==="mouseButtons"?Number.isSafeInteger(o)&&o>=0:i==="hold"?typeof o=="number"&&Number.isFinite(o)&&o>=0:i==="autoScroll"&&typeof o=="boolean"}function Br(e,i){if(typeof e!="object"||!e||Array.isArray(e))return hi(Hr(i),{reason:"not-plain-object",value:e});let o,t;try{o=Object.getPrototypeOf(e),t=Reflect.ownKeys(e)}catch(c){return hi(Hr(i),c)}if(o!==Object.prototype&&o!==null)return hi(Hr(i),{reason:"custom-prototype",prototype:o});let l=i==="dragOption"?hu:xs,f=Object.create(null);for(let c of t){let d=Hr(i,c);if(typeof c!="string"||!l.has(c))return hi(d,{key:c});let g;try{g=Object.getOwnPropertyDescriptor(e,c)}catch(m){return hi(d,m)}if(!g||!g.enumerable||!Object.hasOwn(g,"value"))return hi(d,{reason:"invalid-descriptor",descriptor:g});if(!yu(i,c,g.value))return hi(d,{reason:"invalid-value",value:g.value});f[c]=g.value}return Object.freeze(f)}function Ai(e,i){let o=`gridItem.${i}`;if(e!==void 0&&e!==""){if(typeof e!="string")throw new ue(`Invalid GridItem selector at ${o}`,{code:"invalid-config",path:o,cause:{reason:"invalid-selector-type",value:e}});if(typeof document<"u")try{document.documentElement.matches(e)}catch(t){throw new ue(`Invalid GridItem selector at ${o}`,{code:"invalid-config",path:o,cause:t})}return e}}const bu=typeof window<"u";var za;bu&&((za=window?.navigator)!=null&&za.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Wr(e){return e==null}const wu=Object.freeze({aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",san