@object-ui/plugin-kanban 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { j as e, P as Q } from "./index-CyNcIIS1.js";
1
+ import { j as e, P as Q } from "./index-DP2mI15e.js";
2
2
  import * as p from "react";
3
3
  import { u as F, a as V, D as ee, c as se, S as _, v as H, b as te, d as re, T as ae, P as ne, e as J, C as ie } from "./sortable.esm-CNNHgHk5.js";
4
4
  import { Card as oe, CardHeader as le, CardTitle as de, CardDescription as ce, CardContent as ue, Badge as T, ScrollArea as me, Button as fe, Input as xe } from "@object-ui/components";
@@ -828,7 +828,7 @@ function Qe(e, r) {
828
828
  if (e[n].id !== r[n].id) return !1;
829
829
  return !0;
830
830
  }
831
- const He = M.lazy(() => import("./KanbanImpl-4dgoNPtI.js")), ve = M.lazy(() => import("./KanbanEnhanced-CXDSLlGR.js")), H = ({ schema: e }) => {
831
+ const He = M.lazy(() => import("./KanbanImpl-BnNosFpy.js")), ve = M.lazy(() => import("./KanbanEnhanced-DbOkJkpo.js")), H = ({ schema: e }) => {
832
832
  const r = M.useMemo(() => {
833
833
  const { columns: n = [], data: o, groupBy: i, coverImageField: a } = e, l = (s) => {
834
834
  if (!a) return s;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as d, I as t, K as i, O as m, b, k as p, u, d as c, e as k } from "./index-CyNcIIS1.js";
1
+ import { a as d, I as t, K as i, O as m, b, k as p, u, d as c, e as k } from "./index-DP2mI15e.js";
2
2
  import "react";
3
3
  import "@object-ui/core";
4
4
  import "@object-ui/react";
@@ -1,13 +1,13 @@
1
- (function(U,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react"),require("@object-ui/core"),require("@object-ui/react"),require("@object-ui/components"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@object-ui/core","@object-ui/react","@object-ui/components","react-dom"],u):(U=typeof globalThis<"u"?globalThis:U||self,u(U.ObjectUIPluginKanban={},U.React,U.ObjectUICore,U.ObjectUIReact,U.ObjectUIComponents,U.ReactDOM))})(this,(function(U,u,Ee,Re,F,Ne){"use strict";function ar(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const _=ar(u);var et={exports:{}},Pe={};var Xt;function lr(){if(Xt)return Pe;Xt=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var a in s)a!=="key"&&(o[a]=s[a])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:o}}return Pe.Fragment=n,Pe.jsx=t,Pe.jsxs=t,Pe}var Fe={};var Ht;function cr(){return Ht||(Ht=1,process.env.NODE_ENV!=="production"&&(function(){function e(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===D?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case v:return"Fragment";case j:return"Profiler";case k:return"StrictMode";case x:return"Suspense";case C:return"SuspenseList";case w:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case b:return"Portal";case A:return m.displayName||"Context";case T:return(m._context.displayName||"Context")+".Consumer";case S:var N=m.render;return m=m.displayName,m||(m=N.displayName||N.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case y:return N=m.displayName||null,N!==null?N:e(m.type)||"Memo";case I:N=m._payload,m=m._init;try{return e(m(N))}catch{}}return null}function n(m){return""+m}function t(m){try{n(m);var N=!1}catch{N=!0}if(N){N=console;var z=N.error,L=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return z.call(N,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",L),n(m)}}function r(m){if(m===v)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===I)return"<...>";try{var N=e(m);return N?"<"+N+">":"<...>"}catch{return"<...>"}}function s(){var m=O.A;return m===null?null:m.getOwner()}function o(){return Error("react-stack-top-frame")}function i(m){if(M.call(m,"key")){var N=Object.getOwnPropertyDescriptor(m,"key").get;if(N&&N.isReactWarning)return!1}return m.key!==void 0}function a(m,N){function z(){K||(K=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",N))}z.isReactWarning=!0,Object.defineProperty(m,"key",{get:z,configurable:!0})}function l(){var m=e(this.type);return $[m]||($[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function c(m,N,z,L,ue,G){var W=z.ref;return m={$$typeof:E,type:m,key:N,props:z,_owner:L},(W!==void 0?W:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:l}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function d(m,N,z,L,ue,G){var W=N.children;if(W!==void 0)if(L)if(V(W)){for(L=0;L<W.length;L++)f(W[L]);Object.freeze&&Object.freeze(W)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(W);if(M.call(N,"key")){W=e(m);var ee=Object.keys(N).filter(function(B){return B!=="key"});L=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",ce[W+L]||(ee=0<ee.length?"{"+ee.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(q,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react"),require("@object-ui/core"),require("@object-ui/react"),require("@object-ui/components"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@object-ui/core","@object-ui/react","@object-ui/components","react-dom"],u):(q=typeof globalThis<"u"?globalThis:q||self,u(q.ObjectUIPluginKanban={},q.React,q.ObjectUICore,q.ObjectUIReact,q.ObjectUIComponents,q.ReactDOM))})(this,(function(q,u,Ee,Le,F,Ne){"use strict";function ar(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const _=ar(u);var et={exports:{}},Pe={};var Xt;function lr(){if(Xt)return Pe;Xt=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function t(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var a in s)a!=="key"&&(o[a]=s[a])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:o}}return Pe.Fragment=n,Pe.jsx=t,Pe.jsxs=t,Pe}var Fe={};var Ht;function cr(){return Ht||(Ht=1,process.env.NODE_ENV!=="production"&&(function(){function e(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===D?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case v:return"Fragment";case j:return"Profiler";case k:return"StrictMode";case x:return"Suspense";case C:return"SuspenseList";case w:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case b:return"Portal";case A:return m.displayName||"Context";case I:return(m._context.displayName||"Context")+".Consumer";case S:var E=m.render;return m=m.displayName,m||(m=E.displayName||E.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case y:return E=m.displayName||null,E!==null?E:e(m.type)||"Memo";case M:E=m._payload,m=m._init;try{return e(m(E))}catch{}}return null}function n(m){return""+m}function t(m){try{n(m);var E=!1}catch{E=!0}if(E){E=console;var R=E.error,z=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return R.call(E,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",z),n(m)}}function r(m){if(m===v)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===M)return"<...>";try{var E=e(m);return E?"<"+E+">":"<...>"}catch{return"<...>"}}function s(){var m=O.A;return m===null?null:m.getOwner()}function o(){return Error("react-stack-top-frame")}function i(m){if(T.call(m,"key")){var E=Object.getOwnPropertyDescriptor(m,"key").get;if(E&&E.isReactWarning)return!1}return m.key!==void 0}function a(m,E){function R(){K||(K=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",E))}R.isReactWarning=!0,Object.defineProperty(m,"key",{get:R,configurable:!0})}function l(){var m=e(this.type);return $[m]||($[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function c(m,E,R,z,ue,G){var W=R.ref;return m={$$typeof:N,type:m,key:E,props:R,_owner:z},(W!==void 0?W:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:l}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ue}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function d(m,E,R,z,ue,G){var W=E.children;if(W!==void 0)if(z)if(V(W)){for(z=0;z<W.length;z++)f(W[z]);Object.freeze&&Object.freeze(W)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else f(W);if(T.call(E,"key")){W=e(m);var ee=Object.keys(E).filter(function(B){return B!=="key"});z=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",ce[W+z]||(ee=0<ee.length?"{"+ee.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,L,W,ee,W),ce[W+L]=!0)}if(W=null,z!==void 0&&(t(z),W=""+z),i(N)&&(t(N.key),W=""+N.key),"key"in N){z={};for(var te in N)te!=="key"&&(z[te]=N[te])}else z=N;return W&&a(z,typeof m=="function"?m.displayName||m.name||"Unknown":m),c(m,W,z,s(),ue,G)}function f(m){h(m)?m._store&&(m._store.validated=1):typeof m=="object"&&m!==null&&m.$$typeof===I&&(m._payload.status==="fulfilled"?h(m._payload.value)&&m._payload.value._store&&(m._payload.value._store.validated=1):m._store&&(m._store.validated=1))}function h(m){return typeof m=="object"&&m!==null&&m.$$typeof===E}var p=u,E=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),A=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),O=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,V=Array.isArray,P=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(m){return m()}};var K,$={},q=p.react_stack_bottom_frame.bind(p,o)(),Y=P(r(o)),ce={};Fe.Fragment=v,Fe.jsx=function(m,N,z){var L=1e4>O.recentlyCreatedOwnerStacks++;return d(m,N,z,!1,L?Error("react-stack-top-frame"):q,L?P(r(m)):Y)},Fe.jsxs=function(m,N,z){var L=1e4>O.recentlyCreatedOwnerStacks++;return d(m,N,z,!0,L?Error("react-stack-top-frame"):q,L?P(r(m)):Y)}})()),Fe}var Jt;function ur(){return Jt||(Jt=1,process.env.NODE_ENV==="production"?et.exports=lr():et.exports=cr()),et.exports}var g=ur();const St=({schema:e,dataSource:n,className:t,onRowClick:r,onCardClick:s,...o})=>{const[i,a]=u.useState([]),[l,c]=u.useState(null),[d,f]=u.useState(!1),[h,p]=u.useState(null),E=Re.useDataScope(e.bind);u.useEffect(()=>{let x=!0;return(async()=>{if(!(!n||!e.objectName))try{const y=await n.getObjectSchema(e.objectName);x&&c(y)}catch(y){console.warn("Failed to fetch object def",y)}})(),()=>{x=!1}},[e.objectName,n]),u.useEffect(()=>{let x=!0;const C=async()=>{if(!(!n||typeof n.find!="function"||!e.objectName)){x&&f(!0);try{const y=Ee.buildExpandFields(l?.fields),I=await n.find(e.objectName,{options:{$top:100},$filter:e.filter,...y.length>0?{$expand:y}:{}}),w=Ee.extractRecords(I);console.log(`[ObjectKanban] Extracted data (length: ${w.length})`),x&&a(w)}catch(y){console.error("[ObjectKanban] Fetch error:",y),x&&p(y)}finally{x&&f(!1)}}};return e.objectName&&!E&&!e.data&&!o.data&&C(),()=>{x=!1}},[e.objectName,n,E,e.data,e.filter,o.data,l]);const b=o.data||E||e.data||i,v=u.useMemo(()=>{if(!Array.isArray(b))return[];let x=e.cardTitle||e.titleField;if(!x&&l){if(l.titleFormat){const y=/\{(.+?)\}/.exec(l.titleFormat);y&&(x=y[1])}!x&&l.NAME_FIELD_KEY&&(x=l.NAME_FIELD_KEY)}const C=["name","title","subject","label","display_name"];return b.map(y=>{let I=x?y[x]:void 0;if(!I){for(const w of C)if(y[w]){I=y[w];break}}return{...y,id:y.id||y._id,title:I||"Untitled"}})},[b,e,l]),k=u.useMemo(()=>{if(e.columns&&e.columns.length>0)if(typeof e.columns[0]=="string"){if(!e.groupBy)return e.columns.map(x=>({id:x,title:x}))}else return e.columns;if(e.groupBy&&l?.fields?.[e.groupBy]?.options)return l.fields[e.groupBy].options.map(x=>({id:x.value,title:x.label}));if(e.groupBy&&v.length>0){const x=new Set(v.map(C=>C[e.groupBy]));return Array.from(x).map(C=>({id:String(C),title:String(C)}))}return[]},[e.columns,e.groupBy,v,l]),j=e.swimlaneField||e.grouping?.fields?.[0]?.field,T={...e,data:v,columns:k,className:t||e.className,...j?{swimlaneField:j}:{}},A=Re.useNavigationOverlay({navigation:e.navigation,objectName:e.objectName,onRowClick:r??s});if(h)return g.jsxs("div",{className:"p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive",children:["Error loading kanban data: ",h.message]});const S=e.objectName?`${e.objectName.charAt(0).toUpperCase()+e.objectName.slice(1).replace(/_/g," ")} Detail`:"Card Details";return g.jsxs(g.Fragment,{children:[g.jsx(nt,{schema:{...T,onCardClick:x=>{A.handleClick(x),s?.(x)}}}),A.isOverlay&&g.jsx(F.NavigationOverlay,{...A,title:S,children:x=>g.jsx("div",{className:"space-y-3",children:Object.entries(x).map(([C,y])=>g.jsxs("div",{className:"flex flex-col",children:[g.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:C.replace(/_/g," ")}),g.jsx("span",{className:"text-sm",children:String(y??"—")})]},C))})})]})};const Gt=(...e)=>e.filter((n,t,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===t).join(" ").trim();const dr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const fr=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,t,r)=>r?r.toUpperCase():t.toLowerCase());const Qt=e=>{const n=fr(e);return n.charAt(0).toUpperCase()+n.slice(1)};var hr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const gr=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const mr=u.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...a},l)=>u.createElement("svg",{ref:l,...hr,width:n,height:n,stroke:e,strokeWidth:r?Number(t)*24/Number(n):t,className:Gt("lucide",s),...!o&&!gr(a)&&{"aria-hidden":"true"},...a},[...i.map(([c,d])=>u.createElement(c,d)),...Array.isArray(o)?o:[o]]));const Se=(e,n)=>{const t=u.forwardRef(({className:r,...s},o)=>u.createElement(mr,{ref:o,iconNode:n,className:Gt(`lucide-${dr(Qt(e))}`,`lucide-${e}`,r),...s}));return t.displayName=Qt(e),t};const pr=Se("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Zt=Se("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const vr=Se("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const br=Se("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const tt=Se("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const xr=Se("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const yr=Se("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wr=(...e)=>e.filter(Boolean).join(" "),Cr=({columnId:e,fields:n,onSubmit:t,onCancel:r,defaultValues:s})=>{const[o,i]=_.useState(()=>{const f={};for(const h of n)f[h.name]=s?.[h.name]??h.defaultValue??"";return f}),a=_.useRef(null);_.useEffect(()=>{const f=setTimeout(()=>a.current?.focus(),0);return()=>clearTimeout(f)},[]);const l=_.useCallback((f,h)=>{i(p=>({...p,[f]:h}))},[]),c=_.useCallback(()=>{Object.values(o).some(h=>typeof h=="string"?h.trim().length>0:h!=null)&&t(e,o)},[e,o,t]),d=_.useCallback(f=>{f.key==="Enter"?(f.preventDefault(),c()):f.key==="Escape"&&(f.preventDefault(),r())},[c,r]);return g.jsxs("div",{className:"mt-2 rounded-lg border border-primary/30 bg-card p-3 space-y-2 shadow-sm",onKeyDown:d,role:"form","aria-label":"Quick add card",children:[n.map((f,h)=>g.jsxs("div",{className:"space-y-1",children:[g.jsx("label",{htmlFor:`qa-${e}-${f.name}`,className:"text-xs font-mono text-muted-foreground",children:f.label??f.name}),Sr(f,o[f.name],l,h===0?a:void 0,`qa-${e}-${f.name}`)]},f.name)),g.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[g.jsxs(F.Button,{type:"button",size:"sm",className:"h-7 text-xs gap-1",onClick:c,children:[g.jsx(pr,{className:"h-3 w-3"}),"Save"]}),g.jsxs(F.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1",onClick:r,children:[g.jsx(yr,{className:"h-3 w-3"}),"Cancel"]})]})]})};function Sr(e,n,t,r,s){const o="text-sm h-8";switch(e.type){case"select":return g.jsxs("select",{ref:r,id:s,value:n??"",onChange:i=>t(e.name,i.target.value),className:wr(o,"w-full rounded-md border border-input bg-background px-2 py-1 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[g.jsx("option",{value:"",children:e.placeholder??`Select ${e.label??e.name}...`}),(e.options??[]).map(i=>g.jsx("option",{value:i.value,children:i.label},i.value))]});case"number":return g.jsx(F.Input,{ref:r,id:s,type:"number",value:n??"",onChange:i=>t(e.name,i.target.value===""?"":Number(i.target.value)),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:o});default:return g.jsx(F.Input,{ref:r,id:s,type:"text",value:n??"",onChange:i=>t(e.name,i.target.value),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:o})}}const Er=(...e)=>e.filter(Boolean).join(" "),Nr=({templates:e,onSelect:n,columnId:t})=>{const[r,s]=_.useState(!1),o=_.useRef(null);_.useEffect(()=>{if(!r)return;const a=l=>{o.current&&!o.current.contains(l.target)&&s(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[r]);const i=_.useCallback(a=>{a.key==="Escape"&&s(!1)},[]);return g.jsxs("div",{ref:o,className:"relative",onKeyDown:i,children:[g.jsxs(F.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground gap-1",onClick:()=>s(a=>!a),"aria-haspopup":"listbox","aria-expanded":r,"aria-label":`Add card to ${t}`,children:[g.jsx(tt,{className:"h-4 w-4"}),"Add Card",g.jsx(Zt,{className:Er("h-3 w-3 transition-transform",r?"rotate-180":"")})]}),r&&g.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-popover p-1 shadow-md",role:"listbox","aria-label":"Card templates",children:[g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",role:"option","aria-selected":!1,onClick:()=>{n(null),s(!1)},children:[g.jsx(tt,{className:"h-4 w-4 text-muted-foreground"}),g.jsx("span",{className:"font-mono text-xs",children:"Custom"})]}),e.length>0&&g.jsx("div",{className:"my-1 h-px bg-border",role:"separator"}),e.map(a=>g.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",role:"option","aria-selected":!1,onClick:()=>{n(a),s(!1)},children:[g.jsx(br,{className:"h-4 w-4 text-muted-foreground"}),g.jsx("span",{className:"font-mono text-xs truncate",children:a.name})]},a.id))]})]})},en="objectui:kanban-column-widths";function Dr(e){try{const n=localStorage.getItem(e);if(n){const t=JSON.parse(n);if(t&&typeof t=="object"&&!Array.isArray(t))return t}}catch{}return{}}function jr(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function kr({columns:e,defaultWidth:n=320,minWidth:t=200,maxWidth:r=600,storageKey:s}){const o=s?`${en}:${s}`:en,[i,a]=u.useState(()=>Dr(o)),l=u.useCallback(p=>Math.max(t,Math.min(r,p)),[t,r]),c=u.useCallback(p=>{const E=i[p];return E!=null?l(E):n},[i,n,l]),d=u.useCallback((p,E)=>{const b=l(E);a(v=>{const k={...v,[p]:b};return jr(o,k),k})},[l,o]),f=u.useCallback(()=>{a({});try{localStorage.removeItem(o)}catch{}},[o]),h=u.useMemo(()=>({defaultWidth:n,minWidth:t,maxWidth:r,overrides:{...i}}),[n,t,r,i]);return{getColumnWidth:c,setColumnWidth:d,resetWidths:f,config:h}}function Or({swimlanes:e,onCardMove:n}){const[t,r]=u.useState(null),s=u.useMemo(()=>{const d=new Map;for(const f of e)d.set(f.id,f);return d},[e]),o=u.useCallback((d,f)=>{if(d===f)return!0;const h=s.get(f);return h?h.acceptFrom?h.acceptFrom.includes(d):!0:!1},[s]),i=u.useCallback((d,f,h,p)=>o(f,h)?(n?.({cardId:d,fromSwimlane:f,toSwimlane:h,columnId:p}),r(null),!0):!1,[o,n]),a=u.useCallback(d=>{r(d)},[]),l=u.useCallback(()=>{r(null)},[]);return{handleCrossSwimlaneMove:i,isDraggingAcrossSwimlanes:t!==null,startCrossSwimlaneDrag:a,endCrossSwimlaneDrag:l,canMoveTo:o}}function Ar({cards:e,onReorderComplete:n}){const[t,r]=u.useState(e),[s,o]=u.useState(!1);!Tr(t,e)&&!s&&r(e);const i=u.useCallback(()=>{r(e),o(!1)},[e]),a=u.useCallback((d,f)=>{r(h=>{if(d<0||f<0||d>=h.length||f>=h.length)return h;const p=[...h],[E]=p.splice(d,1);return p.splice(f,0,E),p})},[]),l=u.useCallback(()=>{o(!0)},[]),c=u.useCallback(()=>{o(!1),r(d=>(n?.(d),d))},[n]);return{reorderedCards:t,onReorder:a,isDragging:s,startDrag:l,endDrag:c,reset:i}}function Tr(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].id!==n[t].id)return!1;return!0}const Ir=u.lazy(()=>Promise.resolve().then(()=>Eo)),tn=u.lazy(()=>Promise.resolve().then(()=>Bo)),nt=({schema:e})=>{const n=u.useMemo(()=>{const{columns:t=[],data:r,groupBy:s,coverImageField:o}=e,i=a=>{if(!o)return a;const l=a[o];if(!l)return a;const c=typeof l=="string"?l:l?.url;return c?{...a,coverImage:c}:a};if(r&&s&&Array.isArray(r)){const a={};t.forEach(c=>{c.id&&(a[String(c.id).toLowerCase()]=c.id),c.title&&(a[String(c.title).toLowerCase()]=c.id)});const l=r.reduce((c,d)=>{const f=String(d[s]??""),h=a[f.toLowerCase()]??f;return c[h]||(c[h]=[]),c[h].push(i(d)),c},{});return t.map(c=>({...c,cards:[...(c.cards||[]).map(i),...l[c.id]||[]]}))}return t.map(a=>({...a,cards:(a.cards||[]).map(i)}))},[e]);return g.jsx(u.Suspense,{fallback:g.jsx(F.Skeleton,{className:"w-full h-[600px]"}),children:g.jsx(Ir,{columns:n,onCardMove:e.onCardMove,onCardClick:e.onCardClick,className:e.className,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd,coverImageField:e.coverImageField,conditionalFormatting:e.conditionalFormatting,swimlaneField:e.swimlaneField})})};Ee.ComponentRegistry.register("kanban-ui",nt,{namespace:"plugin-kanban",label:"Kanban Board",icon:"LayoutDashboard",category:"plugin",inputs:[{name:"columns",type:"array",label:"Columns",description:"Array of { id, title, cards, limit, className }",required:!0},{name:"onCardMove",type:"code",label:"On Card Move",description:"Callback when a card is moved",advanced:!0},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:[{id:"todo",title:"To Do",cards:[{id:"card-1",title:"Task 1",description:"This is the first task",badges:[{label:"High Priority",variant:"destructive"},{label:"Feature",variant:"default"}]},{id:"card-2",title:"Task 2",description:"This is the second task",badges:[{label:"Bug",variant:"destructive"}]}]},{id:"in-progress",title:"In Progress",limit:3,cards:[{id:"card-3",title:"Task 3",description:"Currently working on this",badges:[{label:"In Progress",variant:"default"}]}]},{id:"done",title:"Done",cards:[{id:"card-4",title:"Task 4",description:"This task is completed",badges:[{label:"Completed",variant:"outline"}]},{id:"card-5",title:"Task 5",description:"Another completed task",badges:[{label:"Completed",variant:"outline"}]}]}],className:"w-full"}});const Mr={kanban:nt,"kanban-enhanced":tn,"object-kanban":St};Ee.ComponentRegistry.register("kanban-enhanced",({schema:e})=>{const n=u.useMemo(()=>{const{columns:t=[],data:r,groupBy:s}=e;if(r&&s&&Array.isArray(r)){const o=r.reduce((i,a)=>{const l=a[s];return i[l]||(i[l]=[]),i[l].push(a),i},{});return t.map(i=>({...i,cards:[...i.cards||[],...o[i.id]||[]]}))}return t},[e]);return g.jsx(u.Suspense,{fallback:g.jsx(F.Skeleton,{className:"w-full h-[600px]"}),children:g.jsx(tn,{columns:n,onCardMove:e.onCardMove,onColumnToggle:e.onColumnToggle,enableVirtualScrolling:e.enableVirtualScrolling,virtualScrollThreshold:e.virtualScrollThreshold,className:e.className,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd,conditionalFormatting:e.conditionalFormatting})})},{namespace:"plugin-kanban",label:"Kanban Board (Enhanced)",icon:"LayoutGrid",category:"plugin",inputs:[{name:"columns",type:"array",label:"Columns",required:!0},{name:"enableVirtualScrolling",type:"boolean",label:"Virtual Scrolling",defaultValue:!1},{name:"virtualScrollThreshold",type:"number",label:"Virtual Scroll Threshold",defaultValue:50},{name:"onCardMove",type:"code",label:"On Card Move",advanced:!0},{name:"onColumnToggle",type:"code",label:"On Column Toggle",advanced:!0},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:[],enableVirtualScrolling:!1,virtualScrollThreshold:50,className:"w-full"}});const Et=({schema:e,...n})=>{const{dataSource:t}=Re.useSchemaContext()||{};return g.jsx(St,{schema:e,dataSource:t,...n})};Ee.ComponentRegistry.register("object-kanban",Et,{namespace:"plugin-kanban",label:"Object Kanban",category:"view",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"}]}),Ee.ComponentRegistry.register("kanban",Et,{namespace:"view",label:"Kanban Board",category:"view",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"}]});function _r(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return u.useMemo(()=>r=>{n.forEach(s=>s(r))},n)}const rt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function De(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function Nt(e){return"nodeType"in e}function Z(e){var n,t;return e?De(e)?e:Nt(e)&&(n=(t=e.ownerDocument)==null?void 0:t.defaultView)!=null?n:window:window}function Dt(e){const{Document:n}=Z(e);return e instanceof n}function $e(e){return De(e)?!1:e instanceof Z(e).HTMLElement}function nn(e){return e instanceof Z(e).SVGElement}function je(e){return e?De(e)?e.document:Nt(e)?Dt(e)?e:$e(e)||nn(e)?e.ownerDocument:document:document:document}const ae=rt?u.useLayoutEffect:u.useEffect;function st(e){const n=u.useRef(e);return ae(()=>{n.current=e}),u.useCallback(function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return n.current==null?void 0:n.current(...r)},[])}function zr(){const e=u.useRef(null),n=u.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),t=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,t]}function Be(e,n){n===void 0&&(n=[e]);const t=u.useRef(e);return ae(()=>{t.current!==e&&(t.current=e)},n),t}function Ve(e,n){const t=u.useRef();return u.useMemo(()=>{const r=e(t.current);return t.current=r,r},[...n])}function ot(e){const n=st(e),t=u.useRef(null),r=u.useCallback(s=>{s!==t.current&&n?.(s,t.current),t.current=s},[]);return[t,r]}function it(e){const n=u.useRef();return u.useEffect(()=>{n.current=e},[e]),n.current}let jt={};function Ke(e,n){return u.useMemo(()=>{if(n)return n;const t=jt[e]==null?0:jt[e]+1;return jt[e]=t,e+"-"+t},[e,n])}function rn(e){return function(n){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return r.reduce((o,i)=>{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+e*c)}return o},{...n})}}const ke=rn(1),at=rn(-1);function Lr(e){return"clientX"in e&&"clientY"in e}function lt(e){if(!e)return!1;const{KeyboardEvent:n}=Z(e.target);return n&&e instanceof n}function Rr(e){if(!e)return!1;const{TouchEvent:n}=Z(e.target);return n&&e instanceof n}function ct(e){if(Rr(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:t}=e.touches[0];return{x:n,y:t}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:t}=e.changedTouches[0];return{x:n,y:t}}}return Lr(e)?{x:e.clientX,y:e.clientY}:null}const ge=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:t}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:t}=e;return"scaleX("+n+") scaleY("+t+")"}},Transform:{toString(e){if(e)return[ge.Translate.toString(e),ge.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:t,easing:r}=e;return n+" "+t+"ms "+r}}}),sn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Pr(e){return e.matches(sn)?e:e.querySelector(sn)}const Fr={display:"none"};function $r(e){let{id:n,value:t}=e;return u.createElement("div",{id:n,style:Fr},t)}function Br(e){let{id:n,announcement:t,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return u.createElement("div",{id:n,style:s,role:"status","aria-live":r,"aria-atomic":!0},t)}function Vr(){const[e,n]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&n(r)},[]),announcement:e}}const on=u.createContext(null);function Kr(e){const n=u.useContext(on);u.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function Wr(){const[e]=u.useState(()=>new Set),n=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),n]}const Yr={draggable:`
6
+ <%s key={someKey} {...props} />`,z,W,ee,W),ce[W+z]=!0)}if(W=null,R!==void 0&&(t(R),W=""+R),i(E)&&(t(E.key),W=""+E.key),"key"in E){R={};for(var te in E)te!=="key"&&(R[te]=E[te])}else R=E;return W&&a(R,typeof m=="function"?m.displayName||m.name||"Unknown":m),c(m,W,R,s(),ue,G)}function f(m){g(m)?m._store&&(m._store.validated=1):typeof m=="object"&&m!==null&&m.$$typeof===M&&(m._payload.status==="fulfilled"?g(m._payload.value)&&m._payload.value._store&&(m._payload.value._store.validated=1):m._store&&(m._store.validated=1))}function g(m){return typeof m=="object"&&m!==null&&m.$$typeof===N}var p=u,N=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),A=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),O=p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T=Object.prototype.hasOwnProperty,V=Array.isArray,P=console.createTask?console.createTask:function(){return null};p={react_stack_bottom_frame:function(m){return m()}};var K,$={},U=p.react_stack_bottom_frame.bind(p,o)(),Y=P(r(o)),ce={};Fe.Fragment=v,Fe.jsx=function(m,E,R){var z=1e4>O.recentlyCreatedOwnerStacks++;return d(m,E,R,!1,z?Error("react-stack-top-frame"):U,z?P(r(m)):Y)},Fe.jsxs=function(m,E,R){var z=1e4>O.recentlyCreatedOwnerStacks++;return d(m,E,R,!0,z?Error("react-stack-top-frame"):U,z?P(r(m)):Y)}})()),Fe}var Jt;function ur(){return Jt||(Jt=1,process.env.NODE_ENV==="production"?et.exports=lr():et.exports=cr()),et.exports}var h=ur();const St=({schema:e,dataSource:n,className:t,onRowClick:r,onCardClick:s,...o})=>{const[i,a]=u.useState([]),[l,c]=u.useState(null),[d,f]=u.useState(!1),[g,p]=u.useState(null),N=Le.useDataScope(e.bind);u.useEffect(()=>{let x=!0;return(async()=>{if(!(!n||!e.objectName))try{const y=await n.getObjectSchema(e.objectName);x&&c(y)}catch(y){console.warn("Failed to fetch object def",y)}})(),()=>{x=!1}},[e.objectName,n]),u.useEffect(()=>{let x=!0;const C=async()=>{if(!(!n||typeof n.find!="function"||!e.objectName)){x&&f(!0);try{const y=Ee.buildExpandFields(l?.fields),M=await n.find(e.objectName,{options:{$top:100},$filter:e.filter,...y.length>0?{$expand:y}:{}}),w=Ee.extractRecords(M);console.log(`[ObjectKanban] Extracted data (length: ${w.length})`),x&&a(w)}catch(y){console.error("[ObjectKanban] Fetch error:",y),x&&p(y)}finally{x&&f(!1)}}};return e.objectName&&!N&&!e.data&&!o.data&&C(),()=>{x=!1}},[e.objectName,n,N,e.data,e.filter,o.data,l]);const b=o.data||N||e.data||i,v=u.useMemo(()=>{if(!Array.isArray(b))return[];let x=e.cardTitle||e.titleField;if(!x&&l){if(l.titleFormat){const y=/\{(.+?)\}/.exec(l.titleFormat);y&&(x=y[1])}!x&&l.NAME_FIELD_KEY&&(x=l.NAME_FIELD_KEY)}const C=["name","title","subject","label","display_name"];return b.map(y=>{let M=x?y[x]:void 0;if(!M){for(const w of C)if(y[w]){M=y[w];break}}return{...y,id:y.id||y._id,title:M||"Untitled"}})},[b,e,l]),k=u.useMemo(()=>{if(e.columns&&e.columns.length>0)if(typeof e.columns[0]=="string"){if(!e.groupBy)return e.columns.map(x=>({id:x,title:x}))}else return e.columns;if(e.groupBy&&l?.fields?.[e.groupBy]?.options)return l.fields[e.groupBy].options.map(x=>({id:x.value,title:x.label}));if(e.groupBy&&v.length>0){const x=new Set(v.map(C=>C[e.groupBy]));return Array.from(x).map(C=>({id:String(C),title:String(C)}))}return[]},[e.columns,e.groupBy,v,l]),j=e.swimlaneField||e.grouping?.fields?.[0]?.field,I={...e,data:v,columns:k,className:t||e.className,...j?{swimlaneField:j}:{}},A=Le.useNavigationOverlay({navigation:e.navigation,objectName:e.objectName,onRowClick:r??s});if(g)return h.jsxs("div",{className:"p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive",children:["Error loading kanban data: ",g.message]});const S=e.objectName?`${e.objectName.charAt(0).toUpperCase()+e.objectName.slice(1).replace(/_/g," ")} Detail`:"Card Details";return h.jsxs(h.Fragment,{children:[h.jsx(nt,{schema:{...I,onCardClick:x=>{A.handleClick(x),s?.(x)}}}),A.isOverlay&&h.jsx(F.NavigationOverlay,{...A,title:S,children:x=>h.jsx("div",{className:"space-y-3",children:Object.entries(x).map(([C,y])=>h.jsxs("div",{className:"flex flex-col",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:C.replace(/_/g," ")}),h.jsx("span",{className:"text-sm",children:String(y??"—")})]},C))})})]})};const Gt=(...e)=>e.filter((n,t,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===t).join(" ").trim();const dr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const fr=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,t,r)=>r?r.toUpperCase():t.toLowerCase());const Qt=e=>{const n=fr(e);return n.charAt(0).toUpperCase()+n.slice(1)};var hr={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const gr=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const mr=u.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...a},l)=>u.createElement("svg",{ref:l,...hr,width:n,height:n,stroke:e,strokeWidth:r?Number(t)*24/Number(n):t,className:Gt("lucide",s),...!o&&!gr(a)&&{"aria-hidden":"true"},...a},[...i.map(([c,d])=>u.createElement(c,d)),...Array.isArray(o)?o:[o]]));const Se=(e,n)=>{const t=u.forwardRef(({className:r,...s},o)=>u.createElement(mr,{ref:o,iconNode:n,className:Gt(`lucide-${dr(Qt(e))}`,`lucide-${e}`,r),...s}));return t.displayName=Qt(e),t};const pr=Se("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Zt=Se("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const vr=Se("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const br=Se("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const tt=Se("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const xr=Se("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const yr=Se("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),wr=(...e)=>e.filter(Boolean).join(" "),Cr=({columnId:e,fields:n,onSubmit:t,onCancel:r,defaultValues:s})=>{const[o,i]=_.useState(()=>{const f={};for(const g of n)f[g.name]=s?.[g.name]??g.defaultValue??"";return f}),a=_.useRef(null);_.useEffect(()=>{const f=setTimeout(()=>a.current?.focus(),0);return()=>clearTimeout(f)},[]);const l=_.useCallback((f,g)=>{i(p=>({...p,[f]:g}))},[]),c=_.useCallback(()=>{Object.values(o).some(g=>typeof g=="string"?g.trim().length>0:g!=null)&&t(e,o)},[e,o,t]),d=_.useCallback(f=>{f.key==="Enter"?(f.preventDefault(),c()):f.key==="Escape"&&(f.preventDefault(),r())},[c,r]);return h.jsxs("div",{className:"mt-2 rounded-lg border border-primary/30 bg-card p-3 space-y-2 shadow-sm",onKeyDown:d,role:"form","aria-label":"Quick add card",children:[n.map((f,g)=>h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{htmlFor:`qa-${e}-${f.name}`,className:"text-xs font-mono text-muted-foreground",children:f.label??f.name}),Sr(f,o[f.name],l,g===0?a:void 0,`qa-${e}-${f.name}`)]},f.name)),h.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[h.jsxs(F.Button,{type:"button",size:"sm",className:"h-7 text-xs gap-1",onClick:c,children:[h.jsx(pr,{className:"h-3 w-3"}),"Save"]}),h.jsxs(F.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs gap-1",onClick:r,children:[h.jsx(yr,{className:"h-3 w-3"}),"Cancel"]})]})]})};function Sr(e,n,t,r,s){const o="text-sm h-8";switch(e.type){case"select":return h.jsxs("select",{ref:r,id:s,value:n??"",onChange:i=>t(e.name,i.target.value),className:wr(o,"w-full rounded-md border border-input bg-background px-2 py-1 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[h.jsx("option",{value:"",children:e.placeholder??`Select ${e.label??e.name}...`}),(e.options??[]).map(i=>h.jsx("option",{value:i.value,children:i.label},i.value))]});case"number":return h.jsx(F.Input,{ref:r,id:s,type:"number",value:n??"",onChange:i=>t(e.name,i.target.value===""?"":Number(i.target.value)),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:o});default:return h.jsx(F.Input,{ref:r,id:s,type:"text",value:n??"",onChange:i=>t(e.name,i.target.value),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:o})}}const Er=(...e)=>e.filter(Boolean).join(" "),Nr=({templates:e,onSelect:n,columnId:t})=>{const[r,s]=_.useState(!1),o=_.useRef(null);_.useEffect(()=>{if(!r)return;const a=l=>{o.current&&!o.current.contains(l.target)&&s(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[r]);const i=_.useCallback(a=>{a.key==="Escape"&&s(!1)},[]);return h.jsxs("div",{ref:o,className:"relative",onKeyDown:i,children:[h.jsxs(F.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground gap-1",onClick:()=>s(a=>!a),"aria-haspopup":"listbox","aria-expanded":r,"aria-label":`Add card to ${t}`,children:[h.jsx(tt,{className:"h-4 w-4"}),"Add Card",h.jsx(Zt,{className:Er("h-3 w-3 transition-transform",r?"rotate-180":"")})]}),r&&h.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-popover p-1 shadow-md",role:"listbox","aria-label":"Card templates",children:[h.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",role:"option","aria-selected":!1,onClick:()=>{n(null),s(!1)},children:[h.jsx(tt,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{className:"font-mono text-xs",children:"Custom"})]}),e.length>0&&h.jsx("div",{className:"my-1 h-px bg-border",role:"separator"}),e.map(a=>h.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",role:"option","aria-selected":!1,onClick:()=>{n(a),s(!1)},children:[h.jsx(br,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{className:"font-mono text-xs truncate",children:a.name})]},a.id))]})]})},en="objectui:kanban-column-widths";function Dr(e){try{const n=localStorage.getItem(e);if(n){const t=JSON.parse(n);if(t&&typeof t=="object"&&!Array.isArray(t))return t}}catch{}return{}}function jr(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function kr({columns:e,defaultWidth:n=320,minWidth:t=200,maxWidth:r=600,storageKey:s}){const o=s?`${en}:${s}`:en,[i,a]=u.useState(()=>Dr(o)),l=u.useCallback(p=>Math.max(t,Math.min(r,p)),[t,r]),c=u.useCallback(p=>{const N=i[p];return N!=null?l(N):n},[i,n,l]),d=u.useCallback((p,N)=>{const b=l(N);a(v=>{const k={...v,[p]:b};return jr(o,k),k})},[l,o]),f=u.useCallback(()=>{a({});try{localStorage.removeItem(o)}catch{}},[o]),g=u.useMemo(()=>({defaultWidth:n,minWidth:t,maxWidth:r,overrides:{...i}}),[n,t,r,i]);return{getColumnWidth:c,setColumnWidth:d,resetWidths:f,config:g}}function Or({swimlanes:e,onCardMove:n}){const[t,r]=u.useState(null),s=u.useMemo(()=>{const d=new Map;for(const f of e)d.set(f.id,f);return d},[e]),o=u.useCallback((d,f)=>{if(d===f)return!0;const g=s.get(f);return g?g.acceptFrom?g.acceptFrom.includes(d):!0:!1},[s]),i=u.useCallback((d,f,g,p)=>o(f,g)?(n?.({cardId:d,fromSwimlane:f,toSwimlane:g,columnId:p}),r(null),!0):!1,[o,n]),a=u.useCallback(d=>{r(d)},[]),l=u.useCallback(()=>{r(null)},[]);return{handleCrossSwimlaneMove:i,isDraggingAcrossSwimlanes:t!==null,startCrossSwimlaneDrag:a,endCrossSwimlaneDrag:l,canMoveTo:o}}function Ar({cards:e,onReorderComplete:n}){const[t,r]=u.useState(e),[s,o]=u.useState(!1);!Ir(t,e)&&!s&&r(e);const i=u.useCallback(()=>{r(e),o(!1)},[e]),a=u.useCallback((d,f)=>{r(g=>{if(d<0||f<0||d>=g.length||f>=g.length)return g;const p=[...g],[N]=p.splice(d,1);return p.splice(f,0,N),p})},[]),l=u.useCallback(()=>{o(!0)},[]),c=u.useCallback(()=>{o(!1),r(d=>(n?.(d),d))},[n]);return{reorderedCards:t,onReorder:a,isDragging:s,startDrag:l,endDrag:c,reset:i}}function Ir(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].id!==n[t].id)return!1;return!0}const Mr=u.lazy(()=>Promise.resolve().then(()=>Eo)),tn=u.lazy(()=>Promise.resolve().then(()=>Bo)),nt=({schema:e})=>{const n=u.useMemo(()=>{const{columns:t=[],data:r,groupBy:s,coverImageField:o}=e,i=a=>{if(!o)return a;const l=a[o];if(!l)return a;const c=typeof l=="string"?l:l?.url;return c?{...a,coverImage:c}:a};if(r&&s&&Array.isArray(r)){const a={};t.forEach(c=>{c.id&&(a[String(c.id).toLowerCase()]=c.id),c.title&&(a[String(c.title).toLowerCase()]=c.id)});const l=r.reduce((c,d)=>{const f=String(d[s]??""),g=a[f.toLowerCase()]??f;return c[g]||(c[g]=[]),c[g].push(i(d)),c},{});return t.map(c=>({...c,cards:[...(c.cards||[]).map(i),...l[c.id]||[]]}))}return t.map(a=>({...a,cards:(a.cards||[]).map(i)}))},[e]);return h.jsx(u.Suspense,{fallback:h.jsx(F.Skeleton,{className:"w-full h-[600px]"}),children:h.jsx(Mr,{columns:n,onCardMove:e.onCardMove,onCardClick:e.onCardClick,className:e.className,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd,coverImageField:e.coverImageField,conditionalFormatting:e.conditionalFormatting,swimlaneField:e.swimlaneField})})};Ee.ComponentRegistry.register("kanban-ui",nt,{namespace:"plugin-kanban",label:"Kanban Board",icon:"LayoutDashboard",category:"plugin",inputs:[{name:"columns",type:"array",label:"Columns",description:"Array of { id, title, cards, limit, className }",required:!0},{name:"onCardMove",type:"code",label:"On Card Move",description:"Callback when a card is moved",advanced:!0},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:[{id:"todo",title:"To Do",cards:[{id:"card-1",title:"Task 1",description:"This is the first task",badges:[{label:"High Priority",variant:"destructive"},{label:"Feature",variant:"default"}]},{id:"card-2",title:"Task 2",description:"This is the second task",badges:[{label:"Bug",variant:"destructive"}]}]},{id:"in-progress",title:"In Progress",limit:3,cards:[{id:"card-3",title:"Task 3",description:"Currently working on this",badges:[{label:"In Progress",variant:"default"}]}]},{id:"done",title:"Done",cards:[{id:"card-4",title:"Task 4",description:"This task is completed",badges:[{label:"Completed",variant:"outline"}]},{id:"card-5",title:"Task 5",description:"Another completed task",badges:[{label:"Completed",variant:"outline"}]}]}],className:"w-full"}});const Tr={kanban:nt,"kanban-enhanced":tn,"object-kanban":St};Ee.ComponentRegistry.register("kanban-enhanced",({schema:e})=>{const n=u.useMemo(()=>{const{columns:t=[],data:r,groupBy:s}=e;if(r&&s&&Array.isArray(r)){const o=r.reduce((i,a)=>{const l=a[s];return i[l]||(i[l]=[]),i[l].push(a),i},{});return t.map(i=>({...i,cards:[...i.cards||[],...o[i.id]||[]]}))}return t},[e]);return h.jsx(u.Suspense,{fallback:h.jsx(F.Skeleton,{className:"w-full h-[600px]"}),children:h.jsx(tn,{columns:n,onCardMove:e.onCardMove,onColumnToggle:e.onColumnToggle,enableVirtualScrolling:e.enableVirtualScrolling,virtualScrollThreshold:e.virtualScrollThreshold,className:e.className,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd,conditionalFormatting:e.conditionalFormatting})})},{namespace:"plugin-kanban",label:"Kanban Board (Enhanced)",icon:"LayoutGrid",category:"plugin",inputs:[{name:"columns",type:"array",label:"Columns",required:!0},{name:"enableVirtualScrolling",type:"boolean",label:"Virtual Scrolling",defaultValue:!1},{name:"virtualScrollThreshold",type:"number",label:"Virtual Scroll Threshold",defaultValue:50},{name:"onCardMove",type:"code",label:"On Card Move",advanced:!0},{name:"onColumnToggle",type:"code",label:"On Column Toggle",advanced:!0},{name:"className",type:"string",label:"CSS Class"}],defaultProps:{columns:[],enableVirtualScrolling:!1,virtualScrollThreshold:50,className:"w-full"}});const Et=({schema:e,...n})=>{const{dataSource:t}=Le.useSchemaContext()||{};return h.jsx(St,{schema:e,dataSource:t,...n})};Ee.ComponentRegistry.register("object-kanban",Et,{namespace:"plugin-kanban",label:"Object Kanban",category:"view",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"}]}),Ee.ComponentRegistry.register("kanban",Et,{namespace:"view",label:"Kanban Board",category:"view",inputs:[{name:"objectName",type:"string",label:"Object Name",required:!0},{name:"columns",type:"array",label:"Columns"}]});function _r(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return u.useMemo(()=>r=>{n.forEach(s=>s(r))},n)}const rt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function De(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function Nt(e){return"nodeType"in e}function Z(e){var n,t;return e?De(e)?e:Nt(e)&&(n=(t=e.ownerDocument)==null?void 0:t.defaultView)!=null?n:window:window}function Dt(e){const{Document:n}=Z(e);return e instanceof n}function $e(e){return De(e)?!1:e instanceof Z(e).HTMLElement}function nn(e){return e instanceof Z(e).SVGElement}function je(e){return e?De(e)?e.document:Nt(e)?Dt(e)?e:$e(e)||nn(e)?e.ownerDocument:document:document:document}const ae=rt?u.useLayoutEffect:u.useEffect;function st(e){const n=u.useRef(e);return ae(()=>{n.current=e}),u.useCallback(function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return n.current==null?void 0:n.current(...r)},[])}function Rr(){const e=u.useRef(null),n=u.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),t=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,t]}function Be(e,n){n===void 0&&(n=[e]);const t=u.useRef(e);return ae(()=>{t.current!==e&&(t.current=e)},n),t}function Ve(e,n){const t=u.useRef();return u.useMemo(()=>{const r=e(t.current);return t.current=r,r},[...n])}function ot(e){const n=st(e),t=u.useRef(null),r=u.useCallback(s=>{s!==t.current&&n?.(s,t.current),t.current=s},[]);return[t,r]}function it(e){const n=u.useRef();return u.useEffect(()=>{n.current=e},[e]),n.current}let jt={};function Ke(e,n){return u.useMemo(()=>{if(n)return n;const t=jt[e]==null?0:jt[e]+1;return jt[e]=t,e+"-"+t},[e,n])}function rn(e){return function(n){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return r.reduce((o,i)=>{const a=Object.entries(i);for(const[l,c]of a){const d=o[l];d!=null&&(o[l]=d+e*c)}return o},{...n})}}const ke=rn(1),at=rn(-1);function zr(e){return"clientX"in e&&"clientY"in e}function lt(e){if(!e)return!1;const{KeyboardEvent:n}=Z(e.target);return n&&e instanceof n}function Lr(e){if(!e)return!1;const{TouchEvent:n}=Z(e.target);return n&&e instanceof n}function ct(e){if(Lr(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:t}=e.touches[0];return{x:n,y:t}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:t}=e.changedTouches[0];return{x:n,y:t}}}return zr(e)?{x:e.clientX,y:e.clientY}:null}const ge=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:t}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:t}=e;return"scaleX("+n+") scaleY("+t+")"}},Transform:{toString(e){if(e)return[ge.Translate.toString(e),ge.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:t,easing:r}=e;return n+" "+t+"ms "+r}}}),sn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Pr(e){return e.matches(sn)?e:e.querySelector(sn)}const Fr={display:"none"};function $r(e){let{id:n,value:t}=e;return u.createElement("div",{id:n,style:Fr},t)}function Br(e){let{id:n,announcement:t,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return u.createElement("div",{id:n,style:s,role:"status","aria-live":r,"aria-atomic":!0},t)}function Vr(){const[e,n]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&n(r)},[]),announcement:e}}const on=u.createContext(null);function Kr(e){const n=u.useContext(on);u.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function Wr(){const[e]=u.useState(()=>new Set),n=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:s,event:o}=r;e.forEach(i=>{var a;return(a=i[s])==null?void 0:a.call(i,o)})},[e]),n]}const Yr={draggable:`
7
7
  To pick up a draggable item, press the space bar.
8
8
  While dragging, use the arrow keys to move the item.
9
9
  Press space again to drop the item in its new position, or press escape to cancel.
10
- `},qr={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:t}=e;return t?"Draggable item "+n.id+" was moved over droppable area "+t.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:t}=e;return t?"Draggable item "+n.id+" was dropped over droppable area "+t.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function Ur(e){let{announcements:n=qr,container:t,hiddenTextDescribedById:r,screenReaderInstructions:s=Yr}=e;const{announce:o,announcement:i}=Vr(),a=Ke("DndLiveRegion"),[l,c]=u.useState(!1);if(u.useEffect(()=>{c(!0)},[]),Kr(u.useMemo(()=>({onDragStart(f){let{active:h}=f;o(n.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;n.onDragMove&&o(n.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(n.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(n.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(n.onDragCancel({active:h,over:p}))}}),[o,n])),!l)return null;const d=u.createElement(u.Fragment,null,u.createElement($r,{id:r,value:s.draggable}),u.createElement(Br,{id:a,announcement:i}));return t?Ne.createPortal(d,t):d}var X;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(X||(X={}));function ut(){}function kt(e,n){return u.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function an(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return u.useMemo(()=>[...n].filter(r=>r!=null),[...n])}const le=Object.freeze({x:0,y:0});function Xr(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function Hr(e,n){const t=ct(e);if(!t)return"0 0";const r={x:(t.x-n.left)/n.width*100,y:(t.y-n.top)/n.height*100};return r.x+"% "+r.y+"%"}function Jr(e,n){let{data:{value:t}}=e,{data:{value:r}}=n;return t-r}function Gr(e,n){let{data:{value:t}}=e,{data:{value:r}}=n;return r-t}function ln(e){let{left:n,top:t,height:r,width:s}=e;return[{x:n,y:t},{x:n+s,y:t},{x:n,y:t+r},{x:n+s,y:t+r}]}function Qr(e,n){if(!e||e.length===0)return null;const[t]=e;return t[n]}const cn=e=>{let{collisionRect:n,droppableRects:t,droppableContainers:r}=e;const s=ln(n),o=[];for(const i of r){const{id:a}=i,l=t.get(a);if(l){const c=ln(l),d=s.reduce((h,p,E)=>h+Xr(c[E],p),0),f=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:f}})}}return o.sort(Jr)};function Zr(e,n){const t=Math.max(n.top,e.top),r=Math.max(n.left,e.left),s=Math.min(n.left+n.width,e.left+e.width),o=Math.min(n.top+n.height,e.top+e.height),i=s-r,a=o-t;if(r<s&&t<o){const l=n.width*n.height,c=e.width*e.height,d=i*a,f=d/(l+c-d);return Number(f.toFixed(4))}return 0}const es=e=>{let{collisionRect:n,droppableRects:t,droppableContainers:r}=e;const s=[];for(const o of r){const{id:i}=o,a=t.get(i);if(a){const l=Zr(a,n);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(Gr)};function ts(e,n,t){return{...e,scaleX:n&&t?n.width/t.width:1,scaleY:n&&t?n.height/t.height:1}}function un(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:le}function ns(e){return function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s.reduce((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...t})}}const rs=ns(1);function dn(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function ss(e,n,t){const r=dn(n);if(!r)return e;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=e.left-i-(1-s)*parseFloat(t),c=e.top-a-(1-o)*parseFloat(t.slice(t.indexOf(" ")+1)),d=s?e.width/s:e.width,f=o?e.height/o:e.height;return{width:d,height:f,top:c,right:l+d,bottom:c+f,left:l}}const os={ignoreTransform:!1};function Oe(e,n){n===void 0&&(n=os);let t=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:c,transformOrigin:d}=Z(e).getComputedStyle(e);c&&(t=ss(t,c,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=t;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function fn(e){return Oe(e,{ignoreTransform:!0})}function is(e){const n=e.innerWidth,t=e.innerHeight;return{top:0,left:0,right:n,bottom:t,width:n,height:t}}function as(e,n){return n===void 0&&(n=Z(e).getComputedStyle(e)),n.position==="fixed"}function ls(e,n){n===void 0&&(n=Z(e).getComputedStyle(e));const t=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=n[s];return typeof o=="string"?t.test(o):!1})}function Ot(e,n){const t=[];function r(s){if(n!=null&&t.length>=n||!s)return t;if(Dt(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!$e(s)||nn(s)||t.includes(s))return t;const o=Z(e).getComputedStyle(s);return s!==e&&ls(s,o)&&t.push(s),as(s,o)?t:r(s.parentNode)}return e?r(e):t}function hn(e){const[n]=Ot(e,1);return n??null}function At(e){return!rt||!e?null:De(e)?e:Nt(e)?Dt(e)||e===je(e).scrollingElement?window:$e(e)?e:null:null}function gn(e){return De(e)?e.scrollX:e.scrollLeft}function mn(e){return De(e)?e.scrollY:e.scrollTop}function Tt(e){return{x:gn(e),y:mn(e)}}var H;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(H||(H={}));function pn(e){return!rt||!e?!1:e===document.scrollingElement}function vn(e){const n={x:0,y:0},t=pn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-t.width,y:e.scrollHeight-t.height},s=e.scrollTop<=n.y,o=e.scrollLeft<=n.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:n}}const cs={x:.2,y:.2};function us(e,n,t,r,s){let{top:o,left:i,right:a,bottom:l}=t;r===void 0&&(r=10),s===void 0&&(s=cs);const{isTop:c,isBottom:d,isLeft:f,isRight:h}=vn(e),p={x:0,y:0},E={x:0,y:0},b={height:n.height*s.y,width:n.width*s.x};return!c&&o<=n.top+b.height?(p.y=H.Backward,E.y=r*Math.abs((n.top+b.height-o)/b.height)):!d&&l>=n.bottom-b.height&&(p.y=H.Forward,E.y=r*Math.abs((n.bottom-b.height-l)/b.height)),!h&&a>=n.right-b.width?(p.x=H.Forward,E.x=r*Math.abs((n.right-b.width-a)/b.width)):!f&&i<=n.left+b.width&&(p.x=H.Backward,E.x=r*Math.abs((n.left+b.width-i)/b.width)),{direction:p,speed:E}}function ds(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:n,left:t,right:r,bottom:s}=e.getBoundingClientRect();return{top:n,left:t,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function bn(e){return e.reduce((n,t)=>ke(n,Tt(t)),le)}function fs(e){return e.reduce((n,t)=>n+gn(t),0)}function hs(e){return e.reduce((n,t)=>n+mn(t),0)}function xn(e,n){if(n===void 0&&(n=Oe),!e)return;const{top:t,left:r,bottom:s,right:o}=n(e);hn(e)&&(s<=0||o<=0||t>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const gs=[["x",["left","right"],fs],["y",["top","bottom"],hs]];class It{constructor(n,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ot(t),s=bn(r);this.rect={...n},this.width=n.width,this.height=n.height;for(const[o,i,a]of gs)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=s[o]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class We{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(t=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...t)})},this.target=n}add(n,t,r){var s;(s=this.target)==null||s.addEventListener(n,t,r),this.listeners.push([n,t,r])}}function ms(e){const{EventTarget:n}=Z(e);return e instanceof n?e:je(e)}function Mt(e,n){const t=Math.abs(e.x),r=Math.abs(e.y);return typeof n=="number"?Math.sqrt(t**2+r**2)>n:"x"in n&&"y"in n?t>n.x&&r>n.y:"x"in n?t>n.x:"y"in n?r>n.y:!1}var oe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oe||(oe={}));function yn(e){e.preventDefault()}function ps(e){e.stopPropagation()}var R;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(R||(R={}));const wn={start:[R.Space,R.Enter],cancel:[R.Esc],end:[R.Space,R.Enter,R.Tab]},vs=(e,n)=>{let{currentCoordinates:t}=n;switch(e.code){case R.Right:return{...t,x:t.x+25};case R.Left:return{...t,x:t.x-25};case R.Down:return{...t,y:t.y+25};case R.Up:return{...t,y:t.y-25}}};class Cn{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:t}}=n;this.props=n,this.listeners=new We(je(t)),this.windowListeners=new We(Z(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oe.Resize,this.handleCancel),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:t}=this.props,r=n.node.current;r&&xn(r),t(le)}handleKeyDown(n){if(lt(n)){const{active:t,context:r,options:s}=this.props,{keyboardCodes:o=wn,coordinateGetter:i=vs,scrollBehavior:a="smooth"}=s,{code:l}=n;if(o.end.includes(l)){this.handleEnd(n);return}if(o.cancel.includes(l)){this.handleCancel(n);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:le;this.referenceCoordinates||(this.referenceCoordinates=d);const f=i(n,{active:t,context:r.current,currentCoordinates:d});if(f){const h=at(f,d),p={x:0,y:0},{scrollableAncestors:E}=r.current;for(const b of E){const v=n.code,{isTop:k,isRight:j,isLeft:T,isBottom:A,maxScroll:S,minScroll:x}=vn(b),C=ds(b),y={x:Math.min(v===R.Right?C.right-C.width/2:C.right,Math.max(v===R.Right?C.left:C.left+C.width/2,f.x)),y:Math.min(v===R.Down?C.bottom-C.height/2:C.bottom,Math.max(v===R.Down?C.top:C.top+C.height/2,f.y))},I=v===R.Right&&!j||v===R.Left&&!T,w=v===R.Down&&!A||v===R.Up&&!k;if(I&&y.x!==f.x){const D=b.scrollLeft+h.x,O=v===R.Right&&D<=S.x||v===R.Left&&D>=x.x;if(O&&!h.y){b.scrollTo({left:D,behavior:a});return}O?p.x=b.scrollLeft-D:p.x=v===R.Right?b.scrollLeft-S.x:b.scrollLeft-x.x,p.x&&b.scrollBy({left:-p.x,behavior:a});break}else if(w&&y.y!==f.y){const D=b.scrollTop+h.y,O=v===R.Down&&D<=S.y||v===R.Up&&D>=x.y;if(O&&!h.x){b.scrollTo({top:D,behavior:a});return}O?p.y=b.scrollTop-D:p.y=v===R.Down?b.scrollTop-S.y:b.scrollTop-x.y,p.y&&b.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(n,ke(at(f,this.referenceCoordinates),p))}}}handleMove(n,t){const{onMove:r}=this.props;n.preventDefault(),r(t)}handleEnd(n){const{onEnd:t}=this.props;n.preventDefault(),this.detach(),t()}handleCancel(n){const{onCancel:t}=this.props;n.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Cn.activators=[{eventName:"onKeyDown",handler:(e,n,t)=>{let{keyboardCodes:r=wn,onActivation:s}=n,{active:o}=t;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Sn(e){return!!(e&&"distance"in e)}function En(e){return!!(e&&"delay"in e)}class _t{constructor(n,t,r){var s;r===void 0&&(r=ms(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=t;const{event:o}=n,{target:i}=o;this.props=n,this.events=t,this.document=je(i),this.documentListeners=new We(this.document),this.listeners=new We(r),this.windowListeners=new We(Z(i)),this.initialCoordinates=(s=ct(o))!=null?s:le,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(oe.Resize,this.handleCancel),this.windowListeners.add(oe.DragStart,yn),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),this.windowListeners.add(oe.ContextMenu,yn),this.documentListeners.add(oe.Keydown,this.handleKeydown),t){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(En(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Sn(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,t){const{active:r,onPending:s}=this.props;s(r,n,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:n}=this,{onStart:t}=this.props;n&&(this.activated=!0,this.documentListeners.add(oe.Click,ps,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oe.SelectionChange,this.removeTextSelection),t(n))}handleMove(n){var t;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(t=ct(n))!=null?t:le,c=at(s,l);if(!r&&a){if(Sn(a)){if(a.tolerance!=null&&Mt(c,a.tolerance))return this.handleCancel();if(Mt(c,a.distance))return this.handleStart()}if(En(a)&&Mt(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}n.cancelable&&n.preventDefault(),i(l)}handleEnd(){const{onAbort:n,onEnd:t}=this.props;this.detach(),this.activated||n(this.props.active),t()}handleCancel(){const{onAbort:n,onCancel:t}=this.props;this.detach(),this.activated||n(this.props.active),t()}handleKeydown(n){n.code===R.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const bs={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dt extends _t{constructor(n){const{event:t}=n,r=je(t.target);super(n,bs,r)}}dt.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;return!t.isPrimary||t.button!==0?!1:(r?.({event:t}),!0)}}];const xs={move:{name:"mousemove"},end:{name:"mouseup"}};var zt;(function(e){e[e.RightClick=2]="RightClick"})(zt||(zt={}));class ys extends _t{constructor(n){super(n,xs,je(n.event.target))}}ys.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;return t.button===zt.RightClick?!1:(r?.({event:t}),!0)}}];const Lt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Nn extends _t{constructor(n){super(n,Lt)}static setup(){return window.addEventListener(Lt.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(Lt.move.name,n)};function n(){}}}Nn.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;const{touches:s}=t;return s.length>1?!1:(r?.({event:t}),!0)}}];var Ye;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ye||(Ye={}));var ft;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ft||(ft={}));function ws(e){let{acceleration:n,activator:t=Ye.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=ft.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=Ss({delta:f,disabled:!o}),[E,b]=zr(),v=u.useRef({x:0,y:0}),k=u.useRef({x:0,y:0}),j=u.useMemo(()=>{switch(t){case Ye.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ye.DraggableRect:return s}},[t,s,l]),T=u.useRef(null),A=u.useCallback(()=>{const x=T.current;if(!x)return;const C=v.current.x*k.current.x,y=v.current.y*k.current.y;x.scrollBy(C,y)},[]),S=u.useMemo(()=>a===ft.TreeOrder?[...c].reverse():c,[a,c]);u.useEffect(()=>{if(!o||!c.length||!j){b();return}for(const x of S){if(r?.(x)===!1)continue;const C=c.indexOf(x),y=d[C];if(!y)continue;const{direction:I,speed:w}=us(x,y,j,n,h);for(const D of["x","y"])p[D][I[D]]||(w[D]=0,I[D]=0);if(w.x>0||w.y>0){b(),T.current=x,E(A,i),v.current=w,k.current=I;return}}v.current={x:0,y:0},k.current={x:0,y:0},b()},[n,A,r,b,o,i,JSON.stringify(j),JSON.stringify(p),E,c,S,d,JSON.stringify(h)])}const Cs={x:{[H.Backward]:!1,[H.Forward]:!1},y:{[H.Backward]:!1,[H.Forward]:!1}};function Ss(e){let{delta:n,disabled:t}=e;const r=it(n);return Ve(s=>{if(t||!r||!s)return Cs;const o={x:Math.sign(n.x-r.x),y:Math.sign(n.y-r.y)};return{x:{[H.Backward]:s.x[H.Backward]||o.x===-1,[H.Forward]:s.x[H.Forward]||o.x===1},y:{[H.Backward]:s.y[H.Backward]||o.y===-1,[H.Forward]:s.y[H.Forward]||o.y===1}}},[t,n,r])}function Es(e,n){const t=n!=null?e.get(n):void 0,r=t?t.node.current:null;return Ve(s=>{var o;return n==null?null:(o=r??s)!=null?o:null},[r,n])}function Ns(e,n){return u.useMemo(()=>e.reduce((t,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:n(i.handler,r)}));return[...t,...o]},[]),[e,n])}var qe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(qe||(qe={}));var Rt;(function(e){e.Optimized="optimized"})(Rt||(Rt={}));const Dn=new Map;function Ds(e,n){let{dragging:t,dependencies:r,config:s}=n;const[o,i]=u.useState(null),{frequency:a,measure:l,strategy:c}=s,d=u.useRef(e),f=v(),h=Be(f),p=u.useCallback(function(k){k===void 0&&(k=[]),!h.current&&i(j=>j===null?k:j.concat(k.filter(T=>!j.includes(T))))},[h]),E=u.useRef(null),b=Ve(k=>{if(f&&!t)return Dn;if(!k||k===Dn||d.current!==e||o!=null){const j=new Map;for(let T of e){if(!T)continue;if(o&&o.length>0&&!o.includes(T.id)&&T.rect.current){j.set(T.id,T.rect.current);continue}const A=T.node.current,S=A?new It(l(A),A):null;T.rect.current=S,S&&j.set(T.id,S)}return j}return k},[e,o,t,f,l]);return u.useEffect(()=>{d.current=e},[e]),u.useEffect(()=>{f||p()},[t,f]),u.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),u.useEffect(()=>{f||typeof a!="number"||E.current!==null||(E.current=setTimeout(()=>{p(),E.current=null},a))},[a,f,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:o!=null};function v(){switch(c){case qe.Always:return!1;case qe.BeforeDragging:return t;default:return!t}}}function Pt(e,n){return Ve(t=>e?t||(typeof n=="function"?n(e):e):null,[n,e])}function js(e,n){return Pt(e,n)}function ks(e){let{callback:n,disabled:t}=e;const r=st(n),s=u.useMemo(()=>{if(t||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,t]);return u.useEffect(()=>()=>s?.disconnect(),[s]),s}function ht(e){let{callback:n,disabled:t}=e;const r=st(n),s=u.useMemo(()=>{if(t||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[t]);return u.useEffect(()=>()=>s?.disconnect(),[s]),s}function Os(e){return new It(Oe(e),e)}function jn(e,n,t){n===void 0&&(n=Os);const[r,s]=u.useState(null);function o(){s(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??t)!=null?c:null}const d=n(e);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=ks({callback(l){if(e)for(const c of l){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=ht({callback:o});return ae(()=>{o(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function As(e){const n=Pt(e);return un(e,n)}const kn=[];function Ts(e){const n=u.useRef(e),t=Ve(r=>e?r&&r!==kn&&e&&n.current&&e.parentNode===n.current.parentNode?r:Ot(e):kn,[e]);return u.useEffect(()=>{n.current=e},[e]),t}function Is(e){const[n,t]=u.useState(null),r=u.useRef(e),s=u.useCallback(o=>{const i=At(o.target);i&&t(a=>a?(a.set(i,Tt(i)),new Map(a)):null)},[]);return u.useEffect(()=>{const o=r.current;if(e!==o){i(o);const a=e.map(l=>{const c=At(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,Tt(c)]):null}).filter(l=>l!=null);t(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const c=At(l);c?.removeEventListener("scroll",s)})}},[s,e]),u.useMemo(()=>e.length?n?Array.from(n.values()).reduce((o,i)=>ke(o,i),le):bn(e):le,[e,n])}function On(e,n){n===void 0&&(n=[]);const t=u.useRef(null);return u.useEffect(()=>{t.current=null},n),u.useEffect(()=>{const r=e!==le;r&&!t.current&&(t.current=e),!r&&t.current&&(t.current=null)},[e]),t.current?at(e,t.current):le}function Ms(e){u.useEffect(()=>{if(!rt)return;const n=e.map(t=>{let{sensor:r}=t;return r.setup==null?void 0:r.setup()});return()=>{for(const t of n)t?.()}},e.map(n=>{let{sensor:t}=n;return t}))}function _s(e,n){return u.useMemo(()=>e.reduce((t,r)=>{let{eventName:s,handler:o}=r;return t[s]=i=>{o(i,n)},t},{}),[e,n])}function An(e){return u.useMemo(()=>e?is(e):null,[e])}const Tn=[];function zs(e,n){n===void 0&&(n=Oe);const[t]=e,r=An(t?Z(t):null),[s,o]=u.useState(Tn);function i(){o(()=>e.length?e.map(l=>pn(l)?r:new It(n(l),l)):Tn)}const a=ht({callback:i});return ae(()=>{a?.disconnect(),i(),e.forEach(l=>a?.observe(l))},[e]),s}function In(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return $e(n)?n:e}function Ls(e){let{measure:n}=e;const[t,r]=u.useState(null),s=u.useCallback(c=>{for(const{target:d}of c)if($e(d)){r(f=>{const h=n(d);return f?{...f,width:h.width,height:h.height}:h});break}},[n]),o=ht({callback:s}),i=u.useCallback(c=>{const d=In(c);o?.disconnect(),d&&o?.observe(d),r(d?n(d):null)},[n,o]),[a,l]=ot(i);return u.useMemo(()=>({nodeRef:a,rect:t,setRef:l}),[t,a,l])}const Rs=[{sensor:dt,options:{}},{sensor:Cn,options:{}}],Ps={current:{}},gt={draggable:{measure:fn},droppable:{measure:fn,strategy:qe.WhileDragging,frequency:Rt.Optimized},dragOverlay:{measure:Oe}};class Ue extends Map{get(n){var t;return n!=null&&(t=super.get(n))!=null?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:t}=n;return!t})}getNodeFor(n){var t,r;return(t=(r=this.get(n))==null?void 0:r.node.current)!=null?t:void 0}}const Fs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ue,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ut},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gt,measureDroppableContainers:ut,windowRect:null,measuringScheduled:!1},Mn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ut,draggableNodes:new Map,over:null,measureDroppableContainers:ut},Xe=u.createContext(Mn),_n=u.createContext(Fs);function $s(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ue}}}function Bs(e,n){switch(n.type){case X.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case X.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case X.DragEnd:case X.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case X.RegisterDroppable:{const{element:t}=n,{id:r}=t,s=new Ue(e.droppable.containers);return s.set(r,t),{...e,droppable:{...e.droppable,containers:s}}}case X.SetDroppableDisabled:{const{id:t,key:r,disabled:s}=n,o=e.droppable.containers.get(t);if(!o||r!==o.key)return e;const i=new Ue(e.droppable.containers);return i.set(t,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case X.UnregisterDroppable:{const{id:t,key:r}=n,s=e.droppable.containers.get(t);if(!s||r!==s.key)return e;const o=new Ue(e.droppable.containers);return o.delete(t),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Vs(e){let{disabled:n}=e;const{active:t,activatorEvent:r,draggableNodes:s}=u.useContext(Xe),o=it(r),i=it(t?.id);return u.useEffect(()=>{if(!n&&!r&&o&&i!=null){if(!lt(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const f=Pr(d);if(f){f.focus();break}}})}},[r,n,s,i,o]),null}function zn(e,n){let{transform:t,...r}=n;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),t):t}function Ks(e){return u.useMemo(()=>({draggable:{...gt.draggable,...e?.draggable},droppable:{...gt.droppable,...e?.droppable},dragOverlay:{...gt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ws(e){let{activeNode:n,measure:t,initialRect:r,config:s=!0}=e;const o=u.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;ae(()=>{if(!i&&!a||!n){o.current=!1;return}if(o.current||!r)return;const c=n?.node.current;if(!c||c.isConnected===!1)return;const d=t(c),f=un(d,r);if(i||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=hn(c);h&&h.scrollBy({top:f.y,left:f.x})}},[n,i,a,r,t])}const mt=u.createContext({...le,scaleX:1,scaleY:1});var ve;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ve||(ve={}));const Ln=u.memo(function(n){var t,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:d=Rs,collisionDetection:f=es,measuring:h,modifiers:p,...E}=n;const b=u.useReducer(Bs,void 0,$s),[v,k]=b,[j,T]=Wr(),[A,S]=u.useState(ve.Uninitialized),x=A===ve.Initialized,{draggable:{active:C,nodes:y,translate:I},droppable:{containers:w}}=v,D=C!=null?y.get(C):null,O=u.useRef({initial:null,translated:null}),M=u.useMemo(()=>{var Q;return C!=null?{id:C,data:(Q=D?.data)!=null?Q:Ps,rect:O}:null},[C,D]),V=u.useRef(null),[P,K]=u.useState(null),[$,q]=u.useState(null),Y=Be(E,Object.values(E)),ce=Ke("DndDescribedBy",i),m=u.useMemo(()=>w.getEnabled(),[w]),N=Ks(h),{droppableRects:z,measureDroppableContainers:L,measuringScheduled:ue}=Ds(m,{dragging:x,dependencies:[I.x,I.y],config:N.droppable}),G=Es(y,C),W=u.useMemo(()=>$?ct($):null,[$]),ee=Ho(),te=js(G,N.draggable.measure);Ws({activeNode:C!=null?y.get(C):null,config:ee.layoutShiftCompensation,initialRect:te,measure:N.draggable.measure});const B=jn(G,N.draggable.measure,te),He=jn(G?G.parentElement:null),de=u.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:z,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:w,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=w.getNodeFor((t=de.current.over)==null?void 0:t.id),me=Ls({measure:N.dragOverlay.measure}),Ie=(r=me.nodeRef.current)!=null?r:G,Me=x?(s=me.rect)!=null?s:B:null,Zn=!!(me.nodeRef.current&&me.rect),er=As(Zn?null:B),Yt=An(Ie?Z(Ie):null),be=Ts(x?Te??G:null),wt=zs(be),Ct=zn(p,{transform:{x:I.x-er.x,y:I.y-er.y,scaleX:1,scaleY:1},activatorEvent:$,active:M,activeNodeRect:B,containerNodeRect:He,draggingNodeRect:Me,over:de.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:wt,windowRect:Yt}),tr=W?ke(W,I):null,nr=Is(be),Vo=On(nr),Ko=On(nr,[B]),_e=ke(Ct,Vo),ze=Me?rs(Me,Ct):null,Je=M&&ze?f({active:M,collisionRect:ze,droppableRects:z,droppableContainers:m,pointerCoordinates:tr}):null,rr=Qr(Je,"id"),[xe,sr]=u.useState(null),Wo=Zn?Ct:ke(Ct,Ko),Yo=ts(Wo,(o=xe?.rect)!=null?o:null,B),qt=u.useRef(null),or=u.useCallback((Q,ne)=>{let{sensor:re,options:ye}=ne;if(V.current==null)return;const ie=y.get(V.current);if(!ie)return;const se=Q.nativeEvent,fe=new re({active:V.current,activeNode:ie,event:se,options:ye,context:de,onAbort(J){if(!y.get(J))return;const{onDragAbort:he}=Y.current,pe={id:J};he?.(pe),j({type:"onDragAbort",event:pe})},onPending(J,we,he,pe){if(!y.get(J))return;const{onDragPending:Qe}=Y.current,Ce={id:J,constraint:we,initialCoordinates:he,offset:pe};Qe?.(Ce),j({type:"onDragPending",event:Ce})},onStart(J){const we=V.current;if(we==null)return;const he=y.get(we);if(!he)return;const{onDragStart:pe}=Y.current,Ge={activatorEvent:se,active:{id:we,data:he.data,rect:O}};Ne.unstable_batchedUpdates(()=>{pe?.(Ge),S(ve.Initializing),k({type:X.DragStart,initialCoordinates:J,active:we}),j({type:"onDragStart",event:Ge}),K(qt.current),q(se)})},onMove(J){k({type:X.DragMove,coordinates:J})},onEnd:Le(X.DragEnd),onCancel:Le(X.DragCancel)});qt.current=fe;function Le(J){return async function(){const{active:he,collisions:pe,over:Ge,scrollAdjustedTranslate:Qe}=de.current;let Ce=null;if(he&&Qe){const{cancelDrop:Ze}=Y.current;Ce={activatorEvent:se,active:he,collisions:pe,delta:Qe,over:Ge},J===X.DragEnd&&typeof Ze=="function"&&await Promise.resolve(Ze(Ce))&&(J=X.DragCancel)}V.current=null,Ne.unstable_batchedUpdates(()=>{k({type:J}),S(ve.Uninitialized),sr(null),K(null),q(null),qt.current=null;const Ze=J===X.DragEnd?"onDragEnd":"onDragCancel";if(Ce){const Ut=Y.current[Ze];Ut?.(Ce),j({type:Ze,event:Ce})}})}}},[y]),qo=u.useCallback((Q,ne)=>(re,ye)=>{const ie=re.nativeEvent,se=y.get(ye);if(V.current!==null||!se||ie.dndKit||ie.defaultPrevented)return;const fe={active:se};Q(re,ne.options,fe)===!0&&(ie.dndKit={capturedBy:ne.sensor},V.current=ye,or(re,ne))},[y,or]),ir=Ns(d,qo);Ms(d),ae(()=>{B&&A===ve.Initializing&&S(ve.Initialized)},[B,A]),u.useEffect(()=>{const{onDragMove:Q}=Y.current,{active:ne,activatorEvent:re,collisions:ye,over:ie}=de.current;if(!ne||!re)return;const se={active:ne,activatorEvent:re,collisions:ye,delta:{x:_e.x,y:_e.y},over:ie};Ne.unstable_batchedUpdates(()=>{Q?.(se),j({type:"onDragMove",event:se})})},[_e.x,_e.y]),u.useEffect(()=>{const{active:Q,activatorEvent:ne,collisions:re,droppableContainers:ye,scrollAdjustedTranslate:ie}=de.current;if(!Q||V.current==null||!ne||!ie)return;const{onDragOver:se}=Y.current,fe=ye.get(rr),Le=fe&&fe.rect.current?{id:fe.id,rect:fe.rect.current,data:fe.data,disabled:fe.disabled}:null,J={active:Q,activatorEvent:ne,collisions:re,delta:{x:ie.x,y:ie.y},over:Le};Ne.unstable_batchedUpdates(()=>{sr(Le),se?.(J),j({type:"onDragOver",event:J})})},[rr]),ae(()=>{de.current={activatorEvent:$,active:M,activeNode:G,collisionRect:ze,collisions:Je,droppableRects:z,draggableNodes:y,draggingNode:Ie,draggingNodeRect:Me,droppableContainers:w,over:xe,scrollableAncestors:be,scrollAdjustedTranslate:_e},O.current={initial:Me,translated:ze}},[M,G,Je,ze,y,Ie,Me,z,w,xe,be,_e]),ws({...ee,delta:I,draggingRect:ze,pointerCoordinates:tr,scrollableAncestors:be,scrollableAncestorRects:wt});const Uo=u.useMemo(()=>({active:M,activeNode:G,activeNodeRect:B,activatorEvent:$,collisions:Je,containerNodeRect:He,dragOverlay:me,draggableNodes:y,droppableContainers:w,droppableRects:z,over:xe,measureDroppableContainers:L,scrollableAncestors:be,scrollableAncestorRects:wt,measuringConfiguration:N,measuringScheduled:ue,windowRect:Yt}),[M,G,B,$,Je,He,me,y,w,z,xe,L,be,wt,N,ue,Yt]),Xo=u.useMemo(()=>({activatorEvent:$,activators:ir,active:M,activeNodeRect:B,ariaDescribedById:{draggable:ce},dispatch:k,draggableNodes:y,over:xe,measureDroppableContainers:L}),[$,ir,M,B,k,ce,y,xe,L]);return u.createElement(on.Provider,{value:T},u.createElement(Xe.Provider,{value:Xo},u.createElement(_n.Provider,{value:Uo},u.createElement(mt.Provider,{value:Yo},c)),u.createElement(Vs,{disabled:a?.restoreFocus===!1})),u.createElement(Ur,{...a,hiddenTextDescribedById:ce}));function Ho(){const Q=P?.autoScrollEnabled===!1,ne=typeof l=="object"?l.enabled===!1:l===!1,re=x&&!Q&&!ne;return typeof l=="object"?{...l,enabled:re}:{enabled:re}}}),Ys=u.createContext(null),Rn="button",qs="Draggable";function Us(e){let{id:n,data:t,disabled:r=!1,attributes:s}=e;const o=Ke(qs),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:h}=u.useContext(Xe),{role:p=Rn,roleDescription:E="draggable",tabIndex:b=0}=s??{},v=l?.id===n,k=u.useContext(v?mt:Ys),[j,T]=ot(),[A,S]=ot(),x=_s(i,n),C=Be(t);ae(()=>(f.set(n,{id:n,key:o,node:j,activatorNode:A,data:C}),()=>{const I=f.get(n);I&&I.key===o&&f.delete(n)}),[f,n]);const y=u.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&p===Rn?!0:void 0,"aria-roledescription":E,"aria-describedby":d.draggable}),[r,p,b,v,E,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:y,isDragging:v,listeners:r?void 0:x,node:j,over:h,setNodeRef:T,setActivatorNodeRef:S,transform:k}}function Pn(){return u.useContext(_n)}const Xs="Droppable",Hs={timeout:25};function Js(e){let{data:n,disabled:t=!1,id:r,resizeObserverConfig:s}=e;const o=Ke(Xs),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=u.useContext(Xe),d=u.useRef({disabled:t}),f=u.useRef(!1),h=u.useRef(null),p=u.useRef(null),{disabled:E,updateMeasurementsFor:b,timeout:v}={...Hs,...s},k=Be(b??r),j=u.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(k.current)?k.current:[k.current]),p.current=null},v)},[v]),T=ht({callback:j,disabled:E||!i}),A=u.useCallback((y,I)=>{T&&(I&&(T.unobserve(I),f.current=!1),y&&T.observe(y))},[T]),[S,x]=ot(A),C=Be(n);return u.useEffect(()=>{!T||!S.current||(T.disconnect(),f.current=!1,T.observe(S.current))},[S,T]),u.useEffect(()=>(a({type:X.RegisterDroppable,element:{id:r,key:o,disabled:t,node:S,rect:h,data:C}}),()=>a({type:X.UnregisterDroppable,key:o,id:r})),[r]),u.useEffect(()=>{t!==d.current.disabled&&(a({type:X.SetDroppableDisabled,id:r,key:o,disabled:t}),d.current.disabled=t)},[r,o,t,a]),{active:i,rect:h,isOver:l?.id===r,node:S,over:l,setNodeRef:x}}function Gs(e){let{animation:n,children:t}=e;const[r,s]=u.useState(null),[o,i]=u.useState(null),a=it(t);return!t&&!r&&a&&s(a),ae(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(n(c,o)).then(()=>{s(null)})},[n,r,o]),u.createElement(u.Fragment,null,t,r?u.cloneElement(r,{ref:i}):null)}const Qs={x:0,y:0,scaleX:1,scaleY:1};function Zs(e){let{children:n}=e;return u.createElement(Xe.Provider,{value:Mn},u.createElement(mt.Provider,{value:Qs},n))}const eo={position:"fixed",touchAction:"none"},to=e=>lt(e)?"transform 250ms ease":void 0,no=u.forwardRef((e,n)=>{let{as:t,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:c,transition:d=to}=e;if(!a)return null;const f=s?c:{...c,scaleX:1,scaleY:1},h={...eo,width:a.width,height:a.height,top:a.top,left:a.left,transform:ge.Transform.toString(f),transformOrigin:s&&r?Hr(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return u.createElement(t,{className:i,style:h,ref:n},o)}),ro={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:n,final:t}}=e;return[{transform:ge.Transform.toString(n)},{transform:ge.Transform.toString(t)}]},sideEffects:(e=>n=>{let{active:t,dragOverlay:r}=n;const s={},{styles:o,className:i}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=t.node.style.getPropertyValue(a),t.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&t.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,c]of Object.entries(s))t.node.style.setProperty(l,c);i!=null&&i.active&&t.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function so(e){let{config:n,draggableNodes:t,droppableContainers:r,measuringConfiguration:s}=e;return st((o,i)=>{if(n===null)return;const a=t.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=In(i);if(!c)return;const{transform:d}=Z(i).getComputedStyle(i),f=dn(d);if(!f)return;const h=typeof n=="function"?n:oo(n);return xn(l,s.draggable.measure),h({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:t,dragOverlay:{node:i,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:f})})}function oo(e){const{duration:n,easing:t,sideEffects:r,keyframes:s}={...ro,...e};return o=>{let{active:i,dragOverlay:a,transform:l,...c}=o;if(!n)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},f={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-d.x,y:l.y-d.y,...f},p=s({...c,active:i,dragOverlay:a,transform:{initial:l,final:h}}),[E]=p,b=p[p.length-1];if(JSON.stringify(E)===JSON.stringify(b))return;const v=r?.({active:i,dragOverlay:a,...c}),k=a.node.animate(p,{duration:n,easing:t,fill:"forwards"});return new Promise(j=>{k.onfinish=()=>{v?.(),j()}})}}let Fn=0;function io(e){return u.useMemo(()=>{if(e!=null)return Fn++,Fn},[e])}const $n=u.memo(e=>{let{adjustScale:n=!1,children:t,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggableNodes:E,droppableContainers:b,dragOverlay:v,over:k,measuringConfiguration:j,scrollableAncestors:T,scrollableAncestorRects:A,windowRect:S}=Pn(),x=u.useContext(mt),C=io(f?.id),y=zn(i,{activatorEvent:d,active:f,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:T,scrollableAncestorRects:A,transform:x,windowRect:S}),I=Pt(h),w=so({config:r,draggableNodes:E,droppableContainers:b,measuringConfiguration:j}),D=I?v.setRef:void 0;return u.createElement(Zs,null,u.createElement(Gs,{animation:w},f&&C?u.createElement(no,{key:C,id:f.id,ref:D,as:a,activatorEvent:d,adjustScale:n,className:l,transition:o,rect:I,style:{zIndex:c,...s},transform:y},t):null))});function pt(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function ao(e,n){return e.reduce((t,r,s)=>{const o=n.get(r);return o&&(t[s]=o),t},Array(e.length))}function vt(e){return e!==null&&e>=0}function lo(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function co(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Bn=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const o=pt(n,r,t),i=n[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},bt={scaleX:1,scaleY:1},Ft=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:o,overIndex:i}=e;const a=(n=o[t])!=null?n:r;if(!a)return null;if(s===t){const c=o[i];return c?{x:0,y:t<i?c.top+c.height-(a.top+a.height):c.top-a.top,...bt}:null}const l=uo(o,s,t);return s>t&&s<=i?{x:0,y:-a.height-l,...bt}:s<t&&s>=i?{x:0,y:a.height+l,...bt}:{x:0,y:0,...bt}};function uo(e,n,t){const r=e[n],s=e[n-1],o=e[n+1];return r?t<n?s?r.top-(s.top+s.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const Vn="Sortable",Kn=u.createContext({activeIndex:-1,containerId:Vn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Bn,disabled:{draggable:!1,droppable:!1}});function $t(e){let{children:n,id:t,items:r,strategy:s=Bn,disabled:o=!1}=e;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=Pn(),f=Ke(Vn,t),h=a.rect!==null,p=u.useMemo(()=>r.map(x=>typeof x=="object"&&"id"in x?x.id:x),[r]),E=i!=null,b=i?p.indexOf(i.id):-1,v=c?p.indexOf(c.id):-1,k=u.useRef(p),j=!lo(p,k.current),T=v!==-1&&b===-1||j,A=co(o);ae(()=>{j&&E&&d(p)},[j,p,E,d]),u.useEffect(()=>{k.current=p},[p]);const S=u.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:T,items:p,overIndex:v,useDragOverlay:h,sortedRects:ao(p,l),strategy:s}),[b,f,A.draggable,A.droppable,T,p,v,l,h,s]);return u.createElement(Kn.Provider,{value:S},n)}const fo=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return pt(t,r,s).indexOf(n)},ho=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&s===i?!1:t?!0:i!==s&&n===l},go={duration:200,easing:"ease"},Wn="transform",mo=ge.Transition.toString({property:Wn,duration:0,easing:"linear"}),po={roleDescription:"sortable"};function vo(e){let{disabled:n,index:t,node:r,rect:s}=e;const[o,i]=u.useState(null),a=u.useRef(t);return ae(()=>{if(!n&&t!==a.current&&r.current){const l=s.current;if(l){const c=Oe(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&i(d)}}t!==a.current&&(a.current=t)},[n,t,r,s]),u.useEffect(()=>{o&&i(null)},[o]),o}function xt(e){let{animateLayoutChanges:n=ho,attributes:t,disabled:r,data:s,getNewIndex:o=fo,id:i,strategy:a,resizeObserverConfig:l,transition:c=go}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:E,sortedRects:b,overIndex:v,useDragOverlay:k,strategy:j}=u.useContext(Kn),T=bo(r,p),A=d.indexOf(i),S=u.useMemo(()=>({sortable:{containerId:f,index:A,items:d},...s}),[f,s,A,d]),x=u.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:C,node:y,isOver:I,setNodeRef:w}=Js({id:i,data:S,disabled:T.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...l}}),{active:D,activatorEvent:O,activeNodeRect:M,attributes:V,setNodeRef:P,listeners:K,isDragging:$,over:q,setActivatorNodeRef:Y,transform:ce}=Us({id:i,data:S,attributes:{...po,...t},disabled:T.draggable}),m=_r(w,P),N=!!D,z=N&&!E&&vt(h)&&vt(v),L=!k&&$,ue=L&&z?ce:null,W=z?ue??(a??j)({rects:b,activeNodeRect:M,activeIndex:h,overIndex:v,index:A}):null,ee=vt(h)&&vt(v)?o({id:i,items:d,activeIndex:h,overIndex:v}):A,te=D?.id,B=u.useRef({activeId:te,items:d,newIndex:ee,containerId:f}),He=d!==B.current.items,de=n({active:D,containerId:f,isDragging:$,isSorting:N,id:i,index:A,items:d,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:c,wasDragging:B.current.activeId!=null}),Te=vo({disabled:!de,index:A,node:y,rect:C});return u.useEffect(()=>{N&&B.current.newIndex!==ee&&(B.current.newIndex=ee),f!==B.current.containerId&&(B.current.containerId=f),d!==B.current.items&&(B.current.items=d)},[N,ee,f,d]),u.useEffect(()=>{if(te===B.current.activeId)return;if(te!=null&&B.current.activeId==null){B.current.activeId=te;return}const Ie=setTimeout(()=>{B.current.activeId=te},50);return()=>clearTimeout(Ie)},[te]),{active:D,activeIndex:h,attributes:V,data:S,rect:C,index:A,newIndex:ee,items:d,isOver:I,isSorting:N,isDragging:$,listeners:K,node:y,overIndex:v,over:q,setNodeRef:m,setActivatorNodeRef:Y,setDroppableNodeRef:w,setDraggableNodeRef:P,transform:Te??W,transition:me()};function me(){if(Te||He&&B.current.newIndex===A)return mo;if(!(L&&!lt(O)||!c)&&(N||de))return ge.Transition.toString({...c,property:Wn})}}function bo(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}R.Down,R.Right,R.Up,R.Left;const yt=(...e)=>e.filter(Boolean).join(" "),Bt="Uncategorized";function xo(e,n){if(!n||n.length===0)return{};for(const t of n){const r=e[t.field];if(r==null)continue;let s=!1;const o=String(r);switch(t.operator){case"equals":s=o===String(t.value);break;case"not_equals":s=o!==String(t.value);break;case"contains":s=o.toLowerCase().includes(String(t.value).toLowerCase());break;case"in":s=Array.isArray(t.value)&&t.value.includes(o);break}if(s)return{...t.backgroundColor?{backgroundColor:t.backgroundColor}:{},...t.borderColor?{borderColor:t.borderColor}:{}}}return{}}function Vt({card:e,onCardClick:n,conditionalFormatting:t}){const{attributes:r,listeners:s,setNodeRef:o,transform:i,transition:a,isDragging:l}=xt({id:e.id}),c={transform:ge.Transform.toString(i),transition:a,opacity:l?.5:void 0},d=xo(e,t);return g.jsx("div",{ref:o,style:c,...r,...s,role:"listitem","aria-label":e.title,onClick:()=>n?.(e),children:g.jsxs(F.Card,{className:"mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",style:d,children:[e.coverImage&&g.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:g.jsx("img",{src:e.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),g.jsxs(F.CardHeader,{className:"p-2 sm:p-4",children:[g.jsx(F.CardTitle,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&g.jsx(F.CardDescription,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:e.description})]}),e.badges&&e.badges.length>0&&g.jsx(F.CardContent,{className:"p-2 sm:p-4 pt-0",children:g.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((f,h)=>g.jsx(F.Badge,{variant:f.variant||"default",className:"text-xs",children:f.label},h))})})]})})}function yo({columnId:e,onAdd:n}){const[t,r]=_.useState(!1),[s,o]=_.useState(""),i=_.useRef(null),a=()=>{const c=s.trim();c&&(n(e,c),o("")),r(!1)},l=c=>{c.key==="Enter"?(c.preventDefault(),a()):c.key==="Escape"&&(o(""),r(!1))};return t?g.jsx("div",{className:"mt-2 space-y-2",children:g.jsx(F.Input,{ref:i,value:s,onChange:c=>o(c.target.value),onKeyDown:l,onBlur:a,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):g.jsxs(F.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{r(!0),setTimeout(()=>i.current?.focus(),0)},children:[g.jsx(tt,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function wo({column:e,cards:n,onCardClick:t,quickAdd:r,onQuickAdd:s,conditionalFormatting:o}){const i=n||[],{setNodeRef:a}=xt({id:e.id,data:{type:"column"}}),l=e.limit&&i.length>=e.limit;return g.jsxs("div",{ref:a,role:"group","aria-label":e.title,className:yt("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",e.className),children:[g.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/30 rounded-t-lg",children:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h3",{id:`kanban-col-${e.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:e.title}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs(F.Badge,{variant:"secondary",className:"text-xs font-mono tabular-nums",children:[i.length,e.limit&&` / ${e.limit}`]}),l&&g.jsx(F.Badge,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),g.jsxs(F.ScrollArea,{className:"flex-1 p-4",children:[g.jsx($t,{items:i.map(c=>c.id),strategy:Ft,children:g.jsxs("div",{className:"space-y-2",role:"list","aria-label":`${e.title} cards`,children:[i.length===0&&g.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground/50",children:g.jsx("span",{className:"text-xs font-mono",children:"No cards"})}),i.map(c=>g.jsx(Vt,{card:c,onCardClick:t,conditionalFormatting:o},c.id))]})}),r&&s&&g.jsx(yo,{columnId:e.id,onAdd:s})]})]})}function Co({children:e}){const n=Re.useDnd();return g.jsx(g.Fragment,{children:e(n)})}function So({columns:e,onCardMove:n,onCardClick:t,className:r,quickAdd:s,onQuickAdd:o,coverImageField:i,conditionalFormatting:a,swimlaneField:l}){return Re.useHasDndProvider()?g.jsx(Co,{children:d=>g.jsx(Yn,{columns:e,onCardMove:n,onCardClick:t,className:r,dnd:d,quickAdd:s,onQuickAdd:o,coverImageField:i,conditionalFormatting:a,swimlaneField:l})}):g.jsx(Yn,{columns:e,onCardMove:n,onCardClick:t,className:r,dnd:null,quickAdd:s,onQuickAdd:o,coverImageField:i,conditionalFormatting:a,swimlaneField:l})}function Yn({columns:e,onCardMove:n,onCardClick:t,className:r,dnd:s,quickAdd:o,onQuickAdd:i,coverImageField:a,conditionalFormatting:l,swimlaneField:c}){const[d,f]=_.useState(null),h=c?`objectui:kanban-collapsed:${c}`:null,[p,E]=_.useState(()=>{if(!h)return new Set;try{const w=localStorage.getItem(h);if(w){const D=JSON.parse(w);if(Array.isArray(D))return new Set(D.filter(O=>typeof O=="string"))}}catch{}return new Set}),b=_.useMemo(()=>(e||[]).map(w=>({...w,cards:w.cards||[]})),[e]),[v,k]=_.useState(b);_.useEffect(()=>{k(b)},[b]);const j=_.useMemo(()=>{if(!c)return null;const w=v.flatMap(O=>O.cards),D=new Set;return w.forEach(O=>{const M=O[c];D.add(M!=null?String(M):Bt)}),Array.from(D).sort()},[v,c]),T=_.useCallback(w=>{E(D=>{const O=new Set(D);if(O.has(w)?O.delete(w):O.add(w),h)try{localStorage.setItem(h,JSON.stringify([...O]))}catch{}return O})},[h]),A=an(kt(dt,{activationConstraint:{distance:5}}),kt(Nn,{activationConstraint:{delay:200,tolerance:5}})),S=w=>{const{active:D}=w,O=C(D.id);if(f(O),s&&O){const M=y(O.id);M&&s.startDrag({id:O.id,type:"kanban-card",data:O,sourceId:M.id})}},x=w=>{const{active:D,over:O}=w;if(f(null),!O){s&&s.endDrag();return}const M=D.id,V=O.id;if(M===V){s&&s.endDrag();return}const P=y(M),K=y(V)||I(V);if(!P||!K){s&&s.endDrag();return}if(P.id===K.id){const $=[...P.cards],q=$.findIndex(m=>m.id===M),Y=$.findIndex(m=>m.id===V),ce=pt($,q,Y);k(m=>m.map(N=>N.id===P.id?{...N,cards:ce}:N))}else{const $=[...P.cards],q=[...K.cards],Y=$.findIndex(z=>z.id===M),m=V===K.id?q.length:q.findIndex(z=>z.id===V),[N]=$.splice(Y,1);q.splice(m,0,N),k(z=>z.map(L=>L.id===P.id?{...L,cards:$}:L.id===K.id?{...L,cards:q}:L)),n&&n(M,P.id,K.id,m)}s&&s.endDrag(K.id)},C=_.useCallback(w=>{for(const D of v){const O=D.cards.find(M=>M.id===w);if(O)return O}return null},[v]),y=_.useCallback(w=>v.find(D=>D.cards.some(O=>O.id===w))||null,[v]),I=_.useCallback(w=>v.find(D=>D.id===w)||null,[v]);return g.jsxs(Ln,{sensors:A,collisionDetection:cn,onDragStart:S,onDragEnd:x,children:[g.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[g.jsxs("span",{children:[v.length," columns"]}),g.jsx("span",{children:"← Swipe to navigate →"})]}),j?g.jsxs("div",{className:yt("flex flex-col gap-1 p-2 sm:p-4 min-w-0 overflow-hidden",r),role:"region","aria-label":"Kanban board with swimlanes",children:[g.jsx("div",{className:"flex gap-3 sm:gap-4 pl-36 sm:pl-44 overflow-x-auto",children:v.map(w=>g.jsxs("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 text-center",children:[g.jsx("span",{className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase",children:w.title}),g.jsxs("span",{className:"ml-2 font-mono text-xs text-muted-foreground",children:["(",w.cards.length,")"]})]},w.id))}),j.map(w=>{const D=p.has(w),O=v.reduce((M,V)=>M+V.cards.filter(P=>(P[c]!=null?String(P[c]):Bt)===w).length,0);return g.jsxs("div",{className:"border rounded-lg bg-muted/10",children:[g.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>T(w),"aria-expanded":!D,children:[g.jsx("span",{className:yt("transition-transform text-xs",D?"":"rotate-90"),children:"▶"}),g.jsx("span",{className:"font-mono text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:w}),g.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["(",O,")"]})]}),!D&&g.jsx("div",{className:"flex gap-3 sm:gap-4 overflow-x-auto px-2 pb-3 pl-36 sm:pl-44",children:v.map(M=>{const V=M.cards.filter(P=>(P[c]!=null?String(P[c]):Bt)===w);return g.jsx("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 min-h-[60px] rounded-md bg-card/20 p-2",children:g.jsx($t,{items:V.map(P=>P.id),strategy:Ft,children:g.jsx("div",{className:"space-y-2",role:"list","aria-label":`${M.title} - ${w} cards`,children:V.map(P=>g.jsx(Vt,{card:P,onCardClick:t,conditionalFormatting:l},P.id))})})},M.id)})})]},w)})]}):g.jsx("div",{className:yt("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 bg-muted/10 rounded-lg [-webkit-overflow-scrolling:touch] min-w-0",r),role:"region","aria-label":"Kanban board",children:v.map(w=>g.jsx(wo,{column:w,cards:w.cards,onCardClick:t,quickAdd:o,onQuickAdd:i,conditionalFormatting:l},w.id))}),g.jsx($n,{children:g.jsx("div",{"aria-live":"assertive","aria-label":d?`Dragging ${d.title}`:void 0,children:d?g.jsx(Vt,{card:d,conditionalFormatting:l}):null})})]})}const Eo=Object.freeze(Object.defineProperty({__proto__:null,default:So},Symbol.toStringTag,{value:"Module"}));function Ae(e,n,t){let r=t.initialDeps??[],s,o=!0;function i(){var a,l,c;let d;t.key&&((a=t.debug)!=null&&a.call(t))&&(d=Date.now());const f=e();if(!(f.length!==r.length||f.some((E,b)=>r[b]!==E)))return s;r=f;let p;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(p=Date.now()),s=n(...f),t.key&&((c=t.debug)!=null&&c.call(t))){const E=Math.round((Date.now()-d)*100)/100,b=Math.round((Date.now()-p)*100)/100,v=b/16,k=(j,T)=>{for(j=String(j);j.length<T;)j=" "+j;return j};console.info(`%c⏱ ${k(b,5)} /${k(E,5)} ms`,`
10
+ `},Ur={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:t}=e;return t?"Draggable item "+n.id+" was moved over droppable area "+t.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:t}=e;return t?"Draggable item "+n.id+" was dropped over droppable area "+t.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function qr(e){let{announcements:n=Ur,container:t,hiddenTextDescribedById:r,screenReaderInstructions:s=Yr}=e;const{announce:o,announcement:i}=Vr(),a=Ke("DndLiveRegion"),[l,c]=u.useState(!1);if(u.useEffect(()=>{c(!0)},[]),Kr(u.useMemo(()=>({onDragStart(f){let{active:g}=f;o(n.onDragStart({active:g}))},onDragMove(f){let{active:g,over:p}=f;n.onDragMove&&o(n.onDragMove({active:g,over:p}))},onDragOver(f){let{active:g,over:p}=f;o(n.onDragOver({active:g,over:p}))},onDragEnd(f){let{active:g,over:p}=f;o(n.onDragEnd({active:g,over:p}))},onDragCancel(f){let{active:g,over:p}=f;o(n.onDragCancel({active:g,over:p}))}}),[o,n])),!l)return null;const d=u.createElement(u.Fragment,null,u.createElement($r,{id:r,value:s.draggable}),u.createElement(Br,{id:a,announcement:i}));return t?Ne.createPortal(d,t):d}var X;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(X||(X={}));function ut(){}function kt(e,n){return u.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function an(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return u.useMemo(()=>[...n].filter(r=>r!=null),[...n])}const le=Object.freeze({x:0,y:0});function Xr(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function Hr(e,n){const t=ct(e);if(!t)return"0 0";const r={x:(t.x-n.left)/n.width*100,y:(t.y-n.top)/n.height*100};return r.x+"% "+r.y+"%"}function Jr(e,n){let{data:{value:t}}=e,{data:{value:r}}=n;return t-r}function Gr(e,n){let{data:{value:t}}=e,{data:{value:r}}=n;return r-t}function ln(e){let{left:n,top:t,height:r,width:s}=e;return[{x:n,y:t},{x:n+s,y:t},{x:n,y:t+r},{x:n+s,y:t+r}]}function Qr(e,n){if(!e||e.length===0)return null;const[t]=e;return t[n]}const cn=e=>{let{collisionRect:n,droppableRects:t,droppableContainers:r}=e;const s=ln(n),o=[];for(const i of r){const{id:a}=i,l=t.get(a);if(l){const c=ln(l),d=s.reduce((g,p,N)=>g+Xr(c[N],p),0),f=Number((d/4).toFixed(4));o.push({id:a,data:{droppableContainer:i,value:f}})}}return o.sort(Jr)};function Zr(e,n){const t=Math.max(n.top,e.top),r=Math.max(n.left,e.left),s=Math.min(n.left+n.width,e.left+e.width),o=Math.min(n.top+n.height,e.top+e.height),i=s-r,a=o-t;if(r<s&&t<o){const l=n.width*n.height,c=e.width*e.height,d=i*a,f=d/(l+c-d);return Number(f.toFixed(4))}return 0}const es=e=>{let{collisionRect:n,droppableRects:t,droppableContainers:r}=e;const s=[];for(const o of r){const{id:i}=o,a=t.get(i);if(a){const l=Zr(a,n);l>0&&s.push({id:i,data:{droppableContainer:o,value:l}})}}return s.sort(Gr)};function ts(e,n,t){return{...e,scaleX:n&&t?n.width/t.width:1,scaleY:n&&t?n.height/t.height:1}}function un(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:le}function ns(e){return function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];return s.reduce((i,a)=>({...i,top:i.top+e*a.y,bottom:i.bottom+e*a.y,left:i.left+e*a.x,right:i.right+e*a.x}),{...t})}}const rs=ns(1);function dn(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function ss(e,n,t){const r=dn(n);if(!r)return e;const{scaleX:s,scaleY:o,x:i,y:a}=r,l=e.left-i-(1-s)*parseFloat(t),c=e.top-a-(1-o)*parseFloat(t.slice(t.indexOf(" ")+1)),d=s?e.width/s:e.width,f=o?e.height/o:e.height;return{width:d,height:f,top:c,right:l+d,bottom:c+f,left:l}}const os={ignoreTransform:!1};function Oe(e,n){n===void 0&&(n=os);let t=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:c,transformOrigin:d}=Z(e).getComputedStyle(e);c&&(t=ss(t,c,d))}const{top:r,left:s,width:o,height:i,bottom:a,right:l}=t;return{top:r,left:s,width:o,height:i,bottom:a,right:l}}function fn(e){return Oe(e,{ignoreTransform:!0})}function is(e){const n=e.innerWidth,t=e.innerHeight;return{top:0,left:0,right:n,bottom:t,width:n,height:t}}function as(e,n){return n===void 0&&(n=Z(e).getComputedStyle(e)),n.position==="fixed"}function ls(e,n){n===void 0&&(n=Z(e).getComputedStyle(e));const t=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const o=n[s];return typeof o=="string"?t.test(o):!1})}function Ot(e,n){const t=[];function r(s){if(n!=null&&t.length>=n||!s)return t;if(Dt(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!$e(s)||nn(s)||t.includes(s))return t;const o=Z(e).getComputedStyle(s);return s!==e&&ls(s,o)&&t.push(s),as(s,o)?t:r(s.parentNode)}return e?r(e):t}function hn(e){const[n]=Ot(e,1);return n??null}function At(e){return!rt||!e?null:De(e)?e:Nt(e)?Dt(e)||e===je(e).scrollingElement?window:$e(e)?e:null:null}function gn(e){return De(e)?e.scrollX:e.scrollLeft}function mn(e){return De(e)?e.scrollY:e.scrollTop}function It(e){return{x:gn(e),y:mn(e)}}var H;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(H||(H={}));function pn(e){return!rt||!e?!1:e===document.scrollingElement}function vn(e){const n={x:0,y:0},t=pn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-t.width,y:e.scrollHeight-t.height},s=e.scrollTop<=n.y,o=e.scrollLeft<=n.x,i=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:o,isBottom:i,isRight:a,maxScroll:r,minScroll:n}}const cs={x:.2,y:.2};function us(e,n,t,r,s){let{top:o,left:i,right:a,bottom:l}=t;r===void 0&&(r=10),s===void 0&&(s=cs);const{isTop:c,isBottom:d,isLeft:f,isRight:g}=vn(e),p={x:0,y:0},N={x:0,y:0},b={height:n.height*s.y,width:n.width*s.x};return!c&&o<=n.top+b.height?(p.y=H.Backward,N.y=r*Math.abs((n.top+b.height-o)/b.height)):!d&&l>=n.bottom-b.height&&(p.y=H.Forward,N.y=r*Math.abs((n.bottom-b.height-l)/b.height)),!g&&a>=n.right-b.width?(p.x=H.Forward,N.x=r*Math.abs((n.right-b.width-a)/b.width)):!f&&i<=n.left+b.width&&(p.x=H.Backward,N.x=r*Math.abs((n.left+b.width-i)/b.width)),{direction:p,speed:N}}function ds(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:n,left:t,right:r,bottom:s}=e.getBoundingClientRect();return{top:n,left:t,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function bn(e){return e.reduce((n,t)=>ke(n,It(t)),le)}function fs(e){return e.reduce((n,t)=>n+gn(t),0)}function hs(e){return e.reduce((n,t)=>n+mn(t),0)}function xn(e,n){if(n===void 0&&(n=Oe),!e)return;const{top:t,left:r,bottom:s,right:o}=n(e);hn(e)&&(s<=0||o<=0||t>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const gs=[["x",["left","right"],fs],["y",["top","bottom"],hs]];class Mt{constructor(n,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ot(t),s=bn(r);this.rect={...n},this.width=n.width,this.height=n.height;for(const[o,i,a]of gs)for(const l of i)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=s[o]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class We{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(t=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...t)})},this.target=n}add(n,t,r){var s;(s=this.target)==null||s.addEventListener(n,t,r),this.listeners.push([n,t,r])}}function ms(e){const{EventTarget:n}=Z(e);return e instanceof n?e:je(e)}function Tt(e,n){const t=Math.abs(e.x),r=Math.abs(e.y);return typeof n=="number"?Math.sqrt(t**2+r**2)>n:"x"in n&&"y"in n?t>n.x&&r>n.y:"x"in n?t>n.x:"y"in n?r>n.y:!1}var oe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oe||(oe={}));function yn(e){e.preventDefault()}function ps(e){e.stopPropagation()}var L;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(L||(L={}));const wn={start:[L.Space,L.Enter],cancel:[L.Esc],end:[L.Space,L.Enter,L.Tab]},vs=(e,n)=>{let{currentCoordinates:t}=n;switch(e.code){case L.Right:return{...t,x:t.x+25};case L.Left:return{...t,x:t.x-25};case L.Down:return{...t,y:t.y+25};case L.Up:return{...t,y:t.y-25}}};class Cn{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:t}}=n;this.props=n,this.listeners=new We(je(t)),this.windowListeners=new We(Z(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oe.Resize,this.handleCancel),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:t}=this.props,r=n.node.current;r&&xn(r),t(le)}handleKeyDown(n){if(lt(n)){const{active:t,context:r,options:s}=this.props,{keyboardCodes:o=wn,coordinateGetter:i=vs,scrollBehavior:a="smooth"}=s,{code:l}=n;if(o.end.includes(l)){this.handleEnd(n);return}if(o.cancel.includes(l)){this.handleCancel(n);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:le;this.referenceCoordinates||(this.referenceCoordinates=d);const f=i(n,{active:t,context:r.current,currentCoordinates:d});if(f){const g=at(f,d),p={x:0,y:0},{scrollableAncestors:N}=r.current;for(const b of N){const v=n.code,{isTop:k,isRight:j,isLeft:I,isBottom:A,maxScroll:S,minScroll:x}=vn(b),C=ds(b),y={x:Math.min(v===L.Right?C.right-C.width/2:C.right,Math.max(v===L.Right?C.left:C.left+C.width/2,f.x)),y:Math.min(v===L.Down?C.bottom-C.height/2:C.bottom,Math.max(v===L.Down?C.top:C.top+C.height/2,f.y))},M=v===L.Right&&!j||v===L.Left&&!I,w=v===L.Down&&!A||v===L.Up&&!k;if(M&&y.x!==f.x){const D=b.scrollLeft+g.x,O=v===L.Right&&D<=S.x||v===L.Left&&D>=x.x;if(O&&!g.y){b.scrollTo({left:D,behavior:a});return}O?p.x=b.scrollLeft-D:p.x=v===L.Right?b.scrollLeft-S.x:b.scrollLeft-x.x,p.x&&b.scrollBy({left:-p.x,behavior:a});break}else if(w&&y.y!==f.y){const D=b.scrollTop+g.y,O=v===L.Down&&D<=S.y||v===L.Up&&D>=x.y;if(O&&!g.x){b.scrollTo({top:D,behavior:a});return}O?p.y=b.scrollTop-D:p.y=v===L.Down?b.scrollTop-S.y:b.scrollTop-x.y,p.y&&b.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(n,ke(at(f,this.referenceCoordinates),p))}}}handleMove(n,t){const{onMove:r}=this.props;n.preventDefault(),r(t)}handleEnd(n){const{onEnd:t}=this.props;n.preventDefault(),this.detach(),t()}handleCancel(n){const{onCancel:t}=this.props;n.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Cn.activators=[{eventName:"onKeyDown",handler:(e,n,t)=>{let{keyboardCodes:r=wn,onActivation:s}=n,{active:o}=t;const{code:i}=e.nativeEvent;if(r.start.includes(i)){const a=o.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Sn(e){return!!(e&&"distance"in e)}function En(e){return!!(e&&"delay"in e)}class _t{constructor(n,t,r){var s;r===void 0&&(r=ms(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=t;const{event:o}=n,{target:i}=o;this.props=n,this.events=t,this.document=je(i),this.documentListeners=new We(this.document),this.listeners=new We(r),this.windowListeners=new We(Z(i)),this.initialCoordinates=(s=ct(o))!=null?s:le,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:t,bypassActivationConstraint:r}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(oe.Resize,this.handleCancel),this.windowListeners.add(oe.DragStart,yn),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),this.windowListeners.add(oe.ContextMenu,yn),this.documentListeners.add(oe.Keydown,this.handleKeydown),t){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(En(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Sn(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,t){const{active:r,onPending:s}=this.props;s(r,n,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:n}=this,{onStart:t}=this.props;n&&(this.activated=!0,this.documentListeners.add(oe.Click,ps,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oe.SelectionChange,this.removeTextSelection),t(n))}handleMove(n){var t;const{activated:r,initialCoordinates:s,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!s)return;const l=(t=ct(n))!=null?t:le,c=at(s,l);if(!r&&a){if(Sn(a)){if(a.tolerance!=null&&Tt(c,a.tolerance))return this.handleCancel();if(Tt(c,a.distance))return this.handleStart()}if(En(a)&&Tt(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}n.cancelable&&n.preventDefault(),i(l)}handleEnd(){const{onAbort:n,onEnd:t}=this.props;this.detach(),this.activated||n(this.props.active),t()}handleCancel(){const{onAbort:n,onCancel:t}=this.props;this.detach(),this.activated||n(this.props.active),t()}handleKeydown(n){n.code===L.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const bs={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class dt extends _t{constructor(n){const{event:t}=n,r=je(t.target);super(n,bs,r)}}dt.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;return!t.isPrimary||t.button!==0?!1:(r?.({event:t}),!0)}}];const xs={move:{name:"mousemove"},end:{name:"mouseup"}};var Rt;(function(e){e[e.RightClick=2]="RightClick"})(Rt||(Rt={}));class ys extends _t{constructor(n){super(n,xs,je(n.event.target))}}ys.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;return t.button===Rt.RightClick?!1:(r?.({event:t}),!0)}}];const zt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Nn extends _t{constructor(n){super(n,zt)}static setup(){return window.addEventListener(zt.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(zt.move.name,n)};function n(){}}}Nn.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:t}=e,{onActivation:r}=n;const{touches:s}=t;return s.length>1?!1:(r?.({event:t}),!0)}}];var Ye;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ye||(Ye={}));var ft;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ft||(ft={}));function ws(e){let{acceleration:n,activator:t=Ye.Pointer,canScroll:r,draggingRect:s,enabled:o,interval:i=5,order:a=ft.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:f,threshold:g}=e;const p=Ss({delta:f,disabled:!o}),[N,b]=Rr(),v=u.useRef({x:0,y:0}),k=u.useRef({x:0,y:0}),j=u.useMemo(()=>{switch(t){case Ye.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ye.DraggableRect:return s}},[t,s,l]),I=u.useRef(null),A=u.useCallback(()=>{const x=I.current;if(!x)return;const C=v.current.x*k.current.x,y=v.current.y*k.current.y;x.scrollBy(C,y)},[]),S=u.useMemo(()=>a===ft.TreeOrder?[...c].reverse():c,[a,c]);u.useEffect(()=>{if(!o||!c.length||!j){b();return}for(const x of S){if(r?.(x)===!1)continue;const C=c.indexOf(x),y=d[C];if(!y)continue;const{direction:M,speed:w}=us(x,y,j,n,g);for(const D of["x","y"])p[D][M[D]]||(w[D]=0,M[D]=0);if(w.x>0||w.y>0){b(),I.current=x,N(A,i),v.current=w,k.current=M;return}}v.current={x:0,y:0},k.current={x:0,y:0},b()},[n,A,r,b,o,i,JSON.stringify(j),JSON.stringify(p),N,c,S,d,JSON.stringify(g)])}const Cs={x:{[H.Backward]:!1,[H.Forward]:!1},y:{[H.Backward]:!1,[H.Forward]:!1}};function Ss(e){let{delta:n,disabled:t}=e;const r=it(n);return Ve(s=>{if(t||!r||!s)return Cs;const o={x:Math.sign(n.x-r.x),y:Math.sign(n.y-r.y)};return{x:{[H.Backward]:s.x[H.Backward]||o.x===-1,[H.Forward]:s.x[H.Forward]||o.x===1},y:{[H.Backward]:s.y[H.Backward]||o.y===-1,[H.Forward]:s.y[H.Forward]||o.y===1}}},[t,n,r])}function Es(e,n){const t=n!=null?e.get(n):void 0,r=t?t.node.current:null;return Ve(s=>{var o;return n==null?null:(o=r??s)!=null?o:null},[r,n])}function Ns(e,n){return u.useMemo(()=>e.reduce((t,r)=>{const{sensor:s}=r,o=s.activators.map(i=>({eventName:i.eventName,handler:n(i.handler,r)}));return[...t,...o]},[]),[e,n])}var Ue;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ue||(Ue={}));var Lt;(function(e){e.Optimized="optimized"})(Lt||(Lt={}));const Dn=new Map;function Ds(e,n){let{dragging:t,dependencies:r,config:s}=n;const[o,i]=u.useState(null),{frequency:a,measure:l,strategy:c}=s,d=u.useRef(e),f=v(),g=Be(f),p=u.useCallback(function(k){k===void 0&&(k=[]),!g.current&&i(j=>j===null?k:j.concat(k.filter(I=>!j.includes(I))))},[g]),N=u.useRef(null),b=Ve(k=>{if(f&&!t)return Dn;if(!k||k===Dn||d.current!==e||o!=null){const j=new Map;for(let I of e){if(!I)continue;if(o&&o.length>0&&!o.includes(I.id)&&I.rect.current){j.set(I.id,I.rect.current);continue}const A=I.node.current,S=A?new Mt(l(A),A):null;I.rect.current=S,S&&j.set(I.id,S)}return j}return k},[e,o,t,f,l]);return u.useEffect(()=>{d.current=e},[e]),u.useEffect(()=>{f||p()},[t,f]),u.useEffect(()=>{o&&o.length>0&&i(null)},[JSON.stringify(o)]),u.useEffect(()=>{f||typeof a!="number"||N.current!==null||(N.current=setTimeout(()=>{p(),N.current=null},a))},[a,f,p,...r]),{droppableRects:b,measureDroppableContainers:p,measuringScheduled:o!=null};function v(){switch(c){case Ue.Always:return!1;case Ue.BeforeDragging:return t;default:return!t}}}function Pt(e,n){return Ve(t=>e?t||(typeof n=="function"?n(e):e):null,[n,e])}function js(e,n){return Pt(e,n)}function ks(e){let{callback:n,disabled:t}=e;const r=st(n),s=u.useMemo(()=>{if(t||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,t]);return u.useEffect(()=>()=>s?.disconnect(),[s]),s}function ht(e){let{callback:n,disabled:t}=e;const r=st(n),s=u.useMemo(()=>{if(t||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[t]);return u.useEffect(()=>()=>s?.disconnect(),[s]),s}function Os(e){return new Mt(Oe(e),e)}function jn(e,n,t){n===void 0&&(n=Os);const[r,s]=u.useState(null);function o(){s(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??t)!=null?c:null}const d=n(e);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const i=ks({callback(l){if(e)for(const c of l){const{type:d,target:f}=c;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){o();break}}}}),a=ht({callback:o});return ae(()=>{o(),e?(a?.observe(e),i?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),i?.disconnect())},[e]),r}function As(e){const n=Pt(e);return un(e,n)}const kn=[];function Is(e){const n=u.useRef(e),t=Ve(r=>e?r&&r!==kn&&e&&n.current&&e.parentNode===n.current.parentNode?r:Ot(e):kn,[e]);return u.useEffect(()=>{n.current=e},[e]),t}function Ms(e){const[n,t]=u.useState(null),r=u.useRef(e),s=u.useCallback(o=>{const i=At(o.target);i&&t(a=>a?(a.set(i,It(i)),new Map(a)):null)},[]);return u.useEffect(()=>{const o=r.current;if(e!==o){i(o);const a=e.map(l=>{const c=At(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,It(c)]):null}).filter(l=>l!=null);t(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const c=At(l);c?.removeEventListener("scroll",s)})}},[s,e]),u.useMemo(()=>e.length?n?Array.from(n.values()).reduce((o,i)=>ke(o,i),le):bn(e):le,[e,n])}function On(e,n){n===void 0&&(n=[]);const t=u.useRef(null);return u.useEffect(()=>{t.current=null},n),u.useEffect(()=>{const r=e!==le;r&&!t.current&&(t.current=e),!r&&t.current&&(t.current=null)},[e]),t.current?at(e,t.current):le}function Ts(e){u.useEffect(()=>{if(!rt)return;const n=e.map(t=>{let{sensor:r}=t;return r.setup==null?void 0:r.setup()});return()=>{for(const t of n)t?.()}},e.map(n=>{let{sensor:t}=n;return t}))}function _s(e,n){return u.useMemo(()=>e.reduce((t,r)=>{let{eventName:s,handler:o}=r;return t[s]=i=>{o(i,n)},t},{}),[e,n])}function An(e){return u.useMemo(()=>e?is(e):null,[e])}const In=[];function Rs(e,n){n===void 0&&(n=Oe);const[t]=e,r=An(t?Z(t):null),[s,o]=u.useState(In);function i(){o(()=>e.length?e.map(l=>pn(l)?r:new Mt(n(l),l)):In)}const a=ht({callback:i});return ae(()=>{a?.disconnect(),i(),e.forEach(l=>a?.observe(l))},[e]),s}function Mn(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return $e(n)?n:e}function zs(e){let{measure:n}=e;const[t,r]=u.useState(null),s=u.useCallback(c=>{for(const{target:d}of c)if($e(d)){r(f=>{const g=n(d);return f?{...f,width:g.width,height:g.height}:g});break}},[n]),o=ht({callback:s}),i=u.useCallback(c=>{const d=Mn(c);o?.disconnect(),d&&o?.observe(d),r(d?n(d):null)},[n,o]),[a,l]=ot(i);return u.useMemo(()=>({nodeRef:a,rect:t,setRef:l}),[t,a,l])}const Ls=[{sensor:dt,options:{}},{sensor:Cn,options:{}}],Ps={current:{}},gt={draggable:{measure:fn},droppable:{measure:fn,strategy:Ue.WhileDragging,frequency:Lt.Optimized},dragOverlay:{measure:Oe}};class qe extends Map{get(n){var t;return n!=null&&(t=super.get(n))!=null?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:t}=n;return!t})}getNodeFor(n){var t,r;return(t=(r=this.get(n))==null?void 0:r.node.current)!=null?t:void 0}}const Fs={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new qe,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ut},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:gt,measureDroppableContainers:ut,windowRect:null,measuringScheduled:!1},Tn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ut,draggableNodes:new Map,over:null,measureDroppableContainers:ut},Xe=u.createContext(Tn),_n=u.createContext(Fs);function $s(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new qe}}}function Bs(e,n){switch(n.type){case X.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case X.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case X.DragEnd:case X.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case X.RegisterDroppable:{const{element:t}=n,{id:r}=t,s=new qe(e.droppable.containers);return s.set(r,t),{...e,droppable:{...e.droppable,containers:s}}}case X.SetDroppableDisabled:{const{id:t,key:r,disabled:s}=n,o=e.droppable.containers.get(t);if(!o||r!==o.key)return e;const i=new qe(e.droppable.containers);return i.set(t,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:i}}}case X.UnregisterDroppable:{const{id:t,key:r}=n,s=e.droppable.containers.get(t);if(!s||r!==s.key)return e;const o=new qe(e.droppable.containers);return o.delete(t),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function Vs(e){let{disabled:n}=e;const{active:t,activatorEvent:r,draggableNodes:s}=u.useContext(Xe),o=it(r),i=it(t?.id);return u.useEffect(()=>{if(!n&&!r&&o&&i!=null){if(!lt(o)||document.activeElement===o.target)return;const a=s.get(i);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const f=Pr(d);if(f){f.focus();break}}})}},[r,n,s,i,o]),null}function Rn(e,n){let{transform:t,...r}=n;return e!=null&&e.length?e.reduce((s,o)=>o({transform:s,...r}),t):t}function Ks(e){return u.useMemo(()=>({draggable:{...gt.draggable,...e?.draggable},droppable:{...gt.droppable,...e?.droppable},dragOverlay:{...gt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ws(e){let{activeNode:n,measure:t,initialRect:r,config:s=!0}=e;const o=u.useRef(!1),{x:i,y:a}=typeof s=="boolean"?{x:s,y:s}:s;ae(()=>{if(!i&&!a||!n){o.current=!1;return}if(o.current||!r)return;const c=n?.node.current;if(!c||c.isConnected===!1)return;const d=t(c),f=un(d,r);if(i||(f.x=0),a||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const g=hn(c);g&&g.scrollBy({top:f.y,left:f.x})}},[n,i,a,r,t])}const mt=u.createContext({...le,scaleX:1,scaleY:1});var ve;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ve||(ve={}));const zn=u.memo(function(n){var t,r,s,o;let{id:i,accessibility:a,autoScroll:l=!0,children:c,sensors:d=Ls,collisionDetection:f=es,measuring:g,modifiers:p,...N}=n;const b=u.useReducer(Bs,void 0,$s),[v,k]=b,[j,I]=Wr(),[A,S]=u.useState(ve.Uninitialized),x=A===ve.Initialized,{draggable:{active:C,nodes:y,translate:M},droppable:{containers:w}}=v,D=C!=null?y.get(C):null,O=u.useRef({initial:null,translated:null}),T=u.useMemo(()=>{var Q;return C!=null?{id:C,data:(Q=D?.data)!=null?Q:Ps,rect:O}:null},[C,D]),V=u.useRef(null),[P,K]=u.useState(null),[$,U]=u.useState(null),Y=Be(N,Object.values(N)),ce=Ke("DndDescribedBy",i),m=u.useMemo(()=>w.getEnabled(),[w]),E=Ks(g),{droppableRects:R,measureDroppableContainers:z,measuringScheduled:ue}=Ds(m,{dragging:x,dependencies:[M.x,M.y],config:E.droppable}),G=Es(y,C),W=u.useMemo(()=>$?ct($):null,[$]),ee=Ho(),te=js(G,E.draggable.measure);Ws({activeNode:C!=null?y.get(C):null,config:ee.layoutShiftCompensation,initialRect:te,measure:E.draggable.measure});const B=jn(G,E.draggable.measure,te),He=jn(G?G.parentElement:null),de=u.useRef({activatorEvent:null,active:null,activeNode:G,collisionRect:null,collisions:null,droppableRects:R,draggableNodes:y,draggingNode:null,draggingNodeRect:null,droppableContainers:w,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ie=w.getNodeFor((t=de.current.over)==null?void 0:t.id),me=zs({measure:E.dragOverlay.measure}),Me=(r=me.nodeRef.current)!=null?r:G,Te=x?(s=me.rect)!=null?s:B:null,Zn=!!(me.nodeRef.current&&me.rect),er=As(Zn?null:B),Yt=An(Me?Z(Me):null),be=Is(x?Ie??G:null),wt=Rs(be),Ct=Rn(p,{transform:{x:M.x-er.x,y:M.y-er.y,scaleX:1,scaleY:1},activatorEvent:$,active:T,activeNodeRect:B,containerNodeRect:He,draggingNodeRect:Te,over:de.current.over,overlayNodeRect:me.rect,scrollableAncestors:be,scrollableAncestorRects:wt,windowRect:Yt}),tr=W?ke(W,M):null,nr=Ms(be),Vo=On(nr),Ko=On(nr,[B]),_e=ke(Ct,Vo),Re=Te?rs(Te,Ct):null,Je=T&&Re?f({active:T,collisionRect:Re,droppableRects:R,droppableContainers:m,pointerCoordinates:tr}):null,rr=Qr(Je,"id"),[xe,sr]=u.useState(null),Wo=Zn?Ct:ke(Ct,Ko),Yo=ts(Wo,(o=xe?.rect)!=null?o:null,B),Ut=u.useRef(null),or=u.useCallback((Q,ne)=>{let{sensor:re,options:ye}=ne;if(V.current==null)return;const ie=y.get(V.current);if(!ie)return;const se=Q.nativeEvent,fe=new re({active:V.current,activeNode:ie,event:se,options:ye,context:de,onAbort(J){if(!y.get(J))return;const{onDragAbort:he}=Y.current,pe={id:J};he?.(pe),j({type:"onDragAbort",event:pe})},onPending(J,we,he,pe){if(!y.get(J))return;const{onDragPending:Qe}=Y.current,Ce={id:J,constraint:we,initialCoordinates:he,offset:pe};Qe?.(Ce),j({type:"onDragPending",event:Ce})},onStart(J){const we=V.current;if(we==null)return;const he=y.get(we);if(!he)return;const{onDragStart:pe}=Y.current,Ge={activatorEvent:se,active:{id:we,data:he.data,rect:O}};Ne.unstable_batchedUpdates(()=>{pe?.(Ge),S(ve.Initializing),k({type:X.DragStart,initialCoordinates:J,active:we}),j({type:"onDragStart",event:Ge}),K(Ut.current),U(se)})},onMove(J){k({type:X.DragMove,coordinates:J})},onEnd:ze(X.DragEnd),onCancel:ze(X.DragCancel)});Ut.current=fe;function ze(J){return async function(){const{active:he,collisions:pe,over:Ge,scrollAdjustedTranslate:Qe}=de.current;let Ce=null;if(he&&Qe){const{cancelDrop:Ze}=Y.current;Ce={activatorEvent:se,active:he,collisions:pe,delta:Qe,over:Ge},J===X.DragEnd&&typeof Ze=="function"&&await Promise.resolve(Ze(Ce))&&(J=X.DragCancel)}V.current=null,Ne.unstable_batchedUpdates(()=>{k({type:J}),S(ve.Uninitialized),sr(null),K(null),U(null),Ut.current=null;const Ze=J===X.DragEnd?"onDragEnd":"onDragCancel";if(Ce){const qt=Y.current[Ze];qt?.(Ce),j({type:Ze,event:Ce})}})}}},[y]),Uo=u.useCallback((Q,ne)=>(re,ye)=>{const ie=re.nativeEvent,se=y.get(ye);if(V.current!==null||!se||ie.dndKit||ie.defaultPrevented)return;const fe={active:se};Q(re,ne.options,fe)===!0&&(ie.dndKit={capturedBy:ne.sensor},V.current=ye,or(re,ne))},[y,or]),ir=Ns(d,Uo);Ts(d),ae(()=>{B&&A===ve.Initializing&&S(ve.Initialized)},[B,A]),u.useEffect(()=>{const{onDragMove:Q}=Y.current,{active:ne,activatorEvent:re,collisions:ye,over:ie}=de.current;if(!ne||!re)return;const se={active:ne,activatorEvent:re,collisions:ye,delta:{x:_e.x,y:_e.y},over:ie};Ne.unstable_batchedUpdates(()=>{Q?.(se),j({type:"onDragMove",event:se})})},[_e.x,_e.y]),u.useEffect(()=>{const{active:Q,activatorEvent:ne,collisions:re,droppableContainers:ye,scrollAdjustedTranslate:ie}=de.current;if(!Q||V.current==null||!ne||!ie)return;const{onDragOver:se}=Y.current,fe=ye.get(rr),ze=fe&&fe.rect.current?{id:fe.id,rect:fe.rect.current,data:fe.data,disabled:fe.disabled}:null,J={active:Q,activatorEvent:ne,collisions:re,delta:{x:ie.x,y:ie.y},over:ze};Ne.unstable_batchedUpdates(()=>{sr(ze),se?.(J),j({type:"onDragOver",event:J})})},[rr]),ae(()=>{de.current={activatorEvent:$,active:T,activeNode:G,collisionRect:Re,collisions:Je,droppableRects:R,draggableNodes:y,draggingNode:Me,draggingNodeRect:Te,droppableContainers:w,over:xe,scrollableAncestors:be,scrollAdjustedTranslate:_e},O.current={initial:Te,translated:Re}},[T,G,Je,Re,y,Me,Te,R,w,xe,be,_e]),ws({...ee,delta:M,draggingRect:Re,pointerCoordinates:tr,scrollableAncestors:be,scrollableAncestorRects:wt});const qo=u.useMemo(()=>({active:T,activeNode:G,activeNodeRect:B,activatorEvent:$,collisions:Je,containerNodeRect:He,dragOverlay:me,draggableNodes:y,droppableContainers:w,droppableRects:R,over:xe,measureDroppableContainers:z,scrollableAncestors:be,scrollableAncestorRects:wt,measuringConfiguration:E,measuringScheduled:ue,windowRect:Yt}),[T,G,B,$,Je,He,me,y,w,R,xe,z,be,wt,E,ue,Yt]),Xo=u.useMemo(()=>({activatorEvent:$,activators:ir,active:T,activeNodeRect:B,ariaDescribedById:{draggable:ce},dispatch:k,draggableNodes:y,over:xe,measureDroppableContainers:z}),[$,ir,T,B,k,ce,y,xe,z]);return u.createElement(on.Provider,{value:I},u.createElement(Xe.Provider,{value:Xo},u.createElement(_n.Provider,{value:qo},u.createElement(mt.Provider,{value:Yo},c)),u.createElement(Vs,{disabled:a?.restoreFocus===!1})),u.createElement(qr,{...a,hiddenTextDescribedById:ce}));function Ho(){const Q=P?.autoScrollEnabled===!1,ne=typeof l=="object"?l.enabled===!1:l===!1,re=x&&!Q&&!ne;return typeof l=="object"?{...l,enabled:re}:{enabled:re}}}),Ys=u.createContext(null),Ln="button",Us="Draggable";function qs(e){let{id:n,data:t,disabled:r=!1,attributes:s}=e;const o=Ke(Us),{activators:i,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:f,over:g}=u.useContext(Xe),{role:p=Ln,roleDescription:N="draggable",tabIndex:b=0}=s??{},v=l?.id===n,k=u.useContext(v?mt:Ys),[j,I]=ot(),[A,S]=ot(),x=_s(i,n),C=Be(t);ae(()=>(f.set(n,{id:n,key:o,node:j,activatorNode:A,data:C}),()=>{const M=f.get(n);M&&M.key===o&&f.delete(n)}),[f,n]);const y=u.useMemo(()=>({role:p,tabIndex:b,"aria-disabled":r,"aria-pressed":v&&p===Ln?!0:void 0,"aria-roledescription":N,"aria-describedby":d.draggable}),[r,p,b,v,N,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:y,isDragging:v,listeners:r?void 0:x,node:j,over:g,setNodeRef:I,setActivatorNodeRef:S,transform:k}}function Pn(){return u.useContext(_n)}const Xs="Droppable",Hs={timeout:25};function Js(e){let{data:n,disabled:t=!1,id:r,resizeObserverConfig:s}=e;const o=Ke(Xs),{active:i,dispatch:a,over:l,measureDroppableContainers:c}=u.useContext(Xe),d=u.useRef({disabled:t}),f=u.useRef(!1),g=u.useRef(null),p=u.useRef(null),{disabled:N,updateMeasurementsFor:b,timeout:v}={...Hs,...s},k=Be(b??r),j=u.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(k.current)?k.current:[k.current]),p.current=null},v)},[v]),I=ht({callback:j,disabled:N||!i}),A=u.useCallback((y,M)=>{I&&(M&&(I.unobserve(M),f.current=!1),y&&I.observe(y))},[I]),[S,x]=ot(A),C=Be(n);return u.useEffect(()=>{!I||!S.current||(I.disconnect(),f.current=!1,I.observe(S.current))},[S,I]),u.useEffect(()=>(a({type:X.RegisterDroppable,element:{id:r,key:o,disabled:t,node:S,rect:g,data:C}}),()=>a({type:X.UnregisterDroppable,key:o,id:r})),[r]),u.useEffect(()=>{t!==d.current.disabled&&(a({type:X.SetDroppableDisabled,id:r,key:o,disabled:t}),d.current.disabled=t)},[r,o,t,a]),{active:i,rect:g,isOver:l?.id===r,node:S,over:l,setNodeRef:x}}function Gs(e){let{animation:n,children:t}=e;const[r,s]=u.useState(null),[o,i]=u.useState(null),a=it(t);return!t&&!r&&a&&s(a),ae(()=>{if(!o)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(n(c,o)).then(()=>{s(null)})},[n,r,o]),u.createElement(u.Fragment,null,t,r?u.cloneElement(r,{ref:i}):null)}const Qs={x:0,y:0,scaleX:1,scaleY:1};function Zs(e){let{children:n}=e;return u.createElement(Xe.Provider,{value:Tn},u.createElement(mt.Provider,{value:Qs},n))}const eo={position:"fixed",touchAction:"none"},to=e=>lt(e)?"transform 250ms ease":void 0,no=u.forwardRef((e,n)=>{let{as:t,activatorEvent:r,adjustScale:s,children:o,className:i,rect:a,style:l,transform:c,transition:d=to}=e;if(!a)return null;const f=s?c:{...c,scaleX:1,scaleY:1},g={...eo,width:a.width,height:a.height,top:a.top,left:a.left,transform:ge.Transform.toString(f),transformOrigin:s&&r?Hr(r,a):void 0,transition:typeof d=="function"?d(r):d,...l};return u.createElement(t,{className:i,style:g,ref:n},o)}),ro={duration:250,easing:"ease",keyframes:e=>{let{transform:{initial:n,final:t}}=e;return[{transform:ge.Transform.toString(n)},{transform:ge.Transform.toString(t)}]},sideEffects:(e=>n=>{let{active:t,dragOverlay:r}=n;const s={},{styles:o,className:i}=e;if(o!=null&&o.active)for(const[a,l]of Object.entries(o.active))l!==void 0&&(s[a]=t.node.style.getPropertyValue(a),t.node.style.setProperty(a,l));if(o!=null&&o.dragOverlay)for(const[a,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return i!=null&&i.active&&t.node.classList.add(i.active),i!=null&&i.dragOverlay&&r.node.classList.add(i.dragOverlay),function(){for(const[l,c]of Object.entries(s))t.node.style.setProperty(l,c);i!=null&&i.active&&t.node.classList.remove(i.active)}})({styles:{active:{opacity:"0"}}})};function so(e){let{config:n,draggableNodes:t,droppableContainers:r,measuringConfiguration:s}=e;return st((o,i)=>{if(n===null)return;const a=t.get(o);if(!a)return;const l=a.node.current;if(!l)return;const c=Mn(i);if(!c)return;const{transform:d}=Z(i).getComputedStyle(i),f=dn(d);if(!f)return;const g=typeof n=="function"?n:oo(n);return xn(l,s.draggable.measure),g({active:{id:o,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:t,dragOverlay:{node:i,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:f})})}function oo(e){const{duration:n,easing:t,sideEffects:r,keyframes:s}={...ro,...e};return o=>{let{active:i,dragOverlay:a,transform:l,...c}=o;if(!n)return;const d={x:a.rect.left-i.rect.left,y:a.rect.top-i.rect.top},f={scaleX:l.scaleX!==1?i.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?i.rect.height*l.scaleY/a.rect.height:1},g={x:l.x-d.x,y:l.y-d.y,...f},p=s({...c,active:i,dragOverlay:a,transform:{initial:l,final:g}}),[N]=p,b=p[p.length-1];if(JSON.stringify(N)===JSON.stringify(b))return;const v=r?.({active:i,dragOverlay:a,...c}),k=a.node.animate(p,{duration:n,easing:t,fill:"forwards"});return new Promise(j=>{k.onfinish=()=>{v?.(),j()}})}}let Fn=0;function io(e){return u.useMemo(()=>{if(e!=null)return Fn++,Fn},[e])}const $n=u.memo(e=>{let{adjustScale:n=!1,children:t,dropAnimation:r,style:s,transition:o,modifiers:i,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:d,active:f,activeNodeRect:g,containerNodeRect:p,draggableNodes:N,droppableContainers:b,dragOverlay:v,over:k,measuringConfiguration:j,scrollableAncestors:I,scrollableAncestorRects:A,windowRect:S}=Pn(),x=u.useContext(mt),C=io(f?.id),y=Rn(i,{activatorEvent:d,active:f,activeNodeRect:g,containerNodeRect:p,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:I,scrollableAncestorRects:A,transform:x,windowRect:S}),M=Pt(g),w=so({config:r,draggableNodes:N,droppableContainers:b,measuringConfiguration:j}),D=M?v.setRef:void 0;return u.createElement(Zs,null,u.createElement(Gs,{animation:w},f&&C?u.createElement(no,{key:C,id:f.id,ref:D,as:a,activatorEvent:d,adjustScale:n,className:l,transition:o,rect:M,style:{zIndex:c,...s},transform:y},t):null))});function pt(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function ao(e,n){return e.reduce((t,r,s)=>{const o=n.get(r);return o&&(t[s]=o),t},Array(e.length))}function vt(e){return e!==null&&e>=0}function lo(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function co(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Bn=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const o=pt(n,r,t),i=n[s],a=o[s];return!a||!i?null:{x:a.left-i.left,y:a.top-i.top,scaleX:a.width/i.width,scaleY:a.height/i.height}},bt={scaleX:1,scaleY:1},Ft=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:o,overIndex:i}=e;const a=(n=o[t])!=null?n:r;if(!a)return null;if(s===t){const c=o[i];return c?{x:0,y:t<i?c.top+c.height-(a.top+a.height):c.top-a.top,...bt}:null}const l=uo(o,s,t);return s>t&&s<=i?{x:0,y:-a.height-l,...bt}:s<t&&s>=i?{x:0,y:a.height+l,...bt}:{x:0,y:0,...bt}};function uo(e,n,t){const r=e[n],s=e[n-1],o=e[n+1];return r?t<n?s?r.top-(s.top+s.height):o?o.top-(r.top+r.height):0:o?o.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const Vn="Sortable",Kn=u.createContext({activeIndex:-1,containerId:Vn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Bn,disabled:{draggable:!1,droppable:!1}});function $t(e){let{children:n,id:t,items:r,strategy:s=Bn,disabled:o=!1}=e;const{active:i,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=Pn(),f=Ke(Vn,t),g=a.rect!==null,p=u.useMemo(()=>r.map(x=>typeof x=="object"&&"id"in x?x.id:x),[r]),N=i!=null,b=i?p.indexOf(i.id):-1,v=c?p.indexOf(c.id):-1,k=u.useRef(p),j=!lo(p,k.current),I=v!==-1&&b===-1||j,A=co(o);ae(()=>{j&&N&&d(p)},[j,p,N,d]),u.useEffect(()=>{k.current=p},[p]);const S=u.useMemo(()=>({activeIndex:b,containerId:f,disabled:A,disableTransforms:I,items:p,overIndex:v,useDragOverlay:g,sortedRects:ao(p,l),strategy:s}),[b,f,A.draggable,A.droppable,I,p,v,l,g,s]);return u.createElement(Kn.Provider,{value:S},n)}const fo=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return pt(t,r,s).indexOf(n)},ho=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:o,newIndex:i,previousItems:a,previousContainerId:l,transition:c}=e;return!c||!r||a!==o&&s===i?!1:t?!0:i!==s&&n===l},go={duration:200,easing:"ease"},Wn="transform",mo=ge.Transition.toString({property:Wn,duration:0,easing:"linear"}),po={roleDescription:"sortable"};function vo(e){let{disabled:n,index:t,node:r,rect:s}=e;const[o,i]=u.useState(null),a=u.useRef(t);return ae(()=>{if(!n&&t!==a.current&&r.current){const l=s.current;if(l){const c=Oe(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&i(d)}}t!==a.current&&(a.current=t)},[n,t,r,s]),u.useEffect(()=>{o&&i(null)},[o]),o}function xt(e){let{animateLayoutChanges:n=ho,attributes:t,disabled:r,data:s,getNewIndex:o=fo,id:i,strategy:a,resizeObserverConfig:l,transition:c=go}=e;const{items:d,containerId:f,activeIndex:g,disabled:p,disableTransforms:N,sortedRects:b,overIndex:v,useDragOverlay:k,strategy:j}=u.useContext(Kn),I=bo(r,p),A=d.indexOf(i),S=u.useMemo(()=>({sortable:{containerId:f,index:A,items:d},...s}),[f,s,A,d]),x=u.useMemo(()=>d.slice(d.indexOf(i)),[d,i]),{rect:C,node:y,isOver:M,setNodeRef:w}=Js({id:i,data:S,disabled:I.droppable,resizeObserverConfig:{updateMeasurementsFor:x,...l}}),{active:D,activatorEvent:O,activeNodeRect:T,attributes:V,setNodeRef:P,listeners:K,isDragging:$,over:U,setActivatorNodeRef:Y,transform:ce}=qs({id:i,data:S,attributes:{...po,...t},disabled:I.draggable}),m=_r(w,P),E=!!D,R=E&&!N&&vt(g)&&vt(v),z=!k&&$,ue=z&&R?ce:null,W=R?ue??(a??j)({rects:b,activeNodeRect:T,activeIndex:g,overIndex:v,index:A}):null,ee=vt(g)&&vt(v)?o({id:i,items:d,activeIndex:g,overIndex:v}):A,te=D?.id,B=u.useRef({activeId:te,items:d,newIndex:ee,containerId:f}),He=d!==B.current.items,de=n({active:D,containerId:f,isDragging:$,isSorting:E,id:i,index:A,items:d,newIndex:B.current.newIndex,previousItems:B.current.items,previousContainerId:B.current.containerId,transition:c,wasDragging:B.current.activeId!=null}),Ie=vo({disabled:!de,index:A,node:y,rect:C});return u.useEffect(()=>{E&&B.current.newIndex!==ee&&(B.current.newIndex=ee),f!==B.current.containerId&&(B.current.containerId=f),d!==B.current.items&&(B.current.items=d)},[E,ee,f,d]),u.useEffect(()=>{if(te===B.current.activeId)return;if(te!=null&&B.current.activeId==null){B.current.activeId=te;return}const Me=setTimeout(()=>{B.current.activeId=te},50);return()=>clearTimeout(Me)},[te]),{active:D,activeIndex:g,attributes:V,data:S,rect:C,index:A,newIndex:ee,items:d,isOver:M,isSorting:E,isDragging:$,listeners:K,node:y,overIndex:v,over:U,setNodeRef:m,setActivatorNodeRef:Y,setDroppableNodeRef:w,setDraggableNodeRef:P,transform:Ie??W,transition:me()};function me(){if(Ie||He&&B.current.newIndex===A)return mo;if(!(z&&!lt(O)||!c)&&(E||de))return ge.Transition.toString({...c,property:Wn})}}function bo(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}L.Down,L.Right,L.Up,L.Left;const yt=(...e)=>e.filter(Boolean).join(" "),Bt="Uncategorized";function xo(e,n){if(!n||n.length===0)return{};for(const t of n){const r=e[t.field];if(r==null)continue;let s=!1;const o=String(r);switch(t.operator){case"equals":s=o===String(t.value);break;case"not_equals":s=o!==String(t.value);break;case"contains":s=o.toLowerCase().includes(String(t.value).toLowerCase());break;case"in":s=Array.isArray(t.value)&&t.value.includes(o);break}if(s)return{...t.backgroundColor?{backgroundColor:t.backgroundColor}:{},...t.borderColor?{borderColor:t.borderColor}:{}}}return{}}function Vt({card:e,onCardClick:n,conditionalFormatting:t}){const{attributes:r,listeners:s,setNodeRef:o,transform:i,transition:a,isDragging:l}=xt({id:e.id}),c={transform:ge.Transform.toString(i),transition:a,opacity:l?.5:void 0},d=xo(e,t);return h.jsx("div",{ref:o,style:c,...r,...s,role:"listitem","aria-label":e.title,onClick:()=>n?.(e),children:h.jsxs(F.Card,{className:"mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",style:d,children:[e.coverImage&&h.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:h.jsx("img",{src:e.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),h.jsxs(F.CardHeader,{className:"p-2 sm:p-4",children:[h.jsx(F.CardTitle,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&h.jsx(F.CardDescription,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:e.description})]}),e.badges&&e.badges.length>0&&h.jsx(F.CardContent,{className:"p-2 sm:p-4 pt-0",children:h.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((f,g)=>h.jsx(F.Badge,{variant:f.variant||"default",className:"text-xs",children:f.label},g))})})]})})}function yo({columnId:e,onAdd:n}){const[t,r]=_.useState(!1),[s,o]=_.useState(""),i=_.useRef(null),a=()=>{const c=s.trim();c&&(n(e,c),o("")),r(!1)},l=c=>{c.key==="Enter"?(c.preventDefault(),a()):c.key==="Escape"&&(o(""),r(!1))};return t?h.jsx("div",{className:"mt-2 space-y-2",children:h.jsx(F.Input,{ref:i,value:s,onChange:c=>o(c.target.value),onKeyDown:l,onBlur:a,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):h.jsxs(F.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{r(!0),setTimeout(()=>i.current?.focus(),0)},children:[h.jsx(tt,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function wo({column:e,cards:n,onCardClick:t,quickAdd:r,onQuickAdd:s,conditionalFormatting:o}){const i=n||[],{setNodeRef:a}=xt({id:e.id,data:{type:"column"}}),l=e.limit&&i.length>=e.limit;return h.jsxs("div",{ref:a,role:"group","aria-label":e.title,className:yt("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",e.className),children:[h.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/30 rounded-t-lg",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{id:`kanban-col-${e.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:e.title}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(F.Badge,{variant:"secondary",className:"text-xs font-mono tabular-nums",children:[i.length,e.limit&&` / ${e.limit}`]}),l&&h.jsx(F.Badge,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),h.jsxs(F.ScrollArea,{className:"flex-1 p-4",children:[h.jsx($t,{items:i.map(c=>c.id),strategy:Ft,children:h.jsxs("div",{className:"space-y-2",role:"list","aria-label":`${e.title} cards`,children:[i.length===0&&h.jsx("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground/50",children:h.jsx("span",{className:"text-xs font-mono",children:"No cards"})}),i.map(c=>h.jsx(Vt,{card:c,onCardClick:t,conditionalFormatting:o},c.id))]})}),r&&s&&h.jsx(yo,{columnId:e.id,onAdd:s})]})]})}function Co({children:e}){const n=Le.useDnd();return h.jsx(h.Fragment,{children:e(n)})}function So({columns:e,onCardMove:n,onCardClick:t,className:r,quickAdd:s,onQuickAdd:o,coverImageField:i,conditionalFormatting:a,swimlaneField:l}){return Le.useHasDndProvider()?h.jsx(Co,{children:d=>h.jsx(Yn,{columns:e,onCardMove:n,onCardClick:t,className:r,dnd:d,quickAdd:s,onQuickAdd:o,coverImageField:i,conditionalFormatting:a,swimlaneField:l})}):h.jsx(Yn,{columns:e,onCardMove:n,onCardClick:t,className:r,dnd:null,quickAdd:s,onQuickAdd:o,coverImageField:i,conditionalFormatting:a,swimlaneField:l})}function Yn({columns:e,onCardMove:n,onCardClick:t,className:r,dnd:s,quickAdd:o,onQuickAdd:i,coverImageField:a,conditionalFormatting:l,swimlaneField:c}){const[d,f]=_.useState(null),g=c?`objectui:kanban-collapsed:${c}`:null,[p,N]=_.useState(()=>{if(!g)return new Set;try{const w=localStorage.getItem(g);if(w){const D=JSON.parse(w);if(Array.isArray(D))return new Set(D.filter(O=>typeof O=="string"))}}catch{}return new Set}),b=_.useMemo(()=>(e||[]).map(w=>({...w,cards:w.cards||[]})),[e]),[v,k]=_.useState(b);_.useEffect(()=>{k(b)},[b]);const j=_.useMemo(()=>{if(!c)return null;const w=v.flatMap(O=>O.cards),D=new Set;return w.forEach(O=>{const T=O[c];D.add(T!=null?String(T):Bt)}),Array.from(D).sort()},[v,c]),I=_.useCallback(w=>{N(D=>{const O=new Set(D);if(O.has(w)?O.delete(w):O.add(w),g)try{localStorage.setItem(g,JSON.stringify([...O]))}catch{}return O})},[g]),A=an(kt(dt,{activationConstraint:{distance:5}}),kt(Nn,{activationConstraint:{delay:200,tolerance:5}})),S=w=>{const{active:D}=w,O=C(D.id);if(f(O),s&&O){const T=y(O.id);T&&s.startDrag({id:O.id,type:"kanban-card",data:O,sourceId:T.id})}},x=w=>{const{active:D,over:O}=w;if(f(null),!O){s&&s.endDrag();return}const T=D.id,V=O.id;if(T===V){s&&s.endDrag();return}const P=y(T),K=y(V)||M(V);if(!P||!K){s&&s.endDrag();return}if(P.id===K.id){const $=[...P.cards],U=$.findIndex(m=>m.id===T),Y=$.findIndex(m=>m.id===V),ce=pt($,U,Y);k(m=>m.map(E=>E.id===P.id?{...E,cards:ce}:E))}else{const $=[...P.cards],U=[...K.cards],Y=$.findIndex(R=>R.id===T),m=V===K.id?U.length:U.findIndex(R=>R.id===V),[E]=$.splice(Y,1);U.splice(m,0,E),k(R=>R.map(z=>z.id===P.id?{...z,cards:$}:z.id===K.id?{...z,cards:U}:z)),n&&n(T,P.id,K.id,m)}s&&s.endDrag(K.id)},C=_.useCallback(w=>{for(const D of v){const O=D.cards.find(T=>T.id===w);if(O)return O}return null},[v]),y=_.useCallback(w=>v.find(D=>D.cards.some(O=>O.id===w))||null,[v]),M=_.useCallback(w=>v.find(D=>D.id===w)||null,[v]);return h.jsxs(zn,{sensors:A,collisionDetection:cn,onDragStart:S,onDragEnd:x,children:[h.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[h.jsxs("span",{children:[v.length," columns"]}),h.jsx("span",{children:"← Swipe to navigate →"})]}),j?h.jsxs("div",{className:yt("flex flex-col gap-1 p-2 sm:p-4 min-w-0 overflow-hidden",r),role:"region","aria-label":"Kanban board with swimlanes",children:[h.jsx("div",{className:"flex gap-3 sm:gap-4 pl-36 sm:pl-44 overflow-x-auto",children:v.map(w=>h.jsxs("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 text-center",children:[h.jsx("span",{className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase",children:w.title}),h.jsxs("span",{className:"ml-2 font-mono text-xs text-muted-foreground",children:["(",w.cards.length,")"]})]},w.id))}),j.map(w=>{const D=p.has(w),O=v.reduce((T,V)=>T+V.cards.filter(P=>(P[c]!=null?String(P[c]):Bt)===w).length,0);return h.jsxs("div",{className:"border rounded-lg bg-muted/10",children:[h.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors",onClick:()=>I(w),"aria-expanded":!D,children:[h.jsx("span",{className:yt("transition-transform text-xs",D?"":"rotate-90"),children:"▶"}),h.jsx("span",{className:"font-mono text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:w}),h.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["(",O,")"]})]}),!D&&h.jsx("div",{className:"flex gap-3 sm:gap-4 overflow-x-auto px-2 pb-3 pl-36 sm:pl-44",children:v.map(T=>{const V=T.cards.filter(P=>(P[c]!=null?String(P[c]):Bt)===w);return h.jsx("div",{className:"w-[85vw] sm:w-80 flex-shrink-0 min-h-[60px] rounded-md bg-card/20 p-2",children:h.jsx($t,{items:V.map(P=>P.id),strategy:Ft,children:h.jsx("div",{className:"space-y-2",role:"list","aria-label":`${T.title} - ${w} cards`,children:V.map(P=>h.jsx(Vt,{card:P,onCardClick:t,conditionalFormatting:l},P.id))})})},T.id)})})]},w)})]}):h.jsx("div",{className:yt("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 bg-muted/10 rounded-lg [-webkit-overflow-scrolling:touch] min-w-0",r),role:"region","aria-label":"Kanban board",children:v.map(w=>h.jsx(wo,{column:w,cards:w.cards,onCardClick:t,quickAdd:o,onQuickAdd:i,conditionalFormatting:l},w.id))}),h.jsx($n,{children:h.jsx("div",{"aria-live":"assertive","aria-label":d?`Dragging ${d.title}`:void 0,children:d?h.jsx(Vt,{card:d,conditionalFormatting:l}):null})})]})}const Eo=Object.freeze(Object.defineProperty({__proto__:null,default:So},Symbol.toStringTag,{value:"Module"}));function Ae(e,n,t){let r=t.initialDeps??[],s,o=!0;function i(){var a,l,c;let d;t.key&&((a=t.debug)!=null&&a.call(t))&&(d=Date.now());const f=e();if(!(f.length!==r.length||f.some((N,b)=>r[b]!==N)))return s;r=f;let p;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(p=Date.now()),s=n(...f),t.key&&((c=t.debug)!=null&&c.call(t))){const N=Math.round((Date.now()-d)*100)/100,b=Math.round((Date.now()-p)*100)/100,v=b/16,k=(j,I)=>{for(j=String(j);j.length<I;)j=" "+j;return j};console.info(`%c⏱ ${k(b,5)} /${k(N,5)} ms`,`
11
11
  font-size: .6rem;
12
12
  font-weight: bold;
13
- color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(s),o=!1,s}return i.updateDeps=a=>{r=a},i}function qn(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const No=(e,n)=>Math.abs(e-n)<1.01,Do=(e,n,t)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,s),t)}},Un=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},jo=e=>e,ko=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=n;s<=t;s++)r.push(s);return r},Oo=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;const s=i=>{const{width:a,height:l}=i;n({width:Math.round(a),height:Math.round(l)})};if(s(Un(t)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const a=()=>{const l=i[0];if(l?.borderBoxSize){const c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(Un(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Xn={passive:!0},Hn=typeof window>"u"?!0:"onscrollend"in window,Ao=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;let s=0;const o=e.options.useScrollendEvent&&Hn?()=>{}:Do(r,()=>{n(s,!1)},e.options.isScrollingResetDelay),i=d=>()=>{const{horizontal:f,isRtl:h}=e.options;s=f?t.scrollLeft*(h&&-1||1):t.scrollTop,o(),n(s,d)},a=i(!0),l=i(!1);t.addEventListener("scroll",a,Xn);const c=e.options.useScrollendEvent&&Hn;return c&&t.addEventListener("scrollend",l,Xn),()=>{t.removeEventListener("scroll",a),c&&t.removeEventListener("scrollend",l)}},To=(e,n,t)=>{if(n?.borderBoxSize){const r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},Io=(e,{adjustments:n=0,behavior:t},r)=>{var s,o;const i=e+n;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:t})};class Mo{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:jo,rangeExtractor:ko,onChange:()=>{},measureElement:To,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=Ae(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const s=new Map,o=new Map;for(let i=r-1;i>=0;i--){const a=t[i];if(s.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&s.set(a.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Ae(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,r,s,o,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=Ae(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i,lanes:a},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const h of this.laneAssignments.keys())h>=t&&this.laneAssignments.delete(h);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,c),f=new Array(a).fill(void 0);for(let h=0;h<c;h++){const p=d[h];p&&(f[p.lane]=h)}for(let h=c;h<t;h++){const p=o(h),E=this.laneAssignments.get(h);let b,v;if(E!==void 0&&this.options.lanes>1){b=E;const A=f[b],S=A!==void 0?d[A]:void 0;v=S?S.end+this.options.gap:r+s}else{const A=this.options.lanes===1?d[h-1]:this.getFurthestMeasurement(d,h);v=A?A.end+this.options.gap:r+s,b=A?A.lane:h%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(h,b)}const k=l.get(p),j=typeof k=="number"?k:this.options.estimateSize(h),T=v+j;d[h]={index:h,start:v,size:j,end:T,key:p,lane:b},f[b]=h}return this.measurementsCache=d,d},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ae(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,o)=>this.range=t.length>0&&r>0?_o({measurements:t,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Ae(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,o,i)=>o===null||i===null?[]:t({startIndex:o,endIndex:i,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{const s=this.indexFromElement(t),o=this.measurementsCache[s];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==t&&(a&&this.observer.unobserve(a),this.observer.observe(t),this.elementsCache.set(i,t)),t.isConnected&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const s=this.measurementsCache[t];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,i=r-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,i,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=Ae(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let o=0,i=t.length;o<i;o++){const a=t[o],l=r[a];s.push(l)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return qn(r[Jn(0,r.length-1,s=>qn(r[s]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,r,s=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=t>=i+o?"end":"start"),r==="center"?t+=(s-o)/2:r==="end"&&(t-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.measurementsCache[t];if(!s)return;const o=this.getSize(),i=this.getScrollOffset();if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(t,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1)),this.currentScrollToIndex=t;let o=0;const i=10,a=c=>{if(!this.targetWindow)return;const d=this.getOffsetForIndex(t,c);if(!d){console.warn("Failed to get offset for index:",t);return}const[f,h]=d;this._scrollToOffset(f,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{if(!this.targetWindow)return;const p=()=>{if(this.currentScrollToIndex!==t)return;const E=this.getScrollOffset(),b=this.getOffsetForIndex(t,h);if(!b){console.warn("Failed to get offset for index:",t);return}No(b[0],E)||l(h)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(p):p()})},l=c=>{this.targetWindow&&this.currentScrollToIndex===t&&(o++,o<i?(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("Schedule retry",o,i),this.targetWindow.requestAnimationFrame(()=>a(c))):console.warn(`Failed to scroll to index ${t} after ${i} attempts.`))};a(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&o.some(a=>a===null);){const a=r[i];o[a.lane]===null&&(o[a.lane]=a.end),i--}s=Math.max(...o.filter(a=>a!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(n)}}const Jn=(e,n,t,r)=>{for(;e<=n;){const s=(e+n)/2|0,o=t(s);if(o<r)e=s+1;else if(o>r)n=s-1;else return s}return e>0?e-1:0};function _o({measurements:e,outerSize:n,scrollOffset:t,lanes:r}){const s=e.length-1,o=l=>e[l].start;if(e.length<=r)return{startIndex:0,endIndex:s};let i=Jn(0,s,o,t),a=i;if(r===1)for(;a<s&&e[a].end<t+n;)a++;else if(r>1){const l=Array(r).fill(0);for(;a<s&&l.some(d=>d<t+n);){const d=e[a];l[d.lane]=d.end,a++}const c=Array(r).fill(t+n);for(;i>=0&&c.some(d=>d>=t);){const d=e[i];c[d.lane]=d.start,i--}i=Math.max(0,i-i%r),a=Math.min(s,a+(r-1-a%r))}return{startIndex:i,endIndex:a}}const Gn=typeof document<"u"?_.useLayoutEffect:_.useEffect;function zo({useFlushSync:e=!0,...n}){const t=_.useReducer(()=>({}),{})[1],r={...n,onChange:(o,i)=>{var a;e&&i?Ne.flushSync(t):t(),(a=n.onChange)==null||a.call(n,o,i)}},[s]=_.useState(()=>new Mo(r));return s.setOptions(r),Gn(()=>s._didMount(),[]),Gn(()=>s._willUpdate()),s}function Lo(e){return zo({observeElementRect:Oo,observeElementOffset:Ao,scrollToFn:Io,...e})}const Kt=(...e)=>e.filter(Boolean).join(" ");function Ro(e,n){if(!n||n.length===0)return{};for(const t of n){const r=e[t.field];if(r==null)continue;let s=!1;const o=String(r);switch(t.operator){case"equals":s=o===String(t.value);break;case"not_equals":s=o!==String(t.value);break;case"contains":s=o.toLowerCase().includes(String(t.value).toLowerCase());break;case"in":s=Array.isArray(t.value)&&t.value.includes(o);break}if(s)return{...t.backgroundColor?{backgroundColor:t.backgroundColor}:{},...t.borderColor?{borderColor:t.borderColor}:{}}}return{}}function Wt({card:e,conditionalFormatting:n}){const{attributes:t,listeners:r,setNodeRef:s,transform:o,transition:i,isDragging:a}=xt({id:e.id}),l={transform:ge.Transform.toString(o),transition:i,opacity:a?.5:void 0},c=Ro(e,n);return g.jsx("div",{ref:s,style:l,...t,...r,children:g.jsxs(F.Card,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",style:c,children:[e.coverImage&&g.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:g.jsx("img",{src:e.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),g.jsxs(F.CardHeader,{className:"p-4",children:[g.jsx(F.CardTitle,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&g.jsx(F.CardDescription,{className:"text-xs text-muted-foreground font-mono",children:e.description})]}),e.badges&&e.badges.length>0&&g.jsx(F.CardContent,{className:"p-4 pt-0",children:g.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((d,f)=>g.jsx(F.Badge,{variant:d.variant||"default",className:"text-xs",children:d.label},f))})})]})})}function Po({cards:e,parentRef:n,conditionalFormatting:t}){const r=Lo({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>120,overscan:5});return g.jsx("div",{style:{height:`${r.getTotalSize()}px`,width:"100%",position:"relative"},children:r.getVirtualItems().map(s=>{const o=e[s.index];return g.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${s.start}px)`},children:g.jsx(Wt,{card:o,conditionalFormatting:t})},o.id)})})}function Fo({columnId:e,onAdd:n}){const[t,r]=_.useState(!1),[s,o]=_.useState(""),i=_.useRef(null),a=()=>{const c=s.trim();c&&(n(e,c),o("")),r(!1)},l=c=>{c.key==="Enter"?(c.preventDefault(),a()):c.key==="Escape"&&(o(""),r(!1))};return t?g.jsx("div",{className:"mt-2 space-y-2",children:g.jsx(F.Input,{ref:i,value:s,onChange:c=>o(c.target.value),onKeyDown:l,onBlur:a,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):g.jsxs(F.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{r(!0),setTimeout(()=>i.current?.focus(),0)},children:[g.jsx(tt,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function $o({column:e,cards:n,onToggle:t,enableVirtual:r,quickAdd:s,onQuickAdd:o,conditionalFormatting:i}){const a=n||[],l=_.useRef(null),{setNodeRef:c}=xt({id:e.id,data:{type:"column"}}),d=e.limit&&a.length>=e.limit,f=e.limit&&a.length>=e.limit*.8;return g.jsxs("div",{ref:c,className:Kt("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",e.collapsed?"w-16":"w-80",e.className),children:[g.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[g.jsx(F.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>t(!e.collapsed),children:e.collapsed?g.jsx(vr,{className:"h-4 w-4"}):g.jsx(Zt,{className:"h-4 w-4"})}),!e.collapsed&&g.jsxs(g.Fragment,{children:[g.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:e.title}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsxs("span",{className:Kt("font-mono text-xs",d?"text-destructive":f?"text-yellow-500":"text-muted-foreground"),children:[a.length,e.limit&&` / ${e.limit}`]}),d&&g.jsx(F.Badge,{variant:"destructive",className:"text-xs",children:"Full"}),f&&!d&&g.jsx(xr,{className:"h-3 w-3 text-yellow-500"})]})]})]}),e.collapsed&&g.jsxs("div",{className:"flex flex-col items-center gap-1",children:[g.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:e.title}),g.jsx(F.Badge,{variant:"secondary",className:"text-xs",children:a.length})]})]}),!e.collapsed&&g.jsxs("div",{ref:l,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:[g.jsx($t,{items:a.map(h=>h.id),strategy:Ft,children:r?g.jsx(Po,{cards:a,parentRef:l,conditionalFormatting:i}):g.jsx("div",{className:"space-y-2",children:a.map(h=>g.jsx(Wt,{card:h,conditionalFormatting:i},h.id))})}),s&&o&&g.jsx(Fo,{columnId:e.id,onAdd:o})]})]})}function Qn({columns:e,onCardMove:n,onColumnToggle:t,enableVirtualScrolling:r=!1,virtualScrollThreshold:s=50,className:o,quickAdd:i,onQuickAdd:a,conditionalFormatting:l}){const[c,d]=_.useState(null),f=_.useMemo(()=>(e||[]).map(S=>({...S,cards:S.cards||[]})),[e]),[h,p]=_.useState(f);_.useEffect(()=>{p(f)},[f]);const E=an(kt(dt,{activationConstraint:{distance:8}})),b=S=>{const{active:x}=S,C=k(x.id);d(C)},v=S=>{const{active:x,over:C}=S;if(d(null),!C)return;const y=x.id,I=C.id;if(y===I)return;const w=j(y),D=j(I)||T(I);if(!(!w||!D))if(w.id===D.id){const O=[...w.cards],M=O.findIndex(K=>K.id===y),V=O.findIndex(K=>K.id===I),P=pt(O,M,V);p(K=>K.map($=>$.id===w.id?{...$,cards:P}:$))}else{const O=[...w.cards],M=[...D.cards],V=O.findIndex(q=>q.id===y),K=I===D.id?M.length:M.findIndex(q=>q.id===I),[$]=O.splice(V,1);M.splice(K,0,$),p(q=>q.map(Y=>Y.id===w.id?{...Y,cards:O}:Y.id===D.id?{...Y,cards:M}:Y)),n&&n(y,w.id,D.id,K)}},k=_.useCallback(S=>{for(const x of h){const C=x.cards.find(y=>y.id===S);if(C)return C}return null},[h]),j=_.useCallback(S=>h.find(x=>x.cards.some(C=>C.id===S))||null,[h]),T=_.useCallback(S=>h.find(x=>x.id===S)||null,[h]),A=_.useCallback((S,x)=>{p(C=>C.map(y=>y.id===S?{...y,collapsed:x}:y)),t?.(S,x)},[t]);return g.jsxs(Ln,{sensors:E,collisionDetection:cn,onDragStart:b,onDragEnd:v,children:[g.jsx("div",{className:Kt("flex gap-4 overflow-x-auto p-4",o),children:h.map(S=>{const x=r&&S.cards.length>s;return g.jsx($o,{column:S,cards:S.cards,onToggle:C=>A(S.id,C),enableVirtual:x,quickAdd:i,onQuickAdd:a,conditionalFormatting:l},S.id)})}),g.jsx($n,{children:c?g.jsx(Wt,{card:c,conditionalFormatting:l}):null})]})}const Bo=Object.freeze(Object.defineProperty({__proto__:null,KanbanEnhanced:Qn,default:Qn},Symbol.toStringTag,{value:"Module"}));U.CardTemplates=Nr,U.InlineQuickAdd=Cr,U.KanbanRenderer=nt,U.ObjectKanban=St,U.ObjectKanbanRenderer=Et,U.kanbanComponents=Mr,U.useColumnWidths=kr,U.useCrossSwimlaneMove=Or,U.useQuickAddReorder=Ar,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})}));
13
+ color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,t?.key)}return t?.onChange&&!(o&&t.skipInitialOnChange)&&t.onChange(s),o=!1,s}return i.updateDeps=a=>{r=a},i}function Un(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const No=(e,n)=>Math.abs(e-n)<1.01,Do=(e,n,t)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,s),t)}},qn=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},jo=e=>e,ko=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=n;s<=t;s++)r.push(s);return r},Oo=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;const s=i=>{const{width:a,height:l}=i;n({width:Math.round(a),height:Math.round(l)})};if(s(qn(t)),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(i=>{const a=()=>{const l=i[0];if(l?.borderBoxSize){const c=l.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(qn(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return o.observe(t,{box:"border-box"}),()=>{o.unobserve(t)}},Xn={passive:!0},Hn=typeof window>"u"?!0:"onscrollend"in window,Ao=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;let s=0;const o=e.options.useScrollendEvent&&Hn?()=>{}:Do(r,()=>{n(s,!1)},e.options.isScrollingResetDelay),i=d=>()=>{const{horizontal:f,isRtl:g}=e.options;s=f?t.scrollLeft*(g&&-1||1):t.scrollTop,o(),n(s,d)},a=i(!0),l=i(!1);t.addEventListener("scroll",a,Xn);const c=e.options.useScrollendEvent&&Hn;return c&&t.addEventListener("scrollend",l,Xn),()=>{t.removeEventListener("scroll",a),c&&t.removeEventListener("scrollend",l)}},Io=(e,n,t)=>{if(n?.borderBoxSize){const r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},Mo=(e,{adjustments:n=0,behavior:t},r)=>{var s,o;const i=e+n;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:i,behavior:t})};class To{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,r,s;return((s=(r=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:r.now)==null?void 0:s.call(r))??Date.now()},this.observer=(()=>{let t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(o=>{const i=()=>{this._measureElement(o.target,o)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:jo,rangeExtractor:ko,onChange:()=>{},measureElement:Io,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=Ae(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,r)=>{const s=new Map,o=new Map;for(let i=r-1;i>=0;i--){const a=t[i];if(s.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&s.set(a.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Ae(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(t,r,s,o,i,a)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i,lanes:a}),{key:!1}),this.getMeasurements=Ae(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:i,lanes:a},l)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const g of this.laneAssignments.keys())g>=t&&this.laneAssignments.delete(g);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(g=>{this.itemSizeCache.set(g.key,g.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const d=this.measurementsCache.slice(0,c),f=new Array(a).fill(void 0);for(let g=0;g<c;g++){const p=d[g];p&&(f[p.lane]=g)}for(let g=c;g<t;g++){const p=o(g),N=this.laneAssignments.get(g);let b,v;if(N!==void 0&&this.options.lanes>1){b=N;const A=f[b],S=A!==void 0?d[A]:void 0;v=S?S.end+this.options.gap:r+s}else{const A=this.options.lanes===1?d[g-1]:this.getFurthestMeasurement(d,g);v=A?A.end+this.options.gap:r+s,b=A?A.lane:g%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(g,b)}const k=l.get(p),j=typeof k=="number"?k:this.options.estimateSize(g),I=v+j;d[g]={index:g,start:v,size:j,end:I,key:p,lane:b},f[b]=g}return this.measurementsCache=d,d},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ae(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,o)=>this.range=t.length>0&&r>0?_o({measurements:t,outerSize:r,scrollOffset:s,lanes:o}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Ae(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,o,i)=>o===null||i===null?[]:t({startIndex:o,endIndex:i,overscan:r,count:s}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const s=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(s!==void 0&&this.range){const o=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,s-o),a=Math.min(this.options.count-1,s+o);return t>=i&&t<=a}return!0},this._measureElement=(t,r)=>{if(!t.isConnected){this.observer.unobserve(t);return}const s=this.indexFromElement(t),o=this.measurementsCache[s];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==t&&(a&&this.observer.unobserve(a),this.observer.observe(t),this.elementsCache.set(i,t)),this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{var s;const o=this.measurementsCache[t];if(!o)return;const i=this.itemSizeCache.get(o.key)??o.size,a=r-i;a!==0&&(((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",a),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=Ae(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let o=0,i=t.length;o<i;o++){const a=t[o],l=r[a];s.push(l)}return s},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return Un(r[Jn(0,r.length-1,s=>Un(r[s]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,r,s=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=t>=i+o?"end":"start"),r==="center"?t+=(s-o)/2:r==="end"&&(t-=o);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.getSize(),o=this.getScrollOffset(),i=this.measurementsCache[t];if(!i)return;if(r==="auto")if(i.end>=o+s-this.options.scrollPaddingEnd)r="end";else if(i.start<=o+this.options.scrollPaddingStart)r="start";else return[o,r];if(r==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,i.size),r]},this.scrollToOffset=(t,{align:r="start",behavior:s="auto"}={})=>{const o=this.getOffsetForAlignment(t,r),i=this.now();this.scrollState={index:null,align:r,behavior:s,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:r="auto",behavior:s="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const o=this.getOffsetForIndex(t,r);if(!o)return;const[i,a]=o,l=this.now();this.scrollState={index:t,align:a,behavior:s,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:r="auto"}={})=>{const s=this.getScrollOffset()+t,o=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:o,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const o=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&o.some(a=>a===null);){const a=r[i];o[a.lane]===null&&(o[a.lane]=a.end),i--}s=Math.max(...o.filter(a=>a!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(n)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,s=r?r[0]:this.scrollState.lastTargetOffset,o=1,i=s!==this.scrollState.lastTargetOffset;if(!i&&No(s,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.scrollState=null;return}}else this.scrollState.stableFrames=0,i&&(this.scrollState.lastTargetOffset=s,this.scrollState.behavior="auto",this._scrollToOffset(s,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const Jn=(e,n,t,r)=>{for(;e<=n;){const s=(e+n)/2|0,o=t(s);if(o<r)e=s+1;else if(o>r)n=s-1;else return s}return e>0?e-1:0};function _o({measurements:e,outerSize:n,scrollOffset:t,lanes:r}){const s=e.length-1,o=l=>e[l].start;if(e.length<=r)return{startIndex:0,endIndex:s};let i=Jn(0,s,o,t),a=i;if(r===1)for(;a<s&&e[a].end<t+n;)a++;else if(r>1){const l=Array(r).fill(0);for(;a<s&&l.some(d=>d<t+n);){const d=e[a];l[d.lane]=d.end,a++}const c=Array(r).fill(t+n);for(;i>=0&&c.some(d=>d>=t);){const d=e[i];c[d.lane]=d.start,i--}i=Math.max(0,i-i%r),a=Math.min(s,a+(r-1-a%r))}return{startIndex:i,endIndex:a}}const Gn=typeof document<"u"?_.useLayoutEffect:_.useEffect;function Ro({useFlushSync:e=!0,...n}){const t=_.useReducer(()=>({}),{})[1],r={...n,onChange:(o,i)=>{var a;e&&i?Ne.flushSync(t):t(),(a=n.onChange)==null||a.call(n,o,i)}},[s]=_.useState(()=>new To(r));return s.setOptions(r),Gn(()=>s._didMount(),[]),Gn(()=>s._willUpdate()),s}function zo(e){return Ro({observeElementRect:Oo,observeElementOffset:Ao,scrollToFn:Mo,...e})}const Kt=(...e)=>e.filter(Boolean).join(" ");function Lo(e,n){if(!n||n.length===0)return{};for(const t of n){const r=e[t.field];if(r==null)continue;let s=!1;const o=String(r);switch(t.operator){case"equals":s=o===String(t.value);break;case"not_equals":s=o!==String(t.value);break;case"contains":s=o.toLowerCase().includes(String(t.value).toLowerCase());break;case"in":s=Array.isArray(t.value)&&t.value.includes(o);break}if(s)return{...t.backgroundColor?{backgroundColor:t.backgroundColor}:{},...t.borderColor?{borderColor:t.borderColor}:{}}}return{}}function Wt({card:e,conditionalFormatting:n}){const{attributes:t,listeners:r,setNodeRef:s,transform:o,transition:i,isDragging:a}=xt({id:e.id}),l={transform:ge.Transform.toString(o),transition:i,opacity:a?.5:void 0},c=Lo(e,n);return h.jsx("div",{ref:s,style:l,...t,...r,children:h.jsxs(F.Card,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",style:c,children:[e.coverImage&&h.jsx("div",{className:"w-full h-32 overflow-hidden rounded-t-lg",children:h.jsx("img",{src:e.coverImage,alt:"",className:"w-full h-full object-cover",loading:"lazy"})}),h.jsxs(F.CardHeader,{className:"p-4",children:[h.jsx(F.CardTitle,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:e.title}),e.description&&h.jsx(F.CardDescription,{className:"text-xs text-muted-foreground font-mono",children:e.description})]}),e.badges&&e.badges.length>0&&h.jsx(F.CardContent,{className:"p-4 pt-0",children:h.jsx("div",{className:"flex flex-wrap gap-1",children:e.badges.map((d,f)=>h.jsx(F.Badge,{variant:d.variant||"default",className:"text-xs",children:d.label},f))})})]})})}function Po({cards:e,parentRef:n,conditionalFormatting:t}){const r=zo({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>120,overscan:5});return h.jsx("div",{style:{height:`${r.getTotalSize()}px`,width:"100%",position:"relative"},children:r.getVirtualItems().map(s=>{const o=e[s.index];return h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${s.start}px)`},children:h.jsx(Wt,{card:o,conditionalFormatting:t})},o.id)})})}function Fo({columnId:e,onAdd:n}){const[t,r]=_.useState(!1),[s,o]=_.useState(""),i=_.useRef(null),a=()=>{const c=s.trim();c&&(n(e,c),o("")),r(!1)},l=c=>{c.key==="Enter"?(c.preventDefault(),a()):c.key==="Escape"&&(o(""),r(!1))};return t?h.jsx("div",{className:"mt-2 space-y-2",children:h.jsx(F.Input,{ref:i,value:s,onChange:c=>o(c.target.value),onKeyDown:l,onBlur:a,placeholder:"Enter card title...",className:"text-sm",autoFocus:!0})}):h.jsxs(F.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-muted-foreground hover:text-foreground",onClick:()=>{r(!0),setTimeout(()=>i.current?.focus(),0)},children:[h.jsx(tt,{className:"h-4 w-4 mr-1"}),"Add Card"]})}function $o({column:e,cards:n,onToggle:t,enableVirtual:r,quickAdd:s,onQuickAdd:o,conditionalFormatting:i}){const a=n||[],l=_.useRef(null),{setNodeRef:c}=xt({id:e.id,data:{type:"column"}}),d=e.limit&&a.length>=e.limit,f=e.limit&&a.length>=e.limit*.8;return h.jsxs("div",{ref:c,className:Kt("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",e.collapsed?"w-16":"w-80",e.className),children:[h.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[h.jsx(F.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>t(!e.collapsed),children:e.collapsed?h.jsx(vr,{className:"h-4 w-4"}):h.jsx(Zt,{className:"h-4 w-4"})}),!e.collapsed&&h.jsxs(h.Fragment,{children:[h.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:e.title}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("span",{className:Kt("font-mono text-xs",d?"text-destructive":f?"text-yellow-500":"text-muted-foreground"),children:[a.length,e.limit&&` / ${e.limit}`]}),d&&h.jsx(F.Badge,{variant:"destructive",className:"text-xs",children:"Full"}),f&&!d&&h.jsx(xr,{className:"h-3 w-3 text-yellow-500"})]})]})]}),e.collapsed&&h.jsxs("div",{className:"flex flex-col items-center gap-1",children:[h.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:e.title}),h.jsx(F.Badge,{variant:"secondary",className:"text-xs",children:a.length})]})]}),!e.collapsed&&h.jsxs("div",{ref:l,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:[h.jsx($t,{items:a.map(g=>g.id),strategy:Ft,children:r?h.jsx(Po,{cards:a,parentRef:l,conditionalFormatting:i}):h.jsx("div",{className:"space-y-2",children:a.map(g=>h.jsx(Wt,{card:g,conditionalFormatting:i},g.id))})}),s&&o&&h.jsx(Fo,{columnId:e.id,onAdd:o})]})]})}function Qn({columns:e,onCardMove:n,onColumnToggle:t,enableVirtualScrolling:r=!1,virtualScrollThreshold:s=50,className:o,quickAdd:i,onQuickAdd:a,conditionalFormatting:l}){const[c,d]=_.useState(null),f=_.useMemo(()=>(e||[]).map(S=>({...S,cards:S.cards||[]})),[e]),[g,p]=_.useState(f);_.useEffect(()=>{p(f)},[f]);const N=an(kt(dt,{activationConstraint:{distance:8}})),b=S=>{const{active:x}=S,C=k(x.id);d(C)},v=S=>{const{active:x,over:C}=S;if(d(null),!C)return;const y=x.id,M=C.id;if(y===M)return;const w=j(y),D=j(M)||I(M);if(!(!w||!D))if(w.id===D.id){const O=[...w.cards],T=O.findIndex(K=>K.id===y),V=O.findIndex(K=>K.id===M),P=pt(O,T,V);p(K=>K.map($=>$.id===w.id?{...$,cards:P}:$))}else{const O=[...w.cards],T=[...D.cards],V=O.findIndex(U=>U.id===y),K=M===D.id?T.length:T.findIndex(U=>U.id===M),[$]=O.splice(V,1);T.splice(K,0,$),p(U=>U.map(Y=>Y.id===w.id?{...Y,cards:O}:Y.id===D.id?{...Y,cards:T}:Y)),n&&n(y,w.id,D.id,K)}},k=_.useCallback(S=>{for(const x of g){const C=x.cards.find(y=>y.id===S);if(C)return C}return null},[g]),j=_.useCallback(S=>g.find(x=>x.cards.some(C=>C.id===S))||null,[g]),I=_.useCallback(S=>g.find(x=>x.id===S)||null,[g]),A=_.useCallback((S,x)=>{p(C=>C.map(y=>y.id===S?{...y,collapsed:x}:y)),t?.(S,x)},[t]);return h.jsxs(zn,{sensors:N,collisionDetection:cn,onDragStart:b,onDragEnd:v,children:[h.jsx("div",{className:Kt("flex gap-4 overflow-x-auto p-4",o),children:g.map(S=>{const x=r&&S.cards.length>s;return h.jsx($o,{column:S,cards:S.cards,onToggle:C=>A(S.id,C),enableVirtual:x,quickAdd:i,onQuickAdd:a,conditionalFormatting:l},S.id)})}),h.jsx($n,{children:c?h.jsx(Wt,{card:c,conditionalFormatting:l}):null})]})}const Bo=Object.freeze(Object.defineProperty({__proto__:null,KanbanEnhanced:Qn,default:Qn},Symbol.toStringTag,{value:"Module"}));q.CardTemplates=Nr,q.InlineQuickAdd=Cr,q.KanbanRenderer=nt,q.ObjectKanban=St,q.ObjectKanbanRenderer=Et,q.kanbanComponents=Tr,q.useColumnWidths=kr,q.useCrossSwimlaneMove=Or,q.useQuickAddReorder=Ar,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})}));