@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.
@@ -1,2 +1,2 @@
1
- 'use strict';var reactHookForm=require('react-hook-form'),we=require('react'),reactAriaComponents=require('react-aria-components'),reactStately=require('react-stately'),tailwindMerge=require('tailwind-merge'),pa=require('@phosphor-icons/react'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),reactColorful=require('react-colorful'),rs=require('@tiptap/extension-link'),react=require('@tiptap/react'),menus=require('@tiptap/react/menus'),ss=require('@tiptap/starter-kit');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var we__namespace=/*#__PURE__*/_interopNamespace(we);var pa__namespace=/*#__PURE__*/_interopNamespace(pa);var rs__default=/*#__PURE__*/_interopDefault(rs);var ss__default=/*#__PURE__*/_interopDefault(ss);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__namespace.default.createContext(ct),Or=we__namespace.default.createContext(false);var Gr=!!(typeof window<"u"&&window.document&&window.document.createElement),Dt=new WeakMap;function Wr(e=false){let o=we.useContext(Eo),t=we.useRef(null);if(t.current===null&&!e){var r,a;let n=(a=we__namespace.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=we.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__namespace.default.useId(),[t]=we.useState(ut()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ct.prefix}`;return e||`${r}-${o}`}typeof we__namespace.default.useId=="function"?Ur:qr;function Yr(){return false}function jr(){return true}function Xr(e){return ()=>{}}function ut(){return typeof we__namespace.default.useSyncExternalStore=="function"?we__namespace.default.useSyncExternalStore(Xr,Yr,jr):we.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]=we.useState(At);return we.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__namespace.default.createContext(null);function zt(){let e=Mo();return we.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=we.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=we.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=we.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 we.useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function De(e,o=false){let[t,r]=we.useState(o);return we.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]=we.useState(e);return we.useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function ft(e,o=300){let[t,r]=we.useState(false);return we.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 reactAriaComponents.composeRenderProps(e,t=>tailwindMerge.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=we.memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=pa__namespace[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=tailwindMerge.twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsxRuntime.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=we.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=tailwindMerge.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 jsxRuntime.jsx("div",{className:m,style:{width:y,height:y},children:jsxRuntime.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 jsxRuntime.jsxs(reactAriaComponents.TooltipTrigger,{delay:200,children:[e,jsxRuntime.jsxs(reactAriaComponents.Tooltip,{...t,offset:10,className:reactAriaComponents.composeRenderProps(t.className,(r,a)=>ha({...a,className:r})),children:[jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.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:jsxRuntime.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),o]})]})}function Re(){let[e,o]=we__namespace.default.useState(false),t=we__namespace.default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=we__namespace.default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var Z=we__namespace.default.forwardRef(({children:e,className:o},t)=>jsxRuntime.jsx("div",{ref:t,className:tailwindMerge.twMerge("relative w-full",o),children:e}));Z.displayName="InputWrapper";function Qe({onClick:e,size:o="md",className:t}){return jsxRuntime.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:tailwindMerge.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:jsxRuntime.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 tailwindMerge.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=jsxRuntime.jsxs("label",{htmlFor:s,className:tailwindMerge.twMerge(W[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsxRuntime.jsx("span",{children:"*"}),d&&jsxRuntime.jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsxRuntime.jsx(x,{name:"Info",size:o==="sm"?16:20})}),u&&jsxRuntime.jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return d&&c?jsxRuntime.jsx(Wo,{content:c,children:l}):l}function k({size:e="md",className:o,children:t,...r}){return jsxRuntime.jsx("div",{...r,className:tailwindMerge.twMerge("leading-[2.25] text-text-secondary",W[e].text,o),children:t})}function f({children:e,size:o="md",className:t}){return jsxRuntime.jsx("div",{role:"alert",className:tailwindMerge.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 jsxRuntime.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?jsxRuntime.jsx(x,{name:o,size:i,weight:d}):null,V=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&v,typeof t=="function"?null:t,s==="right"&&v]}),D=jsxRuntime.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n||jsxRuntime.jsx(x,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsxRuntime.jsx("div",{className:"invisible","aria-hidden":"true",children:V}),a&&jsxRuntime.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),I=(l??0)>0,R=tailwindMerge.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?jsxRuntime.jsx(reactAriaComponents.Link,{...T,...r&&{"aria-busy":true},style:I?void 0:m,className:R,children:r?D:typeof t=="function"?(function(N){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&v,t(N),s==="right"&&v]})}):V}):jsxRuntime.jsx(reactAriaComponents.Button,{...C,...r&&{"aria-busy":true},style:I?void 0:m,className:R,children:r?D:typeof t=="function"?(function(N){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&v,t(N),s==="right"&&v]})}):V});return I?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative flex",u),style:m,children:[K,jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.ModalOverlay,{...r,className:reactAriaComponents.composeRenderProps(o,(a,n)=>tailwindMerge.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=reactAriaComponents.useSlottedContext(reactAriaComponents.PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=d?c-6:c;let u=jsxRuntime.jsxs(reactAriaComponents.Popover,{offset:c,...i,className:reactAriaComponents.composeRenderProps(r,(l,g)=>Ga({...g,className:l,disableGroup:n})),children:[o&&jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.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:jsxRuntime.jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsxRuntime.jsx(Ie,{isDismissable:a,children:jsxRuntime.jsx(reactAriaComponents.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]=we.useState(null);return we.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 jsxRuntime.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:jsxRuntime.jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${r?"h-28":""}`,children:[r&&jsxRuntime.jsx("div",{className:"flex h-10 justify-center",children:r}),a&&jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsxRuntime.jsx("div",{children:t&&jsxRuntime.jsx(Ut,{action:t,defaultVariant:"destructive"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[o&&jsxRuntime.jsx(Ut,{action:o,defaultVariant:"secondary"}),e&&jsxRuntime.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 jsxRuntime.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})=>jsxRuntime.jsxs("div",{className:tailwindMerge.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&&jsxRuntime.jsx(S,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsxRuntime.jsx(x,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e&&jsxRuntime.jsx(tt,{size:"xs",children:e}),o&&!t&&jsxRuntime.jsx(S,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsxRuntime.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]=we.useState(d===0);if(we.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?jsxRuntime.jsx("div",{className:"space-y-2","data-testid":g,children:i.map((I,R)=>jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(p,C,v,V,D,l),style:{width:I,height:o}},R))}):jsxRuntime.jsx("div",{className:tailwindMerge.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 jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-full overflow-hidden",en[e],tn,a==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsxRuntime.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?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("p-6 pb-4",r),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx(me,{width:120,height:20}),jsxRuntime.jsx(me,{width:24,height:24})]}),o&&jsxRuntime.jsx(me,{width:200,height:16})]}):!e&&!o&&!t?null:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("p-6 pb-4",r),children:jsxRuntime.jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsxRuntime.jsx("div",{className:"mb-1",children:typeof e=="string"?jsxRuntime.jsx(tt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsxRuntime.jsx("div",{className:zo("bodySm","text-text-secondary"),children:o})]}),t&&jsxRuntime.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?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("bg-background-muted",Xt[t],r),children:jsxRuntime.jsx(me,{width:"100%",height:"100%"})}):a?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",Xt[t],r),children:a}):e?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",Xt[t],r),children:jsxRuntime.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?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(n,r&&"flex-1 flex flex-col min-h-0",e),children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(me,{width:"100%",height:16}),jsxRuntime.jsx(me,{width:"80%",height:16}),jsxRuntime.jsx(me,{width:"60%",height:16})]})}):o?jsxRuntime.jsx("div",{className:tailwindMerge.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?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsxRuntime.jsx(me,{width:80,height:32}),jsxRuntime.jsx(me,{width:60,height:32})]}):o?jsxRuntime.jsx("div",{className:tailwindMerge.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 we.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:jsxRuntime.jsxs(pe,{children:[this.props.title&&jsxRuntime.jsx(pe.Header,{title:this.props.title}),jsxRuntime.jsx(pe.Content,{children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsxRuntime.jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsxRuntime.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]=we.useState(false),[T,K]=we.useState(0),[N,te]=we.useState(false),M=Ko(s),se=M?.height??null,Y=M?.keyboardOffset??0,q=we.useRef(null),ie=we.useRef(null),A=we.useRef(null),h=we.useRef({isDragging:false,startY:0,startTime:0,pointerId:null});we.useEffect(()=>{if(s){let b=setTimeout(()=>{R(true),setTimeout(()=>R(false),600);},400);return ()=>clearTimeout(b)}},[s]),we.useEffect(()=>{s||(K(0),te(false),h.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),we.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=we.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=we.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=we.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 jsxRuntime.jsx(rt,{children:jsxRuntime.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:jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx("div",{ref:q,className:tailwindMerge.twMerge("w-full",N&&"transition-transform duration-200"),style:{transform:T>0?`translateY(${T}px)`:void 0},children:jsxRuntime.jsxs(reactAriaComponents.Dialog,{className:tailwindMerge.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&&jsxRuntime.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:jsxRuntime.jsx("div",{className:tailwindMerge.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?jsxRuntime.jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsxRuntime.jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,onClose:d||(()=>{})})),jsxRuntime.jsx("div",{ref:ie,className:tailwindMerge.twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",C?"p-4":"p-0"),children:e}),Ce&&jsxRuntime.jsx(Yt,{primaryAction:l,secondaryAction:g,footerContent:y})]})})})})})}Oe.displayName="Tray";var ao=we.createContext("md");function rr(){return we.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__namespace.default.useCallback((t,r)=>{r?.(t);},[]),o=we__namespace.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]=we.useState(null),[N,te]=we.useState(null),[M,se]=we.useState(false),Y=d??T??c,{handleFocus:q,handleBlur:ie}=fn(),{isMobile:A}=pt(),h=I&&A,Ne=we__namespace.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=we.useRef(null),ve=we.useRef(null),Ce=()=>{h&&se(!M);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.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})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:s,tooltip:y,description:D==="tooltip"||D==="inline"?o:void 0,descriptionPlacement:D,isRequired:m,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.jsx("div",{ref:ve,children:jsxRuntime.jsxs(S,{variant:"unstyled",className:tailwindMerge.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?jsxRuntime.jsx("div",{className:to(s),children:i(Ne)}):h&&Y?jsxRuntime.jsx("div",{className:to(s),children:a?Array.from(a).find(Q=>Q.id===Y)?.label:String(Y)}):jsxRuntime.jsx(reactAriaComponents.SelectValue,{className:to(s)}),jsxRuntime.jsx(x,{name:"CaretDown","aria-hidden":true,className:tailwindMerge.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?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:g?jsxRuntime.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"?jsxRuntime.jsx(k,{size:s,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:g?jsxRuntime.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"?jsxRuntime.jsx(k,{size:s,className:"mt-1",children:o}):null}),h?null:jsxRuntime.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:jsxRuntime.jsx(ao.Provider,{value:"md",children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:a,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:n&&a?X=>jsxRuntime.jsx(Te,{id:X.id,textValue:X.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(X)})},X.id):r})})})]})}),h&&jsxRuntime.jsx(Oe,{isOpen:M,onClose:()=>se(false),title:e??"Select an option",contentPadding:false,children:jsxRuntime.jsx(ao.Provider,{value:"md",children:jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.jsx(Te,{id:b.id,textValue:b.label,children:jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.ListBoxItem,{...t,className:tailwindMerge.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"})=>jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.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__namespace.default.useRef(null),M=we__namespace.default.useRef(null),[se,Y]=we__namespace.default.useState(),[q,ie]=we.useState(()=>so(r||a,o,t)),[A,h]=we.useState(false),[Ne,Fe]=we.useState(false),le=Ao(q),{contains:ve}=mt({sensitivity:"base"}),[Ce,b]=we.useState(),{isMobile:U}=pt(),z=K&&U,X=W[l].text,ge=reactStately.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=we.useRef("");we.useEffect(()=>{I&&h(true);},[I]),we.useEffect(()=>{let w=so(r,o,t);w!==q&&ie(w);},[r,o,t]),we.useEffect(()=>{let w=()=>{te.current&&Y(te.current.offsetWidth);};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),we.useEffect(()=>{le===""?Ye.current="":Q&&le!==Ye.current&&(Ye.current=le,Q.setFilterText(le));},[le,Q]),Le=ft(!!Q?.isLoading,300);let Bo=we__namespace.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 jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:l,tooltip:g,isRequired:y,children:e}),jsxRuntime.jsxs(Z,{ref:te,children:[V?jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:V(Le)}):jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:Le?jsxRuntime.jsx(Ge,{size:16,color:"text-text-secondary"}):jsxRuntime.jsx(x,{name:"MagnifyingGlass",className:`${Nn[l]} text-text-secondary`})}),jsxRuntime.jsx(reactAriaComponents.Input,{className:oe({isInvalid:p||!!c,isDisabled:m,isFocused:A||(z?Ne:w.isOpen),size:l,className:tailwindMerge.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&&jsxRuntime.jsx(Qe,{onClick:()=>{ie(""),n?.(null);},size:l}),!T&&!q&&jsxRuntime.jsx(reactAriaComponents.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})=>jsxRuntime.jsx(x,{name:E?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),R?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:C&&Ce?jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text",children:Ce}):C&&typeof c=="string"?jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text",children:c}):C&&typeof c=="function"&&F?jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text",children:c(F)}):u?jsxRuntime.jsx(k,{size:l,children:u}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u&&jsxRuntime.jsx(k,{size:l,className:"mt-1",children:u}),C&&Ce&&jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:Ce}),C&&typeof c=="string"&&jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c}),C&&typeof c=="function"&&F&&jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c(F)})]}),!z&&jsxRuntime.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:jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.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):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[be.name,jsxRuntime.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__namespace.default.isValidElement(be)&&be.type===reactAriaComponents.ListBoxSection?be:jsxRuntime.jsx(reactAriaComponents.ListBoxSection,{children:be},E.name)}return jsxRuntime.jsxs(reactAriaComponents.ListBoxSection,{children:[jsxRuntime.jsx(reactAriaComponents.Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:E.name}),ee]},E.name)}):E=>jsxRuntime.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):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[E.name,jsxRuntime.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&&jsxRuntime.jsx(Oe,{isOpen:Ne,onClose:()=>Fe(false),title:e??d??"Search",contentPadding:false,height:"80vh",children:jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsx("div",{className:"p-4 border-b border-border-default",children:jsxRuntime.jsxs(Z,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:Le?jsxRuntime.jsx(Ge,{size:16,color:"text-text-secondary"}):jsxRuntime.jsx(x,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsxRuntime.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&&jsxRuntime.jsx(Qe,{onClick:()=>{ie(""),n?.(null);},size:"md"})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 jsxRuntime.jsxs(reactAriaComponents.CheckboxGroup,{...e,className:_(e.className,"flex flex-col gap-2"),children:[jsxRuntime.jsx(O,{children:e.label}),e.children,e.description&&jsxRuntime.jsx(k,{children:e.description}),jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.Checkbox,{...r,className:reactAriaComponents.composeRenderProps(e.className,(a,n)=>`${Hn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,d=jsxRuntime.jsx("div",{className:_n({isSelected:n,isIndeterminate:i,...s}),children:i?jsxRuntime.jsx(lucideReact.Minus,{"aria-hidden":true,className:lr}):n?jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":true,className:lr}):null});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,typeof o=="function"?o(a):o]})}})}function rm({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=reactHookForm.useFormContext(),i=L(n.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(cr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsxRuntime.jsx(f,{children:i})]})})}function dm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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]=we.useState(u||""),[v,V]=we.useState(c||u||""),[D,I]=we.useState(false),[R,T]=we.useState(null),{isFocused:K,handleFocus:N,handleBlur:te}=Re(),M=c!==void 0?c:F;we.useEffect(()=>{c!==void 0&&V(c);},[c]);let se=M?!We(M):false,Y=we.useCallback(A=>{if(V(A),We(A)){let h=mo(A);l?l(h):C(h);}else A===""&&(l?l(""):C(""));},[l]),q=we.useCallback(A=>{let h=mo(A);V(h),l?l(h):C(h);},[l]),ie=we.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 jsxRuntime.jsx(reactAriaComponents.TextField,{...p,isRequired:n,className:_(s,"group flex flex-col"),children:({isDisabled:A})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 relative",children:[jsxRuntime.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:tailwindMerge.twMerge(oe({isInvalid:se,isDisabled:A,isFocused:K,size:r,transparent:i}),y?"pr-12":"pr-3","pl-3")}),y&&jsxRuntime.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:W[r].height},children:jsxRuntime.jsx("div",{className:tailwindMerge.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)&&jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsxRuntime.jsx("div",{ref:T,children:jsxRuntime.jsx(S,{variant:"secondary",size:r,icon:"Palette",onPress:()=>I(!D),isDisabled:A,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&d?jsxRuntime.jsx(f,{size:r,children:t(d)}):o?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(d)}):o?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null}),D&&R&&jsxRuntime.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:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsx(reactColorful.HexColorPicker,{color:M||"#000000",onChange:q,style:{width:"200px",height:"200px"}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:M||"#000000"}}),jsxRuntime.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 jsxRuntime.jsxs(reactAriaComponents.Calendar,{...o,children:[jsxRuntime.jsx(br,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(xr,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:t=>jsxRuntime.jsx(reactAriaComponents.CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${di({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function br(){let{direction:e}=reactAriaComponents.useLocale(),o=18;return jsxRuntime.jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsxRuntime.jsx(S,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsxRuntime.jsx(x,{name:"CaretRight","aria-hidden":true,size:o}):jsxRuntime.jsx(x,{name:"CaretLeft","aria-hidden":true,size:o})}),jsxRuntime.jsx(reactAriaComponents.Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsxRuntime.jsx(S,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsxRuntime.jsx(x,{name:"CaretLeft","aria-hidden":true,size:o}):jsxRuntime.jsx(x,{name:"CaretRight","aria-hidden":true,size:o})})]})}function xr(){return jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader,{children:e=>jsxRuntime.jsx(reactAriaComponents.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]=we.useState(false),p=F=>{g.onChange&&F&&g.onChange(F),m(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(l,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.jsxs("div",{className:"relative w-full",children:[jsxRuntime.jsx(yr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:y,onOpenChange:m,children:[jsxRuntime.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:jsxRuntime.jsx(x,{name:"Calendar",size:18})}),jsxRuntime.jsx(reactAriaComponents.Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"p-4 outline-none",children:jsxRuntime.jsx(fo,{value:g.value,onChange:p,minValue:g.minValue,maxValue:g.maxValue,isDisabled:i,isReadOnly:g.isReadOnly,isDateUnavailable:g.isDateUnavailable})})})]})]})}),c?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&u?jsxRuntime.jsx(f,{size:r,children:t(u)}):o?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(u)}):o?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function xi({isPlaceholder:e,isDisabled:o,size:t="md"}){return tailwindMerge.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 jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.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=>jsxRuntime.jsx(reactAriaComponents.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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]=we.useState(false),[g,y]=we.useState(false),[m,p]=we.useState(null),[F,C]=we.useState(e),v=we.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 jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",s),children:[jsxRuntime.jsxs(reactAriaComponents.DropZone,{className:tailwindMerge.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?jsxRuntime.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&(F.startsWith("data:image")||F.startsWith("http"))?jsxRuntime.jsx("img",{src:F,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Image,{className:"h-12 w-12 text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!n&&jsxRuntime.jsx(S,{variant:"icon",size:"sm",onPress:I,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsxRuntime.jsx(lucideReact.Upload,{className:"h-12 w-12 text-text-secondary"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-primary",children:c}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsxRuntime.jsx(reactAriaComponents.FileTrigger,{acceptedFileTypes:r.split(","),onSelect:R=>{let T=Array.from(R||[]);T.length>0&&V(T[0]);},children:jsxRuntime.jsx(S,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),g&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),m&&jsxRuntime.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}=reactHookForm.useFormContext(),i=L(n.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(xo,{...r,value:s.value??"",onChange:(d,c)=>s.onChange(c||"")}),t&&i&&jsxRuntime.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 tailwindMerge.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=we.useId(),{isFocused:g,handleFocus:y,handleBlur:m}=Re();return jsxRuntime.jsx(reactAriaComponents.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})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,htmlFor:l,children:e}),jsxRuntime.jsx("div",{className:"relative",children:jsxRuntime.jsxs(reactAriaComponents.Group,{className:"relative",children:[jsxRuntime.jsx(reactAriaComponents.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})}),jsxRuntime.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:[jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(x,{name:"CaretUp",size:14})}),jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(x,{name:"CaretDown",size:14})})]})]})}),d?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsxRuntime.jsx(f,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:t?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function _p({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.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__namespace.default.Children.map(s,g=>we__namespace.default.isValidElement(g)?we__namespace.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}=reactHookForm.useFormContext(),d=L(s.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsxRuntime.jsx(O,{children:t}),r&&jsxRuntime.jsx(k,{children:r}),jsxRuntime.jsx(wt,{...n,value:c.value,onChange:u=>c.onChange(u),children:a}),d&&jsxRuntime.jsx(f,{children:d})]})})}function Ki(e){return "primary"}var Yi=we.createContext({variant:"primary"});function Fo(e){let{variant:o="primary",...t}=e,r=Ki();return jsxRuntime.jsx(Yi.Provider,{value:{variant:r},children:jsxRuntime.jsxs(reactAriaComponents.RadioGroup,{...t,className:_(e.className,"group flex flex-col gap-2"),children:[jsxRuntime.jsx(O,{children:e.label}),jsxRuntime.jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsxRuntime.jsx(k,{children:e.description}),jsxRuntime.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 tailwindMerge.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__namespace.default.useState(false),{isFocused:v,handleFocus:V,handleBlur:D}=Re(),I=u==="password",R=ft(y,300);return jsxRuntime.jsx(reactAriaComponents.TextField,{...p,isRequired:n,className:_(p.className,"group flex flex-col"),children:({isDisabled:T,isInvalid:K})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,description:m==="tooltip"||m==="inline"?o:void 0,descriptionPlacement:m,isRequired:n,children:e}),jsxRuntime.jsxs(Z,{children:[s&&jsxRuntime.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?jsxRuntime.jsx(Ge,{size:N,color:"text-text-secondary"}):jsxRuntime.jsx(x,{name:"MagnifyingGlass",size:N,className:`transition-colors ${v?"text-action-brand":"text-text-secondary"}`})})()}),jsxRuntime.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&&jsxRuntime.jsx(Qe,{onClick:()=>{c?c():p.onChange&&p.onChange("");},size:r}),I&&!T&&jsxRuntime.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:jsxRuntime.jsx(x,{name:F?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),g?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsxRuntime.jsx(f,{size:r,children:t(l)}):o&&m==="below"?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(l)}):o&&m==="below"?jsxRuntime.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})=>jsxRuntime.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]=we.useState(e);return we__namespace.default.useEffect(()=>{n(e);},[e]),jsxRuntime.jsx(Ie,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"relative bg-background-surface rounded-lg shadow-xl max-w-md w-full",children:jsxRuntime.jsxs("form",{onSubmit:s=>{s.preventDefault(),r(a),t();},children:[jsxRuntime.jsx(He,{title:"Insert Link",onClose:t}),jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(lt,{label:"URL",type:"url",value:a,onChange:n,autoFocus:true,className:"w-full"})}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsxRuntime.jsx(S,{variant:"secondary",onPress:t,children:"Cancel"}),jsxRuntime.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]=we.useState(false),l=react.useEditor({immediatelyRender:false,extensions:[ss__default.default.configure({heading:s.length>0?{levels:s}:false}),rs__default.default.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:tailwindMerge.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?jsxRuntime.jsxs("div",{id:n,"data-richtexteditor":true,className:tailwindMerge.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&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(menus.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:[jsxRuntime.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:[jsxRuntime.jsx(x,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxRuntime.jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:g,children:[jsxRuntime.jsx(x,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxRuntime.jsxs(S,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsxRuntime.jsx(x,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsxRuntime.jsx(ms,{isOpen:c,onClose:()=>u(false),onSubmit:y,initialUrl:l.getAttributes("link").href||""})]}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center gap-1 border-b border-border-input",d.toolbar),children:[s.map(m=>jsxRuntime.jsx(Ue,{isActive:l.isActive("heading",{level:m}),onPress:()=>l.chain().focus().toggleHeading({level:m}).run(),children:jsxRuntime.jsxs("span",{className:"text-xs font-bold",children:["H",m]})},m)),jsxRuntime.jsx(Ue,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"B"})}),jsxRuntime.jsx(Ue,{isActive:l.isActive("italic"),onPress:()=>l.chain().focus().toggleItalic().run(),children:jsxRuntime.jsx("span",{className:"text-xs italic",children:"I"})}),jsxRuntime.jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsxRuntime.jsx(Ue,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsxRuntime.jsx(x,{name:"ListBullets",className:"h-4 w-4"})}),jsxRuntime.jsx(Ue,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsxRuntime.jsx(x,{name:"ListNumbers",className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsxRuntime.jsx(Ue,{isActive:l.isActive("link"),onPress:g,children:jsxRuntime.jsx(x,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative w-full outline-none focus:outline-none",d.contentWrapper),children:[jsxRuntime.jsx(react.EditorContent,{editor:l,className:tailwindMerge.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&&jsxRuntime.jsx("div",{className:tailwindMerge.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}=reactHookForm.useFormContext(),d=L(s.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsxRuntime.jsx("label",{htmlFor:e,className:"text-sm font-medium text-text-primary",children:t}),r&&jsxRuntime.jsx("p",{className:"text-sm text-text-secondary",children:r}),jsxRuntime.jsx(Co,{...n,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),d&&jsxRuntime.jsx("p",{className:"text-sm text-feedback-error-text",children:d}),a&&!d&&jsxRuntime.jsx("div",{className:"h-5"})]})})}function hg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:vs({...a,size:t}),children:jsxRuntime.jsx("span",{className:Ps({...a,size:t})})}),e]})})}function Ig({name:e,defaultValue:o,...t}){let{control:r}=reactHookForm.useFormContext();return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsxRuntime.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 tailwindMerge.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 jsxRuntime.jsx("div",{className:"group flex flex-col",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.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?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsxRuntime.jsx(f,{size:r,children:t(l)}):o?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(l)}):o?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function Gg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 tailwindMerge.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 jsxRuntime.jsxs(reactAriaComponents.TimeField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(u,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,description:l==="tooltip"||l==="inline"?o:void 0,descriptionPlacement:l,isRequired:n,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(Je({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:y=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:y,className:Ms({isPlaceholder:y.isPlaceholder,isDisabled:!y.isEditable||i,size:r})})})}),d?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&c?jsxRuntime.jsx(f,{size:r,children:t(c)}):o&&l==="below"?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(c)}):o&&l==="below"?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function gb({name:e,...o}){let{control:t,formState:{errors:r}}=reactHookForm.useFormContext(),a=r[e],n=a?.message;return jsxRuntime.jsx(reactHookForm.Controller,{name:e,control:t,render:({field:i})=>jsxRuntime.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}=reactHookForm.useFormContext(),a=we__namespace.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(we__namespace.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 jsxRuntime.jsxs("div",{ref:a,role:"alert",tabIndex:-1,className:tailwindMerge.twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsxRuntime.jsx("div",{className:"font-medium",children:o}),jsxRuntime.jsx("ul",{className:"mt-2 list-disc pl-5",children:i.map(([c,u])=>{let l=u?.message||"Invalid value";return jsxRuntime.jsx("li",{children:jsxRuntime.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}=reactHookForm.useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsxRuntime.jsx(S,{type:"submit",form:e,isDisabled:s,...n,children:a})}function Bb({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:a}=reactHookForm.useFormContext(),{fields:n,append:i,remove:s,swap:d}=reactHookForm.useFieldArray({control:a,name:e});return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[n.map((c,u)=>jsxRuntime.jsxs(pe,{children:[jsxRuntime.jsx(ht,{title:o?o(u):`Item ${u+1}`,actions:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[u>0&&jsxRuntime.jsx(S,{size:"sm",variant:"secondary",onPress:()=>d(u,u-1),children:"Up"}),u<n.length-1&&jsxRuntime.jsx(S,{size:"sm",variant:"secondary",onPress:()=>d(u,u+1),children:"Down"}),jsxRuntime.jsx(S,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsxRuntime.jsx(yt,{children:t(u)})]},c.id)),jsxRuntime.jsx("div",{children:jsxRuntime.jsx(S,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function Io(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.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=reactHookForm.useForm(i),d=(c,u)=>{if(a&&e){let l=document.getElementById(e);l&&Er(l);}t?.(c,u);};return jsxRuntime.jsx(reactHookForm.FormProvider,{...s,children:jsxRuntime.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?jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsxRuntime.jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(S,{variant:"secondary",onPress:r,children:n}),jsxRuntime.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}=reactHookForm.useFormContext();return jsxRuntime.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}=reactHookForm.useFormContext();we__namespace.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}=reactHookForm.useFormContext(),n=we__namespace.useRef(void 0);we__namespace.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]);}exports.ErrorSummary=vb;exports.FieldArrayList=Bb;exports.FormAutocomplete=Hu;exports.FormCheckbox=rm;exports.FormCheckboxGroup=dm;exports.FormColorField=Nm;exports.FormDateField=ip;exports.FormFileUpload=Fp;exports.FormNumberField=_p;exports.FormProvider=qb;exports.FormRadioCardGroup=af;exports.FormRadioGroup=Tf;exports.FormRichTextEditor=dg;exports.FormSaveBar=ex;exports.FormSelect=hg;exports.FormSwitch=Ig;exports.FormTextArea=Gg;exports.FormTextField=jg;exports.FormTimeField=gb;exports.SubmitButton=Sb;exports.focusFirstError=Er;exports.useAutoSave=sx;exports.useScrollIntoViewOnError=ax;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var reactHookForm=require('react-hook-form'),Ne=require('react'),reactAriaComponents=require('react-aria-components'),reactStately=require('react-stately'),tailwindMerge=require('tailwind-merge'),pa=require('@phosphor-icons/react'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),reactColorful=require('react-colorful'),rs=require('@tiptap/extension-link'),react=require('@tiptap/react'),menus=require('@tiptap/react/menus'),ss=require('@tiptap/starter-kit');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Ne__namespace=/*#__PURE__*/_interopNamespace(Ne);var pa__namespace=/*#__PURE__*/_interopNamespace(pa);var rs__default=/*#__PURE__*/_interopDefault(rs);var ss__default=/*#__PURE__*/_interopDefault(ss);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__namespace.default.createContext(ct),Or=Ne__namespace.default.createContext(false);var Gr=!!(typeof window<"u"&&window.document&&window.document.createElement),Lt=new WeakMap;function Wr(e=false){let o=Ne.useContext(Vo),t=Ne.useRef(null);if(t.current===null&&!e){var r,a;let n=(a=Ne__namespace.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=Ne.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__namespace.default.useId(),[t]=Ne.useState(ut()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${ct.prefix}`;return e||`${r}-${o}`}typeof Ne__namespace.default.useId=="function"?Ur:qr;function Yr(){return false}function jr(){return true}function Qr(e){return ()=>{}}function ut(){return typeof Ne__namespace.default.useSyncExternalStore=="function"?Ne__namespace.default.useSyncExternalStore(Qr,Yr,jr):Ne.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]=Ne.useState(Mt);return Ne.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__namespace.default.createContext(null);function At(){let e=$o();return Ne.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=Ne.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=Ne.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=Ne.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 Ne.useMemo(()=>({startsWith:t,endsWith:r,contains:a}),[t,r,a])}function De(e,o=false){let[t,r]=Ne.useState(o);return Ne.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]=Ne.useState(e);return Ne.useEffect(()=>{let a=setTimeout(()=>r(e),o);return ()=>clearTimeout(a)},[e,o]),t}function ft(e,o=300){let[t,r]=Ne.useState(false);return Ne.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 reactAriaComponents.composeRenderProps(e,t=>tailwindMerge.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=Ne.memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=pa__namespace[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=tailwindMerge.twMerge("inline-block flex-shrink-0",!t&&"text-current",a);return jsxRuntime.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=Ne.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=tailwindMerge.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 jsxRuntime.jsx("div",{className:m,style:{width:v,height:v},children:jsxRuntime.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 jsxRuntime.jsxs(reactAriaComponents.TooltipTrigger,{delay:200,children:[e,jsxRuntime.jsxs(reactAriaComponents.Tooltip,{...t,offset:10,className:reactAriaComponents.composeRenderProps(t.className,(r,a)=>ha({...a,className:r})),children:[jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.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:jsxRuntime.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),o]})]})}function Ce(){let[e,o]=Ne__namespace.default.useState(false),t=Ne__namespace.default.useCallback((a,n)=>{o(true),n?.(a);},[]),r=Ne__namespace.default.useCallback((a,n)=>{o(false),n?.(a);},[]);return {isFocused:e,handleFocus:t,handleBlur:r}}var Z=Ne__namespace.default.forwardRef(({children:e,className:o},t)=>jsxRuntime.jsx("div",{ref:t,className:tailwindMerge.twMerge("relative w-full",o),children:e}));Z.displayName="InputWrapper";function Xe({onClick:e,size:o="md",className:t}){return jsxRuntime.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),e();},className:tailwindMerge.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:jsxRuntime.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 tailwindMerge.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=jsxRuntime.jsxs("label",{htmlFor:s,className:tailwindMerge.twMerge(W[o].text,"!text-text-label font-semibold flex items-center gap-1",i),children:[e,n&&jsxRuntime.jsx("span",{children:"*"}),d&&jsxRuntime.jsx("span",{className:"inline-flex items-center text-text-secondary",children:jsxRuntime.jsx(h,{name:"Info",size:o==="sm"?16:20})}),u&&jsxRuntime.jsx("span",{className:"text-text-secondary font-normal ml-1",children:r})]});return d&&c?jsxRuntime.jsx(Go,{content:c,children:l}):l}function k({size:e="md",className:o,children:t,...r}){return jsxRuntime.jsx("div",{...r,className:tailwindMerge.twMerge("leading-[2.25] text-text-secondary",W[e].text,o),children:t})}function f({children:e,size:o="md",className:t}){return jsxRuntime.jsx("div",{role:"alert",className:tailwindMerge.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 jsxRuntime.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?jsxRuntime.jsx(h,{name:o,size:i,weight:d}):null,V=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&y,typeof t=="function"?null:t,s==="right"&&y]}),D=jsxRuntime.jsxs("div",{className:"relative inline-flex items-center justify-center",children:[jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:n||jsxRuntime.jsx(h,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsxRuntime.jsx("div",{className:"invisible","aria-hidden":"true",children:V}),a&&jsxRuntime.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),I=(l??0)>0,C=tailwindMerge.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?jsxRuntime.jsx(reactAriaComponents.Link,{...T,...r&&{"aria-busy":true},style:I?void 0:m,className:C,children:r?D:typeof t=="function"?(function(N){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&y,t(N),s==="right"&&y]})}):V}):jsxRuntime.jsx(reactAriaComponents.Button,{...F,...r&&{"aria-busy":true},style:I?void 0:m,className:C,children:r?D:typeof t=="function"?(function(N){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&y,t(N),s==="right"&&y]})}):V});return I?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative flex",u),style:m,children:[K,jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.ModalOverlay,{...r,className:reactAriaComponents.composeRenderProps(o,(a,n)=>tailwindMerge.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=reactAriaComponents.useSlottedContext(reactAriaComponents.PopoverContext)?.trigger==="SubmenuTrigger",c=o?12:8;c=d?c-6:c;let u=jsxRuntime.jsxs(reactAriaComponents.Popover,{offset:c,...i,className:reactAriaComponents.composeRenderProps(r,(l,g)=>Ga({...g,className:l,disableGroup:n})),children:[o&&jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.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:jsxRuntime.jsx("path",{d:"M0 0 L6 6 L12 0"})})}),e]});return t?jsxRuntime.jsx(ke,{isDismissable:a,children:jsxRuntime.jsx(reactAriaComponents.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]=Ne.useState(null);return Ne.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 jsxRuntime.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:jsxRuntime.jsxs("div",{className:`flex w-full flex-col items-center justify-center border-t p-4 ${r?"h-28":""}`,children:[r&&jsxRuntime.jsx("div",{className:"flex h-10 justify-center",children:r}),a&&jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[jsxRuntime.jsx("div",{children:t&&jsxRuntime.jsx(qt,{action:t,defaultVariant:"destructive"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[o&&jsxRuntime.jsx(qt,{action:o,defaultVariant:"secondary"}),e&&jsxRuntime.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 jsxRuntime.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})=>jsxRuntime.jsxs("div",{className:tailwindMerge.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&&jsxRuntime.jsx(R,{variant:"icon",onPress:n,className:"absolute left-6","aria-label":"Go back",children:jsxRuntime.jsx(h,{name:"CaretLeft","data-testid":"back-arrow"})}),i||jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e&&jsxRuntime.jsx(tt,{size:"xs",children:e}),o&&!t&&jsxRuntime.jsx(R,{variant:"icon",onPress:o,"aria-label":"Close dialog",children:jsxRuntime.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]=Ne.useState(d===0);if(Ne.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?jsxRuntime.jsx("div",{className:"space-y-2","data-testid":g,children:i.map((I,C)=>jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(p,F,y,V,D,l),style:{width:I,height:o}},C))}):jsxRuntime.jsx("div",{className:tailwindMerge.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 jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("w-full overflow-hidden",en[e],tn,a==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsxRuntime.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?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("p-6 pb-4",r),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx(me,{width:120,height:20}),jsxRuntime.jsx(me,{width:24,height:24})]}),o&&jsxRuntime.jsx(me,{width:200,height:16})]}):!e&&!o&&!t?null:jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("p-6 pb-4",r),children:jsxRuntime.jsxs("div",{className:"flex justify-between items-start gap-4",children:[jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[e&&jsxRuntime.jsx("div",{className:"mb-1",children:typeof e=="string"?jsxRuntime.jsx(tt,{tag:"h3",size:"sm",className:"text-text-primary",children:e}):e}),o&&jsxRuntime.jsx("div",{className:Ao("bodySm","text-text-secondary"),children:o})]}),t&&jsxRuntime.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?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("bg-background-muted",jt[t],r),children:jsxRuntime.jsx(me,{width:"100%",height:"100%"})}):a?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",jt[t],r),children:a}):e?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",jt[t],r),children:jsxRuntime.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?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(n,r&&"flex-1 flex flex-col min-h-0",e),children:jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx(me,{width:"100%",height:16}),jsxRuntime.jsx(me,{width:"80%",height:16}),jsxRuntime.jsx(me,{width:"60%",height:16})]})}):o?jsxRuntime.jsx("div",{className:tailwindMerge.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?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("px-6 py-4 flex gap-2 justify-end",e),children:[jsxRuntime.jsx(me,{width:80,height:32}),jsxRuntime.jsx(me,{width:60,height:32})]}):o?jsxRuntime.jsx("div",{className:tailwindMerge.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 Ne.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:jsxRuntime.jsxs(pe,{children:[this.props.title&&jsxRuntime.jsx(pe.Header,{title:this.props.title}),jsxRuntime.jsx(pe.Content,{children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center gap-4","data-testid":"error-boundary",children:[jsxRuntime.jsx("p",{className:"text-feedback-error-text",children:this.state.error?.message||"Something went wrong"}),jsxRuntime.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]=Ne.useState(false),[T,K]=Ne.useState(0),[N,te]=Ne.useState(false),M=Uo(s),se=M?.height??null,Y=M?.keyboardOffset??0,q=Ne.useRef(null),ie=Ne.useRef(null),A=Ne.useRef(null),x=Ne.useRef({isDragging:false,startY:0,startTime:0,pointerId:null});Ne.useEffect(()=>{if(s){let b=setTimeout(()=>{C(true),setTimeout(()=>C(false),600);},400);return ()=>clearTimeout(b)}},[s]),Ne.useEffect(()=>{s||(K(0),te(false),x.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),Ne.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=Ne.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=Ne.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=Ne.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 jsxRuntime.jsx(rt,{children:jsxRuntime.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:jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx("div",{ref:q,className:tailwindMerge.twMerge("w-full",N&&"transition-transform duration-200"),style:{transform:T>0?`translateY(${T}px)`:void 0},children:jsxRuntime.jsxs(reactAriaComponents.Dialog,{className:tailwindMerge.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&&jsxRuntime.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:jsxRuntime.jsx("div",{className:tailwindMerge.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?jsxRuntime.jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsxRuntime.jsx(He,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,onClose:d||(()=>{})})),jsxRuntime.jsx("div",{ref:ie,className:tailwindMerge.twMerge("flex-1 min-h-0 overflow-y-auto overscroll-contain",F?"p-4":"p-0"),children:e}),Fe&&jsxRuntime.jsx(Kt,{primaryAction:l,secondaryAction:g,footerContent:v})]})})})})})}Oe.displayName="Tray";var ro=Ne.createContext("md");function or(){return Ne.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__namespace.default.useCallback((t,r)=>{r?.(t);},[]),o=Ne__namespace.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]=Ne.useState(null),[N,te]=Ne.useState(null),[M,se]=Ne.useState(false),Y=d??T??c,{handleFocus:q,handleBlur:ie}=fn(),{isMobile:A}=pt(),x=I&&A,Te=Ne__namespace.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=Ne.useRef(null),ye=Ne.useRef(null),Fe=()=>{x&&se(!M);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.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})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:s,tooltip:v,description:D==="tooltip"||D==="inline"?o:void 0,descriptionPlacement:D,isRequired:m,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.jsx("div",{ref:ye,children:jsxRuntime.jsxs(R,{variant:"unstyled",className:tailwindMerge.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?jsxRuntime.jsx("div",{className:eo(s),children:i(Te)}):x&&Y?jsxRuntime.jsx("div",{className:eo(s),children:a?Array.from(a).find(X=>X.id===Y)?.label:String(Y)}):jsxRuntime.jsx(reactAriaComponents.SelectValue,{className:eo(s)}),jsxRuntime.jsx(h,{name:"CaretDown","aria-hidden":true,className:tailwindMerge.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?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:g?jsxRuntime.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"?jsxRuntime.jsx(k,{size:s,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:g?jsxRuntime.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"?jsxRuntime.jsx(k,{size:s,className:"mt-1",children:o}):null}),x?null:jsxRuntime.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:jsxRuntime.jsx(ro.Provider,{value:"md",children:jsxRuntime.jsx(reactAriaComponents.ListBox,{items:a,className:"w-full max-h-[300px] overflow-auto bg-background-input p-0 outline-0",children:n&&a?Q=>jsxRuntime.jsx(Se,{id:Q.id,textValue:Q.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(Q)})},Q.id):r})})})]})}),x&&jsxRuntime.jsx(Oe,{isOpen:M,onClose:()=>se(false),title:e??"Select an option",contentPadding:false,children:jsxRuntime.jsx(ro.Provider,{value:"md",children:jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.jsx(Se,{id:b.id,textValue:b.label,children:jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.ListBoxItem,{...t,className:tailwindMerge.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"})=>jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.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__namespace.default.useRef(null),M=Ne__namespace.default.useRef(null),[se,Y]=Ne__namespace.default.useState(),[q,ie]=Ne.useState(()=>io(r||a,o,t)),[A,x]=Ne.useState(false),[Te,Pe]=Ne.useState(false),le=Mo(q),{contains:ye}=mt({sensitivity:"base"}),[Fe,b]=Ne.useState(),{isMobile:U}=pt(),z=K&&U,Q=W[l].text,ge=reactStately.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=Ne.useRef("");Ne.useEffect(()=>{I&&x(true);},[I]),Ne.useEffect(()=>{let w=io(r,o,t);w!==q&&ie(w);},[r,o,t]),Ne.useEffect(()=>{let w=()=>{te.current&&Y(te.current.offsetWidth);};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[]),Ne.useEffect(()=>{le===""?Ye.current="":X&&le!==Ye.current&&(Ye.current=le,X.setFilterText(le));},[le,X]),Le=ft(!!X?.isLoading,300);let Io=Ne__namespace.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 jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:l,tooltip:g,isRequired:v,children:e}),jsxRuntime.jsxs(Z,{ref:te,children:[V?jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:V(Le)}):jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:Le?jsxRuntime.jsx(Ge,{size:16,color:"text-text-secondary"}):jsxRuntime.jsx(h,{name:"MagnifyingGlass",className:`${Nn[l]} text-text-secondary`})}),jsxRuntime.jsx(reactAriaComponents.Input,{className:oe({isInvalid:p||!!c,isDisabled:m,isFocused:A||(z?Te:w.isOpen),size:l,className:tailwindMerge.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&&jsxRuntime.jsx(Xe,{onClick:()=>{ie(""),n?.(null);},size:l}),!T&&!q&&jsxRuntime.jsx(reactAriaComponents.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})=>jsxRuntime.jsx(h,{name:E?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),C?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:F&&Fe?jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text",children:Fe}):F&&typeof c=="string"?jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text",children:c}):F&&typeof c=="function"&&P?jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text",children:c(P)}):u?jsxRuntime.jsx(k,{size:l,children:u}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u&&jsxRuntime.jsx(k,{size:l,className:"mt-1",children:u}),F&&Fe&&jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:Fe}),F&&typeof c=="string"&&jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c}),F&&typeof c=="function"&&P&&jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:c(P)})]}),!z&&jsxRuntime.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:jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.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__namespace.default.isValidElement(be)&&be.type===reactAriaComponents.ListBoxSection?be:jsxRuntime.jsx(reactAriaComponents.ListBoxSection,{children:be},E.name)}return jsxRuntime.jsxs(reactAriaComponents.ListBoxSection,{children:[jsxRuntime.jsx(reactAriaComponents.Header,{className:"px-3 py-1 text-sm font-bold text-text-secondary",children:E.name}),ee]},E.name)}):E=>jsxRuntime.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&&jsxRuntime.jsx(Oe,{isOpen:Te,onClose:()=>Pe(false),title:e??d??"Search",contentPadding:false,height:"80vh",children:jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsx("div",{className:"p-4 border-b border-border-default",children:jsxRuntime.jsxs(Z,{children:[jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10 flex items-center",children:Le?jsxRuntime.jsx(Ge,{size:16,color:"text-text-secondary"}):jsxRuntime.jsx(h,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-secondary"})}),jsxRuntime.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&&jsxRuntime.jsx(Xe,{onClick:()=>{ie(""),n?.(null);},size:"md"})]})}),jsxRuntime.jsx("div",{className:"flex-1 overflow-auto",children:jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 jsxRuntime.jsxs(reactAriaComponents.CheckboxGroup,{...e,className:_(e.className,"flex flex-col gap-2"),children:[jsxRuntime.jsx(O,{children:e.label}),e.children,e.description&&jsxRuntime.jsx(k,{children:e.description}),jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.Checkbox,{...r,className:reactAriaComponents.composeRenderProps(e.className,(a,n)=>`${Hn(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,d=jsxRuntime.jsx("div",{className:_n({isSelected:n,isIndeterminate:i,...s}),children:i?jsxRuntime.jsx(lucideReact.Minus,{"aria-hidden":true,className:lr}):n?jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":true,className:lr}):null});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,typeof o=="function"?o(a):o]})}})}function rm({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=reactHookForm.useFormContext(),i=L(n.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(cr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsxRuntime.jsx(f,{children:i})]})})}function dm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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]=Ne.useState(u||""),[y,V]=Ne.useState(c||u||""),[D,I]=Ne.useState(false),[C,T]=Ne.useState(null),{isFocused:K,handleFocus:N,handleBlur:te}=Ce(),M=c!==void 0?c:P;Ne.useEffect(()=>{c!==void 0&&V(c);},[c]);let se=M?!We(M):false,Y=Ne.useCallback(A=>{if(V(A),We(A)){let x=uo(A);l?l(x):F(x);}else A===""&&(l?l(""):F(""));},[l]),q=Ne.useCallback(A=>{let x=uo(A);V(x),l?l(x):F(x);},[l]),ie=Ne.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 jsxRuntime.jsx(reactAriaComponents.TextField,{...p,isRequired:n,className:_(s,"group flex flex-col"),children:({isDisabled:A})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1 relative",children:[jsxRuntime.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:tailwindMerge.twMerge(oe({isInvalid:se,isDisabled:A,isFocused:K,size:r,transparent:i}),v?"pr-12":"pr-3","pl-3")}),v&&jsxRuntime.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",style:{width:W[r].height},children:jsxRuntime.jsx("div",{className:tailwindMerge.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)&&jsxRuntime.jsx("div",{className:"w-full h-full flex items-center justify-center",children:jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-border-muted"})})})})]}),jsxRuntime.jsx("div",{ref:T,children:jsxRuntime.jsx(R,{variant:"secondary",size:r,icon:"Palette",onPress:()=>I(!D),isDisabled:A,className:"flex-shrink-0",children:"Pick"})})]})}),m?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&d?jsxRuntime.jsx(f,{size:r,children:t(d)}):o?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&d?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(d)}):o?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null}),D&&C&&jsxRuntime.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:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4",children:[jsxRuntime.jsx(reactColorful.HexColorPicker,{color:M||"#000000",onChange:q,style:{width:"200px",height:"200px"}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 rounded border border-border-default shadow-sm flex-shrink-0",style:{backgroundColor:M||"#000000"}}),jsxRuntime.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 jsxRuntime.jsxs(reactAriaComponents.Calendar,{...o,children:[jsxRuntime.jsx(br,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(xr,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:t=>jsxRuntime.jsx(reactAriaComponents.CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${di({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-feedback-error-text",children:e})]})}function br(){let{direction:e}=reactAriaComponents.useLocale(),o=18;return jsxRuntime.jsxs("header",{className:"flex w-full items-center gap-1 px-1 pb-4",children:[jsxRuntime.jsx(R,{variant:"icon",slot:"previous",className:"pl-0",children:e==="rtl"?jsxRuntime.jsx(h,{name:"CaretRight","aria-hidden":true,size:o}):jsxRuntime.jsx(h,{name:"CaretLeft","aria-hidden":true,size:o})}),jsxRuntime.jsx(reactAriaComponents.Heading,{className:"text-md mx-2 flex-1 text-center font-semibold text-text-primary"}),jsxRuntime.jsx(R,{variant:"icon",slot:"next",className:"pr-0",children:e==="rtl"?jsxRuntime.jsx(h,{name:"CaretLeft","aria-hidden":true,size:o}):jsxRuntime.jsx(h,{name:"CaretRight","aria-hidden":true,size:o})})]})}function xr(){return jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader,{children:e=>jsxRuntime.jsx(reactAriaComponents.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]=Ne.useState(false),p=P=>{g.onChange&&P&&g.onChange(P),m(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(l,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.jsxs("div",{className:"relative w-full",children:[jsxRuntime.jsx(vr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:v,onOpenChange:m,children:[jsxRuntime.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:jsxRuntime.jsx(h,{name:"Calendar",size:18})}),jsxRuntime.jsx(reactAriaComponents.Popover,{className:"bg-background-surface rounded-lg border border-border-default shadow-xl",children:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"p-4 outline-none",children:jsxRuntime.jsx(po,{value:g.value,onChange:p,minValue:g.minValue,maxValue:g.maxValue,isDisabled:i,isReadOnly:g.isReadOnly,isDateUnavailable:g.isDateUnavailable})})})]})]})}),c?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&u?jsxRuntime.jsx(f,{size:r,children:t(u)}):o?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&u?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(u)}):o?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function xi({isPlaceholder:e,isDisabled:o,size:t="md"}){return tailwindMerge.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 jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.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=>jsxRuntime.jsx(reactAriaComponents.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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]=Ne.useState(false),[g,v]=Ne.useState(false),[m,p]=Ne.useState(null),[P,F]=Ne.useState(e),y=Ne.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 jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("w-full",s),children:[jsxRuntime.jsxs(reactAriaComponents.DropZone,{className:tailwindMerge.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?jsxRuntime.jsxs("div",{className:"relative flex h-full w-full items-center justify-center p-4",children:[d&&(P.startsWith("data:image")||P.startsWith("http"))?jsxRuntime.jsx("img",{src:P,alt:"Preview",className:"max-h-48 max-w-full rounded-md object-contain"}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Image,{className:"h-12 w-12 text-text-secondary"}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:"File uploaded"})]}),!n&&jsxRuntime.jsx(R,{variant:"icon",size:"sm",onPress:I,className:"absolute right-2 top-2 bg-background-surface shadow-md",children:jsxRuntime.jsx(lucideReact.X,{className:"h-4 w-4"})})]}):jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-4 p-6",children:[jsxRuntime.jsx(lucideReact.Upload,{className:"h-12 w-12 text-text-secondary"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-primary",children:c}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-secondary",children:r==="image/*"?"PNG, JPG, GIF up to 10MB":`Accepts ${r}`})]}),jsxRuntime.jsx(reactAriaComponents.FileTrigger,{acceptedFileTypes:r.split(","),onSelect:C=>{let T=Array.from(C||[]);T.length>0&&V(T[0]);},children:jsxRuntime.jsx(R,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),g&&jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center rounded-lg bg-background-surface/80",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-center gap-2",children:[jsxRuntime.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-action-brand border-t-transparent"}),jsxRuntime.jsx("span",{className:"text-sm text-text-secondary",children:"Uploading..."})]})})]}),m&&jsxRuntime.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}=reactHookForm.useFormContext(),i=L(n.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:a,name:e,defaultValue:o,render:({field:s})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx(bo,{...r,value:s.value??"",onChange:(d,c)=>s.onChange(c||"")}),t&&i&&jsxRuntime.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 tailwindMerge.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=Ne.useId(),{isFocused:g,handleFocus:v,handleBlur:m}=Ce();return jsxRuntime.jsx(reactAriaComponents.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})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,description:c==="tooltip"||c==="inline"?o:void 0,descriptionPlacement:c,isRequired:n,htmlFor:l,children:e}),jsxRuntime.jsx("div",{className:"relative",children:jsxRuntime.jsxs(reactAriaComponents.Group,{className:"relative",children:[jsxRuntime.jsx(reactAriaComponents.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})}),jsxRuntime.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:[jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(h,{name:"CaretUp",size:14})}),jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(h,{name:"CaretDown",size:14})})]})]})}),d?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:t?jsxRuntime.jsx(f,{size:r,children:typeof t=="function"?t(s):t}):o&&c==="below"?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:t?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:typeof t=="function"?t(s):t}):o&&c==="below"?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function _p({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.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__namespace.default.Children.map(s,g=>Ne__namespace.default.isValidElement(g)?Ne__namespace.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}=reactHookForm.useFormContext(),d=L(s.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsxRuntime.jsx(O,{children:t}),r&&jsxRuntime.jsx(k,{children:r}),jsxRuntime.jsx(Nt,{...n,value:c.value,onChange:u=>c.onChange(u),children:a}),d&&jsxRuntime.jsx(f,{children:d})]})})}function Ki(e){return "primary"}var Yi=Ne.createContext({variant:"primary"});function Po(e){let{variant:o="primary",...t}=e,r=Ki();return jsxRuntime.jsx(Yi.Provider,{value:{variant:r},children:jsxRuntime.jsxs(reactAriaComponents.RadioGroup,{...t,className:_(e.className,"group flex flex-col gap-2"),children:[jsxRuntime.jsx(O,{children:e.label}),jsxRuntime.jsx("div",{className:`flex ${t.orientation==="horizontal"?"flex-row gap-4":"flex-col gap-2"}`,children:e.children}),e.description&&jsxRuntime.jsx(k,{children:e.description}),jsxRuntime.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 tailwindMerge.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__namespace.default.useState(false),{isFocused:y,handleFocus:V,handleBlur:D}=Ce(),I=u==="password",C=ft(v,300);return jsxRuntime.jsx(reactAriaComponents.TextField,{...p,isRequired:n,className:_(p.className,"group flex flex-col"),children:({isDisabled:T,isInvalid:K})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,description:m==="tooltip"||m==="inline"?o:void 0,descriptionPlacement:m,isRequired:n,children:e}),jsxRuntime.jsxs(Z,{children:[s&&jsxRuntime.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?jsxRuntime.jsx(Ge,{size:N,color:"text-text-secondary"}):jsxRuntime.jsx(h,{name:"MagnifyingGlass",size:N,className:`transition-colors ${y?"text-action-brand":"text-text-secondary"}`})})()}),jsxRuntime.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&&jsxRuntime.jsx(Xe,{onClick:()=>{c?c():p.onChange&&p.onChange("");},size:r}),I&&!T&&jsxRuntime.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:jsxRuntime.jsx(h,{name:P?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-primary"})})]}),g?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsxRuntime.jsx(f,{size:r,children:t(l)}):o&&m==="below"?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(l)}):o&&m==="below"?jsxRuntime.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})=>jsxRuntime.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]=Ne.useState(e);return Ne__namespace.default.useEffect(()=>{n(e);},[e]),jsxRuntime.jsx(ke,{isDismissable:true,isOpen:o,onOpenChange:s=>!s&&t(),children:jsxRuntime.jsx(reactAriaComponents.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:jsxRuntime.jsx(reactAriaComponents.Dialog,{className:"relative bg-background-surface rounded-lg shadow-xl max-w-md w-full",children:jsxRuntime.jsxs("form",{onSubmit:s=>{s.preventDefault(),r(a),t();},children:[jsxRuntime.jsx(He,{title:"Insert Link",onClose:t}),jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(lt,{label:"URL",type:"url",value:a,onChange:n,autoFocus:true,className:"w-full"})}),jsxRuntime.jsxs("div",{className:"flex justify-end gap-2 border-t border-border-muted p-4",children:[jsxRuntime.jsx(R,{variant:"secondary",onPress:t,children:"Cancel"}),jsxRuntime.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]=Ne.useState(false),l=react.useEditor({immediatelyRender:false,extensions:[ss__default.default.configure({heading:s.length>0?{levels:s}:false}),rs__default.default.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:tailwindMerge.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?jsxRuntime.jsxs("div",{id:n,"data-richtexteditor":true,className:tailwindMerge.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&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(menus.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:[jsxRuntime.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:[jsxRuntime.jsx(h,{name:"ArrowSquareOut",className:"mr-1 h-4 w-4"}),"Open"]}),jsxRuntime.jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:g,children:[jsxRuntime.jsx(h,{name:"PencilSimple",className:"mr-1 h-4 w-4"}),"Edit"]}),jsxRuntime.jsxs(R,{variant:"ghost",size:"sm",className:"h-8 px-2",onPress:()=>l.chain().focus().unsetLink().run(),children:[jsxRuntime.jsx(h,{name:"X",className:"mr-1 h-4 w-4"}),"Remove"]})]}),jsxRuntime.jsx(ms,{isOpen:c,onClose:()=>u(false),onSubmit:v,initialUrl:l.getAttributes("link").href||""})]}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex items-center gap-1 border-b border-border-input",d.toolbar),children:[s.map(m=>jsxRuntime.jsx(Ue,{isActive:l.isActive("heading",{level:m}),onPress:()=>l.chain().focus().toggleHeading({level:m}).run(),children:jsxRuntime.jsxs("span",{className:"text-xs font-bold",children:["H",m]})},m)),jsxRuntime.jsx(Ue,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"B"})}),jsxRuntime.jsx(Ue,{isActive:l.isActive("italic"),onPress:()=>l.chain().focus().toggleItalic().run(),children:jsxRuntime.jsx("span",{className:"text-xs italic",children:"I"})}),jsxRuntime.jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsxRuntime.jsx(Ue,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsxRuntime.jsx(h,{name:"ListBullets",className:"h-4 w-4"})}),jsxRuntime.jsx(Ue,{isActive:l.isActive("orderedList"),onPress:()=>l.chain().focus().toggleOrderedList().run(),children:jsxRuntime.jsx(h,{name:"ListNumbers",className:"h-4 w-4"})}),jsxRuntime.jsx("div",{className:"mx-1 h-4 w-px bg-border-muted"}),jsxRuntime.jsx(Ue,{isActive:l.isActive("link"),onPress:g,children:jsxRuntime.jsx(h,{name:"PaperclipHorizontal",className:"h-4 w-4"})})]}),jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative w-full outline-none focus:outline-none",d.contentWrapper),children:[jsxRuntime.jsx(react.EditorContent,{editor:l,className:tailwindMerge.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&&jsxRuntime.jsx("div",{className:tailwindMerge.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}=reactHookForm.useFormContext(),d=L(s.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:i,name:e,defaultValue:o,render:({field:c})=>jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[t&&jsxRuntime.jsx("label",{htmlFor:e,className:"text-sm font-medium text-text-primary",children:t}),r&&jsxRuntime.jsx("p",{className:"text-sm text-text-secondary",children:r}),jsxRuntime.jsx(Fo,{...n,id:e,initialContent:c.value??"",onChange:u=>c.onChange(u)}),d&&jsxRuntime.jsx("p",{className:"text-sm text-feedback-error-text",children:d}),a&&!d&&jsxRuntime.jsx("div",{className:"h-5"})]})})}function hg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 jsxRuntime.jsx(reactAriaComponents.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=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:ys({...a,size:t}),children:jsxRuntime.jsx("span",{className:Ps({...a,size:t})})}),e]})})}function Ig({name:e,defaultValue:o,...t}){let{control:r}=reactHookForm.useFormContext();return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:a})=>jsxRuntime.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 tailwindMerge.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 jsxRuntime.jsx("div",{className:"group flex flex-col",children:jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,isRequired:n,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.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?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&l?jsxRuntime.jsx(f,{size:r,children:t(l)}):o?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&l?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(l)}):o?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null})]})})}function Gg({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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}=reactHookForm.useFormContext(),n=L(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.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 tailwindMerge.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 jsxRuntime.jsxs(reactAriaComponents.TimeField,{...g,isDisabled:i,isRequired:n,isInvalid:s,className:_(u,"flex flex-col gap-1"),children:[e&&jsxRuntime.jsx(O,{size:r,tooltip:a,description:l==="tooltip"||l==="inline"?o:void 0,descriptionPlacement:l,isRequired:n,children:e}),jsxRuntime.jsx(Z,{children:jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(Je({isInvalid:s,isDisabled:i}),"px-3 py-2 flex items-center gap-0.5 w-full"),children:v=>jsxRuntime.jsx(reactAriaComponents.DateSegment,{segment:v,className:Ms({isPlaceholder:v.isPlaceholder,isDisabled:!v.isEditable||i,size:r})})})}),d?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,children:t}):typeof t=="function"&&c?jsxRuntime.jsx(f,{size:r,children:t(c)}):o&&l==="below"?jsxRuntime.jsx(k,{size:r,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof t=="string"?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t}):typeof t=="function"&&c?jsxRuntime.jsx(f,{size:r,className:"mt-1",children:t(c)}):o&&l==="below"?jsxRuntime.jsx(k,{size:r,className:"mt-1",children:o}):null})]})}function gb({name:e,...o}){let{control:t,formState:{errors:r}}=reactHookForm.useFormContext(),a=r[e],n=a?.message;return jsxRuntime.jsx(reactHookForm.Controller,{name:e,control:t,render:({field:i})=>jsxRuntime.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}=reactHookForm.useFormContext(),a=Ne__namespace.useRef(null),n=r.errors,i=Object.entries(n||{}),s=i.length>0;if(Ne__namespace.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 jsxRuntime.jsxs("div",{ref:a,role:"alert",tabIndex:-1,className:tailwindMerge.twMerge("rounded-md border border-feedback-error-border bg-feedback-error-background p-3 text-sm text-feedback-error-text",e),children:[jsxRuntime.jsx("div",{className:"font-medium",children:o}),jsxRuntime.jsx("ul",{className:"mt-2 list-disc pl-5",children:i.map(([c,u])=>{let l=u?.message||"Invalid value";return jsxRuntime.jsx("li",{children:jsxRuntime.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}=reactHookForm.useFormContext(),s=r||i.isSubmitting||o&&!i.isValid||t&&!i.isDirty;return jsxRuntime.jsx(R,{type:"submit",form:e,isDisabled:s,...n,children:a})}function Bb({name:e,getItemTitle:o,renderItem:t,onAdd:r}){let{control:a}=reactHookForm.useFormContext(),{fields:n,append:i,remove:s,swap:d}=reactHookForm.useFieldArray({control:a,name:e});return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[n.map((c,u)=>jsxRuntime.jsxs(pe,{children:[jsxRuntime.jsx(ht,{title:o?o(u):`Item ${u+1}`,actions:jsxRuntime.jsxs("div",{className:"flex gap-2",children:[u>0&&jsxRuntime.jsx(R,{size:"sm",variant:"secondary",onPress:()=>d(u,u-1),children:"Up"}),u<n.length-1&&jsxRuntime.jsx(R,{size:"sm",variant:"secondary",onPress:()=>d(u,u+1),children:"Down"}),jsxRuntime.jsx(R,{size:"sm",variant:"secondary",onPress:()=>s(u),children:"Remove"})]})}),jsxRuntime.jsx(vt,{children:t(u)})]},c.id)),jsxRuntime.jsx("div",{children:jsxRuntime.jsx(R,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function ko(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.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=reactHookForm.useForm(i),d=(c,u)=>{if(a&&e){let l=document.getElementById(e);l&&Er(l);}t?.(c,u);};return jsxRuntime.jsx(reactHookForm.FormProvider,{...s,children:jsxRuntime.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?jsxRuntime.jsx("div",{className:tailwindMerge.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:jsxRuntime.jsxs("div",{className:"mx-auto flex max-w-screen-lg items-center justify-between gap-3 p-3",children:[jsxRuntime.jsx("div",{className:"text-sm text-text-secondary",children:"You have unsaved changes"}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(R,{variant:"secondary",onPress:r,children:n}),jsxRuntime.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}=reactHookForm.useFormContext();return jsxRuntime.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}=reactHookForm.useFormContext();Ne__namespace.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}=reactHookForm.useFormContext(),n=Ne__namespace.useRef(void 0);Ne__namespace.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]);}exports.ErrorSummary=yb;exports.FieldArrayList=Bb;exports.FormAutocomplete=Hu;exports.FormCheckbox=rm;exports.FormCheckboxGroup=dm;exports.FormColorField=Nm;exports.FormDateField=ip;exports.FormFileUpload=Fp;exports.FormNumberField=_p;exports.FormProvider=qb;exports.FormRadioCardGroup=af;exports.FormRadioGroup=Tf;exports.FormRichTextEditor=dg;exports.FormSaveBar=ex;exports.FormSelect=hg;exports.FormSwitch=Ig;exports.FormTextArea=Gg;exports.FormTextField=jg;exports.FormTimeField=gb;exports.SubmitButton=Sb;exports.focusFirstError=Er;exports.useAutoSave=sx;exports.useScrollIntoViewOnError=ax;//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map