@viglet/viglet-design-system 2026.3.11 → 2026.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -688,9 +688,9 @@ import type {
688
688
 
689
689
  ## What's Included
690
690
 
691
- ### UI Primitives (48 components)
691
+ ### UI Primitives (49 components)
692
692
 
693
- Accordion, Avatar, Badge, Breadcrumb, Button, Card, Checkbox, Dialog, Drawer, DropdownMenu, FloatingFormulasBg, Form, FormActions, FormItemTwoColumns, GlassCard, GradientButton, GradientSwitch, HoverCard, IconPickerDialog, Input, Label, NavigationMenu, Pagination, Popover, Progress, PulseRing, Resizable, SectionCard, Select, Separator, Sheet, Sidebar, Skeleton, Slider, Stepper, StickySaveBar, Switch, Table, Tabs, Textarea, Toaster (sonner), Toggle, ToggleGroup, Tooltip, UserAvatar, UserMenu, VigletAssistant ([the dock](#the-assistant-dock)), VigletAvatar ([the mascot](#the-mascot))
693
+ Accordion, Avatar, Badge, Breadcrumb, Button, Card, Checkbox, Dialog, Drawer, DropdownMenu, FloatingFormulasBg, Form, FormActions, FormItemTwoColumns, GlassCard, GradientButton, GradientSwitch, HoverCard, IconPickerDialog, Input, Label, NavigationMenu, Pagination, Popover, Progress, PulseRing, Resizable, SectionCard, Select, Separator, Sheet, Sidebar, Skeleton, Slider, Stepper, StickySaveBar, Switch, Table, Tabs, Textarea, Toaster (sonner), Toggle, ToggleGroup, Tooltip, Tree, UserAvatar, UserMenu, VigletAssistant ([the dock](#the-assistant-dock)), VigletAvatar ([the mascot](#the-mascot))
694
694
 
695
695
  ### App Components (19 components)
696
696
 
package/consumers.json CHANGED
@@ -103,7 +103,7 @@
103
103
  "chrome": "bento",
104
104
  "accent": "cool",
105
105
  "sourceRoots": ["src", "vite.config.ts"],
106
- "entries": [".", "./bento", "./bento.css", "./router", "./styles", "./vite"]
106
+ "entries": [".", "./bento", "./bento.css", "./i18n", "./router", "./styles", "./vite"]
107
107
  },
108
108
  {
109
109
  "id": "dumont",
@@ -114,7 +114,7 @@
114
114
  "chrome": "bento",
115
115
  "accent": "cool",
116
116
  "sourceRoots": ["src", "vite.config.ts"],
117
- "entries": [".", "./bento", "./bento.css", "./router", "./styles", "./vite"]
117
+ "entries": [".", "./bento", "./bento.css", "./i18n", "./router", "./styles", "./vite"]
118
118
  },
119
119
  {
120
120
  "id": "cloud-console",
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./utils-Oagwe_oa.cjs");let n=require("react");n=e.t(n,1);let r=require("react/jsx-runtime"),i=require("@radix-ui/react-slot"),a=require("class-variance-authority"),o=require("react-i18next"),s=require("@radix-ui/react-dialog");s=e.t(s,1);var c=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function l(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:c(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var u=e=>{let t=``,n=!1;for(let r of e){if(r===`-`||r===`_`||r<=` `){n=t.length>0;continue}t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1}return t},d=e=>{let t=u(e);return t.charAt(0).toUpperCase()+t.slice(1)},f=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),p={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function m(e){return e!=null}function h(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??p.width,a=e.size??e.height??p.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?f(...c):f(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??p[`stroke-width`])*Number(e.size??e.width??p.width)/Number(t.size??t.width??p.width):t.strokeWidth??p[`stroke-width`];return[`svg`,{...Object.entries(p).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&m(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&m(t.width)&&{[r(`width`)]:t.width},...`height`in t&&m(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function g(e,t={}){return h(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var _=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},v=(0,n.createContext)({}),y=()=>(0,n.useContext)(v),b=(0,n.forwardRef)(({color:e,size:t,width:r,height:i,strokeWidth:a,absoluteStrokeWidth:o,nonScalingStroke:s,className:c=``,children:l,iconNode:u=[],icon:d={node:u,aliases:[],size:24},...p},m)=>{let{size:h=24,strokeWidth:v=2,absoluteStrokeWidth:b=!1,nonScalingStroke:x=!1,color:S=`currentColor`,className:C=``}=y()??{},w=!!l||_(p),[T,E,D=[]]=g(d,{color:e??S,width:r??t??h,height:i??t??h,strokeWidth:a??v,absoluteStrokeWidth:o??b,nonScalingStroke:s??x,className:f(C,c),hasA11yProp:w,attributes:p});return(0,n.createElement)(T,{ref:m,...E},[...D.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(l)?l:[l]])});function x(e,t=[],r=[]){let i=typeof e==`string`?l(e,t,r):e,a=(0,n.forwardRef)(({className:e,...t},r)=>(0,n.createElement)(b,{ref:r,icon:i,className:e,...t}));return i.name&&(a.displayName=d(i.name)),a}var S={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};S.node;var C=x(S),w={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};w.node;var T=x(w),E=(0,a.cva)(`inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60`,outline:`text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`}},defaultVariants:{variant:`default`}});function D({className:e,variant:n,asChild:a=!1,...o}){return(0,r.jsx)(a?i.Slot:`span`,{"data-slot":`badge`,className:t.t(E({variant:n}),e),...o})}function O(e,t,n){let r=e||t===!0||t===`true`;return{inert:r,props:{"aria-busy":e?`true`:void 0,"aria-disabled":r?`true`:void 0,onClick:e=>{if(r){e.preventDefault(),e.stopPropagation();return}n?.(e)}}}}function k(){return(0,r.jsxs)(`svg`,{"aria-hidden":`true`,className:`size-4 animate-spin`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,children:[(0,r.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,r.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]})}function A({...e}){return(0,r.jsx)(s.Root,{"data-slot":`dialog`,...e})}function j({...e}){return(0,r.jsx)(s.Trigger,{"data-slot":`dialog-trigger`,...e})}function M({...e}){return(0,r.jsx)(s.Portal,{"data-slot":`dialog-portal`,...e})}function N({...e}){return(0,r.jsx)(s.Close,{"data-slot":`dialog-close`,...e})}function P({className:e,...n}){return(0,r.jsx)(s.Overlay,{"data-slot":`dialog-overlay`,className:t.t(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...n})}function F({className:e,children:n,showCloseButton:i=!0,...a}){let{t:c}=(0,o.useTranslation)();return(0,r.jsxs)(M,{"data-slot":`dialog-portal`,children:[(0,r.jsx)(P,{}),(0,r.jsxs)(s.Content,{"data-slot":`dialog-content`,className:t.t(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg`,e),...a,children:[n,i&&(0,r.jsxs)(s.Close,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,r.jsx)(T,{}),(0,r.jsx)(`span`,{className:`sr-only`,children:c(`dialog.close`,{defaultValue:`Close`})})]})]})]})}function I({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`dialog-header`,className:t.t(`flex flex-col gap-2 text-center sm:text-left`,e),...n})}function L({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`dialog-footer`,className:t.t(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...n})}function R({className:e,...n}){return(0,r.jsx)(s.Title,{"data-slot":`dialog-title`,className:t.t(`text-lg leading-none font-semibold`,e),...n})}function z({className:e,...n}){return(0,r.jsx)(s.Description,{"data-slot":`dialog-description`,className:t.t(`text-muted-foreground text-sm`,e),...n})}var B=(0,a.cva)(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 cursor-pointer disabled:cursor-not-allowed disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-[3px]`,{variants:{variant:{default:[`bg-gradient-to-r from-[var(--vg-accent-fill-from)] to-[var(--vg-accent-fill-to)] text-white`,`shadow-md shadow-[var(--vg-accent-shadow)]`,`hover:from-[var(--vg-accent-fill-from-hover)] hover:to-[var(--vg-accent-fill-to-hover)]`,`hover:shadow-lg hover:shadow-[var(--vg-accent-shadow-hover)]`,`focus-visible:ring-[var(--vg-accent-ring)]`].join(` `),secondary:[`bg-gradient-to-r from-slate-600 to-slate-700 text-white`,`shadow-md shadow-slate-500/25`,`hover:from-slate-700 hover:to-slate-800`,`hover:shadow-lg hover:shadow-slate-500/30`,`focus-visible:ring-slate-500/50`,`dark:from-slate-500 dark:to-slate-600`,`dark:shadow-slate-500/20`,`dark:hover:from-slate-600 dark:hover:to-slate-700`,`dark:hover:shadow-slate-500/25`,`dark:focus-visible:ring-slate-400/50`].join(` `),destructive:[`bg-gradient-to-r from-red-600 to-rose-600 text-white`,`shadow-md shadow-red-500/25`,`hover:from-red-700 hover:to-rose-700`,`hover:shadow-lg hover:shadow-red-500/30`,`focus-visible:ring-red-500/50`,`dark:from-red-500 dark:to-rose-500`,`dark:shadow-red-500/20`,`dark:hover:from-red-600 dark:hover:to-rose-600`,`dark:hover:shadow-red-500/25`,`dark:focus-visible:ring-red-400/50`].join(` `),success:[`bg-gradient-to-r from-emerald-600 to-teal-600 text-white`,`shadow-md shadow-emerald-500/25`,`hover:from-emerald-700 hover:to-teal-700`,`hover:shadow-lg hover:shadow-emerald-500/30`,`focus-visible:ring-emerald-500/50`,`dark:from-emerald-500 dark:to-teal-500`,`dark:shadow-emerald-500/20`,`dark:hover:from-emerald-600 dark:hover:to-teal-600`,`dark:hover:shadow-emerald-500/25`,`dark:focus-visible:ring-emerald-400/50`].join(` `),outline:[`border-2 border-[var(--vg-accent-fg)] text-[var(--vg-accent-fg)] bg-transparent`,`hover:bg-[var(--vg-accent-fill-from)] hover:text-white`,`shadow-sm hover:shadow-md hover:shadow-[var(--vg-accent-shadow)]`,`focus-visible:ring-[var(--vg-accent-ring)]`].join(` `),ghost:[`bg-transparent text-[var(--vg-accent-fg)]`,`hover:bg-[var(--vg-accent-surface)]`,`focus-visible:ring-[var(--vg-accent-ring)]`].join(` `)},size:{default:`h-11 px-5 py-2 has-[>svg]:px-4`,sm:`h-9 rounded-md gap-1.5 px-4 has-[>svg]:px-3 text-xs`,lg:`h-12 rounded-md px-8 has-[>svg]:px-6 text-base`,icon:`size-11`,"icon-sm":`size-9`,"icon-lg":`size-12`}},defaultVariants:{variant:`default`,size:`default`}});function V({className:e,variant:n,size:a,asChild:o=!1,loading:s=!1,onClick:c,children:l,...u}){let d=O(s,u[`aria-disabled`],c),f=t.t(B({variant:n,size:a,className:e}),d.inert&&(s?`cursor-progress`:`cursor-not-allowed opacity-50`));return(0,r.jsx)(o?i.Slot:`button`,{"data-slot":`gradient-button`,className:f,...u,...d.props,children:o?l:(0,r.jsxs)(r.Fragment,{children:[s&&(0,r.jsx)(k,{}),l]})})}function H({className:e,type:n,...i}){return(0,r.jsx)(`input`,{type:n,"data-slot":`input`,className:t.t(`file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent pl-3 pr-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,`aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,e),...i})}function U({className:e,...n}){return(0,r.jsx)(`div`,{"data-slot":`skeleton`,className:t.t(`bg-accent animate-pulse rounded-md`,e),...n})}var W=({text:e,href:n,onClick:i,className:a,prefix:o})=>{if(!e)return null;let s=t.r(e);return(0,r.jsxs)(D,{variant:`outline`,title:e,onClick:()=>n&&i?.(n),className:t.t(`vg-badge-colorful text-xs font-medium px-2 py-0.5 gap-1.5 cursor-pointer transition-all hover:opacity-80`,`dynamic-badge-${e.length}`,a),style:{"--badge-bg":s.light.bg,"--badge-text":s.light.text,"--badge-border":s.light.border,"--badge-dark-bg":s.dark.bg,"--badge-dark-text":s.dark.text,"--badge-dark-border":s.dark.border},children:[o,(0,r.jsx)(`span`,{children:e})]})},G={AR:`SA`,BN:`BD`,CA:`ES`,CS:`CZ`,DA:`DK`,DE:`DE`,EL:`GR`,EN:`US`,EU:`ES`,FA:`IR`,FI:`FI`,FIL:`PH`,FR:`FR`,GA:`IE`,GL:`ES`,GU:`IN`,HE:`IL`,HI:`IN`,HU:`HU`,ID:`ID`,IT:`IT`,JA:`JP`,KN:`IN`,KO:`KR`,MR:`IN`,MSA:`MY`,NL:`NL`,NO:`NO`,PL:`PL`,PT:`BR`,RO:`RO`,RU:`RU`,ES:`ES`,SV:`SE`,TA:`IN`,TH:`TH`,TR:`TR`,UK:`UA`,UR:`PK`,VI:`VN`,ZH:`CN`},K={UK:`GB`};function q(e){if(!e)return``;let{language:n,region:r}=t.i(e);if(r)return(K[r]||r).toLowerCase();let i=G[n];return i?i.toLowerCase():(K[n]||n).toLowerCase()}var J=({locale:e,className:i})=>{let a=q(e),[o,s]=(0,n.useState)(null),c=o===a;return(0,r.jsxs)(D,{variant:`secondary`,className:t.t(`font-mono gap-2 py-1 pl-1 pr-2 w-fit`,i),children:[!c&&a?(0,r.jsx)(`img`,{src:`https://flagcdn.com/w40/${a}.png`,alt:a,onError:()=>s(a),className:`w-5 h-3.5 object-cover rounded-sm shadow-sm`}):(0,r.jsx)(C,{className:`w-3.5 h-3.5 text-muted-foreground`}),(0,r.jsx)(`span`,{className:`text-xs font-bold uppercase tracking-tight leading-none`,children:e})]})};Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return O}});
@@ -5,66 +5,170 @@ import { Slot as d } from "@radix-ui/react-slot";
5
5
  import { cva as f } from "class-variance-authority";
6
6
  import { useTranslation as p } from "react-i18next";
7
7
  import * as m from "@radix-ui/react-dialog";
8
- //#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
9
- var h = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), g = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), _ = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), v = (e) => {
8
+ //#region node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
9
+ var h = (e) => e?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
10
+ //#endregion
11
+ //#region node_modules/lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs
12
+ function g(e, t, n = []) {
13
+ if (t == null) throw Error("[lucide]: iconNode is required when icon name is used");
14
+ return {
15
+ name: h(e),
16
+ size: 24,
17
+ node: t,
18
+ ...n.length > 0 ? { aliases: n } : {}
19
+ };
20
+ }
21
+ //#endregion
22
+ //#region node_modules/lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs
23
+ var _ = (e) => {
24
+ let t = "", n = !1;
25
+ for (let r of e) {
26
+ if (r === "-" || r === "_" || r <= " ") {
27
+ n = t.length > 0;
28
+ continue;
29
+ }
30
+ t.length === 0 ? t += r.toLowerCase() : t += n ? r.toUpperCase() : r, n = !1;
31
+ }
32
+ return t;
33
+ }, v = (e) => {
10
34
  let t = _(e);
11
35
  return t.charAt(0).toUpperCase() + t.slice(1);
12
- }, y = {
36
+ }, y = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), b = {
13
37
  xmlns: "http://www.w3.org/2000/svg",
14
38
  width: 24,
15
39
  height: 24,
16
40
  viewBox: "0 0 24 24",
17
41
  fill: "none",
18
42
  stroke: "currentColor",
19
- strokeWidth: 2,
20
- strokeLinecap: "round",
21
- strokeLinejoin: "round"
22
- }, b = (e) => {
43
+ "stroke-width": 2,
44
+ "stroke-linecap": "round",
45
+ "stroke-linejoin": "round"
46
+ };
47
+ //#endregion
48
+ //#region node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs
49
+ function x(e) {
50
+ return e != null;
51
+ }
52
+ function S(e, t = {}) {
53
+ let n = t.attributeNames ?? {}, r = (e) => n[e] ?? e, i = e.size ?? e.width ?? b.width, a = e.size ?? e.height ?? b.height, o = e.aliases?.filter((e) => typeof e == "string" && e.trim() !== "").map((e) => `lucide-${e}`) ?? [], s = [...e.name ? [`lucide-${e.name}`] : [], ...o], c = t.className?.split(" ").filter(Boolean) ?? [], l = t.includeDefaultClasses === !1 ? y(...c) : y("lucide", ...s, ...c), u = t.absoluteStrokeWidth ? Number(t.strokeWidth ?? b["stroke-width"]) * Number(e.size ?? e.width ?? b.width) / Number(t.size ?? t.width ?? b.width) : t.strokeWidth ?? b["stroke-width"];
54
+ return [
55
+ "svg",
56
+ {
57
+ ...Object.entries(b).reduce((e, [t, n]) => (e[r(t)] = n, e), {}),
58
+ ..."color" in t && t.color && { [r("stroke")]: t.color },
59
+ ..."size" in t && x(t.size) && {
60
+ [r("width")]: t.size,
61
+ [r("height")]: t.size
62
+ },
63
+ ..."width" in t && x(t.width) && { [r("width")]: t.width },
64
+ ..."height" in t && x(t.height) && { [r("height")]: t.height },
65
+ [r("stroke-width")]: u,
66
+ ...l && { [r("class")]: l },
67
+ [r("viewBox")]: `0 0 ${i} ${a}`,
68
+ ...t.hasA11yProp === !1 ? { [r("aria-hidden")]: "true" } : {},
69
+ ..."attributes" in t && t.attributes
70
+ },
71
+ e.node.map((e) => {
72
+ let [n, i, a] = e, o = t.nonScalingStroke ? {
73
+ [r("vector-effect")]: "non-scaling-stroke",
74
+ ...i
75
+ } : i;
76
+ return a ? [
77
+ n,
78
+ o,
79
+ a
80
+ ] : [n, o];
81
+ })
82
+ ];
83
+ }
84
+ //#endregion
85
+ //#region node_modules/lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs
86
+ function C(e, t = {}) {
87
+ return S(e, {
88
+ ...t,
89
+ attributeNames: {
90
+ ...t.attributeNames,
91
+ class: "className",
92
+ "stroke-width": "strokeWidth",
93
+ "stroke-linecap": "strokeLinecap",
94
+ "stroke-linejoin": "strokeLinejoin",
95
+ "vector-effect": "vectorEffect"
96
+ }
97
+ });
98
+ }
99
+ //#endregion
100
+ //#region node_modules/lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs
101
+ var w = (e) => {
23
102
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
24
103
  return !1;
25
- }, x = r({}), S = () => o(x), C = a(({ color: e, size: t, strokeWidth: n, absoluteStrokeWidth: r, className: a = "", children: o, iconNode: s, ...c }, l) => {
26
- let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } = S() ?? {}, g = r ?? f ? Number(n ?? d) * 24 / Number(t ?? u) : n ?? d;
27
- return i("svg", {
28
- ref: l,
29
- ...y,
30
- width: t ?? u ?? y.width,
31
- height: t ?? u ?? y.height,
32
- stroke: e ?? p,
33
- strokeWidth: g,
34
- className: h("lucide", m, a),
35
- ...!o && !b(c) && { "aria-hidden": "true" },
36
- ...c
37
- }, [...s.map(([e, t]) => i(e, t)), ...Array.isArray(o) ? o : [o]]);
38
- }), w = (e, t) => {
39
- let n = a(({ className: n, ...r }, a) => i(C, {
40
- ref: a,
41
- iconNode: t,
42
- className: h(`lucide-${g(v(e))}`, `lucide-${e}`, n),
43
- ...r
104
+ }, T = r({}), E = () => o(T), D = a(({ color: e, size: t, width: n, height: r, strokeWidth: a, absoluteStrokeWidth: o, nonScalingStroke: s, className: c = "", children: l, iconNode: u = [], icon: d = {
105
+ node: u,
106
+ aliases: [],
107
+ size: 24
108
+ }, ...f }, p) => {
109
+ let { size: m = 24, strokeWidth: h = 2, absoluteStrokeWidth: g = !1, nonScalingStroke: _ = !1, color: v = "currentColor", className: b = "" } = E() ?? {}, x = !!l || w(f), [S, T, D = []] = C(d, {
110
+ color: e ?? v,
111
+ width: n ?? t ?? m,
112
+ height: r ?? t ?? m,
113
+ strokeWidth: a ?? h,
114
+ absoluteStrokeWidth: o ?? g,
115
+ nonScalingStroke: s ?? _,
116
+ className: y(b, c),
117
+ hasA11yProp: x,
118
+ attributes: f
119
+ });
120
+ return i(S, {
121
+ ref: p,
122
+ ...T
123
+ }, [...D.map(([e, t]) => i(e, t)), ...Array.isArray(l) ? l : [l]]);
124
+ });
125
+ //#endregion
126
+ //#region node_modules/lucide-react/dist/esm/createLucideIcon.mjs
127
+ function O(e, t = [], n = []) {
128
+ let r = typeof e == "string" ? g(e, t, n) : e, o = a(({ className: e, ...t }, n) => i(D, {
129
+ ref: n,
130
+ icon: r,
131
+ className: e,
132
+ ...t
44
133
  }));
45
- return n.displayName = v(e), n;
46
- }, T = w("globe", [
47
- ["circle", {
48
- cx: "12",
49
- cy: "12",
50
- r: "10",
51
- key: "1mglay"
52
- }],
53
- ["path", {
54
- d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",
55
- key: "13o1zl"
56
- }],
57
- ["path", {
58
- d: "M2 12h20",
59
- key: "9i4pu4"
60
- }]
61
- ]), E = w("x", [["path", {
62
- d: "M18 6 6 18",
63
- key: "1bl5f8"
64
- }], ["path", {
65
- d: "m6 6 12 12",
66
- key: "d8bk6v"
67
- }]]), D = f("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
134
+ return r.name && (o.displayName = v(r.name)), o;
135
+ }
136
+ //#endregion
137
+ //#region node_modules/lucide-react/dist/esm/icons/globe.mjs
138
+ var k = {
139
+ name: "globe",
140
+ size: 24,
141
+ node: [
142
+ ["circle", {
143
+ cx: "12",
144
+ cy: "12",
145
+ r: "10",
146
+ key: "1mglay"
147
+ }],
148
+ ["path", {
149
+ d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",
150
+ key: "13o1zl"
151
+ }],
152
+ ["path", {
153
+ d: "M2 12h20",
154
+ key: "9i4pu4"
155
+ }]
156
+ ]
157
+ };
158
+ k.node;
159
+ var A = O(k), j = {
160
+ name: "x",
161
+ size: 24,
162
+ node: [["path", {
163
+ d: "M18 6 6 18",
164
+ key: "1bl5f8"
165
+ }], ["path", {
166
+ d: "m6 6 12 12",
167
+ key: "d8bk6v"
168
+ }]]
169
+ };
170
+ j.node;
171
+ var M = O(j), N = f("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden", {
68
172
  variants: { variant: {
69
173
  default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
70
174
  secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
@@ -73,16 +177,16 @@ var h = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) =
73
177
  } },
74
178
  defaultVariants: { variant: "default" }
75
179
  });
76
- function O({ className: e, variant: t, asChild: r = !1, ...i }) {
180
+ function P({ className: e, variant: t, asChild: r = !1, ...i }) {
77
181
  return /* @__PURE__ */ l(r ? d : "span", {
78
182
  "data-slot": "badge",
79
- className: n(D({ variant: t }), e),
183
+ className: n(N({ variant: t }), e),
80
184
  ...i
81
185
  });
82
186
  }
83
187
  //#endregion
84
188
  //#region src/lib/busy.tsx
85
- function k(e, t, n) {
189
+ function F(e, t, n) {
86
190
  let r = e || t === !0 || t === "true";
87
191
  return {
88
192
  inert: r,
@@ -99,7 +203,7 @@ function k(e, t, n) {
99
203
  }
100
204
  };
101
205
  }
102
- function A() {
206
+ function I() {
103
207
  return /* @__PURE__ */ u("svg", {
104
208
  "aria-hidden": "true",
105
209
  className: "size-4 animate-spin",
@@ -122,49 +226,49 @@ function A() {
122
226
  }
123
227
  //#endregion
124
228
  //#region src/components/ui/dialog.tsx
125
- function j({ ...e }) {
229
+ function L({ ...e }) {
126
230
  return /* @__PURE__ */ l(m.Root, {
127
231
  "data-slot": "dialog",
128
232
  ...e
129
233
  });
130
234
  }
131
- function M({ ...e }) {
235
+ function ee({ ...e }) {
132
236
  return /* @__PURE__ */ l(m.Trigger, {
133
237
  "data-slot": "dialog-trigger",
134
238
  ...e
135
239
  });
136
240
  }
137
- function N({ ...e }) {
241
+ function R({ ...e }) {
138
242
  return /* @__PURE__ */ l(m.Portal, {
139
243
  "data-slot": "dialog-portal",
140
244
  ...e
141
245
  });
142
246
  }
143
- function P({ ...e }) {
247
+ function z({ ...e }) {
144
248
  return /* @__PURE__ */ l(m.Close, {
145
249
  "data-slot": "dialog-close",
146
250
  ...e
147
251
  });
148
252
  }
149
- function F({ className: e, ...t }) {
253
+ function B({ className: e, ...t }) {
150
254
  return /* @__PURE__ */ l(m.Overlay, {
151
255
  "data-slot": "dialog-overlay",
152
256
  className: n("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", e),
153
257
  ...t
154
258
  });
155
259
  }
156
- function I({ className: e, children: t, showCloseButton: r = !0, ...i }) {
260
+ function V({ className: e, children: t, showCloseButton: r = !0, ...i }) {
157
261
  let { t: a } = p();
158
- return /* @__PURE__ */ u(N, {
262
+ return /* @__PURE__ */ u(R, {
159
263
  "data-slot": "dialog-portal",
160
- children: [/* @__PURE__ */ l(F, {}), /* @__PURE__ */ u(m.Content, {
264
+ children: [/* @__PURE__ */ l(B, {}), /* @__PURE__ */ u(m.Content, {
161
265
  "data-slot": "dialog-content",
162
266
  className: n("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", e),
163
267
  ...i,
164
268
  children: [t, r && /* @__PURE__ */ u(m.Close, {
165
269
  "data-slot": "dialog-close",
166
270
  className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
167
- children: [/* @__PURE__ */ l(E, {}), /* @__PURE__ */ l("span", {
271
+ children: [/* @__PURE__ */ l(M, {}), /* @__PURE__ */ l("span", {
168
272
  className: "sr-only",
169
273
  children: a("dialog.close", { defaultValue: "Close" })
170
274
  })]
@@ -172,28 +276,28 @@ function I({ className: e, children: t, showCloseButton: r = !0, ...i }) {
172
276
  })]
173
277
  });
174
278
  }
175
- function L({ className: e, ...t }) {
279
+ function H({ className: e, ...t }) {
176
280
  return /* @__PURE__ */ l("div", {
177
281
  "data-slot": "dialog-header",
178
282
  className: n("flex flex-col gap-2 text-center sm:text-left", e),
179
283
  ...t
180
284
  });
181
285
  }
182
- function R({ className: e, ...t }) {
286
+ function U({ className: e, ...t }) {
183
287
  return /* @__PURE__ */ l("div", {
184
288
  "data-slot": "dialog-footer",
185
289
  className: n("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
186
290
  ...t
187
291
  });
188
292
  }
189
- function z({ className: e, ...t }) {
293
+ function W({ className: e, ...t }) {
190
294
  return /* @__PURE__ */ l(m.Title, {
191
295
  "data-slot": "dialog-title",
192
296
  className: n("text-lg leading-none font-semibold", e),
193
297
  ...t
194
298
  });
195
299
  }
196
- function B({ className: e, ...t }) {
300
+ function G({ className: e, ...t }) {
197
301
  return /* @__PURE__ */ l(m.Description, {
198
302
  "data-slot": "dialog-description",
199
303
  className: n("text-muted-foreground text-sm", e),
@@ -202,7 +306,7 @@ function B({ className: e, ...t }) {
202
306
  }
203
307
  //#endregion
204
308
  //#region src/components/ui/gradient-button.tsx
205
- var V = f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 cursor-pointer disabled:cursor-not-allowed disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-[3px]", {
309
+ var K = f("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 cursor-pointer disabled:cursor-not-allowed disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-[3px]", {
206
310
  variants: {
207
311
  variant: {
208
312
  default: [
@@ -274,8 +378,8 @@ var V = f("inline-flex items-center justify-center gap-2 whitespace-nowrap round
274
378
  size: "default"
275
379
  }
276
380
  });
277
- function H({ className: e, variant: t, size: r, asChild: i = !1, loading: a = !1, onClick: o, children: s, ...f }) {
278
- let p = k(a, f["aria-disabled"], o), m = n(V({
381
+ function q({ className: e, variant: t, size: r, asChild: i = !1, loading: a = !1, onClick: o, children: s, ...f }) {
382
+ let p = F(a, f["aria-disabled"], o), m = n(K({
279
383
  variant: t,
280
384
  size: r,
281
385
  className: e
@@ -285,12 +389,12 @@ function H({ className: e, variant: t, size: r, asChild: i = !1, loading: a = !1
285
389
  className: m,
286
390
  ...f,
287
391
  ...p.props,
288
- children: i ? s : /* @__PURE__ */ u(c, { children: [a && /* @__PURE__ */ l(A, {}), s] })
392
+ children: i ? s : /* @__PURE__ */ u(c, { children: [a && /* @__PURE__ */ l(I, {}), s] })
289
393
  });
290
394
  }
291
395
  //#endregion
292
396
  //#region src/components/ui/input.tsx
293
- function U({ className: e, type: t, ...r }) {
397
+ function J({ className: e, type: t, ...r }) {
294
398
  return /* @__PURE__ */ l("input", {
295
399
  type: t,
296
400
  "data-slot": "input",
@@ -300,7 +404,7 @@ function U({ className: e, type: t, ...r }) {
300
404
  }
301
405
  //#endregion
302
406
  //#region src/components/ui/skeleton.tsx
303
- function W({ className: e, ...t }) {
407
+ function Y({ className: e, ...t }) {
304
408
  return /* @__PURE__ */ l("div", {
305
409
  "data-slot": "skeleton",
306
410
  className: n("bg-accent animate-pulse rounded-md", e),
@@ -309,10 +413,10 @@ function W({ className: e, ...t }) {
309
413
  }
310
414
  //#endregion
311
415
  //#region src/components/badge-colorful.tsx
312
- var G = ({ text: e, href: r, onClick: i, className: a, prefix: o }) => {
416
+ var X = ({ text: e, href: r, onClick: i, className: a, prefix: o }) => {
313
417
  if (!e) return null;
314
418
  let s = t(e);
315
- return /* @__PURE__ */ u(O, {
419
+ return /* @__PURE__ */ u(P, {
316
420
  variant: "outline",
317
421
  title: e,
318
422
  onClick: () => r && i?.(r),
@@ -327,7 +431,7 @@ var G = ({ text: e, href: r, onClick: i, className: a, prefix: o }) => {
327
431
  },
328
432
  children: [o, /* @__PURE__ */ l("span", { children: e })]
329
433
  });
330
- }, K = {
434
+ }, Z = {
331
435
  AR: "SA",
332
436
  BN: "BD",
333
437
  CA: "ES",
@@ -369,17 +473,17 @@ var G = ({ text: e, href: r, onClick: i, className: a, prefix: o }) => {
369
473
  UR: "PK",
370
474
  VI: "VN",
371
475
  ZH: "CN"
372
- }, q = { UK: "GB" };
373
- function J(t) {
476
+ }, Q = { UK: "GB" };
477
+ function $(t) {
374
478
  if (!t) return "";
375
479
  let { language: n, region: r } = e(t);
376
- if (r) return (q[r] || r).toLowerCase();
377
- let i = K[n];
378
- return i ? i.toLowerCase() : (q[n] || n).toLowerCase();
480
+ if (r) return (Q[r] || r).toLowerCase();
481
+ let i = Z[n];
482
+ return i ? i.toLowerCase() : (Q[n] || n).toLowerCase();
379
483
  }
380
- var Y = ({ locale: e, className: t }) => {
381
- let r = J(e), [i, a] = s(null), o = i === r;
382
- return /* @__PURE__ */ u(O, {
484
+ var te = ({ locale: e, className: t }) => {
485
+ let r = $(e), [i, a] = s(null), o = i === r;
486
+ return /* @__PURE__ */ u(P, {
383
487
  variant: "secondary",
384
488
  className: n("font-mono gap-2 py-1 pl-1 pr-2 w-fit", t),
385
489
  children: [!o && r ? /* @__PURE__ */ l("img", {
@@ -387,11 +491,11 @@ var Y = ({ locale: e, className: t }) => {
387
491
  alt: r,
388
492
  onError: () => a(r),
389
493
  className: "w-5 h-3.5 object-cover rounded-sm shadow-sm"
390
- }) : /* @__PURE__ */ l(T, { className: "w-3.5 h-3.5 text-muted-foreground" }), /* @__PURE__ */ l("span", {
494
+ }) : /* @__PURE__ */ l(A, { className: "w-3.5 h-3.5 text-muted-foreground" }), /* @__PURE__ */ l("span", {
391
495
  className: "text-xs font-bold uppercase tracking-tight leading-none",
392
496
  children: e
393
497
  })]
394
498
  });
395
499
  };
396
500
  //#endregion
397
- export { w as C, E as S, M as _, U as a, O as b, j as c, B as d, R as f, z as g, N as h, W as i, P as l, F as m, J as n, H as o, L as p, G as r, V as s, Y as t, I as u, A as v, D as x, k as y };
501
+ export { O as C, M as S, ee as _, J as a, P as b, L as c, G as d, U as f, W as g, R as h, Y as i, z as l, B as m, $ as n, q as o, H as p, X as r, K as s, te as t, V as u, I as v, N as x, F as y };
package/dist/bento.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-Oagwe_oa.cjs"),t=require("./badge-locale-CJkHDlPg.cjs"),n=require("./user.context-hbdvmXOn.cjs"),r=require("./loading-provider-DGuCfsl9.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("react-i18next"),s=require("@tabler/icons-react"),c=require("@iconify/react"),l=require("react-router-dom"),u=require("@tanstack/react-table"),d=require("@dnd-kit/core"),f=require("@dnd-kit/sortable"),p=require("@dnd-kit/utilities"),m=require("sonner");var h={default:``,destructive:`bento-item-danger`},g=new Set;function _(e){process.env.NODE_ENV===`production`||g.has(e)||(g.add(e),console.warn(`BentoActionsMenu: the action "${e}" has no id. Give it a stable name, such as "post.delete": it is rendered as data-action-id so a console verb can be matched to an agent verb, and it becomes required in the next release.`))}function v({actions:e,triggerLabel:t}){let{t:r}=(0,o.useTranslation)();if(e.length===0)return null;for(let t of e)t.id||_(t.label);return(0,a.jsxs)(n.S,{children:[(0,a.jsx)(n.I,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,"aria-label":t??r(`forms.formActions.moreActions`,{defaultValue:`More actions`}),className:`bento-tile-clickable inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/60 bg-card/60 text-muted-foreground backdrop-blur transition-colors duration-200 hover:text-foreground`,children:(0,a.jsx)(s.IconDotsVertical,{size:18})})}),(0,a.jsx)(n.w,{align:`end`,sideOffset:8,className:`bento-dropdown min-w-44 p-1.5`,children:e.map(e=>{let t=e.icon,r=h[e.tone??`default`];return(0,a.jsxs)(n.E,{"data-action-id":e.id,onSelect:e.onSelect,disabled:e.disabled,className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 ${r}`,children:[(0,a.jsx)(t,{size:16}),e.label]},e.id??e.label)})})]})}var y={blue:`bento-tone-blue`,indigo:`bento-tone-indigo`,violet:`bento-tone-violet`,emerald:`bento-tone-emerald`,amber:`bento-tone-amber`,rose:`bento-tone-rose`,slate:`bento-tone-slate`},b=Object.keys(y);function x(e){return`bento-chip ${y[e]??y.slate}`}function S({to:e,icon:t,tone:n,label:r,count:i,span:o}){let s=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`grid h-9 w-9 place-items-center rounded-2xl text-white shadow-md ${x(n)}`,children:(0,a.jsx)(t,{size:18})}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-3xl font-semibold tabular-nums tracking-tight`,children:i}),(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:r})]})]}),c=`bento-tile bento-glass group relative flex flex-col justify-between overflow-hidden p-4 ${o}${e?` bento-tile-clickable`:``}`;return e?(0,a.jsx)(l.Link,{to:e,className:c,children:s}):(0,a.jsx)(`div`,{className:c,children:s})}var C=6,w={rowSortingFeature:u.rowSortingFeature,coreRowModel:(0,u.createCoreRowModel)(),sortedRowModel:(0,u.createSortedRowModel)()};function T({rows:t,getRowId:r,columns:c,label:l,getRowLabel:d,rowActions:f,selectionActions:p,onSelectionChange:m,selectionScope:h,layout:g,onLayoutChange:_,onRowOpen:y,rowHeight:b=44,height:x=480,empty:S}){let{t:T}=(0,o.useTranslation)(),[E,D]=(0,i.useState)([]),[O,k]=(0,i.useState)({hidden:[]}),[A,j]=(0,i.useState)(new Set),[M,N]=(0,i.useState)(null),[P,F]=(0,i.useState)(h);P!==h&&(F(h),j(new Set),N(null));let I=(0,i.useRef)(h);(0,i.useEffect)(()=>{I.current!==h&&(I.current=h,m?.([]))},[h,m]);let[L,R]=(0,i.useState)(0),[z,ee]=(0,i.useState)(0),te=(0,i.useRef)(null),B=(0,i.useRef)(new Map),V=(0,i.useRef)(!1),H=(p?.length??0)>0,U=e=>d?.(e)??r(e),ne=(0,i.useMemo)(()=>c.map(e=>({id:e.id,accessorFn:t=>e.sortValue?.(t)??null,enableSorting:e.sortValue!==void 0})),[c]),W=(0,u.useTable)({features:w,data:t,columns:ne,state:{sorting:E},onSortingChange:D}).getRowModel().rows.map(e=>e.original),G=g??O,K=c.filter(e=>e.hideable===!1||!G.hidden.includes(e.id)),q=[H?`2.75rem`:null,...K.map(e=>e.width??`minmax(8rem, 1fr)`),f?.length?`3.25rem`:null].filter(Boolean).join(` `),J=W.length,Y=Math.max(1,Math.floor(x/b)),re=Math.max(0,Math.floor(z/b)-C),ie=Math.min(J,Math.ceil((z+x)/b)+C),X=Math.min(L,Math.max(0,J-1));(0,i.useEffect)(()=>{V.current&&(V.current=!1,B.current.get(X)?.focus())},[X,re]);function Z(e){j(e),m?.([...e])}function ae(e,t){let[n,i]=e<=t?[e,t]:[t,e];Z(new Set(W.slice(n,i+1).map(r)))}function oe(e){let t=r(W[e]),n=new Set(A);n.has(t)?n.delete(t):n.add(t),Z(n),N(e)}function Q(e,t){let n=Math.max(0,Math.min(J-1,e));if(t&&H){let e=M??X;N(e),ae(e,n)}let r=te.current,i=n*b;if(r){let e=r.scrollTop;i<e?e=i:i+b>e+x&&(e=i+b-x),e!==r.scrollTop&&(r.scrollTop=e,ee(e))}V.current=!0,R(n)}function se(e,t){if(e.target!==e.currentTarget)return;let n=e.shiftKey;switch(e.key){case`ArrowDown`:Q(t+1,n);break;case`ArrowUp`:Q(t-1,n);break;case`PageDown`:Q(t+Y,n);break;case`PageUp`:Q(t-Y,n);break;case`Home`:Q(0,n);break;case`End`:Q(J-1,n);break;case` `:if(!H)return;oe(t);break;case`Enter`:if(!y)return;y(W[t]);break;case`Escape`:if(!H||A.size===0)return;Z(new Set),N(null);break;case`a`:case`A`:if(!H||!(e.ctrlKey||e.metaKey))return;Z(new Set(W.map(r)));break;default:return}e.preventDefault()}function ce(e,t){if(!e.target.closest(`button, a, input, [role='checkbox']`)&&(R(t),H)){if(e.shiftKey){let e=M??X;N(e),ae(e,t)}else e.metaKey||e.ctrlKey?oe(t):(Z(new Set([r(W[t])])),N(t))}}function le(e){let t=E.find(t=>t.id===e);t?t.desc?D([]):D([{id:e,desc:!0}]):D([{id:e,desc:!1}])}function ue(e,t){let n={hidden:t?[...G.hidden,e]:G.hidden.filter(t=>t!==e)};g===void 0&&k(n),_?.(n)}let $=W.filter(e=>A.has(r(e))),de=J>0&&$.length===J,fe=c.filter(e=>e.hideable!==!1);return(0,a.jsxs)(`div`,{"data-slot":`bento-data-table`,className:`bento-glass overflow-hidden rounded-2xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,a.jsx)(`span`,{"aria-live":`polite`,className:`text-sm font-medium`,children:$.length>0?T(`bento.table.selected`,{defaultValue:`{{count}} selected`,count:$.length}):``}),$.length>0&&(0,a.jsxs)(`div`,{role:`toolbar`,"aria-label":T(`bento.table.selectionActions`,{defaultValue:`Actions on the selection`}),className:`flex flex-wrap items-center gap-2`,children:[p?.map(t=>{let r=t.icon;return(0,a.jsxs)(n.R,{variant:`outline`,size:`sm`,className:e.t(`gap-1.5`,t.tone===`destructive`&&`bento-item-danger`),onClick:()=>t.onSelect($),children:[(0,a.jsx)(r,{size:16}),t.label]},t.id)}),(0,a.jsx)(n.R,{variant:`ghost`,size:`sm`,onClick:()=>Z(new Set),children:T(`bento.table.clearSelection`,{defaultValue:`Clear selection`})})]}),fe.length>0&&(0,a.jsxs)(n.S,{children:[(0,a.jsx)(n.I,{asChild:!0,children:(0,a.jsxs)(n.R,{variant:`ghost`,size:`sm`,className:`ml-auto gap-1.5`,children:[(0,a.jsx)(s.IconColumns3,{size:16,"aria-hidden":`true`}),T(`bento.table.columns`,{defaultValue:`Columns`})]})}),(0,a.jsx)(n.w,{align:`end`,className:`bento-dropdown min-w-44 p-1.5`,children:fe.map(e=>(0,a.jsx)(n.C,{checked:!G.hidden.includes(e.id),onCheckedChange:t=>ue(e.id,t!==!0),onSelect:e=>e.preventDefault(),children:e.header},e.id))})]})]}),(0,a.jsxs)(`div`,{role:`grid`,"aria-label":l,"aria-rowcount":J+1,"aria-colcount":K.length+ +!!H+ +!!f?.length,"aria-multiselectable":H?`true`:void 0,children:[(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsxs)(`div`,{role:`row`,"aria-rowindex":1,className:`grid items-center border-b border-border/50 px-1 text-xs font-medium text-muted-foreground`,style:{gridTemplateColumns:q,minHeight:b},children:[H&&(0,a.jsx)(`div`,{role:`columnheader`,className:`grid place-items-center`,children:(0,a.jsx)(n.L,{"aria-label":T(`bento.table.selectAll`,{defaultValue:`Select all rows`}),checked:de?!0:$.length>0&&`indeterminate`,onCheckedChange:()=>Z(de?new Set:new Set(W.map(r)))})}),K.map(e=>{let t=E.find(t=>t.id===e.id),n=t?t.desc?`descending`:`ascending`:`none`;return(0,a.jsx)(`div`,{role:`columnheader`,"aria-sort":e.sortValue?n:void 0,className:`min-w-0 px-2`,children:e.sortValue?(0,a.jsxs)(`button`,{type:`button`,onClick:()=>le(e.id),className:`inline-flex max-w-full items-center gap-1 rounded-md py-1 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(`span`,{className:`truncate`,children:e.header}),n===`ascending`&&(0,a.jsx)(s.IconArrowUp,{size:14,"aria-hidden":`true`}),n===`descending`&&(0,a.jsx)(s.IconArrowDown,{size:14,"aria-hidden":`true`}),n===`none`&&(0,a.jsx)(s.IconArrowsSort,{size:14,"aria-hidden":`true`,className:`opacity-40`})]}):(0,a.jsx)(`span`,{className:`block truncate py-1`,children:e.header})},e.id)}),f?.length?(0,a.jsx)(`div`,{role:`columnheader`,className:`px-2`,children:(0,a.jsx)(`span`,{className:`sr-only`,children:T(`bento.table.actions`,{defaultValue:`Actions`})})}):null]})}),J===0?(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsx)(`div`,{role:`row`,"aria-rowindex":2,children:(0,a.jsx)(`div`,{role:`gridcell`,className:`px-4 py-10 text-center text-sm text-muted-foreground`,children:S??T(`bento.table.empty`,{defaultValue:`Nothing to show`})})})}):(0,a.jsx)(`div`,{role:`rowgroup`,ref:te,onScroll:e=>ee(e.currentTarget.scrollTop),className:`relative overflow-y-auto`,style:{height:x},children:(0,a.jsx)(`div`,{style:{height:J*b},className:`relative`,children:W.slice(re,ie).map((t,i)=>{let o=re+i,s=r(t),c=A.has(s),l=U(t);return(0,a.jsxs)(`div`,{ref:e=>{e?B.current.set(o,e):B.current.delete(o)},role:`row`,"aria-rowindex":o+2,"aria-selected":H?c?`true`:`false`:void 0,tabIndex:o===X?0:-1,onKeyDown:e=>se(e,o),onClick:e=>ce(e,o),onDoubleClick:()=>y?.(t),onFocus:e=>{e.target===e.currentTarget&&R(o)},className:e.t(`absolute inset-x-0 grid items-center border-b border-border/30 px-1 text-sm outline-none transition-colors`,`hover:bg-muted/40 focus-visible:bg-muted/60 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,c&&`bg-primary/10 hover:bg-primary/15`),style:{top:o*b,height:b,gridTemplateColumns:q},children:[H&&(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(n.L,{tabIndex:-1,"aria-label":T(`bento.table.selectRow`,{defaultValue:`Select {{row}}`,row:l}),checked:c,onCheckedChange:()=>oe(o)})}),K.map(e=>(0,a.jsx)(`div`,{role:`gridcell`,className:`min-w-0 truncate px-2`,children:e.cell(t)},e.id)),f?.length?(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(v,{triggerLabel:T(`bento.table.rowActions`,{defaultValue:`Actions for {{row}}`,row:l}),actions:f.map(e=>({id:e.id,label:e.label,icon:e.icon,tone:e.tone,onSelect:()=>e.onSelect([t])}))})}):null]},s)})})})]})]})}function E({icon:t=s.IconSparkles,tone:n=`indigo`,title:r,description:i,action:o,align:c=`center`,titleLevel:l=2,className:u}){let d=x(n),f=c===`center`,p=`h${l}`;return(0,a.jsxs)(`div`,{className:e.t(`bento-tile bento-glass flex flex-col gap-3 rounded-3xl p-8`,f?`items-center text-center`:`items-start text-left`,u),children:[(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${d} text-white shadow-md`,children:(0,a.jsx)(t,{size:24})}),(0,a.jsx)(p,{className:`m-0 text-lg font-semibold tracking-tight`,children:r}),i&&(0,a.jsx)(`p`,{className:e.t(`max-w-md text-sm text-muted-foreground`,f&&`mx-auto`),children:i}),o&&(0,a.jsx)(`div`,{className:e.t(`mt-1`,f&&`mx-auto`),children:o})]})}function D({to:e,children:t}){return(0,a.jsxs)(l.Link,{to:e,className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,a.jsx)(s.IconArrowLeft,{size:14,"aria-hidden":!0}),t]})}function O({eyebrow:e,backTo:t,backLabel:n,title:r,subtitle:i,leading:o,trailing:s}){let c=e??(t==null?null:(0,a.jsx)(D,{to:t,children:n}));return(0,a.jsx)(`header`,{className:`bento-shell-header mb-6 flex flex-col items-start gap-3 md:mb-10`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-start gap-4`,children:[o&&(0,a.jsx)(`div`,{className:`shrink-0`,children:o}),(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[c&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:c}),(0,a.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight md:text-4xl`,children:r}),i&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:i})]}),s&&(0,a.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:s})]})})}function k({value:e,onChange:t,onClear:r,defaultIcon:l,tone:u,title:d,description:f,readOnly:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(!1);return p?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${x(u)} text-white shadow-md`,children:e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24})}):(0,a.jsxs)(`div`,{className:`group relative`,children:[(0,a.jsxs)(`button`,{type:`button`,onClick:()=>g(!0),"aria-label":m(`forms.iconPicker.chooseAnIcon`),className:`group/icon relative grid h-12 w-12 cursor-pointer place-items-center overflow-hidden rounded-2xl ${x(u)} text-white shadow-md outline-none transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:scale-105 focus-visible:ring-2 focus-visible:ring-ring active:scale-95`,children:[e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24}),(0,a.jsx)(`span`,{className:`pointer-events-none absolute inset-0 grid place-items-center bg-black/40 opacity-0 transition-opacity duration-200 group-hover/icon:opacity-100`,children:(0,a.jsx)(s.IconPalette,{className:`size-5 text-white`})})]}),e&&r&&(0,a.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},"aria-label":m(`forms.common.remove`),title:m(`forms.common.remove`),className:`absolute -right-1.5 -top-1.5 grid h-5 w-5 cursor-pointer place-items-center rounded-full border border-border/60 bg-card/90 text-foreground opacity-0 shadow-md backdrop-blur transition-opacity duration-200 bento-clear focus-visible:opacity-100 group-hover:opacity-100`,children:(0,a.jsx)(s.IconX,{size:12})}),(0,a.jsx)(n.x,{open:h,onOpenChange:g,value:e,onSelect:t,onClear:r,title:d,description:f})]})}function A({value:n,onSave:r,multiline:s=!1,placeholder:c,className:l,ariaLabel:u,autoFocus:d=!1,readOnly:f=!1,commitOnChange:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(d),[_,v]=(0,i.useState)(n),[y,b]=(0,i.useState)(!1),x=(0,i.useRef)(null),S=(0,i.useRef)(null),C=(0,i.useRef)(!1),w=(0,i.useRef)(!1),[T,E]=(0,i.useState)(n);!h&&n!==T&&(E(n),v(n)),(0,i.useEffect)(()=>{h&&x.current?(x.current.focus(),x.current.select()):!h&&w.current&&(w.current=!1,S.current?.focus())},[h]);function D(){w.current=x.current!==null&&document.activeElement===x.current,g(!1)}async function O(){if(C.current)return;let e=_.trim();if(e===n){D();return}if(!e&&!c){v(n),D();return}C.current=!0,b(!0);try{await r(e)}catch{v(n)}finally{C.current=!1,b(!1),D()}}function k(){v(n),D()}function A(e){v(e),p&&r(e)}let j=!n;if(f)return(0,a.jsx)(`span`,{className:e.t(`block w-full`,l),"aria-label":u,children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground/80`,children:c??`—`})});let M=`w-full bg-transparent outline-none border-b transition-colors duration-200`,N=e.t(M,`cursor-text rounded-sm`,j?`border-dashed border-border/70 hover:border-foreground/40`:`border-transparent hover:border-border/60 focus-visible:border-border/80`),P=e.t(M,`bento-editing`);if(!h)return(0,a.jsx)(`button`,{ref:S,type:`button`,onClick:()=>g(!0),className:e.t(N,`text-left`,l),"aria-label":u??m(`forms.formActions.edit`),children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground/80`,children:c??`—`})});function F(e){if(e.key===`Escape`){e.preventDefault(),k();return}e.key===`Enter`&&(!s||e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())}return s?(0,a.jsx)(`textarea`,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,rows:3,className:e.t(P,`resize-none py-0.5 leading-snug`,l)}):(0,a.jsx)(t.a,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,className:e.t(P,`h-auto px-0 py-0 shadow-none focus-visible:ring-0`,l)})}function j({titleMissing:t,dirty:n,className:r}){let{t:i}=(0,o.useTranslation)();if(!t&&!n)return null;let c=`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium normal-case leading-none tracking-normal`;return t?(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-error`,r),children:[(0,a.jsx)(s.IconAlertTriangle,{className:`size-3`}),i(`bento.saveBar.titleRequired`,{defaultValue:`Title required`})]}):(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-warn`,r),children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bento-status-dot bento-pulse`}),i(`bento.saveBar.unsaved`,{defaultValue:`Unsaved changes`})]})}function M(e){(0,i.useEffect)(()=>{let t=e.current;if(!t)return;let n=document.documentElement,r=0,i=()=>{r=0;let e=t.getBoundingClientRect().top,i=Math.max(0,Math.min(1,(160-e)/80));n.style.setProperty(`--bento-fade`,String(i)),n.classList.toggle(`bento-fade-half`,i>.5)},a=()=>{r||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{r&&cancelAnimationFrame(r),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a),n.style.removeProperty(`--bento-fade`),n.classList.remove(`bento-fade-half`)}},[e])}function N(e,t){let n={};for(let r of Object.keys(e))Object.assign(n,{[r]:t[r]});return n}function P({entity:e,isNew:n,headlineFallback:c,eyebrow:u,listRoute:d,icon:f,tone:p,formId:h,feature:g,hasStatus:_=!1,hideIcon:y=!1,readOnly:b=!1,autosaveOnly:x=!1,badge:S,notice:C,onUpdate:w,onDelete:T,extraActions:E,children:P}){let{t:F}=(0,o.useTranslation)(),I=(0,l.useNavigate)(),[L,R]=(0,i.useState)(!1),[z,ee]=(0,i.useState)({isDirty:!1,isSubmitting:!1}),te=(0,i.useRef)(null);M(te);let B={title:e.title??``,description:e.description??``,icon:e.icon??null,enabled:e.enabled??1},[V,H]=(0,i.useState)(B),[U,ne]=(0,i.useState)(B);(B.title!==U.title||B.description!==U.description||B.icon!==U.icon||B.enabled!==U.enabled)&&(ne(B),H(B));async function W(t){if(H(e=>({...e,...t})),n||!w)return;let r=t.title??V.title;try{await w({...e,...t}),m.toast.success(F(`forms.common.updated`,{name:r,feature:g}))}catch(e){console.error(`Failed to update entity field`,e),H(e=>({...e,...N(t,B)})),m.toast.error(F(`forms.common.notUpdated`,{name:B.title||r,feature:g}))}}async function G(){if(T){try{await T()?(m.toast.success(F(`forms.common.deleted`,{name:V.title,feature:g})),I(d)):m.toast.error(F(`forms.common.notDeleted`,{name:V.title,feature:g}))}catch(e){console.error(`Failed to delete entity`,e),m.toast.error(F(`forms.common.notDeleted`,{name:V.title,feature:g}))}R(!1)}}let K=V.enabled===1,q=!b,J=!(x&&!n),Y=!V.title.trim(),re=!n&&!z.isDirty,ie=Y||re,X=[...E??[],...T&&!b?[{id:`entity.delete`,label:F(`forms.formActions.delete`),icon:s.IconTrash,tone:`destructive`,onSelect:()=>R(!0)}]:[]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O,{eyebrow:(0,a.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,a.jsx)(D,{to:d,children:u}),!b&&(0,a.jsx)(j,{titleMissing:Y,dirty:n||z.isDirty})]}),leading:(0,a.jsx)(k,{value:V.icon,onChange:e=>W({icon:e}),onClear:()=>W({icon:null}),defaultIcon:f,tone:p,title:V.title,description:V.description,readOnly:b||y}),title:(0,a.jsx)(A,{value:V.title,onSave:e=>W({title:e}),placeholder:c,className:`text-3xl font-semibold tracking-tight md:text-4xl`,ariaLabel:F(`forms.common.title`),autoFocus:n,commitOnChange:n,readOnly:b}),subtitle:(0,a.jsx)(A,{value:V.description,onSave:e=>W({description:e}),multiline:!0,placeholder:F(`forms.common.description`),className:`max-w-2xl text-sm text-muted-foreground`,ariaLabel:F(`forms.common.description`),commitOnChange:n,readOnly:b}),trailing:(0,a.jsxs)(a.Fragment,{children:[q&&(0,a.jsxs)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:[J&&(0,a.jsxs)(t.o,{type:`submit`,form:h,size:`sm`,loading:z.isSubmitting,"aria-disabled":ie?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),F(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>I(d),children:[(0,a.jsx)(s.IconX,{className:`size-4`}),F(`forms.formActions.cancel`)]})]}),S,_&&(b?(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?F(`common.active`,{defaultValue:`Active`}):F(`common.idle`,{defaultValue:`Idle`})]}):(0,a.jsxs)(`button`,{type:`button`,onClick:()=>W({enabled:+!K}),"aria-label":F(`forms.common.enabled`),title:F(K?`common.activeToggleHint`:`common.idleToggleHint`),className:`bento-tile-clickable flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider transition-colors duration-200 ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground hover:bg-muted/80`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?F(`common.active`,{defaultValue:`Active`}):F(`common.idle`,{defaultValue:`Idle`})]})),!n&&X.length>0&&(0,a.jsx)(v,{actions:X})]})}),(0,a.jsx)(`div`,{ref:te,"aria-hidden":!0,className:`h-px`}),C,!n&&T&&(0,a.jsx)(r.r,{feature:g,name:V.title,onDelete:G,open:L,setOpen:R,trigger:(0,a.jsx)(`span`,{className:`hidden`,"aria-hidden":!0})}),P({staged:V,onStateChange:ee})]})}function F(e,t,n=!0){let r=e.length,i=t.length;if(r*i>4e5)return null;let a=Array.from({length:r+1},()=>new Uint32Array(i+1));for(let n=r-1;n>=0;n--)for(let r=i-1;r>=0;r--)a[n][r]=e[n]===t[r]?a[n+1][r+1]+1:Math.max(a[n+1][r],a[n][r+1]);let o=[],s=(e,t)=>{let r=o[o.length-1];n&&r?.op===e?r.text+=t:o.push({op:e,text:t})},c=0,l=0;for(;c<r&&l<i;)e[c]===t[l]?(s(`same`,e[c]),c++,l++):a[c+1][l]>=a[c][l+1]?s(`remove`,e[c++]):s(`add`,t[l++]);for(;c<r;)s(`remove`,e[c++]);for(;l<i;)s(`add`,t[l++]);return o}var I=e=>e.split(/(\s+)/).filter(e=>e!==``);function L(e){if(typeof DOMParser>`u`)return e.split(/<\/(?:p|h[1-6]|li|blockquote|pre|div)>/i).map(e=>e.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim()).filter(Boolean);let t=new DOMParser().parseFromString(e,`text/html`),n=[...t.body.querySelectorAll(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)].filter(e=>!e.parentElement?.closest(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)).map(e=>(e.textContent??``).replace(/\s+/g,` `).trim()).filter(Boolean),r=(t.body.textContent??``).replace(/\s+/g,` `).trim();return n.length>0?n:r?[r]:[]}var R=e=>e==null?``:String(e);function z({before:t,after:n,fields:r,showUnchanged:c=!1}){let{t:l}=(0,o.useTranslation)(),[u,d]=(0,i.useState)(c),f=r.map(e=>{let r=t?.[e.id],i=n?.[e.id],a=e.kind??`text`,o=a===`rich`?L(R(r)).join(`
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-Oagwe_oa.cjs"),t=require("./badge-locale-1_BmNTro.cjs"),n=require("./user.context-D01CI8gq.cjs"),r=require("./loading-provider-E4tIG9BM.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("react-i18next"),s=require("@tabler/icons-react"),c=require("@iconify/react"),l=require("react-router-dom"),u=require("@tanstack/react-table"),d=require("@dnd-kit/core"),f=require("@dnd-kit/sortable"),p=require("@dnd-kit/utilities"),m=require("sonner");var h={default:``,destructive:`bento-item-danger`},g=new Set;function _(e){process.env.NODE_ENV===`production`||g.has(e)||(g.add(e),console.warn(`BentoActionsMenu: the action "${e}" has no id. Give it a stable name, such as "post.delete": it is rendered as data-action-id so a console verb can be matched to an agent verb, and it becomes required in the next release.`))}function v({actions:e,triggerLabel:t}){let{t:r}=(0,o.useTranslation)();if(e.length===0)return null;for(let t of e)t.id||_(t.label);return(0,a.jsxs)(n.S,{children:[(0,a.jsx)(n.I,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,"aria-label":t??r(`forms.formActions.moreActions`,{defaultValue:`More actions`}),className:`bento-tile-clickable inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/60 bg-card/60 text-muted-foreground backdrop-blur transition-colors duration-200 hover:text-foreground`,children:(0,a.jsx)(s.IconDotsVertical,{size:18})})}),(0,a.jsx)(n.w,{align:`end`,sideOffset:8,className:`bento-dropdown min-w-44 p-1.5`,children:e.map(e=>{let t=e.icon,r=h[e.tone??`default`];return(0,a.jsxs)(n.E,{"data-action-id":e.id,onSelect:e.onSelect,disabled:e.disabled,className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 ${r}`,children:[(0,a.jsx)(t,{size:16}),e.label]},e.id??e.label)})})]})}var y={blue:`bento-tone-blue`,indigo:`bento-tone-indigo`,violet:`bento-tone-violet`,emerald:`bento-tone-emerald`,amber:`bento-tone-amber`,rose:`bento-tone-rose`,slate:`bento-tone-slate`},b=Object.keys(y);function x(e){return`bento-chip ${y[e]??y.slate}`}function S({to:e,icon:t,tone:n,label:r,count:i,span:o}){let s=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`grid h-9 w-9 place-items-center rounded-2xl text-white shadow-md ${x(n)}`,children:(0,a.jsx)(t,{size:18})}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-3xl font-semibold tabular-nums tracking-tight`,children:i}),(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:r})]})]}),c=`bento-tile bento-glass group relative flex flex-col justify-between overflow-hidden p-4 ${o}${e?` bento-tile-clickable`:``}`;return e?(0,a.jsx)(l.Link,{to:e,className:c,children:s}):(0,a.jsx)(`div`,{className:c,children:s})}var C=6,w={rowSortingFeature:u.rowSortingFeature,coreRowModel:(0,u.createCoreRowModel)(),sortedRowModel:(0,u.createSortedRowModel)()};function T({rows:t,getRowId:r,columns:c,label:l,getRowLabel:d,rowActions:f,selectionActions:p,onSelectionChange:m,selectionScope:h,layout:g,onLayoutChange:_,onRowOpen:y,rowHeight:b=44,height:x=480,empty:S}){let{t:T}=(0,o.useTranslation)(),[E,D]=(0,i.useState)([]),[O,k]=(0,i.useState)({hidden:[]}),[A,j]=(0,i.useState)(new Set),[M,N]=(0,i.useState)(null),[P,F]=(0,i.useState)(h);P!==h&&(F(h),j(new Set),N(null));let I=(0,i.useRef)(h);(0,i.useEffect)(()=>{I.current!==h&&(I.current=h,m?.([]))},[h,m]);let[L,R]=(0,i.useState)(0),[z,ee]=(0,i.useState)(0),te=(0,i.useRef)(null),B=(0,i.useRef)(new Map),V=(0,i.useRef)(!1),H=(p?.length??0)>0,U=e=>d?.(e)??r(e),ne=(0,i.useMemo)(()=>c.map(e=>({id:e.id,accessorFn:t=>e.sortValue?.(t)??null,enableSorting:e.sortValue!==void 0})),[c]),W=(0,u.useTable)({features:w,data:t,columns:ne,state:{sorting:E},onSortingChange:D}).getRowModel().rows.map(e=>e.original),G=g??O,K=c.filter(e=>e.hideable===!1||!G.hidden.includes(e.id)),q=[H?`2.75rem`:null,...K.map(e=>e.width??`minmax(8rem, 1fr)`),f?.length?`3.25rem`:null].filter(Boolean).join(` `),J=W.length,Y=Math.max(1,Math.floor(x/b)),re=Math.max(0,Math.floor(z/b)-C),ie=Math.min(J,Math.ceil((z+x)/b)+C),X=Math.min(L,Math.max(0,J-1));(0,i.useEffect)(()=>{V.current&&(V.current=!1,B.current.get(X)?.focus())},[X,re]);function Z(e){j(e),m?.([...e])}function ae(e,t){let[n,i]=e<=t?[e,t]:[t,e];Z(new Set(W.slice(n,i+1).map(r)))}function oe(e){let t=r(W[e]),n=new Set(A);n.has(t)?n.delete(t):n.add(t),Z(n),N(e)}function Q(e,t){let n=Math.max(0,Math.min(J-1,e));if(t&&H){let e=M??X;N(e),ae(e,n)}let r=te.current,i=n*b;if(r){let e=r.scrollTop;i<e?e=i:i+b>e+x&&(e=i+b-x),e!==r.scrollTop&&(r.scrollTop=e,ee(e))}V.current=!0,R(n)}function se(e,t){if(e.target!==e.currentTarget)return;let n=e.shiftKey;switch(e.key){case`ArrowDown`:Q(t+1,n);break;case`ArrowUp`:Q(t-1,n);break;case`PageDown`:Q(t+Y,n);break;case`PageUp`:Q(t-Y,n);break;case`Home`:Q(0,n);break;case`End`:Q(J-1,n);break;case` `:if(!H)return;oe(t);break;case`Enter`:if(!y)return;y(W[t]);break;case`Escape`:if(!H||A.size===0)return;Z(new Set),N(null);break;case`a`:case`A`:if(!H||!(e.ctrlKey||e.metaKey))return;Z(new Set(W.map(r)));break;default:return}e.preventDefault()}function ce(e,t){if(!e.target.closest(`button, a, input, [role='checkbox']`)&&(R(t),H)){if(e.shiftKey){let e=M??X;N(e),ae(e,t)}else e.metaKey||e.ctrlKey?oe(t):(Z(new Set([r(W[t])])),N(t))}}function le(e){let t=E.find(t=>t.id===e);t?t.desc?D([]):D([{id:e,desc:!0}]):D([{id:e,desc:!1}])}function ue(e,t){let n={hidden:t?[...G.hidden,e]:G.hidden.filter(t=>t!==e)};g===void 0&&k(n),_?.(n)}let $=W.filter(e=>A.has(r(e))),de=J>0&&$.length===J,fe=c.filter(e=>e.hideable!==!1);return(0,a.jsxs)(`div`,{"data-slot":`bento-data-table`,className:`bento-glass overflow-hidden rounded-2xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,a.jsx)(`span`,{"aria-live":`polite`,className:`text-sm font-medium`,children:$.length>0?T(`bento.table.selected`,{defaultValue:`{{count}} selected`,count:$.length}):``}),$.length>0&&(0,a.jsxs)(`div`,{role:`toolbar`,"aria-label":T(`bento.table.selectionActions`,{defaultValue:`Actions on the selection`}),className:`flex flex-wrap items-center gap-2`,children:[p?.map(t=>{let r=t.icon;return(0,a.jsxs)(n.R,{variant:`outline`,size:`sm`,className:e.t(`gap-1.5`,t.tone===`destructive`&&`bento-item-danger`),onClick:()=>t.onSelect($),children:[(0,a.jsx)(r,{size:16}),t.label]},t.id)}),(0,a.jsx)(n.R,{variant:`ghost`,size:`sm`,onClick:()=>Z(new Set),children:T(`bento.table.clearSelection`,{defaultValue:`Clear selection`})})]}),fe.length>0&&(0,a.jsxs)(n.S,{children:[(0,a.jsx)(n.I,{asChild:!0,children:(0,a.jsxs)(n.R,{variant:`ghost`,size:`sm`,className:`ml-auto gap-1.5`,children:[(0,a.jsx)(s.IconColumns3,{size:16,"aria-hidden":`true`}),T(`bento.table.columns`,{defaultValue:`Columns`})]})}),(0,a.jsx)(n.w,{align:`end`,className:`bento-dropdown min-w-44 p-1.5`,children:fe.map(e=>(0,a.jsx)(n.C,{checked:!G.hidden.includes(e.id),onCheckedChange:t=>ue(e.id,t!==!0),onSelect:e=>e.preventDefault(),children:e.header},e.id))})]})]}),(0,a.jsxs)(`div`,{role:`grid`,"aria-label":l,"aria-rowcount":J+1,"aria-colcount":K.length+ +!!H+ +!!f?.length,"aria-multiselectable":H?`true`:void 0,children:[(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsxs)(`div`,{role:`row`,"aria-rowindex":1,className:`grid items-center border-b border-border/50 px-1 text-xs font-medium text-muted-foreground`,style:{gridTemplateColumns:q,minHeight:b},children:[H&&(0,a.jsx)(`div`,{role:`columnheader`,className:`grid place-items-center`,children:(0,a.jsx)(n.L,{"aria-label":T(`bento.table.selectAll`,{defaultValue:`Select all rows`}),checked:de?!0:$.length>0&&`indeterminate`,onCheckedChange:()=>Z(de?new Set:new Set(W.map(r)))})}),K.map(e=>{let t=E.find(t=>t.id===e.id),n=t?t.desc?`descending`:`ascending`:`none`;return(0,a.jsx)(`div`,{role:`columnheader`,"aria-sort":e.sortValue?n:void 0,className:`min-w-0 px-2`,children:e.sortValue?(0,a.jsxs)(`button`,{type:`button`,onClick:()=>le(e.id),className:`inline-flex max-w-full items-center gap-1 rounded-md py-1 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(`span`,{className:`truncate`,children:e.header}),n===`ascending`&&(0,a.jsx)(s.IconArrowUp,{size:14,"aria-hidden":`true`}),n===`descending`&&(0,a.jsx)(s.IconArrowDown,{size:14,"aria-hidden":`true`}),n===`none`&&(0,a.jsx)(s.IconArrowsSort,{size:14,"aria-hidden":`true`,className:`opacity-40`})]}):(0,a.jsx)(`span`,{className:`block truncate py-1`,children:e.header})},e.id)}),f?.length?(0,a.jsx)(`div`,{role:`columnheader`,className:`px-2`,children:(0,a.jsx)(`span`,{className:`sr-only`,children:T(`bento.table.actions`,{defaultValue:`Actions`})})}):null]})}),J===0?(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsx)(`div`,{role:`row`,"aria-rowindex":2,children:(0,a.jsx)(`div`,{role:`gridcell`,className:`px-4 py-10 text-center text-sm text-muted-foreground`,children:S??T(`bento.table.empty`,{defaultValue:`Nothing to show`})})})}):(0,a.jsx)(`div`,{role:`rowgroup`,ref:te,onScroll:e=>ee(e.currentTarget.scrollTop),className:`relative overflow-y-auto`,style:{height:x},children:(0,a.jsx)(`div`,{style:{height:J*b},className:`relative`,children:W.slice(re,ie).map((t,i)=>{let o=re+i,s=r(t),c=A.has(s),l=U(t);return(0,a.jsxs)(`div`,{ref:e=>{e?B.current.set(o,e):B.current.delete(o)},role:`row`,"aria-rowindex":o+2,"aria-selected":H?c?`true`:`false`:void 0,tabIndex:o===X?0:-1,onKeyDown:e=>se(e,o),onClick:e=>ce(e,o),onDoubleClick:()=>y?.(t),onFocus:e=>{e.target===e.currentTarget&&R(o)},className:e.t(`absolute inset-x-0 grid items-center border-b border-border/30 px-1 text-sm outline-none transition-colors`,`hover:bg-muted/40 focus-visible:bg-muted/60 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,c&&`bg-primary/10 hover:bg-primary/15`),style:{top:o*b,height:b,gridTemplateColumns:q},children:[H&&(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(n.L,{tabIndex:-1,"aria-label":T(`bento.table.selectRow`,{defaultValue:`Select {{row}}`,row:l}),checked:c,onCheckedChange:()=>oe(o)})}),K.map(e=>(0,a.jsx)(`div`,{role:`gridcell`,className:`min-w-0 truncate px-2`,children:e.cell(t)},e.id)),f?.length?(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(v,{triggerLabel:T(`bento.table.rowActions`,{defaultValue:`Actions for {{row}}`,row:l}),actions:f.map(e=>({id:e.id,label:e.label,icon:e.icon,tone:e.tone,onSelect:()=>e.onSelect([t])}))})}):null]},s)})})})]})]})}function E({icon:t=s.IconSparkles,tone:n=`indigo`,title:r,description:i,action:o,align:c=`center`,titleLevel:l=2,className:u}){let d=x(n),f=c===`center`,p=`h${l}`;return(0,a.jsxs)(`div`,{className:e.t(`bento-tile bento-glass flex flex-col gap-3 rounded-3xl p-8`,f?`items-center text-center`:`items-start text-left`,u),children:[(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${d} text-white shadow-md`,children:(0,a.jsx)(t,{size:24})}),(0,a.jsx)(p,{className:`m-0 text-lg font-semibold tracking-tight`,children:r}),i&&(0,a.jsx)(`p`,{className:e.t(`max-w-md text-sm text-muted-foreground`,f&&`mx-auto`),children:i}),o&&(0,a.jsx)(`div`,{className:e.t(`mt-1`,f&&`mx-auto`),children:o})]})}function D({to:e,children:t}){return(0,a.jsxs)(l.Link,{to:e,className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,a.jsx)(s.IconArrowLeft,{size:14,"aria-hidden":!0}),t]})}function O({eyebrow:e,backTo:t,backLabel:n,title:r,subtitle:i,leading:o,trailing:s}){let c=e??(t==null?null:(0,a.jsx)(D,{to:t,children:n}));return(0,a.jsx)(`header`,{className:`bento-shell-header mb-6 flex flex-col items-start gap-3 md:mb-10`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-start gap-4`,children:[o&&(0,a.jsx)(`div`,{className:`shrink-0`,children:o}),(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[c&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:c}),(0,a.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight md:text-4xl`,children:r}),i&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:i})]}),s&&(0,a.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:s})]})})}function k({value:e,onChange:t,onClear:r,defaultIcon:l,tone:u,title:d,description:f,readOnly:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(!1);return p?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${x(u)} text-white shadow-md`,children:e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24})}):(0,a.jsxs)(`div`,{className:`group relative`,children:[(0,a.jsxs)(`button`,{type:`button`,onClick:()=>g(!0),"aria-label":m(`forms.iconPicker.chooseAnIcon`),className:`group/icon relative grid h-12 w-12 cursor-pointer place-items-center overflow-hidden rounded-2xl ${x(u)} text-white shadow-md outline-none transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:scale-105 focus-visible:ring-2 focus-visible:ring-ring active:scale-95`,children:[e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24}),(0,a.jsx)(`span`,{className:`pointer-events-none absolute inset-0 grid place-items-center bg-black/40 opacity-0 transition-opacity duration-200 group-hover/icon:opacity-100`,children:(0,a.jsx)(s.IconPalette,{className:`size-5 text-white`})})]}),e&&r&&(0,a.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},"aria-label":m(`forms.common.remove`),title:m(`forms.common.remove`),className:`absolute -right-1.5 -top-1.5 grid h-5 w-5 cursor-pointer place-items-center rounded-full border border-border/60 bg-card/90 text-foreground opacity-0 shadow-md backdrop-blur transition-opacity duration-200 bento-clear focus-visible:opacity-100 group-hover:opacity-100`,children:(0,a.jsx)(s.IconX,{size:12})}),(0,a.jsx)(n.x,{open:h,onOpenChange:g,value:e,onSelect:t,onClear:r,title:d,description:f})]})}function A({value:n,onSave:r,multiline:s=!1,placeholder:c,className:l,ariaLabel:u,autoFocus:d=!1,readOnly:f=!1,commitOnChange:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(d),[_,v]=(0,i.useState)(n),[y,b]=(0,i.useState)(!1),x=(0,i.useRef)(null),S=(0,i.useRef)(null),C=(0,i.useRef)(!1),w=(0,i.useRef)(!1),[T,E]=(0,i.useState)(n);!h&&n!==T&&(E(n),v(n)),(0,i.useEffect)(()=>{h&&x.current?(x.current.focus(),x.current.select()):!h&&w.current&&(w.current=!1,S.current?.focus())},[h]);function D(){w.current=x.current!==null&&document.activeElement===x.current,g(!1)}async function O(){if(C.current)return;let e=_.trim();if(e===n){D();return}if(!e&&!c){v(n),D();return}C.current=!0,b(!0);try{await r(e)}catch{v(n)}finally{C.current=!1,b(!1),D()}}function k(){v(n),D()}function A(e){v(e),p&&r(e)}let j=!n;if(f)return(0,a.jsx)(`span`,{className:e.t(`block w-full`,l),"aria-label":u,children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground/80`,children:c??`—`})});let M=`w-full bg-transparent outline-none border-b transition-colors duration-200`,N=e.t(M,`cursor-text rounded-sm`,j?`border-dashed border-border/70 hover:border-foreground/40`:`border-transparent hover:border-border/60 focus-visible:border-border/80`),P=e.t(M,`bento-editing`);if(!h)return(0,a.jsx)(`button`,{ref:S,type:`button`,onClick:()=>g(!0),className:e.t(N,`text-left`,l),"aria-label":u??m(`forms.formActions.edit`),children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground/80`,children:c??`—`})});function F(e){if(e.key===`Escape`){e.preventDefault(),k();return}e.key===`Enter`&&(!s||e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())}return s?(0,a.jsx)(`textarea`,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,rows:3,className:e.t(P,`resize-none py-0.5 leading-snug`,l)}):(0,a.jsx)(t.a,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,className:e.t(P,`h-auto px-0 py-0 shadow-none focus-visible:ring-0`,l)})}function j({titleMissing:t,dirty:n,className:r}){let{t:i}=(0,o.useTranslation)();if(!t&&!n)return null;let c=`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium normal-case leading-none tracking-normal`;return t?(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-error`,r),children:[(0,a.jsx)(s.IconAlertTriangle,{className:`size-3`}),i(`bento.saveBar.titleRequired`,{defaultValue:`Title required`})]}):(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-warn`,r),children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bento-status-dot bento-pulse`}),i(`bento.saveBar.unsaved`,{defaultValue:`Unsaved changes`})]})}function M(e){(0,i.useEffect)(()=>{let t=e.current;if(!t)return;let n=document.documentElement,r=0,i=()=>{r=0;let e=t.getBoundingClientRect().top,i=Math.max(0,Math.min(1,(160-e)/80));n.style.setProperty(`--bento-fade`,String(i)),n.classList.toggle(`bento-fade-half`,i>.5)},a=()=>{r||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{r&&cancelAnimationFrame(r),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a),n.style.removeProperty(`--bento-fade`),n.classList.remove(`bento-fade-half`)}},[e])}function N(e,t){let n={};for(let r of Object.keys(e))Object.assign(n,{[r]:t[r]});return n}function P({entity:e,isNew:n,headlineFallback:c,eyebrow:u,listRoute:d,icon:f,tone:p,formId:h,feature:g,hasStatus:_=!1,hideIcon:y=!1,readOnly:b=!1,autosaveOnly:x=!1,badge:S,notice:C,onUpdate:w,onDelete:T,extraActions:E,children:P}){let{t:F}=(0,o.useTranslation)(),I=(0,l.useNavigate)(),[L,R]=(0,i.useState)(!1),[z,ee]=(0,i.useState)({isDirty:!1,isSubmitting:!1}),te=(0,i.useRef)(null);M(te);let B={title:e.title??``,description:e.description??``,icon:e.icon??null,enabled:e.enabled??1},[V,H]=(0,i.useState)(B),[U,ne]=(0,i.useState)(B);(B.title!==U.title||B.description!==U.description||B.icon!==U.icon||B.enabled!==U.enabled)&&(ne(B),H(B));async function W(t){if(H(e=>({...e,...t})),n||!w)return;let r=t.title??V.title;try{await w({...e,...t}),m.toast.success(F(`forms.common.updated`,{name:r,feature:g}))}catch(e){console.error(`Failed to update entity field`,e),H(e=>({...e,...N(t,B)})),m.toast.error(F(`forms.common.notUpdated`,{name:B.title||r,feature:g}))}}async function G(){if(T){try{await T()?(m.toast.success(F(`forms.common.deleted`,{name:V.title,feature:g})),I(d)):m.toast.error(F(`forms.common.notDeleted`,{name:V.title,feature:g}))}catch(e){console.error(`Failed to delete entity`,e),m.toast.error(F(`forms.common.notDeleted`,{name:V.title,feature:g}))}R(!1)}}let K=V.enabled===1,q=!b,J=!(x&&!n),Y=!V.title.trim(),re=!n&&!z.isDirty,ie=Y||re,X=[...E??[],...T&&!b?[{id:`entity.delete`,label:F(`forms.formActions.delete`),icon:s.IconTrash,tone:`destructive`,onSelect:()=>R(!0)}]:[]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O,{eyebrow:(0,a.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,a.jsx)(D,{to:d,children:u}),!b&&(0,a.jsx)(j,{titleMissing:Y,dirty:n||z.isDirty})]}),leading:(0,a.jsx)(k,{value:V.icon,onChange:e=>W({icon:e}),onClear:()=>W({icon:null}),defaultIcon:f,tone:p,title:V.title,description:V.description,readOnly:b||y}),title:(0,a.jsx)(A,{value:V.title,onSave:e=>W({title:e}),placeholder:c,className:`text-3xl font-semibold tracking-tight md:text-4xl`,ariaLabel:F(`forms.common.title`),autoFocus:n,commitOnChange:n,readOnly:b}),subtitle:(0,a.jsx)(A,{value:V.description,onSave:e=>W({description:e}),multiline:!0,placeholder:F(`forms.common.description`),className:`max-w-2xl text-sm text-muted-foreground`,ariaLabel:F(`forms.common.description`),commitOnChange:n,readOnly:b}),trailing:(0,a.jsxs)(a.Fragment,{children:[q&&(0,a.jsxs)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:[J&&(0,a.jsxs)(t.o,{type:`submit`,form:h,size:`sm`,loading:z.isSubmitting,"aria-disabled":ie?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),F(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>I(d),children:[(0,a.jsx)(s.IconX,{className:`size-4`}),F(`forms.formActions.cancel`)]})]}),S,_&&(b?(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?F(`common.active`,{defaultValue:`Active`}):F(`common.idle`,{defaultValue:`Idle`})]}):(0,a.jsxs)(`button`,{type:`button`,onClick:()=>W({enabled:+!K}),"aria-label":F(`forms.common.enabled`),title:F(K?`common.activeToggleHint`:`common.idleToggleHint`),className:`bento-tile-clickable flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider transition-colors duration-200 ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground hover:bg-muted/80`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?F(`common.active`,{defaultValue:`Active`}):F(`common.idle`,{defaultValue:`Idle`})]})),!n&&X.length>0&&(0,a.jsx)(v,{actions:X})]})}),(0,a.jsx)(`div`,{ref:te,"aria-hidden":!0,className:`h-px`}),C,!n&&T&&(0,a.jsx)(r.r,{feature:g,name:V.title,onDelete:G,open:L,setOpen:R,trigger:(0,a.jsx)(`span`,{className:`hidden`,"aria-hidden":!0})}),P({staged:V,onStateChange:ee})]})}function F(e,t,n=!0){let r=e.length,i=t.length;if(r*i>4e5)return null;let a=Array.from({length:r+1},()=>new Uint32Array(i+1));for(let n=r-1;n>=0;n--)for(let r=i-1;r>=0;r--)a[n][r]=e[n]===t[r]?a[n+1][r+1]+1:Math.max(a[n+1][r],a[n][r+1]);let o=[],s=(e,t)=>{let r=o[o.length-1];n&&r?.op===e?r.text+=t:o.push({op:e,text:t})},c=0,l=0;for(;c<r&&l<i;)e[c]===t[l]?(s(`same`,e[c]),c++,l++):a[c+1][l]>=a[c][l+1]?s(`remove`,e[c++]):s(`add`,t[l++]);for(;c<r;)s(`remove`,e[c++]);for(;l<i;)s(`add`,t[l++]);return o}var I=e=>e.split(/(\s+)/).filter(e=>e!==``);function L(e){if(typeof DOMParser>`u`)return e.split(/<\/(?:p|h[1-6]|li|blockquote|pre|div)>/i).map(e=>e.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim()).filter(Boolean);let t=new DOMParser().parseFromString(e,`text/html`),n=[...t.body.querySelectorAll(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)].filter(e=>!e.parentElement?.closest(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)).map(e=>(e.textContent??``).replace(/\s+/g,` `).trim()).filter(Boolean),r=(t.body.textContent??``).replace(/\s+/g,` `).trim();return n.length>0?n:r?[r]:[]}var R=e=>e==null?``:String(e);function z({before:t,after:n,fields:r,showUnchanged:c=!1}){let{t:l}=(0,o.useTranslation)(),[u,d]=(0,i.useState)(c),f=r.map(e=>{let r=t?.[e.id],i=n?.[e.id],a=e.kind??`text`,o=a===`rich`?L(R(r)).join(`
2
2
  `)===L(R(i)).join(`
3
3
  `):a===`value`?JSON.stringify(r??null)===JSON.stringify(i??null):R(r)===R(i),s=`changed`;return t===null||(r==null||r===``)&&!o?s=`added`:n===null||(i==null||i===``)&&!o?s=`removed`:o&&(s=`unchanged`),{field:e,a:r,b:i,kind:a,state:s}}),p=f.filter(e=>e.state!==`unchanged`),m=f.filter(e=>e.state===`unchanged`),h={added:l(`bento.diff.added`,{defaultValue:`Added`}),removed:l(`bento.diff.removed`,{defaultValue:`Removed`}),changed:l(`bento.diff.changed`,{defaultValue:`Changed`}),unchanged:l(`bento.diff.unchanged`,{defaultValue:`Unchanged`})};return(0,a.jsxs)(`div`,{"data-slot":`bento-diff`,className:`flex flex-col gap-3`,children:[(t===null||n===null)&&(0,a.jsx)(`p`,{className:`m-0 text-sm font-medium`,children:t===null?l(`bento.diff.created`,{defaultValue:`Created in this version`}):l(`bento.diff.deleted`,{defaultValue:`Deleted in this version`})}),p.length===0&&(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.noChanges`,{defaultValue:`No field changed`})}),(0,a.jsx)(`dl`,{className:`m-0 flex flex-col gap-3`,children:p.map(e=>(0,a.jsx)(ee,{label:e.field.label,status:h[e.state],state:e.state,children:(0,a.jsx)(te,{row:e})},e.field.id))}),m.length>0&&(0,a.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,a.jsxs)(`button`,{type:`button`,"aria-expanded":u?`true`:`false`,onClick:()=>d(!u),className:`inline-flex items-center gap-1 self-start rounded-md text-sm text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(s.IconChevronRight,{size:14,"aria-hidden":`true`,className:e.t(`transition-transform`,u&&`rotate-90`)}),l(`bento.diff.unchangedCount`,{defaultValue:`{{count}} unchanged`,count:m.length})]}),u&&(0,a.jsx)(`dl`,{className:`m-0 flex flex-col gap-3`,children:m.map(e=>(0,a.jsx)(ee,{label:e.field.label,status:h.unchanged,state:`unchanged`,children:(0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm text-muted-foreground`,children:e.kind===`rich`?L(R(e.b)).join(`
4
4