@texturehq/edges 1.33.2 → 1.34.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.
Files changed (52) hide show
  1. package/README.md +57 -3
  2. package/dist/{RichTextEditor-CxrunTg7.d.cts → RichTextEditor-diZqy_s1.d.cts} +1 -1
  3. package/dist/{RichTextEditor-CxrunTg7.d.ts → RichTextEditor-diZqy_s1.d.ts} +1 -1
  4. package/dist/{TimeField-DRQshIHX.d.ts → TimeField-7pTUPh11.d.ts} +32 -17
  5. package/dist/{TimeField-WCmeiLu3.d.cts → TimeField-CqmVrAdn.d.cts} +32 -17
  6. package/dist/{colors-Cgs2MGZ8.d.ts → colors-CoULWZ5j.d.ts} +53 -18
  7. package/dist/{colors-DGRiGzgj.d.cts → colors-upTGgIQe.d.cts} +53 -18
  8. package/dist/form/index.cjs +1 -1
  9. package/dist/form/index.cjs.map +1 -1
  10. package/dist/form/index.d.cts +1 -1
  11. package/dist/form/index.d.ts +1 -1
  12. package/dist/form/index.js +1 -1
  13. package/dist/form/index.js.map +1 -1
  14. package/dist/{index-BqpWEc_N.d.ts → index-dofSwYId.d.cts} +5 -5
  15. package/dist/{index-BqpWEc_N.d.cts → index-dofSwYId.d.ts} +5 -5
  16. package/dist/index.cjs +10 -10
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +161 -41
  19. package/dist/index.d.ts +161 -41
  20. package/dist/index.js +10 -10
  21. package/dist/index.js.map +1 -1
  22. package/dist/prose.css +202 -0
  23. package/dist/rhf/index.cjs +1 -1
  24. package/dist/rhf/index.cjs.map +1 -1
  25. package/dist/rhf/index.d.cts +2 -2
  26. package/dist/rhf/index.d.ts +2 -2
  27. package/dist/rhf/index.js +1 -1
  28. package/dist/rhf/index.js.map +1 -1
  29. package/dist/server.cjs +2 -2
  30. package/dist/server.cjs.map +1 -1
  31. package/dist/server.d.cts +2 -2
  32. package/dist/server.d.ts +2 -2
  33. package/dist/server.js +2 -2
  34. package/dist/server.js.map +1 -1
  35. package/dist/styles/computed.css +2 -2
  36. package/dist/styles/responsive-typography.css +9 -7
  37. package/dist/styles/theme-light-override.css +26 -15
  38. package/dist/styles.css +953 -877
  39. package/dist/theme.css +20 -7
  40. package/dist/typography.css +150 -0
  41. package/package.json +10 -12
  42. package/scripts/check-legacy-action-variants.mjs +96 -0
  43. package/scripts/check-legacy-font-colors.mjs +92 -0
  44. package/scripts/copy-assets.js +12 -0
  45. package/templates/claude-rules/.claude +5 -5
  46. package/templates/claude-rules/claude.md +5 -5
  47. package/templates/codex-rules/codex.md +5 -5
  48. package/dist/generated/tailwind-tokens-dark.css +0 -397
  49. package/dist/generated/tailwind-tokens-light.css +0 -611
  50. package/dist/generated/viz-runtime.css +0 -243
  51. package/scripts/generate-viz-runtime.js +0 -107
  52. package/scripts/validate-tokens.js +0 -176
