@lattice-php/lattice 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/registry.js.map +1 -1
- package/dist-standalone/chunks/runtime-5aZwKnpP.js +27 -0
- package/dist-standalone/lattice.js +1 -1
- package/dist-standalone/manifest.json +1 -1
- package/dist-standalone/runtime.js +1 -1
- package/package.json +6 -6
- package/dist-standalone/chunks/runtime-q348oO6b.js +0 -27
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./date-picker-field-CaRIypsW.js","./rolldown-runtime-hePW80VL.js","./react-CwJFpaho.js","./react-dom-Dl-LT-t1.js","./floating-ui.dom-CO6FyQ6K.js","./clsx-CjueKrWZ.js","./jsx-runtime-NZYk81nU.js","./time-picker-CAwU5Rl-.js","./locale-BZOrJtMq.js","./rich-editor-field-DnkT5hlA.js","./registry-context-BdTXNnGL.js","./debounce-CBXrtDuZ.js","./instance-D6cXaqIT.js","./timezone-Ckl1gbqB.js","./toolbar-button-BmtWFTk1.js","./w3c-keyname-BOAvb0qz.js","./with-selector-Cse0iXU1.js","./notifications-echo-BLO9_g1w.js","./dist-D2qBbka0.js","./code-block-view-CetAq3Rk.js","./chart-view-DghsYabe.js","./materialize-CWqnSEHR.js","./format-context-DCYPeoEM.js","./subscriptions-BICQU9ps.js","./translatable-YXSlt1CF.js","./page-props-DZ15iP5k.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{t as n}from"./react-CwJFpaho.js";import{n as r,t as i}from"./materialize-CWqnSEHR.js";import{a,c as o,d as s,i as c,l,n as u,o as d,r as f,s as p,t as m,u as h}from"./registry-context-BdTXNnGL.js";import{t as g}from"./react-dom-Dl-LT-t1.js";import{_,f as v,g as y,h as b,m as x,p as S,u as C}from"./floating-ui.dom-CO6FyQ6K.js";import{t as w}from"./jsx-runtime-NZYk81nU.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as ee}from"./time-picker-CAwU5Rl-.js";import{a as M,c as N,d as P,i as F,l as I,n as te,o as ne,r as re,s as ie,u as ae}from"./format-context-DCYPeoEM.js";import{a as L,n as oe,o as se,s as R}from"./locale-BZOrJtMq.js";import{a as ce,i as le,n as ue,s as de,t as fe}from"./translatable-YXSlt1CF.js";import{c as z,i as pe,n as me,s as he}from"./instance-D6cXaqIT.js";import{a as ge,i as _e,o as ve,r as ye}from"./timezone-Ckl1gbqB.js";import{r as be}from"./page-props-DZ15iP5k.js";import{$ as xe,A as Se,B as Ce,C as we,D as Te,E as Ee,G as De,H as Oe,I as ke,J as Ae,K as je,L as Me,M as Ne,N as Pe,O as Fe,P as Ie,Q as Le,R as Re,S as ze,T as Be,U as Ve,V as He,W as Ue,X as We,Y as Ge,Z as B,_ as Ke,at as qe,b as Je,c as Ye,ct as Xe,d as Ze,dt as Qe,et as $e,f as et,ft as tt,g as nt,h as rt,ht as V,it,j as at,k as ot,l as st,lt as H,m as ct,mt as lt,nt as ut,ot as dt,p as ft,pt,q as mt,rt as ht,s as gt,st as _t,tt as vt,u as yt,ut as bt,v as xt,w as St,x as Ct,y as wt,z as Tt}from"./toolbar-button-BmtWFTk1.js";var U=e(n(),1),Et=`modulepreload`,Dt=function(e,t){return new URL(e,t).href},Ot={},kt=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Dt(t,n),t=s(t),t in Ot)return;Ot[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Et,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function W(e){return{component:e,mode:`eager`}}function At(e){let t=e;return{component:(0,U.lazy)(t),load:t,mode:`lazy`}}var jt=e=>kt(()=>import(e),[],import.meta.url);function Mt(e){return e===void 0||i(e)&&Object.values(e).every(e=>i(e)&&(e.mode===`eager`&&typeof e.component==`function`||e.mode===`lazy`&&i(e.component)&&typeof e.load==`function`))}function Nt(e){return e===void 0||i(e)&&Object.values(e).every(e=>i(e))}function Pt(e,t){let n=i(e)?e.default:void 0;if(!i(n)||typeof n.name!=`string`||n.name.trim()===``||!Mt(n.components)||!Nt(n.extensions)||n.i18n!==void 0&&(!i(n.i18n)||typeof n.i18n.namespace!=`string`||n.i18n.namespace.trim()===``))throw TypeError(`[lattice] Plugin module [${t}] must default export a Plugin object.`);return n}function Ft(e,t=jt){return Promise.all(e.map(async e=>Pt(await t(e),e)))}function It(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n??{}))t[e]={...t[e],...r};return t}function Lt(...e){return e.reduce((e,t)=>({components:{...e.components,...t.components},extensions:It(e.extensions,t.extensions)}),{components:{},extensions:{}})}function Rt(e,...t){return Lt({name:`registry`,...e},...t)}var G=e(w(),1),zt=(0,U.createContext)([]);function Bt({children:e,renderer:t}){let n=(0,U.useContext)(zt),r=(0,U.useMemo)(()=>[t,...n],[n,t]);return(0,G.jsx)(zt.Provider,{value:r,children:e})}function K({className:e,icon:t}){let n=(0,U.useContext)(zt),{ids:r}=y();for(let r of n){let n=r({className:e,icon:t});if(n!=null&&n!==!1)return n}return r&&!r.includes(t)?(0,G.jsx)(Vt,{className:e}):(0,G.jsx)(x,{className:e,name:t})}function Vt({className:e}){return(0,G.jsxs)(`svg`,{"aria-hidden":`true`,className:_(`size-lt-icon-md text-lt-muted-fg`,e),"data-lattice-missing-icon":``,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:[(0,G.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,G.jsx)(`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}),(0,G.jsx)(`path`,{d:`M12 17h.01`})]})}var Ht=e(g(),1),Ut=(0,U.createContext)(null);function Wt(e){return e.type===`action`||e.type===`action.bulk`}function Gt({children:e,render:t}){return(0,G.jsx)(Ut.Provider,{value:t,children:e})}function Kt(){return(0,U.useContext)(Ut)}function qt({action:e,children:t}){let n=Kt();if(!n)throw Error(`Action triggers require an ActionTriggerProvider.`);return(0,G.jsx)(G.Fragment,{children:n({action:e,children:t})})}function Jt(e){let t=le(),n=e.action??null,r=e.effects??[];if(n){if(!Wt(n))throw Error(`Clickable action nodes must have type [action] or [action.bulk].`);return{kind:`action`,action:n}}return r.length>0?{kind:`effects`,onClick:()=>t(de(r))}:e.href!=null&&e.href!==``?{kind:`navigate`,href:e.href,method:e.method??`get`}:{kind:`none`}}var Yt=({node:e})=>{let{label:t,icon:n}=e.props,r=e.props.variant??null,i=e.props.emphasis??`solid`,a=N(e),o=Jt(e.props),s=n?`icon`:`md`,c=n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(K,{className:`size-lt-icon-md`,icon:n}),t?(0,G.jsx)(`span`,{className:`sr-only`,children:t}):null]}):t,l=({onClick:e,processing:t})=>(0,G.jsx)(E,{"data-test":a,disabled:t,emphasis:i,onClick:e,size:s,variant:r,children:c});return o.kind===`navigate`?(0,G.jsx)(E,{asChild:!0,"data-test":a,emphasis:i,variant:r,size:s,children:(0,G.jsx)(p,{href:o.href,method:o.method,children:c})}):o.kind===`action`?(0,G.jsx)(qt,{action:o.action,children:l}):o.kind===`effects`?l({onClick:o.onClick,processing:!1}):(0,G.jsx)(E,{"data-test":a,emphasis:i,size:s,type:e.props.buttonType,variant:r,children:c})};function Xt(e,t,n={}){let{enabled:r=!0}=n,i=(0,U.useRef)(t);i.current=t,(0,U.useEffect)(()=>{if(!r||typeof window>`u`)return;let t=e=>i.current(e);return window.addEventListener(e,t),()=>window.removeEventListener(e,t)},[e,r])}function Zt({preserveScroll:e=!0,preserveState:t=!0}){return Xt(R.localeChange,n=>{let r=n.detail?.locale;typeof r==`string`&&r!==``&&s.visit(window.location.href,{preserveScroll:e,preserveState:t})}),null}function Qt({namespace:e=`lattice`,label:t}={}){let{t:n,locale:r,locales:i,setLocale:a}=z(e),o=i.length>0?i:[r],s=t??(e=>n(`language.${e}`,e));return{locale:r,locales:o,options:o.map(e=>({value:e,label:s(e),active:e===r})),setLocale:a}}function $t({value:e,dateStyle:t=`medium`,timeStyle:n=`short`}){let{locale:r}=L(),{timezone:i}=ye();if(e==null||e===``)return null;let a={locale:r,timeZone:i},o=_e(e,{dateStyle:t,timeStyle:n},a),s=en(e),c=ge(e,a);return(0,G.jsx)(`time`,{dateTime:s??void 0,title:c||void 0,children:o})}function en(e){return ve(e)?.toISOString()??null}function tn({className:e,...t}){let{t:n}=z(me);return(0,G.jsx)(x,{name:`loader-2`,role:`status`,"aria-label":n(`common.loading`,`Loading`),"aria-hidden":!1,className:_(`animate-spin`,e),...t})}var nn=(0,U.createContext)(!1),rn=`flex h-lt-control-sm w-full items-center justify-start gap-2 rounded-lt-sm px-2.5 text-left text-sm font-normal text-lt-popover-fg no-underline decoration-transparent shadow-none transition-colors hover:bg-lt-accent/70 hover:text-lt-popover-fg focus-visible:bg-lt-accent/70 focus-visible:text-lt-popover-fg focus-visible:ring-0 focus-visible:outline-none disabled:pointer-events-none disabled:text-lt-disabled-fg [&_svg]:size-lt-icon-sm [&_svg]:text-lt-muted-fg`;function an({children:e}){return(0,G.jsx)(nn.Provider,{value:!0,children:e})}function on(){return(0,U.useContext)(nn)}var sn=Object.defineProperty,q=(e,t)=>sn(e,`name`,{value:t,configurable:!0}),cn=`Dialog`,[ln,un]=lt(cn),[dn,fn]=ln(cn),pn=q(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=U.useRef(null),c=U.useRef(null),[l,u]=Qe({prop:r,defaultProp:i??!1,onChange:a,caller:cn}),[d,f]=U.useState(0),[p,m]=U.useState(0);return(0,G.jsx)(dn,{scope:t,triggerRef:s,contentRef:c,contentId:tt(),titleId:tt(),descriptionId:tt(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:U.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),mn=`DialogPortal`,[hn,gn]=ln(mn,{forceMount:void 0}),_n=q(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=fn(mn,t);return(0,G.jsx)(hn,{scope:t,forceMount:n,children:U.Children.map(r,e=>(0,G.jsx)(vt,{present:n||a.open,children:(0,G.jsx)(ut,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),vn=`DialogOverlay`,yn=U.forwardRef(q(function(e,t){let n=gn(vn,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=fn(vn,e.__scopeDialog);return a.modal?(0,G.jsx)(vt,{present:r||a.open,children:(0,G.jsx)(xn,{...i,ref:t})}):null},`DialogOverlay`)),bn=v(`DialogOverlay.RemoveScroll`),xn=U.forwardRef(q(function(e,t){let{__scopeDialog:n,...r}=e,i=fn(vn,n),a=_t(),o=S(t,a);return(0,G.jsx)(xe,{as:bn,allowPinchZoom:!0,shards:[i.contentRef],children:(0,G.jsx)(H.div,{"data-state":Nn(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Sn=`DialogContent`,Cn=U.forwardRef(q(function(e,t){let n=gn(Sn,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=fn(Sn,e.__scopeDialog);return(0,G.jsx)(vt,{present:r||a.open,children:a.modal?(0,G.jsx)(wn,{...i,ref:t}):(0,G.jsx)(Tn,{...i,ref:t})})},`DialogContent`)),wn=U.forwardRef(q(function(e,t){let n=fn(Sn,e.__scopeDialog),r=U.useRef(null),i=S(t,n.contentRef,r);return U.useEffect(()=>{let e=r.current;if(e)return Le(e)},[]),(0,G.jsx)(En,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:V(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Tn=U.forwardRef(q(function(e,t){let n=fn(Sn,e.__scopeDialog),r=U.useRef(!1),i=U.useRef(!1);return(0,G.jsx)(En,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),En=U.forwardRef(q(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=fn(Sn,n);return $e(),(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(ht,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,G.jsx)(qe,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Nn(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Dn=`DialogTitle`,On=U.forwardRef(q(function(e,t){let{__scopeDialog:n,...r}=e,i=fn(Dn,n),{setTitleCount:a}=i;return pt(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,G.jsx)(H.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),kn=`DialogDescription`,An=U.forwardRef(q(function(e,t){let{__scopeDialog:n,...r}=e,i=fn(kn,n),{setDescriptionCount:a}=i;return pt(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,G.jsx)(H.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),jn=`DialogClose`,Mn=U.forwardRef(q(function(e,t){let{__scopeDialog:n,...r}=e,i=fn(jn,n);return(0,G.jsx)(H.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Nn(e){return e?`open`:`closed`}q(Nn,`getState`);var Pn=C(`fixed z-lt-modal w-full overflow-y-auto bg-lt-bg p-6 shadow-lt-lg`,{variants:{placement:{center:`left-1/2 top-1/2 max-h-[min(680px,calc(100vh-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-lt border border-lt-border data-[state=open]:animate-lt-dialog-in data-[state=closed]:animate-lt-dialog-out`,start:`inset-y-0 start-0 border-e border-lt-border data-[state=open]:animate-lt-sheet-in-start data-[state=closed]:animate-lt-sheet-out-start`,end:`inset-y-0 end-0 border-s border-lt-border data-[state=open]:animate-lt-sheet-in-end data-[state=closed]:animate-lt-sheet-out-end`},width:{sm:`max-w-sm`,md:`max-w-md`,lg:`max-w-lg`,xl:`max-w-xl`,"2xl":`max-w-2xl`,"3xl":`max-w-3xl`}},defaultVariants:{placement:`center`,width:`lg`}});function Fn(e){return(0,G.jsx)(pn,{"data-slot":`dialog`,...e})}function In(e){return(0,G.jsx)(Mn,{"data-slot":`dialog-close`,...e})}function Ln({className:e,...t}){return(0,G.jsx)(On,{className:_(`text-lg font-semibold leading-none tracking-tight`,e),"data-slot":`dialog-title`,...t})}function Rn({className:e,...t}){return(0,G.jsx)(An,{className:_(`text-sm text-lt-muted-fg`,e),"data-slot":`dialog-description`,...t})}function zn({children:e,className:t,placement:n=`center`,width:r=`lg`,...i}){return(0,G.jsxs)(_n,{children:[(0,G.jsx)(yn,{className:`fixed inset-0 z-lt-overlay bg-lt-overlay data-[state=open]:animate-lt-fade-in data-[state=closed]:animate-lt-fade-out`,"data-slot":`dialog-overlay`}),(0,G.jsx)(Cn,{className:_(Pn({placement:n,width:r}),t),"data-slot":`dialog-content`,...i,children:e})]})}function Bn({closeLabel:e,description:t,title:n}){return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Ln,{children:n}),t?(0,G.jsx)(Rn,{children:t}):null]}),(0,G.jsx)(In,{asChild:!0,children:(0,G.jsx)(E,{"aria-label":e,"data-test":`dialog-close`,size:`icon`,emphasis:`ghost`,children:(0,G.jsx)(x,{name:`x`,"aria-hidden":`true`,className:`size-lt-icon-md`})})})]})}function Vn({title:e,description:t,confirmLabel:n,cancelLabel:r=`Cancel`,confirmVariant:i=null,confirmEmphasis:a=null,processing:o=!1,confirmDisabled:s=!1,onConfirm:c,onCancel:l}){let u=e=>{o&&e.preventDefault()};return(0,G.jsx)(Fn,{open:!0,onOpenChange:e=>{e||l()},children:(0,G.jsxs)(zn,{...t?{}:{"aria-describedby":void 0},width:`md`,onEscapeKeyDown:u,onInteractOutside:u,children:[(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Ln,{children:e}),t&&(0,G.jsx)(Rn,{children:t})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,G.jsx)(E,{type:`button`,emphasis:`outline`,"data-test":`confirm-cancel`,disabled:o,onClick:l,children:r}),(0,G.jsxs)(E,{type:`button`,emphasis:a,variant:i,"data-test":`confirm-accept`,disabled:o||s,onClick:c,children:[o&&(0,G.jsx)(tn,{}),n]})]})]})})}var Hn=`X-Lattice-Ref`,Un=new Map;function Wn(e){return Un.get(e)??e}function Gn(e,t){Un.set(e,t)}function Kn(e){let t=Wn(e);return t?{[Hn]:t}:{}}var qn=()=>({});function Jn(e){qn=e}function Yn(e={}){return{...qn(),...e}}function Xn(e=``,t={}){return{...Yn(),...Kn(e),...t}}var Zn=class extends Error{response;constructor(e){super(`HTTP ${e.status}`),this.response=e}};function Qn(){let e=document.cookie.match(/XSRF-TOKEN=([^;]+)/);return e?decodeURIComponent(e[1]):``}var $n=1e4,er=new Map,tr=new Map;function nr(e){return e===void 0||e===`GET`||e===`HEAD`?{Accept:`application/json`}:{Accept:`application/json`,"Content-Type":`application/json`,"X-Requested-With":`XMLHttpRequest`,"X-XSRF-TOKEN":Qn()}}var rr=`/lattice/refs/refresh`;function ir(e){rr=e}var ar=new Map;async function or(e){let t=ar.get(e);if(t)return t;let n=sr(rr,{method:`POST`,body:JSON.stringify({ref:Wn(e)})}).then(t=>(Gn(e,t.ref),t.ref)).catch(()=>null).finally(()=>{ar.delete(e)});return ar.set(e,n),n}async function J(e,t={}){let{ref:n=``,headers:r,throwOnError:i=!0,method:a,...o}=t,s=a?.toUpperCase(),c=()=>fetch(e,{credentials:`same-origin`,...o,method:s,headers:Xn(n,{...nr(s),...r})}),l=await c();if(n!==``&&l.status===403&&await or(n)!==null&&(l=await c()),i&&!l.ok)throw new Zn(l);return l}async function sr(e,t){return(await J(e,t)).json()}function cr(e){return[e.source,e.audience,[...e.scopes].sort().join(` `)].join(``)}function lr(e){er.delete(cr(e))}async function ur(e){let t=cr(e),n=er.get(t);if(n&&n.expiresAt>Date.now()+$n)return n.token;let r=tr.get(t);if(r)return r;let i=sr(e.tokenEndpoint,{method:`POST`,ref:e.ref,body:JSON.stringify({nodeId:e.nodeId,nodeType:e.nodeType,audience:e.audience,scopes:e.scopes})}).then(e=>(er.set(t,{token:e,expiresAt:Date.now()+Math.max(0,e.expiresIn)*1e3}),e)).finally(()=>{tr.delete(t)});return tr.set(t,i),i}function dr(e){return e.status===401||e.status===403}async function fr(e,t,n){let{headers:r,...i}=t;return fetch(e,{...i,credentials:`omit`,headers:Yn({Accept:`application/json`,...r,Authorization:`${n.tokenType} ${n.accessToken}`})})}async function pr(e,t){let{remote:n,throwOnError:r=!0,...i}=t,a=await ur(n),o=await fr(e,i,a);if(dr(o)&&(lr(n),a=await ur(n),o=await fr(e,i,a)),r&&!o.ok)throw new Zn(o);return o}async function mr(e,t){return(await pr(e,t)).json()}async function hr(e,t){try{let n=await e(),r=await n.json().catch(()=>({}));return t(de(r.effects)),n.ok}catch(e){return ce(e),!1}}function gr({className:e,...t}){return(0,G.jsx)(`div`,{"aria-hidden":`true`,className:_(`animate-pulse rounded-lt-sm bg-lt-muted`,e),"data-slot":`skeleton`,...t})}function _r(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`):[]}function vr(e,t){return e.key??e.id??`${e.type}-${t}`}var yr=(0,U.createContext)(!1);function br(){return(0,U.useContext)(yr)}function xr(){return(0,G.jsxs)(`svg`,{"aria-hidden":`true`,className:`size-lt-icon-md shrink-0`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,children:[(0,G.jsx)(`rect`,{height:`18`,rx:`2`,strokeDasharray:`4 3`,width:`18`,x:`3`,y:`3`}),(0,G.jsx)(`path`,{d:`M12 8v4`}),(0,G.jsx)(`path`,{d:`M12 16h.01`})]})}function Sr({node:e}){e.type;let t=`Missing component: ${e.type}`;return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 align-middle text-lt-muted-fg`,"data-lattice-missing-component":e.type,title:t,children:[(0,G.jsx)(xr,{}),(0,G.jsx)(`span`,{className:`sr-only`,children:t})]})}function Y({nodes:e}){return e.map((e,t)=>(0,G.jsx)(Cr,{node:e},vr(e,t)))}function X({node:e}){return(0,G.jsx)(Cr,{node:e})}var Cr=(0,U.memo)(function({node:e}){let t=br(),n=f()[e.type];if(t&&e.props?.hideWhenCollapsed===!0)return null;if(!n)return(0,G.jsx)(Sr,{node:e});let r=n.component,i=e.schema?.length?(0,G.jsx)(Y,{nodes:e.schema}):null,a=(0,G.jsx)(r,{node:e,children:i});return n.mode===`lazy`?(0,G.jsx)(U.Suspense,{fallback:null,children:a}):a}),wr=(0,U.createContext)({});function Tr({nodes:e,children:t}){return(0,G.jsx)(wr.Provider,{value:e,children:t})}function Er(e){let t=(0,U.useContext)(wr),n=mt(e).name??``,r=at(),i=n&&r?r.errorKey(n):n;return i&&t[i]||n&&t[n]||e}var Dr=typeof window>`u`?U.useEffect:U.useLayoutEffect;function Or(e,t,n,r){return J(e,{method:`POST`,ref:t,signal:r,body:JSON.stringify(n),throwOnError:!1}).then(e=>e.ok?e.json():null)}function kr(e){let t=e.props.templates;return t?.length?t:void 0}function Ar(e,t){let n=kr(e);return n?n.find(e=>e.type===t.type)?.schema??[]:e.schema??[]}function jr(e,t){return e.startsWith(`@`)?e.slice(1):t===null?e:Oe(t,e)}function Mr(e,t,n,r=0,i={}){let a=mt(e);if(!a.editablePrefill||!a.name)return null;let o=Pe(i);return{path:t===null?a.name:Oe(t,a.name),overrideKey:n===null?a.name:Ne(n,o,r,a.name),resetOn:(a.prefillResetOn??[]).map(e=>jr(e,t)),refreshOn:(a.prefillRefreshOn??[]).map(e=>jr(e,t))}}function Nr(e,t){let n=[],r=(e,i=null,a=null,o=null,s=0,c={})=>{for(let l of e??[]){if(je.has(l.type)){let e=mt(l).name;if(e){let n=Oe(i,e),o=Oe(a,e),s=Ve(t,n);(Array.isArray(s)?s:[]).forEach((e,t)=>{r(Ar(l,e),Oe(n,t),Oe(o,Pe(e)??t),o,t,e)})}continue}let e=Mr(l,i,o,s,c);e&&n.push(e),r(l.schema,i,a,o,s,c)}};return r(e),n}function Pr(e,t){let n=new Map(e.targets.map(e=>[e.overrideKey,e]));return t.targets.filter(r=>{let i=n.get(r.overrideKey);return r.resetOn.some((n,r)=>{let a=i?.resetOn[r]??n;return!Object.is(Ve(e.values,a),Ve(t.values,n))})}).map(e=>e.overrideKey)}function Fr(e,t){return e.filter(e=>{let n=Ve(t,e.path);return n!=null&&n!==``}).map(e=>e.overrideKey)}function Ir(e,t){let n=new Set(t.map(e=>e.overrideKey));return new Set([...e].filter(e=>n.has(e)))}function Lr(e,t,n){let r=Te(),i=ot(),[a,o]=(0,U.useState)({}),s=(0,U.useMemo)(()=>Nr(n,r),[n,r]),c=(0,U.useRef)(new Set),l=(0,U.useRef)(new Set),u=(0,U.useRef)(r),d=(0,U.useRef)(s),f=(0,U.useRef)(s);f.current=s,Dr(()=>{let e=new Set(s.map(e=>e.overrideKey));l.current=new Set([...l.current].filter(t=>e.has(t)));let t=s.filter(e=>!l.current.has(e.overrideKey));for(let e of Fr(t,r))c.current.add(e);for(let e of t)l.current.add(e.overrideKey)},[s,r]);let p=(0,U.useCallback)(e=>{c.current.add(e)},[]),m=(0,U.useMemo)(()=>{let e=new Set,t=!1;return Ae(n,n=>{if(Array.isArray(n.dependsOnKeys))for(let t of n.dependsOnKeys)e.add(String(t));n.dependsOnAny&&(t=!0)}),{keys:[...e],any:t}},[n]),h=(0,U.useMemo)(()=>{let e=new Set(m.keys);for(let t of s){for(let n of t.resetOn)e.add(n);for(let n of t.refreshOn)e.add(n)}return[...e]},[m.keys,s]),g=m.any?r:JSON.stringify(h.map(e=>Ve(r,e)));return(0,U.useEffect)(()=>{if(h.length===0&&!m.any)return;let n=u.current;u.current=r;for(let e of Pr({targets:d.current,values:n},{targets:f.current,values:r}))c.current.delete(e);d.current=f.current,c.current=Ir(c.current,f.current);let a=new AbortController,s=window.setTimeout(()=>{Or(e,t,{_sub:`resolve`,...r},a.signal).then(e=>{if(!e)return;for(let[t,n]of Object.entries(e.values??{}))i(t,n);let t=new Map(f.current.map(e=>[e.path,e]));for(let[n,r]of Object.entries(e.prefill??{})){let e=t.get(n);e&&!c.current.has(e.overrideKey)&&i(n,r)}e.fields&&o(e.fields)}).catch(()=>{})},250);return()=>{window.clearTimeout(s),a.abort()}},[g,e,t,m.any,i]),{nodes:a,markUserEdit:p}}function Rr(e){let t={labels:{},values:{}};return Ae(e,e=>{e.name&&(e.label&&(t.labels[e.name]=e.label),e.value!==void 0&&(t.values[e.name]=e.value))}),t}function zr(e,t){return e===t||e.startsWith(`${t}.`)}function Br(e){let t={};for(let[n,r]of Object.entries(e??{}))t[n]=Array.isArray(r)?r[0]:r;return t}function Vr(e,t){let n=(0,U.useRef)(e);n.current=e;let r=(0,U.useRef)(null),i=(0,U.useCallback)(()=>{r.current!==null&&(clearTimeout(r.current),r.current=null)},[]);return(0,U.useEffect)(()=>i,[i]),(0,U.useMemo)(()=>{let e=(...e)=>{i(),r.current=setTimeout(()=>{r.current=null,n.current(...e)},t)};return e.cancel=i,e},[i,t])}function Hr(e,t,n){let[r,i]=(0,U.useState)(null);return(0,U.useEffect)(()=>{if(!n){i(null);return}let r=new AbortController;return J(e,{body:JSON.stringify({_sub:`schema`}),ref:t,method:`POST`,signal:r.signal,throwOnError:!1}).then(e=>e.ok?e.json():null).then(e=>i(e)).catch(()=>{}),()=>r.abort()},[n,e,t]),r}function Ur(){return(0,G.jsxs)(`div`,{className:`space-y-4`,"data-lattice-action-form-loading":!0,children:[(0,G.jsx)(gr,{className:`h-4 w-24`}),(0,G.jsx)(gr,{className:`h-10 w-full`}),(0,G.jsx)(gr,{className:`h-10 w-full`})]})}function Wr({cancelLabel:e,componentRef:t,endpoint:n,extraData:r,fieldLabels:i,formNode:a,method:o,onClose:s,onSuccess:c,precognitive:l,submitLabel:u}){let d=Te(),f=(0,U.useRef)(d);f.current=d;let p=(0,U.useRef)(r);p.current=r;let{nodes:m,markUserEdit:h}=Lr(n,t,a.schema),g=le(),[_,v]=(0,U.useState)({}),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)(!1),C=(0,U.useCallback)(e=>J(n,{body:JSON.stringify({...f.current,...p.current}),method:o,ref:t,headers:e,throwOnError:!1}),[t,n,o]),w=(0,U.useCallback)(e=>{v(t=>t[e]===void 0?t:{...t,[e]:void 0})},[]),T=Vr(e=>{C({Precognition:`true`,"Precognition-Validate-Only":e}).then(async t=>{if(t.status===422){let e=await t.json();v(t=>({...t,...Br(e.errors)}));return}w(e)}).catch(()=>{})},250),D=(0,U.useCallback)(e=>{l&&T(e)},[l,T]),O=(0,U.useCallback)(()=>{},[]),k=(0,U.useCallback)((e,t)=>{S(!0),C({Precognition:`true`,"Precognition-Validate-Only":e.join(`,`)}).then(async n=>{if(n.status===422){let e=await n.json();v(t=>({...t,...Br(e.errors)})),t?.onValidationError?.();return}if(!n.ok){t?.onValidationError?.();return}let r=e.filter(e=>!e.includes(`*`));v(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!r.some(t=>zr(e,t))))),t?.onSuccess?.()}).catch(()=>t?.onValidationError?.()).finally(()=>S(!1))},[C]),A=(0,U.useCallback)(()=>{b(!0),C().then(async e=>{let t=await e.json().catch(()=>({}));if(g(de(t.effects)),e.status===422&&t.errors){v(Br(t.errors));return}e.ok&&c(t)}).catch(e=>ce(e)).finally(()=>b(!1))},[g,c,C]),j=(0,U.useMemo)(()=>({action:n,clearErrors:w,componentRef:t,errors:_,fieldLabels:i,precognitive:l,processing:y,touch:O,validate:D,validateFields:k,validating:x}),[w,t,n,_,i,l,y,O,D,k,x]);return(0,G.jsx)(We,{value:j,children:(0,G.jsxs)(`form`,{className:`flex flex-col gap-6`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,G.jsx)(Ge,{value:{markUserEdit:h},children:(0,G.jsx)(Tr,{nodes:m,children:(0,G.jsx)(Y,{nodes:a.schema??[]})})}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,G.jsx)(E,{"data-test":`action-form-cancel`,disabled:y,onClick:s,type:`button`,emphasis:`ghost`,children:e}),a.props?.submitButton!==!1&&(0,G.jsxs)(E,{"data-test":`action-form-submit`,disabled:y,type:`submit`,children:[y&&(0,G.jsx)(tn,{}),u]})]})]})})}function Gr({formNode:e,...t}){let n=!!e.props?.precognitive,{labels:r,values:i}=(0,U.useMemo)(()=>{let{labels:t,values:n}=Rr(e.schema);return{labels:t,values:{...n,...e.props?.state}}},[e]);return(0,G.jsx)(Be,{initial:i,children:(0,G.jsx)(Wr,{fieldLabels:r,formNode:e,precognitive:n,...t})})}function Kr({description:e,formNode:t,onClose:n,placement:r,title:i,width:a,...o}){let{t:s}=z(`lattice`);return(0,G.jsx)(Fn,{open:!0,onOpenChange:e=>{e||n()},children:(0,G.jsxs)(zn,{...e?{}:{"aria-describedby":void 0},placement:r,width:a,children:[(0,G.jsx)(Bn,{closeLabel:s(`common.close`,`Close`),description:e,title:i}),(0,G.jsx)(`div`,{className:`mt-6`,children:t?(0,G.jsx)(Gr,{formNode:t,onClose:n,...o}):(0,G.jsx)(Ur,{})})]})})}function qr(e){return e.props.label??he(`lattice`,`common.action.run`,`Run action`)}function Jr(e){let t=e.props.endpoint??``,n=e.props.ref??``,r=e.props.method??`post`,i=qr(e),{variant:a,emphasis:o}=e.props,c=e.props.confirmation,l=e.props.form,u=e.props.lazyForm===!0,d=!!l||u,[f,p]=(0,U.useState)(!1),m=le(),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(!1),y=Hr(t,n,_&&u),b=u?y:l,x=async()=>{if(!t)return;if(r===`get`){s.visit(t,{headers:Xn(n)}),g(!1);return}p(!0);let e=await hr(()=>J(t,{method:r,ref:n,throwOnError:!1}),m);p(!1),e&&g(!1)},S=()=>{if(d){v(!0);return}if(c){g(!0);return}x()},C=c?.title??i,w=c?.confirmLabel??i,T=c?.cancelLabel??he(`lattice`,`common.cancel`,`Cancel`);return{processing:f,requestSubmit:S,overlays:(0,G.jsxs)(G.Fragment,{children:[h&&c&&(0,G.jsx)(Vn,{title:C,description:c.description??void 0,confirmLabel:w,cancelLabel:T,confirmVariant:a,confirmEmphasis:o,processing:f,confirmDisabled:!t,onConfirm:()=>void x(),onCancel:()=>g(!1)}),_&&d&&(0,G.jsx)(Kr,{cancelLabel:T,componentRef:n,description:c?.description??void 0,endpoint:t,formNode:b,method:r,onClose:()=>v(!1),onSuccess:()=>{v(!1)},placement:e.props.modalSide??`center`,submitLabel:w,title:C,width:e.props.modalWidth??void 0})]})}}var Yr={components:{action:W(({node:e})=>{let t=e.props.endpoint??``,n=e.props.icon,r=qr(e),i=on(),{variant:a,emphasis:o}=e.props,{processing:s,requestSubmit:c,overlays:l}=Jr(e),u=e.key??ae(`action`,e.id);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(E,{className:i?rn:void 0,"data-lattice-component":e.id,"data-test":u,disabled:s||!t,onClick:c,type:`button`,emphasis:i?`ghost`:o,variant:i?null:a,children:[s?(0,G.jsx)(tn,{className:i?`size-lt-icon-sm`:void 0}):n&&(0,G.jsx)(K,{className:i?`size-lt-icon-sm`:`size-lt-icon-md`,icon:n}),r]}),l]})}),"action.group":W(({children:e,node:t})=>{let{t:n}=z(`lattice`),r=t.props.label??n(`common.action-group.label`,`Actions`),i=t.props.orientation;return i?(0,G.jsx)(`div`,{"aria-label":r,className:_(`inline-flex max-w-full gap-1`,i===`vertical`?`flex-col items-stretch`:`flex-row flex-wrap items-center`),"data-lattice-component":t.id,role:`group`,children:e}):(0,G.jsx)(`div`,{className:`inline-flex`,"data-lattice-component":t.id,children:(0,G.jsxs)(ct,{children:[(0,G.jsx)(Ke,{asChild:!0,children:(0,G.jsx)(E,{"aria-label":r,className:`size-lt-control-sm text-lt-muted-fg shadow-none hover:text-lt-fg`,"data-test":N(t),size:`icon`,type:`button`,emphasis:`ghost`,children:(0,G.jsx)(x,{name:`more-horizontal`,"aria-hidden":`true`,className:`size-lt-icon-md`})})}),(0,G.jsx)(rt,{align:`end`,"aria-label":r,className:`min-w-44 gap-0.5 p-1.5`,sideOffset:8,children:(0,G.jsx)(an,{children:e})})]})})})},name:`lattice/action`};function Xr(e){try{return JSON.parse(e)}catch{return null}}function Zr(e){return async function*(t){let n=await e(t);if(!n.ok||!n.body)throw Error(`Chat stream failed (${n.status})`);yield*ei(n.body)}}var Qr=Zr(({url:e,body:t,signal:n})=>J(e,{method:`POST`,signal:n,headers:{Accept:`application/x-ndjson`},body:JSON.stringify(t),throwOnError:!1}));function $r(e){return Zr(({url:t,body:n,signal:r})=>pr(t,{remote:e,method:`POST`,signal:r,headers:{Accept:`application/x-ndjson`,"Content-Type":`application/json`},body:JSON.stringify(n),throwOnError:!1}))}async function*ei(e){let t=e.getReader(),n=new TextDecoder,r=``;try{for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
|
|
3
|
+
`);r=a.pop()??``;for(let e of a){if(e.trim()===``)continue;let t=Xr(e);t&&(yield t)}}if(r+=n.decode(),r.trim()!==``){let e=Xr(r);e&&(yield e)}}finally{await t.cancel().catch(()=>{})}}var ti=0;function ni(){return ti+=1,`chat-${ti}`}function ri(e){return e instanceof DOMException&&e.name===`AbortError`}function ii(e){return e instanceof Error?e.message:String(e)}function ai(e){let t=e.at(-1);return t!==void 0&&t.role===`assistant`}function oi(e,t){if(!ai(e))return e;let n=e.length-1,r=e[n];if(t.type===`text`){let i=[...r.parts],a=i.length-1,o=i[a];o!==void 0&&o.type===`chat.part.text`?i[a]={type:`chat.part.text`,props:{text:`${o.props.text}${t.value}`}}:i.push({type:`chat.part.text`,props:{text:t.value}});let s=[...e];return s[n]={...r,parts:i},s}if(t.type===`part`){let i=[...e];return i[n]={...r,parts:[...r.parts,t.part]},i}return e}function si({endpoint:e,transport:t=Qr,initialMessages:n=[],generateId:r=ni}){let[i,a]=(0,U.useState)(n),[o,s]=(0,U.useState)(`idle`),[c,l]=(0,U.useState)(null),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(i);f.current=i;let p=(0,U.useCallback)(e=>{f.current=e,a(e)},[]),m=(0,U.useCallback)(async(n,i)=>{u.current?.abort();let a=new AbortController;u.current=a,l(null),s(`submitted`);let o={id:r(),role:`user`,parts:[{type:`chat.part.text`,props:{text:i}}]},c={id:r(),role:`assistant`,parts:[]};p([...n,o,c]),s(`streaming`);try{for await(let n of t({url:e,body:{message:i},signal:a.signal})){if(n.type===`done`){s(`idle`);continue}if(n.type===`error`){l(n.message??`Chat failed`),s(`error`);continue}p(oi(f.current,n))}s(e=>e===`streaming`||e===`submitted`?`idle`:e)}catch(e){if(ri(e)){s(`idle`);return}l(ii(e)),s(`error`)}},[p,e,r,t]),h=(0,U.useCallback)(e=>{let t=e.trim();t!==``&&(d.current=t,m(f.current,t))},[m]),g=(0,U.useCallback)(()=>{u.current?.abort(),s(`idle`)},[]),_=(0,U.useCallback)(()=>{let e=d.current;if(e===null)return;let t=f.current,n=ai(t)?t.slice(0,-2):t;m(n,e)},[m]);return(0,U.useEffect)(()=>()=>{u.current?.abort()},[]),{messages:i,status:o,error:c,sendMessage:h,setMessages:p,stop:g,regenerate:_}}function ci({message:e}){let t=e.role===`user`;return(0,G.jsx)(`div`,{className:_(`flex flex-col gap-1`,t?`items-end`:`items-start`),"data-test":P(`chat-message-${e.role}`),children:(0,G.jsx)(`div`,{className:_(`max-w-[80%] rounded-lt px-3 py-2 text-sm`,t?`bg-lt-primary text-lt-primary-fg`:`bg-lt-muted text-lt-fg`),children:e.parts.map((e,t)=>(0,G.jsx)(X,{node:e},e.key??t))})})}function li({messages:e}){let t=(0,U.useRef)(null),n=e.at(-1),r=n?.parts.at(-1)===void 0?0:JSON.stringify(n.parts.at(-1)).length;return(0,U.useEffect)(()=>{t.current&&typeof t.current.scrollIntoView==`function`&&t.current.scrollIntoView({behavior:`smooth`})},[e.length,r]),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 overflow-y-auto p-3`,"data-test":P(`chat-messages`),children:[e.map(e=>(0,G.jsx)(ci,{message:e},e.id)),(0,G.jsx)(`div`,{ref:t})]})}function ui({onSubmit:e,disabled:t=!1,placeholder:n}){let{t:r}=z(`lattice`),[i,a]=(0,U.useState)(``);function o(){let n=i.trim();n===``||t||(e(n),a(``))}function s(e){e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),o())}return(0,G.jsxs)(`div`,{className:`flex items-end gap-2 border-t border-lt-border p-3`,children:[(0,G.jsx)(`textarea`,{"aria-label":r(`common.chat.input-label`,`Message input`),className:_(`min-h-[2.5rem] flex-1 resize-none rounded-lt-sm border border-lt-input bg-lt-bg px-3 py-2 text-sm text-lt-fg placeholder:text-lt-muted-fg focus:outline-none focus:ring-[length:var(--lt-ring-width)] focus:ring-lt-ring/50 disabled:bg-lt-disabled disabled:text-lt-disabled-fg`),"data-slot":`prompt-input`,"data-test":P(`chat-input`),disabled:t,onChange:e=>a(e.target.value),onKeyDown:s,placeholder:n,rows:1,value:i}),(0,G.jsx)(E,{"data-test":P(`chat-send`),disabled:t,onClick:o,size:`sm`,type:`button`,children:r(`common.chat.send`,`Send`)})]})}var di={name:`lattice/chat`,components:{"chat.box":W(({node:e})=>{let t=e.props,{t:n}=z(`lattice`),r=(0,U.useMemo)(()=>t.remote?$r(t.remote):Qr,[t.remote]),{messages:i,status:a,error:o,sendMessage:s,setMessages:c}=si({endpoint:t.streamEndpoint??``,transport:r}),l=(0,U.useRef)(!1),u=(0,U.useCallback)(async()=>{if(l.current||!t.historyEndpoint)return;if(l.current=!0,t.remote){let e=await mr(t.historyEndpoint,{remote:t.remote});c(e.messages);return}let e=await J(t.historyEndpoint,{throwOnError:!1});if(!e.ok)return;let n=await e.json();c(n.messages)},[t.historyEndpoint,t.remote,c]);(0,U.useEffect)(()=>{u().catch(()=>{})},[u]);let d=a===`submitted`||a===`streaming`||!t.streamEndpoint;return(0,G.jsxs)(`div`,{className:_(`flex flex-col overflow-hidden border border-lt-border bg-lt-bg`,t.fill?`sticky top-0 h-full min-h-[28rem] w-full`:`h-[28rem] w-80 rounded-lt shadow-lt-lg`),"data-test":P(`chat-box`),children:[(0,G.jsx)(`div`,{className:`flex items-center border-b border-lt-border px-3 py-2`,children:(0,G.jsx)(`span`,{className:`text-sm font-medium text-lt-fg`,children:t.title??n(`common.chat.title`,`Chat`)})}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,G.jsx)(li,{messages:i})}),o?(0,G.jsx)(`div`,{className:`border-t border-lt-danger/40 px-3 py-2 text-xs text-lt-danger`,children:o}):null,(0,G.jsx)(ui,{disabled:d,onSubmit:s,placeholder:t.placeholder??void 0})]})}),"chat.part.text":W(({node:e})=>(0,G.jsx)(`div`,{className:`whitespace-pre-wrap text-sm`,children:e.props.text})),"chat.part.tool-call":W(({node:e})=>(0,G.jsxs)(`div`,{className:`mt-1 inline-flex items-center gap-1 rounded-lt-sm bg-lt-muted px-2 py-0.5 font-mono text-xs text-lt-muted-fg`,"data-test":P(`chat-tool-call`),children:[`🔧 `,e.props.name,`(`,JSON.stringify(e.props.args),`)`]}))}};function fi({addLabel:e,options:t,onSelect:n}){return(0,G.jsxs)(ct,{children:[(0,G.jsx)(Ke,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-test":`builder-add`,className:`inline-flex items-center gap-1.5 self-start rounded-lt-sm border border-lt-border px-3 py-1.5 text-sm hover:bg-lt-accent [&_svg]:size-lt-icon-sm`,children:[(0,G.jsx)(x,{name:`plus`}),e]})}),(0,G.jsx)(rt,{align:`start`,className:`min-w-[12rem]`,children:t.map(e=>(0,G.jsx)(nt,{"data-test":`builder-add-${e.type}`,onClick:()=>n(e.type),children:e.label},e.type))})]})}var pi={duplicate:{key:`table.row-actions.duplicate`,fallback:`Duplicate`,icon:`copy`},remove:{key:`table.row-actions.remove`,fallback:`Remove`,icon:`trash-2`}};function mi(e,t){return(e??hi(t.removable)).map(e=>gi(e,t)).filter(e=>e!==null)}function hi(e){return e?[{type:`remove`,key:`remove`,label:null,icon:null,danger:!0}]:[]}function gi(e,t){if(e.type===`duplicate`){let n=pi.duplicate;return{key:e.key,label:e.label??t.t(n.key,n.fallback),icon:e.icon??n.icon,danger:e.danger,onClick:()=>t.onDuplicate(t.index)}}if(e.type===`remove`){if(!t.removable)return null;let n=pi.remove;return{key:e.key,label:e.label??t.t(n.key,n.fallback),icon:e.icon??n.icon,danger:e.danger,onClick:()=>t.onRemove(t.index)}}return null}function _i(e){return e?`text-lt-danger hover:text-lt-danger [&_svg]:size-lt-icon-sm`:`text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-sm`}function vi({actions:e}){let{t}=z(`lattice`);if(e.length===0)return null;if(e.length===1){let t=e[0];return(0,G.jsx)(`button`,{type:`button`,"aria-label":t.label,"data-test":`row-action-${t.key}`,className:_i(t.danger),onClick:t.onClick,children:(0,G.jsx)(x,{name:t.icon})})}return(0,G.jsxs)(ct,{children:[(0,G.jsx)(Ke,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":t(`common.action-group.label`,`Actions`),"data-test":`row-actions-menu`,className:`text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-sm`,children:(0,G.jsx)(x,{name:`more-horizontal`})})}),(0,G.jsx)(rt,{align:`end`,className:`min-w-[10rem]`,children:e.map(e=>(0,G.jsx)(nt,{"data-test":`row-action-${e.key}`,danger:e.danger,icon:e.icon,onClick:e.onClick,children:e.label},e.key))})]})}function yi({path:e,rows:t,rowKey:n}){return(0,G.jsx)(G.Fragment,{children:t.map((t,r)=>(0,G.jsx)(`input`,{type:`hidden`,name:De(Oe(e,r,n)),value:String(t[n]??``)},String(t.rowId??r)))})}function bi({label:e,testId:t,onClick:n,children:r}){return(0,G.jsx)(`button`,{type:`button`,"aria-label":e,"data-test":t,className:`text-lt-muted-fg hover:text-lt-fg`,onClick:n,children:r})}var xi=(0,U.memo)(function({base:e,index:t,row:n,template:r,heading:i,reorderable:a,isFirst:o,isLast:s,removable:c,rowActions:l,onField:u,onRemove:d,onMove:f,onDuplicate:p}){let{t:m}=z(`lattice`);return(0,G.jsxs)(`div`,{"data-test":`repeater-${e}-row-${t}`,className:`rounded-lt border border-lt-border bg-lt-surface p-4`,children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium text-lt-muted-fg`,children:i}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1 [&_svg]:size-lt-icon-sm`,children:[a&&!o&&(0,G.jsx)(bi,{label:`Move up`,testId:`repeater-${e}-up-${t}`,onClick:()=>f(t,-1),children:(0,G.jsx)(x,{name:`arrow-up`})}),a&&!s&&(0,G.jsx)(bi,{label:`Move down`,testId:`repeater-${e}-down-${t}`,onClick:()=>f(t,1),children:(0,G.jsx)(x,{name:`arrow-down`})}),(0,G.jsx)(vi,{actions:mi(l,{index:t,removable:c,onRemove:d,onDuplicate:p,t:m})})]})]}),(0,G.jsx)(Se,{base:e,index:t,row:n,onChange:(e,n)=>u(t,e,n),children:(0,G.jsx)(`div`,{className:`flex flex-col gap-4`,children:r.map((e,t)=>(0,G.jsx)(X,{node:e},vr(e,t)))})})]})}),Si={xs:{track:`minmax(4rem, 0.35fr)`,minPx:64,defaultPx:96},sm:{track:`minmax(6rem, 0.5fr)`,minPx:96,defaultPx:128},md:{track:`minmax(8rem, 1fr)`,minPx:128,defaultPx:176},lg:{track:`minmax(12rem, 1.5fr)`,minPx:192,defaultPx:240},xl:{track:`minmax(16rem, 2fr)`,minPx:256,defaultPx:320}},Ci=1024;function wi(e){return Si[e].track}function Ti(e){return Si[e.width].minPx}function Ei(e){return Si[e.width].defaultPx}function Di({columns:e,leadingTracks:t=[],trailingTracks:n=[],overrides:r={}}){return[...t,...e.map(e=>{let t=r[e.key];return t===void 0?wi(e.width):`${Math.min(Ci,Math.max(Ti(e),t))}px`}),...n].join(` `)}function Oi(e,t,n={}){let{enabled:r=!0,parse:i,serialize:a}=n,o=()=>typeof t==`function`?t():t,[s,c]=(0,U.useState)(()=>{if(!r||typeof window>`u`)return o();let t;try{t=window.localStorage.getItem(e)}catch{return o()}if(t===null)return o();try{return i?i(t):JSON.parse(t)}catch{try{window.localStorage.removeItem(e)}catch{return o()}return o()}}),l=(0,U.useRef)(s);l.current=s;let u=(0,U.useRef)({enabled:r,key:e,serialize:a});return u.current={enabled:r,key:e,serialize:a},[s,(0,U.useCallback)(e=>{let t=typeof e==`function`?e(l.current):e;l.current=t,c(t);let{enabled:n,key:r,serialize:i}=u.current;if(!(!n||typeof window>`u`))try{let e=i?i(t):JSON.stringify(t);e===null?window.localStorage.removeItem(r):window.localStorage.setItem(r,e)}catch{return}},[])]}var ki=[];function Ai({columnGapPx:e=0,columns:t,enabled:n,leadingTracks:r=ki,showIndicator:i=!1,storageKey:a,trailingTracks:o=ki}){let s=(0,U.useMemo)(()=>t.map(e=>e.key),[t]),[c,l]=Oi(a??``,{},{enabled:!!a,parse:e=>Mi(e,t),serialize:e=>Ni(e,s)}),u=(0,U.useRef)(c),d=(0,U.useRef)(null),f=(0,U.useRef)(null),p=(0,U.useCallback)(e=>Di({columns:t,leadingTracks:r,trailingTracks:o,overrides:n?e:{}}),[t,n,r,o]),m=(0,U.useMemo)(()=>p(c),[c,p]),h=(0,U.useCallback)(e=>{let t=f.current;t&&(t.style.gridTemplateColumns=e,t.style.setProperty(`--lattice-table-columns`,e))},[]),g=(0,U.useCallback)(e=>{u.current=e,l(e),h(p(e))},[h,l,p]),_=(0,U.useCallback)((e,t,n,r)=>({...e,[t.key]:Math.min(r??1024,Math.max(Ti(t),n))}),[]),v=(0,U.useCallback)((e,t,n)=>{g(_(u.current,e,t,n))},[g,_]),y=(0,U.useCallback)(e=>{let t={...u.current};delete t[e.key],g(t)},[g]),b=(0,U.useCallback)(()=>{g({})},[g]),x=n&&Object.values(c).some(e=>typeof e==`number`),S=(0,U.useCallback)(e=>u.current[e.key]??Ei(e),[]);return{getResizeHandleProps:(0,U.useCallback)(a=>{let s=Ci,c=Ti(a),l=S(a),m=a.label??a.key,b=i?`after:bg-lt-border`:`after:bg-transparent`,x=n=>ji({column:a,columnGapPx:e,columns:t,grid:f.current??n.parentElement?.parentElement,leadingTracks:r,trailingTracks:o}),C=(e,t)=>v(a,l+t,x(e)),w=(e,t)=>{let n=d.current;n?.key===a.key&&(d.current=null,n.overrides!==null&&g(n.overrides),t&&e.currentTarget.releasePointerCapture?.(e.pointerId))};return{"aria-label":`Resize ${m}`,"aria-orientation":`vertical`,"aria-valuemax":s,"aria-valuemin":c,"aria-valuenow":l,className:`absolute inset-y-0 right-0 hidden w-2 cursor-col-resize touch-none items-stretch justify-center md:flex after:my-1 after:w-px ${b} hover:after:bg-lt-border focus-visible:outline-none focus-visible:after:bg-lt-ring`,onDoubleClick:()=>y(a),onKeyDown:e=>{if(!n)return;let t=e.shiftKey?32:8;if(e.key===`ArrowLeft`&&(e.preventDefault(),C(e.currentTarget,-t)),e.key===`ArrowRight`&&(e.preventDefault(),C(e.currentTarget,t)),e.key===`Home`&&(e.preventDefault(),v(a,c)),e.key===`End`){e.preventDefault();let t=x(e.currentTarget);v(a,t,t)}(e.key===`Enter`||e.key===`Escape`)&&(e.preventDefault(),y(a))},onPointerDown:e=>{if(!n)return;let t=e.currentTarget.parentElement?.getBoundingClientRect().width??0;d.current={key:a.key,maxWidth:x(e.currentTarget),overrides:null,startWidth:t>0?t:l,startX:e.clientX},e.currentTarget.setPointerCapture?.(e.pointerId),e.preventDefault()},onPointerMove:e=>{let t=d.current;if(!n||t?.key!==a.key)return;let r=_(u.current,a,t.startWidth+e.clientX-t.startX,t.maxWidth);t.overrides=r,u.current=r,h(p(r))},onPointerUp:e=>{w(e,!0)},onPointerCancel:e=>{w(e,!0)},onLostPointerCapture:e=>{w(e,!1)},role:`separator`,tabIndex:0}},[e,t,S,n,r,h,g,_,y,v,i,p,o]),gridTemplateColumns:m,hasOverrides:x,resizeRootRef:f,resetColumns:b,resetColumnWidth:y}}function ji({column:e,columnGapPx:t,columns:n,grid:r,leadingTracks:i,trailingTracks:a}){let o=r?.getBoundingClientRect().width??0;if(o<=0)return Ci;let s=[...i,...a].reduce((e,t)=>e+Fi(t),0),c=n.reduce((t,n)=>n.key===e.key?t:t+Ti(n),0),l=n.length+i.length+a.length,u=Math.max(0,l-1)*t,d=o-s-c-u;return Math.min(Ci,Math.max(Ti(e),d))}function Mi(e,t){let n=JSON.parse(e)?.overrides;if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`unexpected stored column widths shape`);let r=Pi(n,t);if(Object.keys(r).length===0)throw Error(`stored column widths hold no usable overrides`);return r}function Ni(e,t){let n={},r=new Set(t);for(let[t,i]of Object.entries(e))r.has(t)&&typeof i==`number`&&Number.isFinite(i)&&(n[t]=i);return Object.keys(n).length===0?null:JSON.stringify({overrides:n})}function Pi(e,t){let n={};for(let r of t){let t=e[r.key];typeof t!=`number`||!Number.isFinite(t)||(n[r.key]=Math.min(Ci,Math.max(Ti(r),t)))}return n}function Fi(e){let t=e.trim(),n=t.match(/^([0-9.]+)px$/);if(n)return Number.parseFloat(n[1]);let r=t.match(/^([0-9.]+)rem$/);return r?Number.parseFloat(r[1])*Ii():0}function Ii(){if(typeof window>`u`)return 16;let e=Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize);return Number.isFinite(e)&&e>0?e:16}function Li(e,t){return typeof window>`u`||typeof window.matchMedia!=`function`?t:window.matchMedia(e).matches}function Ri(e,t=!1){let[n,r]=(0,U.useState)(()=>Li(e,t));return(0,U.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),n=()=>r(t.matches);return n(),t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e]),n}var zi=`3rem`,Bi=`3rem`,Vi=[zi],Hi=[Bi],Ui=`(min-width: 768px)`;function Wi(){return Ri(Ui,!0)}function Gi(e){return e.map(e=>{let t=e.props;return{name:String(t.name),label:String(t.label??t.name),columnWidth:t.columnWidth??`md`}})}var Ki=(0,U.memo)(function({base:e,index:t,row:n,template:r,span:i,isFirst:a,isLast:o,columnCount:s,flipKey:c,reorderable:l,removable:u,rowActions:d,onField:f,onMove:p,onRemove:m,onDuplicate:h,registerRow:g}){let{t:_}=z(`lattice`);return(0,G.jsxs)(`div`,{ref:e=>g?.(c,e),"data-flip-key":c,"data-test":`table-row-${e}-${t}`,className:`grid grid-cols-[var(--lattice-table-columns)] items-start gap-x-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 [&_svg]:size-lt-icon-sm`,children:[l&&!a&&(0,G.jsx)(bi,{label:`Move up`,testId:`table-${e}-up-${t}`,onClick:()=>p(t,-1),children:(0,G.jsx)(x,{name:`arrow-up`})}),l&&!o&&(0,G.jsx)(bi,{label:`Move down`,testId:`table-${e}-down-${t}`,onClick:()=>p(t,1),children:(0,G.jsx)(x,{name:`arrow-down`})})]}),(0,G.jsx)(Se,{base:e,index:t,row:n,onChange:(e,n)=>f(t,e,n),children:(0,G.jsx)(ze,{children:i?(0,G.jsx)(`div`,{"data-test":`table-row-${e}-${t}-span`,className:`flex flex-col gap-2`,style:{gridColumn:`span ${s}`},children:r.map((e,t)=>(0,G.jsx)(X,{node:e},vr(e,t)))}):r.map((e,t)=>(0,G.jsx)(`div`,{children:(0,G.jsx)(X,{node:e})},vr(e,t)))})}),(0,G.jsx)(`div`,{className:`flex items-center`,children:(0,G.jsx)(vi,{actions:mi(d,{index:t,removable:u,onRemove:m,onDuplicate:h,t:_})})})]})});function qi({base:e,columns:t,rows:n,reorderable:r,removable:i,rowActions:a,onField:o,onMove:s,onRemove:c,onDuplicate:l,registerRow:u,resizableColumns:d=!1,resizeIndicator:f=!1}){let{t:p}=z(`lattice`),m=Wi(),h=(0,U.useMemo)(()=>t.map(e=>({key:e.name,label:e.label,width:e.columnWidth})),[t]),{getResizeHandleProps:g,gridTemplateColumns:_,hasOverrides:v,resizeRootRef:y,resetColumns:b}=Ai({columns:h,enabled:d,columnGapPx:12,leadingTracks:Vi,showIndicator:f,storageKey:d?`lattice:table-columns:form:${e}`:void 0,trailingTracks:Hi});return m?(0,G.jsxs)(`div`,{className:`relative`,children:[v&&(0,G.jsx)(`button`,{"aria-label":p(`table.reset-column-widths`,`Reset column widths`),className:`absolute right-1 top-1 z-10 hidden rounded-lt-sm p-1 text-lt-muted-fg hover:text-lt-fg md:inline-flex`,"data-test":`table-reset-columns`,onClick:b,title:p(`table.reset-column-widths`,`Reset column widths`),type:`button`,children:(0,G.jsx)(x,{name:`rotate-ccw`,className:`size-lt-icon-sm`})}),(0,G.jsx)(`div`,{className:`overflow-x-auto`,children:(0,G.jsxs)(`div`,{ref:y,className:`flex min-w-max flex-col gap-2`,style:{"--lattice-table-columns":_},children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-[var(--lattice-table-columns)] items-center gap-x-3`,children:[(0,G.jsx)(`div`,{}),t.map((e,t)=>(0,G.jsxs)(`div`,{className:`relative min-w-0 pr-3 text-xs font-medium text-lt-muted-fg`,children:[e.label,d&&(0,G.jsx)(`div`,{...g(h[t])})]},e.name)),(0,G.jsx)(`div`,{})]}),n.map(d=>(0,G.jsx)(Ki,{base:e,index:d.index,row:d.row,template:d.template,span:d.span,isFirst:d.index===0,isLast:d.index===n.length-1,columnCount:t.length,flipKey:d.key,reorderable:r,removable:i(d.index),rowActions:a,onField:o,onMove:s,onRemove:c,onDuplicate:l,registerRow:u},d.key))]})})]}):(0,G.jsx)(`div`,{className:`flex flex-col gap-3`,children:n.map(t=>(0,G.jsx)(`div`,{ref:e=>u?.(t.key,e),"data-flip-key":t.key,children:(0,G.jsx)(xi,{base:e,index:t.index,row:t.row,template:t.template,heading:t.heading??`#${t.index+1}`,reorderable:r,isFirst:t.index===0,isLast:t.index===n.length-1,removable:i(t.index),rowActions:a,onField:o,onRemove:c,onMove:s,onDuplicate:l})},t.key))})}var Ji=180;function Yi(){return typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion: reduce)`).matches}function Xi(e){let t=(0,U.useRef)(new Map),n=(0,U.useRef)(new Map),r=(0,U.useCallback)((e,n)=>{n?t.current.set(e,n):t.current.delete(e)},[]);return Dr(()=>{let e=[],r=new Map;return t.current.forEach((e,t)=>{e.style.transition=``,e.style.transform=``,r.set(t,e.getBoundingClientRect())}),Yi()||t.current.forEach((t,i)=>{let a=n.current.get(i),o=r.get(i);if(a&&o){let n=a.top-o.top;n&&(t.style.transform=`translateY(${n}px)`,e.push(requestAnimationFrame(()=>{t.style.transition=`transform ${Ji}ms ease-out`,t.style.transform=``})))}}),n.current=r,()=>{for(let t of e)cancelAnimationFrame(t)}},[e]),r}function Zi(e,t){let n=at(),r=n?n.errorKey(e):e,i=ot(),a=Ee(r),o=Array.isArray(a)?a:Ce(a,t),s=Me(o);Dr(()=>{s!==o&&i(r,s)},[o,s,i,r]);let c=(0,U.useCallback)(e=>{i(r,n=>e(Array.isArray(n)?n:Ce(n,t)))},[i,r,t]);return{path:r,rows:s,onField:(0,U.useCallback)((e,t,n)=>c(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r)),[c]),onRemove:(0,U.useCallback)(e=>c(t=>Tt(t,e)),[c]),onMove:(0,U.useCallback)((e,t)=>c(n=>Re(n,e,e+t)),[c]),onDuplicate:(0,U.useCallback)(e=>c(t=>ke(t,e)),[c]),append:(0,U.useCallback)(e=>c(t=>[...t,He(e)]),[c])}}var Qi=[],$i=({node:e})=>{let t=e.props,n=t.name,r=t.templates,{errors:i}=B(),{hidden:a,required:o}=Ye(e),{path:s,rows:c,onField:l,onRemove:u,onMove:d,onDuplicate:f,append:p}=Zi(n,t.defaultItems??0),{t:m}=z(`lattice`),h=Xi(c.map(e=>String(e.rowId??``)).join(`,`)),g=t.maxItems!=null&&c.length>=t.maxItems,_=t.minItems!=null&&c.length<=t.minItems,v=t.layout===`table`,y=e=>r.find(t=>t.type===e),b=r.map(e=>({type:e.type,label:e.label}));if(a)return null;let x=r[0],S=c.map((e,t)=>{let n=y(e.type),r=!!n&&!!x&&n.type===x.type;return{key:String(e.rowId??t),index:t,row:e,template:n?.schema??Qi,span:!r,heading:n?.label??`Unknown block: ${String(e.type)}`}});return(0,G.jsx)(yt,{error:i[s],helperText:t.helperText??void 0,tooltip:t.tooltip??void 0,label:t.label??``,id:s,required:o,children:e=>(0,G.jsxs)(`div`,{...e,className:`flex flex-col gap-3`,role:`group`,children:[(0,G.jsx)(yi,{path:s,rows:c,rowKey:Ie}),(0,G.jsx)(yi,{path:s,rows:c,rowKey:`type`}),v?(0,G.jsx)(G.Fragment,{children:(0,G.jsx)(qi,{base:s,columns:Gi(x?.schema??[]),rows:S,reorderable:t.reorderable??!1,removable:()=>!_,rowActions:t.rowActions,onField:l,onMove:d,onRemove:u,onDuplicate:f,registerRow:h,resizableColumns:t.resizableColumns===!0,resizeIndicator:t.resizeIndicator===!0})}):c.map((e,r)=>{let i=y(e.type),a=String(e.rowId??r);return(0,G.jsx)(`div`,{ref:e=>h(a,e),"data-flip-key":a,children:i?(0,G.jsx)(xi,{base:s,index:r,row:e,template:i.schema??Qi,heading:i.label,reorderable:t.reorderable??!1,isFirst:r===0,isLast:r===c.length-1,removable:!_,rowActions:t.rowActions,onField:l,onRemove:u,onMove:d,onDuplicate:f}):(0,G.jsxs)(`div`,{"data-test":`repeater-${n}-row-${r}`,className:`flex items-center justify-between rounded-lt border border-dashed border-lt-border p-4 text-sm text-lt-muted-fg`,children:[(0,G.jsxs)(`span`,{children:[`Unknown block: `,String(e.type)]}),(0,G.jsx)(vi,{actions:mi(t.rowActions,{index:r,removable:!_,onRemove:u,onDuplicate:f,t:m})})]})},a)}),!g&&(0,G.jsx)(fi,{addLabel:t.addLabel??`Add`,options:b,onSelect:e=>p({type:e})})]})})},ea=Object.defineProperty,ta=(e,t)=>ea(e,`name`,{value:t,configurable:!0}),na=`Checkbox`,[ra,ia]=lt(na),[aa,oa]=ra(na);function sa(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Qe({prop:n,defaultProp:i??!1,onChange:c,caller:na}),[m,h]=U.useState(null),[g,_]=U.useState(null),v=U.useRef(!1),[y,b]=U.useReducer(e=>e+1,0),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:!ga(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,G.jsx)(aa,{scope:t,...S,children:ha(d)?d(S):r})}ta(sa,`CheckboxProvider`);var ca=`CheckboxTrigger`,la=U.forwardRef(ta(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=oa(ca,e),g=S(i,u),_=U.useRef(c);return U.useEffect(()=>{let e=a?.form;if(e){let t=ta(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,G.jsx)(H.button,{type:`button`,role:`checkbox`,"aria-checked":ga(c)?`mixed`:c,"aria-required":l,"data-state":_a(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:V(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:V(n,e=>{p(),d(e=>ga(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),ua=U.forwardRef(ta(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,G.jsx)(sa,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(la,{...d,ref:t,__scopeCheckbox:n}),e&&(0,G.jsx)(ma,{__scopeCheckbox:n})]})})},`Checkbox`)),da=`CheckboxIndicator`,fa=U.forwardRef(ta(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=oa(da,n);return(0,G.jsx)(vt,{present:r||ga(a.checked)||a.checked===!0,children:(0,G.jsx)(H.span,{"data-state":_a(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),pa=`CheckboxBubbleInput`,ma=U.forwardRef(ta(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=oa(pa,e),g=S(r,h),_=Ct(i),v=U.useRef(!1),y=U.useRef(s),b=U.useRef(o);U.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=ga(s),n.call(e,!ga(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=U.useRef(!ga(s)&&s);return(0,G.jsx)(H.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:V(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function ha(e){return typeof e==`function`}ta(ha,`isFunction`);function ga(e){return e===`indeterminate`}ta(ga,`isIndeterminate`);function _a(e){return ga(e)?`indeterminate`:e?`checked`:`unchecked`}ta(_a,`getState`);function va({className:e,...t}){return(0,G.jsx)(ua,{"data-slot":`checkbox`,className:_(`peer border-lt-input data-[state=checked]:bg-lt-primary data-[state=checked]:text-lt-primary-fg data-[state=checked]:border-lt-primary focus-visible:border-lt-ring focus-visible:ring-lt-ring/50 aria-invalid:ring-lt-danger/20 dark:aria-invalid:ring-lt-danger/40 aria-invalid:border-lt-danger size-4 shrink-0 rounded-lt-xs border shadow-lt-xs transition-shadow outline-none focus-visible:ring-[length:var(--lt-ring-width)] disabled:cursor-not-allowed disabled:bg-lt-disabled disabled:text-lt-disabled-fg disabled:data-[state=checked]:bg-lt-disabled disabled:data-[state=checked]:text-lt-disabled-fg disabled:data-[state=checked]:border-lt-disabled`,e),...t,children:(0,G.jsx)(fa,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current transition-none`,children:(0,G.jsx)(x,{name:`check`,className:`size-lt-icon-sm`})})})}function ya(e,t){if(!t)return e;let n=e.replace(/[^A-Za-z0-9_-]+/g,`-`).replace(/^-+|-+$/g,``);return n?`${t}-${n}`:t}function ba(e,t){let n=at(),r=Ee(e),i=n?n.getValue(e):r,a=ot();(0,U.useEffect)(()=>{i===void 0&&t!==void 0&&(n?n.setValue(e,t):a(e,t))},[e,t,i,a,n])}var xa=({node:e})=>{let{hidden:t,readOnly:n,disabled:r}=Ye(e),i=e.props.name,a=at(),{fieldIdPrefix:o}=B(),s=ya(a?a.scopedName(i):i,o),c=Ee(i),l=a?a.getValue(i):c,{commit:u}=St(),d=st(e.props.value),f=l===void 0?d:st(l);return ba(i,d),t?null:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,G.jsx)(va,{autoFocus:e.props.autoFocus??void 0,checked:f,"data-test":P(i),disabled:n||r,id:s,name:s,onCheckedChange:e=>{u(i,e===!0)},tabIndex:e.props.tabIndex??void 0}),(0,G.jsx)(Ze,{htmlFor:s,children:e.props.label})]}),e.props.helperText&&(0,G.jsx)(`p`,{className:`mt-1 pl-7 text-sm text-lt-muted-fg`,children:e.props.helperText})]})};function Sa(e){return _(`whitespace-nowrap rounded-lt-sm px-3 py-1.5 text-sm font-medium transition-colors`,e?`bg-lt-bg text-lt-fg shadow-lt-xs`:`text-lt-muted-fg hover:bg-lt-bg/60 hover:text-lt-fg`)}function Ca({ariaLabel:e,autoFocus:t=!1,className:n,disabled:r=!1,name:i,onSelect:a,options:o,tabIndex:s,value:c,...l}){let u=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(!t)return;let e=u.current;(e?.querySelector(`button[aria-checked="true"]`)??e?.querySelector(`button`))?.focus()},[t]),(0,G.jsx)(`div`,{...l,"aria-label":e,className:_(`inline-flex w-fit max-w-full gap-1 overflow-x-auto rounded-lt bg-lt-muted p-1`,n),ref:u,role:`radiogroup`,children:o.map(e=>{let t=c===e.value;return(0,G.jsx)(`button`,{"aria-checked":t,"data-test":`${i}-${e.value}`,className:_(Sa(t),r&&`cursor-not-allowed opacity-60`),disabled:r,onClick:()=>a(e.value),role:`radio`,tabIndex:s,type:`button`,children:e.label},e.value)})})}function wa(e){let{errors:t,fieldIdPrefix:n}=B(),r=at(),i=Ye(e),a=mt(e),o=a.name??``,s=Ee(o),c=r?r.getValue(o):s,l=c===void 0?a.value:c,u=typeof l==`string`||typeof l==`number`?String(l):``,d=ya(r?r.scopedName(o):o,n),f=r?r.errorKey(o):o,{commit:p,change:m,blur:h}=St(),g=e=>p(o,e),_=e=>m(o,e),v=()=>h(o);return{...i,localName:o,name:d,testId:P(o),value:u,error:t[f],commit:g,change:_,blur:v}}var Ta=({node:e})=>{let t=Er(e),{localName:n,name:r,testId:i,value:a,error:o,hidden:s,required:c,readOnly:l,disabled:u,commit:d}=wa(e),f=(0,U.useMemo)(()=>t.props.options??[],[t.props]),p=f[0]?.value??``,m=a||p;return ba(n,m||void 0),s||f.length===0?null:(0,G.jsx)(yt,{error:o,helperText:e.props.helperText??void 0,tooltip:e.props.tooltip??void 0,label:e.props.label??``,id:r,required:c,children:t=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`input`,{name:r,type:`hidden`,value:m}),(0,G.jsx)(Ca,{...t,ariaLabel:e.props.label??void 0,autoFocus:e.props.autoFocus??void 0,disabled:l||u,name:i??`segment`,onSelect:d,options:f,tabIndex:e.props.tabIndex??void 0,value:m})]})})};function Ea(){return(Ea=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Da(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}function Oa(e){var t=(0,U.useRef)(e),n=(0,U.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var ka=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},Aa=function(e){return`touches`in e},ja=function(e){return e&&e.ownerDocument.defaultView||self},Ma=function(e,t,n){var r=e.getBoundingClientRect(),i=Aa(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:ka((i.pageX-(r.left+ja(e).pageXOffset))/r.width),top:ka((i.pageY-(r.top+ja(e).pageYOffset))/r.height)}},Na=function(e){!Aa(e)&&e.preventDefault()},Pa=U.memo(function(e){var t=e.onMove,n=e.onKey,r=e.onEnd,i=Da(e,[`onMove`,`onKey`,`onEnd`]),a=(0,U.useRef)(null),o=Oa(t),s=Oa(n),c=Oa(r),l=(0,U.useRef)(null),u=(0,U.useRef)(!1),d=(0,U.useMemo)(function(){var e=function(e){Na(e),(Aa(e)?e.touches.length>0:e.buttons>0)&&a.current?o(Ma(a.current,e,l.current)):(n(!1),c())},t=function(){n(!1),c()};function n(n){var r=u.current,i=ja(a.current),o=n?i.addEventListener:i.removeEventListener;o(r?`touchmove`:`mousemove`,e),o(r?`touchend`:`mouseup`,t)}return[function(e){var t=e.nativeEvent,r=a.current;if(r&&(Na(t),!function(e,t){return t&&!Aa(e)}(t,u.current)&&r)){if(Aa(t)){u.current=!0;var i=t.changedTouches||[];i.length&&(l.current=i[0].identifier)}r.focus(),o(Ma(r,t,l.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:t===39?.05:t===37?-.05:0,top:t===40?.05:t===38?-.05:0}))},function(e){var t=e.which||e.keyCode;t>=37&&t<=40&&c()},n]},[s,o,c]),f=d[0],p=d[1],m=d[2],h=d[3];return(0,U.useEffect)(function(){return h},[h]),U.createElement(`div`,Ea({},i,{onTouchStart:f,onMouseDown:f,className:`react-colorful__interactive`,ref:a,onKeyDown:p,onKeyUp:m,tabIndex:0,role:`slider`}))}),Fa=function(e){return e.filter(Boolean).join(` `)},Ia=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,a=Fa([`react-colorful__pointer`,e.className]);return U.createElement(`div`,{className:a,style:{top:100*i+`%`,left:100*n+`%`}},U.createElement(`div`,{className:`react-colorful__pointer-fill`,style:{backgroundColor:t}}))},Z=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n};360/(2*Math.PI);var La=function(e){return Ga(Ra(e))},Ra=function(e){return e[0]===`#`&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Z(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?Z(parseInt(e.substring(6,8),16)/255,2):1}},za=function(e){return Wa(Ha(e))},Ba=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:Z(e.h),s:Z(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:Z(i/2),a:Z(r,2)}},Va=function(e){var t=Ba(e);return`hsl(`+t.h+`, `+t.s+`%, `+t.l+`%)`},Ha=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:Z(255*[r,s,o,o,c,r][l]),g:Z(255*[c,r,r,s,o,o][l]),b:Z(255*[o,o,c,r,r,s][l]),a:Z(i,2)}},Ua=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},Wa=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i<1?Ua(Z(255*i)):``;return`#`+Ua(t)+Ua(n)+Ua(r)+a},Ga=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:Z(60*(s<0?s+6:s)),s:Z(a?o/a*100:0),v:Z(a/255*100),a:i}},Ka=U.memo(function(e){var t=e.hue,n=e.onChange,r=e.onChangeEnd,i=Fa([`react-colorful__hue`,e.className]);return U.createElement(`div`,{className:i},U.createElement(Pa,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:ka(t+360*e.left,0,360)})},onEnd:r,"aria-label":`Hue`,"aria-valuenow":Z(t),"aria-valuemax":`360`,"aria-valuemin":`0`},U.createElement(Ia,{className:`react-colorful__hue-pointer`,left:t/360,color:Va({h:t,s:100,v:100,a:1})})))}),qa=U.memo(function(e){var t=e.hsva,n=e.onChange,r=e.onChangeEnd,i={backgroundColor:Va({h:t.h,s:100,v:100,a:1})};return U.createElement(`div`,{className:`react-colorful__saturation`,style:i},U.createElement(Pa,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:ka(t.s+100*e.left,0,100),v:ka(t.v-100*e.top,0,100)})},onEnd:r,"aria-label":`Color`,"aria-valuetext":`Saturation `+Z(t.s)+`%, Brightness `+Z(t.v)+`%`},U.createElement(Ia,{className:`react-colorful__saturation-pointer`,top:1-t.v/100,left:t.s/100,color:Va(t)})))}),Ja=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},Ya=function(e,t){return e.toLowerCase()===t.toLowerCase()||Ja(Ra(e),Ra(t))};function Xa(e,t,n,r){var i=Oa(n),a=Oa(r),o=(0,U.useState)(function(){return e.toHsva(t)}),s=o[0],c=o[1],l=(0,U.useRef)({color:t,hsva:s}),u=(0,U.useRef)(!1);return(0,U.useEffect)(function(){if(!e.equal(t,l.current.color)){var n=e.toHsva(t);l.current={hsva:n,color:t},c(n),u.current=!1}},[t,e]),(0,U.useEffect)(function(){var t;Ja(s,l.current.hsva)||e.equal(t=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:t},i(t),u.current=!0)},[s,e,i]),[s,(0,U.useCallback)(function(e){c(function(t){return Object.assign({},t,e)})},[]),(0,U.useCallback)(function(){u.current&&(u.current=!1,a(l.current.color))},[a])]}var Za,Qa=typeof window<`u`?U.useLayoutEffect:U.useEffect,$a=function(){return Za||(typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0)},eo=new WeakMap,to=function(e){Qa(function(){var t=e.current;if(typeof document<`u`&&t){var n=t.getRootNode?t.getRootNode():t.ownerDocument,r=n&&(`head`in n||`host`in n)?n:t.ownerDocument;if(!eo.has(r)){var i=`head`in r?r.head:r,a=(i.ownerDocument||document).createElement(`style`);a.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`;var o=$a();o&&a.setAttribute(`nonce`,o),eo.set(r,a),i.appendChild(a)}}},[])},no=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,a=e.onChange,o=e.onChangeEnd,s=Da(e,[`className`,`colorModel`,`color`,`onChange`,`onChangeEnd`]),c=(0,U.useRef)(null);to(c);var l=Xa(n,i,a,o),u=l[0],d=l[1],f=l[2],p=Fa([`react-colorful`,t]);return U.createElement(`div`,Ea({},s,{ref:c,className:p}),U.createElement(qa,{hsva:u,onChange:d,onChangeEnd:f}),U.createElement(Ka,{hue:u.h,onChange:d,onChangeEnd:f,className:`react-colorful__last-control`}))},ro={defaultColor:`000`,toHsva:La,fromHsva:function(e){return za({h:e.h,s:e.s,v:e.v,a:1})},equal:Ya},io=function(e){return U.createElement(no,Ea({},e,{colorModel:ro}))};function ao(e){let t=e.trim().replace(/^#/,``).toLowerCase();return/^[0-9a-f]{6}$/.test(t)?`#${t}`:/^[0-9a-f]{3}$/.test(t)?`#${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`:null}function oo({value:e,onChange:t,palette:n,hexLabel:r=`Hex color`,paletteLabel:i=`Color palette`}){let[a,o]=(0,U.useState)(null),s=ao(e)??`#6b7280`;return(0,G.jsxs)(`div`,{className:`flex w-56 flex-col gap-3`,"data-slot":`color-picker`,children:[(0,G.jsx)(io,{className:`!w-full`,color:s,onChange:t}),n.length>0&&(0,G.jsx)(`div`,{"aria-label":i,className:`flex flex-wrap gap-1.5`,role:`listbox`,children:n.map(e=>{let n=ao(e)??e;return(0,G.jsx)(`button`,{"aria-label":n,"aria-selected":n===s,className:_(`size-6 shrink-0 rounded-full border border-lt-border`,n===s&&`ring-2 ring-lt-ring ring-offset-1`),onClick:()=>t(n),role:`option`,style:{background:e},type:`button`},e)})}),(0,G.jsx)(T,{"aria-label":r,onBlur:()=>o(null),onChange:e=>{let n=e.target.value,r=ao(n);o(n),r!==null&&t(r)},value:a??s})]})}function so({node:e,label:t,children:n}){let r=wa(e);return r.hidden?null:(0,G.jsx)(yt,{error:r.error,helperText:mt(e).helperText??void 0,tooltip:mt(e).tooltip??void 0,label:t,id:r.name,required:r.required,children:e=>n(r,e)})}var co=({node:e})=>{let t=e.props;return(0,G.jsx)(so,{node:e,label:t.label??``,children:({name:e,value:n,readOnly:r,disabled:i,commit:a},o)=>{let s=ao(n);return(0,G.jsxs)(xt,{children:[(0,G.jsx)(`input`,{name:e,type:`hidden`,value:s??``}),(0,G.jsx)(Je,{asChild:!0,children:(0,G.jsx)(`button`,{...o,className:_(j(),`flex items-center gap-2 text-left`),"data-test":`color-picker-${e}`,disabled:i||r,type:`button`,children:s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`size-4 shrink-0 rounded-full border border-lt-border`,style:{background:s}}),(0,G.jsx)(`span`,{className:`tabular-nums`,children:s})]}):(0,G.jsx)(`span`,{className:`text-lt-muted-fg`,children:t.placeholder??``})})}),(0,G.jsx)(wt,{className:`p-3`,children:(0,G.jsx)(oo,{onChange:e=>a(e),palette:t.palette,value:s??`#6b7280`})})]})}})},lo=(0,U.lazy)(async()=>{let{DatePickerField:e}=await kt(async()=>{let{DatePickerField:e}=await import(`./date-picker-field-CaRIypsW.js`);return{DatePickerField:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url);return{default:e}});function uo(e){return(0,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(lo,{...e})})}var fo=({node:e})=>{let t=e.props;return(0,G.jsx)(so,{node:e,label:t.label??``,children:({name:e,testId:n,value:r,readOnly:i,disabled:a,change:o,blur:s},c)=>(0,G.jsx)(uo,{controlProps:c,autoFocus:t.autoFocus??!1,disabled:a,label:t.label??t.name,max:t.max||void 0,min:t.min||void 0,mode:`date`,name:e,onBlur:s,onChange:o,readOnly:i,tabIndex:t.tabIndex??void 0,testId:n??t.name,value:r})})},po=({node:e})=>{let t=e.props,{timezone:n}=ye();return(0,G.jsx)(so,{node:e,label:t.label??``,children:({name:e,testId:r,value:i,readOnly:a,disabled:o,change:s,blur:c},l)=>(0,G.jsx)(uo,{controlProps:l,autoFocus:t.autoFocus??!1,disabled:o,label:t.label??t.name,max:t.max,min:t.min,mode:`date-time`,name:e,onBlur:c,onChange:s,readOnly:a,step:t.step,tabIndex:t.tabIndex??void 0,testId:r??t.name,timezone:n,value:i})})};function mo({url:e,method:t,body:n,headers:r,onProgress:i}){return new Promise((a,o)=>{let s=new XMLHttpRequest;s.open(t,e,!0),Object.entries(r).forEach(([e,t])=>s.setRequestHeader(e,String(t))),s.upload.onprogress=e=>{e.lengthComputable&&i?.(Math.round(e.loaded/e.total*100))},s.onload=()=>{try{a(new Response(s.responseText||null,{status:s.status||500}))}catch{o(Error(`Upload to ${e} returned an unusable response`))}},s.onerror=()=>o(Error(`Upload to ${e} failed`)),s.send(n)})}function ho(e,{ref:t,target:n,filename:r,contentType:i,values:a}){return J(e,{method:`POST`,ref:t,body:JSON.stringify({...a,_sub:`upload`,_target:n,filename:r,contentType:i}),throwOnError:!1})}function go(e,t){return Array.isArray(t)?Array.isArray(e)&&e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}var _o=({node:e})=>{let{t}=z(`lattice`),n=e.props,{hidden:r,required:i,readOnly:a,disabled:o}=Ye(e),{action:s,componentRef:c,errors:l}=B(),u=n.name,d=at(),f=d?d.scopedName(u):u,p=d?d.errorKey(u):u,m=p,h=Te(),g=ot(),_=(0,U.useId)(),v=(0,U.useRef)(null),y=(0,U.useRef)(new Set),b=a||o,x=n.signed,S=n.multiple,C=S?`${f}[]`:f,w=(0,U.useMemo)(()=>(n.files??[]).map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,status:`ready`,progress:100,key:e.key,url:e.url,token:e.token,existing:!0})),[n.files]),[T,E]=(0,U.useState)(w),[D,O]=(0,U.useState)([]);(0,U.useEffect)(()=>{if(!x)return;let e=T.filter(e=>!e.existing&&e.key&&e.status===`ready`).map(e=>e.key),t=S?e:e[0]??``;if(d){go(d.getValue(u),t)||d.setValue(u,t);return}g(u,t)},[T,S,u,d,g,x]),(0,U.useEffect)(()=>{!x||d||g(`${u}__removed`,D)},[u,D,d,g,x]),(0,U.useEffect)(()=>()=>{y.current.forEach(e=>URL.revokeObjectURL(e)),y.current.clear()},[]);let k=(0,U.useMemo)(()=>T.filter(e=>e.file&&!e.existing).map(e=>e.file),[T]);(0,U.useEffect)(()=>{if(x||!v.current)return;let e=new DataTransfer;k.forEach(t=>e.items.add(t)),v.current.files=e.files},[k,x]);function A(e){if(!n.image)return;let t=URL.createObjectURL(e);return y.current.add(t),t}function j(e){!e.url||!y.current.has(e.url)||(URL.revokeObjectURL(e.url),y.current.delete(e.url))}async function ee(e,t){let n=()=>{E(t=>t.map(t=>t.id===e.id?{...t,status:`error`}:t))},r=await ho(s,{ref:c,target:m,filename:t.name,contentType:t.type,values:h});if(!r.ok){n();return}let i=await r.json();try{let n=await mo({url:i.url,method:i.method.toUpperCase(),body:t,headers:i.headers,onProgress:t=>E(n=>n.map(n=>n.id===e.id?{...n,progress:t}:n))});E(t=>t.map(t=>t.id===e.id?{...t,status:n.ok?`ready`:`error`,key:i.key,progress:100}:t))}catch{n()}}function M(e){if(!e||b)return;let t=Array.from(e),n=t.map(e=>({id:crypto.randomUUID(),name:e.name,size:e.size,status:x?`uploading`:`ready`,progress:0,file:e,url:A(e),existing:!1}));if(!S&&(T.forEach(j),!d)){let e=T.filter(e=>e.existing&&e.token).map(e=>e.token);e.length>0&&O(t=>[...t,...e])}E(e=>S?[...e,...n]:n),x&&n.forEach((e,n)=>void ee(e,t[n]))}function N(e){let t=T.find(t=>t.id===e);t&&j(t),t?.existing&&t.token&&!d&&O(e=>[...e,t.token]),E(t=>t.filter(t=>t.id!==e))}return r?null:(0,G.jsx)(yt,{error:l[p],helperText:n.helperText??void 0,tooltip:n.tooltip??void 0,label:n.label??``,id:_,required:i,children:e=>(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lt-sm border border-dashed border-lt-border bg-lt-surface px-4 py-6`,"data-test":P(u),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),M(e.dataTransfer.files)},children:[(0,G.jsx)(`button`,{className:`text-sm text-lt-muted-fg`,disabled:b,onClick:()=>v.current?.click(),type:`button`,children:t(`form.file-upload.dropzone`,`Drop files here or click to browse`)}),(0,G.jsx)(`ul`,{className:n.image?`grid grid-cols-1 gap-3 sm:grid-cols-2`:`flex flex-col gap-2`,children:T.map(e=>(0,G.jsxs)(`li`,{className:n.image?`flex min-w-0 items-center gap-3 rounded-lt-sm border border-lt-border bg-lt-bg p-2 text-sm`:`flex items-center justify-between gap-3 text-sm`,children:[n.image&&e.url?(0,G.jsx)(`img`,{alt:e.name,className:`size-16 shrink-0 rounded-lt-sm border border-lt-border object-cover`,"data-test":P(`${u}-preview`),src:e.url}):null,(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate`,"data-test":P(`${u}-item`),children:e.name}),e.status===`uploading`&&(0,G.jsxs)(`span`,{className:`text-xs text-lt-muted-fg`,children:[e.progress,`%`]}),e.status===`error`&&(0,G.jsx)(`span`,{className:`text-xs text-lt-danger`,children:t(`form.file-upload.failed`,`Failed`)})]}),(!e.existing||!d)&&(0,G.jsx)(gt,{size:`sm`,icon:`x`,label:t(`form.file-upload.remove`,`Remove {{name}}`,{name:e.name}),"data-test":P(e.existing?`${u}-remove-existing`:`${u}-remove`),disabled:b,onClick:()=>N(e.id)}),x&&!e.existing&&e.key&&e.status===`ready`&&(0,G.jsx)(`input`,{"data-test":P(`${u}-uploaded`),name:C,type:`hidden`,value:e.key})]},e.id))}),!d&&D.map(e=>(0,G.jsx)(`input`,{name:`${u}__removed[]`,type:`hidden`,value:e},e)),(0,G.jsx)(`input`,{...e,accept:n.accept??void 0,"aria-label":n.label??u,className:`sr-only`,"data-test":P(`${u}-input`),multiple:S,name:x?void 0:C,onChange:e=>{M(e.target.files),x&&(e.target.value=``)},ref:v,type:`file`})]})})};function vo({label:e,summaryLabel:t,variant:n,emphasis:r}){let{componentId:i,errors:a,fieldLabels:o,processing:s}=B(),c=Object.entries(a).filter(([,e])=>!!e).map(([e,t])=>({label:o[e]??e,message:t})),l=c.length>0;return(0,G.jsxs)(`span`,{className:`group relative inline-flex flex-col`,children:[(0,G.jsxs)(E,{"data-lattice-form":i,"data-test":`form-submit`,disabled:s||l,emphasis:r,type:`submit`,variant:n,children:[s&&(0,G.jsx)(tn,{}),e]}),l&&(0,G.jsxs)(`div`,{className:`pointer-events-none absolute bottom-full left-1/2 z-lt-popover mb-2 w-max max-w-xs -translate-x-1/2 rounded-lt border border-lt-border bg-lt-surface p-3 text-left text-sm opacity-0 shadow-lt-md transition-opacity group-hover:opacity-100`,role:`tooltip`,children:[(0,G.jsx)(`p`,{className:`mb-1 font-medium text-lt-fg`,children:t}),(0,G.jsx)(`ul`,{className:`space-y-1`,children:c.map(e=>(0,G.jsxs)(`li`,{className:`text-lt-muted-fg`,children:[(0,G.jsx)(`span`,{className:`font-medium text-lt-fg`,children:e.label}),` — `,e.message]},e.label))})]})]})}var yo={start:`justify-start`,center:`justify-center`,end:`justify-end`,between:`justify-between`,around:`justify-around`,evenly:`justify-evenly`};function bo({componentId:e,reset:t}){let n=Fe();return Xt(R.resetForm,r=>{let i=r.detail;(!i?.form||i.form===e)&&(t(),n())}),null}function xo({action:e,children:t,componentRef:n,nodes:r,shouldRenderSubmitButton:i,submitButtons:a,submitEmphasis:o,submitJustify:s,submitLabel:c,submitVariant:l,summaryLabel:u}){let{nodes:d,markUserEdit:f}=Lr(e,n,r),p=(0,U.useMemo)(()=>({markUserEdit:f}),[f]);return(0,G.jsx)(Ge,{value:p,children:(0,G.jsx)(Tr,{nodes:d,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[t,i&&(0,G.jsx)(`div`,{className:`flex gap-3 ${yo[s??`end`]}`,children:a?.length?a.map((e,t)=>e.props.buttonType===`submit`?(0,G.jsx)(vo,{emphasis:e.props.emphasis??o,label:e.props.label??c,summaryLabel:u,variant:e.props.variant??l},vr(e,t)):(0,G.jsx)(X,{node:e},vr(e,t))):(0,G.jsx)(vo,{emphasis:o,label:c,summaryLabel:u,variant:l})})]})})})}function So(e){return!e||Array.isArray(e)&&e.length===0?!1:Array.isArray(e)?e:void 0}var Co=({children:e,node:t})=>{let n=(0,U.useMemo)(()=>({...Rr(t.schema).values,...t.props.state}),[t.schema,t.props.state]);return(0,G.jsx)(Be,{initial:n,children:(0,G.jsx)(wo,{node:t,children:e})})};function wo({children:e,node:t}){let{t:n}=z(`lattice`),r=t.props,i=r.action??`#`,o=r.errorBag,s=r.ref??``,c=r.method??`post`,l=r.precognitive,u=r.fullWidth,d=r.resetOnError??!1,f=r.resetOnSuccess??[],p=(0,U.useMemo)(()=>Rr(t.schema).labels,[t.schema]),m=r.submitButton,h=r.submitButtons??void 0,g=r.submitJustify??void 0,v=r.submitLabel??n(`form.submit`,`Submit`),y=r.submitVariant??void 0,b=r.submitEmphasis??void 0,x=r.validationSummaryLabel,S=r.validationTimeout??void 0,C=Fe(),w=e=>{let t=So(e);t!==!1&&C(t)},T=(0,U.useRef)(null),E=(0,U.useRef)(`idle`),[D,O]=(0,U.useState)(0);return(0,U.useEffect)(()=>{D>0&&E.current===`renewing`&&T.current?.submit()},[D]),(0,G.jsx)(a,{ref:T,action:i,"data-slot":`form`,"data-lattice-component":t.id,errorBag:o,method:c,resetOnError:d,resetOnSuccess:f,validationTimeout:l?S:void 0,headers:Xn(s),className:_(`flex w-full flex-col gap-6`,!u&&`mx-auto max-w-2xl`),onStart:()=>{E.current=E.current===`renewing`?`retried`:`idle`},onSuccess:()=>w(f),onError:()=>w(d),onHttpException:e=>{if(e.status===403&&s!==``&&E.current!==`retried`)return E.current=`renewing`,or(s).finally(()=>O(e=>e+1)),!1},children:({clearErrors:n,errors:a,processing:o,reset:c,touch:u,validate:d,validating:f})=>(0,G.jsxs)(We,{value:{action:i,clearErrors:e=>n(e),componentId:t.id,componentRef:s,errors:a,fieldLabels:p,precognitive:l,processing:o,touch:e=>u(...e),validate:e=>d(e),validateFields:(e,t)=>d({only:e,...t}),validating:f},children:[(0,G.jsx)(bo,{componentId:t.id,reset:c}),r.status&&(0,G.jsx)(`div`,{className:`text-center text-sm font-medium text-lt-success`,children:r.status}),(0,G.jsx)(xo,{action:i,componentRef:s,nodes:t.schema,shouldRenderSubmitButton:m,submitButtons:h,submitEmphasis:b,submitJustify:g,submitLabel:v,submitVariant:y,summaryLabel:x,children:e})]})})}var To=({node:e})=>{let t=at(),n=e.props.name,r=t?t.getValue(n):e.props.value;return(0,G.jsx)(`input`,{defaultValue:typeof r==`string`?r:``,name:t?t.scopedName(n):n,type:`hidden`})};function Eo({affix:e,side:t,squared:n=!1}){return(0,G.jsx)(`span`,{"data-slot":`affix-${t}`,className:_(`inline-flex h-lt-control-md shrink-0 items-center border border-lt-input bg-lt-muted px-3 text-base whitespace-nowrap text-lt-muted-fg`,`group-has-[:focus-visible]:border-lt-ring`,t===`start`?`rounded-l-lt-sm border-r-0`:`rounded-r-lt-sm border-l-0`,n&&`rounded-r-none border-r-0`),children:e.icon?(0,G.jsx)(K,{className:`size-lt-icon-md`,icon:e.icon}):e.text})}function Do({prefix:e,suffix:t,end:n,children:r}){return!e&&!t&&!n?r(``):(0,G.jsxs)(`div`,{className:`group flex w-full rounded-lt-sm transition-[color,box-shadow] has-[:focus-visible]:ring-[length:var(--lt-ring-width)] has-[:focus-visible]:ring-lt-ring/50`,"data-slot":`affix-group`,children:[e?(0,G.jsx)(Eo,{affix:e,side:`start`}):null,(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:r(_(`focus-visible:ring-0`,e&&`rounded-l-none`,(t||n)&&`rounded-r-none`))}),t?(0,G.jsx)(Eo,{affix:t,side:`end`,squared:!!n}):null,n]})}var Oo=({node:e})=>{let t=e.props;return(0,G.jsx)(so,{node:e,label:t.label??``,children:({name:e,testId:n,value:r,readOnly:i,disabled:a,commit:o},s)=>{let c=e=>o(e.target.value);return t.slider?(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`input`,{...s,"aria-label":t.label??``,className:`h-2 w-full cursor-pointer appearance-none rounded-lt-sm bg-lt-muted accent-lt-primary disabled:cursor-not-allowed disabled:accent-lt-disabled`,"data-test":n,disabled:a||i,max:t.max??void 0,min:t.min??void 0,name:e,onChange:c,step:t.step??void 0,tabIndex:t.tabIndex??void 0,type:`range`,value:r}),(0,G.jsx)(`output`,{className:`w-10 shrink-0 text-right text-sm tabular-nums text-lt-fg`,children:r})]}):(0,G.jsx)(Do,{prefix:t.prefix,suffix:t.suffix,children:o=>(0,G.jsx)(T,{...s,autoFocus:t.autoFocus??!1,className:o,"data-test":n,disabled:a,max:t.max??void 0,min:t.min??void 0,name:e,onChange:c,placeholder:t.placeholder??``,readOnly:i,step:t.step??void 0,tabIndex:t.tabIndex??void 0,type:`number`,value:r})})}})},ko=Object.defineProperty,Ao=Object.defineProperties,jo=Object.getOwnPropertyDescriptors,Mo=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,Po=Object.prototype.propertyIsEnumerable,Fo=(e,t,n)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Io=(e,t)=>{for(var n in t||={})No.call(t,n)&&Fo(e,n,t[n]);if(Mo)for(var n of Mo(t))Po.call(t,n)&&Fo(e,n,t[n]);return e},Lo=(e,t)=>Ao(e,jo(t)),Ro=(e,t)=>{var n={};for(var r in e)No.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mo)for(var r of Mo(e))t.indexOf(r)<0&&Po.call(e,r)&&(n[r]=e[r]);return n};function zo(e){return[setTimeout(e,0),setTimeout(e,10),setTimeout(e,50)]}function Bo(e){let t=U.useRef();return U.useEffect(()=>{t.current=e}),t.current}var Vo=18,Ho=40,Uo=`${Ho}px`,Wo=[`[data-lastpass-icon-root]`,`com-1password-button`,`[data-dashlanecreated]`,`[style$="2147483647 !important;"]`].join(`,`);function Go({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[i,a]=U.useState(!1),[o,s]=U.useState(!1),[c,l]=U.useState(!1),u=U.useMemo(()=>n!==`none`&&(n===`increase-width`||n===`experimental-no-flickering`)&&i&&o,[i,o,n]),d=U.useCallback(()=>{let r=e.current,i=t.current;if(!r||!i||c||n===`none`)return;let o=r,s=o.getBoundingClientRect().left+o.offsetWidth,u=o.getBoundingClientRect().top+o.offsetHeight/2,d=s-Vo,f=u;document.querySelectorAll(Wo).length===0&&document.elementFromPoint(d,f)===r||(a(!0),l(!0))},[e,t,c,n]);return U.useEffect(()=>{let t=e.current;if(!t||n===`none`)return;function r(){let e=window.innerWidth-t.getBoundingClientRect().right;s(e>=Ho)}r();let i=setInterval(r,1e3);return()=>{clearInterval(i)}},[e,n]),U.useEffect(()=>{let e=r||document.activeElement===t.current;if(n===`none`||!e)return;let i=setTimeout(d,0),a=setTimeout(d,2e3),o=setTimeout(d,5e3),s=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(i),clearTimeout(a),clearTimeout(o),clearTimeout(s)}},[t,r,n,d]),{hasPWMBadge:i,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:Uo}}var Ko=U.createContext({}),qo=U.forwardRef((e,t)=>{var n=e,{value:r,onChange:i,maxLength:a,textAlign:o=`left`,pattern:s,placeholder:c,inputMode:l=`numeric`,onComplete:u,pushPasswordManagerStrategy:d=`increase-width`,pasteTransformer:f,containerClassName:p,noScriptCSSFallback:m=Yo,render:h,children:g}=n,_=Ro(n,[`value`,`onChange`,`maxLength`,`textAlign`,`pattern`,`placeholder`,`inputMode`,`onComplete`,`pushPasswordManagerStrategy`,`pasteTransformer`,`containerClassName`,`noScriptCSSFallback`,`render`,`children`]),v;let[y,b]=U.useState(typeof _.defaultValue==`string`?_.defaultValue:``),x=r??y,S=Bo(x),C=U.useCallback(e=>{i?.(e),b(e)},[i]),w=U.useMemo(()=>s?typeof s==`string`?new RegExp(s):s:null,[s]),T=U.useRef(null),E=U.useRef(null),D=U.useRef({value:x,onChange:C,isIOS:typeof window<`u`&&((v=window==null?void 0:window.CSS)?.supports)?.call(v,`-webkit-touch-callout`,`none`)}),O=U.useRef({prev:[T.current?.selectionStart,T.current?.selectionEnd,T.current?.selectionDirection]});U.useImperativeHandle(t,()=>T.current,[]),U.useEffect(()=>{let e=T.current,t=E.current;if(!e||!t)return;D.current.value!==e.value&&D.current.onChange(e.value),O.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection];function n(){if(document.activeElement!==e){N(null),F(null);return}let t=e.selectionStart,n=e.selectionEnd,r=e.selectionDirection,i=e.maxLength,a=e.value,o=O.current.prev,s=-1,c=-1,l;if(a.length!==0&&t!==null&&n!==null){let e=t===n,r=t===a.length&&a.length<i;if(e&&!r){let e=t;if(e===0)s=0,c=1,l=`forward`;else if(e===i)s=e-1,c=e,l=`backward`;else if(i>1&&a.length>1){let t=0;if(o[0]!==null&&o[1]!==null){l=e<o[1]?`backward`:`forward`;let n=o[0]===o[1]&&o[0]<i;l===`backward`&&!n&&(t=-1)}s=t+e,c=t+e+1}}s!==-1&&c!==-1&&s!==c&&T.current.setSelectionRange(s,c,l)}let u=s===-1?t:s,d=c===-1?n:c,f=l??r;N(u),F(d),O.current.prev=[u,d,f]}if(document.addEventListener(`selectionchange`,n,{capture:!0}),n(),document.activeElement===e&&ee(!0),!document.getElementById(`input-otp-style`)){let e=document.createElement(`style`);if(e.id=`input-otp-style`,document.head.appendChild(e),e.sheet){let t=`background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;`;Jo(e.sheet,`[data-input-otp]::selection { background: transparent !important; color: transparent !important; }`),Jo(e.sheet,`[data-input-otp]:autofill { ${t} }`),Jo(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),Jo(e.sheet,`@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }`),Jo(e.sheet,`[data-input-otp] + * { pointer-events: all !important; }`)}}let r=()=>{t&&t.style.setProperty(`--root-height`,`${e.clientHeight}px`)};r();let i=new ResizeObserver(r);return i.observe(e),()=>{document.removeEventListener(`selectionchange`,n,{capture:!0}),i.disconnect()}},[]);let[k,A]=U.useState(!1),[j,ee]=U.useState(!1),[M,N]=U.useState(null),[P,F]=U.useState(null);U.useEffect(()=>{zo(()=>{var e;(e=T.current)==null||e.dispatchEvent(new Event(`input`));let t=T.current?.selectionStart,n=T.current?.selectionEnd,r=T.current?.selectionDirection;t!==null&&n!==null&&(N(t),F(n),O.current.prev=[t,n,r])})},[x,j]),U.useEffect(()=>{S!==void 0&&x!==S&&S.length<a&&x.length===a&&u?.(x)},[a,u,S,x]);let I=Go({containerRef:E,inputRef:T,pushPasswordManagerStrategy:d,isFocused:j}),te=U.useCallback(e=>{let t=e.currentTarget.value.slice(0,a);if(t.length>0&&w&&!w.test(t)){e.preventDefault();return}typeof S==`string`&&t.length<S.length&&document.dispatchEvent(new Event(`selectionchange`)),C(t)},[a,C,S,w]),ne=U.useCallback(()=>{var e;if(T.current){let t=Math.min(T.current.value.length,a-1),n=T.current.value.length;(e=T.current)==null||e.setSelectionRange(t,n),N(t),F(n)}ee(!0)},[a]),re=U.useCallback(e=>{let t=T.current;if(!f&&(!D.current.isIOS||!e.clipboardData||!t))return;let n=e.clipboardData.getData(`text/plain`),r=f?f(n):n;e.preventDefault();let i=T.current?.selectionStart,o=T.current?.selectionEnd,s=(i===o?x.slice(0,i)+r+x.slice(i):x.slice(0,i)+r+x.slice(o)).slice(0,a);if(s.length>0&&w&&!w.test(s))return;t.value=s,C(s);let c=Math.min(s.length,a-1),l=s.length;t.setSelectionRange(c,l),N(c),F(l)},[a,C,w,x]),ie=U.useMemo(()=>({position:`relative`,cursor:_.disabled?`default`:`text`,userSelect:`none`,WebkitUserSelect:`none`,pointerEvents:`none`}),[_.disabled]),ae=U.useMemo(()=>({position:`absolute`,inset:0,width:I.willPushPWMBadge?`calc(100% + ${I.PWM_BADGE_SPACE_WIDTH})`:`100%`,clipPath:I.willPushPWMBadge?`inset(0 ${I.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:`100%`,display:`flex`,textAlign:o,opacity:`1`,color:`transparent`,pointerEvents:`all`,background:`transparent`,caretColor:`transparent`,border:`0 solid transparent`,outline:`0 solid transparent`,boxShadow:`none`,lineHeight:`1`,letterSpacing:`-.5em`,fontSize:`var(--root-height)`,fontFamily:`monospace`,fontVariantNumeric:`tabular-nums`}),[I.PWM_BADGE_SPACE_WIDTH,I.willPushPWMBadge,o]),L=U.useMemo(()=>U.createElement(`input`,Lo(Io({autoComplete:_.autoComplete||`one-time-code`},_),{"data-input-otp":!0,"data-input-otp-placeholder-shown":x.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":P,inputMode:l,pattern:w?.source,"aria-placeholder":c,style:ae,maxLength:a,value:x,ref:T,onPaste:e=>{var t;re(e),(t=_.onPaste)==null||t.call(_,e)},onChange:te,onMouseOver:e=>{var t;A(!0),(t=_.onMouseOver)==null||t.call(_,e)},onMouseLeave:e=>{var t;A(!1),(t=_.onMouseLeave)==null||t.call(_,e)},onFocus:e=>{var t;ne(),(t=_.onFocus)==null||t.call(_,e)},onBlur:e=>{var t;ee(!1),(t=_.onBlur)==null||t.call(_,e)}})),[te,ne,re,l,ae,a,P,M,_,w?.source,x]),oe=U.useMemo(()=>({slots:Array.from({length:a}).map((e,t)=>{let n=j&&M!==null&&P!==null&&(M===P&&t===M||t>=M&&t<P),r=x[t]===void 0?null:x[t];return{char:r,placeholderChar:x[0]===void 0?c?.[t]??null:null,isActive:n,hasFakeCaret:n&&r===null}}),isFocused:j,isHovering:!_.disabled&&k}),[j,k,a,P,M,_.disabled,x]),se=U.useMemo(()=>h?h(oe):U.createElement(Ko.Provider,{value:oe},g),[g,oe,h]);return U.createElement(U.Fragment,null,m!==null&&U.createElement(`noscript`,null,U.createElement(`style`,null,m)),U.createElement(`div`,{ref:E,"data-input-otp-container":!0,style:ie,className:p},se,U.createElement(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`}},L)))});qo.displayName=`Input`;function Jo(e,t){try{e.insertRule(t)}catch{console.error(`input-otp could not insert CSS rule:`,t)}}var Yo=`
|
|
4
|
+
[data-input-otp] {
|
|
5
|
+
--nojs-bg: white !important;
|
|
6
|
+
--nojs-fg: black !important;
|
|
7
|
+
|
|
8
|
+
background-color: var(--nojs-bg) !important;
|
|
9
|
+
color: var(--nojs-fg) !important;
|
|
10
|
+
caret-color: var(--nojs-fg) !important;
|
|
11
|
+
letter-spacing: .25em !important;
|
|
12
|
+
text-align: center !important;
|
|
13
|
+
border: 1px solid var(--nojs-fg) !important;
|
|
14
|
+
border-radius: 4px !important;
|
|
15
|
+
width: 100% !important;
|
|
16
|
+
}
|
|
17
|
+
@media (prefers-color-scheme: dark) {
|
|
18
|
+
[data-input-otp] {
|
|
19
|
+
--nojs-bg: black !important;
|
|
20
|
+
--nojs-fg: white !important;
|
|
21
|
+
}
|
|
22
|
+
}`,Xo=`^\\d+$`;function Zo({char:e,hasFakeCaret:t,isActive:n}){return(0,G.jsxs)(`div`,{className:_(`relative flex h-lt-control-md w-10 items-center justify-center border-y border-r border-lt-input text-base shadow-lt-xs transition-all first:rounded-l-lt-sm first:border-l last:rounded-r-lt-sm`,n&&`z-10 border-lt-ring ring-lt-ring/50 ring-[length:var(--lt-ring-width)]`),children:[e,t?(0,G.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,G.jsx)(`div`,{className:`bg-lt-fg h-5 w-px animate-pulse`})}):null]})}function Qo({length:e,containerClassName:t,pattern:n=Xo,...r}){return(0,G.jsx)(qo,{maxLength:e,pattern:n,containerClassName:_(`flex items-center gap-2 has-[:disabled]:opacity-50`,t),render:({slots:e})=>(0,G.jsx)(`div`,{className:`flex items-center`,children:e.map((e,t)=>(0,G.jsx)(Zo,{...e},t))}),...r})}var $o=({node:e})=>{let t=e.props;return(0,G.jsx)(so,{node:e,label:t.label??``,children:({name:e,testId:n,value:r,readOnly:i,disabled:a,commit:o},s)=>(0,G.jsx)(Qo,{...s,autoFocus:t.autoFocus??!1,"data-test":n,disabled:a||i,length:t.length,name:e,onChange:e=>o(e),value:r})})};function es({className:e,ref:t,...n}){let[r,i]=(0,U.useState)(!1);return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(T,{type:r?`text`:`password`,className:_(`pr-10`,e),ref:t,...n}),(0,G.jsx)(`button`,{type:`button`,"data-test":typeof n.name==`string`?`${n.name}-visibility`:`password-visibility`,onClick:()=>i(e=>!e),className:`absolute inset-y-0 right-0 flex items-center rounded-r-lt-sm px-3 text-lt-muted-fg hover:text-lt-fg focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50 focus-visible:outline-none`,"aria-label":r?`Hide password`:`Show password`,tabIndex:-1,children:r?(0,G.jsx)(x,{name:`eye-off`,className:`size-lt-icon-md`}):(0,G.jsx)(x,{name:`eye`,className:`size-lt-icon-md`})})]})}var ts=({node:e})=>{let t=e.props,{errors:n}=B(),r=wa(e),{commit:i}=St(),a=at(),o=t.confirmation,s=o?.name??`${r.localName}_confirmation`,c=a?a.scopedName(s):s,l=a?a.errorKey(s):s,u=(t.passwordRules??``)||void 0;return r.hidden?null:(0,G.jsxs)(`div`,{className:`grid gap-6`,children:[(0,G.jsx)(yt,{error:r.error,helperText:t.helperText??void 0,tooltip:t.tooltip??void 0,label:t.label??``,labelAction:t.labelAction??void 0,id:r.name,required:r.required,children:e=>(0,G.jsx)(Do,{prefix:t.prefix,suffix:t.suffix,children:n=>(0,G.jsx)(es,{...e,autoComplete:t.autoComplete??``,autoFocus:t.autoFocus??!1,className:n,"data-test":r.testId,disabled:r.disabled,name:r.name,onChange:e=>{r.commit(e.target.value)},placeholder:t.placeholder??``,passwordrules:u,readOnly:r.readOnly,tabIndex:t.tabIndex??void 0,value:r.value})})}),o&&(0,G.jsx)(yt,{error:n[l],label:o.label??`Confirm password`,id:c,required:r.required,children:e=>(0,G.jsx)(es,{...e,autoComplete:`new-password`,"data-test":P(s),disabled:r.disabled,name:c,onChange:e=>{i(s,e.target.value)},placeholder:o.placeholder??o.label??`Confirm password`,passwordrules:u,readOnly:r.readOnly,tabIndex:t.tabIndex??void 0})})]})},ns=[],rs=({node:e})=>{let t=e.props,n=t.name,{errors:r}=B(),{hidden:i,required:a}=Ye(e),{path:o,rows:s,onField:c,onRemove:l,onMove:u,onDuplicate:d,append:f}=Zi(n,t.defaultItems??1),p=e.schema??ns,m=Xi(s.map(e=>String(e.rowId??``)).join(`,`)),h=t.maxItems!=null&&s.length>=t.maxItems,g=t.minItems!=null&&s.length<=t.minItems,_=t.layout===`table`,v=t.itemLabels,y=e=>{let n=v?.[e];return typeof n==`string`&&n!==``?n:t.itemLabel?`${t.itemLabel} ${e+1}`:`#${e+1}`};if(i)return null;let b=s.map((e,t)=>({key:String(e.rowId??t),index:t,row:e,template:p,span:!1,heading:y(t)}));return(0,G.jsx)(yt,{error:r[o],helperText:t.helperText??void 0,tooltip:t.tooltip??void 0,label:t.label??``,id:o,required:a,children:e=>(0,G.jsxs)(`div`,{...e,className:`flex flex-col gap-3`,role:`group`,children:[(0,G.jsx)(yi,{path:o,rows:s,rowKey:Ie}),_?(0,G.jsx)(qi,{base:o,columns:Gi(p),rows:b,reorderable:t.reorderable??!1,removable:()=>!g,rowActions:t.rowActions,onField:c,onMove:u,onRemove:l,onDuplicate:d,registerRow:m,resizableColumns:t.resizableColumns===!0,resizeIndicator:t.resizeIndicator===!0}):s.map((e,n)=>{let r=String(e.rowId??n);return(0,G.jsx)(`div`,{ref:e=>m(r,e),"data-flip-key":r,children:(0,G.jsx)(xi,{base:o,index:n,row:e,template:p,heading:y(n),reorderable:t.reorderable??!1,isFirst:n===0,isLast:n===s.length-1,removable:!g,rowActions:t.rowActions,onField:c,onRemove:l,onMove:u,onDuplicate:d})},r)}),!h&&(0,G.jsxs)(`button`,{type:`button`,"data-test":`repeater-${n}-add`,className:`inline-flex items-center gap-1.5 self-start rounded-lt-sm border border-lt-border px-3 py-1.5 text-sm hover:bg-lt-accent [&_svg]:size-lt-icon-sm`,onClick:()=>f({}),children:[(0,G.jsx)(x,{name:`plus`}),t.addLabel??`Add`]})]})})},is=250;function as({contentClassName:e,creatable:t=!1,emptyLabel:n,loading:r=!1,multiple:i=!1,onCommit:a,onCreate:o,onSearch:s,onSelect:c,open:l,onOpenChange:u,options:d,renderOption:f,searchLabel:p,searchPlaceholder:m,selected:h,showSearch:g=!0,testId:v,trigger:y,triggerClassName:b,triggerProps:S}){let{t:C}=z(`lattice`),[w,T]=(0,U.useState)(``);function E(e){let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);for(let e of t){let t=d.find(t=>t.label.toLowerCase()===e.toLowerCase());t?(a??c)(t.value):o?.(e)}i?T(``):A()}let D=d.some(e=>e.label.toLowerCase()===w.trim().toLowerCase()),O=Vr(e=>s?.(e),is);(0,U.useEffect)(()=>{if(!(!s||!l))return O(w),()=>O.cancel()},[w,s,l,O]);let k=s?d:d.filter(e=>e.label.toLowerCase().includes(w.toLowerCase()));function A(){T(``),u(!1)}function j(e){c(e),i||A()}return(0,G.jsxs)(xt,{open:l,onOpenChange:e=>e?u(!0):A(),children:[(0,G.jsx)(Je,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:b,...S,children:y})}),(0,G.jsxs)(wt,{align:`start`,className:_(`w-[var(--radix-popover-trigger-width)] overflow-hidden p-0`,e),children:[g&&(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-lt-border px-3 py-2`,children:[(0,G.jsx)(`input`,{"aria-label":p??C(`form.search-options`,`Search options`),"data-slot":`combobox-search`,"data-test":v?`${v}-search`:void 0,className:`w-full bg-transparent text-sm outline-none placeholder:text-lt-muted-fg`,onChange:e=>{let n=e.target.value;if(t&&n.includes(`,`)){E(n);return}T(n)},onKeyDown:e=>{t&&e.key===`Enter`&&w.trim()!==``&&(e.preventDefault(),E(w))},placeholder:m,value:w}),r&&(0,G.jsx)(x,{name:`loader-2`,"aria-hidden":`true`,className:`size-lt-icon-md shrink-0 animate-spin text-lt-muted-fg`})]}),(0,G.jsxs)(`div`,{className:`max-h-60 overflow-y-auto p-1`,role:`listbox`,children:[t&&w.trim()!==``&&!D&&(0,G.jsxs)(`button`,{className:`flex w-full items-center gap-2 rounded-lt-sm px-3 py-1.5 text-left text-sm transition-colors hover:bg-lt-accent hover:text-lt-accent-fg`,"data-test":v?`${v}-create`:void 0,onClick:()=>E(w),type:`button`,children:[(0,G.jsx)(x,{name:`plus`,"aria-hidden":`true`,className:`size-lt-icon-md shrink-0`}),C(`form.create-option`,`Create "{{label}}"`,{label:w.trim()})]}),k.length===0&&!(t&&w.trim()!==``&&!D)?(0,G.jsx)(`p`,{className:`px-3 py-2 text-sm text-lt-muted-fg`,children:n}):k.map(e=>{let t=h.includes(e.value);return(0,G.jsxs)(`button`,{"aria-label":f?e.label:void 0,"aria-selected":t,className:_(`flex w-full items-center justify-between gap-2 rounded-lt-sm px-3 py-1.5 text-left text-sm transition-colors hover:bg-lt-accent hover:text-lt-accent-fg`,t&&`bg-lt-accent/60`),"data-slot":`combobox-option`,"data-test":v?`${v}-option-${e.value}`:void 0,"data-value":e.value,onClick:()=>j(e.value),role:`option`,type:`button`,children:[f?(0,G.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:f(e)}):e.label,t&&(0,G.jsx)(x,{name:`check`,"aria-hidden":`true`,className:`size-lt-icon-md shrink-0`})]},e.value)})]})]})]})}function os(e,t){let n=e??t;return Array.isArray(n)?n.map(String):n==null||n===``?[]:[String(n)]}var ss=({node:e})=>{let{t}=z(`lattice`),n=e.props,{action:i,componentRef:a,errors:o,fieldIdPrefix:s,searchOptions:c}=B(),{hidden:l,required:u,readOnly:d,disabled:f}=Ye(e),{change:p,blur:m}=St(),h=Er(e),g=n.name,v=at(),y=ya(v?v.scopedName(g):g,s),b=v?v.errorKey(g):g,S=b,C=n.placeholder||`Select…`,w=n.multiple,T=n.searchable,E=n.creatable,D=(0,U.useMemo)(()=>h.props.options,[h.props]),O=h.props.optionSchema,k=Ee(g),A=Te(),ee=(0,U.useRef)(A);ee.current=A;let N=v?v.getValue(g):k,P=(0,U.useMemo)(()=>os(N,n.value),[N,n.value]),I=(0,U.useRef)(P);I.current=P;let[te,ne]=(0,U.useState)(!1),[re,ie]=(0,U.useState)(null),[ae,L]=(0,U.useState)(!1),oe=(0,U.useRef)(null),se=(0,U.useMemo)(()=>{let e=new Map;for(let t of[...D,...re??[]])e.set(t.value,t);return e},[D,re]),R=e=>se.get(e)?.label??e,ce=e=>F(se.get(e)?.data?.color),le=d||f,ue=(0,U.useCallback)(e=>{if(oe.current?.abort(),e.trim()===``){ie(null),L(!1);return}let t=new AbortController;if(oe.current=t,L(!0),c){c(S,e,ee.current,t.signal).then(e=>{ie(e),L(!1)}).catch(()=>{});return}Or(i,a,{...ee.current,_sub:`search`,_target:S,_q:e},t.signal).then(e=>{ie(e?.options??[]),L(!1)}).catch(()=>{})},[i,a,S,c]);function de(e){p(g,w?e:e[0]??``)}function fe(e){if(w){let t=I.current.includes(e)?I.current.filter(t=>t!==e):[...I.current,e];I.current=t,de(t);return}I.current=[e],de([e])}function pe(e){de(P.filter(t=>t!==e))}function me(e){if(!w){I.current=[e],de([e]);return}if(!I.current.includes(e)){let t=[...I.current,e];I.current=t,de(t)}}if(l)return null;let he=T?re??D:D,ge=O?.length?e=>(0,G.jsx)(Y,{nodes:r(O,{...e.data,label:e.label,value:e.value})}):void 0;return(0,G.jsx)(yt,{error:o[b],helperText:n.helperText??void 0,tooltip:n.tooltip??void 0,label:n.label??``,id:y,required:u,children:e=>(0,G.jsxs)(G.Fragment,{children:[w?P.map(e=>(0,G.jsx)(`input`,{name:`${y}[]`,type:`hidden`,value:e},e)):(0,G.jsx)(`input`,{name:y,type:`hidden`,value:P[0]??``}),(0,G.jsxs)(`div`,{children:[w&&P.length>0&&(0,G.jsx)(`div`,{className:`mb-1.5 flex flex-wrap gap-1`,children:P.map(e=>{let n=ce(e);return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-lt-sm bg-lt-muted px-2 py-0.5 text-xs`,children:[n&&(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 shrink-0 rounded-full`,style:{background:M(n)}}),R(e),!le&&(0,G.jsx)(`button`,{"aria-label":t(`form.remove-option`,`Remove {{label}}`,{label:R(e)}),"data-test":`select-${g}-remove-${e}`,className:`text-lt-muted-fg hover:text-lt-fg [&_svg]:size-lt-icon-xs`,onClick:()=>pe(e),type:`button`,children:(0,G.jsx)(x,{name:`x`})})]},e)})}),(0,G.jsx)(as,{creatable:E,emptyLabel:n.emptyLabel??void 0,loading:ae,multiple:w,onCommit:me,onCreate:me,onSearch:T?ue:void 0,onSelect:fe,open:te&&!le,onOpenChange:e=>{ne(e),e||m(g)},options:he,renderOption:ge,searchPlaceholder:n.searchPlaceholder??void 0,showSearch:!!(T||E),selected:P,testId:`select-${g}`,trigger:(0,G.jsxs)(G.Fragment,{children:[!w&&P.length>0?(0,G.jsx)(`span`,{children:R(P[0])}):(0,G.jsx)(`span`,{className:`text-lt-muted-fg`,children:C}),(0,G.jsx)(x,{name:`chevrons-up-down`,className:`size-lt-icon-md shrink-0 text-lt-muted-fg`})]}),triggerClassName:_(j(),`flex items-center justify-between gap-2 text-left`,le&&`cursor-not-allowed opacity-60`),triggerProps:{...e,"aria-haspopup":`listbox`,autoFocus:n.autoFocus??void 0,"data-test":`select-${g}`,disabled:le,tabIndex:n.tabIndex??void 0}})]})]})})};function cs({className:e,...t}){return(0,G.jsx)(`textarea`,{"data-slot":`textarea`,className:_(`border-lt-input placeholder:text-lt-muted-fg flex field-sizing-content min-h-16 w-full rounded-lt-sm border bg-transparent px-3 py-2 text-base shadow-lt-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-lt-disabled disabled:text-lt-disabled-fg`,k,`aria-invalid:ring-lt-danger/20 dark:aria-invalid:ring-lt-danger/40 aria-invalid:border-lt-danger`,e),...t})}var ls=({node:e})=>{let t=e.props;return(0,G.jsx)(so,{node:e,label:t.label??``,children:({name:e,testId:n,value:r,readOnly:i,disabled:a,commit:o},s)=>(0,G.jsx)(cs,{...s,autoFocus:t.autoFocus??!1,"data-test":n,disabled:a,name:e,onChange:e=>o(e.target.value),placeholder:t.placeholder??``,readOnly:i,rows:t.rows??void 0,tabIndex:t.tabIndex??void 0,value:r})})};async function us(e){if(!navigator?.clipboard)return!1;try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}function ds({value:e,label:t,testId:n,className:r,iconOnly:i=!1,children:a}){let{t:o}=z(me),[s,c]=(0,U.useState)(!1);(0,U.useEffect)(()=>{if(!s)return;let e=window.setTimeout(()=>c(!1),1500);return()=>window.clearTimeout(e)},[s]);async function l(){await us(e)&&c(!0)}let u=s?o(`common.copied-value`,`Copied {{label}}`,{label:t}):o(`common.copy-value`,`Copy {{label}}`,{label:t});return i?(0,G.jsx)(gt,{icon:s?`check`:`copy`,label:u,"data-test":n,className:r,onClick:()=>void l()}):(0,G.jsx)(E,{type:`button`,size:`sm`,emphasis:`outline`,icon:s?`check`:`copy`,"data-test":n,className:r,"aria-label":u,onClick:()=>void l(),children:s?o(`common.copied`,`Copied`):a??o(`common.copy`,`Copy`)})}function fs({value:e,label:t,testId:n,children:r}){return(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-2`,children:[r??e,(0,G.jsx)(ds,{value:e,label:t,testId:n})]})}var ps=({node:e})=>{let t=e.props;return(0,G.jsx)(so,{node:e,label:t.label??``,children:({name:e,testId:n,value:r,readOnly:i,disabled:a,commit:o},s)=>(0,G.jsx)(Do,{prefix:t.prefix,suffix:t.suffix,end:t.copyable?(0,G.jsx)(ds,{className:`h-lt-control-md gap-1.5 rounded-l-none rounded-r-lt-sm border-l-0 border-lt-input px-3 group-has-[:focus-visible]:border-lt-ring`,label:t.label??e,testId:`${n}-copy`,value:r}):null,children:c=>(0,G.jsx)(T,{...s,autoComplete:t.autoComplete??``,autoFocus:t.autoFocus??!1,className:c,"data-test":n,disabled:a,name:e,onChange:e=>o(e.target.value),placeholder:t.placeholder??``,readOnly:i,tabIndex:t.tabIndex??void 0,type:t.type??`text`,value:r})})})},ms=({node:e})=>{let t=e.props,n=D(t.step),r=t.label??t.name;return(0,G.jsx)(so,{node:e,label:t.label??``,children:({name:e,testId:i,value:a,readOnly:o,disabled:s,commit:c,blur:l},u)=>(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(T,{...u,"aria-label":r,autoFocus:t.autoFocus??!1,"data-test":i,disabled:s,name:e,onBlur:()=>{let e=A(a);e&&c(O(e,n)),l()},onChange:e=>c(e.target.value),readOnly:o,tabIndex:t.tabIndex??void 0,type:`text`,value:a}),(0,G.jsxs)(xt,{children:[(0,G.jsx)(Je,{asChild:!0,children:(0,G.jsx)(E,{"aria-label":`Open ${r} time picker`,disabled:s||o,size:`icon`,type:`button`,variant:`secondary`,children:(0,G.jsx)(x,{name:`clock`,className:`size-lt-icon-md`,"aria-hidden":`true`})})}),(0,G.jsx)(wt,{className:`p-2`,children:(0,G.jsx)(ee,{value:A(a),onChange:e=>c(O(e,n)),step:t.step,min:t.min,max:t.max,disabled:s,readOnly:o,testId:`${i}-picker`})})]})]})})},hs=({node:e})=>{let{hidden:t,required:n,readOnly:r,disabled:i}=Ye(e),a=e.props,o=a.name,s=at(),{errors:c,fieldIdPrefix:l}=B(),u=ya(s?s.scopedName(o):o,l),d=s?s.errorKey(o):o,f=Ee(o),p=s?s.getValue(o):f,m=st(a.value),h=p===void 0?m:st(p),g=r||i,{commit:v}=St();return ba(o,m),t?null:(0,G.jsx)(yt,{error:c[d],helperText:a.helperText??void 0,tooltip:a.tooltip??void 0,label:a.label??``,id:u,required:n,children:e=>(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`input`,{disabled:g,name:u,type:`hidden`,value:h?`1`:`0`}),(0,G.jsx)(`button`,{...e,"aria-checked":h,"aria-label":a.label??o,autoFocus:a.autoFocus??!1,className:_(`inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-transparent bg-lt-muted p-0.5 shadow-lt-xs transition-colors outline-none focus-visible:border-lt-ring focus-visible:ring-[length:var(--lt-ring-width)] focus-visible:ring-lt-ring/50 disabled:cursor-not-allowed disabled:bg-lt-disabled data-[state=checked]:bg-lt-primary disabled:data-[state=checked]:bg-lt-disabled`),"data-state":h?`checked`:`unchecked`,"data-test":P(o),disabled:g,name:u,onClick:()=>v(o,!h),role:`switch`,tabIndex:a.tabIndex??void 0,type:`button`,children:(0,G.jsx)(`span`,{className:`size-5 rounded-full bg-lt-bg shadow-lt-sm transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`,"data-state":h?`checked`:`unchecked`})})]})})};function gs(e){let t=[],n=e=>{let r=mt(e).name;if(r&&t.push(r),!(r&&je.has(e.type)))for(let t of e.schema??[])n(t)};for(let t of e.schema??[])n(t);return t}function _s(e){let t=[],n=e=>{let r=mt(e).name;if(r&&t.push(r,`${r}.*`),r&&je.has(e.type)){for(let n of gs(e))t.push(`${r}.*.${n}`);return}for(let t of e.schema??[])n(t)};for(let t of e.schema??[])n(t);return t}function vs(e,t){let n=Object.keys(t).filter(e=>!!t[e]),r=new Set;return e.forEach((e,t)=>{n.some(t=>e.some(e=>zr(t,e)))&&r.add(t)}),r}function ys(e,t){let n=vs(e,t);return n.size>0?Math.min(...n):null}var bs=(0,U.createContext)({activeName:``});function xs(e){let t=(e.schema??[]).filter(e=>e.type===`wizard-step`);return{items:t.map(e=>e.props),nodes:t}}var Ss=({children:e,node:t})=>{let{t:n}=z(`lattice`),{errors:r,processing:i,touch:a,validateFields:o,validating:s}=B(),{items:c,nodes:l}=(0,U.useMemo)(()=>xs(t),[t]),u=(0,U.useMemo)(()=>l.map(e=>gs(e)),[l]),d=t.props.orientation===`vertical`,[f,p]=(0,U.useState)(0),[m,h]=(0,U.useState)(()=>new Set([0])),[g,v]=(0,U.useState)(()=>new Set),y=(0,U.useMemo)(()=>vs(u,r),[u,r]),b=f===c.length-1,S=e=>{p(e),h(t=>new Set(t).add(e))},C=()=>{v(e=>new Set(e).add(f)),b||S(f+1)},w=()=>{let e=l[f],t=e?_s(e):[];if(t.length===0){C();return}a(t),o(t,{onSuccess:C})},T=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(T.current&&!i){let e=ys(u,r);e!==null&&e!==f&&S(e)}T.current=i},[i,r,u,f]);let D=(0,U.useMemo)(()=>({activeName:c[f]?.name??``}),[c,f]);return(0,G.jsx)(bs.Provider,{value:D,children:(0,G.jsxs)(`div`,{className:_(`gap-6`,d?`flex`:`grid`),"data-slot":`wizard`,children:[(0,G.jsx)(`ol`,{"aria-label":n(`form.wizard.steps`,`Steps`),className:_(`gap-1`,d?`flex w-56 shrink-0 flex-col`:`flex flex-wrap`),children:c.map((e,t)=>{let n=t===f,r=g.has(t),i=y.has(t);return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{"aria-current":n?`step`:void 0,className:_(`flex w-full items-center gap-2 rounded-lt px-3 py-2 text-left text-sm`,n?`bg-lt-muted font-medium text-lt-fg`:`text-lt-muted-fg`,!m.has(t)&&`cursor-not-allowed opacity-60`),"data-error":i||void 0,"data-test":`wizard-rail-${e.name}`,disabled:!m.has(t),id:`wizard-step-${e.name}-trigger`,onClick:()=>S(t),type:`button`,children:[(0,G.jsx)(`span`,{className:_(`flex size-5 shrink-0 items-center justify-center rounded-full border text-xs`,i?`border-lt-danger text-lt-danger`:r?`border-lt-primary bg-lt-primary text-lt-primary-fg`:`border-lt-border`),children:r&&!i?(0,G.jsx)(x,{className:`size-lt-icon-sm`,name:`check`}):t+1}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`block truncate`,children:e.label}),d&&e.description&&(0,G.jsx)(`span`,{className:`block truncate text-xs text-lt-muted-fg`,children:e.description})]})]})},e.name)})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-6`,children:[e,(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,G.jsx)(E,{"data-test":`wizard-back`,disabled:f===0||i,onClick:()=>S(f-1),type:`button`,emphasis:`outline`,children:n(`form.wizard.back`,`Back`)}),b?(0,G.jsxs)(E,{"data-test":`wizard-finish`,disabled:i,type:`submit`,children:[i&&(0,G.jsx)(tn,{}),n(`form.wizard.finish`,`Finish`)]}):(0,G.jsxs)(E,{"data-test":`wizard-next`,disabled:i||s,onClick:w,type:`button`,children:[s&&(0,G.jsx)(tn,{}),n(`form.wizard.next`,`Next`)]})]})]})]})})},Cs=({children:e,node:t})=>{let{activeName:n}=(0,U.useContext)(bs),r=t.props.name,i=n===r,[a,o]=(0,U.useState)(i);return(0,U.useEffect)(()=>{i&&o(!0)},[i]),(0,G.jsx)(`section`,{"aria-labelledby":`wizard-step-${r}-trigger`,className:_(`space-y-8`,!i&&`hidden`),hidden:!i,id:`wizard-step-${r}-panel`,children:a?e:null})},ws=(0,U.lazy)(()=>kt(()=>import(`./rich-editor-field-DnkT5hlA.js`),__vite__mapDeps([9,1,2,10,11,3,4,5,6,12,8,13,14,15,16]),import.meta.url)),Ts={components:{form:W(Co),"field.builder":W($i),"field.checkbox":W(xa),"field.choice":W(Ta),"field.color-picker":W(co),"field.date-input":W(fo),"field.date-time-input":W(po),"field.file-upload":W(_o),"field.hidden-input":W(To),"field.number-input":W(Oo),"field.otp":W($o),"field.password-input":W(ts),"field.repeater":W(rs),"field.rich-editor":W(({children:e,node:t})=>(0,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(ws,{node:t,children:e})})),"field.select":W(ss),"field.textarea":W(ls),"field.text-input":W(ps),"field.time-input":W(ms),"field.toggle":W(hs),wizard:W(Ss),"wizard-step":W(Cs)},name:`lattice/form`},Es={lg:320,md:64,sm:40,xl:384,xs:32,"2xl":448,"3xl":512,"4xl":576},Ds={components:{fragment:W(({node:e})=>{let t=e.props.endpoint??``,n=e.props.lazy===!0,r=e.props.ref??``,i=Es[e.props.size],[a,o]=(0,U.useState)(()=>e.schema??[]),[s,c]=(0,U.useState)(!n),[l,u]=(0,U.useState)(n&&t!==``),d=(0,U.useCallback)(async()=>{if(t){u(!0);try{let e=await sr(t,{ref:r});o(_r(e.schema)),c(!0)}finally{u(!1)}}},[t,r]);return(0,U.useEffect)(()=>{!n||s||d()},[s,n,d]),(0,U.useEffect)(()=>{function t(t){t.detail?.component===e.id&&d()}return window.addEventListener(R.reloadComponent,t),()=>window.removeEventListener(R.reloadComponent,t)},[d,e.id]),(0,U.useEffect)(()=>{function e(){s&&d()}return window.addEventListener(R.localeChange,e),()=>window.removeEventListener(R.localeChange,e)},[s,d]),(0,G.jsx)(`div`,{"data-lattice-fragment":e.id,style:l&&a.length===0?{minHeight:i}:void 0,children:l&&a.length===0?(0,G.jsx)(gr,{className:`w-full`,style:{height:i}}):(0,G.jsx)(Y,{nodes:a})})})},name:`lattice/fragments`},Os=({node:e})=>{let{t}=z(`lattice`),n=l().props.lattice?.breadcrumbs??[];return n.length===0?null:(0,G.jsx)(`nav`,{"aria-label":t(`common.breadcrumb`,`Breadcrumb`),className:`px-4 pt-4`,"data-lattice-component":N(e),children:(0,G.jsx)(`ol`,{className:`flex items-center gap-2 text-sm text-lt-muted-fg`,children:n.map((e,t)=>{let r=t===n.length-1;return(0,G.jsxs)(U.Fragment,{children:[(0,G.jsx)(`li`,{children:r?(0,G.jsx)(`span`,{"aria-current":`page`,className:`text-lt-fg`,children:e.title}):(0,G.jsx)(p,{className:`hover:text-lt-fg`,href:e.href,children:e.title})}),r?null:(0,G.jsx)(`li`,{"aria-hidden":`true`,children:`/`})]},e.href)})})})},ks=[`primary`,`secondary`,`success`,`info`,`warning`,`danger`];function As(e){return ks.some(t=>t===e)}function js(e){let t=typeof e==`string`||fe(e)?e:null;return t===``?null:t}function Ms(e,t,n){let r=e=>{let r=t(e.detail);r!==null&&n(r)};return window.addEventListener(e,r),()=>window.removeEventListener(e,r)}function Ns(e){if(typeof e!=`object`||!e)return null;let t=e,n=js(t.message);return n===null?null:{action:t.action??null,dismissible:t.dismissible!==!1,duration:typeof t.duration==`number`?t.duration:null,message:n,persistent:t.persistent===!0,variant:As(t.variant)?t.variant:`success`}}function Ps(e){return Ms(R.toast,Ns,e)}function Fs(e){if(typeof e!=`object`||!e)return null;let t=e,n=js(t.message);return n===null?null:{action:t.action??null,dismissible:t.dismissible!==!1,message:n,title:typeof t.title==`string`||fe(t.title)?t.title:null,unique:typeof t.unique==`string`?t.unique:null,variant:As(t.variant)?t.variant:`info`}}function Is(e){return Ms(R.callout,Fs,e)}function Ls(e){return Ms(R.retractCallout,e=>{let t=e?.unique;return typeof t==`string`?t:null},e)}var Rs=Object.defineProperty,Q=(e,t)=>Rs(e,`name`,{value:t,configurable:!0});function zs(e){let t=e+`CollectionProvider`,[n,r]=lt(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Q(e=>{let{scope:t,children:n}=e,r=U.useRef(null),a=U.useRef(new Map).current;return(0,G.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=v(s),l=U.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(s,n),o=S(t,i.collectionRef);return(0,G.jsx)(c,{ref:o,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=v(u),p=U.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=U.useRef(null),s=S(t,o),c=a(u,n);return U.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,G.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return U.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return Q(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}Q(zs,`createCollection`);var Bs=new WeakMap,Vs=class e extends Map{static{Q(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],Bs.set(this,!0)}set(e,t){return Bs.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=Ws(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=Hs(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=Hs(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Hs(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function Hs(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=Us(e,t);return n===-1?void 0:e[n]}Q(Hs,`at`);function Us(e,t){let n=e.length,r=Ws(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Q(Us,`toSafeIndex`);function Ws(e){return e!==e||e===0?0:Math.trunc(e)}Q(Ws,`toSafeInteger`);function Gs(e){let t=e+`CollectionProvider`,[n,r]=lt(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Vs,setItemMap:Q(()=>void 0,`setItemMap`)}),o=Q(({state:e,...t})=>e?(0,G.jsx)(c,{...t,state:e}):(0,G.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=Q(e=>{let t=h();return(0,G.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=Q(e=>{let{scope:t,children:n,state:r}=e,a=U.useRef(null),[o,s]=U.useState(null),c=S(a,s),[l,u]=r;return U.useEffect(()=>{if(!o)return;let e=Ys(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,G.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=v(l),d=U.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=a(l,n),o=S(t,i.collectionRef);return(0,G.jsx)(u,{ref:o,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=v(f),m=U.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=U.useRef(null),[s,c]=U.useState(null),l=S(t,o,c),{setItemMap:u}=a(f,n),d=U.useRef(i);Ks(d.current,i)||(d.current=i);let m=d.current;return U.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(Js):(t.set(s,{...e,element:s}),t.toSorted(Js)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new Vs(e)))}},[s,m,u]),(0,G.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return U.useState(new Vs)}Q(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return Q(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}Q(Gs,`createCollection`);function Ks(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}Q(Ks,`shallowEqual`);function qs(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Q(qs,`isElementPreceding`);function Js(e,t){return!e[1].element||!t[1].element?0:qs(e[1].element,t[1].element)?-1:1}Q(Js,`sortByDocumentPosition`);function Ys(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}Q(Ys,`getChildListObserver`);var Xs=Object.defineProperty,Zs=(e,t)=>Xs(e,`name`,{value:t,configurable:!0}),Qs=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),$s=U.forwardRef(Zs(function(e,t){return(0,G.jsx)(H.span,{...e,ref:t,style:{...Qs,...e.style}})},`VisuallyHidden`)),ec=Object.defineProperty,$=(e,t)=>ec(e,`name`,{value:t,configurable:!0}),tc=`ToastProvider`,[nc,rc,ic]=zs(`Toast`),[ac,oc]=lt(`Toast`,[ic]),[sc,cc]=ac(tc),lc=$(e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,announcerContainer:o,children:s}=e,[c,l]=U.useState(null),[u,d]=U.useState(0),f=U.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${tc}\`. Expected non-empty \`string\`.`),(0,G.jsx)(nc.Provider,{scope:t,children:(0,G.jsx)(sc,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:u,viewport:c,onViewportChange:l,onToastAdd:U.useCallback(()=>d(e=>e+1),[]),onToastRemove:U.useCallback(()=>d(e=>e-1),[]),isClosePausedRef:f,announcerContainer:o,children:s})})},`ToastProvider`),uc=`ToastViewport`,dc=[`F8`],fc=`toast.viewportPause`,pc=`toast.viewportResume`,mc=U.forwardRef($(function(e,t){let{__scopeToast:n,hotkey:r=dc,label:i=`Notifications ({hotkey})`,...a}=e,o=cc(uc,n),s=rc(n),c=U.useRef(null),l=U.useRef(null),u=U.useRef(null),d=U.useRef(null),f=S(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;U.useEffect(()=>{let e=$(e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()},`handleKeyDown`);return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),U.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=$(()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(fc);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},`handlePause`),r=$(()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(pc);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},`handleResume`),i=$(t=>{e.contains(t.relatedTarget)||r()},`handleFocusOutResume`),a=$(()=>{e.contains(document.activeElement)||r()},`handlePointerLeaveResume`);return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=U.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...Ic(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return U.useEffect(()=>{let e=d.current;if(e){let t=$(t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);Lc(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}},`handleKeyDown`);return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,G.jsxs)(it,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,G.jsx)(gc,{ref:l,onFocusFromOutsideViewport:()=>{Lc(h({tabbingDirection:`forwards`}))}}),(0,G.jsx)(nc.Slot,{scope:n,children:(0,G.jsx)(H.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,G.jsx)(gc,{ref:u,onFocusFromOutsideViewport:()=>{Lc(h({tabbingDirection:`backwards`}))}})]})},`ToastViewport`)),hc=`ToastFocusProxy`,gc=U.forwardRef($(function(e,t){let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=cc(hc,n);return(0,G.jsx)($s,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})},`ToastFocusProxy`)),_c=`Toast`,vc=`toast.swipeStart`,yc=`toast.swipeMove`,bc=`toast.swipeCancel`,xc=`toast.swipeEnd`,Sc=U.forwardRef($(function(e,t){let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=Qe({prop:r,defaultProp:i??!0,onChange:a,caller:_c});return(0,G.jsx)(vt,{present:n||s,children:(0,G.jsx)(Tc,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:Xe(e.onPause),onResume:Xe(e.onResume),onSwipeStart:V(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:V(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:V(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:V(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})},`Toast`)),[Cc,wc]=ac(_c,{onClose(){}}),Tc=U.forwardRef($(function(e,t){let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=cc(_c,n),g=rc(n),[_,v]=U.useState(null),y=S(t,v),b=U.useRef(null),x=U.useRef(null),C=i||h.duration,w=U.useRef(0),T=U.useRef(C),E=U.useRef(0),{onToastAdd:D,onToastRemove:O}=h,k=Xe(()=>{_?.contains(document.activeElement)&&h.viewport?.focus(),o()}),A=U.useCallback(e=>{!e||e===1/0||(window.clearTimeout(E.current),w.current=new Date().getTime(),E.current=window.setTimeout(k,e))},[k]);U.useEffect(()=>{let e=h.viewport;if(e){let t=$(()=>{A(T.current),l?.()},`handleResume`),n=$(()=>{let e=new Date().getTime()-w.current;T.current-=e,window.clearTimeout(E.current),c?.()},`handlePause`);return e.addEventListener(fc,n),e.addEventListener(pc,t),()=>{e.removeEventListener(fc,n),e.removeEventListener(pc,t)}}},[h.viewport,C,c,l,A]),U.useEffect(()=>{a&&!h.isClosePausedRef.current&&A(C)},[a,C,h.isClosePausedRef,A]),U.useEffect(()=>()=>{window.clearTimeout(E.current)},[]),U.useEffect(()=>(D(),()=>O()),[D,O]);let j=U.useMemo(()=>_?jc(_):null,[_]);return h.viewport?(0,G.jsxs)(G.Fragment,{children:[j&&(0,G.jsx)(Ec,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:j}),(0,G.jsx)(Cc,{scope:n,onClose:k,children:Ht.createPortal((0,G.jsx)(nc.ItemSlot,{scope:n,children:(0,G.jsx)(dt,{asChild:!0,onEscapeKeyDown:V(s,e=>{g().some(t=>t.ref.current?.contains(e.target))||k()}),children:(0,G.jsx)(H.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:y,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:V(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||k())}),onPointerDown:V(e.onPointerDown,e=>{e.button===0&&(b.current={x:e.clientX,y:e.clientY})}),onPointerMove:V(e.onPointerMove,e=>{if(!b.current)return;let t=e.clientX-b.current.x,n=e.clientY-b.current.y,r=!!x.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(x.current=l,Mc(yc,d,f,{discrete:!1})):Nc(l,h.swipeDirection,c)?(x.current=l,Mc(vc,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(b.current=null)}),onPointerUp:V(e.onPointerUp,e=>{let t=x.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),x.current=null,b.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};Nc(t,h.swipeDirection,h.swipeThreshold)?Mc(xc,p,r,{discrete:!0}):Mc(bc,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null},`ToastImpl`)),Ec=$(e=>{let{__scopeToast:t,children:n,...r}=e,i=cc(_c,t),[a,o]=U.useState(!1),[s,c]=U.useState(!1);return Pc(()=>o(!0)),U.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,G.jsx)(ut,{asChild:!0,container:i.announcerContainer||void 0,children:(0,G.jsx)($s,{...r,children:a&&(0,G.jsxs)(G.Fragment,{children:[i.label,` `,n]})})})},`ToastAnnounce`),Dc=U.forwardRef($(function(e,t){let{__scopeToast:n,...r}=e;return(0,G.jsx)(H.div,{...r,ref:t})},`ToastTitle`)),Oc=`ToastClose`,kc=U.forwardRef($(function(e,t){let{__scopeToast:n,...r}=e,i=wc(Oc,n);return(0,G.jsx)(Ac,{asChild:!0,children:(0,G.jsx)(H.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,i.onClose)})})},`ToastClose`)),Ac=U.forwardRef($(function(e,t){let{__scopeToast:n,altText:r,...i}=e;return(0,G.jsx)(H.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})},`ToastAnnounceExclude`));function jc(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),Fc(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...jc(e))}}),t}$(jc,`getAnnounceTextContent`);function Mc(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?bt(i,a):i.dispatchEvent(a)}$(Mc,`handleAndDispatchCustomEvent`);var Nc=$((e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n},`isDeltaInDirection`);function Pc(e=()=>{}){let t=Xe(e);pt(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}$(Pc,`useNextFrame`);function Fc(e){return e.nodeType===e.ELEMENT_NODE}$(Fc,`isHTMLElement`);function Ic(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:$(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}$(Ic,`getTabbableCandidates`);function Lc(e){let t=document.activeElement;return e.some(e=>e===t||(e.focus(),document.activeElement!==t))}$(Lc,`focusFirst`);var Rc=lc,zc=mc,Bc=Sc,Vc=Dc,Hc=kc,Uc={primary:{accent:`border-l-lt-primary`,icon:(0,G.jsx)(x,{name:`info`,className:`size-lt-icon-lg shrink-0 text-lt-primary`})},secondary:{accent:`border-l-lt-secondary`,icon:(0,G.jsx)(x,{name:`info`,className:`size-lt-icon-lg shrink-0 text-lt-muted-fg`})},success:{accent:`border-l-lt-success`,icon:(0,G.jsx)(x,{name:`circle-check`,className:`size-lt-icon-lg shrink-0 text-lt-success`})},info:{accent:`border-l-lt-info`,icon:(0,G.jsx)(x,{name:`info`,className:`size-lt-icon-lg shrink-0 text-lt-info`})},warning:{accent:`border-l-lt-warning`,icon:(0,G.jsx)(x,{name:`circle-alert`,className:`size-lt-icon-lg shrink-0 text-lt-warning`})},danger:{accent:`border-l-lt-danger`,icon:(0,G.jsx)(x,{name:`circle-x`,className:`size-lt-icon-lg shrink-0 text-lt-danger`})}},Wc=0;function Gc({duration:e=4e3}){let{t}=z(`lattice`),[n,r]=(0,U.useState)([]);function i(e){r(t=>t.filter(t=>t.id!==e))}return(0,U.useEffect)(()=>Ps(e=>{r(t=>[...t,{...e,id:Wc++}])}),[]),(0,G.jsxs)(Rc,{duration:e,swipeDirection:`down`,children:[n.map(n=>(0,G.jsxs)(Bc,{className:_(`flex items-start gap-3 rounded-lt border border-l-4 border-lt-border bg-lt-popover p-4 text-lt-popover-fg shadow-lt-lg`,Uc[n.variant].accent,`data-[state=open]:animate-lt-toast-in data-[state=closed]:animate-lt-toast-out`,`data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-y)] data-[swipe=cancel]:translate-y-0 data-[swipe=cancel]:transition-transform`),"data-test":`toast-${n.variant}`,duration:n.persistent?1/0:n.duration??e,onOpenChange:e=>{e||i(n.id)},children:[Uc[n.variant].icon,(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,G.jsx)(Vc,{className:`text-sm text-lt-fg`,children:ue(n.message,t)}),n.action?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,G.jsx)(X,{node:n.action})}):null]}),n.dismissible?(0,G.jsx)(Hc,{"aria-label":t(`common.dismiss`,`Dismiss`),className:`shrink-0 rounded-lt-sm p-1 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg`,"data-test":`toast-dismiss`,children:(0,G.jsx)(x,{name:`x`,className:`size-lt-icon-md`})}):null]},n.id)),(0,G.jsx)(zc,{className:`fixed inset-x-0 bottom-0 z-lt-toast mx-auto flex w-full max-w-sm flex-col gap-2 p-4 outline-none`})]})}var Kc=0,qc=()=>{let{t:e}=z(`lattice`),[t,n]=(0,U.useState)([]);(0,U.useEffect)(()=>Is(e=>{n(t=>[...e.unique?t.filter(t=>t.unique!==e.unique):t,{...e,id:Kc++}])}),[]),(0,U.useEffect)(()=>s.on(`navigate`,()=>{n(e=>e.filter(e=>!e.unique))}),[]),(0,U.useEffect)(()=>Ls(e=>{n(t=>t.filter(t=>t.unique!==e))}),[]);function r(e){n(t=>t.filter(t=>t.id!==e))}return t.length===0?null:(0,G.jsx)(`div`,{className:`flex w-full flex-col gap-2`,children:t.map(t=>(0,G.jsxs)(`div`,{role:`status`,"data-test":`callout-${t.variant}`,className:_(`flex items-start gap-3 rounded-lt border border-l-4 border-lt-border bg-lt-popover p-4 text-lt-popover-fg`,Uc[t.variant].accent),children:[Uc[t.variant].icon,(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[t.title?(0,G.jsx)(`p`,{className:`text-sm font-medium text-lt-fg`,children:ue(t.title,e)}):null,(0,G.jsx)(`p`,{className:`text-sm text-lt-fg`,children:ue(t.message,e)}),t.action?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,G.jsx)(X,{node:t.action})}):null]}),t.dismissible?(0,G.jsx)(`button`,{type:`button`,"aria-label":e(`common.dismiss`,`Dismiss`),"data-test":`callout-dismiss`,className:`shrink-0 rounded-lt-sm p-1 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg`,onClick:()=>r(t.id),children:(0,G.jsx)(x,{name:`x`,className:`size-lt-icon-md`})}):null]},t.id))})};function Jc({align:e=`start`,children:t,className:n,placement:r=`bottom`,testId:i,trigger:a,triggerClassName:o,triggerLabel:s}){let[c,u]=(0,U.useState)(!1),d=l().url;return(0,U.useEffect)(()=>u(!1),[d]),(0,G.jsxs)(xt,{open:c,onOpenChange:u,children:[(0,G.jsx)(Je,{asChild:!0,children:(0,G.jsx)(`button`,{"aria-label":s,className:_(`w-full`,o),"data-test":i,title:s,type:`button`,children:a})}),(0,G.jsx)(wt,{align:e,className:_(`min-w-56 p-1`,n),role:`menu`,side:r,children:(0,G.jsx)(yr.Provider,{value:!1,children:t})})]})}var Yc=({children:e,node:t})=>{let n=t.key??`dropdown`;return(0,G.jsx)(Jc,{placement:t.props.placement,testId:n,triggerClassName:`w-auto`,trigger:(0,G.jsx)(`span`,{className:`flex min-w-0 items-center rounded-lt-sm px-2 py-1.5 text-sm hover:bg-lt-muted`,children:t.props.trigger.map((e,t)=>(0,G.jsx)(X,{node:e},e.key??`${e.type}-${t}`))}),children:(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e})})},Xc=({children:e,node:t})=>(0,G.jsx)(`nav`,{"data-lattice-component":N(t),children:(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e})}),Zc=(0,U.createContext)(null),Qc=`flex items-center gap-2 rounded-lt-sm px-3 py-2 text-base font-medium text-lt-fg transition-colors hover:bg-lt-muted`;function $c({affix:e,className:t}){return e.icon?(0,G.jsx)(K,{className:_(`size-lt-icon-md shrink-0`,t),icon:e.icon}):(0,G.jsx)(`span`,{className:_(`shrink-0 text-sm text-lt-muted-fg`,t),children:e.text})}function el(e,t){return(e??[]).some(e=>e.props?.href===t||el(e.schema,t))}var tl=({children:e,node:t})=>{let n=br(),{icon:r,label:i,prefix:a,suffix:o}=t.props,s=i??``,c=!!r,u=r??a?.icon??null,d=l().url.split(`?`)[0],f=I(`menu`,t),m=Jt(t.props),h=r?(0,G.jsx)(K,{className:`size-lt-icon-md shrink-0`,icon:r}):(0,G.jsxs)(G.Fragment,{children:[a?(0,G.jsx)($c,{affix:a}):null,n?(0,G.jsx)(`span`,{className:`pointer-events-none absolute top-1/2 left-full z-lt-popover ml-2 hidden -translate-y-1/2 rounded-lt-sm border border-lt-border bg-lt-popover px-2 py-1 text-sm whitespace-nowrap text-lt-popover-fg shadow-lt-md group-hover:block`,role:`tooltip`,children:s}):(0,G.jsx)(`span`,{children:s}),o?(0,G.jsx)($c,{affix:o,className:`ml-auto`}):null]}),g=_(Qc,`w-full`,n&&`group relative justify-center`,c&&`justify-center`),v=({onClick:e,processing:t})=>(0,G.jsx)(`button`,{"aria-label":n||c?s:void 0,className:g,"data-test":f,disabled:t,onClick:e,type:`button`,children:h});if(m.kind===`action`)return(0,G.jsx)(`li`,{children:(0,G.jsx)(qt,{action:m.action,children:v})});if(m.kind===`effects`)return(0,G.jsx)(`li`,{children:v({onClick:m.onClick,processing:!1})});if(m.kind===`navigate`){let e=d===m.href;return(0,G.jsx)(`li`,{children:(0,G.jsx)(p,{"aria-current":e?`page`:void 0,"aria-label":n||c?s:void 0,as:m.method===`get`?void 0:`button`,className:_(g,e&&`bg-lt-muted font-medium`),"data-test":f,href:m.href,method:m.method,children:h})})}return e?n?(0,G.jsx)(rl,{icon:u,label:s,testId:f,children:e}):(0,G.jsx)(nl,{content:h,defaultOpen:el(t.schema,d),testId:f,children:e}):n?null:(0,G.jsx)(`li`,{children:(0,G.jsx)(`span`,{className:`flex items-center gap-2 px-3 py-2 text-xs font-semibold tracking-wide text-lt-muted-fg uppercase`,children:h})})};function nl({children:e,content:t,defaultOpen:n,testId:r}){let[i,a]=(0,U.useState)(n);return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`button`,{"aria-expanded":i,className:_(Qc,`w-full`),"data-test":r,onClick:()=>a(e=>!e),type:`button`,children:[t,(0,G.jsx)(x,{name:`chevron-right`,className:_(`ml-auto size-lt-icon-md shrink-0 transition-transform`,i&&`rotate-90`)})]}),i?(0,G.jsx)(`ul`,{className:`mt-1 flex flex-col gap-1 pl-3`,children:e}):null]})}function rl({children:e,icon:t,label:n,testId:r}){return(0,G.jsx)(`li`,{children:(0,G.jsx)(Jc,{className:`min-w-48`,placement:`right`,testId:r,trigger:t?(0,G.jsx)(K,{className:`size-lt-icon-md shrink-0`,icon:t}):(0,G.jsx)(`span`,{children:n}),triggerClassName:_(Qc,`justify-center`),triggerLabel:n,children:(0,G.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`li`,{className:`px-3 py-1.5 text-xs font-semibold tracking-wide text-lt-muted-fg uppercase`,children:n}),e]})})})}var il=()=>(0,G.jsx)(G.Fragment,{children:(0,U.useContext)(Zc)});function al(e,t,n){let[r,i]=Oi(e,t,{enabled:n,parse:e=>e===`true`,serialize:String});return[r,(0,U.useCallback)(()=>i(e=>!e),[i])]}var ol=`(min-width: 768px)`;function sl(e,t){let n=e.detail?.target;return n==null||n===t}var cl={components:{breadcrumbs:W(Os),callouts:W(qc),dropdown:W(Yc),menu:W(Xc),"menu-item":W(tl),outlet:W(il),sidebar:W(({children:e,node:t})=>{let n=t.props.collapsible,r=t.props.rememberState,i=N(t),a=`lattice:sidebar:${i??`default`}`,o=Ri(ol,!0),[c,l]=al(a,!1,n&&r),[u,d]=(0,U.useState)(!1);Xt(R.toggleSidebar,e=>{sl(e,i)&&(window.matchMedia?.(ol).matches??!0?n&&l():d(e=>!e))}),(0,U.useEffect)(()=>s.on(`navigate`,()=>d(!1)),[]),Xt(`keydown`,e=>{e.key===`Escape`&&d(!1)},{enabled:u});let f=n&&c&&o;return(0,G.jsxs)(yr.Provider,{value:f,children:[u?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`fixed inset-0 z-lt-overlay bg-lt-overlay md:hidden`,"data-test":`sidebar-backdrop`,onClick:()=>d(!1)}):null,(0,G.jsx)(`aside`,{className:_(`fixed inset-y-0 left-0 z-lt-modal flex h-svh w-72 max-w-[80vw] shrink-0 flex-col gap-4 border-r border-lt-border bg-lt-bg p-4 transition-transform`,`md:sticky md:top-0 md:z-auto md:max-w-none md:translate-x-0 md:transition-[width]`,u?`translate-x-0`:`-translate-x-full`,f?`md:w-16 md:overflow-visible`:`md:w-64 md:overflow-x-hidden md:overflow-y-auto`),"data-collapsed":f?`true`:`false`,"data-lattice-component":i,"data-test":`sidebar`,children:e})]})}),topbar:W(({children:e,node:t})=>{let n=t.props.sticky;return(0,G.jsx)(`header`,{"data-lattice-component":N(t),className:_(`flex h-14 w-full items-center gap-2 border-b border-lt-border bg-lt-bg px-4 text-lt-fg`,n&&`sticky top-0 z-lt-sticky`),children:e})})},name:`lattice/layout`};function ll(e,t=1){return sr(`${e}?page=${t}`)}function ul(e,t){return sr(`${e}/${t}/read`,{method:`PATCH`})}function dl(e){return sr(`${e}/read-all`,{method:`POST`})}function fl(e,t){return sr(`${e}/${t}`,{method:`DELETE`})}function pl(e){return sr(e,{method:`DELETE`})}function ml(e,t){return e.some(e=>e.id===t.id)?e:[t,...e]}function hl(e,t){return e.map(e=>e.id===t?{...e,isRead:!0}:e)}function gl(e,t){return e.filter(e=>e.id!==t)}function _l({endpoint:e,pollingInterval:t}){let[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(0),[o,s]=(0,U.useState)(`loading`),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!1),f=(0,U.useRef)(1),p=(0,U.useRef)(c);p.current=c;let m=(0,U.useRef)(!1),h=(0,U.useCallback)(async()=>{try{let t=await ll(e,1);f.current=1,r(t.notifications),a(t.unreadCount),l(t.hasMore),s(`idle`)}catch{s(`error`)}},[e]);return(0,U.useEffect)(()=>{h()},[h]),(0,U.useEffect)(()=>{if(!t||t<=0)return;let e=setInterval(()=>void h(),t*1e3);return()=>clearInterval(e)},[h,t]),{notifications:n,unreadCount:i,status:o,hasMore:c,open:u,setOpen:d,loadMore:(0,U.useCallback)(()=>{if(m.current||!p.current)return;m.current=!0;let t=f.current+1;ll(e,t).then(e=>{f.current=t,r(t=>[...t,...e.notifications]),l(e.hasMore)}).catch(()=>void h()).finally(()=>{m.current=!1})},[e,h]),markRead:(0,U.useCallback)(t=>{r(e=>hl(e,t)),a(e=>Math.max(0,e-1)),ul(e,t).then(e=>a(e.unreadCount)).catch(()=>void h())},[e,h]),markAllRead:(0,U.useCallback)(()=>{r(e=>e.map(e=>({...e,isRead:!0}))),a(0),dl(e).then(e=>a(e.unreadCount)).catch(()=>void h())},[e,h]),dismiss:(0,U.useCallback)(t=>{r(e=>gl(e,t)),fl(e,t).then(e=>a(e.unreadCount)).catch(()=>void h())},[e,h]),clearAll:(0,U.useCallback)(()=>{r([]),a(0),pl(e).then(e=>a(e.unreadCount)).catch(()=>void h())},[e,h]),receive:(0,U.useCallback)(e=>{r(t=>{let n=ml(t,e);return n!==t&&a(e=>e+1),n})},[])}}function vl(){let{t:e}=z(`lattice`);return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-lt-muted-fg`,children:[(0,G.jsx)(x,{name:`bell`,className:`size-lt-icon-lg`}),(0,G.jsx)(`p`,{className:`text-sm`,children:e(`notifications.empty`,`No notifications yet`)})]})}var yl={primary:`text-lt-primary`,secondary:`text-lt-muted-fg`,success:`text-lt-success`,info:`text-lt-info`,warning:`text-lt-warning`,danger:`text-lt-danger`};function bl({notification:e,onMarkRead:t,onDismiss:n}){let{t:r}=z(`lattice`),i=ue(e.title,r),a=ue(e.body,r),o=(0,G.jsxs)(G.Fragment,{children:[i?(0,G.jsx)(`p`,{className:`truncate text-sm font-medium text-lt-fg`,children:i}):null,a?(0,G.jsx)(`p`,{className:`text-sm text-lt-muted-fg`,children:a}):null]});return(0,G.jsxs)(`li`,{className:_(`flex gap-3 px-3 py-3`,!e.isRead&&`bg-lt-muted/40`),"data-test":`notification`,children:[e.icon?(0,G.jsx)(K,{icon:e.icon,className:_(`mt-0.5 size-lt-icon-md`,e.variant?yl[e.variant]:void 0)}):null,(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[e.href?(0,G.jsx)(p,{href:e.href,className:`block`,"data-test":`notification-link`,onClick:()=>t(e.id),children:o}):o,e.actions.length>0?(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.actions.map((e,t)=>(0,G.jsx)(X,{node:e},e.key??e.id??`action-${t}`))}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1`,children:[e.isRead?null:(0,G.jsx)(`button`,{type:`button`,className:`text-xs text-lt-muted-fg hover:text-lt-fg`,onClick:()=>t(e.id),children:r(`notifications.mark-read`,`Mark read`)}),(0,G.jsx)(`button`,{type:`button`,"aria-label":r(`notifications.dismiss`,`Dismiss`),className:`text-xs text-lt-muted-fg hover:text-lt-fg`,onClick:()=>n(e.id),children:r(`notifications.dismiss`,`Dismiss`)})]})]})}function xl({notifications:e,status:t,hasMore:n,onMarkRead:r,onDismiss:i,onLoadMore:a}){let{t:o}=z(`lattice`);return t===`loading`&&e.length===0?(0,G.jsxs)(`div`,{className:`space-y-2 p-3`,children:[(0,G.jsx)(gr,{className:`h-12 w-full`}),(0,G.jsx)(gr,{className:`h-12 w-full`}),(0,G.jsx)(gr,{className:`h-12 w-full`})]}):e.length===0?(0,G.jsx)(vl,{}):(0,G.jsxs)(`div`,{className:`max-h-96 overflow-y-auto`,children:[(0,G.jsx)(`ul`,{className:`divide-y divide-lt-border`,children:e.map(e=>(0,G.jsx)(bl,{notification:e,onMarkRead:r,onDismiss:i},e.id))}),n?(0,G.jsx)(`button`,{type:`button`,className:`w-full py-2 text-sm text-lt-muted-fg hover:text-lt-fg`,onClick:a,children:o(`notifications.load-more`,`Load more`)}):null]})}var Sl=(0,U.lazy)(()=>kt(()=>import(`./notifications-echo-BLO9_g1w.js`).then(e=>({default:e.NotificationsEcho})),__vite__mapDeps([17,18,1,2]),import.meta.url)),Cl=class extends U.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){console.warn(`[lattice] The notifications bell declares a realtime channel but Echo is unavailable. Install @laravel/echo-react and call configureEcho().`)}render(){return this.state.failed?null:this.props.children}},wl={name:`lattice/notifications`,components:{notifications:W(({node:e})=>{let{t}=z(`lattice`),n=_l({endpoint:e.props.endpoint,pollingInterval:e.props.pollingInterval}),r=t(`notifications.label`,`Notifications`),i=(0,G.jsxs)(`span`,{className:`relative inline-flex items-center justify-center rounded-lt-sm p-2 hover:bg-lt-muted`,children:[(0,G.jsx)(x,{name:`bell`,className:`size-lt-icon-md`}),n.unreadCount>0?(0,G.jsx)(`span`,{"data-test":`notifications-badge`,className:`absolute -right-0.5 -top-0.5 inline-flex min-w-4 items-center justify-center rounded-lt-full bg-lt-danger px-1 py-0 text-[10px] font-medium text-lt-danger-fg`,children:n.unreadCount}):null]}),a=(0,G.jsxs)(`div`,{className:`w-80`,"data-test":`notifications-panel`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b border-lt-border px-3 py-2`,children:[(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:t(`notifications.heading`,`Notifications`)}),n.unreadCount>0?(0,G.jsx)(`button`,{type:`button`,className:`text-xs text-lt-muted-fg hover:text-lt-fg`,onClick:n.markAllRead,children:t(`notifications.mark-all-read`,`Mark all read`)}):null]}),(0,G.jsx)(xl,{notifications:n.notifications,status:n.status,hasMore:n.hasMore,onMarkRead:n.markRead,onDismiss:n.dismiss,onLoadMore:n.loadMore})]});return(0,G.jsxs)(G.Fragment,{children:[e.props.channel?(0,G.jsx)(Cl,{children:(0,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(Sl,{channel:e.props.channel,onReceive:e=>n.receive(e)})})}):null,e.props.slideOut?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":r,"data-test":`notifications-trigger`,onClick:()=>n.setOpen(!0),children:i}),(0,G.jsx)(Fn,{open:n.open,onOpenChange:n.setOpen,children:(0,G.jsxs)(zn,{"aria-describedby":void 0,className:`p-0`,placement:`end`,width:`sm`,children:[(0,G.jsx)(Ln,{className:`sr-only`,children:r}),a]})})]}):(0,G.jsxs)(xt,{open:n.open,onOpenChange:n.setOpen,children:[(0,G.jsx)(Je,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"aria-label":r,"data-test":`notifications-trigger`,children:i})}),(0,G.jsx)(wt,{align:`end`,className:`p-0`,children:a})]})]})})}};function Tl(e){return e==null?``:String(e)}function El({props:e}){let{t}=z(`lattice`),[n,i]=(0,U.useState)([]),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{if(!e.remote||!e.dataEndpoint){i([]),c(!1);return}let t=!1;return o(null),c(!0),mr(e.dataEndpoint,{remote:e.remote}).then(e=>{t||i(e.data??[])}).catch(e=>{t||o(e instanceof Error?e.message:String(e))}).finally(()=>{t||c(!1)}),()=>{t=!0}},[e.dataEndpoint,e.remote]),a?(0,G.jsx)(`div`,{className:`rounded-lt border border-lt-danger/40 p-3 text-sm`,children:a}):s||!e.remote?(0,G.jsx)(`div`,{className:`rounded-lt border border-lt-border p-3 text-sm`,children:t(`common.remote.data-list.loading`,`Loading...`)}):(0,G.jsxs)(`div`,{className:`rounded-lt border border-lt-border bg-lt-bg`,children:[(0,G.jsx)(`div`,{className:`border-b border-lt-border px-3 py-2 text-sm font-medium`,children:t(`common.remote.data-list.title`,`Remote data`)}),(0,G.jsxs)(`div`,{className:`divide-y divide-lt-border`,children:[n.map((t,n)=>(0,G.jsx)(`div`,{className:`px-3 py-2`,children:(0,G.jsx)(Y,{nodes:r(e.schema,t)})},Tl(t.id)||n)),n.length===0?(0,G.jsx)(`div`,{className:`px-3 py-2 text-sm text-lt-muted-fg`,children:e.emptyLabel??t(`common.remote.data-list.empty`,`No data`)}):null]})]})}var Dl={components:{"remote.data-list":W(({node:e})=>(0,G.jsx)(El,{props:{...e.props,schema:e.schema}}))},name:`lattice/remote`};function Ol(e){return e==null||e===``}function kl(e){return Ol(e)?!0:Array.isArray(e)?e.every(kl):typeof e==`object`&&e?Object.values(e).every(kl):!1}function Al(e){return!kl(e)}function jl(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ml(e){return jl(e)?e:{}}function Nl(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.field==`string`&&typeof e.operator==`string`&&typeof e.value==`string`):[]}function Pl(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&`key`in e&&`props`in e&&typeof e.key==`string`&&typeof e.props==`object`&&e.props!==null&&typeof e.props.label==`string`):[]}function Fl(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)):[]}var Il={mode:`none`,currentPage:null,lastPage:null,perPage:null,total:null,from:null,to:null,hasMore:!1,nextPage:null};function Ll(e){return typeof e!=`object`||!e||Array.isArray(e)?Il:e}function Rl(e){if(typeof e!=`object`||!e||Array.isArray(e))return{filters:[],sorts:[],page:1,perPage:25,tableFilters:{},tableFilterIndicators:[],search:``,mode:null};let t=e;return{filters:Nl(t.filters),sorts:Array.isArray(t.sorts)?t.sorts:[],page:typeof t.page==`number`?t.page:1,perPage:typeof t.perPage==`number`?t.perPage:25,tableFilters:Hl(t.tableFilters),tableFilterIndicators:Ul(t.tableFilterIndicators),search:typeof t.search==`string`?t.search:``,mode:Bl(t.mode)}}var zl=new Set([`none`,`simple`,`table`,`infinite`]);function Bl(e){return typeof e==`string`&&zl.has(e)?e:null}function Vl(e){return Array.isArray(e)?e.filter(e=>typeof e==`number`||e===`infinite`):[]}function Hl(e){return typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`object`&&e[1]!==null&&!Array.isArray(e[1])))}function Ul(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.filter==`string`&&typeof e.label==`string`&&typeof e.value==`string`):[]}function Wl(e,t){let n=e.id??e.uuid??e.key??t;return String(n)}function Gl(e){return Array.isArray(e.actions)?e.actions:[]}function Kl(e){let t=e.detail;return typeof t==`object`&&t&&!Array.isArray(t)?t:null}function ql(e,t){return e.sorts.find(e=>e.key===t.key)}function Jl(e){if(e?.direction===`asc`)return`ascending`;if(e?.direction===`desc`)return`descending`}function Yl(e,t){let n=new URL(e,window.location.origin);return t.filters.length>0&&n.searchParams.set(`filter`,nu(t)),t.sorts.length>0&&n.searchParams.set(`sort`,ru(t)),t.search!==``&&n.searchParams.set(`q`,t.search),Xl(n,t.tableFilters),n.searchParams.set(`page`,String(t.page)),n.searchParams.set(`per_page`,String(t.perPage)),t.mode!=null&&n.searchParams.set(`mode`,t.mode),`${n.pathname}${n.search}`}function Xl(e,t){for(let[n,r]of Object.entries(Zl(t)))eu(e,`tf[${n}]`,r)}function Zl(e){let t={};for(let[n,r]of Object.entries(e)){let e=Ql(r);e!==void 0&&(t[n]=e)}return t}function Ql(e){if(Ol(e)||Array.isArray(e)||typeof e!=`object`)return;let t=Object.entries(e).map(([e,t])=>[e,$l(t)]).filter(e=>e[1]!==void 0);return t.length>0?Object.fromEntries(t):void 0}function $l(e){if(!Ol(e)){if(Array.isArray(e)){let t=e.map($l).filter(e=>e!==void 0);return t.length>0?t:void 0}if(typeof e==`object`){if(e===null)return;let t=Object.entries(e).map(([e,t])=>[e,$l(t)]).filter(e=>e[1]!==void 0);return t.length>0?Object.fromEntries(t):void 0}return String(e)}}function eu(e,t,n){if(Array.isArray(n)){for(let r of n)eu(e,`${t}[]`,r);return}if(typeof n==`object`&&n){for(let[r,i]of Object.entries(n))eu(e,`${t}[${r}]`,i);return}e.searchParams.append(t,String(n))}function tu(e){let t={};e.filters.length>0&&(t.filter=nu(e)),e.sorts.length>0&&(t.sort=ru(e));let n=Zl(e.tableFilters);return Object.keys(n).length>0&&(t.tf=n),e.search!==``&&(t.q=e.search),t}function nu(e){return e.filters.map(e=>`${e.field}:${e.operator}:${encodeURIComponent(e.value)}`).join(`,`)}function ru(e){return e.sorts.map(e=>e.direction===`desc`?`-${e.key}`:e.key).join(`,`)}var iu={contains:`contains`,starts_with:`starts with`,ends_with:`ends with`,eq:`equals`,neq:`not equals`,gt:`>`,gte:`≥`,lt:`<`,lte:`≤`,in:`in`,not_in:`not in`,before:`before`,after:`after`,empty:`is empty`,filled:`is not empty`},au=new Set([`empty`,`filled`]);function ou(e){return he(`lattice`,`table.operators.${e}`,iu[e]??e)}function su(e){return e===`desc`?`descending`:`ascending`}function cu(e,t){if(!t.props.sortable)return e;let n=e.find(e=>e.key===t.key),r=e.filter(e=>e.key!==t.key);return n?n.direction===`asc`?[...r,{key:t.key,direction:`desc`}]:r:[...e,{key:t.key,direction:`asc`}]}function lu(e,t){if(t<=5)return Array.from({length:t},(e,t)=>t+1);let n=Math.max(1,Math.min(e-2,t-4));return Array.from({length:5},(e,t)=>n+t)}function uu(e){return e.map(e=>({key:e.key,label:e.props.label,width:du(e)}))}function du(e){return e.props.width??`md`}function fu(e,t,n=!1){return{leadingTracks:[...n?[`2.5rem`]:[],...t?[`3rem`]:[]],trailingTracks:e?[`10rem`]:[]}}function pu(e){let t=(0,U.useMemo)(()=>Pl(e.props?.columns),[e.props?.columns]),n=typeof e.props?.endpoint==`string`?e.props.endpoint:null,r=typeof e.props?.ref==`string`?e.props.ref:``,i=e.props?.lazy===!0,a=(0,U.useMemo)(()=>Rl(e.props?.query),[e.props?.query]),o=(0,U.useMemo)(()=>Fl(e.props?.data),[e.props?.data]),s=(0,U.useMemo)(()=>Ll(e.props?.pagination),[e.props?.pagination]),[c,l]=(0,U.useState)(o),[u,d]=(0,U.useState)(s),[f,p]=(0,U.useState)(a),[m,h]=(0,U.useState)(i),[g,_]=(0,U.useState)(!i),v=(0,U.useRef)(null),y=u.currentPage??f.page,b=(u.mode??`table`)===`infinite`,x=(0,U.useCallback)(async(e,t=!1)=>{if(n){h(!0);try{let i=await sr(Yl(n,e),{ref:r}),a=Rl(i.query),o=Fl(i.data);l(e=>t?[...e,...o]:o),d(Ll(i.pagination)),p(a),_(!0)}finally{h(!1)}}},[n,r]);function S(e){x({...f,page:1,sorts:cu(f.sorts,e)})}function C(e){x({...f,page:1,sorts:f.sorts.filter(t=>t.key!==e.key)})}function w(e){let t={...f,filters:e,page:1};p(t),x(t)}function T(e){w([...f.filters,e])}function E(e,t){w(f.filters.map((n,r)=>r===e?t:n))}function D(e){w(f.filters.filter((t,n)=>n!==e))}function O(e,t){w([...f.filters.filter(t=>t.field!==e),...t])}function k(e,t){let n={...f.tableFilters};kl(t)||!jl(t)?delete n[e]:n[e]=t;let r={...f,tableFilters:n,tableFilterIndicators:f.tableFilterIndicators.filter(t=>t.filter!==e),page:1};p(r),x(r)}function A(){let e={...f,filters:[],tableFilters:{},tableFilterIndicators:[],search:``,page:1};p(e),x(e)}function j(e){let t={...f,search:e,page:1};p(t),x(t)}let ee=(0,U.useCallback)(async(e,t,i)=>{if(!n)return[];let a=new URL(n,window.location.origin);a.searchParams.set(`_sub`,`search`),a.searchParams.set(`_target`,e),a.searchParams.set(`_q`,t);let o=await J(`${a.pathname}${a.search}`,{ref:r,signal:i,throwOnError:!1});return o.ok?(await o.json()).options??[]:[]},[n,r]);function M(e){x({...f,page:e})}function N(e){let t=s.mode??`table`,n={...f,perPage:e===`infinite`?f.perPage:e,mode:e===`infinite`?`infinite`:t===`infinite`?`table`:null,page:1};p(n),x(n)}let P=(0,U.useCallback)(()=>{m||!u.hasMore||x({...f,page:u.nextPage??y+1},!0)},[y,x,u.hasMore,u.nextPage,m,f]);return(0,U.useEffect)(()=>{l(o),d(s),p(a),h(i),_(!i)},[o,s,a,i]),(0,U.useEffect)(()=>{!i||g||x(f)},[g,i,x,f]),Xt(R.reloadComponent,t=>{t.detail?.component===e.id&&x(f)}),(0,U.useEffect)(()=>{if(!b||!u.hasMore||m||!v.current||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&P()},{rootMargin:`240px`});return e.observe(v.current),()=>e.disconnect()},[b,P,u.hasMore,m]),{columns:t,rows:c,pagination:u,query:f,filters:f.filters,tableFilters:f.tableFilters,search:f.search,addFilter:T,updateFilter:E,removeFilter:D,replaceColumnFilters:O,setTableFilter:k,resetFilters:A,setSearch:j,searchFilterOptions:ee,processing:m,hasLoaded:g,infiniteLoaderRef:v,sort:S,clearSort:C,goToPage:M,setPerPage:N,loadMore:P}}function mu(e){let[t,n]=(0,U.useState)(()=>new Set),[r,i]=(0,U.useState)(!1),a=e.join(` `);(0,U.useEffect)(()=>{n(new Set),i(!1)},[a]);let o=(0,U.useCallback)(e=>{i(!1),n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),s=(0,U.useCallback)(()=>{i(!1),n(t=>t.size===e.length?new Set:new Set(e))},[e]),c=(0,U.useCallback)(()=>i(!0),[]),l=(0,U.useCallback)(()=>{i(!1),n(new Set)},[]),u=e.filter(e=>t.has(e)),d=e.length>0&&u.length===e.length;return{selectedKeys:u,allMatching:r,allVisibleSelected:d,allSelected:r||d,active:r||u.length>0,isSelected:e=>r||t.has(e),toggle:o,toggleAll:s,selectAllMatching:c,clear:l}}function hu({columns:e,storageKey:t}){let n=(0,U.useMemo)(()=>e.filter(e=>e.props.toggleable),[e]),r=(0,U.useMemo)(()=>n.map(e=>e.key),[n]),[i,a]=Oi(t??``,{},{enabled:!!t,parse:e=>_u(e,r),serialize:e=>vu(e,r)}),o=(0,U.useCallback)(e=>e.props.toggleable?i[e.key]??!e.props.hiddenByDefault:!0,[i]),s=(0,U.useMemo)(()=>e.filter(e=>o(e)),[e,o]),c=(0,U.useCallback)((e,t)=>{a(n=>({...n,[e]:t}))},[a]),l=(0,U.useCallback)(()=>a({}),[a]),u=n.length>0;return{hasHidden:n.some(e=>!o(e)),hasToggleableColumns:u,isVisible:o,resetVisibility:l,setColumnVisible:c,toggleableColumns:n,visibleColumns:s}}function gu(e,t){let n=new Set(t),r={};for(let[t,i]of Object.entries(e))n.has(t)&&typeof i==`boolean`&&(r[t]=i);return r}function _u(e,t){let n=JSON.parse(e)?.overrides;if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`unexpected stored column visibility shape`);return gu(n,t)}function vu(e,t){let n=gu(e,t);return Object.keys(n).length===0?null:JSON.stringify({overrides:n})}function yu(){let[e,t]=(0,U.useState)(()=>new Set);return{isExpanded:(0,U.useCallback)(t=>e.has(t),[e]),toggle:(0,U.useCallback)(e=>{t(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[])}}var bu={start:`text-start`,center:`text-center`,end:`text-end`},xu={start:`justify-start`,center:`justify-center`,end:`justify-end`},Su={start:`justify-items-start`,center:`justify-items-center`,end:`justify-items-end`},Cu=e=>bu[e],wu=e=>xu[e],Tu=e=>Su[e];function Eu(e){return(e??[]).flatMap(e=>{if(e.type!==`action`&&e.type!==`action.bulk`)return[];let t=e.props;return t?.endpoint?[{id:e.id??``,label:t.label??he(`lattice`,`common.action.run`,`Run action`),method:t.method??`post`,endpoint:t.endpoint,ref:t.ref??``,variant:t.variant,emphasis:t.emphasis,confirmation:t.confirmation,form:t.form,modalSide:t.modalSide,modalWidth:t.modalWidth}]:[]})}function Du({actions:e,selectedKeys:t,allMatching:n,total:r,query:i,canSelectAllMatching:a,onSelectAllMatching:o,onCompleted:s}){let{t:c}=z(`lattice`),[l,u]=(0,U.useState)(!1),d=le(),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),g=()=>n?{allMatching:!0,...i}:{selected:t};async function _(e){u(!0);let t=await hr(()=>J(e.endpoint,{method:e.method,ref:e.ref,body:JSON.stringify(g()),throwOnError:!1}),d);u(!1),t&&(p(null),s())}function v(e){if(e.form){h(e);return}if(e.confirmation){p(e);return}_(e)}let y=n?r??t.length:t.length;return(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-lt-border bg-lt-muted/50 p-4 text-sm`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:n?c(`table.bulk.all-selected`,`All {{count}} selected`,{count:y}):c(`table.bulk.selected`,`{{count}} selected`,{count:y})}),a&&(0,G.jsx)(`button`,{type:`button`,"data-test":`bulk-select-all-matching`,className:`font-medium text-lt-primary underline underline-offset-2`,onClick:o,children:c(`table.bulk.select-all-matching`,`Select all {{total}} matching`,{total:r})}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.map(e=>(0,G.jsxs)(E,{type:`button`,"data-test":ae(`bulk-action`,e.id),variant:e.variant,emphasis:e.emphasis,disabled:l,onClick:()=>v(e),children:[l&&(0,G.jsx)(tn,{}),e.label]},e.id))}),f?.confirmation&&(0,G.jsx)(Vn,{title:f.confirmation.title??f.label,description:f.confirmation.description??void 0,confirmLabel:f.confirmation.confirmLabel??f.label,cancelLabel:f.confirmation.cancelLabel??c(`common.cancel`,`Cancel`),confirmVariant:f.variant,confirmEmphasis:f.emphasis,processing:l,onConfirm:()=>void _(f),onCancel:()=>p(null)}),m?.form&&(0,G.jsx)(Kr,{cancelLabel:m.confirmation?.cancelLabel??c(`common.cancel`,`Cancel`),componentRef:m.ref,description:m.confirmation?.description??void 0,endpoint:m.endpoint,extraData:g(),formNode:m.form,method:m.method,onClose:()=>h(null),onSuccess:()=>{h(null),s()},placement:m.modalSide??`center`,submitLabel:m.confirmation?.confirmLabel??m.label,title:m.confirmation?.title??m.label,width:m.modalWidth??void 0})]})}function Ou({className:e,density:t,children:n,ref:r,...i}){return(0,G.jsx)(`select`,{ref:r,"data-slot":`native-select`,className:_(j({density:t}),`cursor-pointer`,e),...i,children:n})}function ku(e){return e===!0||e===1||e===`1`||e===`true`}function Au({filter:e,value:t,processing:n,bare:r=!1,onChange:i,onSearch:a}){let{t:o}=z(`lattice`),s=e.schema??[];return s.length===0?(0,G.jsx)(Nu,{filter:e,value:t,processing:n,onChange:i}):(0,G.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(ju,{filter:e,schema:s,value:t,processing:n,bare:r,onChange:i,onSearch:a})}),Al(t)&&(0,G.jsx)(gt,{size:`md`,icon:`x`,label:o(`table.filter.clear`,`Clear {{label}} filter`,{label:e.props.label}),disabled:n,onClick:()=>i(void 0)})]})}function ju({filter:e,schema:t,value:n,processing:r,bare:i,onChange:a,onSearch:o}){let s=(0,U.useMemo)(()=>Ml(n),[n]),c=(0,U.useMemo)(()=>({action:`#`,clearErrors:()=>{},componentId:`table-filter-${e.key}`,componentRef:``,errors:{},fieldIdPrefix:`table-filter-${e.key}`,fieldLabels:{},precognitive:!1,processing:r,searchOptions:(e,t,n,r)=>o?o(e,t,r):Promise.resolve([]),touch:()=>{},validate:()=>{},validateFields:()=>{},validating:!1}),[e.key,o,r]),l=(0,G.jsx)(`div`,{"aria-disabled":r,className:_(`grid gap-3`,r&&`pointer-events-none opacity-60`),children:(0,G.jsx)(Y,{nodes:t})});return(0,G.jsx)(We,{value:c,children:(0,G.jsx)(Ge,{value:{markUserEdit:()=>{}},children:(0,G.jsx)(Tr,{nodes:{},children:(0,G.jsx)(Be,{initial:s,children:(0,G.jsx)(Mu,{onChange:a,children:i?(0,G.jsx)(ze,{children:l}):l})})})})})}function Mu({children:e,onChange:t}){let n=Te(),r=ot(),i=(0,U.useRef)(n);i.current=n;let a=(0,U.useCallback)((e,n)=>{let a=typeof n==`function`?n(Ve(i.current,e)):n,o=Ue(i.current,e,a);i.current=o,r(e,a),t(o)},[t,r]),o=(0,U.useMemo)(()=>({blur:()=>{},change:a,commit:a}),[a]);return(0,G.jsx)(we,{value:o,children:e})}function Nu({filter:e,value:t,processing:n,onChange:r}){let i=ku(Ml(t).value);return(0,G.jsxs)(`label`,{className:`flex h-lt-control-md cursor-pointer items-center gap-2 text-sm`,children:[(0,G.jsx)(va,{"aria-label":e.props.label,"data-test":`table-filter-${e.key}`,checked:i,disabled:n,onCheckedChange:e=>r(e===!0?{value:`1`}:void 0)}),(0,G.jsx)(`span`,{children:e.props.label})]})}function Pu({type:e,label:t,value:n,processing:r,withSearchIcon:i=!1,grouped:a=!1,ariaLabel:o,testId:s,onCommit:c,onClear:l}){let{t:u}=z(`lattice`),[d,f]=(0,U.useState)(n),p=o??u(`table.filter.filter-by`,`Filter {{label}}`,{label:t}),m=a?`rounded-r-none`:``;return(0,U.useEffect)(()=>{f(n)},[n]),e===`boolean`?(0,G.jsxs)(Ou,{density:`compact`,"aria-label":p,"data-test":s,className:m,disabled:r,value:n,onChange:e=>c(e.target.value),children:[(0,G.jsx)(`option`,{value:``,children:u(`table.filter.all`,`All`)}),(0,G.jsx)(`option`,{value:`true`,children:u(`table.filter.true`,`True`)}),(0,G.jsx)(`option`,{value:`false`,children:u(`table.filter.false`,`False`)})]}):e===`date`?(0,G.jsx)(T,{type:`date`,density:`compact`,"aria-label":p,"data-test":s,className:m,disabled:r,value:d,onChange:e=>{f(e.target.value),c(e.target.value)}}):(0,G.jsxs)(`div`,{className:`relative flex w-full min-w-0 items-center`,children:[i&&(0,G.jsx)(x,{name:`search`,"aria-hidden":`true`,className:`pointer-events-none absolute left-2 size-lt-icon-md text-lt-muted-fg`}),(0,G.jsx)(T,{type:e===`number`?`number`:`text`,density:`compact`,"aria-label":p,"data-test":s,className:_(m,i&&`pl-8`,l&&`pr-8`),disabled:r,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c(d)},onBlur:()=>{d!==n&&c(d)}}),l&&d!==``&&(0,G.jsx)(gt,{size:`xs`,icon:`x`,label:u(`table.filter.clear`,`Clear {{label}} filter`,{label:t}),"data-test":s?`${s}-clear`:void 0,className:`absolute right-1 size-6`,disabled:r,onClick:l})]})}function Fu({column:e,clauses:t,processing:n,onAdd:r,onUpdate:i,onRemove:a,onReplace:o,onSearch:s}){let{t:c}=z(`lattice`),{filter:l,label:u}=e.props,d=u??e.key;if(!l)return null;if(l.control===`filter.select`)return(0,G.jsx)(Lu,{column:e,clauses:t,processing:n,onReplace:o,onSearch:s});let f=l.type??`text`,p=l.operators??[],m=l.defaultOperator??p[0]??`eq`,h=t.find(e=>e.clause.operator===m)??t[0];function g(t){if(t===``){h&&a(h.index);return}h?i(h.index,{...h.clause,value:t}):r({field:e.key,operator:m,value:t})}return(0,G.jsxs)(`div`,{className:`flex min-w-0 max-w-80 items-stretch`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(Pu,{type:f,label:d,value:h?.clause.value??``,processing:n,withSearchIcon:f===`text`||f===`number`,grouped:!0,testId:`filter-${e.key}-value`,onCommit:g,onClear:h?()=>a(h.index):void 0})}),(0,G.jsxs)(xt,{children:[(0,G.jsx)(Je,{asChild:!0,children:(0,G.jsx)(gt,{emphasis:`segmented`,size:`md`,icon:`filter`,label:c(`table.filter.column-filters`,`{{label}} filters`,{label:d}),"data-test":`filter-${e.key}`,disabled:n,children:t.length>0&&(0,G.jsx)(`span`,{className:`absolute -right-1.5 -top-1.5 inline-flex size-4 items-center justify-center rounded-full bg-lt-primary text-xs font-medium text-lt-primary-fg`,children:t.length})})}),(0,G.jsx)(wt,{align:`start`,className:`w-80 p-4`,children:(0,G.jsx)(Vu,{column:e,clauses:t,operators:p,defaultOperator:m,processing:n,onAdd:r,onUpdate:i,onRemove:a})})]})]})}function Iu(e){return Array.isArray(e)?e.join(`,`):typeof e==`string`?e:``}function Lu({column:e,clauses:t,processing:n,onReplace:r,onSearch:i}){let{filter:a,label:o}=e.props,s=o??e.key;if(!a)return null;let c=a.multiple,l=a.defaultOperator,u=a.clauseOptions??[],d=zu(t.map(e=>e.clause),u),f=t.find(e=>e.clause.operator===l)??t[0],p=d?d.value:c?f?.clause.value?f.clause.value.split(`,`):[]:f?.clause.value??``,m={key:e.key,type:`filter.select`,props:{label:s,options:a.options,multiple:c,searchable:a.searchable,placeholder:null},schema:[{type:`field.select`,key:e.key,props:{name:`value`,label:s,options:a.options,multiple:c,searchable:a.searchable,placeholder:null}}]};function h(t){let n=Iu(Ml(t).value);if(n===``){r(e.key,[]);return}let i=u.find(e=>e.value===n);if(i){r(e.key,Ru(e.key,i));return}r(e.key,[{field:e.key,operator:l,value:n}])}return(0,G.jsx)(Au,{filter:m,value:{value:p},processing:n,bare:!0,onChange:h,onSearch:i?(e,t,n)=>i(t,n):void 0})}function Ru(e,t){return t.clauses.map(t=>({field:e,operator:t.operator,value:t.value}))}function zu(e,t){return t.find(t=>Bu(e,Ru(``,t)))}function Bu(e,t){return e.length===t.length&&t.every(t=>e.some(e=>e.operator===t.operator&&e.value===t.value))}function Vu({column:e,clauses:t,operators:n,defaultOperator:r,processing:i,onAdd:a,onUpdate:o,onRemove:s}){let{t:c}=z(`lattice`),l=e.props.filter?.type??`text`,[u,d]=(0,U.useState)(r),[f,p]=(0,U.useState)(t.length===0);return(0,G.jsxs)(`div`,{className:`grid gap-3`,children:[t.map(t=>(0,G.jsx)(Hu,{column:e,type:l,operators:n,clause:t.clause,processing:i,onOperator:e=>o(t.index,{...t.clause,operator:e}),onValue:e=>e===``?s(t.index):o(t.index,{...t.clause,value:e}),onRemove:()=>s(t.index)},t.index)),f&&(0,G.jsx)(Hu,{column:e,type:l,operators:n,clause:{field:e.key,operator:u,value:``},processing:i,onOperator:t=>{if(au.has(t)){a({field:e.key,operator:t,value:``}),d(r),p(!1);return}d(t)},onValue:t=>{t!==``&&(a({field:e.key,operator:u,value:t}),d(r),p(!1))},onRemove:()=>p(!1)}),(0,G.jsx)(`div`,{className:`border-t border-lt-border pt-3`,children:(0,G.jsx)(E,{variant:`secondary`,icon:`plus`,"data-test":`filter-${e.key}-add`,className:`w-full`,disabled:i,onClick:()=>p(!0),children:c(`table.filter.add`,`Add filter`)})})]})}function Hu({column:e,type:t,operators:n,clause:r,processing:i,onOperator:a,onValue:o,onRemove:s}){let{t:c}=z(`lattice`),l=e.props.label??e.key,u=au.has(r.operator);return(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.length>1?(0,G.jsx)(Ou,{density:`compact`,"aria-label":c(`table.filter.operator`,`{{label}} operator`,{label:l}),"data-test":`filter-${e.key}-operator`,className:`flex-1`,disabled:i,value:r.operator,onChange:e=>a(e.target.value),children:n.map(e=>(0,G.jsx)(`option`,{value:e,children:ou(e)},e))}):(0,G.jsx)(`span`,{className:`flex-1 text-sm font-medium`,children:ou(r.operator)}),(0,G.jsx)(E,{emphasis:`outline`,size:`icon`,icon:`trash-2`,"aria-label":c(`table.filter.remove`,`Remove {{label}} filter`,{label:l}),"data-test":`filter-${e.key}-remove`,disabled:i,onClick:s})]}),!u&&(0,G.jsx)(Pu,{type:t,label:l,ariaLabel:c(`table.filter.value`,`{{label}} filter value`,{label:l}),value:r.value,processing:i,onCommit:o,onClear:()=>o(``)})]})}function Uu({sort:e}){return e?.direction===`asc`?(0,G.jsx)(x,{name:`arrow-up`,"aria-hidden":`true`,className:`size-lt-icon-sm shrink-0`}):e?.direction===`desc`?(0,G.jsx)(x,{name:`arrow-down`,"aria-hidden":`true`,className:`size-lt-icon-sm shrink-0`}):(0,G.jsx)(x,{name:`chevrons-up-down`,"aria-hidden":`true`,className:`size-lt-icon-sm shrink-0 opacity-50`})}function Wu({column:e,processing:t,resizeHandleProps:n,sort:r,query:i}){let a=ql(i,e),{t:o}=z(`lattice`),{align:s,label:c,sortable:l}=e.props;return(0,G.jsxs)(`div`,{"aria-sort":Jl(a),className:_(`relative min-w-0 px-4 py-3 pr-5 align-middle font-semibold text-lt-fg`,Cu(s)),role:`columnheader`,children:[l?(0,G.jsxs)(`button`,{type:`button`,"aria-label":o(`table.sort.column`,`Sort {{label}}`,{label:c}),className:_(`flex w-full items-center gap-1.5 font-semibold`,wu(s)),"data-test":`sort-${e.key}`,disabled:t,onClick:()=>r(e),children:[(0,G.jsx)(`span`,{className:_(`min-w-0 flex-1 truncate`,Cu(s)),children:c}),(0,G.jsx)(Uu,{sort:a})]}):(0,G.jsx)(`span`,{className:_(`block truncate`,Cu(s)),children:c}),n&&(0,G.jsx)(`div`,{...n})]})}function Gu({columns:e,hasHidden:t,isVisible:n,onReset:r,onToggle:i,processing:a,visibleColumnCount:o}){let{t:s}=z(`lattice`),c=s(`table.columns.label`,`Columns`);return(0,G.jsxs)(xt,{children:[(0,G.jsx)(Je,{asChild:!0,children:(0,G.jsx)(gt,{size:`sm`,icon:`columns-3`,label:c,"data-test":`table-columns-menu`,disabled:a})}),(0,G.jsx)(wt,{align:`end`,className:`w-64 p-4`,children:(0,G.jsxs)(`div`,{className:`grid gap-3`,children:[e.map(e=>{let t=n(e),r=t&&o<=1;return(0,G.jsxs)(`label`,{className:`flex items-center gap-2 text-base text-lt-fg`,children:[(0,G.jsx)(va,{"data-test":`table-column-toggle-${e.key}`,checked:t,disabled:r,onCheckedChange:t=>i(e.key,t===!0)}),(0,G.jsx)(`span`,{children:e.props.label??e.key})]},e.key)}),t&&(0,G.jsx)(`button`,{type:`button`,"data-test":`table-columns-reset`,className:`mt-1 justify-self-start text-sm text-lt-muted-fg hover:text-lt-fg`,onClick:r,children:s(`table.columns.reset`,`Reset`)})]})})]})}function Ku({clauses:e,columnsByKey:t,indicators:n,processing:r,onRemoveClause:i,onChange:a,onReset:o}){let{t:s}=z(`lattice`);return e.length===0&&n.length===0?null:(0,G.jsx)(`div`,{className:`border-b border-lt-border px-4 py-3`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[e.map((e,n)=>{let a=t.get(e.field)?.props.label??e.field,o=au.has(e.operator);return(0,G.jsx)(qu,{label:`${a} ${ou(e.operator)}`,value:o?``:e.value,removeTestId:`filter-chip-${e.field}-remove`,removeLabel:s(`table.filter.remove`,`Remove {{label}} filter`,{label:a}),processing:r,onRemove:()=>i(n)},`${e.field}-${e.operator}-${n}`)}),n.map(e=>(0,G.jsx)(qu,{label:e.label,value:e.value,removeTestId:`table-filter-chip-${e.filter}-remove`,removeLabel:s(`table.filter.remove`,`Remove {{label}} filter`,{label:e.label}),processing:r,onRemove:()=>a(e.filter,void 0)},`${e.filter}:${e.label}:${e.value}`)),(0,G.jsx)(`button`,{type:`button`,"data-test":`table-filters-reset`,className:`text-lt-muted-fg underline-offset-2 hover:underline disabled:text-lt-disabled-fg`,disabled:r,onClick:o,children:s(`table.filter.reset-all`,`Reset all`)})]})})}function qu({label:e,value:t,removeTestId:n,removeLabel:r,processing:i,onRemove:a}){return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-lt-sm bg-lt-muted px-2 py-1`,children:[(0,G.jsx)(`span`,{children:t===``?(0,G.jsx)(`span`,{className:`font-semibold`,children:e}):(0,G.jsxs)(G.Fragment,{children:[`${e}: `,(0,G.jsx)(`span`,{className:`font-semibold`,children:t})]})}),(0,G.jsx)(gt,{size:`xs`,icon:`x`,label:r,"data-test":n,disabled:i,onClick:a})]})}function Ju({filters:e,values:t,processing:n,onChange:r,onSearch:i}){let{t:a}=z(`lattice`),o=e.filter(e=>Al(t[e.key])),s=a(`table.filter.filters`,`Filters`);return(0,G.jsxs)(xt,{children:[(0,G.jsx)(Je,{asChild:!0,children:(0,G.jsx)(gt,{size:`sm`,icon:`filter`,label:s,"data-test":`table-filters-menu`,disabled:n,children:o.length>0&&(0,G.jsx)(`span`,{className:`absolute -right-1 -top-1 inline-flex size-3.5 items-center justify-center rounded-full bg-lt-primary text-[10px] font-medium leading-none text-lt-primary-fg`,children:o.length})})}),(0,G.jsx)(wt,{align:`end`,className:`w-80 p-4`,children:(0,G.jsx)(`div`,{className:`grid gap-3`,children:e.map(e=>(0,G.jsx)(`div`,{className:`grid gap-1`,children:(0,G.jsx)(Au,{filter:e,value:t[e.key],processing:n,onChange:t=>r(e.key,t),onSearch:i?(t,n,r)=>i(`filter:${e.key}.${t}`,n,r):void 0})},e.key))})})]})}function Yu({pagination:e,currentPage:t,processing:n,mode:r,hasNextPage:i,visiblePages:a,infiniteLoaderRef:o,perPageOptions:s,perPageValue:c,onPerPage:l,onPage:u,onLoadMore:d}){let{t:f}=z(`lattice`);return(0,G.jsxs)(`div`,{"data-slot":`table-pagination`,className:`flex items-center justify-between gap-3 border-t border-lt-border p-4 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,G.jsx)(`span`,{children:e.total==null?f(`table.pagination.page`,`Page {{page}}`,{page:t}):f(`table.pagination.showing`,`Showing {{from}}-{{to}} of {{total}}`,{from:e.from??0,to:e.to??0,total:e.total})}),s.length>0&&r!==`none`&&(0,G.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-lt-muted-fg`,children:f(`table.pagination.per-page`,`Rows per page`)}),(0,G.jsx)(Ou,{"data-test":`pagination-per-page`,disabled:n,value:String(c),onChange:e=>l(e.target.value===`infinite`?`infinite`:Number(e.target.value)),children:s.map(e=>(0,G.jsx)(`option`,{value:String(e),children:e===`infinite`?f(`table.pagination.infinite`,`Infinite`):e},String(e)))})]})]}),r===`infinite`?(0,G.jsx)(`div`,{ref:o,className:`flex items-center gap-2`,children:e.hasMore?(0,G.jsx)(E,{emphasis:`outline`,"data-test":`pagination-load-more`,disabled:n,onClick:d,children:n?f(`table.pagination.loading`,`Loading...`):f(`table.pagination.load-more`,`Load more`)}):(0,G.jsx)(`span`,{className:`text-lt-muted-fg`,children:f(`table.pagination.all-loaded`,`All rows loaded`)})}):r===`simple`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(E,{emphasis:`outline`,"data-test":`pagination-previous`,disabled:n||t<=1,onClick:()=>u(t-1),children:f(`table.pagination.previous`,`Previous`)}),(0,G.jsx)(E,{emphasis:`outline`,"data-test":`pagination-next`,disabled:n||!i,onClick:()=>u(t+1),children:f(`table.pagination.next`,`Next`)})]}):r===`table`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(E,{emphasis:`outline`,"data-test":`pagination-previous`,disabled:n||t<=1,onClick:()=>u(t-1),children:f(`table.pagination.previous`,`Previous`)}),a.map(e=>(0,G.jsx)(E,{emphasis:`outline`,size:`icon`,"data-test":`pagination-page-${e}`,disabled:n||e===t,"aria-current":e===t?`page`:void 0,"aria-label":f(`table.pagination.page`,`Page {{page}}`,{page:e}),onClick:()=>u(e),children:e},e)),(0,G.jsx)(E,{emphasis:`outline`,"data-test":`pagination-next`,disabled:n||!i,onClick:()=>u(t+1),children:f(`table.pagination.next`,`Next`)})]}):null]})}function Xu({columnsByKey:e,query:t,processing:n,onClear:r}){let{t:i}=z(`lattice`);return(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-4 border-b border-lt-border px-4 py-2.5 text-sm`,children:t.sorts.map((t,a)=>{let o=e.get(t.key)?.props.label??t.key,s=t.direction===`desc`?`arrow-down`:`arrow-up`;return(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`${a+1}. ${o}`}),(0,G.jsx)(x,{name:s,role:`img`,"aria-hidden":!1,"aria-label":su(t.direction),className:`size-lt-icon-sm text-lt-muted-fg`}),(0,G.jsx)(gt,{size:`xs`,icon:`x`,label:i(`table.sort.clear`,`Clear {{label}} sort`,{label:o}),"data-test":`clear-${t.key}-sort`,disabled:n,onClick:()=>r(t)})]},t.key)})})}var Zu=300;function Qu({value:e,onSearch:t}){let{t:n}=z(`lattice`),[r,i]=(0,U.useState)(e),a=(0,U.useRef)(e);(0,U.useEffect)(()=>{e!==a.current&&(a.current=e,i(e))},[e]);function o(e){a.current=e,t(e)}let s=Vr(o,Zu);function c(e){i(e),s(e)}function l(){s.cancel(),i(``),o(``)}let u=n(`table.search.placeholder`,`Search`);return(0,G.jsxs)(`div`,{className:`relative w-full max-w-xs`,children:[(0,G.jsx)(x,{name:`search`,"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 top-1/2 size-lt-icon-sm -translate-y-1/2 text-lt-muted-fg`}),(0,G.jsx)(T,{type:`search`,"data-test":`table-search`,value:r,placeholder:u,"aria-label":u,onChange:e=>c(e.target.value),className:_(`px-8`,`[&::-webkit-search-cancel-button]:hidden`)}),r!==``&&(0,G.jsx)(gt,{size:`xs`,icon:`x`,label:n(`table.search.clear`,`Clear search`),"data-test":`table-search-clear`,className:`absolute right-1.5 top-1/2 -translate-y-1/2`,onClick:l})]})}var $u=`table.columns`;function ed(){return c($u)}function td(e){return e}function nd({color:e,className:t,style:n,...r}){let i=ie(F(e??void 0)??ne(`gray`));return(0,G.jsx)(`span`,{"data-slot":`badge`,className:_(`lt-badge`,i.className,t),style:{...i.style,...n},...r})}function rd(e,t,n){if(e==null)return``;let r=t?.props?.date;return r?_e(e,r,n):typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function id(e,t,n){let r=e.props.link;if(!r)return null;let i=r.href??String(n??``);return i===``?null:i.replace(/\{([^}]+)\}/g,(e,r)=>encodeURIComponent(String(r===`value`?n??``:t[r]??``)))}var ad=({column:e,props:t,value:n})=>{let r=rd(n,e);return r===``?null:(0,G.jsx)(nd,{color:t.colors?.[String(n)],children:r})},od=({value:e})=>{let{t}=z(`lattice`),n=ku(e);return(0,G.jsx)(`span`,{"aria-label":n?t(`common.yes`,`Yes`):t(`common.no`,`No`),role:`img`,children:(0,G.jsx)(x,{name:n?`check`:`x`,className:_(`size-lt-icon-md`,n?`text-lt-success`:`text-lt-muted-fg`)})})},sd=({props:e,value:t})=>{let n=e.icons?.[String(t)]??e.icon??void 0;if(!n)return null;let r=F(e.colors?.[String(t)]),i=r?ie(r):void 0;return(0,G.jsx)(`span`,{"aria-label":String(t),className:_(`lt-cell-icon`,i?.className),style:i?.style,children:(0,G.jsx)(K,{className:`size-lt-icon-md`,icon:n})})};function cd({src:e,alt:t,previewable:n,width:r,height:i,className:a,testId:o}){let{t:s}=z(me),[c,l]=(0,U.useState)(!1),u=(0,G.jsx)(`img`,{alt:t,src:e,width:r,height:i,className:a,style:r?{width:r,height:i}:void 0});if(!n)return u;let d=s(`common.image.open-preview`,`View image`);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,"data-test":o,className:`cursor-zoom-in`,"aria-label":d,onClick:()=>l(!0),children:u}),(0,G.jsx)(Fn,{open:c,onOpenChange:l,children:(0,G.jsxs)(zn,{"aria-describedby":void 0,className:`max-h-[90vh] w-auto max-w-[90vw] border-none bg-transparent p-0 shadow-none`,children:[(0,G.jsx)(Ln,{className:`sr-only`,children:t||d}),(0,G.jsx)(`img`,{alt:t,src:e,"data-slot":`image-lightbox`,className:`max-h-[90vh] max-w-[90vw] rounded-lt object-contain`}),(0,G.jsx)(In,{asChild:!0,children:(0,G.jsx)(E,{icon:`x`,"aria-label":s(`common.close`,`Close`),"data-test":`lightbox-close`,size:`icon`,emphasis:`ghost`,className:`absolute top-2 right-2 bg-lt-bg/80 hover:bg-lt-bg`})})]})})]})}var ld=({column:e,props:t,value:n})=>{let r=typeof n==`string`?n:``;if(r===``)return null;let i=t.size??32;return(0,G.jsx)(cd,{alt:e.props.label??``,className:_(`object-cover`,t.circular?`rounded-full`:`rounded-lt-sm`),height:i,previewable:t.previewable,src:r,testId:`preview-${e.key}`,width:i})};function ud({children:e,column:t,copyable:n,value:r}){return n?(0,G.jsx)(fs,{value:r,label:t.props.label??t.key,testId:`copy-${t.key}`,children:e}):e}function dd({column:e,copyable:t,format:n,value:r}){let{locale:i}=L();return re(r)===null?(0,G.jsx)(`span`,{children:rd(r,e)}):(0,G.jsx)(ud,{column:e,copyable:t,value:String(r),children:(0,G.jsx)(`span`,{className:`tabular-nums`,children:te(r,n,i)})})}var fd=({column:e,props:t,row:n,value:r})=>{let i=t.currencyField?n[t.currencyField]:void 0,a=t.currency??(typeof i==`string`?i:null);return(0,G.jsx)(dd,{column:e,copyable:t.copyable,value:r,format:{kind:`number`,notation:`standard`,minimumFractionDigits:t.minimumFractionDigits,maximumFractionDigits:t.maximumFractionDigits,currency:a,unit:null}})},pd=({column:e,props:t,value:n})=>(0,G.jsx)(dd,{column:e,copyable:t.copyable,value:n,format:{kind:`number`,notation:t.compact?`compact`:`standard`,minimumFractionDigits:t.minimumFractionDigits,maximumFractionDigits:t.maximumFractionDigits,currency:null,unit:t.unit}}),md=({column:e,row:t})=>(0,G.jsx)(`div`,{className:`grid gap-1`,children:(0,G.jsx)(Y,{nodes:r(e.schema,t)})}),hd=e=>e.props.multiple?(0,G.jsx)(_d,{...e}):e.props.badge?(0,G.jsx)(vd,{...e}):(0,G.jsx)(yd,{...e});function gd({label:e,color:t}){return e===``?null:(0,G.jsx)(nd,{color:t,children:e})}function _d({column:e,props:t,value:n}){let r=Array.isArray(n)?n:[];return r.length===0?null:t.badge?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map((t,n)=>{let r=t;return(0,G.jsx)(gd,{label:rd(r.value,e),color:r.color},n)})}):(0,G.jsx)(`span`,{children:r.map(t=>rd(t,e)).join(`, `)})}function vd({column:e,props:t,row:n,value:r}){let i=t.badge.colorKey;return(0,G.jsx)(gd,{label:rd(r,e),color:String(n[i]??``)})}function yd({column:e,props:t,row:n,value:r}){let i=e.props.date,a=id(e,n,r),o=rd(r,e),s=a?(0,G.jsx)(`a`,{className:`underline underline-offset-2`,href:a,rel:t.link?.external?`noreferrer`:void 0,target:t.link?.external?`_blank`:void 0,children:o}):o;return i&&!a&&!t.copyable&&r!=null?(0,G.jsx)($t,{value:r,dateStyle:i.dateStyle,timeStyle:i.timeStyle}):(0,G.jsx)(ud,{column:e,copyable:t.copyable,value:o,children:s})}var bd={"column.badge":td(ad),"column.boolean":td(od),"column.icon":td(sd),"column.image":td(ld),"column.money":td(fd),"column.number":td(pd),"column.stack":td(md),"column.text":td(hd)};function xd({column:e,row:t}){let n=ed()[e.type]??bd[e.type]??bd[`column.text`];return(0,G.jsx)(n,{column:e,props:e.props,row:t,value:t[e.key]})}var Sd={components:{table:W(({node:e})=>{let{t}=z(`lattice`),{columns:n,rows:r,pagination:i,query:a,filters:o,tableFilters:s,search:c,addFilter:l,updateFilter:u,removeFilter:d,replaceColumnFilters:f,setTableFilter:p,resetFilters:m,setSearch:h,searchFilterOptions:g,processing:v,hasLoaded:y,infiniteLoaderRef:b,sort:S,clearSort:C,goToPage:w,setPerPage:T,loadMore:E}=pu(e),D=(0,U.useMemo)(()=>Eu(e.props?.bulkActions),[e.props?.bulkActions]),O=D.length>0,k=(0,U.useMemo)(()=>r.map((e,t)=>({row:e,actions:Gl(e),detail:Kl(e),key:Wl(e,t)})),[r]),A=mu(k.map(e=>e.key)),{isExpanded:j,toggle:ee}=yu(),M=k.some(e=>e.detail!=null),P=(0,U.useMemo)(()=>new Map(n.map(e=>[e.key,e])),[n]),F=N(e),{hasToggleableColumns:I,hasHidden:te,isVisible:ne,resetVisibility:re,setColumnVisible:ie,toggleableColumns:ae,visibleColumns:L}=hu({columns:n,storageKey:F?`lattice:table-column-visibility:${F}`:void 0}),oe=i.currentPage??a.page,se=i.lastPage??oe,R=i.mode??`table`,ce=(0,U.useMemo)(()=>Vl(e.props?.perPageOptions),[e.props?.perPageOptions]),le=lu(oe,se),ue=i.hasMore??oe<se,de=k.some(e=>e.actions.length>0),fe=e.props?.striped===!0,pe=L.some(e=>e.props.filter!=null),me=o.map((e,t)=>({clause:e,index:t})),he=(0,U.useMemo)(()=>Array.isArray(e.props?.filters)?e.props.filters:[],[e.props?.filters]),ge=he.length>0,_e=de,ve=(0,U.useMemo)(()=>Array.isArray(e.props?.toolbar)?e.props.toolbar:[],[e.props?.toolbar]),ye=(0,U.useMemo)(()=>uu(L),[L]),be=(0,U.useMemo)(()=>fu(_e,O,M),[_e,O,M]),xe=e.props?.resizableColumns===!0,Se=N(e),{getResizeHandleProps:Ce,gridTemplateColumns:we,hasOverrides:Te,resizeRootRef:Ee,resetColumns:De}=Ai({columns:ye,enabled:xe,leadingTracks:be.leadingTracks,showIndicator:e.props?.resizeIndicator===!0,storageKey:xe&&Se?`lattice:table-columns:${Se}`:void 0,trailingTracks:be.trailingTracks}),Oe=e.props?.searchable===!0||ve.length>0||ge||I||Te;return(0,G.jsx)(`div`,{"data-slot":`table`,"data-lattice-component":e.id,className:`relative`,children:(0,G.jsxs)(`div`,{"data-slot":`table-scroll`,className:`overflow-x-auto rounded-lt-sm border border-lt-border`,children:[Oe&&(0,G.jsxs)(`div`,{"data-slot":`table-toolbar`,className:`flex items-center gap-2 border-b border-lt-border px-4 py-2`,children:[e.props?.searchable&&(0,G.jsx)(Qu,{value:c,onSearch:h}),(0,G.jsxs)(`div`,{className:`ms-auto flex items-center gap-1`,children:[ge&&(0,G.jsx)(Ju,{filters:he,values:s,processing:v,onChange:p,onSearch:g}),I&&(0,G.jsx)(Gu,{columns:ae,isVisible:ne,visibleColumnCount:L.length,hasHidden:te,onToggle:ie,onReset:re,processing:v}),Te&&(0,G.jsx)(`button`,{"aria-label":t(`table.reset-column-widths`,`Reset column widths`),className:`hidden rounded-lt-sm p-1 text-lt-muted-fg hover:text-lt-fg md:inline-flex`,"data-test":`table-reset-columns`,onClick:De,title:t(`table.reset-column-widths`,`Reset column widths`),type:`button`,children:(0,G.jsx)(x,{name:`rotate-ccw`,className:`size-lt-icon-sm`})}),ve.map((e,t)=>(0,G.jsx)(X,{node:e},e.key??e.id??t))]})]}),(0,G.jsx)(Ku,{clauses:o,columnsByKey:P,indicators:a.tableFilterIndicators,processing:v,onRemoveClause:d,onChange:p,onReset:m}),O&&A.active&&(0,G.jsx)(Du,{actions:D,selectedKeys:A.selectedKeys,allMatching:A.allMatching,total:i.total??void 0,query:tu(a),canSelectAllMatching:A.allVisibleSelected&&!A.allMatching&&i.total!=null&&i.total>A.selectedKeys.length,onSelectAllMatching:A.selectAllMatching,onCompleted:A.clear}),a.sorts.length>0&&(0,G.jsx)(Xu,{columnsByKey:P,query:a,processing:v,onClear:C}),(0,G.jsxs)(`div`,{ref:Ee,className:`min-w-full text-base`,role:`table`,style:{"--lattice-table-columns":we},children:[(0,G.jsxs)(`div`,{"data-slot":`table-header`,className:`border-b border-lt-border bg-lt-muted/50`,role:`rowgroup`,children:[(0,G.jsxs)(`div`,{className:`hidden min-w-full md:grid md:grid-cols-[var(--lattice-table-columns)]`,role:`row`,children:[M&&(0,G.jsx)(`div`,{className:`px-2 py-3`,role:`columnheader`,"aria-hidden":`true`}),O&&(0,G.jsx)(`div`,{className:`flex items-center px-4 py-3`,role:`columnheader`,children:(0,G.jsx)(va,{"aria-label":t(`table.select-all-rows`,`Select all rows`),"data-test":`select-all`,checked:A.allSelected,onCheckedChange:()=>A.toggleAll()})}),L.map((e,t)=>(0,G.jsx)(Wu,{column:e,processing:v,resizeHandleProps:xe?Ce(ye[t]):void 0,sort:S,query:a},e.key)),_e&&(0,G.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-4 py-2 align-middle font-semibold text-lt-fg`,role:`columnheader`,children:(0,G.jsx)(`span`,{className:`sr-only`,children:e.props?.actionsLabel??t(`table.actions`,`Actions`)})})]}),pe&&(0,G.jsxs)(`div`,{className:`hidden min-w-full border-t border-lt-border md:grid md:grid-cols-[var(--lattice-table-columns)]`,role:`row`,children:[M&&(0,G.jsx)(`div`,{className:`px-2 py-2`,role:`cell`}),O&&(0,G.jsx)(`div`,{className:`px-4 py-2`,role:`cell`}),L.map(e=>(0,G.jsx)(`div`,{className:`min-w-0 px-2 py-2`,role:`cell`,children:e.props.filter!=null&&(0,G.jsx)(Fu,{column:e,clauses:me.filter(t=>t.clause.field===e.key),processing:v,onAdd:l,onUpdate:u,onRemove:d,onReplace:f,onSearch:(t,n)=>g(`column:${e.key}`,t,n)})},e.key)),_e&&(0,G.jsx)(`div`,{className:`px-4 py-2`,role:`cell`})]})]}),(0,G.jsx)(`div`,{role:`rowgroup`,children:y?k.length===0?(0,G.jsx)(`div`,{"data-slot":`table-empty`,className:`p-8 text-center text-lt-muted-fg`,role:`row`,children:(0,G.jsx)(`div`,{role:`cell`,children:e.props?.emptyLabel??t(`table.empty`,`No results`)})}):k.map(({row:n,actions:r,detail:i,key:a})=>{let o=i!=null&&j(a),s=`${N(e)??`table`}-row-detail-${a}`;return(0,G.jsxs)(U.Fragment,{children:[(0,G.jsxs)(`div`,{"data-slot":`table-row`,className:`grid grid-cols-1 border-b border-lt-border last:border-b-0 md:grid-cols-[var(--lattice-table-columns)] ${fe?`odd:bg-lt-muted/30`:``}`,role:`row`,children:[M&&(0,G.jsx)(`div`,{className:`flex items-center px-2 py-lt-cell-y`,role:`cell`,children:i&&(0,G.jsx)(`button`,{type:`button`,"data-test":`row-expand-${a}`,"aria-expanded":o,"aria-controls":s,"aria-label":t(`table.row-detail.toggle`,`Toggle detail`),className:`inline-flex size-6 items-center justify-center rounded-lt-sm text-lt-muted-fg hover:bg-lt-muted hover:text-lt-fg`,onClick:()=>ee(a),children:(0,G.jsx)(x,{name:`chevron-down`,"aria-hidden":`true`,className:_(`size-lt-icon-md transition-transform`,!o&&`-rotate-90`)})})}),O&&(0,G.jsx)(`div`,{className:`flex items-center px-lt-cell-x py-lt-cell-y`,role:`cell`,children:(0,G.jsx)(va,{"aria-label":t(`table.select-row`,`Select row {{key}}`,{key:a}),"data-test":`select-row-${a}`,checked:A.isSelected(a),onCheckedChange:()=>A.toggle(a)})}),L.map(e=>(0,G.jsxs)(`div`,{"data-slot":`table-cell`,className:_(`grid min-w-0 content-center gap-1 overflow-hidden px-lt-cell-x py-lt-cell-y`,Cu(e.props.align),Tu(e.props.align)),role:`cell`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs font-medium text-lt-muted-fg md:hidden`,children:e.props.label}),(0,G.jsx)(`div`,{"data-slot":`table-cell-content`,className:`min-w-0 max-w-full overflow-hidden truncate`,children:(0,G.jsx)(xd,{column:e,row:n})})]},e.key)),_e&&(0,G.jsx)(`div`,{className:_(`items-center justify-start gap-2 px-lt-cell-x py-lt-cell-y md:justify-end`,r.length>0?`flex`:`hidden md:flex`),role:`cell`,children:r.map((e,t)=>(0,G.jsx)(X,{node:e},e.key??e.id??t))})]}),o&&i&&(0,G.jsx)(`div`,{id:s,role:`region`,"data-slot":`table-row-detail`,className:`border-b border-lt-border bg-lt-muted/20 px-lt-cell-x py-lt-cell-y`,children:(0,G.jsx)(Y,{nodes:[i]})})]},a)}):(0,G.jsx)(`div`,{className:`p-4 text-lt-muted-fg`,role:`row`,children:(0,G.jsx)(`div`,{role:`cell`,children:t(`table.loading`,`Loading rows...`)})})})]}),y&&(0,G.jsx)(Yu,{pagination:i,currentPage:oe,processing:v,mode:R,hasNextPage:ue,visiblePages:le,infiniteLoaderRef:b,perPageOptions:ce,perPageValue:R===`infinite`?`infinite`:a.perPage,onPerPage:T,onPage:w,onLoadMore:E})]})})})},name:`lattice/table`};function Cd({className:e,...t}){return(0,G.jsx)(`article`,{"data-slot":`card`,className:_(`flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm`,e),...t})}function wd({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-header`,className:_(`flex flex-col gap-1.5 px-lt-gutter`,e),...t})}function Td({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-title`,className:_(`font-semibold leading-none`,e),...t})}function Ed({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-description`,className:_(`text-sm text-lt-muted-fg`,e),...t})}function Dd({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-content`,className:_(`px-lt-gutter`,e),...t})}var Od=({children:e,node:t})=>{let{title:n,description:r,tooltip:i,headerActions:a}=t.props,o=a??[];return(0,G.jsxs)(Cd,{"data-lattice-component":N(t),children:[(n||r||o.length>0)&&(0,G.jsxs)(wd,{children:[(n||o.length>0)&&(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center`,children:[n&&(0,G.jsx)(Td,{children:n}),n&&(0,G.jsx)(ft,{content:i})]}),o.length>0&&(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:o.map((e,t)=>(0,G.jsx)(X,{node:e},e.key??e.id??t))})]}),r&&(0,G.jsxs)(`div`,{className:`flex items-center`,children:[(0,G.jsx)(Ed,{children:r}),!n&&(0,G.jsx)(ft,{content:i})]})]}),e&&(0,G.jsx)(Dd,{className:`flex flex-col gap-6`,children:e})]})},kd=(0,U.lazy)(()=>kt(()=>import(`./code-block-view-CetAq3Rk.js`),__vite__mapDeps([19,1,2,6,15]),import.meta.url));function Ad({"aria-label":e,children:t,className:n,copyable:r=!1,language:i=`text`,lineNumbers:a=!1,maxHeight:o=null,role:s=e?`region`:void 0,wrap:c=!1,...l}){let u=(0,G.jsx)(`pre`,{className:_(`max-w-full overflow-auto p-3 font-lt-mono text-xs`,c&&`whitespace-pre-wrap wrap-anywhere`),style:{maxHeight:o??void 0},children:a?(0,G.jsx)(`code`,{className:`grid grid-cols-[auto_1fr]`,children:t.split(`
|
|
23
|
+
`).map((e,t)=>(0,G.jsxs)(U.Fragment,{children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`mr-3 border-r border-lt-border pr-3 text-right text-lt-muted-fg select-none`,children:t+1}),(0,G.jsx)(`span`,{children:e||``})]},t))}):t});return(0,G.jsxs)(`div`,{"data-slot":`code-block`,"aria-label":e,role:s,...l,className:_(`relative max-w-full overflow-hidden rounded-lt-sm bg-lt-muted text-lt-fg`,n),children:[r?(0,G.jsx)(ds,{value:t,label:e??`code`,iconOnly:!0,className:`absolute top-3 right-6 z-10 bg-lt-bg/80 hover:bg-lt-bg`}):null,(0,G.jsx)(U.Suspense,{fallback:u,children:(0,G.jsx)(kd,{language:i,lineNumbers:a,maxHeight:o,wrap:c,children:t})})]})}var jd=({node:e})=>(0,G.jsx)(Ad,{copyable:e.props.copyable,language:e.props.language,lineNumbers:e.props.lineNumbers,maxHeight:e.props.maxHeight,wrap:e.props.wrap,children:e.props.code});function Md(){let e=le();(0,U.useEffect)(()=>s.on(`flash`,t=>{let n=de(t.detail?.flash?.latticeEffects);n.length>0&&e(n)}),[e])}var Nd={xs:`size-6 text-[0.5rem]`,sm:`size-8 text-xs`,md:`size-10 text-sm`,lg:`size-12 text-base`,xl:`size-16 text-lg`,"2xl":`size-20 text-xl`,"3xl":`size-24 text-2xl`,"4xl":`size-32 text-3xl`};function Pd(e){return e.trim().split(/\s+/).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)}function Fd(){return(0,G.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,className:`size-[60%]`,children:[(0,G.jsx)(`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`}),(0,G.jsx)(`circle`,{cx:`12`,cy:`7`,r:`4`})]})}var Id=({node:e})=>{let{src:t,name:n,size:r}=e.props,i=n??void 0;return(0,G.jsx)(`span`,{"data-slot":`avatar`,role:t?void 0:`img`,"aria-label":t?void 0:i,className:_(`inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-lt-muted font-medium text-lt-muted-fg select-none`,Nd[r]),children:t?(0,G.jsx)(`img`,{src:t,alt:i??``,className:`size-full object-cover`}):n?Pd(n):(0,G.jsx)(Fd,{})})},Ld=({node:e})=>(0,G.jsx)(nd,{color:e.props.color,children:e.props.label}),Rd=(0,U.lazy)(()=>kt(()=>import(`./chart-view-DghsYabe.js`),__vite__mapDeps([20,1,2,21,11,3,5,6,22,8,13,16]),import.meta.url)),zd=({children:e,node:t})=>(0,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(Rd,{node:t,children:e})}),Bd=({children:e,node:t})=>{let n=t.props.rememberState!==!1,r=_r(t.props.trigger),i=N(t),a=`lattice:collapsible:${i??`default`}`,o=`${i??`collapsible`}-content`,[s,c]=al(a,t.props.collapsed===!1,n);return(0,G.jsxs)(`div`,{"data-slot":`collapsible`,"data-lattice-component":i,children:[(0,G.jsxs)(`div`,{"aria-controls":o,"aria-expanded":s,"data-test":ae(`collapsible-toggle`,i)??`collapsible-toggle-default`,className:`flex w-full cursor-pointer items-center justify-between gap-4 rounded-lt-sm py-2 text-left text-lt-fg transition-colors hover:bg-lt-muted`,onClick:c,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),c())},role:`button`,tabIndex:0,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,G.jsx)(Y,{nodes:r}),t.props.tooltip&&(0,G.jsx)(`span`,{role:`presentation`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,G.jsx)(ft,{content:t.props.tooltip})})]}),(0,G.jsx)(x,{name:`chevron-down`,className:_(`size-lt-icon-md shrink-0 text-lt-muted-fg transition-transform`,!s&&`-rotate-90`)})]}),s&&e&&(0,G.jsx)(`div`,{id:o,className:`flex flex-col gap-4 pt-2`,children:e})]})};function Vd(e,t){return e===`top-start`?{left:t,top:t}:e===`top-end`?{right:t,top:t}:e===`bottom-start`?{bottom:t,left:t}:{bottom:t,right:t}}var Hd=({children:e,node:t})=>{let n=t.props.label??void 0,r=Math.max(0,t.props.offset??16),i=t.props.placement??`bottom-end`,a=t.props.trigger??[],[o,s]=(0,U.useState)(!1);if(a.length===0)return(0,G.jsx)(`div`,{"aria-label":n,className:`fixed z-lt-popover max-w-[calc(100vw-2rem)] rounded-lt border border-lt-border bg-lt-popover p-1 text-lt-popover-fg shadow-lt-md`,"data-lattice-component":N(t),role:n?`group`:void 0,style:Vd(i,r),children:e});let c=i===`bottom-start`||i===`bottom-end`,l=i===`top-start`||i===`bottom-start`;return(0,G.jsx)(`div`,{"aria-label":n,className:`fixed z-lt-popover max-w-[calc(100vw-2rem)]`,"data-lattice-component":N(t),role:n?`group`:void 0,style:Vd(i,r),children:(0,G.jsxs)(`div`,{className:_(`flex w-fit gap-2`,c?`flex-col-reverse`:`flex-col`),children:[(0,G.jsx)(`button`,{"aria-expanded":o,className:_(`inline-flex items-center gap-2 rounded-lt border border-lt-border bg-lt-popover px-3 py-1.5 text-sm font-medium text-lt-popover-fg shadow-lt-md hover:bg-lt-muted`,l?`self-start`:`self-end`),"data-test":t.key?`${t.key}-trigger`:void 0,onClick:()=>s(e=>!e),type:`button`,children:a.map((e,t)=>(0,G.jsx)(X,{node:e},e.key??`${e.type}-${t}`))}),(0,G.jsx)(`div`,{className:o?`block`:`hidden`,children:e})]})})};function Ud(e,t,n){let r=Object.entries(e??{});if(r.length!==0)return Object.fromEntries(r.map(([e,r])=>[`${t}-${e}`,n(r)]))}var Wd=e=>typeof e==`number`?`repeat(${e}, minmax(0, 1fr))`:e,Gd=e=>e===`full`?`1 / -1`:`span ${e} / span ${e}`,Kd=({node:e})=>(0,G.jsx)(`div`,{"data-slot":`grid`,"data-lattice-component":N(e),className:`lt-grid grid gap-x-4 gap-y-6`,style:Ud(e.props.columns,`--lt-grid-cols`,Wd),children:(e.schema??[]).map((e,t)=>(0,G.jsx)(`div`,{"data-slot":`grid-item`,style:Ud(e.props?.columnSpan,`--lt-col-span`,Gd),children:(0,G.jsx)(X,{node:e})},vr(e,t)))}),qd=({node:e})=>{let{text:t,tooltip:n}=e.props,r=Math.min(Math.max(e.props.level,1),6),i=_(`max-w-3xl font-semibold tracking-normal text-balance text-lt-fg`,r===1&&`text-2xl font-bold leading-tight`,r===2&&`text-xl`,r>2&&`text-base`),a=(0,G.jsxs)(G.Fragment,{children:[t,(0,G.jsx)(ft,{content:n})]}),o;switch(r){case 1:o=(0,G.jsx)(`h1`,{className:i,children:a});break;case 2:o=(0,G.jsx)(`h2`,{className:i,children:a});break;case 3:o=(0,G.jsx)(`h3`,{className:i,children:a});break;case 4:o=(0,G.jsx)(`h4`,{className:i,children:a});break;case 5:o=(0,G.jsx)(`h5`,{className:i,children:a});break;default:o=(0,G.jsx)(`h6`,{className:i,children:a})}return e.props.copyable?(0,G.jsx)(fs,{value:t,label:t,children:o}):o},Jd={xs:`size-lt-icon-xs`,sm:`size-lt-icon-sm`,md:`size-lt-icon-md`,lg:`size-lt-icon-lg`,xl:`size-lt-icon-xl`,"2xl":`size-lt-icon-2xl`,"3xl":`size-lt-icon-3xl`,"4xl":`size-lt-icon-4xl`},Yd=({node:e})=>{let{name:t,size:n,color:r,class:i}=e.props,a=(0,G.jsx)(K,{icon:t,className:_(Jd[n],i)}),o=F(r);return o?(0,G.jsx)(`span`,{className:`contents`,style:{color:M(o)},children:a}):a},Xd=({node:e})=>{let{src:t,alt:n,size:r,circular:i,previewable:a}=e.props;return(0,G.jsx)(cd,{alt:n??``,className:_(`object-cover`,i?`rounded-full`:`rounded-lt-sm`),height:r??void 0,previewable:a,src:t,testId:N(e),width:r??void 0})},Zd=`text-lt-fg underline decoration-lt-border underline-offset-4 transition-colors duration-300 ease-out hover:decoration-current! dark:decoration-lt-border`;function Qd({affix:e,className:t}){return e.icon?(0,G.jsx)(K,{className:_(`size-lt-icon-md shrink-0`,t),icon:e.icon}):(0,G.jsx)(`span`,{className:_(`shrink-0 text-sm text-lt-muted-fg`,t),children:e.text})}function $d({icon:e,isMenuItem:t,label:n,prefix:r,suffix:i}){return e?(0,G.jsx)(K,{className:`size-lt-icon-md shrink-0`,icon:e}):t?(0,G.jsxs)(G.Fragment,{children:[r?(0,G.jsx)(Qd,{affix:r}):null,(0,G.jsx)(`span`,{children:n}),i?(0,G.jsx)(Qd,{affix:i,className:`ml-auto`}):null]}):r||i?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 align-baseline`,children:[r?(0,G.jsx)(Qd,{affix:r}):null,(0,G.jsx)(`span`,{children:n}),i?(0,G.jsx)(Qd,{affix:i}):null]}):n}function ef(e,t,n){if(!(!t?.text&&!n?.text))return[t?.text,e,n?.text].filter(e=>!!e).join(` `)}var tf=({node:e})=>{let t=on(),{icon:n,label:r,prefix:i,suffix:a}=e.props,o=r??``,s=Jt(e.props),c=t?rn:void 0,l=N(e),u=(0,G.jsx)($d,{icon:n,isMenuItem:t,label:o,prefix:i,suffix:a}),d=n?o:ef(o,i,a),f=({onClick:e,processing:t})=>(0,G.jsx)(`button`,{"aria-label":d,className:_(Zd,c),"data-test":l,disabled:t,onClick:e,type:`button`,children:u});return s.kind===`action`?(0,G.jsx)(qt,{action:s.action,children:f}):s.kind===`effects`?f({onClick:s.onClick,processing:!1}):(0,G.jsx)(et,{"aria-label":d,className:c,"data-test":l,href:s.kind===`navigate`?s.href:`#`,method:s.kind===`navigate`?s.method:`get`,tabIndex:e.props.tabIndex??void 0,children:u})};function nf(e,t){let n=e.detail?.modal;return n==null||n===t}var rf=({children:e,node:t})=>{let{t:n}=z(me),r=t.props.title??n(`common.dialog`,`Dialog`),i=t.props.description,a=t.props.closeLabel,[o,s]=(0,U.useState)(t.props.open===!0),c=(0,U.useRef)(null),l=(0,U.useRef)(o);return(0,U.useEffect)(()=>{t.props.open===!0&&s(!0)},[t.props.open]),(0,U.useEffect)(()=>{function e(e){t.id&&nf(e,t.id)&&(c.current=document.activeElement instanceof HTMLElement?document.activeElement:null,s(!0))}function n(e){(!t.id||nf(e,t.id))&&s(!1)}return window.addEventListener(R.openModal,e),window.addEventListener(R.closeModal,n),()=>{window.removeEventListener(R.openModal,e),window.removeEventListener(R.closeModal,n)}},[t.id]),(0,U.useEffect)(()=>{if(l.current&&!o){let e=c.current;e&&requestAnimationFrame(()=>e.focus())}l.current=o},[o]),(0,G.jsx)(Fn,{open:o,onOpenChange:s,children:(0,G.jsxs)(zn,{...i?{}:{"aria-describedby":void 0},placement:t.props.side??`center`,width:t.props.width,children:[(0,G.jsx)(Bn,{closeLabel:a,description:i,title:r}),(0,G.jsx)(`div`,{className:`mt-6 space-y-6`,children:e})]})})},af={xs:`h-1`,sm:`h-1.5`,md:`h-2.5`,lg:`h-3`,xl:`h-4`,"2xl":`h-5`,"3xl":`h-6`,"4xl":`h-8`},of={xs:24,sm:32,md:40,lg:48,xl:64,"2xl":80,"3xl":96,"4xl":128},sf={xs:`text-[0.5rem]`,sm:`text-[0.625rem]`,md:`text-xs`,lg:`text-sm`,xl:`text-base`,"2xl":`text-lg`,"3xl":`text-xl`,"4xl":`text-2xl`},cf=({node:e})=>{let{value:t,max:n,shape:r,showValue:i,color:a,size:o}=e.props,{locale:s}=L(),c=M(F(a)??ne(`primary`)),l=n>0?Math.min(Math.max(t,0),n):0,u=n>0?l/n:0,d=new Intl.NumberFormat(s,{maximumFractionDigits:0,style:`percent`}).format(u),f={"aria-valuemax":n,"aria-valuemin":0,"aria-valuenow":l,"aria-valuetext":d,role:`progressbar`};if(r===`circle`){let e=of[o],t=Math.max(3,e/10),n=(e-t)/2,r=2*Math.PI*n;return(0,G.jsxs)(`div`,{...f,className:`relative inline-flex`,"data-lattice-progress":`circle`,children:[(0,G.jsxs)(`svg`,{className:`-rotate-90`,height:e,width:e,children:[(0,G.jsx)(`circle`,{className:`text-lt-muted`,cx:e/2,cy:e/2,fill:`none`,r:n,stroke:`currentColor`,strokeWidth:t}),(0,G.jsx)(`circle`,{cx:e/2,cy:e/2,fill:`none`,r:n,stroke:`currentColor`,strokeDasharray:r,strokeDashoffset:r*(1-u),strokeLinecap:`round`,strokeWidth:t,style:{color:c}})]}),i&&(0,G.jsx)(`span`,{className:_(`absolute inset-0 flex items-center justify-center font-medium text-lt-fg tabular-nums`,sf[o]),children:d})]})}return(0,G.jsxs)(`div`,{className:`flex w-full items-center gap-2`,"data-lattice-progress":`bar`,children:[(0,G.jsx)(`div`,{...f,className:_(`w-full overflow-hidden rounded-full bg-lt-muted`,af[o]),children:(0,G.jsx)(`div`,{className:`h-full rounded-full`,style:{background:c,width:`${u*100}%`}})}),i&&(0,G.jsx)(`span`,{className:`shrink-0 text-lt-muted-fg text-sm tabular-nums`,children:d})]})},lf=({node:e})=>(0,G.jsx)(`span`,{style:{display:`contents`},dangerouslySetInnerHTML:{__html:e.props.html}}),uf=({children:e,node:t})=>{let{title:n,description:r,tooltip:i}=t.props,a=t.props.collapsible===!0,o=t.props.rememberState!==!1,s=_r(t.props.headerActions),c=N(t),[l,u]=al(`lattice:section:${c??`default`}`,t.props.collapsed===!0,a&&o),d=a&&l,f=!!(n||r||s.length>0||a);return(0,G.jsxs)(`section`,{"data-slot":`section`,className:`flex flex-col gap-6 rounded-lt border border-lt-border bg-lt-surface py-lt-gutter text-lt-surface-fg shadow-lt-sm`,"data-lattice-component":c,children:[f&&(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-lt-gutter`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[a&&(0,G.jsx)(`button`,{"aria-expanded":!d,"aria-label":d?`Expand section`:`Collapse section`,"data-test":ae(`section-toggle`,c)??`section-toggle-default`,className:`mt-0.5 inline-flex shrink-0 items-center rounded-lt-sm p-0.5 text-lt-muted-fg transition-colors hover:bg-lt-muted hover:text-lt-fg`,onClick:u,type:`button`,children:(0,G.jsx)(x,{name:`chevron-down`,className:_(`size-lt-icon-md transition-transform`,d&&`-rotate-90`)})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[n&&(0,G.jsxs)(`div`,{className:`flex items-center`,children:[(0,G.jsx)(`div`,{className:`font-semibold leading-none`,children:n}),(0,G.jsx)(ft,{content:i})]}),r&&(0,G.jsxs)(`div`,{className:`flex items-center`,children:[(0,G.jsx)(`div`,{className:`text-sm text-lt-muted-fg`,children:r}),!n&&(0,G.jsx)(ft,{content:i})]})]})]}),s.length>0&&(0,G.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:(0,G.jsx)(Y,{nodes:s})})]}),!d&&e&&(0,G.jsx)(`div`,{className:`flex flex-col gap-6 px-lt-gutter`,children:e})]})},df=({node:e})=>{let{options:t,name:n,emits:r}=e.props,[i,a]=(0,U.useState)(e.props.value||t[0]?.value||``);if(t.length===0)return null;function o(e){a(e),r&&window.dispatchEvent(new CustomEvent(r,{detail:{name:n,value:e}}))}return(0,G.jsx)(Ca,{ariaLabel:e.props.label??void 0,name:n,onSelect:o,options:t,value:i})},ff=({node:e})=>{let t=e.props.orientation===`horizontal`;return(0,G.jsx)(`div`,{role:`separator`,"aria-orientation":e.props.orientation,className:_(`shrink-0 bg-lt-border`,t?`h-px w-full`:`h-full w-px self-stretch`)})},pf={center:`justify-items-center text-center`,start:`justify-items-start text-left`,stretch:`justify-items-stretch`},mf={center:`items-center text-center`,start:`items-center text-left`,stretch:`items-stretch justify-stretch`},hf={none:`gap-0`,xs:`gap-1`,lg:`gap-6`,md:`gap-4`,sm:`gap-2`,xl:`gap-8`},gf={auto:`w-auto`,fill:`min-w-0 flex-1`,full:`w-full`,lg:`mx-auto w-full max-w-4xl`,md:`mx-auto w-full max-w-2xl`,sm:`mx-auto w-full max-w-md`},_f={around:`justify-around`,between:`justify-between`,center:`justify-center`,end:`justify-end`,evenly:`justify-evenly`,start:`justify-start`},vf={full:`h-full`,screen:`min-h-screen`},yf={end:`ml-auto`,start:`mr-auto`},bf=({children:e,node:t})=>{let n=t.props.align??`stretch`,r=t.props.direction??`column`,i=t.props.gap??`md`,a=t.props.width??`full`,o=t.props.justify,s=t.props.height,c=t.props.float,l=r===`row`||o!=null;return(0,G.jsx)(`div`,{"data-slot":`stack`,"data-lattice-component":N(t),className:_(l?_(`flex`,r===`row`?`flex-wrap`:`flex-col`):`grid content-start`,l?mf[n]??mf.stretch:pf[n]??pf.stretch,hf[i]??hf.md,gf[a]??gf.full,o?_f[o]:null,s?vf[s]:null,c?yf[c]:null),children:e})},xf=(0,U.createContext)(null);function Sf(){return(0,U.useContext)(xf)||{activeValue:``,setActiveValue:()=>{}}}function Cf(e){return(e.schema??[]).filter(e=>e.type===`tab`).map(e=>{let t=e.props;return{confirm:t.confirm?{required:t.confirm.required}:void 0,label:t.label,value:t.value}}).filter(e=>e.value!==``)}function wf(e,t){if(typeof window>`u`)return null;let n=new URLSearchParams(window.location.search).get(e);return!n||!t.some(e=>e.value===n)?null:n}function Tf(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href);n.searchParams.set(e,t),window.history.replaceState(window.history.state,``,`${n.pathname}${n.search}${n.hash}`)}function Ef(e,t){if(typeof window>`u`)return``;let n=new URL(window.location.href);return n.searchParams.set(e,t),`${n.pathname}${n.search}${n.hash}`}var Df=({children:e,node:t})=>{let{t:n}=z(me),r=(0,U.useMemo)(()=>Cf(t),[t]),i=r[0]?.value??``,a=t.props.queryKey,o=t.props.orientation,c=o===`vertical`,l=t.props.alignment,u=!c&&l===`stretch`,d=t.props.activeValue,f=t.props.defaultValue??i,p=(0,U.useRef)(null),[m,h]=(0,U.useState)(()=>d||(wf(a,r)??f)||i),g=(0,U.useCallback)(e=>{if(e.confirm?.required){s.visit(Ef(a,e.value),{preserveScroll:!0});return}h(e.value),Tf(a,e.value)},[a]),v=(0,U.useCallback)(e=>{let t=r.find(t=>t.value===e);t&&g(t)},[g,r]),y=(0,U.useMemo)(()=>({activeValue:m,setActiveValue:v}),[m,v]);function b(e){let t=c?`ArrowDown`:`ArrowRight`,n=c?`ArrowUp`:`ArrowLeft`;if(e.key!==t&&e.key!==n&&e.key!==`Home`&&e.key!==`End`)return;let r=Array.from(p.current?.querySelectorAll(`[role="tab"]`)??[]);if(r.length===0)return;e.preventDefault();let i=r.indexOf(document.activeElement),a;if(e.key===`Home`)a=0;else if(e.key===`End`)a=r.length-1;else{let n=e.key===t?1:-1;a=((i<0?0:i)+n+r.length)%r.length}r[a]?.focus()}return(0,G.jsx)(xf.Provider,{value:y,children:(0,G.jsxs)(`div`,{className:_(`gap-6`,c?_(`flex`,l===`end`&&`flex-row-reverse`):`grid`),"data-lattice-tabs":t.key??t.id,children:[(0,G.jsx)(`div`,{"aria-label":n(`common.tabs`,`Tabs`),"aria-orientation":o,className:_(`gap-1 rounded-lt bg-lt-muted p-1`,c&&`flex flex-col`,u&&`flex w-full`,!c&&!u&&_(`inline-flex w-fit max-w-full overflow-x-auto`,{"justify-self-center":l===`center`,"justify-self-end":l===`end`})),ref:p,role:`tablist`,children:r.map(e=>{let t=m===e.value;return(0,G.jsx)(`button`,{"aria-controls":`${e.value}-panel`,"aria-selected":t,"data-test":`tab-${e.value}`,className:_(Sa(t),c&&`text-left`,u&&`flex-1`),id:`${e.value}-tab`,onClick:()=>g(e),onKeyDown:b,role:`tab`,tabIndex:t?0:-1,type:`button`,children:e.label},e.value)})}),(0,G.jsx)(`div`,{className:_(`min-w-0`,c&&`flex-1`),children:e})]})})},Of=({children:e,node:t})=>{let{activeValue:n}=Sf(),r=t.props.value,i=n===r,[a,o]=(0,U.useState)(i);return(0,U.useEffect)(()=>{i&&o(!0)},[i]),(0,G.jsx)(`section`,{"aria-labelledby":`${r}-tab`,className:_(`space-y-8`,!i&&`hidden`),hidden:!i,id:`${r}-panel`,role:`tabpanel`,tabIndex:0,children:a?e:null})},kf={center:`text-center`,left:`text-left`},Af={xs:`text-xs leading-5`,sm:`text-sm leading-6`,md:`text-base leading-7`,lg:`text-lg leading-8`,xl:`text-xl leading-8`,"2xl":`text-2xl leading-9`,"3xl":`text-3xl leading-10`,"4xl":`text-4xl leading-none`},jf=Lt({components:{avatar:W(Id),badge:W(Ld),button:W(Yt),card:W(Od),chart:W(zd),"code-block":W(jd),collapsible:W(Bd),"floating-panel":W(Hd),grid:W(Kd),heading:W(qd),icon:W(Yd),image:W(Xd),link:W(tf),modal:W(rf),progress:W(cf),"raw-block":W(lf),section:W(uf),"segmented-control":W(df),separator:W(ff),stack:W(bf),tab:W(Of),tabs:W(Df),text:W(({node:e})=>{let t=e.props.align??`left`,n=M(F(e.props.color)??ne(`muted`)),r=(0,G.jsx)(`p`,{className:_(`m-0`,`max-w-2xl`,kf[t]??kf.left,Af[e.props.size]),style:{color:n},children:e.props.text});return e.props.copyable?(0,G.jsx)(fs,{value:e.props.text,label:e.props.text,children:r}):r}),tooltip:W(({node:e})=>{let t=e.props.content,n=_r(e.props.trigger);return t?n.length===0?(0,G.jsx)(ft,{content:t}):(0,G.jsxs)(xt,{children:[(0,G.jsx)(Je,{type:`button`,className:`inline-flex items-center rounded-lt-sm outline-none focus-visible:ring-lt-ring/50 focus-visible:ring-[length:var(--lt-ring-width)]`,children:(0,G.jsx)(Y,{nodes:n})}),(0,G.jsx)(wt,{align:`start`,className:`max-w-xs p-3 text-sm [&_a]:underline`,dangerouslySetInnerHTML:{__html:t}})]}):null})},i18n:{namespace:me},name:`lattice/ui`},Ds,Yr,Ts,cl,Sd,di,wl,Dl),Mf=[`light`,`dark`,`system`],{subscribe:Nf,notify:Pf}=se(),Ff=`system`,If=`system`;function Lf(e){Rf(e)&&(If=e)}function Rf(e){return Mf.some(t=>t===e)}var zf=()=>typeof window>`u`?!1:window.matchMedia(`(prefers-color-scheme: dark)`).matches,Bf=(e,t,n=365)=>{if(typeof document>`u`)return;let r=n*24*60*60;document.cookie=`${e}=${t};path=/;max-age=${r};SameSite=Lax`},Vf=()=>{if(typeof window>`u`)return`system`;let e=localStorage.getItem(`appearance`);return Rf(e)?e:`system`},Hf=e=>e===`dark`||e===`system`&&zf(),Uf=()=>zf()?`dark`:`light`,Wf=e=>{if(typeof document>`u`)return;let t=Hf(e);document.documentElement.classList.toggle(`dark`,t),document.documentElement.style.colorScheme=t?`dark`:`light`},Gf=()=>typeof window>`u`?null:window.matchMedia(`(prefers-color-scheme: dark)`),Kf=()=>{Wf(Ff),Pf()};function qf(e){Ff=e,localStorage.setItem(`appearance`,e),Bf(`appearance`,e),Wf(e),Pf()}function Jf(){typeof window>`u`||(localStorage.getItem(`appearance`)||(localStorage.setItem(`appearance`,`system`),Bf(`appearance`,`system`)),Ff=Vf(),Wf(Ff),Gf()?.addEventListener(`change`,Kf))}function Yf(){let e=(0,U.useSyncExternalStore)(Nf,()=>Ff,()=>If),t=(0,U.useSyncExternalStore)(Nf,Uf,()=>`light`);return{appearance:e,resolvedAppearance:e===`system`?t:e,updateAppearance:qf}}function Xf({children:e}){let t=l().props.lattice.layout;return t?(0,G.jsx)(Zc.Provider,{value:e,children:(0,G.jsx)(Y,{nodes:t.schema})}):(0,G.jsx)(G.Fragment,{children:e})}var Zf=(0,U.lazy)(()=>kt(()=>import(`./subscriptions-BICQU9ps.js`),__vite__mapDeps([23,1,2,6,24,10,11,3,8,12,13,18]),import.meta.url)),Qf=class extends U.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){console.warn(`[lattice] Real-time listeners are declared but Echo is unavailable. Install @laravel/echo-react and call configureEcho().`)}render(){return this.state.failed?null:this.props.children}};function $f({listeners:e}){return e.length===0?null:(0,G.jsx)(Qf,{children:(0,G.jsx)(U.Suspense,{fallback:null,children:(0,G.jsx)(Zf,{listeners:e})})})}function ep({lattice:e}){let t=(0,G.jsx)(Y,{nodes:e.schema});return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(d,{title:e.title??void 0}),(0,G.jsx)($f,{listeners:e.listeners}),e.container===`centered`?(0,G.jsx)(`main`,{className:`min-h-svh bg-lt-bg text-lt-fg`,children:(0,G.jsx)(`div`,{"data-test":`lattice-centered-container`,className:`mx-auto flex min-h-svh w-full max-w-6xl flex-col justify-center px-6 py-12 sm:px-8 lg:px-10`,children:t})}):(0,G.jsx)(`div`,{"data-test":`lattice-default-container`,className:_(`w-full`,{"px-4 py-6":e.layout!==null}),children:t})]})}var tp=`lattice/page`;function np(e){return t=>{if(t===`lattice/page`)return{default:ep};let n=e[`./Pages/${t}.tsx`]??e[`./pages/${t}.tsx`];if(n)return n();throw Error(`Page not found: ${t}`)}}function rp({defaultLayout:e}={}){return(t,n)=>t===`lattice/page`?n.props.lattice?.layout?Xf:null:e?.(t,n)??null}function ip(e,t){return{...t,headers:Xn(``,t.headers)}}var ap=!1;function op(){ap||(ap=!0,h.onRequest(e=>{let t=e.headers?.[Hn];return e.headers&&typeof t==`string`&&t!==``&&(e.headers[Hn]=Wn(t)),e}))}function sp({action:e,children:t}){let{processing:n,requestSubmit:r,overlays:i}=Jr(e);return(0,G.jsxs)(G.Fragment,{children:[t({onClick:r,processing:n}),i]})}function cp({children:e}){return(0,G.jsx)(Gt,{render:e=>(0,G.jsx)(sp,{action:e.action,children:e.children}),children:e})}function lp({onAppearanceChange:e}){return Xt(R.appearanceChange,t=>{let n=t.detail?.value;Rf(n)&&e?.(n)},{enabled:!!e}),null}var up={href:``};function dp({children:e,registry:t,sprite:n=up,toaster:r=!0}){return Md(),(0,G.jsx)(m.Provider,{value:t,children:(0,G.jsx)(cp,{children:(0,G.jsxs)(b,{sprite:n,children:[e,(0,G.jsx)(lp,{onAppearanceChange:qf}),r?(0,G.jsx)(Gc,{}):null]})})})}function fp(e,t){let n=new Set([...e.namespaces??[`lattice`,`lattice-ui`],...t.map(e=>e.namespace)]);return{...e,namespaces:[...n]}}function pp({ready:e,children:t}){let[n,r]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{let t=!0,n=()=>{t&&r(!0)};return e.then(n,n),()=>{t=!1}},[e]),n?t:null}function mp({registry:e,plugins:t,sprite:n,pages:r={},defaultLayout:a,strictMode:s=!0,i18n:c,boot:l,wrap:d,...f}={}){let p=e??jf,m=t&&t.length>0?Rt(p,...t):p;u(m),Jn(oe),op();let h=c!==!1,g=t?.flatMap(e=>e.i18n?[e.i18n]:[])??[],_=h?fp(c??{},g):{},v=f.defaults?.visitOptions,y=h?{...f.defaults,visitOptions:(e,t)=>ip(e,v?.(e,t)??t)}:f.defaults,b=o({...f,defaults:y,strictMode:s,resolve:np(r),layout:rp({defaultLayout:a}),withApp:(e,{ssr:t,page:r})=>{let a=[],o=r.props.lattice,s=!1;if(i(o)&&Lf(o.appearance),!t){s=document.getElementById(f.id??`app`)?.hasAttribute(`data-server-rendered`)===!0,i(o)&&i(o.urls)&&typeof o.urls.refreshRef==`string`&&ir(o.urls.refreshRef),h&&be(r.props)!==void 0&&a.push(kt(()=>import(`./page-props-DZ15iP5k.js`).then(e=>e.n).then(e=>e.configureI18nFromPageProps(r.props,_)),__vite__mapDeps([25,1,21,8,2,12,13]),import.meta.url));let e=l?.({page:r});e&&a.push(e)}let c=(0,G.jsxs)(G.Fragment,{children:[e,h?(0,G.jsx)(Zt,{}):null]}),u=(0,G.jsx)(dp,{registry:m,sprite:n,children:d?d(c):c});return a.length===0?u:s?(pe(Promise.all(a)),u):(0,G.jsx)(pp,{ready:Promise.all(a),children:u})}});return Jf(),b}u(jf);function hp({registry:e=jf,...t}){return(0,G.jsx)(dp,{...t,registry:e})}function gp(e){if(Array.isArray(e))return e}function _p(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function vp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function yp(e,t){if(e){if(typeof e==`string`)return vp(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vp(e,t):void 0}}function bp(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
24
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xp(e,t){return gp(e)||_p(e,t)||yp(e,t)||bp()}var Sp=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bind=void 0;function t(e,t){var n=t.type,r=t.listener,i=t.options;return e.addEventListener(n,r,i),function(){e.removeEventListener(n,r,i)}}e.bind=t})),Cp=t((e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=void 0;var n=Sp();function r(e){if(e!==void 0)return typeof e==`boolean`?{capture:e}:e}function i(e,n){return n==null?e:t(t({},e),{options:t(t({},r(n)),r(e.options))})}function a(e,t,r){var a=t.map(function(t){var a=i(t,r);return(0,n.bind)(e,a)});return function(){a.forEach(function(e){return e()})}}e.bindAll=a})),wp=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=e.bind=void 0;var t=Sp();Object.defineProperty(e,"bind",{enumerable:!0,get:function(){return t.bind}});var n=Cp();Object.defineProperty(e,"bindAll",{enumerable:!0,get:function(){return n.bindAll}})}))(),Tp=`data-pdnd-honey-pot`;function Ep(e){return e instanceof Element&&e.hasAttribute(`data-pdnd-honey-pot`)}function Dp(e){var t=xp(document.elementsFromPoint(e.x,e.y),2),n=t[0],r=t[1];return n?Ep(n)?r??null:n:null}function Op(e){"@babel/helpers - typeof";return Op=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Op(e)}function kp(e,t){if(Op(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Op(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Ap(e){var t=kp(e,`string`);return Op(t)==`symbol`?t:t+``}function jp(e,t,n){return(t=Ap(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mp=2147483647,Np={inset:`unset`,border:`none`,padding:0,margin:0,overflow:`visible`,color:`inherit`,background:`transparent`,width:`auto`,height:`auto`};function Pp(e){var t=null;return function(){if(!t){var n=[...arguments];t={result:e.apply(this,n)}}return t.result}}var Fp=Pp(function(){return typeof HTMLElement<`u`&&typeof HTMLElement.prototype.showPopover==`function`});function Ip(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ip(Object(n),!0).forEach(function(t){jp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ip(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Rp=2,zp=Rp/2;function Bp(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function Vp(e){return{x:e.x-zp,y:e.y-zp}}function Hp(e){return{x:Math.max(e.x,0),y:Math.max(e.y,0)}}function Up(e){return{x:Math.min(e.x,window.innerWidth-Rp),y:Math.min(e.y,window.innerHeight-Rp)}}function Wp(e){var t=e.client,n=Up(Hp(Vp(Bp(t))));return DOMRect.fromRect({x:n.x,y:n.y,width:Rp,height:Rp})}function Gp(e){var t=e.clientRect;return{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`}}function Kp(e){var t=e.client,n=e.clientRect;return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height}function qp(e){var t=e.initial,n=document.createElement(`div`);n.setAttribute(Tp,`true`),Fp()&&n.setAttribute(`popover`,`manual`);var r=Wp({client:t});Object.assign(n.style,Lp(Lp({position:`fixed`},Fp()?Np:{zIndex:Mp}),{},{backgroundColor:`transparent`,padding:0,margin:0,boxSizing:`border-box`,pointerEvents:`auto`},Gp({clientRect:r}))),document.body.appendChild(n),Fp()&&n.showPopover();var i=(0,wp.bind)(window,{type:`pointermove`,listener:function(e){r=Wp({client:{x:e.clientX,y:e.clientY}}),Object.assign(n.style,Gp({clientRect:r}))},options:{capture:!0}});return function(e){var t=e.current;if(i(),Kp({client:t,clientRect:r})){n.remove();return}function a(){o(),n.remove()}var o=(0,wp.bindAll)(window,[{type:`pointerdown`,listener:a},{type:`pointermove`,listener:a},{type:`focusin`,listener:a},{type:`focusout`,listener:a},{type:`dragstart`,listener:a},{type:`dragenter`,listener:a},{type:`dragover`,listener:a}],{capture:!0})}}function Jp(){var e=null;function t(){return e=null,(0,wp.bind)(window,{type:`pointermove`,listener:function(t){e={x:t.clientX,y:t.clientY}},options:{capture:!0}})}function n(){var t=null;return function(n){var r=n.eventName,i=n.payload;if(r===`onDragStart`){var a=i.location.initial.input;t=qp({initial:e??{x:a.clientX,y:a.clientY}})}if(r===`onDrop`){var o,s=i.location.current.input;(o=t)==null||o({current:{x:s.clientX,y:s.clientY}}),t=null,e=null}}}return{bindEvents:t,getOnPostDispatch:n}}function Yp(e){if(Array.isArray(e))return vp(e)}function Xp(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function Zp(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
25
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qp(e){return Yp(e)||Xp(e)||yp(e)||Zp()}var $p=Pp(function(){return navigator.userAgent.includes(`Firefox`)}),em=Pp(function(){var e=navigator.userAgent;return e.includes(`AppleWebKit`)&&!e.includes(`Chrome`)}),tm={isLeavingWindow:Symbol(`leaving`),isEnteringWindow:Symbol(`entering`)};function nm(e){var t=e.dragLeave;return em()?t.hasOwnProperty(tm.isLeavingWindow):!1}(function(){if(typeof window>`u`||!em())return;function e(){return{enterCount:0,isOverWindow:!1}}var t=e();function n(){t=e()}(0,wp.bindAll)(window,[{type:`dragstart`,listener:function(){t.enterCount=0,t.isOverWindow=!0}},{type:`drop`,listener:n},{type:`dragend`,listener:n},{type:`dragenter`,listener:function(e){!t.isOverWindow&&t.enterCount===0&&(e[tm.isEnteringWindow]=!0),t.isOverWindow=!0,t.enterCount++}},{type:`dragleave`,listener:function(e){t.enterCount--,t.isOverWindow&&t.enterCount===0&&(e[tm.isLeavingWindow]=!0,t.isOverWindow=!1)}}],{capture:!0})})();function rm(e){return`nodeName`in e}function im(e){return rm(e)&&e.ownerDocument!==document}function am(e){var t=e.dragLeave,n=t.type,r=t.relatedTarget;return n===`dragleave`?em()?nm({dragLeave:t}):r==null?!0:$p()?im(r):r instanceof HTMLIFrameElement:!1}function om(e){var t=e.onDragEnd;return[{type:`pointermove`,listener:function(){var e=0;return function(){if(e<20){e++;return}t()}}()},{type:`pointerdown`,listener:t}]}function sm(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var cm=function(e){var t=[],n=null,r=function(){t=[...arguments],!n&&(n=requestAnimationFrame(function(){n=null,e.apply(void 0,t)}))};return r.cancel=function(){n&&=(cancelAnimationFrame(n),null)},r}(function(e){return e()}),lm=function(){var e=null;function t(t){e={frameId:requestAnimationFrame(function(){e=null,t()}),fn:t}}function n(){e&&=(cancelAnimationFrame(e.frameId),e.fn(),null)}return{schedule:t,flush:n}}();function um(e){var t=e.source,n=e.initial,r=e.dispatchEvent,i={dropTargets:[]};function a(e){r(e),i={dropTargets:e.payload.location.current.dropTargets}}return{start:function(e){var r=e.nativeSetDragImage,o={current:n,previous:i,initial:n};a({eventName:`onGenerateDragPreview`,payload:{source:t,location:o,nativeSetDragImage:r}}),lm.schedule(function(){a({eventName:`onDragStart`,payload:{source:t,location:o}})})},dragUpdate:function(e){var r=e.current;lm.flush(),cm.cancel(),a({eventName:`onDropTargetChange`,payload:{source:t,location:{initial:n,previous:i,current:r}}})},drag:function(e){var r=e.current;cm(function(){lm.flush(),a({eventName:`onDrag`,payload:{source:t,location:{initial:n,previous:i,current:r}}})})},drop:function(e){var r=e.current,o=e.updatedSourcePayload;lm.flush(),cm.cancel(),a({eventName:`onDrop`,payload:{source:o??t,location:{current:r,previous:i,initial:n}}})}}}var dm={isActive:!1};function fm(){return!dm.isActive}function pm(e){return e.dataTransfer?e.dataTransfer.setDragImage.bind(e.dataTransfer):null}function mm(e){var t=e.current,n=e.next;if(t.length!==n.length)return!0;for(var r=0;r<t.length;r++)if(t[r].element!==n[r].element)return!0;return!1}function hm(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=e.dispatchEvent;if(!fm())return;var a=_m({event:t,dragType:n,getDropTargetsOver:r});dm.isActive=!0;var o={current:a};gm({event:t,current:a.dropTargets});var s=um({source:n.payload,dispatchEvent:i,initial:a});function c(e){var t=mm({current:o.current.dropTargets,next:e.dropTargets});o.current=e,t&&s.dragUpdate({current:o.current})}function l(e){var t=sm(e),i=r({target:Ep(e.target)?Dp({x:t.clientX,y:t.clientY}):e.target,input:t,source:n.payload,current:o.current.dropTargets});i.length&&(e.preventDefault(),gm({event:e,current:i})),c({dropTargets:i,input:t})}function u(){o.current.dropTargets.length&&c({dropTargets:[],input:o.current.input}),s.drop({current:o.current,updatedSourcePayload:null}),d()}function d(){dm.isActive=!1,f()}var f=(0,wp.bindAll)(window,[{type:`dragover`,listener:function(e){l(e),s.drag({current:o.current})}},{type:`dragenter`,listener:l},{type:`dragleave`,listener:function(e){am({dragLeave:e})&&(c({input:o.current.input,dropTargets:[]}),n.startedFrom===`external`&&u())}},{type:`drop`,listener:function(e){if(o.current={dropTargets:o.current.dropTargets,input:sm(e)},!o.current.dropTargets.length){u();return}e.preventDefault(),gm({event:e,current:o.current.dropTargets}),s.drop({current:o.current,updatedSourcePayload:n.type===`external`?n.getDropPayload(e):null}),d()}},{type:`dragend`,listener:function(e){o.current={dropTargets:o.current.dropTargets,input:sm(e)},u()}}].concat(Qp(om({onDragEnd:u}))),{capture:!0});s.start({nativeSetDragImage:pm(t)})}function gm(e){var t=e.event,n=e.current[0]?.dropEffect;n!=null&&t.dataTransfer&&(t.dataTransfer.dropEffect=n)}function _m(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=sm(t);return n.startedFrom===`external`?{input:i,dropTargets:[]}:{input:i,dropTargets:r({input:i,source:n.payload,target:t.target,current:[]})}}var vm={canStart:fm,start:hm},ym=new Map;function bm(e){var t=e.typeKey,n=e.mount,r=ym.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return ym.set(t,i),i}function xm(e){var t=bm(e);return function(){t.usageCount--,!(t.usageCount>0)&&(t.unmount(),ym.delete(e.typeKey))}}function Sm(){var e=[...arguments];return function(){e.forEach(function(e){return e()})}}function Cm(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function wm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Tm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?wm(Object(n),!0).forEach(function(t){jp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Em(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Dm(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
26
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function Dm(e,t){if(e){if(typeof e==`string`)return Om(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Om(e,t):void 0}}function Om(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function km(e){return e.slice(0).reverse()}function Am(e){var t=e.typeKey,n=e.defaultDropEffect,r=new WeakMap,i=`data-drop-target-for-${t}`,a=`[${i}]`;function o(e){return r.set(e.element,e),function(){return r.delete(e.element)}}function s(e){return Pp(Sm(Cm(e.element,{attribute:i,value:`true`}),o(e)))}function c(e){var t=e.source,i=e.target,o=e.input,s=e.result,l=s===void 0?[]:s;if(i==null)return l;if(!(i instanceof Element))return i instanceof Node?c({source:t,target:i.parentElement,input:o,result:l}):l;var u=i.closest(a);if(u==null)return l;var d=r.get(u);if(d==null)return l;var f={input:o,source:t,element:d.element};if(d.canDrop&&!d.canDrop(f))return c({source:t,target:d.element.parentElement,input:o,result:l});var p=d.getData?.call(d,f)??{},m=d.getDropEffect?.call(d,f)??n,h={data:p,element:d.element,dropEffect:m,isActiveDueToStickiness:!1};return c({source:t,target:d.element.parentElement,input:o,result:[].concat(Qp(l),[h])})}function l(e){var t=e.eventName,n=e.payload,i=Em(n.location.current.dropTargets),a;try{for(i.s();!(a=i.n()).done;){var o,s=a.value,c=r.get(s.element),l=Tm(Tm({},n),{},{self:s});c==null||(o=c[t])==null||o.call(c,l)}}catch(e){i.e(e)}finally{i.f()}}var u={onGenerateDragPreview:l,onDrag:l,onDragStart:l,onDrop:l,onDropTargetChange:function(e){var t=e.payload,n=new Set(t.location.current.dropTargets.map(function(e){return e.element})),i=new Set,a=Em(t.location.previous.dropTargets),o;try{for(a.s();!(o=a.n()).done;){var s,c=o.value;i.add(c.element);var l=r.get(c.element),u=n.has(c.element),d=Tm(Tm({},t),{},{self:c});if(l==null||(s=l.onDropTargetChange)==null||s.call(l,d),!u){var f;l==null||(f=l.onDragLeave)==null||f.call(l,d)}}}catch(e){a.e(e)}finally{a.f()}var p=Em(t.location.current.dropTargets),m;try{for(p.s();!(m=p.n()).done;){var h,g,_=m.value;if(!i.has(_.element)){var v=Tm(Tm({},t),{},{self:_}),y=r.get(_.element);y==null||(h=y.onDropTargetChange)==null||h.call(y,v),y==null||(g=y.onDragEnter)==null||g.call(y,v)}}}catch(e){p.e(e)}finally{p.f()}}};function d(e){u[e.eventName](e)}function f(e){var t=e.source,n=e.target,i=e.input,a=e.current,o=c({source:t,target:n,input:i});if(o.length>=a.length)return o;for(var s=km(a),l=km(o),u=[],d=0;d<s.length;d++){var f,p=s[d],m=l[d];if(m!=null){u.push(m);continue}var h=u[d-1],g=s[d-1];if(h?.element!==g?.element)break;var _=r.get(p.element);if(!_)break;var v={input:i,source:t,element:_.element};if(_.canDrop&&!_.canDrop(v)||!((f=_.getIsSticky)!=null&&f.call(_,v)))break;u.push(Tm(Tm({},p),{},{isActiveDueToStickiness:!0}))}return km(u)}return{dropTargetForConsumers:s,getIsOver:f,dispatchEvent:d}}function jm(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Mm(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
27
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function Mm(e,t){if(e){if(typeof e==`string`)return Nm(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nm(e,t):void 0}}function Nm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Pm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Fm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Pm(Object(n),!0).forEach(function(t){jp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pm(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Im(){var e=new Set,t=null;function n(e){t&&(!e.canMonitor||e.canMonitor(t.canMonitorArgs))&&t.active.add(e)}function r(r){var i=Fm({},r);e.add(i),n(i);function a(){e.delete(i),t&&t.active.delete(i)}return Pp(a)}function i(r){var i=r.eventName,a=r.payload;if(i===`onGenerateDragPreview`){t={canMonitorArgs:{initial:a.location.initial,source:a.source},active:new Set};var o=jm(e),s;try{for(o.s();!(s=o.n()).done;){var c=s.value;n(c)}}catch(e){o.e(e)}finally{o.f()}}if(t){for(var l=Array.from(t.active),u=0,d=l;u<d.length;u++){var f=d[u];if(t.active.has(f)){var p;(p=f[i])==null||p.call(f,a)}}i===`onDrop`&&(t.active.clear(),t=null)}}return{dispatchEvent:i,monitorForConsumers:r}}function Lm(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,o=Im(),s=Am({typeKey:t,defaultDropEffect:a});function c(e){r?.(e),s.dispatchEvent(e),o.dispatchEvent(e),i?.(e)}function l(e){var t=e.event,n=e.dragType;vm.start({event:t,dragType:n,getDropTargetsOver:s.getIsOver,dispatchEvent:c})}function u(){function e(){return n({canStart:vm.canStart,start:l})}return xm({typeKey:t,mount:e})}return{registerUsage:u,dropTarget:s.dropTargetForConsumers,monitor:o.monitorForConsumers}}var Rm=Pp(function(){return navigator.userAgent.toLocaleLowerCase().includes(`android`)}),zm=`pdnd:android-fallback`,Bm=`text/plain`,Vm=`application/vnd.pdnd`,Hm=new WeakMap;function Um(e){return Hm.set(e.element,e),function(){Hm.delete(e.element)}}var Wm=Jp(),Gm=Lm({typeKey:`element`,defaultDropEffect:`move`,mount:function(e){return Sm(Wm.bindEvents(),(0,wp.bind)(document,{type:`dragstart`,listener:function(t){if(e.canStart(t)&&!t.defaultPrevented&&t.dataTransfer){var n=t.target;if(n instanceof HTMLElement){var r=Hm.get(n);if(r){var i=sm(t),a={element:r.element,dragHandle:r.dragHandle??null,input:i};if(r.canDrag&&!r.canDrag(a)){t.preventDefault();return}if(r.dragHandle){var o=Dp({x:i.clientX,y:i.clientY});if(!r.dragHandle.contains(o)){t.preventDefault();return}}var s=r.getInitialDataForExternal?.call(r,a)??null;if(s)for(var c=0,l=Object.entries(s);c<l.length;c++){var u=xp(l[c],2),d=u[0],f=u[1];t.dataTransfer.setData(d,f??``)}Rm()&&!t.dataTransfer.types.includes(`text/plain`)&&!t.dataTransfer.types.includes(`text/uri-list`)&&t.dataTransfer.setData(Bm,zm),t.dataTransfer.setData(Vm,``);var p={type:`element`,payload:{element:r.element,dragHandle:r.dragHandle??null,data:r.getInitialData?.call(r,a)??{}},startedFrom:`internal`};e.start({event:t,dragType:p})}}}}}))},dispatchEventToSource:function(e){var t,n,r=e.eventName,i=e.payload;(t=Hm.get(i.source.element))==null||(n=t[r])==null||n.call(t,i)},onPostDispatch:Wm.getOnPostDispatch()}),Km=Gm.dropTarget;Gm.monitor;function qm(e){return Pp(Sm(Gm.registerUsage(),Um(e),Cm(e.element,{attribute:`draggable`,value:`true`})))}function Jm(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Ym(e,t){if(e==null)return{};var n,r,i=Jm(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Xm(e,t){var n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(function(n){return Object.is(e[n],t[n])})}function Zm(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xm,t=null;return function(n){return t&&e(t.value,n)||(t={value:n}),t.value}}var Qm=[`block`];function $m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function eh(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?$m(Object(n),!0).forEach(function(t){jp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var th=Symbol(`tree-item-instruction`);function nh(e){return{x:(e.right+e.left)/2,y:(e.bottom+e.top)/2}}function rh(e){var t=e.client,n=e.borderBox,r=n.height/4;return t.y<=n.top+r?`reorder-above`:t.y>=n.bottom-r?`reorder-below`:`make-child`}function ih(e){var t=e.element,n=e.input,r=e.currentLevel,i=e.indentPerLevel,a=e.mode,o={x:n.clientX,y:n.clientY},s=t.getBoundingClientRect();if(a===`standard`)return{type:rh({borderBox:s,client:o}),indentPerLevel:i,currentLevel:r};var c=nh(s);if(a===`expanded`){var l=rh({borderBox:s,client:o});return{type:l===`reorder-above`?l:`make-child`,indentPerLevel:i,currentLevel:r}}var u=i*r;if(o.x<s.left+u){if(o.y<c.y)return{type:`reorder-above`,indentPerLevel:i,currentLevel:r};var d=(o.x-s.left)/i;return{type:`reparent`,desiredLevel:Math.max(Math.floor(d),0),indentPerLevel:i,currentLevel:r}}return{type:rh({borderBox:s,client:o}),indentPerLevel:i,currentLevel:r}}function ah(e,t){return e.type===t.type?e.type===`instruction-blocked`&&t.type===`instruction-blocked`?ah(e.desired,t.desired):Xm(e,t):!1}var oh=Zm(ah);function sh(e){var t=e.desired,n=e.block;return n!=null&&n.includes(t.type)&&t.type!==`instruction-blocked`?{type:`instruction-blocked`,desired:t}:t}function ch(e,t){var n=t.block,r=oh(sh({desired:ih(Ym(t,Qm)),block:n}));return eh(eh({},e),{},jp({},th,r))}function lh(e){return e[th]??null}var uh=1e3,dh=null,fh=`1px`,ph={width:fh,height:fh,padding:`0`,position:`absolute`,border:`0`,clip:`rect(${fh}, ${fh}, ${fh}, ${fh})`,overflow:`hidden`,whiteSpace:`nowrap`,marginTop:`-${fh}`,pointerEvents:`none`};function mh(){var e=document.createElement(`div`);return e.setAttribute(`role`,`status`),Object.assign(e.style,ph),document.body.append(e),e}function hh(){return dh===null&&(dh=mh()),dh}var gh=null;function _h(){gh!==null&&clearTimeout(gh),gh=null}function vh(e){hh(),_h(),gh=setTimeout(function(){gh=null;var t=hh();t.textContent=e},uh)}export{sr as $,Gc as A,yi as B,Ou as C,cl as D,pu as E,mo as F,Ar as G,di as H,so as I,Y as J,kr as K,va as L,Ps as M,us as N,Zc as O,ho as P,J as Q,Zi as R,ed as S,mu as T,si as U,fi as V,Vr as W,br as X,yr as Y,hr as Z,qf as _,At as _t,Km as a,Vn as at,cd as b,mp as c,Bn as ct,np as d,Zt as dt,ir as et,tp as f,K as ft,Jf as g,Rt as gt,Xf as h,W as ht,qm as i,Kn as it,Is as j,qc as k,lp as l,$t as lt,$f as m,Lt as mt,ch as n,Xn as nt,Sm as o,Fn as ot,ip as p,Bt as pt,X as q,lh as r,Hn as rt,hp as s,zn as st,vh as t,Qn as tt,rp as u,Qt as ut,Yf as v,Ft as vt,Eu as w,td as x,jf as y,kt as yt,Oi as z};
|