@texturehq/edges 1.25.1 → 1.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{RichTextEditor-BGQenUvv.d.cts → RichTextEditor-BhX77nTp.d.cts} +16 -2
  2. package/dist/{RichTextEditor-BGQenUvv.d.ts → RichTextEditor-BhX77nTp.d.ts} +16 -2
  3. package/dist/{TimeField-Blk2Ci2M.d.ts → TimeField-C2O3KVaW.d.ts} +43 -5
  4. package/dist/{TimeField-p31z8xSR.d.cts → TimeField-DC3iyts9.d.cts} +43 -5
  5. package/dist/{colors-Bw6dREwE.d.ts → colors-DCUq7Ywi.d.ts} +1 -1
  6. package/dist/{colors-nZbxzpnU.d.cts → colors-DVn78Aex.d.cts} +1 -1
  7. package/dist/components.manifest.json +5 -5
  8. package/dist/form/index.cjs +1 -1
  9. package/dist/form/index.cjs.map +1 -1
  10. package/dist/form/index.d.cts +1 -1
  11. package/dist/form/index.d.ts +1 -1
  12. package/dist/form/index.js +1 -1
  13. package/dist/form/index.js.map +1 -1
  14. package/dist/{index-DKA9NMRw.d.ts → index-Dkhk7IbI.d.cts} +5 -1
  15. package/dist/{index-DKA9NMRw.d.cts → index-Dkhk7IbI.d.ts} +5 -1
  16. package/dist/index.cjs +9 -9
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +24 -13
  19. package/dist/index.d.ts +24 -13
  20. package/dist/index.js +9 -9
  21. package/dist/index.js.map +1 -1
  22. package/dist/rhf/index.cjs +1 -1
  23. package/dist/rhf/index.cjs.map +1 -1
  24. package/dist/rhf/index.d.cts +2 -2
  25. package/dist/rhf/index.d.ts +2 -2
  26. package/dist/rhf/index.js +1 -1
  27. package/dist/rhf/index.js.map +1 -1
  28. package/dist/server.d.cts +2 -2
  29. package/dist/server.d.ts +2 -2
  30. package/dist/styles/utilities.css +15 -2
  31. package/dist/styles.css +62 -2
  32. package/dist/utilities.manifest.json +1 -1
  33. package/package.json +1 -1
  34. package/scripts/setup-cursor-rules.js +4 -4
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { Key, DateValue } from 'react-aria-components';
4
4
  import { FieldValues, FieldPath, Path, UseFormProps, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';
5
- import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioGroup, S as Select, c as Switch, T as TextArea, d as TextField, e as TimeFieldProps, B as Button } from '../TimeField-p31z8xSR.cjs';
6
- import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-BGQenUvv.cjs';
5
+ import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioGroup, S as Select, c as Switch, T as TextArea, d as TextField, e as TimeFieldProps, B as Button } from '../TimeField-DC3iyts9.cjs';
6
+ import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-BhX77nTp.cjs';
7
7
  import '@phosphor-icons/react';
8
8
 
9
9
  interface FormAutocompleteProps<T extends FieldValues> extends Omit<React.ComponentProps<typeof Autocomplete>, "selectedKey" | "defaultSelectedKey" | "onSelectionChange"> {
@@ -2,8 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import { Key, DateValue } from 'react-aria-components';
4
4
  import { FieldValues, FieldPath, Path, UseFormProps, SubmitHandler, SubmitErrorHandler } from 'react-hook-form';
5
- import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioGroup, S as Select, c as Switch, T as TextArea, d as TextField, e as TimeFieldProps, B as Button } from '../TimeField-Blk2Ci2M.js';
6
- import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-BGQenUvv.js';
5
+ import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioGroup, S as Select, c as Switch, T as TextArea, d as TextField, e as TimeFieldProps, B as Button } from '../TimeField-C2O3KVaW.js';
6
+ import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-BhX77nTp.js';
7
7
  import '@phosphor-icons/react';
8
8
 