@@ -1,2 +1,2 @@
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'),ca=require('@phosphor-icons/react'),jsxRuntime=require('react/jsx-runtime'),lucideReact=require('lucide-react'),reactColorful=require('react-colorful'),Xi=require('@tiptap/extension-link'),react=require('@tiptap/react'),menus=require('@tiptap/react/menus'),ts=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 ca__namespace=/*#__PURE__*/_interopNamespace(ca);var Xi__default=/*#__PURE__*/_interopDefault(Xi);var ts__default=/*#__PURE__*/_interopDefault(ts);var Lr=Object.defineProperty;var Vr=(e,o,t)=>o in e?Lr(e,o,{enumerable:true,configurable:true,writable:true,value:t}):e[o]=t;var Et=(e,o,t)=>Vr(e,typeof o!="symbol"?o+"":o,t);var dt={prefix:String(Math.round(Math.random()*1e10)),current:0},Bo=Ne__namespace.default.createContext(dt),zr=Ne__namespace.default.createContext(false);var _r=!!(typeof window<"u"&&window.document&&window.document.createElement),$t=new WeakMap;function Hr(e=false){let o=Ne.useContext(Bo),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=$t.get(n);i==null?$t.set(n,{id:o.current,state:n.memoizedState}):n.memoizedState!==i.state&&(o.current=i.id,$t.delete(n));}t.current=++o.current;}return t.current}function Or(e){let o=Ne.useContext(Bo);o===dt&&!_r&&process.env.NODE_ENV!=="production"&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let t=Hr(!!e),r=o===dt&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${o.prefix}`;return e||`${r}-${t}`}function Gr(e){let o=Ne__namespace.default.useId(),[t]=Ne.useState(ct()),r=t||process.env.NODE_ENV==="test"?"react-aria":`react-aria${dt.prefix}`;return e||`${r}-${o}`}typeof Ne__namespace.default.useId=="function"?Gr:Or;function qr(){return false}function Ur(){return true}function Kr(e){return ()=>{}}function ct(){return typeof Ne__namespace.default.useSyncExternalStore=="function"?Ne__namespace.default.useSyncExternalStore(Kr,qr,Ur):Ne.useContext(zr)}var Yr=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 Lt(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 Yr.has(t.script)}let o=e.split("-")[0];return jr.has(o)}var $o=Symbol.for("react-aria.i18n.locale");function Do(){let e=typeof window<"u"&&window[$o]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([e]);}catch{e="en-US";}return {locale:e,direction:Lt(e)?"rtl":"ltr"}}var Vt=Do(),Ye=new Set;function Eo(){Vt=Do();for(let e of Ye)e(Vt);}function Lo(){let e=ct(),[o,t]=Ne.useState(Vt);return Ne.useEffect(()=>(Ye.size===0&&window.addEventListener("languagechange",Eo),Ye.add(t),()=>{Ye.delete(t),Ye.size===0&&window.removeEventListener("languagechange",Eo);}),[]),e?{locale:typeof window<"u"&&window[$o]||"en-US",direction:"ltr"}:o}var ea=Ne__namespace.default.createContext(null);function At(){let e=Lo();return Ne.useContext(ea)||e}var Mt=new Map;function zt(e){let{locale:o}=At(),t=o+(e?Object.entries(e).sort((a,n)=>a[0]<n[0]?-1:1).join():"");if(Mt.has(t))return Mt.get(t);let r=new Intl.Collator(o,e);return Mt.set(t,r),r}function ut(e){let o=zt({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 je={sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"};function mt(e="base"){let o=De(`(min-width: ${je.sm})`,e!=="base"),t=De(`(min-width: ${je.md})`,["md","lg","xl","2xl"].includes(e)),r=De(`(min-width: ${je.lg})`,["lg","xl","2xl"].includes(e)),a=De(`(min-width: ${je.xl})`,["xl","2xl"].includes(e)),n=De(`(min-width: ${je["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 Vo(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 pt(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 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 H(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 Le={xs:16,sm:20,md:24,lg:32,xl:40,"2xl":48},x=Ne.memo(({name:e,size:o="md",color:t,weight:r="regular",className:a,ariaLabel:n,...i})=>{let s=ca__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 Le?Le[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 zo=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 b=typeof a=="string"&&a in Le?Le[a]:a,v=t?typeof t=="string"&&t in Le?Le[t]:t:b*1.75,m=tailwindMerge.twMerge("inline-flex items-center justify-center flex-shrink-0",o==="circle"?"rounded-full":"rounded-lg",e==="subtle"&&"bg-gray-100 dark:bg-gray-800",e==="solid"&&"bg-brand text-white",e==="outline"&&"border-2 border-current",r);return jsxRuntime.jsx("div",{className:m,style:{width:v,height:v},children:jsxRuntime.jsx(x,{...l,name:i,size:a,color:s,weight:d,className:n,ariaLabel:c})})});zo.displayName="IconWithContainer";var ba=({isEntering:e,isExiting:o,className:t})=>["max-w-[200px] group bg-slate-700 dark:bg-slate-600 border border-slate-800 dark:border-white/10 shadow-[inset_0_1px_0_0_theme(colors.gray.600)] dark:shadow-none text-white text-sm rounded-lg drop-shadow-lg will-change-transform px-3 py-1",e?"animate-in fade-in placement-bottom:slide-in-from-top-0.5 placement-top:slide-in-from-bottom-0.5 placement-left:slide-in-from-right-0.5 placement-right:slide-in-from-left-0.5 ease-out duration-200":"",o?"animate-out fade-out placement-bottom:slide-out-to-top-0.5 placement-top:slide-out-to-bottom-0.5 placement-left:slide-out-to-right-0.5 placement-right:slide-out-to-left-0.5 ease-in duration-150":"",t].filter(Boolean).join(" ");function Ho({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)=>ba({...a,className:r})),children:[jsxRuntime.jsx(reactAriaComponents.OverlayArrow,{children:jsxRuntime.jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",className:"fill-slate-700 stroke-gray-800 group-placement-left:-rotate-90 group-placement-right:rotate-90 group-placement-bottom:rotate-180 dark:fill-slate-600 dark:stroke-white/10 forced-colors:fill-[Canvas] forced-colors:stroke-[ButtonBorder]",children: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 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-muted hover:text-text-body 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 Xe(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 ga(e){return e.isDisabled?"bg-background-muted":e.transparent?"bg-transparent":"bg-background-input"}function xa(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",Xe({isInvalid:o,isDisabled:t,isFocused:r}),ga({transparent:a,isDisabled:t}),W[n].text,W[n].height,W[n].padding,xa(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-muted",children:jsxRuntime.jsx(x,{name:"Info",size:o==="sm"?16:20})}),u&&jsxRuntime.jsx("span",{className:"text-text-caption font-normal ml-1",children:r})]});return d&&c?jsxRuntime.jsx(Ho,{content:c,children:l}):l}function w({size:e="md",className:o,children:t,...r}){return jsxRuntime.jsx("div",{...r,className:tailwindMerge.twMerge("leading-[2.25] text-text-caption",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 bt({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 Pa="flex font-medium justify-center items-center gap-2 text-center transition rounded-[var(--control-border-radius)] whitespace-nowrap box-border",Fa={default:"bg-action-default text-[color:var(--color-action-default-text)] hover:bg-action-default-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",brand:"bg-action-brand text-[color:var(--color-action-brand-text)] hover:bg-action-brand-hover forced-colors:bg-[ButtonText] forced-colors:text-[ButtonFace] border-2 border-transparent",secondary:"bg-transparent text-text-body border-2 border-border-muted hover:bg-text-body/5 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[ButtonText]",ghost:"border-none text-text-body hover:bg-text-body/5 forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace]",destructive:"bg-transparent text-feedback-error-text border-2 border-border-muted hover:bg-feedback-error-background/50 forced-colors:border-[ButtonBorder] forced-colors:bg-[ButtonFace] forced-colors:text-[Mark]",link:"!text-action-brand hover:text-action-brand/90 hover:underline hover:decoration-2 hover:underline-offset-4",icon:"border-none text-text-body hover:bg-background-hover hover:text-text-heading forced-colors:text-[ButtonText] forced-colors:hover:bg-[ButtonFace] p-1 flex-shrink-0 rounded-[var(--control-border-radius)]",unstyled:"bg-transparent"},Go={full:"w-full",default:"w-fit"},Ca="opacity-50 cursor-not-allowed pointer-events-none",Ra="opacity-100 cursor-pointer",Sa={"top-right":"-right-2 -top-2","top-left":"-left-2 -top-2","bottom-right":"-right-2 -bottom-2","bottom-left":"-left-2 -bottom-2"},Ta={primary:"bg-action-brand text-white",destructive:"bg-action-destructive text-white"};function Na(e){return e?e==="primary"?"brand":e:"default"}function wa(e){let{variant:o="default",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Na(o),s=i==="unstyled"?"":`${Pa} ${Fa[i]}`;i!=="unstyled"&&(s+=` ${W[t].text} ${W[t].height} ${W[t].padding} ${W[t].gap}`),r||n?s+=` ${Ca}`:s+=` ${Ra}`,a?s+=` ${Go.full}`:s+=` ${Go.default}`;let d=i==="brand"?"focus-visible:outline-action-brand":void 0;return [s,we(),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:b="primary",badgePosition:v="top-right",style:m,target:p,rel:F,...C}=e,y=o?jsxRuntime.jsx(x,{name:o,size:i,weight:d}):null,E=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&y,typeof t=="function"?null:t,s==="right"&&y]}),L=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:E}),a&&jsxRuntime.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),k=(l??0)>0,R=tailwindMerge.twMerge(wa(e),u),T=c?{href:c,target:p,rel:F,...C}:{};if(c){let{onPress:I,onPressStart:te,onPressEnd:A,onPressChange:se,onPressUp:Y,onAuxClick:q,onContextMenu:ie,onDoubleClick:M,...h}=C;Object.assign(T,h);}let K=c?jsxRuntime.jsx(reactAriaComponents.Link,{...T,...r&&{"aria-busy":true},style:k?void 0:m,className:R,children:r?L:typeof t=="function"?(function(I){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&y,t(I),s==="right"&&y]})}):E}):jsxRuntime.jsx(reactAriaComponents.Button,{...C,...r&&{"aria-busy":true},style:k?void 0:m,className:R,children:r?L:typeof t=="function"?(function(I){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&y,t(I),s==="right"&&y]})}):E});return k?jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("relative flex",u),style:m,children:[K,jsxRuntime.jsx("span",{className:`absolute ${Sa[v]} flex h-5 w-5 items-center justify-center rounded-full ${Ta[b]} 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-black/20 via-black/15 to-black/20","backdrop-blur-[2px]","supports-[backdrop-filter]:bg-black/15"].join(" "),n.isEntering&&["animate-in fade-in","duration-300 ease-out"].join(" "),n.isExiting&&["animate-out fade-out","duration-200 ease-in"].join(" "),a)),children:t})}function za({isEntering:e,isExiting:o,className:t="",disableGroup:r=false}){let a=[!r&&"group","bg-background-surface","forced-colors:bg-[Canvas]","shadow-lg","rounded-[var(--control-border-radius)]","bg-clip-padding","border","border-border-default","outline-none"].filter(Boolean).join(" "),n=e?["animate-in","fade-in","placement-bottom:slide-in-from-top-1","placement-top:slide-in-from-bottom-1","placement-left:slide-in-from-right-1","placement-right:slide-in-from-left-1","ease-out","duration-200"].join(" "):"",i=o?["animate-out","fade-out","placement-bottom:slide-out-to-top-1","placement-top:slide-out-to-bottom-1","placement-left:slide-out-to-right-1","placement-right:slide-out-to-left-1","ease-in","duration-150"].join(" "):"";return [a,n,i,t].filter(Boolean).join(" ")}function 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,b)=>za({...b,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 Wo(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 Wt({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 Ut({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(Wt,{action:t,defaultVariant:"destructive"})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[o&&jsxRuntime.jsx(Wt,{action:o,defaultVariant:"secondary"}),e&&jsxRuntime.jsx(Wt,{action:e,defaultVariant:"default"})]})]})]})}var Wa={xs:"text-base md:text-lg font-semibold",sm:"text-lg md:text-xl font-semibold",md:"text-xl md:text-2xl font-semibold",lg:"text-2xl md:text-3xl font-semibold",xl:"text-3xl md:text-4xl font-semibold"},qa={page:"h-16 leading-[62px]"};function et({tag:e="h1",size:o="lg",height:t,className:r="",children:a}){let n=Wa[o],i=t?qa[t]:"";return jsxRuntime.jsx(e,{className:tailwindMerge.twMerge(n,i,r),children:a})}var ze=({title:e,onClose:o,hideCloseIcon:t=false,titleAlign:r="left",hasBackArrow:a=false,onBack:n,headerContent:i})=>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(et,{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":b})=>{let[v,m]=Ne.useState(d===0);if(Ne.useEffect(()=>{if(d>0){let k=setTimeout(()=>m(true),d);return ()=>clearTimeout(k)}},[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)]",F=c&&e?(()=>{let k=typeof e=="number"?e:parseFloat(String(e));return isNaN(k)?"":`animation-duration-[${Math.max(.8,k/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}`:"",y="rounded-sm";t==="circle"&&(y="rounded-full"),t==="text"&&(y="h-4 w-full rounded-sm");let E=n?"flex-1 min-w-0":"",L=s?Object.entries(s).map(([k,R])=>`${k}:w-[${R}]`).join(" "):"";return i?jsxRuntime.jsx("div",{className:"space-y-2","data-testid":b,children:i.map((k,R)=>jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(p,C,y,E,L,l),style:{width:k,height:o}},R))}):jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(p,C,y,E,L,l),style:{width:e,height:o},role:"presentation","aria-hidden":!u,"aria-label":u??void 0,"data-testid":b})};var Xa={outlined:"bg-background-surface border border-border-default",elevated:"bg-background-surface border-0 shadow-md",filled:"bg-background-muted border-0",ghost:"bg-transparent border-0 shadow-none"},Ja="rounded-lg",Yt={square:"aspect-square",video:"aspect-video",wide:"aspect-[2/1]",auto:""},Za={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",Xa[e],Ja,a==="flex"&&"flex flex-col",o),"data-testid":"card",children:r?jsxRuntime.jsx(me,{width:"100%",height:"100%",className:"rounded-none"}):t})}function gt({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(et,{tag:"h3",size:"sm",className:"text-text-heading",children:e}):e}),o&&jsxRuntime.jsx("div",{className:"text-sm text-text-muted",children:o})]}),t&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:t})]})})}function Ko({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",Yt[t],r),children:jsxRuntime.jsx(me,{width:"100%",height:"100%"})}):a?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",Yt[t],r),children:a}):e?jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("overflow-hidden",Yt[t],r),children:jsxRuntime.jsx("img",{src:e,alt:o||"",className:"w-full h-full object-cover",loading:"lazy"})}):null}function xt({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-body",r&&"flex-1 flex flex-col min-h-0",e),children:o}):null}function Yo({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",Za[t],e),children:o}):null}pe.Header=gt;pe.Media=Ko;pe.Content=xt;pe.Footer=Yo;var ot=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-red-500",children:this.state.error?.message||"Something went wrong"}),jsxRuntime.jsx("button",{className:"rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600",onClick:this.handleRetry,children:"Retry"})]})})]}):this.props.children}};var rn=.3,an=.5;function He({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:b,footerContent:v,maxHeight:m="80vh",height:p,maxWidth:F="640px",contentPadding:C=true,showHandle:y=true,animationVariant:E="scale",className:L}){let[k,R]=Ne.useState(false),[T,K]=Ne.useState(0),[I,te]=Ne.useState(false),A=Wo(s),se=A?.height??null,Y=A?.keyboardOffset??0,q=Ne.useRef(null),ie=Ne.useRef(null),M=Ne.useRef(null),h=Ne.useRef({isDragging:false,startY:0,startTime:0,pointerId:null});Ne.useEffect(()=>{if(s){let g=setTimeout(()=>{R(true),setTimeout(()=>R(false),600);},400);return ()=>clearTimeout(g)}},[s]),Ne.useEffect(()=>{s||(K(0),te(false),h.current={isDragging:false,startY:0,startTime:0,pointerId:null});},[s]),Ne.useEffect(()=>{let g=ie.current;if(!g||!s)return;let U=null,z=Q=>{let be=Q.target;be&&["INPUT","TEXTAREA","SELECT"].includes(be.tagName)&&(U&&clearTimeout(U),U=setTimeout(()=>{be.scrollIntoView({block:"nearest",behavior:"smooth"});},320));};return g.addEventListener("focusin",z),()=>{g.removeEventListener("focusin",z),U&&clearTimeout(U);}},[s]);let Te=Ne.useCallback(g=>{c&&(g.pointerType!=="touch"&&g.pointerType!=="pen"||(M.current&&(clearTimeout(M.current),M.current=null),h.current={isDragging:true,startY:g.clientY,startTime:Date.now(),pointerId:g.pointerId},te(false),g.currentTarget.setPointerCapture(g.pointerId)));},[c]),Pe=Ne.useCallback(g=>{let{isDragging:U,startY:z,pointerId:Q}=h.current;if(!U||g.pointerId!==Q)return;let be=g.clientY-z;K(Math.max(0,be));},[]),le=Ne.useCallback(g=>{let{isDragging:U,startY:z,startTime:Q,pointerId:be}=h.current;if(!U||g.pointerId!==be)return;let X=g.clientY-z,$e=Date.now()-Q,Ke=X/$e;h.current={isDragging:false,startY:0,startTime:0,pointerId:null};let lt=(q.current?.getBoundingClientRect().height??0)*rn;(X>lt||Ke>an&&X>50)&&c?(d?.(),K(0)):(te(true),K(0),M.current=setTimeout(()=>{te(false),M.current=null;},200));},[c,d]);if(!s)return null;let ve=o||t,Fe=l||b||v;return jsxRuntime.jsx(ot,{children:jsxRuntime.jsx(ke,{isOpen:s,onOpenChange:g=>{g||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",I&&"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",E==="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)]",E==="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)]",L),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:[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",k&&"animate-[handle-wiggle_0.6s_ease-in-out]")})}),ve&&(n?jsxRuntime.jsx(ze,{title:o,headerContent:t,titleAlign:r,hideCloseIcon:a||!d,hasBackArrow:true,onBack:i??(()=>{}),onClose:d||(()=>{})}):jsxRuntime.jsx(ze,{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}),Fe&&jsxRuntime.jsx(Ut,{primaryAction:l,secondaryAction:b,footerContent:v})]})})})})})}He.displayName="Tray";var oo=Ne.createContext("md");function er(){return Ne.useContext(oo)}function Zt(e="md"){let o=e==="sm"?"!text-base md:!text-[length:var(--control-text-sm)]":e==="md"?"!text-base md:!text-[length:var(--control-text-md)]":"";return `flex-1 text-start data-[placeholder]:text-text-placeholder overflow-hidden text-ellipsis whitespace-nowrap ${W[e].text} ${o}`}function un(){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 ro({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:b=false,tooltip:v,isRequired:m,transparent:p,reserveErrorSpace:F=false,placement:C="bottom start",shouldFlip:y=true,menuWidth:E="match",descriptionPlacement:L="below",useMobileTray:k=true,...R}){let[T,K]=Ne.useState(null),[I,te]=Ne.useState(null),[A,se]=Ne.useState(false),Y=d??T??c,{handleFocus:q,handleBlur:ie}=un(),{isMobile:M}=mt(),h=k&&M,Te=Ne__namespace.default.useMemo(()=>!i||!Y||!a?null:Array.from(a).find(U=>U.id===Y)??null,[i,Y,a]),Pe=g=>{u&&g!==null&&u(g),u||K(g);},le=Ne.useRef(null),ve=Ne.useRef(null),Fe=()=>{h&&se(!A);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.Select,{...R,selectedKey:Y,defaultSelectedKey:c,onSelectionChange:Pe,placeholder:l,className:H(R.className,"group flex w-full flex-col"),ref:le,onOpenChange:g=>{h||(g&&ve.current?te(ve.current.offsetWidth):g||le.current?.blur());},children:({isDisabled:g,isInvalid:U,isOpen:z})=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:s,tooltip:v,description:L==="tooltip"||L==="inline"?o:void 0,descriptionPlacement:L,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||b&&!!t,isDisabled:g,isFocused:h?A:z,transparent:p,size:s}),"flex items-center text-start gap-4 cursor-pointer pl-[var(--control-padding-sm)]"),onFocus:Q=>q(Q,R.onFocus),onBlur:Q=>ie(Q,R.onBlur),onPress:h?Fe:void 0,"data-open":h?A:z,children:[i&&Te?jsxRuntime.jsx("div",{className:Zt(s),children:i(Te)}):h&&Y?jsxRuntime.jsx("div",{className:Zt(s),children:a?Array.from(a).find(X=>X.id===Y)?.label:String(Y)}):jsxRuntime.jsx(reactAriaComponents.SelectValue,{className:Zt(s)}),jsxRuntime.jsx(x,{name:"CaretDown","aria-hidden":true,className:tailwindMerge.twMerge("h-4 w-4 text-text-body group-disabled:text-gray-200 forced-colors:text-[ButtonText] transition-transform",(h?A:z)&&"rotate-180")})]})})}),F?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:b?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&&L==="below"?jsxRuntime.jsx(w,{size:s,children:o}):null}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:b?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&&L==="below"?jsxRuntime.jsx(w,{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:E==="match"&&I?`${I}px`:void 0,minWidth:E==="auto"&&I?`${I}px`:void 0,maxWidth:E==="auto"?"min(600px, 90vw)":void 0},placement:C,shouldFlip:y,children:jsxRuntime.jsx(oo.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})})})]})}),h&&jsxRuntime.jsx(He,{isOpen:A,onClose:()=>se(false),title:e??"Select an option",contentPadding:false,children:jsxRuntime.jsx(oo.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:g=>{let U=Array.from(g)[0];U!=null&&(Pe(U),se(false));},children:n&&a?g=>jsxRuntime.jsx(Se,{id:g.id,textValue:g.label,children:jsxRuntime.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap min-w-0 flex-1",children:n(g)})},g.id):r})})})]})}function Se({size:e,className:o,...t}){let r=er(),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-body data-[focused]:bg-background-hover data-[focus-visible]:ring-2 data-[focus-visible]:ring-action-default data-[focus-visible]:ring-inset data-[selected]:bg-background-selected data-[selected]:font-medium overflow-hidden",W[a].paddingY,W[a].text,o)})}var Oe=({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 Cn=[],Rn={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",xl:"h-7 w-7"},Sn={sm:"pl-8",md:"pl-10",lg:"pl-11",xl:"pl-13"},rr={sm:"py-1",md:"py-2",lg:"py-3",xl:"py-4"},no=(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 Tn(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 Nn(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 io({label:e,staticItems:o=Cn,sections:t,selectedKey:r,defaultSelectedKey:a,onSelectionChange:n,requestConfig:i,defaultFilter:s,placeholder:d,errorMessage:c,description:u,size:l="md",tooltip:b,isRequired:v,isDisabled:m,isInvalid:p,validationResult:F,showErrors:C=true,renderItem:y,renderLeftIcon:E,renderSection:L,autoFocus:k=false,reserveErrorSpace:R=false,hideChevron:T=false,useMobileTray:K=true,className:I}){let te=Ne__namespace.default.useRef(null),A=Ne__namespace.default.useRef(null),[se,Y]=Ne__namespace.default.useState(),[q,ie]=Ne.useState(()=>no(r||a,o,t)),[M,h]=Ne.useState(false),[Te,Pe]=Ne.useState(false),le=Vo(q),{contains:ve}=ut({sensitivity:"base"}),[Fe,g]=Ne.useState(),{isMobile:U}=mt(),z=K&&U,Q=W[l].text,be=reactStately.useAsyncList({async load({signal:N,filterText:$=""}){if(!i)return {items:[]};if(!i.url||i.shouldLoad&&!i.shouldLoad($))return {items:[]};try{let ee;return i.requestType==="GraphQL"?ee=await Nn(i,$,N):ee=await Tn(i,$,N),g(ee.error),{items:ee.items}}catch(ee){return ee instanceof Error&&ee.name==="AbortError"?{items:[]}:(console.error("Error loading items:",ee),g(ee instanceof Error?ee.message:"Unknown error occurred"),{items:[]})}},initialFilterText:""}),X=i&&le!==""?be:null,$e=false,Ke=Ne.useRef("");Ne.useEffect(()=>{k&&h(true);},[k]),Ne.useEffect(()=>{let N=no(r,o,t);N!==q&&ie(N);},[r,o,t]),Ne.useEffect(()=>{let N=()=>{te.current&&Y(te.current.offsetWidth);};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),Ne.useEffect(()=>{le===""?Ke.current="":X&&le!==Ke.current&&(Ke.current=le,X.setFilterText(le));},[le,X]),$e=pt(!!X?.isLoading,300);let ko=Ne__namespace.default.useMemo(()=>{if(!z||!q)return X?X.items:o;let N=X?X.items:o,$=s||ve;return N.filter(ee=>$(ee.name,q))},[z,q,X,o,s,ve]),lt=N=>{let $=no(N,o,t);ie($),n&&n(N);},Bt=N=>{ie(N);},Io=()=>{z&&Pe(true);};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactAriaComponents.ComboBox,{onSelectionChange:lt,selectedKey:r||void 0,defaultSelectedKey:a||void 0,defaultItems:t?t.flatMap(N=>N.items):o,items:X?X.items:void 0,className:H(I,"group flex flex-col w-full"),menuTrigger:z?"manual":"focus",isDisabled:m,isInvalid:p||!!c,inputValue:q,onInputChange:Bt,autoFocus:k&&!z,defaultFilter:s||ve,"aria-label":e||d||"Autocomplete",children:N=>jsxRuntime.jsxs("div",{className:"flex flex-col",children:[e&&jsxRuntime.jsx(O,{size:l,tooltip:b,isRequired:v,children:e}),jsxRuntime.jsxs(Z,{ref:te,children:[E?jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:E($e)}):jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 z-10 flex items-center",children:$e?jsxRuntime.jsx(Oe,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(x,{name:"MagnifyingGlass",className:`${Rn[l]} text-text-muted`})}),jsxRuntime.jsx(reactAriaComponents.Input,{className:oe({isInvalid:p||!!c,isDisabled:m,isFocused:M||(z?Te:N.isOpen),size:l,className:tailwindMerge.twMerge(Sn[l],q&&!m||!T&&!q?"pr-10":"pr-3",z&&"cursor-pointer",I)}),placeholder:d,disabled:m,onFocus:$=>{h(true),z&&($.currentTarget.blur(),Io());},onBlur:()=>{h(false);},onClick:z?Io: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-muted hover:text-text-body","aria-label":"Toggle menu",isDisabled:m,children:({isPressed:$})=>jsxRuntime.jsx(x,{name:$?"CaretUp":"CaretDown",className:"h-4 w-4"})})]}),R?jsxRuntime.jsx("div",{className:"mt-1 min-h-[20px]",children:C&&Fe?jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text",children:Fe}):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(w,{size:l,children:u}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u&&jsxRuntime.jsx(w,{size:l,className:"mt-1",children:u}),C&&Fe&&jsxRuntime.jsx(f,{size:l,className:"text-feedback-error-text mt-1",children:Fe}),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,{className:`max-h-[300px] overflow-auto bg-background-input outline-none ${Q}`,children:t?t.map($=>{let ee=$.items.map(ge=>jsxRuntime.jsx(Se,{id:ge.id,textValue:ge.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${rr[l]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:y?y(ge):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[ge.name,jsxRuntime.jsx(x,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},ge.id));if(L){let ge=L($,ee);return Ne__namespace.default.isValidElement(ge)&&ge.type===reactAriaComponents.ListBoxSection?ge:jsxRuntime.jsx(reactAriaComponents.ListBoxSection,{children:ge},$.name)}return jsxRuntime.jsxs(reactAriaComponents.ListBoxSection,{children:[jsxRuntime.jsx(reactAriaComponents.Header,{className:"px-3 py-1 text-sm font-bold text-text-muted",children:$.name}),ee]},$.name)}):$=>jsxRuntime.jsx(Se,{id:$.id,textValue:$.name,size:l,className:`flex cursor-default items-center gap-2 px-3 ${rr[l]} text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0`,children:y?y($):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[$.name,jsxRuntime.jsx(x,{name:"X",className:"ml-auto h-4 w-4 text-text-muted opacity-0 data-[focused]:opacity-100 data-[selected]:opacity-100"})]})},$.id)})})]})}),z&&jsxRuntime.jsx(He,{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:$e?jsxRuntime.jsx(Oe,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(x,{name:"MagnifyingGlass",className:"h-4 w-4 text-text-muted"})}),jsxRuntime.jsx("input",{ref:A,type:"text",value:q,onChange:N=>Bt(N.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,{items:ko,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:N=>{let $=Array.from(N)[0];$&&(lt($),Pe(false));},className:"bg-background-input outline-none",children:N=>jsxRuntime.jsx(Se,{id:N.id,textValue:N.name,size:"md",className:"flex cursor-default items-center gap-2 px-4 py-3 text-text-body outline-none data-[focused]:bg-background-hover data-[selected]:bg-background-selected data-[selected]:font-medium data-[focus-visible]:ring-0",children:y?y(N):N.name},N.id)})})]})})]})}function D(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 wu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(io,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}function ir(e){return jsxRuntime.jsxs(reactAriaComponents.CheckboxGroup,{...e,className:H(e.className,"flex flex-col gap-2"),children:[jsxRuntime.jsx(O,{children:e.label}),e.children,e.description&&jsxRuntime.jsx(w,{children:e.description}),jsxRuntime.jsx(f,{children:typeof e.errorMessage=="function"?void 0:e.errorMessage})]})}function Ln({isDisabled:e}){return `flex gap-2 items-center group text-sm transition ${e?"text-text-disabled":"text-text-caption"}`}function Vn({isSelected:e,isInvalid:o,isDisabled:t,isIndeterminate:r,variant:a="default"}){let n="w-5 h-5 flex-shrink-0 rounded-[var(--control-border-radius)] flex items-center justify-center border-2 transition ring-offset-2 focus:ring-2",i=a==="brand"?"focus:ring-action-brand":"focus:ring-action-default",s="";if(t)s="border-border-muted bg-background-muted";else if(o)s="border-feedback-error-border bg-feedback-error-background";else if(e||r){let d=a==="brand"?"action-brand":"action-default";s=`bg-${d} border-${d} hover:bg-${d}-hover hover:border-${d}-hover`;}else s="bg-background-input border-border-input hover:border-border-focus";return `${n} ${i} ${s}`}var nr="w-4 h-4 text-text-onPrimary group-disabled:text-text-disabled";function sr(e){let{children:o,variant:t="default",...r}=e;return jsxRuntime.jsx(reactAriaComponents.Checkbox,{...r,className:reactAriaComponents.composeRenderProps(e.className,(a,n)=>`${Ln(n)} ${a||""}`),children:a=>{let{isSelected:n,isIndeterminate:i,...s}=a,d=jsxRuntime.jsx("div",{className:Vn({isSelected:n,isIndeterminate:i,variant:t,...s}),children:i?jsxRuntime.jsx(lucideReact.Minus,{"aria-hidden":true,className:nr}):n?jsxRuntime.jsx(lucideReact.Check,{"aria-hidden":true,className:nr}):null});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,typeof o=="function"?o(a):o]})}})}function qu({name:e,defaultValue:o,errorBelow:t=false,...r}){let{control:a,formState:n}=reactHookForm.useFormContext(),i=D(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(sr,{...r,isSelected:!!s.value,onChange:d=>s.onChange(d),"aria-invalid":!!i,children:r.children}),t&&i&&jsxRuntime.jsx(f,{children:i})]})})}function Xu({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(ir,{...t,value:i.value||[],onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}function Ge(e){if(!e)return false;let o=e.startsWith("#")?e.slice(1):e;return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(o)}function co(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 ur({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:b="#000000",showColorSwatch:v=true,reserveErrorSpace:m=true,...p}){let[F,C]=Ne.useState(u||""),[y,E]=Ne.useState(c||u||""),[L,k]=Ne.useState(false),[R,T]=Ne.useState(null),{isFocused:K,handleFocus:I,handleBlur:te}=Ce(),A=c!==void 0?c:F;Ne.useEffect(()=>{c!==void 0&&E(c);},[c]);let se=A?!Ge(A):false,Y=Ne.useCallback(M=>{if(E(M),Ge(M)){let h=co(M);l?l(h):C(h);}else M===""&&(l?l(""):C(""));},[l]),q=Ne.useCallback(M=>{let h=co(M);E(h),l?l(h):C(h);},[l]),ie=Ne.useCallback(M=>{if(Ge(y)){let h=co(y);E(h),l&&h!==A?l(h):!l&&h!==F&&C(h);}te(M,p.onBlur);},[y,A,F,l,te,p.onBlur]);return jsxRuntime.jsx(reactAriaComponents.TextField,{...p,isRequired:n,className:H(s,"group flex flex-col"),children:({isDisabled:M})=>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(bt,{size:r,disabled:M,type:"text",value:y,placeholder:b,onFocus:h=>I(h,p.onFocus),onBlur:ie,onChange:h=>Y(h.target.value),className:tailwindMerge.twMerge(oe({isInvalid:se,isDisabled:M,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",Ge(A)?"border-border-default":"border-border-default bg-background-muted"),style:Ge(A)?{backgroundColor:A}:void 0,"aria-hidden":"true",children:!Ge(A)&&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:()=>k(!L),isDisabled:M,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(w,{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(w,{size:r,className:"mt-1",children:o}):null}),L&&R&&jsxRuntime.jsx(Ae,{triggerRef:{current:R},isOpen:L,onOpenChange:k,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:A||"#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:A||"#000000"}}),jsxRuntime.jsx("div",{className:"flex-1 text-text-body text-[length:var(--control-text-sm)] font-mono",children:A||"#000000"})]})]})})]})})}function bm({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(ur,{...t,value:i.value??"",onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n})})}function ai({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-onPrimary invalid:bg-feedback-error-border forced-colors:bg-[Highlight] forced-colors:invalid:bg-[Mark] forced-colors:text-[HighlightText]"):t.push("text-text-body hover:bg-background-hover pressed:bg-background-selected"),t.join(" ")}function mo({errorMessage:e,...o}){return jsxRuntime.jsxs(reactAriaComponents.Calendar,{...o,children:[jsxRuntime.jsx(pr,{}),jsxRuntime.jsxs(reactAriaComponents.CalendarGrid,{className:"border-separate [border-spacing:0] [&_td]:p-0 [&_td]:!border-0",children:[jsxRuntime.jsx(fr,{}),jsxRuntime.jsx(reactAriaComponents.CalendarGridBody,{children:t=>jsxRuntime.jsx(reactAriaComponents.CalendarCell,{date:t,className:({isSelected:r,isDisabled:a})=>`${ai({isSelected:r,isDisabled:a})} border-0`})})]}),e&&jsxRuntime.jsx(reactAriaComponents.Text,{slot:"errorMessage",className:"text-sm text-red-600",children:e})]})}function pr(){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-zinc-900 dark:text-zinc-200"}),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 fr(){return jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader,{children:e=>jsxRuntime.jsx(reactAriaComponents.CalendarHeaderCell,{className:"text-xs font-semibold text-text-caption",children:e})})}function fo({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,...b}){let[v,m]=Ne.useState(false),p=F=>{b.onChange&&F&&b.onChange(F),m(false);};return jsxRuntime.jsxs(reactAriaComponents.DateField,{...b,isDisabled:i,isRequired:n,isInvalid:s,className:H(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(gr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:v,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-muted hover:text-text-body 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(mo,{value:b.value,onChange:p,minValue:b.minValue,maxValue:b.maxValue,isDisabled:i,isReadOnly:b.isReadOnly,isDateUnavailable:b.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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})}function mi({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-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function gr({size:e="md",isDisabled:o,isInvalid:t,hasCalendar:r,className:a,...n}){return jsxRuntime.jsx(reactAriaComponents.DateInput,{className:tailwindMerge.twMerge(Xe({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:mi({isPlaceholder:i.isPlaceholder,isDisabled:!i.isEditable||o,size:e})})})}function Ym({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(fo,{...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),[b,v]=Ne.useState(false),[m,p]=Ne.useState(null),[F,C]=Ne.useState(e),y=Ne.useRef(null),E=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){v(true);try{let T=await i(R);C(T),t?.(T);}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{v(false);}}o?.(R,F);},L=async R=>{try{let T=R.items;if(T.length>0){let K=T[0];if(K.kind==="file"){let I=await K.getFile();I&&E(I);}}}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{l(false);}},k=()=>{C(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:L,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-muted"}),jsxRuntime.jsx("span",{className:"text-sm text-text-muted",children:"File uploaded"})]}),!n&&jsxRuntime.jsx(S,{variant:"icon",size:"sm",onPress:k,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-muted"}),jsxRuntime.jsxs("div",{className:"text-center",children:[jsxRuntime.jsx("p",{className:"text-sm text-text-body",children:c}),jsxRuntime.jsx("p",{className:"mt-1 text-xs text-text-muted",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&&E(T[0]);},children:jsxRuntime.jsx(S,{variant:"secondary",size:"sm",isDisabled:n,children:"Choose File"})})]}),b&&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-muted",children:"Uploading..."})]})})]}),m&&jsxRuntime.jsx("p",{className:"mt-2 text-sm text-feedback-error-text",children:m})]})}function cp({name:e,defaultValue:o,errorBelow:t=true,...r}){let{control:a,formState:n}=reactHookForm.useFormContext(),i=D(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 Ii=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 ho({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:b,handleFocus:v,handleBlur:m}=Ce();return jsxRuntime.jsx(reactAriaComponents.NumberField,{...u,id:l,isRequired:n,className:H(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:y=>v(y,u.onFocus),onBlur:y=>m(y,u.onBlur),className:Ii({isInvalid:F||!!t,isDisabled:p,isFocused:b,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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})})}function kp({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(ho,{...t,value:typeof i.value=="number"?i.value:void 0,onChange:s=>i.onChange(s),isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Tt({value:e,defaultValue:o,onChange:t,isDisabled:r,isReadOnly:a,isRequired:n,className:i,children:s,size:d="2",variant:c="default",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:H(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,b=>Ne__namespace.default.isValidElement(b)?Ne__namespace.default.cloneElement(b,{size:d,variant:c}):b)})}function Up({name:e,defaultValue:o,label:t,description:r,children:a,...n}){let{control:i,formState:s}=reactHookForm.useFormContext(),d=D(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(w,{children:r}),jsxRuntime.jsx(Tt,{...n,value:c.value,onChange:u=>c.onChange(u),children:a}),d&&jsxRuntime.jsx(f,{children:d})]})})}var Oi=Ne.createContext({variant:"brand"});function yo(e){let{variant:o="default",...t}=e;return jsxRuntime.jsx(Oi.Provider,{value:{variant:o},children:jsxRuntime.jsxs(reactAriaComponents.RadioGroup,{...t,className:H(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(w,{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 ff({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(yo,{...t,value:i.value,onChange:s=>i.onChange(s),errorMessage:n,children:t.children})})}var ji=e=>{let o=oe({isInvalid:e.isInvalid,isDisabled:e.isDisabled,isFocused:e.isFocused,transparent:e.transparent,size:e.size}),t=[e.showSearchIcon?"pl-8":"pl-3",e.isClearable&&e.hasValue||e.isPassword?"pr-8":"pr-3"].join(" ");return tailwindMerge.twMerge(o,t,e.className)};function st({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:b=true,isLoading:v=false,descriptionPlacement:m="below",...p}){let[F,C]=Ne__namespace.default.useState(false),{isFocused:y,handleFocus:E,handleBlur:L}=Ce(),k=u==="password",R=pt(v,300);return jsxRuntime.jsx(reactAriaComponents.TextField,{...p,isRequired:n,className:H(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 left-2 top-[45%] -translate-y-1/2 transform flex items-center z-10",children:R?jsxRuntime.jsx(Oe,{size:16,color:"text-text-muted"}):jsxRuntime.jsx(x,{name:"MagnifyingGlass",className:`h-4 w-4 transition-colors ${y?"text-action-brand":"text-text-muted"}`})}),jsxRuntime.jsx(bt,{size:r,disabled:T,type:k?F?"text":"password":u,value:p.value,defaultValue:p.defaultValue,placeholder:p.placeholder,onFocus:I=>E(I,p.onFocus),onBlur:I=>L(I,p.onBlur),onChange:I=>p.onChange?.(I.target.value),className:ji({isInvalid:K,isDisabled:T,isFocused:y,size:r,transparent:i,showSearchIcon:s,isClearable:d,hasValue:!!p.value,isPassword:k,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}),k&&!T&&jsxRuntime.jsx("button",{type:"button",onClick:()=>C(!F),className:"absolute right-3 top-1/2 -translate-y-1/2 transform text-text-muted hover:text-text-body","aria-label":F?"Hide password":"Show password",onMouseDown:I=>{I.preventDefault(),I.stopPropagation();},children:jsxRuntime.jsx(x,{name:F?"EyeSlash":"Eye",size:r==="sm"?16:20,className:"text-text-body"})})]}),b?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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})})}var ns={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"}},qe=({isActive:e=false,onPress:o,children:t})=>jsxRuntime.jsx(S,{variant:e?"secondary":"ghost",size:"sm",onPress:o,className:"p-1",children:t});function is({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(ze,{title:"Insert Link",onClose:t}),jsxRuntime.jsx("div",{className:"p-6",children:jsxRuntime.jsx(st,{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 Po({initialContent:e="",onChange:o,className:t,isDisabled:r=false,placeholder:a="Start typing...",id:n,size:i="md",headingLevels:s=[1,2]}){let d=ns[i],[c,u]=Ne.useState(false),l=react.useEditor({immediatelyRender:false,extensions:[ts__default.default.configure({heading:s.length>0?{levels:s}:false}),Xi__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")}}}),b=()=>{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(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:b,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(is,{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(qe,{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(qe,{isActive:l.isActive("bold"),onPress:()=>l.chain().focus().toggleBold().run(),children:jsxRuntime.jsx("span",{className:"text-xs font-bold",children:"B"})}),jsxRuntime.jsx(qe,{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(qe,{isActive:l.isActive("bulletList"),onPress:()=>l.chain().focus().toggleBulletList().run(),children:jsxRuntime.jsx(x,{name:"ListBullets",className:"h-4 w-4"})}),jsxRuntime.jsx(qe,{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(qe,{isActive:l.isActive("link"),onPress:b,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-muted",d.placeholderPos,d.placeholderText),children:a})]})]}):null}function Xf({name:e,defaultValue:o,label:t,description:r,reserveErrorSpace:a=true,...n}){let{control:i,formState:s}=reactHookForm.useFormContext(),d=D(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-heading",children:t}),r&&jsxRuntime.jsx("p",{className:"text-sm text-text-muted",children:r}),jsxRuntime.jsx(Po,{...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 ib({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(ro,{...t,selectedKey:i.value??null,onSelectionChange:s=>i.onChange(s),showErrors:!!n,errorMessage:n})})}var Co={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 fs({isSelected:e,isDisabled:o,variant:t="default",size:r="md"}){let a="flex px-px items-center shrink-0 cursor-default rounded-full transition duration-200 ease-in-out shadow-inner border border-transparent",n=Co[r].track,i=we,s=t==="brand"?"focus-visible:outline-action-brand":"focus-visible:outline-action-default",d="";return e?t==="brand"?d="bg-action-brand forced-colors:!bg-[Highlight] group-pressed:bg-action-brand-hover":d="bg-action-default forced-colors:!bg-[Highlight] group-pressed:bg-action-default-hover":d="bg-gray-400 dark:bg-zinc-400 group-pressed:bg-gray-500 dark:group-pressed:bg-zinc-300",[a,n,i,s,d,o?"bg-gray-200 dark:bg-zinc-700 forced-colors:group-selected:!bg-[GrayText] forced-colors:border-[GrayText]":""].filter(Boolean).join(" ")}function bs({isSelected:e,isDisabled:o,size:t="md"}){let r="transform rounded-full bg-white dark:bg-zinc-900 outline-none shadow transition duration-200 ease-in-out",a=Co[t].handle;return [r,a,e?"translate-x-[100%]":"translate-x-0",o?"forced-colors:outline-[GrayText]":""].filter(Boolean).join(" ")}function Ro({children:e,variant:o="default",size:t="md",...r}){return jsxRuntime.jsx(reactAriaComponents.Switch,{...r,className:H(r.className,`group flex items-center gap-2 ${Co[t].text} text-gray-800 transition disabled:text-gray-300 dark:text-zinc-200 dark:disabled:text-zinc-600 forced-colors:disabled:text-[GrayText]`),children:a=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:fs({...a,variant:o,size:t}),children:jsxRuntime.jsx("span",{className:bs({...a,size:t})})}),e]})})}function hb({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(Ro,{...t,isSelected:!!a.value,onChange:n=>a.onChange(n),children:t.children})})}var Ps=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 So({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:b=true,...v}){let{isFocused:m,handleFocus:p,handleBlur:F}=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:C=>{v.onFocus&&v.onFocus(C),p(C);},onBlur:C=>{v.onBlur&&v.onBlur(C),F(C);},className:Ps({isInvalid:s,isDisabled:d,isResizable:c,isFocused:m,size:r,transparent:i,className:u}),disabled:d})}),b?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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})})}function Bb({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(So,{...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 Ab({name:e,defaultValue:o,...t}){let{control:r,formState:a}=reactHookForm.useFormContext(),n=D(a.errors,e);return jsxRuntime.jsx(reactHookForm.Controller,{control:r,name:e,defaultValue:o,render:({field:i})=>jsxRuntime.jsx(st,{...t,value:i.value??"",onChange:s=>i.onChange(s),onBlur:s=>{i.onBlur(),t.onBlur?.(s);},isInvalid:!!n,errorMessage:n,isRequired:t.isRequired})})}function Bs({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-placeholder italic":"text-text-body",o?"text-text-disabled cursor-not-allowed":"cursor-text",!o&&"hover:bg-background-hover","data-[focused]:bg-background-selected data-[focused]:text-text-body")}function To({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",...b}){return jsxRuntime.jsxs(reactAriaComponents.TimeField,{...b,isDisabled:i,isRequired:n,isInvalid:s,className:H(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(Xe({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:Bs({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(w,{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(w,{size:r,className:"mt-1",children:o}):null})]})}function rg({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(To,{...o,value:i.value,onChange:i.onChange,isInvalid:!!a,errorMessage:n})})}function lg({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 pg({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 vg({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(gt,{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(xt,{children:t(u)})]},c.id)),jsxRuntime.jsx("div",{children:jsxRuntime.jsx(S,{variant:"secondary",onPress:()=>i(r?.()||{}),children:"Add item"})})]})}function wo(e){return jsxRuntime.jsx(reactAriaComponents.Form,{validationBehavior:"aria",...e,className:tailwindMerge.twMerge("flex flex-col gap-6",e.className)})}function Ir(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 $g({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&&Ir(l);}t?.(c,u);};return jsxRuntime.jsx(reactHookForm.FormProvider,{...s,children:jsxRuntime.jsx(wo,{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-muted",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 Og({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 Ug(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 jg({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=lg;exports.FieldArrayList=vg;exports.FormAutocomplete=wu;exports.FormCheckbox=qu;exports.FormCheckboxGroup=Xu;exports.FormColorField=bm;exports.FormDateField=Ym;exports.FormFileUpload=cp;exports.FormNumberField=kp;exports.FormProvider=$g;exports.FormRadioCardGroup=Up;exports.FormRadioGroup=ff;exports.FormRichTextEditor=Xf;exports.FormSaveBar=Og;exports.FormSelect=ib;exports.FormSwitch=hb;exports.FormTextArea=Bb;exports.FormTextField=Ab;exports.FormTimeField=rg;exports.SubmitButton=pg;exports.focusFirstError=Ir;exports.useAutoSave=jg;exports.useScrollIntoViewOnError=Ug;//# sourceMappingURL=index.cjs.map
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,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(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 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(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 w({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-action-destructive text-[color:var(--color-action-destructive-text)] hover:bg-action-destructive-hover forced-colors:bg-[Mark] forced-colors:text-[MarkText] border-2 border-transparent",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-action-destructive text-[color:var(--color-action-destructive-text)] hover:bg-action-destructive-hover forced-colors:bg-[Mark] forced-colors:text-[MarkText] border-2 border-transparent"};function Va(e){return !e||e==="default"||e==="brand"?"primary":e}function Ba(e){let{variant:o="primary",size:t="md",isDisabled:r,fullWidth:a=false,isLoading:n=false}=e,i=Va(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:v="top-right",style:m,target:p,rel:F,...C}=e,y=o?jsxRuntime.jsx(x,{name:o,size:i,weight:d}):null,B=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(x,{name:"CircleNotch",size:i,className:"animate-spin","aria-hidden":"true"})}),jsxRuntime.jsx("div",{className:"invisible","aria-hidden":"true",children:B}),a&&jsxRuntime.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a})]}),k=(l??0)>0,R=tailwindMerge.twMerge(Ba(e),u),T=c?{href:c,target:p,rel:F,...C}:{};if(c){let{onPress:I,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:k?void 0:m,className:R,children:r?D:typeof t=="function"?(function(I){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&y,t(I),s==="right"&&y]})}):B}):jsxRuntime.jsx(reactAriaComponents.Button,{...C,...r&&{"aria-busy":true},style:k?void 0:m,className:R,children:r?D:typeof t=="function"?(function(I){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s==="left"&&y,t(I),s==="right"&&y]})}):B});return k?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 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[v,m]=we.useState(d===0);if(we.useEffect(()=>{if(d>0){let k=setTimeout(()=>m(true),d);return ()=>clearTimeout(k)}},[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)]",F=c&&e?(()=>{let k=typeof e=="number"?e:parseFloat(String(e));return isNaN(k)?"":`animation-duration-[${Math.max(.8,k/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}`:"",y="rounded-sm";t==="circle"&&(y="rounded-full"),t==="text"&&(y="h-4 w-full rounded-sm");let B=n?"flex-1 min-w-0":"",D=s?Object.entries(s).map(([k,R])=>`${k}:w-[${R}]`).join(" "):"";return i?jsxRuntime.jsx("div",{className:"space-y-2","data-testid":g,children:i.map((k,R)=>jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(p,C,y,B,D,l),style:{width:k,height:o}},R))}):jsxRuntime.jsx("div",{className:tailwindMerge.twMerge(p,C,y,B,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 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=Xo;pe.Content=vt;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:v,maxHeight:m="80vh",height:p,maxWidth:F="640px",contentPadding:C=true,showHandle:y=true,animationVariant:B="scale",className:D}){let[k,R]=we.useState(false),[T,K]=we.useState(0),[I,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 ye=o||t,Ce=l||g||v;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",I&&"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",B==="scale"?"animate-[tray-enter-scale_400ms_cubic-bezier(0.32,0.72,0,1)]":"animate-[tray-enter_400ms_cubic-bezier(0.32,0.72,0,1)]",B==="scale"?"data-[exiting]:animate-[tray-exit-scale_250ms_cubic-bezier(0.32,0,0.67,0)]":"data-[exiting]:animate-[tray-exit_250ms_cubic-bezier(0.32,0,0.67,0)]",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:[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: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",k&&"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",C?"p-4":"p-0"),children:e}),Ce&&jsxRuntime.jsx(Yt,{primaryAction:l,secondaryAction:g,footerContent:v})]})})})})})}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:v,isRequired:m,transparent:p,reserveErrorSpace:F=false,placement:C="bottom start",shouldFlip:y=true,menuWidth:B="match",descriptionPlacement:D="below",useMobileTray:k=true,...R}){let[T,K]=we.useState(null),[I,te]=we.useState(null),[M,se]=we.useState(false),Y=d??T??c,{handleFocus:q,handleBlur:ie}=fn(),{isMobile:A}=pt(),h=k&&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),ye=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&&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(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(w,{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(w,{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:B==="match"&&I?`${I}px`:void 0,minWidth:B==="auto"&&I?`${I}px`:void 0,maxWidth:B==="auto"?"min(600px, 90vw)":void 0},placement:C,shouldFlip:y,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:v,isDisabled:m,isInvalid:p,validationResult:F,showErrors:C=true,renderItem:y,renderLeftIcon:B,renderSection:D,autoFocus:k=false,reserveErrorSpace:R=false,hideChevron:T=false,useMobileTray:K=true,className:I}){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:ye}=mt({sensitivity:"base"}),[Ce,b]=we.useState(),{isMobile:U}=pt(),z=K&&U,X=W[l].text,ge=reactStately.useAsyncList({async load({signal:N,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,N):ee=await kn(i,E,N),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(()=>{k&&h(true);},[k]),we.useEffect(()=>{let N=so(r,o,t);N!==q&&ie(N);},[r,o,t]),we.useEffect(()=>{let N=()=>{te.current&&Y(te.current.offsetWidth);};return N(),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[]),we.useEffect(()=>{le===""?Ye.current="":Q&&le!==Ye.current&&(Ye.current=le,Q.setFilterText(le));},[le,Q]),Le=ft(!!Q?.isLoading,300);let Vo=we__namespace.default.useMemo(()=>{if(!z||!q)return Q?Q.items:o;let N=Q?Q.items:o,E=s||ye;return N.filter(ee=>E(ee.name,q))},[z,q,Q,o,s,ye]),dt=N=>{let E=so(N,o,t);ie(E),n&&n(N);},Et=N=>{ie(N);},Bo=()=>{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(N=>N.items):o,items:Q?Q.items:void 0,className:_(I,"group flex flex-col w-full"),menuTrigger:z?"manual":"focus",isDisabled:m,isInvalid:p||!!c,inputValue:q,onInputChange:Et,autoFocus:k&&!z,defaultFilter:s||ye,"aria-label":e||d||"Autocomplete",children:N=>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:[B?jsxRuntime.jsx("div",{className:"pointer-events-none absolute left-3 top-[45%] -translate-y-1/2 z-10",children:B(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:N.isOpen),size:l,className:tailwindMerge.twMerge(wn[l],q&&!m||!T&&!q?"pr-10":"pr-3",z&&"cursor-pointer",I)}),placeholder:d,disabled:m,onFocus:E=>{h(true),z&&(E.currentTarget.blur(),Bo());},onBlur:()=>{h(false);},onClick:z?Bo: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(w,{size:l,children:u}):null}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u&&jsxRuntime.jsx(w,{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:y?y(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:y?y(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:N=>Et(N.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:Vo,selectedKeys:r?[r]:[],selectionMode:"single",onSelectionChange:N=>{let E=Array.from(N)[0];E&&(dt(E),Fe(false));},className:"bg-background-input outline-none",children:N=>jsxRuntime.jsx(Te,{id:N.id,textValue:N.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(N):N.name},N.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(w,{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:v=true,reserveErrorSpace:m=true,...p}){let[F,C]=we.useState(u||""),[y,B]=we.useState(c||u||""),[D,k]=we.useState(false),[R,T]=we.useState(null),{isFocused:K,handleFocus:I,handleBlur:te}=Re(),M=c!==void 0?c:F;we.useEffect(()=>{c!==void 0&&B(c);},[c]);let se=M?!We(M):false,Y=we.useCallback(A=>{if(B(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);B(h),l?l(h):C(h);},[l]),ie=we.useCallback(A=>{if(We(y)){let h=mo(y);B(h),l&&h!==M?l(h):!l&&h!==F&&C(h);}te(A,p.onBlur);},[y,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:y,placeholder:g,onFocus:h=>I(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}),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(S,{variant:"secondary",size:r,icon:"Palette",onPress:()=>k(!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(w,{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(w,{size:r,className:"mt-1",children:o}):null}),D&&R&&jsxRuntime.jsx(Ae,{triggerRef:{current:R},isOpen:D,onOpenChange:k,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[v,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(vr,{size:r,isDisabled:i,isInvalid:s,hasCalendar:d}),d&&!i&&jsxRuntime.jsxs(reactAriaComponents.DialogTrigger,{isOpen:v,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(w,{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(w,{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(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,v]=we.useState(false),[m,p]=we.useState(null),[F,C]=we.useState(e),y=we.useRef(null),B=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){v(true);try{let T=await i(R);C(T),t?.(T);}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{v(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 I=await K.getFile();I&&B(I);}}}catch(T){p("Failed to upload file"),console.error("Upload error:",T);}finally{l(false);}},k=()=>{C(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:[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:k,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&&B(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 yo({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:v,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:y=>v(y,u.onFocus),onBlur:y=>m(y,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(w,{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(w,{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(yo,{...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(w,{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(w,{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-8":"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[F,C]=we__namespace.default.useState(false),{isFocused:y,handleFocus:B,handleBlur:D}=Re(),k=u==="password",R=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 left-2 top-[45%] -translate-y-1/2 transform flex items-center z-10",children:R?jsxRuntime.jsx(Ge,{size:16,color:"text-text-secondary"}):jsxRuntime.jsx(x,{name:"MagnifyingGlass",className:`h-4 w-4 transition-colors ${y?"text-action-brand":"text-text-secondary"}`})}),jsxRuntime.jsx(xt,{size:r,disabled:T,type:k?F?"text":"password":u,value:p.value,defaultValue:p.defaultValue,placeholder:p.placeholder,onFocus:I=>B(I,p.onFocus),onBlur:I=>D(I,p.onBlur),onChange:I=>p.onChange?.(I.target.value),className:ts({isInvalid:K,isDisabled:T,isFocused:y,size:r,transparent:i,showSearchIcon:s,isClearable:d,hasValue:!!p.value,isPassword:k,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}),k&&!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:I=>{I.preventDefault(),I.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(w,{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(w,{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);},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(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: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(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 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=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: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(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,...v}){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",{...v,required:n,onFocus:C=>{v.onFocus&&v.onFocus(C),p(C);},onBlur:C=>{v.onBlur&&v.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(w,{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(w,{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: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(w,{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(w,{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 yb({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 Vb({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(vt,{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=yb;exports.FieldArrayList=Vb;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