@texturehq/edges 1.37.0 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{colors-CIEgeqF8.d.cts → colors-CBDlvX1A.d.cts} +9 -2
- package/dist/{colors-CQJMI7Wz.d.ts → colors-op_IMV5O.d.ts} +9 -2
- package/dist/index.cjs +12 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -258
- package/dist/index.d.ts +24 -258
- package/dist/index.js +12 -12
- 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.js +1 -1
- package/dist/rhf/index.js.map +1 -1
- package/dist/server.cjs +2 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/styles.css +0 -13
- package/package.json +1 -1
package/dist/rhf/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {useFormContext,Controller,useFieldArray,useForm,FormProvider}from'react-hook-form';import*as we from'react';import we__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 pa from'@phosphor-icons/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Minus,Check,Image,X,Upload}from'lucide-react';import {HexColorPicker}from'react-colorful';import rs from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import ss from'@tiptap/starter-kit';var Ar=Object.defineProperty;var zr=(e,o,t)=>o in e?Ar(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var Lt=(e,o,t)=>zr(e,typeof o!="symbol"?o+"":o,t);var ct={prefix:String(Math.round(Math.random()*1e10)),current:0},Eo=we__default.createContext(ct),Or=we__default.createContext(false);var Gr=!!(typeof window<"u"&&window.document&&window.document.createElement),Dt=new WeakMap;function Wr(e=false){let o=useContext(Eo),t=useRef(null);if(t.current===null&&!e){var r,a;let n=(a=we__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=Dt.get(n);i==null?Dt.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,Dt.delete(n));}t.current=++o.current;}return t.current}function qr(e){let o=useContext(Eo);o===ct&&!Gr&&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=Wr(!!e),r=o===ct&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function Ur(e){let o=we__default.useId(),[t]=useState(ut()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ct.prefix}`;return e||`${r}-${o}`}typeof we__default.useId=="function"?Ur:qr;function Yr(){return false}function jr(){return true}function Xr(e){return ()=>{}}function ut(){return typeof we__default.useSyncExternalStore=="function"?we__default.useSyncExternalStore(Xr,Yr,jr):useContext(Or)}var Qr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Jr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Mt(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 Qr.has(t.script)}let o=e.split("-")[0];return Jr.has(o)}var Do=Symbol.for("react-aria.i18n.locale");function $o(){let e=typeof window<"u"&&window[Do]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:Mt(e)?"rtl":"ltr"}}var At=$o(),je=new Set;function Lo(){At=$o();for(let e of je)e(At);}function Mo(){let e=ut(),[o,t]=useState(At);return useEffect(()=>(je.size===0&&window.addEventListener("languagechange",Lo),je.add(t),()=>{je.delete(t),je.size===0&&window.removeEventListener("languagechange",Lo);}),[]),e?{locale:typeof window<"u"&&window[Do]||"en-US",direction:"ltr"}:o}var ra=we__default.createContext(null);function zt(){let e=Mo();return useContext(ra)||e}var Ht=new Map;function _t(e){let{locale:o}=zt(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(Ht.has(t))return Ht.get(t);let r=new Intl.Collator(o,e);return Ht.set(t,r),r}function mt(e){let o=_t({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 c=n.slice(s,s+d);if(o.compare(i,c)===0)return true}return false},[o]);return useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function De(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 Xe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function pt(e="base"){let o=De(`(min-width: ${Xe.sm})`,e!=="base"),t=De(`(min-width: ${Xe.md})`,["md","lg","xl","2xl"].includes(e)),r=De(`(min-width: ${Xe.lg})`,["lg","xl","2xl"].includes(e)),a=De(`(min-width: ${Xe.xl})`,["xl","2xl"].includes(e)),n=De(`(min-width: ${Xe["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 Ao(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function ft(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 gt(...e){return e.filter(Boolean).join(" ")}var xe={displayXl:"text-display-xl",displayLg:"text-display-lg",displayMd:"text-display-md",displaySm:"text-display-sm",headingXl:"text-heading-xl",headingLg:"text-heading-lg",headingMd:"text-heading-md",headingSm:"text-heading-sm",bodyLg:"text-body-lg",bodyMd:"text-body-md",bodySm:"text-body-sm",labelLg:"text-label-lg",labelMd:"text-label-md",labelSm:"text-label-sm",code:"text-code",agent:"text-agent"};function zo(e,...o){return gt(xe[e],...o)}function ke(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 W={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 $e={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},x=memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=pa[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 $e?$e[o]:o,c=twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsx(s,{...i,size:d,color:t,weight:r,className:c,"aria-label":n||`${e} icon`,"data-testid":`icon-${e}`})});x.displayName="Icon";var Oo=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:a="md",className:n,name:i,color:s,weight:d,ariaLabel:c,ref:u,...l})=>{let g=typeof a=="string"&&a in $e?$e[a]:a,y=t?typeof t=="string"&&t in $e?$e[t]:t:g*1.75,m=twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:m,style:{width:y,height:y},children:jsx(x,{...l,name:i,size:a,color:s,weight:d,className:n,ariaLabel:c})})});Oo.displayName="IconWithContainer";var ha=({isEntering:e,isExiting:o,className:t})=>["max-w-[200px] group bg-action-default border border-action-default-hover text-[color:var(--color-action-default-text)] 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 Wo({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,a)=>ha({...a,className:r})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-action-default stroke-action-default-hover 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 L4 4 L8 0"})})}),o]})]})}function Re(){let[e,o]=we__default.useState(false),t=we__default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=we__default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var Z=we__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));Z.displayName="InputWrapper";function Qe({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-secondary hover:text-text-primary cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(x,{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 ya(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function va(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}),ya({transparent:a,isDisabled:t}),W[n].text,W[n].height,W[n].padding,va(n),i)}function O({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:a="below",isRequired:n,className:i,htmlFor:s}){let d=t||r&&a==="tooltip",c=t||r,u=r&&a==="inline",l=jsxs("label",{htmlFor:s,className:twMerge(W[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsx("span",{children:"*"}),d&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(x,{name:"Info",size:o==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return d&&c?jsx(Wo,{content:c,children:l}):l}function k({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-secondary",W[e].text,o),children:t})}function f({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge(W[o].text,"text-feedback-error-text",t),children:e})}function xt({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 Ra="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Sa="bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",Ta={primary:Sa,secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border-2 border-border-muted hover:bg-action-secondary-hover forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-primary hover:bg-text-primary/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-primary hover:text-action-primary/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-primary hover:bg-background-hover hover:text-text-primary forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},Uo={full:"w-full",default:"w-fit"},Na="opacity-50 cursor-not-allowed pointer-events-none",wa="opacity-100 cursor-pointer",ka={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},Ia={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function Ba(e){return !e||e==="default"||e==="brand"?"primary":e}function Va(e){let{variant:o="primary",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Ba(o),s=i==="unstyled"?"":`${Ra} ${Ta[i]}`;i!=="unstyled"&&(s+=` ${W[t].text} ${W[t].height} ${W[t].padding} ${W[t].gap}`),r||n?s+=` ${Na}`:s+=` ${wa}`,a?s+=` ${Uo.full}`:s+=` ${Uo.default}`;let d=i==="primary"?"focus-visible:outline-action-primary":void 0;return [s,ke(),d].filter(Boolean).join(" ")}function S(e){let{icon:o,children:t,isLoading:r=false,loadingText:a,loadingIndicator:n,size:i="md",iconPosition:s="left",iconWeight:d,href:c,className:u,badgeNumber:l,badgeVariant:g="primary",badgePosition:y="top-right",style:m,target:p,rel:F,...C}=e,v=o?jsx(x,{name:o,size:i,weight:d}):null,V=jsxs(Fragment,{children:[s==="left"&&v,typeof t=="function"?null:t,s==="right"&&v]}),D=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(x,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:V}),a&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),I=(l??0)>0,R=twMerge(Va(e),u),T=c?{href:c,target:p,rel:F,...C}:{};if(c){let{onPress:N,onPressStart:te,onPressEnd:M,onPressChange:se,onPressUp:Y,onAuxClick:q,onContextMenu:ie,onDoubleClick:A,...h}=C;Object.assign(T,h);}let K=c?jsx(Link,{...T,...r&&{"aria-busy":true},style:I?void 0:m,className:R,children:r?D:typeof t=="function"?(function(N){return jsxs(Fragment,{children:[s==="left"&&v,t(N),s==="right"&&v]})}):V}):jsx(Button,{...C,...r&&{"aria-busy":true},style:I?void 0:m,className:R,children:r?D:typeof t=="function"?(function(N){return jsxs(Fragment,{children:[s==="left"&&v,t(N),s==="right"&&v]})}):V});return I?jsxs("div",{className:twMerge("relative flex",u),style:m,children:[K,jsx("span",{className:`absolute ${ka[y]} flex h-5 w-5 items-center justify-center rounded-full ${Ia[g]} text-xs font-medium`,"aria-label":`${l} items`,children:l})]}):K}function Ie({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-background-modal/20 via-background-modal/15 to-background-modal/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-background-modal/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 Ga({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 Ae({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:a=true,disableGroup:n=false,...i}){let d=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=d?c-6:c;let u=jsxs(Popover,{offset:c,...i,className:composeRenderProps(r,(l,g)=>Ga({...g,className:l,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(Ie,{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 Ko(e=true){let[o,t]=useState(null);return useEffect(()=>{if(!e){t(null);return}let r=typeof window<"u"?window.visualViewport:null;if(!r)return;let a=()=>{let n=Math.max(0,window.innerHeight-r.height-(r.offsetTop??0));t({height:r.height,keyboardOffset:n});};return a(),r.addEventListener("resize",a),r.addEventListener("scroll",a),()=>{r.removeEventListener("resize",a),r.removeEventListener("scroll",a);}},[e]),o}function Ut({action:e,defaultVariant:o,defaultSize:t="lg"}){let r=!!e.formId;return jsx(S,{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 Yt({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(Ut,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[o&&jsx(Ut,{action:o,defaultVariant:"secondary"}),e&&jsx(Ut,{action:e,defaultVariant:"primary"})]})]})]})}var Ka={heading:{sm:xe.headingSm,md:xe.headingMd,lg:xe.headingLg,xl:xe.headingXl},display:{sm:xe.displaySm,md:xe.displayMd,lg:xe.displayLg,xl:xe.displayXl}},Ya={page:"h-16 leading-[62px]"};function tt({tag:e="h1",variant:o="heading",size:t="lg",height:r,className:a="",children:n}){let i=t==="xs"?"sm":t,s=Ka[o][i],d=r?Ya[r]:"";return jsx(e,{className:gt(s,"text-text-primary",d,a),children:n})}var He=({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(S,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsx(x,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(tt,{size:"xs",children:e}),o&&!t&&jsx(S,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(x,{name:"X","data-testid":"close-button"})})]})]});var me=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:a=false,flex:n=false,stack:i,responsive:s,delay:d=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:l,"data-testid":g})=>{let[y,m]=useState(d===0);if(useEffect(()=>{if(d>0){let I=setTimeout(()=>m(true),d);return ()=>clearTimeout(I)}},[d]),!y)return null;let p=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)]",F=c&&e?(()=>{let I=typeof e=="number"?e:parseFloat(String(e));return isNaN(I)?"":`animation-duration-[${Math.max(.8,I/100)}s]`})():"",C=r==="pulse"?`animate-pulse ${F}`: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 ${F}`:"",v="rounded-sm";t==="circle"&&(v="rounded-full"),t==="text"&&(v="h-4 w-full rounded-sm");let V=n?"flex-1 min-w-0":"",D=s?Object.entries(s).map(([I,R])=>`${I}:w-[${R}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":g,children:i.map((I,R)=>jsx("div",{className:twMerge(p,C,v,V,D,l),style:{width:I,height:o}},R))}):jsx("div",{className:twMerge(p,C,v,V,D,l),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":g})};var en={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"},tn="rounded-lg",Xt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},on={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function pe({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:a="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",en[e],tn,a==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsx(me,{width:"100%",height:"100%",className:"rounded-none"}):t})}function ht({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(me,{width:120,height:20}),jsx(me,{width:24,height:24})]}),o&&jsx(me,{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(tt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsx("div",{className:zo("bodySm","text-text-secondary"),children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function Xo({src:e,alt:o,aspectRatio:t="auto",className:r,children:a,isLoading:n=false}){return n?jsx("div",{className:twMerge("bg-background-muted",Xt[t],r),children:jsx(me,{width:"100%",height:"100%"})}):a?jsx("div",{className:twMerge("overflow-hidden",Xt[t],r),children:a}):e?jsx("div",{className:twMerge("overflow-hidden",Xt[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function yt({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(me,{width:"100%",height:16}),jsx(me,{width:"80%",height:16}),jsx(me,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge("px-6 py-4 text-text-primary",r&&"flex-1 flex flex-col min-h-0",e),children:o}):null}function Qo({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(me,{width:80,height:32}),jsx(me,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",on[t],e),children:o}):null}pe.Header=ht;pe.Media=Xo;pe.Content=yt;pe.Footer=Qo;var rt=class extends Component{constructor(){super(...arguments);Lt(this,"state",{hasError:false});Lt(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(pe,{children:[this.props.title&&jsx(pe.Header,{title:this.props.title}),jsx(pe.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var sn=.3,ln=.5;function Oe({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:a=false,hasBackArrow:n=false,onBack:i,isOpen:s,onClose:d,isDismissable:c=true,transparentOverlay:u=false,primaryAction:l,secondaryAction:g,footerContent:y,maxHeight:m="80vh",height:p,maxWidth:F="640px",contentPadding:C=true,showHandle:v=true,animationVariant:V="scale",className:D}){let[I,R]=useState(false),[T,K]=useState(0),[N,te]=useState(false),M=Ko(s),se=M?.height??null,Y=M?.keyboardOffset??0,q=useRef(null),ie=useRef(null),A=useRef(null),h=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let b=setTimeout(()=>{R(true),setTimeout(()=>R(false),600);},400);return ()=>clearTimeout(b)}},[s]),useEffect(()=>{s||(K(0),te(false),h.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let b=ie.current;if(!b||!s)return;let U=null,z=X=>{let ge=X.target;ge&&["INPUT","TEXTAREA","SELECT"].includes(ge.tagName)&&(U&&clearTimeout(U),U=setTimeout(()=>{ge.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return b.addEventListener("focusin",z),()=>{b.removeEventListener("focusin",z),U&&clearTimeout(U);}},[s]);let Ne=useCallback(b=>{c&&(b.pointerType!=="touch"&&b.pointerType!=="pen"||(A.current&&(clearTimeout(A.current),A.current=null),h.current={isDragging:true,startY:b.clientY,startTime:Date.now(),pointerId:b.pointerId},te(false),b.currentTarget.setPointerCapture(b.pointerId)));},[c]),Fe=useCallback(b=>{let{isDragging:U,startY:z,pointerId:X}=h.current;if(!U||b.pointerId!==X)return;let ge=b.clientY-z;K(Math.max(0,ge));},[]),le=useCallback(b=>{let{isDragging:U,startY:z,startTime:X,pointerId:ge}=h.current;if(!U||b.pointerId!==ge)return;let Q=b.clientY-z,Le=Date.now()-X,Ye=Q/Le;h.current={isDragging:false,startY:0,startTime:0,pointerId:null};let dt=(q.current?.getBoundingClientRect().height??0)*sn;(Q>dt||Ye>ln&&Q>50)&&c?(d?.(),K(0)):(te(true),K(0),A.current=setTimeout(()=>{te(false),A.current=null;},200));},[c,d]);if(!s)return null;let ve=o||t,Ce=l||g||y;return jsx(rt,{children:jsx(Ie,{isOpen:s,onOpenChange:b=>{b||d?.();},isDismissable:c,transparent:u,style:{paddingBottom:Y>0?`${Y}px`:void 0,transition:"padding-bottom 0.25s ease-out"},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:q,className:twMerge("w-full",N&&"transition-transform duration-200"),style:{transform:T>0?`translateY(${T}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",V==="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)]",V==="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)]",D),style:{maxWidth:F,...p?{height:p}:{maxHeight:/\d/.test(m)?se!==null?`min(${m}, ${Math.max(se-8,0)}px, 100dvh)`:`min(${m}, 100dvh)`:m}},children:[v&&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:Ne,onPointerMove:Fe,onPointerUp:le,onPointerCancel:le,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",I&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),ve&&(n?jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,onClose:d||(()=>{})})),jsx("div",{ref:ie,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",C?"p-4":"p-0"),children:e}),Ce&&jsx(Yt,{primaryAction:l,secondaryAction:g,footerContent:y})]})})})})})}Oe.displayName="Tray";var ao=createContext("md");function rr(){return useContext(ao)}function to(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-disabled overflow-hidden text-ellipsis whitespace-nowrap ${W[e].text} ${o}`}function fn(){let e=we__default.useCallback((t,r)=>{r?.(t);},[]),o=we__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function no({label:e,description:o,errorMessage:t,children:r,items:a,renderItem:n,renderSelectedValue:i,size:s="md",selectedKey:d,defaultSelectedKey:c,onSelectionChange:u,placeholder:l,showErrors:g=false,tooltip:y,isRequired:m,transparent:p,reserveErrorSpace:F=false,placement:C="bottom start",shouldFlip:v=true,menuWidth:V="match",descriptionPlacement:D="below",useMobileTray:I=true,...R}){let[T,K]=useState(null),[N,te]=useState(null),[M,se]=useState(false),Y=d??T??c,{handleFocus:q,handleBlur:ie}=fn(),{isMobile:A}=pt(),h=I&&A,Ne=we__default.useMemo(()=>!i||!Y||!a?null:Array.from(a).find(U=>U.id===Y)??null,[i,Y,a]),Fe=b=>{u&&b!==null&&u(b),u||K(b);},le=useRef(null),ve=useRef(null),Ce=()=>{h&&se(!M);};return jsxs(Fragment,{children:[jsx(Select,{...R,selectedKey:Y,defaultSelectedKey:c,onSelectionChange:Fe,placeholder:l,className:_(R.className,"group flex w-full flex-col"),ref:le,onOpenChange:b=>{h||(b&&ve.current?te(ve.current.offsetWidth):b||le.current?.blur());},children:({isDisabled:b,isInvalid:U,isOpen:z})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:s,tooltip:y,description:D==="tooltip"||D==="inline"?o:void 0,descriptionPlacement:D,isRequired:m,children:e}),jsx(Z,{children:jsx("div",{ref:ve,children:jsxs(S,{variant:"unstyled",className:twMerge(oe({isInvalid:U||g&&!!t,isDisabled:b,isFocused:h?M:z,transparent:p,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:X=>q(X,R.onFocus),onBlur:X=>ie(X,R.onBlur),onPress:h?Ce:void 0,"data-open":h?M:z,children:[i&&Ne?jsx("div",{className:to(s),children:i(Ne)}):h&&Y?jsx("div",{className:to(s),children:a?Array.from(a).find(Q=>Q.id===Y)?.label:String(Y)}):jsx(SelectValue,{className:to(s)}),jsx(x,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(h?M:z)&&"rotate-180")})]})})}),F?jsx("div",{className:"mt-1 min-h-[20px]",children:g?jsx(f,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&R.validationResult?t(R.validationResult):typeof t=="string"?t:null}):o&&D==="below"?jsx(k,{size:s,children:o}):null}):jsx(Fragment,{children:g?jsx(f,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&R.validationResult?t(R.validationResult):typeof t=="string"?t:null}):o&&D==="below"?jsx(k,{size:s,className:"mt-1",children:o}):null}),h?null:jsx(Ae,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:V==="match"&&N?`${N}px`:void 0,minWidth:V==="auto"&&N?`${N}px`:void 0,maxWidth:V==="auto"?"min(600px, 90vw)":void 0},placement:C,shouldFlip:v,children:jsx(ao.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?X=>jsx(Te,{id:X.id,textValue:X.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(X)})},X.id):r})})})]})}),h&&jsx(Oe,{isOpen:M,onClose:()=>se(false),title:e??"Select an option",contentPadding:false,children:jsx(ao.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:Y!=null?[Y]:[],onSelectionChange:b=>{let U=Array.from(b)[0];U!=null&&(Fe(U),se(false));},children:n&&a?b=>jsx(Te,{id:b.id,textValue:b.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(b)})},b.id):r})})})]})}function Te({size:e,className:o,...t}){let r=rr(),a=e??r;return jsx(ListBoxItem,{...t,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary 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",W[a].paddingY,W[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 Tn=[],Nn={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},wn={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},ir={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},so=(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 kn(e,o,t){try{let r=e.url.replace("{q}",o),a=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([d,c])=>{a.append(d,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 In(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 lo({label:e,staticItems:o=Tn,sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:d,errorMessage:c,description:u,size:l="md",tooltip:g,isRequired:y,isDisabled:m,isInvalid:p,validationResult:F,showErrors:C=true,renderItem:v,renderLeftIcon:V,renderSection:D,autoFocus:I=false,reserveErrorSpace:R=false,hideChevron:T=false,useMobileTray:K=true,className:N}){let te=we__default.useRef(null),M=we__default.useRef(null),[se,Y]=we__default.useState(),[q,ie]=useState(()=>so(r||a,o,t)),[A,h]=useState(false),[Ne,Fe]=useState(false),le=Ao(q),{contains:ve}=mt({sensitivity:"base"}),[Ce,b]=useState(),{isMobile:U}=pt(),z=K&&U,X=W[l].text,ge=useAsyncList({async load({signal:w,filterText:E=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(E))return {items:[]};try{let ee;return i.requestType==="GraphQL"?ee=await In(i,E,w):ee=await kn(i,E,w),b(ee.error),{items:ee.items}}catch(ee){return ee instanceof Error&&ee.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ee),b(ee instanceof Error?ee.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),Q=i&&le!==""?ge:null,Le=false,Ye=useRef("");useEffect(()=>{I&&h(true);},[I]),useEffect(()=>{let w=so(r,o,t);w!==q&&ie(w);},[r,o,t]),useEffect(()=>{let w=()=>{te.current&&Y(te.current.offsetWidth);};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),useEffect(()=>{le===""?Ye.current="":Q&&le!==Ye.current&&(Ye.current=le,Q.setFilterText(le));},[le,Q]),Le=ft(!!Q?.isLoading,300);let Bo=we__default.useMemo(()=>{if(!z||!q)return Q?Q.items:o;let w=Q?Q.items:o,E=s||ve;return w.filter(ee=>E(ee.name,q))},[z,q,Q,o,s,ve]),dt=w=>{let E=so(w,o,t);ie(E),n&&n(w);},Et=w=>{ie(w);},Vo=()=>{z&&Fe(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:dt,selectedKey:r||void 0,defaultSelectedKey:a||void 0,defaultItems:t?t.flatMap(w=>w.items):o,items:Q?Q.items:void 0,className:_(N,"group flex flex-col w-full"),menuTrigger:z?"manual":"focus",isDisabled:m,isInvalid:p||!!c,inputValue:q,onInputChange:Et,autoFocus:I&&!z,defaultFilter:s||ve,"aria-label":e||d||"Autocomplete",children:w=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:l,tooltip:g,isRequired:y,children:e}),jsxs(Z,{ref:te,children:[V?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:V(Le)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:Le?jsx(Ge,{size:16,color:"text-text-secondary"}):jsx(x,{name:"MagnifyingGlass",className:`${Nn[l]} text-text-secondary`})}),jsx(Input,{className:oe({isInvalid:p||!!c,isDisabled:m,isFocused:A||(z?Ne:w.isOpen),size:l,className:twMerge(wn[l],q&&!m||!T&&!q?"pr-10":"pr-3",z&&"cursor-pointer",N)}),placeholder:d,disabled:m,onFocus:E=>{h(true),z&&(E.currentTarget.blur(),Vo());},onBlur:()=>{h(false);},onClick:z?Vo:void 0,readOnly:z,"aria-label":e||d||"Autocomplete"}),q&&!m&&jsx(Qe,{onClick:()=>{ie(""),n?.(null);},size:l}),!T&&!q&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:m,children:({isPressed:E})=>jsx(x,{name:E?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),R?jsx("div",{className:"mt-1 min-h-[20px]",children:C&&Ce?jsx(f,{size:l,className:"text-feedback-error-text",children:Ce}):C&&typeof c=="string"?jsx(f,{size:l,className:"text-feedback-error-text",children:c}):C&&typeof c=="function"&&F?jsx(f,{size:l,className:"text-feedback-error-text",children:c(F)}):u?jsx(k,{size:l,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(k,{size:l,className:"mt-1",children:u}),C&&Ce&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:Ce}),C&&typeof c=="string"&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c}),C&&typeof c=="function"&&F&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c(F)})]}),!z&&jsx(Ae,{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:se?`${se}px`:void 0},children:jsx(ListBox,{"aria-label":e||d||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${X}`,children:t?t.map(E=>{let ee=E.items.map(be=>jsx(Te,{id:be.id,textValue:be.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${ir[l]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v(be):jsxs(Fragment,{children:[be.name,jsx(x,{name:"X",className:"ml-auto h-4 w-4 text-text-secondary opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},be.id));if(D){let be=D(E,ee);return we__default.isValidElement(be)&&be.type===ListBoxSection?be:jsx(ListBoxSection,{children:be},E.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:E.name}),ee]},E.name)}):E=>jsx(Te,{id:E.id,textValue:E.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${ir[l]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:v?v(E):jsxs(Fragment,{children:[E.name,jsx(x,{name:"X",className:"ml-auto h-4 w-4 text-text-secondary opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},E.id)})})]})}),z&&jsx(Oe,{isOpen:Ne,onClose:()=>Fe(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(Z,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:Le?jsx(Ge,{size:16,color:"text-text-secondary"}):jsx(x,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:M,type:"text",value:q,onChange:w=>Et(w.target.value),placeholder:d,autoFocus:true,className:oe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),q&&jsx(Qe,{onClick:()=>{ie(""),n?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||d||"Suggestions",items:Bo,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:w=>{let E=Array.from(w)[0];E&&(dt(E),Fe(false));},className:"bg-background-input outline-none",children:w=>jsx(Te,{id:w.id,textValue:w.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:v?v(w):w.name},w.id)})})]})})]})}function L(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 Hu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(lo,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var An="focus:ring-action-primary",zn="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function dr(e){return jsxs(CheckboxGroup,{...e,className:_(e.className,"flex flex-col gap-2"),children:[jsx(O,{children:e.label}),e.children,e.description&&jsx(k,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Hn({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function _n({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r}){let a="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",n=An,i="";return t?i="border-border-muted bg-background-muted":o?i="border-feedback-error-border bg-feedback-error-background":e||r?i=zn:i="bg-background-input border-border-input hover:border-border-focus",`${a} ${n} ${i}`}var lr="w-4 h-4 text-current group-disabled:text-text-disabled";function cr(e){let{children:o,variant:t,...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(a,n)=>`${Hn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,d=jsx("div",{className:_n({isSelected:n,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:lr}):n?jsx(Check,{"aria-hidden":true,className:lr}):null});return jsxs(Fragment,{children:[d,typeof o=="function"?o(a):o]})}})}function rm({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=useFormContext(),i=L(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(cr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(f,{children:i})]})})}function dm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(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),errorMessage:n,children:t.children})})}function We(e){if(!e)return false;let o=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(o)}function mo(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 fr({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,className:s,validationResult:d,value:c,defaultValue:u,onChange:l,placeholder:g="#000000",showColorSwatch:y=true,reserveErrorSpace:m=true,...p}){let[F,C]=useState(u||""),[v,V]=useState(c||u||""),[D,I]=useState(false),[R,T]=useState(null),{isFocused:K,handleFocus:N,handleBlur:te}=Re(),M=c!==void 0?c:F;useEffect(()=>{c!==void 0&&V(c);},[c]);let se=M?!We(M):false,Y=useCallback(A=>{if(V(A),We(A)){let h=mo(A);l?l(h):C(h);}else A===""&&(l?l(""):C(""));},[l]),q=useCallback(A=>{let h=mo(A);V(h),l?l(h):C(h);},[l]),ie=useCallback(A=>{if(We(v)){let h=mo(v);V(h),l&&h!==M?l(h):!l&&h!==F&&C(h);}te(A,p.onBlur);},[v,M,F,l,te,p.onBlur]);return jsx(TextField,{...p,isRequired:n,className:_(s,"group flex flex-col"),children:({isDisabled:A})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(xt,{size:r,disabled:A,type:"text",value:v,placeholder:g,onFocus:h=>N(h,p.onFocus),onBlur:ie,onChange:h=>Y(h.target.value),className:twMerge(oe({isInvalid:se,isDisabled:A,isFocused:K,size:r,transparent:i}),y?"pr-12":"pr-3","pl-3")}),y&&jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:W[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",We(M)?"border-border-default":"border-border-default bg-background-muted"),style:We(M)?{backgroundColor:M}:void 0,"aria-hidden":"true",children:!We(M)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:T,children:jsx(S,{variant:"secondary",size:r,icon:"Palette",onPress:()=>I(!D),isDisabled:A,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&d?jsx(f,{size:r,children:t(d)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(f,{size:r,className:"mt-1",children:t(d)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null}),D&&R&&jsx(Ae,{triggerRef:{current:R},isOpen:D,onOpenChange:I,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:M||"#000000",onChange:q,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:M||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:M||"#000000"})]})]})})]})})}function Nm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(fr,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function di({isSelected:e,isDisabled:o}){let t=[ke,"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-inverse invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-primary hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function fo({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(br,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(xr,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${di({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function br(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(S,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(x,{name:"CaretRight","aria-hidden":true,size:o}):jsx(x,{name:"CaretLeft","aria-hidden":true,size:o})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(S,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(x,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(x,{name:"CaretRight","aria-hidden":true,size:o})})]})}function xr(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}function bo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,showCalendar:d=true,reserveErrorSpace:c=true,validationResult:u,className:l,...g}){let[y,m]=useState(false),p=F=>{g.onChange&&F&&g.onChange(F),m(false);};return jsxs(DateField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(l,"flex flex-col gap-1"),children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsxs("div",{className:"relative w-full",children:[jsx(yr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxs(DialogTrigger,{isOpen:y,onOpenChange:m,children:[jsx(S,{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-secondary hover:text-text-primary transition-colors","aria-label":"Open calendar",children:jsx(x,{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(fo,{value:g.value,onChange:p,minValue:g.minValue,maxValue:g.maxValue,isDisabled:i,isReadOnly:g.isReadOnly,isDateUnavailable:g.isDateUnavailable})})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&u?jsx(f,{size:r,children:t(u)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(f,{size:r,className:"mt-1",children:t(u)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function xi({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-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function yr({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:xi({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function ip({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(bo,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function xo({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:a,isDisabled:n=false,onUpload:i,className:s,showPreview:d=true,placeholder:c="Drop files here or click to browse"}){let[u,l]=useState(false),[g,y]=useState(false),[m,p]=useState(null),[F,C]=useState(e),v=useRef(null),V=async R=>{if(p(null),a&&R.size>a){p(`File size must be less than ${(a/1024/1024).toFixed(2)}MB`);return}if(d&&R.type.startsWith("image/")){let T=new FileReader;T.onloadend=()=>{C(T.result);},T.readAsDataURL(R);}if(i){y(true);try{let T=await i(R);C(T),t?.(T);}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{y(false);}}o?.(R,F);},D=async R=>{try{let T=R.items;if(T.length>0){let K=T[0];if(K.kind==="file"){let N=await K.getFile();N&&V(N);}}}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{l(false);}},I=()=>{C(void 0),p(null),o?.(null),t?.(""),v.current&&(v.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",m&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:D,onDropEnter:()=>l(true),onDropExit:()=>l(false),children:[F?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&(F.startsWith("data:image")||F.startsWith("http"))?jsx("img",{src:F,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-secondary"}),jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!n&&jsx(S,{variant:"icon",size:"sm",onPress:I,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-secondary"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-primary",children:c}),jsx("p",{className:"mt-1 text-xs text-text-secondary",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsx(FileTrigger,{acceptedFileTypes:r.split(","),onSelect:R=>{let T=Array.from(R||[]);T.length>0&&V(T[0]);},children:jsx(S,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),g&&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-secondary",children:"Uploading..."})]})})]}),m&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:m})]})}function Fp({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=useFormContext(),i=L(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(xo,{...r,value:s.value??"",onChange:(d,c)=>s.onChange(c||"")}),t&&i&&jsx(f,{children:i})]})})}var Di=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 vo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,validationResult:s,reserveErrorSpace:d=true,descriptionPlacement:c="below",...u}){let l=useId(),{isFocused:g,handleFocus:y,handleBlur:m}=Re();return jsx(NumberField,{...u,id:l,isRequired:n,className:_(u.className,"group flex flex-col gap-1"),step:u.step??1,onChange:p=>{typeof p=="number"&&(u.maxValue!=null&&p>u.maxValue?u.onChange?.(u.maxValue):u.minValue!=null&&p<u.minValue?u.onChange?.(u.minValue):u.onChange?.(p));},isInvalid:!!t||typeof u.value=="number"&&(u.maxValue!=null&&u.value>u.maxValue||u.minValue!=null&&u.value<u.minValue),children:({isDisabled:p,isInvalid:F})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(O,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,htmlFor:l,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:v=>y(v,u.onFocus),onBlur:v=>m(v,u.onBlur),className:Di({isInvalid:F||!!t,isDisabled:p,isFocused:g,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:p,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(x,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:p,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(x,{name:"CaretDown",size:14})})]})]})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(f,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(f,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function _p({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(vo,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function wt({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:i,children:s,size:d="2",variant:c="primary",columns:u="repeat(auto-fit, minmax(160px, 1fr))",gap:l="1"}){return jsx(RadioGroup,{value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:_(i,"grid"),style:{gridTemplateColumns:/^\d+$/.test(String(u))?`repeat(${u}, minmax(0, 1fr))`:u,gap:l==="1"?"0.25rem":l==="2"?"0.5rem":l==="3"?"0.75rem":l==="4"?"1rem":typeof l=="number"?`${l}px`:l},children:we__default.Children.map(s,g=>we__default.isValidElement(g)?we__default.cloneElement(g,{size:d,variant:c}):g)})}function af({name:e,defaultValue:o,label:t,description:r,children:a,...n}){let{control:i,formState:s}=useFormContext(),d=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(O,{children:t}),r&&jsx(k,{children:r}),jsx(wt,{...n,value:c.value,onChange:u=>c.onChange(u),children:a}),d&&jsx(f,{children:d})]})})}function Ki(e){return "primary"}var Yi=createContext({variant:"primary"});function Fo(e){let{variant:o="primary",...t}=e,r=Ki();return jsx(Yi.Provider,{value:{variant:r},children:jsxs(RadioGroup,{...t,className:_(e.className,"group flex flex-col gap-2"),children:[jsx(O,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(k,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function Tf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(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),errorMessage:n,children:t.children})})}var ts=e=>{let o=oe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(o,t,e.className)};function lt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,showSearchIcon:s,isClearable:d,onClear:c,type:u,validationResult:l,reserveErrorSpace:g=true,isLoading:y=false,descriptionPlacement:m="below",...p}){let[F,C]=we__default.useState(false),{isFocused:v,handleFocus:V,handleBlur:D}=Re(),I=u==="password",R=ft(y,300);return jsx(TextField,{...p,isRequired:n,className:_(p.className,"group flex flex-col"),children:({isDisabled:T,isInvalid:K})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,description:m==="tooltip"||m==="inline"?o:void 0,descriptionPlacement:m,isRequired:n,children:e}),jsxs(Z,{children:[s&&jsx("div",{className:"pointer-events-none absolute top-1/2 -translate-y-1/2 transform flex items-center z-10",style:{left:9},children:(()=>{let N={sm:14,md:16,lg:18,xl:20}[r];return R?jsx(Ge,{size:N,color:"text-text-secondary"}):jsx(x,{name:"MagnifyingGlass",size:N,className:`transition-colors ${v?"text-action-brand":"text-text-secondary"}`})})()}),jsx(xt,{size:r,disabled:T,type:I?F?"text":"password":u,value:p.value,defaultValue:p.defaultValue,placeholder:p.placeholder,onFocus:N=>V(N,p.onFocus),onBlur:N=>D(N,p.onBlur),onChange:N=>p.onChange?.(N.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[r]}:void 0,className:ts({isInvalid:K,isDisabled:T,isFocused:v,size:r,transparent:i,showSearchIcon:s,isClearable:d,hasValue:!!p.value,isPassword:I,className:typeof p.className=="string"?p.className:void 0})}),d&&p.value&&!T&&jsx(Qe,{onClick:()=>{c?c():p.onChange&&p.onChange("");},size:r}),I&&!T&&jsx("button",{type:"button",onClick:()=>C(!F),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":F?"Hide password":"Show password",onMouseDown:N=>{N.preventDefault(),N.stopPropagation();},children:jsx(x,{name:F?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o&&m==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o&&m==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}var us={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"}},Ue=({isActive:e=false,onPress:o,children:t})=>jsx(S,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function ms({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[a,n]=useState(e);return we__default.useEffect(()=>{n(e);},[e]),jsx(Ie,{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(He,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(lt,{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(S,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(S,{type:"submit",children:"Save"})]})]})})})})}function Co({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:a="Start typing...",id:n,size:i="md",headingLevels:s=[1,2]}){let d=us[i],[c,u]=useState(false),l=useEditor({immediatelyRender:false,extensions:[ss.configure({heading:s.length>0?{levels:s}:false}),rs.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:m})=>{o?.(m.getHTML());},editorProps:{attributes:{class:twMerge(`prose ${d.prose} max-w-none`,"focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),g=()=>{u(true);},y=m=>{m===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:m}).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:[!r&&l&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:l,shouldShow:({editor:m})=>m.isActive("link")&&!c,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let m=l.getAttributes("link").href;m&&window.open(m,"_blank","noopener,noreferrer");},children:[jsx(x,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:g,children:[jsx(x,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(x,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(ms,{isOpen:c,onClose:()=>u(false),onSubmit:y,initialUrl:l.getAttributes("link").href||""})]}),jsxs("div",{className:twMerge("flex items-center gap-1 border-b border-border-input",d.toolbar),children:[s.map(m=>jsx(Ue,{isActive:l.isActive("heading",{level:m}),onPress:()=>l.chain().focus().toggleHeading({level:m}).run(),children:jsxs("span",{className:"text-xs font-bold",children:["H",m]})},m)),jsx(Ue,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(Ue,{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(Ue,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(x,{name:"ListBullets",className:"h-4 w-4"})}),jsx(Ue,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(x,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(Ue,{isActive:l.isActive("link"),onPress:g,children:jsx(x,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxs("div",{className:twMerge("relative w-full outline-none focus:outline-none",d.contentWrapper),children:[jsx(EditorContent,{editor:l,className:twMerge("w-full outline-none focus:outline-none",d.contentPadding,"[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none",d.h1,d.h2,d.p,"[&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:list-decimal",d.list,d.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-secondary",d.placeholderPos,d.placeholderText),children:a})]})]}):null}function dg({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=useFormContext(),d=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-primary",children:t}),r&&jsx("p",{className:"text-sm text-text-secondary",children:r}),jsx(Co,{...n,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),d&&jsx("p",{className:"text-sm text-feedback-error-text",children:d}),a&&!d&&jsx("div",{className:"h-5"})]})})}function hg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(no,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var So={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 vs({isSelected:e,isDisabled:o,size:t="md"}){let r="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",a=So[t].track,n=ke,i="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[r,a,n,i,s,o?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function Ps({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",a=So[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function To({children:e,variant:o="primary",size:t="md",...r}){return jsx(Switch,{...r,className:_(r.className,`group flex items-center gap-2 ${So[t].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:a=>jsxs(Fragment,{children:[jsx("div",{className:vs({...a,size:t}),children:jsx("span",{className:Ps({...a,size:t})})}),e]})})}function Ig({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(To,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var Ns=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 No({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,required:n,transparent:i,isInvalid:s,isDisabled:d,isResizable:c=false,className:u,validationResult:l,reserveErrorSpace:g=true,...y}){let{isFocused:m,handleFocus:p,handleBlur:F}=Re();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsx("textarea",{...y,required:n,onFocus:C=>{y.onFocus&&y.onFocus(C),p(C);},onBlur:C=>{y.onBlur&&y.onBlur(C),F(C);},className:Ns({isInvalid:s,isDisabled:d,isResizable:c,isFocused:m,size:r,transparent:i,className:u}),disabled:d})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function Gg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(No,{...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 jg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(lt,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Ms({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-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function wo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,reserveErrorSpace:d=true,validationResult:c,className:u,descriptionPlacement:l="below",...g}){return jsxs(TimeField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(u,"flex flex-col gap-1"),children:[e&&jsx(O,{size:r,tooltip:a,description:l==="tooltip"||l==="inline"?o:void 0,descriptionPlacement:l,isRequired:n,children:e}),jsx(Z,{children:jsx(DateInput,{className:twMerge(Je({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:y=>jsx(DateSegment,{segment:y,className:Ms({isPlaceholder:y.isPlaceholder,isDisabled:!y.isEditable||i,size:r})})})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&c?jsx(f,{size:r,children:t(c)}):o&&l==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(f,{size:r,className:"mt-1",children:t(c)}):o&&l==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function gb({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(wo,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function vb({className:e,title:o="Please fix the following errors:",autoFocus:t=true}){let{formState:r}=useFormContext(),a=we.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(we.useEffect(()=>{t&&s&&a.current?.focus();},[t,s]),!s)return null;let d=c=>{let u=`[name="${CSS.escape(c)}"]`,l=document.querySelector(u);l&&(l.focus(),l.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 l=u?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>d(c),children:l})},c)})})]})}function Sb({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(S,{type:"submit",form:e,isDisabled:s,...n,children:a})}function Bb({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((c,u)=>jsxs(pe,{children:[jsx(ht,{title:o?o(u):`Item ${u+1}`,actions:jsxs("div",{className:"flex gap-2",children:[u>0&&jsx(S,{size:"sm",variant:"secondary",onPress:()=>d(u,u-1),children:"Up"}),u<n.length-1&&jsx(S,{size:"sm",variant:"secondary",onPress:()=>d(u,u+1),children:"Down"}),jsx(S,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsx(yt,{children:t(u)})]},c.id)),jsx("div",{children:jsx(S,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function Io(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Er(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 qb({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:a=true,className:n,...i}){let s=useForm(i),d=(c,u)=>{if(a&&e){let l=document.getElementById(e);l&&Er(l);}t?.(c,u);};return jsx(FormProvider,{...s,children:jsx(Io,{id:e,className:n,onSubmit:s.handleSubmit(o,d),children:r})})}function $r({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-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(S,{variant:"secondary",onPress:r,children:n}),jsx(S,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":a})]})]})}):null}function ex({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a}){let{formState:n}=useFormContext();return jsx($r,{formId:e,show:n.isDirty,isSubmitting:n.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a})}function ax(e=true){let{formState:o}=useFormContext();we.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 sx({delayMs:e=800,onAutoSave:o}){let{watch:t,formState:r,getValues:a}=useFormContext(),n=we.useRef(void 0);we.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{vb as ErrorSummary,Bb as FieldArrayList,Hu as FormAutocomplete,rm as FormCheckbox,dm as FormCheckboxGroup,Nm as FormColorField,ip as FormDateField,Fp as FormFileUpload,_p as FormNumberField,qb as FormProvider,af as FormRadioCardGroup,Tf as FormRadioGroup,dg as FormRichTextEditor,ex as FormSaveBar,hg as FormSelect,Ig as FormSwitch,Gg as FormTextArea,jg as FormTextField,gb as FormTimeField,Sb as SubmitButton,Er as focusFirstError,sx as useAutoSave,ax 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 pa from'@phosphor-icons/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Minus,Check,Image,X,Upload}from'lucide-react';import {HexColorPicker}from'react-colorful';import rs from'@tiptap/extension-link';import {useEditor,EditorContent}from'@tiptap/react';import {BubbleMenu}from'@tiptap/react/menus';import ss from'@tiptap/starter-kit';var Ar=Object.defineProperty;var zr=(e,o,t)=>o in e?Ar(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var Et=(e,o,t)=>zr(e,typeof o!="symbol"?o+"":o,t);var ct={prefix:String(Math.round(Math.random()*1e10)),current:0},Vo=Ne__default.createContext(ct),Or=Ne__default.createContext(false);var Gr=!!(typeof window<"u"&&window.document&&window.document.createElement),Lt=new WeakMap;function Wr(e=false){let o=useContext(Vo),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=Lt.get(n);i==null?Lt.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,Lt.delete(n));}t.current=++o.current;}return t.current}function qr(e){let o=useContext(Vo);o===ct&&!Gr&&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=Wr(!!e),r=o===ct&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function Ur(e){let o=Ne__default.useId(),[t]=useState(ut()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ct.prefix}`;return e||`${r}-${o}`}typeof Ne__default.useId=="function"?Ur:qr;function Yr(){return false}function jr(){return true}function Qr(e){return ()=>{}}function ut(){return typeof Ne__default.useSyncExternalStore=="function"?Ne__default.useSyncExternalStore(Qr,Yr,jr):useContext(Or)}var Xr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Jr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function $t(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 Xr.has(t.script)}let o=e.split("-")[0];return Jr.has(o)}var Lo=Symbol.for("react-aria.i18n.locale");function Do(){let e=typeof window<"u"&&window[Lo]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:$t(e)?"rtl":"ltr"}}var Mt=Do(),je=new Set;function Eo(){Mt=Do();for(let e of je)e(Mt);}function $o(){let e=ut(),[o,t]=useState(Mt);return useEffect(()=>(je.size===0&&window.addEventListener("languagechange",Eo),je.add(t),()=>{je.delete(t),je.size===0&&window.removeEventListener("languagechange",Eo);}),[]),e?{locale:typeof window<"u"&&window[Lo]||"en-US",direction:"ltr"}:o}var ra=Ne__default.createContext(null);function At(){let e=$o();return useContext(ra)||e}var zt=new Map;function Ht(e){let{locale:o}=At(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(zt.has(t))return zt.get(t);let r=new Intl.Collator(o,e);return zt.set(t,r),r}function mt(e){let o=Ht({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 c=n.slice(s,s+d);if(o.compare(i,c)===0)return true}return false},[o]);return useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function De(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 Qe={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function pt(e="base"){let o=De(`(min-width: ${Qe.sm})`,e!=="base"),t=De(`(min-width: ${Qe.md})`,["md","lg","xl","2xl"].includes(e)),r=De(`(min-width: ${Qe.lg})`,["lg","xl","2xl"].includes(e)),a=De(`(min-width: ${Qe.xl})`,["xl","2xl"].includes(e)),n=De(`(min-width: ${Qe["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 Mo(e,o=300){let[t,r]=useState(e);return useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function ft(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 gt(...e){return e.filter(Boolean).join(" ")}var xe={displayXl:"text-display-xl",displayLg:"text-display-lg",displayMd:"text-display-md",displaySm:"text-display-sm",headingXl:"text-heading-xl",headingLg:"text-heading-lg",headingMd:"text-heading-md",headingSm:"text-heading-sm",bodyLg:"text-body-lg",bodyMd:"text-body-md",bodySm:"text-body-sm",labelLg:"text-label-lg",labelMd:"text-label-md",labelSm:"text-label-sm",code:"text-code",agent:"text-agent"};function Ao(e,...o){return gt(xe[e],...o)}function we(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 W={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 $e={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},h=memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=pa[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 $e?$e[o]:o,c=twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsx(s,{...i,size:d,color:t,weight:r,className:c,"aria-label":n||`${e} icon`,"data-testid":`icon-${e}`})});h.displayName="Icon";var _o=memo(({variant:e="subtle",shape:o="square",containerSize:t,containerClassName:r,size:a="md",className:n,name:i,color:s,weight:d,ariaLabel:c,ref:u,...l})=>{let g=typeof a=="string"&&a in $e?$e[a]:a,v=t?typeof t=="string"&&t in $e?$e[t]:t:g*1.75,m=twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-background-muted",e==="solid"&&"bg-action-brand text-[color:var(--color-action-brand-text)]",e==="outline"&&"border-2 border-current",r);return jsx("div",{className:m,style:{width:v,height:v},children:jsx(h,{...l,name:i,size:a,color:s,weight:d,className:n,ariaLabel:c})})});_o.displayName="IconWithContainer";var ha=({isEntering:e,isExiting:o,className:t})=>["max-w-[200px] group bg-action-default border border-action-default-hover text-[color:var(--color-action-default-text)] 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 Go({children:e,content:o,...t}){return jsxs(TooltipTrigger,{delay:200,children:[e,jsxs(Tooltip,{...t,offset:10,className:composeRenderProps(t.className,(r,a)=>ha({...a,className:r})),children:[jsx(OverlayArrow,{children:jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-action-default stroke-action-default-hover 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 L4 4 L8 0"})})}),o]})]})}function Ce(){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 Z=Ne__default.forwardRef(({children:e,className:o},t)=>jsx("div",{ref:t,className:twMerge("relative w-full",o),children:e}));Z.displayName="InputWrapper";function Xe({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-secondary hover:text-text-primary cursor-pointer",t),"aria-label":"Clear input",onMouseDown:r=>{r.preventDefault(),r.stopPropagation();},children:jsx(h,{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 va(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function ya(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}),va({transparent:a,isDisabled:t}),W[n].text,W[n].height,W[n].padding,ya(n),i)}function O({children:e,size:o="md",tooltip:t,description:r,descriptionPlacement:a="below",isRequired:n,className:i,htmlFor:s}){let d=t||r&&a==="tooltip",c=t||r,u=r&&a==="inline",l=jsxs("label",{htmlFor:s,className:twMerge(W[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsx("span",{children:"*"}),d&&jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsx(h,{name:"Info",size:o==="sm"?16:20})}),u&&jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return d&&c?jsx(Go,{content:c,children:l}):l}function k({size:e="md",className:o,children:t,...r}){return jsx("div",{...r,className:twMerge("leading-[2.25] text-text-secondary",W[e].text,o),children:t})}function f({children:e,size:o="md",className:t}){return jsx("div",{role:"alert",className:twMerge(W[o].text,"text-feedback-error-text",t),children:e})}function xt({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 Ra="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Sa="bg-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",Ta={primary:Sa,secondary:"bg-action-secondary text-[color:var(--color-action-secondary-text)] border-2 border-border-muted hover:bg-action-secondary-hover forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-primary hover:bg-text-primary/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-primary hover:text-action-primary/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-primary hover:bg-background-hover hover:text-text-primary forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},qo={full:"w-full",default:"w-fit"},Na="opacity-50 cursor-not-allowed pointer-events-none",wa="opacity-100 cursor-pointer",ka={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},Ia={primary:"bg-action-primary text-[color:var(--color-action-primary-text)]",destructive:"bg-feedback-error-border text-text-inverse"};function Ba(e){return !e||e==="default"||e==="brand"?"primary":e}function Va(e){let{variant:o="primary",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Ba(o),s=i==="unstyled"?"":`${Ra} ${Ta[i]}`;i!=="unstyled"&&(s+=` ${W[t].text} ${W[t].height} ${W[t].padding} ${W[t].gap}`),r||n?s+=` ${Na}`:s+=` ${wa}`,a?s+=` ${qo.full}`:s+=` ${qo.default}`;let d=i==="primary"?"focus-visible:outline-action-primary":void 0;return [s,we(),d].filter(Boolean).join(" ")}function R(e){let{icon:o,children:t,isLoading:r=false,loadingText:a,loadingIndicator:n,size:i="md",iconPosition:s="left",iconWeight:d,href:c,className:u,badgeNumber:l,badgeVariant:g="primary",badgePosition:v="top-right",style:m,target:p,rel:P,...F}=e,y=o?jsx(h,{name:o,size:i,weight:d}):null,V=jsxs(Fragment,{children:[s==="left"&&y,typeof t=="function"?null:t,s==="right"&&y]}),D=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(h,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsx("div",{className:"invisible","aria-hidden":"true",children:V}),a&&jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),I=(l??0)>0,C=twMerge(Va(e),u),T=c?{href:c,target:p,rel:P,...F}:{};if(c){let{onPress:N,onPressStart:te,onPressEnd:M,onPressChange:se,onPressUp:Y,onAuxClick:q,onContextMenu:ie,onDoubleClick:A,...x}=F;Object.assign(T,x);}let K=c?jsx(Link,{...T,...r&&{"aria-busy":true},style:I?void 0:m,className:C,children:r?D:typeof t=="function"?(function(N){return jsxs(Fragment,{children:[s==="left"&&y,t(N),s==="right"&&y]})}):V}):jsx(Button,{...F,...r&&{"aria-busy":true},style:I?void 0:m,className:C,children:r?D:typeof t=="function"?(function(N){return jsxs(Fragment,{children:[s==="left"&&y,t(N),s==="right"&&y]})}):V});return I?jsxs("div",{className:twMerge("relative flex",u),style:m,children:[K,jsx("span",{className:`absolute ${ka[v]} flex h-5 w-5 items-center justify-center rounded-full ${Ia[g]} text-xs font-medium`,"aria-label":`${l} items`,children:l})]}):K}function ke({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-background-modal/20 via-background-modal/15 to-background-modal/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-background-modal/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 Ga({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 Ae({children:e,showArrow:o=false,withBackdrop:t=false,className:r,isDismissable:a=true,disableGroup:n=false,...i}){let d=useSlottedContext(PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=d?c-6:c;let u=jsxs(Popover,{offset:c,...i,className:composeRenderProps(r,(l,g)=>Ga({...g,className:l,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(ke,{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 Uo(e=true){let[o,t]=useState(null);return useEffect(()=>{if(!e){t(null);return}let r=typeof window<"u"?window.visualViewport:null;if(!r)return;let a=()=>{let n=Math.max(0,window.innerHeight-r.height-(r.offsetTop??0));t({height:r.height,keyboardOffset:n});};return a(),r.addEventListener("resize",a),r.addEventListener("scroll",a),()=>{r.removeEventListener("resize",a),r.removeEventListener("scroll",a);}},[e]),o}function qt({action:e,defaultVariant:o,defaultSize:t="lg"}){let r=!!e.formId;return jsx(R,{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 Kt({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(qt,{action:t,defaultVariant:"destructive"})}),jsxs("div",{className:"flex items-center gap-3",children:[o&&jsx(qt,{action:o,defaultVariant:"secondary"}),e&&jsx(qt,{action:e,defaultVariant:"primary"})]})]})]})}var Ka={heading:{sm:xe.headingSm,md:xe.headingMd,lg:xe.headingLg,xl:xe.headingXl},display:{sm:xe.displaySm,md:xe.displayMd,lg:xe.displayLg,xl:xe.displayXl}},Ya={page:"h-16 leading-[62px]"};function tt({tag:e="h1",variant:o="heading",size:t="lg",height:r,className:a="",children:n}){let i=t==="xs"?"sm":t,s=Ka[o][i],d=r?Ya[r]:"";return jsx(e,{className:gt(s,"text-text-primary",d,a),children:n})}var He=({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(R,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsx(h,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxs(Fragment,{children:[e&&jsx(tt,{size:"xs",children:e}),o&&!t&&jsx(R,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsx(h,{name:"X","data-testid":"close-button"})})]})]});var me=({width:e,height:o,variant:t="rect",animation:r="pulse",gradient:a=false,flex:n=false,stack:i,responsive:s,delay:d=0,adjustAnimationSpeedBasedOnWidth:c=false,ariaLabel:u,className:l,"data-testid":g})=>{let[v,m]=useState(d===0);if(useEffect(()=>{if(d>0){let I=setTimeout(()=>m(true),d);return ()=>clearTimeout(I)}},[d]),!v)return null;let p=a?"bg-gradient-to-r from-[var(--color-skeleton-base)] via-[var(--color-skeleton-highlight)] to-[var(--color-skeleton-base)]":"bg-[var(--color-skeleton-base)]",P=c&&e?(()=>{let I=typeof e=="number"?e:parseFloat(String(e));return isNaN(I)?"":`animation-duration-[${Math.max(.8,I/100)}s]`})():"",F=r==="pulse"?`animate-pulse ${P}`:r==="wave"?`relative overflow-hidden before:absolute before:inset-0 before:bg-gradient-to-r before:from-transparent before:via-[var(--color-skeleton-wave)] before:to-transparent before:animate-wave ${P}`:"",y="rounded-sm";t==="circle"&&(y="rounded-full"),t==="text"&&(y="h-4 w-full rounded-sm");let V=n?"flex-1 min-w-0":"",D=s?Object.entries(s).map(([I,C])=>`${I}:w-[${C}]`).join(" "):"";return i?jsx("div",{className:"space-y-2","data-testid":g,children:i.map((I,C)=>jsx("div",{className:twMerge(p,F,y,V,D,l),style:{width:I,height:o}},C))}):jsx("div",{className:twMerge(p,F,y,V,D,l),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":g})};var en={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"},tn="rounded-lg",jt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},on={start:"justify-start",end:"justify-end",center:"justify-center",between:"justify-between"};function pe({variant:e="outlined",className:o,children:t,isLoading:r=false,layout:a="default"}){return jsx("div",{className:twMerge("w-full overflow-hidden",en[e],tn,a==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsx(me,{width:"100%",height:"100%",className:"rounded-none"}):t})}function ht({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(me,{width:120,height:20}),jsx(me,{width:24,height:24})]}),o&&jsx(me,{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(tt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsx("div",{className:Ao("bodySm","text-text-secondary"),children:o})]}),t&&jsx("div",{className:"flex-shrink-0",children:t})]})})}function jo({src:e,alt:o,aspectRatio:t="auto",className:r,children:a,isLoading:n=false}){return n?jsx("div",{className:twMerge("bg-background-muted",jt[t],r),children:jsx(me,{width:"100%",height:"100%"})}):a?jsx("div",{className:twMerge("overflow-hidden",jt[t],r),children:a}):e?jsx("div",{className:twMerge("overflow-hidden",jt[t],r),children:jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function vt({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(me,{width:"100%",height:16}),jsx(me,{width:"80%",height:16}),jsx(me,{width:"60%",height:16})]})}):o?jsx("div",{className:twMerge("px-6 py-4 text-text-primary",r&&"flex-1 flex flex-col min-h-0",e),children:o}):null}function Qo({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(me,{width:80,height:32}),jsx(me,{width:60,height:32})]}):o?jsx("div",{className:twMerge("px-6 py-4 flex items-center gap-2",on[t],e),children:o}):null}pe.Header=ht;pe.Media=jo;pe.Content=vt;pe.Footer=Qo;var rt=class extends Component{constructor(){super(...arguments);Et(this,"state",{hasError:false});Et(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(pe,{children:[this.props.title&&jsx(pe.Header,{title:this.props.title}),jsx(pe.Content,{children:jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsx("button",{className:"rounded bg-action-default px-4 py-2 text-[color:var(--color-action-default-text)] hover:bg-action-default-hover",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var sn=.3,ln=.5;function Oe({children:e,title:o,headerContent:t,titleAlign:r="left",hideCloseIcon:a=false,hasBackArrow:n=false,onBack:i,isOpen:s,onClose:d,isDismissable:c=true,transparentOverlay:u=false,primaryAction:l,secondaryAction:g,footerContent:v,maxHeight:m="80vh",height:p,maxWidth:P="640px",contentPadding:F=true,showHandle:y=true,animationVariant:V="scale",className:D}){let[I,C]=useState(false),[T,K]=useState(0),[N,te]=useState(false),M=Uo(s),se=M?.height??null,Y=M?.keyboardOffset??0,q=useRef(null),ie=useRef(null),A=useRef(null),x=useRef({isDragging:false,startY:0,startTime:0,pointerId:null});useEffect(()=>{if(s){let b=setTimeout(()=>{C(true),setTimeout(()=>C(false),600);},400);return ()=>clearTimeout(b)}},[s]),useEffect(()=>{s||(K(0),te(false),x.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),useEffect(()=>{let b=ie.current;if(!b||!s)return;let U=null,z=Q=>{let ge=Q.target;ge&&["INPUT","TEXTAREA","SELECT"].includes(ge.tagName)&&(U&&clearTimeout(U),U=setTimeout(()=>{ge.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return b.addEventListener("focusin",z),()=>{b.removeEventListener("focusin",z),U&&clearTimeout(U);}},[s]);let Te=useCallback(b=>{c&&(b.pointerType!=="touch"&&b.pointerType!=="pen"||(A.current&&(clearTimeout(A.current),A.current=null),x.current={isDragging:true,startY:b.clientY,startTime:Date.now(),pointerId:b.pointerId},te(false),b.currentTarget.setPointerCapture(b.pointerId)));},[c]),Pe=useCallback(b=>{let{isDragging:U,startY:z,pointerId:Q}=x.current;if(!U||b.pointerId!==Q)return;let ge=b.clientY-z;K(Math.max(0,ge));},[]),le=useCallback(b=>{let{isDragging:U,startY:z,startTime:Q,pointerId:ge}=x.current;if(!U||b.pointerId!==ge)return;let X=b.clientY-z,Le=Date.now()-Q,Ye=X/Le;x.current={isDragging:false,startY:0,startTime:0,pointerId:null};let dt=(q.current?.getBoundingClientRect().height??0)*sn;(X>dt||Ye>ln&&X>50)&&c?(d?.(),K(0)):(te(true),K(0),A.current=setTimeout(()=>{te(false),A.current=null;},200));},[c,d]);if(!s)return null;let ye=o||t,Fe=l||g||v;return jsx(rt,{children:jsx(ke,{isOpen:s,onOpenChange:b=>{b||d?.();},isDismissable:c,transparent:u,style:{paddingBottom:Y>0?`${Y}px`:void 0,transition:"padding-bottom 0.25s ease-out"},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:q,className:twMerge("w-full",N&&"transition-transform duration-200"),style:{transform:T>0?`translateY(${T}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",V==="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)]",V==="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)]",D),style:{maxWidth:P,...p?{height:p}:{maxHeight:/\d/.test(m)?se!==null?`min(${m}, ${Math.max(se-8,0)}px, 100dvh)`:`min(${m}, 100dvh)`:m}},children:[y&&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:Te,onPointerMove:Pe,onPointerUp:le,onPointerCancel:le,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",I&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),ye&&(n?jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,onClose:d||(()=>{})})),jsx("div",{ref:ie,className:twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",F?"p-4":"p-0"),children:e}),Fe&&jsx(Kt,{primaryAction:l,secondaryAction:g,footerContent:v})]})})})})})}Oe.displayName="Tray";var ro=createContext("md");function or(){return useContext(ro)}function eo(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-disabled overflow-hidden text-ellipsis whitespace-nowrap ${W[e].text} ${o}`}function fn(){let e=Ne__default.useCallback((t,r)=>{r?.(t);},[]),o=Ne__default.useCallback((t,r)=>{r?.(t);},[]);return {handleFocus:e,handleBlur:o}}function ao({label:e,description:o,errorMessage:t,children:r,items:a,renderItem:n,renderSelectedValue:i,size:s="md",selectedKey:d,defaultSelectedKey:c,onSelectionChange:u,placeholder:l,showErrors:g=false,tooltip:v,isRequired:m,transparent:p,reserveErrorSpace:P=false,placement:F="bottom start",shouldFlip:y=true,menuWidth:V="match",descriptionPlacement:D="below",useMobileTray:I=true,...C}){let[T,K]=useState(null),[N,te]=useState(null),[M,se]=useState(false),Y=d??T??c,{handleFocus:q,handleBlur:ie}=fn(),{isMobile:A}=pt(),x=I&&A,Te=Ne__default.useMemo(()=>!i||!Y||!a?null:Array.from(a).find(U=>U.id===Y)??null,[i,Y,a]),Pe=b=>{u&&b!==null&&u(b),u||K(b);},le=useRef(null),ye=useRef(null),Fe=()=>{x&&se(!M);};return jsxs(Fragment,{children:[jsx(Select,{...C,selectedKey:Y,defaultSelectedKey:c,onSelectionChange:Pe,placeholder:l,className:_(C.className,"group flex w-full flex-col"),ref:le,onOpenChange:b=>{x||(b&&ye.current?te(ye.current.offsetWidth):b||le.current?.blur());},children:({isDisabled:b,isInvalid:U,isOpen:z})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:s,tooltip:v,description:D==="tooltip"||D==="inline"?o:void 0,descriptionPlacement:D,isRequired:m,children:e}),jsx(Z,{children:jsx("div",{ref:ye,children:jsxs(R,{variant:"unstyled",className:twMerge(oe({isInvalid:U||g&&!!t,isDisabled:b,isFocused:x?M:z,transparent:p,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:Q=>q(Q,C.onFocus),onBlur:Q=>ie(Q,C.onBlur),onPress:x?Fe:void 0,"data-open":x?M:z,children:[i&&Te?jsx("div",{className:eo(s),children:i(Te)}):x&&Y?jsx("div",{className:eo(s),children:a?Array.from(a).find(X=>X.id===Y)?.label:String(Y)}):jsx(SelectValue,{className:eo(s)}),jsx(h,{name:"CaretDown","aria-hidden":true,className:twMerge("h-4 w-4 text-text-primary group-disabled:text-text-disabled forced-colors:text-[ButtonText] transition-transform",(x?M:z)&&"rotate-180")})]})})}),P?jsx("div",{className:"mt-1 min-h-[20px]",children:g?jsx(f,{size:s,className:"text-feedback-error-text",children:typeof t=="function"&&C.validationResult?t(C.validationResult):typeof t=="string"?t:null}):o&&D==="below"?jsx(k,{size:s,children:o}):null}):jsx(Fragment,{children:g?jsx(f,{size:s,className:"mt-1 text-feedback-error-text",children:typeof t=="function"&&C.validationResult?t(C.validationResult):typeof t=="string"?t:null}):o&&D==="below"?jsx(k,{size:s,className:"mt-1",children:o}):null}),x?null:jsx(Ae,{className:"bg-background-input shadow-xl border border-border-input/20 backdrop-blur-sm rounded-[var(--control-border-radius)]",style:{width:V==="match"&&N?`${N}px`:void 0,minWidth:V==="auto"&&N?`${N}px`:void 0,maxWidth:V==="auto"?"min(600px, 90vw)":void 0},placement:F,shouldFlip:y,children:jsx(ro.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?Q=>jsx(Se,{id:Q.id,textValue:Q.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(Q)})},Q.id):r})})})]})}),x&&jsx(Oe,{isOpen:M,onClose:()=>se(false),title:e??"Select an option",contentPadding:false,children:jsx(ro.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:Y!=null?[Y]:[],onSelectionChange:b=>{let U=Array.from(b)[0];U!=null&&(Pe(U),se(false));},children:n&&a?b=>jsx(Se,{id:b.id,textValue:b.label,children:jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(b)})},b.id):r})})})]})}function Se({size:e,className:o,...t}){let r=or(),a=e??r;return jsx(ListBoxItem,{...t,className:twMerge("flex cursor-default items-center gap-2 rounded-sm px-3 outline-none text-text-primary 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",W[a].paddingY,W[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 Tn=[],Nn={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},wn={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},nr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},io=(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 kn(e,o,t){try{let r=e.url.replace("{q}",o),a=new URLSearchParams;e.extraParams&&Object.entries(e.extraParams).forEach(([d,c])=>{a.append(d,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 In(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 so({label:e,staticItems:o=Tn,sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:d,errorMessage:c,description:u,size:l="md",tooltip:g,isRequired:v,isDisabled:m,isInvalid:p,validationResult:P,showErrors:F=true,renderItem:y,renderLeftIcon:V,renderSection:D,autoFocus:I=false,reserveErrorSpace:C=false,hideChevron:T=false,useMobileTray:K=true,className:N}){let te=Ne__default.useRef(null),M=Ne__default.useRef(null),[se,Y]=Ne__default.useState(),[q,ie]=useState(()=>io(r||a,o,t)),[A,x]=useState(false),[Te,Pe]=useState(false),le=Mo(q),{contains:ye}=mt({sensitivity:"base"}),[Fe,b]=useState(),{isMobile:U}=pt(),z=K&&U,Q=W[l].text,ge=useAsyncList({async load({signal:w,filterText:E=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad(E))return {items:[]};try{let ee;return i.requestType==="GraphQL"?ee=await In(i,E,w):ee=await kn(i,E,w),b(ee.error),{items:ee.items}}catch(ee){return ee instanceof Error&&ee.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ee),b(ee instanceof Error?ee.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),X=i&&le!==""?ge:null,Le=false,Ye=useRef("");useEffect(()=>{I&&x(true);},[I]),useEffect(()=>{let w=io(r,o,t);w!==q&&ie(w);},[r,o,t]),useEffect(()=>{let w=()=>{te.current&&Y(te.current.offsetWidth);};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),useEffect(()=>{le===""?Ye.current="":X&&le!==Ye.current&&(Ye.current=le,X.setFilterText(le));},[le,X]),Le=ft(!!X?.isLoading,300);let Io=Ne__default.useMemo(()=>{if(!z||!q)return X?X.items:o;let w=X?X.items:o,E=s??(i?()=>true:ye);return w.filter(ee=>E(ee.name,q))},[z,q,X,o,s,ye]),dt=w=>{let E=io(w,o,t);ie(E),n&&n(w);},Vt=w=>{ie(w);},Bo=()=>{z&&Pe(true);};return jsxs(Fragment,{children:[jsx(ComboBox,{onSelectionChange:dt,selectedKey:r||void 0,defaultSelectedKey:a||void 0,items:X?X.items:t?t.flatMap(w=>w.items):o,className:_(N,"group flex flex-col w-full"),menuTrigger:z?"manual":i?"input":"focus",allowsEmptyCollection:!!i,isDisabled:m,isInvalid:p||!!c,inputValue:q,onInputChange:Vt,autoFocus:I&&!z,defaultFilter:s??(i?()=>true:ye),"aria-label":e||d||"Autocomplete",children:w=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:l,tooltip:g,isRequired:v,children:e}),jsxs(Z,{ref:te,children:[V?jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:V(Le)}):jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:Le?jsx(Ge,{size:16,color:"text-text-secondary"}):jsx(h,{name:"MagnifyingGlass",className:`${Nn[l]} text-text-secondary`})}),jsx(Input,{className:oe({isInvalid:p||!!c,isDisabled:m,isFocused:A||(z?Te:w.isOpen),size:l,className:twMerge(wn[l],q&&!m||!T&&!q?"pr-10":"pr-3",z&&"cursor-pointer",N)}),placeholder:d,disabled:m,onFocus:E=>{x(true),z&&(E.currentTarget.blur(),Bo());},onBlur:()=>{x(false);},onClick:z?Bo:void 0,readOnly:z,"aria-label":e||d||"Autocomplete"}),q&&!m&&jsx(Xe,{onClick:()=>{ie(""),n?.(null);},size:l}),!T&&!q&&jsx(Button,{className:"absolute right-3 top-[46%] -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":"Toggle menu",isDisabled:m,children:({isPressed:E})=>jsx(h,{name:E?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),C?jsx("div",{className:"mt-1 min-h-[20px]",children:F&&Fe?jsx(f,{size:l,className:"text-feedback-error-text",children:Fe}):F&&typeof c=="string"?jsx(f,{size:l,className:"text-feedback-error-text",children:c}):F&&typeof c=="function"&&P?jsx(f,{size:l,className:"text-feedback-error-text",children:c(P)}):u?jsx(k,{size:l,children:u}):null}):jsxs(Fragment,{children:[u&&jsx(k,{size:l,className:"mt-1",children:u}),F&&Fe&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:Fe}),F&&typeof c=="string"&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c}),F&&typeof c=="function"&&P&&jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c(P)})]}),!z&&jsx(Ae,{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:se?`${se}px`:void 0,zIndex:9999},children:jsx(ListBox,{"aria-label":e||d||"Suggestions",className:`max-h-[300px] overflow-auto bg-background-input outline-none ${Q}`,children:t?t.map(E=>{let ee=E.items.map(be=>jsx(Se,{id:be.id,textValue:be.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${nr[l]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:y?y(be):be.name},be.id));if(D){let be=D(E,ee);return Ne__default.isValidElement(be)&&be.type===ListBoxSection?be:jsx(ListBoxSection,{children:be},E.name)}return jsxs(ListBoxSection,{children:[jsx(Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:E.name}),ee]},E.name)}):E=>jsx(Se,{id:E.id,textValue:E.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${nr[l]} text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:y?y(E):E.name},E.id)})})]})}),z&&jsx(Oe,{isOpen:Te,onClose:()=>Pe(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(Z,{children:[jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:Le?jsx(Ge,{size:16,color:"text-text-secondary"}):jsx(h,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsx("input",{ref:M,type:"text",value:q,onChange:w=>Vt(w.target.value),placeholder:d,autoFocus:true,className:oe({isInvalid:false,isDisabled:false,isFocused:true,size:"md",className:"pl-10 pr-10"})}),q&&jsx(Xe,{onClick:()=>{ie(""),n?.(null);},size:"md"})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsx(ListBox,{"aria-label":e||d||"Suggestions",items:Io,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:w=>{let E=Array.from(w)[0];E&&(dt(E),Pe(false));},className:"bg-background-input outline-none",children:w=>jsx(Se,{id:w.id,textValue:w.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-primary outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:y?y(w):w.name},w.id)})})]})})]})}function L(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 Hu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(so,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var An="focus:ring-action-primary",zn="bg-action-primary border-action-primary text-[color:var(--color-action-primary-text)] hover:bg-action-primary-hover hover:border-action-primary-hover";function dr(e){return jsxs(CheckboxGroup,{...e,className:_(e.className,"flex flex-col gap-2"),children:[jsx(O,{children:e.label}),e.children,e.description&&jsx(k,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Hn({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-secondary"}`}function _n({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r}){let a="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",n=An,i="";return t?i="border-border-muted bg-background-muted":o?i="border-feedback-error-border bg-feedback-error-background":e||r?i=zn:i="bg-background-input border-border-input hover:border-border-focus",`${a} ${n} ${i}`}var lr="w-4 h-4 text-current group-disabled:text-text-disabled";function cr(e){let{children:o,variant:t,...r}=e;return jsx(Checkbox,{...r,className:composeRenderProps(e.className,(a,n)=>`${Hn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,d=jsx("div",{className:_n({isSelected:n,isIndeterminate:i,...s}),children:i?jsx(Minus,{"aria-hidden":true,className:lr}):n?jsx(Check,{"aria-hidden":true,className:lr}):null});return jsxs(Fragment,{children:[d,typeof o=="function"?o(a):o]})}})}function rm({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=useFormContext(),i=L(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(cr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsx(f,{children:i})]})})}function dm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(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),errorMessage:n,children:t.children})})}function We(e){if(!e)return false;let o=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(o)}function uo(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 fr({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,className:s,validationResult:d,value:c,defaultValue:u,onChange:l,placeholder:g="#000000",showColorSwatch:v=true,reserveErrorSpace:m=true,...p}){let[P,F]=useState(u||""),[y,V]=useState(c||u||""),[D,I]=useState(false),[C,T]=useState(null),{isFocused:K,handleFocus:N,handleBlur:te}=Ce(),M=c!==void 0?c:P;useEffect(()=>{c!==void 0&&V(c);},[c]);let se=M?!We(M):false,Y=useCallback(A=>{if(V(A),We(A)){let x=uo(A);l?l(x):F(x);}else A===""&&(l?l(""):F(""));},[l]),q=useCallback(A=>{let x=uo(A);V(x),l?l(x):F(x);},[l]),ie=useCallback(A=>{if(We(y)){let x=uo(y);V(x),l&&x!==M?l(x):!l&&x!==P&&F(x);}te(A,p.onBlur);},[y,M,P,l,te,p.onBlur]);return jsx(TextField,{...p,isRequired:n,className:_(s,"group flex flex-col"),children:({isDisabled:A})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"flex-1 relative",children:[jsx(xt,{size:r,disabled:A,type:"text",value:y,placeholder:g,onFocus:x=>N(x,p.onFocus),onBlur:ie,onChange:x=>Y(x.target.value),className:twMerge(oe({isInvalid:se,isDisabled:A,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:W[r].height},children:jsx("div",{className:twMerge("w-6 h-6 rounded border shadow-sm",We(M)?"border-border-default":"border-border-default bg-background-muted"),style:We(M)?{backgroundColor:M}:void 0,"aria-hidden":"true",children:!We(M)&&jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsx("div",{ref:T,children:jsx(R,{variant:"secondary",size:r,icon:"Palette",onPress:()=>I(!D),isDisabled:A,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&d?jsx(f,{size:r,children:t(d)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsx(f,{size:r,className:"mt-1",children:t(d)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null}),D&&C&&jsx(Ae,{triggerRef:{current:C},isOpen:D,onOpenChange:I,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:M||"#000000",onChange:q,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:M||"#000000"}}),jsx("div",{className:"flex-1 text-text-primary text-[length:var(--control-text-sm)] font-mono",children:M||"#000000"})]})]})})]})})}function Nm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(fr,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function di({isSelected:e,isDisabled:o}){let t=[we,"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-inverse invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-primary hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function po({errorMessage:e,...o}){return jsxs(Calendar,{...o,children:[jsx(br,{}),jsxs(CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsx(xr,{}),jsx(CalendarGridBody,{children:t=>jsx(CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${di({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsx(Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function br(){let{direction:e}=useLocale(),o=18;return jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsx(R,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsx(h,{name:"CaretRight","aria-hidden":true,size:o}):jsx(h,{name:"CaretLeft","aria-hidden":true,size:o})}),jsx(Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsx(R,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsx(h,{name:"CaretLeft","aria-hidden":true,size:o}):jsx(h,{name:"CaretRight","aria-hidden":true,size:o})})]})}function xr(){return jsx(CalendarGridHeader,{children:e=>jsx(CalendarHeaderCell,{className:"text-xs font-semibold text-text-secondary",children:e})})}function go({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,showCalendar:d=true,reserveErrorSpace:c=true,validationResult:u,className:l,...g}){let[v,m]=useState(false),p=P=>{g.onChange&&P&&g.onChange(P),m(false);};return jsxs(DateField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(l,"flex flex-col gap-1"),children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsxs("div",{className:"relative w-full",children:[jsx(vr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxs(DialogTrigger,{isOpen:v,onOpenChange:m,children:[jsx(R,{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-secondary hover:text-text-primary transition-colors","aria-label":"Open calendar",children:jsx(h,{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(po,{value:g.value,onChange:p,minValue:g.minValue,maxValue:g.maxValue,isDisabled:i,isReadOnly:g.isReadOnly,isDateUnavailable:g.isDateUnavailable})})})]})]})}),c?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&u?jsx(f,{size:r,children:t(u)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsx(f,{size:r,className:"mt-1",children:t(u)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function xi({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-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function vr({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:xi({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function ip({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(go,{...t,value:i.value??null,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function bo({value:e,onChange:o,onUrlChange:t,accept:r="image/*",maxSize:a,isDisabled:n=false,onUpload:i,className:s,showPreview:d=true,placeholder:c="Drop files here or click to browse"}){let[u,l]=useState(false),[g,v]=useState(false),[m,p]=useState(null),[P,F]=useState(e),y=useRef(null),V=async C=>{if(p(null),a&&C.size>a){p(`File size must be less than ${(a/1024/1024).toFixed(2)}MB`);return}if(d&&C.type.startsWith("image/")){let T=new FileReader;T.onloadend=()=>{F(T.result);},T.readAsDataURL(C);}if(i){v(true);try{let T=await i(C);F(T),t?.(T);}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{v(false);}}o?.(C,P);},D=async C=>{try{let T=C.items;if(T.length>0){let K=T[0];if(K.kind==="file"){let N=await K.getFile();N&&V(N);}}}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{l(false);}},I=()=>{F(void 0),p(null),o?.(null),t?.(""),y.current&&(y.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",m&&"border-feedback-error-border bg-feedback-error-background/50"),onDrop:D,onDropEnter:()=>l(true),onDropExit:()=>l(false),children:[P?jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&(P.startsWith("data:image")||P.startsWith("http"))?jsx("img",{src:P,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsx(Image,{className:"h-12 w-12 text-text-secondary"}),jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!n&&jsx(R,{variant:"icon",size:"sm",onPress:I,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsx(X,{className:"h-4 w-4"})})]}):jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsx(Upload,{className:"h-12 w-12 text-text-secondary"}),jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-sm text-text-primary",children:c}),jsx("p",{className:"mt-1 text-xs text-text-secondary",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsx(FileTrigger,{acceptedFileTypes:r.split(","),onSelect:C=>{let T=Array.from(C||[]);T.length>0&&V(T[0]);},children:jsx(R,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),g&&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-secondary",children:"Uploading..."})]})})]}),m&&jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:m})]})}function Fp({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=useFormContext(),i=L(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(bo,{...r,value:s.value??"",onChange:(d,c)=>s.onChange(c||"")}),t&&i&&jsx(f,{children:i})]})})}var Di=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 vo({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,validationResult:s,reserveErrorSpace:d=true,descriptionPlacement:c="below",...u}){let l=useId(),{isFocused:g,handleFocus:v,handleBlur:m}=Ce();return jsx(NumberField,{...u,id:l,isRequired:n,className:_(u.className,"group flex flex-col gap-1"),step:u.step??1,onChange:p=>{typeof p=="number"&&(u.maxValue!=null&&p>u.maxValue?u.onChange?.(u.maxValue):u.minValue!=null&&p<u.minValue?u.onChange?.(u.minValue):u.onChange?.(p));},isInvalid:!!t||typeof u.value=="number"&&(u.maxValue!=null&&u.value>u.maxValue||u.minValue!=null&&u.value<u.minValue),children:({isDisabled:p,isInvalid:P})=>jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsx(O,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,htmlFor:l,children:e}),jsx("div",{className:"relative",children:jsxs(Group,{className:"relative",children:[jsx(Input,{onFocus:y=>v(y,u.onFocus),onBlur:y=>m(y,u.onBlur),className:Di({isInvalid:P||!!t,isDisabled:p,isFocused:g,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:p,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(h,{name:"CaretUp",size:14})}),jsx(Button,{slot:"decrement",isDisabled:p,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(h,{name:"CaretDown",size:14})})]})]})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsx(f,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:t?jsx(f,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function _p({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(vo,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Nt({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:i,children:s,size:d="2",variant:c="primary",columns:u="repeat(auto-fit, minmax(160px, 1fr))",gap:l="1"}){return jsx(RadioGroup,{value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:_(i,"grid"),style:{gridTemplateColumns:/^\d+$/.test(String(u))?`repeat(${u}, minmax(0, 1fr))`:u,gap:l==="1"?"0.25rem":l==="2"?"0.5rem":l==="3"?"0.75rem":l==="4"?"1rem":typeof l=="number"?`${l}px`:l},children:Ne__default.Children.map(s,g=>Ne__default.isValidElement(g)?Ne__default.cloneElement(g,{size:d,variant:c}):g)})}function af({name:e,defaultValue:o,label:t,description:r,children:a,...n}){let{control:i,formState:s}=useFormContext(),d=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(O,{children:t}),r&&jsx(k,{children:r}),jsx(Nt,{...n,value:c.value,onChange:u=>c.onChange(u),children:a}),d&&jsx(f,{children:d})]})})}function Ki(e){return "primary"}var Yi=createContext({variant:"primary"});function Po(e){let{variant:o="primary",...t}=e,r=Ki();return jsx(Yi.Provider,{value:{variant:r},children:jsxs(RadioGroup,{...t,className:_(e.className,"group flex flex-col gap-2"),children:[jsx(O,{children:e.label}),jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsx(k,{children:e.description}),jsx(f,{children:typeof e.errorMessage=="function"&&e.validationResult?e.errorMessage(e.validationResult):typeof e.errorMessage=="string"?e.errorMessage:null})]})})}function Tf({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(Po,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}var ts=e=>{let o=oe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return twMerge(o,t,e.className)};function lt({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,transparent:i,showSearchIcon:s,isClearable:d,onClear:c,type:u,validationResult:l,reserveErrorSpace:g=true,isLoading:v=false,descriptionPlacement:m="below",...p}){let[P,F]=Ne__default.useState(false),{isFocused:y,handleFocus:V,handleBlur:D}=Ce(),I=u==="password",C=ft(v,300);return jsx(TextField,{...p,isRequired:n,className:_(p.className,"group flex flex-col"),children:({isDisabled:T,isInvalid:K})=>jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,description:m==="tooltip"||m==="inline"?o:void 0,descriptionPlacement:m,isRequired:n,children:e}),jsxs(Z,{children:[s&&jsx("div",{className:"pointer-events-none absolute top-1/2 -translate-y-1/2 transform flex items-center z-10",style:{left:9},children:(()=>{let N={sm:14,md:16,lg:18,xl:20}[r];return C?jsx(Ge,{size:N,color:"text-text-secondary"}):jsx(h,{name:"MagnifyingGlass",size:N,className:`transition-colors ${y?"text-action-brand":"text-text-secondary"}`})})()}),jsx(xt,{size:r,disabled:T,type:I?P?"text":"password":u,value:p.value,defaultValue:p.defaultValue,placeholder:p.placeholder,onFocus:N=>V(N,p.onFocus),onBlur:N=>D(N,p.onBlur),onChange:N=>p.onChange?.(N.target.value),style:s?{paddingLeft:{sm:28,md:32,lg:36,xl:37}[r]}:void 0,className:ts({isInvalid:K,isDisabled:T,isFocused:y,size:r,transparent:i,showSearchIcon:s,isClearable:d,hasValue:!!p.value,isPassword:I,className:typeof p.className=="string"?p.className:void 0})}),d&&p.value&&!T&&jsx(Xe,{onClick:()=>{c?c():p.onChange&&p.onChange("");},size:r}),I&&!T&&jsx("button",{type:"button",onClick:()=>F(!P),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-secondary hover:text-text-primary","aria-label":P?"Hide password":"Show password",onMouseDown:N=>{N.preventDefault(),N.stopPropagation();},children:jsx(h,{name:P?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o&&m==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o&&m==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}var us={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"}},Ue=({isActive:e=false,onPress:o,children:t})=>jsx(R,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function ms({initialUrl:e,isOpen:o,onClose:t,onSubmit:r}){let[a,n]=useState(e);return Ne__default.useEffect(()=>{n(e);},[e]),jsx(ke,{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(He,{title:"Insert Link",onClose:t}),jsx("div",{className:"p-6",children:jsx(lt,{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(R,{variant:"secondary",onPress:t,children:"Cancel"}),jsx(R,{type:"submit",children:"Save"})]})]})})})})}function Fo({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:a="Start typing...",id:n,size:i="md",headingLevels:s=[1,2]}){let d=us[i],[c,u]=useState(false),l=useEditor({immediatelyRender:false,extensions:[ss.configure({heading:s.length>0?{levels:s}:false}),rs.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:m})=>{o?.(m.getHTML());},editorProps:{attributes:{class:twMerge(`prose ${d.prose} max-w-none`,"focus:outline-none","[&>*:first-child]:mt-0 [&>*:last-child]:mb-0")}}}),g=()=>{u(true);},v=m=>{m===""?l?.chain().focus().unsetLink().run():l?.chain().focus().setLink({href:m}).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:[!r&&l&&jsxs(Fragment,{children:[jsxs(BubbleMenu,{editor:l,shouldShow:({editor:m})=>m.isActive("link")&&!c,className:"flex items-center gap-1 rounded-md border border-border-input bg-background-surface p-1 shadow-md",children:[jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>{let m=l.getAttributes("link").href;m&&window.open(m,"_blank","noopener,noreferrer");},children:[jsx(h,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:g,children:[jsx(h,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsx(h,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsx(ms,{isOpen:c,onClose:()=>u(false),onSubmit:v,initialUrl:l.getAttributes("link").href||""})]}),jsxs("div",{className:twMerge("flex items-center gap-1 border-b border-border-input",d.toolbar),children:[s.map(m=>jsx(Ue,{isActive:l.isActive("heading",{level:m}),onPress:()=>l.chain().focus().toggleHeading({level:m}).run(),children:jsxs("span",{className:"text-xs font-bold",children:["H",m]})},m)),jsx(Ue,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsx("span",{className:"text-xs font-bold",children:"B"})}),jsx(Ue,{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(Ue,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsx(h,{name:"ListBullets",className:"h-4 w-4"})}),jsx(Ue,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsx(h,{name:"ListNumbers",className:"h-4 w-4"})}),jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsx(Ue,{isActive:l.isActive("link"),onPress:g,children:jsx(h,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxs("div",{className:twMerge("relative w-full outline-none focus:outline-none",d.contentWrapper),children:[jsx(EditorContent,{editor:l,className:twMerge("w-full outline-none focus:outline-none",d.contentPadding,"[&_.ProseMirror]:min-h-[inherit]","[&_.ProseMirror]:outline-none [&_.ProseMirror]:focus:outline-none",d.h1,d.h2,d.p,"[&_.ProseMirror_ul]:list-disc","[&_.ProseMirror_ol]:list-decimal",d.list,d.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-secondary",d.placeholderPos,d.placeholderText),children:a})]})]}):null}function dg({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=useFormContext(),d=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-primary",children:t}),r&&jsx("p",{className:"text-sm text-text-secondary",children:r}),jsx(Fo,{...n,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),d&&jsx("p",{className:"text-sm text-feedback-error-text",children:d}),a&&!d&&jsx("div",{className:"h-5"})]})})}function hg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(ao,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var Ro={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 ys({isSelected:e,isDisabled:o,size:t="md"}){let r="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",a=Ro[t].track,n=we,i="focus-visible:outline-action-primary",s="";return e?s="bg-action-primary forced-colors:!bg-[Highlight] group-pressed:bg-action-primary-hover":s="bg-border-input group-pressed:bg-border-focus",[r,a,n,i,s,o?"bg-background-muted forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function Ps({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-background-surface outline-none shadow transition duration-200 ease-in-out",a=Ro[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function So({children:e,variant:o="primary",size:t="md",...r}){return jsx(Switch,{...r,className:_(r.className,`group flex items-center gap-2 ${Ro[t].text} text-text-primary transition disabled:text-text-disabled forced-colors:disabled:text-[GrayText]`),children:a=>jsxs(Fragment,{children:[jsx("div",{className:ys({...a,size:t}),children:jsx("span",{className:Ps({...a,size:t})})}),e]})})}function Ig({name:e,defaultValue:o,...t}){let{control:r}=useFormContext();return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsx(So,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var Ns=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 To({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,required:n,transparent:i,isInvalid:s,isDisabled:d,isResizable:c=false,className:u,validationResult:l,reserveErrorSpace:g=true,...v}){let{isFocused:m,handleFocus:p,handleBlur:P}=Ce();return jsx("div",{className:"group flex flex-col",children:jsxs("div",{className:"flex flex-col",children:[e&&jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsx(Z,{children:jsx("textarea",{...v,required:n,onFocus:F=>{v.onFocus&&v.onFocus(F),p(F);},onBlur:F=>{v.onBlur&&v.onBlur(F),P(F);},className:Ns({isInvalid:s,isDisabled:d,isResizable:c,isFocused:m,size:r,transparent:i,className:u}),disabled:d})}),g?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsx(f,{size:r,children:t(l)}):o?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsx(f,{size:r,className:"mt-1",children:t(l)}):o?jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function Gg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(To,{...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 jg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=useFormContext(),n=L(a.errors,e);return jsx(Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsx(lt,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Ms({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-disabled italic":"text-text-primary",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-primary")}function No({label:e,description:o,errorMessage:t,size:r="md",tooltip:a,isRequired:n,isDisabled:i,isInvalid:s,reserveErrorSpace:d=true,validationResult:c,className:u,descriptionPlacement:l="below",...g}){return jsxs(TimeField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(u,"flex flex-col gap-1"),children:[e&&jsx(O,{size:r,tooltip:a,description:l==="tooltip"||l==="inline"?o:void 0,descriptionPlacement:l,isRequired:n,children:e}),jsx(Z,{children:jsx(DateInput,{className:twMerge(Je({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsx(DateSegment,{segment:v,className:Ms({isPlaceholder:v.isPlaceholder,isDisabled:!v.isEditable||i,size:r})})})}),d?jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsx(f,{size:r,children:t}):typeof t=="function"&&c?jsx(f,{size:r,children:t(c)}):o&&l==="below"?jsx(k,{size:r,children:o}):null}):jsx(Fragment,{children:typeof t=="string"?jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsx(f,{size:r,className:"mt-1",children:t(c)}):o&&l==="below"?jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function gb({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(No,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function yb({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=c=>{let u=`[name="${CSS.escape(c)}"]`,l=document.querySelector(u);l&&(l.focus(),l.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 l=u?.message||"Invalid value";return jsx("li",{children:jsx("button",{type:"button",className:"underline underline-offset-2",onClick:()=>d(c),children:l})},c)})})]})}function Sb({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(R,{type:"submit",form:e,isDisabled:s,...n,children:a})}function Bb({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((c,u)=>jsxs(pe,{children:[jsx(ht,{title:o?o(u):`Item ${u+1}`,actions:jsxs("div",{className:"flex gap-2",children:[u>0&&jsx(R,{size:"sm",variant:"secondary",onPress:()=>d(u,u-1),children:"Up"}),u<n.length-1&&jsx(R,{size:"sm",variant:"secondary",onPress:()=>d(u,u+1),children:"Down"}),jsx(R,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsx(vt,{children:t(u)})]},c.id)),jsx("div",{children:jsx(R,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function ko(e){return jsx(Form,{validationBehavior:"aria",...e,className:twMerge("flex flex-col gap-6",e.className)})}function Er(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 qb({id:e,onSubmit:o,onInvalid:t,children:r,shouldFocusError:a=true,className:n,...i}){let s=useForm(i),d=(c,u)=>{if(a&&e){let l=document.getElementById(e);l&&Er(l);}t?.(c,u);};return jsx(FormProvider,{...s,children:jsx(ko,{id:e,className:n,onSubmit:s.handleSubmit(o,d),children:r})})}function $r({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-secondary",children:"You have unsaved changes"}),jsxs("div",{className:"flex gap-2",children:[jsx(R,{variant:"secondary",onPress:r,children:n}),jsx(R,{type:"submit",form:e,isDisabled:!!t,children:t?"Saving...":a})]})]})}):null}function ex({formId:e,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a}){let{formState:n}=useFormContext();return jsx($r,{formId:e,show:n.isDirty,isSubmitting:n.isSubmitting,onCancel:o,primaryLabel:t,secondaryLabel:r,className:a})}function ax(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 sx({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{yb as ErrorSummary,Bb as FieldArrayList,Hu as FormAutocomplete,rm as FormCheckbox,dm as FormCheckboxGroup,Nm as FormColorField,ip as FormDateField,Fp as FormFileUpload,_p as FormNumberField,qb as FormProvider,af as FormRadioCardGroup,Tf as FormRadioGroup,dg as FormRichTextEditor,ex as FormSaveBar,hg as FormSelect,Ig as FormSwitch,Gg as FormTextArea,jg as FormTextField,gb as FormTimeField,Sb as SubmitButton,Er as focusFirstError,sx as useAutoSave,ax as useScrollIntoViewOnError};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|