@texturehq/edges 1.28.1 → 1.28.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.
- package/dist/{RichTextEditor-7jc4jO7e.d.cts → RichTextEditor-BjXePCmA.d.cts} +5 -1
- package/dist/{RichTextEditor-7jc4jO7e.d.ts → RichTextEditor-BjXePCmA.d.ts} +5 -1
- package/dist/{TimeField-ydXvd3yT.d.cts → TimeField-B4qAwv88.d.cts} +1 -1
- package/dist/{TimeField-DUQ94xQz.d.ts → TimeField-DDhiyenr.d.ts} +1 -1
- package/dist/{colors-BArtDuqU.d.ts → colors-BhJKDQEw.d.ts} +1 -1
- package/dist/{colors-BHVIdEzL.d.cts → colors-CEdtNxvm.d.cts} +1 -1
- package/dist/components.manifest.json +1 -1
- package/dist/index.cjs +21 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -8
- package/dist/index.d.ts +37 -8
- package/dist/index.js +21 -20
- package/dist/index.js.map +1 -1
- package/dist/rhf/index.cjs +1 -1
- package/dist/rhf/index.cjs.map +1 -1
- package/dist/rhf/index.d.cts +2 -2
- package/dist/rhf/index.d.ts +2 -2
- package/dist/rhf/index.js +1 -1
- package/dist/rhf/index.js.map +1 -1
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/styles/theme-light-override.css +55 -0
- package/dist/styles.css +194 -0
- package/dist/theme.css +4 -0
- package/dist/utilities.manifest.json +1 -1
- package/package.json +1 -1
- package/scripts/copy-assets.js +1 -0
package/dist/rhf/index.d.cts
CHANGED
|
@@ -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 RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-
|
|
6
|
-
import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-
|
|
5
|
+
import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-B4qAwv88.cjs';
|
|
6
|
+
import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-BjXePCmA.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"> {
|
package/dist/rhf/index.d.ts
CHANGED
|
@@ -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 RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-
|
|
6
|
-
import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-
|
|
5
|
+
import { A as Autocomplete, C as Checkbox, a as CheckboxGroup, b as ColorField, N as NumberField, R as RadioCardGroup, c as RadioGroup, S as Select, d as Switch, T as TextArea, e as TextField, f as TimeFieldProps, B as Button } from '../TimeField-DDhiyenr.js';
|
|
6
|
+
import { a as DateField, b as FileUpload, c as RichTextEditor } from '../RichTextEditor-BjXePCmA.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 Ne from'react';import Ne__default,{memo,createContext,useState,useContext,useRef,useEffect,useCallback,useId,useMemo,Component}from'react';import {ComboBox,Input,Button,ListBox,ListBoxSection,Header,Checkbox,composeRenderProps,CheckboxGroup,TextField,DateField,DialogTrigger,Popover,Dialog,DropZone,FileTrigger,NumberField,Group,RadioGroup,Select,SelectValue,Switch,TimeField,DateInput,DateSegment,Link,Form,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 da 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 Yi from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import Ji from'@tiptap/starter-kit';var Er=Object.defineProperty;var Lr=(e,o,t)=>o in e?Er(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var wt=(e,o,t)=>Lr(e,typeof o!="symbol"?o+"":o,t);var nt={prefix:String(Math.round(Math.random()*1e10)),current:0},ko=Ne__default.createContext(nt),zr=Ne__default.createContext(false);var Mr=!!(typeof window<"u"&&window.document&&window.document.createElement),kt=new WeakMap;function Hr(e=false){let o=useContext(ko),t=useRef(null);if(t.current===null&&!e){var r,a;let n=(a=Ne__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=kt.get(n);i==null?kt.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,kt.delete(n));}t.current=++o.current;}return t.current}function Gr(e){let o=useContext(ko);o===nt&&!Mr&&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=Hr(!!e),r=o===nt&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function Or(e){let o=Ne__default.useId(),[t]=useState(it()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${nt.prefix}`;return e||`${r}-${o}`}typeof Ne__default.useId=="function"?Or:Gr;function qr(){return false}function Wr(){return true}function Ur(e){return ()=>{}}function it(){return typeof Ne__default.useSyncExternalStore=="function"?Ne__default.useSyncExternalStore(Ur,qr,Wr):useContext(zr)}var Kr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Yr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Bt(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 Kr.has(t.script)}let o=e.split("-")[0];return Yr.has(o)}var Bo=Symbol.for("react-aria.i18n.locale");function Do(){let e=typeof window<"u"&&window[Bo]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:Bt(e)?"rtl":"ltr"}}var Dt=Do(),We=new Set;function Io(){Dt=Do();for(let e of We)e(Dt);}function $o(){let e=it(),[o,t]=useState(Dt);return useEffect(()=>(We.size===0&&window.addEventListener("languagechange",Io),We.add(t),()=>{We.delete(t),We.size===0&&window.removeEventListener("languagechange",Io);}),[]),e?{locale:typeof window<"u"&&window[Bo]||"en-US",direction:"ltr"}:o}var Zr=Ne__default.createContext(null);function $t(){let e=$o();return useContext(Zr)||e}var Et=new Map;function Lt(e){let{locale:o}=$t(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(Et.has(t))return Et.get(t);let r=new Intl.Collator(o,e);return Et.set(t,r),r}function st(e){let o=Lt({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 c=n.slice(s,s+l);if(o.compare(i,c)===0)return true}return false},[o]);return useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function $e(e,o=false){let[t,r]=useState(o);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia(e);r(a.matches);let n=i=>{r(i.matches);};return a.addEventListener("change",n),()=>{a.removeEventListener("change",n);}},[e]),t}var Ue={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function lt(e="base"){let o=$e(`(min-width: ${Ue.sm})`,e!=="base"),t=$e(`(min-width: ${Ue.md})`,["md","lg","xl","2xl"].includes(e)),r=$e(`(min-width: ${Ue.lg})`,["lg","xl","2xl"].includes(e)),a=$e(`(min-width: ${Ue.xl})`,["xl","2xl"].includes(e)),n=$e(`(min-width: ${Ue["2xl"]})`,e==="2xl"),i=!t,s=t,l="base";return n?l="2xl":a?l="xl":r?l="lg":t?l="md":o&&(l="sm"),{current:l,isSm:o,isMd:t,isLg:r,isXl:a,is2Xl:n,isMobile:i,isDesktop:s}}function Eo(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function dt(e,o=300){let[t,r]=useState(false);return useEffect(()=>{if(e){let a=setTimeout(()=>{r(true);},o);return ()=>clearTimeout(a)}r(false);},[e,o]),t}function Te(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 H(e,o){return composeRenderProps(e,t=>twMerge(o,t))}var q={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 Ee={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},b=memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=da[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 Ee?Ee[o]:o,c=twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsx(s,{...i,size:l,color:t,weight:r,className:c,"aria-label":n||`${e} icon`,"data-testid":`icon-${e}`})});b.displayName="Icon";var Ao=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:a="md",className:n,name:i,color:s,weight:l,ariaLabel:c,ref:u,...d})=>{let f=typeof a=="string"&&a in Ee?Ee[a]:a,v=t?typeof t=="string"&&t in Ee?Ee[t]:t:f*1.75,g=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:g,style:{width:v,height:v},children:jsx(b,{...d,name:i,size:a,color:s,weight:l,className:n,ariaLabel:c})})});Ao.displayName="IconWithContainer";var fa=({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 Mo({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,a)=>fa({...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 Fe(){let[e,o]=Ne__default.useState(false),t=Ne__default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=Ne__default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var X=Ne__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));X.displayName="InputWrapper";function Ke({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-[48%] -translate-y-1/2 transform text-text-muted hover:text-text-body cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(b,{name:"X",size:o==="sm"?16:20})})}function Ye(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 ba(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function ga(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",Ye({isInvalid:o,isDisabled:t,isFocused:r}),ba({transparent:a,isDisabled:t}),q[n].text,q[n].height,q[n].padding,ga(n),i)}function G({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:a="below",isRequired:n,className:i,htmlFor:s}){let l=t||r&&a==="tooltip",c=t||r,u=r&&a==="inline",d=jsxs("label",{htmlFor:s,className:twMerge(q[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(b,{name:"Info",size:o==="sm"?16:20})}),u&&jsx("span",{className:"text-text-caption font-normal ml-1",children:r})]});return l&&c?jsx(Mo,{content:c,children:d}):d}function w({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-caption",q[e].text,o),children:t})}function p({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge(q[o].text,"text-feedback-error-text",t),children:e})}function ut({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 ya="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Pa={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"},Go={full:"w-full",default:"w-fit"},Fa="opacity-50 cursor-not-allowed pointer-events-none",Ca="opacity-100 cursor-pointer",Ra={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},Sa={primary:"bg-action-brand text-white",destructive:"bg-action-destructive text-white"};function Na(e){return e?e==="primary"?"brand":e:"default"}function Ta(e){let{variant:o="default",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Na(o),s=i==="unstyled"?"":`${ya} ${Pa[i]}`;i!=="unstyled"&&(s+=` ${q[t].text} ${q[t].height} ${q[t].padding} ${q[t].gap}`),r||n?s+=` ${Fa}`:s+=` ${Ca}`,a?s+=` ${Go.full}`:s+=` ${Go.default}`;let l=i==="brand"?"focus-visible:outline-action-brand":void 0;return [s,Te(),l].filter(Boolean).join(" ")}function F(e){let{icon:o,children:t,isLoading:r=false,loadingText:a,loadingIndicator:n,size:i="md",iconPosition:s="left",iconWeight:l,href:c,className:u,badgeNumber:d,badgeVariant:f="primary",badgePosition:v="top-right",style:g,target:m,rel:C,...y}=e,x=o?jsx(b,{name:o,size:i,weight:l}):null,B=jsxs(Fragment,{children:[s==="left"&&x,typeof t=="function"?null:t,s==="right"&&x]}),E=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(b,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:B}),a&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),k=(d??0)>0,P=twMerge(Ta(e),u),R=c?{href:c,target:m,rel:C,...y}:{};if(c){let{onPress:I,onPressStart:te,onPressEnd:V,onPressChange:J,onPressUp:_,onAuxClick:U,onContextMenu:de,onDoubleClick:W,...S}=y;Object.assign(R,S);}let K=c?jsx(Link,{...R,...r&&{"aria-busy":true},style:k?void 0:g,className:P,children:r?E:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&x,t(I),s==="right"&&x]})}):B}):jsx(Button,{...y,...r&&{"aria-busy":true},style:k?void 0:g,className:P,children:r?E:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&x,t(I),s==="right"&&x]})}):B});return k?jsxs("div",{className:twMerge("relative flex",u),style:g,children:[K,jsx("span",{className:`absolute ${Ra[v]} flex h-5 w-5 items-center justify-center rounded-full ${Sa[f]} text-xs font-medium`,"aria-label":`${d} items`,children:d})]}):K}function we({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 za({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 Ve({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:a=true,disableGroup:n=false,...i}){let l=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=l?c-6:c;let u=jsxs(Popover,{offset:c,...i,className:composeRenderProps(r,(d,f)=>za({...f,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(we,{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:u})}):u}function Ht({action:e,defaultVariant:o,defaultSize:t="lg"}){let r=!!e.formId;return jsx(F,{type:r?"submit":"button",form:r?e.formId:void 0,size:e.size||t,variant:e.variant||o,onPress:r?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function Ot({primaryAction:e,secondaryAction:o,tertiaryAction:t,footerContent:r}){let a=e||o||t;return !a&&!r?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${r?"h-28":""}`,children:[r&&jsx("div",{className:"flex h-10 justify-center",children:r}),a&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:t&&jsx(Ht,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[o&&jsx(Ht,{action:o,defaultVariant:"secondary"}),e&&jsx(Ht,{action:e,defaultVariant:"default"})]})]})]})}var Ga={xs:"text-base md:text-lg font-semibold",sm:"text-lg md:text-xl font-semibold",md:"text-xl md:text-2xl font-semibold",lg:"text-2xl md:text-3xl font-semibold",xl:"text-3xl md:text-4xl font-semibold"},Oa={page:"h-16 leading-[62px]"};function Xe({tag:e="h1",size:o="lg",height:t,className:r="",children:a}){let n=Ga[o],i=t?Oa[t]:"";return jsx(e,{className:twMerge(n,i,r),children:a})}var ze=({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(F,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsx(b,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(Xe,{size:"xs",children:e}),o&&!t&&jsx(F,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(b,{name:"X","data-testid":"close-button"})})]})]});var fe=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:a=false,flex:n=false,stack:i,responsive:s,delay:l=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:d,"data-testid":f})=>{let[v,g]=useState(l===0);if(useEffect(()=>{if(l>0){let k=setTimeout(()=>g(true),l);return ()=>clearTimeout(k)}},[l]),!v)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)]",C=c&&e?(()=>{let k=typeof e=="number"?e:parseFloat(String(e));return isNaN(k)?"":`animation-duration-[${Math.max(.8,k/100)}s]`})():"",y=r==="pulse"?`animate-pulse ${C}`: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 ${C}`:"",x="rounded-sm";t==="circle"&&(x="rounded-full"),t==="text"&&(x="h-4 w-full rounded-sm");let B=n?"flex-1 min-w-0":"",E=s?Object.entries(s).map(([k,P])=>`${k}:w-[${P}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":f,children:i.map((k,P)=>jsx("div",{className:twMerge(m,y,x,B,E,d),style:{width:k,height:o}},P))}):jsx("div",{className:twMerge(m,y,x,B,E,d),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":f})};var Ya={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"},ja="rounded-lg",qt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Qa={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function be({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:a="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",Ya[e],ja,a==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsx(fe,{width:"100%",height:"100%",className:"rounded-none"}):t})}function mt({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(fe,{width:120,height:20}),jsx(fe,{width:24,height:24})]}),o&&jsx(fe,{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(Xe,{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 qo({src:e,alt:o,aspectRatio:t="auto",className:r,children:a,isLoading:n=false}){return n?jsx("div",{className:twMerge("bg-background-muted",qt[t],r),children:jsx(fe,{width:"100%",height:"100%"})}):a?jsx("div",{className:twMerge("overflow-hidden",qt[t],r),children:a}):e?jsx("div",{className:twMerge("overflow-hidden",qt[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function pt({className:e,children:o,isLoading:t=false,fill:r=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,r&&"flex-1 flex flex-col min-h-0",e),children:jsxs("div",{className:"space-y-2",children:[jsx(fe,{width:"100%",height:16}),jsx(fe,{width:"80%",height:16}),jsx(fe,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge("px-6 py-4 text-text-body",r&&"flex-1 flex flex-col min-h-0",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(fe,{width:80,height:32}),jsx(fe,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",Qa[t],e),children:o}):null}be.Header=mt;be.Media=qo;be.Content=pt;be.Footer=Wo;var Ze=class extends Component{constructor(){super(...arguments);wt(this,"state",{hasError:false});wt(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,r){console.error("Error Boundary caught an error:",t,r);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs(be,{children:[this.props.title&&jsx(be.Header,{title:this.props.title}),jsx(be.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-red-500",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var en=.3,tn=.5;function He({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:a=false,hasBackArrow:n=false,onBack:i,isOpen:s,onClose:l,isDismissable:c=true,transparentOverlay:u=false,primaryAction:d,secondaryAction:f,footerContent:v,maxHeight:g="80vh",height:m,maxWidth:C="640px",contentPadding:y=true,showHandle:x=true,animationVariant:B="scale",className:E}){let[k,P]=useState(false),[R,K]=useState(0),[I,te]=useState(false),V=useRef(null),J=useRef(null),_=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let A=setTimeout(()=>{P(true),setTimeout(()=>P(false),600);},400);return ()=>clearTimeout(A)}},[s]),useEffect(()=>{s||(K(0),te(false),_.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]);let U=useCallback(A=>{c&&(A.pointerType!=="touch"&&A.pointerType!=="pen"||(J.current&&(clearTimeout(J.current),J.current=null),_.current={isDragging:true,startY:A.clientY,startTime:Date.now(),pointerId:A.pointerId},te(false),A.currentTarget.setPointerCapture(A.pointerId)));},[c]),de=useCallback(A=>{let{isDragging:ie,startY:me,pointerId:ge}=_.current;if(!ie||A.pointerId!==ge)return;let z=A.clientY-me;K(Math.max(0,z));},[]),W=useCallback(A=>{let{isDragging:ie,startY:me,startTime:ge,pointerId:z}=_.current;if(!ie||A.pointerId!==z)return;let se=A.clientY-me,Y=Date.now()-ge,le=se/Y;_.current={isDragging:false,startY:0,startTime:0,pointerId:null};let Z=(V.current?.getBoundingClientRect().height??0)*en;(se>Z||le>tn&&se>50)&&c?(l?.(),K(0)):(te(true),K(0),J.current=setTimeout(()=>{te(false),J.current=null;},200));},[c,l]);if(!s)return null;let S=o||t,Se=d||f||v;return jsx(Ze,{children:jsx(we,{isOpen:s,onOpenChange:A=>{A||l?.();},isDismissable:c,transparent:u,className:"flex items-end justify-center p-0 sm:p-4",children:jsx(Modal,{className:"w-full max-w-full p-0 sm:p-2 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:c,children:jsx("div",{ref:V,className:twMerge("w-full",I&&"transition-transform duration-200"),style:{transform:R>0?`translateY(${R}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",B==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",B==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",E),style:{maxWidth:C,...m?{height:m}:{maxHeight:g}},children:[x&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:U,onPointerMove:de,onPointerUp:W,onPointerCancel:W,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",k&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),S&&(n?jsx(ze,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!l,hasBackArrow:true,onBack:i??(()=>{}),onClose:l||(()=>{})}):jsx(ze,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!l,onClose:l||(()=>{})})),jsx("div",{className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",y?"p-4":"p-0"),children:e}),Se&&jsx(Ot,{primaryAction:d,secondaryAction:f,footerContent:v})]})})})})})}He.displayName="Tray";var Jt=createContext("md");function Jo(){return useContext(Jt)}function jt(e="md"){let o=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${q[e].text} ${o}`}function ln(){let e=Ne__default.useCallback((t,r)=>{r?.(t);},[]),o=Ne__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function Zt({label:e,description:o,errorMessage:t,children:r,items:a,renderItem:n,renderSelectedValue:i,size:s="md",selectedKey:l,defaultSelectedKey:c,onSelectionChange:u,placeholder:d,showErrors:f=false,tooltip:v,isRequired:g,transparent:m,reserveErrorSpace:C=false,placement:y="bottom start",shouldFlip:x=true,menuWidth:B="match",descriptionPlacement:E="below",useMobileTray:k=true,...P}){let[R,K]=useState(null),[I,te]=useState(null),[V,J]=useState(false),_=l??R??c,{handleFocus:U,handleBlur:de}=ln(),{isMobile:W}=lt(),S=k&&W,Se=Ne__default.useMemo(()=>!i||!_||!a?null:Array.from(a).find(se=>se.id===_)??null,[i,_,a]),A=z=>{u&&z!==null&&u(z),u||K(z);},ie=useRef(null),me=useRef(null),ge=()=>{S&&J(!V);};return jsxs(Fragment,{children:[jsx(Select,{...P,selectedKey:_,defaultSelectedKey:c,onSelectionChange:A,placeholder:d,className:H(P.className,"group flex w-full flex-col"),ref:ie,onOpenChange:z=>{S||(z&&me.current?te(me.current.offsetWidth):z||ie.current?.blur());},children:({isDisabled:z,isInvalid:se,isOpen:Y})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:s,tooltip:v,description:E==="tooltip"||E==="inline"?o:void 0,descriptionPlacement:E,isRequired:g,children:e}),jsx(X,{children:jsx("div",{ref:me,children:jsxs(F,{variant:"unstyled",className:twMerge(oe({isInvalid:se||f&&!!t,isDisabled:z,isFocused:S?V:Y,transparent:m,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:le=>U(le,P.onFocus),onBlur:le=>de(le,P.onBlur),onPress:S?ge:void 0,"data-open":S?V:Y,children:[i&&Se?jsx("div",{className:jt(s),children:i(Se)}):S&&_?jsx("div",{className:jt(s),children:a?Array.from(a).find(Z=>Z.id===_)?.label:String(_)}):jsx(SelectValue,{className:jt(s)}),jsx(b,{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",(S?V:Y)&&"rotate-180")})]})})}),C?jsx("div",{className:"mt-1 min-h-[20px]",children:f?jsx(p,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&P.validationResult?t(P.validationResult):typeof t=="string"?t:null}):o&&E==="below"?jsx(w,{size:s,children:o}):null}):jsx(Fragment,{children:f?jsx(p,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&P.validationResult?t(P.validationResult):typeof t=="string"?t:null}):o&&E==="below"?jsx(w,{size:s,className:"mt-1",children:o}):null}),S?null:jsx(Ve,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:B==="match"&&I?`${I}px`:void 0,minWidth:B==="auto"&&I?`${I}px`:void 0,maxWidth:B==="auto"?"min(600px, 90vw)":void 0},placement:y,shouldFlip:x,children:jsx(Jt.Provider,{value:"md",children:jsx(ListBox,{items:a,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:n&&a?le=>jsx(Re,{id:le.id,textValue:le.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(le)})},le.id):r})})})]})}),S&&jsx(He,{isOpen:V,onClose:()=>J(false),title:e??"Select an option",contentPadding:false,children:jsx(Jt.Provider,{value:"md",children:jsx(ListBox,{items:a,className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:_!=null?[_]:[],onSelectionChange:z=>{let se=Array.from(z)[0];se!=null&&(A(se),J(false));},children:n&&a?z=>jsx(Re,{id:z.id,textValue:z.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(z)})},z.id):r})})})]})}function Re({size:e,className:o,...t}){let r=Jo(),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",q[a].paddingY,q[a].text,o)})}var Ge=({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 yn=[],Pn={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},Fn={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},tr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},to=(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 Cn(e,o,t){try{let r=e.url.replace("{q}",o),a=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([l,c])=>{a.append(l,c.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){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in REST request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}async function Rn(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){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}function oo({label:e,staticItems:o=yn,sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:l,errorMessage:c,description:u,size:d="md",tooltip:f,isRequired:v,isDisabled:g,isInvalid:m,validationResult:C,showErrors:y=true,renderItem:x,renderLeftIcon:B,renderSection:E,autoFocus:k=false,reserveErrorSpace:P=false,hideChevron:R=false,useMobileTray:K=true,className:I}){let te=Ne__default.useRef(null),V=Ne__default.useRef(null),[J,_]=Ne__default.useState(),[U,de]=useState(()=>to(r||a,o,t)),[W,S]=useState(false),[Se,A]=useState(false),ie=Eo(U),{contains:me}=st({sensitivity:"base"}),[ge,z]=useState(),{isMobile:se}=lt(),Y=K&&se,le=q[d].text,Nt=useAsyncList({async load({signal:T,filterText:D=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(D))return {items:[]};try{let ee;return i.requestType==="GraphQL"?ee=await Rn(i,D,T):ee=await Cn(i,D,T),z(ee.error),{items:ee.items}}catch(ee){return ee instanceof Error&&ee.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ee),z(ee instanceof Error?ee.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),Z=i&&ie!==""?Nt:null,qe=false,Tt=useRef("");useEffect(()=>{k&&S(true);},[k]),useEffect(()=>{let T=to(r,o,t);T!==U&&de(T);},[r,o,t]),useEffect(()=>{let T=()=>{te.current&&_(te.current.offsetWidth);};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),useEffect(()=>{ie===""?Tt.current="":Z&&ie!==Tt.current&&(Tt.current=ie,Z.setFilterText(ie));},[ie,Z]),qe=dt(!!Z?.isLoading,300);let $r=Ne__default.useMemo(()=>{if(!Y||!U)return Z?Z.items:o;let T=Z?Z.items:o,D=s||me;return T.filter(ee=>D(ee.name,U))},[Y,U,Z,o,s,me]),No=T=>{let D=to(T,o,t);de(D),n&&n(T);},To=T=>{de(T);},wo=()=>{Y&&A(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:No,selectedKey:r||void 0,defaultSelectedKey:a||void 0,defaultItems:t?t.flatMap(T=>T.items):o,items:Z?Z.items:void 0,className:H(I,"group flex flex-col w-full"),menuTrigger:Y?"manual":"focus",isDisabled:g,isInvalid:m||!!c,inputValue:U,onInputChange:To,autoFocus:k&&!Y,defaultFilter:s||me,"aria-label":e||l||"Autocomplete",children:T=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:d,tooltip:f,isRequired:v,children:e}),jsxs(X,{ref:te,children:[B?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:B(qe)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:qe?jsx(Ge,{size:16,color:"text-text-muted"}):jsx(b,{name:"MagnifyingGlass",className:`${Pn[d]} text-text-muted`})}),jsx(Input,{className:oe({isInvalid:m||!!c,isDisabled:g,isFocused:W||(Y?Se:T.isOpen),size:d,className:twMerge(Fn[d],U&&!g||!R&&!U?"pr-10":"pr-3",Y&&"cursor-pointer",I)}),placeholder:l,disabled:g,onFocus:D=>{S(true),Y&&(D.currentTarget.blur(),wo());},onBlur:()=>{S(false);},onClick:Y?wo:void 0,readOnly:Y,"aria-label":e||l||"Autocomplete"}),U&&!g&&jsx(Ke,{onClick:()=>{de(""),n?.(null);},size:d}),!R&&!U&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":"Toggle menu",isDisabled:g,children:({isPressed:D})=>jsx(b,{name:D?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),P?jsx("div",{className:"mt-1 min-h-[20px]",children:y&&ge?jsx(p,{size:d,className:"text-feedback-error-text",children:ge}):y&&typeof c=="string"?jsx(p,{size:d,className:"text-feedback-error-text",children:c}):y&&typeof c=="function"&&C?jsx(p,{size:d,className:"text-feedback-error-text",children:c(C)}):u?jsx(w,{size:d,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(w,{size:d,className:"mt-1",children:u}),y&&ge&&jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:ge}),y&&typeof c=="string"&&jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:c}),y&&typeof c=="function"&&C&&jsx(p,{size:d,className:"text-feedback-error-text mt-1",children:c(C)})]}),!Y&&jsx(Ve,{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:J?`${J}px`:void 0},children:jsx(ListBox,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${le}`,children:t?t.map(D=>{let ee=D.items.map(xe=>jsx(Re,{id:xe.id,textValue:xe.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${tr[d]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:x?x(xe):jsxs(Fragment,{children:[xe.name,jsx(b,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},xe.id));if(E){let xe=E(D,ee);return Ne__default.isValidElement(xe)&&xe.type===ListBoxSection?xe:jsx(ListBoxSection,{children:xe},D.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:D.name}),ee]},D.name)}):D=>jsx(Re,{id:D.id,textValue:D.name,size:d,className:`flex cursor-default items-center gap-2 px-3 ${tr[d]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:x?x(D):jsxs(Fragment,{children:[D.name,jsx(b,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},D.id)})})]})}),Y&&jsx(He,{isOpen:Se,onClose:()=>A(false),title:e??l??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(X,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:qe?jsx(Ge,{size:16,color:"text-text-muted"}):jsx(b,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-muted"})}),jsx("input",{ref:V,type:"text",value:U,onChange:T=>To(T.target.value),placeholder:l,autoFocus:true,className:oe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),U&&jsx(Ke,{onClick:()=>{de(""),n?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{items:$r,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:T=>{let D=Array.from(T)[0];D&&(No(D),A(false));},className:"bg-background-input outline-none",children:T=>jsx(Re,{id:T.id,textValue:T.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:x?x(T):T.name},T.id)})})]})})]})}function $(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 Pu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(oo,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}function ar(e){return jsxs(CheckboxGroup,{...e,className:H(e.className,"flex flex-col gap-2"),children:[jsx(G,{children:e.label}),e.children,e.description&&jsx(w,{children:e.description}),jsx(p,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Dn({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function $n({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 rr="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function nr(e){let{children:o,variant:t="default",...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(a,n)=>`${Dn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,l=jsx("div",{className:$n({isSelected:n,isIndeterminate:i,variant:t,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:rr}):n?jsx(Check,{"aria-hidden":true,className:rr}):null});return jsxs(Fragment,{children:[l,typeof o=="function"?o(a):o]})}})}function zu({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=useFormContext(),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(nr,{...r,isSelected:!!s.value,onChange:l=>s.onChange(l),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(p,{children:i})]})})}function qu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ar,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}function Oe(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 no(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 dr({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,className:s,validationResult:l,value:c,defaultValue:u,onChange:d,placeholder:f="#000000",showColorSwatch:v=true,reserveErrorSpace:g=true,...m}){let[C,y]=useState(u||""),[x,B]=useState(c||u||""),[E,k]=useState(false),[P,R]=useState(null),{isFocused:K,handleFocus:I,handleBlur:te}=Fe(),V=c!==void 0?c:C;useEffect(()=>{c!==void 0&&B(c);},[c]);let J=V?!Oe(V):false,_=useCallback(W=>{if(B(W),Oe(W)){let S=no(W);d?d(S):y(S);}else W===""&&(d?d(""):y(""));},[d]),U=useCallback(W=>{let S=no(W);B(S),d?d(S):y(S);},[d]),de=useCallback(W=>{if(Oe(x)){let S=no(x);B(S),d&&S!==V?d(S):!d&&S!==C&&y(S);}te(W,m.onBlur);},[x,V,C,d,te,m.onBlur]);return jsx(TextField,{...m,isRequired:n,className:H(s,"group flex flex-col"),children:({isDisabled:W})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:r,tooltip:a,isRequired:n,children:e}),jsx(X,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(ut,{size:r,disabled:W,type:"text",value:x,placeholder:f,onFocus:S=>I(S,m.onFocus),onBlur:de,onChange:S=>_(S.target.value),className:twMerge(oe({isInvalid:J,isDisabled:W,isFocused:K,size:r,transparent:i}),v?"pr-12":"pr-3","pl-3")}),v&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:q[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",Oe(V)?"border-border-default":"border-border-default bg-background-muted"),style:Oe(V)?{backgroundColor:V}:void 0,"aria-hidden":"true",children:!Oe(V)&&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:R,children:jsx(F,{variant:"secondary",size:r,icon:"Palette",onPress:()=>k(!E),isDisabled:W,className:"flex-shrink-0",children:"Pick"})})]})}),g?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(w,{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(w,{size:r,className:"mt-1",children:o}):null}),E&&P&&jsx(Ve,{triggerRef:{current:P},isOpen:E,onOpenChange:k,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:V||"#000000",onChange:U,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:V||"#000000"}}),jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:V||"#000000"})]})]})})]})})}function lm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(dr,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function ti({isSelected:e,isDisabled:o}){let t=[Te,"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 so({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(ur,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(mr,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${ti({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function ur(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(F,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(b,{name:"CaretRight","aria-hidden":true,size:o}):jsx(b,{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(F,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(b,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(b,{name:"CaretRight","aria-hidden":true,size:o})})]})}function mr(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}function co({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,showCalendar:l=true,reserveErrorSpace:c=true,validationResult:u,className:d,...f}){let[v,g]=useState(false),m=C=>{f.onChange&&C&&f.onChange(C),g(false);};return jsxs(DateField,{...f,isDisabled:i,isRequired:n,isInvalid:s,className:H(d,"flex flex-col gap-1"),children:[e&&jsx(G,{size:r,tooltip:a,isRequired:n,children:e}),jsx(X,{children:jsxs("div",{className:"relative w-full",children:[jsx(fr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:l}),l&&!i&&jsxs(DialogTrigger,{isOpen:v,onOpenChange:g,children:[jsx(F,{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(b,{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(so,{value:f.value,onChange:m,minValue:f.minValue,maxValue:f.maxValue,isDisabled:i,isReadOnly:f.isReadOnly,isDateUnavailable:f.isDateUnavailable})})})]})]})}),c?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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})}function di({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 fr({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:a,...n}){return jsx(DateInput,{className:twMerge(Ye({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:di({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function Gm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(co,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function uo({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:a,isDisabled:n=false,onUpload:i,className:s,showPreview:l=true,placeholder:c="Drop files here or click to browse"}){let[u,d]=useState(false),[f,v]=useState(false),[g,m]=useState(null),[C,y]=useState(e),x=useRef(null),B=async P=>{if(m(null),a&&P.size>a){m(`File size must be less than ${(a/1024/1024).toFixed(2)}MB`);return}if(l&&P.type.startsWith("image/")){let R=new FileReader;R.onloadend=()=>{y(R.result);},R.readAsDataURL(P);}if(i){v(true);try{let R=await i(P);y(R),t?.(R);}catch(R){m("Failed to upload file"),console.error("Upload error:",R);}finally{v(false);}}o?.(P,C);},E=async P=>{try{let R=P.items;if(R.length>0){let K=R[0];if(K.kind==="file"){let I=await K.getFile();I&&B(I);}}}catch(R){m("Failed to upload file"),console.error("Upload error:",R);}finally{d(false);}},k=()=>{y(void 0),m(null),o?.(null),t?.(""),x.current&&(x.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",n&&"pointer-events-none opacity-50",g&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:E,onDropEnter:()=>d(true),onDropExit:()=>d(false),children:[C?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[l&&C.startsWith("data:image")?jsx("img",{src:C,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(F,{variant:"icon",size:"sm",onPress:k,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:c}),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:P=>{let R=Array.from(P||[]);R.length>0&&B(R[0]);},children:jsx(F,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),f&&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..."})]})})]}),g&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:g})]})}function rp({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=useFormContext(),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(uo,{...r,value:s.value??"",onChange:(l,c)=>s.onChange(c||"")}),t&&i&&jsx(p,{children:i})]})})}var Ti=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 fo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,validationResult:s,reserveErrorSpace:l=true,descriptionPlacement:c="below",...u}){let d=useId(),{isFocused:f,handleFocus:v,handleBlur:g}=Fe();return jsx(NumberField,{...u,id:d,isRequired:n,className:H(u.className,"group flex flex-col gap-1"),step:u.step??1,onChange:m=>{typeof m=="number"&&(u.maxValue!=null&&m>u.maxValue?u.onChange?.(u.maxValue):u.minValue!=null&&m<u.minValue?u.onChange?.(u.minValue):u.onChange?.(m));},isInvalid:!!t||typeof u.value=="number"&&(u.maxValue!=null&&u.value>u.maxValue||u.minValue!=null&&u.value<u.minValue),children:({isDisabled:m,isInvalid:C})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(G,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,htmlFor:d,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:x=>v(x,u.onFocus),onBlur:x=>g(x,u.onBlur),className:Ti({isInvalid:C||!!t,isDisabled:m,isFocused:f,transparent:i,size:r,className:typeof u.className=="string"?u.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(b,{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(b,{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&&c==="below"?jsx(w,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(p,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(w,{size:r,className:"mt-1",children:o}):null})]})})}function Fp({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(fo,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Pt({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:i,children:s,size:l="2",variant:c="default",columns:u="repeat(auto-fit, minmax(160px, 1fr))",gap:d="1"}){return jsx(RadioGroup,{value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:H(i,"grid"),style:{gridTemplateColumns:/^\d+$/.test(String(u))?`repeat(${u}, minmax(0, 1fr))`:u,gap:d==="1"?"0.25rem":d==="2"?"0.5rem":d==="3"?"0.75rem":d==="4"?"1rem":typeof d=="number"?`${d}px`:d},children:Ne__default.Children.map(s,f=>Ne__default.isValidElement(f)?Ne__default.cloneElement(f,{size:l,variant:c}):f)})}function Mp({name:e,defaultValue:o,label:t,description:r,children:a,...n}){let{control:i,formState:s}=useFormContext(),l=$(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsx(G,{children:t}),r&&jsx(w,{children:r}),jsx(Pt,{...n,value:c.value,onChange:u=>c.onChange(u),children:a}),l&&jsx(p,{children:l})]})})}var Mi=createContext({variant:"brand"});function go(e){let{variant:o="default",...t}=e;return jsx(Mi.Provider,{value:{variant:o},children:jsxs(RadioGroup,{...t,className:H(e.className,"group flex flex-col gap-2"),children:[jsx(G,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(w,{children:e.description}),jsx(p,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function sf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(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})})}var Ui=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 at({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,showSearchIcon:s,isClearable:l,onClear:c,type:u,validationResult:d,reserveErrorSpace:f=true,isLoading:v=false,descriptionPlacement:g="below",...m}){let[C,y]=Ne__default.useState(false),{isFocused:x,handleFocus:B,handleBlur:E}=Fe(),k=u==="password",P=dt(v,300);return jsx(TextField,{...m,isRequired:n,className:H(m.className,"group flex flex-col"),children:({isDisabled:R,isInvalid:K})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:r,tooltip:a,description:g==="tooltip"||g==="inline"?o:void 0,descriptionPlacement:g,isRequired:n,children:e}),jsxs(X,{children:[s&&jsx("div",{className:"pointer-events-none absolute left-2 top-[45%] -translate-y-1/2 transform flex items-center z-10",children:P?jsx(Ge,{size:16,color:"text-text-muted"}):jsx(b,{name:"MagnifyingGlass",className:`h-4 w-4 transition-colors ${x?"text-action-brand":"text-text-muted"}`})}),jsx(ut,{size:r,disabled:R,type:k?C?"text":"password":u,value:m.value,defaultValue:m.defaultValue,placeholder:m.placeholder,onFocus:I=>B(I,m.onFocus),onBlur:I=>E(I,m.onBlur),onChange:I=>m.onChange?.(I.target.value),className:Ui({isInvalid:K,isDisabled:R,isFocused:x,size:r,transparent:i,showSearchIcon:s,isClearable:l,hasValue:!!m.value,isPassword:k,className:typeof m.className=="string"?m.className:void 0})}),l&&m.value&&!R&&jsx(Ke,{onClick:()=>{c?c():m.onChange&&m.onChange("");},size:r}),k&&!R&&jsx("button",{type:"button",onClick:()=>y(!C),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":C?"Hide password":"Show password",onMouseDown:I=>{I.preventDefault(),I.stopPropagation();},children:jsx(b,{name:C?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-body"})})]}),f?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&&g==="below"?jsx(w,{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&&g==="below"?jsx(w,{size:r,className:"mt-1",children:o}):null})]})})}var Be=({isActive:e=false,onPress:o,children:t})=>jsx(F,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function os({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[a,n]=useState(e);return Ne__default.useEffect(()=>{n(e);},[e]),jsx(we,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsx(Modal,{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(ze,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(at,{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(F,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(F,{type:"submit",children:"Save"})]})]})})})})}function ho({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:[Ji.configure({heading:{levels:[1,2]}}),Yi.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")}}}),c=()=>{s(true);},u=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(F,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let d=l.getAttributes("link").href;window.open(d,"_blank");},children:[jsx(b,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(F,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:c,children:[jsx(b,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(F,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(b,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(os,{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(Be,{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(Be,{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(Be,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(Be,{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(Be,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(b,{name:"ListBullets",className:"h-4 w-4"})}),jsx(Be,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(b,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(Be,{isActive:l.isActive("link"),onPress:c,children:jsx(b,{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 qf({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=useFormContext(),l=$(s.errors,e);return jsx(Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>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(ho,{...n,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),l&&jsx("p",{className:"text-sm text-feedback-error-text",children:l}),a&&!l&&jsx("div",{className:"h-5"})]})})}function Zf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Zt,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var yo={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 cs({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=yo[r].track,i=Te,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 us({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=yo[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function Po({children:e,variant:o="default",size:t="md",...r}){return jsx(Switch,{...r,className:H(r.className,`group flex items-center gap-2 ${yo[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:cs({...a,variant:o,size:t}),children:jsx("span",{className:us({...a,size:t})})}),e]})})}function ub({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Po,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var xs=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 Fo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,required:n,transparent:i,isInvalid:s,isDisabled:l,isResizable:c=false,className:u,validationResult:d,reserveErrorSpace:f=true,...v}){let{isFocused:g,handleFocus:m,handleBlur:C}=Fe();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(G,{size:r,tooltip:a,isRequired:n,children:e}),jsx(X,{children:jsx("textarea",{...v,required:n,onFocus:y=>{v.onFocus&&v.onFocus(y),m(y);},onBlur:y=>{v.onBlur&&v.onBlur(y),C(y);},className:xs({isInvalid:s,isDisabled:l,isResizable:c,isFocused:g,size:r,transparent:i,className:u}),disabled:l})}),f?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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})})}function Rb({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(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.target.value),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,required:t.required})})}function Ib({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(at,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Ts({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({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,reserveErrorSpace:l=true,validationResult:c,className:u,descriptionPlacement:d="below",...f}){return jsxs(TimeField,{...f,isDisabled:i,isRequired:n,isInvalid:s,className:H(u,"flex flex-col gap-1"),children:[e&&jsx(G,{size:r,tooltip:a,description:d==="tooltip"||d==="inline"?o:void 0,descriptionPlacement:d,isRequired:n,children:e}),jsx(X,{children:jsx(DateInput,{className:twMerge(Ye({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsx(DateSegment,{segment:v,className:Ts({isPlaceholder:v.isPlaceholder,isDisabled:!v.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"&&c?jsx(p,{size:r,children:t(c)}):o&&d==="below"?jsx(w,{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&&d==="below"?jsx(w,{size:r,className:"mt-1",children:o}):null})]})}function Qb({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(Co,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function tg({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),a=Ne.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(Ne.useEffect(()=>{t&&s&&a.current?.focus();},[t,s]),!s)return null;let l=c=>{let u=`[name="${CSS.escape(c)}"]`,d=document.querySelector(u);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(([c,u])=>{let d=u?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>l(c),children:d})},c)})})]})}function ig({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(F,{type:"submit",form:e,isDisabled:s,...n,children:a})}function mg({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((c,u)=>jsxs(be,{children:[jsx(mt,{title:o?o(u):`Item ${u+1}`,actions:jsxs("div",{className:"flex gap-2",children:[u>0&&jsx(F,{size:"sm",variant:"secondary",onPress:()=>l(u,u-1),children:"Up"}),u<n.length-1&&jsx(F,{size:"sm",variant:"secondary",onPress:()=>l(u,u+1),children:"Down"}),jsx(F,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsx(pt,{children:t(u)})]},c.id)),jsx("div",{children:jsx(F,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function So(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function wr(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 Ng({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:a=true,className:n,...i}){let s=useForm(i),l=(c,u)=>{if(a&&e){let d=document.getElementById(e);d&&wr(d);}t?.(c,u);};return jsx(FormProvider,{...s,children:jsx(So,{id:e,className:n,onSubmit:s.handleSubmit(o,l),children:r})})}function Br({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(F,{variant:"secondary",onPress:r,children:n}),jsx(F,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":a})]})]})}):null}function Lg({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a}){let{formState:n}=useFormContext();return jsx(Br,{formId:e,show:n.isDirty,isSubmitting:n.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a})}function Mg(e=true){let{formState:o}=useFormContext();Ne.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 Og({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:a}=useFormContext(),n=Ne.useRef(void 0);Ne.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{tg as ErrorSummary,mg as FieldArrayList,Pu as FormAutocomplete,zu as FormCheckbox,qu as FormCheckboxGroup,lm as FormColorField,Gm as FormDateField,rp as FormFileUpload,Fp as FormNumberField,Ng as FormProvider,Mp as FormRadioCardGroup,sf as FormRadioGroup,qf as FormRichTextEditor,Lg as FormSaveBar,Zf as FormSelect,ub as FormSwitch,Rb as FormTextArea,Ib as FormTextField,Qb as FormTimeField,ig as SubmitButton,wr as focusFirstError,Og as useAutoSave,Mg as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
|
|
1
|
+
import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';import*as Ne from'react';import Ne__default,{memo,createContext,useState,useContext,useRef,useEffect,useCallback,useId,useMemo,Component}from'react';import {ComboBox,Input,Button,ListBox,ListBoxSection,Header,Checkbox,composeRenderProps,CheckboxGroup,TextField,DateField,DialogTrigger,Popover,Dialog,DropZone,FileTrigger,NumberField,Group,RadioGroup,Select,SelectValue,Switch,TimeField,DateInput,DateSegment,Link,Form,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 da 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 Yi from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import Ji from'@tiptap/starter-kit';var Er=Object.defineProperty;var Lr=(e,o,t)=>o in e?Er(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var kt=(e,o,t)=>Lr(e,typeof o!="symbol"?o+"":o,t);var it={prefix:String(Math.round(Math.random()*1e10)),current:0},ko=Ne__default.createContext(it),Mr=Ne__default.createContext(false);var zr=!!(typeof window<"u"&&window.document&&window.document.createElement),It=new WeakMap;function _r(e=false){let o=useContext(ko),t=useRef(null);if(t.current===null&&!e){var r,a;let n=(a=Ne__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=It.get(n);i==null?It.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,It.delete(n));}t.current=++o.current;}return t.current}function Hr(e){let o=useContext(ko);o===it&&!zr&&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=_r(!!e),r=o===it&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function Gr(e){let o=Ne__default.useId(),[t]=useState(st()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${it.prefix}`;return e||`${r}-${o}`}typeof Ne__default.useId=="function"?Gr:Hr;function qr(){return false}function Wr(){return true}function Ur(e){return ()=>{}}function st(){return typeof Ne__default.useSyncExternalStore=="function"?Ne__default.useSyncExternalStore(Ur,qr,Wr):useContext(Mr)}var Kr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Yr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Dt(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 Kr.has(t.script)}let o=e.split("-")[0];return Yr.has(o)}var Bo=Symbol.for("react-aria.i18n.locale");function Do(){let e=typeof window<"u"&&window[Bo]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:Dt(e)?"rtl":"ltr"}}var $t=Do(),Ue=new Set;function Io(){$t=Do();for(let e of Ue)e($t);}function $o(){let e=st(),[o,t]=useState($t);return useEffect(()=>(Ue.size===0&&window.addEventListener("languagechange",Io),Ue.add(t),()=>{Ue.delete(t),Ue.size===0&&window.removeEventListener("languagechange",Io);}),[]),e?{locale:typeof window<"u"&&window[Bo]||"en-US",direction:"ltr"}:o}var Zr=Ne__default.createContext(null);function Et(){let e=$o();return useContext(Zr)||e}var Lt=new Map;function Vt(e){let{locale:o}=Et(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(Lt.has(t))return Lt.get(t);let r=new Intl.Collator(o,e);return Lt.set(t,r),r}function lt(e){let o=Vt({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,d=i.length;for(;s+d<=n.length;s++){let u=n.slice(s,s+d);if(o.compare(i,u)===0)return true}return false},[o]);return useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function $e(e,o=false){let[t,r]=useState(o);return useEffect(()=>{if(typeof window>"u")return;let a=window.matchMedia(e);r(a.matches);let n=i=>{r(i.matches);};return a.addEventListener("change",n),()=>{a.removeEventListener("change",n);}},[e]),t}var Ke={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function dt(e="base"){let o=$e(`(min-width: ${Ke.sm})`,e!=="base"),t=$e(`(min-width: ${Ke.md})`,["md","lg","xl","2xl"].includes(e)),r=$e(`(min-width: ${Ke.lg})`,["lg","xl","2xl"].includes(e)),a=$e(`(min-width: ${Ke.xl})`,["xl","2xl"].includes(e)),n=$e(`(min-width: ${Ke["2xl"]})`,e==="2xl"),i=!t,s=t,d="base";return n?d="2xl":a?d="xl":r?d="lg":t?d="md":o&&(d="sm"),{current:d,isSm:o,isMd:t,isLg:r,isXl:a,is2Xl:n,isMobile:i,isDesktop:s}}function Eo(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function ct(e,o=300){let[t,r]=useState(false);return useEffect(()=>{if(e){let a=setTimeout(()=>{r(true);},o);return ()=>clearTimeout(a)}r(false);},[e,o]),t}function Te(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 _(e,o){return composeRenderProps(e,t=>twMerge(o,t))}var q={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 Ee={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},g=memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=da[e];if(!s)return process.env.NODE_ENV==="development"&&console.error(`Icon "${e}" not found in @phosphor-icons/react`),null;let d=typeof o=="string"&&o in Ee?Ee[o]:o,u=twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsx(s,{...i,size:d,color:t,weight:r,className:u,"aria-label":n||`${e} icon`,"data-testid":`icon-${e}`})});g.displayName="Icon";var Ao=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:a="md",className:n,name:i,color:s,weight:d,ariaLabel:u,ref:l,...c})=>{let f=typeof a=="string"&&a in Ee?Ee[a]:a,b=t?typeof t=="string"&&t in Ee?Ee[t]:t:f*1.75,x=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:x,style:{width:b,height:b},children:jsx(g,{...c,name:i,size:a,color:s,weight:d,className:n,ariaLabel:u})})});Ao.displayName="IconWithContainer";var fa=({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 zo({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,a)=>fa({...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 Fe(){let[e,o]=Ne__default.useState(false),t=Ne__default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=Ne__default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var X=Ne__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));X.displayName="InputWrapper";function Ye({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-[48%] -translate-y-1/2 transform text-text-muted hover:text-text-body cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(g,{name:"X",size:o==="sm"?16:20})})}function je(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 ba(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function ga(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",je({isInvalid:o,isDisabled:t,isFocused:r}),ba({transparent:a,isDisabled:t}),q[n].text,q[n].height,q[n].padding,ga(n),i)}function H({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:a="below",isRequired:n,className:i,htmlFor:s}){let d=t||r&&a==="tooltip",u=t||r,l=r&&a==="inline",c=jsxs("label",{htmlFor:s,className:twMerge(q[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsx("span",{children:"*"}),d&&jsx("span",{className:"text-text-muted",children:jsx(g,{name:"Info",size:o==="sm"?16:20})}),l&&jsx("span",{className:"text-text-caption font-normal ml-1",children:r})]});return d&&u?jsx(zo,{content:u,children:c}):c}function w({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-caption",q[e].text,o),children:t})}function p({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge(q[o].text,"text-feedback-error-text",t),children:e})}function mt({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 ya="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Pa={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"},Ho={full:"w-full",default:"w-fit"},Fa="opacity-50 cursor-not-allowed pointer-events-none",Ca="opacity-100 cursor-pointer",Ra={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},Sa={primary:"bg-action-brand text-white",destructive:"bg-action-destructive text-white"};function Na(e){return e?e==="primary"?"brand":e:"default"}function Ta(e){let{variant:o="default",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Na(o),s=i==="unstyled"?"":`${ya} ${Pa[i]}`;i!=="unstyled"&&(s+=` ${q[t].text} ${q[t].height} ${q[t].padding} ${q[t].gap}`),r||n?s+=` ${Fa}`:s+=` ${Ca}`,a?s+=` ${Ho.full}`:s+=` ${Ho.default}`;let d=i==="brand"?"focus-visible:outline-action-brand":void 0;return [s,Te(),d].filter(Boolean).join(" ")}function F(e){let{icon:o,children:t,isLoading:r=false,loadingText:a,loadingIndicator:n,size:i="md",iconPosition:s="left",iconWeight:d,href:u,className:l,badgeNumber:c,badgeVariant:f="primary",badgePosition:b="top-right",style:x,target:m,rel:C,...y}=e,h=o?jsx(g,{name:o,size:i,weight:d}):null,B=jsxs(Fragment,{children:[s==="left"&&h,typeof t=="function"?null:t,s==="right"&&h]}),E=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(g,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:B}),a&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),k=(c??0)>0,P=twMerge(Ta(e),l),R=u?{href:u,target:m,rel:C,...y}:{};if(u){let{onPress:I,onPressStart:te,onPressEnd:V,onPressChange:J,onPressUp:O,onAuxClick:U,onContextMenu:de,onDoubleClick:W,...S}=y;Object.assign(R,S);}let K=u?jsx(Link,{...R,...r&&{"aria-busy":true},style:k?void 0:x,className:P,children:r?E:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&h,t(I),s==="right"&&h]})}):B}):jsx(Button,{...y,...r&&{"aria-busy":true},style:k?void 0:x,className:P,children:r?E:typeof t=="function"?(function(I){return jsxs(Fragment,{children:[s==="left"&&h,t(I),s==="right"&&h]})}):B});return k?jsxs("div",{className:twMerge("relative flex",l),style:x,children:[K,jsx("span",{className:`absolute ${Ra[b]} flex h-5 w-5 items-center justify-center rounded-full ${Sa[f]} text-xs font-medium`,"aria-label":`${c} items`,children:c})]}):K}function we({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 Ma({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 Ve({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:a=true,disableGroup:n=false,...i}){let d=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",u=o?12:8;u=d?u-6:u;let l=jsxs(Popover,{offset:u,...i,className:composeRenderProps(r,(c,f)=>Ma({...f,className:c,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(we,{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:l})}):l}function Ht({action:e,defaultVariant:o,defaultSize:t="lg"}){let r=!!e.formId;return jsx(F,{type:r?"submit":"button",form:r?e.formId:void 0,size:e.size||t,variant:e.variant||o,onPress:r?void 0:e.onPress,isLoading:e.isLoading,isDisabled:e.isDisabled,children:e.label})}function Ot({primaryAction:e,secondaryAction:o,tertiaryAction:t,footerContent:r}){let a=e||o||t;return !a&&!r?null:jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${r?"h-28":""}`,children:[r&&jsx("div",{className:"flex h-10 justify-center",children:r}),a&&jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsx("div",{children:t&&jsx(Ht,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[o&&jsx(Ht,{action:o,defaultVariant:"secondary"}),e&&jsx(Ht,{action:e,defaultVariant:"default"})]})]})]})}var Ha={xs:"text-base md:text-lg font-semibold",sm:"text-lg md:text-xl font-semibold",md:"text-xl md:text-2xl font-semibold",lg:"text-2xl md:text-3xl font-semibold",xl:"text-3xl md:text-4xl font-semibold"},Ga={page:"h-16 leading-[62px]"};function Je({tag:e="h1",size:o="lg",height:t,className:r="",children:a}){let n=Ha[o],i=t?Ga[t]:"";return jsx(e,{className:twMerge(n,i,r),children:a})}var Me=({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(F,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsx(g,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(Je,{size:"xs",children:e}),o&&!t&&jsx(F,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(g,{name:"X","data-testid":"close-button"})})]})]});var fe=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:a=false,flex:n=false,stack:i,responsive:s,delay:d=0,adjustAnimationSpeedBasedOnWidth:u=false,ariaLabel:l,className:c,"data-testid":f})=>{let[b,x]=useState(d===0);if(useEffect(()=>{if(d>0){let k=setTimeout(()=>x(true),d);return ()=>clearTimeout(k)}},[d]),!b)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)]",C=u&&e?(()=>{let k=typeof e=="number"?e:parseFloat(String(e));return isNaN(k)?"":`animation-duration-[${Math.max(.8,k/100)}s]`})():"",y=r==="pulse"?`animate-pulse ${C}`: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 ${C}`:"",h="rounded-sm";t==="circle"&&(h="rounded-full"),t==="text"&&(h="h-4 w-full rounded-sm");let B=n?"flex-1 min-w-0":"",E=s?Object.entries(s).map(([k,P])=>`${k}:w-[${P}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":f,children:i.map((k,P)=>jsx("div",{className:twMerge(m,y,h,B,E,c),style:{width:k,height:o}},P))}):jsx("div",{className:twMerge(m,y,h,B,E,c),style:{width:e,height:o},role:"presentation","aria-hidden":!l,"aria-label":l??void 0,"data-testid":f})};var Ya={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"},ja="rounded-lg",Wt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Qa={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function be({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:a="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",Ya[e],ja,a==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsx(fe,{width:"100%",height:"100%",className:"rounded-none"}):t})}function pt({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(fe,{width:120,height:20}),jsx(fe,{width:24,height:24})]}),o&&jsx(fe,{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(Je,{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 qo({src:e,alt:o,aspectRatio:t="auto",className:r,children:a,isLoading:n=false}){return n?jsx("div",{className:twMerge("bg-background-muted",Wt[t],r),children:jsx(fe,{width:"100%",height:"100%"})}):a?jsx("div",{className:twMerge("overflow-hidden",Wt[t],r),children:a}):e?jsx("div",{className:twMerge("overflow-hidden",Wt[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function ft({className:e,children:o,isLoading:t=false,fill:r=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,r&&"flex-1 flex flex-col min-h-0",e),children:jsxs("div",{className:"space-y-2",children:[jsx(fe,{width:"100%",height:16}),jsx(fe,{width:"80%",height:16}),jsx(fe,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge("px-6 py-4 text-text-body",r&&"flex-1 flex flex-col min-h-0",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(fe,{width:80,height:32}),jsx(fe,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",Qa[t],e),children:o}):null}be.Header=pt;be.Media=qo;be.Content=ft;be.Footer=Wo;var et=class extends Component{constructor(){super(...arguments);kt(this,"state",{hasError:false});kt(this,"handleRetry",()=>{this.setState({hasError:false,error:void 0}),typeof window<"u"&&window.location.reload();});}static getDerivedStateFromError(t){return {hasError:true,error:t}}componentDidCatch(t,r){console.error("Error Boundary caught an error:",t,r);}render(){return this.state.hasError?this.props.fallback?this.props.fallback:jsxs(be,{children:[this.props.title&&jsx(be.Header,{title:this.props.title}),jsx(be.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-red-500",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var en=.3,tn=.5;function _e({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:a=false,hasBackArrow:n=false,onBack:i,isOpen:s,onClose:d,isDismissable:u=true,transparentOverlay:l=false,primaryAction:c,secondaryAction:f,footerContent:b,maxHeight:x="80vh",height:m,maxWidth:C="640px",contentPadding:y=true,showHandle:h=true,animationVariant:B="scale",className:E}){let[k,P]=useState(false),[R,K]=useState(0),[I,te]=useState(false),V=useRef(null),J=useRef(null),O=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let A=setTimeout(()=>{P(true),setTimeout(()=>P(false),600);},400);return ()=>clearTimeout(A)}},[s]),useEffect(()=>{s||(K(0),te(false),O.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]);let U=useCallback(A=>{u&&(A.pointerType!=="touch"&&A.pointerType!=="pen"||(J.current&&(clearTimeout(J.current),J.current=null),O.current={isDragging:true,startY:A.clientY,startTime:Date.now(),pointerId:A.pointerId},te(false),A.currentTarget.setPointerCapture(A.pointerId)));},[u]),de=useCallback(A=>{let{isDragging:ie,startY:me,pointerId:ge}=O.current;if(!ie||A.pointerId!==ge)return;let M=A.clientY-me;K(Math.max(0,M));},[]),W=useCallback(A=>{let{isDragging:ie,startY:me,startTime:ge,pointerId:M}=O.current;if(!ie||A.pointerId!==M)return;let se=A.clientY-me,Y=Date.now()-ge,le=se/Y;O.current={isDragging:false,startY:0,startTime:0,pointerId:null};let Z=(V.current?.getBoundingClientRect().height??0)*en;(se>Z||le>tn&&se>50)&&u?(d?.(),K(0)):(te(true),K(0),J.current=setTimeout(()=>{te(false),J.current=null;},200));},[u,d]);if(!s)return null;let S=o||t,Se=c||f||b;return jsx(et,{children:jsx(we,{isOpen:s,onOpenChange:A=>{A||d?.();},isDismissable:u,transparent:l,className:"flex items-end justify-center p-0 sm:p-4",children:jsx(Modal,{className:"w-full max-w-full p-0 sm:p-2 outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0",isDismissable:u,children:jsx("div",{ref:V,className:twMerge("w-full",I&&"transition-transform duration-200"),style:{transform:R>0?`translateY(${R}px)`:void 0},children:jsxs(Dialog,{className:twMerge("relative flex w-full flex-col overflow-hidden","bg-background-surface","shadow-2xl shadow-black/30 dark:shadow-black/60","border-t border-x border-border-default/40","outline-none focus:outline-none focus-visible:outline-none ring-0 focus:ring-0 focus-visible:ring-0 focus:shadow-none","origin-bottom",B==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",B==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",E),style:{maxWidth:C,...m?{height:m}:{maxHeight:x}},children:[h&&jsx("div",{className:"absolute top-0 left-0 right-0 h-8 z-10 flex justify-center items-start pt-2 touch-none cursor-grab active:cursor-grabbing",onPointerDown:U,onPointerMove:de,onPointerUp:W,onPointerCancel:W,children:jsx("div",{className:twMerge("h-1 w-12 rounded-full bg-border-muted transition-all duration-300","hover:bg-border-default hover:w-16",k&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),S&&(n?jsx(Me,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsx(Me,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,onClose:d||(()=>{})})),jsx("div",{className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",y?"p-4":"p-0"),children:e}),Se&&jsx(Ot,{primaryAction:c,secondaryAction:f,footerContent:b})]})})})})})}_e.displayName="Tray";var Zt=createContext("md");function Jo(){return useContext(Zt)}function Qt(e="md"){let o=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${q[e].text} ${o}`}function ln(){let e=Ne__default.useCallback((t,r)=>{r?.(t);},[]),o=Ne__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function eo({label:e,description:o,errorMessage:t,children:r,items:a,renderItem:n,renderSelectedValue:i,size:s="md",selectedKey:d,defaultSelectedKey:u,onSelectionChange:l,placeholder:c,showErrors:f=false,tooltip:b,isRequired:x,transparent:m,reserveErrorSpace:C=false,placement:y="bottom start",shouldFlip:h=true,menuWidth:B="match",descriptionPlacement:E="below",useMobileTray:k=true,...P}){let[R,K]=useState(null),[I,te]=useState(null),[V,J]=useState(false),O=d??R??u,{handleFocus:U,handleBlur:de}=ln(),{isMobile:W}=dt(),S=k&&W,Se=Ne__default.useMemo(()=>!i||!O||!a?null:Array.from(a).find(se=>se.id===O)??null,[i,O,a]),A=M=>{l&&M!==null&&l(M),l||K(M);},ie=useRef(null),me=useRef(null),ge=()=>{S&&J(!V);};return jsxs(Fragment,{children:[jsx(Select,{...P,selectedKey:O,defaultSelectedKey:u,onSelectionChange:A,placeholder:c,className:_(P.className,"group flex w-full flex-col"),ref:ie,onOpenChange:M=>{S||(M&&me.current?te(me.current.offsetWidth):M||ie.current?.blur());},children:({isDisabled:M,isInvalid:se,isOpen:Y})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(H,{size:s,tooltip:b,description:E==="tooltip"||E==="inline"?o:void 0,descriptionPlacement:E,isRequired:x,children:e}),jsx(X,{children:jsx("div",{ref:me,children:jsxs(F,{variant:"unstyled",className:twMerge(oe({isInvalid:se||f&&!!t,isDisabled:M,isFocused:S?V:Y,transparent:m,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:le=>U(le,P.onFocus),onBlur:le=>de(le,P.onBlur),onPress:S?ge:void 0,"data-open":S?V:Y,children:[i&&Se?jsx("div",{className:Qt(s),children:i(Se)}):S&&O?jsx("div",{className:Qt(s),children:a?Array.from(a).find(Z=>Z.id===O)?.label:String(O)}):jsx(SelectValue,{className:Qt(s)}),jsx(g,{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",(S?V:Y)&&"rotate-180")})]})})}),C?jsx("div",{className:"mt-1 min-h-[20px]",children:f?jsx(p,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&P.validationResult?t(P.validationResult):typeof t=="string"?t:null}):o&&E==="below"?jsx(w,{size:s,children:o}):null}):jsx(Fragment,{children:f?jsx(p,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&P.validationResult?t(P.validationResult):typeof t=="string"?t:null}):o&&E==="below"?jsx(w,{size:s,className:"mt-1",children:o}):null}),S?null:jsx(Ve,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:B==="match"&&I?`${I}px`:void 0,minWidth:B==="auto"&&I?`${I}px`:void 0,maxWidth:B==="auto"?"min(600px, 90vw)":void 0},placement:y,shouldFlip:h,children:jsx(Zt.Provider,{value:"md",children:jsx(ListBox,{items:a,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:n&&a?le=>jsx(Re,{id:le.id,textValue:le.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(le)})},le.id):r})})})]})}),S&&jsx(_e,{isOpen:V,onClose:()=>J(false),title:e??"Select an option",contentPadding:false,children:jsx(Zt.Provider,{value:"md",children:jsx(ListBox,{items:a,className:"w-full bg-background-surface p-0 outline-0 [&_[role=option]]:border-b [&_[role=option]]:border-border-default [&_[role=option]:last-child]:border-0 [&_[role=option]]:!px-6 [&_[role=option]]:!py-4 [&_[role=option]]:rounded-none",selectionMode:"single",selectedKeys:O!=null?[O]:[],onSelectionChange:M=>{let se=Array.from(M)[0];se!=null&&(A(se),J(false));},children:n&&a?M=>jsx(Re,{id:M.id,textValue:M.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(M)})},M.id):r})})})]})}function Re({size:e,className:o,...t}){let r=Jo(),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",q[a].paddingY,q[a].text,o)})}var He=({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 yn=[],Pn={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},Fn={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},tr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},oo=(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 Cn(e,o,t){try{let r=e.url.replace("{q}",o),a=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([d,u])=>{a.append(d,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){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in REST request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}async function Rn(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){if(r instanceof Error&&r.name==="AbortError")return {items:[]};console.error("Error in GraphQL request:",r);let a=r instanceof Error?r.message:"Unknown error occurred";return {items:[],error:a}}}function ro({label:e,staticItems:o=yn,sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:d,errorMessage:u,description:l,size:c="md",tooltip:f,isRequired:b,isDisabled:x,isInvalid:m,validationResult:C,showErrors:y=true,renderItem:h,renderLeftIcon:B,renderSection:E,autoFocus:k=false,reserveErrorSpace:P=false,hideChevron:R=false,useMobileTray:K=true,className:I}){let te=Ne__default.useRef(null),V=Ne__default.useRef(null),[J,O]=Ne__default.useState(),[U,de]=useState(()=>oo(r||a,o,t)),[W,S]=useState(false),[Se,A]=useState(false),ie=Eo(U),{contains:me}=lt({sensitivity:"base"}),[ge,M]=useState(),{isMobile:se}=dt(),Y=K&&se,le=q[c].text,Tt=useAsyncList({async load({signal:T,filterText:D=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(D))return {items:[]};try{let ee;return i.requestType==="GraphQL"?ee=await Rn(i,D,T):ee=await Cn(i,D,T),M(ee.error),{items:ee.items}}catch(ee){return ee instanceof Error&&ee.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ee),M(ee instanceof Error?ee.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),Z=i&&ie!==""?Tt:null,We=false,wt=useRef("");useEffect(()=>{k&&S(true);},[k]),useEffect(()=>{let T=oo(r,o,t);T!==U&&de(T);},[r,o,t]),useEffect(()=>{let T=()=>{te.current&&O(te.current.offsetWidth);};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[]),useEffect(()=>{ie===""?wt.current="":Z&&ie!==wt.current&&(wt.current=ie,Z.setFilterText(ie));},[ie,Z]),We=ct(!!Z?.isLoading,300);let $r=Ne__default.useMemo(()=>{if(!Y||!U)return Z?Z.items:o;let T=Z?Z.items:o,D=s||me;return T.filter(ee=>D(ee.name,U))},[Y,U,Z,o,s,me]),No=T=>{let D=oo(T,o,t);de(D),n&&n(T);},To=T=>{de(T);},wo=()=>{Y&&A(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:No,selectedKey:r||void 0,defaultSelectedKey:a||void 0,defaultItems:t?t.flatMap(T=>T.items):o,items:Z?Z.items:void 0,className:_(I,"group flex flex-col w-full"),menuTrigger:Y?"manual":"focus",isDisabled:x,isInvalid:m||!!u,inputValue:U,onInputChange:To,autoFocus:k&&!Y,defaultFilter:s||me,"aria-label":e||d||"Autocomplete",children:T=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(H,{size:c,tooltip:f,isRequired:b,children:e}),jsxs(X,{ref:te,children:[B?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:B(We)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:We?jsx(He,{size:16,color:"text-text-muted"}):jsx(g,{name:"MagnifyingGlass",className:`${Pn[c]} text-text-muted`})}),jsx(Input,{className:oe({isInvalid:m||!!u,isDisabled:x,isFocused:W||(Y?Se:T.isOpen),size:c,className:twMerge(Fn[c],U&&!x||!R&&!U?"pr-10":"pr-3",Y&&"cursor-pointer",I)}),placeholder:d,disabled:x,onFocus:D=>{S(true),Y&&(D.currentTarget.blur(),wo());},onBlur:()=>{S(false);},onClick:Y?wo:void 0,readOnly:Y,"aria-label":e||d||"Autocomplete"}),U&&!x&&jsx(Ye,{onClick:()=>{de(""),n?.(null);},size:c}),!R&&!U&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":"Toggle menu",isDisabled:x,children:({isPressed:D})=>jsx(g,{name:D?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),P?jsx("div",{className:"mt-1 min-h-[20px]",children:y&&ge?jsx(p,{size:c,className:"text-feedback-error-text",children:ge}):y&&typeof u=="string"?jsx(p,{size:c,className:"text-feedback-error-text",children:u}):y&&typeof u=="function"&&C?jsx(p,{size:c,className:"text-feedback-error-text",children:u(C)}):l?jsx(w,{size:c,children:l}):null}):jsxs(Fragment,{children:[l&&jsx(w,{size:c,className:"mt-1",children:l}),y&&ge&&jsx(p,{size:c,className:"text-feedback-error-text mt-1",children:ge}),y&&typeof u=="string"&&jsx(p,{size:c,className:"text-feedback-error-text mt-1",children:u}),y&&typeof u=="function"&&C&&jsx(p,{size:c,className:"text-feedback-error-text mt-1",children:u(C)})]}),!Y&&jsx(Ve,{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:J?`${J}px`:void 0},children:jsx(ListBox,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${le}`,children:t?t.map(D=>{let ee=D.items.map(xe=>jsx(Re,{id:xe.id,textValue:xe.name,size:c,className:`flex cursor-default items-center gap-2 px-3 ${tr[c]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:h?h(xe):jsxs(Fragment,{children:[xe.name,jsx(g,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},xe.id));if(E){let xe=E(D,ee);return Ne__default.isValidElement(xe)&&xe.type===ListBoxSection?xe:jsx(ListBoxSection,{children:xe},D.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:D.name}),ee]},D.name)}):D=>jsx(Re,{id:D.id,textValue:D.name,size:c,className:`flex cursor-default items-center gap-2 px-3 ${tr[c]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:h?h(D):jsxs(Fragment,{children:[D.name,jsx(g,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},D.id)})})]})}),Y&&jsx(_e,{isOpen:Se,onClose:()=>A(false),title:e??d??"Search",contentPadding:false,height:"80vh",children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"p-4 border-b border-border-default",children:jsxs(X,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:We?jsx(He,{size:16,color:"text-text-muted"}):jsx(g,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-muted"})}),jsx("input",{ref:V,type:"text",value:U,onChange:T=>To(T.target.value),placeholder:d,autoFocus:true,className:oe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),U&&jsx(Ye,{onClick:()=>{de(""),n?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{items:$r,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:T=>{let D=Array.from(T)[0];D&&(No(D),A(false));},className:"bg-background-input outline-none",children:T=>jsx(Re,{id:T.id,textValue:T.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:h?h(T):T.name},T.id)})})]})})]})}function $(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 Fu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ro,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}function ar(e){return jsxs(CheckboxGroup,{...e,className:_(e.className,"flex flex-col gap-2"),children:[jsx(H,{children:e.label}),e.children,e.description&&jsx(w,{children:e.description}),jsx(p,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Dn({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function $n({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 d=a==="brand"?"action-brand":"action-default";s=`bg-${d} border-${d} hover:bg-${d}-hover hover:border-${d}-hover`;}else s="bg-background-input border-border-input hover:border-border-focus";return `${n} ${i} ${s}`}var rr="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function nr(e){let{children:o,variant:t="default",...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(a,n)=>`${Dn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,d=jsx("div",{className:$n({isSelected:n,isIndeterminate:i,variant:t,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:rr}):n?jsx(Check,{"aria-hidden":true,className:rr}):null});return jsxs(Fragment,{children:[d,typeof o=="function"?o(a):o]})}})}function zu({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=useFormContext(),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(nr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(p,{children:i})]})})}function Wu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ar,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}function Ge(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 io(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 dr({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,className:s,validationResult:d,value:u,defaultValue:l,onChange:c,placeholder:f="#000000",showColorSwatch:b=true,reserveErrorSpace:x=true,...m}){let[C,y]=useState(l||""),[h,B]=useState(u||l||""),[E,k]=useState(false),[P,R]=useState(null),{isFocused:K,handleFocus:I,handleBlur:te}=Fe(),V=u!==void 0?u:C;useEffect(()=>{u!==void 0&&B(u);},[u]);let J=V?!Ge(V):false,O=useCallback(W=>{if(B(W),Ge(W)){let S=io(W);c?c(S):y(S);}else W===""&&(c?c(""):y(""));},[c]),U=useCallback(W=>{let S=io(W);B(S),c?c(S):y(S);},[c]),de=useCallback(W=>{if(Ge(h)){let S=io(h);B(S),c&&S!==V?c(S):!c&&S!==C&&y(S);}te(W,m.onBlur);},[h,V,C,c,te,m.onBlur]);return jsx(TextField,{...m,isRequired:n,className:_(s,"group flex flex-col"),children:({isDisabled:W})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(H,{size:r,tooltip:a,isRequired:n,children:e}),jsx(X,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(mt,{size:r,disabled:W,type:"text",value:h,placeholder:f,onFocus:S=>I(S,m.onFocus),onBlur:de,onChange:S=>O(S.target.value),className:twMerge(oe({isInvalid:J,isDisabled:W,isFocused:K,size:r,transparent:i}),b?"pr-12":"pr-3","pl-3")}),b&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:q[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",Ge(V)?"border-border-default":"border-border-default bg-background-muted"),style:Ge(V)?{backgroundColor:V}:void 0,"aria-hidden":"true",children:!Ge(V)&&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:R,children:jsx(F,{variant:"secondary",size:r,icon:"Palette",onPress:()=>k(!E),isDisabled:W,className:"flex-shrink-0",children:"Pick"})})]})}),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(w,{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(w,{size:r,className:"mt-1",children:o}):null}),E&&P&&jsx(Ve,{triggerRef:{current:P},isOpen:E,onOpenChange:k,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:V||"#000000",onChange:U,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:V||"#000000"}}),jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:V||"#000000"})]})]})})]})})}function dm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(dr,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function ti({isSelected:e,isDisabled:o}){let t=[Te,"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 lo({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(ur,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(mr,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${ti({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function ur(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(F,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(g,{name:"CaretRight","aria-hidden":true,size:o}):jsx(g,{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(F,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(g,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(g,{name:"CaretRight","aria-hidden":true,size:o})})]})}function mr(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}function uo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,showCalendar:d=true,reserveErrorSpace:u=true,validationResult:l,className:c,...f}){let[b,x]=useState(false),m=C=>{f.onChange&&C&&f.onChange(C),x(false);};return jsxs(DateField,{...f,isDisabled:i,isRequired:n,isInvalid:s,className:_(c,"flex flex-col gap-1"),children:[e&&jsx(H,{size:r,tooltip:a,isRequired:n,children:e}),jsx(X,{children:jsxs("div",{className:"relative w-full",children:[jsx(fr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxs(DialogTrigger,{isOpen:b,onOpenChange:x,children:[jsx(F,{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(g,{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(lo,{value:f.value,onChange:m,minValue:f.minValue,maxValue:f.maxValue,isDisabled:i,isReadOnly:f.isReadOnly,isDateUnavailable:f.isDateUnavailable})})})]})]})}),u?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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})}function di({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 fr({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:a,...n}){return jsx(DateInput,{className:twMerge(je({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:di({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function Gm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(uo,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function mo({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:a,isDisabled:n=false,onUpload:i,className:s,showPreview:d=true,placeholder:u="Drop files here or click to browse"}){let[l,c]=useState(false),[f,b]=useState(false),[x,m]=useState(null),[C,y]=useState(e),h=useRef(null),B=async P=>{if(m(null),a&&P.size>a){m(`File size must be less than ${(a/1024/1024).toFixed(2)}MB`);return}if(d&&P.type.startsWith("image/")){let R=new FileReader;R.onloadend=()=>{y(R.result);},R.readAsDataURL(P);}if(i){b(true);try{let R=await i(P);y(R),t?.(R);}catch(R){m("Failed to upload file"),console.error("Upload error:",R);}finally{b(false);}}o?.(P,C);},E=async P=>{try{let R=P.items;if(R.length>0){let K=R[0];if(K.kind==="file"){let I=await K.getFile();I&&B(I);}}}catch(R){m("Failed to upload file"),console.error("Upload error:",R);}finally{c(false);}},k=()=>{y(void 0),m(null),o?.(null),t?.(""),h.current&&(h.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",l?"border-action-brand bg-action-brand/5":"border-border-muted hover:border-border-default",n&&"pointer-events-none opacity-50",x&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:E,onDropEnter:()=>c(true),onDropExit:()=>c(false),children:[C?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&C.startsWith("data:image")?jsx("img",{src:C,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(F,{variant:"icon",size:"sm",onPress:k,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: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:P=>{let R=Array.from(P||[]);R.length>0&&B(R[0]);},children:jsx(F,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),f&&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..."})]})})]}),x&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:x})]})}function ap({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=useFormContext(),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(mo,{...r,value:s.value??"",onChange:(d,u)=>s.onChange(u||"")}),t&&i&&jsx(p,{children:i})]})})}var Ti=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 bo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,validationResult:s,reserveErrorSpace:d=true,descriptionPlacement:u="below",...l}){let c=useId(),{isFocused:f,handleFocus:b,handleBlur:x}=Fe();return jsx(NumberField,{...l,id:c,isRequired:n,className:_(l.className,"group flex flex-col gap-1"),step:l.step??1,onChange:m=>{typeof m=="number"&&(l.maxValue!=null&&m>l.maxValue?l.onChange?.(l.maxValue):l.minValue!=null&&m<l.minValue?l.onChange?.(l.minValue):l.onChange?.(m));},isInvalid:!!t||typeof l.value=="number"&&(l.maxValue!=null&&l.value>l.maxValue||l.minValue!=null&&l.value<l.minValue),children:({isDisabled:m,isInvalid:C})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(H,{size:r,tooltip:a,description:u==="tooltip"||u==="inline"?o:void 0,descriptionPlacement:u,isRequired:n,htmlFor:c,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:h=>b(h,l.onFocus),onBlur:h=>x(h,l.onBlur),className:Ti({isInvalid:C||!!t,isDisabled:m,isFocused:f,transparent:i,size:r,className:typeof l.className=="string"?l.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(g,{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(g,{name:"CaretDown",size:14})})]})]})}),d?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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})})}function Cp({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(bo,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Ft({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:i,children:s,size:d="2",variant:u="default",columns:l="repeat(auto-fit, minmax(160px, 1fr))",gap:c="1"}){return jsx(RadioGroup,{value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:_(i,"grid"),style:{gridTemplateColumns:/^\d+$/.test(String(l))?`repeat(${l}, minmax(0, 1fr))`:l,gap:c==="1"?"0.25rem":c==="2"?"0.5rem":c==="3"?"0.75rem":c==="4"?"1rem":typeof c=="number"?`${c}px`:c},children:Ne__default.Children.map(s,f=>Ne__default.isValidElement(f)?Ne__default.cloneElement(f,{size:d,variant:u}):f)})}function _p({name:e,defaultValue:o,label:t,description:r,children:a,...n}){let{control:i,formState:s}=useFormContext(),d=$(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(H,{children:t}),r&&jsx(w,{children:r}),jsx(Ft,{...n,value:u.value,onChange:l=>u.onChange(l),children:a}),d&&jsx(p,{children:d})]})})}var zi=createContext({variant:"brand"});function xo(e){let{variant:o="default",...t}=e;return jsx(zi.Provider,{value:{variant:o},children:jsxs(RadioGroup,{...t,className:_(e.className,"group flex flex-col gap-2"),children:[jsx(H,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(w,{children:e.description}),jsx(p,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function lf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(xo,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}var Ui=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 nt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,showSearchIcon:s,isClearable:d,onClear:u,type:l,validationResult:c,reserveErrorSpace:f=true,isLoading:b=false,descriptionPlacement:x="below",...m}){let[C,y]=Ne__default.useState(false),{isFocused:h,handleFocus:B,handleBlur:E}=Fe(),k=l==="password",P=ct(b,300);return jsx(TextField,{...m,isRequired:n,className:_(m.className,"group flex flex-col"),children:({isDisabled:R,isInvalid:K})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(H,{size:r,tooltip:a,description:x==="tooltip"||x==="inline"?o:void 0,descriptionPlacement:x,isRequired:n,children:e}),jsxs(X,{children:[s&&jsx("div",{className:"pointer-events-none absolute left-2 top-[45%] -translate-y-1/2 transform flex items-center z-10",children:P?jsx(He,{size:16,color:"text-text-muted"}):jsx(g,{name:"MagnifyingGlass",className:`h-4 w-4 transition-colors ${h?"text-action-brand":"text-text-muted"}`})}),jsx(mt,{size:r,disabled:R,type:k?C?"text":"password":l,value:m.value,defaultValue:m.defaultValue,placeholder:m.placeholder,onFocus:I=>B(I,m.onFocus),onBlur:I=>E(I,m.onBlur),onChange:I=>m.onChange?.(I.target.value),className:Ui({isInvalid:K,isDisabled:R,isFocused:h,size:r,transparent:i,showSearchIcon:s,isClearable:d,hasValue:!!m.value,isPassword:k,className:typeof m.className=="string"?m.className:void 0})}),d&&m.value&&!R&&jsx(Ye,{onClick:()=>{u?u():m.onChange&&m.onChange("");},size:r}),k&&!R&&jsx("button",{type:"button",onClick:()=>y(!C),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":C?"Hide password":"Show password",onMouseDown:I=>{I.preventDefault(),I.stopPropagation();},children:jsx(g,{name:C?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-body"})})]}),f?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&&x==="below"?jsx(w,{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&&x==="below"?jsx(w,{size:r,className:"mt-1",children:o}):null})]})})}var os={sm:{toolbar:"p-1.5",contentWrapper:"min-h-[100px]",contentPadding:"p-3",placeholderPos:"left-3 top-3",prose:"prose-xs",h1:"[&_.ProseMirror_h1]:mb-2 [&_.ProseMirror_h1]:text-base [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-1.5 [&_.ProseMirror_h2]:text-sm [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-1",list:"[&_.ProseMirror_ul]:mb-1 [&_.ProseMirror_ul]:ml-4 [&_.ProseMirror_ol]:mb-1 [&_.ProseMirror_ol]:ml-4",li:"[&_.ProseMirror_li]:mb-0.5",placeholderText:"text-xs"},md:{toolbar:"p-2",contentWrapper:"min-h-[200px]",contentPadding:"p-4",placeholderPos:"left-4 top-4",prose:"prose-sm",h1:"[&_.ProseMirror_h1]:mb-4 [&_.ProseMirror_h1]:text-2xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-3 [&_.ProseMirror_h2]:text-xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-2",list:"[&_.ProseMirror_ul]:mb-2 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ol]:mb-2 [&_.ProseMirror_ol]:ml-6",li:"[&_.ProseMirror_li]:mb-1",placeholderText:"text-sm"},lg:{toolbar:"p-2.5",contentWrapper:"min-h-[250px]",contentPadding:"p-5",placeholderPos:"left-5 top-5",prose:"prose-base",h1:"[&_.ProseMirror_h1]:mb-5 [&_.ProseMirror_h1]:text-3xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-4 [&_.ProseMirror_h2]:text-2xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-3",list:"[&_.ProseMirror_ul]:mb-3 [&_.ProseMirror_ul]:ml-6 [&_.ProseMirror_ol]:mb-3 [&_.ProseMirror_ol]:ml-6",li:"[&_.ProseMirror_li]:mb-1.5",placeholderText:"text-base"},xl:{toolbar:"p-3",contentWrapper:"min-h-[300px]",contentPadding:"p-6",placeholderPos:"left-6 top-6",prose:"prose-lg",h1:"[&_.ProseMirror_h1]:mb-6 [&_.ProseMirror_h1]:text-4xl [&_.ProseMirror_h1]:font-bold",h2:"[&_.ProseMirror_h2]:mb-5 [&_.ProseMirror_h2]:text-3xl [&_.ProseMirror_h2]:font-semibold",p:"[&_.ProseMirror_p]:mb-3",list:"[&_.ProseMirror_ul]:mb-3 [&_.ProseMirror_ul]:ml-8 [&_.ProseMirror_ol]:mb-3 [&_.ProseMirror_ol]:ml-8",li:"[&_.ProseMirror_li]:mb-2",placeholderText:"text-lg"}},Be=({isActive:e=false,onPress:o,children:t})=>jsx(F,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function rs({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[a,n]=useState(e);return Ne__default.useEffect(()=>{n(e);},[e]),jsx(we,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsx(Modal,{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(Me,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(nt,{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(F,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(F,{type:"submit",children:"Save"})]})]})})})})}function ho({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:a="Start typing...",id:n,size:i="md"}){let s=os[i],[d,u]=useState(false),l=useEditor({immediatelyRender:false,extensions:[Ji.configure({heading:{levels:[1,2]}}),Yi.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:b})=>{o?.(b.getHTML());},editorProps:{attributes:{class:twMerge(`prose ${s.prose} max-w-none`,"focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),c=()=>{u(true);},f=b=>{b===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:b}).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:b})=>b.isActive("link")&&!d,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxs(F,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let b=l.getAttributes("link").href;window.open(b,"_blank");},children:[jsx(g,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(F,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:c,children:[jsx(g,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(F,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(g,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(rs,{isOpen:d,onClose:()=>u(false),onSubmit:f,initialUrl:l.getAttributes("link").href||""})]}),jsxs("div",{className:twMerge("flex items-center gap-1 border-b border-border-input",s.toolbar),children:[jsx(Be,{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(Be,{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(Be,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(Be,{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(Be,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(g,{name:"ListBullets",className:"h-4 w-4"})}),jsx(Be,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(g,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(Be,{isActive:l.isActive("link"),onPress:c,children:jsx(g,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxs("div",{className:twMerge("relative w-full outline-none focus:outline-none",s.contentWrapper),children:[jsx(EditorContent,{editor:l,className:twMerge("w-full outline-none focus:outline-none",s.contentPadding,"[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none",s.h1,s.h2,s.p,"[&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:list-decimal",s.list,s.li,"[&_.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:twMerge("pointer-events-none absolute text-text-muted",s.placeholderPos,s.placeholderText),children:a})]})]}):null}function Wf({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=useFormContext(),d=$(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(ho,{...n,id:e,initialContent:u.value??"",onChange:l=>u.onChange(l)}),d&&jsx("p",{className:"text-sm text-feedback-error-text",children:d}),a&&!d&&jsx("div",{className:"h-5"})]})})}function eb({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(eo,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var yo={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 us({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=yo[r].track,i=Te,s=t==="brand"?"focus-visible:outline-action-brand":"focus-visible:outline-action-default",d="";return e?t==="brand"?d="bg-action-brand forced-colors:!bg-[Highlight] group-pressed:bg-action-brand-hover":d="bg-action-default forced-colors:!bg-[Highlight] group-pressed:bg-action-default-hover":d="bg-gray-400 dark:bg-zinc-400 group-pressed:bg-gray-500 dark:group-pressed:bg-zinc-300",[a,n,i,s,d,o?"bg-gray-200 dark:bg-zinc-700 forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function ms({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=yo[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function Po({children:e,variant:o="default",size:t="md",...r}){return jsx(Switch,{...r,className:_(r.className,`group flex items-center gap-2 ${yo[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:us({...a,variant:o,size:t}),children:jsx("span",{className:ms({...a,size:t})})}),e]})})}function mb({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(Po,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var hs=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 Fo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,required:n,transparent:i,isInvalid:s,isDisabled:d,isResizable:u=false,className:l,validationResult:c,reserveErrorSpace:f=true,...b}){let{isFocused:x,handleFocus:m,handleBlur:C}=Fe();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(H,{size:r,tooltip:a,isRequired:n,children:e}),jsx(X,{children:jsx("textarea",{...b,required:n,onFocus:y=>{b.onFocus&&b.onFocus(y),m(y);},onBlur:y=>{b.onBlur&&b.onBlur(y),C(y);},className:hs({isInvalid:s,isDisabled:d,isResizable:u,isFocused:x,size:r,transparent:i,className:l}),disabled:d})}),f?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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})})}function Sb({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(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.target.value),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,required:t.required})})}function Bb({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=$(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(nt,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function ws({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({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,reserveErrorSpace:d=true,validationResult:u,className:l,descriptionPlacement:c="below",...f}){return jsxs(TimeField,{...f,isDisabled:i,isRequired:n,isInvalid:s,className:_(l,"flex flex-col gap-1"),children:[e&&jsx(H,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,children:e}),jsx(X,{children:jsx(DateInput,{className:twMerge(je({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:b=>jsx(DateSegment,{segment:b,className:ws({isPlaceholder:b.isPlaceholder,isDisabled:!b.isEditable||i,size:r})})})}),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&&c==="below"?jsx(w,{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&&c==="below"?jsx(w,{size:r,className:"mt-1",children:o}):null})]})}function Xb({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(Co,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function og({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),a=Ne.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(Ne.useEffect(()=>{t&&s&&a.current?.focus();},[t,s]),!s)return null;let d=u=>{let l=`[name="${CSS.escape(u)}"]`,c=document.querySelector(l);c&&(c.focus(),c.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,l])=>{let c=l?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>d(u),children:c})},u)})})]})}function sg({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(F,{type:"submit",form:e,isDisabled:s,...n,children:a})}function pg({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:a}=useFormContext(),{fields:n,append:i,remove:s,swap:d}=useFieldArray({control:a,name:e});return jsxs("div",{className:"flex flex-col gap-3",children:[n.map((u,l)=>jsxs(be,{children:[jsx(pt,{title:o?o(l):`Item ${l+1}`,actions:jsxs("div",{className:"flex gap-2",children:[l>0&&jsx(F,{size:"sm",variant:"secondary",onPress:()=>d(l,l-1),children:"Up"}),l<n.length-1&&jsx(F,{size:"sm",variant:"secondary",onPress:()=>d(l,l+1),children:"Down"}),jsx(F,{size:"sm",variant:"secondary",onPress:()=>s(l),children:"Remove"})]})}),jsx(ft,{children:t(l)})]},u.id)),jsx("div",{children:jsx(F,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function So(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function wr(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 Tg({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:a=true,className:n,...i}){let s=useForm(i),d=(u,l)=>{if(a&&e){let c=document.getElementById(e);c&&wr(c);}t?.(u,l);};return jsx(FormProvider,{...s,children:jsx(So,{id:e,className:n,onSubmit:s.handleSubmit(o,d),children:r})})}function Br({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(F,{variant:"secondary",onPress:r,children:n}),jsx(F,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":a})]})]})}):null}function Vg({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a}){let{formState:n}=useFormContext();return jsx(Br,{formId:e,show:n.isDirty,isSubmitting:n.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a})}function _g(e=true){let{formState:o}=useFormContext();Ne.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 Og({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:a}=useFormContext(),n=Ne.useRef(void 0);Ne.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{og as ErrorSummary,pg as FieldArrayList,Fu as FormAutocomplete,zu as FormCheckbox,Wu as FormCheckboxGroup,dm as FormColorField,Gm as FormDateField,ap as FormFileUpload,Cp as FormNumberField,Tg as FormProvider,_p as FormRadioCardGroup,lf as FormRadioGroup,Wf as FormRichTextEditor,Vg as FormSaveBar,eb as FormSelect,mb as FormSwitch,Sb as FormTextArea,Bb as FormTextField,Xb as FormTimeField,sg as SubmitButton,wr as focusFirstError,Og as useAutoSave,_g as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|