9
9
  interface FormAutocompleteProps<T extends FieldValues> extends Omit<React.ComponentProps<typeof Autocomplete>, "selectedKey" | "defaultSelectedKey" | "onSelectionChange"> {
package/dist/rhf/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';import*as me from'react';import me__default,{memo,createContext,useState,useContext,useRef,useEffect,useCallback,useId,useMemo}from'react';import {ComboBox,Group,Input,Button,ListBox,ListBoxSection,Header,Checkbox,composeRenderProps,CheckboxGroup,TextField,DateField,DialogTrigger,Popover,Dialog,DropZone,FileTrigger,NumberField,RadioGroup,Select,SelectValue,Switch,TimeField,DateInput,DateSegment,Link,Form,ComboBoxStateContext,useSlottedContext,PopoverContext,OverlayArrow,Modal,ListBoxItem,Calendar,CalendarGrid,CalendarGridBody,CalendarCell,Text,ModalOverlay,useLocale,Heading,CalendarGridHeader,CalendarHeaderCell}from'react-aria-components';import {useAsyncList}from'react-stately';import {twMerge}from'tailwind-merge';import*as vr from'@phosphor-icons/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Minus,Check,Image,X as X$1,Upload}from'lucide-react';import {HexColorPicker}from'react-colorful';import zn from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import On from'@tiptap/starter-kit';var ze={prefix:String(Math.round(Math.random()*1e10)),current:0},Ot=me__default.createContext(ze),Yo=me__default.createContext(false);var Jo=!!(typeof window<"u"&&window.document&&window.document.createElement),Je=new WeakMap;function Zo(e=false){let o=useContext(Ot),t=useRef(null);if(t.current===null&&!e){var r,n;let a=(n=me__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||n===void 0||(r=n.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(a){let i=Je.get(a);i==null?Je.set(a,{id:o.current,state:a.memoizedState}):a.memoizedState!==i.state&&(o.current=i.id,Je.delete(a));}t.current=++o.current;}return t.current}function er(e){let o=useContext(Ot);o===ze&&!Jo&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let t=Zo(!!e),r=o===ze&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function tr(e){let o=me__default.useId(),[t]=useState(Me()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ze.prefix}`;return e||`${r}-${o}`}typeof me__default.useId=="function"?tr:er;function rr(){return false}function ar(){return true}function nr(e){return ()=>{}}function Me(){return typeof me__default.useSyncExternalStore=="function"?me__default.useSyncExternalStore(nr,rr,ar):useContext(Yo)}var ir=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),sr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function et(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),r=typeof t.getTextInfo=="function"?t.getTextInfo():t.textInfo;if(r)return r.direction==="rtl";if(t.script)return ir.has(t.script)}let o=e.split("-")[0];return sr.has(o)}var cr=Symbol.for("react-aria.i18n.locale");function _t(){let e=typeof window<"u"&&window[cr]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:et(e)?"rtl":"ltr"}}var tt=_t(),we=new Set;function qt(){tt=_t();for(let e of we)e(tt);}function Wt(){let e=Me(),[o,t]=useState(tt);return useEffect(()=>(we.size===0&&window.addEventListener("languagechange",qt),we.add(t),()=>{we.delete(t),we.size===0&&window.removeEventListener("languagechange",qt);}),[]),e?{locale:"en-US",direction:"ltr"}:o}var pr=me__default.createContext(null);function ot(){let e=Wt();return useContext(pr)||e}var rt=new Map;function at(e){let{locale:o}=ot(),t=o+(e?Object.entries(e).sort((n,a)=>n[0]<a[0]?-1:1).join():"");if(rt.has(t))return rt.get(t);let r=new Intl.Collator(o,e);return rt.set(t,r),r}function He(e){let o=at({usage:"search",...e}),t=useCallback((a,i)=>i.length===0?true:(a=a.normalize("NFC"),i=i.normalize("NFC"),o.compare(a.slice(0,i.length),i)===0),[o]),r=useCallback((a,i)=>i.length===0?true:(a=a.normalize("NFC"),i=i.normalize("NFC"),o.compare(a.slice(-i.length),i)===0),[o]),n=useCallback((a,i)=>{if(i.length===0)return true;a=a.normalize("NFC"),i=i.normalize("NFC");let s=0,l=i.length;for(;s+l<=a.length;s++){let d=a.slice(s,s+l);if(o.compare(i,d)===0)return true}return false},[o]);return useMemo(()=>({startsWith:t,endsWith:r,contains:n}),[t,r,n])}function Kt(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let n=setTimeout(()=>r(e),o);return ()=>clearTimeout(n)},[e,o]),t}function pe(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}function A(e,o){return composeRenderProps(e,t=>twMerge(o,t))}var $={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};var Pe={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},f=memo(({name:e,size:o="md",color:t,weight:r="regular",className:n,ariaLabel:a,...i})=>{let s=vr[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react`),null;let l=typeof o=="string"&&o in Pe?Pe[o]:o,d=twMerge("inline-block flex-shrink-0",!t&&"text-current",n);return jsx(s,{...i,size:l,color:t,weight:r,className:d,"aria-label":a||`${e} icon`,"data-testid":`icon-${e}`})});f.displayName="Icon";var Qt=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:n="md",className:a,name:i,color:s,weight:l,ariaLabel:d,ref:u,...c})=>{let x=typeof n=="string"&&n in Pe?Pe[n]:n,C=t?typeof t=="string"&&t in Pe?Pe[t]:t:x*1.75,m=twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-gray-100 dark:bg-gray-800",e==="solid"&&"bg-brand text-white",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:m,style:{width:C,height:C},children:jsx(f,{...c,name:i,size:n,color:s,weight:l,className:a,ariaLabel:d})})});Qt.displayName="IconWithContainer";function de(){let[e,o]=me__default.useState(false),t=me__default.useCallback((n,a)=>{o(true),a?.(n);},[]),r=me__default.useCallback((n,a)=>{o(false),a?.(n);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}function X({children:e,className:o}){return jsx("div",{className:twMerge("relative w-full",o),children:e})}function Xt({onClick:e,size:o="md",className:t}){return jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:twMerge("absolute right-2 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(f,{name:"X",size:o==="sm"?16:20})})}function Fe(e){let{isInvalid:o,isDisabled:t,isFocused:r}=e,n="border rounded-[var(--control-border-radius)] !outline-none ";return t?`${n} border-border-muted`:o&&r?`${n} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:o?`${n} border-feedback-error-border`:r?`${n} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${n} border-border-input`}function Yt(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function yr(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function ee(e){let{isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:a="md",className:i}=e;return twMerge("w-full",Fe({isInvalid:o,isDisabled:t,isFocused:r}),Yt({transparent:n,isDisabled:t}),$[a].text,$[a].height,$[a].padding,yr(a),i)}function Jt(e){let{size:o="md",isFocusWithin:t,isInvalid:r,isDisabled:n,transparent:a,className:i}=e;return twMerge("group flex items-center rounded-[var(--control-border-radius)] overflow-hidden",Yt({transparent:a,isDisabled:n}),$[o].height,Fe({isFocused:t,isInvalid:r,isDisabled:n}),i)}function z({children:e,size:o="md",tooltip:t,isRequired:r,className:n,htmlFor:a}){return jsxs("label",{htmlFor:a,className:twMerge($[o].text,"!text-text-label font-semibold flex items-center gap-1",n),children:[e,r&&jsx("span",{children:"*"}),t&&jsx("span",{className:"text-text-muted",children:jsx(f,{name:"Info",size:o==="sm"?16:20})})]})}function k({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-caption",$[e].text,o),children:t})}function p({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge($[o].text,"text-feedback-error-text",t),children:e})}function Ge({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:n,className:a,...i}){return jsx("input",{className:ee({isInvalid:o,isDisabled:t,isFocused:r,transparent:n,size:e,className:a}),...i})}var Rr="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Sr={default:"bg-action-default text-[color:var(--color-action-default-text)] hover:bg-action-default-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",brand:"bg-action-brand text-[color:var(--color-action-brand-text)] hover:bg-action-brand-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",secondary:"bg-transparent text-text-body border-2 border-border-muted hover:bg-text-body/5 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-body hover:bg-text-body/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-transparent text-feedback-error-text border-2 border-border-muted hover:bg-feedback-error-background/50 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[Mark]",link:"!text-action-brand hover:text-action-brand/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-body hover:bg-background-hover hover:text-text-heading forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},eo={full:"w-full",default:"w-fit"},Nr="opacity-50 cursor-not-allowed pointer-events-none",Tr="opacity-100 cursor-pointer",kr={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},wr={primary:"bg-action-brand text-white",destructive:"bg-action-destructive text-white"};function Ir(e){return e?e==="primary"?"brand":e:"default"}function $r(e){let{variant:o="default",size:t="md",isDisabled:r,fullWidth:n=false,isLoading:a=false}=e,i=Ir(o),s=i==="unstyled"?"":`${Rr} ${Sr[i]}`;i!=="unstyled"&&(s+=` ${$[t].text} ${$[t].height} ${$[t].padding} ${$[t].gap}`),r||a?s+=` ${Nr}`:s+=` ${Tr}`,n?s+=` ${eo.full}`:s+=` ${eo.default}`;let l=i==="brand"?"focus-visible:outline-action-brand":void 0;return [s,pe(),l].filter(Boolean).join(" ")}function h(e){let{icon:o,children:t,isLoading:r=false,loadingText:n,loadingIndicator:a,size:i="md",iconPosition:s="left",iconWeight:l,href:d,className:u,badgeNumber:c,badgeVariant:x="primary",badgePosition:C="top-right",style:m,target:y,rel:R,...b}=e,P=o?jsx(f,{name:o,size:i,weight:l}):null,S=jsxs(Fragment,{children:[s==="left"&&P,typeof t=="function"?null:t,s==="right"&&P]}),D=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a||jsx(f,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:S}),n&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:n})]}),N=(c??0)>0,T=twMerge($r(e),u),g=d?{href:d,target:y,rel:R,...b}:{};if(d){let{onPress:j,onPressStart:ie,onPressEnd:H,onPressChange:ue,onPressUp:oe,onAuxClick:_,onContextMenu:ye,onDoubleClick:V,...F}=b;Object.assign(g,F);}let Q=d?jsx(Link,{...g,...r&&{"aria-busy":true},style:N?void 0:m,className:T,children:r?D:typeof t=="function"?(function(j){return jsxs(Fragment,{children:[s==="left"&&P,t(j),s==="right"&&P]})}):S}):jsx(Button,{...b,...r&&{"aria-busy":true},style:N?void 0:m,className:T,children:r?D:typeof t=="function"?(function(j){return jsxs(Fragment,{children:[s==="left"&&P,t(j),s==="right"&&P]})}):S});return N?jsxs("div",{className:twMerge("relative flex",u),style:m,children:[Q,jsx("span",{className:`absolute ${kr[C]} flex h-5 w-5 items-center justify-center rounded-full ${wr[x]} text-xs font-medium`,"aria-label":`${c} items`,children:c})]}):Q}function $e({transparent:e=false,className:o,children:t,...r}){return jsx(ModalOverlay,{...r,className:composeRenderProps(o,(n,a)=>twMerge("fixed inset-0 z-50",e?"bg-transparent":["bg-gradient-to-br from-black/20 via-black/15 to-black/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-black/15"].join(" "),a.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),a.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),n)),children:t})}function Or({isEntering:e,isExiting:o,className:t="",disableGroup:r=false}){let n=[!r&&"group","bg-background-surface","forced-colors:bg-[Canvas]","shadow-lg","rounded-[var(--control-border-radius)]","bg-clip-padding","border","border-border-default","outline-none"].filter(Boolean).join(" "),a=e?["animate-in","fade-in","placement-bottom:slide-in-from-top-1","placement-top:slide-in-from-bottom-1","placement-left:slide-in-from-right-1","placement-right:slide-in-from-left-1","ease-out","duration-200"].join(" "):"",i=o?["animate-out","fade-out","placement-bottom:slide-out-to-top-1","placement-top:slide-out-to-bottom-1","placement-left:slide-out-to-right-1","placement-right:slide-out-to-left-1","ease-in","duration-150"].join(" "):"";return [n,a,i,t].filter(Boolean).join(" ")}function Re({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:n=true,disableGroup:a=false,...i}){let l=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",d=o?12:8;d=l?d-6:d;let u=jsxs(Popover,{offset:d,...i,className:composeRenderProps(r,(c,x)=>Or({...x,className:c,disableGroup:a})),children:[o&&jsx(OverlayArrow,{children:jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",className:"block fill-background-surface stroke-border-default stroke-1 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsx($e,{isDismissable:n,children:jsx(Modal,{isDismissable:n,children:u})}):u}var io=createContext("md");function so(){return useContext(io)}function Qr(e="md"){return `flex-1 text-start data-[placeholder]:text-text-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${$[e].text}`}function Xr(){let e=me__default.useCallback((t,r)=>{r?.(t);},[]),o=me__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function dt({label:e,description:o,errorMessage:t,children:r,items:n,renderItem:a,size:i="md",selectedKey:s,defaultSelectedKey:l,onSelectionChange:d,placeholder:u,showErrors:c=false,tooltip:x,isRequired:C,transparent:m,reserveErrorSpace:y=false,placement:R="bottom start",shouldFlip:b=true,menuWidth:P="match",...S}){let[D,N]=useState(null),[T,g]=useState(null),Q=s??D??l,{handleFocus:j,handleBlur:ie}=Xr(),H=_=>{d&&_!==null&&d(_),d||N(_);},ue=useRef(null),oe=useRef(null);return jsx(Select,{...S,selectedKey:Q,defaultSelectedKey:l,onSelectionChange:H,placeholder:u,className:A(S.className,"group flex w-full flex-col"),ref:ue,onOpenChange:_=>{_&&oe.current?g(oe.current.offsetWidth):_||ue.current?.blur();},children:({isDisabled:_,isInvalid:ye,isOpen:V})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(z,{size:i,tooltip:x,isRequired:C,children:e}),jsx(X,{children:jsx("div",{ref:oe,children:jsxs(h,{variant:"unstyled",className:twMerge(ee({isInvalid:ye||c&&!!t,isDisabled:_,isFocused:V,transparent:m,size:i}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:F=>j(F,S.onFocus),onBlur:F=>ie(F,S.onBlur),"data-open":V,children:[jsx(SelectValue,{className:Qr(i)}),jsx(f,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-body group-disabled:text-gray-200 forced-colors:text-[ButtonText] transition-transform",V&&"rotate-180")})]})})}),y?jsx("div",{className:"mt-1 min-h-[20px]",children:c?jsx(p,{size:i,className:"text-feedback-error-text",children:typeof t=="function"&&S.validationResult?t(S.validationResult):typeof t=="string"?t:null}):o?jsx(k,{size:i,children:o}):null}):jsx(Fragment,{children:c?jsx(p,{size:i,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&S.validationResult?t(S.validationResult):typeof t=="string"?t:null}):o?jsx(k,{size:i,className:"mt-1",children:o}):null}),jsx(Re,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:P==="match"&&T?`${T}px`:void 0,minWidth:P==="auto"&&T?`${T}px`:void 0,maxWidth:P==="auto"?"min(600px, 90vw)":void 0},placement:R,shouldFlip:b,children:jsx(io.Provider,{value:i,children:jsx(ListBox,{items:n,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:a&&n?F=>jsx(Ce,{id:F.id,textValue:F.label,size:i,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:a(F)})},F.id):r})})})]})})}function Ce({size:e,className:o,...t}){let r=so(),n=e??r;return jsx(ListBoxItem,{...t,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-body data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",$[n].paddingY,$[n].text,o)})}var la={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},da={sm:"pl-7",md:"pl-9",lg:"pl-10",xl:"pl-12"},lo={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"};function ca(){let e=me__default.useContext(ComboBoxStateContext);return jsx(Button,{slot:null,className:"clear-button","aria-label":"Clear",onPress:()=>e?.setSelectedKey(null),children:"\u2715"})}var pt=(e,o,t)=>{if(e==null||e==="")return "";let n=(t?t.flatMap(a=>a.items):o||[]).find(a=>a.id===e);return n?n.name:""};async function ua(e,o,t){try{let r=e.url.replace("{q}",o),n=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([l,d])=>{n.append(l,d.toString());});let a=`${r}${n.toString()?"?"+n.toString():""}`,i=await fetch(a,{method:"GET",headers:e.headers,signal:t});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let s=await i.json();return {items:e.transformResponse(s)}}catch(r){console.error("Error in REST request:",r);let n=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:n}}}async function ma(e,o,t){try{let r=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${o}"`),n=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:r}),signal:t});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);let a=await n.json();if(a.errors)throw new Error(a.errors[0]?.message||"GraphQL error occurred");return e.responsePath&&(a=e.responsePath.split(".").reduce((i,s)=>i?.[s],a)),{items:e.transformResponse(a)}}catch(r){console.error("Error in GraphQL request:",r);let n=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:n}}}function bt({label:e,staticItems:o=[],sections:t,selectedKey:r,defaultSelectedKey:n,onSelectionChange:a,requestConfig:i,defaultFilter:s,placeholder:l,errorMessage:d,description:u,size:c="md",tooltip:x,isRequired:C,isDisabled:m,isInvalid:y,validationResult:R,showErrors:b=true,renderItem:P,renderLeftIcon:S,renderSection:D,autoFocus:N=false,reserveErrorSpace:T=false}){let g=me__default.useRef(null),[Q,j]=me__default.useState(),[ie,H]=useState(()=>pt(r||n,o,t)),[ue,oe]=useState(false),_=Kt(ie),{contains:ye}=He({sensitivity:"base"}),[V,F]=useState(),Ye=$[c].text,Gt=$[c].height,le=null;useEffect(()=>{N&&oe(true);},[N]),useEffect(()=>{let q=()=>{g.current&&j(g.current.offsetWidth);};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]),useEffect(()=>{le&&le.setFilterText(_);},[_,le]),i&&(le=useAsyncList({async load({signal:q,filterText:E=""}){if(!i.url||i.shouldLoad&&!i.shouldLoad(E))return {items:[]};try{let Z;return i.requestType==="GraphQL"?Z=await ma(i,E,q):Z=await ua(i,E,q),F(Z.error),{items:Z.items}}catch(Z){return console.error("Error loading items:",Z),F(Z instanceof Error?Z.message:"Unknown error occurred"),{items:[]}}},initialFilterText:""})),_===""&&(le=null);let Uo=q=>{let E=pt(q,o,t);H(E),a&&a(q);},jo=q=>{H(q);let E=pt(r,o,t);r!=null&&q!==E&&a&&a(null);};return jsx(ComboBox,{onSelectionChange:Uo,selectedKey:r||void 0,defaultSelectedKey:n||void 0,defaultItems:t?t.flatMap(q=>q.items):o,items:le?le.items:void 0,className:A("group flex flex-col","w-full"),menuTrigger:"focus",isDisabled:m,isInvalid:y||!!d,inputValue:ie,onInputChange:jo,autoFocus:N,defaultFilter:s||ye,"aria-label":e||l||"Autocomplete",children:q=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(z,{size:c,tooltip:x,isRequired:C,children:e}),jsxs(Group,{ref:g,className:Jt({size:c,isInvalid:y||!!d,isDisabled:m,isFocusWithin:ue||q.isOpen,className:"w-full cursor-pointer"}),"aria-label":e||l||"Autocomplete",style:{position:"relative"},children:[S?jsx("div",{className:"absolute left-3",children:S(!!le?.isLoading)}):jsx(f,{name:"MagnifyingGlass",className:`${la[c]} absolute left-3 text-inherit`}),jsx(Input,{className:`flex-1 min-w-0 border-none pr-3 outline-0 placeholder:text-text-placeholder ${da[c]} ${Ye} ${Gt} ${m?"bg-background-muted":"bg-background-input"}`,placeholder:l,disabled:m,onFocus:()=>oe(true),onBlur:()=>oe(false)}),ie&&!m&&jsx(ca,{}),jsx(Button,{className:`px-2 text-text-body ${Ye} ${Gt} ${m?"bg-background-muted":"bg-background-input"}`,"aria-label":"Toggle menu",isDisabled:m,children:({isPressed:E})=>jsx(f,{name:E?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),T?jsx("div",{className:"mt-1 min-h-[20px]",children:b&&V?jsx(p,{size:c,className:"text-feedback-error-text",children:V}):b&&typeof d=="string"?jsx(p,{size:c,className:"text-feedback-error-text",children:d}):b&&typeof d=="function"&&R?jsx(p,{size:c,className:"text-feedback-error-text",children:d(R)}):u?jsx(k,{size:c,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(k,{size:c,className:"mt-1",children:u}),b&&V&&jsx(p,{size:c,className:"text-feedback-error-text mt-1",children:V}),b&&typeof d=="string"&&jsx(p,{size:c,className:"text-feedback-error-text mt-1",children:d}),b&&typeof d=="function"&&R&&jsx(p,{size:c,className:"text-feedback-error-text mt-1",children:d(R)})]}),jsx(Re,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm ring-1 ring-black/5 rounded-[var(--control-border-radius)]",style:{minWidth:Q?`${Q}px`:void 0},children:jsx(ListBox,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${Ye}`,children:t?t.map(E=>{let Z=E.items.map(re=>jsx(Ce,{id:re.id,textValue:re.name,size:c,className:`flex cursor-default items-center gap-2 px-3 ${lo[c]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium`,children:P?P(re):jsxs(Fragment,{children:[re.name,jsx(f,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},re.id));if(D){let re=D(E,Z);return me__default.isValidElement(re)&&re.type===ListBoxSection?re:jsx(ListBoxSection,{children:re},E.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:E.name}),Z]},E.name)}):E=>jsx(Ce,{id:E.id,textValue:E.name,size:c,className:`flex cursor-default items-center gap-2 px-3 ${lo[c]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium`,children:P?P(E):jsxs(Fragment,{children:[E.name,jsx(f,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},E.id)})})]})})}function I(e,o){let t=o.split("."),r=e;for(let a of t)if(r&&typeof r=="object"&&a in r)r=r[a];else {r=void 0;break}let n=r?.message;return typeof n=="string"?n:void 0}function Yl({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(bt,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!a,errorMessage:a})})}function po(e){return jsxs(CheckboxGroup,{...e,className:A(e.className,"flex flex-col gap-2"),children:[jsx(z,{children:e.label}),e.children,e.description&&jsx(k,{children:e.description}),jsx(p,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function ya({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function Pa({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r,variant:n="default"}){let a="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",i=n==="brand"?"focus:ring-action-brand":"focus:ring-action-default",s="";if(t)s="border-border-muted bg-background-muted";else if(o)s="border-feedback-error-border bg-feedback-error-background";else if(e||r){let l=n==="brand"?"action-brand":"action-default";s=`bg-${l} border-${l} hover:bg-${l}-hover hover:border-${l}-hover`;}else s="bg-background-input border-border-input hover:border-border-focus";return `${a} ${i} ${s}`}var mo="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function fo(e){let{children:o,variant:t="default",...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(n,a)=>`${ya(a)} ${n||""}`),children:n=>{let{isSelected:a,isIndeterminate:i,...s}=n,l=jsx("div",{className:Pa({isSelected:a,isIndeterminate:i,variant:t,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:mo}):a?jsx(Check,{"aria-hidden":true,className:mo}):null});return jsxs(Fragment,{children:[l,typeof o=="function"?o(n):o]})}})}function fd({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:n,formState:a}=useFormContext(),i=I(a.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(fo,{...r,isSelected:!!s.value,onChange:l=>s.onChange(l),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(p,{children:i})]})})}function yd({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(po,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:a,children:t.children})})}function Ne(e){if(!e)return false;let o=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(o)}function ht(e){if(!e)return "";let o=e.startsWith("#")?e.slice(1):e;return o.length===3&&(o=o.split("").map(t=>t+t).join("")),`#${o.toUpperCase()}`}function ho({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,className:s,validationResult:l,value:d,defaultValue:u,onChange:c,placeholder:x="#000000",showColorSwatch:C=true,reserveErrorSpace:m=true,...y}){let[R,b]=useState(u||""),[P,S]=useState(d||u||""),[D,N]=useState(false),[T,g]=useState(null),{isFocused:Q,handleFocus:j,handleBlur:ie}=de(),H=d!==void 0?d:R;useEffect(()=>{d!==void 0&&S(d);},[d]);let ue=H?!Ne(H):false,oe=useCallback(V=>{if(S(V),Ne(V)){let F=ht(V);c?c(F):b(F);}else V===""&&(c?c(""):b(""));},[c]),_=useCallback(V=>{let F=ht(V);S(F),c?c(F):b(F);},[c]),ye=useCallback(V=>{if(Ne(P)){let F=ht(P);S(F),c&&F!==H?c(F):!c&&F!==R&&b(F);}ie(V,y.onBlur);},[P,H,R,c,ie,y.onBlur]);return jsx(TextField,{...y,isRequired:a,className:A(s,"group flex flex-col"),children:({isDisabled:V})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(z,{size:r,tooltip:n,isRequired:a,children:e}),jsx(X,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(Ge,{size:r,disabled:V,type:"text",value:P,placeholder:x,onFocus:F=>j(F,y.onFocus),onBlur:ye,onChange:F=>oe(F.target.value),className:twMerge(ee({isInvalid:ue,isDisabled:V,isFocused:Q,size:r,transparent:i}),C?"pr-12":"pr-3","pl-3")}),C&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:$[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",Ne(H)?"border-border-default":"border-border-default bg-background-muted"),style:Ne(H)?{backgroundColor:H}:void 0,"aria-hidden":"true",children:!Ne(H)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:g,children:jsx(h,{variant:"secondary",size:r,icon:"Palette",onPress:()=>N(!D),isDisabled:V,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&l?jsx(p,{size:r,children:t(l)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(p,{size:r,className:"mt-1",children:t(l)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null}),D&&T&&jsx(Re,{triggerRef:{current:T},isOpen:D,onOpenChange:N,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxs("div",{className:"flex flex-col gap-4",children:[jsx(HexColorPicker,{color:H||"#000000",onChange:_,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:H||"#000000"}}),jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:H||"#000000"})]})]})})]})})}function zd({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ho,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a})})}function qa({isSelected:e,isDisabled:o}){let t=[pe,"w-9 h-9 text-sm cursor-default rounded-sm flex items-center justify-center forced-color-adjust-none font-semibold"];return o?t.push("text-text-disabled forced-colors:text-[GrayText]"):e?t.push("bg-action-default text-text-onPrimary invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-body hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function yt({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(yo,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(Po,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:n})=>`${qa({isSelected:r,isDisabled:n})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function yo(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(h,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(f,{name:"CaretRight","aria-hidden":true,size:o}):jsx(f,{name:"CaretLeft","aria-hidden":true,size:o})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-zinc-900 dark:text-zinc-200"}),jsx(h,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(f,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(f,{name:"CaretRight","aria-hidden":true,size:o})})]})}function Po(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}function Ft({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,showCalendar:l=true,reserveErrorSpace:d=true,validationResult:u,className:c,...x}){let[C,m]=useState(false),y=R=>{x.onChange&&R&&x.onChange(R),m(false);};return jsxs(DateField,{...x,isDisabled:i,isRequired:a,isInvalid:s,className:A(c,"flex flex-col gap-1"),children:[e&&jsx(z,{size:r,tooltip:n,isRequired:a,children:e}),jsx(X,{children:jsxs("div",{className:"relative w-full",children:[jsx(Co,{size:r,isDisabled:i,isInvalid:s,hasCalendar:l}),l&&!i&&jsxs(DialogTrigger,{isOpen:C,onOpenChange:m,children:[jsx(h,{variant:"unstyled",className:"absolute right-2 top-1/2 -translate-y-1/2 flex h-8 w-8 items-center justify-center rounded hover:bg-background-hover text-text-muted hover:text-text-body transition-colors","aria-label":"Open calendar",children:jsx(f,{name:"Calendar",size:18})}),jsx(Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsx(Dialog,{className:"p-4 outline-none",children:jsx(yt,{value:x.value,onChange:y,minValue:x.minValue,maxValue:x.maxValue,isDisabled:i,isReadOnly:x.isReadOnly,isDateUnavailable:x.isDateUnavailable})})})]})]})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&u?jsx(p,{size:r,children:t(u)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(p,{size:r,className:"mt-1",children:t(u)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function Ya({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function Co({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:n,...a}){return jsx(DateInput,{className:twMerge(Fe({isInvalid:t,isDisabled:o}),"px-3 py-2 flex items-center gap-0.5 w-full",r&&"pr-10",n),...a,children:i=>jsx(DateSegment,{segment:i,className:Ya({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function gc({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Ft,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a})})}function Ct({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:n,isDisabled:a=false,onUpload:i,className:s,showPreview:l=true,placeholder:d="Drop files here or click to browse"}){let[u,c]=useState(false),[x,C]=useState(false),[m,y]=useState(null),[R,b]=useState(e),P=useRef(null),S=async T=>{if(y(null),n&&T.size>n){y(`File size must be less than ${(n/1024/1024).toFixed(2)}MB`);return}if(l&&T.type.startsWith("image/")){let g=new FileReader;g.onloadend=()=>{b(g.result);},g.readAsDataURL(T);}if(i){C(true);try{let g=await i(T);b(g),t?.(g);}catch(g){y("Failed to upload file"),console.error("Upload error:",g);}finally{C(false);}}o?.(T,R);},D=T=>{let g=T.items;if(g.length>0){let Q=g[0];if(Q.kind==="file"){let j=Q.getAsFile();j&&S(j);}}c(false);},N=()=>{b(void 0),y(null),o?.(null),t?.(""),P.current&&(P.current.value="");};return jsxs("div",{className:twMerge("w-full",s),children:[jsxs(DropZone,{className:twMerge("relative flex min-h-[200px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",u?"border-action-brand bg-action-brand/5":"border-border-muted hover:border-border-default",a&&"pointer-events-none opacity-50",m&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:D,onDropEnter:()=>c(true),onDropExit:()=>c(false),children:[R?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[l&&R.startsWith("data:image")?jsx("img",{src:R,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image,{className:"h-12 w-12 text-text-muted"}),jsx("span",{className:"text-sm text-text-muted",children:"File uploaded"})]}),!a&&jsx(h,{variant:"icon",size:"sm",onPress:N,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X$1,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-muted"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-body",children:d}),jsx("p",{className:"mt-1 text-xs text-text-muted",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsx(FileTrigger,{acceptedFileTypes:r.split(","),onSelect:T=>{let g=Array.from(T||[]);g.length>0&&S(g[0]);},children:jsx(h,{variant:"secondary",size:"sm",isDisabled:a,children:"Choose File"})})]}),x&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-muted",children:"Uploading..."})]})})]}),m&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:m})]})}function Vc({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:n,formState:a}=useFormContext(),i=I(a.errors,e);return jsx(Controller,{control:n,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(Ct,{...r,value:s.value??"",onChange:(l,d)=>s.onChange(d||"")}),t&&i&&jsx(p,{children:i})]})})}var xn=e=>{let o=ee({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(o,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function Nt({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,validationResult:s,reserveErrorSpace:l=true,...d}){let u=useId(),{isFocused:c,handleFocus:x,handleBlur:C}=de();return jsx(NumberField,{...d,id:u,isRequired:a,className:A(d.className,"group flex flex-col gap-1"),step:d.step??1,onChange:m=>{typeof m=="number"&&(d.maxValue!=null&&m>d.maxValue?d.onChange?.(d.maxValue):d.minValue!=null&&m<d.minValue?d.onChange?.(d.minValue):d.onChange?.(m));},isInvalid:!!t||typeof d.value=="number"&&(d.maxValue!=null&&d.value>d.maxValue||d.minValue!=null&&d.value<d.minValue),children:({isDisabled:m,isInvalid:y})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(z,{size:r,tooltip:n,isRequired:a,htmlFor:u,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:b=>x(b,d.onFocus),onBlur:b=>C(b,d.onBlur),className:xn({isInvalid:y||!!t,isDisabled:m,isFocused:c,transparent:i,size:r,className:typeof d.className=="string"?d.className:void 0})}),jsxs("div",{className:"absolute inset-y-[2px] right-[2px] flex flex-col divide-y divide-border-default border-l border-border-default overflow-hidden rounded-r-[calc(var(--control-border-radius)-2px)]",children:[jsx(Button,{slot:"increment",isDisabled:m,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(f,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:m,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(f,{name:"CaretDown",size:14})})]})]})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(p,{size:r,children:typeof t=="function"?t(s):t}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(p,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function Jc({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Nt,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!a,errorMessage:a,isRequired:t.isRequired})})}var Fn=createContext({variant:"brand"});function Tt(e){let{variant:o="default",...t}=e;return jsx(Fn.Provider,{value:{variant:o},children:jsxs(RadioGroup,{...t,className:A(e.className,"group flex flex-col gap-2"),children:[jsx(z,{children:e.label}),jsx("div",{className:"flex gap-2 group-orientation-horizontal:gap-4 group-orientation-vertical:flex-col",children:e.children}),e.description&&jsx(k,{children:e.description}),jsx(p,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function vu({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Tt,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:a,children:t.children})})}var Tn={xs:"text-lg font-semibold",sm:"text-xl font-semibold",md:"text-2xl font-semibold",lg:"text-3xl font-semibold",xl:"text-4xl font-semibold"},kn={page:"h-16 leading-[62px]"};function Ee({tag:e="h1",size:o="lg",height:t,className:r="",children:n}){let a=Tn[o],i=t?kn[t]:"";return jsx(e,{className:twMerge(a,i,r),children:n})}var kt=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:n=false,onBack:a,headerContent:i})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",r==="center"?"justify-center":""),children:[n&&jsx(h,{variant:"icon",onPress:a,className:"absolute left-6","aria-label":"Go back",children:jsx(f,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(Ee,{size:"xs",children:e}),o&&!t&&jsx(h,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(f,{name:"X","data-testid":"close-button"})})]})]});var wt=({className:e,size:o=24,color:t="text-action-brand"})=>jsx("div",{className:twMerge("inline-block animate-spin rounded-full border-2 border-solid border-current border-r-transparent",t,e),style:{width:o,height:o},role:"status","aria-label":"loading",children:jsx("span",{className:"sr-only",children:"Loading..."})});var Dn=e=>{let o=ee({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"pl-8":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(o,t,e.className)};function Ae({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,transparent:i,showSearchIcon:s,isClearable:l,onClear:d,type:u,validationResult:c,reserveErrorSpace:x=true,isLoading:C=false,...m}){let[y,R]=me__default.useState(false),{isFocused:b,handleFocus:P,handleBlur:S}=de(),D=u==="password";return jsx(TextField,{...m,isRequired:a,className:A(m.className,"group flex flex-col"),children:({isDisabled:N,isInvalid:T})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(z,{size:r,tooltip:n,isRequired:a,children:e}),jsxs(X,{children:[s&&jsx("div",{className:"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 transform flex items-center",children:C?jsx(wt,{size:16,color:"text-text-muted"}):jsx(f,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-muted translate-y-[0.5px]"})}),jsx(Ge,{size:r,disabled:N,type:D?y?"text":"password":u,value:m.value,defaultValue:m.defaultValue,placeholder:m.placeholder,onFocus:g=>P(g,m.onFocus),onBlur:g=>S(g,m.onBlur),onChange:g=>m.onChange?.(g.target.value),className:Dn({isInvalid:T,isDisabled:N,isFocused:b,size:r,transparent:i,showSearchIcon:s,isClearable:l,hasValue:!!m.value,isPassword:D,className:typeof m.className=="string"?m.className:void 0})}),l&&m.value&&!N&&jsx(Xt,{onClick:()=>{d?d():m.onChange&&m.onChange("");},size:r}),D&&!N&&jsx("button",{type:"button",onClick:()=>R(!y),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":y?"Hide password":"Show password",onMouseDown:g=>{g.preventDefault(),g.stopPropagation();},children:jsx(f,{name:y?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-body"})})]}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&c?jsx(p,{size:r,children:t(c)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(p,{size:r,className:"mt-1",children:t(c)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}var ge=({isActive:e=false,onPress:o,children:t})=>jsx(h,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function Kn({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[n,a]=useState(e);return me__default.useEffect(()=>{a(e);},[e]),jsx($e,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsx(Modal,{isDismissable:true,className:"flex items-center justify-center p-4",children:jsx(Dialog,{className:"relative bg-background-surface rounded-lg shadow-xl max-w-md w-full",children:jsxs("form",{onSubmit:s=>{s.preventDefault(),r(n),t();},children:[jsx(kt,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(Ae,{label:"URL",type:"url",value:n,onChange:a,autoFocus:true,className:"w-full"})}),jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsx(h,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(h,{type:"submit",children:"Save"})]})]})})})})}function $t({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:n="Start typing...",id:a}){let[i,s]=useState(false),l=useEditor({immediatelyRender:false,extensions:[On.configure({heading:{levels:[1,2]}}),zn.configure({openOnClick:false,HTMLAttributes:{class:"text-text-link-default hover:text-text-link-hover underline decoration-text-link-default/30 hover:decoration-text-link-hover cursor-pointer"}})],content:e,editable:!r,onUpdate:({editor:c})=>{o?.(c.getHTML());},editorProps:{attributes:{class:twMerge("prose prose-sm max-w-none","focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),d=()=>{s(true);},u=c=>{c===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:c}).run();};return l?jsxs("div",{id:a,"data-richtexteditor":true,className:twMerge("flex flex-col rounded-md border border-border-input bg-background-input","outline-none focus-within:outline-none focus-within:border-border-input focus-within:ring-0 focus-within:shadow-none",r&&"opacity-50",t),style:{outline:"none"},children:[l&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:l,shouldShow:({editor:c})=>c.isActive("link")&&!i,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let c=l.getAttributes("link").href;window.open(c,"_blank");},children:[jsx(f,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:d,children:[jsx(f,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(h,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(f,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(Kn,{isOpen:i,onClose:()=>s(false),onSubmit:u,initialUrl:l.getAttributes("link").href||""})]}),jsxs("div",{className:"flex items-center gap-1 border-b border-border-input p-2",children:[jsx(ge,{isActive:l.isActive("heading",{level:1}),onPress:()=>l.chain().focus().toggleHeading({level:1}).run(),children:jsx("span",{className:"text-xs font-bold",children:"H1"})}),jsx(ge,{isActive:l.isActive("heading",{level:2}),onPress:()=>l.chain().focus().toggleHeading({level:2}).run(),children:jsx("span",{className:"text-xs font-bold",children:"H2"})}),jsx(ge,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(ge,{isActive:l.isActive("italic"),onPress:()=>l.chain().focus().toggleItalic().run(),children:jsx("span",{className:"text-xs italic",children:"I"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(ge,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(f,{name:"ListBullets",className:"h-4 w-4"})}),jsx(ge,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(f,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(ge,{isActive:l.isActive("link"),onPress:d,children:jsx(f,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxs("div",{className:"relative min-h-[200px] w-full outline-none focus:outline-none",children:[jsx(EditorContent,{editor:l,className:twMerge("w-full p-4 outline-none focus:outline-none","[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none","[&_.ProseMirror_h1]:mb-4 [&_.ProseMirror_h1]:text-2xl [&_.ProseMirror_h1]:font-bold","[&_.ProseMirror_h2]:mb-3 [&_.ProseMirror_h2]:text-xl [&_.ProseMirror_h2]:font-semibold","[&_.ProseMirror_p]:mb-2","[&_.ProseMirror_ul]:mb-2 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:mb-2 [&_.ProseMirror_ol]:ml-6 [&_.ProseMirror_ol]:list-decimal","[&_.ProseMirror_li]:mb-1","[&_.ProseMirror_blockquote]:border-l-4 [&_.ProseMirror_blockquote]:border-border-muted [&_.ProseMirror_blockquote]:pl-4 [&_.ProseMirror_blockquote]:italic","[&_.ProseMirror_code]:rounded [&_.ProseMirror_code]:bg-background-muted [&_.ProseMirror_code]:px-1 [&_.ProseMirror_code]:py-0.5 [&_.ProseMirror_code]:font-mono [&_.ProseMirror_code]:text-sm","[&_.ProseMirror_pre]:rounded-md [&_.ProseMirror_pre]:bg-background-muted [&_.ProseMirror_pre]:p-3 [&_.ProseMirror_pre]:font-mono [&_.ProseMirror_pre]:text-sm","[&_.ProseMirror_hr]:border-border-muted",r&&"pointer-events-none")}),l.isEmpty&&!r&&jsx("div",{className:"pointer-events-none absolute left-4 top-4 text-text-muted",children:n})]})]}):null}function gm({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:n=true,...a}){let{control:i,formState:s}=useFormContext(),l=I(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field:d})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx("label",{htmlFor:e,className:"text-sm font-medium text-text-heading",children:t}),r&&jsx("p",{className:"text-sm text-text-muted",children:r}),jsx($t,{...a,id:e,initialContent:d.value??"",onChange:u=>d.onChange(u)}),l&&jsx("p",{className:"text-sm text-feedback-error-text",children:l}),n&&!l&&jsx("div",{className:"h-5"})]})})}function Nm({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(dt,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!a,errorMessage:a})})}var Vt={sm:{track:"h-4 w-7",handle:"h-3.5 w-3.5",text:"text-xs"},md:{track:"h-5 w-9",handle:"h-4 w-4",text:"text-sm"},lg:{track:"h-6 w-11",handle:"h-5 w-5",text:"text-base"},xl:{track:"h-7 w-14",handle:"h-6 w-6",text:"text-lg"}};function ei({isSelected:e,isDisabled:o,variant:t="default",size:r="md"}){let n="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",a=Vt[r].track,i=pe,s=t==="brand"?"focus-visible:outline-action-brand":"focus-visible:outline-action-default",l="";return e?t==="brand"?l="bg-action-brand forced-colors:!bg-[Highlight] group-pressed:bg-action-brand-hover":l="bg-action-default forced-colors:!bg-[Highlight] group-pressed:bg-action-default-hover":l="bg-gray-400 dark:bg-zinc-400 group-pressed:bg-gray-500 dark:group-pressed:bg-zinc-300",[n,a,i,s,l,o?"bg-gray-200 dark:bg-zinc-700 forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function ti({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-white dark:bg-zinc-900 outline-none shadow transition duration-200 ease-in-out",n=Vt[t].handle;return [r,n,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function Lt({children:e,variant:o="default",size:t="md",...r}){return jsx(Switch,{...r,className:A(r.className,`group flex items-center gap-2 ${Vt[t].text} text-gray-800 transition disabled:text-gray-300 dark:text-zinc-200 dark:disabled:text-zinc-600 forced-colors:disabled:text-[GrayText]`),children:n=>jsxs(Fragment,{children:[jsx("div",{className:ei({...n,variant:o,size:t}),children:jsx("span",{className:ti({...n,size:t})})}),e]})})}function zm({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:n})=>jsx(Lt,{...t,isSelected:!!n.value,onChange:a=>n.onChange(a),children:t.children})})}var si=e=>{let o=ee({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=`min-h-[100px] py-2 ${e.isDisabled?"resize-none":e.isResizable?"resize-y":"resize-none"}`;return twMerge(o,t,e.className)};function Et({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,required:a,transparent:i,isInvalid:s,isDisabled:l,isResizable:d=false,className:u,validationResult:c,reserveErrorSpace:x=true,...C}){let{isFocused:m,handleFocus:y,handleBlur:R}=de();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(z,{size:r,tooltip:n,isRequired:a,children:e}),jsx(X,{children:jsx("textarea",{...C,required:a,onFocus:b=>{C.onFocus&&C.onFocus(b),y(b);},onBlur:b=>{C.onBlur&&C.onBlur(b),R(b);},className:si({isInvalid:s,isDisabled:l,isResizable:d,isFocused:m,size:r,transparent:i,className:u}),disabled:l})}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&c?jsx(p,{size:r,children:t(c)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(p,{size:r,className:"mt-1",children:t(c)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function Ym({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Et,{...t,value:i.value??"",onChange:s=>i.onChange(s.target.value),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!a,errorMessage:a,required:t.required})})}function rp({name:e,defaultValue:o,...t}){let{control:r,formState:n}=useFormContext(),a=I(n.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Ae,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!a,errorMessage:a,isRequired:t.isRequired})})}function gi({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function Dt({label:e,description:o,errorMessage:t,size:r="md",tooltip:n,isRequired:a,isDisabled:i,isInvalid:s,reserveErrorSpace:l=true,validationResult:d,className:u,...c}){return jsxs(TimeField,{...c,isDisabled:i,isRequired:a,isInvalid:s,className:A(u,"flex flex-col gap-1"),children:[e&&jsx(z,{size:r,tooltip:n,isRequired:a,children:e}),jsx(X,{children:jsx(DateInput,{className:twMerge(Fe({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:x=>jsx(DateSegment,{segment:x,className:gi({isPlaceholder:x.isPlaceholder,isDisabled:!x.isEditable||i,size:r})})})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&d?jsx(p,{size:r,children:t(d)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(p,{size:r,className:"mt-1",children:t(d)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function Cp({name:e,...o}){let{control:t,formState:{errors:r}}=useFormContext(),n=r[e],a=n?.message;return jsx(Controller,{name:e,control:t,render:({field:i})=>jsx(Dt,{...o,value:i.value,onChange:i.onChange,isInvalid:!!n,errorMessage:a})})}function kp({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),n=me.useRef(null),a=r.errors,i=Object.entries(a||{}),s=i.length>0;if(me.useEffect(()=>{t&&s&&n.current?.focus();},[t,s]),!s)return null;let l=d=>{let u=`[name="${CSS.escape(d)}"]`,c=document.querySelector(u);c&&(c.focus(),c.scrollIntoView({block:"center",behavior:"smooth"}));};return jsxs("div",{ref:n,role:"alert",tabIndex:-1,className:twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsx("div",{className:"font-medium",children:o}),jsx("ul",{className:"mt-2 list-disc pl-5",children:i.map(([d,u])=>{let c=u?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>l(d),children:c})},d)})})]})}function Vp({formId:e,disableWhenInvalid:o,disableWhenPristine:t,isDisabled:r,children:n,...a}){let{formState:i}=useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsx(h,{type:"submit",form:e,isDisabled:s,...a,children:n})}var te=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:n=false,flex:a=false,stack:i,responsive:s,delay:l=0,adjustAnimationSpeedBasedOnWidth:d=false,ariaLabel:u,className:c,"data-testid":x})=>{let[C,m]=useState(l===0);if(useEffect(()=>{if(l>0){let N=setTimeout(()=>m(true),l);return ()=>clearTimeout(N)}},[l]),!C)return null;let y=n?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",R=d&&e?(()=>{let N=typeof e=="number"?e:parseFloat(String(e));return isNaN(N)?"":`animation-duration-[${Math.max(.8,N/100)}s]`})():"",b=r==="pulse"?`animate-pulse ${R}`:r==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${R}`:"",P="rounded-sm";t==="circle"&&(P="rounded-full"),t==="text"&&(P="h-4 w-full rounded-sm");let S=a?"flex-1 min-w-0":"",D=s?Object.entries(s).map(([N,T])=>`${N}:w-[${T}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":x,children:i.map((N,T)=>jsx("div",{className:twMerge(y,b,P,S,D,c),style:{width:N,height:o}},T))}):jsx("div",{className:twMerge(y,b,P,S,D,c),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":x})};var wi={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},Ii="rounded-lg",zt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},$i={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function he({variant:e="outlined",className:o,children:t,isLoading:r=false}){return jsx("div",{className:twMerge("w-full overflow-hidden",wi[e],Ii,o),"data-testid":"card",children:r?jsx(te,{width:"100%",height:"100%",className:"rounded-none"}):t})}function Ue({title:e,subtitle:o,actions:t,className:r,isLoading:n=false}){return n?jsxs("div",{className:twMerge("p-6 pb-4",r),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(te,{width:120,height:20}),jsx(te,{width:24,height:24})]}),o&&jsx(te,{width:200,height:16})]}):!e&&!o&&!t?null:jsx("div",{className:twMerge("p-6 pb-4",r),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(Ee,{tag:"h3",size:"sm",className:"text-text-heading",children:e}):e}),o&&jsx("div",{className:"text-sm text-text-muted",children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function Ho({src:e,alt:o,aspectRatio:t="auto",className:r,children:n,isLoading:a=false}){return a?jsx("div",{className:twMerge("bg-background-muted",zt[t],r),children:jsx(te,{width:"100%",height:"100%"})}):n?jsx("div",{className:twMerge("overflow-hidden",zt[t],r),children:n}):e?jsx("div",{className:twMerge("overflow-hidden",zt[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function je({className:e,children:o,isLoading:t=false}){let n=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return t?jsx("div",{className:twMerge(n,e),children:jsxs("div",{className:"space-y-2",children:[jsx(te,{width:"100%",height:16}),jsx(te,{width:"80%",height:16}),jsx(te,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge("px-6 py-4 text-text-body",e),children:o}):null}function Go({className:e,children:o,align:t="end",isLoading:r=false}){return r?jsxs("div",{className:twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsx(te,{width:80,height:32}),jsx(te,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",$i[t],e),children:o}):null}he.Header=Ue;he.Media=Ho;he.Content=je;he.Footer=Go;function Yp({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:n}=useFormContext(),{fields:a,append:i,remove:s,swap:l}=useFieldArray({control:n,name:e});return jsxs("div",{className:"flex flex-col gap-3",children:[a.map((d,u)=>jsxs(he,{children:[jsx(Ue,{title:o?o(u):`Item ${u+1}`,actions:jsxs("div",{className:"flex gap-2",children:[u>0&&jsx(h,{size:"sm",variant:"secondary",onPress:()=>l(u,u-1),children:"Up"}),u<a.length-1&&jsx(h,{size:"sm",variant:"secondary",onPress:()=>l(u,u+1),children:"Down"}),jsx(h,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsx(je,{children:t(u)})]},d.id)),jsx("div",{children:jsx(h,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function Ht(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Oo(e){let o=e.querySelector("[aria-invalid='true'], .aria-invalid, [data-invalid='true']")||e.querySelector("input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true']")||e.querySelector("input, select, textarea");o&&(o.focus({preventScroll:false}),o instanceof HTMLElement&&o.scrollIntoView({block:"center",behavior:"smooth"}));}function mf({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:n=true,className:a,...i}){let s=useForm(i),l=(d,u)=>{if(n&&e){let c=document.getElementById(e);c&&Oo(c);}t?.(d,u);};return jsx(FormProvider,{...s,children:jsx(Ht,{id:e,className:a,onSubmit:s.handleSubmit(o,l),children:r})})}function Wo({formId:e,show:o,isSubmitting:t,onCancel:r,primaryLabel:n="Save changes",secondaryLabel:a="Cancel",className:i}){return o?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",i),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-muted",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(h,{variant:"secondary",onPress:r,children:a}),jsx(h,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":n})]})]})}):null}function Pf({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n}){let{formState:a}=useFormContext();return jsx(Wo,{formId:e,show:a.isDirty,isSubmitting:a.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:n})}function Sf(e=true){let{formState:o}=useFormContext();me.useEffect(()=>{if(!e||!o.isSubmitted||!o.errors||Object.keys(o.errors).length===0)return;let t=document.querySelector("[aria-invalid='true'], .aria-invalid, [data-invalid='true']")||document.querySelector("input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true']");t&&t.scrollIntoView({block:"center",behavior:"smooth"});},[e,o.isSubmitted,o.errors]);}function kf({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:n}=useFormContext(),a=me.useRef(void 0);me.useEffect(()=>{let i=t(()=>{r.isDirty&&(a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(async()=>{let s=n();await o(s);},e));});return ()=>{i.unsubscribe(),a.current&&window.clearTimeout(a.current);}},[t,r.isDirty,n,e,o]);}export{kp as ErrorSummary,Yp as FieldArrayList,Yl as FormAutocomplete,fd as FormCheckbox,yd as FormCheckboxGroup,zd as FormColorField,gc as FormDateField,Vc as FormFileUpload,Jc as FormNumberField,mf as FormProvider,vu as FormRadioGroup,gm as FormRichTextEditor,Pf as FormSaveBar,Nm as FormSelect,zm as FormSwitch,Ym as FormTextArea,rp as FormTextField,Cp as FormTimeField,Vp as SubmitButton,Oo as focusFirstError,kf as useAutoSave,Sf as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
1
+ import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';import*as pe from'react';import pe__default,{memo,createContext,useState,useContext,useRef,useEffect,useCallback,useId,useMemo}from'react';import {ComboBox,Group,Input,Button,ListBox,ListBoxSection,Header,Checkbox,composeRenderProps,CheckboxGroup,TextField,DateField,DialogTrigger,Popover,Dialog,DropZone,FileTrigger,NumberField,RadioGroup,Select,SelectValue,Switch,TimeField,DateInput,DateSegment,Link,Form,ComboBoxStateContext,useSlottedContext,PopoverContext,OverlayArrow,Modal,ListBoxItem,Calendar,CalendarGrid,CalendarGridBody,CalendarCell,Text,TooltipTrigger,Tooltip,ModalOverlay,useLocale,Heading,CalendarGridHeader,CalendarHeaderCell}from'react-aria-components';import {useAsyncList}from'react-stately';import {twMerge}from'tailwind-merge';import*as Cr from'@phosphor-icons/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Minus,Check,Image,X,Upload}from'lucide-react';import {HexColorPicker}from'react-colorful';import Kn from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import Xn from'@tiptap/starter-kit';var He={prefix:String(Math.round(Math.random()*1e10)),current:0},_t=pe__default.createContext(He),tr=pe__default.createContext(false);var or=!!(typeof window<"u"&&window.document&&window.document.createElement),Ze=new WeakMap;function rr(e=false){let o=useContext(_t),t=useRef(null);if(t.current===null&&!e){var r,a;let n=(a=pe__default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||a===void 0||(r=a.ReactCurrentOwner)===null||r===void 0?void 0:r.current;if(n){let i=Ze.get(n);i==null?Ze.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,Ze.delete(n));}t.current=++o.current;}return t.current}function ar(e){let o=useContext(_t);o===He&&!or&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let t=rr(!!e),r=o===He&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function nr(e){let o=pe__default.useId(),[t]=useState(Ge()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${He.prefix}`;return e||`${r}-${o}`}typeof pe__default.useId=="function"?nr:ar;function sr(){return false}function lr(){return true}function dr(e){return ()=>{}}function Ge(){return typeof pe__default.useSyncExternalStore=="function"?pe__default.useSyncExternalStore(dr,sr,lr):useContext(tr)}var cr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),ur=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function tt(e){if(Intl.Locale){let t=new Intl.Locale(e).maximize(),r=typeof t.getTextInfo=="function"?t.getTextInfo():t.textInfo;if(r)return r.direction==="rtl";if(t.script)return cr.has(t.script)}let o=e.split("-")[0];return ur.has(o)}var fr=Symbol.for("react-aria.i18n.locale");function Kt(){let e=typeof window<"u"&&window[fr]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:tt(e)?"rtl":"ltr"}}var ot=Kt(),$e=new Set;function Wt(){ot=Kt();for(let e of $e)e(ot);}function Ut(){let e=Ge(),[o,t]=useState(ot);return useEffect(()=>($e.size===0&&window.addEventListener("languagechange",Wt),$e.add(t),()=>{$e.delete(t),$e.size===0&&window.removeEventListener("languagechange",Wt);}),[]),e?{locale:"en-US",direction:"ltr"}:o}var gr=pe__default.createContext(null);function rt(){let e=Ut();return useContext(gr)||e}var at=new Map;function nt(e){let{locale:o}=rt(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(at.has(t))return at.get(t);let r=new Intl.Collator(o,e);return at.set(t,r),r}function Oe(e){let o=nt({usage:"search",...e}),t=useCallback((n,i)=>i.length===0?true:(n=n.normalize("NFC"),i=i.normalize("NFC"),o.compare(n.slice(0,i.length),i)===0),[o]),r=useCallback((n,i)=>i.length===0?true:(n=n.normalize("NFC"),i=i.normalize("NFC"),o.compare(n.slice(-i.length),i)===0),[o]),a=useCallback((n,i)=>{if(i.length===0)return true;n=n.normalize("NFC"),i=i.normalize("NFC");let s=0,l=i.length;for(;s+l<=n.length;s++){let u=n.slice(s,s+l);if(o.compare(i,u)===0)return true}return false},[o]);return useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function jt(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function fe(e=false){return `${e?"outline outline-1 outline-border-input data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2":"outline-none data-[focus-visible]:outline data-[focus-visible]:outline-2 data-[focus-visible]:outline-action-default data-[focus-visible]:outline-offset-0 invalid:outline-2 invalid:outline-feedback-error-border group-invalid:outline-2 group-invalid:outline-feedback-error-border forced-colors:focus:outline-[Highlight] forced-colors:focus:outline-2 forced-colors:focus:outline-offset-2"}`}function z(e,o){return composeRenderProps(e,t=>twMerge(o,t))}var B={sm:{text:"text-[length:var(--control-text-sm)]",height:"h-[var(--control-sm-height)]",padding:"px-[var(--control-padding-sm)]",paddingY:"py-[var(--control-gap-sm)]",gap:"gap-[var(--control-gap-sm)]"},md:{text:"text-[length:var(--control-text-md)]",height:"h-[var(--control-md-height)]",padding:"px-[var(--control-padding-md)]",paddingY:"py-[var(--control-gap-md)]",gap:"gap-[var(--control-gap-md)]"},lg:{text:"text-[length:var(--control-text-lg)]",height:"h-[var(--control-lg-height)]",padding:"px-[var(--control-padding-lg)]",paddingY:"py-[var(--control-gap-lg)]",gap:"gap-[var(--control-gap-lg)]"},xl:{text:"text-[length:var(--control-text-xl)]",height:"h-[var(--control-xl-height)]",padding:"px-[var(--control-padding-xl)]",paddingY:"py-[var(--control-gap-xl)]",gap:"gap-[var(--control-gap-xl)]"}};var Ce={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},f=memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=Cr[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react`),null;let l=typeof o=="string"&&o in Ce?Ce[o]:o,u=twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsx(s,{...i,size:l,color:t,weight:r,className:u,"aria-label":n||`${e} icon`,"data-testid":`icon-${e}`})});f.displayName="Icon";var Yt=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:a="md",className:n,name:i,color:s,weight:l,ariaLabel:u,ref:c,...d})=>{let x=typeof a=="string"&&a in Ce?Ce[a]:a,y=t?typeof t=="string"&&t in Ce?Ce[t]:t:x*1.75,b=twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-gray-100 dark:bg-gray-800",e==="solid"&&"bg-brand text-white",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:b,style:{width:y,height:y},children:jsx(f,{...d,name:i,size:a,color:s,weight:l,className:n,ariaLabel:u})})});Yt.displayName="IconWithContainer";var wr=({isEntering:e,isExiting:o,className:t})=>["max-w-[200px] group bg-slate-700 dark:bg-slate-600 border border-slate-800 dark:border-white/10 shadow-[inset_0_1px_0_0_theme(colors.gray.600)] dark:shadow-none text-white text-sm rounded-lg drop-shadow-lg will-change-transform px-3 py-1",e?"animate-in fade-in placement-bottom:slide-in-from-top-0.5 placement-top:slide-in-from-bottom-0.5 placement-left:slide-in-from-right-0.5 placement-right:slide-in-from-left-0.5 ease-out duration-200":"",o?"animate-out fade-out placement-bottom:slide-out-to-top-0.5 placement-top:slide-out-to-bottom-0.5 placement-left:slide-out-to-right-0.5 placement-right:slide-out-to-left-0.5 ease-in duration-150":"",t].filter(Boolean).join(" ");function Zt({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,a)=>wr({...a,className:r})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-slate-700 stroke-gray-800 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 dark:fill-slate-600 dark:stroke-white/10 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L4 4 L8 0"})})}),o]})]})}function de(){let[e,o]=pe__default.useState(false),t=pe__default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=pe__default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}function Y({children:e,className:o}){return jsx("div",{className:twMerge("relative w-full",o),children:e})}function eo({onClick:e,size:o="md",className:t}){return jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:twMerge("absolute right-2 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(f,{name:"X",size:o==="sm"?16:20})})}function Re(e){let{isInvalid:o,isDisabled:t,isFocused:r}=e,a="border rounded-[var(--control-border-radius)] !outline-none ";return t?`${a} border-border-muted`:o&&r?`${a} border-feedback-error-border shadow-[inset_0_0_0_1px_var(--color-feedback-error-border)]`:o?`${a} border-feedback-error-border`:r?`${a} border-border-focus shadow-[inset_0_0_0_1px_var(--color-border-focus)]`:`${a} border-border-input`}function to(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function kr(e){return e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":""}function oe(e){let{isInvalid:o,isDisabled:t,isFocused:r,transparent:a,size:n="md",className:i}=e;return twMerge("w-full",Re({isInvalid:o,isDisabled:t,isFocused:r}),to({transparent:a,isDisabled:t}),B[n].text,B[n].height,B[n].padding,kr(n),i)}function oo(e){let{size:o="md",isFocusWithin:t,isInvalid:r,isDisabled:a,transparent:n,className:i}=e;return twMerge("group flex items-center rounded-[var(--control-border-radius)] overflow-hidden",to({transparent:n,isDisabled:a}),B[o].height,Re({isFocused:t,isInvalid:r,isDisabled:a}),i)}function M({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:a="below",isRequired:n,className:i,htmlFor:s}){let l=t||r&&a==="tooltip",u=t||r,c=r&&a==="inline",d=jsxs("label",{htmlFor:s,className:twMerge(B[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsx("span",{children:"*"}),l&&jsx("span",{className:"text-text-muted",children:jsx(f,{name:"Info",size:o==="sm"?16:20})}),c&&jsx("span",{className:"text-text-caption font-normal ml-1",children:r})]});return l&&u?jsx(Zt,{content:u,children:d}):d}function N({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-caption",B[e].text,o),children:t})}function p({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge(B[o].text,"text-feedback-error-text",t),children:e})}function qe({size:e="md",isInvalid:o,isDisabled:t,isFocused:r,transparent:a,className:n,...i}){return jsx("input",{className:oe({isInvalid:o,isDisabled:t,isFocused:r,transparent:a,size:e,className:n}),...i})}var Vr="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Lr={default:"bg-action-default text-[color:var(--color-action-default-text)] hover:bg-action-default-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",brand:"bg-action-brand text-[color:var(--color-action-brand-text)] hover:bg-action-brand-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",secondary:"bg-transparent text-text-body border-2 border-border-muted hover:bg-text-body/5 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-body hover:bg-text-body/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-transparent text-feedback-error-text border-2 border-border-muted hover:bg-feedback-error-background/50 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[Mark]",link:"!text-action-brand hover:text-action-brand/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-body hover:bg-background-hover hover:text-text-heading forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},ao={full:"w-full",default:"w-fit"},Er="opacity-50 cursor-not-allowed pointer-events-none",Dr="opacity-100 cursor-pointer",Ar={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},zr={primary:"bg-action-brand text-white",destructive:"bg-action-destructive text-white"};function Mr(e){return e?e==="primary"?"brand":e:"default"}function Hr(e){let{variant:o="default",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Mr(o),s=i==="unstyled"?"":`${Vr} ${Lr[i]}`;i!=="unstyled"&&(s+=` ${B[t].text} ${B[t].height} ${B[t].padding} ${B[t].gap}`),r||n?s+=` ${Er}`:s+=` ${Dr}`,a?s+=` ${ao.full}`:s+=` ${ao.default}`;let l=i==="brand"?"focus-visible:outline-action-brand":void 0;return [s,fe(),l].filter(Boolean).join(" ")}function v(e){let{icon:o,children:t,isLoading:r=false,loadingText:a,loadingIndicator:n,size:i="md",iconPosition:s="left",iconWeight:l,href:u,className:c,badgeNumber:d,badgeVariant:x="primary",badgePosition:y="top-right",style:b,target:m,rel:P,...h}=e,F=o?jsx(f,{name:o,size:i,weight:l}):null,$=jsxs(Fragment,{children:[s==="left"&&F,typeof t=="function"?null:t,s==="right"&&F]}),L=jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n||jsx(f,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:$}),a&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),g=(d??0)>0,S=twMerge(Hr(e),c),T=u?{href:u,target:m,rel:P,...h}:{};if(u){let{onPress:Q,onPressStart:X,onPressEnd:O,onPressChange:Pe,onPressUp:se,onAuxClick:le,onContextMenu:ue,onDoubleClick:E,...C}=h;Object.assign(T,C);}let k=u?jsx(Link,{...T,...r&&{"aria-busy":true},style:g?void 0:b,className:S,children:r?L:typeof t=="function"?(function(Q){return jsxs(Fragment,{children:[s==="left"&&F,t(Q),s==="right"&&F]})}):$}):jsx(Button,{...h,...r&&{"aria-busy":true},style:g?void 0:b,className:S,children:r?L:typeof t=="function"?(function(Q){return jsxs(Fragment,{children:[s==="left"&&F,t(Q),s==="right"&&F]})}):$});return g?jsxs("div",{className:twMerge("relative flex",c),style:b,children:[k,jsx("span",{className:`absolute ${Ar[y]} flex h-5 w-5 items-center justify-center rounded-full ${zr[x]} text-xs font-medium`,"aria-label":`${d} items`,children:d})]}):k}function Ve({transparent:e=false,className:o,children:t,...r}){return jsx(ModalOverlay,{...r,className:composeRenderProps(o,(a,n)=>twMerge("fixed inset-0 z-50","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",e?"bg-transparent":["bg-gradient-to-br from-black/20 via-black/15 to-black/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-black/15"].join(" "),n.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),n.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),a)),children:t})}function Yr({isEntering:e,isExiting:o,className:t="",disableGroup:r=false}){let a=[!r&&"group","bg-background-surface","forced-colors:bg-[Canvas]","shadow-lg","rounded-[var(--control-border-radius)]","bg-clip-padding","border","border-border-default","outline-none"].filter(Boolean).join(" "),n=e?["animate-in","fade-in","placement-bottom:slide-in-from-top-1","placement-top:slide-in-from-bottom-1","placement-left:slide-in-from-right-1","placement-right:slide-in-from-left-1","ease-out","duration-200"].join(" "):"",i=o?["animate-out","fade-out","placement-bottom:slide-out-to-top-1","placement-top:slide-out-to-bottom-1","placement-left:slide-out-to-right-1","placement-right:slide-out-to-left-1","ease-in","duration-150"].join(" "):"";return [a,n,i,t].filter(Boolean).join(" ")}function Ne({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:a=true,disableGroup:n=false,...i}){let l=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",u=o?12:8;u=l?u-6:u;let c=jsxs(Popover,{offset:u,...i,className:composeRenderProps(r,(d,x)=>Yr({...x,className:d,disableGroup:n})),children:[o&&jsx(OverlayArrow,{children:jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",className:"block fill-background-surface stroke-border-default stroke-1 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children:jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsx(Ve,{isDismissable:a,children:jsx(Modal,{className:"outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:a,children:c})}):c}var uo=createContext("md");function mo(){return useContext(uo)}function lo(e="md"){return `flex-1 text-start data-[placeholder]:text-text-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${B[e].text}`}function aa(){let e=pe__default.useCallback((t,r)=>{r?.(t);},[]),o=pe__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function mt({label:e,description:o,errorMessage:t,children:r,items:a,renderItem:n,renderSelectedValue:i,size:s="md",selectedKey:l,defaultSelectedKey:u,onSelectionChange:c,placeholder:d,showErrors:x=false,tooltip:y,isRequired:b,transparent:m,reserveErrorSpace:P=false,placement:h="bottom start",shouldFlip:F=true,menuWidth:$="match",descriptionPlacement:L="below",...g}){let[S,T]=useState(null),[k,Q]=useState(null),X=l??S??u,{handleFocus:O,handleBlur:Pe}=aa(),se=pe__default.useMemo(()=>!i||!X||!a?null:Array.from(a).find(me=>me.id===X)??null,[i,X,a]),le=C=>{c&&C!==null&&c(C),c||T(C);},ue=useRef(null),E=useRef(null);return jsx(Select,{...g,selectedKey:X,defaultSelectedKey:u,onSelectionChange:le,placeholder:d,className:z(g.className,"group flex w-full flex-col"),ref:ue,onOpenChange:C=>{C&&E.current?Q(E.current.offsetWidth):C||ue.current?.blur();},children:({isDisabled:C,isInvalid:me,isOpen:Fe})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(M,{size:s,tooltip:y,description:L==="tooltip"||L==="inline"?o:void 0,descriptionPlacement:L,isRequired:b,children:e}),jsx(Y,{children:jsx("div",{ref:E,children:jsxs(v,{variant:"unstyled",className:twMerge(oe({isInvalid:me||x&&!!t,isDisabled:C,isFocused:Fe,transparent:m,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:q=>O(q,g.onFocus),onBlur:q=>Pe(q,g.onBlur),"data-open":Fe,children:[i&&se?jsx("div",{className:lo(s),children:i(se)}):jsx(SelectValue,{className:lo(s)}),jsx(f,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-body group-disabled:text-gray-200 forced-colors:text-[ButtonText] transition-transform",Fe&&"rotate-180")})]})})}),P?jsx("div",{className:"mt-1 min-h-[20px]",children:x?jsx(p,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&g.validationResult?t(g.validationResult):typeof t=="string"?t:null}):o&&L==="below"?jsx(N,{size:s,children:o}):null}):jsx(Fragment,{children:x?jsx(p,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&g.validationResult?t(g.validationResult):typeof t=="string"?t:null}):o&&L==="below"?jsx(N,{size:s,className:"mt-1",children:o}):null}),jsx(Ne,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:$==="match"&&k?`${k}px`:void 0,minWidth:$==="auto"&&k?`${k}px`:void 0,maxWidth:$==="auto"?"min(600px, 90vw)":void 0},placement:h,shouldFlip:F,children:jsx(uo.Provider,{value:s,children:jsx(ListBox,{items:a,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:n&&a?q=>jsx(Se,{id:q.id,textValue:q.label,size:s,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(q)})},q.id):r})})})]})})}function Se({size:e,className:o,...t}){let r=mo(),a=e??r;return jsx(ListBoxItem,{...t,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-body data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",B[a].paddingY,B[a].text,o)})}var xa={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},ga={sm:"pl-7",md:"pl-9",lg:"pl-10",xl:"pl-12"},po={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"};function ha(){let e=pe__default.useContext(ComboBoxStateContext);return jsx(Button,{slot:null,className:"clear-button","aria-label":"Clear",onPress:()=>e?.setSelectedKey(null),children:"\u2715"})}var xt=(e,o,t)=>{if(e==null||e==="")return "";let a=(t?t.flatMap(n=>n.items):o||[]).find(n=>n.id===e);return a?a.name:""};async function va(e,o,t){try{let r=e.url.replace("{q}",o),a=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([l,u])=>{a.append(l,u.toString());});let n=`${r}${a.toString()?"?"+a.toString():""}`,i=await fetch(n,{method:"GET",headers:e.headers,signal:t});if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);let s=await i.json();return {items:e.transformResponse(s)}}catch(r){console.error("Error in REST request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}async function ya(e,o,t){try{let r=e.graphqlQuery.replace(`$${e.variableKey||"filter"}`,`"${o}"`),a=await fetch(e.url,{method:"POST",headers:{"Content-Type":"application/json",...e.headers},body:JSON.stringify({query:r}),signal:t});if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);let n=await a.json();if(n.errors)throw new Error(n.errors[0]?.message||"GraphQL error occurred");return e.responsePath&&(n=e.responsePath.split(".").reduce((i,s)=>i?.[s],n)),{items:e.transformResponse(n)}}catch(r){console.error("Error in GraphQL request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}function ht({label:e,staticItems:o=[],sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:l,errorMessage:u,description:c,size:d="md",tooltip:x,isRequired:y,isDisabled:b,isInvalid:m,validationResult:P,showErrors:h=true,renderItem:F,renderLeftIcon:$,renderSection:L,autoFocus:g=false,reserveErrorSpace:S=false}){let T=pe__default.useRef(null),[k,Q]=pe__default.useState(),[X,O]=useState(()=>xt(r||a,o,t)),[Pe,se]=useState(false),le=jt(X),{contains:ue}=Oe({sensitivity:"base"}),[E,C]=useState(),me=B[d].text,Fe=B[d].height,q=null;useEffect(()=>{g&&se(true);},[g]),useEffect(()=>{let W=()=>{T.current&&Q(T.current.offsetWidth);};return W(),window.addEventListener("resize",W),()=>window.removeEventListener("resize",W)},[]),useEffect(()=>{q&&q.setFilterText(le);},[le,q]),i&&(q=useAsyncList({async load({signal:W,filterText:A=""}){if(!i.url||i.shouldLoad&&!i.shouldLoad(A))return {items:[]};try{let ee;return i.requestType==="GraphQL"?ee=await ya(i,A,W):ee=await va(i,A,W),C(ee.error),{items:ee.items}}catch(ee){return console.error("Error loading items:",ee),C(ee instanceof Error?ee.message:"Unknown error occurred"),{items:[]}}},initialFilterText:""})),le===""&&(q=null);let Yo=W=>{let A=xt(W,o,t);O(A),n&&n(W);},Jo=W=>{O(W);let A=xt(r,o,t);r!=null&&W!==A&&n&&n(null);};return jsx(ComboBox,{onSelectionChange:Yo,selectedKey:r||void 0,defaultSelectedKey:a||void 0,defaultItems:t?t.flatMap(W=>W.items):o,items:q?q.items:void 0,className:z("group flex flex-col","w-full"),menuTrigger:"focus",isDisabled:b,isInvalid:m||!!u,inputValue:X,onInputChange:Jo,autoFocus:g,defaultFilter:s||ue,"aria-label":e||l||"Autocomplete",children:W=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(M,{size:d,tooltip:x,isRequired:y,children:e}),jsxs(Group,{ref:T,className:oo({size:d,isInvalid:m||!!u,isDisabled:b,isFocusWithin:Pe||W.isOpen,className:"w-full cursor-pointer"}),"aria-label":e||l||"Autocomplete",style:{position:"relative"},children:[$?jsx("div",{className:"absolute left-3",children:$(!!q?.isLoading)}):jsx(f,{name:"MagnifyingGlass",className:`${xa[d]} absolute left-3 text-inherit`}),jsx(Input,{className:`flex-1 min-w-0 border-none pr-3 outline-0 placeholder:text-text-placeholder ${ga[d]} ${me} ${Fe} ${b?"bg-background-muted":"bg-background-input"}`,placeholder:l,disabled:b,onFocus:()=>se(true),onBlur:()=>se(false)}),X&&!b&&jsx(ha,{}),jsx(Button,{className:`px-2 text-text-body ${me} ${Fe} ${b?"bg-background-muted":"bg-background-input"}`,"aria-label":"Toggle menu",isDisabled:b,children:({isPressed:A})=>jsx(f,{name:A?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),S?jsx("div",{className:"mt-1 min-h-[20px]",children:h&&E?jsx(p,{size:d,className:"text-feedback-error-text",children:E}):h&&typeof u=="string"?jsx(p,{size:d,className:"text-feedback-error-text",children:u}):h&&typeof u=="function"&&P?jsx(p,{size:d,className:"text-feedback-error-text",children:u(P)}):c?jsx(N,{size:d,children:c}):null}):jsxs(Fragment,{children:[c&&jsx(N,{size:d,className:"mt-1",children:c}),h&&E&&jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:E}),h&&typeof u=="string"&&jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:u}),h&&typeof u=="function"&&P&&jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:u(P)})]}),jsx(Ne,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm ring-1 ring-black/5 rounded-[var(--control-border-radius)]",style:{minWidth:k?`${k}px`:void 0},children:jsx(ListBox,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${me}`,children:t?t.map(A=>{let ee=A.items.map(ae=>jsx(Se,{id:ae.id,textValue:ae.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${po[d]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium`,children:F?F(ae):jsxs(Fragment,{children:[ae.name,jsx(f,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},ae.id));if(L){let ae=L(A,ee);return pe__default.isValidElement(ae)&&ae.type===ListBoxSection?ae:jsx(ListBoxSection,{children:ae},A.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:A.name}),ee]},A.name)}):A=>jsx(Se,{id:A.id,textValue:A.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${po[d]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium`,children:F?F(A):jsxs(Fragment,{children:[A.name,jsx(f,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},A.id)})})]})})}function I(e,o){let t=o.split("."),r=e;for(let n of t)if(r&&typeof r=="object"&&n in r)r=r[n];else {r=void 0;break}let a=r?.message;return typeof a=="string"?a:void 0}function cd({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ht,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}function go(e){return jsxs(CheckboxGroup,{...e,className:z(e.className,"flex flex-col gap-2"),children:[jsx(M,{children:e.label}),e.children,e.description&&jsx(N,{children:e.description}),jsx(p,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function wa({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function ka({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r,variant:a="default"}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",i=a==="brand"?"focus:ring-action-brand":"focus:ring-action-default",s="";if(t)s="border-border-muted bg-background-muted";else if(o)s="border-feedback-error-border bg-feedback-error-background";else if(e||r){let l=a==="brand"?"action-brand":"action-default";s=`bg-${l} border-${l} hover:bg-${l}-hover hover:border-${l}-hover`;}else s="bg-background-input border-border-input hover:border-border-focus";return `${n} ${i} ${s}`}var xo="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function ho(e){let{children:o,variant:t="default",...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(a,n)=>`${wa(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,l=jsx("div",{className:ka({isSelected:n,isIndeterminate:i,variant:t,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:xo}):n?jsx(Check,{"aria-hidden":true,className:xo}):null});return jsxs(Fragment,{children:[l,typeof o=="function"?o(a):o]})}})}function Td({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=useFormContext(),i=I(n.errors,e);return jsx(Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(ho,{...r,isSelected:!!s.value,onChange:l=>s.onChange(l),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(p,{children:i})]})})}function Vd({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(go,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}function we(e){if(!e)return false;let o=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(o)}function Pt(e){if(!e)return "";let o=e.startsWith("#")?e.slice(1):e;return o.length===3&&(o=o.split("").map(t=>t+t).join("")),`#${o.toUpperCase()}`}function Fo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,className:s,validationResult:l,value:u,defaultValue:c,onChange:d,placeholder:x="#000000",showColorSwatch:y=true,reserveErrorSpace:b=true,...m}){let[P,h]=useState(c||""),[F,$]=useState(u||c||""),[L,g]=useState(false),[S,T]=useState(null),{isFocused:k,handleFocus:Q,handleBlur:X}=de(),O=u!==void 0?u:P;useEffect(()=>{u!==void 0&&$(u);},[u]);let Pe=O?!we(O):false,se=useCallback(E=>{if($(E),we(E)){let C=Pt(E);d?d(C):h(C);}else E===""&&(d?d(""):h(""));},[d]),le=useCallback(E=>{let C=Pt(E);$(C),d?d(C):h(C);},[d]),ue=useCallback(E=>{if(we(F)){let C=Pt(F);$(C),d&&C!==O?d(C):!d&&C!==P&&h(C);}X(E,m.onBlur);},[F,O,P,d,X,m.onBlur]);return jsx(TextField,{...m,isRequired:n,className:z(s,"group flex flex-col"),children:({isDisabled:E})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(M,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Y,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(qe,{size:r,disabled:E,type:"text",value:F,placeholder:x,onFocus:C=>Q(C,m.onFocus),onBlur:ue,onChange:C=>se(C.target.value),className:twMerge(oe({isInvalid:Pe,isDisabled:E,isFocused:k,size:r,transparent:i}),y?"pr-12":"pr-3","pl-3")}),y&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:B[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",we(O)?"border-border-default":"border-border-default bg-background-muted"),style:we(O)?{backgroundColor:O}:void 0,"aria-hidden":"true",children:!we(O)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:T,children:jsx(v,{variant:"secondary",size:r,icon:"Palette",onPress:()=>g(!L),isDisabled:E,className:"flex-shrink-0",children:"Pick"})})]})}),b?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&l?jsx(p,{size:r,children:t(l)}):o?jsx(N,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(p,{size:r,className:"mt-1",children:t(l)}):o?jsx(N,{size:r,className:"mt-1",children:o}):null}),L&&S&&jsx(Ne,{triggerRef:{current:S},isOpen:L,onOpenChange:g,placement:"bottom end",className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-lg p-4",children:jsxs("div",{className:"flex flex-col gap-4",children:[jsx(HexColorPicker,{color:O||"#000000",onChange:le,style:{width:"200px",height:"200px"}}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:O||"#000000"}}),jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:O||"#000000"})]})]})})]})})}function Yd({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Fo,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function Ya({isSelected:e,isDisabled:o}){let t=[fe,"w-9 h-9 text-sm cursor-default rounded-sm flex items-center justify-center forced-color-adjust-none font-semibold"];return o?t.push("text-text-disabled forced-colors:text-[GrayText]"):e?t.push("bg-action-default text-text-onPrimary invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-body hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function Ct({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(Ro,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(So,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${Ya({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function Ro(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(v,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(f,{name:"CaretRight","aria-hidden":true,size:o}):jsx(f,{name:"CaretLeft","aria-hidden":true,size:o})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-zinc-900 dark:text-zinc-200"}),jsx(v,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(f,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(f,{name:"CaretRight","aria-hidden":true,size:o})})]})}function So(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}function St({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,showCalendar:l=true,reserveErrorSpace:u=true,validationResult:c,className:d,...x}){let[y,b]=useState(false),m=P=>{x.onChange&&P&&x.onChange(P),b(false);};return jsxs(DateField,{...x,isDisabled:i,isRequired:n,isInvalid:s,className:z(d,"flex flex-col gap-1"),children:[e&&jsx(M,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Y,{children:jsxs("div",{className:"relative w-full",children:[jsx(To,{size:r,isDisabled:i,isInvalid:s,hasCalendar:l}),l&&!i&&jsxs(DialogTrigger,{isOpen:y,onOpenChange:b,children:[jsx(v,{variant:"unstyled",className:"absolute right-2 top-1/2 -translate-y-1/2 flex h-8 w-8 items-center justify-center rounded hover:bg-background-hover text-text-muted hover:text-text-body transition-colors","aria-label":"Open calendar",children:jsx(f,{name:"Calendar",size:18})}),jsx(Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsx(Dialog,{className:"p-4 outline-none",children:jsx(Ct,{value:x.value,onChange:m,minValue:x.minValue,maxValue:x.maxValue,isDisabled:i,isReadOnly:x.isReadOnly,isDateUnavailable:x.isDateUnavailable})})})]})]})}),u?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&c?jsx(p,{size:r,children:t(c)}):o?jsx(N,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(p,{size:r,className:"mt-1",children:t(c)}):o?jsx(N,{size:r,className:"mt-1",children:o}):null})]})}function nn({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function To({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:a,...n}){return jsx(DateInput,{className:twMerge(Re({isInvalid:t,isDisabled:o}),"px-3 py-2 flex items-center gap-0.5 w-full",r&&"pr-10",a),...n,children:i=>jsx(DateSegment,{segment:i,className:nn({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function Ic({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(St,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function Nt({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:a,isDisabled:n=false,onUpload:i,className:s,showPreview:l=true,placeholder:u="Drop files here or click to browse"}){let[c,d]=useState(false),[x,y]=useState(false),[b,m]=useState(null),[P,h]=useState(e),F=useRef(null),$=async S=>{if(m(null),a&&S.size>a){m(`File size must be less than ${(a/1024/1024).toFixed(2)}MB`);return}if(l&&S.type.startsWith("image/")){let T=new FileReader;T.onloadend=()=>{h(T.result);},T.readAsDataURL(S);}if(i){y(true);try{let T=await i(S);h(T),t?.(T);}catch(T){m("Failed to upload file"),console.error("Upload error:",T);}finally{y(false);}}o?.(S,P);},L=S=>{let T=S.items;if(T.length>0){let k=T[0];if(k.kind==="file"){let Q=k.getAsFile();Q&&$(Q);}}d(false);},g=()=>{h(void 0),m(null),o?.(null),t?.(""),F.current&&(F.current.value="");};return jsxs("div",{className:twMerge("w-full",s),children:[jsxs(DropZone,{className:twMerge("relative flex min-h-[200px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",c?"border-action-brand bg-action-brand/5":"border-border-muted hover:border-border-default",n&&"pointer-events-none opacity-50",b&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:L,onDropEnter:()=>d(true),onDropExit:()=>d(false),children:[P?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[l&&P.startsWith("data:image")?jsx("img",{src:P,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image,{className:"h-12 w-12 text-text-muted"}),jsx("span",{className:"text-sm text-text-muted",children:"File uploaded"})]}),!n&&jsx(v,{variant:"icon",size:"sm",onPress:g,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-muted"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-body",children:u}),jsx("p",{className:"mt-1 text-xs text-text-muted",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsx(FileTrigger,{acceptedFileTypes:r.split(","),onSelect:S=>{let T=Array.from(S||[]);T.length>0&&$(T[0]);},children:jsx(v,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),x&&jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsx("span",{className:"text-sm text-text-muted",children:"Uploading..."})]})})]}),b&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:b})]})}function Kc({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=useFormContext(),i=I(n.errors,e);return jsx(Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxs("div",{className:"flex flex-col gap-1",children:[jsx(Nt,{...r,value:s.value??"",onChange:(l,u)=>s.onChange(u||"")}),t&&i&&jsx(p,{children:i})]})})}var Rn=e=>{let o=oe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size});return twMerge(o,"pr-9","[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",e.className)};function kt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,validationResult:s,reserveErrorSpace:l=true,descriptionPlacement:u="below",...c}){let d=useId(),{isFocused:x,handleFocus:y,handleBlur:b}=de();return jsx(NumberField,{...c,id:d,isRequired:n,className:z(c.className,"group flex flex-col gap-1"),step:c.step??1,onChange:m=>{typeof m=="number"&&(c.maxValue!=null&&m>c.maxValue?c.onChange?.(c.maxValue):c.minValue!=null&&m<c.minValue?c.onChange?.(c.minValue):c.onChange?.(m));},isInvalid:!!t||typeof c.value=="number"&&(c.maxValue!=null&&c.value>c.maxValue||c.minValue!=null&&c.value<c.minValue),children:({isDisabled:m,isInvalid:P})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(M,{size:r,tooltip:a,description:u==="tooltip"||u==="inline"?o:void 0,descriptionPlacement:u,isRequired:n,htmlFor:d,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:F=>y(F,c.onFocus),onBlur:F=>b(F,c.onBlur),className:Rn({isInvalid:P||!!t,isDisabled:m,isFocused:x,transparent:i,size:r,className:typeof c.className=="string"?c.className:void 0})}),jsxs("div",{className:"absolute inset-y-[2px] right-[2px] flex flex-col divide-y divide-border-default border-l border-border-default overflow-hidden rounded-r-[calc(var(--control-border-radius)-2px)]",children:[jsx(Button,{slot:"increment",isDisabled:m,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(f,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:m,className:"flex h-1/2 w-7 items-center justify-center bg-background-input hover:bg-background-input-hover active:bg-background-input-active disabled:cursor-not-allowed disabled:opacity-50",children:jsx(f,{name:"CaretDown",size:14})})]})]})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(p,{size:r,children:typeof t=="function"?t(s):t}):o&&u==="below"?jsx(N,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(p,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&u==="below"?jsx(N,{size:r,className:"mt-1",children:o}):null})]})})}function uu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(kt,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}var In=createContext({variant:"brand"});function It(e){let{variant:o="default",...t}=e;return jsx(In.Provider,{value:{variant:o},children:jsxs(RadioGroup,{...t,className:z(e.className,"group flex flex-col gap-2"),children:[jsx(M,{children:e.label}),jsx("div",{className:"flex gap-2 group-orientation-horizontal:gap-4 group-orientation-vertical:flex-col",children:e.children}),e.description&&jsx(N,{children:e.description}),jsx(p,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function Bu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(It,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}var En={xs:"text-lg font-semibold",sm:"text-xl font-semibold",md:"text-2xl font-semibold",lg:"text-3xl font-semibold",xl:"text-4xl font-semibold"},Dn={page:"h-16 leading-[62px]"};function Ae({tag:e="h1",size:o="lg",height:t,className:r="",children:a}){let n=En[o],i=t?Dn[t]:"";return jsx(e,{className:twMerge(n,i,r),children:a})}var $t=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:a=false,onBack:n,headerContent:i})=>jsxs("div",{className:twMerge("relative flex h-16 w-full flex-shrink-0 items-center justify-between border-b px-6",e&&"border-b",r==="center"?"justify-center":""),children:[a&&jsx(v,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsx(f,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(Ae,{size:"xs",children:e}),o&&!t&&jsx(v,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(f,{name:"X","data-testid":"close-button"})})]})]});var Bt=({className:e,size:o=24,color:t="text-action-brand"})=>jsx("div",{className:twMerge("inline-block animate-spin rounded-full border-2 border-solid border-current border-r-transparent",t,e),style:{width:o,height:o},role:"status","aria-label":"loading",children:jsx("span",{className:"sr-only",children:"Loading..."})});var _n=e=>{let o=oe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"pl-8":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(o,t,e.className)};function Me({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,showSearchIcon:s,isClearable:l,onClear:u,type:c,validationResult:d,reserveErrorSpace:x=true,isLoading:y=false,descriptionPlacement:b="below",...m}){let[P,h]=pe__default.useState(false),{isFocused:F,handleFocus:$,handleBlur:L}=de(),g=c==="password";return jsx(TextField,{...m,isRequired:n,className:z(m.className,"group flex flex-col"),children:({isDisabled:S,isInvalid:T})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(M,{size:r,tooltip:a,description:b==="tooltip"||b==="inline"?o:void 0,descriptionPlacement:b,isRequired:n,children:e}),jsxs(Y,{children:[s&&jsx("div",{className:"pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 transform flex items-center",children:y?jsx(Bt,{size:16,color:"text-text-muted"}):jsx(f,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-muted translate-y-[0.5px]"})}),jsx(qe,{size:r,disabled:S,type:g?P?"text":"password":c,value:m.value,defaultValue:m.defaultValue,placeholder:m.placeholder,onFocus:k=>$(k,m.onFocus),onBlur:k=>L(k,m.onBlur),onChange:k=>m.onChange?.(k.target.value),className:_n({isInvalid:T,isDisabled:S,isFocused:F,size:r,transparent:i,showSearchIcon:s,isClearable:l,hasValue:!!m.value,isPassword:g,className:typeof m.className=="string"?m.className:void 0})}),l&&m.value&&!S&&jsx(eo,{onClick:()=>{u?u():m.onChange&&m.onChange("");},size:r}),g&&!S&&jsx("button",{type:"button",onClick:()=>h(!P),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":P?"Hide password":"Show password",onMouseDown:k=>{k.preventDefault(),k.stopPropagation();},children:jsx(f,{name:P?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-body"})})]}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&d?jsx(p,{size:r,children:t(d)}):o&&b==="below"?jsx(N,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(p,{size:r,className:"mt-1",children:t(d)}):o&&b==="below"?jsx(N,{size:r,className:"mt-1",children:o}):null})]})})}var he=({isActive:e=false,onPress:o,children:t})=>jsx(v,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function ei({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[a,n]=useState(e);return pe__default.useEffect(()=>{n(e);},[e]),jsx(Ve,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsx(Modal,{isDismissable:true,className:"flex items-center justify-center p-4 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",children:jsx(Dialog,{className:"relative bg-background-surface rounded-lg shadow-xl max-w-md w-full",children:jsxs("form",{onSubmit:s=>{s.preventDefault(),r(a),t();},children:[jsx($t,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(Me,{label:"URL",type:"url",value:a,onChange:n,autoFocus:true,className:"w-full"})}),jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsx(v,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(v,{type:"submit",children:"Save"})]})]})})})})}function Lt({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:a="Start typing...",id:n}){let[i,s]=useState(false),l=useEditor({immediatelyRender:false,extensions:[Xn.configure({heading:{levels:[1,2]}}),Kn.configure({openOnClick:false,HTMLAttributes:{class:"text-text-link-default hover:text-text-link-hover underline decoration-text-link-default/30 hover:decoration-text-link-hover cursor-pointer"}})],content:e,editable:!r,onUpdate:({editor:d})=>{o?.(d.getHTML());},editorProps:{attributes:{class:twMerge("prose prose-sm max-w-none","focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),u=()=>{s(true);},c=d=>{d===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:d}).run();};return l?jsxs("div",{id:n,"data-richtexteditor":true,className:twMerge("flex flex-col rounded-md border border-border-input bg-background-input","outline-none focus-within:outline-none focus-within:border-border-input focus-within:ring-0 focus-within:shadow-none",r&&"opacity-50",t),style:{outline:"none"},children:[l&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:l,shouldShow:({editor:d})=>d.isActive("link")&&!i,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxs(v,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let d=l.getAttributes("link").href;window.open(d,"_blank");},children:[jsx(f,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(v,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:u,children:[jsx(f,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(v,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(f,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(ei,{isOpen:i,onClose:()=>s(false),onSubmit:c,initialUrl:l.getAttributes("link").href||""})]}),jsxs("div",{className:"flex items-center gap-1 border-b border-border-input p-2",children:[jsx(he,{isActive:l.isActive("heading",{level:1}),onPress:()=>l.chain().focus().toggleHeading({level:1}).run(),children:jsx("span",{className:"text-xs font-bold",children:"H1"})}),jsx(he,{isActive:l.isActive("heading",{level:2}),onPress:()=>l.chain().focus().toggleHeading({level:2}).run(),children:jsx("span",{className:"text-xs font-bold",children:"H2"})}),jsx(he,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(he,{isActive:l.isActive("italic"),onPress:()=>l.chain().focus().toggleItalic().run(),children:jsx("span",{className:"text-xs italic",children:"I"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(he,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(f,{name:"ListBullets",className:"h-4 w-4"})}),jsx(he,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(f,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(he,{isActive:l.isActive("link"),onPress:u,children:jsx(f,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxs("div",{className:"relative min-h-[200px] w-full outline-none focus:outline-none",children:[jsx(EditorContent,{editor:l,className:twMerge("w-full p-4 outline-none focus:outline-none","[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none","[&_.ProseMirror_h1]:mb-4 [&_.ProseMirror_h1]:text-2xl [&_.ProseMirror_h1]:font-bold","[&_.ProseMirror_h2]:mb-3 [&_.ProseMirror_h2]:text-xl [&_.ProseMirror_h2]:font-semibold","[&_.ProseMirror_p]:mb-2","[&_.ProseMirror_ul]:mb-2 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:mb-2 [&_.ProseMirror_ol]:ml-6 [&_.ProseMirror_ol]:list-decimal","[&_.ProseMirror_li]:mb-1","[&_.ProseMirror_blockquote]:border-l-4 [&_.ProseMirror_blockquote]:border-border-muted [&_.ProseMirror_blockquote]:pl-4 [&_.ProseMirror_blockquote]:italic","[&_.ProseMirror_code]:rounded [&_.ProseMirror_code]:bg-background-muted [&_.ProseMirror_code]:px-1 [&_.ProseMirror_code]:py-0.5 [&_.ProseMirror_code]:font-mono [&_.ProseMirror_code]:text-sm","[&_.ProseMirror_pre]:rounded-md [&_.ProseMirror_pre]:bg-background-muted [&_.ProseMirror_pre]:p-3 [&_.ProseMirror_pre]:font-mono [&_.ProseMirror_pre]:text-sm","[&_.ProseMirror_hr]:border-border-muted",r&&"pointer-events-none")}),l.isEmpty&&!r&&jsx("div",{className:"pointer-events-none absolute left-4 top-4 text-text-muted",children:a})]})]}):null}function Im({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=useFormContext(),l=I(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field:u})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx("label",{htmlFor:e,className:"text-sm font-medium text-text-heading",children:t}),r&&jsx("p",{className:"text-sm text-text-muted",children:r}),jsx(Lt,{...n,id:e,initialContent:u.value??"",onChange:c=>u.onChange(c)}),l&&jsx("p",{className:"text-sm text-feedback-error-text",children:l}),a&&!l&&jsx("div",{className:"h-5"})]})})}function Mm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(mt,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var Dt={sm:{track:"h-4 w-7",handle:"h-3.5 w-3.5",text:"text-xs"},md:{track:"h-5 w-9",handle:"h-4 w-4",text:"text-sm"},lg:{track:"h-6 w-11",handle:"h-5 w-5",text:"text-base"},xl:{track:"h-7 w-14",handle:"h-6 w-6",text:"text-lg"}};function li({isSelected:e,isDisabled:o,variant:t="default",size:r="md"}){let a="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=Dt[r].track,i=fe,s=t==="brand"?"focus-visible:outline-action-brand":"focus-visible:outline-action-default",l="";return e?t==="brand"?l="bg-action-brand forced-colors:!bg-[Highlight] group-pressed:bg-action-brand-hover":l="bg-action-default forced-colors:!bg-[Highlight] group-pressed:bg-action-default-hover":l="bg-gray-400 dark:bg-zinc-400 group-pressed:bg-gray-500 dark:group-pressed:bg-zinc-300",[a,n,i,s,l,o?"bg-gray-200 dark:bg-zinc-700 forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function di({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-white dark:bg-zinc-900 outline-none shadow transition duration-200 ease-in-out",a=Dt[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function At({children:e,variant:o="default",size:t="md",...r}){return jsx(Switch,{...r,className:z(r.className,`group flex items-center gap-2 ${Dt[t].text} text-gray-800 transition disabled:text-gray-300 dark:text-zinc-200 dark:disabled:text-zinc-600 forced-colors:disabled:text-[GrayText]`),children:a=>jsxs(Fragment,{children:[jsx("div",{className:li({...a,variant:o,size:t}),children:jsx("span",{className:di({...a,size:t})})}),e]})})}function Ym({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(At,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var bi=e=>{let o=oe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=`min-h-[100px] py-2 ${e.isDisabled?"resize-none":e.isResizable?"resize-y":"resize-none"}`;return twMerge(o,t,e.className)};function zt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,required:n,transparent:i,isInvalid:s,isDisabled:l,isResizable:u=false,className:c,validationResult:d,reserveErrorSpace:x=true,...y}){let{isFocused:b,handleFocus:m,handleBlur:P}=de();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(M,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Y,{children:jsx("textarea",{...y,required:n,onFocus:h=>{y.onFocus&&y.onFocus(h),m(h);},onBlur:h=>{y.onBlur&&y.onBlur(h),P(h);},className:bi({isInvalid:s,isDisabled:l,isResizable:u,isFocused:b,size:r,transparent:i,className:c}),disabled:l})}),x?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&d?jsx(p,{size:r,children:t(d)}):o?jsx(N,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(p,{size:r,className:"mt-1",children:t(d)}):o?jsx(N,{size:r,className:"mt-1",children:o}):null})]})})}function cp({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(zt,{...t,value:i.value??"",onChange:s=>i.onChange(s.target.value),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,required:t.required})})}function xp({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=I(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Me,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Si({isPlaceholder:e,isDisabled:o,size:t="md"}){return twMerge("inline-block box-content px-0.5 rounded outline-none tabular-nums text-center transition-colors",{sm:"text-base md:text-xs",md:"text-base md:text-sm",lg:"text-base",xl:"text-lg"}[t],e?"text-text-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function Mt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,reserveErrorSpace:l=true,validationResult:u,className:c,descriptionPlacement:d="below",...x}){return jsxs(TimeField,{...x,isDisabled:i,isRequired:n,isInvalid:s,className:z(c,"flex flex-col gap-1"),children:[e&&jsx(M,{size:r,tooltip:a,description:d==="tooltip"||d==="inline"?o:void 0,descriptionPlacement:d,isRequired:n,children:e}),jsx(Y,{children:jsx(DateInput,{className:twMerge(Re({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:y=>jsx(DateSegment,{segment:y,className:Si({isPlaceholder:y.isPlaceholder,isDisabled:!y.isEditable||i,size:r})})})}),l?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(p,{size:r,children:t}):typeof t=="function"&&u?jsx(p,{size:r,children:t(u)}):o&&d==="below"?jsx(N,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(p,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(p,{size:r,className:"mt-1",children:t(u)}):o&&d==="below"?jsx(N,{size:r,className:"mt-1",children:o}):null})]})}function Dp({name:e,...o}){let{control:t,formState:{errors:r}}=useFormContext(),a=r[e],n=a?.message;return jsx(Controller,{name:e,control:t,render:({field:i})=>jsx(Mt,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function Gp({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),a=pe.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(pe.useEffect(()=>{t&&s&&a.current?.focus();},[t,s]),!s)return null;let l=u=>{let c=`[name="${CSS.escape(u)}"]`,d=document.querySelector(c);d&&(d.focus(),d.scrollIntoView({block:"center",behavior:"smooth"}));};return jsxs("div",{ref:a,role:"alert",tabIndex:-1,className:twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsx("div",{className:"font-medium",children:o}),jsx("ul",{className:"mt-2 list-disc pl-5",children:i.map(([u,c])=>{let d=c?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>l(u),children:d})},u)})})]})}function Kp({formId:e,disableWhenInvalid:o,disableWhenPristine:t,isDisabled:r,children:a,...n}){let{formState:i}=useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsx(v,{type:"submit",form:e,isDisabled:s,...n,children:a})}var re=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:a=false,flex:n=false,stack:i,responsive:s,delay:l=0,adjustAnimationSpeedBasedOnWidth:u=false,ariaLabel:c,className:d,"data-testid":x})=>{let[y,b]=useState(l===0);if(useEffect(()=>{if(l>0){let g=setTimeout(()=>b(true),l);return ()=>clearTimeout(g)}},[l]),!y)return null;let m=a?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",P=u&&e?(()=>{let g=typeof e=="number"?e:parseFloat(String(e));return isNaN(g)?"":`animation-duration-[${Math.max(.8,g/100)}s]`})():"",h=r==="pulse"?`animate-pulse ${P}`:r==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${P}`:"",F="rounded-sm";t==="circle"&&(F="rounded-full"),t==="text"&&(F="h-4 w-full rounded-sm");let $=n?"flex-1 min-w-0":"",L=s?Object.entries(s).map(([g,S])=>`${g}:w-[${S}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":x,children:i.map((g,S)=>jsx("div",{className:twMerge(m,h,F,$,L,d),style:{width:g,height:o}},S))}):jsx("div",{className:twMerge(m,h,F,$,L,d),style:{width:e,height:o},role:"presentation","aria-hidden":!c,"aria-label":c??void 0,"data-testid":x})};var Ai={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},zi="rounded-lg",Gt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Mi={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function ve({variant:e="outlined",className:o,children:t,isLoading:r=false}){return jsx("div",{className:twMerge("w-full overflow-hidden",Ai[e],zi,o),"data-testid":"card",children:r?jsx(re,{width:"100%",height:"100%",className:"rounded-none"}):t})}function Qe({title:e,subtitle:o,actions:t,className:r,isLoading:a=false}){return a?jsxs("div",{className:twMerge("p-6 pb-4",r),children:[jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsx(re,{width:120,height:20}),jsx(re,{width:24,height:24})]}),o&&jsx(re,{width:200,height:16})]}):!e&&!o&&!t?null:jsx("div",{className:twMerge("p-6 pb-4",r),children:jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsx("div",{className:"mb-1",children:typeof e=="string"?jsx(Ae,{tag:"h3",size:"sm",className:"text-text-heading",children:e}):e}),o&&jsx("div",{className:"text-sm text-text-muted",children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function _o({src:e,alt:o,aspectRatio:t="auto",className:r,children:a,isLoading:n=false}){return n?jsx("div",{className:twMerge("bg-background-muted",Gt[t],r),children:jsx(re,{width:"100%",height:"100%"})}):a?jsx("div",{className:twMerge("overflow-hidden",Gt[t],r),children:a}):e?jsx("div",{className:twMerge("overflow-hidden",Gt[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function Xe({className:e,children:o,isLoading:t=false}){let a=e?.match(/p(?:t|b|l|r|x|y)?-(?:\d+(?:\.\d+)?|px|\[.+?\])/)?"":"px-6 py-4";return t?jsx("div",{className:twMerge(a,e),children:jsxs("div",{className:"space-y-2",children:[jsx(re,{width:"100%",height:16}),jsx(re,{width:"80%",height:16}),jsx(re,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge("px-6 py-4 text-text-body",e),children:o}):null}function Wo({className:e,children:o,align:t="end",isLoading:r=false}){return r?jsxs("div",{className:twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsx(re,{width:80,height:32}),jsx(re,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",Mi[t],e),children:o}):null}ve.Header=Qe;ve.Media=_o;ve.Content=Xe;ve.Footer=Wo;function uf({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:a}=useFormContext(),{fields:n,append:i,remove:s,swap:l}=useFieldArray({control:a,name:e});return jsxs("div",{className:"flex flex-col gap-3",children:[n.map((u,c)=>jsxs(ve,{children:[jsx(Qe,{title:o?o(c):`Item ${c+1}`,actions:jsxs("div",{className:"flex gap-2",children:[c>0&&jsx(v,{size:"sm",variant:"secondary",onPress:()=>l(c,c-1),children:"Up"}),c<n.length-1&&jsx(v,{size:"sm",variant:"secondary",onPress:()=>l(c,c+1),children:"Down"}),jsx(v,{size:"sm",variant:"secondary",onPress:()=>s(c),children:"Remove"})]})}),jsx(Xe,{children:t(c)})]},u.id)),jsx("div",{children:jsx(v,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function qt(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Ko(e){let o=e.querySelector("[aria-invalid='true'], .aria-invalid, [data-invalid='true']")||e.querySelector("input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true']")||e.querySelector("input, select, textarea");o&&(o.focus({preventScroll:false}),o instanceof HTMLElement&&o.scrollIntoView({block:"center",behavior:"smooth"}));}function Sf({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:a=true,className:n,...i}){let s=useForm(i),l=(u,c)=>{if(a&&e){let d=document.getElementById(e);d&&Ko(d);}t?.(u,c);};return jsx(FormProvider,{...s,children:jsx(qt,{id:e,className:n,onSubmit:s.handleSubmit(o,l),children:r})})}function Qo({formId:e,show:o,isSubmitting:t,onCancel:r,primaryLabel:a="Save changes",secondaryLabel:n="Cancel",className:i}){return o?jsx("div",{className:twMerge("fixed inset-x-0 bottom-0 z-40 border-t border-border-muted bg-background-surface/95 backdrop-blur supports-[backdrop-filter]:bg-background-surface/70",i),children:jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsx("div",{className:"text-sm text-text-muted",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(v,{variant:"secondary",onPress:r,children:n}),jsx(v,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":a})]})]})}):null}function Lf({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a}){let{formState:n}=useFormContext();return jsx(Qo,{formId:e,show:n.isDirty,isSubmitting:n.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a})}function zf(e=true){let{formState:o}=useFormContext();pe.useEffect(()=>{if(!e||!o.isSubmitted||!o.errors||Object.keys(o.errors).length===0)return;let t=document.querySelector("[aria-invalid='true'], .aria-invalid, [data-invalid='true']")||document.querySelector("input[aria-invalid='true'], select[aria-invalid='true'], textarea[aria-invalid='true']");t&&t.scrollIntoView({block:"center",behavior:"smooth"});},[e,o.isSubmitted,o.errors]);}function Gf({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:a}=useFormContext(),n=pe.useRef(void 0);pe.useEffect(()=>{let i=t(()=>{r.isDirty&&(n.current&&window.clearTimeout(n.current),n.current=window.setTimeout(async()=>{let s=a();await o(s);},e));});return ()=>{i.unsubscribe(),n.current&&window.clearTimeout(n.current);}},[t,r.isDirty,a,e,o]);}export{Gp as ErrorSummary,uf as FieldArrayList,cd as FormAutocomplete,Td as FormCheckbox,Vd as FormCheckboxGroup,Yd as FormColorField,Ic as FormDateField,Kc as FormFileUpload,uu as FormNumberField,Sf as FormProvider,Bu as FormRadioGroup,Im as FormRichTextEditor,Lf as FormSaveBar,Mm as FormSelect,Ym as FormSwitch,cp as FormTextArea,xp as FormTextField,Dp as FormTimeField,Kp as SubmitButton,Ko as focusFirstError,Gf as useAutoSave,zf as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map