@embedreach/components 0.2.18 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/index.js +11 -13
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -91,7 +91,7 @@ function IQ(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=
|
|
|
91
91
|
*
|
|
92
92
|
* This source code is licensed under the MIT license found in the
|
|
93
93
|
* LICENSE file in the root directory of this source tree.
|
|
94
|
-
*/$ae.exports="production"===process.env.NODE_ENV?function(){if(Uae)return Vae;Uae=1;var e="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},t=n.useState,r=n.useEffect,o=n.useLayoutEffect,i=n.useDebugValue;function a(t){var n=t.getSnapshot;t=t.value;try{var r=n();return!e(t,r)}catch(o){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,n){var s=n(),l=t({inst:{value:s,getSnapshot:n}}),c=l[0].inst,u=l[1];return o((function(){c.value=s,c.getSnapshot=n,a(c)&&u({inst:c})}),[e,s,n]),r((function(){return a(c)&&u({inst:c}),e((function(){a(c)&&u({inst:c})}))}),[e]),i(s),s};return Vae.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:s,Vae}():(Bae||(Bae=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(o){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=n,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useState,i=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue,l=!1,c=!1,u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(n,u){l||void 0===t.startTransition||(l=!0);var d=u();if(!c){var p=u();r(d,p)||(c=!0)}var f=(p=o({inst:{value:d,getSnapshot:u}}))[0].inst,h=p[1];return a((function(){f.value=d,f.getSnapshot=u,e(f)&&h({inst:f})}),[n,d,u]),i((function(){return e(f)&&h({inst:f}),n((function(){e(f)&&h({inst:f})}))}),[n]),s(d),d};zae.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:u,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),zae);var Hae=$ae.exports,qae='[cmdk-group=""]',Gae='[cmdk-group-items=""]',Kae='[cmdk-item=""]',Wae=`${Kae}:not([aria-disabled="true"])`,Yae="cmdk-item-select",Xae="data-value",Zae=(e,t,n)=>Fae(e,t,n),Qae=i.createContext(void 0),Jae=()=>i.useContext(Qae),ese=i.createContext(void 0),tse=()=>i.useContext(ese),nse=i.createContext(void 0),rse=i.forwardRef(((e,t)=>{let n=vse((()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",filtered:{count:0,items:new Map,groups:new Set}}})),r=vse((()=>new Set)),o=vse((()=>new Map)),a=vse((()=>new Map)),s=vse((()=>new Set)),l=mse(e),{label:c,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=EJ(),x=EJ(),w=EJ(),_=i.useRef(null),S=wse();gse((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,E.emit()}}),[d]),gse((()=>{S(6,O)}),[]);let E=i.useMemo((()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,i,a;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)R(),A(),S(1,N);else if("value"===e&&(r||S(5,O),void 0!==(null==(o=l.current)?void 0:o.value))){return void(null==(a=(i=l.current).onValueChange)||a.call(i,null!=t?t:""))}E.emit()}},emit:()=>{s.current.forEach((e=>e()))}})),[]),T=i.useMemo((()=>({value:(e,t,r)=>{var o;t!==(null==(o=a.current.get(e))?void 0:o.value)&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),S(2,(()=>{A(),E.emit()})))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),S(3,(()=>{R(),A(),n.current.value||N(),E.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();S(4,(()=>{R(),(null==t?void 0:t.getAttribute("id"))===e&&N(),E.emit()}))}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{a.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:w,labelId:x,listInnerRef:_})),[]);function C(e,t){var r,o;let i=null!=(o=null==(r=l.current)?void 0:r.filter)?o:Zae;return e?i(e,n.current.search,t):0}function A(){if(!n.current.search||!1===l.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach((n=>{let r=o.current.get(n),i=0;r.forEach((t=>{let n=e.get(t);i=Math.max(n,i)})),t.push([n,i])}));let r=_.current;k().sort(((t,n)=>{var r,o;let i=t.getAttribute("id"),a=n.getAttribute("id");return(null!=(r=e.get(a))?r:0)-(null!=(o=e.get(i))?o:0)})).forEach((e=>{let t=e.closest(Gae);t?t.appendChild(e.parentElement===t?e:e.closest(`${Gae} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Gae} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{var t;let n=null==(t=_.current)?void 0:t.querySelector(`${qae}[${Xae}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function N(){let e=k().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(Xae);E.setState("value",t||void 0)}function R(){var e,t,i,s;if(!n.current.search||!1===l.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let c=0;for(let o of r.current){let r=C(null!=(t=null==(e=a.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(i=a.current.get(o))?void 0:i.keywords)?s:[]);n.current.filtered.items.set(o,r),r>0&&c++}for(let[r,a]of o.current)for(let e of a)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(r);break}n.current.filtered.count=c}function O(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(qae))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=_.current)?void 0:e.querySelector(`${Kae}[aria-selected="true"]`)}function k(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(Wae))||[])}function M(e){let t=k()[e];t&&E.setState("value",t.getAttribute(Xae))}function j(e){var t;let n=P(),r=k(),o=r.findIndex((e=>e===n)),i=r[o+e];null!=(t=l.current)&&t.loop&&(i=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),i&&E.setState("value",i.getAttribute(Xae))}function L(e){let t,n=P(),r=null==n?void 0:n.closest(qae);for(;r&&!t;)r=e>0?fse(r,qae):hse(r,qae),t=null==r?void 0:r.querySelector(Wae);t?E.setState("value",t.getAttribute(Xae)):j(e)}let D=()=>M(k().length-1),I=e=>{e.preventDefault(),e.metaKey?D():e.altKey?L(1):j(1)},F=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?L(-1):j(-1)};return i.createElement(WQ.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=y.onKeyDown)||t.call(y,e),!e.defaultPrevented)switch(e.key){case"n":case"j":v&&e.ctrlKey&&I(e);break;case"ArrowDown":I(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),D();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=P();if(t){let e=new Event(Yae);t.dispatchEvent(e)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Sse},c),_se(e,(e=>i.createElement(ese.Provider,{value:E},i.createElement(Qae.Provider,{value:T},e)))))})),ose=i.forwardRef(((e,t)=>{var n,r;let o=EJ(),a=i.useRef(null),s=i.useContext(nse),l=Jae(),c=mse(e),u=null!=(r=null==(n=c.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;gse((()=>{if(!u)return l.item(o,null==s?void 0:s.id)}),[u]);let d=xse(o,a,[e.value,e.children,a],e.keywords),p=tse(),f=bse((e=>e.value&&e.value===d.current)),h=bse((e=>!(!u&&!1!==l.filter())||(!e.search||e.filtered.items.get(o)>0)));function m(){var e,t;g(),null==(t=(e=c.current).onSelect)||t.call(e,d.current)}function g(){p.setState("value",d.current,!0)}if(i.useEffect((()=>{let t=a.current;if(t&&!e.disabled)return t.addEventListener(Yae,m),()=>t.removeEventListener(Yae,m)}),[h,e.onSelect,e.disabled]),!h)return null;let{disabled:v,value:y,onSelect:b,forceMount:x,keywords:w,..._}=e;return i.createElement(WQ.div,{ref:yse([a,t]),..._,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)})),ise=i.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,s=EJ(),l=i.useRef(null),c=i.useRef(null),u=EJ(),d=Jae(),p=bse((e=>!(!o&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));gse((()=>d.group(s)),[]),xse(s,l,[e.value,e.heading,c]);let f=i.useMemo((()=>({id:s,forceMount:o})),[o]);return i.createElement(WQ.div,{ref:yse([l,t]),...a,"cmdk-group":"",role:"presentation",hidden:!p||void 0},n&&i.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),_se(e,(e=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},i.createElement(nse.Provider,{value:f},e)))))})),ase=i.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=i.useRef(null),a=bse((e=>!e.search));return n||a?i.createElement(WQ.div,{ref:yse([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),sse=i.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=tse(),s=bse((e=>e.search)),l=bse((e=>e.value)),c=Jae(),u=i.useMemo((()=>{var e;let t=null==(e=c.listInnerRef.current)?void 0:e.querySelector(`${Kae}[${Xae}="${encodeURIComponent(l)}"]`);return null==t?void 0:t.getAttribute("id")}),[]);return i.useEffect((()=>{null!=e.value&&a.setState("search",e.value)}),[e.value]),i.createElement(WQ.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":u,id:c.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||a.setState("search",e.target.value),null==n||n(e.target.value)}})})),lse=i.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=i.useRef(null),s=i.useRef(null),l=Jae();return i.useEffect((()=>{if(s.current&&a.current){let e,t=s.current,n=a.current,r=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{n.style.setProperty("--cmdk-list-height",t.offsetHeight.toFixed(1)+"px")}))}));return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}}),[]),i.createElement(WQ.div,{ref:yse([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},_se(e,(e=>i.createElement("div",{ref:yse([s,l.listInnerRef]),"cmdk-list-sizer":""},e))))})),cse=i.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:s,...l}=e;return i.createElement(hB,{open:n,onOpenChange:r},i.createElement(mB,{container:s},i.createElement(gB,{"cmdk-overlay":"",className:o}),i.createElement(vB,{"aria-label":e.label,"cmdk-dialog":"",className:a},i.createElement(rse,{ref:t,...l}))))})),use=i.forwardRef(((e,t)=>bse((e=>0===e.filtered.count))?i.createElement(WQ.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),dse=i.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return i.createElement(WQ.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},_se(e,(e=>i.createElement("div",{"aria-hidden":!0},e))))})),pse=Object.assign(rse,{List:lse,Item:ose,Input:sse,Group:ise,Separator:ase,Dialog:cse,Empty:use,Loading:dse});function fse(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function hse(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mse(e){let t=i.useRef(e);return gse((()=>{t.current=e})),t}var gse="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function vse(e){let t=i.useRef();return void 0===t.current&&(t.current=e()),t}function yse(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function bse(e){let t=tse(),n=()=>e(t.snapshot());return Hae.useSyncExternalStore(t.subscribe,n,n)}function xse(e,t,n,r=[]){let o=i.useRef(),a=Jae();return gse((()=>{var i;let s=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),l=r.map((e=>e.trim()));a.value(e,s,l),null==(i=t.current)||i.setAttribute(Xae,s),o.current=s})),o}var wse=()=>{let[e,t]=i.useState(),n=vse((()=>new Map));return gse((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function _se({asChild:e,children:t},n){return e&&i.isValidElement(t)?i.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},n(t.props.children)):n(t)}var Sse={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ese=i.forwardRef((({className:e,...n},r)=>t.jsx(pse,{ref:r,className:Zd("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})));Ese.displayName=pse.displayName;const Tse=i.forwardRef((({className:e,searchIcon:n,...r},o)=>t.jsxs("div",{className:"flex items-center border-b px-3",children:[n||t.jsx(Bu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),t.jsx(pse.Input,{ref:o,className:Zd("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})));Tse.displayName=pse.Input.displayName;const Cse=i.forwardRef((({className:e,...n},r)=>t.jsx(pse.List,{ref:r,className:Zd("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n})));Cse.displayName=pse.List.displayName;const Ase=i.forwardRef(((e,n)=>t.jsx(pse.Empty,{ref:n,className:"py-6 text-center text-sm",...e})));Ase.displayName=pse.Empty.displayName;const Nse=i.forwardRef((({className:e,...n},r)=>t.jsx(pse.Group,{ref:r,className:Zd("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...n})));Nse.displayName=pse.Group.displayName;const Rse=i.forwardRef((({className:e,...n},r)=>t.jsx(pse.Separator,{ref:r,className:Zd("-mx-1 h-px bg-border",e),...n})));Rse.displayName=pse.Separator.displayName;const Ose=i.forwardRef((({className:e,...n},r)=>t.jsx(pse.Item,{ref:r,className:Zd("relative flex cursor-pointer gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...n})));Ose.displayName=pse.Item.displayName;const Pse=({data:e,placeholder:n,searchPlaceholder:r,noResultsMessage:o,value:a,setValue:s})=>{const[l,c]=i.useState(!1);return t.jsxs(Z6,{open:l,onOpenChange:c,modal:!0,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",role:"combobox","aria-expanded":l,className:"w-full max-w-[200px] justify-between bg-background",children:[a?e.find((e=>e.value===a))?.label:n,t.jsx(vu,{className:"opacity-50"})]})}),t.jsx(J6,{className:"w-[200px] p-0",children:t.jsxs(Ese,{children:[t.jsx(Tse,{placeholder:r,className:"h-9"}),t.jsxs(Cse,{children:[t.jsx(Ase,{children:o}),t.jsx(Nse,{children:e.map((e=>t.jsxs(Ose,{value:e.value,onSelect:e=>{s(e===a?"":e),c(!1)},children:[e.label,t.jsx(pu,{className:Zd("ml-auto",a===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},kse=({setScheduleTime:e,setTimezone:n,timezone:r,scheduleTime:o,setIsDirty:a})=>{const[s,l]=i.useState(o&&o<(new Date).toISOString()?"Please select a time in the future":null),[c,u]=i.useState(o?o9(new Date(o),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),p=t=>{const n=v8(new Date,15);new Date(t.toLocaleString("en-US",{timeZone:r}))<new Date(n.toLocaleString("en-US",{timeZone:r}))?l("Please select a time at least 15 minutes in the future"):(l(null),e(t.toISOString()),a(!0))};return t.jsx("div",{className:"w-full @container/schedule-time",children:t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsxs("div",{className:"flex gap-2 w-full @xl/schedule-time:flex-row flex-col items-center justify-center",children:[t.jsxs(Z6,{children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",className:Zd("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[t.jsx(du,{className:"mr-2 h-4 w-4"}),o?o9(new Date(o),"PPP"):t.jsx("span",{children:"Pick a date"})]})}),t.jsx(J6,{className:"w-auto p-0 z-[60] pointer-events-auto",children:t.jsx(Oae,{mode:"single",selected:o?new Date(o):void 0,onSelect:e=>{if(!e)return;const[t,n]=c.split(":").map(Number);e.setHours(t,n),p(e)},disabled:e=>{const t=new Date;return t.setHours(0,0,0,0),e<t},initialFocus:!0})})]}),t.jsx("input",{type:"time",value:c,onChange:e=>{if(u(e.target.value),o&&e.target.value){const[t,n]=e.target.value.split(":").map(Number),r=new Date(o);r.setHours(t,n),p(r)}},className:Zd("flex h-9 w-full sm:w-[150px] rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s&&"border-red-500")}),t.jsx(Pse,{data:d,placeholder:"Select timezone...",searchPlaceholder:"Search timezone...",noResultsMessage:"No timezone found",value:r,setValue:e=>{const t=new Date(o||(new Date).toISOString()),r=v8(new Date,15);t<new Date(r.toLocaleString("en-US",{timeZone:e}))?l("Please select a time at least 15 minutes in the future"):(l(null),n(e),a(!0))}})]}),s&&t.jsxs("p",{className:"text-destructive text-sm mt-2 flex items-center",children:[t.jsx("span",{className:"mr-2",children:"⚠️"}),s]})]})})},Mse=({title:e="Edit Schedule Time",autoSave:r=!1})=>{const o=aZ(),{updateAutomation:i}=Le(o?.id||""),{toast:a}=jl(),[s,l]=n.useState(null),[c,u]=n.useState(o?.triggerMetadata?.triggerType===Fe.ONE_TIME?o?.triggerMetadata?.scheduledAt:null),[d,p]=n.useState(o?.triggerMetadata?.triggerType===Fe.ONE_TIME&&o?.triggerMetadata?.timezone||"America/New_York"),[f,h]=n.useState(!1),m=n.useCallback((()=>{if("sendNow"===s)i({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:new Date(Date.now()+3e5).toISOString()}}),a({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),h(!1);else{if(!c||!d)return;i({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:c,timezone:d}}),a({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),h(!1)}}),[s,c,d,i,a]);return n.useEffect((()=>{}),[o]),n.useEffect((()=>{r&&f&&(m(),h(!1))}),[r,f,m]),o?t.jsx(Ore,{title:e,headerActions:r?void 0:t.jsx(vZ,{onClick:m,disabled:!f,children:"Save"}),children:t.jsx("div",{className:"@container flex-1 mx-4",children:t.jsxs("div",{className:"flex @[1000px]:flex-row flex-col gap-8 items-center",children:[t.jsxs("div",{className:"flex-1 w-full",children:[t.jsxs("div",{className:"grid grid-cols-1 @[480px]:grid-cols-2 gap-4",children:[t.jsx(xZ,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(wZ.SendButton,{className:"text-primary"}),onClick:()=>{l("sendNow"),u(new Date(Date.now()+3e5).toISOString()),p("America/New_York"),h(!0)}}),t.jsx(xZ,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(wZ.ScheduleButton,{className:"text-primary"}),onClick:()=>l("schedule")})]}),t.jsx(zB,{children:"schedule"===s&&t.jsx(mZ,{className:"overflow-hidden mt-8",children:t.jsx("div",{className:"bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center",children:t.jsx(kse,{setScheduleTime:u,setTimezone:p,timezone:d,scheduleTime:c,setIsDirty:h})})})})]}),c&&t.jsxs(AX.div,{initial:{opacity:0,y:10,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.6,ease:[.23,1,.32,1],delay:.1},className:"@[1000px]:w-80 max-w-md w-full shrink-0 h-fit p-4 bg-blue-50 rounded-xl border border-blue-100 backdrop-blur-sm",children:[t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:.3,duration:.4},className:"text-sm font-medium text-gray-700",children:"Currently scheduled for:"}),t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:d||void 0})})]})]})})}):null},jse=()=>t.jsx("div",{children:t.jsx(Mse,{title:"Set Schedule Time",autoSave:!0})});var Lse=(e=>(e.DAYS="days",e))(Lse||{});const Dse={[oZ.EQUALS]:"Equals",[oZ.NOT_EQUALS]:"Not Equals",[oZ.GREATER_THAN]:"Greater Than",[oZ.LESS_THAN]:"Less Than",[oZ.EXISTS]:"Exists",[oZ.EQUALS_MONTH_DAY]:"Month and Day Matches",[oZ.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[oZ.BETWEEN_MONTH_DAY]:"Between Month Day",[oZ.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[oZ.ARRAY_CONTAINS]:"List Contains"},Ise={email:"Email",phone:"Phone",firstName:"First Name",lastName:"Last Name"},Fse=({options:e,value:n,onChange:r,placeholder:o})=>{const[a,s]=i.useState(!1);return t.jsxs(Z6,{modal:!0,open:a,onOpenChange:s,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(vZ,{"aria-expanded":a,className:"w-[200px] overflow-hidden justify-between",variant:"outline",children:[n?e.find((e=>e.value===n))?.label:o,t.jsx(vu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(J6,{className:"w-[200px] p-0",children:t.jsxs(Ese,{children:[t.jsx(Tse,{placeholder:`${o}...`}),t.jsxs(Cse,{children:[t.jsxs(Ase,{children:["No ",o.toLowerCase()," found."]}),t.jsx(Nse,{children:e.map((e=>t.jsxs(Ose,{value:e.value,onSelect:e=>{r(e===n?"":e),s(!1)},children:[t.jsx(pu,{className:Zd("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var Use=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find(Bse);if(s){const e=s.props.children,r=a.map((t=>t===s?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx($se,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx($se,{...o,ref:n,children:r})}));Use.displayName="Slot";var $se=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?YU(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));$se.displayName="SlotClone";var Vse=({children:e})=>t.jsx(t.Fragment,{children:e});function Bse(e){return i.isValidElement(e)&&e.type===Vse}var zse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,n)=>{const r=i.forwardRef(((e,r)=>{const{asChild:o,...i}=e,a=o?Use:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...i,ref:r})}));return r.displayName=`Primitive.${n}`,{...e,[n]:r}}),{}),Hse="horizontal",qse=["horizontal","vertical"],Gse=i.forwardRef(((e,n)=>{const{decorative:r,orientation:o=Hse,...i}=e,a=function(e){return qse.includes(e)}(o)?o:Hse;return t.jsx(zse.div,{"data-orientation":a,...r?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...i,ref:n})}));Gse.displayName="Separator";var Kse=Gse;const Wse=i.forwardRef((({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>t.jsx(Kse,{ref:i,decorative:r,orientation:n,className:Zd("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",e),...o})));Wse.displayName=Kse.displayName;const Yse=ru("m-1 transition ease-in-out delay-150 duration-300",{variants:{variant:{default:"border-foreground/10 text-foreground bg-card hover:bg-card/80",secondary:"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",inverted:"inverted"}},defaultVariants:{variant:"default"}}),Xse=i.forwardRef((({options:e,onValueChange:n,variant:r,placeholder:o="Select options",animation:a=0,maxCount:s=3,modalPopover:l=!0,className:c,extraCommandItems:u,searchPlaceholder:d="Search...",handleSearchInput:p,emptyMessage:f="No results found.",searchIcon:h=t.jsx(Bu,{className:"h-4 w-4 mr-2"}),selectedValues:m,setSelectedValues:g,...v},y)=>{const[b,x]=i.useState(!1),[w,_]=i.useState(!1),S=e=>{const t=m.includes(e)?m.filter((t=>t!==e)):[...m,e];g(t),n(t)},E=()=>{g([]),n([])};return t.jsxs(Z6,{open:b,onOpenChange:x,modal:l,children:[t.jsx(Q6,{asChild:!0,children:t.jsx("button",{type:"button",ref:y,...v,onClick:()=>{x((e=>!e))},className:Zd("flex w-full p-1 rounded-md border min-h-9 h-auto items-center justify-between bg-white hover:bg-gray-50 [&_svg]:pointer-events-auto data-[state=open]:bg-gray-50",c),children:t.jsxs("div",m.length>0?{className:"flex justify-between items-center w-full",children:[t.jsxs("div",{className:"flex flex-wrap items-center",children:[m.slice(0,s).map((n=>{const o=e.find((e=>e.value===n)),i=o?.icon;return t.jsxs(kZ,{className:Zd(w?"animate-bounce":"",Yse({variant:r})),style:{animationDuration:`${a}s`},children:[i&&t.jsx(i,{className:"h-4 w-4 mr-2"}),o?.label,t.jsx(xu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),S(n)}})]},n)})),m.length>s&&t.jsxs(kZ,{className:Zd("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",w?"animate-bounce":"",Yse({variant:r})),style:{animationDuration:`${a}s`},children:[`+ ${m.length-s} more`,t.jsx(xu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),(()=>{const e=m.slice(0,s);g(e),n(e)})()}})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(rd,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:e=>{e.stopPropagation(),E()}}),t.jsx(Wse,{orientation:"vertical",className:"flex min-h-6 h-full"}),t.jsx(fu,{className:"h-4 mx-2 cursor-pointer text-muted-foreground"})]})]}:{className:"flex items-center justify-between w-full mx-auto",children:[t.jsx("span",{className:"text-sm text-muted-foreground mx-3",children:o}),t.jsx(fu,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),t.jsx(J6,{className:"w-auto p-0 z-[1000]",align:"start",onEscapeKeyDown:()=>x(!1),children:t.jsxs(Ese,{children:[t.jsx(Tse,{searchIcon:h,placeholder:d,onKeyDown:e=>{if("Enter"===e.key)x(!0),p&&(p(e.currentTarget.value),x(!1));else if("Backspace"===e.key&&!e.currentTarget.value){const e=[...m];e.pop(),g(e),n(e)}}}),t.jsxs(Cse,{children:[t.jsx(Ase,{children:f}),t.jsxs(Nse,{children:[t.jsxs(Ose,{onSelect:()=>{if(m.length===e.length)E();else{const t=e.map((e=>e.value));g(t),n(t)}},className:"cursor-pointer",children:[t.jsx("div",{className:Zd("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",m.length===e.length?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(pu,{className:"h-4 w-4"})}),t.jsx("span",{children:"(Select All)"})]},"all"),e.map((e=>{const n=m.includes(e.value);return t.jsxs(Ose,{onSelect:()=>S(e.value),className:"cursor-pointer",children:[t.jsx("div",{className:Zd("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",n?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(pu,{className:"h-4 w-4"})}),e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:e.label})]},e.value)}))]}),t.jsx(Rse,{}),t.jsx(Nse,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[m.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Ose,{onSelect:E,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),t.jsx(Wse,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),t.jsx(Ose,{onSelect:()=>x(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"}),u&&u.map((e=>e(x)))]})})]})]})}),a>0&&m.length>0&&t.jsx(nd,{className:Zd("cursor-pointer my-2 text-foreground bg-background w-3 h-3",w?"":"text-muted-foreground"),onClick:()=>_(!w)})]})}));Xse.displayName="MultiSelect";var Zse="Switch",[Qse,Jse]=UQ(Zse),[ele,tle]=Qse(Zse),nle=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,name:o,checked:a,defaultChecked:s,required:l,disabled:c,value:u="on",onCheckedChange:d,form:p,...f}=e,[h,m]=i.useState(null),g=XU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=BQ({prop:a,defaultProp:s,onChange:d});return t.jsxs(ele,{scope:r,checked:b,disabled:c,children:[t.jsx(WQ.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":ale(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onClick:FQ(e.onClick,(e=>{x((e=>!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(ile,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})}));nle.displayName=Zse;var rle="SwitchThumb",ole=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=tle(rle,r);return t.jsx(WQ.span,{"data-state":ale(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})}));ole.displayName=rle;var ile=e=>{const{control:n,checked:r,bubbles:o=!0,...a}=e,s=i.useRef(null),l=Tte(r),c=t1(n);return i.useEffect((()=>{const e=s.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==r&&n){const t=new Event("click",{bubbles:o});n.call(e,r),e.dispatchEvent(t)}}),[l,r,o]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ale(e){return e?"checked":"unchecked"}var sle=nle,lle=ole;const cle=i.forwardRef((({className:e,...n},r)=>t.jsx(sle,{className:Zd("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input/50",e),...n,ref:r,children:t.jsx(lle,{className:Zd("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})));cle.displayName=sle.displayName;const ule=({onSelect:e,date:n,placeholder:r="Pick a date"})=>t.jsxs(Z6,{modal:!0,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",className:Zd("w-[200px] justify-start text-left font-normal h-9",!n&&"text-muted-foreground"),children:[t.jsx(du,{className:"mr-2 h-4 w-4"}),n?o9(n,"PPP"):t.jsx("span",{children:r})]})}),t.jsx(J6,{className:"w-auto p-0",align:"start",children:t.jsx(Oae,{mode:"single",selected:n,onSelect:e,initialFocus:!0})})]}),dle=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===Lse.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),ple=({fieldType:e,operator:n,value:r,onChange:o,options:a,toast:s,metadata:l})=>{const c=r.length>0&&"object"==typeof r[0]&&"type"in r[0]&&"relative"===r[0].type,u=r.length>0&&"object"==typeof r[0]&&"startDate"in r[0]&&"endDate"in r[0],[d,p]=i.useState((e===nZ.Date||e===nZ.DateTime)&&r.length>0&&r[0]instanceof Date?r[0]:void 0),[f,h]=i.useState(c),[m,g]=i.useState(c?r[0]:{type:"relative",value:0,unit:Lse.DAYS,direction:"before"}),[v,y]=i.useState(u?r[0]:void 0),[b,x]=i.useState(!1);if(i.useEffect((()=>{n!==oZ.EQUALS_MONTH_DAY&&n!==oZ.EQUALS_MONTH_DAY_YEAR&&f&&(h(!1),o(d?[d]:[]))}),[n,f,d,o]),i.useEffect((()=>{if(u&&v?.startDate){x("object"==typeof v.startDate&&"type"in v.startDate)}}),[u,v]),e===nZ.String||e===nZ.ReachResource||e===nZ.Array)return n===oZ.EXISTS?null:t.jsx(Xse,{maxCount:2,options:(a||[]).map((e=>({label:e.displayName,value:e.id}))),value:r.map((e=>{const t=(a||[]).find((t=>t.id===String(e)||t.displayName===String(e)||t.id===t.displayName&&t.id===String(e)));return t?.id||String(e)})),onValueChange:e=>{o(e)},selectedValues:r.map((e=>{const t=(a||[]).find((t=>t.id===String(e)||t.displayName===String(e)||t.id===t.displayName&&t.id===String(e)));return t?.id||String(e)})),setSelectedValues:e=>{o(e)},searchPlaceholder:"Enter new value",emptyMessage:"Press enter to add new value",handleSearchInput:e=>{if(e.length>0){const t=(e=>{const{value:t,type:n}=e;switch(n){case nZ.ReachResource:case nZ.Array:case nZ.String:return t.length>0;case nZ.Number:return!isNaN(Number(t));case nZ.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case nZ.Boolean:return"true"===t||"false"===t;case nZ.Date:case nZ.DateTime:return!isNaN(new Date(t).getTime());default:throw ene(n,nZ)}})({value:e,type:l.type});t?o([...new Set([...r,e])]):s({title:"Invalid value",description:`Please enter a valid value for this field. The value must be a ${l.type} type`,variant:"destructive"})}}});if(e===nZ.Date||e===nZ.DateTime){const e=n===oZ.EQUALS_MONTH_DAY||n===oZ.EQUALS_MONTH_DAY_YEAR,r=n===oZ.BETWEEN_MONTH_DAY||n===oZ.BETWEEN_MONTH_DAY_YEAR,i=e=>{dle(e)?(g(e),f&&o([e])):s({title:"Invalid relative date",description:"Please enter a valid non-negative number of days.",variant:"destructive"})},a=e=>{const t=e.startDate??v?.startDate,n=e.endDate??v?.endDate,r=t&&"object"==typeof t&&"type"in t,i=n&&"object"==typeof n&&"type"in n;if(t&&n){if(r!==i)return void s({title:"Invalid date range",description:"Both start and end dates must be of the same type (either both absolute or both relative).",variant:"destructive"});if(!r&&!i&&!(e=>!e.finalStartDate||!e.finalEndDate||e.finalStartDate<e.finalEndDate)({finalStartDate:t,finalEndDate:n}))return void s({title:"Invalid date range",description:"Start date must be before end date.",variant:"destructive"});if(r&&(!dle(t)||!dle(n)))return void s({title:"Invalid relative date",description:"Please enter valid relative dates.",variant:"destructive"})}y(e),t&&n&&o([{startDate:t,endDate:n}])},l=e=>{e&&(e=>e instanceof Date?!isNaN(e.getTime()):"object"==typeof e&&"type"in e&&"relative"===e.type&&dle(e))(e)?(p(e),o([e]),h(!1)):e||(p(void 0),o([]),h(!1))},c=e=>{h(e),o(e?[m]:d?[d]:[])};return t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"min-h-[36px] flex items-center",children:[(!f||!e)&&!r&&t.jsx(ule,{date:d,onSelect:l}),e&&f&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(q3,{type:"number",value:void 0===m.value?"":m.value,onChange:e=>{const t=""===e.target.value?void 0:parseInt(e.target.value,10);i({...m,value:t})},className:"w-20 h-9",min:"0","aria-label":"Relative days value"}),t.jsxs(cte,{value:m.direction,onValueChange:e=>{i({...m,direction:e})},children:[t.jsx(dte,{className:"w-[180px] h-9","aria-label":"Relative direction",children:t.jsx(ute,{placeholder:"Select direction..."})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"before",children:"days before today"}),t.jsx(mte,{value:"after",children:"days after today"})]})]})]}),r&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"flex flex-col space-y-2",children:[t.jsx("div",{className:"flex items-center space-x-2",children:b?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(q3,{type:"number",value:v?.startDate&&"object"==typeof v.startDate&&"type"in v.startDate?v.startDate.value:"",onChange:e=>{const t={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Lse.DAYS,direction:v?.startDate?.direction||"before"};dle(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),t.jsxs(cte,{value:v?.startDate&&"object"==typeof v.startDate&&"type"in v.startDate?v.startDate.direction:"before",onValueChange:e=>{const t={type:"relative",value:v?.startDate?.value,unit:Lse.DAYS,direction:e};dle(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},children:[t.jsx(dte,{className:"w-[180px] h-9",children:t.jsx(ute,{placeholder:"Select direction..."})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"before",children:"days before today"}),t.jsx(mte,{value:"after",children:"days after today"})]})]}),t.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"Start"})]}):t.jsx(ule,{placeholder:"Start date",date:v?.startDate instanceof Date||"string"==typeof v?.startDate?v.startDate instanceof Date?v.startDate:new Date(v.startDate):void 0,onSelect:e=>{const t=e;t&&(y({...v,startDate:t}),a({...v,startDate:t}))}})}),t.jsx("div",{className:"flex items-center space-x-2",children:b?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(q3,{type:"number",value:v?.endDate&&"object"==typeof v.endDate&&"type"in v.endDate?v.endDate.value:"",onChange:e=>{const t={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Lse.DAYS,direction:v?.endDate?.direction||"before"};dle(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),t.jsxs(cte,{value:v?.endDate&&"object"==typeof v.endDate&&"type"in v.endDate?v.endDate.direction:"before",onValueChange:e=>{const t={type:"relative",value:v?.endDate?.value,unit:Lse.DAYS,direction:e};dle(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},children:[t.jsx(dte,{className:"w-[180px] h-9",children:t.jsx(ute,{placeholder:"Select direction..."})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"before",children:"days before today"}),t.jsx(mte,{value:"after",children:"days after today"})]})]}),t.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"End"})]}):t.jsx(ule,{placeholder:"End date",date:v?.endDate instanceof Date||"string"==typeof v?.endDate?v.endDate instanceof Date?v.endDate:new Date(v.endDate):void 0,onSelect:e=>{const t=e;t&&(y({...v,endDate:t}),a({...v,endDate:t}))}})})]}),t.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[t.jsx(cle,{id:"between-relative-date-switch",checked:b,onCheckedChange:e=>{if(x(e),e){const e={type:"relative",value:0,unit:Lse.DAYS,direction:"before"},t={type:"relative",value:0,unit:Lse.DAYS,direction:"before"};y({startDate:e,endDate:t}),a({startDate:e,endDate:t})}else{const e=new Date,t=new Date(e);t.setDate(t.getDate()+1),y({startDate:e,endDate:t}),a({startDate:e,endDate:t})}},"aria-label":"Toggle relative date input for between dates"}),t.jsx(L9,{htmlFor:"between-relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})]}),e&&t.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[t.jsx(cle,{id:"relative-date-switch",checked:f,onCheckedChange:c,"aria-label":"Toggle relative date input"}),t.jsx(L9,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===nZ.Number||e===nZ.Integer)return n===oZ.EXISTS?null:t.jsx(q3,{type:"number",value:r.length>0?String(r[0]):"",onChange:e=>o([Number(e.target.value)]),className:"w-[200px]"});if(e===nZ.Boolean){if(n===oZ.EXISTS)return null;const e=r.length>0&&Boolean(r[0]);return t.jsx(cle,{checked:e,onCheckedChange:e=>o([e])})}return t.jsx(q3,{value:r.length>0?String(r[0]):"",onChange:e=>o([e.target.value]),className:"w-[200px]",disabled:!0})},fle=({condition:e,onUpdate:n,onDuplicate:r,onDelete:o,segmentsConditions:i})=>{const{toast:a}=jl(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:nZ.String,options:void 0,itemType:void 0},l=s.operators,c=s.type,u=i.conditions.map((e=>e.field)).map((e=>({value:e,label:Ise[e]||e})));return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[t.jsx(Fse,{options:u,value:e.field,onChange:t=>{const r=t,o=i.conditions.find((e=>e.field===r));if(!o)return;const a=o.operators.map((e=>({value:e,label:Dse[e]||e,fieldType:o.type}))),s=a[0]?.value;let l=[];switch(o.type){case nZ.Boolean:l=[!1];break;case nZ.Number:l=[0];break;case nZ.Date:case nZ.DateTime:l=[new Date];break;case nZ.String:l=o.options?.length?o.options.map((e=>e.displayName)):[];break;default:l=[]}n({...e,field:r,operator:s,value:l})},placeholder:"Select field"}),t.jsx(Fse,{options:l.map((e=>({value:e,label:Dse[e]||e}))),value:e.operator,onChange:t=>n({...e,operator:t}),placeholder:"Select operator"}),t.jsx("div",{className:"max-w-2xl w-full overflow-hidden",children:t.jsx(ple,{fieldType:c,operator:e.operator,options:"string"==typeof e.value[0]&&e.value[0]&&Array.isArray(s.options)?[...(s.options||[]).map((e=>({displayName:e.displayName,id:e.id}))),...e.value.filter((e=>!s.options?.some((t=>t.id===e||t.displayName===e)))).map((e=>({displayName:e,id:e})))]:s.options?.map((e=>({displayName:e.displayName,id:e.id}))),value:e.value,onChange:t=>n({...e,value:t}),toast:a,metadata:{field:e.field,type:c,itemType:s.itemType}})})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsx(vZ,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(_u,{className:"h-4 w-4"})}),t.jsx(vZ,{size:"icon",variant:"ghost",onClick:o,children:t.jsx(Yu,{className:"h-4 w-4"})})]})]})},hle=({onSelectStyle:e})=>{const[r,o]=n.useState(null);return t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 max-w-4xl mx-auto",children:[t.jsx(xZ,{onClick:()=>{o("ai"),e("ai")},title:"Build with AI",subtitle:"Describe your audience in plain language and let AI create the conditions",icon:t.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:t.jsx(Ku,{className:"w-full h-full"})})}),selected:"ai"===r}),t.jsx(xZ,{onClick:()=>{o("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${ff("engage:segment")} by configuring conditions directly`,icon:t.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:t.jsx(Hu,{className:"w-full h-full"})})}),selected:"manual"===r})]})},mle=({segmentId:e,setOpen:n,setTextToSegment:r,promptBuilderStyle:o,textToSegment:i})=>t.jsx("div",{children:t.jsx(CB,{className:"",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(NB,{className:"text-3xl font-normal",children:e?`Edit ${ff("engage:segment")}`:`Create ${ff("engage:segment")}`}),t.jsxs("div",{className:"flex items-center gap-2",children:[!1===o&&!1===i&&t.jsx(m6,{children:t.jsxs(g6,{children:[t.jsx(v6,{asChild:!0,children:t.jsx(vZ,{variant:"outline",size:"sm",onClick:()=>r(!0),children:t.jsx(Ku,{className:"h-4 w-3"})})}),t.jsx(y6,{children:t.jsxs("p",{children:["Use AI to create ",ff("engage:segment")," by describing them in natural language"]})})]})}),t.jsx(vZ,{variant:"ghost",size:"icon",onClick:()=>{n(!1)},className:"h-8 w-8",children:t.jsx(rd,{className:"h-4 w-4"})})]})]})})}),gle=({setTextToSegment:e,setSegment:r})=>{const[o,i]=n.useState(""),[a,s]=n.useState(!1),{toast:c}=jl();return t.jsxs("div",{className:"flex flex-col gap-6 p-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Describe your audience"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Describe the audience you want to target in plain language, and our AI will create the conditions for you."})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(zB,{children:[a&&t.jsx(mZ,{children:t.jsx(hZ,{})}),!a&&t.jsx(mZ,{children:t.jsx(Hte,{placeholder:"Describe your target audience...",className:"min-h-[120px] resize-none",value:o,onChange:e=>i(e.target.value)})})]}),t.jsx("div",{className:"flex justify-end gap-2",children:t.jsxs(vZ,{onClick:async()=>{if(!o)return void c({title:"Please enter a description",description:"Please enter a description of your target audience",variant:"destructive"});s(!0);const t=await(async e=>(await Re(`${l}/text-to-segment`,{method:"POST",body:JSON.stringify({text:e})})).data)(o);t.success&&t.conditions?(c({title:`${ff("engage:segment")} conditions built successfully 🚀`,description:`Your ${ff("engage:segment")} conditions have been built successfully`}),r(t.conditions)):c({title:`${ff("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[t.jsx(Ku,{className:"h-4 w-4"}),"Generate ",ff("engage:segment")]})})]})]})};function vle({segmentId:e,setOpen:n,onSegmentUpdated:r}){const{toast:o}=jl(),a=void 0===e,[s,l]=i.useState(!1),[c,u]=i.useState({version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[]}),{segment:d,isLoading:p}=eZ(e||""),{updateSegment:f}=tZ(e),{createSegment:h,isCreating:m,segmentsConditions:g}=ZX(),[v,y]=i.useState(!1),[b,x]=i.useState(!!a);i.useEffect((()=>{g&&u(d?{version:"1.0",id:d.id,name:d.name,description:d.description,logic:"AND",conditions:d.conditions}:{version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[{field:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})}),[d,g]);const w=e=>e.value.some((e=>"object"==typeof e&&"type"in e&&"relative"===e.type)),_=e=>e.value.some((e=>"object"==typeof e&&"startDate"in e&&"endDate"in e));if(!g||p)return t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(hZ,{})});return t.jsx(t.Fragment,{children:t.jsxs(zB,{mode:"wait",children:[t.jsx(mle,{segmentId:e,setOpen:n,setTextToSegment:y,promptBuilderStyle:b,textToSegment:v},"segment-builder-header"),b?t.jsx(mZ,{children:t.jsx(hle,{onSelectStyle:e=>{"ai"===e&&y(!0),x(!1)}})},"prompt-builder-style"):t.jsx(mZ,{children:t.jsxs("div",{className:"flex flex-1 flex-col",children:[t.jsx("div",{className:"flex flex-1 flex-col px-8 py-2",children:t.jsx("div",{className:"flex flex-1 flex-col gap-4 overflow-visible",children:t.jsx(zB,{children:v?t.jsx(mZ,{children:t.jsx(gle,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(mZ,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(L9,{className:"text-muted-foreground text-xs",children:"Name"}),t.jsx(q3,{placeholder:`${ff("engage:segment")} name`,value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(L9,{className:"text-muted-foreground text-xs",children:"Description"}),t.jsx(q3,{placeholder:`${ff("engage:segment")} description`,value:c.description,onChange:e=>u({...c,description:e.target.value})})]})]}),c.conditions.length>0&&t.jsx("div",{className:"flex-1 overflow-y-auto pb-8",children:t.jsx("div",{className:"grid",children:t.jsx(zB,{mode:"popLayout",children:c.conditions.map(((e,n)=>t.jsxs(AX.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{type:"spring",stiffness:300,damping:30,mass:.5},children:[n>0&&t.jsxs(AX.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[t.jsx(AX.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}}),t.jsx(AX.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),t.jsx(AX.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}})]}),t.jsx(fle,{condition:e,onUpdate:e=>((e,t)=>{const n=[...c.conditions];n[e]=t,u({...c,conditions:n})})(n,e),segmentsConditions:g,onDuplicate:()=>(e=>{const t=[...c.conditions];t.splice(e+1,0,{...c.conditions[e]}),u({...c,conditions:t})})(n),onDelete:()=>(e=>{const t=c.conditions.filter(((t,n)=>n!==e));u({...c,conditions:t})})(n)})]},`${e.field}-${e.operator}-${n}`)))})})})]})})})}),t.jsx("div",{className:"border-t px-8 py-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs(vZ,v?{variant:"secondary",onClick:()=>y(!1),children:[t.jsx(Hu,{className:"h-4 w-4"}),"Manual Builder"]}:{variant:"secondary",onClick:()=>{u({...c,conditions:[...c.conditions,{field:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})},children:[t.jsx(Vu,{className:"h-4 w-4"}),"Add Condition"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(vZ,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(vZ,{variant:"default",onClick:async()=>{if(!c.name||!c.description)return void o({title:"Name and description are required",description:"Please ensure all fields are filled out",variant:"destructive"});const{valid:t,error:i}=(e=>{for(const t of e){if(!t.field||!t.operator)return{valid:!1,error:"Please ensure all fields are filled out for condition"};if(t.operator!==oZ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===oZ.EXISTS&&t.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${t.field}`};if(w(t)&&t.operator!==oZ.EQUALS_MONTH_DAY&&t.operator!==oZ.EQUALS_MONTH_DAY_YEAR)return{valid:!1,error:`Relative dates can only be used with the month and day or month, day, and year operator for ${t.field}`};if(w(t)&&void 0===t.value[0].value)return{valid:!1,error:`Please select a value for the relative date for ${t.field}`};if(_(t)&&t.operator!==oZ.BETWEEN_MONTH_DAY&&t.operator!==oZ.BETWEEN_MONTH_DAY_YEAR)return{valid:!1,error:`Between dates can only be used with the between month day or between month day year operator for ${t.field}`};if(_(t)&&t.value.length>1)return{valid:!1,error:`Between dates can only have a single value for ${t.field}`};if(_(t)){const e=t.value[0];if(!e.startDate||!e.endDate)return{valid:!1,error:`Please ensure both a start and end date are selected for ${t.field}`};if(e.startDate instanceof Date&&e.endDate instanceof Date&&e.startDate>e.endDate)return{valid:!1,error:`Start date must be before end date for ${t.field}`};if("type"in e.startDate&&"relative"===e.startDate.type&&"type"in e.endDate&&"relative"===e.endDate.type){if(!e.startDate.value||!e.endDate.value)return{valid:!1,error:`Please ensure both a start and end date are selected for ${t.field}`};if(e.startDate.direction!==e.endDate.direction)return{valid:!1,error:`Start and end date must be of the same direction for ${t.field}`};const n=e=>{if(e.unit===Lse.DAYS)return e.value??0;throw LX(e.unit,Lse)};if("before"===e.startDate.direction&&n(e.startDate)>n(e.endDate))return{valid:!1,error:`Start date must be before end date for ${t.field}`};if("after"===e.startDate.direction&&n(e.startDate)<n(e.endDate))return{valid:!1,error:`Start date must be after end date for ${t.field}`}}}}return{valid:!0,error:void 0}})(c.conditions);if(!t)return void o({title:"Conditions are invalid",description:i??"Please ensure all fields are filled out",variant:"destructive"});const a=c.conditions.map((e=>{const t=g?.conditions.find((t=>t.field===e.field));return t?.type===nZ.Date&&(e.value=e.value.map((e=>e instanceof Date?e.toISOString().split("T")[0]:e))),e}));l(!0);try{e&&d?f({name:c.name,description:c.description,conditions:a},{onSuccess:()=>{o({title:`${ff("engage:segment")} updated successfully`}),n(!1),r?.(e)},onError:()=>{o({title:`Error updating ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}}):h({name:c.name,description:c.description,conditions:c.conditions},{onSuccess:e=>{o({title:`${ff("engage:segment")} created successfully`}),r?.(e?.id??!1),n(!1)},onError:()=>{o({title:`Error creating ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}})}catch(s){o({title:`Error saving ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}finally{l(!1)}},disabled:s||m,children:s||m?t.jsxs(t.Fragment,{children:[t.jsx(Nu,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})})}function yle({open:e,setOpen:n,segmentId:r,onSegmentUpdated:o}){return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-4xl w-full",hideCloseButton:!0,children:[t.jsxs(n$,{children:[t.jsxs(NB,{children:[ff("engage:segment")," Builder"]}),t.jsxs(RB,{children:["Build a ",ff("engage:segment")," to target your audience"]})]}),t.jsx(vle,{segmentId:r,setOpen:n,onSegmentUpdated:e=>{o?.(e),n(!1)}})]})})}const ble=({value:e,label:n,percentage:r,variant:o,isLoading:i,selected:a})=>t.jsxs("div",{className:"rounded-md border-2 border-muted-foreground/20 px-2 pt-2 pb-3 duration-300 ease-in-out overflow-x-auto max-w-full min-w-0 "+(a?"scale-[1.02] [border-color:hsl(var(--reach-primary))] shadow-lg":""),style:{containerType:"inline-size"},"data-card-container":!0,children:[t.jsxs("div",{className:"flex flex-col gap-1 items-start w-full min-w-0",children:[t.jsx("div",{className:"flex items-baseline gap-2 w-full min-w-0 @container/num",children:i?t.jsx("span",{className:"animate-pulse",children:"..."}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-semibold pl-2 break-words max-w-full min-w-0 truncate\n text-xl @[250px]/card:text-2xl @[350px]/card:text-3xl @[500px]/card:text-4xl text-primary",children:e.toLocaleString()}),void 0!==r&&e.toLocaleString().replace(/,/g,"").length<5&&t.jsxs("span",{className:"text-muted-foreground/50 text-sm hidden @[120px]/num:inline",children:["(",r,"%)"]})]})}),t.jsx("span",{className:`px-2 sm:px-2.5 py-1 text-xs font-medium rounded-lg ${{default:"bg-gray-100/50 text-gray-700",blue:"bg-blue-100/50 text-blue-700",green:"bg-green-100/50 text-green-700"}[o]}`,children:n})]}),t.jsx("p",{className:"text-sm text-muted-fore hidden @[250px]/card:inline mt-1",children:1===e?"contact":"contacts"})]}),xle=({countResponse:e})=>{const r=n.useMemo((()=>e?.recipients?e.recipients.reduce(((t,n)=>({total:e.count,emails:t.emails+(n.email?1:0),phones:t.phones+(n.phone?1:0)})),{total:0,emails:0,phones:0}):{total:0,emails:0,phones:0}),[e]),o=e=>Math.round(e/(r.total||1)*100);return t.jsxs(t.Fragment,{children:[t.jsx(Rre,{children:"Estimated Matches"}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 md:mb-6 w-full gap-4 mt-3 px-1",children:[t.jsx(ble,{value:r.total,label:"Total",variant:"default",isLoading:void 0===e}),t.jsx(ble,{value:r.emails,label:"Email",percentage:o(r.emails),variant:"blue",isLoading:void 0===e}),t.jsx(ble,{value:r.phones,label:"Phone",percentage:o(r.phones),variant:"green",isLoading:void 0===e})]})]})},wle=({recipients:e})=>e?.length?t.jsx("div",{className:"bg-foreground/5 rounded-lg h-full relative overflow-hidden",children:t.jsx("div",{className:"absolute inset-0 w-full h-full overflow-y-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"sticky top-0 bg-foreground/5 backdrop-blur-sm",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Name"}),t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Contact"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-200/50",children:e.map(((e,n)=>t.jsxs("tr",{className:"hover:bg-white/50 transition-colors",children:[t.jsxs("td",{className:"px-3 sm:px-4 py-3 text-sm text-gray-900",children:[e.firstName," ",e.lastName]}),t.jsx("td",{className:"px-3 sm:px-4 py-3",children:t.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[e.email&&t.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-blue-100/50 text-blue-700 rounded-lg",children:"Email"}),e.phone&&t.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-green-100/50 text-green-700 rounded-lg",children:"Phone"})]})})]},n)))})]})})}):null,_le=({onSelectionChange:e,defaultValue:r="all"})=>{const[o,i]=n.useState(r),a=t=>{i(t),e?.(t)};return t.jsxs(t.Fragment,{children:[t.jsx(Rre,{children:"Filter"}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[t.jsx(xZ,{onClick:()=>a("all"),title:`All ${ff("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(wZ.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(xZ,{onClick:()=>a("segments"),title:`Select ${ff("engage:user",{count:2})}`,subtitle:`Choose from ${ff("engage:segment",{count:2})}`,icon:t.jsx(wZ.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===o})]})]})},Sle=({segments:e,allSegments:r,onAddSegment:o,onRemoveSegment:i,setOpenCreateSegmentDialog:a})=>{const[s,l]=n.useState([]),c=r.map((e=>({label:e.name,value:e.id})));return n.useEffect((()=>{l(e)}),[e]),t.jsx("div",{children:t.jsx(Xse,{selectedValues:s,setSelectedValues:l,options:c,defaultValue:e,onValueChange:t=>{const n=t.filter((t=>!e.includes(t))),r=e.filter((e=>!t.includes(e)));n.forEach(o),r.forEach(i)},placeholder:"Select segments",maxCount:5,extraCommandItems:[e=>t.jsxs(Ose,{onSelect:()=>{e(!1),a(!0)},className:"cursor-pointer",children:[t.jsx(wZ.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},Ele=({includedSegments:e,excludedSegments:r,handleAddSegment:o,handleRemoveSegment:i,setOpenCreateSegmentDialog:a,segments:s,defaultIsExcludeOpen:l=!1})=>{const[c,u]=n.useState(l);return t.jsxs("div",{children:[t.jsx(Sle,{segments:e,allSegments:s||[],onAddSegment:e=>o(e,"include"),onRemoveSegment:e=>i(e,"include"),setOpenCreateSegmentDialog:a}),t.jsx("div",{className:"border-t border-gray-200 my-8"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(vZ,{onClick:()=>u(!c),className:"flex items-center gap-1 transition-colors",size:"sm",children:[t.jsx(AX.div,{animate:{rotate:c?180:0},transition:{duration:.2},children:t.jsx(wZ.DropdownMenuTrigger,{className:"w-5 h-5"})}),t.jsx("span",{children:"Don't send to"})]}),t.jsx(zB,{children:c&&t.jsx(AX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:t.jsx(Sle,{segments:r,allSegments:s||[],onAddSegment:e=>o(e,"exclude"),onRemoveSegment:e=>i(e,"exclude"),setOpenCreateSegmentDialog:a})})})]})]})},Tle=({title:e="Preview Audience"})=>{const r=aZ(),[o,i]=n.useState("all"),[a,s]=n.useState(r?.includeSegmentIds||[]),[l,c]=n.useState(r?.excludeSegmentIds||[]),[u,d]=n.useState(!1),[p,f]=n.useState(!1),{segments:h,isLoading:m}=QX(),{updateAutomation:g}=Le(r?.id??""),[v,y]=n.useState(void 0),b=1===a.length&&0===l.length&&void 0!==h?.find((e=>e.type===rZ.ALL_USERS&&e.id===a[0]));n.useEffect((()=>{r&&!p&&(i(b||a.length>0&&0===l.length?"all":"segments"),YX({includeSegments:a,excludeSegments:l}).then((e=>{y(e)})),f(!0))}),[r,b,p,a,l]);return n.useEffect((()=>{r&&p&&(JSON.stringify(a)===JSON.stringify(r.includeSegmentIds)&&JSON.stringify(l)===JSON.stringify(r.excludeSegmentIds)||(g({includeSegments:a,excludeSegments:l}),YX({includeSegments:a,excludeSegments:l}).then((e=>{y(e)}))))}),[a,l,r,p,g]),t.jsxs(Ore,{title:e,children:[!m&&h&&p?t.jsxs("div",{className:"flex gap-8 w-full pb-4 px-4",children:[t.jsxs("div",{className:"flex flex-col flex-1 relative overflow-y-auto pb-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:[t.jsx(xle,{countResponse:v}),t.jsx(_le,{onSelectionChange:e=>{if(i(e),"all"===e){const e=h?.find((e=>e.type===rZ.ALL_USERS));if(!e)return;s([e.id]),c([])}},defaultValue:o}),t.jsx(zB,{children:"segments"===o&&t.jsx(AX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:"easeInOut"},className:"w-full pt-4",children:t.jsx(Ele,{includedSegments:a,excludedSegments:l,handleAddSegment:(e,t)=>{"include"===t?s((t=>[...t,e])):c((t=>[...t,e]))},handleRemoveSegment:(e,t)=>{"include"===t?s((t=>t.filter((t=>t!==e)))):c((t=>t.filter((t=>t!==e))))},setOpenCreateSegmentDialog:d,segments:h,defaultIsExcludeOpen:l.length>0})})})]}),t.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:v?.recipients&&t.jsx(wle,{recipients:v.recipients})})]}):t.jsx("div",{children:t.jsx(hZ,{text:["Fetching segments","Finishing up"]})}),t.jsx(yle,{open:u,setOpen:d})]})},Cle=()=>t.jsx(Tle,{title:"Select Audience"});var Ale=(e=>(e[e.SelectAudience=1]="SelectAudience",e[e.SelectCommunication=2]="SelectCommunication",e[e.Schedule=3]="Schedule",e[e.PreviewAndSend=4]="PreviewAndSend",e))(Ale||{});const Nle=()=>{const e=aZ(),t=sZ(),r=n.useCallback((async n=>e?await(async e=>{const{currentStep:t,automation:n,communicationGroup:r}=e;switch(t){case Ale.SelectAudience:return{canMove:n.includeSegmentIds.length>0,errorMessage:"Please ensure you have selected at least one segment"};case Ale.SelectCommunication:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));return e&&r&&(r.smsChannelSenderId||r.emailChannelSenderId)?!r.emailChannelSenderId||r.emailHtmlBody&&r.emailSubject?r.smsChannelSenderId&&!r.smsMessageBody?{canMove:!1,errorMessage:"Please ensure you have a sms message body"}:{canMove:!0,errorMessage:null}:{canMove:!1,errorMessage:"Please ensure you have a email body and subject"}:{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"}}case Ale.Schedule:{if(!n.triggerMetadata)return{canMove:!1,errorMessage:"Please make sure to select a time to send before starting!"};if(n.triggerMetadata.triggerType!==Fe.ONE_TIME)return{canMove:Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:null};if(!n.triggerMetadata?.scheduledAt)return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${ff("engage:one_time")}`};if(!Boolean(n.triggerMetadata?.scheduledAt&&new Date(n.triggerMetadata.scheduledAt)>new Date))return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${ff("engage:one_time")}`};if(!Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))))return{canMove:!1,errorMessage:"Please ensure you have set a valid email or sms communication"};const e=n.triggerMetadata;return{canMove:Boolean(e.scheduledAt&&new Date(e.scheduledAt)>new Date&&n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:`Please ensure you have set a valid future date for your ${ff("engage:one_time")} automation`}}case Ale.PreviewAndSend:return{canMove:!0,errorMessage:null};default:ene(t,Ale)}})({currentStep:n,automation:e,communicationGroup:t}):{canMove:!1,errorMessage:`${ff("engage:one_time")} not loaded`}),[e,t]);return{validateStep:r}},Rle=({onFinish:e,getExtraMergeFields:r,onBeforeSchedule:o})=>{const i=aZ(),a=sZ(),{updateAutomation:s}=Le(i?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:t}=JX({includeSegments:e?.includeSegmentIds??[],excludeSegments:e?.excludeSegmentIds??[]}),r=n.useMemo((()=>t?.recipients?t.recipients.reduce(((e,t)=>({emails:e.emails+(t.email?1:0),phones:e.phones+(t.phone?1:0)})),{emails:0,phones:0}):{emails:0,phones:0}),[t?.recipients]);return{estimatedMatches:t,estimatedMatchesStats:r}})(i??void 0),{validateStep:c}=Nle(),[u,d]=n.useState(!1),[p,f]=n.useState(Ale.SelectAudience);if(!i||!p||!a)return t.jsx("div",{className:"flex-1 flex flex-col @container justify-center items-center h-[500px]",children:t.jsx(hZ,{text:[`Fetching ${ff("engage:one_time")} data`,"Finishing up"]})});const h=(({automation:e,communicationGroup:n,getExtraMergeFields:r})=>e?[{id:"audience",title:"Audience",step:1,isValid:()=>e.includeSegmentIds.length>0,content:t.jsx(Qte,{content:t.jsx(Cle,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Fe.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},{id:"content",title:"Content",step:2,isValid:()=>{const t=e.actionData?.find((e=>"send_communication"===e.actionType));return!(!t||!t.actionMetadata.communicationGroupId||!n||!n.smsChannelSenderId&&!n.emailChannelSenderId||!(!n.emailChannelSenderId||n.emailHtmlBody&&n.emailSubject)||n.smsChannelSenderId&&!n.smsMessageBody)},content:t.jsxs("div",{className:"flex flex-col gap-4 w-full p-6 rounded-xl bg-gray-100 flex-1 h-full",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:"Edit Content"}),t.jsx(Zte,{getExtraMergeFields:r})]},"content"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"schedule",title:"Schedule",step:3,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Fe.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(Qte,{className:"flex-1",content:t.jsx(jse,{})},"schedule"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"send",title:"Send",step:4,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Fe.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date(Date.now()+18e4)&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(Qte,{className:"flex-1",content:t.jsx(kre,{})},"send"),footerConfig:{backText:"Back",nextText:"Schedule",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[])({automation:i,communicationGroup:a,getExtraMergeFields:r}),m=async()=>{const{canMove:t,errorMessage:n}=await c(p);t?p===Ale.PreviewAndSend?await(async()=>{if(o)try{const t=await o({estimatedEmailRecipients:l?.emails||0,estimatedSmsRecipients:l?.phones||0});!0===t?(s({status:Ve.ACTIVE}),Ml({title:`${ff("engage:one_time")} scheduled!`}),e()):Ml({title:"Oops!",description:t,variant:"destructive"})}catch(t){Ml({title:"Oops!",description:"An error occurred while checking scheduling conditions",variant:"destructive"})}else s({status:Ve.ACTIVE}),Ml({title:`${ff("engage:one_time")} scheduled!`}),e()})():f(p+1):Ml({title:"Oops!",description:n,variant:"destructive"})},g=()=>{p>Ale.SelectAudience&&f(p-1)},v=()=>{e()};return t.jsxs("div",{className:"flex-1 flex flex-col @container h-full min-h-0",children:[t.jsxs("header",{className:"w-full flex items-center gap-4 h-16 px-6",children:[t.jsx("h1",{className:"text-xl font-bold leading-none",children:i.name}),t.jsx("div",{className:"flex items-center gap-4",children:t.jsx(kZ,{variant:c9(i.status),children:e8[i.status]})})]}),t.jsxs("main",{className:"flex gap-4 flex-1 min-h-0",children:[t.jsx("div",{className:"hidden @[1000px]:block",children:t.jsx("nav",{className:"space-y-0 w-50 self-start pr-6 pl-8 pt-4 ",children:h.map((e=>t.jsx("div",{className:`\n rounded-md transition-colors\n ${e.step===p?"bg-[var(--reach-secondary)] text-[var(--reach-primary-foreground)] font-medium":e.step<p?"text-muted-foreground hover:bg-muted":"text-muted-foreground/60"}\n `,children:t.jsx(BZ,{label:e.title,isActive:e.step===p,isCompleted:e.isValid(),onClick:async()=>{if(!u)if(e.step>p){const{canMove:t,errorMessage:n}=await(async e=>{if(e<=p)return{canMove:!0,errorMessage:null};d(!0);try{for(let t=p;t<e;t++){const{canMove:e,errorMessage:n}=await c(t);if(!e)return{canMove:e,errorMessage:n}}return{canMove:!0,errorMessage:null}}finally{d(!1)}})(e.step);t?f(e.step):n&&Ml({title:"Cannot navigate to this step",description:n,variant:"destructive"})}else f(e.step)}})},e.step)))})}),t.jsx("section",{className:"flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0",children:t.jsx("div",{className:" overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex",children:t.jsx(zB,{children:t.jsx(mZ,{className:"pt-0 h-full",children:h.find((e=>e.step===p))?.content},p)})})})]}),t.jsx("footer",{className:"w-full flex justify-end shadow-md z-10 items-center h-16 px-6",children:t.jsx(y9,{handleSkipAndSaveAsDraft:v,handleBack:g,handleNext:m,hideBack:h.find((e=>e.step===p))?.footerConfig.hideBack??!1,backText:h.find((e=>e.step===p))?.footerConfig.backText??"Back",nextText:h.find((e=>e.step===p))?.footerConfig.nextText??"Next",backDisabled:h.find((e=>e.step===p))?.footerConfig.backDisabled??!1,nextDisabled:h.find((e=>e.step===p))?.footerConfig.nextDisabled()??!1})})]})},Ole=({children:e,actionId:r})=>{const{setActionId:o}=n.useContext(VX);return n.useEffect((()=>{o(r)}),[r,o]),t.jsx("div",{children:e})},Ple=()=>t.jsxs("div",{children:[t.jsx("div",{className:TZ,children:t.jsx(wZ.OneTimeBroadcast,{})}),t.jsxs("h3",{className:CZ,children:[ff("engage:one_time")," Broadcast"]}),t.jsx("p",{className:AZ,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),kle=()=>t.jsxs("div",{children:[t.jsx("div",{className:NZ,children:"Coming Soon"}),t.jsx("div",{className:TZ,children:t.jsx(wZ.RealtimeActivity,{})}),t.jsx("h3",{className:CZ,children:"Realtime Activity"}),t.jsx("p",{className:AZ,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),Mle=({selectedType:e,setAutomationName:n,automationName:r,setAutomationDescription:o,automationDescription:i})=>t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 max-w-lg mx-auto",children:[t.jsxs("h2",{className:"text-2xl font-semibold mb-8 text-center",children:["Name Your"," ",ff(e===Fe.ONE_TIME?"engage:one_time":"engage:trigger_based")]}),t.jsxs("div",{className:"w-full space-y-6",children:[t.jsx("div",{className:"bg-gray-50 p-6 rounded-xl items-center justify-center text-center",children:(()=>{switch(e){case Fe.ONE_TIME:return t.jsx(Ple,{});case Fe.TRIGGER_BASED:return t.jsx(kle,{});default:throw ene(e,Fe)}})()}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationName",className:"block text-sm font-medium text-gray-900",children:"Name"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Only visible to your team"})]}),t.jsx(q3,{id:"automationName",type:"text",value:r,onChange:e=>n(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500 shadow-sm",placeholder:"e.g. April Newsletter Campaign",autoFocus:!0})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationDescription",className:"block text-sm font-medium text-gray-900",children:"Description"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Optional"})]}),t.jsx(Hte,{id:"automationDescription",value:i,onChange:e=>o(e.target.value),className:"w-full min-h-[80px] resize-none",placeholder:`Add any helpful context for your team. If left blank, we'll generate one for you when you start the ${ff("engage:one_time").toLowerCase()}`})]})]})]})]}),jle=({onClose:e,automationType:r,currentStep:o,setCurrentStep:i,getExtraMergeFields:a,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:c}=je(),[u,p]=n.useState(!1),[f,h]=n.useState(void 0),[m,g]=n.useState(void 0),[v,y]=n.useState(!1),[b,x]=n.useState(r?{name:void 0,description:void 0,type:r}:{name:void 0,description:void 0,type:void 0}),w=void 0!==b.name&&void 0!==b.type&&""!==b.name;n.useEffect((()=>{if(b.type&&!b.name&&!v){const e=new Date,t=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=e.toLocaleDateString([],{month:"long",day:"numeric"}),r=`${ff("engage:one_time")} ${n} ${t}`,o="";x((e=>({...e,name:r,description:o}))),y(!0)}}),[b,v]);if(c||u)return t.jsx("div",{className:EZ,children:t.jsx(hZ,{text:[`Creating ${ff("engage:one_time")}`,"Finishing up"]})});return t.jsxs("div",{className:wB("relative overflow-y-auto h-full p-8",o===yZ.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[t.jsx(zB,{mode:"wait",children:t.jsx(mZ,{className:"h-full",children:(()=>{switch(o){case yZ.ChooseAutomationType:return t.jsx(RZ,{onNext:e=>{x({...b,type:e}),i(yZ.SetAutomationName)}});case yZ.SetAutomationName:return b.type?t.jsx(Mle,{selectedType:b.type,setAutomationName:e=>{x({...b,name:e})},automationName:b.name??"",setAutomationDescription:e=>{x({...b,description:e})},automationDescription:b.description??""}):null;case yZ.OneTimeWizard:return f&&m?t.jsx(cZ,{automationId:f,children:t.jsx(Ole,{actionId:m,children:t.jsx(Rle,{onFinish:()=>{e?.(f)},getExtraMergeFields:a,onBeforeSchedule:s})})}):null;default:throw LX(o,yZ)}})()},o)}),o!==yZ.OneTimeWizard&&t.jsx("div",{className:"pt-2",children:t.jsx(bZ,{onClose:e,currentStep:o,setCurrentStep:i,isDisabled:!w,createAutomation:async()=>{if(!w||!b.name||!b.type)return;p(!0);l({name:b.name,type:b.type,description:b.description},{onSuccess:async t=>{if(t.id){const n=await(async e=>(await Re(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),o=jX().toString();await Pe(t.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:o}}]}),h(t.id),await fZ({automationId:t.id,actionId:o}),r===Fe.ONE_TIME?(i(yZ.OneTimeWizard),g(o),p(!1)):e?.(t.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{x({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==r})})]})};function Lle({open:e,setOpen:r,onClose:o,automationType:i,getExtraMergeFields:a}){const[s,l]=n.useState(i?yZ.SetAutomationName:yZ.ChooseAutomationType);return n.useEffect((()=>{e&&l(i?yZ.SetAutomationName:yZ.ChooseAutomationType)}),[e,i]),t.jsx(_B,{open:e,onOpenChange:r,children:t.jsxs(TB,{hideCloseButton:s===yZ.OneTimeWizard,className:`flex max-h-[86vh] ${s===yZ.OneTimeWizard?"max-w-[90vw]":"max-w-4xl"} flex-col gap-0 overflow-visible p-0`,children:[t.jsx(CB,{children:t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs(n$,{children:[t.jsx(NB,{className:"text-3xl font-normal",children:"Create Automation"}),t.jsx(RB,{children:"Create a new automation to send messages to your customers."})]})})}),t.jsx(jle,{onClose:e=>{o?.(e),r(!1)},automationType:i,currentStep:s,setCurrentStep:l,getExtraMergeFields:a})]})})}const Dle=({tabs:e,activeTab:r,onTabChange:o,tabsLocation:i="left",secondaryTabs:a=!1})=>{const s=n.useRef([]),[l,c]=n.useState({width:0,left:0});n.useEffect((()=>{const t=s.current[e.findIndex((e=>e.id===r))];t&&c({width:t.offsetWidth,left:t.offsetLeft})}),[r,e]);const u=e.find((e=>e.id===r));return t.jsxs("div",{className:"flex flex-col gap-4 w-full overflow-x-hidden h-full",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{className:"relative flex items-center gap-8 "+("left"===i?"w-full justify-start":"w-full justify-center"),children:[t.jsx("div",{className:"absolute bottom-0 h-[1px] rounded-full transition-all duration-300 ease-out\n bg-gradient-to-r from-primary to-primary/90\n shadow-[0_0_8px_rgba(var(--primary-rgb),0.3)]",style:{width:`${l.width}px`,left:`${l.left}px`}}),e.map(((e,n)=>t.jsx("button",{ref:e=>s.current[n]=e,onClick:()=>o(e.id),className:wB("relative px-7 py-3 transition-all duration-200 text-lg",r!==e.id&&"text-muted-foreground",a&&"text-sm"),children:e.label},e.id)))]})}),t.jsx("div",{className:"relative overflow-hidden flex-grow min-h-0",children:t.jsx("div",{className:"relative h-full",children:u?u.content:null})})]})},Ile=e=>{if(!e)return"$0.00";const t="string"==typeof e?e.replace(/,/g,""):e,n=Number(t);return Number.isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(n)},Fle="reach-styles-module__header___-izE2",Ule="reach-styles-module__title___n1hA9",$le="reach-styles-module__description___EvXM-",Vle="reach-styles-module__content___okv68",Ble="reach-styles-module__footer___YA4U4",zle=ru("reach-styles-module__base___zJcoE",{variants:{variant:{default:"reach-styles-module__default___88Q0d",destructive:"reach-styles-module__destructive___5EWhN",outline:"reach-styles-module__outline___gj9sC",secondary:"reach-styles-module__secondary___cN5Wj"}},defaultVariants:{variant:"default"}}),Hle=i.forwardRef((({className:e,variant:n,...r},o)=>t.jsx("div",{ref:o,className:Zd(zle({variant:n}),e),...r})));Hle.displayName="Card";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Fle,e),...n}))).displayName="CardHeader";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Ule,e),...n}))).displayName="CardTitle";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd($le,e),...n}))).displayName="CardDescription";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Vle,e),...n}))).displayName="CardContent";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Ble,e),...n}))).displayName="CardFooter";const qle=({Icon:e,title:n,value:r,tooltipText:o,change:i})=>t.jsxs(Hle,{className:"relative flex flex-col justify-between min-h-[130px] transition-all duration-300 hover:shadow-md p-4",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsx("div",{className:"rounded-lg p-2 bg-primary/10 flex items-center justify-center",children:t.jsx(e,{className:"w-5 h-5 text-primary"})}),t.jsx("div",{className:"absolute top-3 right-3",children:t.jsx(T9,{title:o})})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx("div",{className:"text-2xl font-bold leading-tight text-primary",children:r}),t.jsx(Rre,{children:n})]}),i&&t.jsx("div",{className:"absolute bottom-3 right-3",children:t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-green-100 text-green-600 text-xs font-semibold",children:i})})]}),Gle=({activeTab:e,automation:n})=>{if(!n)return null;const r={sales:[{Icon:wZ.SalesAmount,title:"Order Amount",value:Ile(n.derivedRevenue),tooltipText:"Total derived revenue from this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx(qle,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Kle=({activeTab:e,statistics:n})=>{const r={email:[{Icon:wZ.MessagesSent,title:"Emails Sent",value:n.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:wZ.OpenRate,title:"Open Rate",value:`${(100*n.email.openPercentage).toFixed(2)}%`,tooltipText:"Percentage of recipients who opened the email out of total emails delivered"},{Icon:wZ.TotalBounceRate,title:"Total Bounce Rate",value:`${(100*(n.email.softBounceRate+n.email.hardBounceRate)).toFixed(2)}%`,tooltipText:"Percentage of emails that were not delivered due to permanent (hard) or temporary (soft) delivery failures"},{Icon:wZ.LinksClicked,title:"Links Clicked",value:n.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:wZ.SpamComplies,title:"Spam Complaints",value:`${(100*n.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:wZ.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*n.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:wZ.MessagesSent,title:"SMS Sent",value:n.sms.numberSent,tooltipText:"Total number of SMS messages that were successfully sent in this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx(qle,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Wle=({automationId:e,includeSales:r=!1,includeSms:o=!1,automation:i})=>{const[a,s]=n.useState("email"),{statistics:l,isLoading:c}=De(e);if(c||!l)return t.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:t.jsx(hZ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]})});const u=[{id:"email",label:`Email ${ff("engage:insight",{count:2})}`,content:t.jsx(Kle,{activeTab:"email",statistics:l})},...o?[{id:"sms",label:`SMS ${ff("engage:insight",{count:2})}`,content:t.jsx(Kle,{activeTab:"sms",statistics:l})}]:[],...r?[{id:"sales",label:`Sales ${ff("engage:insight",{count:2})}`,content:t.jsx(Gle,{activeTab:"sales",automation:i})}]:[]];return t.jsx(Dle,{tabs:u,activeTab:a,onTabChange:e=>s(e),tabsLocation:"left"})},Yle={all:["website"],content:()=>[...Yle.all,"content"],analyze:()=>[...Yle.all,"analyze"],brandSettings:()=>[...Yle.all,"brand-settings"]},Xle=async()=>(await Re("/web-presence/brand-settings",{method:"POST"})).data,Zle=({isLoading:e,brandSettings:r,onComplete:o})=>{const[i,a]=n.useState(0),[s,l]=n.useState(!1),c=["Analyzing your brand palette","Extracting your visual identity","Discovering your brand personality","Crafting your email style","Finalizing your brand profile"],u=r?.primaryColor||"#4285F4",d=(()=>{const e=e=>e.startsWith("#")?`${e}80`:e;return r?.secondaryColors?.length&&r.secondaryColors.length>0?{start:e(r.primaryColor||"#4285F4"),middle:e(r.secondaryColors[0]||"#FBBC05"),end:e(r.secondaryColors[1]||"#34A853")}:{start:"#F5F5F580",middle:e(u),end:"#C2E7FF80"}})();n.useEffect((()=>{if(!e)return;const t=setInterval((()=>{a((e=>{const n=e+1;return n>=c.length?(clearInterval(t),setTimeout((()=>{l(!0),setTimeout(o,1e3)}),1500),e):n}))}),2500);return()=>clearInterval(t)}),[e,o,c.length]);return s?t.jsx(AX.div,{className:"flex flex-col items-center justify-center h-full w-full",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},children:t.jsxs(AX.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.8,ease:"easeOut"},className:"text-center",children:[t.jsx("h2",{className:"text-2xl font-bold mb-4",style:{color:u},children:"Analysis Complete!"}),t.jsx("p",{className:"text-gray-700",children:"Your brand profile has been successfully created"})]})}):t.jsxs(AX.div,{className:"flex flex-col items-center justify-center h-full w-full relative",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:8,repeat:1/0,repeatType:"reverse"},style:{backgroundImage:`linear-gradient(135deg, ${d.start} 0%, ${d.middle} 50%, ${d.end} 100%)`,backgroundSize:"200% 200%"},children:[t.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-15 backdrop-blur-[2px]"}),t.jsxs("div",{className:"flex flex-col items-center gap-10 p-6 relative z-10",children:[t.jsx(AX.div,r?.logoUrl?{className:"w-32 h-32 sm:w-40 sm:h-40 flex items-center justify-center rounded-lg overflow-hidden bg-white shadow-lg",initial:{scale:.9,rotate:0},animate:{scale:1.05,rotate:0},transition:{scale:{duration:3,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:t.jsx("img",{src:r.logoUrl,alt:"Brand Logo",className:"max-w-full max-h-full object-contain"})}:{className:"w-32 h-32 sm:w-40 sm:h-40 rounded-full flex items-center justify-center",style:{backgroundColor:u},initial:{scale:.9,rotate:0},animate:{scale:[1,1.1,1],rotate:0},transition:{scale:{duration:3,repeat:1/0,ease:"easeInOut"}},children:r?.brandName?t.jsx("span",{className:"text-6xl font-bold text-primary",children:r.brandName.charAt(0)}):t.jsx(Ku,{className:"w-16 h-16 text-primary"})}),t.jsx(AX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"text-xl text-primary font-medium text-center max-w-md drop-shadow-lg",children:c[i]},i),t.jsx("div",{className:"flex space-x-2 mt-4",children:c.map(((e,n)=>t.jsx(AX.div,{className:"h-2 w-2 rounded-full bg-muted-foreground",initial:{opacity:.3},animate:{opacity:n<=i?1:.3,scale:n===i?1.5:1},transition:{duration:.3}},n)))}),r?.brandName&&t.jsxs(AX.div,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:1,duration:1},className:"mt-6 text-primary text-opacity-90 font-medium",children:[r.brandName,r.brandTagline&&t.jsx("span",{className:"block text-sm mt-1 opacity-80",children:r.brandTagline})]})]})]})},Qle=({setAutoParse:e,onBrandSettingsGenerated:r,onForceRefresh:o})=>{const{data:i,updateWebsite:a,isUpdatingWebsite:s,updateBrandSettings:l}=zte(),c=ye({mutationFn:Xle,mutationKey:Yle.brandSettings()}),[u,d]=n.useState(i?.website||""),[p,f]=n.useState(!1),[h,m]=n.useState(null),[g,v]=n.useState(!1),[y,b]=n.useState(!1),x=()=>{e(!1)};return y&&h?t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(ece,{initialBrandSettings:h,onSave:()=>{h&&(l({logoBase64:h.logo_base64,primaryColor:h.primaryColor,secondaryColors:h.secondaryColors,brandTagline:h.brandTagline,brandName:h.brandName,brandPersonality:h.brandPersonality,colorPalette:h.colorPalette}),o&&o(),Ml({title:"Brand settings saved successfully 🚀",description:"Your brand identity has been updated."}),e(!1))},onBack:x,showAutoParseButton:!1})},"results"):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[t.jsx("div",{className:"relative",children:t.jsxs("div",{className:"pb-6",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:y&&h?h.brandName||"Brand Analysis":"Website Analysis"}),t.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:y?h?.brandTagline||"Automatically generated from your website":"Customize your email branding with our AI analysis"})]})}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.jsxs(zB,{mode:"wait",children:[!g&&!y&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col h-full",children:t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-start px-6 space-y-8",children:[t.jsxs("div",{className:"space-y-2 w-full max-w-md",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block text-center",children:"Your Website URL"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-center",children:[t.jsx(q3,{type:"url",value:u,onChange:e=>d(e.target.value),placeholder:"https://example.com",className:"flex-1",disabled:!p}),t.jsx(zB,{mode:"wait",children:p?t.jsxs(AX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex gap-2",children:[t.jsx(vZ,{variant:"outline",size:"sm",onClick:()=>{f(!1),d(i?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),t.jsx(vZ,{size:"sm",onClick:async()=>{try{a(u),f(!1),Ml({title:"Website URL updated successfully 🎉",description:"Your website URL has been saved."})}catch(e){Ml({title:"Error updating website URL",description:"Please try again.",variant:"destructive"})}},disabled:s||!u,className:"w-full sm:w-auto",children:s?t.jsx(hZ,{}):"Save Changes"})]},"save"):t.jsx(AX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:t.jsx(vZ,{variant:"outline",size:"sm",onClick:()=>f(!0),className:"w-full sm:w-auto",children:"Edit URL"})},"edit")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl",children:[t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"What we'll analyze"}),t.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[t.jsx("li",{children:"• Your brand colors and color palette"}),t.jsx("li",{children:"• Your logo (if detectable)"}),t.jsx("li",{children:"• Your brand name and tagline"}),t.jsx("li",{children:"• Your brand's tone and personality"})]})]}),t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"How it helps you"}),t.jsx("p",{className:"text-sm text-gray-600",children:"Our AI will automatically extract your brand assets to create consistently styled emails that match your website. This helps maintain brand recognition and professionalism in all your communications."})]})]}),t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"text-sm text-muted-foreground text-center max-w-md",children:"We'll use AI to analyze your website and extract your brand elements to create perfectly matched email templates."})]})},"url-confirmation"),g&&h&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(Zle,{isLoading:g,brandSettings:h,onComplete:()=>{v(!1),b(!0),Ml({title:"Brand settings generated successfully!",description:"Your brand identity has been analyzed."})}})},"analyzing"),g&&!h&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 flex flex-col items-center justify-center h-full",style:{background:"linear-gradient(135deg, #F5F5F5 0%, #E1E6FC 50%, #C2E7FF 100%)",backgroundSize:"200% 200%"},children:t.jsxs(AX.div,{className:"flex flex-col items-center gap-8",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:5,repeat:1/0,repeatType:"reverse"},children:[t.jsxs(AX.div,{className:"relative w-24 h-24 flex items-center justify-center",initial:{scale:.9},animate:{scale:[1,1.1,1],rotate:[0,5,0,-5,0]},transition:{scale:{duration:3,repeat:1/0,repeatType:"reverse"},rotate:{duration:5,repeat:1/0,repeatType:"reverse"}},children:[t.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/10 animate-pulse"}),t.jsx(Bu,{className:"w-12 h-12 text-primary drop-shadow-md"})]}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:"Analyzing your website"}),t.jsx(zB,{mode:"wait",children:t.jsx(AX.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-gray-600 max-w-md text-center px-4",children:"Generating your brand's unique visual identity and personality"},"loading-message")})]})]})},"pre-analyzing")]})}),!g&&!y&&t.jsxs(AB,{className:"p-4 pb-0",children:[t.jsx(vZ,{variant:"outline",onClick:x,className:"gap-1",children:"Go Back"}),t.jsxs(vZ,{onClick:async()=>{try{v(!0);const e=await c.mutateAsync();m(e),r&&r(e)}catch(e){v(!1),m(null),Ml({title:"Error generating brand settings",description:"Please try again.",variant:"destructive"})}},disabled:!u||c.isPending,className:"gap-1",children:[t.jsx(Ku,{className:"h-4 w-4 text-amber-500"}),c.isPending?t.jsx(hZ,{}):"Analyze Website"]})]})]})},Jle=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],ece=({initialBrandSettings:e,onSave:r,onBack:o,showAutoParseButton:i=!0})=>{const{data:a,isLoading:s,updateBrandSettings:l,isUpdatingBrandSettings:c}=zte(),[u,d]=n.useState({}),[p,f]=n.useState(!1),[h,m]=n.useState({}),[g,v]=n.useState(""),[y,b]=n.useState(""),[x,w]=n.useState("#000000"),[_,S]=n.useState(Date.now()),[E,T]=n.useState(!1),[C,A]=n.useState({identity:!0,colors:!0,personality:!0}),N=n.useRef(null),{toast:R}=jl();n.useEffect((()=>{if(e)return d({brandName:e.brandName,brandTagline:e.brandTagline,logoUrl:e.logoUrl,primaryColor:e.primaryColor||"#000000",secondaryColors:e.secondaryColors||[],brandPersonality:{tone:e.brandPersonality?.tone,voice:e.brandPersonality?.voice,values:e.brandPersonality?.values||[]}}),void S(Date.now());a?.branding&&(d({brandName:a.branding.brandName||a.name,brandTagline:a.branding.brandTagline||"",logoUrl:a.branding.logoUrl||"",primaryColor:a.branding.primaryColor||"#000000",secondaryColors:a.branding.secondaryColors||[],brandPersonality:{tone:a.branding.brandPersonality?.tone,voice:a.branding.brandPersonality?.voice,values:a.branding.brandPersonality?.values||[]}}),S(Date.now()))}),[a,e]);const O=e=>{A((t=>({...t,[e]:!t[e]})))},P=e=>{m((t=>{const n={...t,[e]:!t[e]};return n[e]&&("brandName"===e?v(u.brandName||""):"brandTagline"===e?v(u.brandTagline||""):"primaryColor"===e?v(u.primaryColor||"#000000"):"tone"===e?v(u.brandPersonality?.tone||""):"voice"===e&&v(u.brandPersonality?.voice||"")),n}))},k=e=>{"brandName"===e?d((e=>({...e,brandName:g}))):"brandTagline"===e?d((e=>({...e,brandTagline:g}))):"primaryColor"===e?d((e=>({...e,primaryColor:g}))):"tone"===e?d((e=>({...e,brandPersonality:{...e.brandPersonality,tone:g||void 0}}))):"voice"===e&&d((e=>({...e,brandPersonality:{...e.brandPersonality,voice:g||void 0}}))),P(e)},M=e=>{P(e)},j=e=>{d((t=>({...t,primaryColor:e})))},L=()=>{y.trim()&&(d((e=>{const t=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:[...t,y.trim()]}}})),b(""))};return s?t.jsx("div",{className:"flex justify-center items-center h-full min-h-[500px] w-full bg-white rounded-lg shadow-sm",children:t.jsx(hZ,{})}):p?t.jsx(Qle,{setAutoParse:f,onForceRefresh:()=>S(Date.now())}):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16",children:[t.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 px-6 pt-2",children:[t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("identity"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Identity"})]}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.identity?gu:fu,{className:"h-4 w-4"})})]}),C.identity&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Name"}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("brandName"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandName?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandName"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>k("brandName"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm font-medium",children:u.brandName})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Tagline"}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("brandTagline"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandTagline?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0,placeholder:"Your brand's tagline"}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandTagline"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>k("brandTagline"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm italic",children:u.brandTagline||"No tagline set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Logo"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Square image, 128x128px, PNG recommended"})]})}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-24 h-24 rounded-lg border-2 border-dashed border-gray-200 flex items-center justify-center bg-gray-50 overflow-hidden",children:u.logoUrl?t.jsx("img",{src:`${u.logoUrl}?${_}`,alt:u.brandName||"Brand logo",className:"w-full h-full object-contain"},_):t.jsx(Tu,{className:"h-10 w-10 text-gray-300"})}),t.jsxs("div",{className:"absolute inset-0 bg-black bg-opacity-40 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:[t.jsx("input",{type:"file",ref:N,onChange:e=>{const t=e.target.files?.[0];if(t){const e=new FileReader;e.onloadend=async()=>{const n=e.result.split(",")[1],r=URL.createObjectURL(t);d((e=>({...e,logoUrl:r}))),S(Date.now()),l({logoBase64:n})},e.readAsDataURL(t)}},accept:"image/*",className:"hidden"}),t.jsxs(vZ,{variant:"ghost",size:"sm",onClick:()=>{N.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[t.jsx(Zu,{className:"h-4 w-4 mr-1"}),"Update"]})]})]}),u.logoUrl&&t.jsxs("div",{className:"flex-1 flex items-center gap-2 max-w-md bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx("div",{className:"flex-1 truncate text-sm text-gray-600 font-mono",children:u.logoUrl}),t.jsxs(vZ,{variant:"ghost",size:"sm",onClick:()=>{u.logoUrl&&(navigator.clipboard.writeText(u.logoUrl),T(!0),setTimeout((()=>T(!1)),1500),R({title:"Logo URL copied to clipboard"}))},className:"h-7 px-2 text-xs shrink-0",children:[E?t.jsx(pu,{className:"h-3.5 w-3.5 mr-1 text-green-500"}):t.jsx(_u,{className:"h-3.5 w-3.5 mr-1"}),E?"Copied":"Copy"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("colors"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Colors"})]}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.colors?gu:fu,{className:"h-4 w-4"})})]}),C.colors&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Primary Color"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Your main brand color used throughout the interface"})]}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("primaryColor"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-14 h-14 rounded-lg shadow-md",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsxs("div",h.primaryColor?{className:"flex flex-1 gap-2 max-w-sm",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Iu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx(q3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"pl-10 h-10 font-mono text-sm flex-1",placeholder:"#000000",maxLength:7,autoFocus:!0})]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("primaryColor"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("primaryColor"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}:{className:"flex-1 max-w-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx(Iu,{className:"h-4 w-4 text-gray-400"}),t.jsx("div",{className:"text-sm font-mono",children:u.primaryColor||"#000000"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(q3,{type:"color",value:u.primaryColor||"#000000",onChange:e=>j(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:Jle.map(((e,n)=>t.jsx(vZ,{variant:"ghost",size:"icon",className:"w-6 h-6 rounded-full border border-gray-200 "+(u.primaryColor===e?"ring-2 ring-gray-400 ring-offset-1":""),style:{backgroundColor:e},onClick:()=>j(e)},n)))})]})]})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Secondary Colors"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Additional colors that complement your primary brand color"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"flex flex-wrap gap-3 mb-4",children:u.secondaryColors?.length?u.secondaryColors.map(((e,n)=>t.jsxs("div",{className:"group relative flex flex-col items-center",children:[t.jsx("div",{className:"w-12 h-12 rounded-lg shadow-sm border border-gray-200 mb-1 group-hover:ring-2 ring-gray-200",style:{backgroundColor:e}}),t.jsx("div",{className:"text-xs font-mono text-gray-600",children:e}),t.jsx(vZ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.secondaryColors||[];return{...e,secondaryColors:n.filter((e=>e!==t))}}));var t},className:"absolute -top-1 -right-1 w-5 h-5 bg-white rounded-full shadow border border-gray-200 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(rd,{className:"w-3 h-3 text-gray-500"})})]},n))):t.jsx("div",{className:"text-sm text-gray-500 italic my-2",children:"No secondary colors set"})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex-1 max-w-xs",children:[t.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Add color"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(q3,{type:"color",value:x,onChange:e=>w(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded-md"}),t.jsx(q3,{type:"text",value:x,onChange:e=>w(e.target.value),className:"h-10 font-mono text-sm",placeholder:"#000000",maxLength:7})]})]}),t.jsxs(vZ,{variant:"outline",onClick:()=>{x&&(d((e=>{const t=e.secondaryColors||[];return{...e,secondaryColors:[...t,x]}})),w("#000000"))},className:"h-10",children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add Color"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("personality"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Personality"})]}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.personality?gu:fu,{className:"h-4 w-4"})})]}),C.personality&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Tone"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"The overall feeling and attitude your brand conveys"})]}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("tone"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.tone?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("tone"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("tone"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.tone||"No tone set"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Voice"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"How your brand expresses itself in communication"})]}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("voice"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.voice?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("voice"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("voice"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.voice||"No voice set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Values"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Core principles and beliefs that drive your brand"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"mb-4",children:t.jsx("div",u.brandPersonality?.values&&u.brandPersonality.values.length>0?{className:"flex flex-wrap gap-2",children:u.brandPersonality.values.map(((e,n)=>t.jsxs(kZ,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",style:{borderColor:`${u.primaryColor}30`||"#f3f4f6",backgroundColor:`${u.primaryColor}08`||"#f9fafb"},children:[e,t.jsx(vZ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:n.filter((e=>e!==t))}}}));var t},className:"ml-1.5 w-4 h-4 flex items-center justify-center rounded-full bg-gray-200 hover:bg-red-100 hover:text-red-500 transition-colors",children:t.jsx(rd,{className:"w-2.5 h-2.5"})})]},n)))}:{className:"text-sm text-gray-500 italic py-2",children:"No brand values set"})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{placeholder:"Add a brand value",value:y,onChange:e=>b(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&L()}),t.jsxs(vZ,{variant:"outline",onClick:L,disabled:!y.trim(),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),t.jsxs(AB,{className:"pb-4 px-6",children:[o?t.jsx(vZ,{variant:"outline",className:"gap-1.5",onClick:o,children:"Go Back"}):i&&t.jsxs(vZ,{variant:"outline",className:"gap-1.5",onClick:()=>{f(!0)},children:[t.jsx(Ku,{className:"h-4 w-4 text-amber-500"}),"Auto Parse"]}),t.jsx(vZ,{className:"px-4",style:{backgroundColor:u.primaryColor||void 0},onClick:async()=>{l({brandName:u.brandName,brandTagline:u.brandTagline,logoBase64:u.logoUrl,primaryColor:u.primaryColor,secondaryColors:u.secondaryColors,brandPersonality:u.brandPersonality}),R({title:"Brand settings saved 🚀"}),r&&r()},disabled:c,children:c?"Saving":"Save Changes"})]})]})};var tce=e=>"checkbox"===e.type,nce=e=>e instanceof Date,rce=e=>null==e;const oce=e=>"object"==typeof e;var ice=e=>!rce(e)&&!Array.isArray(e)&&oce(e)&&!nce(e),ace=e=>ice(e)&&e.target?tce(e.target)?e.target.checked:e.target.value:e,sce=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),lce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function cce(e){let t;const n=Array.isArray(e),r="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(lce&&(e instanceof Blob||r)||!n&&!ice(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return ice(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=cce(e[n]));else t=e}return t}var uce=e=>Array.isArray(e)?e.filter(Boolean):[],dce=e=>void 0===e,pce=(e,t,n)=>{if(!t||!ice(e))return n;const r=uce(t.split(/[,[\].]+?/)).reduce(((e,t)=>rce(e)?e:e[t]),e);return dce(r)||r===e?dce(e[t])?n:e[t]:r},fce=e=>"boolean"==typeof e,hce=e=>/^\w*$/.test(e),mce=e=>uce(e.replace(/["|']|\]/g,"").split(/\.|\[/)),gce=(e,t,n)=>{let r=-1;const o=hce(t)?[t]:mce(t),i=o.length,a=i-1;for(;++r<i;){const t=o[r];let i=n;if(r!==a){const n=e[t];i=ice(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const vce="blur",yce="focusout",bce="change",xce="onBlur",wce="onChange",_ce="onSubmit",Sce="onTouched",Ece="all",Tce="max",Cce="min",Ace="maxLength",Nce="minLength",Rce="pattern",Oce="required",Pce="validate",kce=n.createContext(null),Mce=()=>n.useContext(kce);var jce=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Ece&&(t._proxyFormState[o]=!r||Ece),n&&(n[o]=!0),e[o]}});return o},Lce=e=>rce(e)||!oce(e);function Dce(e,t){if(Lce(e)||Lce(t))return e===t;if(nce(e)&&nce(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const n=e[o];if(!r.includes(o))return!1;if("ref"!==o){const e=t[o];if(nce(n)&&nce(e)||ice(n)&&ice(e)||Array.isArray(n)&&Array.isArray(e)?!Dce(n,e):n!==e)return!1}}return!0}const Ice=(e,t)=>{const r=n.useRef(t);Dce(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var Fce=e=>"string"==typeof e,Uce=(e,t,n,r,o)=>Fce(e)?(r&&t.watch.add(e),pce(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),pce(n,e)))):(r&&(t.watchAll=!0),n);function $ce(e){const t=Mce(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=sce(i._names.array,r),l=function(e){const t=Mce(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return Ice((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c(Uce(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:pce(i._formValues,r,pce(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=Mce(),{control:r=t.control,disabled:o,name:i,exact:a}=e||{},[s,l]=n.useState(r._formState),c=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ice((()=>r._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!o&&l({...r._formState,...e})}})),[i,o,a]),n.useEffect((()=>{c.current.isValid&&r._setValid(!0)}),[r]),n.useMemo((()=>jce(s,r,c.current,!1)),[s,r])}({control:i,name:r,exact:!0}),u=n.useRef(e),d=n.useRef(i.register(r,{...e.rules,value:l,...fce(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!pce(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!pce(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!pce(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!pce(c.validatingFields,r)},error:{enumerable:!0,get:()=>pce(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:ace(e),name:r},type:bce})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:pce(i._formValues,r),name:r},type:vce})),[r,i._formValues]),m=n.useCallback((e=>{const t=pce(i._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}),[i._fields,r]),g=n.useMemo((()=>({name:r,value:l,...fce(o)||c.disabled?{disabled:c.disabled||o}:{},onChange:f,onBlur:h,ref:m})),[r,o,c.disabled,f,h,m,l]);return n.useEffect((()=>{const e=i._options.shouldUnregister||a;i.register(r,{...u.current.rules,...fce(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=pce(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=cce(pce(i._options.defaultValues,r));gce(i._defaultValues,r,e),dce(pce(i._formValues,r))&&gce(i._formValues,r,e)}return!s&&i.register(r),()=>{(s?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}}),[r,i,s,a]),n.useEffect((()=>{i._setDisabledField({disabled:o,name:r})}),[o,r,i]),n.useMemo((()=>({field:g,formState:c,fieldState:p})),[g,c,p])}const Vce=e=>e.render($ce(e));var Bce=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},zce=e=>Array.isArray(e)?e:[e],Hce=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},qce=e=>ice(e)&&!Object.keys(e).length,Gce=e=>"file"===e.type,Kce=e=>"function"==typeof e,Wce=e=>{if(!lce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Yce=e=>"select-multiple"===e.type,Xce=e=>"radio"===e.type,Zce=e=>Wce(e)&&e.isConnected;function Qce(e,t){const n=Array.isArray(t)?t:hce(t)?[t]:mce(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=dce(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(ice(r)&&qce(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!dce(e[t]))return!1;return!0}(r))&&Qce(e,n.slice(0,-1)),e}var Jce=e=>{for(const t in e)if(Kce(e[t]))return!0;return!1};function eue(e,t={}){const n=Array.isArray(e);if(ice(e)||n)for(const r in e)Array.isArray(e[r])||ice(e[r])&&!Jce(e[r])?(t[r]=Array.isArray(e[r])?[]:{},eue(e[r],t[r])):rce(e[r])||(t[r]=!0);return t}function tue(e,t,n){const r=Array.isArray(e);if(ice(e)||r)for(const o in e)Array.isArray(e[o])||ice(e[o])&&!Jce(e[o])?dce(t)||Lce(n[o])?n[o]=Array.isArray(e[o])?eue(e[o],[]):{...eue(e[o])}:tue(e[o],rce(t)?{}:t[o],n[o]):n[o]=!Dce(e[o],t[o]);return n}var nue=(e,t)=>tue(e,t,eue(t));const rue={value:!1,isValid:!1},oue={value:!0,isValid:!0};var iue=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!dce(e[0].attributes.value)?dce(e[0].value)||""===e[0].value?oue:{value:e[0].value,isValid:!0}:oue:rue}return rue},aue=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>dce(e)?e:t?""===e?NaN:e?+e:e:n&&Fce(e)?new Date(e):r?r(e):e;const sue={isValid:!1,value:null};var lue=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),sue):sue;function cue(e){const t=e.ref;return Gce(t)?t.files:Xce(t)?lue(e.refs).value:Yce(t)?[...t.selectedOptions].map((({value:e})=>e)):tce(t)?iue(e.refs).value:aue(dce(t.value)?e.ref.value:t.value,e)}var uue=e=>e instanceof RegExp,due=e=>dce(e)?e:uue(e)?e.source:ice(e)?uue(e.value)?e.value.source:e.value:e,pue=e=>({isOnSubmit:!e||e===_ce,isOnBlur:e===xce,isOnChange:e===wce,isOnAll:e===Ece,isOnTouch:e===Sce});const fue="AsyncFunction";var hue=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const mue=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=pce(e,o);if(n){const{_f:e,...i}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],o)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(mue(i,t))break}else if(ice(i)&&mue(i,t))break}}};function gue(e,t,n){const r=pce(e,n);if(r||hce(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=pce(t,r),a=pce(e,r);if(i&&!Array.isArray(i)&&n!==r)return{name:n};if(a&&a.type)return{name:r,error:a};o.pop()}return{name:n}}var vue=(e,t,n)=>{const r=zce(pce(e,n));return gce(r,"root",t[n]),gce(e,n,r),e},yue=e=>Fce(e);function bue(e,t,n="validate"){if(yue(e)||Array.isArray(e)&&e.every(yue)||fce(e)&&!e)return{type:n,message:yue(e)?e:"",ref:t}}var xue=e=>ice(e)&&!uue(e)?e:{value:e,message:""},wue=async(e,t,n,r,o,i)=>{const{ref:a,refs:s,required:l,maxLength:c,minLength:u,min:d,max:p,pattern:f,validate:h,name:m,valueAsNumber:g,mount:v}=e._f,y=pce(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,x=e=>{o&&b.reportValidity&&(b.setCustomValidity(fce(e)?"":e||""),b.reportValidity())},w={},_=Xce(a),S=tce(a),E=_||S,T=(g||Gce(a))&&dce(a.value)&&dce(y)||Wce(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=Bce.bind(null,m,r,w),A=(e,t,n,r=Ace,o=Nce)=>{const i=e?t:n;w[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(i?!Array.isArray(y)||!y.length:l&&(!E&&(T||rce(y))||fce(y)&&!y||S&&!iue(s).isValid||_&&!lue(s).isValid)){const{value:e,message:t}=yue(l)?{value:!!l,message:l}:xue(l);if(e&&(w[m]={type:Oce,message:t,ref:b,...C(Oce,t)},!r))return x(t),w}if(!(T||rce(d)&&rce(p))){let e,t;const n=xue(p),o=xue(d);if(rce(y)||isNaN(y)){const r=a.valueAsDate||new Date(y),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==a.type,l="week"==a.type;Fce(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),Fce(o.value)&&y&&(t=s?i(y)<i(o.value):l?y<o.value:r<new Date(o.value))}else{const r=a.valueAsNumber||(y?+y:y);rce(n.value)||(e=r>n.value),rce(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,Tce,Cce),!r))return x(w[m].message),w}if((c||u)&&!T&&(Fce(y)||i&&Array.isArray(y))){const e=xue(c),t=xue(u),n=!rce(e.value)&&y.length>+e.value,o=!rce(t.value)&&y.length<+t.value;if((n||o)&&(A(n,e.message,t.message),!r))return x(w[m].message),w}if(f&&!T&&Fce(y)){const{value:e,message:t}=xue(f);if(uue(e)&&!y.match(e)&&(w[m]={type:Rce,message:t,ref:a,...C(Rce,t)},!r))return x(t),w}if(h)if(Kce(h)){const e=bue(await h(y,n),b);if(e&&(w[m]={...e,...C(Pce,e.message)},!r))return x(e.message),w}else if(ice(h)){let e={};for(const t in h){if(!qce(e)&&!r)break;const o=bue(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},x(o.message),r&&(w[m]=e))}if(!qce(e)&&(w[m]={ref:b,...e},!r))return w}return x(!0),w};const _ue={mode:_ce,reValidateMode:wce,shouldFocusError:!0};function Sue(e={}){let t={..._ue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Kce(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const r={};let o,i=(ice(t.defaultValues)||ice(t.values))&&cce(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:cce(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let d={...u};const p={array:Hce(),state:Hce()},f=pue(t.mode),h=pue(t.reValidateMode),m=t.criteriaMode===Ece,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?qce((await w()).errors):await _(r,!0);e!==n.isValid&&p.state.next({isValid:e})}},v=(e,r)=>{!t.disabled&&(u.isValidating||u.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(r?gce(n.validatingFields,e,r):Qce(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!qce(n.validatingFields)}))},y=(e,t,n,o)=>{const l=pce(r,e);if(l){const r=pce(a,e,dce(n)?pce(i,e):n);dce(r)||o&&o.defaultChecked||t?gce(a,e,t?r:cue(l._f)):T(e,r),s.mount&&g()}},b=(e,r,o,a,s)=>{let l=!1,c=!1;const f={name:e};if(!t.disabled){if(!o||a){(u.isDirty||d.isDirty)&&(c=n.isDirty,n.isDirty=f.isDirty=S(),l=c!==f.isDirty);const t=Dce(pce(i,e),r);c=!!pce(n.dirtyFields,e),t?Qce(n.dirtyFields,e):gce(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=pce(n.touchedFields,e);t||(gce(n.touchedFields,e,o),f.touchedFields=n.touchedFields,l=l||(u.touchedFields||d.touchedFields)&&t!==o)}l&&s&&p.state.next(f)}return l?f:{}},x=(e,r,i,a)=>{const s=pce(n.errors,e),l=(u.isValid||d.isValid)&&fce(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{gce(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?gce(n.errors,e,i):Qce(n.errors,e)),(i?!Dce(s,i):s)||!qce(a)||l){const t={...a,...l&&fce(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{v(e,!0);const n=await t.resolver(a,t.context,((e,t,n,r)=>{const o={};for(const i of e){const e=pce(t,i);e&&gce(o,i,e._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}})(e||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return v(e),n},_=async(e,r,o={valid:!0})=>{for(const s in e){const c=e[s];if(c){const{_f:e,...d}=c;if(e){const d=l.array.has(e.name),p=c._f&&(!!(i=c._f)&&!!i.validate&&!!(Kce(i.validate)&&i.validate.constructor.name===fue||ice(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===fue))));p&&u.validatingFields&&v([s],!0);const f=await wue(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(pce(f,e.name)?d?vue(n.errors,f,e.name):gce(n.errors,e.name,f[e.name]):Qce(n.errors,e.name))}!qce(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&gce(a,e,n),!Dce(P(),i)),E=(e,t,n)=>Uce(e,l,{...s.mount?a:dce(t)?i:Fce(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=pce(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&gce(a,e,aue(t,n)),i=Wce(n.ref)&&rce(t)?"":t,Yce(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?tce(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):n.refs[0]&&(n.refs[0].checked=!!i):n.refs.forEach((e=>e.checked=e.value===i)):Gce(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:cce(a)})))}(n.shouldDirty||n.shouldTouch)&&b(e,i,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&O(e)},C=(e,t,n)=>{for(const o in t){const i=t[o],a=`${e}.${o}`,s=pce(r,a);(l.array.has(e)||ice(i)||s&&!s._f)&&!nce(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=pce(r,e),f=l.array.has(e),h=cce(t);gce(a,e,h),f?(p.array.next({name:e,values:cce(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:nue(i,a),isDirty:S(e,h)})):!c||c._f||rce(h)?T(e,h,o):C(e,h,o),hue(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:cce(a)})},N=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=pce(r,c),E=e=>{y=Number.isNaN(e)||nce(e)&&isNaN(e.getTime())||Dce(e,pce(a,c,e))};if(S){let s,C;const A=i.type?cue(S._f):ace(e),N=e.type===vce||e.type===yce,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||pce(n.errors,c)||S._f.deps)||((e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e))(N,pce(n.touchedFields,c),n.isSubmitted,h,f),P=hue(c,l,N);gce(a,c,A),N?(S._f.onBlur&&S._f.onBlur(e),o&&o(0)):S._f.onChange&&S._f.onChange(e);const k=b(c,A,N),M=!qce(k)||P;if(!N&&p.state.next({name:c,type:e.type,values:cce(a)}),R)return(u.isValid||d.isValid)&&("onBlur"===t.mode?N&&g():N||g()),M&&p.state.next({name:c,...P?{}:k});if(!N&&P&&p.state.next({...n}),t.resolver){const{errors:e}=await w([c]);if(E(A),y){const t=gue(n.errors,r,c),o=gue(e,r,t.name||c);s=o.error,c=o.name,C=qce(e)}}else v([c],!0),s=(await wue(S,l.disabled,a,m,t.shouldUseNativeValidation))[c],v([c]),E(A),y&&(s?C=!1:(u.isValid||d.isValid)&&(C=await _(r,!0)));y&&(S._f.deps&&O(S._f.deps),x(c,C,s,k))}var T},R=(e,t)=>{if(pce(n.errors,t)&&e.focus)return e.focus(),1},O=async(e,o={})=>{let i,a;const s=zce(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=pce(t,r);e?gce(n.errors,r,e):Qce(n.errors,r)}else n.errors=t;return t})(dce(e)?e:s);i=qce(t),a=e?!s.some((e=>pce(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=pce(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!Fce(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&mue(r,R,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return dce(e)?t:Fce(e)?pce(t,e):e.map((e=>pce(t,e)))},k=(e,t)=>({invalid:!!pce((t||n).errors,e),isDirty:!!pce((t||n).dirtyFields,e),error:pce((t||n).errors,e),isValidating:!!pce(n.validatingFields,e),isTouched:!!pce((t||n).touchedFields,e)}),M=(e,t,o)=>{const i=(pce(r,e,{_f:{}})._f||{}).ref,a=pce(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;gce(n.errors,e,{...u,...t,ref:i}),p.state.next({name:e,errors:n.errors,isValid:!1}),o&&o.shouldFocus&&i&&i.focus&&i.focus()},j=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!zce(r).some((e=>e&&(i?e===o:e.startsWith(o)||o.startsWith(e))))||!((e,t,n,r)=>{n(e);const{name:o,...i}=e;return qce(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||Ece)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,L=(e,o={})=>{for(const s of e?zce(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(Qce(r,s),Qce(a,s)),!o.keepError&&Qce(n.errors,s),!o.keepDirty&&Qce(n.dirtyFields,s),!o.keepTouched&&Qce(n.touchedFields,s),!o.keepIsValidating&&Qce(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&Qce(i,s);p.state.next({values:cce(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},D=({disabled:e,name:t})=>{(fce(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=pce(r,e);const a=fce(n.disabled)||fce(t.disabled);return gce(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?D({disabled:fce(n.disabled)?n.disabled:t.disabled,name:e}):y(e,!0,n.value),{...a?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:due(n.min),max:due(n.max),minLength:due(n.minLength),maxLength:due(n.maxLength),pattern:due(n.pattern)}:{},name:e,onChange:N,onBlur:N,ref:a=>{if(a){I(e,n),o=pce(r,e);const t=dce(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>Xce(e)||tce(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;gce(r,e,{_f:{...o._f,...s?{refs:[...l.filter(Zce),t,...Array.isArray(pce(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=pce(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!sce(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&mue(r,R,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=cce(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await w();n.errors=e,c=t}else await _(r);if(l.disabled.size)for(const e of l.disabled)gce(c,e,void 0);if(Qce(n.errors,"root"),qce(n.errors)){p.state.next({errors:{}});try{await e(c,i)}catch(u){s=u}}else o&&await o({...n.errors},i),F(),setTimeout(F);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:qce(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?cce(e):i,d=cce(c),f=qce(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(nue(i,a))]);for(const t of Array.from(e))pce(n.dirtyFields,t)?gce(h,t,pce(a,t)):A(t,pce(h,t))}else{if(lce&&dce(e))for(const e of l.mount){const t=pce(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Wce(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,pce(h,e))}a=cce(h),p.array.next({values:{...h}}),p.state.next({values:{...h}})}l={mount:o.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!o.keepIsValid||!!o.keepDirtyValues,s.watch=!!t.shouldUnregister,p.state.next({submitCount:o.keepSubmitCount?n.submitCount:0,isDirty:!f&&(o.keepDirty?n.isDirty:!(!o.keepDefaultValues||Dce(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?nue(i,a):n.dirtyFields:o.keepDefaultValues&&e?nue(i,e):o.keepDirty?n.dirtyFields:{},touchedFields:o.keepTouched?n.touchedFields:{},errors:o.keepErrors?n.errors:{},isSubmitSuccessful:!!o.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},V=(e,t)=>$(Kce(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:L,getFieldState:k,handleSubmit:U,setError:M,_subscribe:j,_runSchema:w,_getWatch:E,_getDirty:S,_setValid:g,_setFieldArray:(e,o=[],l,c,f=!0,h=!0)=>{if(c&&l&&!t.disabled){if(s.action=!0,h&&Array.isArray(pce(r,e))){const t=l(pce(r,e),c.argA,c.argB);f&&gce(r,e,t)}if(h&&Array.isArray(pce(n.errors,e))){const t=l(pce(n.errors,e),c.argA,c.argB);f&&gce(n.errors,e,t),((e,t)=>{!uce(pce(e,t)).length&&Qce(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(pce(n.touchedFields,e))){const t=l(pce(n.touchedFields,e),c.argA,c.argB);f&&gce(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=nue(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else gce(a,e,o)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>uce(pce(s.mount?a:i,e,t.shouldUnregister?pce(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>Kce(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=pce(r,e);t&&(t._f.refs?t._f.refs.every((e=>!Zce(e))):!Zce(t._f.ref))&&L(e)}l.unMount=new Set},_disableForm:e=>{fce(e)&&(p.state.next({disabled:e}),mue(r,((t,n)=>{const o=pce(r,n);o&&(t.disabled=o._f.disabled||e,Array.isArray(o._f.refs)&&o._f.refs.forEach((t=>{t.disabled=o._f.disabled||e})))}),0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return r},get _formValues(){return a},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:e=>(s.mount=!0,d={...d,...e.formState},j({...e,formState:d})),trigger:O,register:I,handleSubmit:U,watch:(e,t)=>Kce(e)?p.state.subscribe({next:n=>e(E(void 0,t),n)}):E(e,t,!0),setValue:A,getValues:P,reset:V,resetField:(e,t={})=>{pce(r,e)&&(dce(t.defaultValue)?A(e,cce(pce(i,e))):(A(e,t.defaultValue),gce(i,e,cce(t.defaultValue))),t.keepTouched||Qce(n.touchedFields,e),t.keepDirty||(Qce(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,cce(pce(i,e))):S()),t.keepError||(Qce(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&zce(e).forEach((e=>Qce(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:L,setError:M,setFocus:(e,t={})=>{const n=pce(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&Kce(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const Eue="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Tue(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:Kce(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Kce(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:Sue(e),formState:o},e.formControl&&e.defaultValues&&!Kce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Eue((()=>{const e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i((e=>({...e,isReady:!0}))),e}),[a]),n.useEffect((()=>a._disableForm(e.disabled)),[a,e.disabled]),n.useEffect((()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode),e.errors&&!qce(e.errors)&&a._setErrors(e.errors)}),[a,e.errors,e.mode,e.reValidateMode]),n.useEffect((()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})}),[a,e.shouldUnregister]),n.useEffect((()=>{if(a._proxyFormState.isDirty){const e=a._getDirty();e!==o.isDirty&&a._subjects.state.next({isDirty:e})}}),[a,o.isDirty]),n.useEffect((()=>{e.values&&!Dce(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,i((e=>({...e})))):a._resetDefaultValues()}),[a,e.values]),n.useEffect((()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()})),t.current.formState=jce(o,a),t.current}const Cue=(e,t,n)=>{if(e&&"reportValidity"in e){const r=pce(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Aue=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Cue(r.ref,n,e):r.refs&&r.refs.forEach((t=>Cue(t,n,e)))}},Nue=(e,t)=>{t.shouldUseNativeValidation&&Aue(e,t);const n={};for(const r in e){const o=pce(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Rue(t.names||Object.keys(e),r)){const e=Object.assign({},pce(n,r));gce(e,"root",i),gce(n,r,e)}else gce(n,r,i)}return n},Rue=(e,t)=>e.some((e=>e.startsWith(t+".")));var Oue=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,i=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[a]={message:s.message,type:s.code}}else n[a]={message:i,type:o};if("unionErrors"in r&&r.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var l=n[a].types,c=l&&l[r.code];n[a]=Bce(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},Pue=function(e,t,n){return void 0===n&&(n={}),function(r,o,i){try{return Promise.resolve(function(o,a){try{var s=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then((function(e){return i.shouldUseNativeValidation&&Aue({},i),{errors:{},values:n.raw?r:e}}))}catch(l){return a(l)}return s&&s.then?s.then(void 0,a):s}(0,(function(e){if(t=e,Array.isArray(null==t?void 0:t.errors))return{values:{},errors:Nue(Oue(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};const kue="reach-styles-module__base___r-a1U",Mue=ru([kue],{variants:{variant:{default:"reach-styles-module__default___vu2Rt",primary:"reach-styles-module__primary___mGKjo",success:"reach-styles-module__success___xn1Y1",warning:"reach-styles-module__warning___jdyU9",error:"reach-styles-module__error___Z-3IS"},size:{default:"reach-styles-module__sizeDefault___oS6W2",sm:"reach-styles-module__sizeSm___GI826",lg:"reach-styles-module__sizeLg___J--WF"},position:{default:"reach-styles-module__positionDefault___visr6",top:"reach-styles-module__positionTop___y6h-n",bottom:"reach-styles-module__positionBottom___vYLkd",inline:"reach-styles-module__positionInline___NjZsw"}},defaultVariants:{variant:"default",size:"default",position:"default"}}),jue=e=>{const{children:t,...r}=e;return n.createElement(kce.Provider,{value:r},t)},Lue=i.createContext({}),Due=({...e})=>t.jsx(Lue.Provider,{value:{name:e.name},children:t.jsx(Vce,{...e})}),Iue=()=>{const e=i.useContext(Lue),t=i.useContext(Fue),{getFieldState:n,formState:r}=Mce(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...o}},Fue=i.createContext({}),Uue=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(Fue.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:Zd("space-y-2",e),...n})})}));Uue.displayName="FormItem";const $ue=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=Iue();return t.jsx(L9,{ref:r,className:Zd(o&&"text-destructive",e),htmlFor:i,...n})}));$ue.displayName="FormLabel";const Vue=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=Iue();return t.jsx(ZU,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));Vue.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=Iue();return t.jsx("p",{ref:r,id:o,className:Zd("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const Bue=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=Iue(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:Zd("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));Bue.displayName="FormMessage";const zue=({control:e,disabled:n,legalNameRef:r})=>t.jsxs(t.Fragment,{children:[t.jsx(Due,{control:e,name:"company.legalName",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Legal Company Name"}),t.jsx(Vue,{children:t.jsx(q3,{...e,ref:r,disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"company.type",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Company Type"}),t.jsxs(cte,{onValueChange:e.onChange,defaultValue:e.value,disabled:n,children:[t.jsx(Vue,{children:t.jsx(dte,{className:"h-8",children:t.jsx(ute,{placeholder:"Select company type"})})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"corporation",children:"Corporation"}),t.jsx(mte,{value:"llc",children:"LLC"})]})]}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"company.ein",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"EIN (Employer Identification Number)"}),t.jsx(Vue,{children:t.jsx(q3,{...e,type:"text",disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})})]}),Hue=({control:e,disabled:n})=>t.jsxs(t.Fragment,{children:[t.jsx(Due,{control:e,name:"representative.title",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Title"}),t.jsx(Vue,{children:t.jsx(q3,{...e,disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"representative.firstName",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"First Name"}),t.jsx(Vue,{children:t.jsx(q3,{...e,disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"representative.email",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Email"}),t.jsx(Vue,{children:t.jsx(q3,{...e,type:"email",disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"representative.phone",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Contact Phone Number"}),t.jsx(Vue,{children:t.jsx(q3,{...e,type:"tel",disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"representative.position",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Position"}),t.jsxs(cte,{onValueChange:e.onChange,defaultValue:e.value,disabled:n,children:[t.jsx(Vue,{children:t.jsx(dte,{className:"h-8",children:t.jsx(ute,{placeholder:"Select position"})})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"owner",children:"Owner"}),t.jsx(mte,{value:"manager",children:"Manager"}),t.jsx(mte,{value:"director",children:"Director"})]})]}),t.jsx(Bue,{className:"text-xs"})]})})]});var que,Gue,Kue;(Gue=que||(que={})).assertEqual=e=>e,Gue.assertIs=function(e){},Gue.assertNever=function(e){throw new Error},Gue.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Gue.getValidEnumValues=e=>{const t=Gue.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return Gue.objectValues(n)},Gue.objectValues=e=>Gue.objectKeys(e).map((function(t){return e[t]})),Gue.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},Gue.find=(e,t)=>{for(const n of e)if(t(n))return n},Gue.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,Gue.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},Gue.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Kue||(Kue={})).mergeShapes=(e,t)=>({...e,...t});const Wue=que.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yue=e=>{switch(typeof e){case"undefined":return Wue.undefined;case"string":return Wue.string;case"number":return isNaN(e)?Wue.nan:Wue.number;case"boolean":return Wue.boolean;case"function":return Wue.function;case"bigint":return Wue.bigint;case"symbol":return Wue.symbol;case"object":return Array.isArray(e)?Wue.array:null===e?Wue.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Wue.promise:"undefined"!=typeof Map&&e instanceof Map?Wue.map:"undefined"!=typeof Set&&e instanceof Set?Wue.set:"undefined"!=typeof Date&&e instanceof Date?Wue.date:Wue.object;default:return Wue.unknown}},Xue=que.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Zue extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const o of e.issues)if("invalid_union"===o.code)o.unionErrors.map(r);else if("invalid_return_type"===o.code)r(o.returnTypeError);else if("invalid_arguments"===o.code)r(o.argumentsError);else if(0===o.path.length)n._errors.push(t(o));else{let e=n,r=0;for(;r<o.path.length;){const n=o.path[r];r===o.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Zue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,que.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Zue.create=e=>new Zue(e);const Que=(e,t)=>{let n;switch(e.code){case Xue.invalid_type:n=e.received===Wue.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Xue.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,que.jsonStringifyReplacer)}`;break;case Xue.unrecognized_keys:n=`Unrecognized key(s) in object: ${que.joinValues(e.keys,", ")}`;break;case Xue.invalid_union:n="Invalid input";break;case Xue.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${que.joinValues(e.options)}`;break;case Xue.invalid_enum_value:n=`Invalid enum value. Expected ${que.joinValues(e.options)}, received '${e.received}'`;break;case Xue.invalid_arguments:n="Invalid function arguments";break;case Xue.invalid_return_type:n="Invalid function return type";break;case Xue.invalid_date:n="Invalid date";break;case Xue.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:que.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Xue.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Xue.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Xue.custom:n="Invalid input";break;case Xue.invalid_intersection_types:n="Intersection results could not be merged";break;case Xue.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Xue.not_finite:n="Number must be finite";break;default:n=t.defaultError,que.assertNever(e)}return{message:n}};let Jue=Que;function ede(){return Jue}const tde=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],a={...o,path:i};if(void 0!==o.message)return{...o,path:i,message:o.message};let s="";const l=r.filter((e=>!!e)).slice().reverse();for(const c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function nde(e,t){const n=ede(),r=tde({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Que?void 0:Que].filter((e=>!!e))});e.common.issues.push(r)}class rde{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return ode;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return rde.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:o}=r;if("aborted"===t.status)return ode;if("aborted"===o.status)return ode;"dirty"===t.status&&e.dirty(),"dirty"===o.status&&e.dirty(),"__proto__"===t.value||void 0===o.value&&!r.alwaysSet||(n[t.value]=o.value)}return{status:e.value,value:n}}}const ode=Object.freeze({status:"aborted"}),ide=e=>({status:"dirty",value:e}),ade=e=>({status:"valid",value:e}),sde=e=>"aborted"===e.status,lde=e=>"dirty"===e.status,cde=e=>"valid"===e.status,ude=e=>"undefined"!=typeof Promise&&e instanceof Promise;function dde(e,t,n,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function pde(e,t,n,r,o){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var fde,hde,mde,gde;"function"==typeof SuppressedError&&SuppressedError,(hde=fde||(fde={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},hde.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class vde{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const yde=(e,t)=>{if(cde(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Zue(e.common.issues);return this._error=t,this._error}}};function bde(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:o};return{errorMap:(t,o)=>{var i,a;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:o.defaultError}:void 0===o.data?{message:null!==(i=null!=s?s:r)&&void 0!==i?i:o.defaultError}:"invalid_type"!==t.code?{message:o.defaultError}:{message:null!==(a=null!=s?s:n)&&void 0!==a?a:o.defaultError}},description:o}}class xde{get description(){return this._def.description}_getType(e){return Yue(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Yue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rde,ctx:{common:e.parent.common,data:e.data,parsedType:Yue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ude(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yue(e)},o=this._parseSync({data:e,path:r.path,parent:r});return yde(r,o)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yue(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return cde(t)?{value:t.value}:{issues:r.common.issues}}catch(eEe){(null===(n=null===(t=null==eEe?void 0:eEe.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then((e=>cde(e)?{value:e.value}:{issues:r.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yue(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(ude(r)?r:Promise.resolve(r));return yde(n,o)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const o=e(t),i=()=>r.addIssue({code:Xue.custom,...n(t)});return"undefined"!=typeof Promise&&o instanceof Promise?o.then((e=>!!e||(i(),!1))):!!o||(i(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new wpe({schema:this,typeName:jpe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return _pe.create(this,this._def)}nullable(){return Spe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return npe.create(this)}promise(){return xpe.create(this,this._def)}or(e){return ipe.create([this,e],this._def)}and(e){return cpe.create(this,e,this._def)}transform(e){return new wpe({...bde(this._def),schema:this,typeName:jpe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Epe({...bde(this._def),innerType:this,defaultValue:t,typeName:jpe.ZodDefault})}brand(){return new Npe({typeName:jpe.ZodBranded,type:this,...bde(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Tpe({...bde(this._def),innerType:this,catchValue:t,typeName:jpe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Rpe.create(this,e)}readonly(){return Ope.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const wde=/^c[^\s-]{8,}$/i,_de=/^[0-9a-z]+$/,Sde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ede=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Tde=/^[a-z0-9_-]{21}$/i,Cde=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ade=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Nde=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Rde;const Ode=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Pde=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,kde=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Mde=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jde=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Lde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dde="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ide=new RegExp(`^${Dde}$`);function Fde(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function Ude(e){return new RegExp(`^${Fde(e)}$`)}function $de(e){let t=`${Dde}T${Fde(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Vde(e,t){if(!Cde.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return"object"==typeof o&&null!==o&&(!(!o.typ||!o.alg)&&(!t||o.alg===t))}catch(tEe){return!1}}function Bde(e,t){return!("v4"!==t&&t||!Pde.test(e))||!("v6"!==t&&t||!Mde.test(e))}class zde extends xde{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Wue.string){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.string,received:t.parsedType}),ode}const t=new rde;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const r=e.data.length>i.value,o=e.data.length<i.value;(r||o)&&(n=this._getOrReturnCtx(e,n),r?nde(n,{code:Xue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&nde(n,{code:Xue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)Nde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"email",code:Xue.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Rde||(Rde=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Rde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"emoji",code:Xue.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)Ede.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"uuid",code:Xue.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)Tde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"nanoid",code:Xue.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)wde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"cuid",code:Xue.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)_de.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"cuid2",code:Xue.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)Sde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"ulid",code:Xue.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(tEe){n=this._getOrReturnCtx(e,n),nde(n,{validation:"url",code:Xue.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"regex",code:Xue.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){$de(i).test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Ide.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){Ude(i).test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?Ade.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"duration",code:Xue.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!Ode.test(r))&&("v6"!==o&&o||!kde.test(r))&&(n=this._getOrReturnCtx(e,n),nde(n,{validation:"ip",code:Xue.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?Vde(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"jwt",code:Xue.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Bde(e.data,i.version)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"cidr",code:Xue.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?jde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"base64",code:Xue.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Lde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"base64url",code:Xue.invalid_string,message:i.message}),t.dirty()):que.assertNever(i);var r,o;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:Xue.invalid_string,...fde.errToObj(n)})}_addCheck(e){return new zde({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...fde.errToObj(e)})}url(e){return this._addCheck({kind:"url",...fde.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...fde.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...fde.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...fde.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...fde.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...fde.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...fde.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...fde.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...fde.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...fde.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...fde.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...fde.errToObj(e)})}datetime(e){var t,n;return this._addCheck("string"==typeof e?{kind:"datetime",precision:null,offset:!1,local:!1,message:e}:{kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...fde.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return this._addCheck("string"==typeof e?{kind:"time",precision:null,message:e}:{kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...fde.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...fde.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...fde.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...fde.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...fde.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...fde.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...fde.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...fde.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...fde.errToObj(t)})}nonempty(e){return this.min(1,fde.errToObj(e))}trim(){return new zde({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new zde({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new zde({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Hde(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r;return parseInt(e.toFixed(o).replace(".",""))%parseInt(t.toFixed(o).replace(".",""))/Math.pow(10,o)}zde.create=e=>{var t;return new zde({checks:[],typeName:jpe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...bde(e)})};class qde extends xde{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==Wue.number){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.number,received:t.parsedType}),ode}let t;const n=new rde;for(const r of this._def.checks)if("int"===r.kind)que.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==Hde(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.not_finite,message:r.message}),n.dirty()):que.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,fde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,fde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,fde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,fde.toString(t))}setLimit(e,t,n,r){return new qde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:fde.toString(r)}]})}_addCheck(e){return new qde({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:fde.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:fde.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:fde.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fde.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fde.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&que.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}qde.create=e=>new qde({checks:[],typeName:jpe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...bde(e)});class Gde extends xde{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(tEe){return this._getInvalidInput(e)}if(this._getType(e)!==Wue.bigint)return this._getInvalidInput(e);let t;const n=new rde;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):que.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.bigint,received:t.parsedType}),ode}gte(e,t){return this.setLimit("min",e,!0,fde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,fde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,fde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,fde.toString(t))}setLimit(e,t,n,r){return new Gde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:fde.toString(r)}]})}_addCheck(e){return new Gde({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:fde.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Gde.create=e=>{var t;return new Gde({checks:[],typeName:jpe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...bde(e)})};class Kde extends xde{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Wue.boolean){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.boolean,received:t.parsedType}),ode}return ade(e.data)}}Kde.create=e=>new Kde({typeName:jpe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...bde(e)});class Wde extends xde{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Wue.date){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.date,received:t.parsedType}),ode}if(isNaN(e.data.getTime())){return nde(this._getOrReturnCtx(e),{code:Xue.invalid_date}),ode}const t=new rde;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):que.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Wde({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:fde.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:fde.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Wde.create=e=>new Wde({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:jpe.ZodDate,...bde(e)});class Yde extends xde{_parse(e){if(this._getType(e)!==Wue.symbol){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.symbol,received:t.parsedType}),ode}return ade(e.data)}}Yde.create=e=>new Yde({typeName:jpe.ZodSymbol,...bde(e)});class Xde extends xde{_parse(e){if(this._getType(e)!==Wue.undefined){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.undefined,received:t.parsedType}),ode}return ade(e.data)}}Xde.create=e=>new Xde({typeName:jpe.ZodUndefined,...bde(e)});class Zde extends xde{_parse(e){if(this._getType(e)!==Wue.null){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.null,received:t.parsedType}),ode}return ade(e.data)}}Zde.create=e=>new Zde({typeName:jpe.ZodNull,...bde(e)});class Qde extends xde{constructor(){super(...arguments),this._any=!0}_parse(e){return ade(e.data)}}Qde.create=e=>new Qde({typeName:jpe.ZodAny,...bde(e)});class Jde extends xde{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ade(e.data)}}Jde.create=e=>new Jde({typeName:jpe.ZodUnknown,...bde(e)});class epe extends xde{_parse(e){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.never,received:t.parsedType}),ode}}epe.create=e=>new epe({typeName:jpe.ZodNever,...bde(e)});class tpe extends xde{_parse(e){if(this._getType(e)!==Wue.undefined){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.void,received:t.parsedType}),ode}return ade(e.data)}}tpe.create=e=>new tpe({typeName:jpe.ZodVoid,...bde(e)});class npe extends xde{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Wue.array)return nde(t,{code:Xue.invalid_type,expected:Wue.array,received:t.parsedType}),ode;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(nde(t,{code:e?Xue.too_big:Xue.too_small,minimum:o?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(nde(t,{code:Xue.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(nde(t,{code:Xue.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new vde(t,e,t.path,n))))).then((e=>rde.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new vde(t,e,t.path,n))));return rde.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new npe({...this._def,minLength:{value:e,message:fde.toString(t)}})}max(e,t){return new npe({...this._def,maxLength:{value:e,message:fde.toString(t)}})}length(e,t){return new npe({...this._def,exactLength:{value:e,message:fde.toString(t)}})}nonempty(e){return this.min(1,e)}}function rpe(e){if(e instanceof ope){const t={};for(const n in e.shape){t[n]=_pe.create(rpe(e.shape[n]))}return new ope({...e._def,shape:()=>t})}return e instanceof npe?new npe({...e._def,type:rpe(e.element)}):e instanceof _pe?_pe.create(rpe(e.unwrap())):e instanceof Spe?Spe.create(rpe(e.unwrap())):e instanceof upe?upe.create(e.items.map((e=>rpe(e)))):e}npe.create=(e,t)=>new npe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:jpe.ZodArray,...bde(t)});class ope extends xde{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=que.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Wue.object){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.object,received:t.parsedType}),ode}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof epe&&"strip"===this._def.unknownKeys))for(const s in n.data)o.includes(s)||i.push(s);const a=[];for(const s of o){a.push({key:{status:"valid",value:s},value:r[s]._parse(new vde(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof epe){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of i)a.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)i.length>0&&(nde(n,{code:Xue.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){a.push({key:{status:"valid",value:t},value:e._parse(new vde(n,n.data[t],n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>rde.mergeObjectSync(t,e))):rde.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new ope({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,o,i,a;const s=null!==(i=null===(o=(r=this._def).errorMap)||void 0===o?void 0:o.call(r,t,n).message)&&void 0!==i?i:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=fde.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new ope({...this._def,unknownKeys:"strip"})}passthrough(){return new ope({...this._def,unknownKeys:"passthrough"})}extend(e){return new ope({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ope({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:jpe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ope({...this._def,catchall:e})}pick(e){const t={};return que.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new ope({...this._def,shape:()=>t})}omit(e){const t={};return que.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new ope({...this._def,shape:()=>t})}deepPartial(){return rpe(this)}partial(e){const t={};return que.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new ope({...this._def,shape:()=>t})}required(e){const t={};return que.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof _pe;)e=e._def.innerType;t[n]=e}})),new ope({...this._def,shape:()=>t})}keyof(){return vpe(que.objectKeys(this.shape))}}ope.create=(e,t)=>new ope({shape:()=>e,unknownKeys:"strip",catchall:epe.create(),typeName:jpe.ZodObject,...bde(t)}),ope.strictCreate=(e,t)=>new ope({shape:()=>e,unknownKeys:"strict",catchall:epe.create(),typeName:jpe.ZodObject,...bde(t)}),ope.lazycreate=(e,t)=>new ope({shape:e,unknownKeys:"strip",catchall:epe.create(),typeName:jpe.ZodObject,...bde(t)});class ipe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map((e=>new Zue(e.ctx.common.issues)));return nde(t,{code:Xue.invalid_union,unionErrors:n}),ode}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},o=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const o=r.map((e=>new Zue(e)));return nde(t,{code:Xue.invalid_union,unionErrors:o}),ode}}get options(){return this._def.options}}ipe.create=(e,t)=>new ipe({options:e,typeName:jpe.ZodUnion,...bde(t)});const ape=e=>e instanceof mpe?ape(e.schema):e instanceof wpe?ape(e.innerType()):e instanceof gpe?[e.value]:e instanceof ype?e.options:e instanceof bpe?que.objectValues(e.enum):e instanceof Epe?ape(e._def.innerType):e instanceof Xde?[void 0]:e instanceof Zde?[null]:e instanceof _pe?[void 0,...ape(e.unwrap())]:e instanceof Spe?[null,...ape(e.unwrap())]:e instanceof Npe||e instanceof Ope?ape(e.unwrap()):e instanceof Tpe?ape(e._def.innerType):[];class spe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Wue.object)return nde(t,{code:Xue.invalid_type,expected:Wue.object,received:t.parsedType}),ode;const n=this.discriminator,r=this.optionsMap.get(t.data[n]);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(nde(t,{code:Xue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ode)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const o of t){const t=ape(o.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,o)}}return new spe({typeName:jpe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...bde(n)})}}function lpe(e,t){const n=Yue(e),r=Yue(t);if(e===t)return{valid:!0,data:e};if(n===Wue.object&&r===Wue.object){const n=que.objectKeys(t),r=que.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=lpe(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===Wue.array&&r===Wue.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=lpe(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===Wue.date&&r===Wue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class cpe extends xde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(sde(e)||sde(r))return ode;const o=lpe(e.value,r.value);return o.valid?((lde(e)||lde(r))&&t.dirty(),{status:t.value,value:o.data}):(nde(n,{code:Xue.invalid_intersection_types}),ode)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}cpe.create=(e,t,n)=>new cpe({left:e,right:t,typeName:jpe.ZodIntersection,...bde(n)});class upe extends xde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wue.array)return nde(n,{code:Xue.invalid_type,expected:Wue.array,received:n.parsedType}),ode;if(n.data.length<this._def.items.length)return nde(n,{code:Xue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ode;!this._def.rest&&n.data.length>this._def.items.length&&(nde(n,{code:Xue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new vde(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>rde.mergeArray(t,e))):rde.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new upe({...this._def,rest:e})}}upe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new upe({items:e,typeName:jpe.ZodTuple,rest:null,...bde(t)})};class dpe extends xde{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wue.object)return nde(n,{code:Xue.invalid_type,expected:Wue.object,received:n.parsedType}),ode;const r=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)r.push({key:o._parse(new vde(n,a,n.path,a)),value:i._parse(new vde(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?rde.mergeObjectAsync(t,r):rde.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new dpe(t instanceof xde?{keyType:e,valueType:t,typeName:jpe.ZodRecord,...bde(n)}:{keyType:zde.create(),valueType:e,typeName:jpe.ZodRecord,...bde(t)})}}class ppe extends xde{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wue.map)return nde(n,{code:Xue.invalid_type,expected:Wue.map,received:n.parsedType}),ode;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new vde(n,e,n.path,[i,"key"])),value:o._parse(new vde(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of i){const r=await n.key,o=await n.value;if("aborted"===r.status||"aborted"===o.status)return ode;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of i){const r=n.key,o=n.value;if("aborted"===r.status||"aborted"===o.status)return ode;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}ppe.create=(e,t,n)=>new ppe({valueType:t,keyType:e,typeName:jpe.ZodMap,...bde(n)});class fpe extends xde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wue.set)return nde(n,{code:Xue.invalid_type,expected:Wue.set,received:n.parsedType}),ode;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(nde(n,{code:Xue.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(nde(n,{code:Xue.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const o=this._def.valueType;function i(e){const n=new Set;for(const r of e){if("aborted"===r.status)return ode;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>o._parse(new vde(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new fpe({...this._def,minSize:{value:e,message:fde.toString(t)}})}max(e,t){return new fpe({...this._def,maxSize:{value:e,message:fde.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}fpe.create=(e,t)=>new fpe({valueType:e,minSize:null,maxSize:null,typeName:jpe.ZodSet,...bde(t)});class hpe extends xde{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Wue.function)return nde(t,{code:Xue.invalid_type,expected:Wue.function,received:t.parsedType}),ode;function n(e,n){return tde({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ede(),Que].filter((e=>!!e)),issueData:{code:Xue.invalid_arguments,argumentsError:n}})}function r(e,n){return tde({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ede(),Que].filter((e=>!!e)),issueData:{code:Xue.invalid_return_type,returnTypeError:n}})}const o={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof xpe){const e=this;return ade((async function(...t){const a=new Zue([]),s=await e._def.args.parseAsync(t,o).catch((e=>{throw a.addIssue(n(t,e)),a})),l=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(l,o).catch((e=>{throw a.addIssue(r(l,e)),a}))}))}{const e=this;return ade((function(...t){const a=e._def.args.safeParse(t,o);if(!a.success)throw new Zue([n(t,a.error)]);const s=Reflect.apply(i,this,a.data),l=e._def.returns.safeParse(s,o);if(!l.success)throw new Zue([r(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new hpe({...this._def,args:upe.create(e).rest(Jde.create())})}returns(e){return new hpe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new hpe({args:e||upe.create([]).rest(Jde.create()),returns:t||Jde.create(),typeName:jpe.ZodFunction,...bde(n)})}}class mpe extends xde{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}mpe.create=(e,t)=>new mpe({getter:e,typeName:jpe.ZodLazy,...bde(t)});class gpe extends xde{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return nde(t,{received:t.data,code:Xue.invalid_literal,expected:this._def.value}),ode}return{status:"valid",value:e.data}}get value(){return this._def.value}}function vpe(e,t){return new ype({values:e,typeName:jpe.ZodEnum,...bde(t)})}gpe.create=(e,t)=>new gpe({value:e,typeName:jpe.ZodLiteral,...bde(t)});class ype extends xde{constructor(){super(...arguments),mde.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return nde(t,{expected:que.joinValues(this._def.values),received:t.parsedType,code:Xue.invalid_type}),ode}if(dde(this,mde)||pde(this,mde,new Set(this._def.values)),!dde(this,mde).has(e.data)){const t=this._getOrReturnCtx(e);return nde(t,{received:t.data,code:Xue.invalid_enum_value,options:this._def.values}),ode}return ade(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ype.create(e,{...this._def,...t})}exclude(e,t=this._def){return ype.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}mde=new WeakMap,ype.create=vpe;class bpe extends xde{constructor(){super(...arguments),gde.set(this,void 0)}_parse(e){const t=que.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Wue.string&&n.parsedType!==Wue.number){const e=que.objectValues(t);return nde(n,{expected:que.joinValues(e),received:n.parsedType,code:Xue.invalid_type}),ode}if(dde(this,gde)||pde(this,gde,new Set(que.getValidEnumValues(this._def.values))),!dde(this,gde).has(e.data)){const e=que.objectValues(t);return nde(n,{received:n.data,code:Xue.invalid_enum_value,options:e}),ode}return ade(e.data)}get enum(){return this._def.values}}gde=new WeakMap,bpe.create=(e,t)=>new bpe({values:e,typeName:jpe.ZodNativeEnum,...bde(t)});class xpe extends xde{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Wue.promise&&!1===t.common.async)return nde(t,{code:Xue.invalid_type,expected:Wue.promise,received:t.parsedType}),ode;const n=t.parsedType===Wue.promise?t.data:Promise.resolve(t.data);return ade(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}xpe.create=(e,t)=>new xpe({type:e,typeName:jpe.ZodPromise,...bde(t)});class wpe extends xde{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===jpe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:e=>{nde(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),"preprocess"===r.type){const e=r.transform(n.data,o);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ode;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?ode:"dirty"===r.status||"dirty"===t.value?ide(r.value):r}));{if("aborted"===t.value)return ode;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?ode:"dirty"===r.status||"dirty"===t.value?ide(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,o);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?ode:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?ode:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!cde(e))return e;const i=r.transform(e.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>cde(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}que.assertNever(r)}}wpe.create=(e,t,n)=>new wpe({schema:e,typeName:jpe.ZodEffects,effect:t,...bde(n)}),wpe.createWithPreprocess=(e,t,n)=>new wpe({schema:t,effect:{type:"preprocess",transform:e},typeName:jpe.ZodEffects,...bde(n)});class _pe extends xde{_parse(e){return this._getType(e)===Wue.undefined?ade(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_pe.create=(e,t)=>new _pe({innerType:e,typeName:jpe.ZodOptional,...bde(t)});class Spe extends xde{_parse(e){return this._getType(e)===Wue.null?ade(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Spe.create=(e,t)=>new Spe({innerType:e,typeName:jpe.ZodNullable,...bde(t)});class Epe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Wue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Epe.create=(e,t)=>new Epe({innerType:e,typeName:jpe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...bde(t)});class Tpe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ude(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Zue(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Zue(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Tpe.create=(e,t)=>new Tpe({innerType:e,typeName:jpe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...bde(t)});class Cpe extends xde{_parse(e){if(this._getType(e)!==Wue.nan){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.nan,received:t.parsedType}),ode}return{status:"valid",value:e.data}}}Cpe.create=e=>new Cpe({typeName:jpe.ZodNaN,...bde(e)});const Ape=Symbol("zod_brand");class Npe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.type._parse({data:t.data,path:t.path,parent:t})}unwrap(){return this._def.type}}class Rpe extends xde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ode:"dirty"===e.status?(t.dirty(),ide(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ode:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new Rpe({in:e,out:t,typeName:jpe.ZodPipeline})}}class Ope extends xde{_parse(e){const t=this._def.innerType._parse(e),n=e=>(cde(e)&&(e.value=Object.freeze(e.value)),e);return ude(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Ppe(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function kpe(e,t={},n){return e?Qde.create().superRefine(((r,o)=>{var i,a;const s=e(r);if(s instanceof Promise)return s.then((e=>{var i,a;if(!e){const e=Ppe(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=Ppe(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}})):Qde.create()}Ope.create=(e,t)=>new Ope({innerType:e,typeName:jpe.ZodReadonly,...bde(t)});const Mpe={object:ope.lazycreate};var jpe,Lpe;(Lpe=jpe||(jpe={})).ZodString="ZodString",Lpe.ZodNumber="ZodNumber",Lpe.ZodNaN="ZodNaN",Lpe.ZodBigInt="ZodBigInt",Lpe.ZodBoolean="ZodBoolean",Lpe.ZodDate="ZodDate",Lpe.ZodSymbol="ZodSymbol",Lpe.ZodUndefined="ZodUndefined",Lpe.ZodNull="ZodNull",Lpe.ZodAny="ZodAny",Lpe.ZodUnknown="ZodUnknown",Lpe.ZodNever="ZodNever",Lpe.ZodVoid="ZodVoid",Lpe.ZodArray="ZodArray",Lpe.ZodObject="ZodObject",Lpe.ZodUnion="ZodUnion",Lpe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Lpe.ZodIntersection="ZodIntersection",Lpe.ZodTuple="ZodTuple",Lpe.ZodRecord="ZodRecord",Lpe.ZodMap="ZodMap",Lpe.ZodSet="ZodSet",Lpe.ZodFunction="ZodFunction",Lpe.ZodLazy="ZodLazy",Lpe.ZodLiteral="ZodLiteral",Lpe.ZodEnum="ZodEnum",Lpe.ZodEffects="ZodEffects",Lpe.ZodNativeEnum="ZodNativeEnum",Lpe.ZodOptional="ZodOptional",Lpe.ZodNullable="ZodNullable",Lpe.ZodDefault="ZodDefault",Lpe.ZodCatch="ZodCatch",Lpe.ZodPromise="ZodPromise",Lpe.ZodBranded="ZodBranded",Lpe.ZodPipeline="ZodPipeline",Lpe.ZodReadonly="ZodReadonly";const Dpe=zde.create,Ipe=qde.create,Fpe=Cpe.create,Upe=Gde.create,$pe=Kde.create,Vpe=Wde.create,Bpe=Yde.create,zpe=Xde.create,Hpe=Zde.create,qpe=Qde.create,Gpe=Jde.create,Kpe=epe.create,Wpe=tpe.create,Ype=npe.create,Xpe=ope.create,Zpe=ope.strictCreate,Qpe=ipe.create,Jpe=spe.create,efe=cpe.create,tfe=upe.create,nfe=dpe.create,rfe=ppe.create,ofe=fpe.create,ife=hpe.create,afe=mpe.create,sfe=gpe.create,lfe=ype.create,cfe=bpe.create,ufe=xpe.create,dfe=wpe.create,pfe=_pe.create,ffe=Spe.create,hfe=wpe.createWithPreprocess,mfe=Rpe.create,gfe={string:e=>zde.create({...e,coerce:!0}),number:e=>qde.create({...e,coerce:!0}),boolean:e=>Kde.create({...e,coerce:!0}),bigint:e=>Gde.create({...e,coerce:!0}),date:e=>Wde.create({...e,coerce:!0})},vfe=ode;var yfe=Object.freeze({__proto__:null,defaultErrorMap:Que,setErrorMap:function(e){Jue=e},getErrorMap:ede,makeIssue:tde,EMPTY_PATH:[],addIssueToContext:nde,ParseStatus:rde,INVALID:ode,DIRTY:ide,OK:ade,isAborted:sde,isDirty:lde,isValid:cde,isAsync:ude,get util(){return que},get objectUtil(){return Kue},ZodParsedType:Wue,getParsedType:Yue,ZodType:xde,datetimeRegex:$de,ZodString:zde,ZodNumber:qde,ZodBigInt:Gde,ZodBoolean:Kde,ZodDate:Wde,ZodSymbol:Yde,ZodUndefined:Xde,ZodNull:Zde,ZodAny:Qde,ZodUnknown:Jde,ZodNever:epe,ZodVoid:tpe,ZodArray:npe,ZodObject:ope,ZodUnion:ipe,ZodDiscriminatedUnion:spe,ZodIntersection:cpe,ZodTuple:upe,ZodRecord:dpe,ZodMap:ppe,ZodSet:fpe,ZodFunction:hpe,ZodLazy:mpe,ZodLiteral:gpe,ZodEnum:ype,ZodNativeEnum:bpe,ZodPromise:xpe,ZodEffects:wpe,ZodTransformer:wpe,ZodOptional:_pe,ZodNullable:Spe,ZodDefault:Epe,ZodCatch:Tpe,ZodNaN:Cpe,BRAND:Ape,ZodBranded:Npe,ZodPipeline:Rpe,ZodReadonly:Ope,custom:kpe,Schema:xde,ZodSchema:xde,late:Mpe,get ZodFirstPartyTypeKind(){return jpe},coerce:gfe,any:qpe,array:Ype,bigint:Upe,boolean:$pe,date:Vpe,discriminatedUnion:Jpe,effect:dfe,enum:lfe,function:ife,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>kpe((t=>t instanceof e),t),intersection:efe,lazy:afe,literal:sfe,map:rfe,nan:Fpe,nativeEnum:cfe,never:Kpe,null:Hpe,nullable:ffe,number:Ipe,object:Xpe,oboolean:()=>$pe().optional(),onumber:()=>Ipe().optional(),optional:pfe,ostring:()=>Dpe().optional(),pipeline:mfe,preprocess:hfe,promise:ufe,record:nfe,set:ofe,strictObject:Zpe,string:Dpe,symbol:Bpe,transformer:dfe,tuple:tfe,undefined:zpe,union:Qpe,unknown:Gpe,void:Wpe,NEVER:vfe,ZodIssueCode:Xue,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Zue});const bfe=yfe.object({company:yfe.object({legalName:yfe.string().min(1,"Legal company name is required"),type:yfe.enum(["corporation","llc"]).optional(),ein:yfe.string().min(1,"EIN is required")}),representative:yfe.object({title:yfe.string().min(1,"Title is required"),firstName:yfe.string().min(1,"First name is required"),email:yfe.string().email("Invalid email address"),phone:yfe.string().min(1,"Phone number is required"),position:yfe.enum(["owner","manager","director"]).optional()})}),xfe=({onSave:e,onBack:r})=>{const o=n.useRef(null),{isUpdatingBrandSettings:i,data:a}=zte(),{toast:s}=jl(),[l,c]=n.useState(Boolean(null));n.useEffect((()=>{o.current?.focus()}),[]);const u=Tue({resolver:Pue(bfe),defaultValues:{company:{legalName:"",type:void 0,ein:""},representative:{title:"",firstName:"",email:"",phone:"",position:void 0}}}),d=a?.branding?.primaryColor||"#000000",p=Object.entries(u.formState.errors).reduce(((e,[t,n])=>"company"===t||"representative"===t?e+Object.keys(n).length:e+1),0);return t.jsx(jue,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit((async t=>{try{s({title:"Settings saved 🚀"}),e?.()}catch(n){s({title:"Error saving settings",variant:"destructive"})}})),className:"w-full h-full flex flex-col bg-white rounded-lg",children:[t.jsx("div",{className:"flex-1 flex flex-col min-h-0 px-6 pt-16 overflow-y-auto relative",children:t.jsxs("div",{className:"flex-1 w-full min-h-[400px] @container flex flex-col gap-2",children:[!l&&t.jsx("div",{className:Zd(Mue({variant:"warning",size:"default",position:"inline"}),kue,"p-4 relative"),role:"alert",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"mr-3 shrink-0 pt-0.5",children:t.jsx(Xu,{className:"h-6 w-6"})}),t.jsxs("div",{className:"flex-grow",children:[t.jsx("h5",{className:"text-sm font-medium mb-1",children:"Complete Required Information"}),t.jsx("div",{className:"text-sm",children:"Please complete the required information to get your Twilio phone number."})]})]})}),t.jsxs("div",{className:"bg-card rounded-lg border shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between p-6",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Twilio Application"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Status:"}),t.jsx("span",{className:"inline-flex items-center rounded-full bg-yellow-100 px-2 py-1 text-xs font-medium text-yellow-800",children:"Pending"})]})]}),t.jsxs("div",{className:"py-4 @md:grid @md:grid-cols-2 @md:gap-8 px-6",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-medium pb-2 border-b border-border",children:"Company"}),t.jsx("div",{className:"space-y-4 py-4",children:t.jsx(zue,{control:u.control,disabled:i,legalNameRef:o})})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-medium pb-2 border-b border-border",children:"Authorized Representative"}),t.jsx("div",{className:"space-y-4 py-4",children:t.jsx(Hue,{control:u.control,disabled:i})})]})]})]}),t.jsx("div",{className:"h-4",children:" "})]})}),t.jsxs(AB,{className:"py-4 px-6",children:[r&&t.jsx(vZ,{variant:"outline",className:"gap-1.5",onClick:r,disabled:i,children:"Go Back"}),t.jsxs("div",{className:"flex items-center gap-4",children:[p>0&&t.jsxs("span",{className:"text-sm text-destructive flex items-center gap-1.5",children:["Please fix the ",t.jsx("span",{className:"font-bold",children:p})," ","fields that need attention"]}),t.jsx(vZ,{type:"submit",className:"px-4",style:{backgroundColor:d},disabled:i||!u.formState.isDirty,children:i?t.jsxs(t.Fragment,{children:[t.jsx(Nu,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving"]}):"Save Changes"})]})]})]})})};function wfe({tabs:e,activeTab:n,onTabChange:r,title:o}){return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:"w-48 py-2 pl-4",children:[o&&t.jsx("h2",{className:"px-4 pt-4 pb-5 text-lg font-medium",children:o}),e.map((e=>t.jsx(vZ,{variant:"ghost",className:Zd("w-full justify-start mb-1",n===e.id&&"bg-accent"),onClick:()=>r(e.id),children:e.label},e.id)))]}),t.jsx("div",{className:"flex-1",children:e.find((e=>e.id===n))?.content})]})}function _fe({open:e,setOpen:r}){const[o,i]=n.useState("brand"),a=(()=>{const{flags:e}=n.useContext(al.reactContext);return e})()["show-settings-modal"]??!1;n.useEffect((()=>{e&&i("brand")}),[e]);const s=a?[{id:"brand",label:"Brand",content:t.jsx(ece,{})},{id:"phone-number",label:"Phone Number",content:t.jsx(xfe,{})}]:[{id:"brand",label:"Brand",content:t.jsx(ece,{})}];return t.jsx(_B,{open:e,onOpenChange:r,children:t.jsxs(TB,{className:"flex w-[90vw] h-[90vh] flex-col gap-0 overflow-hidden sm:max-w-xl md:max-w-3xl lg:max-w-4xl xl:max-w-5xl p-0",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Settings"}),t.jsx(RB,{children:"Edit your business and brand settings"})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(wfe,{tabs:s,activeTab:o,onTabChange:i,title:"Settings"})})]})})}const Sfe=e=>{const{updateAutomation:t,updateError:r,isUpdateSuccess:o}=Le(e),{toast:i}=jl();return n.useEffect((()=>{o?i({title:"Status updated",description:"The status has been updated successfully"}):r&&i({title:"Error updating status",description:"Please try again",variant:"destructive"})}),[o,r,i]),{toggleStatus:async e=>{try{return await t({status:e?Ve.ACTIVE:Ve.DRAFT}),!0}catch(n){return i({title:"Error updating status",description:"Please try again",variant:"destructive"}),!1}}}};function Efe(){const{toast:e}=jl(),[r,o]=n.useState(null),{toggleStatus:i}=Sfe(r||""),a=q5(),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{automations:f,nextCursor:h,isLoading:m,error:g,isFetching:v,isPlaceholderData:y}=Ie({cursor:c,limit:s,triggerType:Fe.TRIGGER_BASED,search:d||void 0});n.useEffect((()=>{g&&e({title:`Error Fetching ${ff("engage:automation")}`,description:g?.message||"Please try again.",variant:"destructive"})}),[g,e]);const b=n.useMemo((()=>(f||[]).map((e=>({...e,emailsSent:0,smsSent:0,updated_at:e.updatedAt||e.createdAt})))),[f]),x=n.useCallback((async(e,t)=>{try{o(e);const n=t===Ve.ACTIVE;await i(n)}finally{o(null)}}),[i,o]),w=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]),_=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),S=n.useMemo((()=>v9({automationName:ff("engage:automation"),setUrl:_,onToggle:x,vsaasManaged:!0})),[x,_]);return t.jsx("div",{className:"w-full h-[75vh] flex flex-col",children:t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(K3,{data:b,columns:S,paginationMode:"cursor",initialPageSize:s,isLoading:m&&!y,onRowClick:e=>{a(`/automations/view-modal/${e.id}?showBackButton=true`)},cursorPaginationQueryResult:{nextCursor:h,isLoading:m,isFetching:v,isPlaceholderData:y},onQueryParametersChange:w,searchValue:d,onSearchChange:p})})})}function Tfe(){const{toast:e}=jl(),[r,o]=n.useState(!1),[i,a]=n.useState(null),{toggleStatus:s}=Sfe(i||""),l=q5(),[c,u]=n.useState(10),[d,p]=n.useState(void 0),[f,h]=n.useState(""),{automations:m,nextCursor:g,isLoading:v,error:y,isFetching:b,isPlaceholderData:x}=Ie({cursor:d,limit:c,triggerType:Fe.ONE_TIME,search:f||void 0});n.useEffect((()=>{y&&e({title:`Error Fetching ${ff("engage:one_time")}`,description:y?.message||"Please try again.",variant:"destructive"})}),[y,e]);const w=n.useMemo((()=>(m||[]).map((e=>({...e,updated_at:e.updatedAt})))),[m]),_=n.useCallback((async(e,t)=>{try{a(e);const n=t===Ve.ACTIVE;await s(n)}finally{a(null)}}),[s,a]),S=n.useCallback((e=>{p(e.cursor),u(e.pageSize)}),[]),E=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),T=n.useMemo((()=>v9({automationName:ff("engage:one_time"),setUrl:E,onToggle:_})),[_,E]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(K3,{data:w,columns:T,paginationMode:"cursor",initialPageSize:c,headerActions:t.jsxs(vZ,{className:"bg-primary",onClick:()=>o(!0),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"New"]}),isLoading:v&&!x,cursorPaginationQueryResult:{nextCursor:g,isLoading:v,isFetching:b,isPlaceholderData:x},onRowClick:e=>{l(`/automations/view-modal/${e.id}?showBackButton=true`)},onQueryParametersChange:S,searchValue:f,onSearchChange:h})}),t.jsx(Lle,{open:r,setOpen:o,onClose:t=>{l9(o,e,t,`Error creating ${ff("engage:one_time")}`,"Please try again"),p(void 0),u(10),h(""),!1!==t&&l(`/automations/view-modal/${t}?showBackButton=true`)},automationType:Fe.ONE_TIME})]})}function Cfe(){const{toast:e}=jl(),[r,o]=n.useState(!1),[i,a]=n.useState(null),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{segments:f,isLoading:h,nextCursor:m,isFetching:g,isPlaceholderData:v}=QX({search:d||void 0,cursor:c,limit:s}),y=n.useCallback((e=>{a(e),o(!0)}),[a]),b=n.useMemo((()=>function(e){return[d9("name",`${ff("engage:segment")} Name`,!0),p9(),s9({accessorKey:"user_count",header:ff("engage:user_other"),meta:{align:"right",displayName:ff("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const t=e.getValue()??0;return`${t.toLocaleString()} ${1===t?ff("engage:user").toLowerCase():ff("engage:user_other").toLowerCase()}`}}),f9("user_count_updated_at"),g9(e||(()=>{}))]}(y)),[y]),x=n.useMemo((()=>f?f.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[f]),w=n.useMemo((()=>t.jsxs(vZ,{onClick:()=>{a(null),o(!0)},children:[t.jsx(Vu,{className:"h-4 w-4"}),"New List"]})),[]),_=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(K3,{data:x,columns:b,paginationMode:"cursor",initialPageSize:s,headerActions:w,isLoading:h&&!v,cursorPaginationQueryResult:{nextCursor:m,isLoading:h,isFetching:g,isPlaceholderData:v},onQueryParametersChange:_,onRowClick:e=>{a(e.id),o(!0)},searchValue:d,onSearchChange:p})}),t.jsx(yle,{open:r,setOpen:o,segmentId:i??void 0,onSegmentUpdated:t=>{l9(o,e,t,`Error creating ${ff("engage:segment")}`,"Please try again"),u(void 0),l(10),p("")}})]})}const Afe=()=>{const e=[{id:"broadcasts",label:ff("engage:one_time",{count:2}),content:t.jsx(Tfe,{})},{id:"automations",label:ff("engage:automation",{count:2}),content:t.jsx(Efe,{})},{id:"segments",label:ff("engage:segment",{count:2}),content:t.jsx(Cfe,{})},{id:"statistics",label:ff("engage:insight",{count:2}),content:t.jsx(Wle,{})}],r=ce(),[o,i]=n.useState(!1),[a,s]=n.useState(e[0].id);return n.useEffect((()=>{r.prefetchQuery({queryKey:Oe.list()}),r.prefetchQuery({queryKey:XX.lists()})}),[r]),t.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[t.jsx(_fe,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(vZ,{variant:"outline",onClick:()=>i(!0),children:t.jsx(qu,{className:"w-4 h-4"})})}),t.jsx("div",{className:"flex-1 w-full h-full flex flex-col gap-4",children:t.jsx(Dle,{activeTab:a,tabs:e,onTabChange:s})})]})},Nfe=Xpe({name:Dpe().min(2,"Title must be at least 2 characters"),description:Dpe()});function Rfe({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=aZ(),{toast:i}=jl(),a=Tue({resolver:Pue(Nfe),defaultValues:{name:`${o?.name} (copy)`,description:o?.description??""}});return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsx(CB,{children:t.jsx(NB,{children:"Duplicate Automation"})}),t.jsx(jue,{...a,children:t.jsxs("form",{onSubmit:a.handleSubmit((async function(){if(!o)return void i({title:"Error duplicating automation",description:"Please try again"});const{id:e}=await(async e=>(await Re(`${c}`,{method:"POST",body:JSON.stringify({duplicate:!0,source_id:e})})).data)(o.id);e?(r?.(e),i({title:"Automation duplicated!",description:"The automation has been duplicated"}),n(!1)):i({title:"Error duplicating automation",description:"Please try again"})})),className:"space-y-4",children:[t.jsxs("div",{children:["Create a copy of the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),"automation with a new title and description."]}),t.jsx(Due,{control:a.control,name:"name",disabled:!0,render:({field:e})=>t.jsxs(Uue,{children:[t.jsx($ue,{children:"Title"}),t.jsx(Vue,{children:t.jsx(q3,{...e})}),t.jsx(Bue,{})]})}),t.jsx(Due,{control:a.control,name:"description",disabled:!0,render:({field:e})=>t.jsxs(Uue,{children:[t.jsx($ue,{children:"Description"}),t.jsx(Vue,{children:t.jsx(Hte,{...e})}),t.jsx(Bue,{})]})}),t.jsx(AB,{children:t.jsx(vZ,{type:"submit",children:"Duplicate"})})]})})]})})}const Ofe=Xpe({name:Dpe().min(2,"Title must be at least 2 characters"),description:Dpe()});function Pfe({open:e,onOpenChange:n}){const r=aZ(),{updateAutomation:o}=Le(r?.id||""),i=Tue({resolver:Pue(Ofe),defaultValues:{name:r?.name??"",description:r?.description??""},values:{name:r?.name??"",description:r?.description??""}});return r?t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsxs(CB,{children:[t.jsxs(NB,{children:["Edit"," ",ff(r.triggerType===Fe.ONE_TIME?"engage:one_time":"engage:automation")]}),t.jsxs(RB,{children:["Update the title and description of your"," ",ff(r.triggerType===Fe.ONE_TIME?"engage:one_time":"engage:automation"),"."]})]}),t.jsx(jue,{...i,children:t.jsxs("form",{onSubmit:i.handleSubmit((function(e){o({name:e.name,description:e.description}),n(!1)})),className:"space-y-4",children:[t.jsx(Due,{control:i.control,name:"name",render:({field:e})=>t.jsxs(Uue,{children:[t.jsx($ue,{children:"Title"}),t.jsx(Vue,{children:t.jsx(q3,{...e})}),t.jsx(Bue,{})]})}),t.jsx(Due,{control:i.control,name:"description",render:({field:e})=>t.jsxs(Uue,{children:[t.jsx($ue,{children:"Description"}),t.jsx(Vue,{children:t.jsx(Hte,{...e})}),t.jsx(Bue,{})]})}),t.jsx(AB,{children:t.jsx(vZ,{type:"submit",children:"Save changes"})})]})})]})}):null}function kfe({open:e,onOpenChange:n,setIsActive:r}){const o=aZ(),{updateAutomation:i}=Le(o?.id||""),{toast:a}=jl();return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsx(CB,{children:t.jsxs(NB,{children:["Deactivate ",ff("engage:automation")]})}),t.jsxs("div",{children:["Are you sure you want to deactivate the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),ff("engage:automation"),"?"]}),t.jsxs(AB,{className:"gap-2 sm:gap-0",children:[t.jsx(vZ,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(vZ,{variant:"destructive",onClick:()=>{i({status:Ve.DRAFT}),n(!1),r(!1),a({title:`Updated ${ff("engage:automation")}`,description:`${ff("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const Mfe=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=aZ(),a=q5(),{updateAutomation:s}=Le(i?.id||""),{toast:l}=jl(),c=(()=>{const{state:e}=iZ();return e.recipientStats})(),u=sZ(),[d,p]=n.useState(void 0),[f,h]=n.useState(!1),[m,g]=n.useState(!1),[v,y]=n.useState(!1),[b,x]=n.useState(!1);n.useEffect((()=>{if(i&&void 0===d)switch(i.status){case Ve.ACTIVE:p(!0);break;case Ve.DRAFT:p(!1);break;case Ve.RUNNING:case Ve.COMPLETED:p(!0);break;case Ve.FAILED:case Ve.DEACTIVATED:p(!1);break;default:throw ene(i.status,Ve)}}),[i,d]);const w=n.useCallback((()=>{if(!i)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});const e=async e=>{if(d&&!e)y(!0);else{if(x(!0),o&&!0===e){let e=0;for(;!c&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!c)return l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),void x(!1);const t=await o({estimatedEmailRecipients:c?.emails??0,estimatedSmsRecipients:c?.phones??0});if(!0!==t)return l({title:"Error while updating the status",description:t,variant:"destructive"}),void x(!1)}switch(i.triggerType){case Fe.ONE_TIME:if(!i.triggerMetadata||!("scheduledAt"in i.triggerMetadata)||!i.triggerMetadata?.scheduledAt)return l({title:"Ensure you have selected a scheduled time",variant:"destructive"}),void x(!1);if(!u||!u.emailChannelSenderId&&!u.smsChannelSenderId)return l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"}),void x(!1);break;case Fe.TRIGGER_BASED:break;default:throw ene(i.triggerType,Fe)}s({status:e?Ve.ACTIVE:Ve.DEACTIVATED},{onSuccess:()=>{p(e),l({title:`${ff("engage:automation")} 🚀`,description:`${ff("engage:automation")} status updated to ${e?"active":"inactive"} 🚀`}),x(!1)},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),x(!1)}})}};if(!i)return null;let n=!1,r=!0;switch(i.status){case Ve.ACTIVE:case Ve.DRAFT:n=!1;break;case Ve.DEACTIVATED:n=!0,r=!1;break;case Ve.RUNNING:n=!0,r=i.triggerType===Fe.TRIGGER_BASED;break;case Ve.COMPLETED:case Ve.FAILED:n=!0,r=!1;break;default:throw ene(i.status,Ve)}if(!r)return t.jsx(kZ,{variant:c9(i.status),children:e8[i.status]});switch(i.triggerType){case Fe.TRIGGER_BASED:return t.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[t.jsx(d?pu:xu,{className:"w-4 h-4"}),t.jsx("div",{className:"text-[13px] font-medium",children:d?"Active":"Inactive"}),t.jsx(cle,{checked:d,onCheckedChange:e,disabled:n})]});case Fe.ONE_TIME:if(!i.triggerMetadata||i.triggerMetadata?.triggerType===Fe.ONE_TIME&&!i.triggerMetadata?.scheduledAt)return t.jsx(vZ,{variant:"outline",className:"flex items-center gap-2",disabled:!0,children:"Set Scheduled Time"});if(d)return t.jsx(vZ,{variant:"outline",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:"Convert to Draft"});{let r="Schedule Send";return i.triggerMetadata.triggerType===Fe.ONE_TIME&&i.triggerMetadata.scheduledAt&&new Date(i.triggerMetadata.scheduledAt)<new Date(Date.now()+3e5)&&(r="Send Now"),t.jsx(vZ,{variant:"default",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:r})}default:throw ene(i.triggerType,Fe)}}),[i,d,l,o,s,c,u]);return i&&void 0!==d?t.jsxs("header",{className:"flex px-1 pt-1",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[e&&t.jsx(vZ,{variant:"ghost",size:"icon",onClick:()=>a(-1),children:t.jsx(lu,{})}),t.jsx("div",{className:"flex flex-col gap-1",children:t.jsx("h1",{className:"text-lg leading-none",children:i.name})})]}),t.jsxs("div",{className:"ml-auto flex gap-4 items-center",children:[t.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:i.triggerType===Fe.ONE_TIME&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",onClick:()=>h(!0),children:t.jsx(T9,{title:"Edit",Icon:wZ.EditIcon,asChild:!1,onClick:()=>h(!0)})}),t.jsx("div",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",onClick:()=>g(!0),children:t.jsx(T9,{title:"Duplicate",Icon:wZ.DuplicateIcon,asChild:!1,onClick:()=>g(!0)})})]})}),b?t.jsx("div",{className:"flex items-center text-muted-foreground pr-8",children:t.jsx(hZ,{})}):w()]}),t.jsx(Pfe,{open:f,onOpenChange:h}),t.jsx(Rfe,{open:m,onOpenChange:g,onDuplicationCreated:r}),t.jsx(kfe,{open:v,onOpenChange:y,setIsActive:p})]}):null},jfe=({hideSms:e,hideSales:n})=>{const r=aZ(),{isLoading:o}=De(r?.id);return!r||o?t.jsx(hZ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(Wle,{automationId:r.id,automation:r,includeSales:!n,includeSms:!e})})},Lfe=()=>{const e=aZ(),{recipients:n,isLoading:r,fetchError:o}=Me(e?.id??""),i=[{accessorFn:e=>`${e.firstName||""} ${e.lastName||""}`.trim(),id:"name",header:"Name",cell:({row:e})=>{const n=`${e.original.firstName||""} ${e.original.lastName||""}`.trim();return n||t.jsx("span",{className:"text-gray-400",children:"Not provided"})}},{accessorKey:"email",header:"Email",cell:({row:e})=>e.original.email||t.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"phone",header:"Phone",cell:({row:e})=>e.original.phone||t.jsx("span",{className:"text-gray-400",children:"Not provided"})}];return e&&!r&&n?o?t.jsxs("div",{children:["Error: ",o.message]}):n&&0!==n.recipients.length?t.jsx("div",{className:"h-full p-4",children:t.jsx(K3,{data:n.recipients,columns:i,paginationMode:"standard",initialPageSize:10,isLoading:r})}):t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[t.jsx("div",{className:"mb-4",children:t.jsx(wZ.UserIcon,{className:"h-12 w-12 text-gray-400"})}),t.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Recipients Found"}),t.jsxs("p",{className:"text-gray-500",children:["This ",ff("engage:automation")," currently has no assigned recipients. Please update the include or exclude"," ",ff("engage:segment",{count:2})," to add recipients."]})]}):t.jsx(hZ,{text:["Fetching Recipients","Finishing up"]})},Dfe=n.createContext(null);Dfe.displayName="PanelGroupContext";const Ife="data-panel-group",Ffe="data-panel-group-direction",Ufe="data-panel-group-id",$fe="data-panel",Vfe="data-panel-collapsible",Bfe="data-panel-id",zfe="data-panel-size",Hfe="data-resize-handle",qfe="data-resize-handle-active",Gfe="data-panel-resize-handle-enabled",Kfe="data-panel-resize-handle-id",Wfe="data-resize-handle-state",Yfe=n.useLayoutEffect,Xfe=i["useId".toString()],Zfe="function"==typeof Xfe?Xfe:()=>null;let Qfe=0;function Jfe(e=null){const t=Zfe(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+Qfe++),null!=e?e:r.current}function ehe({children:e,className:t="",collapsedSize:r,collapsible:o,defaultSize:i,forwardedRef:a,id:s,maxSize:l,minSize:c,onCollapse:u,onExpand:d,onResize:p,order:f,style:h,tagName:m="div",...g}){const v=n.useContext(Dfe);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:b,getPanelSize:x,getPanelStyle:w,groupId:_,isPanelCollapsed:S,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:C,unregisterPanel:A}=v,N=Jfe(s),R=n.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:r,collapsible:o,defaultSize:i,maxSize:l,minSize:c},id:N,idIsFromProps:void 0!==s,order:f});n.useRef({didLogMissingDefaultSizeWarning:!1}),Yfe((()=>{const{callbacks:e,constraints:t}=R.current,n={...t};R.current.id=N,R.current.idIsFromProps=void 0!==s,R.current.order=f,e.onCollapse=u,e.onExpand=d,e.onResize=p,t.collapsedSize=r,t.collapsible=o,t.defaultSize=i,t.maxSize=l,t.minSize=c,n.collapsedSize===t.collapsedSize&&n.collapsible===t.collapsible&&n.maxSize===t.maxSize&&n.minSize===t.minSize||E(R.current,n)})),Yfe((()=>{const e=R.current;return T(e),()=>{A(e)}}),[f,N,T,A]),n.useImperativeHandle(a,(()=>({collapse:()=>{y(R.current)},expand:e=>{b(R.current,e)},getId:()=>N,getSize:()=>x(R.current),isCollapsed:()=>S(R.current),isExpanded:()=>!S(R.current),resize:e=>{C(R.current,e)}})),[y,b,x,S,N,C]);const O=w(R.current,i);return n.createElement(m,{...g,children:e,className:t,id:N,style:{...O,...h},[Ufe]:_,[$fe]:"",[Vfe]:o||void 0,[Bfe]:N,[zfe]:parseFloat(""+O.flexGrow).toFixed(1)})}const the=n.forwardRef(((e,t)=>n.createElement(ehe,{...e,forwardedRef:t})));ehe.displayName="Panel",the.displayName="forwardRef(Panel)";let nhe=null,rhe=-1,ohe=null;function ihe(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&yhe),n=!!(t&bhe);if(t&ghe)return e?"se-resize":n?"ne-resize":"e-resize";if(t&vhe)return e?"sw-resize":n?"nw-resize":"w-resize";if(e)return"s-resize";if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,t);if(nhe!==o){var i;if(nhe=o,null===ohe&&(ohe=document.createElement("style"),document.head.appendChild(ohe)),rhe>=0)null===(i=ohe.sheet)||void 0===i||i.removeRule(rhe);rhe=null!==(n=null===(r=ohe.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function ahe(e){return"keydown"===e.type}function she(e){return e.type.startsWith("pointer")}function lhe(e){return e.type.startsWith("mouse")}function che(e){if(she(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(lhe(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const uhe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function dhe(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=mhe(e))&&void 0!==t?t:e).display;return"flex"===n||"inline-flex"===n}(e))||(+t.opacity<1||("transform"in t&&"none"!==t.transform||("webkitTransform"in t&&"none"!==t.webkitTransform||("mixBlendMode"in t&&"normal"!==t.mixBlendMode||("filter"in t&&"none"!==t.filter||("webkitFilter"in t&&"none"!==t.webkitFilter||("isolation"in t&&"isolate"===t.isolation||(!!uhe.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function phe(e){let t=e.length;for(;t--;){const n=e[t];if(Dhe(n,"Missing node"),dhe(n))return n}return null}function fhe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function hhe(e){const t=[];for(;e;)t.push(e),e=mhe(e);return t}function mhe(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const ghe=1,vhe=2,yhe=4,bhe=8,xhe="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let whe=[],_he=!1,She=new Map,Ehe=new Map;const The=new Set;function Che(e){const{target:t}=e,{x:n,y:r}=che(e);_he=!0,Ohe({target:t,x:n,y:r}),jhe(),whe.length>0&&(Lhe("down",e),e.preventDefault(),Rhe(t)||e.stopImmediatePropagation())}function Ahe(e){const{x:t,y:n}=che(e);if(_he&&0===e.buttons&&(_he=!1,Lhe("up",e)),!_he){const{target:r}=e;Ohe({target:r,x:t,y:n})}Lhe("move",e),khe(),whe.length>0&&e.preventDefault()}function Nhe(e){const{target:t}=e,{x:n,y:r}=che(e);Ehe.clear(),_he=!1,whe.length>0&&(e.preventDefault(),Rhe(t)||e.stopImmediatePropagation()),Lhe("up",e),Ohe({target:t,x:n,y:r}),khe(),jhe()}function Rhe(e){let t=e;for(;t;){if(t.hasAttribute(Hfe))return!0;t=t.parentElement}return!1}function Ohe({target:e,x:t,y:n}){whe.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),The.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=xhe?i.coarse:i.fine;if(t>=l-d&&t<=c+d&&n>=u-d&&n<=s+d){if(null!==r&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&function(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:hhe(e),b:hhe(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Dhe(r,"Stacking order can only be calculated for elements with a common ancestor");const o=fhe(phe(n.a)),i=fhe(phe(n.b));if(o===i){const e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)};let o=e.length;for(;o--;){const n=e[o];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(o-i)}(r,o)>0){let e=r,t=!1;for(;e&&!e.contains(o);){if((p=e.getBoundingClientRect()).x<(f=a).x+f.width&&p.x+p.width>f.x&&p.y<f.y+f.height&&p.y+p.height>f.y){t=!0;break}e=e.parentElement}if(t)return}whe.push(e)}var p,f}))}function Phe(e,t){Ehe.set(e,t)}function khe(){let e=!1,t=!1;whe.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;Ehe.forEach((e=>{n|=e})),e&&t?ihe("intersection",n):e?ihe("horizontal",n):t?ihe("vertical",n):null!==ohe&&(document.head.removeChild(ohe),nhe=null,ohe=null,rhe=-1)}let Mhe=new AbortController;function jhe(){Mhe.abort(),Mhe=new AbortController;const e={capture:!0,signal:Mhe.signal};The.size&&(_he?(whe.length>0&&She.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",Nhe,e),r.addEventListener("pointerleave",Ahe,e),r.addEventListener("pointermove",Ahe,e))})),She.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",Nhe,e),r.addEventListener("pointercancel",Nhe,e)}))):She.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",Che,e),r.addEventListener("pointermove",Ahe,e))})))}function Lhe(e,t){The.forEach((n=>{const{setResizeHandlerState:r}=n,o=whe.includes(n);r(e,o,t)}))}function Dhe(e,t){if(!e)throw Error(t)}function Ihe(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Fhe(e,t,n=10){return 0===Ihe(e,t,n)}function Uhe(e,t,n){return 0===Ihe(e,t,n)}function $he({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Dhe(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(Ihe(n,s)<0)if(i){n=Ihe(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function Vhe({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Uhe(e,0))return t;const a=[...t],[s,l]=r;Dhe(null!=s,"Invalid first pivot index"),Dhe(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];Dhe(o,`Panel constraints not found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:c=0}=o;if(a){const n=t[r];if(Dhe(null!=n,`Previous layout not found for panel index ${r}`),Uhe(n,i)){const t=c-n;Ihe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];Dhe(o,`No panel constraints found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:c=0}=o;if(a){const n=t[r];if(Dhe(null!=n,`Previous layout not found for panel index ${r}`),Uhe(n,c)){const t=n-i;Ihe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{const r=e<0?1:-1;let o=e<0?l:s,i=0;for(;;){const e=t[o];Dhe(null!=e,`Previous layout not found for panel index ${o}`);if(i+=$he({panelConstraints:n,panelIndex:o,size:100})-e,o+=r,o<0||o>=n.length)break}const a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let r=e<0?s:l;for(;r>=0&&r<n.length;){const o=Math.abs(e)-Math.abs(c),i=t[r];Dhe(null!=i,`Previous layout not found for panel index ${r}`);const s=$he({panelConstraints:n,panelIndex:r,size:i-o});if(!Uhe(i,s)&&(c+=i-s,a[r]=s,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(function(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Uhe(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];Dhe(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=$he({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!Uhe(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];Dhe(null!=o,`Previous layout not found for panel index ${r}`);const i=$he({panelConstraints:n,panelIndex:r,size:o+t});if(Uhe(o,i)||(t-=i-o,a[r]=i),Uhe(t,0))break;e>0?r--:r++}}}return Uhe(a.reduce(((e,t)=>t+e),0),100)?a:o}function Bhe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];Dhe(null!=s,"No pivot index found"),t.forEach(((e,t)=>{const{constraints:n}=e,{maxSize:l=100,minSize:c=0}=n;t===s?(r=c,o=l):(i+=c,a+=l)}));return{valueMax:Math.min(o,100-i),valueMin:Math.max(r,100-a),valueNow:e[s]}}function zhe(e,t=document){return Array.from(t.querySelectorAll(`[${Kfe}][data-panel-group-id="${e}"]`))}function Hhe(e,t,n=document){const r=zhe(e,n).findIndex((e=>e.getAttribute(Kfe)===t));return null!=r?r:null}function qhe(e,t,n){const r=Hhe(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function Ghe(e,t=document){var n;if(t instanceof HTMLElement&&(null==t||null===(n=t.dataset)||void 0===n?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function Khe(e,t=document){const n=t.querySelector(`[${Kfe}="${e}"]`);return n||null}function Whe({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),Yfe((()=>{if(!a)return;const e=zhe(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=Bhe({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];Dhe(e,`No panel data found for index "${t}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(n)),s.setAttribute("aria-valuemin",""+Math.round(r)),s.setAttribute("aria-valuenow",null!=a?""+Math.round(a):"")}}return()=>{e.forEach(((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[r,o,i,a]),n.useEffect((()=>{if(!a)return;const e=t.current;Dhe(e,"Eager values not found");const{panelDataArray:n}=e;Dhe(null!=Ghe(r,a),`No group found for id "${r}"`);const i=zhe(r,a);Dhe(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(Kfe);Dhe(t,"Resize handle element has no handle id attribute");const[i,l]=function(e,t,n,r=document){var o,i,a,s;const l=Khe(t,r),c=zhe(e,r),u=l?c.indexOf(l):-1;return[null!==(o=null===(i=n[u])||void 0===i?void 0:i.id)&&void 0!==o?o:null,null!==(a=null===(s=n[u+1])||void 0===s?void 0:s.id)&&void 0!==a?a:null]}(r,t,n,a);if(null==i||null==l)return()=>{};const c=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=n.findIndex((e=>e.id===i));if(l>=0){const e=n[l];Dhe(e,`No panel data found for index ${l}`);const i=o[l],{collapsedSize:c=0,collapsible:u,minSize:d=0}=e.constraints;if(null!=i&&u){const e=Vhe({delta:Uhe(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:qhe(r,t,a),prevLayout:o,trigger:"keyboard"});o!==e&&s(e)}}break}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}));return()=>{l.forEach((e=>e()))}}),[a,e,t,r,o,i,s])}function Yhe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Xhe(e,t){const n="horizontal"===e,{x:r,y:o}=che(t);return n?r:o}function Zhe(e,t,n,r,o,i){if(ahe(e)){const t="horizontal"===n;let r=0;r=e.shiftKey?100:null!=o?o:10;let i=0;switch(e.key){case"ArrowDown":i=t?0:r;break;case"ArrowLeft":i=t?-r:0;break;case"ArrowRight":i=t?r:0;break;case"ArrowUp":i=t?0:-r;break;case"End":i=100;break;case"Home":i=-100}return i}return null==r?0:function(e,t,n,r,o){const i="horizontal"===n,a=Khe(t,o);Dhe(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(Ufe);Dhe(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Xhe(n,e),u=Ghe(s,o);Dhe(u,`No group element found for id "${s}"`);const d=u.getBoundingClientRect();return(c-l)/(i?d.width:d.height)*100}(e,t,n,r,i)}function Qhe(e,t,n){t.forEach(((t,r)=>{const o=e[r];Dhe(o,`Panel data not found for index ${r}`);const{callbacks:i,constraints:a,id:s}=o,{collapsedSize:l=0,collapsible:c}=a,u=n[s];if(null==u||t!==u){n[s]=t;const{onCollapse:e,onExpand:r,onResize:o}=i;o&&o(t,u),c&&(e||r)&&(!r||null!=u&&!Fhe(u,l)||Fhe(t,l)||r(),!e||null!=u&&Fhe(u,l)||!Fhe(t,l)||e())}}))}function Jhe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function eme(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)}}catch(t){e.getItem=()=>null,e.setItem=()=>{}}}function tme(e){return`react-resizable-panels:${e}`}function nme(e){return e.map((e=>{const{constraints:t,id:n,idIsFromProps:r,order:o}=e;return r?n:o?`${o}:${JSON.stringify(t)}`:JSON.stringify(t)})).sort(((e,t)=>e.localeCompare(t))).join(",")}function rme(e,t){try{const n=tme(e),r=t.getItem(n);if(r){const e=JSON.parse(r);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function ome(e,t,n,r,o){var i;const a=tme(e),s=nme(t),l=null!==(i=rme(e,o))&&void 0!==i?i:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(a,JSON.stringify(l))}catch(c){}}function ime({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce(((e,t)=>e+t),0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!Uhe(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];Dhe(null!=e,`No layout data found for index ${i}`);n[i]=100/r*e}let o=0;for(let i=0;i<t.length;i++){const e=n[i];Dhe(null!=e,`No layout data found for index ${i}`);const r=$he({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!Uhe(o,0))for(let i=0;i<t.length;i++){const e=n[i];Dhe(null!=e,`No layout data found for index ${i}`);const r=$he({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,Uhe(o,0)))break}return n}const ame={getItem:e=>(eme(ame),ame.getItem(e)),setItem:(e,t)=>{eme(ame),ame.setItem(e,t)}},sme={};function lme({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=ame,style:u,tagName:d="div",...p}){const f=Jfe(a),h=n.useRef(null),[m,g]=n.useState(null),[v,y]=n.useState([]),b=function(){const[e,t]=n.useState(0);return n.useCallback((()=>t((e=>e+1))),[])}(),x=n.useRef({}),w=n.useRef(new Map),_=n.useRef(0),S=n.useRef({autoSaveId:e,direction:o,dragState:m,id:f,keyboardResizeBy:l,onLayout:s,storage:c}),E=n.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});n.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),n.useImperativeHandle(i,(()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:e}=E.current;return e},setLayout:e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current,o=ime({layout:e,panelConstraints:r.map((e=>e.constraints))});Yhe(n,o)||(y(o),E.current.layout=o,t&&t(o),Qhe(r,o,x.current))}})),[]),Yfe((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),Whe({committedValuesRef:S,eagerValuesRef:E,groupId:f,layout:v,panelDataArray:E.current.panelDataArray,setLayout:y,panelGroupElement:h.current}),n.useEffect((()=>{const{panelDataArray:t}=E.current;if(e){if(0===v.length||v.length!==t.length)return;let n=sme[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(ome,100),sme[e]=n);const r=[...t],o=new Map(w.current);n(e,r,o,v,c)}}),[e,v,c]),n.useEffect((()=>{}));const T=n.useCallback((e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current;if(e.constraints.collapsible){const o=r.map((e=>e.constraints)),{collapsedSize:i=0,panelSize:a,pivotIndices:s}=dme(r,e,n);if(Dhe(null!=a,`Panel size not found for panel "${e.id}"`),!Fhe(a,i)){w.current.set(e.id,a);const l=Vhe({delta:ume(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Jhe(n,l)||(y(l),E.current.layout=l,t&&t(l),Qhe(r,l,x.current))}}}),[]),C=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current;if(e.constraints.collapsible){const i=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s=0,minSize:l=0,pivotIndices:c}=dme(o,e,r),u=null!=t?t:l;if(Fhe(s,a)){const t=w.current.get(e.id),a=null!=t&&t>=u?t:u,l=Vhe({delta:ume(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});Jhe(r,l)||(y(l),E.current.layout=l,n&&n(l),Qhe(o,l,x.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=dme(n,e,t);return Dhe(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),N=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=ume(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const a=n[o];let s;return s=null==a?null!=e?e.toPrecision(i):"1":1===r.length?"1":a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:v,panelData:n,panelIndex:r})}),[m,v]),R=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=dme(n,e,t);return Dhe(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&Fhe(i,r)}),[]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=dme(n,e,t);return Dhe(null!=i,`Panel size not found for panel "${e.id}"`),!o||Ihe(i,r)>0}),[]),P=n.useCallback((e=>{const{panelDataArray:t}=E.current;t.push(e),t.sort(((e,t)=>{const n=e.order,r=t.order;return null==n&&null==r?0:null==n?-1:null==r?1:n-r})),E.current.panelDataArrayChanged=!0,b()}),[b]);Yfe((()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:t,storage:n}=S.current,{layout:r,panelDataArray:o}=E.current;let i=null;if(e){const t=function(e,t,n){var r,o;return null!==(o=(null!==(r=rme(e,n))&&void 0!==r?r:{})[nme(t)])&&void 0!==o?o:null}(e,o,n);t&&(w.current=new Map(Object.entries(t.expandToSizes)),i=t.layout)}null==i&&(i=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let r=0,o=100;for(let i=0;i<e.length;i++){const e=n[i];Dhe(e,`Panel constraints not found for index ${i}`);const{defaultSize:a}=e;null!=a&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const a=n[i];Dhe(a,`Panel constraints not found for index ${i}`);const{defaultSize:s}=a;if(null!=s)continue;const l=o/(e.length-r);r++,t[i]=l,o-=l}return t}({panelDataArray:o}));const a=ime({layout:i,panelConstraints:o.map((e=>e.constraints))});Yhe(r,a)||(y(a),E.current.layout=a,t&&t(a),Qhe(o,a,x.current))}})),Yfe((()=>{const e=E.current;return()=>{e.layout=[]}}),[]);const k=n.useCallback((e=>{let t=!1;const n=h.current;if(n){"rtl"===window.getComputedStyle(n,null).getPropertyValue("direction")&&(t=!0)}return function(n){n.preventDefault();const r=h.current;if(!r)return()=>null;const{direction:o,dragState:i,id:a,keyboardResizeBy:s,onLayout:l}=S.current,{layout:c,panelDataArray:u}=E.current,{initialLayout:d}=null!=i?i:{},p=qhe(a,e,r);let f=Zhe(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=Vhe({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:ahe(n)?"keyboard":"mouse-or-touch"}),v=!Jhe(c,g);(she(n)||lhe(n))&&_.current!=f&&(_.current=f,Phe(e,v||0===f?0:m?f<0?ghe:vhe:f<0?yhe:bhe)),v&&(y(g),E.current.layout=g,l&&l(g),Qhe(u,g,x.current))}}),[]),M=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current,i=o.map((e=>e.constraints)),{panelSize:a,pivotIndices:s}=dme(o,e,r);Dhe(null!=a,`Panel size not found for panel "${e.id}"`);const l=Vhe({delta:ume(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});Jhe(r,l)||(y(l),E.current.layout=l,n&&n(l),Qhe(o,l,x.current))}),[]),j=n.useCallback(((e,t)=>{const{layout:n,panelDataArray:r}=E.current,{collapsedSize:o=0,collapsible:i}=t,{collapsedSize:a=0,collapsible:s,maxSize:l=100,minSize:c=0}=e.constraints,{panelSize:u}=dme(r,e,n);null!=u&&(i&&s&&Fhe(u,o)?Fhe(o,a)||M(e,a):u<c?M(e,c):u>l&&M(e,l))}),[M]),L=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=Khe(e,h.current);Dhe(o,`Drag handle element not found for id "${e}"`);const i=Xhe(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),D=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=ume(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],E.current.panelDataArrayChanged=!0,b())}),[b]),F=n.useMemo((()=>({collapsePanel:T,direction:o,dragState:m,expandPanel:C,getPanelSize:A,getPanelStyle:N,groupId:f,isPanelCollapsed:R,isPanelExpanded:O,reevaluatePanelConstraints:j,registerPanel:P,registerResizeHandle:k,resizePanel:M,startDragging:L,stopDragging:D,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,N,f,R,O,j,P,k,M,L,D,I]);return n.createElement(Dfe.Provider,{value:F},n.createElement(d,{...p,children:t,className:r,id:a,ref:h,style:{...{display:"flex",flexDirection:"horizontal"===o?"row":"column",height:"100%",overflow:"hidden",width:"100%"},...u},[Ife]:"",[Ffe]:o,[Ufe]:f}))}const cme=n.forwardRef(((e,t)=>n.createElement(lme,{...e,forwardedRef:t})));function ume(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function dme(e,t,n){const r=ume(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function pme({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:o,id:i,onBlur:a,onClick:s,onDragging:l,onFocus:c,onPointerDown:u,onPointerUp:d,style:p={},tabIndex:f=0,tagName:h="div",...m}){var g,v;const y=n.useRef(null),b=n.useRef({onClick:s,onDragging:l,onPointerDown:u,onPointerUp:d});n.useEffect((()=>{b.current.onClick=s,b.current.onDragging=l,b.current.onPointerDown=u,b.current.onPointerUp=d}));const x=n.useContext(Dfe);if(null===x)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:w,groupId:_,registerResizeHandle:S,startDragging:E,stopDragging:T,panelGroupElement:C}=x,A=Jfe(i),[N,R]=n.useState("inactive"),[O,P]=n.useState(!1),[k,M]=n.useState(null),j=n.useRef({state:N});Yfe((()=>{j.current.state=N})),n.useEffect((()=>{if(r)M(null);else{const e=S(A);M((()=>e))}}),[r,A,S]);const L=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,D=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;Dhe(e,"Element ref not attached");let t=!1;return function(e,t,n,r,o){var i;const{ownerDocument:a}=t,s={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=null!==(i=She.get(a))&&void 0!==i?i:0;return She.set(a,l+1),The.add(s),jhe(),function(){var t;Ehe.delete(e),The.delete(s);const n=null!==(t=She.get(a))&&void 0!==t?t:1;if(She.set(a,n-1),jhe(),1===n&&She.delete(a),whe.includes(s)){const e=whe.indexOf(s);e>=0&&whe.splice(e,1),khe(),o("up",!0,null)}}}(A,e,w,{coarse:L,fine:D},((e,n,r)=>{if(n)switch(e){case"down":{R("drag"),t=!1,Dhe(r,'Expected event to be defined for "down" action'),E(A,r);const{onDragging:e,onPointerDown:n}=b.current;null==e||e(!0),null==n||n();break}case"move":{const{state:e}=j.current;t=!0,"drag"!==e&&R("hover"),Dhe(r,'Expected event to be defined for "move" action'),k(r);break}case"up":{R("hover"),T();const{onClick:e,onDragging:n,onPointerUp:r}=b.current;null==n||n(!1),null==r||r(),t||null==e||e();break}}else R("inactive")}))}),[L,w,r,D,S,A,k,E,T]),function({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:o}){n.useEffect((()=>{if(e||null==r||null==o)return;const n=Khe(t,o);if(null==n)return;const i=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),r(e);break;case"F6":{e.preventDefault();const r=n.getAttribute(Ufe);Dhe(r,`No group element found for id "${r}"`);const i=zhe(r,o),a=Hhe(r,t,o);Dhe(null!==a,`No resize element found for id "${t}"`),i[e.shiftKey?a>0?a-1:i.length-1:a+1<i.length?a+1:0].focus();break}}};return n.addEventListener("keydown",i),()=>{n.removeEventListener("keydown",i)}}),[o,e,t,r])}({disabled:r,handleId:A,resizeHandler:k,panelGroupElement:C});return n.createElement(h,{...m,children:e,className:t,id:i,onBlur:()=>{P(!1),null==a||a()},onFocus:()=>{P(!0),null==c||c()},ref:y,role:"separator",style:{touchAction:"none",userSelect:"none",...p},tabIndex:f,[Ffe]:w,[Ufe]:_,[Hfe]:"",[qfe]:"drag"===N?"pointer":O?"keyboard":void 0,[Gfe]:!r,[Kfe]:A,[Wfe]:N})}lme.displayName="PanelGroup",cme.displayName="forwardRef(PanelGroup)",pme.displayName="PanelResizeHandle";const fme=({className:e,...n})=>t.jsx(cme,{className:wB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),hme=the,mme=({withHandle:e,className:n,...r})=>t.jsx(pme,{className:wB("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",n),...r,children:e&&t.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsx(Eu,{className:"h-2.5 w-2.5"})})}),gme=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),vme="rgba(245, 246, 247, 1)",yme={[$e.SEND_COMMUNICATION]:{color:{bg:vme},clickable:!0},[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:vme},clickable:!1}},bme={[$e.SEND_COMMUNICATION]:"Send Email & SMS",[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},xme=({children:e,onClick:n,iconBgColor:r,iconStrokeColor:o,Icon:i,disabled:a=!1,selected:s=!1})=>{const l=i;return t.jsxs(AX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},style:{backgroundColor:s?r:vme},onClick:n,className:Zd("flex gap-2 items-center rounded-md transition-colors group","p-2 border-2 border-transparent overflow-hidden",!a&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:[t.jsx("div",{className:Zd("bg-purple-50 rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 transition-colors",!a&&"group-hover/trigger-audience:bg-background",r),children:t.jsx(l,{className:Zd("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})},wme=({segmentName:e})=>t.jsx("span",{className:"inline-flex items-center bg-white border border-gray-200 rounded-md px-2 py-0.5 text-sm font-medium shadow-sm",children:e}),_me=()=>{const e=aZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=QX(),u=n.useCallback((()=>c?.find((e=>e.type===rZ.ALL_USERS))),[c]);return n.useEffect((()=>{e&&c&&(null===i&&null===s?(a(e?.includeSegmentIds||null),l(e?.excludeSegmentIds||null),0===e.includeSegmentIds.length&&0===e.excludeSegmentIds.length&&(a([u()?.id||""]),l([]))):(JSON.stringify(e.includeSegmentIds)!==JSON.stringify(i)&&a(e.includeSegmentIds),JSON.stringify(e.excludeSegmentIds)!==JSON.stringify(s)&&l(e.excludeSegmentIds)))}),[e,s,i,c,u]),e&&i&&s?t.jsx(t.Fragment,{children:t.jsx(xme,{selected:o===Yte.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(Yte.EditAudience)},Icon:wZ.AudienceIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Rre,{children:"Audience"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(gme,{copyText:`Send to all ${ff("engage:user",{count:2})} in ${1===i.length?"this":"these"} ${ff("engage:segment",{count:i.length}).toLowerCase()}`}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:i.map((e=>{const n=c?.find((t=>t.id===e));return n?t.jsx(wme,{segmentName:n.name},e):null}))})]})]})})}):null},Sme=()=>{const e=aZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),{segments:i}=QX(),a=ff(e?.triggerType===Fe.TRIGGER_BASED?"engage:automation":"engage:one_time"),s=`Start this ${a?.toLowerCase()}`;if(!e||!i)return null;return t.jsx(t.Fragment,{children:(()=>{switch(e.triggerType){case Fe.TRIGGER_BASED:{if(e.triggerMetadata.triggerType!==Fe.TRIGGER_BASED||e.triggerMetadata.eventName!==Ue.USER_ENTERS_SEGMENT||!e.triggerMetadata.eventFilter.segment_id)return null;const n=e.triggerMetadata.eventFilter.segment_id,r=i.find((e=>e.id===n))?.name;return r?t.jsx(xme,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:wZ.TriggerIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Rre,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(gme,{copyText:`When ${ff("engage:user").toLowerCase()} joins the`}),t.jsx(wme,{segmentName:r})]})]})}):null}case Fe.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(xme,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(Yte.EditTime)},selected:o===Yte.EditTime,Icon:wZ.TriggerIcon,children:[t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Rre,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(gme,n?{copyText:`Click to set the date and time for this ${ff("engage:one_time")}`}:{copyText:"Bulk send at"}),!1===n&&"scheduledAt"in e.triggerMetadata&&e.triggerMetadata.scheduledAt&&t.jsx("div",{className:"text-xs font-medium",children:t.jsx(wme,{segmentName:o9(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),t.jsx("div",{className:"",children:n&&t.jsx(E9,{className:"group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors"})})]})}default:throw ene(e.triggerType,Fe)}})()})},Eme=e=>{switch(e){case $e.SEND_COMMUNICATION:return"Send Communication";case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw LX(e,$e)}},Tme=e=>{switch(e){case $e.SEND_COMMUNICATION:return t.jsx(wZ.CommunicationIcon,{className:"w-4 h-4"});case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(wZ.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw ene(e,$e)}},Cme=e=>{if(!(e&&e.actionType===$e.WAIT_UNTIL_NEXT_FIXED_TIME&&"hour"in e&&"minute"in e&&"timezone"in e))return null;const{hour:t,minute:n,timezone:r}=e;return`Wait until next ${`${t?.toString().padStart(2,"0")}:${n?.toString().padStart(2,"0")}`} ${r}`},Ame=({actionDataWithMetadata:e})=>{const{actionData:r,communicationGroup:o}=e,{state:{selectedActionId:i},setActionId:a,setSelectedCommunicationGroupId:s}=n.useContext(VX),l=n.useMemo((()=>i===r.actionMetadata.currentActionId),[i,r.actionMetadata.currentActionId]),c=yme[r.actionType],u=c.color,d=c.clickable;return t.jsx(AX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:Zd("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",l&&"border-primary",r.actionType!==$e.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:l?u.bg:u.bgUnselected??vme},onClick:()=>{d&&(a(r.actionMetadata.currentActionId),r.actionType===$e.SEND_COMMUNICATION&&s(r.actionMetadata.communicationGroupId))},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white",children:Tme(r.actionType)}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{style:{color:l?u.text:u.textUnselected},children:t.jsx(Rre,{children:bme[r.actionType]})}),t.jsx("div",r.actionType===$e.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:Cme(r.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:r.actionType===$e.SEND_COMMUNICATION&&o?.emailSubject?o?.emailSubject:Eme(r.actionType)})]})]})})},Nme=()=>{const[e,r]=n.useState(!1),[o,i]=n.useState(void 0),[a,s]=n.useState(!1),[l,c]=n.useState(""),[u,d]=n.useState(null),p=aZ(),{setActionId:f,state:{selectedActionId:h}}=n.useContext(VX),{updateAutomation:m}=Le(p?.id||""),{toast:g}=jl();if(n.useEffect((()=>{if(!p)return;if(h)return;const e=p.actionData?.find((e=>"send_communication"===e.actionType));e&&f(e.actionMetadata.currentActionId)}),[p,f,h]),n.useEffect((()=>{if(!p)return;(async()=>{const e=[];for(const t of p.actionData??[])switch(t.actionType){case $e.SEND_COMMUNICATION:{const n=await zX(t.actionMetadata.communicationGroupId);e.push({actionData:t,communicationGroup:n});break}case $e.WAIT_UNTIL_NEXT_FIXED_TIME:e.push({actionData:t});break;default:throw LX(t.actionType,$e)}i(e)})()}),[p]),n.useEffect((()=>{d(null),c(p?.description??"")}),[p?.description]),!p||!o)return null;const v=(e=>{const{steps:t,rootActionId:n}=e;if(!t||!n)return t??[];const r=new Map(t.map((e=>[e.actionData.actionMetadata.currentActionId,e]))),o=r.get(n);if(!o)return t;const i=[];let a=o;for(;a;){i.push(a);const e=a.actionData.actionMetadata.nextActionId;if(!e)break;a=r.get(e)}return i})({steps:o,rootActionId:p.triggerMetadata?.triggerType===Fe.TRIGGER_BASED?p.triggerMetadata.rootActionId:void 0}).filter((t=>!!e||"send_communication"===t.actionData.actionType));let y=()=>t.jsx("div",{},"empty-trigger-audience");(e||p.triggerType===Fe.ONE_TIME)&&(y=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[p.triggerType===Fe.ONE_TIME&&t.jsx(_me,{}),p.triggerType!==Fe.ONE_TIME&&t.jsx(Sme,{})]}));const b=async()=>{d(l),m({description:l},{onSuccess:()=>{g({title:"Description updated 🚀"}),s(!1)}})};return t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[p.description||a?t.jsx("div",{className:"w-full mx-auto rounded-xl bg-neutral-50 dark:bg-neutral-900 shadow-sm px-4 py-3 my-2 border border-neutral-200 dark:border-neutral-800 text-neutral-800 dark:text-neutral-100 text-[15px] font-medium leading-snug tracking-tight justify-start group relative transition-colors duration-150",style:{containerType:"inline-size"},tabIndex:0,onClick:()=>{s(!0)},role:"button","aria-label":"Edit automation description",children:a?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("textarea",{className:"w-full bg-transparent outline-none resize-none text-[15px] font-medium leading-snug tracking-tight text-neutral-800 dark:text-neutral-100 rounded-xl border border-primary-500 focus:ring-2 focus:ring-primary-400 transition-all min-h-[48px] p-2",style:{containerType:"inline-size"},value:l,autoFocus:!0,rows:2,maxLength:300,onChange:e=>c(e.target.value),onBlur:()=>{s(!1)},"aria-label":"Edit automation description textarea"}),t.jsx(vZ,{variant:"secondary",onClick:b,onMouseDown:e=>e.preventDefault(),className:"z-20",children:"Update Description"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"pr-8 select-text cursor-pointer",children:null!==u?u:p.description}),t.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity duration-150 pointer-events-none",children:t.jsx(wZ.EditIcon,{className:"w-4 h-4"})})]})}):null,p.triggerType===Fe.TRIGGER_BASED&&t.jsxs("div",{className:"flex gap-2 items-center justify-between",children:[t.jsx("div",{className:"text-[13px] text-muted-foreground",children:"Messages sent in listed order"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("div",{className:"text-[13px] font-medium",children:"Show all details"}),t.jsx(cle,{defaultChecked:e,onCheckedChange:()=>{r(!e)}})]})]}),t.jsx("div",{className:"flex-1 flex flex-col gap-3",children:t.jsxs(zB,{mode:"popLayout",children:[y(),v.map(((e,n)=>t.jsx(AX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,delay:.05*n,ease:"easeInOut"},children:t.jsx(Ame,{actionDataWithMetadata:e})},e.actionData.actionMetadata?.currentActionId??n))),p.triggerType===Fe.ONE_TIME&&t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx(Sme,{})},"one-time-trigger")]})})]})},Rme=()=>{const e=aZ(),{segments:n}=QX();return t.jsx("div",e&&n?{className:"h-full pt-4 relative",children:t.jsx("div",{className:"absolute inset-0 overflow-y-auto flex flex-col gap-3",children:t.jsx(Nme,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(hZ,{text:[`Getting details on your ${ff("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},Ome=({hideSms:e})=>{const{state:{selectedActionId:r}}=n.useContext(VX);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(zB,{mode:"wait",children:r===Yte.EditTime?t.jsx(Mse,{}):r===Yte.EditAudience?t.jsx(Tle,{}):t.jsx(Tre,{hideSms:e})})})},Pme=({hideSms:e})=>t.jsxs(fme,{direction:"horizontal",className:"flex-1",children:[t.jsx(hme,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(Rme,{})})}),t.jsx(mme,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(hme,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(Ome,{hideSms:e})})})]}),kme=({hideSms:e,hideSales:r})=>{const[o,i]=n.useState("workflow"),a=[{id:"workflow",label:"Workflow",content:t.jsx(Pme,{hideSms:e})},{id:"recipients",label:"Recipients",content:t.jsx(Lfe,{})},{id:"insights",label:ff("engage:insight",{count:2}),content:t.jsx(jfe,{hideSms:e,hideSales:r})}];return t.jsx("div",{className:"h-full w-full",children:t.jsx(Dle,{tabs:a,activeTab:o,onTabChange:i,tabsLocation:"left"})})},Mme=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i,hideSms:a,hideSales:s})=>{const l=aZ(),c=sZ(),{updateCommunicationGroup:u}=KX(),{toast:d}=jl();return n.useEffect((()=>{if(c&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(c.extraMergeFields)&&u({groupId:c?.id,params:{extraMergeFields:e}},{onError:e=>{d({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[c,i,u,d]),l&&c?t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(Mfe,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(kme,{hideSms:a,hideSales:s})})]}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(hZ,{text:[`Fetching ${ff("engage:automation").toLowerCase()} data`,"Finishing up"]})})},jme=({...e})=>{const n=function(){let{matches:e}=i.useContext(U5),t=e[e.length-1];return t?t.params:{}}(),[r]=N4(),o=e.automationId||n?.automationId||r.get("automationId")||"",a="true"===r.get("showBackButton")||e.showBackButton;return t.jsx(cZ,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(Mme,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var Lme=e=>null!=e;var Dme=e=>"function"!=typeof e||e.length?e:e(),Ime=e=>Array.isArray(e)?e:e?[e]:[];var Fme=mt;var Ume,$me=function(e){const[t,n]=at(),r=e?.throw?(e,t)=>{throw n(e instanceof Error?e:new Error(t)),e}:(e,t)=>{n(e instanceof Error?e:new Error(t))},o=e?.api?Array.isArray(e.api)?e.api:[e.api]:[globalThis.localStorage].filter(Boolean),i=e?.prefix?`${e.prefix}.`:"",a=new Map,s=new Proxy({},{get(t,n){let s=a.get(n);s||(s=at(void 0,{equals:!1}),a.set(n,s)),s[0]();const l=o.reduce(((e,t)=>{if(null!==e||!t)return e;try{return t.getItem(`${i}${n}`)}catch(eEe){return r(eEe,`Error reading ${i}${n} from ${t.name}`),null}}),null);return null!==l&&e?.deserializer?e.deserializer(l,n,e.options):l}});return!1!==e?.sync&&ht((()=>{const e=e=>{let t=!1;o.forEach((n=>{try{n!==e.storageArea&&e.key&&e.newValue!==n.getItem(e.key)&&(e.newValue?n.setItem(e.key,e.newValue):n.removeItem(e.key),t=!0)}catch(eEe){r(eEe,`Error synching api ${n.name} from storage event (${e.key}=${e.newValue})`)}})),t&&e.key&&a.get(e.key)?.[1]()};"addEventListener"in globalThis?(globalThis.addEventListener("storage",e),mt((()=>globalThis.removeEventListener("storage",e)))):(o.forEach((t=>t.addEventListener?.("storage",e))),mt((()=>o.forEach((t=>t.removeEventListener?.("storage",e))))))})),[s,(t,n,s)=>{const l=e?.serializer?e.serializer(n,t,s??e.options):n,c=`${i}${t}`;o.forEach((e=>{try{e.getItem(c)!==l&&e.setItem(c,l)}catch(eEe){r(eEe,`Error setting ${i}${t} to ${l} in ${e.name}`)}}));const u=a.get(t);u&&u[1]()},{clear:()=>o.forEach((e=>{try{e.clear()}catch(eEe){r(eEe,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(eEe){r(eEe,`Error removing ${i}${e} from ${t.name}`)}})),toJSON:()=>{const t={},n=(n,r)=>{if(!t.hasOwnProperty(n)){const o=r&&e?.deserializer?e.deserializer(r,n,e.options):r;o&&(t[n]=o)}};return o.forEach((e=>{if("function"==typeof e.getAll){let t;try{t=e.getAll()}catch(eEe){r(eEe,`Error getting all values from in ${e.name}`)}for(const e of t)n(e,t[e])}else{let o,i=0;try{for(;o=e.key(i++);)t.hasOwnProperty(o)||n(o,e.getItem(o))}catch(eEe){r(eEe,`Error getting all values from ${e.name}`)}}})),t}}]},Vme=e=>{if(!e)return"";let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const r=e[n];t+=r instanceof Date?`; ${n}=${r.toUTCString()}`:"boolean"==typeof r?`; ${n}`:`; ${n}=${r}`}return t},Bme=("function"==typeof(Ume={_cookies:[globalThis.document,"cookie"],getItem:e=>Bme._cookies[0][Bme._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=Bme.getItem(e);Bme._cookies[0][Bme._cookies[1]]=`${e}=${t}${Vme(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:Bme});window.dispatchEvent(o)},removeItem:e=>{Bme._cookies[0][Bme._cookies[1]]=`${e}=deleted${Vme({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return Bme._cookies[0][Bme._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return Bme._cookies[0][Bme._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(Ume.clear=()=>{let e;for(;e=Ume.key(0);)Ume.removeItem(e)}),Ume),zme=796,Hme="bottom",qme="system",Gme=Object.keys(Nr)[0],Kme=Object.keys(Pr)[0],Wme=xt({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Yme(){return wt(Wme)}var Xme=xt(void 0),Zme=e=>{const[t,n]=at(null),r=()=>{const e=t();null!=e&&(e.close(),n(null))},o=(r,o)=>{if(null!=t())return;const i=window.open("","TSQD-Devtools-Panel",`width=${r},height=${o},popup`);if(!i)throw new Error("Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.");i.document.head.innerHTML="",i.document.body.innerHTML="",function(e=window.document){if(e[un]){for(let t of e[un].keys())e.removeEventListener(t,En);delete e[un]}}(i.document),i.document.title="TanStack Query Devtools",i.document.body.style.margin="0",i.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(Yme().shadowDOMTarget||document).styleSheets].forEach((e=>{try{const t=[...e.cssRules].map((e=>e.cssText)).join(""),n=document.createElement("style"),r=e.ownerNode;let o="";r&&"id"in r&&(o=r.id),o&&n.setAttribute("id",o),n.textContent=t,i.document.head.appendChild(n)}catch(JSe){const n=document.createElement("link");if(null==e.href)return;n.rel="stylesheet",n.type=e.type,n.media=e.media.toString(),n.href=e.href,i.document.head.appendChild(n)}})),fn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],i.document),e.setLocalStore("pip_open","true"),n(i)};ct((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||o(Number(window.innerWidth),Number(e.localStore.height||500))})),ct((()=>{const e=(Yme().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(Yme().shadowDOMTarget||n.document).querySelector("#_goober");t&&(t.textContent=e.textContent)}));t.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),mt((()=>{t.disconnect()}))}}));const i=ut((()=>({pipWindow:t(),requestPipWindow:o,closePipWindow:r,disabled:e.disabled??!1})));return $t(Xme.Provider,{value:i,get children(){return e.children}})},Qme=()=>ut((()=>{const e=wt(Xme);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Jme=xt((()=>"dark"));function ege(){return wt(Jme)}var tge={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Ấ":"A","Ắ":"A","Ẳ":"A","Ẵ":"A","Ặ":"A","Æ":"AE","Ầ":"A","Ằ":"A","Ȃ":"A","Ç":"C","Ḉ":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ế":"E","Ḗ":"E","Ề":"E","Ḕ":"E","Ḝ":"E","Ȇ":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ḯ":"I","Ȋ":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ố":"O","Ṍ":"O","Ṓ":"O","Ȏ":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ấ":"a","ắ":"a","ẳ":"a","ẵ":"a","ặ":"a","æ":"ae","ầ":"a","ằ":"a","ȃ":"a","ç":"c","ḉ":"c","è":"e","é":"e","ê":"e","ë":"e","ế":"e","ḗ":"e","ề":"e","ḕ":"e","ḝ":"e","ȇ":"e","ì":"i","í":"i","î":"i","ï":"i","ḯ":"i","ȋ":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ố":"o","ṍ":"o","ṓ":"o","ȏ":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","C̆":"C","c̆":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","Ǵ":"G","ĝ":"g","ǵ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ḫ":"H","ḫ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","Ḱ":"K","ḱ":"k","K̆":"K","k̆":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"l","ł":"l","Ḿ":"M","ḿ":"m","M̆":"M","m̆":"m","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","N̆":"N","n̆":"n","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","P̆":"P","p̆":"p","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","R̆":"R","r̆":"r","Ȓ":"R","ȓ":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","Ș":"S","ș":"s","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","ț":"t","Ț":"T","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","T̆":"T","t̆":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ȗ":"U","ȗ":"u","V̆":"V","v̆":"v","Ŵ":"W","ŵ":"w","Ẃ":"W","ẃ":"w","X̆":"X","x̆":"x","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Y̆":"Y","y̆":"y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ſ":"s","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Ǎ":"A","ǎ":"a","Ǐ":"I","ǐ":"i","Ǒ":"O","ǒ":"o","Ǔ":"U","ǔ":"u","Ǖ":"U","ǖ":"u","Ǘ":"U","ǘ":"u","Ǚ":"U","ǚ":"u","Ǜ":"U","ǜ":"u","Ứ":"U","ứ":"u","Ṹ":"U","ṹ":"u","Ǻ":"A","ǻ":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","ǿ":"o","Þ":"TH","þ":"th","Ṕ":"P","ṕ":"p","Ṥ":"S","ṥ":"s","X́":"X","x́":"x","Ѓ":"Г","ѓ":"г","Ќ":"К","ќ":"к","A̋":"A","a̋":"a","E̋":"E","e̋":"e","I̋":"I","i̋":"i","Ǹ":"N","ǹ":"n","Ồ":"O","ồ":"o","Ṑ":"O","ṑ":"o","Ừ":"U","ừ":"u","Ẁ":"W","ẁ":"w","Ỳ":"Y","ỳ":"y","Ȁ":"A","ȁ":"a","Ȅ":"E","ȅ":"e","Ȉ":"I","ȉ":"i","Ȍ":"O","ȍ":"o","Ȑ":"R","ȑ":"r","Ȕ":"U","ȕ":"u","B̌":"B","b̌":"b","Č̣":"C","č̣":"c","Ê̌":"E","ê̌":"e","F̌":"F","f̌":"f","Ǧ":"G","ǧ":"g","Ȟ":"H","ȟ":"h","J̌":"J","ǰ":"j","Ǩ":"K","ǩ":"k","M̌":"M","m̌":"m","P̌":"P","p̌":"p","Q̌":"Q","q̌":"q","Ř̩":"R","ř̩":"r","Ṧ":"S","ṧ":"s","V̌":"V","v̌":"v","W̌":"W","w̌":"w","X̌":"X","x̌":"x","Y̌":"Y","y̌":"y","A̧":"A","a̧":"a","B̧":"B","b̧":"b","Ḑ":"D","ḑ":"d","Ȩ":"E","ȩ":"e","Ɛ̧":"E","ɛ̧":"e","Ḩ":"H","ḩ":"h","I̧":"I","i̧":"i","Ɨ̧":"I","ɨ̧":"i","M̧":"M","m̧":"m","O̧":"O","o̧":"o","Q̧":"Q","q̧":"q","U̧":"U","u̧":"u","X̧":"X","x̧":"x","Z̧":"Z","z̧":"z"},nge=Object.keys(tge).join("|"),rge=new RegExp(nge,"g");var oge=7,ige=6,age=5,sge=4,lge=3,cge=2,uge=1,dge=0;function pge(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:uge,!n.accessors){const r=fge(e,t,n);return{rankedValue:e,rank:r,accessorIndex:-1,accessorThreshold:n.threshold,passed:r>=n.threshold}}const o=function(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r],i=vge(o),a=mge(e,o);for(let e=0,t=a.length;e<t;e++)n.push({itemValue:a[e],attributes:i})}return n}(e,n.accessors),i={rankedValue:e,rank:dge,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=fge(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=uge?r=s:r>l&&(r=l),r=Math.min(r,l),r>=c&&r>i.rank&&(i.rank=r,i.passed=!0,i.accessorIndex=a,i.accessorThreshold=c,i.rankedValue=e.itemValue)}return i}function fge(e,t,n){return e=hge(e,n),(t=hge(t,n)).length>e.length?dge:e===t?oge:(e=e.toLowerCase())===(t=t.toLowerCase())?ige:e.startsWith(t)?age:e.includes(` ${t}`)?sge:e.includes(t)?lge:1===t.length?dge:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?cge:function(e,t){let n=0,r=0;function o(e,t,r){for(let o=r,i=t.length;o<i;o++){if(t[o]===e)return n+=1,o+1}return-1}function i(e){return uge+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return dge;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return dge}return i(r-a)}(e,t)}function hge(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(rge,(e=>tge[e]))),e}function mge(e,t){let n=t;"object"==typeof t&&(n=t.accessor);const r=n(e);return null==r?[]:Array.isArray(r)?r:[String(r)]}var gge={maxRanking:1/0,minRanking:-1/0};function vge(e){return"function"==typeof e?gge:{...gge,...e}}var yge={data:""},bge=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,xge=/\/\*[^]*?\*\/| +/g,wge=/\n+/g,_ge=(e,t)=>{let n="",r="",o="";for(let i in e){let a=e[i];"@"==i[0]?"i"==i[1]?n=i+" "+a+";":r+="f"==i[1]?_ge(a,i):i+"{"+_ge(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=_ge(a,t?t.replace(/([^,])+/g,(e=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)))):i):null!=a&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=_ge.p?_ge.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},Sge={},Ege=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+Ege(e[n]);return t}return e};function Tge(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=Ege(e),a=Sge[i]||(Sge[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!Sge[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=bge.exec(e.replace(xge,""));)t[4]?r.shift():t[3]?(n=t[3].replace(wge," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(wge," ").trim();return r[0]})(e);Sge[a]=_ge(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&Sge.g?Sge.g:null;return n&&(Sge.g=Sge[a]),l=Sge[a],c=t,u=r,(d=s)?c.data=c.data.replace(d,l):-1===c.data.indexOf(l)&&(c.data=u?l+c.data:c.data+l),a;var l,c,u,d})(n.unshift?n.raw?((e,t,n)=>e.reduce(((e,r,o)=>{let i=t[o];if(i&&i.call){let e=i(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;i=t?"."+t:e&&"object"==typeof e?e.props?"":_ge(e,""):!1===e?"":e}return e+r+(null==i?"":i)}),""))(n,[].slice.call(arguments,1),t.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(t.p):n)),{}):n,(r=t.target,"object"==typeof window?((r?r.querySelector("#_goober"):window._goober)||Object.assign((r||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:r||yge),t.g,t.o,t.k);var r}function Cge(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Cge(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Age(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Cge(e))&&(r&&(r+=" "),r+=t);return r}function Nge(e,t){const n=pt(e),{onChange:r}=t;let o=new Set(t.appear?void 0:n);const i=new WeakSet,[a,s]=at([],{equals:!1}),[l]=[yt,vt],c=e=>{s((t=>(t.push.apply(t,e),t)));for(const t of e)i.delete(t)},u=(e,t,n)=>e.splice(n,0,t);return ut((t=>{const n=a(),s=e();if(pt(l))return l(),t;if(n.length){const e=t.filter((e=>!n.includes(e)));return n.length=0,r({list:e,added:[],removed:[],unchanged:e,finishRemoved:c}),e}return pt((()=>{const e=new Set(s),n=s.slice(),a=[],l=[],d=[];for(const t of s)(o.has(t)?d:a).push(t);let p=!a.length;for(let r=0;r<t.length;r++){const o=t[r];e.has(o)||(i.has(o)||(l.push(o),i.add(o)),u(n,o,r)),p&&o!==n[r]&&(p=!1)}return!l.length&&p?t:(r({list:n,added:a,removed:l,unchanged:d,finishRemoved:c}),o=e,n)}))}),t.appear?[]:n.slice())}function Rge(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}Tge.bind({g:1}),Tge.bind({k:1});var Oge=e=>e instanceof Element;function Pge(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return Pge(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=Pge(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function kge(e,t=Oge,n=Oge){const r=ut(e),o=ut((()=>Pge(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function Mge(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function jge(e,t,n,r){const{onBeforeEnter:o,onEnter:i,onAfterEnter:a}=t;function s(t){t&&t.target!==n||(n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.enterActive),n.classList.remove(...e.enterTo),a?.(n))}o?.(n),n.classList.add(...e.enter),n.classList.add(...e.enterActive),queueMicrotask((()=>{if(!n.parentNode)return r?.();i?.(n,(()=>s()))})),Mge((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function Lge(e,t,n,r){const{onBeforeExit:o,onExit:i,onAfterExit:a}=t;if(!n.parentNode)return r?.();function s(t){t&&t.target!==n||(r?.(),n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.exitActive),n.classList.remove(...e.exitTo),a?.(n))}o?.(n),n.classList.add(...e.exit),n.classList.add(...e.exitActive),i?.(n,(()=>s())),Mge((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var Dge=e=>{const t=function(e){return ut((()=>{const t=e.name||"s";return{enterActive:(e.enterActiveClass||t+"-enter-active").split(" "),enter:(e.enterClass||t+"-enter").split(" "),enterTo:(e.enterToClass||t+"-enter-to").split(" "),exitActive:(e.exitActiveClass||t+"-exit-active").split(" "),exit:(e.exitClass||t+"-exit").split(" "),exitTo:(e.exitToClass||t+"-exit-to").split(" "),move:(e.moveClass||t+"-move").split(" ")}}))}(e);return Nge(kge((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)jge(a,e,t);const s=[];for(const e of i)e.isConnected&&(e instanceof HTMLElement||e instanceof SVGElement)&&s.push({el:e,rect:e.getBoundingClientRect()});queueMicrotask((()=>{const e=[];for(const{el:t,rect:n}of s)if(t.isConnected){const r=t.getBoundingClientRect(),o=n.left-r.left,i=n.top-r.top;(o||i)&&(t.style.transform=`translate(${o}px, ${i}px)`,t.style.transitionDuration="0s",e.push(t))}document;for(const t of e){let e=function(n){(n.target===t||/transform$/.test(n.propertyName))&&(t.removeEventListener("transitionend",e),t.classList.remove(...a.move))};t.classList.add(...a.move),t.style.transform=t.style.transitionDuration="",t.addEventListener("transitionend",e)}}));for(const t of r)Lge(a,e,t,(()=>o([t])))}})},Ige=Symbol("fallback");function Fge(e){for(const t of e)t.dispose()}function Uge(e){const{by:t}=e;return ut(function(e,t,n,r={}){const o=new Map;return mt((()=>Fge(o.values()))),()=>{const n=e()||[];return pt((()=>{if(!n.length)return Fge(o.values()),o.clear(),r.fallback?[it((e=>(o.set(Ige,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(Ige);if(!o.size||a){a?.dispose(),o.delete(Ige);for(let r=0;r<n.length;r++){const o=n[r];i(e,o,r,t(o,r))}return e}const s=new Set(o.keys());for(let r=0;r<n.length;r++){const a=n[r],l=t(a,r);s.delete(l);const c=o.get(l);c?(e[r]=c.mapped,c.setIndex?.(r),c.setItem((()=>a))):i(e,a,r,l)}for(const t of s)o.get(t)?.dispose(),o.delete(t);return e}))};function i(e,t,r,i){it((a=>{const[s,l]=at(t),c={setItem:l,dispose:a};if(n.length>1){const[e,t]=at(r);c.setIndex=t,c.mapped=n(s,e)}else c.mapped=n(s);o.set(i,c),e[r]=c.mapped}))}}((()=>e.each),"function"==typeof t?t:e=>e[t],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function $ge(e,t,n,r){const o=()=>{Ime(Dme(e)).forEach((e=>{e&&Ime(Dme(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),Fme(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?ct(o):lt(o)}function Vge(e,t,n){const r=new WeakMap,{observe:o,unobserve:i}=function(e,t){const n=new ResizeObserver(e);return mt(n.disconnect.bind(n)),{observe:e=>n.observe(e,t),unobserve:n.unobserve.bind(n)}}((e=>{for(const n of e){const{contentRect:e,target:o}=n,i=Math.round(e.width),a=Math.round(e.height),s=r.get(o);s&&s.width===i&&s.height===a||(t(e,o,n),r.set(o,{width:i,height:a}))}}),n);ct((t=>{const n=Ime(Dme(e)).filter(Lme);return function(e,t,n,r){const o=e.length,i=t.length;let a,s,l=0;if(i)if(o){for(;l<i&&t[l]===e[l];l++);for(a of(t=t.slice(l),e=e.slice(l),t))e.includes(a)||r(a);for(s of e)t.includes(s)||n(s)}else for(;l<i;l++)r(t[l]);else for(;l<o;l++)n(e[l])}(n,t,o,i),n}),[])}var Bge=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function zge(e){const t={};let n;for(;n=Bge.exec(e);)t[n[1]]=n[2];return t}function Hge(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=zge(e)}else"string"==typeof t&&(t=zge(t));return{...e,...t}}function qge(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function Gge(e){return"[object String]"===Object.prototype.toString.call(e)}function Kge(e){return t=>`${e()}-${t}`}function Wge(e,t){return!!e&&(e===t||e.contains(t))}function Yge(e,t=!1){const{activeElement:n}=Xge(e);if(!n?.nodeName)return null;if(Zge(n)&&n.contentDocument)return Yge(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Xge(n).getElementById(e);if(t)return t}}return n}function Xge(e){return e?e.ownerDocument||e:document}function Zge(e){return"IFRAME"===e.tagName}var Qge=(e=>(e.Escape="Escape",e.Enter="Enter",e.Tab="Tab",e.Space=" ",e.ArrowDown="ArrowDown",e.ArrowLeft="ArrowLeft",e.ArrowRight="ArrowRight",e.ArrowUp="ArrowUp",e.End="End",e.Home="Home",e.PageDown="PageDown",e.PageUp="PageUp",e))(Qge||{});function Jge(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function eve(){return Jge(/^Mac/i)}function tve(){return Jge(/^iPhone/i)||Jge(/^iPad/i)||eve()&&navigator.maxTouchPoints>1}function nve(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function rve(e){return t=>{for(const n of e)nve(t,n)}}function ove(e){return eve()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function ive(e){if(e)if(function(){if(null==ave){ave=!1;try{document.createElement("div").focus({get preventScroll(){return ave=!0,!0}})}catch(JSe){}}return ave}())e.focus({preventScroll:!0});else{const t=function(e){let t=e.parentNode;const n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft});return n}(e);e.focus(),function(e){for(const{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}var ave=null;var sve=["input:not([type='hidden']):not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","[tabindex]","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])"],lve=[...sve,'[tabindex]:not([tabindex="-1"]):not([disabled])'],cve=sve.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",uve=lve.join(':not([hidden]):not([tabindex="-1"]),');function dve(e,t){const n=Array.from(e.querySelectorAll(cve)).filter(pve);return t&&pve(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Zge(e)&&e.contentDocument){const r=dve(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function pve(e){return fve(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function fve(e){return e.matches(cve)&&hve(e)}function hve(e,t){return"#comment"!==e.nodeName&&function(e){if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const{display:t,visibility:n}=e.style;let r="none"!==t&&"hidden"!==n&&"collapse"!==n;if(r){if(!e.ownerDocument.defaultView)return r;const{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:o}=t(e);r="none"!==n&&"hidden"!==o&&"collapse"!==o}return r}(e)&&function(e,t){return!e.hasAttribute("hidden")&&("DETAILS"!==e.nodeName||!t||"SUMMARY"===t.nodeName||e.hasAttribute("open"))}(e,t)&&(!e.parentElement||hve(e.parentElement,e))}function mve(e){for(;e&&!gve(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function gve(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function vve(){}function yve(e,t){return qt(e,t)}var bve=new Map,xve=new Set;function wve(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=bve.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),bve.delete(t.target)),0===bve.size)){for(const e of xve)e();xve.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=bve.get(t.target);n||(n=new Set,bve.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function _ve(e,t){const n=Sve(e,t,"left"),r=Sve(e,t,"top"),o=t.offsetWidth,i=t.offsetHeight;let a=e.scrollLeft,s=e.scrollTop;const l=a+e.offsetWidth,c=s+e.offsetHeight;n<=a?a=n:n+o>l&&(a+=n+o-l),r<=s?s=r:r+i>c&&(s+=r+i-c),e.scrollLeft=a,e.scrollTop=s}function Sve(e,t,n){const r="left"===n?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);){if(t.offsetParent.contains(e)){o-=e[r];break}t=t.offsetParent}return o}"undefined"!=typeof document&&("loading"!==document.readyState?wve():document.addEventListener("DOMContentLoaded",wve));var Eve={border:"0",clip:"rect(0 0 0 0)","clip-path":"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:"0",position:"absolute",width:"1px","white-space":"nowrap"};function Tve(e){return t=>(e(t),()=>e(void 0))}function Cve(e,t){const[n,r]=at(Ave(t?.()));return ct((()=>{r(e()?.tagName.toLowerCase()||Ave(t?.()))})),n}function Ave(e){return Gge(e)?e:void 0}function Nve(e){const[t,n]=Gt(e,["as"]);if(!t.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return $t(Pn,qt(n,{get component(){return t.as}}))}var Rve=["id","name","validationState","required","disabled","readOnly"];var Ove=xt();function Pve(){const e=wt(Ove);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function kve(e){const t=Pve(),n=yve({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Nve,qt({as:"div"},(()=>t.dataset()),n))}function Mve(e){const t=Pve(),n=yve({id:t.generateId("error-message")},e),[r,o]=Gt(n,["forceMount"]),i=()=>"invalid"===t.validationState();return ct((()=>{i()&&mt(t.registerErrorMessage(o.id))})),$t(Jt,{get when(){return r.forceMount||i()},get children(){return $t(Nve,qt({as:"div"},(()=>t.dataset()),o))}})}function jve(e){let t;const n=Pve(),r=yve({id:n.generateId("label")},e),[o,i]=Gt(r,["ref"]),a=Cve((()=>t),(()=>"label"));return ct((()=>mt(n.registerLabel(i.id)))),$t(Nve,qt({as:"label",ref(e){const n=Rge((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ut((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function Lve(e,t){ct(ft(e,(e=>{if(null==e)return;const n=function(e){return function(e){return e.matches("textarea, input, select, button")}(e)?e.form:e.closest("form")}(e);null!=n&&(n.addEventListener("reset",t,{passive:!0}),mt((()=>{n.removeEventListener("reset",t)})))})))}function Dve(e){const[t,n]=at(e.defaultValue?.()),r=ut((()=>void 0!==e.value?.())),o=ut((()=>r()?e.value?.():t()));return[o,t=>{pt((()=>{const i=function(e,...t){return"function"==typeof e?e(...t):e}(t,o());return Object.is(i,o())||(r()||n(i),e.onChange?.(i)),i}))}]}function Ive(e){const[t,n]=Dve(e);return[()=>t()??!1,n]}var Fve=Object.defineProperty,Uve=(e,t)=>{for(var n in t)Fve(e,n,{get:t[n],enumerable:!0})},$ve=xt();function Vve(){return wt($ve)}function Bve(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function zve(e,t){const n=function(e){const t=e.map(((e,t)=>[t,e]));let n=!1;return t.sort((([e,t],[r,o])=>{const i=t.ref(),a=o.ref();return i===a?0:i&&a?Bve(i,a)?(e>r&&(n=!0),-1):(e<r&&(n=!0),1):0})),n?t.map((([e,t])=>t)):e}(e);e!==n&&t(n)}function Hve(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){ct((()=>{const n=setTimeout((()=>{zve(e(),t)}));mt((()=>clearTimeout(n)))}))}(e,t);let n=[];ct((()=>{const r=function(e){const t=e[0],n=e[e.length-1]?.ref();let r=t?.ref()?.parentElement;for(;r;){if(n&&r.contains(n))return r;r=r.parentElement}return Xge(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&zve(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}mt((()=>o.disconnect()))}))}function qve(e={}){const[t,n]=function(e){const[t,n]=Dve(e);return[()=>t()??[],n]}({value:()=>Dme(e.items),onChange:t=>e.onItemsChange?.(t)});Hve(t,n);const r=e=>(n((t=>{const n=function(e,t){const n=t.ref();if(!n)return-1;let r=e.length;if(!r)return-1;for(;r--;){const t=e[r]?.ref();if(t&&Bve(t,n))return r+1}return 0}(t,e);return function(e,t,n=-1){return n in e?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}(t,e,n)})),()=>{n((t=>{const n=t.filter((t=>t.ref()!==e.ref()));return t.length===n.length?t:n}))});return{DomCollectionProvider:e=>$t($ve.Provider,{value:{registerItem:r},get children(){return e.children}})}}function Gve(e){const t=function(){const e=Vve();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=yve({shouldRegisterItem:!0},e);ct((()=>{if(!n.shouldRegisterItem)return;mt(t.registerItem(n.getItem()))}))}function Kve(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=Gge(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=Gge(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(Gge(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return Gge(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(Gge(l)||"number"==typeof l)r.push({type:"item",rawValue:l,key:String(l),textValue:String(l),disabled:a(l),level:n,index:t}),t++;else if(null!=s(l)){r.push({type:"section",rawValue:l,key:"",textValue:"",disabled:!1,level:n,index:t}),t++;const o=s(l)??[];if(o.length>0){const i=Kve({dataSource:o,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:t,startLevel:n+1});r.push(...i),t+=i.length}}else r.push({type:"item",rawValue:l,key:o(l),textValue:i(l),disabled:a(l),level:n,index:t}),t++;return r}function Wve(e,t=[]){return ut((()=>{const n=Kve({dataSource:Dme(e.dataSource),getKey:Dme(e.getKey),getTextValue:Dme(e.getTextValue),getDisabled:Dme(e.getDisabled),getSectionChildren:Dme(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var Yve=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Xve=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Zve(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return Yve.has(t)}const t=e.split("-")[0];return Xve.has(t)}(e)?"rtl":"ltr"}function Qve(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Zve(e)}}var Jve=Qve(),eye=new Set;function tye(){Jve=Qve();for(const e of eye)e(Jve)}var nye=xt();function rye(){const e=function(){const[e,t]=at(Jve),n=ut((()=>e()));return ht((()=>{0===eye.size&&window.addEventListener("languagechange",tye),eye.add(t),mt((()=>{eye.delete(t),0===eye.size&&window.removeEventListener("languagechange",tye)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return wt(nye)||e}var oye=new Map;var iye=class e extends Set{anchorKey;currentKey;constructor(t,n,r){super(t),t instanceof e?(this.anchorKey=n||t.anchorKey,this.currentKey=r||t.currentKey):(this.anchorKey=n,this.currentKey=r)}};function aye(e){return eve()||tve()?e.altKey:e.ctrlKey}function sye(e){return eve()?e.metaKey:e.ctrlKey}function lye(e){return new iye(e)}function cye(e){const t=yve({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=at(!1),[o,i]=at(),a=ut((()=>{const e=Dme(t.selectedKeys);return null!=e?lye(e):e})),s=ut((()=>{const e=Dme(t.defaultSelectedKeys);return null!=e?lye(e):new iye})),[l,c]=function(e){const[t,n]=Dve(e);return[()=>t()??new iye,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=at(Dme(t.selectionBehavior));return ct((()=>{const e=l();"replace"===Dme(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),ct((()=>{d(Dme(t.selectionBehavior)??"toggle")})),{selectionMode:()=>Dme(t.selectionMode),disallowEmptySelection:()=>Dme(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!Dme(t.allowDuplicateSelectionEvents)&&function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(e,l())||c(e)}}}function uye(e,t,n){const r=qt({selectOnFocus:()=>"replace"===Dme(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=rye();let a={top:0,left:0};$ge((()=>Dme(r.isVirtualized)?void 0:o()),"scroll",(()=>{const e=o();e&&(a={top:e.scrollTop,left:e.scrollLeft})}));const{typeSelectHandlers:s}=function(e){const[t,n]=at(""),[r,o]=at(-1);return{typeSelectHandlers:{onKeyDown:i=>{if(Dme(e.isDisabled))return;const a=Dme(e.keyboardDelegate),s=Dme(e.selectionManager);if(!a.getKeyForSearch)return;const l=function(e){return 1!==e.length&&/^[A-Z]/i.test(e)?"":e}(i.key);if(!l||i.ctrlKey||i.metaKey)return;" "===l&&t().trim().length>0&&(i.preventDefault(),i.stopPropagation());let c=n((e=>e+l)),u=a.getKeyForSearch(c,s.focusedKey())??a.getKeyForSearch(c);null==u&&function(e){return e.split("").every((t=>t===e[0]))}(c)&&(c=c[0],u=a.getKeyForSearch(c,s.focusedKey())??a.getKeyForSearch(c)),null!=u&&(s.setFocusedKey(u),e.onTypeSelect?.(u)),clearTimeout(r()),o(window.setTimeout((()=>n("")),500))}}}}({isDisabled:()=>Dme(r.disallowTypeAhead),keyboardDelegate:()=>Dme(r.keyboardDelegate),selectionManager:()=>Dme(r.selectionManager)}),l=()=>Dme(r.orientation)??"vertical",c=()=>{const e=Dme(r.autoFocus);if(!e)return;const n=Dme(r.selectionManager),o=Dme(r.keyboardDelegate);let i;"first"===e&&(i=o.getFirstKey?.()),"last"===e&&(i=o.getLastKey?.());const a=n.selectedKeys();a.size&&(i=a.values().next().value),n.setFocused(!0),n.setFocusedKey(i);const s=t();s&&null==i&&!Dme(r.shouldUseVirtualFocus)&&ive(s)};ht((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),ct(ft([o,()=>Dme(r.isVirtualized),()=>Dme(r.selectionManager).focusedKey()],(e=>{const[t,n,o]=e;if(n)o&&r.scrollToKey?.(o);else if(o&&t){const e=t.querySelector(`[data-key="${o}"]`);e&&_ve(t,e)}})));return{tabIndex:ut((()=>{if(!Dme(r.shouldUseVirtualFocus))return null==Dme(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{nve(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=Dme(r.selectionManager),a=Dme(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!aye(e)&&o.replaceSelection(t))},u=Dme(r.keyboardDelegate),d=Dme(r.shouldFocusWrap),p=o.focusedKey();switch(e.key){case"vertical"===l()?"ArrowDown":"ArrowRight":if(u.getKeyBelow){let t;e.preventDefault(),t=null!=p?u.getKeyBelow(p):u.getFirstKey?.(),null==t&&d&&(t=u.getFirstKey?.(p)),c(t)}break;case"vertical"===l()?"ArrowUp":"ArrowLeft":if(u.getKeyAbove){let t;e.preventDefault(),t=null!=p?u.getKeyAbove(p):u.getLastKey?.(),null==t&&d&&(t=u.getLastKey?.(p)),c(t)}break;case"vertical"===l()?"ArrowLeft":"ArrowUp":if(u.getKeyLeftOf){e.preventDefault();const t="rtl"===i();let n;n=null!=p?u.getKeyLeftOf(p):t?u.getFirstKey?.():u.getLastKey?.(),c(n)}break;case"vertical"===l()?"ArrowRight":"ArrowDown":if(u.getKeyRightOf){e.preventDefault();const t="rtl"===i();let n;n=null!=p?u.getKeyRightOf(p):t?u.getLastKey?.():u.getFirstKey?.(),c(n)}break;case"Home":if(u.getFirstKey){e.preventDefault();const t=u.getFirstKey(p,sye(e));null!=t&&(o.setFocusedKey(t),sye(e)&&e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&o.replaceSelection(t))}break;case"End":if(u.getLastKey){e.preventDefault();const t=u.getLastKey(p,sye(e));null!=t&&(o.setFocusedKey(t),sye(e)&&e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&o.replaceSelection(t))}break;case"PageDown":if(u.getKeyPageBelow&&null!=p){e.preventDefault();c(u.getKeyPageBelow(p))}break;case"PageUp":if(u.getKeyPageAbove&&null!=p){e.preventDefault();c(u.getKeyPageAbove(p))}break;case"a":sye(e)&&"multiple"===o.selectionMode()&&!0!==Dme(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),Dme(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!Dme(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?uve:cve,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&hve(e)&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});return t?.from&&(r.currentNode=t.from),r}(n,{tabbable:!0});let t,r;do{r=e.lastChild(),r&&(t=r)}while(r);t&&!t.contains(document.activeElement)&&ive(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=Dme(r.selectionManager),n=Dme(r.keyboardDelegate),i=Dme(r.selectOnFocus);if(t.isFocused())e.currentTarget.contains(e.target)||t.setFocused(!1);else if(e.currentTarget.contains(e.target))if(t.setFocused(!0),null==t.focusedKey()){const r=e=>{null!=e&&(t.setFocusedKey(e),i&&t.replaceSelection(e))},o=e.relatedTarget;o&&e.currentTarget.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?r(t.lastSelectedKey()??n.getLastKey?.()):r(t.firstSelectedKey()??n.getFirstKey?.())}else if(!Dme(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(ive(n),_ve(e,n))}}},onFocusOut:e=>{const t=Dme(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function dye(e,t){const n=()=>Dme(e.selectionManager),r=()=>Dme(e.key),o=()=>Dme(e.shouldUseVirtualFocus),i=e=>{"none"!==n().selectionMode()&&("single"===n().selectionMode()?n().isSelected(r())&&!n().disallowEmptySelection()?n().toggleSelection(r()):n().replaceSelection(r()):e?.shiftKey?n().extendSelection(r()):"toggle"===n().selectionBehavior()||sye(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>Dme(e.disabled)||n().isDisabled(r()),s=()=>!a()&&n().canSelectItem(r());let l=null;const c=ut((()=>{if(!o()&&!a())return r()===n().focusedKey()?0:-1})),u=ut((()=>Dme(e.virtualized)?void 0:r()));return ct(ft([t,r,o,()=>n().focusedKey(),()=>n().isFocused()],(([t,n,r,o,i])=>{t&&n===o&&i&&!r&&document.activeElement!==t&&(e.focus?e.focus():ive(t))}))),{isSelected:()=>n().isSelected(r()),isDisabled:a,allowsSelection:s,tabIndex:c,dataKey:u,onPointerDown:t=>{s()&&(l=t.pointerType,"mouse"!==t.pointerType||0!==t.button||Dme(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&Dme(e.shouldSelectOnPressUp)&&Dme(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(Dme(e.shouldSelectOnPressUp)&&!Dme(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(aye(e)?n().toggleSelection(r()):i(e))},onMouseDown:e=>{a()&&e.preventDefault()},onFocus:e=>{const i=t();o()||a()||!i||e.target===i&&n().setFocusedKey(r())}}}var pye=class{collection;state;constructor(e,t){this.collection=e,this.state=t}selectionMode(){return this.state.selectionMode()}disallowEmptySelection(){return this.state.disallowEmptySelection()}selectionBehavior(){return this.state.selectionBehavior()}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}isFocused(){return this.state.isFocused()}setFocused(e){this.state.setFocused(e)}focusedKey(){return this.state.focusedKey()}setFocusedKey(e){(null==e||this.collection().getItem(e))&&this.state.setFocusedKey(e)}selectedKeys(){return this.state.selectedKeys()}isSelected(e){if("none"===this.state.selectionMode())return!1;const t=this.getKey(e);return null!=t&&this.state.selectedKeys().has(t)}isEmpty(){return 0===this.state.selectedKeys().size}isSelectAll(){if(this.isEmpty())return!1;const e=this.state.selectedKeys();return this.getAllSelectableKeys().every((t=>e.has(t)))}firstSelectedKey(){let e;for(const t of this.state.selectedKeys()){const n=this.collection().getItem(t);e&&!(null!=n?.index&&null!=e?.index&&n.index<e.index)||(e=n)}return e?.key}lastSelectedKey(){let e;for(const t of this.state.selectedKeys()){const n=this.collection().getItem(t);e&&!(null!=n?.index&&null!=e?.index&&n.index>e.index)||(e=n)}return e?.key}extendSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode())return void this.replaceSelection(e);const t=this.getKey(e);if(null==t)return;const n=this.state.selectedKeys(),r=n.anchorKey||t,o=new iye(n,r,t);for(const i of this.getKeyRange(r,n.currentKey||t))o.delete(i);for(const i of this.getKeyRange(t,r))this.canSelectItem(i)&&o.add(i);this.state.setSelectedKeys(o)}getKeyRange(e,t){const n=this.collection().getItem(e),r=this.collection().getItem(t);return n&&r?null!=n.index&&null!=r.index&&n.index<=r.index?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){const n=[];let r=e;for(;null!=r;){const e=this.collection().getItem(r);if(e&&"item"===e.type&&n.push(r),r===t)return n;r=this.collection().getKeyAfter(r)}return[]}getKey(e){const t=this.collection().getItem(e);return t?t&&"item"===t.type?t.key:null:e}toggleSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode()&&!this.isSelected(e))return void this.replaceSelection(e);const t=this.getKey(e);if(null==t)return;const n=new iye(this.state.selectedKeys());n.has(t)?n.delete(t):this.canSelectItem(t)&&(n.add(t),n.anchorKey=t,n.currentKey=t),this.disallowEmptySelection()&&0===n.size||this.state.setSelectedKeys(n)}replaceSelection(e){if("none"===this.selectionMode())return;const t=this.getKey(e);if(null==t)return;const n=this.canSelectItem(t)?new iye([t],t,t):new iye;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new iye;for(const n of e){const e=this.getKey(n);if(null!=e&&(t.add(e),"single"===this.selectionMode()))break}this.state.setSelectedKeys(t)}selectAll(){"multiple"===this.selectionMode()&&this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()))}clearSelection(){const e=this.state.selectedKeys();!this.disallowEmptySelection()&&e.size>0&&this.state.setSelectedKeys(new iye)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,t){"none"!==this.selectionMode()&&("single"===this.selectionMode()?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):"toggle"===this.selectionBehavior()||t&&"touch"===t.pointerType?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;const t=this.selectedKeys();if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;for(const n of t)if(!e.has(n))return!1;return!0}canSelectItem(e){if("none"===this.state.selectionMode())return!1;const t=this.collection().getItem(e);return null!=t&&!t.disabled}isDisabled(e){const t=this.collection().getItem(e);return!t||t.disabled}getAllSelectableKeys(){const e=[];return(t=>{for(;null!=t;){if(this.canSelectItem(t)){const n=this.collection().getItem(t);if(!n)continue;"item"===n.type&&e.push(t)}t=this.collection().getKeyAfter(t)}})(this.collection().getFirstKey()),e}},fye=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(const r of e)this.keyMap.set(r.key,r);if(0===this.keyMap.size)return;let t,n=0;for(const[r,o]of this.keyMap)t?(t.nextKey=r,o.prevKey=t.key):(this.firstKey=r,o.prevKey=void 0),"item"===o.type&&(o.index=n++),t=o,t.nextKey=void 0;this.lastKey=t.key}*[Symbol.iterator](){yield*this.iterable}getSize(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey}getKeyAfter(e){return this.keyMap.get(e)?.nextKey}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const t=[...this.getKeys()];return this.getItem(t[e])}};var hye,mye=e=>"function"==typeof e?e():e,gye=e=>{const t=ut((()=>{const t=mye(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=at(mye(e.show)?"present":"hidden");let i="none";return ct((r=>{const a=mye(e.show);return pt((()=>{if(r===a)return a;const e=i,s=n();if(a)o("present");else if("none"===s||"none"===t()?.display)o("hidden");else{o(!0===r&&e!==s?"hiding":"hidden")}})),a})),ct((()=>{const t=mye(e.element);if(!t)return;const a=e=>{e.target===t&&(i=n())},s=e=>{const i=n().includes(e.animationName);e.target===t&&i&&"hiding"===r()&&o("hidden")};t.addEventListener("animationstart",a),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),mt((()=>{t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}))})),{present:()=>"present"===r()||"hiding"===r(),state:r}},vye="data-kb-top-layer",yye=!1,bye=[];function xye(e){return bye.findIndex((t=>t.node===e))}function wye(){return bye.filter((e=>e.isPointerBlocking))}function _ye(){return wye().length>0}function Sye(e){const t=xye([...wye()].slice(-1)[0]?.node);return xye(e)<t}var Eye={layers:bye,isTopMostLayer:function(e){return bye[bye.length-1].node===e},hasPointerBlockingLayer:_ye,isBelowPointerBlockingLayer:Sye,addLayer:function(e){bye.push(e)},removeLayer:function(e){const t=xye(e);t<0||bye.splice(t,1)},indexOf:xye,find:function(e){return bye[xye(e)]},assignPointerEventToLayers:function(){for(const{node:e}of bye)e.style.pointerEvents=Sye(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(_ye()&&!yye){const t=Xge(e);hye=document.body.style.pointerEvents,t.body.style.pointerEvents="none",yye=!0}},restoreBodyPointerEvents:function(e){if(_ye())return;const t=Xge(e);t.body.style.pointerEvents=hye,0===t.body.style.length&&t.body.removeAttribute("style"),yye=!1}};Uve({},{Button:()=>Aye,Root:()=>Cye});var Tye=["button","color","file","image","reset","submit"];function Cye(e){let t;const n=yve({type:"button"},e),[r,o]=Gt(n,["ref","type","disabled"]),i=Cve((()=>t),(()=>"button")),a=ut((()=>{const e=i();return null!=e&&function(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==Tye.indexOf(e.type)}({tagName:e,type:r.type})})),s=ut((()=>"input"===i())),l=ut((()=>"a"===i()&&null!=t?.getAttribute("href")));return $t(Nve,qt({as:"button",ref(e){const n=Rge((e=>t=e),r.ref);"function"==typeof n&&n(e)},get type(){return a()||s()?r.type:void 0},get role(){return a()||l()?void 0:"button"},get tabIndex(){return a()||l()||r.disabled?void 0:0},get disabled(){return a()||s()?r.disabled:void 0},get"aria-disabled"(){return!(a()||s()||!r.disabled)||void 0},get"data-disabled"(){return r.disabled?"":void 0}},o))}var Aye=Cye,Nye=["top","right","bottom","left"],Rye=Math.min,Oye=Math.max,Pye=Math.round,kye=Math.floor,Mye=e=>({x:e,y:e}),jye={left:"right",right:"left",bottom:"top",top:"bottom"},Lye={start:"end",end:"start"};function Dye(e,t,n){return Oye(e,Rye(t,n))}function Iye(e,t){return"function"==typeof e?e(t):e}function Fye(e){return e.split("-")[0]}function Uye(e){return e.split("-")[1]}function $ye(e){return"x"===e?"y":"x"}function Vye(e){return"y"===e?"height":"width"}function Bye(e){return["top","bottom"].includes(Fye(e))?"y":"x"}function zye(e){return $ye(Bye(e))}function Hye(e){return e.replace(/start|end/g,(e=>Lye[e]))}function qye(e){return e.replace(/left|right|bottom|top/g,(e=>jye[e]))}function Gye(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Kye(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Wye(e,t,n){let{reference:r,floating:o}=e;const i=Bye(t),a=zye(t),s=Vye(a),l=Fye(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[s]/2-o[s]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Uye(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function Yye(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Iye(t,e),h=Gye(f),m=s[p?"floating"===d?"reference":"floating":d],g=Kye(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Kye(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function Xye(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zye(e){return Nye.some((t=>e[t]>=0))}function Qye(e){return tbe(e)?(e.nodeName||"").toLowerCase():"#document"}function Jye(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function ebe(e){var t;return null==(t=(tbe(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function tbe(e){return e instanceof Node||e instanceof Jye(e).Node}function nbe(e){return e instanceof Element||e instanceof Jye(e).Element}function rbe(e){return e instanceof HTMLElement||e instanceof Jye(e).HTMLElement}function obe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Jye(e).ShadowRoot)}function ibe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=dbe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function abe(e){return["table","td","th"].includes(Qye(e))}function sbe(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(JSe){return!1}}))}function lbe(e){const t=cbe(),n=nbe(e)?dbe(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function cbe(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function ube(e){return["html","body","#document"].includes(Qye(e))}function dbe(e){return Jye(e).getComputedStyle(e)}function pbe(e){return nbe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fbe(e){if("html"===Qye(e))return e;const t=e.assignedSlot||e.parentNode||obe(e)&&e.host||ebe(e);return obe(t)?t.host:t}function hbe(e){const t=fbe(e);return ube(t)?e.ownerDocument?e.ownerDocument.body:e.body:rbe(t)&&ibe(t)?t:hbe(t)}function mbe(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=hbe(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Jye(o);return i?t.concat(a,a.visualViewport||[],ibe(o)?o:[],a.frameElement&&n?mbe(a.frameElement):[]):t.concat(o,mbe(o,[],n))}function gbe(e){const t=dbe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rbe(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Pye(n)!==i||Pye(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function vbe(e){return nbe(e)?e:e.contextElement}function ybe(e){const t=vbe(e);if(!rbe(t))return Mye(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=gbe(t);let a=(i?Pye(n.width):n.width)/r,s=(i?Pye(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var bbe=Mye(0);function xbe(e){const t=Jye(e);return cbe()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:bbe}function wbe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=vbe(e);let a=Mye(1);t&&(r?nbe(r)&&(a=ybe(r)):a=ybe(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Jye(e))&&t}(i,n,r)?xbe(i):Mye(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=Jye(i),t=r&&nbe(r)?Jye(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=ybe(o),t=o.getBoundingClientRect(),r=dbe(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=Jye(o),o=n.frameElement}}return Kye({width:u,height:d,x:l,y:c})}function _be(e){return wbe(ebe(e)).left+pbe(e).scrollLeft}function Sbe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Jye(e),r=ebe(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=cbe();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=ebe(e),n=pbe(e),r=e.ownerDocument.body,o=Oye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Oye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+_be(e);const s=-n.scrollTop;return"rtl"===dbe(r).direction&&(a+=Oye(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(ebe(e));else if(nbe(t))r=function(e,t){const n=wbe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=rbe(e)?ybe(e):Mye(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=xbe(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Kye(r)}function Ebe(e,t){const n=fbe(e);return!(n===t||!nbe(n)||ube(n))&&("fixed"===dbe(n).position||Ebe(n,t))}function Tbe(e,t,n){const r=rbe(t),o=ebe(t),i="fixed"===n,a=wbe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Mye(0);if(r||!r&&!i)if(("body"!==Qye(t)||ibe(o))&&(s=pbe(t)),r){const e=wbe(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=_be(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Cbe(e){return"static"===dbe(e).position}function Abe(e,t){return rbe(e)&&"fixed"!==dbe(e).position?t?t(e):e.offsetParent:null}function Nbe(e,t){const n=Jye(e);if(sbe(e))return n;if(!rbe(e)){let t=fbe(e);for(;t&&!ube(t);){if(nbe(t)&&!Cbe(t))return t;t=fbe(t)}return n}let r=Abe(e,t);for(;r&&abe(r)&&Cbe(r);)r=Abe(r,t);return r&&ube(r)&&Cbe(r)&&!lbe(r)?n:r||function(e){let t=fbe(e);for(;rbe(t)&&!ube(t);){if(lbe(t))return t;if(sbe(t))return null;t=fbe(t)}return null}(e)||n}var Rbe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=ebe(r),s=!!t&&sbe(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Mye(1);const u=Mye(0),d=rbe(r);if((d||!d&&!i)&&(("body"!==Qye(r)||ibe(a))&&(l=pbe(r)),rbe(r))){const e=wbe(r);c=ybe(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:ebe,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?sbe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=mbe(e,[],!1).filter((e=>nbe(e)&&"body"!==Qye(e))),o=null;const i="fixed"===dbe(e).position;let a=i?fbe(e):e;for(;nbe(a)&&!ube(a);){const t=dbe(a),n=lbe(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||ibe(a)&&!n&&Ebe(e,a))?r=r.filter((e=>e!==a)):o=t,a=fbe(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=Sbe(t,n,o);return e.top=Oye(r.top,e.top),e.right=Rye(r.right,e.right),e.bottom=Rye(r.bottom,e.bottom),e.left=Oye(r.left,e.left),e}),Sbe(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Nbe,getElementRects:async function(e){const t=this.getOffsetParent||Nbe,n=this.getDimensions,r=await n(e.floating);return{reference:Tbe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=gbe(e);return{width:t,height:n}},getScale:ybe,isElement:nbe,isRTL:function(e){return"rtl"===dbe(e).direction}};function Obe(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=vbe(e),u=o||i?[...c?mbe(c):[],...mbe(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=ebe(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(s||t(),!d||!p)return;const f={rootMargin:-kye(u)+"px "+-kye(o.clientWidth-(c+d))+"px "+-kye(o.clientHeight-(u+p))+"px "+-kye(c)+"px",threshold:Oye(0,Rye(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),1e3)}h=!1}try{r=new IntersectionObserver(m,{...f,root:o.ownerDocument})}catch(JSe){r=new IntersectionObserver(m,f)}r.observe(e)}(!0),i}(c,n):null;let p,f=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?wbe(e):null;return l&&function t(){const r=wbe(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}var Pbe=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Fye(n),s=Uye(n),l="y"===Bye(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=Iye(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof h&&(f="end"===s?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},kbe=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Iye(e,t),c={x:n,y:r},u=await Yye(t,l),d=Bye(Fye(o)),p=$ye(d);let f=c[p],h=c[d];if(i){f=Dye(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=Dye(h+u["y"===d?"top":"left"],h,h-u["y"===d?"bottom":"right"])}const m=s.fn({...t,[p]:f,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Mbe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=Iye(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Fye(o),y=Bye(s),b=Fye(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[qye(s)]:function(e){const t=qye(e);return[Hye(e),t,Hye(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=Uye(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(Fye(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Hye)))),i}(s,m,h,x));const S=[s,...w],E=await Yye(t,g),T=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&T.push(E[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Uye(e),o=zye(e),i=Vye(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=qye(a)),[a,qye(a)]}(o,a,x);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,N;const e=((null==(A=i.flip)?void 0:A.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(N=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(f){case"bestFit":{var R;const e=null==(R=C.filter((e=>{if(_){const t=Bye(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},jbe=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:a=()=>{},...s}=Iye(e,t),l=await Yye(t,s),c=Fye(n),u=Uye(n),d="y"===Bye(n),{width:p,height:f}=r.floating;let h,m;"top"===c||"bottom"===c?(h=c,m=u===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,h="end"===u?"top":"bottom");const g=f-l.top-l.bottom,v=p-l.left-l.right,y=Rye(f-l[h],g),b=Rye(p-l[m],v),x=!t.middlewareData.shift;let w=y,_=b;if(d?_=u||x?Rye(b,v):v:w=u||x?Rye(y,g):g,x&&!u){const e=Oye(l.left,0),t=Oye(l.right,0),n=Oye(l.top,0),r=Oye(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:Oye(l.left,l.right)):w=f-2*(0!==n||0!==r?n+r:Oye(l.top,l.bottom))}await a({...t,availableWidth:_,availableHeight:w});const S=await o.getDimensions(i.floating);return p!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},Lbe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Iye(e,t);switch(r){case"referenceHidden":{const e=Xye(await Yye(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Zye(e)}}}case"escaped":{const e=Xye(await Yye(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Zye(e)}}}default:return{}}}}},Dbe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Iye(e,t)||{};if(null==c)return{};const d=Gye(u),p={x:n,y:r},f=zye(o),h=Vye(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],w=p[f]-i.reference[f],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=_?_[b]:0;S&&await(null==a.isElement?void 0:a.isElement(_))||(S=s.floating[b]||i.floating[h]);const E=x/2-w/2,T=S/2-m[h]/2-1,C=Rye(d[v],T),A=Rye(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=Dye(N,O,R),k=!l.arrow&&null!=Uye(o)&&O!==P&&i.reference[h]/2-(O<N?C:A)-m[h]/2<0,M=k?O<N?O-N:O-R:0;return{[f]:p[f]+M,data:{[f]:P,centerOffset:O-P-M,...k&&{alignmentOffset:M}},reset:k}}}),Ibe=(e,t,n)=>{const r={platform:Rbe,...n},o={...r.platform,_c:new Map};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Wye(c,r,l),p=r,f={},h=0;for(let m=0;m<s.length;m++){const{name:n,fn:i}=s[m],{x:g,y:v,data:y,reset:b}=await i({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,f={...f,[n]:{...f[n],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=Wye(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},Fbe=xt();function Ube(){const e=wt(Fbe);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var $be=pn('<svg display="block" viewBox="0 0 30 30" style="transform:scale(1.02)"><g><path fill="none" d="M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"></path><path stroke="none" d="M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z">'),Vbe={top:180,right:-90,bottom:0,left:90};function Bbe(e){const t=Ube(),n=yve({size:30},e),[r,o]=Gt(n,["ref","style","size"]),i=()=>t.currentPlacement().split("-")[0],a=function(e){const[t,n]=at();return ct((()=>{const t=e();var r;t&&n((r=t,Xge(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return $t(Nve,qt({as:"div",ref(e){const n=Rge(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Hge({position:"absolute","font-size":`${r.size}px`,width:"1em",height:"1em","pointer-events":"none",fill:a()?.getPropertyValue("background-color")||"none",stroke:a()?.getPropertyValue(`border-${i()}-color`)||"none","stroke-width":s()},r.style)}},o,{get children(){const e=$be(),t=e.firstChild;return lt((()=>hn(t,"transform",`rotate(${Vbe[i()]} 15 15) translate(0 2)`))),e}}))}function zbe(e){const{x:t=0,y:n=0,width:r=0,height:o=0}=e??{};if("function"==typeof DOMRect)return new DOMRect(t,n,r,o);const i={x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:n+o,left:t};return{...i,toJSON:()=>i}}function Hbe(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var qbe={top:"bottom",right:"left",bottom:"top",left:"right"};var Gbe=Object.assign((function(e){const t=yve({getAnchorRect:e=>e?.getBoundingClientRect(),placement:"bottom",gutter:0,shift:0,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,hideWhenDetached:!1,detachedPadding:0,arrowPadding:4,overflowPadding:8},e),[n,r]=at(),[o,i]=at(),[a,s]=at(t.placement),l=()=>{return e=t.anchorRef?.(),n=t.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const t=n(e);return t?zbe(t):e?e.getBoundingClientRect():zbe()}};var e,n},{direction:c}=rye();async function u(){const e=l(),r=n(),i=o();if(!e||!r)return;const a=(i?.clientHeight||0)/2,u="number"==typeof t.gutter?t.gutter+a:t.gutter??a;r.style.setProperty("--kb-popper-content-overflow-padding",`${t.overflowPadding}px`),e.getBoundingClientRect();const d=[Pbe((({placement:e})=>{const n=!!e.split("-")[1];return{mainAxis:u,crossAxis:n?void 0:t.shift,alignmentAxis:t.shift}}))];if(!1!==t.flip){const e="string"==typeof t.flip?t.flip.split(" "):void 0;if(void 0!==e&&!e.every(Hbe))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(Mbe({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(kbe({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(jbe({padding:t.overflowPadding,apply({availableWidth:e,availableHeight:n,rects:o}){const i=Math.round(o.reference.width);e=Math.floor(e),n=Math.floor(n),r.style.setProperty("--kb-popper-anchor-width",`${i}px`),r.style.setProperty("--kb-popper-content-available-width",`${e}px`),r.style.setProperty("--kb-popper-content-available-height",`${n}px`),t.sameWidth&&(r.style.width=`${i}px`),t.fitViewport&&(r.style.maxWidth=`${e}px`,r.style.maxHeight=`${n}px`)}})),t.hideWhenDetached&&d.push(Lbe({padding:t.detachedPadding})),i&&d.push(Dbe({element:i,padding:t.arrowPadding}));const p=await Ibe(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...Rbe,isRTL:()=>"rtl"===c()}});if(s(p.placement),t.onCurrentPlacementChange?.(p.placement),!r)return;r.style.setProperty("--kb-popper-content-transform-origin",function(e,t){const[n,r]=e.split("-"),o=qbe[n];return r?"left"===n||"right"===n?`${o} ${"start"===r?"top":"bottom"}`:"start"===r?`${o} ${"rtl"===t?"right":"left"}`:`${o} ${"rtl"===t?"left":"right"}`:`${o} center`}(p.placement,c()));const f=Math.round(p.x),h=Math.round(p.y);let m;if(t.hideWhenDetached&&(m=p.middlewareData.hide?.referenceHidden?"hidden":"visible"),Object.assign(r.style,{top:"0",left:"0",transform:`translate3d(${f}px, ${h}px, 0)`,visibility:m}),i&&p.middlewareData.arrow){const{x:e,y:t}=p.middlewareData.arrow,n=p.placement.split("-")[0];Object.assign(i.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[n]:"100%"})}}return ct((()=>{const e=l(),t=n();if(!e||!t)return;mt(Obe(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),ct((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),$t(Fbe.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:Bbe,Context:Fbe,usePopperContext:Ube,Positioner:function(e){const t=Ube(),[n,r]=Gt(e,["ref","style"]);return $t(Nve,qt({as:"div",ref(e){const r=Rge(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return Hge({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var Kbe="interactOutside.pointerDownOutside",Wbe="interactOutside.focusOutside";var Ybe=xt();function Xbe(e){let t;const n=wt(Ybe),[r,o]=Gt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=vve;const o=()=>Xge(t()),i=t=>e.onPointerDownOutside?.(t),a=t=>e.onFocusOutside?.(t),s=t=>e.onInteractOutside?.(t),l=n=>{const r=n.target;return r instanceof HTMLElement&&!r.closest(`[${vye}]`)&&!!Wge(o(),r)&&!Wge(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=rve([i,s]);r.addEventListener(Kbe,o,{once:!0});const a=new CustomEvent(Kbe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||ove(e)&&0===e.button}});r.dispatchEvent(a)}"touch"===e.pointerType?(o().removeEventListener("click",n),r=n,o().addEventListener("click",n,{once:!0})):n()},u=e=>{const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=rve([a,s]);r.addEventListener(Wbe,o,{once:!0});const i=new CustomEvent(Wbe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};ct((()=>{Dme(e.isDisabled)||(n=window.setTimeout((()=>{o().addEventListener("pointerdown",c,!0)}),0),o().addEventListener("focusin",u,!0),mt((()=>{window.clearTimeout(n),o().removeEventListener("click",r),o().removeEventListener("pointerdown",c,!0),o().removeEventListener("focusin",u,!0)})))}))}({shouldExcludeElement:e=>!!t&&(r.excludedElements?.some((t=>Wge(t(),e)))||[...i].some((t=>Wge(t,e)))),onPointerDownOutside:e=>{t&&!Eye.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||Eye.isTopMostLayer(t))&&(r.onPointerDownOutside?.(e),r.onInteractOutside?.(e),e.defaultPrevented||r.onDismiss?.())},onFocusOutside:e=>{r.onFocusOutside?.(e),r.onInteractOutside?.(e),e.defaultPrevented||r.onDismiss?.()}},(()=>t)),function(e){const t=t=>{t.key===Qge.Escape&&e.onEscapeKeyDown?.(t)};ct((()=>{if(Dme(e.isDisabled))return;const n=e.ownerDocument?.()??Xge();n.addEventListener("keydown",t),mt((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Xge(t),onEscapeKeyDown:e=>{t&&Eye.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),ht((()=>{if(!t)return;Eye.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);Eye.assignPointerEventToLayers(),Eye.disableBodyPointerEvents(t),mt((()=>{t&&(Eye.removeLayer(t),e?.(),Eye.assignPointerEventToLayers(),Eye.restoreBodyPointerEvents(t))}))})),ct(ft([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=Eye.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,Eye.assignPointerEventToLayers()),t&&Eye.disableBodyPointerEvents(e),mt((()=>{Eye.restoreBodyPointerEvents(e)}))}),{defer:!0}));return $t(Ybe.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return $t(Nve,qt({as:"div",ref(e){const n=Rge((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Zbe(e={}){const[t,n]=Ive({value:()=>Dme(e.open),defaultValue:()=>!!Dme(e.defaultOpen),onChange:t=>e.onOpenChange?.(t)}),r=()=>{n(!0)},o=()=>{n(!1)};return{isOpen:t,setIsOpen:n,open:r,close:o,toggle:()=>{t()?o():r()}}}var Qbe={};Uve(Qbe,{Description:()=>kve,ErrorMessage:()=>Mve,Item:()=>rxe,ItemControl:()=>oxe,ItemDescription:()=>ixe,ItemIndicator:()=>axe,ItemInput:()=>sxe,ItemLabel:()=>lxe,Label:()=>cxe,RadioGroup:()=>dxe,Root:()=>uxe});var Jbe=xt();function exe(){const e=wt(Jbe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var txe=xt();function nxe(){const e=wt(txe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function rxe(e){const t=Pve(),n=exe(),r=yve({id:`${t.generateId("item")}-${Yt()}`},e),[o,i]=Gt(r,["value","disabled","onPointerDown"]),[a,s]=at(),[l,c]=at(),[u,d]=at(),[p,f]=at(),[h,m]=at(!1),g=ut((()=>n.isSelectedValue(o.value))),v=ut((()=>o.disabled||t.isDisabled()||!1)),y=e=>{nve(e,o.onPointerDown),h()&&e.preventDefault()},b=ut((()=>({...t.dataset(),"data-disabled":v()?"":void 0,"data-checked":g()?"":void 0}))),x={value:()=>o.value,dataset:b,isSelected:g,isDisabled:v,inputId:a,labelId:l,descriptionId:u,inputRef:p,select:()=>n.setSelectedValue(o.value),generateId:Kge((()=>i.id)),registerInput:Tve(s),registerLabel:Tve(c),registerDescription:Tve(d),setIsFocused:m,setInputRef:f};return $t(txe.Provider,{value:x,get children(){return $t(Nve,qt({as:"div",role:"group",onPointerDown:y},b,i))}})}function oxe(e){const t=nxe(),n=yve({id:t.generateId("control")},e),[r,o]=Gt(n,["onClick","onKeyDown"]);return $t(Nve,qt({as:"div",onClick:e=>{nve(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{nve(e,r.onKeyDown),e.key===Qge.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function ixe(e){const t=nxe(),n=yve({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Nve,qt({as:"div"},(()=>t.dataset()),n))}function axe(e){const t=nxe(),n=yve({id:t.generateId("indicator")},e),[r,o]=Gt(n,["ref","forceMount"]),[i,a]=at(),{present:s}=gye({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return $t(Jt,{get when(){return s()},get children(){return $t(Nve,qt({as:"div",ref(e){const t=Rge(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function sxe(e){const t=Pve(),n=exe(),r=nxe(),o=yve({id:r.generateId("input")},e),[i,a]=Gt(o,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=at(!1);return ct(ft([()=>r.isSelected(),()=>r.value()],(e=>{if(!e[0]&&e[1]===r.value())return;l(!0);const t=r.inputRef();t?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),{defer:!0})),ct((()=>mt(r.registerInput(a.id)))),$t(Nve,qt({as:"input",ref(e){const t=Rge(r.setInputRef,i.ref);"function"==typeof t&&t(e)},type:"radio",get name(){return t.name()},get value(){return r.value()},get checked(){return r.isSelected()},get required(){return t.isRequired()},get disabled(){return r.isDisabled()},get readonly(){return t.isReadOnly()},get style(){return Hge({...Eve},i.style)},get"aria-labelledby"(){return[i["aria-labelledby"],r.labelId(),null!=i["aria-labelledby"]&&null!=a["aria-label"]?a.id:void 0].filter(Boolean).join(" ")||void 0},get"aria-describedby"(){return[i["aria-describedby"],r.descriptionId(),n.ariaDescribedBy()].filter(Boolean).join(" ")||void 0},onChange:e=>{if(nve(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{nve(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{nve(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function lxe(e){const t=nxe(),n=yve({id:t.generateId("label")},e);return ct((()=>mt(t.registerLabel(n.id)))),$t(Nve,qt({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function cxe(e){return $t(jve,qt({as:"span"},e))}function uxe(e){let t;const n=yve({id:`radiogroup-${Yt()}`,orientation:"vertical"},e),[r,o,i]=Gt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],Rve),[a,s]=Dve({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=yve({id:`form-control-${Yt()}`},e),[n,r]=at(),[o,i]=at(),[a,s]=at(),[l,c]=at();return{formControlContext:{name:()=>Dme(t.name)??Dme(t.id),dataset:ut((()=>({"data-valid":"valid"===Dme(t.validationState)?"":void 0,"data-invalid":"invalid"===Dme(t.validationState)?"":void 0,"data-required":Dme(t.required)?"":void 0,"data-disabled":Dme(t.disabled)?"":void 0,"data-readonly":Dme(t.readOnly)?"":void 0}))),validationState:()=>Dme(t.validationState),isRequired:()=>Dme(t.required),isDisabled:()=>Dme(t.disabled),isReadOnly:()=>Dme(t.readOnly),labelId:n,fieldId:o,descriptionId:a,errorMessageId:l,getAriaLabelledBy:(e,t,r)=>{const o=null!=r||null!=n();return[r,n(),o&&null!=t?e:void 0].filter(Boolean).join(" ")||void 0},getAriaDescribedBy:e=>[a(),l(),e].filter(Boolean).join(" ")||void 0,generateId:Kge((()=>Dme(t.id))),registerLabel:Tve(r),registerField:Tve(i),registerDescription:Tve(s),registerErrorMessage:Tve(c)}}}(o);Lve((()=>t),(()=>s(r.defaultValue??"")));const c=()=>l.getAriaDescribedBy(r["aria-describedby"]),u=e=>e===a(),d={ariaDescribedBy:c,isSelectedValue:u,setSelectedValue:e=>{if(!l.isReadOnly()&&!l.isDisabled()&&(s(e),t))for(const n of t.querySelectorAll("[type='radio']")){n.checked=u(n.value)}}};return $t(Ove.Provider,{value:l,get children(){return $t(Jbe.Provider,{value:d,get children(){return $t(Nve,qt({as:"div",ref(e){const n=Rge((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return Dme(o.id)},get"aria-invalid"(){return"invalid"===l.validationState()||void 0},get"aria-required"(){return l.isRequired()||void 0},get"aria-disabled"(){return l.isDisabled()||void 0},get"aria-readonly"(){return l.isReadOnly()||void 0},get"aria-orientation"(){return r.orientation},get"aria-labelledby"(){return l.getAriaLabelledBy(Dme(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var dxe=Object.assign(uxe,{Description:kve,ErrorMessage:Mve,Item:rxe,ItemControl:oxe,ItemDescription:ixe,ItemIndicator:axe,ItemInput:sxe,ItemLabel:lxe,Label:cxe}),pxe=class{collection;ref;collator;constructor(e,t,n){this.collection=e,this.ref=t,this.collator=n}getKeyBelow(e){let t=this.collection().getKeyAfter(e);for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&!e.disabled)return t;t=this.collection().getKeyAfter(t)}}getKeyAbove(e){let t=this.collection().getKeyBefore(e);for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&!e.disabled)return t;t=this.collection().getKeyBefore(t)}}getFirstKey(){let e=this.collection().getFirstKey();for(;null!=e;){const t=this.collection().getItem(e);if(t&&"item"===t.type&&!t.disabled)return e;e=this.collection().getKeyAfter(e)}}getLastKey(){let e=this.collection().getLastKey();for(;null!=e;){const t=this.collection().getItem(e);if(t&&"item"===t.type&&!t.disabled)return e;e=this.collection().getKeyBefore(e)}}getItem(e){return this.ref?.()?.querySelector(`[data-key="${e}"]`)??null}getKeyPageAbove(e){const t=this.ref?.();let n=this.getItem(e);if(!t||!n)return;const r=Math.max(0,n.offsetTop+n.offsetHeight-t.offsetHeight);let o=e;for(;o&&n&&n.offsetTop>r;)o=this.getKeyAbove(o),n=null!=o?this.getItem(o):null;return o}getKeyPageBelow(e){const t=this.ref?.();let n=this.getItem(e);if(!t||!n)return;const r=Math.min(t.scrollHeight,n.offsetTop-n.offsetHeight+t.offsetHeight);let o=e;for(;o&&n&&n.offsetTop<r;)o=this.getKeyBelow(o),n=null!=o?this.getItem(o):null;return o}getKeyForSearch(e,t){const n=this.collator?.();if(!n)return;let r=null!=t?this.getKeyBelow(t):this.getFirstKey();for(;null!=r;){const t=this.collection().getItem(r);if(t){const o=t.textValue.slice(0,e.length);if(t.textValue&&0===n.compare(o,e))return r}r=this.getKeyBelow(r)}}};function fxe(e,t,n){const r=function(e){const{locale:t}=rye(),n=ut((()=>t()+(e?Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1)).join():"")));return ut((()=>{const r=n();let o;return oye.has(r)&&(o=oye.get(r)),o||(o=new Intl.Collator(t(),e),oye.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return uye({selectionManager:()=>Dme(e.selectionManager),keyboardDelegate:ut((()=>{const n=Dme(e.keyboardDelegate);return n||new pxe(e.collection,t,r)})),autoFocus:()=>Dme(e.autoFocus),deferAutoFocus:()=>Dme(e.deferAutoFocus),shouldFocusWrap:()=>Dme(e.shouldFocusWrap),disallowEmptySelection:()=>Dme(e.disallowEmptySelection),selectOnFocus:()=>Dme(e.selectOnFocus),disallowTypeAhead:()=>Dme(e.disallowTypeAhead),shouldUseVirtualFocus:()=>Dme(e.shouldUseVirtualFocus),allowsTabNavigation:()=>Dme(e.allowsTabNavigation),isVirtualized:()=>Dme(e.isVirtualized),scrollToKey:t=>Dme(e.scrollToKey)?.(t),orientation:()=>Dme(e.orientation)},t)}var hxe="focusScope.autoFocusOnMount",mxe="focusScope.autoFocusOnUnmount",gxe={bubbles:!1,cancelable:!0},vxe={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=qge(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=qge(this.stack,e),this.active()?.resume()}};function yxe(e,t){const[n,r]=at(!1),o={pause(){r(!0)},resume(){r(!1)}};let i=null;const a=t=>e.onMountAutoFocus?.(t),s=t=>e.onUnmountAutoFocus?.(t),l=()=>Xge(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,Eve),e},u=()=>{const e=t();return e?dve(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=u();return e.length>0?e[0]:null};ct((()=>{const e=t();if(!e)return;vxe.add(o);const n=Yge(e);if(!Wge(e,n)){const t=new CustomEvent(hxe,gxe);e.addEventListener(hxe,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{ive(d()),Yge(e)===n&&ive(e)}),0)}mt((()=>{e.removeEventListener(hxe,a),setTimeout((()=>{const r=new CustomEvent(mxe,gxe);(()=>{const e=t();if(!e)return!1;const n=Yge(e);return!!n&&!Wge(e,n)&&fve(n)})()&&r.preventDefault(),e.addEventListener(mxe,s),e.dispatchEvent(r),r.defaultPrevented||ive(n??l().body),e.removeEventListener(mxe,s),vxe.remove(o)}),0)}))})),ct((()=>{const r=t();if(!r||!Dme(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${vye}]`)||(Wge(r,t)?i=t:ive(i))},a=e=>{const t=e.relatedTarget??Yge(r);t?.closest(`[${vye}]`)||Wge(r,t)||ive(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),mt((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),ct((()=>{const r=t();if(!r||!Dme(e.trapFocus)||n())return;const o=c();r.insertAdjacentElement("afterbegin",o);const i=c();function a(e){const t=d(),n=(()=>{const e=u();return e.length>0?e[e.length-1]:null})();ive(e.relatedTarget===t?n:t)}r.insertAdjacentElement("beforeend",i),o.addEventListener("focusin",a),i.addEventListener("focusin",a);const s=new MutationObserver((e=>{for(const t of e)t.previousSibling===i&&(i.remove(),r.insertAdjacentElement("beforeend",i)),t.nextSibling===o&&(o.remove(),r.insertAdjacentElement("afterbegin",o))}));s.observe(r,{childList:!0,subtree:!1}),mt((()=>{o.removeEventListener("focusin",a),i.removeEventListener("focusin",a),o.remove(),i.remove(),s.disconnect()}))}))}var bxe="data-live-announcer";function xxe(e){ct((()=>{Dme(e.isDisabled)||mt(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${bxe}], [${vye}]`))n.add(r);const t=e=>{if(n.has(e)||e.parentElement&&r.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(const t of n)if(e.contains(t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),a=t(e);if(a===NodeFilter.FILTER_ACCEPT&&i(e),a!==NodeFilter.FILTER_REJECT){let e=o.nextNode();for(;null!=e;)i(e),e=o.nextNode()}},i=e=>{const t=wxe.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),wxe.set(e,t+1))};_xe.length&&_xe[_xe.length-1].disconnect();o(t);const a=new MutationObserver((e=>{for(const t of e)if("childList"===t.type&&0!==t.addedNodes.length&&![...n,...r].some((e=>e.contains(t.target)))){for(const e of t.removedNodes)e instanceof Element&&(n.delete(e),r.delete(e));for(const e of t.addedNodes)!(e instanceof HTMLElement||e instanceof SVGElement)||"true"!==e.dataset.liveAnnouncer&&"true"!==e.dataset.reactAriaTopLayer?e instanceof Element&&o(e):n.add(e)}}));a.observe(t,{childList:!0,subtree:!0});const s={observe(){a.observe(t,{childList:!0,subtree:!0})},disconnect(){a.disconnect()}};return _xe.push(s),()=>{a.disconnect();for(const e of r){const t=wxe.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),wxe.delete(e)):wxe.set(e,t-1)}s===_xe[_xe.length-1]?(_xe.pop(),_xe.length&&_xe[_xe.length-1].observe()):_xe.splice(_xe.indexOf(s),1)}}(Dme(e.targets),Dme(e.root)))}))}var wxe=new WeakMap,_xe=[];var Sxe=new Map,Exe=e=>{ct((()=>{const t=mye(e.style)??{},n=mye(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=Sxe.get(e.key);o?o.activeCount++:Sxe.set(e.key,{activeCount:1,originalStyles:r,properties:n.map((e=>e.key))}),Object.assign(e.element.style,e.style);for(const i of n)e.element.style.setProperty(i.key,i.value);mt((()=>{const t=Sxe.get(e.key);if(t)if(1===t.activeCount){Sxe.delete(e.key);for(const[n,r]of Object.entries(t.originalStyles))e.element.style[n]=r;for(const n of t.properties)e.element.style.removeProperty(n);0===e.element.style.length&&e.element.removeAttribute("style"),e.cleanup?.()}else t.activeCount--}))}))},Txe=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},Cxe=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[Axe,Nxe]=at([]),Rxe=e=>[e.deltaX,e.deltaY],Oxe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],Pxe=(e,t,n,r)=>{const o=null!==r&&kxe(r,e),[i,a]=((e,t,n)=>{const r="x"===t&&"rtl"===window.getComputedStyle(e).direction?-1:1;let o=e,i=0,a=0,s=!1;do{const[e,l,c]=Txe(o,t),u=c-e-r*l;0===l&&0===u||!Cxe(o,t)||(i+=u,a+=l),o===(n??document.documentElement)?s=!0:o=o._$host??o.parentElement}while(o&&!s);return[i,a]})(e,t,o?r:void 0);return!(n>0&&Math.abs(i)<=1)&&!(n<0&&Math.abs(a)<1)},kxe=(e,t)=>{if(e.contains(t))return!0;let n=t;for(;n;){if(n===e)return!0;n=n._$host??n.parentElement}return!1},Mxe=e=>{const t=qt({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=Yt();let r=[0,0],o=null,i=null;ct((()=>{mye(t.enabled)&&(Nxe((e=>[...e,n])),mt((()=>{Nxe((e=>e.filter((e=>e!==n))))})))})),ct((()=>{if(!mye(t.enabled)||!mye(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(mye(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===mye(t.preventScrollbarShiftMode)?r.paddingRight=`calc(${window.getComputedStyle(e).paddingRight} + ${n}px)`:r.marginRight=`calc(${window.getComputedStyle(e).marginRight} + ${n}px)`,o.push({key:"--scrollbar-width",value:`${n}px`}));const i=window.scrollY,a=window.scrollX;Exe({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{mye(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else Exe({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),ct((()=>{var e;(e=n,Axe().indexOf(e)===Axe().length-1&&mye(t.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",a,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),mt((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",a),document.removeEventListener("touchmove",l)})))}));const a=e=>{r=Oxe(e),o=null,i=null},s=e=>{const n=e.target,r=mye(t.element),o=Rxe(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=Pxe(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!kxe(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=mye(t.element),a=e.target;let s;if(2===e.touches.length)s=!mye(t.allowPinchZoom);else{if(null==o||null===i){const t=Oxe(e).map(((e,t)=>r[t]-e)),n=Math.abs(t[0])>Math.abs(t[1])?"x":"y";o=n,i="x"===n?t[0]:t[1]}if("range"===a.type)s=!1;else{const e=Pxe(a,o,i,n);s=!n||!kxe(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},jxe=xt();function Lxe(){return wt(jxe)}function Dxe(){const e=Lxe();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var Ixe=xt();function Fxe(){const e=wt(Ixe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var Uxe=xt();function $xe(){const e=wt(Uxe);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function Vxe(e){let t;const n=$xe(),r=Dxe(),o=yve({id:n.generateId(`item-${Yt()}`)},e),[i,a]=Gt(o,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=at(),[c,u]=at(),[d,p]=at(),f=()=>r.listState().selectionManager(),h=()=>a.id,m=()=>{i.onSelect?.(),i.closeOnSelect&&setTimeout((()=>{r.close(!0)}))};Gve({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=dye({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{nve(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(ive(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{nve(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{nve(e,i.onPointerUp),i.disabled||0!==e.button||m()},x=e=>{if(nve(e,i.onKeyDown),!e.repeat&&!i.disabled)switch(e.key){case"Enter":case" ":m()}},w=ut((()=>i.indeterminate?"mixed":null!=i.checked?i.checked:void 0)),_=ut((()=>({"data-indeterminate":i.indeterminate?"":void 0,"data-checked":i.checked&&!i.indeterminate?"":void 0,"data-disabled":i.disabled?"":void 0,"data-highlighted":f().focusedKey()===h()?"":void 0}))),S={isChecked:()=>i.checked,dataset:_,setLabelRef:p,generateId:Kge((()=>a.id)),registerLabel:Tve(l),registerDescription:Tve(u)};return $t(Ixe.Provider,{value:S,get children(){return $t(Nve,qt({as:"div",ref(e){const n=Rge((e=>t=e),i.ref);"function"==typeof n&&n(e)},get tabIndex(){return g.tabIndex()},get"aria-checked"(){return w()},get"aria-disabled"(){return i.disabled},get"aria-labelledby"(){return s()},get"aria-describedby"(){return c()},get"data-key"(){return g.dataKey()},get onPointerDown(){return rve([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return rve([b,g.onPointerUp])},get onClick(){return rve([i.onClick,g.onClick])},get onKeyDown(){return rve([x,g.onKeyDown])},get onMouseDown(){return rve([i.onMouseDown,g.onMouseDown])},get onFocus(){return rve([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function Bxe(e){const t=yve({closeOnSelect:!1},e),[n,r]=Gt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=Ive({value:()=>Dme(e.isSelected),defaultValue:()=>!!Dme(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{Dme(e.isReadOnly)||Dme(e.isDisabled)||n(t)},toggle:()=>{Dme(e.isReadOnly)||Dme(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return $t(Vxe,qt({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var zxe=xt();function Hxe(){return wt(zxe)}var qxe={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>qxe.next("ltr"===e?"rtl":"ltr",t)},Gxe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",Kxe=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function Wxe(e){const t=$xe(),n=Dxe(),r=Hxe(),{direction:o}=rye(),i=yve({id:t.generateId("trigger")},e),[a,s]=Gt(i,["ref","id","disabled","onPointerDown","onClick","onKeyDown","onMouseOver","onFocus"]);let l=()=>t.value();void 0!==r&&(l=()=>t.value()??a.id,void 0===r.lastValue()&&r.setLastValue(l));const c=Cve((()=>n.triggerRef()),(()=>"button")),u=ut((()=>"a"===c()&&null!=n.triggerRef()?.getAttribute("href")));ct(ft((()=>r?.value()),(e=>{u()&&e===l()&&n.triggerRef()?.focus()})));const d=()=>{void 0!==r?n.isOpen()?r.value()===l()&&r.closeMenu():(r.autoFocusMenu()||r.setAutoFocusMenu(!0),n.open(!1)):n.toggle(!0)};return ct((()=>mt(n.registerTriggerId(a.id)))),$t(Cye,qt({ref(e){const t=Rge(n.setTriggerRef,a.ref);"function"==typeof t&&t(e)},get"data-kb-menu-value-trigger"(){return t.value()},get id(){return a.id},get disabled(){return a.disabled},"aria-haspopup":"true",get"aria-expanded"(){return n.isOpen()},get"aria-controls"(){return ut((()=>!!n.isOpen()))()?n.contentId():void 0},get"data-highlighted"(){return void 0!==l()&&r?.value()===l()||void 0},get tabIndex(){return void 0!==r?r.value()===l()||r.lastValue()===l()?0:-1:void 0},onPointerDown:e=>{nve(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{nve(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{nve(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if(nve(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case Gxe(t.orientation()):e.stopPropagation(),e.preventDefault(),function(e){if(document.contains(e)){const t=document.scrollingElement||document.documentElement;if("hidden"===window.getComputedStyle(t).overflow){let n=mve(e);for(;e&&n&&e!==t&&n!==t;)_ve(n,e),n=mve(e=n)}else{const{left:t,top:n}=e.getBoundingClientRect();e?.scrollIntoView?.({block:"nearest"});const{left:r,top:o}=e.getBoundingClientRect();(Math.abs(t-r)>1||Math.abs(n-o)>1)&&e.scrollIntoView?.({block:"nearest"})}}}(e.currentTarget),n.open("first"),r?.setAutoFocusMenu(!0),r?.setValue(l);break;case Kxe(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case qxe.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case qxe.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{nve(e,a.onFocus),void 0!==r&&"touch"!==e.currentTarget.dataset.pointerType&&r.setValue(l)},role:void 0!==r?"menuitem":void 0},(()=>n.dataset()),s))}var Yxe=xt();function Xxe(){return wt(Yxe)}function Zxe(e){let t;const n=$xe(),r=Dxe(),o=Hxe(),i=Xxe(),{direction:a}=rye(),s=yve({id:n.generateId(`content-${Yt()}`)},e),[l,c]=Gt(s,["ref","id","style","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onPointerEnter","onPointerMove","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]);let u=0;const d=()=>null==r.parentMenuContext()&&void 0===o&&n.isModal(),p=fxe({selectionManager:r.listState().selectionManager,collection:r.listState().collection,autoFocus:r.autoFocus,deferAutoFocus:!0,shouldFocusWrap:!0,disallowTypeAhead:()=>!r.listState().selectionManager().isFocused(),orientation:()=>"horizontal"===n.orientation()?"vertical":"horizontal"},(()=>t));yxe({trapFocus:()=>d()&&r.isOpen(),onMountAutoFocus:e=>{void 0===o&&l.onOpenAutoFocus?.(e)},onUnmountAutoFocus:l.onCloseAutoFocus},(()=>t));const f=e=>{l.onEscapeKeyDown?.(e),o?.setAutoFocusMenu(!1),r.close(!0)},h=e=>{l.onFocusOutside?.(e),n.isModal()&&e.preventDefault()};ct((()=>mt(r.registerContentId(l.id))));const m={ref:Rge((e=>{r.setContentRef(e),t=e}),l.ref),role:"menu",get id(){return l.id},get tabIndex(){return p.tabIndex()},get"aria-labelledby"(){return r.triggerId()},onKeyDown:rve([l.onKeyDown,p.onKeyDown,e=>{if(Wge(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case qxe.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case qxe.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:rve([l.onMouseDown,p.onMouseDown]),onFocusIn:rve([l.onFocusIn,p.onFocusIn]),onFocusOut:rve([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{nve(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if(nve(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;Wge(e.currentTarget,e.target)&&t&&(r.setPointerDir(e.clientX>u?"right":"left"),u=e.clientX)},get"data-orientation"(){return n.orientation()}};return $t(Jt,{get when(){return r.contentPresent()},get children(){return $t(Jt,{get when(){return void 0===i||null!=r.parentMenuContext()},get fallback(){return $t(Nve,qt({as:"div"},(()=>r.dataset()),m,c))},get children(){return $t(Gbe.Positioner,{get children(){return $t(Xbe,qt({get disableOutsidePointerEvents(){return ut((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Hge({"--kb-menu-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onEscapeKeyDown:f,onFocusOutside:h,get onDismiss(){return r.close}},(()=>r.dataset()),m,c))}})}})}})}function Qxe(e){let t;const n=$xe(),r=Dxe(),[o,i]=Gt(e,["ref"]);return Mxe({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),$t(Zxe,qt({ref(e){const n=Rge((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var Jxe=xt();function ewe(e){const t=yve({id:$xe().generateId(`group-${Yt()}`)},e),[n,r]=at(),o={generateId:Kge((()=>t.id)),registerLabelId:Tve(r)};return $t(Jxe.Provider,{value:o,get children(){return $t(Nve,qt({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function twe(e){const t=function(){const e=wt(Jxe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=yve({id:t.generateId("label")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerLabelId(r.id)))),$t(Nve,qt({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function nwe(e){const t=Dxe();return $t(Nve,qt({as:"span","aria-hidden":"true"},(()=>t.dataset()),yve({children:"▼"},e)))}function rwe(e){return $t(Vxe,qt({role:"menuitem",closeOnSelect:!0},e))}function owe(e){const t=Fxe(),n=yve({id:t.generateId("description")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerDescription(r.id)))),$t(Nve,qt({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function iwe(e){const t=Fxe(),n=yve({id:t.generateId("indicator")},e),[r,o]=Gt(n,["forceMount"]);return $t(Jt,{get when(){return r.forceMount||t.isChecked()},get children(){return $t(Nve,qt({as:"div"},(()=>t.dataset()),o))}})}function awe(e){const t=Fxe(),n=yve({id:t.generateId("label")},e),[r,o]=Gt(n,["ref","id"]);return ct((()=>mt(t.registerLabel(r.id)))),$t(Nve,qt({as:"div",ref(e){const n=Rge(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function swe(e){const t=Dxe();return $t(Jt,{get when(){return t.contentPresent()},get children(){return $t(On,e)}})}var lwe=xt();function cwe(e){const t=yve({id:$xe().generateId(`radiogroup-${Yt()}`)},e),[n,r]=Gt(t,["value","defaultValue","onChange","disabled"]),[o,i]=Dve({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return $t(lwe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return $t(ewe,r)}})}function uwe(e){const t=function(){const e=wt(lwe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=yve({closeOnSelect:!1},e),[r,o]=Gt(n,["value","onSelect"]);return $t(Vxe,qt({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function dwe(e,t,n){const r=e.split("-")[0],o=n.getBoundingClientRect(),i=[],a=t.clientX,s=t.clientY;switch(r){case"top":i.push([a,s+5]),i.push([o.left,o.bottom]),i.push([o.left,o.top]),i.push([o.right,o.top]),i.push([o.right,o.bottom]);break;case"right":i.push([a-5,s]),i.push([o.left,o.top]),i.push([o.right,o.top]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]);break;case"bottom":i.push([a,s-5]),i.push([o.right,o.top]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]),i.push([o.left,o.top]);break;case"left":i.push([a+5,s]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]),i.push([o.left,o.top]),i.push([o.right,o.top])}return i}function pwe(e){const t=$xe(),n=Vve(),r=Lxe(),o=Hxe(),i=Xxe(),a=yve({placement:"horizontal"===t.orientation()?"bottom-start":"right-start"},e),[s,l]=Gt(a,["open","defaultOpen","onOpenChange"]);let c=0,u=null,d="right";const[p,f]=at(),[h,m]=at(),[g,v]=at(),[y,b]=at(),[x,w]=at(!0),[_,S]=at(l.placement),[E,T]=at([]),[C,A]=at([]),{DomCollectionProvider:N}=qve({items:C,onItemsChange:A}),R=Zbe({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:O}=gye({show:()=>t.forceMount()||R.isOpen(),element:()=>y()??null}),P=function(e){const t=cye(e),n=Wve({dataSource:()=>Dme(e.dataSource),getKey:()=>Dme(e.getKey),getTextValue:()=>Dme(e.getTextValue),getDisabled:()=>Dme(e.getDisabled),getSectionChildren:()=>Dme(e.getSectionChildren),factory:t=>new fye(e.filter?e.filter(t):t)},[()=>e.filter]),r=new pye(n,t);return st((()=>{const e=t.focusedKey();null==e||n().getItem(e)||t.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>r}}({selectionMode:"none",dataSource:C}),k=e=>{w(e),R.open()},M=(e=!1)=>{R.close(),e&&r&&r.close(!0)},j=()=>{const e=y();e&&(ive(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},L=()=>{null!=i?setTimeout((()=>j())):j()},D=e=>{return d===u?.side&&(t=e,n=u?.area,!!n&&function(e,t){const[n,r]=e;let o=!1;for(let i=t.length,a=0,s=i-1;a<i;s=a++){const[e,l]=t[a],[c,u]=t[s],[,d]=t[0===s?i-1:s-1]||[0,0],p=(l-u)*(n-e)-(e-c)*(r-l);if(u<l){if(r>=u&&r<l){if(0===p)return!0;p>0&&(r===u?r>d&&(o=!o):o=!o)}}else if(l<u){if(r>l&&r<=u){if(0===p)return!0;p<0&&(r===u?r<d&&(o=!o):o=!o)}}else if(r==l&&(n>=c&&n<=e||n>=e&&n<=c))return!0}return o}([t.clientX,t.clientY],n));var t,n};xxe({isDisabled:()=>!(null==r&&R.isOpen()&&t.isModal()),targets:()=>[y(),...E()].filter(Boolean)}),ct((()=>{const e=y();if(!e||!r)return;const t=r.registerNestedMenu(e);mt((()=>{t()}))})),ct((()=>{void 0===r&&o?.registerMenu(t.value(),[y(),...E()])})),ct((()=>{void 0===r&&void 0!==o&&(o.value()===t.value()?(g()?.focus(),o.autoFocusMenu()&&k(!0)):M())})),ct((()=>{void 0===r&&void 0!==o&&R.isOpen()&&o.setValue(t.value())})),mt((()=>{void 0===r&&o?.unregisterMenu(t.value())}));const I={dataset:ut((()=>({"data-expanded":R.isOpen()?"":void 0,"data-closed":R.isOpen()?void 0:""}))),isOpen:R.isOpen,contentPresent:O,nestedMenus:E,currentPlacement:_,pointerGraceTimeoutId:()=>c,autoFocus:x,listState:()=>P,parentMenuContext:()=>r,triggerRef:g,contentRef:y,triggerId:p,contentId:h,setTriggerRef:v,setContentRef:b,open:k,close:M,toggle:e=>{w(e),R.toggle()},focusContent:L,onItemEnter:e=>{D(e)&&e.preventDefault()},onItemLeave:e=>{D(e)||L()},onTriggerLeave:e=>{D(e)&&e.preventDefault()},setPointerDir:e=>d=e,setPointerGraceTimeoutId:e=>c=e,setPointerGraceIntent:e=>u=e,registerNestedMenu:e=>{T((t=>[...t,e]));const t=r?.registerNestedMenu(e);return()=>{T((t=>qge(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:Tve(f),registerContentId:Tve(m)};return $t(N,{get children(){return $t(jxe.Provider,{value:I,get children(){return $t(Jt,{when:void 0===i,get fallback(){return l.children},get children(){return $t(Gbe,qt({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function fwe(e){const{direction:t}=rye();return $t(pwe,qt({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var hwe=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function mwe(e){const t=Dxe(),n=$xe(),[r,o]=Gt(e,["onFocusOutside","onKeyDown"]),{direction:i}=rye();return $t(Zxe,qt({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;Wge(t.triggerRef(),n)||t.close()},onKeyDown:e=>{nve(e,r.onKeyDown);const o=Wge(e.currentTarget,e.target),a=hwe(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),ive(t.triggerRef()))}},o))}var gwe=["Enter"," "],vwe=(e,t)=>"ltr"===e?[...gwe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...gwe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function ywe(e){let t;const n=$xe(),r=Dxe(),o=yve({id:n.generateId(`sub-trigger-${Yt()}`)},e),[i,a]=Gt(o,["ref","id","textValue","disabled","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);let s=null;const l=()=>{s&&window.clearTimeout(s),s=null},{direction:c}=rye(),u=()=>i.id,d=()=>{const e=r.parentMenuContext();if(null==e)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");return e.listState().selectionManager()},p=dye({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{nve(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{nve(e,i.onKeyDown),e.repeat||i.disabled||vwe(c(),n.orientation()).includes(e.key)&&(e.stopPropagation(),e.preventDefault(),d().setFocused(!1),d().setFocusedKey(void 0),r.isOpen()||r.open("first"),r.focusContent(),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(r.listState().collection().getFirstKey()))};return ct((()=>{if(null==r.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");mt(r.registerItemToParentDomCollection({ref:()=>t,type:"item",key:u(),textValue:i.textValue??t?.textContent??"",disabled:i.disabled??!1}))})),ct(ft((()=>r.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{mt((()=>{window.clearTimeout(e),r.parentMenuContext()?.setPointerGraceIntent(null)}))}))),ct((()=>mt(r.registerTriggerId(i.id)))),mt((()=>{l()})),$t(Nve,qt({as:"div",ref(e){const n=Rge((e=>{r.setTriggerRef(e),t=e}),i.ref);"function"==typeof n&&n(e)},get id(){return i.id},role:"menuitem",get tabIndex(){return p.tabIndex()},"aria-haspopup":"true",get"aria-expanded"(){return r.isOpen()},get"aria-controls"(){return ut((()=>!!r.isOpen()))()?r.contentId():void 0},get"aria-disabled"(){return i.disabled},get"data-key"(){return p.dataKey()},get"data-highlighted"(){return d().focusedKey()===u()?"":void 0},get"data-disabled"(){return i.disabled?"":void 0},get onPointerDown(){return rve([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return rve([i.onPointerUp,p.onPointerUp])},get onClick(){return rve([f,p.onClick])},get onKeyDown(){return rve([h,p.onKeyDown])},get onMouseDown(){return rve([i.onMouseDown,p.onMouseDown])},get onFocus(){return rve([i.onFocus,p.onFocus])},onPointerMove:e=>{if(nve(e,i.onPointerMove),"mouse"!==e.pointerType)return;const t=r.parentMenuContext();t?.onItemEnter(e),e.defaultPrevented||(i.disabled?t?.onItemLeave(e):(r.isOpen()||s||(r.parentMenuContext()?.setPointerGraceIntent(null),s=window.setTimeout((()=>{r.open(!1),l()}),100)),t?.onItemEnter(e),e.defaultPrevented||(r.listState().selectionManager().isFocused()&&(r.listState().selectionManager().setFocused(!1),r.listState().selectionManager().setFocusedKey(void 0)),ive(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if(nve(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:dwe(r.currentPlacement(),e,n),side:r.currentPlacement().split("-")[0]}),window.clearTimeout(t?.pointerGraceTimeoutId());const o=window.setTimeout((()=>{t?.setPointerGraceIntent(null)}),300);t?.setPointerGraceTimeoutId(o)}else{if(t?.onTriggerLeave(e),e.defaultPrevented)return;t?.setPointerGraceIntent(null)}t?.onItemLeave(e)}},(()=>r.dataset()),a))}function bwe(e){const t=Hxe(),n=yve({id:`menu-${Yt()}`,modal:!0},e),[r,o]=Gt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Zbe({open:()=>r.open,defaultOpen:()=>r.defaultOpen,onOpenChange:e=>r.onOpenChange?.(e)}),a={isModal:()=>r.modal??!0,preventScroll:()=>r.preventScroll??a.isModal(),forceMount:()=>r.forceMount??!1,generateId:Kge((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return $t(Uxe.Provider,{value:a,get children(){return $t(pwe,qt({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function xwe(e){let t;const n=yve({orientation:"horizontal"},e),[r,o]=Gt(n,["ref","orientation"]),i=Cve((()=>t),(()=>"hr"));return $t(Nve,qt({as:"hr",ref(e){const n=Rge((e=>t=e),r.ref);"function"==typeof n&&n(e)},get role(){return"hr"!==i()?"separator":void 0},get"aria-orientation"(){return"vertical"===r.orientation?"vertical":void 0},get"data-orientation"(){return r.orientation}},o))}Uve({},{Root:()=>xwe,Separator:()=>wwe});var wwe=xwe,_we={};function Swe(e){const t=$xe(),n=Dxe(),[r,o]=Gt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return $t(Qxe,qt({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||ive(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function Ewe(e){return $t(bwe,yve({id:`dropdownmenu-${Yt()}`},e))}Uve(_we,{Arrow:()=>Bbe,CheckboxItem:()=>Bxe,Content:()=>Swe,DropdownMenu:()=>Twe,Group:()=>ewe,GroupLabel:()=>twe,Icon:()=>nwe,Item:()=>rwe,ItemDescription:()=>owe,ItemIndicator:()=>iwe,ItemLabel:()=>awe,Portal:()=>swe,RadioGroup:()=>cwe,RadioItem:()=>uwe,Root:()=>Ewe,Separator:()=>xwe,Sub:()=>fwe,SubContent:()=>mwe,SubTrigger:()=>ywe,Trigger:()=>Wxe});var Twe=Object.assign(Ewe,{Arrow:Bbe,CheckboxItem:Bxe,Content:Swe,Group:ewe,GroupLabel:twe,Icon:nwe,Item:rwe,ItemDescription:owe,ItemIndicator:iwe,ItemLabel:awe,Portal:swe,RadioGroup:cwe,RadioItem:uwe,Separator:xwe,Sub:fwe,SubContent:mwe,SubTrigger:ywe,Trigger:Wxe}),Cwe={colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000000",white:"#ffffff",neutral:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},darkGray:{50:"#525c7a",100:"#49536e",200:"#414962",300:"#394056",400:"#313749",500:"#292e3d",600:"#212530",700:"#191c24",800:"#111318",900:"#0b0d10"},gray:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},blue:{25:"#F5FAFF",50:"#EFF8FF",100:"#D1E9FF",200:"#B2DDFF",300:"#84CAFF",400:"#53B1FD",500:"#2E90FA",600:"#1570EF",700:"#175CD3",800:"#1849A9",900:"#194185"},green:{25:"#F6FEF9",50:"#ECFDF3",100:"#D1FADF",200:"#A6F4C5",300:"#6CE9A6",400:"#32D583",500:"#12B76A",600:"#039855",700:"#027A48",800:"#05603A",900:"#054F31"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},yellow:{25:"#FFFCF5",50:"#FFFAEB",100:"#FEF0C7",200:"#FEDF89",300:"#FEC84B",400:"#FDB022",500:"#F79009",600:"#DC6803",700:"#B54708",800:"#93370D",900:"#7A2E0E"},purple:{25:"#FAFAFF",50:"#F4F3FF",100:"#EBE9FE",200:"#D9D6FE",300:"#BDB4FE",400:"#9B8AFB",500:"#7A5AF8",600:"#6938EF",700:"#5925DC",800:"#4A1FB8",900:"#3E1C96"},teal:{25:"#F6FEFC",50:"#F0FDF9",100:"#CCFBEF",200:"#99F6E0",300:"#5FE9D0",400:"#2ED3B7",500:"#15B79E",600:"#0E9384",700:"#107569",800:"#125D56",900:"#134E48"},pink:{25:"#fdf2f8",50:"#fce7f3",100:"#fbcfe8",200:"#f9a8d4",300:"#f472b6",400:"#ec4899",500:"#db2777",600:"#be185d",700:"#9d174d",800:"#831843",900:"#500724"},cyan:{25:"#ecfeff",50:"#cffafe",100:"#a5f3fc",200:"#67e8f9",300:"#22d3ee",400:"#06b6d4",500:"#0891b2",600:"#0e7490",700:"#155e75",800:"#164e63",900:"#083344"}},alpha:{90:"e5",80:"cc"},font:{size:{xs:"calc(var(--tsqd-font-size) * 0.75)",sm:"calc(var(--tsqd-font-size) * 0.875)",md:"var(--tsqd-font-size)"},lineHeight:{xs:"calc(var(--tsqd-font-size) * 1)",sm:"calc(var(--tsqd-font-size) * 1.25)",md:"calc(var(--tsqd-font-size) * 1.5)"},weight:{medium:"500",semibold:"600",bold:"700"}},border:{radius:{xs:"calc(var(--tsqd-font-size) * 0.125)",sm:"calc(var(--tsqd-font-size) * 0.25)",full:"9999px"}},size:{.25:"calc(var(--tsqd-font-size) * 0.0625)",.5:"calc(var(--tsqd-font-size) * 0.125)",1:"calc(var(--tsqd-font-size) * 0.25)",1.5:"calc(var(--tsqd-font-size) * 0.375)",2:"calc(var(--tsqd-font-size) * 0.5)",2.5:"calc(var(--tsqd-font-size) * 0.625)",3:"calc(var(--tsqd-font-size) * 0.75)",3.5:"calc(var(--tsqd-font-size) * 0.875)",4:"calc(var(--tsqd-font-size) * 1)",4.5:"calc(var(--tsqd-font-size) * 1.125)",5:"calc(var(--tsqd-font-size) * 1.25)",6:"calc(var(--tsqd-font-size) * 1.5)",6.5:"calc(var(--tsqd-font-size) * 1.625)",14:"calc(var(--tsqd-font-size) * 3.5)"},shadow:{xs:(e="rgb(0 0 0 / 0.1)")=>"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:(e="rgb(0 0 0 / 0.1)")=>`0 1px 3px 0 ${e}, 0 1px 2px -1px ${e}`,md:(e="rgb(0 0 0 / 0.1)")=>`0 4px 6px -1px ${e}, 0 2px 4px -2px ${e}`,lg:(e="rgb(0 0 0 / 0.1)")=>`0 10px 15px -3px ${e}, 0 4px 6px -4px ${e}`,xl:(e="rgb(0 0 0 / 0.1)")=>`0 20px 25px -5px ${e}, 0 8px 10px -6px ${e}`,"2xl":(e="rgb(0 0 0 / 0.25)")=>`0 25px 50px -12px ${e}`,inner:(e="rgb(0 0 0 / 0.05)")=>`inset 0 2px 4px 0 ${e}`,none:()=>"none"}},Awe=pn('<svg width=14 height=14 viewBox="0 0 14 14"fill=none xmlns=http://www.w3.org/2000/svg><path d="M13 13L9.00007 9M10.3333 5.66667C10.3333 8.244 8.244 10.3333 5.66667 10.3333C3.08934 10.3333 1 8.244 1 5.66667C1 3.08934 3.08934 1 5.66667 1C8.244 1 10.3333 3.08934 10.3333 5.66667Z"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Nwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9 3H15M3 6H21M19 6L18.2987 16.5193C18.1935 18.0975 18.1409 18.8867 17.8 19.485C17.4999 20.0118 17.0472 20.4353 16.5017 20.6997C15.882 21 15.0911 21 13.5093 21H10.4907C8.90891 21 8.11803 21 7.49834 20.6997C6.95276 20.4353 6.50009 20.0118 6.19998 19.485C5.85911 18.8867 5.8065 18.0975 5.70129 16.5193L5 6M10 10.5V15.5M14 10.5V15.5"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Rwe=pn('<svg width=10 height=6 viewBox="0 0 10 6"fill=none xmlns=http://www.w3.org/2000/svg><path d="M1 1L5 5L9 1"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Owe=pn('<svg width=12 height=12 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 13.3333V2.66667M8 2.66667L4 6.66667M8 2.66667L12 6.66667"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Pwe=pn('<svg width=12 height=12 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 2.66667V13.3333M8 13.3333L4 9.33333M8 13.3333L12 9.33333"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),kwe=pn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M12 2v2m0 16v2M4 12H2m4.314-5.686L4.9 4.9m12.786 1.414L19.1 4.9M6.314 17.69 4.9 19.104m12.786-1.414 1.414 1.414M22 12h-2m-3 0a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Mwe=pn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M22 15.844a10.424 10.424 0 0 1-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 0 0 2 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),jwe=pn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 21h8m-4-4v4m-5.2-4h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 14.72 22 13.88 22 12.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 3 18.88 3 17.2 3H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 5.28 2 6.12 2 7.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 17 5.12 17 6.8 17Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Lwe=pn('<svg stroke=currentColor fill=currentColor stroke-width=0 viewBox="0 0 24 24"height=1em width=1em xmlns=http://www.w3.org/2000/svg><path fill=none d="M0 0h24v24H0z"></path><path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3a4.237 4.237 0 00-6 0zm-4-4l2 2a7.074 7.074 0 0110 0l2-2C15.14 9.14 8.87 9.14 5 13z">'),Dwe=pn('<svg stroke-width=0 viewBox="0 0 24 24"height=1em width=1em xmlns=http://www.w3.org/2000/svg><path fill=none d="M24 .01c0-.01 0-.01 0 0L0 0v24h24V.01zM0 0h24v24H0V0zm0 0h24v24H0V0z"></path><path d="M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7l2-2zm-4 4a9.793 9.793 0 00-4.49-2.56l3.53 3.53.96-.97zM2 3.05L5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24A9.684 9.684 0 005 13v.01L6.99 15a7.042 7.042 0 014.92-2.06L18.98 20l1.27-1.26L3.29 1.79 2 3.05zM9 17l3 3 3-3a4.237 4.237 0 00-6 0z">'),Iwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9.3951 19.3711L9.97955 20.6856C10.1533 21.0768 10.4368 21.4093 10.7958 21.6426C11.1547 21.8759 11.5737 22.0001 12.0018 22C12.4299 22.0001 12.8488 21.8759 13.2078 21.6426C13.5667 21.4093 13.8503 21.0768 14.024 20.6856L14.6084 19.3711C14.8165 18.9047 15.1664 18.5159 15.6084 18.26C16.0532 18.0034 16.5678 17.8941 17.0784 17.9478L18.5084 18.1C18.9341 18.145 19.3637 18.0656 19.7451 17.8713C20.1265 17.6771 20.4434 17.3763 20.6573 17.0056C20.8715 16.635 20.9735 16.2103 20.9511 15.7829C20.9286 15.3555 20.7825 14.9438 20.5307 14.5978L19.684 13.4344C19.3825 13.0171 19.2214 12.5148 19.224 12C19.2239 11.4866 19.3865 10.9864 19.6884 10.5711L20.5351 9.40778C20.787 9.06175 20.933 8.65007 20.9555 8.22267C20.978 7.79528 20.8759 7.37054 20.6618 7C20.4479 6.62923 20.131 6.32849 19.7496 6.13423C19.3681 5.93997 18.9386 5.86053 18.5129 5.90556L17.0829 6.05778C16.5722 6.11141 16.0577 6.00212 15.6129 5.74556C15.17 5.48825 14.82 5.09736 14.6129 4.62889L14.024 3.31444C13.8503 2.92317 13.5667 2.59072 13.2078 2.3574C12.8488 2.12408 12.4299 1.99993 12.0018 2C11.5737 1.99993 11.1547 2.12408 10.7958 2.3574C10.4368 2.59072 10.1533 2.92317 9.97955 3.31444L9.3951 4.62889C9.18803 5.09736 8.83798 5.48825 8.3951 5.74556C7.95032 6.00212 7.43577 6.11141 6.9251 6.05778L5.49066 5.90556C5.06499 5.86053 4.6354 5.93997 4.25397 6.13423C3.87255 6.32849 3.55567 6.62923 3.34177 7C3.12759 7.37054 3.02555 7.79528 3.04804 8.22267C3.07052 8.65007 3.21656 9.06175 3.46844 9.40778L4.3151 10.5711C4.61704 10.9864 4.77964 11.4866 4.77955 12C4.77964 12.5134 4.61704 13.0137 4.3151 13.4289L3.46844 14.5922C3.21656 14.9382 3.07052 15.3499 3.04804 15.7773C3.02555 16.2047 3.12759 16.6295 3.34177 17C3.55589 17.3706 3.8728 17.6712 4.25417 17.8654C4.63554 18.0596 5.06502 18.1392 5.49066 18.0944L6.92066 17.9422C7.43133 17.8886 7.94587 17.9979 8.39066 18.2544C8.83519 18.511 9.18687 18.902 9.3951 19.3711Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path><path d="M12 15C13.6568 15 15 13.6569 15 12C15 10.3431 13.6568 9 12 9C10.3431 9 8.99998 10.3431 8.99998 12C8.99998 13.6569 10.3431 15 12 15Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Fwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M16 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V8M11.5 12.5L17 7M17 7H12M17 7V12M6.2 21H8.8C9.9201 21 10.4802 21 10.908 20.782C11.2843 20.5903 11.5903 20.2843 11.782 19.908C12 19.4802 12 18.9201 12 17.8V15.2C12 14.0799 12 13.5198 11.782 13.092C11.5903 12.7157 11.2843 12.4097 10.908 12.218C10.4802 12 9.92011 12 8.8 12H6.2C5.0799 12 4.51984 12 4.09202 12.218C3.71569 12.4097 3.40973 12.7157 3.21799 13.092C3 13.5198 3 14.0799 3 15.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Uwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path class=copier d="M8 8V5.2C8 4.0799 8 3.51984 8.21799 3.09202C8.40973 2.71569 8.71569 2.40973 9.09202 2.21799C9.51984 2 10.0799 2 11.2 2H18.8C19.9201 2 20.4802 2 20.908 2.21799C21.2843 2.40973 21.5903 2.71569 21.782 3.09202C22 3.51984 22 4.0799 22 5.2V12.8C22 13.9201 22 14.4802 21.782 14.908C21.5903 15.2843 21.2843 15.5903 20.908 15.782C20.4802 16 19.9201 16 18.8 16H16M5.2 22H12.8C13.9201 22 14.4802 22 14.908 21.782C15.2843 21.5903 15.5903 21.2843 15.782 20.908C16 20.4802 16 19.9201 16 18.8V11.2C16 10.0799 16 9.51984 15.782 9.09202C15.5903 8.71569 15.2843 8.40973 14.908 8.21799C14.4802 8 13.9201 8 12.8 8H5.2C4.0799 8 3.51984 8 3.09202 8.21799C2.71569 8.40973 2.40973 8.71569 2.21799 9.09202C2 9.51984 2 10.0799 2 11.2V18.8C2 19.9201 2 20.4802 2.21799 20.908C2.40973 21.2843 2.71569 21.5903 3.09202 21.782C3.51984 22 4.07989 22 5.2 22Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round stroke=currentColor>'),$we=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M2.5 21.4998L8.04927 19.3655C8.40421 19.229 8.58168 19.1607 8.74772 19.0716C8.8952 18.9924 9.0358 18.901 9.16804 18.7984C9.31692 18.6829 9.45137 18.5484 9.72028 18.2795L21 6.99982C22.1046 5.89525 22.1046 4.10438 21 2.99981C19.8955 1.89525 18.1046 1.89524 17 2.99981L5.72028 14.2795C5.45138 14.5484 5.31692 14.6829 5.20139 14.8318C5.09877 14.964 5.0074 15.1046 4.92823 15.2521C4.83911 15.4181 4.77085 15.5956 4.63433 15.9506L2.5 21.4998ZM2.5 21.4998L4.55812 16.1488C4.7054 15.7659 4.77903 15.5744 4.90534 15.4867C5.01572 15.4101 5.1523 15.3811 5.2843 15.4063C5.43533 15.4351 5.58038 15.5802 5.87048 15.8703L8.12957 18.1294C8.41967 18.4195 8.56472 18.5645 8.59356 18.7155C8.61877 18.8475 8.58979 18.9841 8.51314 19.0945C8.42545 19.2208 8.23399 19.2944 7.85107 19.4417L2.5 21.4998Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Vwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M7.5 12L10.5 15L16.5 9M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Bwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9 9L15 15M15 9L9 15M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"stroke=#F04438 stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),zwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 xmlns=http://www.w3.org/2000/svg><rect class=list width=20 height=20 y=2 x=2 rx=2></rect><line class=list-item y1=7 y2=7 x1=6 x2=18></line><line class=list-item y2=12 y1=12 x1=6 x2=18></line><line class=list-item y1=17 y2=17 x1=6 x2=18>'),Hwe=pn('<svg viewBox="0 0 24 24"height=20 width=20 fill=none xmlns=http://www.w3.org/2000/svg><path d="M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),qwe=pn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Gwe=pn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M12 2V6M12 18V22M6 12H2M22 12H18M19.0784 19.0784L16.25 16.25M19.0784 4.99994L16.25 7.82837M4.92157 19.0784L7.75 16.25M4.92157 4.99994L7.75 7.82837"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path><animateTransform attributeName=transform attributeType=XML type=rotate from=0 to=360 dur=2s repeatCount=indefinite>'),Kwe=pn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M15 9L9 15M9 9L15 15M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Wwe=pn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9.5 15V9M14.5 15V9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Ywe=pn('<svg version=1.0 viewBox="0 0 633 633"><linearGradient x1=-666.45 x2=-666.45 y1=163.28 y2=163.99 gradientTransform="matrix(633 0 0 633 422177 -103358)"gradientUnits=userSpaceOnUse><stop stop-color=#6BDAFF offset=0></stop><stop stop-color=#F9FFB5 offset=.32></stop><stop stop-color=#FFA770 offset=.71></stop><stop stop-color=#FF7373 offset=1></stop></linearGradient><circle cx=316.5 cy=316.5 r=316.5></circle><defs><filter x=-137.5 y=412 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=412 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=610.5 rx=214.5 ry=186 fill=#015064 stroke=#00CFE2 stroke-width=25></ellipse></g><defs><filter x=316.5 y=412 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=412 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=610.5 rx=214.5 ry=186 fill=#015064 stroke=#00CFE2 stroke-width=25></ellipse></g><defs><filter x=-137.5 y=450 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=450 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=648.5 rx=214.5 ry=186 fill=#015064 stroke=#00A8B8 stroke-width=25></ellipse></g><defs><filter x=316.5 y=450 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=450 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=648.5 rx=214.5 ry=186 fill=#015064 stroke=#00A8B8 stroke-width=25></ellipse></g><defs><filter x=-137.5 y=486 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=486 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=684.5 rx=214.5 ry=186 fill=#015064 stroke=#007782 stroke-width=25></ellipse></g><defs><filter x=316.5 y=486 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=486 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=684.5 rx=214.5 ry=186 fill=#015064 stroke=#007782 stroke-width=25></ellipse></g><defs><filter x=272.2 y=308 width=176.9 height=129.3 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=272.2 y=308 width=176.9 height=129.3 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><line x1=436 x2=431 y1=403.2 y2=431.8 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><line x1=291 x2=280 y1=341.5 y2=403.5 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><line x1=332.9 x2=328.6 y1=384.1 y2=411.2 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><linearGradient x1=-670.75 x2=-671.59 y1=164.4 y2=164.49 gradientTransform="matrix(-184.16 -32.472 -11.461 64.997 -121359 -32126)"gradientUnits=userSpaceOnUse><stop stop-color=#EE2700 offset=0></stop><stop stop-color=#FF008E offset=1></stop></linearGradient><path d="m344.1 363 97.7 17.2c5.8 2.1 8.2 6.1 7.1 12.1s-4.7 9.2-11 9.9l-106-18.7-57.5-59.2c-3.2-4.8-2.9-9.1 0.8-12.8s8.3-4.4 13.7-2.1l55.2 53.6z"clip-rule=evenodd fill-rule=evenodd></path><line x1=428.2 x2=429.1 y1=384.5 y2=378 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=395.2 x2=396.1 y1=379.5 y2=373 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=362.2 x2=363.1 y1=373.5 y2=367.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=324.2 x2=328.4 y1=351.3 y2=347.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=303.2 x2=307.4 y1=331.3 y2=327.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line></g><defs><filter x=73.2 y=113.8 width=280.6 height=317.4 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=73.2 y=113.8 width=280.6 height=317.4 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-672.16 x2=-672.16 y1=165.03 y2=166.03 gradientTransform="matrix(-100.18 48.861 97.976 200.88 -83342 -93.059)"gradientUnits=userSpaceOnUse><stop stop-color=#A17500 offset=0></stop><stop stop-color=#5D2100 offset=1></stop></linearGradient><path d="m192.3 203c8.1 37.3 14 73.6 17.8 109.1 3.8 35.4 2.8 75.1-3 119.2l61.2-16.7c-15.6-59-25.2-97.9-28.6-116.6s-10.8-51.9-22.1-99.6l-25.3 4.6"clip-rule=evenodd fill-rule=evenodd></path><g stroke=#2F8A00><linearGradient x1=-660.23 x2=-660.23 y1=166.72 y2=167.72 gradientTransform="matrix(92.683 4.8573 -2.0259 38.657 61680 -3088.6)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m195 183.9s-12.6-22.1-36.5-29.9c-15.9-5.2-34.4-1.5-55.5 11.1 15.9 14.3 29.5 22.6 40.7 24.9 16.8 3.6 51.3-6.1 51.3-6.1z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-661.36 x2=-661.36 y1=164.18 y2=165.18 gradientTransform="matrix(110 5.7648 -6.3599 121.35 73933 -15933)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5s-47.5-8.5-83.2 15.7c-23.8 16.2-34.3 49.3-31.6 99.4 30.3-27.8 52.1-48.5 65.2-61.9 19.8-20.2 49.6-53.2 49.6-53.2z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-656.79 x2=-656.79 y1=165.15 y2=166.15 gradientTransform="matrix(62.954 3.2993 -3.5023 66.828 42156 -8754.1)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m195 183.9c-0.8-21.9 6-38 20.6-48.2s29.8-15.4 45.5-15.3c-6.1 21.4-14.5 35.8-25.2 43.4s-24.4 14.2-40.9 20.1z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-663.07 x2=-663.07 y1=165.44 y2=166.44 gradientTransform="matrix(152.47 7.9907 -3.0936 59.029 101884 -4318.7)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c31.9-30 64.1-39.7 96.7-29s50.8 30.4 54.6 59.1c-35.2-5.5-60.4-9.6-75.8-12.1-15.3-2.6-40.5-8.6-75.5-18z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-662.57 x2=-662.57 y1=164.44 y2=165.44 gradientTransform="matrix(136.46 7.1517 -5.2163 99.533 91536 -11442)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c35.8-7.6 65.6-0.2 89.2 22s37.7 49 42.3 80.3c-39.8-9.7-68.3-23.8-85.5-42.4s-32.5-38.5-46-59.9z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-656.43 x2=-656.43 y1=163.86 y2=164.86 gradientTransform="matrix(60.866 3.1899 -8.7773 167.48 41560 -25168)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c-33.6 13.8-53.6 35.7-60.1 65.6s-3.6 63.1 8.7 99.6c27.4-40.3 43.2-69.6 47.4-88s5.6-44.1 4-77.2z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><path d="m196.5 182.3c-14.8 21.6-25.1 41.4-30.8 59.4s-9.5 33-11.1 45.1"fill=none stroke-linecap=round stroke-width=8></path><path d="m194.9 185.7c-24.4 1.7-43.8 9-58.1 21.8s-24.7 25.4-31.3 37.8"fill=none stroke-linecap=round stroke-width=8></path><path d="m204.5 176.4c29.7-6.7 52-8.4 67-5.1s26.9 8.6 35.8 15.9"fill=none stroke-linecap=round stroke-width=8></path><path d="m196.5 181.4c20.3 9.9 38.2 20.5 53.9 31.9s27.4 22.1 35.1 32"fill=none stroke-linecap=round stroke-width=8></path></g></g><defs><filter x=50.5 y=399 width=532 height=633 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=50.5 y=399 width=532 height=633 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-666.06 x2=-666.23 y1=163.36 y2=163.75 gradientTransform="matrix(532 0 0 633 354760 -102959)"gradientUnits=userSpaceOnUse><stop stop-color=#FFF400 offset=0></stop><stop stop-color=#3C8700 offset=1></stop></linearGradient><ellipse cx=316.5 cy=715.5 rx=266 ry=316.5></ellipse></g><defs><filter x=391 y=-24 width=288 height=283 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=391 y=-24 width=288 height=283 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-664.56 x2=-664.56 y1=163.79 y2=164.79 gradientTransform="matrix(227 0 0 227 151421 -37204)"gradientUnits=userSpaceOnUse><stop stop-color=#FFDF00 offset=0></stop><stop stop-color=#FF9D00 offset=1></stop></linearGradient><circle cx=565.5 cy=89.5 r=113.5></circle><linearGradient x1=-644.5 x2=-645.77 y1=342 y2=342 gradientTransform="matrix(30 0 0 1 19770 -253)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=427 x2=397 y1=89 y2=89 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-641.56 x2=-642.83 y1=196.02 y2=196.07 gradientTransform="matrix(26.5 0 0 5.5 17439 -1025.5)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=430.5 x2=404 y1=55.5 y2=50 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-643.73 x2=-645 y1=185.83 y2=185.9 gradientTransform="matrix(29 0 0 8 19107 -1361)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=431 x2=402 y1=122 y2=130 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-638.94 x2=-640.22 y1=177.09 y2=177.39 gradientTransform="matrix(24 0 0 13 15783 -2145)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=442 x2=418 y1=153 y2=166 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-633.42 x2=-634.7 y1=172.41 y2=173.31 gradientTransform="matrix(20 0 0 19 13137 -3096)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=464 x2=444 y1=180 y2=199 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-619.05 x2=-619.52 y1=170.82 y2=171.82 gradientTransform="matrix(13.83 0 0 22.85 9050 -3703.4)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=491.4 x2=477.5 y1=203 y2=225.9 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-578.5 x2=-578.63 y1=170.31 y2=171.31 gradientTransform="matrix(7.5 0 0 24.5 4860 -3953)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=524.5 x2=517 y1=219.5 y2=244 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=666.5 x2=666.5 y1=170.31 y2=171.31 gradientTransform="matrix(.5 0 0 24.5 231.5 -3944)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=564.5 x2=565 y1=228.5 y2=253 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12>');function Xwe(){return Awe()}function Zwe(){return Nwe()}function Qwe(){return Rwe()}function Jwe(){return Owe()}function e_e(){return Pwe()}function t_e(){return(e=Pwe()).style.setProperty("transform","rotate(90deg)"),e;var e}function n_e(){return(e=Pwe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function r_e(){return kwe()}function o_e(){return Mwe()}function i_e(){return jwe()}function a_e(){return Lwe()}function s_e(){return Dwe()}function l_e(){return Iwe()}function c_e(){return Fwe()}function u_e(){return Uwe()}function d_e(){return $we()}function p_e(e){return t=Vwe(),n=t.firstChild,lt((()=>hn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function f_e(){return Bwe()}function h_e(){return zwe()}function m_e(e){return[$t(Jt,{get when(){return e.checked},get children(){var t=Vwe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}}),$t(Jt,{get when(){return!e.checked},get children(){var t=Hwe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function g_e(){return qwe()}function v_e(){return Gwe()}function y_e(){return Kwe()}function b_e(){return Wwe()}function x_e(){const e=Yt();return t=Ywe(),i=(o=(r=(n=t.firstChild).nextSibling).nextSibling).firstChild,s=(a=o.nextSibling).firstChild,u=(c=(l=a.nextSibling).nextSibling).firstChild,p=(d=c.nextSibling).firstChild,m=(h=(f=d.nextSibling).nextSibling).firstChild,v=(g=h.nextSibling).firstChild,x=(b=(y=g.nextSibling).nextSibling).firstChild,_=(w=b.nextSibling).firstChild,T=(E=(S=w.nextSibling).nextSibling).firstChild,A=(C=E.nextSibling).firstChild,O=(R=(N=C.nextSibling).nextSibling).firstChild,k=(P=R.nextSibling).firstChild,L=(j=(M=P.nextSibling).nextSibling).firstChild,I=(D=j.nextSibling).firstChild,$=(U=(F=D.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Q=(Z=(X=(Y=(W=(K=(G=(q=z.nextSibling).firstChild).nextSibling).nextSibling.firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,se=(ae=q.nextSibling).firstChild,ce=(le=ae.nextSibling).firstChild,pe=(de=(ue=le.nextSibling).firstChild).nextSibling,he=(fe=ue.nextSibling).firstChild,ge=(me=fe.nextSibling).firstChild,Le=(je=(Me=(ke=(Pe=(Oe=(Re=(Ne=(Ae=(Ce=(Te=(Ee=(Se=(_e=(we=(xe=(be=(ye=(ve=me.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,hn(n,"id",`a-${e}`),hn(r,"fill",`url(#a-${e})`),hn(i,"id",`am-${e}`),hn(a,"id",`b-${e}`),hn(s,"filter",`url(#am-${e})`),hn(l,"mask",`url(#b-${e})`),hn(u,"id",`ah-${e}`),hn(d,"id",`k-${e}`),hn(p,"filter",`url(#ah-${e})`),hn(f,"mask",`url(#k-${e})`),hn(m,"id",`ae-${e}`),hn(g,"id",`j-${e}`),hn(v,"filter",`url(#ae-${e})`),hn(y,"mask",`url(#j-${e})`),hn(x,"id",`ai-${e}`),hn(w,"id",`i-${e}`),hn(_,"filter",`url(#ai-${e})`),hn(S,"mask",`url(#i-${e})`),hn(T,"id",`aj-${e}`),hn(C,"id",`h-${e}`),hn(A,"filter",`url(#aj-${e})`),hn(N,"mask",`url(#h-${e})`),hn(O,"id",`ag-${e}`),hn(P,"id",`g-${e}`),hn(k,"filter",`url(#ag-${e})`),hn(M,"mask",`url(#g-${e})`),hn(L,"id",`af-${e}`),hn(D,"id",`f-${e}`),hn(I,"filter",`url(#af-${e})`),hn(F,"mask",`url(#f-${e})`),hn(U,"id",`m-${e}`),hn($,"fill",`url(#m-${e})`),hn(B,"id",`ak-${e}`),hn(z,"id",`e-${e}`),hn(H,"filter",`url(#ak-${e})`),hn(q,"mask",`url(#e-${e})`),hn(G,"id",`n-${e}`),hn(K,"fill",`url(#n-${e})`),hn(W,"id",`r-${e}`),hn(Y,"fill",`url(#r-${e})`),hn(X,"id",`s-${e}`),hn(Z,"fill",`url(#s-${e})`),hn(Q,"id",`q-${e}`),hn(J,"fill",`url(#q-${e})`),hn(ee,"id",`p-${e}`),hn(te,"fill",`url(#p-${e})`),hn(ne,"id",`o-${e}`),hn(re,"fill",`url(#o-${e})`),hn(oe,"id",`l-${e}`),hn(ie,"fill",`url(#l-${e})`),hn(se,"id",`al-${e}`),hn(le,"id",`d-${e}`),hn(ce,"filter",`url(#al-${e})`),hn(ue,"mask",`url(#d-${e})`),hn(de,"id",`u-${e}`),hn(pe,"fill",`url(#u-${e})`),hn(he,"id",`ad-${e}`),hn(me,"id",`c-${e}`),hn(ge,"filter",`url(#ad-${e})`),hn(ve,"mask",`url(#c-${e})`),hn(ye,"id",`t-${e}`),hn(be,"fill",`url(#t-${e})`),hn(xe,"id",`v-${e}`),hn(we,"stroke",`url(#v-${e})`),hn(_e,"id",`aa-${e}`),hn(Se,"stroke",`url(#aa-${e})`),hn(Ee,"id",`w-${e}`),hn(Te,"stroke",`url(#w-${e})`),hn(Ce,"id",`ac-${e}`),hn(Ae,"stroke",`url(#ac-${e})`),hn(Ne,"id",`ab-${e}`),hn(Re,"stroke",`url(#ab-${e})`),hn(Oe,"id",`y-${e}`),hn(Pe,"stroke",`url(#y-${e})`),hn(ke,"id",`x-${e}`),hn(Me,"stroke",`url(#x-${e})`),hn(je,"id",`z-${e}`),hn(Le,"stroke",`url(#z-${e})`),t;var t,n,r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x,w,_,S,E,T,C,A,N,R,O,P,k,M,j,L,D,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Z,Q,J,ee,te,ne,re,oe,ie,ae,se,le,ce,ue,de,pe,fe,he,me,ge,ve,ye,be,xe,we,_e,Se,Ee,Te,Ce,Ae,Ne,Re,Oe,Pe,ke,Me,je,Le}var w_e=pn('<span><svg width=16 height=16 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M6 12L10 8L6 4"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),__e=pn('<button title="Copy object to clipboard">'),S_e=pn('<button title="Remove all items"aria-label="Remove all items">'),E_e=pn('<button title="Delete item"aria-label="Delete item">'),T_e=pn('<button title="Toggle value"aria-label="Toggle value">'),C_e=pn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),A_e=pn("<div>"),N_e=pn("<div><button> <span></span> <span> "),R_e=pn("<input>"),O_e=pn("<span>"),P_e=pn("<div><span>:"),k_e=pn("<div><div><button> [<!>...<!>]");var M_e=e=>{const t=ege(),n=Yme().shadowDOMTarget?Tge.bind({target:Yme().shadowDOMTarget}):Tge,r=ut((()=>"dark"===t()?B_e(n):V_e(n)));return o=w_e(),lt((()=>mn(o,Age(r().expander,n`
|
|
94
|
+
*/$ae.exports="production"===process.env.NODE_ENV?function(){if(Uae)return Vae;Uae=1;var e="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},t=n.useState,r=n.useEffect,o=n.useLayoutEffect,i=n.useDebugValue;function a(t){var n=t.getSnapshot;t=t.value;try{var r=n();return!e(t,r)}catch(o){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,n){var s=n(),l=t({inst:{value:s,getSnapshot:n}}),c=l[0].inst,u=l[1];return o((function(){c.value=s,c.getSnapshot=n,a(c)&&u({inst:c})}),[e,s,n]),r((function(){return a(c)&&u({inst:c}),e((function(){a(c)&&u({inst:c})}))}),[e]),i(s),s};return Vae.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:s,Vae}():(Bae||(Bae=1,"production"!==process.env.NODE_ENV&&function(){function e(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(o){return!0}}"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=n,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useState,i=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue,l=!1,c=!1,u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(n,u){l||void 0===t.startTransition||(l=!0);var d=u();if(!c){var p=u();r(d,p)||(c=!0)}var f=(p=o({inst:{value:d,getSnapshot:u}}))[0].inst,h=p[1];return a((function(){f.value=d,f.getSnapshot=u,e(f)&&h({inst:f})}),[n,d,u]),i((function(){return e(f)&&h({inst:f}),n((function(){e(f)&&h({inst:f})}))}),[n]),s(d),d};zae.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:u,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),zae);var Hae=$ae.exports,qae='[cmdk-group=""]',Gae='[cmdk-group-items=""]',Kae='[cmdk-item=""]',Wae=`${Kae}:not([aria-disabled="true"])`,Yae="cmdk-item-select",Xae="data-value",Zae=(e,t,n)=>Fae(e,t,n),Qae=i.createContext(void 0),Jae=()=>i.useContext(Qae),ese=i.createContext(void 0),tse=()=>i.useContext(ese),nse=i.createContext(void 0),rse=i.forwardRef(((e,t)=>{let n=vse((()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",filtered:{count:0,items:new Map,groups:new Set}}})),r=vse((()=>new Set)),o=vse((()=>new Map)),a=vse((()=>new Map)),s=vse((()=>new Set)),l=mse(e),{label:c,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=EJ(),x=EJ(),w=EJ(),_=i.useRef(null),S=wse();gse((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,E.emit()}}),[d]),gse((()=>{S(6,O)}),[]);let E=i.useMemo((()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,i,a;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)R(),A(),S(1,N);else if("value"===e&&(r||S(5,O),void 0!==(null==(o=l.current)?void 0:o.value))){return void(null==(a=(i=l.current).onValueChange)||a.call(i,null!=t?t:""))}E.emit()}},emit:()=>{s.current.forEach((e=>e()))}})),[]),T=i.useMemo((()=>({value:(e,t,r)=>{var o;t!==(null==(o=a.current.get(e))?void 0:o.value)&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),S(2,(()=>{A(),E.emit()})))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),S(3,(()=>{R(),A(),n.current.value||N(),E.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();S(4,(()=>{R(),(null==t?void 0:t.getAttribute("id"))===e&&N(),E.emit()}))}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{a.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:w,labelId:x,listInnerRef:_})),[]);function C(e,t){var r,o;let i=null!=(o=null==(r=l.current)?void 0:r.filter)?o:Zae;return e?i(e,n.current.search,t):0}function A(){if(!n.current.search||!1===l.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach((n=>{let r=o.current.get(n),i=0;r.forEach((t=>{let n=e.get(t);i=Math.max(n,i)})),t.push([n,i])}));let r=_.current;k().sort(((t,n)=>{var r,o;let i=t.getAttribute("id"),a=n.getAttribute("id");return(null!=(r=e.get(a))?r:0)-(null!=(o=e.get(i))?o:0)})).forEach((e=>{let t=e.closest(Gae);t?t.appendChild(e.parentElement===t?e:e.closest(`${Gae} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Gae} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{var t;let n=null==(t=_.current)?void 0:t.querySelector(`${qae}[${Xae}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function N(){let e=k().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(Xae);E.setState("value",t||void 0)}function R(){var e,t,i,s;if(!n.current.search||!1===l.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let c=0;for(let o of r.current){let r=C(null!=(t=null==(e=a.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(i=a.current.get(o))?void 0:i.keywords)?s:[]);n.current.filtered.items.set(o,r),r>0&&c++}for(let[r,a]of o.current)for(let e of a)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(r);break}n.current.filtered.count=c}function O(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(qae))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=_.current)?void 0:e.querySelector(`${Kae}[aria-selected="true"]`)}function k(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(Wae))||[])}function M(e){let t=k()[e];t&&E.setState("value",t.getAttribute(Xae))}function j(e){var t;let n=P(),r=k(),o=r.findIndex((e=>e===n)),i=r[o+e];null!=(t=l.current)&&t.loop&&(i=o+e<0?r[r.length-1]:o+e===r.length?r[0]:r[o+e]),i&&E.setState("value",i.getAttribute(Xae))}function L(e){let t,n=P(),r=null==n?void 0:n.closest(qae);for(;r&&!t;)r=e>0?fse(r,qae):hse(r,qae),t=null==r?void 0:r.querySelector(Wae);t?E.setState("value",t.getAttribute(Xae)):j(e)}let D=()=>M(k().length-1),I=e=>{e.preventDefault(),e.metaKey?D():e.altKey?L(1):j(1)},F=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?L(-1):j(-1)};return i.createElement(WQ.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=y.onKeyDown)||t.call(y,e),!e.defaultPrevented)switch(e.key){case"n":case"j":v&&e.ctrlKey&&I(e);break;case"ArrowDown":I(e);break;case"p":case"k":v&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),D();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=P();if(t){let e=new Event(Yae);t.dispatchEvent(e)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:Sse},c),_se(e,(e=>i.createElement(ese.Provider,{value:E},i.createElement(Qae.Provider,{value:T},e)))))})),ose=i.forwardRef(((e,t)=>{var n,r;let o=EJ(),a=i.useRef(null),s=i.useContext(nse),l=Jae(),c=mse(e),u=null!=(r=null==(n=c.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;gse((()=>{if(!u)return l.item(o,null==s?void 0:s.id)}),[u]);let d=xse(o,a,[e.value,e.children,a],e.keywords),p=tse(),f=bse((e=>e.value&&e.value===d.current)),h=bse((e=>!(!u&&!1!==l.filter())||(!e.search||e.filtered.items.get(o)>0)));function m(){var e,t;g(),null==(t=(e=c.current).onSelect)||t.call(e,d.current)}function g(){p.setState("value",d.current,!0)}if(i.useEffect((()=>{let t=a.current;if(t&&!e.disabled)return t.addEventListener(Yae,m),()=>t.removeEventListener(Yae,m)}),[h,e.onSelect,e.disabled]),!h)return null;let{disabled:v,value:y,onSelect:b,forceMount:x,keywords:w,..._}=e;return i.createElement(WQ.div,{ref:yse([a,t]),..._,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:m},e.children)})),ise=i.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,s=EJ(),l=i.useRef(null),c=i.useRef(null),u=EJ(),d=Jae(),p=bse((e=>!(!o&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));gse((()=>d.group(s)),[]),xse(s,l,[e.value,e.heading,c]);let f=i.useMemo((()=>({id:s,forceMount:o})),[o]);return i.createElement(WQ.div,{ref:yse([l,t]),...a,"cmdk-group":"",role:"presentation",hidden:!p||void 0},n&&i.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),_se(e,(e=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},i.createElement(nse.Provider,{value:f},e)))))})),ase=i.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=i.useRef(null),a=bse((e=>!e.search));return n||a?i.createElement(WQ.div,{ref:yse([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),sse=i.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=tse(),s=bse((e=>e.search)),l=bse((e=>e.value)),c=Jae(),u=i.useMemo((()=>{var e;let t=null==(e=c.listInnerRef.current)?void 0:e.querySelector(`${Kae}[${Xae}="${encodeURIComponent(l)}"]`);return null==t?void 0:t.getAttribute("id")}),[]);return i.useEffect((()=>{null!=e.value&&a.setState("search",e.value)}),[e.value]),i.createElement(WQ.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":u,id:c.inputId,type:"text",value:o?e.value:s,onChange:e=>{o||a.setState("search",e.target.value),null==n||n(e.target.value)}})})),lse=i.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=i.useRef(null),s=i.useRef(null),l=Jae();return i.useEffect((()=>{if(s.current&&a.current){let e,t=s.current,n=a.current,r=new ResizeObserver((()=>{e=requestAnimationFrame((()=>{n.style.setProperty("--cmdk-list-height",t.offsetHeight.toFixed(1)+"px")}))}));return r.observe(t),()=>{cancelAnimationFrame(e),r.unobserve(t)}}}),[]),i.createElement(WQ.div,{ref:yse([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},_se(e,(e=>i.createElement("div",{ref:yse([s,l.listInnerRef]),"cmdk-list-sizer":""},e))))})),cse=i.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:s,...l}=e;return i.createElement(hB,{open:n,onOpenChange:r},i.createElement(mB,{container:s},i.createElement(gB,{"cmdk-overlay":"",className:o}),i.createElement(vB,{"aria-label":e.label,"cmdk-dialog":"",className:a},i.createElement(rse,{ref:t,...l}))))})),use=i.forwardRef(((e,t)=>bse((e=>0===e.filtered.count))?i.createElement(WQ.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),dse=i.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return i.createElement(WQ.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},_se(e,(e=>i.createElement("div",{"aria-hidden":!0},e))))})),pse=Object.assign(rse,{List:lse,Item:ose,Input:sse,Group:ise,Separator:ase,Dialog:cse,Empty:use,Loading:dse});function fse(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function hse(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mse(e){let t=i.useRef(e);return gse((()=>{t.current=e})),t}var gse="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function vse(e){let t=i.useRef();return void 0===t.current&&(t.current=e()),t}function yse(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function bse(e){let t=tse(),n=()=>e(t.snapshot());return Hae.useSyncExternalStore(t.subscribe,n,n)}function xse(e,t,n,r=[]){let o=i.useRef(),a=Jae();return gse((()=>{var i;let s=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():o.current}})(),l=r.map((e=>e.trim()));a.value(e,s,l),null==(i=t.current)||i.setAttribute(Xae,s),o.current=s})),o}var wse=()=>{let[e,t]=i.useState(),n=vse((()=>new Map));return gse((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function _se({asChild:e,children:t},n){return e&&i.isValidElement(t)?i.cloneElement(function(e){let t=e.type;return"function"==typeof t?t(e.props):"render"in t?t.render(e.props):e}(t),{ref:t.ref},n(t.props.children)):n(t)}var Sse={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ese=i.forwardRef((({className:e,...n},r)=>t.jsx(pse,{ref:r,className:Zd("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})));Ese.displayName=pse.displayName;const Tse=i.forwardRef((({className:e,searchIcon:n,...r},o)=>t.jsxs("div",{className:"flex items-center border-b px-3",children:[n||t.jsx(Bu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),t.jsx(pse.Input,{ref:o,className:Zd("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})));Tse.displayName=pse.Input.displayName;const Cse=i.forwardRef((({className:e,...n},r)=>t.jsx(pse.List,{ref:r,className:Zd("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n})));Cse.displayName=pse.List.displayName;const Ase=i.forwardRef(((e,n)=>t.jsx(pse.Empty,{ref:n,className:"py-6 text-center text-sm",...e})));Ase.displayName=pse.Empty.displayName;const Nse=i.forwardRef((({className:e,...n},r)=>t.jsx(pse.Group,{ref:r,className:Zd("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...n})));Nse.displayName=pse.Group.displayName;const Rse=i.forwardRef((({className:e,...n},r)=>t.jsx(pse.Separator,{ref:r,className:Zd("-mx-1 h-px bg-border",e),...n})));Rse.displayName=pse.Separator.displayName;const Ose=i.forwardRef((({className:e,...n},r)=>t.jsx(pse.Item,{ref:r,className:Zd("relative flex cursor-pointer gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...n})));Ose.displayName=pse.Item.displayName;const Pse=({data:e,placeholder:n,searchPlaceholder:r,noResultsMessage:o,value:a,setValue:s})=>{const[l,c]=i.useState(!1);return t.jsxs(Z6,{open:l,onOpenChange:c,modal:!0,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",role:"combobox","aria-expanded":l,className:"w-full max-w-[200px] justify-between bg-background",children:[a?e.find((e=>e.value===a))?.label:n,t.jsx(vu,{className:"opacity-50"})]})}),t.jsx(J6,{className:"w-[200px] p-0",children:t.jsxs(Ese,{children:[t.jsx(Tse,{placeholder:r,className:"h-9"}),t.jsxs(Cse,{children:[t.jsx(Ase,{children:o}),t.jsx(Nse,{children:e.map((e=>t.jsxs(Ose,{value:e.value,onSelect:e=>{s(e===a?"":e),c(!1)},children:[e.label,t.jsx(pu,{className:Zd("ml-auto",a===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},kse=({setScheduleTime:e,setTimezone:n,timezone:r,scheduleTime:o,setIsDirty:a})=>{const[s,l]=i.useState(o&&o<(new Date).toISOString()?"Please select a time in the future":null),[c,u]=i.useState(o?o9(new Date(o),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),p=t=>{const n=v8(new Date,15);new Date(t.toLocaleString("en-US",{timeZone:r}))<new Date(n.toLocaleString("en-US",{timeZone:r}))?l("Please select a time at least 15 minutes in the future"):(l(null),e(t.toISOString()),a(!0))};return t.jsx("div",{className:"w-full @container/schedule-time",children:t.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[t.jsxs("div",{className:"flex gap-2 w-full @xl/schedule-time:flex-row flex-col items-center justify-center",children:[t.jsxs(Z6,{children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",className:Zd("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[t.jsx(du,{className:"mr-2 h-4 w-4"}),o?o9(new Date(o),"PPP"):t.jsx("span",{children:"Pick a date"})]})}),t.jsx(J6,{className:"w-auto p-0 z-[60] pointer-events-auto",children:t.jsx(Oae,{mode:"single",selected:o?new Date(o):void 0,onSelect:e=>{if(!e)return;const[t,n]=c.split(":").map(Number);e.setHours(t,n),p(e)},disabled:e=>{const t=new Date;return t.setHours(0,0,0,0),e<t},initialFocus:!0})})]}),t.jsx("input",{type:"time",value:c,onChange:e=>{if(u(e.target.value),o&&e.target.value){const[t,n]=e.target.value.split(":").map(Number),r=new Date(o);r.setHours(t,n),p(r)}},className:Zd("flex h-9 w-full sm:w-[150px] rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s&&"border-red-500")}),t.jsx(Pse,{data:d,placeholder:"Select timezone...",searchPlaceholder:"Search timezone...",noResultsMessage:"No timezone found",value:r,setValue:e=>{const t=new Date(o||(new Date).toISOString()),r=v8(new Date,15);t<new Date(r.toLocaleString("en-US",{timeZone:e}))?l("Please select a time at least 15 minutes in the future"):(l(null),n(e),a(!0))}})]}),s&&t.jsxs("p",{className:"text-destructive text-sm mt-2 flex items-center",children:[t.jsx("span",{className:"mr-2",children:"⚠️"}),s]})]})})},Mse=({title:e="Edit Schedule Time",autoSave:r=!1})=>{const o=aZ(),{updateAutomation:i}=Le(o?.id||""),{toast:a}=jl(),[s,l]=n.useState(null),[c,u]=n.useState(o?.triggerMetadata?.triggerType===Fe.ONE_TIME?o?.triggerMetadata?.scheduledAt:null),[d,p]=n.useState(o?.triggerMetadata?.triggerType===Fe.ONE_TIME&&o?.triggerMetadata?.timezone||"America/New_York"),[f,h]=n.useState(!1),m=n.useCallback((()=>{if("sendNow"===s)i({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:new Date(Date.now()+3e5).toISOString()}}),a({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),h(!1);else{if(!c||!d)return;i({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:c,timezone:d}}),a({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),h(!1)}}),[s,c,d,i,a]);return n.useEffect((()=>{}),[o]),n.useEffect((()=>{r&&f&&(m(),h(!1))}),[r,f,m]),o?t.jsx(Ore,{title:e,headerActions:r?void 0:t.jsx(vZ,{onClick:m,disabled:!f,children:"Save"}),children:t.jsx("div",{className:"@container flex-1 mx-4",children:t.jsxs("div",{className:"flex @[1000px]:flex-row flex-col gap-8 items-center",children:[t.jsxs("div",{className:"flex-1 w-full",children:[t.jsxs("div",{className:"grid grid-cols-1 @[480px]:grid-cols-2 gap-4",children:[t.jsx(xZ,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(wZ.SendButton,{className:"text-primary"}),onClick:()=>{l("sendNow"),u(new Date(Date.now()+3e5).toISOString()),p("America/New_York"),h(!0)}}),t.jsx(xZ,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(wZ.ScheduleButton,{className:"text-primary"}),onClick:()=>l("schedule")})]}),t.jsx(zB,{children:"schedule"===s&&t.jsx(mZ,{className:"overflow-hidden mt-8",children:t.jsx("div",{className:"bg-gray-50 rounded-xl p-5 border border-gray-100 flex items-center justify-center",children:t.jsx(kse,{setScheduleTime:u,setTimezone:p,timezone:d,scheduleTime:c,setIsDirty:h})})})})]}),c&&t.jsxs(AX.div,{initial:{opacity:0,y:10,scale:.98},animate:{opacity:1,y:0,scale:1},transition:{duration:.6,ease:[.23,1,.32,1],delay:.1},className:"@[1000px]:w-80 max-w-md w-full shrink-0 h-fit p-4 bg-blue-50 rounded-xl border border-blue-100 backdrop-blur-sm",children:[t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:.3,duration:.4},className:"text-sm font-medium text-gray-700",children:"Currently scheduled for:"}),t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:d||void 0})})]})]})})}):null},jse=()=>t.jsx("div",{children:t.jsx(Mse,{title:"Set Schedule Time",autoSave:!0})});var Lse=(e=>(e.DAYS="days",e))(Lse||{});const Dse={[oZ.EQUALS]:"Equals",[oZ.NOT_EQUALS]:"Not Equals",[oZ.GREATER_THAN]:"Greater Than",[oZ.LESS_THAN]:"Less Than",[oZ.EXISTS]:"Exists",[oZ.EQUALS_MONTH_DAY]:"Month and Day Matches",[oZ.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[oZ.BETWEEN_MONTH_DAY]:"Between Month Day",[oZ.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[oZ.ARRAY_CONTAINS]:"List Contains"},Ise={email:"Email",phone:"Phone",firstName:"First Name",lastName:"Last Name"},Fse=({options:e,value:n,onChange:r,placeholder:o})=>{const[a,s]=i.useState(!1);return t.jsxs(Z6,{modal:!0,open:a,onOpenChange:s,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(vZ,{"aria-expanded":a,className:"w-[200px] overflow-hidden justify-between",variant:"outline",children:[n?e.find((e=>e.value===n))?.label:o,t.jsx(vu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(J6,{className:"w-[200px] p-0",children:t.jsxs(Ese,{children:[t.jsx(Tse,{placeholder:`${o}...`}),t.jsxs(Cse,{children:[t.jsxs(Ase,{children:["No ",o.toLowerCase()," found."]}),t.jsx(Nse,{children:e.map((e=>t.jsxs(Ose,{value:e.value,onSelect:e=>{r(e===n?"":e),s(!1)},children:[t.jsx(pu,{className:Zd("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var Use=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find(Bse);if(s){const e=s.props.children,r=a.map((t=>t===s?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx($se,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx($se,{...o,ref:n,children:r})}));Use.displayName="Slot";var $se=i.forwardRef(((e,t)=>{const{children:n,...r}=e;if(i.isValidElement(n)){const e=function(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;if(n)return e.ref;if(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(n),o=function(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...e)=>{i(...e),o(...e)}:o&&(n[r]=o):"style"===r?n[r]={...o,...i}:"className"===r&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(o.ref=t?YU(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));$se.displayName="SlotClone";var Vse=({children:e})=>t.jsx(t.Fragment,{children:e});function Bse(e){return i.isValidElement(e)&&e.type===Vse}var zse=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((e,n)=>{const r=i.forwardRef(((e,r)=>{const{asChild:o,...i}=e,a=o?Use:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(a,{...i,ref:r})}));return r.displayName=`Primitive.${n}`,{...e,[n]:r}}),{}),Hse="horizontal",qse=["horizontal","vertical"],Gse=i.forwardRef(((e,n)=>{const{decorative:r,orientation:o=Hse,...i}=e,a=function(e){return qse.includes(e)}(o)?o:Hse;return t.jsx(zse.div,{"data-orientation":a,...r?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...i,ref:n})}));Gse.displayName="Separator";var Kse=Gse;const Wse=i.forwardRef((({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>t.jsx(Kse,{ref:i,decorative:r,orientation:n,className:Zd("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",e),...o})));Wse.displayName=Kse.displayName;const Yse=ru("m-1 transition ease-in-out delay-150 duration-300",{variants:{variant:{default:"border-foreground/10 text-foreground bg-card hover:bg-card/80",secondary:"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",inverted:"inverted"}},defaultVariants:{variant:"default"}}),Xse=i.forwardRef((({options:e,onValueChange:n,variant:r,placeholder:o="Select options",animation:a=0,maxCount:s=3,modalPopover:l=!0,className:c,extraCommandItems:u,searchPlaceholder:d="Search...",handleSearchInput:p,emptyMessage:f="No results found.",searchIcon:h=t.jsx(Bu,{className:"h-4 w-4 mr-2"}),selectedValues:m,setSelectedValues:g,...v},y)=>{const[b,x]=i.useState(!1),[w,_]=i.useState(!1),S=e=>{const t=m.includes(e)?m.filter((t=>t!==e)):[...m,e];g(t),n(t)},E=()=>{g([]),n([])};return t.jsxs(Z6,{open:b,onOpenChange:x,modal:l,children:[t.jsx(Q6,{asChild:!0,children:t.jsx("button",{type:"button",ref:y,...v,onClick:()=>{x((e=>!e))},className:Zd("flex w-full p-1 rounded-md border min-h-9 h-auto items-center justify-between bg-white hover:bg-gray-50 [&_svg]:pointer-events-auto data-[state=open]:bg-gray-50",c),children:t.jsxs("div",m.length>0?{className:"flex justify-between items-center w-full",children:[t.jsxs("div",{className:"flex flex-wrap items-center",children:[m.slice(0,s).map((n=>{const o=e.find((e=>e.value===n)),i=o?.icon;return t.jsxs(kZ,{className:Zd(w?"animate-bounce":"",Yse({variant:r})),style:{animationDuration:`${a}s`},children:[i&&t.jsx(i,{className:"h-4 w-4 mr-2"}),o?.label,t.jsx(xu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),S(n)}})]},n)})),m.length>s&&t.jsxs(kZ,{className:Zd("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",w?"animate-bounce":"",Yse({variant:r})),style:{animationDuration:`${a}s`},children:[`+ ${m.length-s} more`,t.jsx(xu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),(()=>{const e=m.slice(0,s);g(e),n(e)})()}})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(rd,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:e=>{e.stopPropagation(),E()}}),t.jsx(Wse,{orientation:"vertical",className:"flex min-h-6 h-full"}),t.jsx(fu,{className:"h-4 mx-2 cursor-pointer text-muted-foreground"})]})]}:{className:"flex items-center justify-between w-full mx-auto",children:[t.jsx("span",{className:"text-sm text-muted-foreground mx-3",children:o}),t.jsx(fu,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),t.jsx(J6,{className:"w-auto p-0 z-[1000]",align:"start",onEscapeKeyDown:()=>x(!1),children:t.jsxs(Ese,{children:[t.jsx(Tse,{searchIcon:h,placeholder:d,onKeyDown:e=>{if("Enter"===e.key)x(!0),p&&(p(e.currentTarget.value),x(!1));else if("Backspace"===e.key&&!e.currentTarget.value){const e=[...m];e.pop(),g(e),n(e)}}}),t.jsxs(Cse,{children:[t.jsx(Ase,{children:f}),t.jsxs(Nse,{children:[t.jsxs(Ose,{onSelect:()=>{if(m.length===e.length)E();else{const t=e.map((e=>e.value));g(t),n(t)}},className:"cursor-pointer",children:[t.jsx("div",{className:Zd("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",m.length===e.length?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(pu,{className:"h-4 w-4"})}),t.jsx("span",{children:"(Select All)"})]},"all"),e.map((e=>{const n=m.includes(e.value);return t.jsxs(Ose,{onSelect:()=>S(e.value),className:"cursor-pointer",children:[t.jsx("div",{className:Zd("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",n?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(pu,{className:"h-4 w-4"})}),e.icon&&t.jsx(e.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),t.jsx("span",{children:e.label})]},e.value)}))]}),t.jsx(Rse,{}),t.jsx(Nse,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[m.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Ose,{onSelect:E,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),t.jsx(Wse,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),t.jsx(Ose,{onSelect:()=>x(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"}),u&&u.map((e=>e(x)))]})})]})]})}),a>0&&m.length>0&&t.jsx(nd,{className:Zd("cursor-pointer my-2 text-foreground bg-background w-3 h-3",w?"":"text-muted-foreground"),onClick:()=>_(!w)})]})}));Xse.displayName="MultiSelect";var Zse="Switch",[Qse,Jse]=UQ(Zse),[ele,tle]=Qse(Zse),nle=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,name:o,checked:a,defaultChecked:s,required:l,disabled:c,value:u="on",onCheckedChange:d,form:p,...f}=e,[h,m]=i.useState(null),g=XU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=BQ({prop:a,defaultProp:s,onChange:d});return t.jsxs(ele,{scope:r,checked:b,disabled:c,children:[t.jsx(WQ.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":ale(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onClick:FQ(e.onClick,(e=>{x((e=>!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(ile,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})}));nle.displayName=Zse;var rle="SwitchThumb",ole=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=tle(rle,r);return t.jsx(WQ.span,{"data-state":ale(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})}));ole.displayName=rle;var ile=e=>{const{control:n,checked:r,bubbles:o=!0,...a}=e,s=i.useRef(null),l=Tte(r),c=t1(n);return i.useEffect((()=>{const e=s.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==r&&n){const t=new Event("click",{bubbles:o});n.call(e,r),e.dispatchEvent(t)}}),[l,r,o]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ale(e){return e?"checked":"unchecked"}var sle=nle,lle=ole;const cle=i.forwardRef((({className:e,...n},r)=>t.jsx(sle,{className:Zd("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input/50",e),...n,ref:r,children:t.jsx(lle,{className:Zd("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})));cle.displayName=sle.displayName;const ule=({onSelect:e,date:n,placeholder:r="Pick a date"})=>t.jsxs(Z6,{modal:!0,children:[t.jsx(Q6,{asChild:!0,children:t.jsxs(vZ,{variant:"outline",className:Zd("w-[200px] justify-start text-left font-normal h-9",!n&&"text-muted-foreground"),children:[t.jsx(du,{className:"mr-2 h-4 w-4"}),n?o9(n,"PPP"):t.jsx("span",{children:r})]})}),t.jsx(J6,{className:"w-auto p-0",align:"start",children:t.jsx(Oae,{mode:"single",selected:n,onSelect:e,initialFocus:!0})})]}),dle=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===Lse.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),ple=({fieldType:e,operator:n,value:r,onChange:o,options:a,toast:s,metadata:l})=>{const c=r.length>0&&"object"==typeof r[0]&&"type"in r[0]&&"relative"===r[0].type,u=r.length>0&&"object"==typeof r[0]&&"startDate"in r[0]&&"endDate"in r[0],[d,p]=i.useState((e===nZ.Date||e===nZ.DateTime)&&r.length>0&&r[0]instanceof Date?r[0]:void 0),[f,h]=i.useState(c),[m,g]=i.useState(c?r[0]:{type:"relative",value:0,unit:Lse.DAYS,direction:"before"}),[v,y]=i.useState(u?r[0]:void 0),[b,x]=i.useState(!1);if(i.useEffect((()=>{n!==oZ.EQUALS_MONTH_DAY&&n!==oZ.EQUALS_MONTH_DAY_YEAR&&f&&(h(!1),o(d?[d]:[]))}),[n,f,d,o]),i.useEffect((()=>{if(u&&v?.startDate){x("object"==typeof v.startDate&&"type"in v.startDate)}}),[u,v]),e===nZ.String||e===nZ.ReachResource||e===nZ.Array)return n===oZ.EXISTS?null:t.jsx(Xse,{maxCount:2,options:(a||[]).map((e=>({label:e.displayName,value:e.id}))),value:r.map((e=>{const t=(a||[]).find((t=>t.id===String(e)||t.displayName===String(e)||t.id===t.displayName&&t.id===String(e)));return t?.id||String(e)})),onValueChange:e=>{o(e)},selectedValues:r.map((e=>{const t=(a||[]).find((t=>t.id===String(e)||t.displayName===String(e)||t.id===t.displayName&&t.id===String(e)));return t?.id||String(e)})),setSelectedValues:e=>{o(e)},searchPlaceholder:"Enter new value",emptyMessage:"Press enter to add new value",handleSearchInput:e=>{if(e.length>0){const t=(e=>{const{value:t,type:n}=e;switch(n){case nZ.ReachResource:case nZ.Array:case nZ.String:return t.length>0;case nZ.Number:return!isNaN(Number(t));case nZ.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case nZ.Boolean:return"true"===t||"false"===t;case nZ.Date:case nZ.DateTime:return!isNaN(new Date(t).getTime());default:throw ene(n,nZ)}})({value:e,type:l.type});t?o([...new Set([...r,e])]):s({title:"Invalid value",description:`Please enter a valid value for this field. The value must be a ${l.type} type`,variant:"destructive"})}}});if(e===nZ.Date||e===nZ.DateTime){const e=n===oZ.EQUALS_MONTH_DAY||n===oZ.EQUALS_MONTH_DAY_YEAR,r=n===oZ.BETWEEN_MONTH_DAY||n===oZ.BETWEEN_MONTH_DAY_YEAR,i=e=>{dle(e)?(g(e),f&&o([e])):s({title:"Invalid relative date",description:"Please enter a valid non-negative number of days.",variant:"destructive"})},a=e=>{const t=e.startDate??v?.startDate,n=e.endDate??v?.endDate,r=t&&"object"==typeof t&&"type"in t,i=n&&"object"==typeof n&&"type"in n;if(t&&n){if(r!==i)return void s({title:"Invalid date range",description:"Both start and end dates must be of the same type (either both absolute or both relative).",variant:"destructive"});if(!r&&!i&&!(e=>!e.finalStartDate||!e.finalEndDate||e.finalStartDate<e.finalEndDate)({finalStartDate:t,finalEndDate:n}))return void s({title:"Invalid date range",description:"Start date must be before end date.",variant:"destructive"});if(r&&(!dle(t)||!dle(n)))return void s({title:"Invalid relative date",description:"Please enter valid relative dates.",variant:"destructive"})}y(e),t&&n&&o([{startDate:t,endDate:n}])},l=e=>{e&&(e=>e instanceof Date?!isNaN(e.getTime()):"object"==typeof e&&"type"in e&&"relative"===e.type&&dle(e))(e)?(p(e),o([e]),h(!1)):e||(p(void 0),o([]),h(!1))},c=e=>{h(e),o(e?[m]:d?[d]:[])};return t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"min-h-[36px] flex items-center",children:[(!f||!e)&&!r&&t.jsx(ule,{date:d,onSelect:l}),e&&f&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(q3,{type:"number",value:void 0===m.value?"":m.value,onChange:e=>{const t=""===e.target.value?void 0:parseInt(e.target.value,10);i({...m,value:t})},className:"w-20 h-9",min:"0","aria-label":"Relative days value"}),t.jsxs(cte,{value:m.direction,onValueChange:e=>{i({...m,direction:e})},children:[t.jsx(dte,{className:"w-[180px] h-9","aria-label":"Relative direction",children:t.jsx(ute,{placeholder:"Select direction..."})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"before",children:"days before today"}),t.jsx(mte,{value:"after",children:"days after today"})]})]})]}),r&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsxs("div",{className:"flex flex-col space-y-2",children:[t.jsx("div",{className:"flex items-center space-x-2",children:b?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(q3,{type:"number",value:v?.startDate&&"object"==typeof v.startDate&&"type"in v.startDate?v.startDate.value:"",onChange:e=>{const t={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Lse.DAYS,direction:v?.startDate?.direction||"before"};dle(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),t.jsxs(cte,{value:v?.startDate&&"object"==typeof v.startDate&&"type"in v.startDate?v.startDate.direction:"before",onValueChange:e=>{const t={type:"relative",value:v?.startDate?.value,unit:Lse.DAYS,direction:e};dle(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},children:[t.jsx(dte,{className:"w-[180px] h-9",children:t.jsx(ute,{placeholder:"Select direction..."})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"before",children:"days before today"}),t.jsx(mte,{value:"after",children:"days after today"})]})]}),t.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"Start"})]}):t.jsx(ule,{placeholder:"Start date",date:v?.startDate instanceof Date||"string"==typeof v?.startDate?v.startDate instanceof Date?v.startDate:new Date(v.startDate):void 0,onSelect:e=>{const t=e;t&&(y({...v,startDate:t}),a({...v,startDate:t}))}})}),t.jsx("div",{className:"flex items-center space-x-2",children:b?t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(q3,{type:"number",value:v?.endDate&&"object"==typeof v.endDate&&"type"in v.endDate?v.endDate.value:"",onChange:e=>{const t={type:"relative",value:""===e.target.value?void 0:parseInt(e.target.value,10),unit:Lse.DAYS,direction:v?.endDate?.direction||"before"};dle(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),t.jsxs(cte,{value:v?.endDate&&"object"==typeof v.endDate&&"type"in v.endDate?v.endDate.direction:"before",onValueChange:e=>{const t={type:"relative",value:v?.endDate?.value,unit:Lse.DAYS,direction:e};dle(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},children:[t.jsx(dte,{className:"w-[180px] h-9",children:t.jsx(ute,{placeholder:"Select direction..."})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"before",children:"days before today"}),t.jsx(mte,{value:"after",children:"days after today"})]})]}),t.jsx("span",{className:"w-12 text-xs font-medium text-muted-foreground flex-shrink-0",children:"End"})]}):t.jsx(ule,{placeholder:"End date",date:v?.endDate instanceof Date||"string"==typeof v?.endDate?v.endDate instanceof Date?v.endDate:new Date(v.endDate):void 0,onSelect:e=>{const t=e;t&&(y({...v,endDate:t}),a({...v,endDate:t}))}})})]}),t.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[t.jsx(cle,{id:"between-relative-date-switch",checked:b,onCheckedChange:e=>{if(x(e),e){const e={type:"relative",value:0,unit:Lse.DAYS,direction:"before"},t={type:"relative",value:0,unit:Lse.DAYS,direction:"before"};y({startDate:e,endDate:t}),a({startDate:e,endDate:t})}else{const e=new Date,t=new Date(e);t.setDate(t.getDate()+1),y({startDate:e,endDate:t}),a({startDate:e,endDate:t})}},"aria-label":"Toggle relative date input for between dates"}),t.jsx(L9,{htmlFor:"between-relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})]}),e&&t.jsxs("div",{className:"flex items-center space-x-1 pl-1",children:[t.jsx(cle,{id:"relative-date-switch",checked:f,onCheckedChange:c,"aria-label":"Toggle relative date input"}),t.jsx(L9,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===nZ.Number||e===nZ.Integer)return n===oZ.EXISTS?null:t.jsx(q3,{type:"number",value:r.length>0?String(r[0]):"",onChange:e=>o([Number(e.target.value)]),className:"w-[200px]"});if(e===nZ.Boolean){if(n===oZ.EXISTS)return null;const e=r.length>0&&Boolean(r[0]);return t.jsx(cle,{checked:e,onCheckedChange:e=>o([e])})}return t.jsx(q3,{value:r.length>0?String(r[0]):"",onChange:e=>o([e.target.value]),className:"w-[200px]",disabled:!0})},fle=({condition:e,onUpdate:n,onDuplicate:r,onDelete:o,segmentsConditions:i})=>{const{toast:a}=jl(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:nZ.String,options:void 0,itemType:void 0},l=s.operators,c=s.type,u=i.conditions.map((e=>e.field)).map((e=>({value:e,label:Ise[e]||e})));return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[t.jsx(Fse,{options:u,value:e.field,onChange:t=>{const r=t,o=i.conditions.find((e=>e.field===r));if(!o)return;const a=o.operators.map((e=>({value:e,label:Dse[e]||e,fieldType:o.type}))),s=a[0]?.value;let l=[];switch(o.type){case nZ.Boolean:l=[!1];break;case nZ.Number:l=[0];break;case nZ.Date:case nZ.DateTime:l=[new Date];break;case nZ.String:l=o.options?.length?o.options.map((e=>e.displayName)):[];break;default:l=[]}n({...e,field:r,operator:s,value:l})},placeholder:"Select field"}),t.jsx(Fse,{options:l.map((e=>({value:e,label:Dse[e]||e}))),value:e.operator,onChange:t=>n({...e,operator:t}),placeholder:"Select operator"}),t.jsx("div",{className:"max-w-2xl w-full overflow-hidden",children:t.jsx(ple,{fieldType:c,operator:e.operator,options:"string"==typeof e.value[0]&&e.value[0]&&Array.isArray(s.options)?[...(s.options||[]).map((e=>({displayName:e.displayName,id:e.id}))),...e.value.filter((e=>!s.options?.some((t=>t.id===e||t.displayName===e)))).map((e=>({displayName:e,id:e})))]:s.options?.map((e=>({displayName:e.displayName,id:e.id}))),value:e.value,onChange:t=>n({...e,value:t}),toast:a,metadata:{field:e.field,type:c,itemType:s.itemType}})})]}),t.jsxs("div",{className:"flex items-center",children:[t.jsx(vZ,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(_u,{className:"h-4 w-4"})}),t.jsx(vZ,{size:"icon",variant:"ghost",onClick:o,children:t.jsx(Yu,{className:"h-4 w-4"})})]})]})},hle=({onSelectStyle:e})=>{const[r,o]=n.useState(null);return t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 p-4 max-w-4xl mx-auto",children:[t.jsx(xZ,{onClick:()=>{o("ai"),e("ai")},title:"Build with AI",subtitle:"Describe your audience in plain language and let AI create the conditions",icon:t.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:t.jsx(Ku,{className:"w-full h-full"})})}),selected:"ai"===r}),t.jsx(xZ,{onClick:()=>{o("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${ff("engage:segment")} by configuring conditions directly`,icon:t.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:t.jsx("div",{className:"w-6 h-6 text-[hsl(var(--reach-primary))]",children:t.jsx(Hu,{className:"w-full h-full"})})}),selected:"manual"===r})]})},mle=({segmentId:e,setOpen:n,setTextToSegment:r,promptBuilderStyle:o,textToSegment:i})=>t.jsx("div",{children:t.jsx(CB,{className:"",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(NB,{className:"text-3xl font-normal",children:e?`Edit ${ff("engage:segment")}`:`Create ${ff("engage:segment")}`}),t.jsxs("div",{className:"flex items-center gap-2",children:[!1===o&&!1===i&&t.jsx(m6,{children:t.jsxs(g6,{children:[t.jsx(v6,{asChild:!0,children:t.jsx(vZ,{variant:"outline",size:"sm",onClick:()=>r(!0),children:t.jsx(Ku,{className:"h-4 w-3"})})}),t.jsx(y6,{children:t.jsxs("p",{children:["Use AI to create ",ff("engage:segment")," by describing them in natural language"]})})]})}),t.jsx(vZ,{variant:"ghost",size:"icon",onClick:()=>{n(!1)},className:"h-8 w-8",children:t.jsx(rd,{className:"h-4 w-4"})})]})]})})}),gle=({setTextToSegment:e,setSegment:r})=>{const[o,i]=n.useState(""),[a,s]=n.useState(!1),{toast:c}=jl();return t.jsxs("div",{className:"flex flex-col gap-6 p-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Describe your audience"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Describe the audience you want to target in plain language, and our AI will create the conditions for you."})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(zB,{children:[a&&t.jsx(mZ,{children:t.jsx(hZ,{})}),!a&&t.jsx(mZ,{children:t.jsx(Hte,{placeholder:"Describe your target audience...",className:"min-h-[120px] resize-none",value:o,onChange:e=>i(e.target.value)})})]}),t.jsx("div",{className:"flex justify-end gap-2",children:t.jsxs(vZ,{onClick:async()=>{if(!o)return void c({title:"Please enter a description",description:"Please enter a description of your target audience",variant:"destructive"});s(!0);const t=await(async e=>(await Re(`${l}/text-to-segment`,{method:"POST",body:JSON.stringify({text:e})})).data)(o);t.success&&t.conditions?(c({title:`${ff("engage:segment")} conditions built successfully 🚀`,description:`Your ${ff("engage:segment")} conditions have been built successfully`}),r(t.conditions)):c({title:`${ff("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[t.jsx(Ku,{className:"h-4 w-4"}),"Generate ",ff("engage:segment")]})})]})]})};function vle({segmentId:e,setOpen:n,onSegmentUpdated:r}){const{toast:o}=jl(),a=void 0===e,[s,l]=i.useState(!1),[c,u]=i.useState({version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[]}),{segment:d,isLoading:p}=eZ(e||""),{updateSegment:f}=tZ(e),{createSegment:h,isCreating:m,segmentsConditions:g}=ZX(),[v,y]=i.useState(!1),[b,x]=i.useState(!!a);i.useEffect((()=>{g&&u(d?{version:"1.0",id:d.id,name:d.name,description:d.description,logic:"AND",conditions:d.conditions}:{version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[{field:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})}),[d,g]);const w=e=>e.value.some((e=>"object"==typeof e&&"type"in e&&"relative"===e.type)),_=e=>e.value.some((e=>"object"==typeof e&&"startDate"in e&&"endDate"in e));if(!g||p)return t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(hZ,{})});return t.jsx(t.Fragment,{children:t.jsxs(zB,{mode:"wait",children:[t.jsx(mle,{segmentId:e,setOpen:n,setTextToSegment:y,promptBuilderStyle:b,textToSegment:v},"segment-builder-header"),b?t.jsx(mZ,{children:t.jsx(hle,{onSelectStyle:e=>{"ai"===e&&y(!0),x(!1)}})},"prompt-builder-style"):t.jsx(mZ,{children:t.jsxs("div",{className:"flex flex-1 flex-col",children:[t.jsx("div",{className:"flex flex-1 flex-col px-8 py-2",children:t.jsx("div",{className:"flex flex-1 flex-col gap-4 overflow-visible",children:t.jsx(zB,{children:v?t.jsx(mZ,{children:t.jsx(gle,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(mZ,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(L9,{className:"text-muted-foreground text-xs",children:"Name"}),t.jsx(q3,{placeholder:`${ff("engage:segment")} name`,value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(L9,{className:"text-muted-foreground text-xs",children:"Description"}),t.jsx(q3,{placeholder:`${ff("engage:segment")} description`,value:c.description,onChange:e=>u({...c,description:e.target.value})})]})]}),c.conditions.length>0&&t.jsx("div",{className:"flex-1 overflow-y-auto pb-8",children:t.jsx("div",{className:"grid",children:t.jsx(zB,{mode:"popLayout",children:c.conditions.map(((e,n)=>t.jsxs(AX.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},transition:{type:"spring",stiffness:300,damping:30,mass:.5},children:[n>0&&t.jsxs(AX.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[t.jsx(AX.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}}),t.jsx(AX.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),t.jsx(AX.div,{className:"h-px flex-1 bg-border",initial:{scaleX:0},animate:{scaleX:1},transition:{type:"spring",stiffness:300,damping:30,mass:.5}})]}),t.jsx(fle,{condition:e,onUpdate:e=>((e,t)=>{const n=[...c.conditions];n[e]=t,u({...c,conditions:n})})(n,e),segmentsConditions:g,onDuplicate:()=>(e=>{const t=[...c.conditions];t.splice(e+1,0,{...c.conditions[e]}),u({...c,conditions:t})})(n),onDelete:()=>(e=>{const t=c.conditions.filter(((t,n)=>n!==e));u({...c,conditions:t})})(n)})]},`${e.field}-${e.operator}-${n}`)))})})})]})})})}),t.jsx("div",{className:"border-t px-8 py-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs(vZ,v?{variant:"secondary",onClick:()=>y(!1),children:[t.jsx(Hu,{className:"h-4 w-4"}),"Manual Builder"]}:{variant:"secondary",onClick:()=>{u({...c,conditions:[...c.conditions,{field:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})},children:[t.jsx(Vu,{className:"h-4 w-4"}),"Add Condition"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(vZ,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(vZ,{variant:"default",onClick:async()=>{if(!c.name||!c.description)return void o({title:"Name and description are required",description:"Please ensure all fields are filled out",variant:"destructive"});const{valid:t,error:i}=(e=>{for(const t of e){if(!t.field||!t.operator)return{valid:!1,error:"Please ensure all fields are filled out for condition"};if(t.operator!==oZ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===oZ.EXISTS&&t.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${t.field}`};if(w(t)&&t.operator!==oZ.EQUALS_MONTH_DAY&&t.operator!==oZ.EQUALS_MONTH_DAY_YEAR)return{valid:!1,error:`Relative dates can only be used with the month and day or month, day, and year operator for ${t.field}`};if(w(t)&&void 0===t.value[0].value)return{valid:!1,error:`Please select a value for the relative date for ${t.field}`};if(_(t)&&t.operator!==oZ.BETWEEN_MONTH_DAY&&t.operator!==oZ.BETWEEN_MONTH_DAY_YEAR)return{valid:!1,error:`Between dates can only be used with the between month day or between month day year operator for ${t.field}`};if(_(t)&&t.value.length>1)return{valid:!1,error:`Between dates can only have a single value for ${t.field}`};if(_(t)){const e=t.value[0];if(!e.startDate||!e.endDate)return{valid:!1,error:`Please ensure both a start and end date are selected for ${t.field}`};if(e.startDate instanceof Date&&e.endDate instanceof Date&&e.startDate>e.endDate)return{valid:!1,error:`Start date must be before end date for ${t.field}`};if("type"in e.startDate&&"relative"===e.startDate.type&&"type"in e.endDate&&"relative"===e.endDate.type){if(!e.startDate.value||!e.endDate.value)return{valid:!1,error:`Please ensure both a start and end date are selected for ${t.field}`};if(e.startDate.direction!==e.endDate.direction)return{valid:!1,error:`Start and end date must be of the same direction for ${t.field}`};const n=e=>{if(e.unit===Lse.DAYS)return e.value??0;throw LX(e.unit,Lse)};if("before"===e.startDate.direction&&n(e.startDate)>n(e.endDate))return{valid:!1,error:`Start date must be before end date for ${t.field}`};if("after"===e.startDate.direction&&n(e.startDate)<n(e.endDate))return{valid:!1,error:`Start date must be after end date for ${t.field}`}}}}return{valid:!0,error:void 0}})(c.conditions);if(!t)return void o({title:"Conditions are invalid",description:i??"Please ensure all fields are filled out",variant:"destructive"});const a=c.conditions.map((e=>{const t=g?.conditions.find((t=>t.field===e.field));return t?.type===nZ.Date&&(e.value=e.value.map((e=>e instanceof Date?e.toISOString().split("T")[0]:e))),e}));l(!0);try{e&&d?f({name:c.name,description:c.description,conditions:a},{onSuccess:()=>{o({title:`${ff("engage:segment")} updated successfully`}),n(!1),r?.(e)},onError:()=>{o({title:`Error updating ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}}):h({name:c.name,description:c.description,conditions:c.conditions},{onSuccess:e=>{o({title:`${ff("engage:segment")} created successfully`}),r?.(e?.id??!1),n(!1)},onError:()=>{o({title:`Error creating ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}})}catch(s){o({title:`Error saving ${ff("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}finally{l(!1)}},disabled:s||m,children:s||m?t.jsxs(t.Fragment,{children:[t.jsx(Nu,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})})}function yle({open:e,setOpen:n,segmentId:r,onSegmentUpdated:o}){return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-4xl w-full",hideCloseButton:!0,children:[t.jsxs(n$,{children:[t.jsxs(NB,{children:[ff("engage:segment")," Builder"]}),t.jsxs(RB,{children:["Build a ",ff("engage:segment")," to target your audience"]})]}),t.jsx(vle,{segmentId:r,setOpen:n,onSegmentUpdated:e=>{o?.(e),n(!1)}})]})})}const ble=({value:e,label:n,percentage:r,variant:o,isLoading:i,selected:a})=>t.jsxs("div",{className:"rounded-md border-2 border-muted-foreground/20 px-2 pt-2 pb-3 duration-300 ease-in-out overflow-x-auto max-w-full min-w-0 "+(a?"scale-[1.02] [border-color:hsl(var(--reach-primary))] shadow-lg":""),style:{containerType:"inline-size"},"data-card-container":!0,children:[t.jsxs("div",{className:"flex flex-col gap-1 items-start w-full min-w-0",children:[t.jsx("div",{className:"flex items-baseline gap-2 w-full min-w-0 @container/num",children:i?t.jsx("span",{className:"animate-pulse",children:"..."}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-semibold pl-2 break-words max-w-full min-w-0 truncate\n text-xl @[250px]/card:text-2xl @[350px]/card:text-3xl @[500px]/card:text-4xl text-primary",children:e.toLocaleString()}),void 0!==r&&e.toLocaleString().replace(/,/g,"").length<5&&t.jsxs("span",{className:"text-muted-foreground/50 text-sm hidden @[120px]/num:inline",children:["(",r,"%)"]})]})}),t.jsx("span",{className:`px-2 sm:px-2.5 py-1 text-xs font-medium rounded-lg ${{default:"bg-gray-100/50 text-gray-700",blue:"bg-blue-100/50 text-blue-700",green:"bg-green-100/50 text-green-700"}[o]}`,children:n})]}),t.jsx("p",{className:"text-sm text-muted-fore hidden @[250px]/card:inline mt-1",children:1===e?"contact":"contacts"})]}),xle=({countResponse:e})=>{const r=n.useMemo((()=>e?.recipients?e.recipients.reduce(((t,n)=>({total:e.count,emails:t.emails+(n.email?1:0),phones:t.phones+(n.phone?1:0)})),{total:0,emails:0,phones:0}):{total:0,emails:0,phones:0}),[e]),o=e=>Math.round(e/(r.total||1)*100);return t.jsxs(t.Fragment,{children:[t.jsx(Rre,{children:"Estimated Matches"}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 md:mb-6 w-full gap-4 mt-3 px-1",children:[t.jsx(ble,{value:r.total,label:"Total",variant:"default",isLoading:void 0===e}),t.jsx(ble,{value:r.emails,label:"Email",percentage:o(r.emails),variant:"blue",isLoading:void 0===e}),t.jsx(ble,{value:r.phones,label:"Phone",percentage:o(r.phones),variant:"green",isLoading:void 0===e})]})]})},wle=({recipients:e})=>e?.length?t.jsx("div",{className:"bg-foreground/5 rounded-lg h-full relative overflow-hidden",children:t.jsx("div",{className:"absolute inset-0 w-full h-full overflow-y-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"sticky top-0 bg-foreground/5 backdrop-blur-sm",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Name"}),t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Contact"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-200/50",children:e.map(((e,n)=>t.jsxs("tr",{className:"hover:bg-white/50 transition-colors",children:[t.jsx("td",{className:"px-3 sm:px-4 py-3 text-sm text-gray-900",children:e.firstName||e.lastName?`${e.firstName||""} ${e.lastName||""}`.trim():"Not Provided"}),t.jsx("td",{className:"px-3 sm:px-4 py-3",children:t.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[e.email&&t.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-blue-100/50 text-blue-700 rounded-lg",children:"Email"}),e.phone&&t.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-green-100/50 text-green-700 rounded-lg",children:"Phone"})]})})]},n)))})]})})}):null,_le=({onSelectionChange:e,defaultValue:r="all"})=>{const[o,i]=n.useState(r),a=t=>{i(t),e?.(t)};return t.jsxs(t.Fragment,{children:[t.jsx(Rre,{children:"Filter"}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[t.jsx(xZ,{onClick:()=>a("all"),title:`All ${ff("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(wZ.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(xZ,{onClick:()=>a("segments"),title:`Select ${ff("engage:user",{count:2})}`,subtitle:`Choose from ${ff("engage:segment",{count:2})}`,icon:t.jsx(wZ.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===o})]})]})},Sle=({segments:e,allSegments:r,onAddSegment:o,onRemoveSegment:i,setOpenCreateSegmentDialog:a})=>{const[s,l]=n.useState([]),c=r.map((e=>({label:e.name,value:e.id})));return n.useEffect((()=>{l(e)}),[e]),t.jsx("div",{children:t.jsx(Xse,{selectedValues:s,setSelectedValues:l,options:c,defaultValue:e,onValueChange:t=>{const n=t.filter((t=>!e.includes(t))),r=e.filter((e=>!t.includes(e)));n.forEach(o),r.forEach(i)},placeholder:"Select segments",maxCount:5,extraCommandItems:[e=>t.jsxs(Ose,{onSelect:()=>{e(!1),a(!0)},className:"cursor-pointer",children:[t.jsx(wZ.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},Ele=({includedSegments:e,excludedSegments:r,handleAddSegment:o,handleRemoveSegment:i,setOpenCreateSegmentDialog:a,segments:s,defaultIsExcludeOpen:l=!1})=>{const[c,u]=n.useState(l);return t.jsxs("div",{children:[t.jsx(Sle,{segments:e,allSegments:s||[],onAddSegment:e=>o(e,"include"),onRemoveSegment:e=>i(e,"include"),setOpenCreateSegmentDialog:a}),t.jsx("div",{className:"border-t border-gray-200 my-8"}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs(vZ,{onClick:()=>u(!c),className:"flex items-center gap-1 transition-colors",size:"sm",children:[t.jsx(AX.div,{animate:{rotate:c?180:0},transition:{duration:.2},children:t.jsx(wZ.DropdownMenuTrigger,{className:"w-5 h-5"})}),t.jsx("span",{children:"Don't send to"})]}),t.jsx(zB,{children:c&&t.jsx(AX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:t.jsx(Sle,{segments:r,allSegments:s||[],onAddSegment:e=>o(e,"exclude"),onRemoveSegment:e=>i(e,"exclude"),setOpenCreateSegmentDialog:a})})})]})]})},Tle=({title:e="Preview Audience"})=>{const r=aZ(),[o,i]=n.useState("all"),[a,s]=n.useState(r?.includeSegmentIds||[]),[l,c]=n.useState(r?.excludeSegmentIds||[]),[u,d]=n.useState(!1),[p,f]=n.useState(!1),{segments:h,isLoading:m}=QX(),{updateAutomation:g}=Le(r?.id??""),[v,y]=n.useState(void 0),b=1===a.length&&0===l.length&&void 0!==h?.find((e=>e.type===rZ.ALL_USERS&&e.id===a[0]));n.useEffect((()=>{r&&!p&&(i(b||a.length>0&&0===l.length?"all":"segments"),YX({includeSegments:a,excludeSegments:l}).then((e=>{y(e)})),f(!0))}),[r,b,p,a,l]);return n.useEffect((()=>{r&&p&&(JSON.stringify(a)===JSON.stringify(r.includeSegmentIds)&&JSON.stringify(l)===JSON.stringify(r.excludeSegmentIds)||(g({includeSegments:a,excludeSegments:l}),YX({includeSegments:a,excludeSegments:l}).then((e=>{y(e)}))))}),[a,l,r,p,g]),t.jsxs(Ore,{title:e,children:[!m&&h&&p?t.jsxs("div",{className:"flex gap-8 w-full pb-4 px-4",children:[t.jsxs("div",{className:"flex flex-col flex-1 relative overflow-y-auto pb-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:[t.jsx(xle,{countResponse:v}),t.jsx(_le,{onSelectionChange:e=>{if(i(e),"all"===e){const e=h?.find((e=>e.type===rZ.ALL_USERS));if(!e)return;s([e.id]),c([])}},defaultValue:o}),t.jsx(zB,{children:"segments"===o&&t.jsx(AX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.3,ease:"easeInOut"},className:"w-full pt-4",children:t.jsx(Ele,{includedSegments:a,excludedSegments:l,handleAddSegment:(e,t)=>{"include"===t?s((t=>[...t,e])):c((t=>[...t,e]))},handleRemoveSegment:(e,t)=>{"include"===t?s((t=>t.filter((t=>t!==e)))):c((t=>t.filter((t=>t!==e))))},setOpenCreateSegmentDialog:d,segments:h,defaultIsExcludeOpen:l.length>0})})})]}),t.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:v?.recipients&&t.jsx(wle,{recipients:v.recipients})})]}):t.jsx("div",{children:t.jsx(hZ,{text:["Fetching segments","Finishing up"]})}),t.jsx(yle,{open:u,setOpen:d})]})},Cle=()=>t.jsx(Tle,{title:"Select Audience"});var Ale=(e=>(e[e.SelectAudience=1]="SelectAudience",e[e.SelectCommunication=2]="SelectCommunication",e[e.Schedule=3]="Schedule",e[e.PreviewAndSend=4]="PreviewAndSend",e))(Ale||{});const Nle=()=>{const e=aZ(),t=sZ(),r=n.useCallback((async n=>e?await(async e=>{const{currentStep:t,automation:n,communicationGroup:r}=e;switch(t){case Ale.SelectAudience:return{canMove:n.includeSegmentIds.length>0,errorMessage:"Please ensure you have selected at least one segment"};case Ale.SelectCommunication:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));return e&&r&&(r.smsChannelSenderId||r.emailChannelSenderId)?!r.emailChannelSenderId||r.emailHtmlBody&&r.emailSubject?r.smsChannelSenderId&&!r.smsMessageBody?{canMove:!1,errorMessage:"Please ensure you have a sms message body"}:{canMove:!0,errorMessage:null}:{canMove:!1,errorMessage:"Please ensure you have a email body and subject"}:{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"}}case Ale.Schedule:{if(!n.triggerMetadata)return{canMove:!1,errorMessage:"Please make sure to select a time to send before starting!"};if(n.triggerMetadata.triggerType!==Fe.ONE_TIME)return{canMove:Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:null};if(!n.triggerMetadata?.scheduledAt)return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${ff("engage:one_time")}`};if(!Boolean(n.triggerMetadata?.scheduledAt&&new Date(n.triggerMetadata.scheduledAt)>new Date))return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${ff("engage:one_time")}`};if(!Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))))return{canMove:!1,errorMessage:"Please ensure you have set a valid email or sms communication"};const e=n.triggerMetadata;return{canMove:Boolean(e.scheduledAt&&new Date(e.scheduledAt)>new Date&&n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:`Please ensure you have set a valid future date for your ${ff("engage:one_time")} automation`}}case Ale.PreviewAndSend:return{canMove:!0,errorMessage:null};default:ene(t,Ale)}})({currentStep:n,automation:e,communicationGroup:t}):{canMove:!1,errorMessage:`${ff("engage:one_time")} not loaded`}),[e,t]);return{validateStep:r}},Rle=({onFinish:e,getExtraMergeFields:r,onBeforeSchedule:o})=>{const i=aZ(),a=sZ(),{updateAutomation:s}=Le(i?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:t}=JX({includeSegments:e?.includeSegmentIds??[],excludeSegments:e?.excludeSegmentIds??[]}),r=n.useMemo((()=>t?.recipients?t.recipients.reduce(((e,t)=>({emails:e.emails+(t.email?1:0),phones:e.phones+(t.phone?1:0)})),{emails:0,phones:0}):{emails:0,phones:0}),[t?.recipients]);return{estimatedMatches:t,estimatedMatchesStats:r}})(i??void 0),{validateStep:c}=Nle(),[u,d]=n.useState(!1),[p,f]=n.useState(Ale.SelectAudience);if(!i||!p||!a)return t.jsx("div",{className:"flex-1 flex flex-col @container justify-center items-center h-[500px]",children:t.jsx(hZ,{text:[`Fetching ${ff("engage:one_time")} data`,"Finishing up"]})});const h=(({automation:e,communicationGroup:n,getExtraMergeFields:r})=>e?[{id:"audience",title:"Audience",step:1,isValid:()=>e.includeSegmentIds.length>0,content:t.jsx(Qte,{content:t.jsx(Cle,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Fe.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},{id:"content",title:"Content",step:2,isValid:()=>{const t=e.actionData?.find((e=>"send_communication"===e.actionType));return!(!t||!t.actionMetadata.communicationGroupId||!n||!n.smsChannelSenderId&&!n.emailChannelSenderId||!(!n.emailChannelSenderId||n.emailHtmlBody&&n.emailSubject)||n.smsChannelSenderId&&!n.smsMessageBody)},content:t.jsxs("div",{className:"flex flex-col gap-4 w-full p-6 rounded-xl bg-gray-100 flex-1 h-full",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:"Edit Content"}),t.jsx(Zte,{getExtraMergeFields:r})]},"content"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"schedule",title:"Schedule",step:3,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Fe.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(Qte,{className:"flex-1",content:t.jsx(jse,{})},"schedule"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"send",title:"Send",step:4,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Fe.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date(Date.now()+18e4)&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(Qte,{className:"flex-1",content:t.jsx(kre,{})},"send"),footerConfig:{backText:"Back",nextText:"Schedule",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[])({automation:i,communicationGroup:a,getExtraMergeFields:r}),m=async()=>{const{canMove:t,errorMessage:n}=await c(p);t?p===Ale.PreviewAndSend?await(async()=>{if(o)try{const t=await o({estimatedEmailRecipients:l?.emails||0,estimatedSmsRecipients:l?.phones||0});!0===t?(s({status:Ve.ACTIVE}),Ml({title:`${ff("engage:one_time")} scheduled!`}),e()):Ml({title:"Oops!",description:t,variant:"destructive"})}catch(t){Ml({title:"Oops!",description:"An error occurred while checking scheduling conditions",variant:"destructive"})}else s({status:Ve.ACTIVE}),Ml({title:`${ff("engage:one_time")} scheduled!`}),e()})():f(p+1):Ml({title:"Oops!",description:n,variant:"destructive"})},g=()=>{p>Ale.SelectAudience&&f(p-1)},v=()=>{e()};return t.jsxs("div",{className:"flex-1 flex flex-col @container h-full min-h-0",children:[t.jsxs("header",{className:"w-full flex items-center gap-4 h-16 px-6",children:[t.jsx("h1",{className:"text-xl font-bold leading-none",children:i.name}),t.jsx("div",{className:"flex items-center gap-4",children:t.jsx(kZ,{variant:c9(i.status),children:e8[i.status]})})]}),t.jsxs("main",{className:"flex gap-4 flex-1 min-h-0",children:[t.jsx("div",{className:"hidden @[1000px]:block",children:t.jsx("nav",{className:"space-y-0 w-50 self-start pr-6 pl-8 pt-4 ",children:h.map((e=>t.jsx("div",{className:`\n rounded-md transition-colors\n ${e.step===p?"bg-[var(--reach-secondary)] text-[var(--reach-primary-foreground)] font-medium":e.step<p?"text-muted-foreground hover:bg-muted":"text-muted-foreground/60"}\n `,children:t.jsx(BZ,{label:e.title,isActive:e.step===p,isCompleted:e.isValid(),onClick:async()=>{if(!u)if(e.step>p){const{canMove:t,errorMessage:n}=await(async e=>{if(e<=p)return{canMove:!0,errorMessage:null};d(!0);try{for(let t=p;t<e;t++){const{canMove:e,errorMessage:n}=await c(t);if(!e)return{canMove:e,errorMessage:n}}return{canMove:!0,errorMessage:null}}finally{d(!1)}})(e.step);t?f(e.step):n&&Ml({title:"Cannot navigate to this step",description:n,variant:"destructive"})}else f(e.step)}})},e.step)))})}),t.jsx("section",{className:"flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0",children:t.jsx("div",{className:" overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex",children:t.jsx(zB,{children:t.jsx(mZ,{className:"pt-0 h-full",children:h.find((e=>e.step===p))?.content},p)})})})]}),t.jsx("footer",{className:"w-full flex justify-end shadow-md z-10 items-center h-16 px-6",children:t.jsx(y9,{handleSkipAndSaveAsDraft:v,handleBack:g,handleNext:m,hideBack:h.find((e=>e.step===p))?.footerConfig.hideBack??!1,backText:h.find((e=>e.step===p))?.footerConfig.backText??"Back",nextText:h.find((e=>e.step===p))?.footerConfig.nextText??"Next",backDisabled:h.find((e=>e.step===p))?.footerConfig.backDisabled??!1,nextDisabled:h.find((e=>e.step===p))?.footerConfig.nextDisabled()??!1})})]})},Ole=({children:e,actionId:r})=>{const{setActionId:o}=n.useContext(VX);return n.useEffect((()=>{o(r)}),[r,o]),t.jsx("div",{children:e})},Ple=()=>t.jsxs("div",{children:[t.jsx("div",{className:TZ,children:t.jsx(wZ.OneTimeBroadcast,{})}),t.jsxs("h3",{className:CZ,children:[ff("engage:one_time")," Broadcast"]}),t.jsx("p",{className:AZ,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),kle=()=>t.jsxs("div",{children:[t.jsx("div",{className:NZ,children:"Coming Soon"}),t.jsx("div",{className:TZ,children:t.jsx(wZ.RealtimeActivity,{})}),t.jsx("h3",{className:CZ,children:"Realtime Activity"}),t.jsx("p",{className:AZ,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),Mle=({selectedType:e,setAutomationName:n,automationName:r,setAutomationDescription:o,automationDescription:i})=>t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 max-w-lg mx-auto",children:[t.jsxs("h2",{className:"text-2xl font-semibold mb-8 text-center",children:["Name Your"," ",ff(e===Fe.ONE_TIME?"engage:one_time":"engage:trigger_based")]}),t.jsxs("div",{className:"w-full space-y-6",children:[t.jsx("div",{className:"bg-gray-50 p-6 rounded-xl items-center justify-center text-center",children:(()=>{switch(e){case Fe.ONE_TIME:return t.jsx(Ple,{});case Fe.TRIGGER_BASED:return t.jsx(kle,{});default:throw ene(e,Fe)}})()}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationName",className:"block text-sm font-medium text-gray-900",children:"Name"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Only visible to your team"})]}),t.jsx(q3,{id:"automationName",type:"text",value:r,onChange:e=>n(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500 shadow-sm",placeholder:"e.g. April Newsletter Campaign",autoFocus:!0})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationDescription",className:"block text-sm font-medium text-gray-900",children:"Description"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Optional"})]}),t.jsx(Hte,{id:"automationDescription",value:i,onChange:e=>o(e.target.value),className:"w-full min-h-[80px] resize-none",placeholder:`Add any helpful context for your team. If left blank, we'll generate one for you when you start the ${ff("engage:one_time").toLowerCase()}`})]})]})]})]}),jle=({onClose:e,automationType:r,currentStep:o,setCurrentStep:i,getExtraMergeFields:a,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:c}=je(),[u,p]=n.useState(!1),[f,h]=n.useState(void 0),[m,g]=n.useState(void 0),[v,y]=n.useState(!1),[b,x]=n.useState(r?{name:void 0,description:void 0,type:r}:{name:void 0,description:void 0,type:void 0}),w=void 0!==b.name&&void 0!==b.type&&""!==b.name;n.useEffect((()=>{if(b.type&&!b.name&&!v){const e=new Date,t=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=e.toLocaleDateString([],{month:"long",day:"numeric"}),r=`${ff("engage:one_time")} ${n} ${t}`,o="";x((e=>({...e,name:r,description:o}))),y(!0)}}),[b,v]);if(c||u)return t.jsx("div",{className:EZ,children:t.jsx(hZ,{text:[`Creating ${ff("engage:one_time")}`,"Finishing up"]})});return t.jsxs("div",{className:wB("relative overflow-y-auto h-full p-8",o===yZ.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[t.jsx(zB,{mode:"wait",children:t.jsx(mZ,{className:"h-full",children:(()=>{switch(o){case yZ.ChooseAutomationType:return t.jsx(RZ,{onNext:e=>{x({...b,type:e}),i(yZ.SetAutomationName)}});case yZ.SetAutomationName:return b.type?t.jsx(Mle,{selectedType:b.type,setAutomationName:e=>{x({...b,name:e})},automationName:b.name??"",setAutomationDescription:e=>{x({...b,description:e})},automationDescription:b.description??""}):null;case yZ.OneTimeWizard:return f&&m?t.jsx(cZ,{automationId:f,children:t.jsx(Ole,{actionId:m,children:t.jsx(Rle,{onFinish:()=>{e?.(f)},getExtraMergeFields:a,onBeforeSchedule:s})})}):null;default:throw LX(o,yZ)}})()},o)}),o!==yZ.OneTimeWizard&&t.jsx("div",{className:"pt-2",children:t.jsx(bZ,{onClose:e,currentStep:o,setCurrentStep:i,isDisabled:!w,createAutomation:async()=>{if(!w||!b.name||!b.type)return;p(!0);l({name:b.name,type:b.type,description:b.description},{onSuccess:async t=>{if(t.id){const n=await(async e=>(await Re(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),o=jX().toString();await Pe(t.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:o}}]}),h(t.id),await fZ({automationId:t.id,actionId:o}),r===Fe.ONE_TIME?(i(yZ.OneTimeWizard),g(o),p(!1)):e?.(t.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{x({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==r})})]})};function Lle({open:e,setOpen:r,onClose:o,automationType:i,getExtraMergeFields:a}){const[s,l]=n.useState(i?yZ.SetAutomationName:yZ.ChooseAutomationType);return n.useEffect((()=>{e&&l(i?yZ.SetAutomationName:yZ.ChooseAutomationType)}),[e,i]),t.jsx(_B,{open:e,onOpenChange:r,children:t.jsxs(TB,{hideCloseButton:s===yZ.OneTimeWizard,className:`flex max-h-[86vh] ${s===yZ.OneTimeWizard?"max-w-[90vw]":"max-w-4xl"} flex-col gap-0 overflow-visible p-0`,children:[t.jsx(CB,{children:t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs(n$,{children:[t.jsx(NB,{className:"text-3xl font-normal",children:"Create Automation"}),t.jsx(RB,{children:"Create a new automation to send messages to your customers."})]})})}),t.jsx(jle,{onClose:e=>{o?.(e),r(!1)},automationType:i,currentStep:s,setCurrentStep:l,getExtraMergeFields:a})]})})}const Dle=({tabs:e,activeTab:r,onTabChange:o,tabsLocation:i="left",secondaryTabs:a=!1})=>{const s=n.useRef([]),[l,c]=n.useState({width:0,left:0});n.useEffect((()=>{const t=s.current[e.findIndex((e=>e.id===r))];t&&c({width:t.offsetWidth,left:t.offsetLeft})}),[r,e]);const u=e.find((e=>e.id===r));return t.jsxs("div",{className:"flex flex-col gap-4 w-full overflow-x-hidden h-full",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{className:"relative flex items-center gap-8 "+("left"===i?"w-full justify-start":"w-full justify-center"),children:[t.jsx("div",{className:"absolute bottom-0 h-[1px] rounded-full transition-all duration-300 ease-out\n bg-gradient-to-r from-primary to-primary/90\n shadow-[0_0_8px_rgba(var(--primary-rgb),0.3)]",style:{width:`${l.width}px`,left:`${l.left}px`}}),e.map(((e,n)=>t.jsx("button",{ref:e=>s.current[n]=e,onClick:()=>o(e.id),className:wB("relative px-7 py-3 transition-all duration-200 text-lg",r!==e.id&&"text-muted-foreground",a&&"text-sm"),children:e.label},e.id)))]})}),t.jsx("div",{className:"relative overflow-hidden flex-grow min-h-0",children:t.jsx("div",{className:"relative h-full",children:u?u.content:null})})]})},Ile=e=>{if(!e)return"$0.00";const t="string"==typeof e?e.replace(/,/g,""):e,n=Number(t);return Number.isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(n)},Fle="reach-styles-module__header___-izE2",Ule="reach-styles-module__title___n1hA9",$le="reach-styles-module__description___EvXM-",Vle="reach-styles-module__content___okv68",Ble="reach-styles-module__footer___YA4U4",zle=ru("reach-styles-module__base___zJcoE",{variants:{variant:{default:"reach-styles-module__default___88Q0d",destructive:"reach-styles-module__destructive___5EWhN",outline:"reach-styles-module__outline___gj9sC",secondary:"reach-styles-module__secondary___cN5Wj"}},defaultVariants:{variant:"default"}}),Hle=i.forwardRef((({className:e,variant:n,...r},o)=>t.jsx("div",{ref:o,className:Zd(zle({variant:n}),e),...r})));Hle.displayName="Card";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Fle,e),...n}))).displayName="CardHeader";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Ule,e),...n}))).displayName="CardTitle";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd($le,e),...n}))).displayName="CardDescription";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Vle,e),...n}))).displayName="CardContent";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:Zd(Ble,e),...n}))).displayName="CardFooter";const qle=({Icon:e,title:n,value:r,tooltipText:o,change:i})=>t.jsxs(Hle,{className:"relative flex flex-col justify-between min-h-[130px] transition-all duration-300 hover:shadow-md p-4",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsx("div",{className:"rounded-lg p-2 bg-primary/10 flex items-center justify-center",children:t.jsx(e,{className:"w-5 h-5 text-primary"})}),t.jsx("div",{className:"absolute top-3 right-3",children:t.jsx(T9,{title:o})})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx("div",{className:"text-2xl font-bold leading-tight text-primary",children:r}),t.jsx(Rre,{children:n})]}),i&&t.jsx("div",{className:"absolute bottom-3 right-3",children:t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-green-100 text-green-600 text-xs font-semibold",children:i})})]}),Gle=({activeTab:e,automation:n})=>{if(!n)return null;const r={sales:[{Icon:wZ.SalesAmount,title:"Order Amount",value:Ile(n.derivedRevenue),tooltipText:"Total derived revenue from this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx(qle,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Kle=({activeTab:e,statistics:n})=>{const r={email:[{Icon:wZ.MessagesSent,title:"Emails Sent",value:n.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:wZ.OpenRate,title:"Open Rate",value:`${(100*n.email.openPercentage).toFixed(2)}%`,tooltipText:"Percentage of recipients who opened the email out of total emails delivered"},{Icon:wZ.TotalBounceRate,title:"Total Bounce Rate",value:`${(100*(n.email.softBounceRate+n.email.hardBounceRate)).toFixed(2)}%`,tooltipText:"Percentage of emails that were not delivered due to permanent (hard) or temporary (soft) delivery failures"},{Icon:wZ.LinksClicked,title:"Links Clicked",value:n.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:wZ.SpamComplies,title:"Spam Complaints",value:`${(100*n.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:wZ.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*n.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:wZ.MessagesSent,title:"SMS Sent",value:n.sms.numberSent,tooltipText:"Total number of SMS messages that were successfully sent in this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx(qle,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Wle=({automationId:e,includeSales:r=!1,includeSms:o=!1,automation:i})=>{const[a,s]=n.useState("email"),{statistics:l,isLoading:c}=De(e);if(c||!l)return t.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:t.jsx(hZ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]})});const u=[{id:"email",label:`Email ${ff("engage:insight",{count:2})}`,content:t.jsx(Kle,{activeTab:"email",statistics:l})},...o?[{id:"sms",label:`SMS ${ff("engage:insight",{count:2})}`,content:t.jsx(Kle,{activeTab:"sms",statistics:l})}]:[],...r?[{id:"sales",label:`Sales ${ff("engage:insight",{count:2})}`,content:t.jsx(Gle,{activeTab:"sales",automation:i})}]:[]];return t.jsx(Dle,{tabs:u,activeTab:a,onTabChange:e=>s(e),tabsLocation:"left"})},Yle={all:["website"],content:()=>[...Yle.all,"content"],analyze:()=>[...Yle.all,"analyze"],brandSettings:()=>[...Yle.all,"brand-settings"]},Xle=async()=>(await Re("/web-presence/brand-settings",{method:"POST"})).data,Zle=({isLoading:e,brandSettings:r,onComplete:o})=>{const[i,a]=n.useState(0),[s,l]=n.useState(!1),c=["Analyzing your brand palette","Extracting your visual identity","Discovering your brand personality","Crafting your email style","Finalizing your brand profile"],u=r?.primaryColor||"#4285F4",d=(()=>{const e=e=>e.startsWith("#")?`${e}80`:e;return r?.secondaryColors?.length&&r.secondaryColors.length>0?{start:e(r.primaryColor||"#4285F4"),middle:e(r.secondaryColors[0]||"#FBBC05"),end:e(r.secondaryColors[1]||"#34A853")}:{start:"#F5F5F580",middle:e(u),end:"#C2E7FF80"}})();n.useEffect((()=>{if(!e)return;const t=setInterval((()=>{a((e=>{const n=e+1;return n>=c.length?(clearInterval(t),setTimeout((()=>{l(!0),setTimeout(o,1e3)}),1500),e):n}))}),2500);return()=>clearInterval(t)}),[e,o,c.length]);return s?t.jsx(AX.div,{className:"flex flex-col items-center justify-center h-full w-full",initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},children:t.jsxs(AX.div,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.8,ease:"easeOut"},className:"text-center",children:[t.jsx("h2",{className:"text-2xl font-bold mb-4",style:{color:u},children:"Analysis Complete!"}),t.jsx("p",{className:"text-gray-700",children:"Your brand profile has been successfully created"})]})}):t.jsxs(AX.div,{className:"flex flex-col items-center justify-center h-full w-full relative",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:8,repeat:1/0,repeatType:"reverse"},style:{backgroundImage:`linear-gradient(135deg, ${d.start} 0%, ${d.middle} 50%, ${d.end} 100%)`,backgroundSize:"200% 200%"},children:[t.jsx("div",{className:"absolute inset-0 bg-black bg-opacity-15 backdrop-blur-[2px]"}),t.jsxs("div",{className:"flex flex-col items-center gap-10 p-6 relative z-10",children:[t.jsx(AX.div,r?.logoUrl?{className:"w-32 h-32 sm:w-40 sm:h-40 flex items-center justify-center rounded-lg overflow-hidden bg-white shadow-lg",initial:{scale:.9,rotate:0},animate:{scale:1.05,rotate:0},transition:{scale:{duration:3,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:t.jsx("img",{src:r.logoUrl,alt:"Brand Logo",className:"max-w-full max-h-full object-contain"})}:{className:"w-32 h-32 sm:w-40 sm:h-40 rounded-full flex items-center justify-center",style:{backgroundColor:u},initial:{scale:.9,rotate:0},animate:{scale:[1,1.1,1],rotate:0},transition:{scale:{duration:3,repeat:1/0,ease:"easeInOut"}},children:r?.brandName?t.jsx("span",{className:"text-6xl font-bold text-primary",children:r.brandName.charAt(0)}):t.jsx(Ku,{className:"w-16 h-16 text-primary"})}),t.jsx(AX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.5},className:"text-xl text-primary font-medium text-center max-w-md drop-shadow-lg",children:c[i]},i),t.jsx("div",{className:"flex space-x-2 mt-4",children:c.map(((e,n)=>t.jsx(AX.div,{className:"h-2 w-2 rounded-full bg-muted-foreground",initial:{opacity:.3},animate:{opacity:n<=i?1:.3,scale:n===i?1.5:1},transition:{duration:.3}},n)))}),r?.brandName&&t.jsxs(AX.div,{initial:{opacity:0},animate:{opacity:.8},transition:{delay:1,duration:1},className:"mt-6 text-primary text-opacity-90 font-medium",children:[r.brandName,r.brandTagline&&t.jsx("span",{className:"block text-sm mt-1 opacity-80",children:r.brandTagline})]})]})]})},Qle=({setAutoParse:e,onBrandSettingsGenerated:r,onForceRefresh:o})=>{const{data:i,updateWebsite:a,isUpdatingWebsite:s,updateBrandSettings:l}=zte(),c=ye({mutationFn:Xle,mutationKey:Yle.brandSettings()}),[u,d]=n.useState(i?.website||""),[p,f]=n.useState(!1),[h,m]=n.useState(null),[g,v]=n.useState(!1),[y,b]=n.useState(!1),x=()=>{e(!1)};return y&&h?t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(ece,{initialBrandSettings:h,onSave:()=>{h&&(l({logoBase64:h.logo_base64,primaryColor:h.primaryColor,secondaryColors:h.secondaryColors,brandTagline:h.brandTagline,brandName:h.brandName,brandPersonality:h.brandPersonality,colorPalette:h.colorPalette}),o&&o(),Ml({title:"Brand settings saved successfully 🚀",description:"Your brand identity has been updated."}),e(!1))},onBack:x,showAutoParseButton:!1})},"results"):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[t.jsx("div",{className:"relative",children:t.jsxs("div",{className:"pb-6",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:y&&h?h.brandName||"Brand Analysis":"Website Analysis"}),t.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:y?h?.brandTagline||"Automatically generated from your website":"Customize your email branding with our AI analysis"})]})}),t.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.jsxs(zB,{mode:"wait",children:[!g&&!y&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col h-full",children:t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-start px-6 space-y-8",children:[t.jsxs("div",{className:"space-y-2 w-full max-w-md",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block text-center",children:"Your Website URL"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-center",children:[t.jsx(q3,{type:"url",value:u,onChange:e=>d(e.target.value),placeholder:"https://example.com",className:"flex-1",disabled:!p}),t.jsx(zB,{mode:"wait",children:p?t.jsxs(AX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex gap-2",children:[t.jsx(vZ,{variant:"outline",size:"sm",onClick:()=>{f(!1),d(i?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),t.jsx(vZ,{size:"sm",onClick:async()=>{try{a(u),f(!1),Ml({title:"Website URL updated successfully 🎉",description:"Your website URL has been saved."})}catch(e){Ml({title:"Error updating website URL",description:"Please try again.",variant:"destructive"})}},disabled:s||!u,className:"w-full sm:w-auto",children:s?t.jsx(hZ,{}):"Save Changes"})]},"save"):t.jsx(AX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:t.jsx(vZ,{variant:"outline",size:"sm",onClick:()=>f(!0),className:"w-full sm:w-auto",children:"Edit URL"})},"edit")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl",children:[t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"What we'll analyze"}),t.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[t.jsx("li",{children:"• Your brand colors and color palette"}),t.jsx("li",{children:"• Your logo (if detectable)"}),t.jsx("li",{children:"• Your brand name and tagline"}),t.jsx("li",{children:"• Your brand's tone and personality"})]})]}),t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"How it helps you"}),t.jsx("p",{className:"text-sm text-gray-600",children:"Our AI will automatically extract your brand assets to create consistently styled emails that match your website. This helps maintain brand recognition and professionalism in all your communications."})]})]}),t.jsx(AX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"text-sm text-muted-foreground text-center max-w-md",children:"We'll use AI to analyze your website and extract your brand elements to create perfectly matched email templates."})]})},"url-confirmation"),g&&h&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(Zle,{isLoading:g,brandSettings:h,onComplete:()=>{v(!1),b(!0),Ml({title:"Brand settings generated successfully!",description:"Your brand identity has been analyzed."})}})},"analyzing"),g&&!h&&t.jsx(AX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 flex flex-col items-center justify-center h-full",style:{background:"linear-gradient(135deg, #F5F5F5 0%, #E1E6FC 50%, #C2E7FF 100%)",backgroundSize:"200% 200%"},children:t.jsxs(AX.div,{className:"flex flex-col items-center gap-8",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:5,repeat:1/0,repeatType:"reverse"},children:[t.jsxs(AX.div,{className:"relative w-24 h-24 flex items-center justify-center",initial:{scale:.9},animate:{scale:[1,1.1,1],rotate:[0,5,0,-5,0]},transition:{scale:{duration:3,repeat:1/0,repeatType:"reverse"},rotate:{duration:5,repeat:1/0,repeatType:"reverse"}},children:[t.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/10 animate-pulse"}),t.jsx(Bu,{className:"w-12 h-12 text-primary drop-shadow-md"})]}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:"Analyzing your website"}),t.jsx(zB,{mode:"wait",children:t.jsx(AX.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-gray-600 max-w-md text-center px-4",children:"Generating your brand's unique visual identity and personality"},"loading-message")})]})]})},"pre-analyzing")]})}),!g&&!y&&t.jsxs(AB,{className:"p-4 pb-0",children:[t.jsx(vZ,{variant:"outline",onClick:x,className:"gap-1",children:"Go Back"}),t.jsxs(vZ,{onClick:async()=>{try{v(!0);const e=await c.mutateAsync();m(e),r&&r(e)}catch(e){v(!1),m(null),Ml({title:"Error generating brand settings",description:"Please try again.",variant:"destructive"})}},disabled:!u||c.isPending,className:"gap-1",children:[t.jsx(Ku,{className:"h-4 w-4 text-amber-500"}),c.isPending?t.jsx(hZ,{}):"Analyze Website"]})]})]})},Jle=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],ece=({initialBrandSettings:e,onSave:r,onBack:o,showAutoParseButton:i=!0})=>{const{data:a,isLoading:s,updateBrandSettings:l,isUpdatingBrandSettings:c}=zte(),[u,d]=n.useState({}),[p,f]=n.useState(!1),[h,m]=n.useState({}),[g,v]=n.useState(""),[y,b]=n.useState(""),[x,w]=n.useState("#000000"),[_,S]=n.useState(Date.now()),[E,T]=n.useState(!1),[C,A]=n.useState({identity:!0,colors:!0,personality:!0}),N=n.useRef(null),{toast:R}=jl();n.useEffect((()=>{if(e)return d({brandName:e.brandName,brandTagline:e.brandTagline,logoUrl:e.logoUrl,primaryColor:e.primaryColor||"#000000",secondaryColors:e.secondaryColors||[],brandPersonality:{tone:e.brandPersonality?.tone,voice:e.brandPersonality?.voice,values:e.brandPersonality?.values||[]}}),void S(Date.now());a?.branding&&(d({brandName:a.branding.brandName||a.name,brandTagline:a.branding.brandTagline||"",logoUrl:a.branding.logoUrl||"",primaryColor:a.branding.primaryColor||"#000000",secondaryColors:a.branding.secondaryColors||[],brandPersonality:{tone:a.branding.brandPersonality?.tone,voice:a.branding.brandPersonality?.voice,values:a.branding.brandPersonality?.values||[]}}),S(Date.now()))}),[a,e]);const O=e=>{A((t=>({...t,[e]:!t[e]})))},P=e=>{m((t=>{const n={...t,[e]:!t[e]};return n[e]&&("brandName"===e?v(u.brandName||""):"brandTagline"===e?v(u.brandTagline||""):"primaryColor"===e?v(u.primaryColor||"#000000"):"tone"===e?v(u.brandPersonality?.tone||""):"voice"===e&&v(u.brandPersonality?.voice||"")),n}))},k=e=>{"brandName"===e?d((e=>({...e,brandName:g}))):"brandTagline"===e?d((e=>({...e,brandTagline:g}))):"primaryColor"===e?d((e=>({...e,primaryColor:g}))):"tone"===e?d((e=>({...e,brandPersonality:{...e.brandPersonality,tone:g||void 0}}))):"voice"===e&&d((e=>({...e,brandPersonality:{...e.brandPersonality,voice:g||void 0}}))),P(e)},M=e=>{P(e)},j=e=>{d((t=>({...t,primaryColor:e})))},L=()=>{y.trim()&&(d((e=>{const t=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:[...t,y.trim()]}}})),b(""))};return s?t.jsx("div",{className:"flex justify-center items-center h-full min-h-[500px] w-full bg-white rounded-lg shadow-sm",children:t.jsx(hZ,{})}):p?t.jsx(Qle,{setAutoParse:f,onForceRefresh:()=>S(Date.now())}):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16",children:[t.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 px-6 pt-2",children:[t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("identity"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Identity"})]}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.identity?gu:fu,{className:"h-4 w-4"})})]}),C.identity&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Name"}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("brandName"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandName?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandName"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>k("brandName"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm font-medium",children:u.brandName})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Tagline"}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("brandTagline"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandTagline?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0,placeholder:"Your brand's tagline"}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandTagline"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>k("brandTagline"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm italic",children:u.brandTagline||"No tagline set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Logo"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Square image, 128x128px, PNG recommended"})]})}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-24 h-24 rounded-lg border-2 border-dashed border-gray-200 flex items-center justify-center bg-gray-50 overflow-hidden",children:u.logoUrl?t.jsx("img",{src:`${u.logoUrl}?${_}`,alt:u.brandName||"Brand logo",className:"w-full h-full object-contain"},_):t.jsx(Tu,{className:"h-10 w-10 text-gray-300"})}),t.jsxs("div",{className:"absolute inset-0 bg-black bg-opacity-40 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:[t.jsx("input",{type:"file",ref:N,onChange:e=>{const t=e.target.files?.[0];if(t){const e=new FileReader;e.onloadend=async()=>{const n=e.result.split(",")[1],r=URL.createObjectURL(t);d((e=>({...e,logoUrl:r}))),S(Date.now()),l({logoBase64:n})},e.readAsDataURL(t)}},accept:"image/*",className:"hidden"}),t.jsxs(vZ,{variant:"ghost",size:"sm",onClick:()=>{N.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[t.jsx(Zu,{className:"h-4 w-4 mr-1"}),"Update"]})]})]}),u.logoUrl&&t.jsxs("div",{className:"flex-1 flex items-center gap-2 max-w-md bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx("div",{className:"flex-1 truncate text-sm text-gray-600 font-mono",children:u.logoUrl}),t.jsxs(vZ,{variant:"ghost",size:"sm",onClick:()=>{u.logoUrl&&(navigator.clipboard.writeText(u.logoUrl),T(!0),setTimeout((()=>T(!1)),1500),R({title:"Logo URL copied to clipboard"}))},className:"h-7 px-2 text-xs shrink-0",children:[E?t.jsx(pu,{className:"h-3.5 w-3.5 mr-1 text-green-500"}):t.jsx(_u,{className:"h-3.5 w-3.5 mr-1"}),E?"Copied":"Copy"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("colors"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Colors"})]}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.colors?gu:fu,{className:"h-4 w-4"})})]}),C.colors&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Primary Color"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Your main brand color used throughout the interface"})]}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("primaryColor"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-14 h-14 rounded-lg shadow-md",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsxs("div",h.primaryColor?{className:"flex flex-1 gap-2 max-w-sm",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Iu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx(q3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"pl-10 h-10 font-mono text-sm flex-1",placeholder:"#000000",maxLength:7,autoFocus:!0})]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("primaryColor"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("primaryColor"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}:{className:"flex-1 max-w-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx(Iu,{className:"h-4 w-4 text-gray-400"}),t.jsx("div",{className:"text-sm font-mono",children:u.primaryColor||"#000000"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(q3,{type:"color",value:u.primaryColor||"#000000",onChange:e=>j(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:Jle.map(((e,n)=>t.jsx(vZ,{variant:"ghost",size:"icon",className:"w-6 h-6 rounded-full border border-gray-200 "+(u.primaryColor===e?"ring-2 ring-gray-400 ring-offset-1":""),style:{backgroundColor:e},onClick:()=>j(e)},n)))})]})]})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Secondary Colors"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Additional colors that complement your primary brand color"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"flex flex-wrap gap-3 mb-4",children:u.secondaryColors?.length?u.secondaryColors.map(((e,n)=>t.jsxs("div",{className:"group relative flex flex-col items-center",children:[t.jsx("div",{className:"w-12 h-12 rounded-lg shadow-sm border border-gray-200 mb-1 group-hover:ring-2 ring-gray-200",style:{backgroundColor:e}}),t.jsx("div",{className:"text-xs font-mono text-gray-600",children:e}),t.jsx(vZ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.secondaryColors||[];return{...e,secondaryColors:n.filter((e=>e!==t))}}));var t},className:"absolute -top-1 -right-1 w-5 h-5 bg-white rounded-full shadow border border-gray-200 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(rd,{className:"w-3 h-3 text-gray-500"})})]},n))):t.jsx("div",{className:"text-sm text-gray-500 italic my-2",children:"No secondary colors set"})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex-1 max-w-xs",children:[t.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Add color"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(q3,{type:"color",value:x,onChange:e=>w(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded-md"}),t.jsx(q3,{type:"text",value:x,onChange:e=>w(e.target.value),className:"h-10 font-mono text-sm",placeholder:"#000000",maxLength:7})]})]}),t.jsxs(vZ,{variant:"outline",onClick:()=>{x&&(d((e=>{const t=e.secondaryColors||[];return{...e,secondaryColors:[...t,x]}})),w("#000000"))},className:"h-10",children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add Color"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>O("personality"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Personality"})]}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(C.personality?gu:fu,{className:"h-4 w-4"})})]}),C.personality&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Tone"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"The overall feeling and attitude your brand conveys"})]}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("tone"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.tone?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("tone"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("tone"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.tone||"No tone set"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Voice"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"How your brand expresses itself in communication"})]}),t.jsx(vZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>P("voice"),children:t.jsx(Fu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.voice?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("voice"),children:t.jsx(rd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(vZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>k("voice"),children:t.jsx(pu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.voice||"No voice set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Values"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Core principles and beliefs that drive your brand"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"mb-4",children:t.jsx("div",u.brandPersonality?.values&&u.brandPersonality.values.length>0?{className:"flex flex-wrap gap-2",children:u.brandPersonality.values.map(((e,n)=>t.jsxs(kZ,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",style:{borderColor:`${u.primaryColor}30`||"#f3f4f6",backgroundColor:`${u.primaryColor}08`||"#f9fafb"},children:[e,t.jsx(vZ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:n.filter((e=>e!==t))}}}));var t},className:"ml-1.5 w-4 h-4 flex items-center justify-center rounded-full bg-gray-200 hover:bg-red-100 hover:text-red-500 transition-colors",children:t.jsx(rd,{className:"w-2.5 h-2.5"})})]},n)))}:{className:"text-sm text-gray-500 italic py-2",children:"No brand values set"})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(q3,{placeholder:"Add a brand value",value:y,onChange:e=>b(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&L()}),t.jsxs(vZ,{variant:"outline",onClick:L,disabled:!y.trim(),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),t.jsxs(AB,{className:"pb-4 px-6",children:[o?t.jsx(vZ,{variant:"outline",className:"gap-1.5",onClick:o,children:"Go Back"}):i&&t.jsxs(vZ,{variant:"outline",className:"gap-1.5",onClick:()=>{f(!0)},children:[t.jsx(Ku,{className:"h-4 w-4 text-amber-500"}),"Auto Parse"]}),t.jsx(vZ,{className:"px-4",style:{backgroundColor:u.primaryColor||void 0},onClick:async()=>{l({brandName:u.brandName,brandTagline:u.brandTagline,logoBase64:u.logoUrl,primaryColor:u.primaryColor,secondaryColors:u.secondaryColors,brandPersonality:u.brandPersonality}),R({title:"Brand settings saved 🚀"}),r&&r()},disabled:c,children:c?"Saving":"Save Changes"})]})]})};var tce=e=>"checkbox"===e.type,nce=e=>e instanceof Date,rce=e=>null==e;const oce=e=>"object"==typeof e;var ice=e=>!rce(e)&&!Array.isArray(e)&&oce(e)&&!nce(e),ace=e=>ice(e)&&e.target?tce(e.target)?e.target.checked:e.target.value:e,sce=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),lce="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function cce(e){let t;const n=Array.isArray(e),r="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(lce&&(e instanceof Blob||r)||!n&&!ice(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return ice(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=cce(e[n]));else t=e}return t}var uce=e=>Array.isArray(e)?e.filter(Boolean):[],dce=e=>void 0===e,pce=(e,t,n)=>{if(!t||!ice(e))return n;const r=uce(t.split(/[,[\].]+?/)).reduce(((e,t)=>rce(e)?e:e[t]),e);return dce(r)||r===e?dce(e[t])?n:e[t]:r},fce=e=>"boolean"==typeof e,hce=e=>/^\w*$/.test(e),mce=e=>uce(e.replace(/["|']|\]/g,"").split(/\.|\[/)),gce=(e,t,n)=>{let r=-1;const o=hce(t)?[t]:mce(t),i=o.length,a=i-1;for(;++r<i;){const t=o[r];let i=n;if(r!==a){const n=e[t];i=ice(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const vce="blur",yce="focusout",bce="change",xce="onBlur",wce="onChange",_ce="onSubmit",Sce="onTouched",Ece="all",Tce="max",Cce="min",Ace="maxLength",Nce="minLength",Rce="pattern",Oce="required",Pce="validate",kce=n.createContext(null),Mce=()=>n.useContext(kce);var jce=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const o=i;return t._proxyFormState[o]!==Ece&&(t._proxyFormState[o]=!r||Ece),n&&(n[o]=!0),e[o]}});return o},Lce=e=>rce(e)||!oce(e);function Dce(e,t){if(Lce(e)||Lce(t))return e===t;if(nce(e)&&nce(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const n=e[o];if(!r.includes(o))return!1;if("ref"!==o){const e=t[o];if(nce(n)&&nce(e)||ice(n)&&ice(e)||Array.isArray(n)&&Array.isArray(e)?!Dce(n,e):n!==e)return!1}}return!0}const Ice=(e,t)=>{const r=n.useRef(t);Dce(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var Fce=e=>"string"==typeof e,Uce=(e,t,n,r,o)=>Fce(e)?(r&&t.watch.add(e),pce(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),pce(n,e)))):(r&&(t.watchAll=!0),n);function $ce(e){const t=Mce(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=sce(i._names.array,r),l=function(e){const t=Mce(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return Ice((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c(Uce(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:pce(i._formValues,r,pce(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=Mce(),{control:r=t.control,disabled:o,name:i,exact:a}=e||{},[s,l]=n.useState(r._formState),c=n.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ice((()=>r._subscribe({name:i,formState:c.current,exact:a,callback:e=>{!o&&l({...r._formState,...e})}})),[i,o,a]),n.useEffect((()=>{c.current.isValid&&r._setValid(!0)}),[r]),n.useMemo((()=>jce(s,r,c.current,!1)),[s,r])}({control:i,name:r,exact:!0}),u=n.useRef(e),d=n.useRef(i.register(r,{...e.rules,value:l,...fce(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!pce(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!pce(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!pce(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!pce(c.validatingFields,r)},error:{enumerable:!0,get:()=>pce(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:ace(e),name:r},type:bce})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:pce(i._formValues,r),name:r},type:vce})),[r,i._formValues]),m=n.useCallback((e=>{const t=pce(i._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}),[i._fields,r]),g=n.useMemo((()=>({name:r,value:l,...fce(o)||c.disabled?{disabled:c.disabled||o}:{},onChange:f,onBlur:h,ref:m})),[r,o,c.disabled,f,h,m,l]);return n.useEffect((()=>{const e=i._options.shouldUnregister||a;i.register(r,{...u.current.rules,...fce(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=pce(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=cce(pce(i._options.defaultValues,r));gce(i._defaultValues,r,e),dce(pce(i._formValues,r))&&gce(i._formValues,r,e)}return!s&&i.register(r),()=>{(s?e&&!i._state.action:e)?i.unregister(r):t(r,!1)}}),[r,i,s,a]),n.useEffect((()=>{i._setDisabledField({disabled:o,name:r})}),[o,r,i]),n.useMemo((()=>({field:g,formState:c,fieldState:p})),[g,c,p])}const Vce=e=>e.render($ce(e));var Bce=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},zce=e=>Array.isArray(e)?e:[e],Hce=()=>{let e=[];return{get observers(){return e},next:t=>{for(const n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},qce=e=>ice(e)&&!Object.keys(e).length,Gce=e=>"file"===e.type,Kce=e=>"function"==typeof e,Wce=e=>{if(!lce)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Yce=e=>"select-multiple"===e.type,Xce=e=>"radio"===e.type,Zce=e=>Wce(e)&&e.isConnected;function Qce(e,t){const n=Array.isArray(t)?t:hce(t)?[t]:mce(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=dce(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(ice(r)&&qce(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!dce(e[t]))return!1;return!0}(r))&&Qce(e,n.slice(0,-1)),e}var Jce=e=>{for(const t in e)if(Kce(e[t]))return!0;return!1};function eue(e,t={}){const n=Array.isArray(e);if(ice(e)||n)for(const r in e)Array.isArray(e[r])||ice(e[r])&&!Jce(e[r])?(t[r]=Array.isArray(e[r])?[]:{},eue(e[r],t[r])):rce(e[r])||(t[r]=!0);return t}function tue(e,t,n){const r=Array.isArray(e);if(ice(e)||r)for(const o in e)Array.isArray(e[o])||ice(e[o])&&!Jce(e[o])?dce(t)||Lce(n[o])?n[o]=Array.isArray(e[o])?eue(e[o],[]):{...eue(e[o])}:tue(e[o],rce(t)?{}:t[o],n[o]):n[o]=!Dce(e[o],t[o]);return n}var nue=(e,t)=>tue(e,t,eue(t));const rue={value:!1,isValid:!1},oue={value:!0,isValid:!0};var iue=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!dce(e[0].attributes.value)?dce(e[0].value)||""===e[0].value?oue:{value:e[0].value,isValid:!0}:oue:rue}return rue},aue=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>dce(e)?e:t?""===e?NaN:e?+e:e:n&&Fce(e)?new Date(e):r?r(e):e;const sue={isValid:!1,value:null};var lue=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),sue):sue;function cue(e){const t=e.ref;return Gce(t)?t.files:Xce(t)?lue(e.refs).value:Yce(t)?[...t.selectedOptions].map((({value:e})=>e)):tce(t)?iue(e.refs).value:aue(dce(t.value)?e.ref.value:t.value,e)}var uue=e=>e instanceof RegExp,due=e=>dce(e)?e:uue(e)?e.source:ice(e)?uue(e.value)?e.value.source:e.value:e,pue=e=>({isOnSubmit:!e||e===_ce,isOnBlur:e===xce,isOnChange:e===wce,isOnAll:e===Ece,isOnTouch:e===Sce});const fue="AsyncFunction";var hue=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const mue=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=pce(e,o);if(n){const{_f:e,...i}=n;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],o)&&!r)return!0;if(e.ref&&t(e.ref,e.name)&&!r)return!0;if(mue(i,t))break}else if(ice(i)&&mue(i,t))break}}};function gue(e,t,n){const r=pce(e,n);if(r||hce(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=pce(t,r),a=pce(e,r);if(i&&!Array.isArray(i)&&n!==r)return{name:n};if(a&&a.type)return{name:r,error:a};o.pop()}return{name:n}}var vue=(e,t,n)=>{const r=zce(pce(e,n));return gce(r,"root",t[n]),gce(e,n,r),e},yue=e=>Fce(e);function bue(e,t,n="validate"){if(yue(e)||Array.isArray(e)&&e.every(yue)||fce(e)&&!e)return{type:n,message:yue(e)?e:"",ref:t}}var xue=e=>ice(e)&&!uue(e)?e:{value:e,message:""},wue=async(e,t,n,r,o,i)=>{const{ref:a,refs:s,required:l,maxLength:c,minLength:u,min:d,max:p,pattern:f,validate:h,name:m,valueAsNumber:g,mount:v}=e._f,y=pce(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,x=e=>{o&&b.reportValidity&&(b.setCustomValidity(fce(e)?"":e||""),b.reportValidity())},w={},_=Xce(a),S=tce(a),E=_||S,T=(g||Gce(a))&&dce(a.value)&&dce(y)||Wce(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=Bce.bind(null,m,r,w),A=(e,t,n,r=Ace,o=Nce)=>{const i=e?t:n;w[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(i?!Array.isArray(y)||!y.length:l&&(!E&&(T||rce(y))||fce(y)&&!y||S&&!iue(s).isValid||_&&!lue(s).isValid)){const{value:e,message:t}=yue(l)?{value:!!l,message:l}:xue(l);if(e&&(w[m]={type:Oce,message:t,ref:b,...C(Oce,t)},!r))return x(t),w}if(!(T||rce(d)&&rce(p))){let e,t;const n=xue(p),o=xue(d);if(rce(y)||isNaN(y)){const r=a.valueAsDate||new Date(y),i=e=>new Date((new Date).toDateString()+" "+e),s="time"==a.type,l="week"==a.type;Fce(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),Fce(o.value)&&y&&(t=s?i(y)<i(o.value):l?y<o.value:r<new Date(o.value))}else{const r=a.valueAsNumber||(y?+y:y);rce(n.value)||(e=r>n.value),rce(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,Tce,Cce),!r))return x(w[m].message),w}if((c||u)&&!T&&(Fce(y)||i&&Array.isArray(y))){const e=xue(c),t=xue(u),n=!rce(e.value)&&y.length>+e.value,o=!rce(t.value)&&y.length<+t.value;if((n||o)&&(A(n,e.message,t.message),!r))return x(w[m].message),w}if(f&&!T&&Fce(y)){const{value:e,message:t}=xue(f);if(uue(e)&&!y.match(e)&&(w[m]={type:Rce,message:t,ref:a,...C(Rce,t)},!r))return x(t),w}if(h)if(Kce(h)){const e=bue(await h(y,n),b);if(e&&(w[m]={...e,...C(Pce,e.message)},!r))return x(e.message),w}else if(ice(h)){let e={};for(const t in h){if(!qce(e)&&!r)break;const o=bue(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},x(o.message),r&&(w[m]=e))}if(!qce(e)&&(w[m]={ref:b,...e},!r))return w}return x(!0),w};const _ue={mode:_ce,reValidateMode:wce,shouldFocusError:!0};function Sue(e={}){let t={..._ue,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Kce(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1};const r={};let o,i=(ice(t.defaultValues)||ice(t.values))&&cce(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:cce(i),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let d={...u};const p={array:Hce(),state:Hce()},f=pue(t.mode),h=pue(t.reValidateMode),m=t.criteriaMode===Ece,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?qce((await w()).errors):await _(r,!0);e!==n.isValid&&p.state.next({isValid:e})}},v=(e,r)=>{!t.disabled&&(u.isValidating||u.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(r?gce(n.validatingFields,e,r):Qce(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!qce(n.validatingFields)}))},y=(e,t,n,o)=>{const l=pce(r,e);if(l){const r=pce(a,e,dce(n)?pce(i,e):n);dce(r)||o&&o.defaultChecked||t?gce(a,e,t?r:cue(l._f)):T(e,r),s.mount&&g()}},b=(e,r,o,a,s)=>{let l=!1,c=!1;const f={name:e};if(!t.disabled){if(!o||a){(u.isDirty||d.isDirty)&&(c=n.isDirty,n.isDirty=f.isDirty=S(),l=c!==f.isDirty);const t=Dce(pce(i,e),r);c=!!pce(n.dirtyFields,e),t?Qce(n.dirtyFields,e):gce(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=pce(n.touchedFields,e);t||(gce(n.touchedFields,e,o),f.touchedFields=n.touchedFields,l=l||(u.touchedFields||d.touchedFields)&&t!==o)}l&&s&&p.state.next(f)}return l?f:{}},x=(e,r,i,a)=>{const s=pce(n.errors,e),l=(u.isValid||d.isValid)&&fce(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{gce(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?gce(n.errors,e,i):Qce(n.errors,e)),(i?!Dce(s,i):s)||!qce(a)||l){const t={...a,...l&&fce(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{v(e,!0);const n=await t.resolver(a,t.context,((e,t,n,r)=>{const o={};for(const i of e){const e=pce(t,i);e&&gce(o,i,e._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}})(e||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return v(e),n},_=async(e,r,o={valid:!0})=>{for(const s in e){const c=e[s];if(c){const{_f:e,...d}=c;if(e){const d=l.array.has(e.name),p=c._f&&(!!(i=c._f)&&!!i.validate&&!!(Kce(i.validate)&&i.validate.constructor.name===fue||ice(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===fue))));p&&u.validatingFields&&v([s],!0);const f=await wue(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(pce(f,e.name)?d?vue(n.errors,f,e.name):gce(n.errors,e.name,f[e.name]):Qce(n.errors,e.name))}!qce(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&gce(a,e,n),!Dce(P(),i)),E=(e,t,n)=>Uce(e,l,{...s.mount?a:dce(t)?i:Fce(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=pce(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&gce(a,e,aue(t,n)),i=Wce(n.ref)&&rce(t)?"":t,Yce(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?tce(n.ref)?n.refs.length>1?n.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find((t=>t===e.value)):i===e.value))):n.refs[0]&&(n.refs[0].checked=!!i):n.refs.forEach((e=>e.checked=e.value===i)):Gce(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:cce(a)})))}(n.shouldDirty||n.shouldTouch)&&b(e,i,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&O(e)},C=(e,t,n)=>{for(const o in t){const i=t[o],a=`${e}.${o}`,s=pce(r,a);(l.array.has(e)||ice(i)||s&&!s._f)&&!nce(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=pce(r,e),f=l.array.has(e),h=cce(t);gce(a,e,h),f?(p.array.next({name:e,values:cce(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:nue(i,a),isDirty:S(e,h)})):!c||c._f||rce(h)?T(e,h,o):C(e,h,o),hue(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:cce(a)})},N=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=pce(r,c),E=e=>{y=Number.isNaN(e)||nce(e)&&isNaN(e.getTime())||Dce(e,pce(a,c,e))};if(S){let s,C;const A=i.type?cue(S._f):ace(e),N=e.type===vce||e.type===yce,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||pce(n.errors,c)||S._f.deps)||((e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e))(N,pce(n.touchedFields,c),n.isSubmitted,h,f),P=hue(c,l,N);gce(a,c,A),N?(S._f.onBlur&&S._f.onBlur(e),o&&o(0)):S._f.onChange&&S._f.onChange(e);const k=b(c,A,N),M=!qce(k)||P;if(!N&&p.state.next({name:c,type:e.type,values:cce(a)}),R)return(u.isValid||d.isValid)&&("onBlur"===t.mode?N&&g():N||g()),M&&p.state.next({name:c,...P?{}:k});if(!N&&P&&p.state.next({...n}),t.resolver){const{errors:e}=await w([c]);if(E(A),y){const t=gue(n.errors,r,c),o=gue(e,r,t.name||c);s=o.error,c=o.name,C=qce(e)}}else v([c],!0),s=(await wue(S,l.disabled,a,m,t.shouldUseNativeValidation))[c],v([c]),E(A),y&&(s?C=!1:(u.isValid||d.isValid)&&(C=await _(r,!0)));y&&(S._f.deps&&O(S._f.deps),x(c,C,s,k))}var T},R=(e,t)=>{if(pce(n.errors,t)&&e.focus)return e.focus(),1},O=async(e,o={})=>{let i,a;const s=zce(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=pce(t,r);e?gce(n.errors,r,e):Qce(n.errors,r)}else n.errors=t;return t})(dce(e)?e:s);i=qce(t),a=e?!s.some((e=>pce(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=pce(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!Fce(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&mue(r,R,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return dce(e)?t:Fce(e)?pce(t,e):e.map((e=>pce(t,e)))},k=(e,t)=>({invalid:!!pce((t||n).errors,e),isDirty:!!pce((t||n).dirtyFields,e),error:pce((t||n).errors,e),isValidating:!!pce(n.validatingFields,e),isTouched:!!pce((t||n).touchedFields,e)}),M=(e,t,o)=>{const i=(pce(r,e,{_f:{}})._f||{}).ref,a=pce(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;gce(n.errors,e,{...u,...t,ref:i}),p.state.next({name:e,errors:n.errors,isValid:!1}),o&&o.shouldFocus&&i&&i.focus&&i.focus()},j=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!zce(r).some((e=>e&&(i?e===o:e.startsWith(o)||o.startsWith(e))))||!((e,t,n,r)=>{n(e);const{name:o,...i}=e;return qce(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||Ece)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,L=(e,o={})=>{for(const s of e?zce(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(Qce(r,s),Qce(a,s)),!o.keepError&&Qce(n.errors,s),!o.keepDirty&&Qce(n.dirtyFields,s),!o.keepTouched&&Qce(n.touchedFields,s),!o.keepIsValidating&&Qce(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&Qce(i,s);p.state.next({values:cce(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},D=({disabled:e,name:t})=>{(fce(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=pce(r,e);const a=fce(n.disabled)||fce(t.disabled);return gce(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?D({disabled:fce(n.disabled)?n.disabled:t.disabled,name:e}):y(e,!0,n.value),{...a?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:due(n.min),max:due(n.max),minLength:due(n.minLength),maxLength:due(n.maxLength),pattern:due(n.pattern)}:{},name:e,onChange:N,onBlur:N,ref:a=>{if(a){I(e,n),o=pce(r,e);const t=dce(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>Xce(e)||tce(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;gce(r,e,{_f:{...o._f,...s?{refs:[...l.filter(Zce),t,...Array.isArray(pce(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=pce(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!sce(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&mue(r,R,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=cce(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await w();n.errors=e,c=t}else await _(r);if(l.disabled.size)for(const e of l.disabled)gce(c,e,void 0);if(Qce(n.errors,"root"),qce(n.errors)){p.state.next({errors:{}});try{await e(c,i)}catch(u){s=u}}else o&&await o({...n.errors},i),F(),setTimeout(F);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:qce(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?cce(e):i,d=cce(c),f=qce(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(nue(i,a))]);for(const t of Array.from(e))pce(n.dirtyFields,t)?gce(h,t,pce(a,t)):A(t,pce(h,t))}else{if(lce&&dce(e))for(const e of l.mount){const t=pce(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(Wce(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,pce(h,e))}a=cce(h),p.array.next({values:{...h}}),p.state.next({values:{...h}})}l={mount:o.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!u.isValid||!!o.keepIsValid||!!o.keepDirtyValues,s.watch=!!t.shouldUnregister,p.state.next({submitCount:o.keepSubmitCount?n.submitCount:0,isDirty:!f&&(o.keepDirty?n.isDirty:!(!o.keepDefaultValues||Dce(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?nue(i,a):n.dirtyFields:o.keepDefaultValues&&e?nue(i,e):o.keepDirty?n.dirtyFields:{},touchedFields:o.keepTouched?n.touchedFields:{},errors:o.keepErrors?n.errors:{},isSubmitSuccessful:!!o.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1})},V=(e,t)=>$(Kce(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:L,getFieldState:k,handleSubmit:U,setError:M,_subscribe:j,_runSchema:w,_getWatch:E,_getDirty:S,_setValid:g,_setFieldArray:(e,o=[],l,c,f=!0,h=!0)=>{if(c&&l&&!t.disabled){if(s.action=!0,h&&Array.isArray(pce(r,e))){const t=l(pce(r,e),c.argA,c.argB);f&&gce(r,e,t)}if(h&&Array.isArray(pce(n.errors,e))){const t=l(pce(n.errors,e),c.argA,c.argB);f&&gce(n.errors,e,t),((e,t)=>{!uce(pce(e,t)).length&&Qce(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(pce(n.touchedFields,e))){const t=l(pce(n.touchedFields,e),c.argA,c.argB);f&&gce(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=nue(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else gce(a,e,o)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>uce(pce(s.mount?a:i,e,t.shouldUnregister?pce(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>Kce(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=pce(r,e);t&&(t._f.refs?t._f.refs.every((e=>!Zce(e))):!Zce(t._f.ref))&&L(e)}l.unMount=new Set},_disableForm:e=>{fce(e)&&(p.state.next({disabled:e}),mue(r,((t,n)=>{const o=pce(r,n);o&&(t.disabled=o._f.disabled||e,Array.isArray(o._f.refs)&&o._f.refs.forEach((t=>{t.disabled=o._f.disabled||e})))}),0,!1))},_subjects:p,_proxyFormState:u,get _fields(){return r},get _formValues(){return a},get _state(){return s},set _state(e){s=e},get _defaultValues(){return i},get _names(){return l},set _names(e){l=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e}}},subscribe:e=>(s.mount=!0,d={...d,...e.formState},j({...e,formState:d})),trigger:O,register:I,handleSubmit:U,watch:(e,t)=>Kce(e)?p.state.subscribe({next:n=>e(E(void 0,t),n)}):E(e,t,!0),setValue:A,getValues:P,reset:V,resetField:(e,t={})=>{pce(r,e)&&(dce(t.defaultValue)?A(e,cce(pce(i,e))):(A(e,t.defaultValue),gce(i,e,cce(t.defaultValue))),t.keepTouched||Qce(n.touchedFields,e),t.keepDirty||(Qce(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,cce(pce(i,e))):S()),t.keepError||(Qce(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&zce(e).forEach((e=>Qce(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:L,setError:M,setFocus:(e,t={})=>{const n=pce(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&Kce(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const Eue="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Tue(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:Kce(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Kce(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:Sue(e),formState:o},e.formControl&&e.defaultValues&&!Kce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Eue((()=>{const e=a._subscribe({formState:a._proxyFormState,callback:()=>i({...a._formState}),reRenderRoot:!0});return i((e=>({...e,isReady:!0}))),e}),[a]),n.useEffect((()=>a._disableForm(e.disabled)),[a,e.disabled]),n.useEffect((()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode),e.errors&&!qce(e.errors)&&a._setErrors(e.errors)}),[a,e.errors,e.mode,e.reValidateMode]),n.useEffect((()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})}),[a,e.shouldUnregister]),n.useEffect((()=>{if(a._proxyFormState.isDirty){const e=a._getDirty();e!==o.isDirty&&a._subjects.state.next({isDirty:e})}}),[a,o.isDirty]),n.useEffect((()=>{e.values&&!Dce(e.values,r.current)?(a._reset(e.values,a._options.resetOptions),r.current=e.values,i((e=>({...e})))):a._resetDefaultValues()}),[a,e.values]),n.useEffect((()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()})),t.current.formState=jce(o,a),t.current}const Cue=(e,t,n)=>{if(e&&"reportValidity"in e){const r=pce(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Aue=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Cue(r.ref,n,e):r.refs&&r.refs.forEach((t=>Cue(t,n,e)))}},Nue=(e,t)=>{t.shouldUseNativeValidation&&Aue(e,t);const n={};for(const r in e){const o=pce(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Rue(t.names||Object.keys(e),r)){const e=Object.assign({},pce(n,r));gce(e,"root",i),gce(n,r,e)}else gce(n,r,i)}return n},Rue=(e,t)=>e.some((e=>e.startsWith(t+".")));var Oue=function(e,t){for(var n={};e.length;){var r=e[0],o=r.code,i=r.message,a=r.path.join(".");if(!n[a])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[a]={message:s.message,type:s.code}}else n[a]={message:i,type:o};if("unionErrors"in r&&r.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var l=n[a].types,c=l&&l[r.code];n[a]=Bce(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},Pue=function(e,t,n){return void 0===n&&(n={}),function(r,o,i){try{return Promise.resolve(function(o,a){try{var s=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](r,t)).then((function(e){return i.shouldUseNativeValidation&&Aue({},i),{errors:{},values:n.raw?r:e}}))}catch(l){return a(l)}return s&&s.then?s.then(void 0,a):s}(0,(function(e){if(t=e,Array.isArray(null==t?void 0:t.errors))return{values:{},errors:Nue(Oue(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};const kue="reach-styles-module__base___r-a1U",Mue=ru([kue],{variants:{variant:{default:"reach-styles-module__default___vu2Rt",primary:"reach-styles-module__primary___mGKjo",success:"reach-styles-module__success___xn1Y1",warning:"reach-styles-module__warning___jdyU9",error:"reach-styles-module__error___Z-3IS"},size:{default:"reach-styles-module__sizeDefault___oS6W2",sm:"reach-styles-module__sizeSm___GI826",lg:"reach-styles-module__sizeLg___J--WF"},position:{default:"reach-styles-module__positionDefault___visr6",top:"reach-styles-module__positionTop___y6h-n",bottom:"reach-styles-module__positionBottom___vYLkd",inline:"reach-styles-module__positionInline___NjZsw"}},defaultVariants:{variant:"default",size:"default",position:"default"}}),jue=e=>{const{children:t,...r}=e;return n.createElement(kce.Provider,{value:r},t)},Lue=i.createContext({}),Due=({...e})=>t.jsx(Lue.Provider,{value:{name:e.name},children:t.jsx(Vce,{...e})}),Iue=()=>{const e=i.useContext(Lue),t=i.useContext(Fue),{getFieldState:n,formState:r}=Mce(),o=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...o}},Fue=i.createContext({}),Uue=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(Fue.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:Zd("space-y-2",e),...n})})}));Uue.displayName="FormItem";const $ue=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=Iue();return t.jsx(L9,{ref:r,className:Zd(o&&"text-destructive",e),htmlFor:i,...n})}));$ue.displayName="FormLabel";const Vue=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=Iue();return t.jsx(ZU,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));Vue.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=Iue();return t.jsx("p",{ref:r,id:o,className:Zd("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const Bue=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=Iue(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:Zd("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));Bue.displayName="FormMessage";const zue=({control:e,disabled:n,legalNameRef:r})=>t.jsxs(t.Fragment,{children:[t.jsx(Due,{control:e,name:"company.legalName",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Legal Company Name"}),t.jsx(Vue,{children:t.jsx(q3,{...e,ref:r,disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"company.type",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Company Type"}),t.jsxs(cte,{onValueChange:e.onChange,defaultValue:e.value,disabled:n,children:[t.jsx(Vue,{children:t.jsx(dte,{className:"h-8",children:t.jsx(ute,{placeholder:"Select company type"})})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"corporation",children:"Corporation"}),t.jsx(mte,{value:"llc",children:"LLC"})]})]}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"company.ein",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"EIN (Employer Identification Number)"}),t.jsx(Vue,{children:t.jsx(q3,{...e,type:"text",disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})})]}),Hue=({control:e,disabled:n})=>t.jsxs(t.Fragment,{children:[t.jsx(Due,{control:e,name:"representative.title",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Title"}),t.jsx(Vue,{children:t.jsx(q3,{...e,disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"representative.firstName",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"First Name"}),t.jsx(Vue,{children:t.jsx(q3,{...e,disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"representative.email",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Email"}),t.jsx(Vue,{children:t.jsx(q3,{...e,type:"email",disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"representative.phone",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Contact Phone Number"}),t.jsx(Vue,{children:t.jsx(q3,{...e,type:"tel",disabled:n,className:"h-8"})}),t.jsx(Bue,{className:"text-xs"})]})}),t.jsx(Due,{control:e,name:"representative.position",render:({field:e})=>t.jsxs(Uue,{className:"space-y-1",children:[t.jsx($ue,{className:"text-sm",children:"Position"}),t.jsxs(cte,{onValueChange:e.onChange,defaultValue:e.value,disabled:n,children:[t.jsx(Vue,{children:t.jsx(dte,{className:"h-8",children:t.jsx(ute,{placeholder:"Select position"})})}),t.jsxs(hte,{children:[t.jsx(mte,{value:"owner",children:"Owner"}),t.jsx(mte,{value:"manager",children:"Manager"}),t.jsx(mte,{value:"director",children:"Director"})]})]}),t.jsx(Bue,{className:"text-xs"})]})})]});var que,Gue,Kue;(Gue=que||(que={})).assertEqual=e=>e,Gue.assertIs=function(e){},Gue.assertNever=function(e){throw new Error},Gue.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Gue.getValidEnumValues=e=>{const t=Gue.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return Gue.objectValues(n)},Gue.objectValues=e=>Gue.objectKeys(e).map((function(t){return e[t]})),Gue.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},Gue.find=(e,t)=>{for(const n of e)if(t(n))return n},Gue.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,Gue.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},Gue.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Kue||(Kue={})).mergeShapes=(e,t)=>({...e,...t});const Wue=que.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yue=e=>{switch(typeof e){case"undefined":return Wue.undefined;case"string":return Wue.string;case"number":return isNaN(e)?Wue.nan:Wue.number;case"boolean":return Wue.boolean;case"function":return Wue.function;case"bigint":return Wue.bigint;case"symbol":return Wue.symbol;case"object":return Array.isArray(e)?Wue.array:null===e?Wue.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Wue.promise:"undefined"!=typeof Map&&e instanceof Map?Wue.map:"undefined"!=typeof Set&&e instanceof Set?Wue.set:"undefined"!=typeof Date&&e instanceof Date?Wue.date:Wue.object;default:return Wue.unknown}},Xue=que.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Zue extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const o of e.issues)if("invalid_union"===o.code)o.unionErrors.map(r);else if("invalid_return_type"===o.code)r(o.returnTypeError);else if("invalid_arguments"===o.code)r(o.argumentsError);else if(0===o.path.length)n._errors.push(t(o));else{let e=n,r=0;for(;r<o.path.length;){const n=o.path[r];r===o.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Zue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,que.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Zue.create=e=>new Zue(e);const Que=(e,t)=>{let n;switch(e.code){case Xue.invalid_type:n=e.received===Wue.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Xue.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,que.jsonStringifyReplacer)}`;break;case Xue.unrecognized_keys:n=`Unrecognized key(s) in object: ${que.joinValues(e.keys,", ")}`;break;case Xue.invalid_union:n="Invalid input";break;case Xue.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${que.joinValues(e.options)}`;break;case Xue.invalid_enum_value:n=`Invalid enum value. Expected ${que.joinValues(e.options)}, received '${e.received}'`;break;case Xue.invalid_arguments:n="Invalid function arguments";break;case Xue.invalid_return_type:n="Invalid function return type";break;case Xue.invalid_date:n="Invalid date";break;case Xue.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:que.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Xue.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Xue.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Xue.custom:n="Invalid input";break;case Xue.invalid_intersection_types:n="Intersection results could not be merged";break;case Xue.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Xue.not_finite:n="Number must be finite";break;default:n=t.defaultError,que.assertNever(e)}return{message:n}};let Jue=Que;function ede(){return Jue}const tde=e=>{const{data:t,path:n,errorMaps:r,issueData:o}=e,i=[...n,...o.path||[]],a={...o,path:i};if(void 0!==o.message)return{...o,path:i,message:o.message};let s="";const l=r.filter((e=>!!e)).slice().reverse();for(const c of l)s=c(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function nde(e,t){const n=ede(),r=tde({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Que?void 0:Que].filter((e=>!!e))});e.common.issues.push(r)}class rde{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return ode;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return rde.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:o}=r;if("aborted"===t.status)return ode;if("aborted"===o.status)return ode;"dirty"===t.status&&e.dirty(),"dirty"===o.status&&e.dirty(),"__proto__"===t.value||void 0===o.value&&!r.alwaysSet||(n[t.value]=o.value)}return{status:e.value,value:n}}}const ode=Object.freeze({status:"aborted"}),ide=e=>({status:"dirty",value:e}),ade=e=>({status:"valid",value:e}),sde=e=>"aborted"===e.status,lde=e=>"dirty"===e.status,cde=e=>"valid"===e.status,ude=e=>"undefined"!=typeof Promise&&e instanceof Promise;function dde(e,t,n,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function pde(e,t,n,r,o){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var fde,hde,mde,gde;"function"==typeof SuppressedError&&SuppressedError,(hde=fde||(fde={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},hde.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class vde{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const yde=(e,t)=>{if(cde(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Zue(e.common.issues);return this._error=t,this._error}}};function bde(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:o}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:o};return{errorMap:(t,o)=>{var i,a;const{message:s}=e;return"invalid_enum_value"===t.code?{message:null!=s?s:o.defaultError}:void 0===o.data?{message:null!==(i=null!=s?s:r)&&void 0!==i?i:o.defaultError}:"invalid_type"!==t.code?{message:o.defaultError}:{message:null!==(a=null!=s?s:n)&&void 0!==a?a:o.defaultError}},description:o}}class xde{get description(){return this._def.description}_getType(e){return Yue(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Yue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rde,ctx:{common:e.parent.common,data:e.data,parsedType:Yue(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ude(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yue(e)},o=this._parseSync({data:e,path:r.path,parent:r});return yde(r,o)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yue(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return cde(t)?{value:t.value}:{issues:r.common.issues}}catch(eEe){(null===(n=null===(t=null==eEe?void 0:eEe.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then((e=>cde(e)?{value:e.value}:{issues:r.common.issues}))}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Yue(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(ude(r)?r:Promise.resolve(r));return yde(n,o)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,r)=>{const o=e(t),i=()=>r.addIssue({code:Xue.custom,...n(t)});return"undefined"!=typeof Promise&&o instanceof Promise?o.then((e=>!!e||(i(),!1))):!!o||(i(),!1)}))}refinement(e,t){return this._refinement(((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1)))}_refinement(e){return new wpe({schema:this,typeName:jpe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return _pe.create(this,this._def)}nullable(){return Spe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return npe.create(this)}promise(){return xpe.create(this,this._def)}or(e){return ipe.create([this,e],this._def)}and(e){return cpe.create(this,e,this._def)}transform(e){return new wpe({...bde(this._def),schema:this,typeName:jpe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Epe({...bde(this._def),innerType:this,defaultValue:t,typeName:jpe.ZodDefault})}brand(){return new Npe({typeName:jpe.ZodBranded,type:this,...bde(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Tpe({...bde(this._def),innerType:this,catchValue:t,typeName:jpe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Rpe.create(this,e)}readonly(){return Ope.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const wde=/^c[^\s-]{8,}$/i,_de=/^[0-9a-z]+$/,Sde=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ede=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Tde=/^[a-z0-9_-]{21}$/i,Cde=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ade=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Nde=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Rde;const Ode=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Pde=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,kde=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Mde=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jde=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Lde=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dde="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ide=new RegExp(`^${Dde}$`);function Fde(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function Ude(e){return new RegExp(`^${Fde(e)}$`)}function $de(e){let t=`${Dde}T${Fde(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Vde(e,t){if(!Cde.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return"object"==typeof o&&null!==o&&(!(!o.typ||!o.alg)&&(!t||o.alg===t))}catch(tEe){return!1}}function Bde(e,t){return!("v4"!==t&&t||!Pde.test(e))||!("v6"!==t&&t||!Mde.test(e))}class zde extends xde{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Wue.string){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.string,received:t.parsedType}),ode}const t=new rde;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const r=e.data.length>i.value,o=e.data.length<i.value;(r||o)&&(n=this._getOrReturnCtx(e,n),r?nde(n,{code:Xue.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&nde(n,{code:Xue.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)Nde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"email",code:Xue.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Rde||(Rde=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Rde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"emoji",code:Xue.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)Ede.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"uuid",code:Xue.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)Tde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"nanoid",code:Xue.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)wde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"cuid",code:Xue.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)_de.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"cuid2",code:Xue.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)Sde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"ulid",code:Xue.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(tEe){n=this._getOrReturnCtx(e,n),nde(n,{validation:"url",code:Xue.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"regex",code:Xue.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){$de(i).test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Ide.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){Ude(i).test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?Ade.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"duration",code:Xue.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!Ode.test(r))&&("v6"!==o&&o||!kde.test(r))&&(n=this._getOrReturnCtx(e,n),nde(n,{validation:"ip",code:Xue.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?Vde(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"jwt",code:Xue.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Bde(e.data,i.version)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"cidr",code:Xue.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?jde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"base64",code:Xue.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Lde.test(e.data)||(n=this._getOrReturnCtx(e,n),nde(n,{validation:"base64url",code:Xue.invalid_string,message:i.message}),t.dirty()):que.assertNever(i);var r,o;return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:Xue.invalid_string,...fde.errToObj(n)})}_addCheck(e){return new zde({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...fde.errToObj(e)})}url(e){return this._addCheck({kind:"url",...fde.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...fde.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...fde.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...fde.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...fde.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...fde.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...fde.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...fde.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...fde.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...fde.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...fde.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...fde.errToObj(e)})}datetime(e){var t,n;return this._addCheck("string"==typeof e?{kind:"datetime",precision:null,offset:!1,local:!1,message:e}:{kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...fde.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return this._addCheck("string"==typeof e?{kind:"time",precision:null,message:e}:{kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...fde.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...fde.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...fde.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...fde.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...fde.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...fde.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...fde.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...fde.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...fde.errToObj(t)})}nonempty(e){return this.min(1,fde.errToObj(e))}trim(){return new zde({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new zde({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new zde({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Hde(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r;return parseInt(e.toFixed(o).replace(".",""))%parseInt(t.toFixed(o).replace(".",""))/Math.pow(10,o)}zde.create=e=>{var t;return new zde({checks:[],typeName:jpe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...bde(e)})};class qde extends xde{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==Wue.number){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.number,received:t.parsedType}),ode}let t;const n=new rde;for(const r of this._def.checks)if("int"===r.kind)que.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==Hde(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.not_finite,message:r.message}),n.dirty()):que.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,fde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,fde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,fde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,fde.toString(t))}setLimit(e,t,n,r){return new qde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:fde.toString(r)}]})}_addCheck(e){return new qde({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:fde.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:fde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:fde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:fde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:fde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:fde.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:fde.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:fde.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:fde.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&que.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}qde.create=e=>new qde({checks:[],typeName:jpe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...bde(e)});class Gde extends xde{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(tEe){return this._getInvalidInput(e)}if(this._getType(e)!==Wue.bigint)return this._getInvalidInput(e);let t;const n=new rde;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),nde(t,{code:Xue.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):que.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.bigint,received:t.parsedType}),ode}gte(e,t){return this.setLimit("min",e,!0,fde.toString(t))}gt(e,t){return this.setLimit("min",e,!1,fde.toString(t))}lte(e,t){return this.setLimit("max",e,!0,fde.toString(t))}lt(e,t){return this.setLimit("max",e,!1,fde.toString(t))}setLimit(e,t,n,r){return new Gde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:fde.toString(r)}]})}_addCheck(e){return new Gde({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:fde.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:fde.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:fde.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:fde.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:fde.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Gde.create=e=>{var t;return new Gde({checks:[],typeName:jpe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...bde(e)})};class Kde extends xde{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Wue.boolean){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.boolean,received:t.parsedType}),ode}return ade(e.data)}}Kde.create=e=>new Kde({typeName:jpe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...bde(e)});class Wde extends xde{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Wue.date){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.date,received:t.parsedType}),ode}if(isNaN(e.data.getTime())){return nde(this._getOrReturnCtx(e),{code:Xue.invalid_date}),ode}const t=new rde;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),nde(n,{code:Xue.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):que.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Wde({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:fde.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:fde.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Wde.create=e=>new Wde({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:jpe.ZodDate,...bde(e)});class Yde extends xde{_parse(e){if(this._getType(e)!==Wue.symbol){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.symbol,received:t.parsedType}),ode}return ade(e.data)}}Yde.create=e=>new Yde({typeName:jpe.ZodSymbol,...bde(e)});class Xde extends xde{_parse(e){if(this._getType(e)!==Wue.undefined){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.undefined,received:t.parsedType}),ode}return ade(e.data)}}Xde.create=e=>new Xde({typeName:jpe.ZodUndefined,...bde(e)});class Zde extends xde{_parse(e){if(this._getType(e)!==Wue.null){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.null,received:t.parsedType}),ode}return ade(e.data)}}Zde.create=e=>new Zde({typeName:jpe.ZodNull,...bde(e)});class Qde extends xde{constructor(){super(...arguments),this._any=!0}_parse(e){return ade(e.data)}}Qde.create=e=>new Qde({typeName:jpe.ZodAny,...bde(e)});class Jde extends xde{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ade(e.data)}}Jde.create=e=>new Jde({typeName:jpe.ZodUnknown,...bde(e)});class epe extends xde{_parse(e){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.never,received:t.parsedType}),ode}}epe.create=e=>new epe({typeName:jpe.ZodNever,...bde(e)});class tpe extends xde{_parse(e){if(this._getType(e)!==Wue.undefined){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.void,received:t.parsedType}),ode}return ade(e.data)}}tpe.create=e=>new tpe({typeName:jpe.ZodVoid,...bde(e)});class npe extends xde{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Wue.array)return nde(t,{code:Xue.invalid_type,expected:Wue.array,received:t.parsedType}),ode;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(nde(t,{code:e?Xue.too_big:Xue.too_small,minimum:o?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(nde(t,{code:Xue.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(nde(t,{code:Xue.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>r.type._parseAsync(new vde(t,e,t.path,n))))).then((e=>rde.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new vde(t,e,t.path,n))));return rde.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new npe({...this._def,minLength:{value:e,message:fde.toString(t)}})}max(e,t){return new npe({...this._def,maxLength:{value:e,message:fde.toString(t)}})}length(e,t){return new npe({...this._def,exactLength:{value:e,message:fde.toString(t)}})}nonempty(e){return this.min(1,e)}}function rpe(e){if(e instanceof ope){const t={};for(const n in e.shape){t[n]=_pe.create(rpe(e.shape[n]))}return new ope({...e._def,shape:()=>t})}return e instanceof npe?new npe({...e._def,type:rpe(e.element)}):e instanceof _pe?_pe.create(rpe(e.unwrap())):e instanceof Spe?Spe.create(rpe(e.unwrap())):e instanceof upe?upe.create(e.items.map((e=>rpe(e)))):e}npe.create=(e,t)=>new npe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:jpe.ZodArray,...bde(t)});class ope extends xde{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=que.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Wue.object){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.object,received:t.parsedType}),ode}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof epe&&"strip"===this._def.unknownKeys))for(const s in n.data)o.includes(s)||i.push(s);const a=[];for(const s of o){a.push({key:{status:"valid",value:s},value:r[s]._parse(new vde(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof epe){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of i)a.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)i.length>0&&(nde(n,{code:Xue.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){a.push({key:{status:"valid",value:t},value:e._parse(new vde(n,n.data[t],n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of a){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e})).then((e=>rde.mergeObjectSync(t,e))):rde.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new ope({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,o,i,a;const s=null!==(i=null===(o=(r=this._def).errorMap)||void 0===o?void 0:o.call(r,t,n).message)&&void 0!==i?i:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(a=fde.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new ope({...this._def,unknownKeys:"strip"})}passthrough(){return new ope({...this._def,unknownKeys:"passthrough"})}extend(e){return new ope({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ope({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:jpe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ope({...this._def,catchall:e})}pick(e){const t={};return que.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new ope({...this._def,shape:()=>t})}omit(e){const t={};return que.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new ope({...this._def,shape:()=>t})}deepPartial(){return rpe(this)}partial(e){const t={};return que.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new ope({...this._def,shape:()=>t})}required(e){const t={};return que.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof _pe;)e=e._def.innerType;t[n]=e}})),new ope({...this._def,shape:()=>t})}keyof(){return vpe(que.objectKeys(this.shape))}}ope.create=(e,t)=>new ope({shape:()=>e,unknownKeys:"strip",catchall:epe.create(),typeName:jpe.ZodObject,...bde(t)}),ope.strictCreate=(e,t)=>new ope({shape:()=>e,unknownKeys:"strict",catchall:epe.create(),typeName:jpe.ZodObject,...bde(t)}),ope.lazycreate=(e,t)=>new ope({shape:e,unknownKeys:"strip",catchall:epe.create(),typeName:jpe.ZodObject,...bde(t)});class ipe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map((e=>new Zue(e.ctx.common.issues)));return nde(t,{code:Xue.invalid_union,unionErrors:n}),ode}));{let e;const r=[];for(const i of n){const n={...t,common:{...t.common,issues:[]},parent:null},o=i._parseSync({data:t.data,path:t.path,parent:n});if("valid"===o.status)return o;"dirty"!==o.status||e||(e={result:o,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const o=r.map((e=>new Zue(e)));return nde(t,{code:Xue.invalid_union,unionErrors:o}),ode}}get options(){return this._def.options}}ipe.create=(e,t)=>new ipe({options:e,typeName:jpe.ZodUnion,...bde(t)});const ape=e=>e instanceof mpe?ape(e.schema):e instanceof wpe?ape(e.innerType()):e instanceof gpe?[e.value]:e instanceof ype?e.options:e instanceof bpe?que.objectValues(e.enum):e instanceof Epe?ape(e._def.innerType):e instanceof Xde?[void 0]:e instanceof Zde?[null]:e instanceof _pe?[void 0,...ape(e.unwrap())]:e instanceof Spe?[null,...ape(e.unwrap())]:e instanceof Npe||e instanceof Ope?ape(e.unwrap()):e instanceof Tpe?ape(e._def.innerType):[];class spe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Wue.object)return nde(t,{code:Xue.invalid_type,expected:Wue.object,received:t.parsedType}),ode;const n=this.discriminator,r=this.optionsMap.get(t.data[n]);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(nde(t,{code:Xue.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ode)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const o of t){const t=ape(o.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,o)}}return new spe({typeName:jpe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...bde(n)})}}function lpe(e,t){const n=Yue(e),r=Yue(t);if(e===t)return{valid:!0,data:e};if(n===Wue.object&&r===Wue.object){const n=que.objectKeys(t),r=que.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=lpe(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===Wue.array&&r===Wue.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=lpe(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===Wue.date&&r===Wue.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class cpe extends xde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(sde(e)||sde(r))return ode;const o=lpe(e.value,r.value);return o.valid?((lde(e)||lde(r))&&t.dirty(),{status:t.value,value:o.data}):(nde(n,{code:Xue.invalid_intersection_types}),ode)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>r(e,t))):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}cpe.create=(e,t,n)=>new cpe({left:e,right:t,typeName:jpe.ZodIntersection,...bde(n)});class upe extends xde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wue.array)return nde(n,{code:Xue.invalid_type,expected:Wue.array,received:n.parsedType}),ode;if(n.data.length<this._def.items.length)return nde(n,{code:Xue.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ode;!this._def.rest&&n.data.length>this._def.items.length&&(nde(n,{code:Xue.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map(((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new vde(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>rde.mergeArray(t,e))):rde.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new upe({...this._def,rest:e})}}upe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new upe({items:e,typeName:jpe.ZodTuple,rest:null,...bde(t)})};class dpe extends xde{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wue.object)return nde(n,{code:Xue.invalid_type,expected:Wue.object,received:n.parsedType}),ode;const r=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)r.push({key:o._parse(new vde(n,a,n.path,a)),value:i._parse(new vde(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?rde.mergeObjectAsync(t,r):rde.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new dpe(t instanceof xde?{keyType:e,valueType:t,typeName:jpe.ZodRecord,...bde(n)}:{keyType:zde.create(),valueType:e,typeName:jpe.ZodRecord,...bde(t)})}}class ppe extends xde{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wue.map)return nde(n,{code:Xue.invalid_type,expected:Wue.map,received:n.parsedType}),ode;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new vde(n,e,n.path,[i,"key"])),value:o._parse(new vde(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of i){const r=await n.key,o=await n.value;if("aborted"===r.status||"aborted"===o.status)return ode;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of i){const r=n.key,o=n.value;if("aborted"===r.status||"aborted"===o.status)return ode;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}ppe.create=(e,t,n)=>new ppe({valueType:t,keyType:e,typeName:jpe.ZodMap,...bde(n)});class fpe extends xde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wue.set)return nde(n,{code:Xue.invalid_type,expected:Wue.set,received:n.parsedType}),ode;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(nde(n,{code:Xue.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(nde(n,{code:Xue.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const o=this._def.valueType;function i(e){const n=new Set;for(const r of e){if("aborted"===r.status)return ode;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const a=[...n.data.values()].map(((e,t)=>o._parse(new vde(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new fpe({...this._def,minSize:{value:e,message:fde.toString(t)}})}max(e,t){return new fpe({...this._def,maxSize:{value:e,message:fde.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}fpe.create=(e,t)=>new fpe({valueType:e,minSize:null,maxSize:null,typeName:jpe.ZodSet,...bde(t)});class hpe extends xde{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Wue.function)return nde(t,{code:Xue.invalid_type,expected:Wue.function,received:t.parsedType}),ode;function n(e,n){return tde({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ede(),Que].filter((e=>!!e)),issueData:{code:Xue.invalid_arguments,argumentsError:n}})}function r(e,n){return tde({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ede(),Que].filter((e=>!!e)),issueData:{code:Xue.invalid_return_type,returnTypeError:n}})}const o={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof xpe){const e=this;return ade((async function(...t){const a=new Zue([]),s=await e._def.args.parseAsync(t,o).catch((e=>{throw a.addIssue(n(t,e)),a})),l=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(l,o).catch((e=>{throw a.addIssue(r(l,e)),a}))}))}{const e=this;return ade((function(...t){const a=e._def.args.safeParse(t,o);if(!a.success)throw new Zue([n(t,a.error)]);const s=Reflect.apply(i,this,a.data),l=e._def.returns.safeParse(s,o);if(!l.success)throw new Zue([r(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new hpe({...this._def,args:upe.create(e).rest(Jde.create())})}returns(e){return new hpe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new hpe({args:e||upe.create([]).rest(Jde.create()),returns:t||Jde.create(),typeName:jpe.ZodFunction,...bde(n)})}}class mpe extends xde{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}mpe.create=(e,t)=>new mpe({getter:e,typeName:jpe.ZodLazy,...bde(t)});class gpe extends xde{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return nde(t,{received:t.data,code:Xue.invalid_literal,expected:this._def.value}),ode}return{status:"valid",value:e.data}}get value(){return this._def.value}}function vpe(e,t){return new ype({values:e,typeName:jpe.ZodEnum,...bde(t)})}gpe.create=(e,t)=>new gpe({value:e,typeName:jpe.ZodLiteral,...bde(t)});class ype extends xde{constructor(){super(...arguments),mde.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return nde(t,{expected:que.joinValues(this._def.values),received:t.parsedType,code:Xue.invalid_type}),ode}if(dde(this,mde)||pde(this,mde,new Set(this._def.values)),!dde(this,mde).has(e.data)){const t=this._getOrReturnCtx(e);return nde(t,{received:t.data,code:Xue.invalid_enum_value,options:this._def.values}),ode}return ade(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ype.create(e,{...this._def,...t})}exclude(e,t=this._def){return ype.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}mde=new WeakMap,ype.create=vpe;class bpe extends xde{constructor(){super(...arguments),gde.set(this,void 0)}_parse(e){const t=que.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Wue.string&&n.parsedType!==Wue.number){const e=que.objectValues(t);return nde(n,{expected:que.joinValues(e),received:n.parsedType,code:Xue.invalid_type}),ode}if(dde(this,gde)||pde(this,gde,new Set(que.getValidEnumValues(this._def.values))),!dde(this,gde).has(e.data)){const e=que.objectValues(t);return nde(n,{received:n.data,code:Xue.invalid_enum_value,options:e}),ode}return ade(e.data)}get enum(){return this._def.values}}gde=new WeakMap,bpe.create=(e,t)=>new bpe({values:e,typeName:jpe.ZodNativeEnum,...bde(t)});class xpe extends xde{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Wue.promise&&!1===t.common.async)return nde(t,{code:Xue.invalid_type,expected:Wue.promise,received:t.parsedType}),ode;const n=t.parsedType===Wue.promise?t.data:Promise.resolve(t.data);return ade(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}xpe.create=(e,t)=>new xpe({type:e,typeName:jpe.ZodPromise,...bde(t)});class wpe extends xde{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===jpe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:e=>{nde(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),"preprocess"===r.type){const e=r.transform(n.data,o);if(n.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return ode;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?ode:"dirty"===r.status||"dirty"===t.value?ide(r.value):r}));{if("aborted"===t.value)return ode;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?ode:"dirty"===r.status||"dirty"===t.value?ide(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,o);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?ode:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((n=>"aborted"===n.status?ode:("dirty"===n.status&&t.dirty(),e(n.value).then((()=>({status:t.value,value:n.value}))))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!cde(e))return e;const i=r.transform(e.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then((e=>cde(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}que.assertNever(r)}}wpe.create=(e,t,n)=>new wpe({schema:e,typeName:jpe.ZodEffects,effect:t,...bde(n)}),wpe.createWithPreprocess=(e,t,n)=>new wpe({schema:t,effect:{type:"preprocess",transform:e},typeName:jpe.ZodEffects,...bde(n)});class _pe extends xde{_parse(e){return this._getType(e)===Wue.undefined?ade(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_pe.create=(e,t)=>new _pe({innerType:e,typeName:jpe.ZodOptional,...bde(t)});class Spe extends xde{_parse(e){return this._getType(e)===Wue.null?ade(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Spe.create=(e,t)=>new Spe({innerType:e,typeName:jpe.ZodNullable,...bde(t)});class Epe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Wue.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Epe.create=(e,t)=>new Epe({innerType:e,typeName:jpe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...bde(t)});class Tpe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ude(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Zue(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Zue(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Tpe.create=(e,t)=>new Tpe({innerType:e,typeName:jpe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...bde(t)});class Cpe extends xde{_parse(e){if(this._getType(e)!==Wue.nan){const t=this._getOrReturnCtx(e);return nde(t,{code:Xue.invalid_type,expected:Wue.nan,received:t.parsedType}),ode}return{status:"valid",value:e.data}}}Cpe.create=e=>new Cpe({typeName:jpe.ZodNaN,...bde(e)});const Ape=Symbol("zod_brand");class Npe extends xde{_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.type._parse({data:t.data,path:t.path,parent:t})}unwrap(){return this._def.type}}class Rpe extends xde{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ode:"dirty"===e.status?(t.dirty(),ide(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ode:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new Rpe({in:e,out:t,typeName:jpe.ZodPipeline})}}class Ope extends xde{_parse(e){const t=this._def.innerType._parse(e),n=e=>(cde(e)&&(e.value=Object.freeze(e.value)),e);return ude(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Ppe(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function kpe(e,t={},n){return e?Qde.create().superRefine(((r,o)=>{var i,a;const s=e(r);if(s instanceof Promise)return s.then((e=>{var i,a;if(!e){const e=Ppe(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=Ppe(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}})):Qde.create()}Ope.create=(e,t)=>new Ope({innerType:e,typeName:jpe.ZodReadonly,...bde(t)});const Mpe={object:ope.lazycreate};var jpe,Lpe;(Lpe=jpe||(jpe={})).ZodString="ZodString",Lpe.ZodNumber="ZodNumber",Lpe.ZodNaN="ZodNaN",Lpe.ZodBigInt="ZodBigInt",Lpe.ZodBoolean="ZodBoolean",Lpe.ZodDate="ZodDate",Lpe.ZodSymbol="ZodSymbol",Lpe.ZodUndefined="ZodUndefined",Lpe.ZodNull="ZodNull",Lpe.ZodAny="ZodAny",Lpe.ZodUnknown="ZodUnknown",Lpe.ZodNever="ZodNever",Lpe.ZodVoid="ZodVoid",Lpe.ZodArray="ZodArray",Lpe.ZodObject="ZodObject",Lpe.ZodUnion="ZodUnion",Lpe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Lpe.ZodIntersection="ZodIntersection",Lpe.ZodTuple="ZodTuple",Lpe.ZodRecord="ZodRecord",Lpe.ZodMap="ZodMap",Lpe.ZodSet="ZodSet",Lpe.ZodFunction="ZodFunction",Lpe.ZodLazy="ZodLazy",Lpe.ZodLiteral="ZodLiteral",Lpe.ZodEnum="ZodEnum",Lpe.ZodEffects="ZodEffects",Lpe.ZodNativeEnum="ZodNativeEnum",Lpe.ZodOptional="ZodOptional",Lpe.ZodNullable="ZodNullable",Lpe.ZodDefault="ZodDefault",Lpe.ZodCatch="ZodCatch",Lpe.ZodPromise="ZodPromise",Lpe.ZodBranded="ZodBranded",Lpe.ZodPipeline="ZodPipeline",Lpe.ZodReadonly="ZodReadonly";const Dpe=zde.create,Ipe=qde.create,Fpe=Cpe.create,Upe=Gde.create,$pe=Kde.create,Vpe=Wde.create,Bpe=Yde.create,zpe=Xde.create,Hpe=Zde.create,qpe=Qde.create,Gpe=Jde.create,Kpe=epe.create,Wpe=tpe.create,Ype=npe.create,Xpe=ope.create,Zpe=ope.strictCreate,Qpe=ipe.create,Jpe=spe.create,efe=cpe.create,tfe=upe.create,nfe=dpe.create,rfe=ppe.create,ofe=fpe.create,ife=hpe.create,afe=mpe.create,sfe=gpe.create,lfe=ype.create,cfe=bpe.create,ufe=xpe.create,dfe=wpe.create,pfe=_pe.create,ffe=Spe.create,hfe=wpe.createWithPreprocess,mfe=Rpe.create,gfe={string:e=>zde.create({...e,coerce:!0}),number:e=>qde.create({...e,coerce:!0}),boolean:e=>Kde.create({...e,coerce:!0}),bigint:e=>Gde.create({...e,coerce:!0}),date:e=>Wde.create({...e,coerce:!0})},vfe=ode;var yfe=Object.freeze({__proto__:null,defaultErrorMap:Que,setErrorMap:function(e){Jue=e},getErrorMap:ede,makeIssue:tde,EMPTY_PATH:[],addIssueToContext:nde,ParseStatus:rde,INVALID:ode,DIRTY:ide,OK:ade,isAborted:sde,isDirty:lde,isValid:cde,isAsync:ude,get util(){return que},get objectUtil(){return Kue},ZodParsedType:Wue,getParsedType:Yue,ZodType:xde,datetimeRegex:$de,ZodString:zde,ZodNumber:qde,ZodBigInt:Gde,ZodBoolean:Kde,ZodDate:Wde,ZodSymbol:Yde,ZodUndefined:Xde,ZodNull:Zde,ZodAny:Qde,ZodUnknown:Jde,ZodNever:epe,ZodVoid:tpe,ZodArray:npe,ZodObject:ope,ZodUnion:ipe,ZodDiscriminatedUnion:spe,ZodIntersection:cpe,ZodTuple:upe,ZodRecord:dpe,ZodMap:ppe,ZodSet:fpe,ZodFunction:hpe,ZodLazy:mpe,ZodLiteral:gpe,ZodEnum:ype,ZodNativeEnum:bpe,ZodPromise:xpe,ZodEffects:wpe,ZodTransformer:wpe,ZodOptional:_pe,ZodNullable:Spe,ZodDefault:Epe,ZodCatch:Tpe,ZodNaN:Cpe,BRAND:Ape,ZodBranded:Npe,ZodPipeline:Rpe,ZodReadonly:Ope,custom:kpe,Schema:xde,ZodSchema:xde,late:Mpe,get ZodFirstPartyTypeKind(){return jpe},coerce:gfe,any:qpe,array:Ype,bigint:Upe,boolean:$pe,date:Vpe,discriminatedUnion:Jpe,effect:dfe,enum:lfe,function:ife,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>kpe((t=>t instanceof e),t),intersection:efe,lazy:afe,literal:sfe,map:rfe,nan:Fpe,nativeEnum:cfe,never:Kpe,null:Hpe,nullable:ffe,number:Ipe,object:Xpe,oboolean:()=>$pe().optional(),onumber:()=>Ipe().optional(),optional:pfe,ostring:()=>Dpe().optional(),pipeline:mfe,preprocess:hfe,promise:ufe,record:nfe,set:ofe,strictObject:Zpe,string:Dpe,symbol:Bpe,transformer:dfe,tuple:tfe,undefined:zpe,union:Qpe,unknown:Gpe,void:Wpe,NEVER:vfe,ZodIssueCode:Xue,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Zue});const bfe=yfe.object({company:yfe.object({legalName:yfe.string().min(1,"Legal company name is required"),type:yfe.enum(["corporation","llc"]).optional(),ein:yfe.string().min(1,"EIN is required")}),representative:yfe.object({title:yfe.string().min(1,"Title is required"),firstName:yfe.string().min(1,"First name is required"),email:yfe.string().email("Invalid email address"),phone:yfe.string().min(1,"Phone number is required"),position:yfe.enum(["owner","manager","director"]).optional()})}),xfe=({onSave:e,onBack:r})=>{const o=n.useRef(null),{isUpdatingBrandSettings:i,data:a}=zte(),{toast:s}=jl(),[l,c]=n.useState(Boolean(null));n.useEffect((()=>{o.current?.focus()}),[]);const u=Tue({resolver:Pue(bfe),defaultValues:{company:{legalName:"",type:void 0,ein:""},representative:{title:"",firstName:"",email:"",phone:"",position:void 0}}}),d=a?.branding?.primaryColor||"#000000",p=Object.entries(u.formState.errors).reduce(((e,[t,n])=>"company"===t||"representative"===t?e+Object.keys(n).length:e+1),0);return t.jsx(jue,{...u,children:t.jsxs("form",{onSubmit:u.handleSubmit((async t=>{try{s({title:"Settings saved 🚀"}),e?.()}catch(n){s({title:"Error saving settings",variant:"destructive"})}})),className:"w-full h-full flex flex-col bg-white rounded-lg",children:[t.jsx("div",{className:"flex-1 flex flex-col min-h-0 px-6 pt-16 overflow-y-auto relative",children:t.jsxs("div",{className:"flex-1 w-full min-h-[400px] @container flex flex-col gap-2",children:[!l&&t.jsx("div",{className:Zd(Mue({variant:"warning",size:"default",position:"inline"}),kue,"p-4 relative"),role:"alert",children:t.jsxs("div",{className:"flex items-start",children:[t.jsx("div",{className:"mr-3 shrink-0 pt-0.5",children:t.jsx(Xu,{className:"h-6 w-6"})}),t.jsxs("div",{className:"flex-grow",children:[t.jsx("h5",{className:"text-sm font-medium mb-1",children:"Complete Required Information"}),t.jsx("div",{className:"text-sm",children:"Please complete the required information to get your Twilio phone number."})]})]})}),t.jsxs("div",{className:"bg-card rounded-lg border shadow-sm",children:[t.jsxs("div",{className:"flex items-center justify-between p-6",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Twilio Application"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Status:"}),t.jsx("span",{className:"inline-flex items-center rounded-full bg-yellow-100 px-2 py-1 text-xs font-medium text-yellow-800",children:"Pending"})]})]}),t.jsxs("div",{className:"py-4 @md:grid @md:grid-cols-2 @md:gap-8 px-6",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-medium pb-2 border-b border-border",children:"Company"}),t.jsx("div",{className:"space-y-4 py-4",children:t.jsx(zue,{control:u.control,disabled:i,legalNameRef:o})})]}),t.jsxs("div",{children:[t.jsx("h3",{className:"text-base font-medium pb-2 border-b border-border",children:"Authorized Representative"}),t.jsx("div",{className:"space-y-4 py-4",children:t.jsx(Hue,{control:u.control,disabled:i})})]})]})]}),t.jsx("div",{className:"h-4",children:" "})]})}),t.jsxs(AB,{className:"py-4 px-6",children:[r&&t.jsx(vZ,{variant:"outline",className:"gap-1.5",onClick:r,disabled:i,children:"Go Back"}),t.jsxs("div",{className:"flex items-center gap-4",children:[p>0&&t.jsxs("span",{className:"text-sm text-destructive flex items-center gap-1.5",children:["Please fix the ",t.jsx("span",{className:"font-bold",children:p})," ","fields that need attention"]}),t.jsx(vZ,{type:"submit",className:"px-4",style:{backgroundColor:d},disabled:i||!u.formState.isDirty,children:i?t.jsxs(t.Fragment,{children:[t.jsx(Nu,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving"]}):"Save Changes"})]})]})]})})};function wfe({tabs:e,activeTab:n,onTabChange:r,title:o}){return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:"w-48 py-2 pl-4",children:[o&&t.jsx("h2",{className:"px-4 pt-4 pb-5 text-lg font-medium",children:o}),e.map((e=>t.jsx(vZ,{variant:"ghost",className:Zd("w-full justify-start mb-1",n===e.id&&"bg-accent"),onClick:()=>r(e.id),children:e.label},e.id)))]}),t.jsx("div",{className:"flex-1",children:e.find((e=>e.id===n))?.content})]})}function _fe({open:e,setOpen:r}){const[o,i]=n.useState("brand"),a=(()=>{const{flags:e}=n.useContext(al.reactContext);return e})()["show-settings-modal"]??!1;n.useEffect((()=>{e&&i("brand")}),[e]);const s=a?[{id:"brand",label:"Brand",content:t.jsx(ece,{})},{id:"phone-number",label:"Phone Number",content:t.jsx(xfe,{})}]:[{id:"brand",label:"Brand",content:t.jsx(ece,{})}];return t.jsx(_B,{open:e,onOpenChange:r,children:t.jsxs(TB,{className:"flex w-[90vw] h-[90vh] flex-col gap-0 overflow-hidden sm:max-w-xl md:max-w-3xl lg:max-w-4xl xl:max-w-5xl p-0",children:[t.jsxs(n$,{children:[t.jsx(NB,{children:"Settings"}),t.jsx(RB,{children:"Edit your business and brand settings"})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(wfe,{tabs:s,activeTab:o,onTabChange:i,title:"Settings"})})]})})}const Sfe=e=>{const{updateAutomation:t,updateError:r,isUpdateSuccess:o}=Le(e),{toast:i}=jl();return n.useEffect((()=>{o?i({title:"Status updated",description:"The status has been updated successfully"}):r&&i({title:"Error updating status",description:"Please try again",variant:"destructive"})}),[o,r,i]),{toggleStatus:async e=>{try{return await t({status:e?Ve.ACTIVE:Ve.DRAFT}),!0}catch(n){return i({title:"Error updating status",description:"Please try again",variant:"destructive"}),!1}}}};function Efe(){const{toast:e}=jl(),[r,o]=n.useState(null),{toggleStatus:i}=Sfe(r||""),a=q5(),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{automations:f,nextCursor:h,isLoading:m,error:g,isFetching:v,isPlaceholderData:y}=Ie({cursor:c,limit:s,triggerType:Fe.TRIGGER_BASED,search:d||void 0});n.useEffect((()=>{g&&e({title:`Error Fetching ${ff("engage:automation")}`,description:g?.message||"Please try again.",variant:"destructive"})}),[g,e]);const b=n.useMemo((()=>(f||[]).map((e=>({...e,emailsSent:0,smsSent:0,updated_at:e.updatedAt||e.createdAt})))),[f]),x=n.useCallback((async(e,t)=>{try{o(e);const n=t===Ve.ACTIVE;await i(n)}finally{o(null)}}),[i,o]),w=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]),_=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),S=n.useMemo((()=>v9({automationName:ff("engage:automation"),setUrl:_,onToggle:x,vsaasManaged:!0})),[x,_]);return t.jsx("div",{className:"w-full h-[75vh] flex flex-col",children:t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(K3,{data:b,columns:S,paginationMode:"cursor",initialPageSize:s,isLoading:m&&!y,onRowClick:e=>{a(`/automations/view-modal/${e.id}?showBackButton=true`)},cursorPaginationQueryResult:{nextCursor:h,isLoading:m,isFetching:v,isPlaceholderData:y},onQueryParametersChange:w,searchValue:d,onSearchChange:p})})})}function Tfe(){const{toast:e}=jl(),[r,o]=n.useState(!1),[i,a]=n.useState(null),{toggleStatus:s}=Sfe(i||""),l=q5(),[c,u]=n.useState(10),[d,p]=n.useState(void 0),[f,h]=n.useState(""),{automations:m,nextCursor:g,isLoading:v,error:y,isFetching:b,isPlaceholderData:x}=Ie({cursor:d,limit:c,triggerType:Fe.ONE_TIME,search:f||void 0});n.useEffect((()=>{y&&e({title:`Error Fetching ${ff("engage:one_time")}`,description:y?.message||"Please try again.",variant:"destructive"})}),[y,e]);const w=n.useMemo((()=>(m||[]).map((e=>({...e,updated_at:e.updatedAt})))),[m]),_=n.useCallback((async(e,t)=>{try{a(e);const n=t===Ve.ACTIVE;await s(n)}finally{a(null)}}),[s,a]),S=n.useCallback((e=>{p(e.cursor),u(e.pageSize)}),[]),E=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),T=n.useMemo((()=>v9({automationName:ff("engage:one_time"),setUrl:E,onToggle:_})),[_,E]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(K3,{data:w,columns:T,paginationMode:"cursor",initialPageSize:c,headerActions:t.jsxs(vZ,{className:"bg-primary",onClick:()=>o(!0),children:[t.jsx(Vu,{className:"h-4 w-4 mr-1"}),"New"]}),isLoading:v&&!x,cursorPaginationQueryResult:{nextCursor:g,isLoading:v,isFetching:b,isPlaceholderData:x},onRowClick:e=>{l(`/automations/view-modal/${e.id}?showBackButton=true`)},onQueryParametersChange:S,searchValue:f,onSearchChange:h})}),t.jsx(Lle,{open:r,setOpen:o,onClose:t=>{l9(o,e,t,`Error creating ${ff("engage:one_time")}`,"Please try again"),p(void 0),u(10),h(""),!1!==t&&l(`/automations/view-modal/${t}?showBackButton=true`)},automationType:Fe.ONE_TIME})]})}function Cfe(){const{toast:e}=jl(),[r,o]=n.useState(!1),[i,a]=n.useState(null),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{segments:f,isLoading:h,nextCursor:m,isFetching:g,isPlaceholderData:v}=QX({search:d||void 0,cursor:c,limit:s}),y=n.useCallback((e=>{a(e),o(!0)}),[a]),b=n.useMemo((()=>function(e){return[d9("name",`${ff("engage:segment")} Name`,!0),p9(),s9({accessorKey:"user_count",header:ff("engage:user_other"),meta:{align:"right",displayName:ff("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const t=e.getValue()??0;return`${t.toLocaleString()} ${1===t?ff("engage:user").toLowerCase():ff("engage:user_other").toLowerCase()}`}}),f9("user_count_updated_at"),g9(e||(()=>{}))]}(y)),[y]),x=n.useMemo((()=>f?f.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[f]),w=n.useMemo((()=>t.jsxs(vZ,{onClick:()=>{a(null),o(!0)},children:[t.jsx(Vu,{className:"h-4 w-4"}),"New List"]})),[]),_=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(K3,{data:x,columns:b,paginationMode:"cursor",initialPageSize:s,headerActions:w,isLoading:h&&!v,cursorPaginationQueryResult:{nextCursor:m,isLoading:h,isFetching:g,isPlaceholderData:v},onQueryParametersChange:_,onRowClick:e=>{a(e.id),o(!0)},searchValue:d,onSearchChange:p})}),t.jsx(yle,{open:r,setOpen:o,segmentId:i??void 0,onSegmentUpdated:t=>{l9(o,e,t,`Error creating ${ff("engage:segment")}`,"Please try again"),u(void 0),l(10),p("")}})]})}const Afe=()=>{const e=[{id:"broadcasts",label:ff("engage:one_time",{count:2}),content:t.jsx(Tfe,{})},{id:"automations",label:ff("engage:automation",{count:2}),content:t.jsx(Efe,{})},{id:"segments",label:ff("engage:segment",{count:2}),content:t.jsx(Cfe,{})},{id:"statistics",label:ff("engage:insight",{count:2}),content:t.jsx(Wle,{})}],r=ce(),[o,i]=n.useState(!1),[a,s]=n.useState(e[0].id);return n.useEffect((()=>{r.prefetchQuery({queryKey:Oe.list()}),r.prefetchQuery({queryKey:XX.lists()})}),[r]),t.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[t.jsx(_fe,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(vZ,{variant:"outline",onClick:()=>i(!0),children:t.jsx(qu,{className:"w-4 h-4"})})}),t.jsx("div",{className:"flex-1 w-full h-full flex flex-col gap-4",children:t.jsx(Dle,{activeTab:a,tabs:e,onTabChange:s})})]})},Nfe=Xpe({name:Dpe().min(2,"Title must be at least 2 characters"),description:Dpe()});function Rfe({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=aZ(),{toast:i}=jl(),a=Tue({resolver:Pue(Nfe),defaultValues:{name:`${o?.name} (copy)`,description:o?.description??""}});return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsx(CB,{children:t.jsx(NB,{children:"Duplicate Automation"})}),t.jsx(jue,{...a,children:t.jsxs("form",{onSubmit:a.handleSubmit((async function(e){if(!o||!e.name)return void i({title:"Error duplicating automation",description:"Please try again. Please make sure to fill in the name of the automation."});const{id:t}=await(async(e,t,n)=>(await Re(`${c}`,{method:"POST",body:JSON.stringify({duplicate:!0,source_id:e,name:t,description:n})})).data)(o.id,e.name,e.description);t?(r?.(t),i({title:"Automation duplicated!",description:"The automation has been duplicated"}),n(!1)):i({title:"Error duplicating automation",description:"Please try again"})})),className:"space-y-4",children:[t.jsxs("div",{children:["Create a copy of the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),"automation with a new title and description."]}),t.jsx(Due,{control:a.control,name:"name",render:({field:e})=>t.jsxs(Uue,{children:[t.jsx($ue,{children:"Title"}),t.jsx(Vue,{children:t.jsx(q3,{...e})}),t.jsx(Bue,{})]})}),t.jsx(Due,{control:a.control,name:"description",render:({field:e})=>t.jsxs(Uue,{children:[t.jsx($ue,{children:"Description"}),t.jsx(Vue,{children:t.jsx(Hte,{...e})}),t.jsx(Bue,{})]})}),t.jsx(AB,{children:t.jsx(vZ,{type:"submit",children:"Duplicate"})})]})})]})})}const Ofe=Xpe({name:Dpe().min(2,"Title must be at least 2 characters"),description:Dpe()});function Pfe({open:e,onOpenChange:n}){const r=aZ(),{updateAutomation:o}=Le(r?.id||""),i=Tue({resolver:Pue(Ofe),defaultValues:{name:r?.name??"",description:r?.description??""},values:{name:r?.name??"",description:r?.description??""}});return r?t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsxs(CB,{children:[t.jsxs(NB,{children:["Edit"," ",ff(r.triggerType===Fe.ONE_TIME?"engage:one_time":"engage:automation")]}),t.jsxs(RB,{children:["Update the title and description of your"," ",ff(r.triggerType===Fe.ONE_TIME?"engage:one_time":"engage:automation"),"."]})]}),t.jsx(jue,{...i,children:t.jsxs("form",{onSubmit:i.handleSubmit((function(e){o({name:e.name,description:e.description}),n(!1)})),className:"space-y-4",children:[t.jsx(Due,{control:i.control,name:"name",render:({field:e})=>t.jsxs(Uue,{children:[t.jsx($ue,{children:"Title"}),t.jsx(Vue,{children:t.jsx(q3,{...e})}),t.jsx(Bue,{})]})}),t.jsx(Due,{control:i.control,name:"description",render:({field:e})=>t.jsxs(Uue,{children:[t.jsx($ue,{children:"Description"}),t.jsx(Vue,{children:t.jsx(Hte,{...e})}),t.jsx(Bue,{})]})}),t.jsx(AB,{children:t.jsx(vZ,{type:"submit",children:"Save changes"})})]})})]})}):null}function kfe({open:e,onOpenChange:n,setIsActive:r}){const o=aZ(),{updateAutomation:i}=Le(o?.id||""),{toast:a}=jl();return t.jsx(_B,{open:e,onOpenChange:n,children:t.jsxs(TB,{className:"sm:max-w-[425px]",children:[t.jsx(CB,{children:t.jsxs(NB,{children:["Deactivate ",ff("engage:automation")]})}),t.jsxs("div",{children:["Are you sure you want to deactivate the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),ff("engage:automation"),"?"]}),t.jsxs(AB,{className:"gap-2 sm:gap-0",children:[t.jsx(vZ,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(vZ,{variant:"destructive",onClick:()=>{i({status:Ve.DRAFT}),n(!1),r(!1),a({title:`Updated ${ff("engage:automation")}`,description:`${ff("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const Mfe=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=aZ(),a=q5(),{updateAutomation:s}=Le(i?.id||""),{toast:l}=jl(),c=(()=>{const{state:e}=iZ();return e.recipientStats})(),u=sZ(),[d,p]=n.useState(void 0),[f,h]=n.useState(!1),[m,g]=n.useState(!1),[v,y]=n.useState(!1),[b,x]=n.useState(!1);n.useEffect((()=>{if(i&&void 0===d)switch(i.status){case Ve.ACTIVE:p(!0);break;case Ve.DRAFT:p(!1);break;case Ve.RUNNING:case Ve.COMPLETED:p(!0);break;case Ve.FAILED:case Ve.DEACTIVATED:p(!1);break;default:throw ene(i.status,Ve)}}),[i,d]);const w=n.useCallback((()=>{if(!i)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});const e=async e=>{if(d&&!e)y(!0);else{if(x(!0),o&&!0===e){let e=0;for(;!c&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!c)return l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),void x(!1);const t=await o({estimatedEmailRecipients:c?.emails??0,estimatedSmsRecipients:c?.phones??0});if(!0!==t)return l({title:"Error while updating the status",description:t,variant:"destructive"}),void x(!1)}switch(i.triggerType){case Fe.ONE_TIME:if(!i.triggerMetadata||!("scheduledAt"in i.triggerMetadata)||!i.triggerMetadata?.scheduledAt)return l({title:"Ensure you have selected a scheduled time",variant:"destructive"}),void x(!1);if(!u||!u.emailChannelSenderId&&!u.smsChannelSenderId)return l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"}),void x(!1);break;case Fe.TRIGGER_BASED:break;default:throw ene(i.triggerType,Fe)}s({status:e?Ve.ACTIVE:Ve.DEACTIVATED},{onSuccess:()=>{p(e),l({title:`${ff("engage:automation")} 🚀`,description:`${ff("engage:automation")} status updated to ${e?"active":"inactive"} 🚀`}),x(!1)},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),x(!1)}})}};if(!i)return null;let n=!1,r=!0;switch(i.status){case Ve.ACTIVE:case Ve.DRAFT:n=!1;break;case Ve.DEACTIVATED:n=!0,r=!1;break;case Ve.RUNNING:n=!0,r=i.triggerType===Fe.TRIGGER_BASED;break;case Ve.COMPLETED:case Ve.FAILED:n=!0,r=!1;break;default:throw ene(i.status,Ve)}if(!r)return t.jsx(kZ,{variant:c9(i.status),children:e8[i.status]});switch(i.triggerType){case Fe.TRIGGER_BASED:return t.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[t.jsx(d?pu:xu,{className:"w-4 h-4"}),t.jsx("div",{className:"text-[13px] font-medium",children:d?"Active":"Inactive"}),t.jsx(cle,{checked:d,onCheckedChange:e,disabled:n})]});case Fe.ONE_TIME:if(!i.triggerMetadata||i.triggerMetadata?.triggerType===Fe.ONE_TIME&&!i.triggerMetadata?.scheduledAt)return t.jsx(vZ,{variant:"outline",className:"flex items-center gap-2",disabled:!0,children:"Set Scheduled Time"});if(d)return t.jsx(vZ,{variant:"outline",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:"Convert to Draft"});{let r="Schedule Send";return i.triggerMetadata.triggerType===Fe.ONE_TIME&&i.triggerMetadata.scheduledAt&&new Date(i.triggerMetadata.scheduledAt)<new Date(Date.now()+3e5)&&(r="Send Now"),t.jsx(vZ,{variant:"default",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:r})}default:throw ene(i.triggerType,Fe)}}),[i,d,l,o,s,c,u]);return i&&void 0!==d?t.jsxs("header",{className:"flex px-1 pt-1",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[e&&t.jsx(vZ,{variant:"ghost",size:"icon",onClick:()=>a(-1),children:t.jsx(lu,{})}),t.jsx("div",{className:"flex flex-col gap-1",children:t.jsx("h1",{className:"text-lg leading-none",children:i.name})})]}),t.jsxs("div",{className:"ml-auto flex gap-4 items-center",children:[t.jsx("div",{className:"flex items-center gap-2 text-muted-foreground",children:i.triggerType===Fe.ONE_TIME&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",onClick:()=>h(!0),children:t.jsx(T9,{title:"Edit",Icon:wZ.EditIcon,asChild:!1,onClick:()=>h(!0)})}),t.jsx("div",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",onClick:()=>g(!0),children:t.jsx(T9,{title:"Duplicate",Icon:wZ.DuplicateIcon,asChild:!1,onClick:()=>g(!0)})})]})}),b?t.jsx("div",{className:"flex items-center text-muted-foreground pr-8",children:t.jsx(hZ,{})}):w()]}),t.jsx(Pfe,{open:f,onOpenChange:h}),t.jsx(Rfe,{open:m,onOpenChange:g,onDuplicationCreated:r}),t.jsx(kfe,{open:v,onOpenChange:y,setIsActive:p})]}):null},jfe=({hideSms:e,hideSales:n})=>{const r=aZ(),{isLoading:o}=De(r?.id);return!r||o?t.jsx(hZ,{text:[`Fetching ${ff("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(Wle,{automationId:r.id,automation:r,includeSales:!n,includeSms:!e})})},Lfe=()=>{const e=aZ(),{recipients:n,isLoading:r,fetchError:o}=Me(e?.id??""),i=[{accessorFn:e=>`${e.firstName||""} ${e.lastName||""}`.trim(),id:"name",header:"Name",cell:({row:e})=>{const n=`${e.original.firstName||""} ${e.original.lastName||""}`.trim();return n||t.jsx("span",{className:"text-gray-400",children:"Not provided"})}},{accessorKey:"email",header:"Email",cell:({row:e})=>e.original.email||t.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"phone",header:"Phone",cell:({row:e})=>e.original.phone||t.jsx("span",{className:"text-gray-400",children:"Not provided"})}];return e&&!r&&n?o?t.jsxs("div",{children:["Error: ",o.message]}):n&&0!==n.recipients.length?t.jsx("div",{className:"h-full p-4",children:t.jsx(K3,{data:n.recipients,columns:i,paginationMode:"standard",initialPageSize:10,isLoading:r})}):t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[t.jsx("div",{className:"mb-4",children:t.jsx(wZ.UserIcon,{className:"h-12 w-12 text-gray-400"})}),t.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Recipients Found"}),t.jsxs("p",{className:"text-gray-500",children:["This ",ff("engage:automation")," currently has no assigned recipients. Please update the include or exclude"," ",ff("engage:segment",{count:2})," to add recipients."]})]}):t.jsx(hZ,{text:["Fetching Recipients","Finishing up"]})},Dfe=n.createContext(null);Dfe.displayName="PanelGroupContext";const Ife="data-panel-group",Ffe="data-panel-group-direction",Ufe="data-panel-group-id",$fe="data-panel",Vfe="data-panel-collapsible",Bfe="data-panel-id",zfe="data-panel-size",Hfe="data-resize-handle",qfe="data-resize-handle-active",Gfe="data-panel-resize-handle-enabled",Kfe="data-panel-resize-handle-id",Wfe="data-resize-handle-state",Yfe=n.useLayoutEffect,Xfe=i["useId".toString()],Zfe="function"==typeof Xfe?Xfe:()=>null;let Qfe=0;function Jfe(e=null){const t=Zfe(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+Qfe++),null!=e?e:r.current}function ehe({children:e,className:t="",collapsedSize:r,collapsible:o,defaultSize:i,forwardedRef:a,id:s,maxSize:l,minSize:c,onCollapse:u,onExpand:d,onResize:p,order:f,style:h,tagName:m="div",...g}){const v=n.useContext(Dfe);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:b,getPanelSize:x,getPanelStyle:w,groupId:_,isPanelCollapsed:S,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:C,unregisterPanel:A}=v,N=Jfe(s),R=n.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:r,collapsible:o,defaultSize:i,maxSize:l,minSize:c},id:N,idIsFromProps:void 0!==s,order:f});n.useRef({didLogMissingDefaultSizeWarning:!1}),Yfe((()=>{const{callbacks:e,constraints:t}=R.current,n={...t};R.current.id=N,R.current.idIsFromProps=void 0!==s,R.current.order=f,e.onCollapse=u,e.onExpand=d,e.onResize=p,t.collapsedSize=r,t.collapsible=o,t.defaultSize=i,t.maxSize=l,t.minSize=c,n.collapsedSize===t.collapsedSize&&n.collapsible===t.collapsible&&n.maxSize===t.maxSize&&n.minSize===t.minSize||E(R.current,n)})),Yfe((()=>{const e=R.current;return T(e),()=>{A(e)}}),[f,N,T,A]),n.useImperativeHandle(a,(()=>({collapse:()=>{y(R.current)},expand:e=>{b(R.current,e)},getId:()=>N,getSize:()=>x(R.current),isCollapsed:()=>S(R.current),isExpanded:()=>!S(R.current),resize:e=>{C(R.current,e)}})),[y,b,x,S,N,C]);const O=w(R.current,i);return n.createElement(m,{...g,children:e,className:t,id:N,style:{...O,...h},[Ufe]:_,[$fe]:"",[Vfe]:o||void 0,[Bfe]:N,[zfe]:parseFloat(""+O.flexGrow).toFixed(1)})}const the=n.forwardRef(((e,t)=>n.createElement(ehe,{...e,forwardedRef:t})));ehe.displayName="Panel",the.displayName="forwardRef(Panel)";let nhe=null,rhe=-1,ohe=null;function ihe(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&yhe),n=!!(t&bhe);if(t&ghe)return e?"se-resize":n?"ne-resize":"e-resize";if(t&vhe)return e?"sw-resize":n?"nw-resize":"w-resize";if(e)return"s-resize";if(n)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}(e,t);if(nhe!==o){var i;if(nhe=o,null===ohe&&(ohe=document.createElement("style"),document.head.appendChild(ohe)),rhe>=0)null===(i=ohe.sheet)||void 0===i||i.removeRule(rhe);rhe=null!==(n=null===(r=ohe.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function ahe(e){return"keydown"===e.type}function she(e){return e.type.startsWith("pointer")}function lhe(e){return e.type.startsWith("mouse")}function che(e){if(she(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(lhe(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const uhe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function dhe(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=mhe(e))&&void 0!==t?t:e).display;return"flex"===n||"inline-flex"===n}(e))||(+t.opacity<1||("transform"in t&&"none"!==t.transform||("webkitTransform"in t&&"none"!==t.webkitTransform||("mixBlendMode"in t&&"normal"!==t.mixBlendMode||("filter"in t&&"none"!==t.filter||("webkitFilter"in t&&"none"!==t.webkitFilter||("isolation"in t&&"isolate"===t.isolation||(!!uhe.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function phe(e){let t=e.length;for(;t--;){const n=e[t];if(Dhe(n,"Missing node"),dhe(n))return n}return null}function fhe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function hhe(e){const t=[];for(;e;)t.push(e),e=mhe(e);return t}function mhe(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const ghe=1,vhe=2,yhe=4,bhe=8,xhe="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let whe=[],_he=!1,She=new Map,Ehe=new Map;const The=new Set;function Che(e){const{target:t}=e,{x:n,y:r}=che(e);_he=!0,Ohe({target:t,x:n,y:r}),jhe(),whe.length>0&&(Lhe("down",e),e.preventDefault(),Rhe(t)||e.stopImmediatePropagation())}function Ahe(e){const{x:t,y:n}=che(e);if(_he&&0===e.buttons&&(_he=!1,Lhe("up",e)),!_he){const{target:r}=e;Ohe({target:r,x:t,y:n})}Lhe("move",e),khe(),whe.length>0&&e.preventDefault()}function Nhe(e){const{target:t}=e,{x:n,y:r}=che(e);Ehe.clear(),_he=!1,whe.length>0&&(e.preventDefault(),Rhe(t)||e.stopImmediatePropagation()),Lhe("up",e),Ohe({target:t,x:n,y:r}),khe(),jhe()}function Rhe(e){let t=e;for(;t;){if(t.hasAttribute(Hfe))return!0;t=t.parentElement}return!1}function Ohe({target:e,x:t,y:n}){whe.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),The.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=xhe?i.coarse:i.fine;if(t>=l-d&&t<=c+d&&n>=u-d&&n<=s+d){if(null!==r&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&function(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:hhe(e),b:hhe(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Dhe(r,"Stacking order can only be calculated for elements with a common ancestor");const o=fhe(phe(n.a)),i=fhe(phe(n.b));if(o===i){const e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)};let o=e.length;for(;o--;){const n=e[o];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(o-i)}(r,o)>0){let e=r,t=!1;for(;e&&!e.contains(o);){if((p=e.getBoundingClientRect()).x<(f=a).x+f.width&&p.x+p.width>f.x&&p.y<f.y+f.height&&p.y+p.height>f.y){t=!0;break}e=e.parentElement}if(t)return}whe.push(e)}var p,f}))}function Phe(e,t){Ehe.set(e,t)}function khe(){let e=!1,t=!1;whe.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;Ehe.forEach((e=>{n|=e})),e&&t?ihe("intersection",n):e?ihe("horizontal",n):t?ihe("vertical",n):null!==ohe&&(document.head.removeChild(ohe),nhe=null,ohe=null,rhe=-1)}let Mhe=new AbortController;function jhe(){Mhe.abort(),Mhe=new AbortController;const e={capture:!0,signal:Mhe.signal};The.size&&(_he?(whe.length>0&&She.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",Nhe,e),r.addEventListener("pointerleave",Ahe,e),r.addEventListener("pointermove",Ahe,e))})),She.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",Nhe,e),r.addEventListener("pointercancel",Nhe,e)}))):She.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",Che,e),r.addEventListener("pointermove",Ahe,e))})))}function Lhe(e,t){The.forEach((n=>{const{setResizeHandlerState:r}=n,o=whe.includes(n);r(e,o,t)}))}function Dhe(e,t){if(!e)throw Error(t)}function Ihe(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Fhe(e,t,n=10){return 0===Ihe(e,t,n)}function Uhe(e,t,n){return 0===Ihe(e,t,n)}function $he({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Dhe(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(Ihe(n,s)<0)if(i){n=Ihe(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function Vhe({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Uhe(e,0))return t;const a=[...t],[s,l]=r;Dhe(null!=s,"Invalid first pivot index"),Dhe(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];Dhe(o,`Panel constraints not found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:c=0}=o;if(a){const n=t[r];if(Dhe(null!=n,`Previous layout not found for panel index ${r}`),Uhe(n,i)){const t=c-n;Ihe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];Dhe(o,`No panel constraints found for index ${r}`);const{collapsedSize:i=0,collapsible:a,minSize:c=0}=o;if(a){const n=t[r];if(Dhe(null!=n,`Previous layout not found for panel index ${r}`),Uhe(n,c)){const t=n-i;Ihe(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}{const r=e<0?1:-1;let o=e<0?l:s,i=0;for(;;){const e=t[o];Dhe(null!=e,`Previous layout not found for panel index ${o}`);if(i+=$he({panelConstraints:n,panelIndex:o,size:100})-e,o+=r,o<0||o>=n.length)break}const a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let r=e<0?s:l;for(;r>=0&&r<n.length;){const o=Math.abs(e)-Math.abs(c),i=t[r];Dhe(null!=i,`Previous layout not found for panel index ${r}`);const s=$he({panelConstraints:n,panelIndex:r,size:i-o});if(!Uhe(i,s)&&(c+=i-s,a[r]=s,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?r--:r++}}if(function(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Uhe(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];Dhe(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=$he({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!Uhe(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];Dhe(null!=o,`Previous layout not found for panel index ${r}`);const i=$he({panelConstraints:n,panelIndex:r,size:o+t});if(Uhe(o,i)||(t-=i-o,a[r]=i),Uhe(t,0))break;e>0?r--:r++}}}return Uhe(a.reduce(((e,t)=>t+e),0),100)?a:o}function Bhe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];Dhe(null!=s,"No pivot index found"),t.forEach(((e,t)=>{const{constraints:n}=e,{maxSize:l=100,minSize:c=0}=n;t===s?(r=c,o=l):(i+=c,a+=l)}));return{valueMax:Math.min(o,100-i),valueMin:Math.max(r,100-a),valueNow:e[s]}}function zhe(e,t=document){return Array.from(t.querySelectorAll(`[${Kfe}][data-panel-group-id="${e}"]`))}function Hhe(e,t,n=document){const r=zhe(e,n).findIndex((e=>e.getAttribute(Kfe)===t));return null!=r?r:null}function qhe(e,t,n){const r=Hhe(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function Ghe(e,t=document){var n;if(t instanceof HTMLElement&&(null==t||null===(n=t.dataset)||void 0===n?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function Khe(e,t=document){const n=t.querySelector(`[${Kfe}="${e}"]`);return n||null}function Whe({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),Yfe((()=>{if(!a)return;const e=zhe(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=Bhe({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];Dhe(e,`No panel data found for index "${t}"`),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-valuemax",""+Math.round(n)),s.setAttribute("aria-valuemin",""+Math.round(r)),s.setAttribute("aria-valuenow",null!=a?""+Math.round(a):"")}}return()=>{e.forEach(((e,t)=>{e.removeAttribute("aria-controls"),e.removeAttribute("aria-valuemax"),e.removeAttribute("aria-valuemin"),e.removeAttribute("aria-valuenow")}))}}),[r,o,i,a]),n.useEffect((()=>{if(!a)return;const e=t.current;Dhe(e,"Eager values not found");const{panelDataArray:n}=e;Dhe(null!=Ghe(r,a),`No group found for id "${r}"`);const i=zhe(r,a);Dhe(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(Kfe);Dhe(t,"Resize handle element has no handle id attribute");const[i,l]=function(e,t,n,r=document){var o,i,a,s;const l=Khe(t,r),c=zhe(e,r),u=l?c.indexOf(l):-1;return[null!==(o=null===(i=n[u])||void 0===i?void 0:i.id)&&void 0!==o?o:null,null!==(a=null===(s=n[u+1])||void 0===s?void 0:s.id)&&void 0!==a?a:null]}(r,t,n,a);if(null==i||null==l)return()=>{};const c=e=>{if(!e.defaultPrevented)switch(e.key){case"Enter":{e.preventDefault();const l=n.findIndex((e=>e.id===i));if(l>=0){const e=n[l];Dhe(e,`No panel data found for index ${l}`);const i=o[l],{collapsedSize:c=0,collapsible:u,minSize:d=0}=e.constraints;if(null!=i&&u){const e=Vhe({delta:Uhe(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:qhe(r,t,a),prevLayout:o,trigger:"keyboard"});o!==e&&s(e)}}break}}};return e.addEventListener("keydown",c),()=>{e.removeEventListener("keydown",c)}}));return()=>{l.forEach((e=>e()))}}),[a,e,t,r,o,i,s])}function Yhe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Xhe(e,t){const n="horizontal"===e,{x:r,y:o}=che(t);return n?r:o}function Zhe(e,t,n,r,o,i){if(ahe(e)){const t="horizontal"===n;let r=0;r=e.shiftKey?100:null!=o?o:10;let i=0;switch(e.key){case"ArrowDown":i=t?0:r;break;case"ArrowLeft":i=t?-r:0;break;case"ArrowRight":i=t?r:0;break;case"ArrowUp":i=t?0:-r;break;case"End":i=100;break;case"Home":i=-100}return i}return null==r?0:function(e,t,n,r,o){const i="horizontal"===n,a=Khe(t,o);Dhe(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(Ufe);Dhe(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Xhe(n,e),u=Ghe(s,o);Dhe(u,`No group element found for id "${s}"`);const d=u.getBoundingClientRect();return(c-l)/(i?d.width:d.height)*100}(e,t,n,r,i)}function Qhe(e,t,n){t.forEach(((t,r)=>{const o=e[r];Dhe(o,`Panel data not found for index ${r}`);const{callbacks:i,constraints:a,id:s}=o,{collapsedSize:l=0,collapsible:c}=a,u=n[s];if(null==u||t!==u){n[s]=t;const{onCollapse:e,onExpand:r,onResize:o}=i;o&&o(t,u),c&&(e||r)&&(!r||null!=u&&!Fhe(u,l)||Fhe(t,l)||r(),!e||null!=u&&Fhe(u,l)||!Fhe(t,l)||e())}}))}function Jhe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function eme(e){try{if("undefined"==typeof localStorage)throw new Error("localStorage not supported in this environment");e.getItem=e=>localStorage.getItem(e),e.setItem=(e,t)=>{localStorage.setItem(e,t)}}catch(t){e.getItem=()=>null,e.setItem=()=>{}}}function tme(e){return`react-resizable-panels:${e}`}function nme(e){return e.map((e=>{const{constraints:t,id:n,idIsFromProps:r,order:o}=e;return r?n:o?`${o}:${JSON.stringify(t)}`:JSON.stringify(t)})).sort(((e,t)=>e.localeCompare(t))).join(",")}function rme(e,t){try{const n=tme(e),r=t.getItem(n);if(r){const e=JSON.parse(r);if("object"==typeof e&&null!=e)return e}}catch(n){}return null}function ome(e,t,n,r,o){var i;const a=tme(e),s=nme(t),l=null!==(i=rme(e,o))&&void 0!==i?i:{};l[s]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(a,JSON.stringify(l))}catch(c){}}function ime({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce(((e,t)=>e+t),0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map((e=>`${e}%`)).join(", ")}`);if(!Uhe(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];Dhe(null!=e,`No layout data found for index ${i}`);n[i]=100/r*e}let o=0;for(let i=0;i<t.length;i++){const e=n[i];Dhe(null!=e,`No layout data found for index ${i}`);const r=$he({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!Uhe(o,0))for(let i=0;i<t.length;i++){const e=n[i];Dhe(null!=e,`No layout data found for index ${i}`);const r=$he({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,Uhe(o,0)))break}return n}const ame={getItem:e=>(eme(ame),ame.getItem(e)),setItem:(e,t)=>{eme(ame),ame.setItem(e,t)}},sme={};function lme({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=ame,style:u,tagName:d="div",...p}){const f=Jfe(a),h=n.useRef(null),[m,g]=n.useState(null),[v,y]=n.useState([]),b=function(){const[e,t]=n.useState(0);return n.useCallback((()=>t((e=>e+1))),[])}(),x=n.useRef({}),w=n.useRef(new Map),_=n.useRef(0),S=n.useRef({autoSaveId:e,direction:o,dragState:m,id:f,keyboardResizeBy:l,onLayout:s,storage:c}),E=n.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});n.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),n.useImperativeHandle(i,(()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:e}=E.current;return e},setLayout:e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current,o=ime({layout:e,panelConstraints:r.map((e=>e.constraints))});Yhe(n,o)||(y(o),E.current.layout=o,t&&t(o),Qhe(r,o,x.current))}})),[]),Yfe((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),Whe({committedValuesRef:S,eagerValuesRef:E,groupId:f,layout:v,panelDataArray:E.current.panelDataArray,setLayout:y,panelGroupElement:h.current}),n.useEffect((()=>{const{panelDataArray:t}=E.current;if(e){if(0===v.length||v.length!==t.length)return;let n=sme[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(ome,100),sme[e]=n);const r=[...t],o=new Map(w.current);n(e,r,o,v,c)}}),[e,v,c]),n.useEffect((()=>{}));const T=n.useCallback((e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current;if(e.constraints.collapsible){const o=r.map((e=>e.constraints)),{collapsedSize:i=0,panelSize:a,pivotIndices:s}=dme(r,e,n);if(Dhe(null!=a,`Panel size not found for panel "${e.id}"`),!Fhe(a,i)){w.current.set(e.id,a);const l=Vhe({delta:ume(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Jhe(n,l)||(y(l),E.current.layout=l,t&&t(l),Qhe(r,l,x.current))}}}),[]),C=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current;if(e.constraints.collapsible){const i=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s=0,minSize:l=0,pivotIndices:c}=dme(o,e,r),u=null!=t?t:l;if(Fhe(s,a)){const t=w.current.get(e.id),a=null!=t&&t>=u?t:u,l=Vhe({delta:ume(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});Jhe(r,l)||(y(l),E.current.layout=l,n&&n(l),Qhe(o,l,x.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=dme(n,e,t);return Dhe(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),N=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=ume(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const a=n[o];let s;return s=null==a?null!=e?e.toPrecision(i):"1":1===r.length?"1":a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:v,panelData:n,panelIndex:r})}),[m,v]),R=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=dme(n,e,t);return Dhe(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&Fhe(i,r)}),[]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=dme(n,e,t);return Dhe(null!=i,`Panel size not found for panel "${e.id}"`),!o||Ihe(i,r)>0}),[]),P=n.useCallback((e=>{const{panelDataArray:t}=E.current;t.push(e),t.sort(((e,t)=>{const n=e.order,r=t.order;return null==n&&null==r?0:null==n?-1:null==r?1:n-r})),E.current.panelDataArrayChanged=!0,b()}),[b]);Yfe((()=>{if(E.current.panelDataArrayChanged){E.current.panelDataArrayChanged=!1;const{autoSaveId:e,onLayout:t,storage:n}=S.current,{layout:r,panelDataArray:o}=E.current;let i=null;if(e){const t=function(e,t,n){var r,o;return null!==(o=(null!==(r=rme(e,n))&&void 0!==r?r:{})[nme(t)])&&void 0!==o?o:null}(e,o,n);t&&(w.current=new Map(Object.entries(t.expandToSizes)),i=t.layout)}null==i&&(i=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let r=0,o=100;for(let i=0;i<e.length;i++){const e=n[i];Dhe(e,`Panel constraints not found for index ${i}`);const{defaultSize:a}=e;null!=a&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const a=n[i];Dhe(a,`Panel constraints not found for index ${i}`);const{defaultSize:s}=a;if(null!=s)continue;const l=o/(e.length-r);r++,t[i]=l,o-=l}return t}({panelDataArray:o}));const a=ime({layout:i,panelConstraints:o.map((e=>e.constraints))});Yhe(r,a)||(y(a),E.current.layout=a,t&&t(a),Qhe(o,a,x.current))}})),Yfe((()=>{const e=E.current;return()=>{e.layout=[]}}),[]);const k=n.useCallback((e=>{let t=!1;const n=h.current;if(n){"rtl"===window.getComputedStyle(n,null).getPropertyValue("direction")&&(t=!0)}return function(n){n.preventDefault();const r=h.current;if(!r)return()=>null;const{direction:o,dragState:i,id:a,keyboardResizeBy:s,onLayout:l}=S.current,{layout:c,panelDataArray:u}=E.current,{initialLayout:d}=null!=i?i:{},p=qhe(a,e,r);let f=Zhe(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=Vhe({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:ahe(n)?"keyboard":"mouse-or-touch"}),v=!Jhe(c,g);(she(n)||lhe(n))&&_.current!=f&&(_.current=f,Phe(e,v||0===f?0:m?f<0?ghe:vhe:f<0?yhe:bhe)),v&&(y(g),E.current.layout=g,l&&l(g),Qhe(u,g,x.current))}}),[]),M=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current,i=o.map((e=>e.constraints)),{panelSize:a,pivotIndices:s}=dme(o,e,r);Dhe(null!=a,`Panel size not found for panel "${e.id}"`);const l=Vhe({delta:ume(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});Jhe(r,l)||(y(l),E.current.layout=l,n&&n(l),Qhe(o,l,x.current))}),[]),j=n.useCallback(((e,t)=>{const{layout:n,panelDataArray:r}=E.current,{collapsedSize:o=0,collapsible:i}=t,{collapsedSize:a=0,collapsible:s,maxSize:l=100,minSize:c=0}=e.constraints,{panelSize:u}=dme(r,e,n);null!=u&&(i&&s&&Fhe(u,o)?Fhe(o,a)||M(e,a):u<c?M(e,c):u>l&&M(e,l))}),[M]),L=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=Khe(e,h.current);Dhe(o,`Drag handle element not found for id "${e}"`);const i=Xhe(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),D=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=ume(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],E.current.panelDataArrayChanged=!0,b())}),[b]),F=n.useMemo((()=>({collapsePanel:T,direction:o,dragState:m,expandPanel:C,getPanelSize:A,getPanelStyle:N,groupId:f,isPanelCollapsed:R,isPanelExpanded:O,reevaluatePanelConstraints:j,registerPanel:P,registerResizeHandle:k,resizePanel:M,startDragging:L,stopDragging:D,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,N,f,R,O,j,P,k,M,L,D,I]);return n.createElement(Dfe.Provider,{value:F},n.createElement(d,{...p,children:t,className:r,id:a,ref:h,style:{...{display:"flex",flexDirection:"horizontal"===o?"row":"column",height:"100%",overflow:"hidden",width:"100%"},...u},[Ife]:"",[Ffe]:o,[Ufe]:f}))}const cme=n.forwardRef(((e,t)=>n.createElement(lme,{...e,forwardedRef:t})));function ume(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function dme(e,t,n){const r=ume(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function pme({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:o,id:i,onBlur:a,onClick:s,onDragging:l,onFocus:c,onPointerDown:u,onPointerUp:d,style:p={},tabIndex:f=0,tagName:h="div",...m}){var g,v;const y=n.useRef(null),b=n.useRef({onClick:s,onDragging:l,onPointerDown:u,onPointerUp:d});n.useEffect((()=>{b.current.onClick=s,b.current.onDragging=l,b.current.onPointerDown=u,b.current.onPointerUp=d}));const x=n.useContext(Dfe);if(null===x)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:w,groupId:_,registerResizeHandle:S,startDragging:E,stopDragging:T,panelGroupElement:C}=x,A=Jfe(i),[N,R]=n.useState("inactive"),[O,P]=n.useState(!1),[k,M]=n.useState(null),j=n.useRef({state:N});Yfe((()=>{j.current.state=N})),n.useEffect((()=>{if(r)M(null);else{const e=S(A);M((()=>e))}}),[r,A,S]);const L=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,D=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;Dhe(e,"Element ref not attached");let t=!1;return function(e,t,n,r,o){var i;const{ownerDocument:a}=t,s={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=null!==(i=She.get(a))&&void 0!==i?i:0;return She.set(a,l+1),The.add(s),jhe(),function(){var t;Ehe.delete(e),The.delete(s);const n=null!==(t=She.get(a))&&void 0!==t?t:1;if(She.set(a,n-1),jhe(),1===n&&She.delete(a),whe.includes(s)){const e=whe.indexOf(s);e>=0&&whe.splice(e,1),khe(),o("up",!0,null)}}}(A,e,w,{coarse:L,fine:D},((e,n,r)=>{if(n)switch(e){case"down":{R("drag"),t=!1,Dhe(r,'Expected event to be defined for "down" action'),E(A,r);const{onDragging:e,onPointerDown:n}=b.current;null==e||e(!0),null==n||n();break}case"move":{const{state:e}=j.current;t=!0,"drag"!==e&&R("hover"),Dhe(r,'Expected event to be defined for "move" action'),k(r);break}case"up":{R("hover"),T();const{onClick:e,onDragging:n,onPointerUp:r}=b.current;null==n||n(!1),null==r||r(),t||null==e||e();break}}else R("inactive")}))}),[L,w,r,D,S,A,k,E,T]),function({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:o}){n.useEffect((()=>{if(e||null==r||null==o)return;const n=Khe(t,o);if(null==n)return;const i=e=>{if(!e.defaultPrevented)switch(e.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":e.preventDefault(),r(e);break;case"F6":{e.preventDefault();const r=n.getAttribute(Ufe);Dhe(r,`No group element found for id "${r}"`);const i=zhe(r,o),a=Hhe(r,t,o);Dhe(null!==a,`No resize element found for id "${t}"`),i[e.shiftKey?a>0?a-1:i.length-1:a+1<i.length?a+1:0].focus();break}}};return n.addEventListener("keydown",i),()=>{n.removeEventListener("keydown",i)}}),[o,e,t,r])}({disabled:r,handleId:A,resizeHandler:k,panelGroupElement:C});return n.createElement(h,{...m,children:e,className:t,id:i,onBlur:()=>{P(!1),null==a||a()},onFocus:()=>{P(!0),null==c||c()},ref:y,role:"separator",style:{touchAction:"none",userSelect:"none",...p},tabIndex:f,[Ffe]:w,[Ufe]:_,[Hfe]:"",[qfe]:"drag"===N?"pointer":O?"keyboard":void 0,[Gfe]:!r,[Kfe]:A,[Wfe]:N})}lme.displayName="PanelGroup",cme.displayName="forwardRef(PanelGroup)",pme.displayName="PanelResizeHandle";const fme=({className:e,...n})=>t.jsx(cme,{className:wB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),hme=the,mme=({withHandle:e,className:n,...r})=>t.jsx(pme,{className:wB("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",n),...r,children:e&&t.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:t.jsx(Eu,{className:"h-2.5 w-2.5"})})}),gme=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),vme="rgba(245, 246, 247, 1)",yme={[$e.SEND_COMMUNICATION]:{color:{bg:vme},clickable:!0},[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:vme},clickable:!1}},bme={[$e.SEND_COMMUNICATION]:"Send Email & SMS",[$e.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},xme=({children:e,onClick:n,iconBgColor:r,iconStrokeColor:o,Icon:i,disabled:a=!1,selected:s=!1})=>{const l=i;return t.jsxs(AX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},style:{backgroundColor:s?r:vme},onClick:n,className:Zd("flex gap-2 items-center rounded-md transition-colors group","p-2 border-2 border-transparent overflow-hidden",!a&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:[t.jsx("div",{className:Zd("bg-purple-50 rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 transition-colors",!a&&"group-hover/trigger-audience:bg-background",r),children:t.jsx(l,{className:Zd("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})},wme=({segmentName:e})=>t.jsx("span",{className:"inline-flex items-center bg-white border border-gray-200 rounded-md px-2 py-0.5 text-sm font-medium shadow-sm",children:e}),_me=()=>{const e=aZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=QX(),u=n.useCallback((()=>c?.find((e=>e.type===rZ.ALL_USERS))),[c]);return n.useEffect((()=>{e&&c&&(null===i&&null===s?(a(e?.includeSegmentIds||null),l(e?.excludeSegmentIds||null),0===e.includeSegmentIds.length&&0===e.excludeSegmentIds.length&&(a([u()?.id||""]),l([]))):(JSON.stringify(e.includeSegmentIds)!==JSON.stringify(i)&&a(e.includeSegmentIds),JSON.stringify(e.excludeSegmentIds)!==JSON.stringify(s)&&l(e.excludeSegmentIds)))}),[e,s,i,c,u]),e&&i&&s?t.jsx(t.Fragment,{children:t.jsx(xme,{selected:o===Yte.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(Yte.EditAudience)},Icon:wZ.AudienceIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Rre,{children:"Audience"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(gme,{copyText:`Send to all ${ff("engage:user",{count:2})} in ${1===i.length?"this":"these"} ${ff("engage:segment",{count:i.length}).toLowerCase()}`}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:i.map((e=>{const n=c?.find((t=>t.id===e));return n?t.jsx(wme,{segmentName:n.name},e):null}))})]})]})})}):null},Sme=()=>{const e=aZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(VX),{segments:i}=QX(),a=ff(e?.triggerType===Fe.TRIGGER_BASED?"engage:automation":"engage:one_time"),s=`Start this ${a?.toLowerCase()}`;if(!e||!i)return null;return t.jsx(t.Fragment,{children:(()=>{switch(e.triggerType){case Fe.TRIGGER_BASED:{if(e.triggerMetadata.triggerType!==Fe.TRIGGER_BASED||e.triggerMetadata.eventName!==Ue.USER_ENTERS_SEGMENT||!e.triggerMetadata.eventFilter.segment_id)return null;const n=e.triggerMetadata.eventFilter.segment_id,r=i.find((e=>e.id===n))?.name;return r?t.jsx(xme,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:wZ.TriggerIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Rre,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(gme,{copyText:`When ${ff("engage:user").toLowerCase()} joins the`}),t.jsx(wme,{segmentName:r})]})]})}):null}case Fe.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(xme,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(Yte.EditTime)},selected:o===Yte.EditTime,Icon:wZ.TriggerIcon,children:[t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Rre,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(gme,n?{copyText:`Click to set the date and time for this ${ff("engage:one_time")}`}:{copyText:"Bulk send at"}),!1===n&&"scheduledAt"in e.triggerMetadata&&e.triggerMetadata.scheduledAt&&t.jsx("div",{className:"text-xs font-medium",children:t.jsx(wme,{segmentName:o9(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),t.jsx("div",{className:"",children:n&&t.jsx(E9,{className:"group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors"})})]})}default:throw ene(e.triggerType,Fe)}})()})},Eme=e=>{switch(e){case $e.SEND_COMMUNICATION:return"Send Communication";case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw LX(e,$e)}},Tme=e=>{switch(e){case $e.SEND_COMMUNICATION:return t.jsx(wZ.CommunicationIcon,{className:"w-4 h-4"});case $e.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(wZ.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw ene(e,$e)}},Cme=e=>{if(!(e&&e.actionType===$e.WAIT_UNTIL_NEXT_FIXED_TIME&&"hour"in e&&"minute"in e&&"timezone"in e))return null;const{hour:t,minute:n,timezone:r}=e;return`Wait until next ${`${t?.toString().padStart(2,"0")}:${n?.toString().padStart(2,"0")}`} ${r}`},Ame=({actionDataWithMetadata:e})=>{const{actionData:r,communicationGroup:o}=e,{state:{selectedActionId:i},setActionId:a,setSelectedCommunicationGroupId:s}=n.useContext(VX),l=n.useMemo((()=>i===r.actionMetadata.currentActionId),[i,r.actionMetadata.currentActionId]),c=yme[r.actionType],u=c.color,d=c.clickable;return t.jsx(AX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:Zd("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",l&&"border-primary",r.actionType!==$e.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:l?u.bg:u.bgUnselected??vme},onClick:()=>{d&&(a(r.actionMetadata.currentActionId),r.actionType===$e.SEND_COMMUNICATION&&s(r.actionMetadata.communicationGroupId))},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white",children:Tme(r.actionType)}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{style:{color:l?u.text:u.textUnselected},children:t.jsx(Rre,{children:bme[r.actionType]})}),t.jsx("div",r.actionType===$e.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:Cme(r.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:r.actionType===$e.SEND_COMMUNICATION&&o?.emailSubject?o?.emailSubject:Eme(r.actionType)})]})]})})},Nme=()=>{const[e,r]=n.useState(!1),[o,i]=n.useState(void 0),[a,s]=n.useState(!1),[l,c]=n.useState(""),[u,d]=n.useState(null),p=aZ(),{setActionId:f,state:{selectedActionId:h}}=n.useContext(VX),{updateAutomation:m}=Le(p?.id||""),{toast:g}=jl();if(n.useEffect((()=>{if(!p)return;if(h)return;const e=p.actionData?.find((e=>"send_communication"===e.actionType));e&&f(e.actionMetadata.currentActionId)}),[p,f,h]),n.useEffect((()=>{if(!p)return;(async()=>{const e=[];for(const t of p.actionData??[])switch(t.actionType){case $e.SEND_COMMUNICATION:{const n=await zX(t.actionMetadata.communicationGroupId);e.push({actionData:t,communicationGroup:n});break}case $e.WAIT_UNTIL_NEXT_FIXED_TIME:e.push({actionData:t});break;default:throw LX(t.actionType,$e)}i(e)})()}),[p]),n.useEffect((()=>{d(null),c(p?.description??"")}),[p?.description]),!p||!o)return null;const v=(e=>{const{steps:t,rootActionId:n}=e;if(!t||!n)return t??[];const r=new Map(t.map((e=>[e.actionData.actionMetadata.currentActionId,e]))),o=r.get(n);if(!o)return t;const i=[];let a=o;for(;a;){i.push(a);const e=a.actionData.actionMetadata.nextActionId;if(!e)break;a=r.get(e)}return i})({steps:o,rootActionId:p.triggerMetadata?.triggerType===Fe.TRIGGER_BASED?p.triggerMetadata.rootActionId:void 0}).filter((t=>!!e||"send_communication"===t.actionData.actionType));let y=()=>t.jsx("div",{},"empty-trigger-audience");(e||p.triggerType===Fe.ONE_TIME)&&(y=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[p.triggerType===Fe.ONE_TIME&&t.jsx(_me,{}),p.triggerType!==Fe.ONE_TIME&&t.jsx(Sme,{})]}));const b=async()=>{d(l),m({description:l},{onSuccess:()=>{g({title:"Description updated 🚀"}),s(!1)}})};return t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[p.description||a?t.jsx("div",{className:"w-full mx-auto rounded-xl bg-neutral-50 dark:bg-neutral-900 shadow-sm px-4 py-3 my-2 border border-neutral-200 dark:border-neutral-800 text-neutral-800 dark:text-neutral-100 text-[15px] font-medium leading-snug tracking-tight justify-start group relative transition-colors duration-150",style:{containerType:"inline-size"},tabIndex:0,onClick:()=>{s(!0)},role:"button","aria-label":"Edit automation description",children:a?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("textarea",{className:"w-full bg-transparent outline-none resize-none text-[15px] font-medium leading-snug tracking-tight text-neutral-800 dark:text-neutral-100 rounded-xl border border-primary-500 focus:ring-2 focus:ring-primary-400 transition-all min-h-[48px] p-2",style:{containerType:"inline-size"},value:l,autoFocus:!0,rows:2,maxLength:300,onChange:e=>c(e.target.value),onBlur:()=>{s(!1)},"aria-label":"Edit automation description textarea"}),t.jsx(vZ,{variant:"secondary",onClick:b,onMouseDown:e=>e.preventDefault(),className:"z-20",children:"Update Description"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"pr-8 select-text cursor-pointer",children:null!==u?u:p.description}),t.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-0 group-hover:opacity-100 group-focus:opacity-100 transition-opacity duration-150 pointer-events-none",children:t.jsx(wZ.EditIcon,{className:"w-4 h-4"})})]})}):null,p.triggerType===Fe.TRIGGER_BASED&&t.jsxs("div",{className:"flex gap-2 items-center justify-between",children:[t.jsx("div",{className:"text-[13px] text-muted-foreground",children:"Messages sent in listed order"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx("div",{className:"text-[13px] font-medium",children:"Show all details"}),t.jsx(cle,{defaultChecked:e,onCheckedChange:()=>{r(!e)}})]})]}),t.jsx("div",{className:"flex-1 flex flex-col gap-3",children:t.jsxs(zB,{mode:"popLayout",children:[y(),v.map(((e,n)=>t.jsx(AX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,delay:.05*n,ease:"easeInOut"},children:t.jsx(Ame,{actionDataWithMetadata:e})},e.actionData.actionMetadata?.currentActionId??n))),p.triggerType===Fe.ONE_TIME&&t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx(Sme,{})},"one-time-trigger")]})})]})},Rme=()=>{const e=aZ(),{segments:n}=QX();return t.jsx("div",e&&n?{className:"h-full pt-4 relative",children:t.jsx("div",{className:"absolute inset-0 overflow-y-auto flex flex-col gap-3",children:t.jsx(Nme,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(hZ,{text:[`Getting details on your ${ff("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},Ome=({hideSms:e})=>{const{state:{selectedActionId:r}}=n.useContext(VX);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(zB,{mode:"wait",children:r===Yte.EditTime?t.jsx(Mse,{}):r===Yte.EditAudience?t.jsx(Tle,{}):t.jsx(Tre,{hideSms:e})})})},Pme=({hideSms:e})=>t.jsxs(fme,{direction:"horizontal",className:"flex-1",children:[t.jsx(hme,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(Rme,{})})}),t.jsx(mme,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(hme,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(Ome,{hideSms:e})})})]}),kme=({hideSms:e,hideSales:r})=>{const[o,i]=n.useState("workflow"),a=[{id:"workflow",label:"Workflow",content:t.jsx(Pme,{hideSms:e})},{id:"recipients",label:"Recipients",content:t.jsx(Lfe,{})},{id:"insights",label:ff("engage:insight",{count:2}),content:t.jsx(jfe,{hideSms:e,hideSales:r})}];return t.jsx("div",{className:"h-full w-full",children:t.jsx(Dle,{tabs:a,activeTab:o,onTabChange:i,tabsLocation:"left"})})},Mme=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i,hideSms:a,hideSales:s})=>{const l=aZ(),c=sZ(),{updateCommunicationGroup:u}=KX(),{toast:d}=jl();return n.useEffect((()=>{if(c&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(c.extraMergeFields)&&u({groupId:c?.id,params:{extraMergeFields:e}},{onError:e=>{d({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[c,i,u,d]),l&&c?t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(Mfe,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(kme,{hideSms:a,hideSales:s})})]}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(hZ,{text:[`Fetching ${ff("engage:automation").toLowerCase()} data`,"Finishing up"]})})},jme=({...e})=>{const n=function(){let{matches:e}=i.useContext(U5),t=e[e.length-1];return t?t.params:{}}(),[r]=N4(),o=e.automationId||n?.automationId||r.get("automationId")||"",a="true"===r.get("showBackButton")||e.showBackButton;return t.jsx(cZ,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(Mme,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var Lme=e=>null!=e;var Dme=e=>"function"!=typeof e||e.length?e:e(),Ime=e=>Array.isArray(e)?e:e?[e]:[];var Fme=mt;var Ume,$me=function(e){const[t,n]=at(),r=e?.throw?(e,t)=>{throw n(e instanceof Error?e:new Error(t)),e}:(e,t)=>{n(e instanceof Error?e:new Error(t))},o=e?.api?Array.isArray(e.api)?e.api:[e.api]:[globalThis.localStorage].filter(Boolean),i=e?.prefix?`${e.prefix}.`:"",a=new Map,s=new Proxy({},{get(t,n){let s=a.get(n);s||(s=at(void 0,{equals:!1}),a.set(n,s)),s[0]();const l=o.reduce(((e,t)=>{if(null!==e||!t)return e;try{return t.getItem(`${i}${n}`)}catch(eEe){return r(eEe,`Error reading ${i}${n} from ${t.name}`),null}}),null);return null!==l&&e?.deserializer?e.deserializer(l,n,e.options):l}});return!1!==e?.sync&&ht((()=>{const e=e=>{let t=!1;o.forEach((n=>{try{n!==e.storageArea&&e.key&&e.newValue!==n.getItem(e.key)&&(e.newValue?n.setItem(e.key,e.newValue):n.removeItem(e.key),t=!0)}catch(eEe){r(eEe,`Error synching api ${n.name} from storage event (${e.key}=${e.newValue})`)}})),t&&e.key&&a.get(e.key)?.[1]()};"addEventListener"in globalThis?(globalThis.addEventListener("storage",e),mt((()=>globalThis.removeEventListener("storage",e)))):(o.forEach((t=>t.addEventListener?.("storage",e))),mt((()=>o.forEach((t=>t.removeEventListener?.("storage",e))))))})),[s,(t,n,s)=>{const l=e?.serializer?e.serializer(n,t,s??e.options):n,c=`${i}${t}`;o.forEach((e=>{try{e.getItem(c)!==l&&e.setItem(c,l)}catch(eEe){r(eEe,`Error setting ${i}${t} to ${l} in ${e.name}`)}}));const u=a.get(t);u&&u[1]()},{clear:()=>o.forEach((e=>{try{e.clear()}catch(eEe){r(eEe,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(eEe){r(eEe,`Error removing ${i}${e} from ${t.name}`)}})),toJSON:()=>{const t={},n=(n,r)=>{if(!t.hasOwnProperty(n)){const o=r&&e?.deserializer?e.deserializer(r,n,e.options):r;o&&(t[n]=o)}};return o.forEach((e=>{if("function"==typeof e.getAll){let t;try{t=e.getAll()}catch(eEe){r(eEe,`Error getting all values from in ${e.name}`)}for(const e of t)n(e,t[e])}else{let o,i=0;try{for(;o=e.key(i++);)t.hasOwnProperty(o)||n(o,e.getItem(o))}catch(eEe){r(eEe,`Error getting all values from ${e.name}`)}}})),t}}]},Vme=e=>{if(!e)return"";let t="";for(const n in e){if(!e.hasOwnProperty(n))continue;const r=e[n];t+=r instanceof Date?`; ${n}=${r.toUTCString()}`:"boolean"==typeof r?`; ${n}`:`; ${n}=${r}`}return t},Bme=("function"==typeof(Ume={_cookies:[globalThis.document,"cookie"],getItem:e=>Bme._cookies[0][Bme._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=Bme.getItem(e);Bme._cookies[0][Bme._cookies[1]]=`${e}=${t}${Vme(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:Bme});window.dispatchEvent(o)},removeItem:e=>{Bme._cookies[0][Bme._cookies[1]]=`${e}=deleted${Vme({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return Bme._cookies[0][Bme._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return Bme._cookies[0][Bme._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(Ume.clear=()=>{let e;for(;e=Ume.key(0);)Ume.removeItem(e)}),Ume),zme=796,Hme="bottom",qme="system",Gme=Object.keys(Nr)[0],Kme=Object.keys(Pr)[0],Wme=xt({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Yme(){return wt(Wme)}var Xme=xt(void 0),Zme=e=>{const[t,n]=at(null),r=()=>{const e=t();null!=e&&(e.close(),n(null))},o=(r,o)=>{if(null!=t())return;const i=window.open("","TSQD-Devtools-Panel",`width=${r},height=${o},popup`);if(!i)throw new Error("Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.");i.document.head.innerHTML="",i.document.body.innerHTML="",function(e=window.document){if(e[un]){for(let t of e[un].keys())e.removeEventListener(t,En);delete e[un]}}(i.document),i.document.title="TanStack Query Devtools",i.document.body.style.margin="0",i.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(Yme().shadowDOMTarget||document).styleSheets].forEach((e=>{try{const t=[...e.cssRules].map((e=>e.cssText)).join(""),n=document.createElement("style"),r=e.ownerNode;let o="";r&&"id"in r&&(o=r.id),o&&n.setAttribute("id",o),n.textContent=t,i.document.head.appendChild(n)}catch(JSe){const n=document.createElement("link");if(null==e.href)return;n.rel="stylesheet",n.type=e.type,n.media=e.media.toString(),n.href=e.href,i.document.head.appendChild(n)}})),fn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],i.document),e.setLocalStore("pip_open","true"),n(i)};ct((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||o(Number(window.innerWidth),Number(e.localStore.height||500))})),ct((()=>{const e=(Yme().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(Yme().shadowDOMTarget||n.document).querySelector("#_goober");t&&(t.textContent=e.textContent)}));t.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),mt((()=>{t.disconnect()}))}}));const i=ut((()=>({pipWindow:t(),requestPipWindow:o,closePipWindow:r,disabled:e.disabled??!1})));return $t(Xme.Provider,{value:i,get children(){return e.children}})},Qme=()=>ut((()=>{const e=wt(Xme);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Jme=xt((()=>"dark"));function ege(){return wt(Jme)}var tge={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Ấ":"A","Ắ":"A","Ẳ":"A","Ẵ":"A","Ặ":"A","Æ":"AE","Ầ":"A","Ằ":"A","Ȃ":"A","Ç":"C","Ḉ":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ế":"E","Ḗ":"E","Ề":"E","Ḕ":"E","Ḝ":"E","Ȇ":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ḯ":"I","Ȋ":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ố":"O","Ṍ":"O","Ṓ":"O","Ȏ":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ấ":"a","ắ":"a","ẳ":"a","ẵ":"a","ặ":"a","æ":"ae","ầ":"a","ằ":"a","ȃ":"a","ç":"c","ḉ":"c","è":"e","é":"e","ê":"e","ë":"e","ế":"e","ḗ":"e","ề":"e","ḕ":"e","ḝ":"e","ȇ":"e","ì":"i","í":"i","î":"i","ï":"i","ḯ":"i","ȋ":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ố":"o","ṍ":"o","ṓ":"o","ȏ":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Ĉ":"C","ĉ":"c","Ċ":"C","ċ":"c","Č":"C","č":"c","C̆":"C","c̆":"c","Ď":"D","ď":"d","Đ":"D","đ":"d","Ē":"E","ē":"e","Ĕ":"E","ĕ":"e","Ė":"E","ė":"e","Ę":"E","ę":"e","Ě":"E","ě":"e","Ĝ":"G","Ǵ":"G","ĝ":"g","ǵ":"g","Ğ":"G","ğ":"g","Ġ":"G","ġ":"g","Ģ":"G","ģ":"g","Ĥ":"H","ĥ":"h","Ħ":"H","ħ":"h","Ḫ":"H","ḫ":"h","Ĩ":"I","ĩ":"i","Ī":"I","ī":"i","Ĭ":"I","ĭ":"i","Į":"I","į":"i","İ":"I","ı":"i","IJ":"IJ","ij":"ij","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","Ḱ":"K","ḱ":"k","K̆":"K","k̆":"k","Ĺ":"L","ĺ":"l","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ŀ":"L","ŀ":"l","Ł":"l","ł":"l","Ḿ":"M","ḿ":"m","M̆":"M","m̆":"m","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","ʼn":"n","N̆":"N","n̆":"n","Ō":"O","ō":"o","Ŏ":"O","ŏ":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","P̆":"P","p̆":"p","Ŕ":"R","ŕ":"r","Ŗ":"R","ŗ":"r","Ř":"R","ř":"r","R̆":"R","r̆":"r","Ȓ":"R","ȓ":"r","Ś":"S","ś":"s","Ŝ":"S","ŝ":"s","Ş":"S","Ș":"S","ș":"s","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","ț":"t","Ț":"T","Ť":"T","ť":"t","Ŧ":"T","ŧ":"t","T̆":"T","t̆":"t","Ũ":"U","ũ":"u","Ū":"U","ū":"u","Ŭ":"U","ŭ":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ȗ":"U","ȗ":"u","V̆":"V","v̆":"v","Ŵ":"W","ŵ":"w","Ẃ":"W","ẃ":"w","X̆":"X","x̆":"x","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Y̆":"Y","y̆":"y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","ſ":"s","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Ǎ":"A","ǎ":"a","Ǐ":"I","ǐ":"i","Ǒ":"O","ǒ":"o","Ǔ":"U","ǔ":"u","Ǖ":"U","ǖ":"u","Ǘ":"U","ǘ":"u","Ǚ":"U","ǚ":"u","Ǜ":"U","ǜ":"u","Ứ":"U","ứ":"u","Ṹ":"U","ṹ":"u","Ǻ":"A","ǻ":"a","Ǽ":"AE","ǽ":"ae","Ǿ":"O","ǿ":"o","Þ":"TH","þ":"th","Ṕ":"P","ṕ":"p","Ṥ":"S","ṥ":"s","X́":"X","x́":"x","Ѓ":"Г","ѓ":"г","Ќ":"К","ќ":"к","A̋":"A","a̋":"a","E̋":"E","e̋":"e","I̋":"I","i̋":"i","Ǹ":"N","ǹ":"n","Ồ":"O","ồ":"o","Ṑ":"O","ṑ":"o","Ừ":"U","ừ":"u","Ẁ":"W","ẁ":"w","Ỳ":"Y","ỳ":"y","Ȁ":"A","ȁ":"a","Ȅ":"E","ȅ":"e","Ȉ":"I","ȉ":"i","Ȍ":"O","ȍ":"o","Ȑ":"R","ȑ":"r","Ȕ":"U","ȕ":"u","B̌":"B","b̌":"b","Č̣":"C","č̣":"c","Ê̌":"E","ê̌":"e","F̌":"F","f̌":"f","Ǧ":"G","ǧ":"g","Ȟ":"H","ȟ":"h","J̌":"J","ǰ":"j","Ǩ":"K","ǩ":"k","M̌":"M","m̌":"m","P̌":"P","p̌":"p","Q̌":"Q","q̌":"q","Ř̩":"R","ř̩":"r","Ṧ":"S","ṧ":"s","V̌":"V","v̌":"v","W̌":"W","w̌":"w","X̌":"X","x̌":"x","Y̌":"Y","y̌":"y","A̧":"A","a̧":"a","B̧":"B","b̧":"b","Ḑ":"D","ḑ":"d","Ȩ":"E","ȩ":"e","Ɛ̧":"E","ɛ̧":"e","Ḩ":"H","ḩ":"h","I̧":"I","i̧":"i","Ɨ̧":"I","ɨ̧":"i","M̧":"M","m̧":"m","O̧":"O","o̧":"o","Q̧":"Q","q̧":"q","U̧":"U","u̧":"u","X̧":"X","x̧":"x","Z̧":"Z","z̧":"z"},nge=Object.keys(tge).join("|"),rge=new RegExp(nge,"g");var oge=7,ige=6,age=5,sge=4,lge=3,cge=2,uge=1,dge=0;function pge(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:uge,!n.accessors){const r=fge(e,t,n);return{rankedValue:e,rank:r,accessorIndex:-1,accessorThreshold:n.threshold,passed:r>=n.threshold}}const o=function(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r],i=vge(o),a=mge(e,o);for(let e=0,t=a.length;e<t;e++)n.push({itemValue:a[e],attributes:i})}return n}(e,n.accessors),i={rankedValue:e,rank:dge,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=fge(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=uge?r=s:r>l&&(r=l),r=Math.min(r,l),r>=c&&r>i.rank&&(i.rank=r,i.passed=!0,i.accessorIndex=a,i.accessorThreshold=c,i.rankedValue=e.itemValue)}return i}function fge(e,t,n){return e=hge(e,n),(t=hge(t,n)).length>e.length?dge:e===t?oge:(e=e.toLowerCase())===(t=t.toLowerCase())?ige:e.startsWith(t)?age:e.includes(` ${t}`)?sge:e.includes(t)?lge:1===t.length?dge:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?cge:function(e,t){let n=0,r=0;function o(e,t,r){for(let o=r,i=t.length;o<i;o++){if(t[o]===e)return n+=1,o+1}return-1}function i(e){return uge+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return dge;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return dge}return i(r-a)}(e,t)}function hge(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(rge,(e=>tge[e]))),e}function mge(e,t){let n=t;"object"==typeof t&&(n=t.accessor);const r=n(e);return null==r?[]:Array.isArray(r)?r:[String(r)]}var gge={maxRanking:1/0,minRanking:-1/0};function vge(e){return"function"==typeof e?gge:{...gge,...e}}var yge={data:""},bge=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,xge=/\/\*[^]*?\*\/| +/g,wge=/\n+/g,_ge=(e,t)=>{let n="",r="",o="";for(let i in e){let a=e[i];"@"==i[0]?"i"==i[1]?n=i+" "+a+";":r+="f"==i[1]?_ge(a,i):i+"{"+_ge(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=_ge(a,t?t.replace(/([^,])+/g,(e=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,(t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)))):i):null!=a&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=_ge.p?_ge.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},Sge={},Ege=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+Ege(e[n]);return t}return e};function Tge(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=Ege(e),a=Sge[i]||(Sge[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!Sge[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=bge.exec(e.replace(xge,""));)t[4]?r.shift():t[3]?(n=t[3].replace(wge," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(wge," ").trim();return r[0]})(e);Sge[a]=_ge(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&Sge.g?Sge.g:null;return n&&(Sge.g=Sge[a]),l=Sge[a],c=t,u=r,(d=s)?c.data=c.data.replace(d,l):-1===c.data.indexOf(l)&&(c.data=u?l+c.data:c.data+l),a;var l,c,u,d})(n.unshift?n.raw?((e,t,n)=>e.reduce(((e,r,o)=>{let i=t[o];if(i&&i.call){let e=i(n),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;i=t?"."+t:e&&"object"==typeof e?e.props?"":_ge(e,""):!1===e?"":e}return e+r+(null==i?"":i)}),""))(n,[].slice.call(arguments,1),t.p):n.reduce(((e,n)=>Object.assign(e,n&&n.call?n(t.p):n)),{}):n,(r=t.target,"object"==typeof window?((r?r.querySelector("#_goober"):window._goober)||Object.assign((r||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:r||yge),t.g,t.o,t.k);var r}function Cge(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Cge(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Age(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Cge(e))&&(r&&(r+=" "),r+=t);return r}function Nge(e,t){const n=pt(e),{onChange:r}=t;let o=new Set(t.appear?void 0:n);const i=new WeakSet,[a,s]=at([],{equals:!1}),[l]=[yt,vt],c=e=>{s((t=>(t.push.apply(t,e),t)));for(const t of e)i.delete(t)},u=(e,t,n)=>e.splice(n,0,t);return ut((t=>{const n=a(),s=e();if(pt(l))return l(),t;if(n.length){const e=t.filter((e=>!n.includes(e)));return n.length=0,r({list:e,added:[],removed:[],unchanged:e,finishRemoved:c}),e}return pt((()=>{const e=new Set(s),n=s.slice(),a=[],l=[],d=[];for(const t of s)(o.has(t)?d:a).push(t);let p=!a.length;for(let r=0;r<t.length;r++){const o=t[r];e.has(o)||(i.has(o)||(l.push(o),i.add(o)),u(n,o,r)),p&&o!==n[r]&&(p=!1)}return!l.length&&p?t:(r({list:n,added:a,removed:l,unchanged:d,finishRemoved:c}),o=e,n)}))}),t.appear?[]:n.slice())}function Rge(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}Tge.bind({g:1}),Tge.bind({k:1});var Oge=e=>e instanceof Element;function Pge(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return Pge(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=Pge(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function kge(e,t=Oge,n=Oge){const r=ut(e),o=ut((()=>Pge(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function Mge(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function jge(e,t,n,r){const{onBeforeEnter:o,onEnter:i,onAfterEnter:a}=t;function s(t){t&&t.target!==n||(n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.enterActive),n.classList.remove(...e.enterTo),a?.(n))}o?.(n),n.classList.add(...e.enter),n.classList.add(...e.enterActive),queueMicrotask((()=>{if(!n.parentNode)return r?.();i?.(n,(()=>s()))})),Mge((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function Lge(e,t,n,r){const{onBeforeExit:o,onExit:i,onAfterExit:a}=t;if(!n.parentNode)return r?.();function s(t){t&&t.target!==n||(r?.(),n.removeEventListener("transitionend",s),n.removeEventListener("animationend",s),n.classList.remove(...e.exitActive),n.classList.remove(...e.exitTo),a?.(n))}o?.(n),n.classList.add(...e.exit),n.classList.add(...e.exitActive),i?.(n,(()=>s())),Mge((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var Dge=e=>{const t=function(e){return ut((()=>{const t=e.name||"s";return{enterActive:(e.enterActiveClass||t+"-enter-active").split(" "),enter:(e.enterClass||t+"-enter").split(" "),enterTo:(e.enterToClass||t+"-enter-to").split(" "),exitActive:(e.exitActiveClass||t+"-exit-active").split(" "),exit:(e.exitClass||t+"-exit").split(" "),exitTo:(e.exitToClass||t+"-exit-to").split(" "),move:(e.moveClass||t+"-move").split(" ")}}))}(e);return Nge(kge((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)jge(a,e,t);const s=[];for(const e of i)e.isConnected&&(e instanceof HTMLElement||e instanceof SVGElement)&&s.push({el:e,rect:e.getBoundingClientRect()});queueMicrotask((()=>{const e=[];for(const{el:t,rect:n}of s)if(t.isConnected){const r=t.getBoundingClientRect(),o=n.left-r.left,i=n.top-r.top;(o||i)&&(t.style.transform=`translate(${o}px, ${i}px)`,t.style.transitionDuration="0s",e.push(t))}document;for(const t of e){let e=function(n){(n.target===t||/transform$/.test(n.propertyName))&&(t.removeEventListener("transitionend",e),t.classList.remove(...a.move))};t.classList.add(...a.move),t.style.transform=t.style.transitionDuration="",t.addEventListener("transitionend",e)}}));for(const t of r)Lge(a,e,t,(()=>o([t])))}})},Ige=Symbol("fallback");function Fge(e){for(const t of e)t.dispose()}function Uge(e){const{by:t}=e;return ut(function(e,t,n,r={}){const o=new Map;return mt((()=>Fge(o.values()))),()=>{const n=e()||[];return pt((()=>{if(!n.length)return Fge(o.values()),o.clear(),r.fallback?[it((e=>(o.set(Ige,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(Ige);if(!o.size||a){a?.dispose(),o.delete(Ige);for(let r=0;r<n.length;r++){const o=n[r];i(e,o,r,t(o,r))}return e}const s=new Set(o.keys());for(let r=0;r<n.length;r++){const a=n[r],l=t(a,r);s.delete(l);const c=o.get(l);c?(e[r]=c.mapped,c.setIndex?.(r),c.setItem((()=>a))):i(e,a,r,l)}for(const t of s)o.get(t)?.dispose(),o.delete(t);return e}))};function i(e,t,r,i){it((a=>{const[s,l]=at(t),c={setItem:l,dispose:a};if(n.length>1){const[e,t]=at(r);c.setIndex=t,c.mapped=n(s,e)}else c.mapped=n(s);o.set(i,c),e[r]=c.mapped}))}}((()=>e.each),"function"==typeof t?t:e=>e[t],e.children,"fallback"in e?{fallback:()=>e.fallback}:void 0))}function $ge(e,t,n,r){const o=()=>{Ime(Dme(e)).forEach((e=>{e&&Ime(Dme(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),Fme(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?ct(o):lt(o)}function Vge(e,t,n){const r=new WeakMap,{observe:o,unobserve:i}=function(e,t){const n=new ResizeObserver(e);return mt(n.disconnect.bind(n)),{observe:e=>n.observe(e,t),unobserve:n.unobserve.bind(n)}}((e=>{for(const n of e){const{contentRect:e,target:o}=n,i=Math.round(e.width),a=Math.round(e.height),s=r.get(o);s&&s.width===i&&s.height===a||(t(e,o,n),r.set(o,{width:i,height:a}))}}),n);ct((t=>{const n=Ime(Dme(e)).filter(Lme);return function(e,t,n,r){const o=e.length,i=t.length;let a,s,l=0;if(i)if(o){for(;l<i&&t[l]===e[l];l++);for(a of(t=t.slice(l),e=e.slice(l),t))e.includes(a)||r(a);for(s of e)t.includes(s)||n(s)}else for(;l<i;l++)r(t[l]);else for(;l<o;l++)n(e[l])}(n,t,o,i),n}),[])}var Bge=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function zge(e){const t={};let n;for(;n=Bge.exec(e);)t[n[1]]=n[2];return t}function Hge(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=zge(e)}else"string"==typeof t&&(t=zge(t));return{...e,...t}}function qge(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function Gge(e){return"[object String]"===Object.prototype.toString.call(e)}function Kge(e){return t=>`${e()}-${t}`}function Wge(e,t){return!!e&&(e===t||e.contains(t))}function Yge(e,t=!1){const{activeElement:n}=Xge(e);if(!n?.nodeName)return null;if(Zge(n)&&n.contentDocument)return Yge(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Xge(n).getElementById(e);if(t)return t}}return n}function Xge(e){return e?e.ownerDocument||e:document}function Zge(e){return"IFRAME"===e.tagName}var Qge=(e=>(e.Escape="Escape",e.Enter="Enter",e.Tab="Tab",e.Space=" ",e.ArrowDown="ArrowDown",e.ArrowLeft="ArrowLeft",e.ArrowRight="ArrowRight",e.ArrowUp="ArrowUp",e.End="End",e.Home="Home",e.PageDown="PageDown",e.PageUp="PageUp",e))(Qge||{});function Jge(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function eve(){return Jge(/^Mac/i)}function tve(){return Jge(/^iPhone/i)||Jge(/^iPad/i)||eve()&&navigator.maxTouchPoints>1}function nve(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function rve(e){return t=>{for(const n of e)nve(t,n)}}function ove(e){return eve()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function ive(e){if(e)if(function(){if(null==ave){ave=!1;try{document.createElement("div").focus({get preventScroll(){return ave=!0,!0}})}catch(JSe){}}return ave}())e.focus({preventScroll:!0});else{const t=function(e){let t=e.parentNode;const n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft});return n}(e);e.focus(),function(e){for(const{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}(t)}}var ave=null;var sve=["input:not([type='hidden']):not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","[tabindex]","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]:not([contenteditable='false'])"],lve=[...sve,'[tabindex]:not([tabindex="-1"]):not([disabled])'],cve=sve.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",uve=lve.join(':not([hidden]):not([tabindex="-1"]),');function dve(e,t){const n=Array.from(e.querySelectorAll(cve)).filter(pve);return t&&pve(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Zge(e)&&e.contentDocument){const r=dve(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function pve(e){return fve(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function fve(e){return e.matches(cve)&&hve(e)}function hve(e,t){return"#comment"!==e.nodeName&&function(e){if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const{display:t,visibility:n}=e.style;let r="none"!==t&&"hidden"!==n&&"collapse"!==n;if(r){if(!e.ownerDocument.defaultView)return r;const{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:o}=t(e);r="none"!==n&&"hidden"!==o&&"collapse"!==o}return r}(e)&&function(e,t){return!e.hasAttribute("hidden")&&("DETAILS"!==e.nodeName||!t||"SUMMARY"===t.nodeName||e.hasAttribute("open"))}(e,t)&&(!e.parentElement||hve(e.parentElement,e))}function mve(e){for(;e&&!gve(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function gve(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function vve(){}function yve(e,t){return qt(e,t)}var bve=new Map,xve=new Set;function wve(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=bve.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),bve.delete(t.target)),0===bve.size)){for(const e of xve)e();xve.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=bve.get(t.target);n||(n=new Set,bve.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function _ve(e,t){const n=Sve(e,t,"left"),r=Sve(e,t,"top"),o=t.offsetWidth,i=t.offsetHeight;let a=e.scrollLeft,s=e.scrollTop;const l=a+e.offsetWidth,c=s+e.offsetHeight;n<=a?a=n:n+o>l&&(a+=n+o-l),r<=s?s=r:r+i>c&&(s+=r+i-c),e.scrollLeft=a,e.scrollTop=s}function Sve(e,t,n){const r="left"===n?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);){if(t.offsetParent.contains(e)){o-=e[r];break}t=t.offsetParent}return o}"undefined"!=typeof document&&("loading"!==document.readyState?wve():document.addEventListener("DOMContentLoaded",wve));var Eve={border:"0",clip:"rect(0 0 0 0)","clip-path":"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:"0",position:"absolute",width:"1px","white-space":"nowrap"};function Tve(e){return t=>(e(t),()=>e(void 0))}function Cve(e,t){const[n,r]=at(Ave(t?.()));return ct((()=>{r(e()?.tagName.toLowerCase()||Ave(t?.()))})),n}function Ave(e){return Gge(e)?e:void 0}function Nve(e){const[t,n]=Gt(e,["as"]);if(!t.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return $t(Pn,qt(n,{get component(){return t.as}}))}var Rve=["id","name","validationState","required","disabled","readOnly"];var Ove=xt();function Pve(){const e=wt(Ove);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function kve(e){const t=Pve(),n=yve({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Nve,qt({as:"div"},(()=>t.dataset()),n))}function Mve(e){const t=Pve(),n=yve({id:t.generateId("error-message")},e),[r,o]=Gt(n,["forceMount"]),i=()=>"invalid"===t.validationState();return ct((()=>{i()&&mt(t.registerErrorMessage(o.id))})),$t(Jt,{get when(){return r.forceMount||i()},get children(){return $t(Nve,qt({as:"div"},(()=>t.dataset()),o))}})}function jve(e){let t;const n=Pve(),r=yve({id:n.generateId("label")},e),[o,i]=Gt(r,["ref"]),a=Cve((()=>t),(()=>"label"));return ct((()=>mt(n.registerLabel(i.id)))),$t(Nve,qt({as:"label",ref(e){const n=Rge((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ut((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function Lve(e,t){ct(ft(e,(e=>{if(null==e)return;const n=function(e){return function(e){return e.matches("textarea, input, select, button")}(e)?e.form:e.closest("form")}(e);null!=n&&(n.addEventListener("reset",t,{passive:!0}),mt((()=>{n.removeEventListener("reset",t)})))})))}function Dve(e){const[t,n]=at(e.defaultValue?.()),r=ut((()=>void 0!==e.value?.())),o=ut((()=>r()?e.value?.():t()));return[o,t=>{pt((()=>{const i=function(e,...t){return"function"==typeof e?e(...t):e}(t,o());return Object.is(i,o())||(r()||n(i),e.onChange?.(i)),i}))}]}function Ive(e){const[t,n]=Dve(e);return[()=>t()??!1,n]}var Fve=Object.defineProperty,Uve=(e,t)=>{for(var n in t)Fve(e,n,{get:t[n],enumerable:!0})},$ve=xt();function Vve(){return wt($ve)}function Bve(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function zve(e,t){const n=function(e){const t=e.map(((e,t)=>[t,e]));let n=!1;return t.sort((([e,t],[r,o])=>{const i=t.ref(),a=o.ref();return i===a?0:i&&a?Bve(i,a)?(e>r&&(n=!0),-1):(e<r&&(n=!0),1):0})),n?t.map((([e,t])=>t)):e}(e);e!==n&&t(n)}function Hve(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){ct((()=>{const n=setTimeout((()=>{zve(e(),t)}));mt((()=>clearTimeout(n)))}))}(e,t);let n=[];ct((()=>{const r=function(e){const t=e[0],n=e[e.length-1]?.ref();let r=t?.ref()?.parentElement;for(;r;){if(n&&r.contains(n))return r;r=r.parentElement}return Xge(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&zve(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}mt((()=>o.disconnect()))}))}function qve(e={}){const[t,n]=function(e){const[t,n]=Dve(e);return[()=>t()??[],n]}({value:()=>Dme(e.items),onChange:t=>e.onItemsChange?.(t)});Hve(t,n);const r=e=>(n((t=>{const n=function(e,t){const n=t.ref();if(!n)return-1;let r=e.length;if(!r)return-1;for(;r--;){const t=e[r]?.ref();if(t&&Bve(t,n))return r+1}return 0}(t,e);return function(e,t,n=-1){return n in e?[...e.slice(0,n),t,...e.slice(n)]:[...e,t]}(t,e,n)})),()=>{n((t=>{const n=t.filter((t=>t.ref()!==e.ref()));return t.length===n.length?t:n}))});return{DomCollectionProvider:e=>$t($ve.Provider,{value:{registerItem:r},get children(){return e.children}})}}function Gve(e){const t=function(){const e=Vve();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=yve({shouldRegisterItem:!0},e);ct((()=>{if(!n.shouldRegisterItem)return;mt(t.registerItem(n.getItem()))}))}function Kve(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=Gge(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=Gge(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(Gge(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return Gge(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(Gge(l)||"number"==typeof l)r.push({type:"item",rawValue:l,key:String(l),textValue:String(l),disabled:a(l),level:n,index:t}),t++;else if(null!=s(l)){r.push({type:"section",rawValue:l,key:"",textValue:"",disabled:!1,level:n,index:t}),t++;const o=s(l)??[];if(o.length>0){const i=Kve({dataSource:o,getKey:e.getKey,getTextValue:e.getTextValue,getDisabled:e.getDisabled,getSectionChildren:e.getSectionChildren,startIndex:t,startLevel:n+1});r.push(...i),t+=i.length}}else r.push({type:"item",rawValue:l,key:o(l),textValue:i(l),disabled:a(l),level:n,index:t}),t++;return r}function Wve(e,t=[]){return ut((()=>{const n=Kve({dataSource:Dme(e.dataSource),getKey:Dme(e.getKey),getTextValue:Dme(e.getTextValue),getDisabled:Dme(e.getDisabled),getSectionChildren:Dme(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var Yve=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Xve=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Zve(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return Yve.has(t)}const t=e.split("-")[0];return Xve.has(t)}(e)?"rtl":"ltr"}function Qve(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Zve(e)}}var Jve=Qve(),eye=new Set;function tye(){Jve=Qve();for(const e of eye)e(Jve)}var nye=xt();function rye(){const e=function(){const[e,t]=at(Jve),n=ut((()=>e()));return ht((()=>{0===eye.size&&window.addEventListener("languagechange",tye),eye.add(t),mt((()=>{eye.delete(t),0===eye.size&&window.removeEventListener("languagechange",tye)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return wt(nye)||e}var oye=new Map;var iye=class e extends Set{anchorKey;currentKey;constructor(t,n,r){super(t),t instanceof e?(this.anchorKey=n||t.anchorKey,this.currentKey=r||t.currentKey):(this.anchorKey=n,this.currentKey=r)}};function aye(e){return eve()||tve()?e.altKey:e.ctrlKey}function sye(e){return eve()?e.metaKey:e.ctrlKey}function lye(e){return new iye(e)}function cye(e){const t=yve({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=at(!1),[o,i]=at(),a=ut((()=>{const e=Dme(t.selectedKeys);return null!=e?lye(e):e})),s=ut((()=>{const e=Dme(t.defaultSelectedKeys);return null!=e?lye(e):new iye})),[l,c]=function(e){const[t,n]=Dve(e);return[()=>t()??new iye,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=at(Dme(t.selectionBehavior));return ct((()=>{const e=l();"replace"===Dme(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),ct((()=>{d(Dme(t.selectionBehavior)??"toggle")})),{selectionMode:()=>Dme(t.selectionMode),disallowEmptySelection:()=>Dme(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!Dme(t.allowDuplicateSelectionEvents)&&function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(e,l())||c(e)}}}function uye(e,t,n){const r=qt({selectOnFocus:()=>"replace"===Dme(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=rye();let a={top:0,left:0};$ge((()=>Dme(r.isVirtualized)?void 0:o()),"scroll",(()=>{const e=o();e&&(a={top:e.scrollTop,left:e.scrollLeft})}));const{typeSelectHandlers:s}=function(e){const[t,n]=at(""),[r,o]=at(-1);return{typeSelectHandlers:{onKeyDown:i=>{if(Dme(e.isDisabled))return;const a=Dme(e.keyboardDelegate),s=Dme(e.selectionManager);if(!a.getKeyForSearch)return;const l=function(e){return 1!==e.length&&/^[A-Z]/i.test(e)?"":e}(i.key);if(!l||i.ctrlKey||i.metaKey)return;" "===l&&t().trim().length>0&&(i.preventDefault(),i.stopPropagation());let c=n((e=>e+l)),u=a.getKeyForSearch(c,s.focusedKey())??a.getKeyForSearch(c);null==u&&function(e){return e.split("").every((t=>t===e[0]))}(c)&&(c=c[0],u=a.getKeyForSearch(c,s.focusedKey())??a.getKeyForSearch(c)),null!=u&&(s.setFocusedKey(u),e.onTypeSelect?.(u)),clearTimeout(r()),o(window.setTimeout((()=>n("")),500))}}}}({isDisabled:()=>Dme(r.disallowTypeAhead),keyboardDelegate:()=>Dme(r.keyboardDelegate),selectionManager:()=>Dme(r.selectionManager)}),l=()=>Dme(r.orientation)??"vertical",c=()=>{const e=Dme(r.autoFocus);if(!e)return;const n=Dme(r.selectionManager),o=Dme(r.keyboardDelegate);let i;"first"===e&&(i=o.getFirstKey?.()),"last"===e&&(i=o.getLastKey?.());const a=n.selectedKeys();a.size&&(i=a.values().next().value),n.setFocused(!0),n.setFocusedKey(i);const s=t();s&&null==i&&!Dme(r.shouldUseVirtualFocus)&&ive(s)};ht((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),ct(ft([o,()=>Dme(r.isVirtualized),()=>Dme(r.selectionManager).focusedKey()],(e=>{const[t,n,o]=e;if(n)o&&r.scrollToKey?.(o);else if(o&&t){const e=t.querySelector(`[data-key="${o}"]`);e&&_ve(t,e)}})));return{tabIndex:ut((()=>{if(!Dme(r.shouldUseVirtualFocus))return null==Dme(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{nve(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=Dme(r.selectionManager),a=Dme(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!aye(e)&&o.replaceSelection(t))},u=Dme(r.keyboardDelegate),d=Dme(r.shouldFocusWrap),p=o.focusedKey();switch(e.key){case"vertical"===l()?"ArrowDown":"ArrowRight":if(u.getKeyBelow){let t;e.preventDefault(),t=null!=p?u.getKeyBelow(p):u.getFirstKey?.(),null==t&&d&&(t=u.getFirstKey?.(p)),c(t)}break;case"vertical"===l()?"ArrowUp":"ArrowLeft":if(u.getKeyAbove){let t;e.preventDefault(),t=null!=p?u.getKeyAbove(p):u.getLastKey?.(),null==t&&d&&(t=u.getLastKey?.(p)),c(t)}break;case"vertical"===l()?"ArrowLeft":"ArrowUp":if(u.getKeyLeftOf){e.preventDefault();const t="rtl"===i();let n;n=null!=p?u.getKeyLeftOf(p):t?u.getFirstKey?.():u.getLastKey?.(),c(n)}break;case"vertical"===l()?"ArrowRight":"ArrowDown":if(u.getKeyRightOf){e.preventDefault();const t="rtl"===i();let n;n=null!=p?u.getKeyRightOf(p):t?u.getLastKey?.():u.getFirstKey?.(),c(n)}break;case"Home":if(u.getFirstKey){e.preventDefault();const t=u.getFirstKey(p,sye(e));null!=t&&(o.setFocusedKey(t),sye(e)&&e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&o.replaceSelection(t))}break;case"End":if(u.getLastKey){e.preventDefault();const t=u.getLastKey(p,sye(e));null!=t&&(o.setFocusedKey(t),sye(e)&&e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&o.replaceSelection(t))}break;case"PageDown":if(u.getKeyPageBelow&&null!=p){e.preventDefault();c(u.getKeyPageBelow(p))}break;case"PageUp":if(u.getKeyPageAbove&&null!=p){e.preventDefault();c(u.getKeyPageAbove(p))}break;case"a":sye(e)&&"multiple"===o.selectionMode()&&!0!==Dme(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),Dme(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!Dme(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?uve:cve,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&hve(e)&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});return t?.from&&(r.currentNode=t.from),r}(n,{tabbable:!0});let t,r;do{r=e.lastChild(),r&&(t=r)}while(r);t&&!t.contains(document.activeElement)&&ive(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=Dme(r.selectionManager),n=Dme(r.keyboardDelegate),i=Dme(r.selectOnFocus);if(t.isFocused())e.currentTarget.contains(e.target)||t.setFocused(!1);else if(e.currentTarget.contains(e.target))if(t.setFocused(!0),null==t.focusedKey()){const r=e=>{null!=e&&(t.setFocusedKey(e),i&&t.replaceSelection(e))},o=e.relatedTarget;o&&e.currentTarget.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?r(t.lastSelectedKey()??n.getLastKey?.()):r(t.firstSelectedKey()??n.getFirstKey?.())}else if(!Dme(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(ive(n),_ve(e,n))}}},onFocusOut:e=>{const t=Dme(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function dye(e,t){const n=()=>Dme(e.selectionManager),r=()=>Dme(e.key),o=()=>Dme(e.shouldUseVirtualFocus),i=e=>{"none"!==n().selectionMode()&&("single"===n().selectionMode()?n().isSelected(r())&&!n().disallowEmptySelection()?n().toggleSelection(r()):n().replaceSelection(r()):e?.shiftKey?n().extendSelection(r()):"toggle"===n().selectionBehavior()||sye(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>Dme(e.disabled)||n().isDisabled(r()),s=()=>!a()&&n().canSelectItem(r());let l=null;const c=ut((()=>{if(!o()&&!a())return r()===n().focusedKey()?0:-1})),u=ut((()=>Dme(e.virtualized)?void 0:r()));return ct(ft([t,r,o,()=>n().focusedKey(),()=>n().isFocused()],(([t,n,r,o,i])=>{t&&n===o&&i&&!r&&document.activeElement!==t&&(e.focus?e.focus():ive(t))}))),{isSelected:()=>n().isSelected(r()),isDisabled:a,allowsSelection:s,tabIndex:c,dataKey:u,onPointerDown:t=>{s()&&(l=t.pointerType,"mouse"!==t.pointerType||0!==t.button||Dme(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&Dme(e.shouldSelectOnPressUp)&&Dme(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(Dme(e.shouldSelectOnPressUp)&&!Dme(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(aye(e)?n().toggleSelection(r()):i(e))},onMouseDown:e=>{a()&&e.preventDefault()},onFocus:e=>{const i=t();o()||a()||!i||e.target===i&&n().setFocusedKey(r())}}}var pye=class{collection;state;constructor(e,t){this.collection=e,this.state=t}selectionMode(){return this.state.selectionMode()}disallowEmptySelection(){return this.state.disallowEmptySelection()}selectionBehavior(){return this.state.selectionBehavior()}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}isFocused(){return this.state.isFocused()}setFocused(e){this.state.setFocused(e)}focusedKey(){return this.state.focusedKey()}setFocusedKey(e){(null==e||this.collection().getItem(e))&&this.state.setFocusedKey(e)}selectedKeys(){return this.state.selectedKeys()}isSelected(e){if("none"===this.state.selectionMode())return!1;const t=this.getKey(e);return null!=t&&this.state.selectedKeys().has(t)}isEmpty(){return 0===this.state.selectedKeys().size}isSelectAll(){if(this.isEmpty())return!1;const e=this.state.selectedKeys();return this.getAllSelectableKeys().every((t=>e.has(t)))}firstSelectedKey(){let e;for(const t of this.state.selectedKeys()){const n=this.collection().getItem(t);e&&!(null!=n?.index&&null!=e?.index&&n.index<e.index)||(e=n)}return e?.key}lastSelectedKey(){let e;for(const t of this.state.selectedKeys()){const n=this.collection().getItem(t);e&&!(null!=n?.index&&null!=e?.index&&n.index>e.index)||(e=n)}return e?.key}extendSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode())return void this.replaceSelection(e);const t=this.getKey(e);if(null==t)return;const n=this.state.selectedKeys(),r=n.anchorKey||t,o=new iye(n,r,t);for(const i of this.getKeyRange(r,n.currentKey||t))o.delete(i);for(const i of this.getKeyRange(t,r))this.canSelectItem(i)&&o.add(i);this.state.setSelectedKeys(o)}getKeyRange(e,t){const n=this.collection().getItem(e),r=this.collection().getItem(t);return n&&r?null!=n.index&&null!=r.index&&n.index<=r.index?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){const n=[];let r=e;for(;null!=r;){const e=this.collection().getItem(r);if(e&&"item"===e.type&&n.push(r),r===t)return n;r=this.collection().getKeyAfter(r)}return[]}getKey(e){const t=this.collection().getItem(e);return t?t&&"item"===t.type?t.key:null:e}toggleSelection(e){if("none"===this.selectionMode())return;if("single"===this.selectionMode()&&!this.isSelected(e))return void this.replaceSelection(e);const t=this.getKey(e);if(null==t)return;const n=new iye(this.state.selectedKeys());n.has(t)?n.delete(t):this.canSelectItem(t)&&(n.add(t),n.anchorKey=t,n.currentKey=t),this.disallowEmptySelection()&&0===n.size||this.state.setSelectedKeys(n)}replaceSelection(e){if("none"===this.selectionMode())return;const t=this.getKey(e);if(null==t)return;const n=this.canSelectItem(t)?new iye([t],t,t):new iye;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new iye;for(const n of e){const e=this.getKey(n);if(null!=e&&(t.add(e),"single"===this.selectionMode()))break}this.state.setSelectedKeys(t)}selectAll(){"multiple"===this.selectionMode()&&this.state.setSelectedKeys(new Set(this.getAllSelectableKeys()))}clearSelection(){const e=this.state.selectedKeys();!this.disallowEmptySelection()&&e.size>0&&this.state.setSelectedKeys(new iye)}toggleSelectAll(){this.isSelectAll()?this.clearSelection():this.selectAll()}select(e,t){"none"!==this.selectionMode()&&("single"===this.selectionMode()?this.isSelected(e)&&!this.disallowEmptySelection()?this.toggleSelection(e):this.replaceSelection(e):"toggle"===this.selectionBehavior()||t&&"touch"===t.pointerType?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys())return!0;const t=this.selectedKeys();if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;for(const n of t)if(!e.has(n))return!1;return!0}canSelectItem(e){if("none"===this.state.selectionMode())return!1;const t=this.collection().getItem(e);return null!=t&&!t.disabled}isDisabled(e){const t=this.collection().getItem(e);return!t||t.disabled}getAllSelectableKeys(){const e=[];return(t=>{for(;null!=t;){if(this.canSelectItem(t)){const n=this.collection().getItem(t);if(!n)continue;"item"===n.type&&e.push(t)}t=this.collection().getKeyAfter(t)}})(this.collection().getFirstKey()),e}},fye=class{keyMap=new Map;iterable;firstKey;lastKey;constructor(e){this.iterable=e;for(const r of e)this.keyMap.set(r.key,r);if(0===this.keyMap.size)return;let t,n=0;for(const[r,o]of this.keyMap)t?(t.nextKey=r,o.prevKey=t.key):(this.firstKey=r,o.prevKey=void 0),"item"===o.type&&(o.index=n++),t=o,t.nextKey=void 0;this.lastKey=t.key}*[Symbol.iterator](){yield*this.iterable}getSize(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){return this.keyMap.get(e)?.prevKey}getKeyAfter(e){return this.keyMap.get(e)?.nextKey}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const t=[...this.getKeys()];return this.getItem(t[e])}};var hye,mye=e=>"function"==typeof e?e():e,gye=e=>{const t=ut((()=>{const t=mye(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=at(mye(e.show)?"present":"hidden");let i="none";return ct((r=>{const a=mye(e.show);return pt((()=>{if(r===a)return a;const e=i,s=n();if(a)o("present");else if("none"===s||"none"===t()?.display)o("hidden");else{o(!0===r&&e!==s?"hiding":"hidden")}})),a})),ct((()=>{const t=mye(e.element);if(!t)return;const a=e=>{e.target===t&&(i=n())},s=e=>{const i=n().includes(e.animationName);e.target===t&&i&&"hiding"===r()&&o("hidden")};t.addEventListener("animationstart",a),t.addEventListener("animationcancel",s),t.addEventListener("animationend",s),mt((()=>{t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}))})),{present:()=>"present"===r()||"hiding"===r(),state:r}},vye="data-kb-top-layer",yye=!1,bye=[];function xye(e){return bye.findIndex((t=>t.node===e))}function wye(){return bye.filter((e=>e.isPointerBlocking))}function _ye(){return wye().length>0}function Sye(e){const t=xye([...wye()].slice(-1)[0]?.node);return xye(e)<t}var Eye={layers:bye,isTopMostLayer:function(e){return bye[bye.length-1].node===e},hasPointerBlockingLayer:_ye,isBelowPointerBlockingLayer:Sye,addLayer:function(e){bye.push(e)},removeLayer:function(e){const t=xye(e);t<0||bye.splice(t,1)},indexOf:xye,find:function(e){return bye[xye(e)]},assignPointerEventToLayers:function(){for(const{node:e}of bye)e.style.pointerEvents=Sye(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(_ye()&&!yye){const t=Xge(e);hye=document.body.style.pointerEvents,t.body.style.pointerEvents="none",yye=!0}},restoreBodyPointerEvents:function(e){if(_ye())return;const t=Xge(e);t.body.style.pointerEvents=hye,0===t.body.style.length&&t.body.removeAttribute("style"),yye=!1}};Uve({},{Button:()=>Aye,Root:()=>Cye});var Tye=["button","color","file","image","reset","submit"];function Cye(e){let t;const n=yve({type:"button"},e),[r,o]=Gt(n,["ref","type","disabled"]),i=Cve((()=>t),(()=>"button")),a=ut((()=>{const e=i();return null!=e&&function(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==Tye.indexOf(e.type)}({tagName:e,type:r.type})})),s=ut((()=>"input"===i())),l=ut((()=>"a"===i()&&null!=t?.getAttribute("href")));return $t(Nve,qt({as:"button",ref(e){const n=Rge((e=>t=e),r.ref);"function"==typeof n&&n(e)},get type(){return a()||s()?r.type:void 0},get role(){return a()||l()?void 0:"button"},get tabIndex(){return a()||l()||r.disabled?void 0:0},get disabled(){return a()||s()?r.disabled:void 0},get"aria-disabled"(){return!(a()||s()||!r.disabled)||void 0},get"data-disabled"(){return r.disabled?"":void 0}},o))}var Aye=Cye,Nye=["top","right","bottom","left"],Rye=Math.min,Oye=Math.max,Pye=Math.round,kye=Math.floor,Mye=e=>({x:e,y:e}),jye={left:"right",right:"left",bottom:"top",top:"bottom"},Lye={start:"end",end:"start"};function Dye(e,t,n){return Oye(e,Rye(t,n))}function Iye(e,t){return"function"==typeof e?e(t):e}function Fye(e){return e.split("-")[0]}function Uye(e){return e.split("-")[1]}function $ye(e){return"x"===e?"y":"x"}function Vye(e){return"y"===e?"height":"width"}function Bye(e){return["top","bottom"].includes(Fye(e))?"y":"x"}function zye(e){return $ye(Bye(e))}function Hye(e){return e.replace(/start|end/g,(e=>Lye[e]))}function qye(e){return e.replace(/left|right|bottom|top/g,(e=>jye[e]))}function Gye(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function Kye(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Wye(e,t,n){let{reference:r,floating:o}=e;const i=Bye(t),a=zye(t),s=Vye(a),l=Fye(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[s]/2-o[s]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Uye(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function Yye(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Iye(t,e),h=Gye(f),m=s[p?"floating"===d?"reference":"floating":d],g=Kye(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Kye(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function Xye(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zye(e){return Nye.some((t=>e[t]>=0))}function Qye(e){return tbe(e)?(e.nodeName||"").toLowerCase():"#document"}function Jye(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function ebe(e){var t;return null==(t=(tbe(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function tbe(e){return e instanceof Node||e instanceof Jye(e).Node}function nbe(e){return e instanceof Element||e instanceof Jye(e).Element}function rbe(e){return e instanceof HTMLElement||e instanceof Jye(e).HTMLElement}function obe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Jye(e).ShadowRoot)}function ibe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=dbe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function abe(e){return["table","td","th"].includes(Qye(e))}function sbe(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(JSe){return!1}}))}function lbe(e){const t=cbe(),n=nbe(e)?dbe(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function cbe(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function ube(e){return["html","body","#document"].includes(Qye(e))}function dbe(e){return Jye(e).getComputedStyle(e)}function pbe(e){return nbe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fbe(e){if("html"===Qye(e))return e;const t=e.assignedSlot||e.parentNode||obe(e)&&e.host||ebe(e);return obe(t)?t.host:t}function hbe(e){const t=fbe(e);return ube(t)?e.ownerDocument?e.ownerDocument.body:e.body:rbe(t)&&ibe(t)?t:hbe(t)}function mbe(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=hbe(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Jye(o);return i?t.concat(a,a.visualViewport||[],ibe(o)?o:[],a.frameElement&&n?mbe(a.frameElement):[]):t.concat(o,mbe(o,[],n))}function gbe(e){const t=dbe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rbe(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Pye(n)!==i||Pye(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function vbe(e){return nbe(e)?e:e.contextElement}function ybe(e){const t=vbe(e);if(!rbe(t))return Mye(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=gbe(t);let a=(i?Pye(n.width):n.width)/r,s=(i?Pye(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var bbe=Mye(0);function xbe(e){const t=Jye(e);return cbe()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:bbe}function wbe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=vbe(e);let a=Mye(1);t&&(r?nbe(r)&&(a=ybe(r)):a=ybe(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Jye(e))&&t}(i,n,r)?xbe(i):Mye(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,d=o.height/a.y;if(i){const e=Jye(i),t=r&&nbe(r)?Jye(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=ybe(o),t=o.getBoundingClientRect(),r=dbe(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,n=Jye(o),o=n.frameElement}}return Kye({width:u,height:d,x:l,y:c})}function _be(e){return wbe(ebe(e)).left+pbe(e).scrollLeft}function Sbe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Jye(e),r=ebe(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=cbe();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=ebe(e),n=pbe(e),r=e.ownerDocument.body,o=Oye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Oye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+_be(e);const s=-n.scrollTop;return"rtl"===dbe(r).direction&&(a+=Oye(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(ebe(e));else if(nbe(t))r=function(e,t){const n=wbe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=rbe(e)?ybe(e):Mye(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=xbe(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Kye(r)}function Ebe(e,t){const n=fbe(e);return!(n===t||!nbe(n)||ube(n))&&("fixed"===dbe(n).position||Ebe(n,t))}function Tbe(e,t,n){const r=rbe(t),o=ebe(t),i="fixed"===n,a=wbe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Mye(0);if(r||!r&&!i)if(("body"!==Qye(t)||ibe(o))&&(s=pbe(t)),r){const e=wbe(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=_be(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Cbe(e){return"static"===dbe(e).position}function Abe(e,t){return rbe(e)&&"fixed"!==dbe(e).position?t?t(e):e.offsetParent:null}function Nbe(e,t){const n=Jye(e);if(sbe(e))return n;if(!rbe(e)){let t=fbe(e);for(;t&&!ube(t);){if(nbe(t)&&!Cbe(t))return t;t=fbe(t)}return n}let r=Abe(e,t);for(;r&&abe(r)&&Cbe(r);)r=Abe(r,t);return r&&ube(r)&&Cbe(r)&&!lbe(r)?n:r||function(e){let t=fbe(e);for(;rbe(t)&&!ube(t);){if(lbe(t))return t;if(sbe(t))return null;t=fbe(t)}return null}(e)||n}var Rbe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=ebe(r),s=!!t&&sbe(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Mye(1);const u=Mye(0),d=rbe(r);if((d||!d&&!i)&&(("body"!==Qye(r)||ibe(a))&&(l=pbe(r)),rbe(r))){const e=wbe(r);c=ybe(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:ebe,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?sbe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=mbe(e,[],!1).filter((e=>nbe(e)&&"body"!==Qye(e))),o=null;const i="fixed"===dbe(e).position;let a=i?fbe(e):e;for(;nbe(a)&&!ube(a);){const t=dbe(a),n=lbe(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||ibe(a)&&!n&&Ebe(e,a))?r=r.filter((e=>e!==a)):o=t,a=fbe(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=Sbe(t,n,o);return e.top=Oye(r.top,e.top),e.right=Rye(r.right,e.right),e.bottom=Rye(r.bottom,e.bottom),e.left=Oye(r.left,e.left),e}),Sbe(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Nbe,getElementRects:async function(e){const t=this.getOffsetParent||Nbe,n=this.getDimensions,r=await n(e.floating);return{reference:Tbe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=gbe(e);return{width:t,height:n}},getScale:ybe,isElement:nbe,isRTL:function(e){return"rtl"===dbe(e).direction}};function Obe(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,c=vbe(e),u=o||i?[...c?mbe(c):[],...mbe(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&s?function(e,t){let n,r=null;const o=ebe(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const{left:c,top:u,width:d,height:p}=e.getBoundingClientRect();if(s||t(),!d||!p)return;const f={rootMargin:-kye(u)+"px "+-kye(o.clientWidth-(c+d))+"px "+-kye(o.clientHeight-(u+p))+"px "+-kye(c)+"px",threshold:Oye(0,Rye(1,l))||1};let h=!0;function m(e){const t=e[0].intersectionRatio;if(t!==l){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!1,1e-7)}),1e3)}h=!1}try{r=new IntersectionObserver(m,{...f,root:o.ownerDocument})}catch(JSe){r=new IntersectionObserver(m,f)}r.observe(e)}(!0),i}(c,n):null;let p,f=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!l&&h.observe(c),h.observe(t));let m=l?wbe(e):null;return l&&function t(){const r=wbe(e);!m||r.x===m.x&&r.y===m.y&&r.width===m.width&&r.height===m.height||n();m=r,p=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}var Pbe=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Fye(n),s=Uye(n),l="y"===Bye(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=Iye(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&"number"==typeof h&&(f="end"===s?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},kbe=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Iye(e,t),c={x:n,y:r},u=await Yye(t,l),d=Bye(Fye(o)),p=$ye(d);let f=c[p],h=c[d];if(i){f=Dye(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=Dye(h+u["y"===d?"top":"left"],h,h-u["y"===d?"bottom":"right"])}const m=s.fn({...t,[p]:f,[d]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Mbe=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=Iye(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=Fye(o),y=Bye(s),b=Fye(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[qye(s)]:function(e){const t=qye(e);return[Hye(e),t,Hye(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=Uye(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(Fye(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Hye)))),i}(s,m,h,x));const S=[s,...w],E=await Yye(t,g),T=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&T.push(E[v]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Uye(e),o=zye(e),i=Vye(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=qye(a)),[a,qye(a)]}(o,a,x);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,N;const e=((null==(A=i.flip)?void 0:A.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(N=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(f){case"bestFit":{var R;const e=null==(R=C.filter((e=>{if(_){const t=Bye(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},jbe=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:a=()=>{},...s}=Iye(e,t),l=await Yye(t,s),c=Fye(n),u=Uye(n),d="y"===Bye(n),{width:p,height:f}=r.floating;let h,m;"top"===c||"bottom"===c?(h=c,m=u===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,h="end"===u?"top":"bottom");const g=f-l.top-l.bottom,v=p-l.left-l.right,y=Rye(f-l[h],g),b=Rye(p-l[m],v),x=!t.middlewareData.shift;let w=y,_=b;if(d?_=u||x?Rye(b,v):v:w=u||x?Rye(y,g):g,x&&!u){const e=Oye(l.left,0),t=Oye(l.right,0),n=Oye(l.top,0),r=Oye(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:Oye(l.left,l.right)):w=f-2*(0!==n||0!==r?n+r:Oye(l.top,l.bottom))}await a({...t,availableWidth:_,availableHeight:w});const S=await o.getDimensions(i.floating);return p!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},Lbe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Iye(e,t);switch(r){case"referenceHidden":{const e=Xye(await Yye(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Zye(e)}}}case"escaped":{const e=Xye(await Yye(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Zye(e)}}}default:return{}}}}},Dbe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:u=0}=Iye(e,t)||{};if(null==c)return{};const d=Gye(u),p={x:n,y:r},f=zye(o),h=Vye(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],w=p[f]-i.reference[f],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=_?_[b]:0;S&&await(null==a.isElement?void 0:a.isElement(_))||(S=s.floating[b]||i.floating[h]);const E=x/2-w/2,T=S/2-m[h]/2-1,C=Rye(d[v],T),A=Rye(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=Dye(N,O,R),k=!l.arrow&&null!=Uye(o)&&O!==P&&i.reference[h]/2-(O<N?C:A)-m[h]/2<0,M=k?O<N?O-N:O-R:0;return{[f]:p[f]+M,data:{[f]:P,centerOffset:O-P-M,...k&&{alignmentOffset:M}},reset:k}}}),Ibe=(e,t,n)=>{const r={platform:Rbe,...n},o={...r.platform,_c:new Map};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=Wye(c,r,l),p=r,f={},h=0;for(let m=0;m<s.length;m++){const{name:n,fn:i}=s[m],{x:g,y:v,data:y,reset:b}=await i({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,f={...f,[n]:{...f[n],...y}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(p=b.placement),b.rects&&(c=!0===b.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=Wye(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},Fbe=xt();function Ube(){const e=wt(Fbe);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var $be=pn('<svg display="block" viewBox="0 0 30 30" style="transform:scale(1.02)"><g><path fill="none" d="M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"></path><path stroke="none" d="M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z">'),Vbe={top:180,right:-90,bottom:0,left:90};function Bbe(e){const t=Ube(),n=yve({size:30},e),[r,o]=Gt(n,["ref","style","size"]),i=()=>t.currentPlacement().split("-")[0],a=function(e){const[t,n]=at();return ct((()=>{const t=e();var r;t&&n((r=t,Xge(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return $t(Nve,qt({as:"div",ref(e){const n=Rge(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Hge({position:"absolute","font-size":`${r.size}px`,width:"1em",height:"1em","pointer-events":"none",fill:a()?.getPropertyValue("background-color")||"none",stroke:a()?.getPropertyValue(`border-${i()}-color`)||"none","stroke-width":s()},r.style)}},o,{get children(){const e=$be(),t=e.firstChild;return lt((()=>hn(t,"transform",`rotate(${Vbe[i()]} 15 15) translate(0 2)`))),e}}))}function zbe(e){const{x:t=0,y:n=0,width:r=0,height:o=0}=e??{};if("function"==typeof DOMRect)return new DOMRect(t,n,r,o);const i={x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:n+o,left:t};return{...i,toJSON:()=>i}}function Hbe(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var qbe={top:"bottom",right:"left",bottom:"top",left:"right"};var Gbe=Object.assign((function(e){const t=yve({getAnchorRect:e=>e?.getBoundingClientRect(),placement:"bottom",gutter:0,shift:0,flip:!0,slide:!0,overlap:!1,sameWidth:!1,fitViewport:!1,hideWhenDetached:!1,detachedPadding:0,arrowPadding:4,overflowPadding:8},e),[n,r]=at(),[o,i]=at(),[a,s]=at(t.placement),l=()=>{return e=t.anchorRef?.(),n=t.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const t=n(e);return t?zbe(t):e?e.getBoundingClientRect():zbe()}};var e,n},{direction:c}=rye();async function u(){const e=l(),r=n(),i=o();if(!e||!r)return;const a=(i?.clientHeight||0)/2,u="number"==typeof t.gutter?t.gutter+a:t.gutter??a;r.style.setProperty("--kb-popper-content-overflow-padding",`${t.overflowPadding}px`),e.getBoundingClientRect();const d=[Pbe((({placement:e})=>{const n=!!e.split("-")[1];return{mainAxis:u,crossAxis:n?void 0:t.shift,alignmentAxis:t.shift}}))];if(!1!==t.flip){const e="string"==typeof t.flip?t.flip.split(" "):void 0;if(void 0!==e&&!e.every(Hbe))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(Mbe({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(kbe({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(jbe({padding:t.overflowPadding,apply({availableWidth:e,availableHeight:n,rects:o}){const i=Math.round(o.reference.width);e=Math.floor(e),n=Math.floor(n),r.style.setProperty("--kb-popper-anchor-width",`${i}px`),r.style.setProperty("--kb-popper-content-available-width",`${e}px`),r.style.setProperty("--kb-popper-content-available-height",`${n}px`),t.sameWidth&&(r.style.width=`${i}px`),t.fitViewport&&(r.style.maxWidth=`${e}px`,r.style.maxHeight=`${n}px`)}})),t.hideWhenDetached&&d.push(Lbe({padding:t.detachedPadding})),i&&d.push(Dbe({element:i,padding:t.arrowPadding}));const p=await Ibe(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...Rbe,isRTL:()=>"rtl"===c()}});if(s(p.placement),t.onCurrentPlacementChange?.(p.placement),!r)return;r.style.setProperty("--kb-popper-content-transform-origin",function(e,t){const[n,r]=e.split("-"),o=qbe[n];return r?"left"===n||"right"===n?`${o} ${"start"===r?"top":"bottom"}`:"start"===r?`${o} ${"rtl"===t?"right":"left"}`:`${o} ${"rtl"===t?"left":"right"}`:`${o} center`}(p.placement,c()));const f=Math.round(p.x),h=Math.round(p.y);let m;if(t.hideWhenDetached&&(m=p.middlewareData.hide?.referenceHidden?"hidden":"visible"),Object.assign(r.style,{top:"0",left:"0",transform:`translate3d(${f}px, ${h}px, 0)`,visibility:m}),i&&p.middlewareData.arrow){const{x:e,y:t}=p.middlewareData.arrow,n=p.placement.split("-")[0];Object.assign(i.style,{left:null!=e?`${e}px`:"",top:null!=t?`${t}px`:"",[n]:"100%"})}}return ct((()=>{const e=l(),t=n();if(!e||!t)return;mt(Obe(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),ct((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),$t(Fbe.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:Bbe,Context:Fbe,usePopperContext:Ube,Positioner:function(e){const t=Ube(),[n,r]=Gt(e,["ref","style"]);return $t(Nve,qt({as:"div",ref(e){const r=Rge(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return Hge({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var Kbe="interactOutside.pointerDownOutside",Wbe="interactOutside.focusOutside";var Ybe=xt();function Xbe(e){let t;const n=wt(Ybe),[r,o]=Gt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=vve;const o=()=>Xge(t()),i=t=>e.onPointerDownOutside?.(t),a=t=>e.onFocusOutside?.(t),s=t=>e.onInteractOutside?.(t),l=n=>{const r=n.target;return r instanceof HTMLElement&&!r.closest(`[${vye}]`)&&!!Wge(o(),r)&&!Wge(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=rve([i,s]);r.addEventListener(Kbe,o,{once:!0});const a=new CustomEvent(Kbe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||ove(e)&&0===e.button}});r.dispatchEvent(a)}"touch"===e.pointerType?(o().removeEventListener("click",n),r=n,o().addEventListener("click",n,{once:!0})):n()},u=e=>{const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=rve([a,s]);r.addEventListener(Wbe,o,{once:!0});const i=new CustomEvent(Wbe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};ct((()=>{Dme(e.isDisabled)||(n=window.setTimeout((()=>{o().addEventListener("pointerdown",c,!0)}),0),o().addEventListener("focusin",u,!0),mt((()=>{window.clearTimeout(n),o().removeEventListener("click",r),o().removeEventListener("pointerdown",c,!0),o().removeEventListener("focusin",u,!0)})))}))}({shouldExcludeElement:e=>!!t&&(r.excludedElements?.some((t=>Wge(t(),e)))||[...i].some((t=>Wge(t,e)))),onPointerDownOutside:e=>{t&&!Eye.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||Eye.isTopMostLayer(t))&&(r.onPointerDownOutside?.(e),r.onInteractOutside?.(e),e.defaultPrevented||r.onDismiss?.())},onFocusOutside:e=>{r.onFocusOutside?.(e),r.onInteractOutside?.(e),e.defaultPrevented||r.onDismiss?.()}},(()=>t)),function(e){const t=t=>{t.key===Qge.Escape&&e.onEscapeKeyDown?.(t)};ct((()=>{if(Dme(e.isDisabled))return;const n=e.ownerDocument?.()??Xge();n.addEventListener("keydown",t),mt((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Xge(t),onEscapeKeyDown:e=>{t&&Eye.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),ht((()=>{if(!t)return;Eye.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);Eye.assignPointerEventToLayers(),Eye.disableBodyPointerEvents(t),mt((()=>{t&&(Eye.removeLayer(t),e?.(),Eye.assignPointerEventToLayers(),Eye.restoreBodyPointerEvents(t))}))})),ct(ft([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=Eye.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,Eye.assignPointerEventToLayers()),t&&Eye.disableBodyPointerEvents(e),mt((()=>{Eye.restoreBodyPointerEvents(e)}))}),{defer:!0}));return $t(Ybe.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return $t(Nve,qt({as:"div",ref(e){const n=Rge((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Zbe(e={}){const[t,n]=Ive({value:()=>Dme(e.open),defaultValue:()=>!!Dme(e.defaultOpen),onChange:t=>e.onOpenChange?.(t)}),r=()=>{n(!0)},o=()=>{n(!1)};return{isOpen:t,setIsOpen:n,open:r,close:o,toggle:()=>{t()?o():r()}}}var Qbe={};Uve(Qbe,{Description:()=>kve,ErrorMessage:()=>Mve,Item:()=>rxe,ItemControl:()=>oxe,ItemDescription:()=>ixe,ItemIndicator:()=>axe,ItemInput:()=>sxe,ItemLabel:()=>lxe,Label:()=>cxe,RadioGroup:()=>dxe,Root:()=>uxe});var Jbe=xt();function exe(){const e=wt(Jbe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var txe=xt();function nxe(){const e=wt(txe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function rxe(e){const t=Pve(),n=exe(),r=yve({id:`${t.generateId("item")}-${Yt()}`},e),[o,i]=Gt(r,["value","disabled","onPointerDown"]),[a,s]=at(),[l,c]=at(),[u,d]=at(),[p,f]=at(),[h,m]=at(!1),g=ut((()=>n.isSelectedValue(o.value))),v=ut((()=>o.disabled||t.isDisabled()||!1)),y=e=>{nve(e,o.onPointerDown),h()&&e.preventDefault()},b=ut((()=>({...t.dataset(),"data-disabled":v()?"":void 0,"data-checked":g()?"":void 0}))),x={value:()=>o.value,dataset:b,isSelected:g,isDisabled:v,inputId:a,labelId:l,descriptionId:u,inputRef:p,select:()=>n.setSelectedValue(o.value),generateId:Kge((()=>i.id)),registerInput:Tve(s),registerLabel:Tve(c),registerDescription:Tve(d),setIsFocused:m,setInputRef:f};return $t(txe.Provider,{value:x,get children(){return $t(Nve,qt({as:"div",role:"group",onPointerDown:y},b,i))}})}function oxe(e){const t=nxe(),n=yve({id:t.generateId("control")},e),[r,o]=Gt(n,["onClick","onKeyDown"]);return $t(Nve,qt({as:"div",onClick:e=>{nve(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{nve(e,r.onKeyDown),e.key===Qge.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function ixe(e){const t=nxe(),n=yve({id:t.generateId("description")},e);return ct((()=>mt(t.registerDescription(n.id)))),$t(Nve,qt({as:"div"},(()=>t.dataset()),n))}function axe(e){const t=nxe(),n=yve({id:t.generateId("indicator")},e),[r,o]=Gt(n,["ref","forceMount"]),[i,a]=at(),{present:s}=gye({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return $t(Jt,{get when(){return s()},get children(){return $t(Nve,qt({as:"div",ref(e){const t=Rge(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function sxe(e){const t=Pve(),n=exe(),r=nxe(),o=yve({id:r.generateId("input")},e),[i,a]=Gt(o,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=at(!1);return ct(ft([()=>r.isSelected(),()=>r.value()],(e=>{if(!e[0]&&e[1]===r.value())return;l(!0);const t=r.inputRef();t?.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0})),t?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}),{defer:!0})),ct((()=>mt(r.registerInput(a.id)))),$t(Nve,qt({as:"input",ref(e){const t=Rge(r.setInputRef,i.ref);"function"==typeof t&&t(e)},type:"radio",get name(){return t.name()},get value(){return r.value()},get checked(){return r.isSelected()},get required(){return t.isRequired()},get disabled(){return r.isDisabled()},get readonly(){return t.isReadOnly()},get style(){return Hge({...Eve},i.style)},get"aria-labelledby"(){return[i["aria-labelledby"],r.labelId(),null!=i["aria-labelledby"]&&null!=a["aria-label"]?a.id:void 0].filter(Boolean).join(" ")||void 0},get"aria-describedby"(){return[i["aria-describedby"],r.descriptionId(),n.ariaDescribedBy()].filter(Boolean).join(" ")||void 0},onChange:e=>{if(nve(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{nve(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{nve(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function lxe(e){const t=nxe(),n=yve({id:t.generateId("label")},e);return ct((()=>mt(t.registerLabel(n.id)))),$t(Nve,qt({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function cxe(e){return $t(jve,qt({as:"span"},e))}function uxe(e){let t;const n=yve({id:`radiogroup-${Yt()}`,orientation:"vertical"},e),[r,o,i]=Gt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],Rve),[a,s]=Dve({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=yve({id:`form-control-${Yt()}`},e),[n,r]=at(),[o,i]=at(),[a,s]=at(),[l,c]=at();return{formControlContext:{name:()=>Dme(t.name)??Dme(t.id),dataset:ut((()=>({"data-valid":"valid"===Dme(t.validationState)?"":void 0,"data-invalid":"invalid"===Dme(t.validationState)?"":void 0,"data-required":Dme(t.required)?"":void 0,"data-disabled":Dme(t.disabled)?"":void 0,"data-readonly":Dme(t.readOnly)?"":void 0}))),validationState:()=>Dme(t.validationState),isRequired:()=>Dme(t.required),isDisabled:()=>Dme(t.disabled),isReadOnly:()=>Dme(t.readOnly),labelId:n,fieldId:o,descriptionId:a,errorMessageId:l,getAriaLabelledBy:(e,t,r)=>{const o=null!=r||null!=n();return[r,n(),o&&null!=t?e:void 0].filter(Boolean).join(" ")||void 0},getAriaDescribedBy:e=>[a(),l(),e].filter(Boolean).join(" ")||void 0,generateId:Kge((()=>Dme(t.id))),registerLabel:Tve(r),registerField:Tve(i),registerDescription:Tve(s),registerErrorMessage:Tve(c)}}}(o);Lve((()=>t),(()=>s(r.defaultValue??"")));const c=()=>l.getAriaDescribedBy(r["aria-describedby"]),u=e=>e===a(),d={ariaDescribedBy:c,isSelectedValue:u,setSelectedValue:e=>{if(!l.isReadOnly()&&!l.isDisabled()&&(s(e),t))for(const n of t.querySelectorAll("[type='radio']")){n.checked=u(n.value)}}};return $t(Ove.Provider,{value:l,get children(){return $t(Jbe.Provider,{value:d,get children(){return $t(Nve,qt({as:"div",ref(e){const n=Rge((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return Dme(o.id)},get"aria-invalid"(){return"invalid"===l.validationState()||void 0},get"aria-required"(){return l.isRequired()||void 0},get"aria-disabled"(){return l.isDisabled()||void 0},get"aria-readonly"(){return l.isReadOnly()||void 0},get"aria-orientation"(){return r.orientation},get"aria-labelledby"(){return l.getAriaLabelledBy(Dme(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var dxe=Object.assign(uxe,{Description:kve,ErrorMessage:Mve,Item:rxe,ItemControl:oxe,ItemDescription:ixe,ItemIndicator:axe,ItemInput:sxe,ItemLabel:lxe,Label:cxe}),pxe=class{collection;ref;collator;constructor(e,t,n){this.collection=e,this.ref=t,this.collator=n}getKeyBelow(e){let t=this.collection().getKeyAfter(e);for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&!e.disabled)return t;t=this.collection().getKeyAfter(t)}}getKeyAbove(e){let t=this.collection().getKeyBefore(e);for(;null!=t;){const e=this.collection().getItem(t);if(e&&"item"===e.type&&!e.disabled)return t;t=this.collection().getKeyBefore(t)}}getFirstKey(){let e=this.collection().getFirstKey();for(;null!=e;){const t=this.collection().getItem(e);if(t&&"item"===t.type&&!t.disabled)return e;e=this.collection().getKeyAfter(e)}}getLastKey(){let e=this.collection().getLastKey();for(;null!=e;){const t=this.collection().getItem(e);if(t&&"item"===t.type&&!t.disabled)return e;e=this.collection().getKeyBefore(e)}}getItem(e){return this.ref?.()?.querySelector(`[data-key="${e}"]`)??null}getKeyPageAbove(e){const t=this.ref?.();let n=this.getItem(e);if(!t||!n)return;const r=Math.max(0,n.offsetTop+n.offsetHeight-t.offsetHeight);let o=e;for(;o&&n&&n.offsetTop>r;)o=this.getKeyAbove(o),n=null!=o?this.getItem(o):null;return o}getKeyPageBelow(e){const t=this.ref?.();let n=this.getItem(e);if(!t||!n)return;const r=Math.min(t.scrollHeight,n.offsetTop-n.offsetHeight+t.offsetHeight);let o=e;for(;o&&n&&n.offsetTop<r;)o=this.getKeyBelow(o),n=null!=o?this.getItem(o):null;return o}getKeyForSearch(e,t){const n=this.collator?.();if(!n)return;let r=null!=t?this.getKeyBelow(t):this.getFirstKey();for(;null!=r;){const t=this.collection().getItem(r);if(t){const o=t.textValue.slice(0,e.length);if(t.textValue&&0===n.compare(o,e))return r}r=this.getKeyBelow(r)}}};function fxe(e,t,n){const r=function(e){const{locale:t}=rye(),n=ut((()=>t()+(e?Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1)).join():"")));return ut((()=>{const r=n();let o;return oye.has(r)&&(o=oye.get(r)),o||(o=new Intl.Collator(t(),e),oye.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return uye({selectionManager:()=>Dme(e.selectionManager),keyboardDelegate:ut((()=>{const n=Dme(e.keyboardDelegate);return n||new pxe(e.collection,t,r)})),autoFocus:()=>Dme(e.autoFocus),deferAutoFocus:()=>Dme(e.deferAutoFocus),shouldFocusWrap:()=>Dme(e.shouldFocusWrap),disallowEmptySelection:()=>Dme(e.disallowEmptySelection),selectOnFocus:()=>Dme(e.selectOnFocus),disallowTypeAhead:()=>Dme(e.disallowTypeAhead),shouldUseVirtualFocus:()=>Dme(e.shouldUseVirtualFocus),allowsTabNavigation:()=>Dme(e.allowsTabNavigation),isVirtualized:()=>Dme(e.isVirtualized),scrollToKey:t=>Dme(e.scrollToKey)?.(t),orientation:()=>Dme(e.orientation)},t)}var hxe="focusScope.autoFocusOnMount",mxe="focusScope.autoFocusOnUnmount",gxe={bubbles:!1,cancelable:!0},vxe={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=qge(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=qge(this.stack,e),this.active()?.resume()}};function yxe(e,t){const[n,r]=at(!1),o={pause(){r(!0)},resume(){r(!1)}};let i=null;const a=t=>e.onMountAutoFocus?.(t),s=t=>e.onUnmountAutoFocus?.(t),l=()=>Xge(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,Eve),e},u=()=>{const e=t();return e?dve(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=u();return e.length>0?e[0]:null};ct((()=>{const e=t();if(!e)return;vxe.add(o);const n=Yge(e);if(!Wge(e,n)){const t=new CustomEvent(hxe,gxe);e.addEventListener(hxe,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{ive(d()),Yge(e)===n&&ive(e)}),0)}mt((()=>{e.removeEventListener(hxe,a),setTimeout((()=>{const r=new CustomEvent(mxe,gxe);(()=>{const e=t();if(!e)return!1;const n=Yge(e);return!!n&&!Wge(e,n)&&fve(n)})()&&r.preventDefault(),e.addEventListener(mxe,s),e.dispatchEvent(r),r.defaultPrevented||ive(n??l().body),e.removeEventListener(mxe,s),vxe.remove(o)}),0)}))})),ct((()=>{const r=t();if(!r||!Dme(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${vye}]`)||(Wge(r,t)?i=t:ive(i))},a=e=>{const t=e.relatedTarget??Yge(r);t?.closest(`[${vye}]`)||Wge(r,t)||ive(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),mt((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),ct((()=>{const r=t();if(!r||!Dme(e.trapFocus)||n())return;const o=c();r.insertAdjacentElement("afterbegin",o);const i=c();function a(e){const t=d(),n=(()=>{const e=u();return e.length>0?e[e.length-1]:null})();ive(e.relatedTarget===t?n:t)}r.insertAdjacentElement("beforeend",i),o.addEventListener("focusin",a),i.addEventListener("focusin",a);const s=new MutationObserver((e=>{for(const t of e)t.previousSibling===i&&(i.remove(),r.insertAdjacentElement("beforeend",i)),t.nextSibling===o&&(o.remove(),r.insertAdjacentElement("afterbegin",o))}));s.observe(r,{childList:!0,subtree:!1}),mt((()=>{o.removeEventListener("focusin",a),i.removeEventListener("focusin",a),o.remove(),i.remove(),s.disconnect()}))}))}var bxe="data-live-announcer";function xxe(e){ct((()=>{Dme(e.isDisabled)||mt(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${bxe}], [${vye}]`))n.add(r);const t=e=>{if(n.has(e)||e.parentElement&&r.has(e.parentElement)&&"row"!==e.parentElement.getAttribute("role"))return NodeFilter.FILTER_REJECT;for(const t of n)if(e.contains(t))return NodeFilter.FILTER_SKIP;return NodeFilter.FILTER_ACCEPT},o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:t}),a=t(e);if(a===NodeFilter.FILTER_ACCEPT&&i(e),a!==NodeFilter.FILTER_REJECT){let e=o.nextNode();for(;null!=e;)i(e),e=o.nextNode()}},i=e=>{const t=wxe.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),wxe.set(e,t+1))};_xe.length&&_xe[_xe.length-1].disconnect();o(t);const a=new MutationObserver((e=>{for(const t of e)if("childList"===t.type&&0!==t.addedNodes.length&&![...n,...r].some((e=>e.contains(t.target)))){for(const e of t.removedNodes)e instanceof Element&&(n.delete(e),r.delete(e));for(const e of t.addedNodes)!(e instanceof HTMLElement||e instanceof SVGElement)||"true"!==e.dataset.liveAnnouncer&&"true"!==e.dataset.reactAriaTopLayer?e instanceof Element&&o(e):n.add(e)}}));a.observe(t,{childList:!0,subtree:!0});const s={observe(){a.observe(t,{childList:!0,subtree:!0})},disconnect(){a.disconnect()}};return _xe.push(s),()=>{a.disconnect();for(const e of r){const t=wxe.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),wxe.delete(e)):wxe.set(e,t-1)}s===_xe[_xe.length-1]?(_xe.pop(),_xe.length&&_xe[_xe.length-1].observe()):_xe.splice(_xe.indexOf(s),1)}}(Dme(e.targets),Dme(e.root)))}))}var wxe=new WeakMap,_xe=[];var Sxe=new Map,Exe=e=>{ct((()=>{const t=mye(e.style)??{},n=mye(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=Sxe.get(e.key);o?o.activeCount++:Sxe.set(e.key,{activeCount:1,originalStyles:r,properties:n.map((e=>e.key))}),Object.assign(e.element.style,e.style);for(const i of n)e.element.style.setProperty(i.key,i.value);mt((()=>{const t=Sxe.get(e.key);if(t)if(1===t.activeCount){Sxe.delete(e.key);for(const[n,r]of Object.entries(t.originalStyles))e.element.style[n]=r;for(const n of t.properties)e.element.style.removeProperty(n);0===e.element.style.length&&e.element.removeAttribute("style"),e.cleanup?.()}else t.activeCount--}))}))},Txe=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},Cxe=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[Axe,Nxe]=at([]),Rxe=e=>[e.deltaX,e.deltaY],Oxe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],Pxe=(e,t,n,r)=>{const o=null!==r&&kxe(r,e),[i,a]=((e,t,n)=>{const r="x"===t&&"rtl"===window.getComputedStyle(e).direction?-1:1;let o=e,i=0,a=0,s=!1;do{const[e,l,c]=Txe(o,t),u=c-e-r*l;0===l&&0===u||!Cxe(o,t)||(i+=u,a+=l),o===(n??document.documentElement)?s=!0:o=o._$host??o.parentElement}while(o&&!s);return[i,a]})(e,t,o?r:void 0);return!(n>0&&Math.abs(i)<=1)&&!(n<0&&Math.abs(a)<1)},kxe=(e,t)=>{if(e.contains(t))return!0;let n=t;for(;n;){if(n===e)return!0;n=n._$host??n.parentElement}return!1},Mxe=e=>{const t=qt({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=Yt();let r=[0,0],o=null,i=null;ct((()=>{mye(t.enabled)&&(Nxe((e=>[...e,n])),mt((()=>{Nxe((e=>e.filter((e=>e!==n))))})))})),ct((()=>{if(!mye(t.enabled)||!mye(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(mye(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===mye(t.preventScrollbarShiftMode)?r.paddingRight=`calc(${window.getComputedStyle(e).paddingRight} + ${n}px)`:r.marginRight=`calc(${window.getComputedStyle(e).marginRight} + ${n}px)`,o.push({key:"--scrollbar-width",value:`${n}px`}));const i=window.scrollY,a=window.scrollX;Exe({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{mye(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else Exe({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),ct((()=>{var e;(e=n,Axe().indexOf(e)===Axe().length-1&&mye(t.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",a,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),mt((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",a),document.removeEventListener("touchmove",l)})))}));const a=e=>{r=Oxe(e),o=null,i=null},s=e=>{const n=e.target,r=mye(t.element),o=Rxe(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=Pxe(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!kxe(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=mye(t.element),a=e.target;let s;if(2===e.touches.length)s=!mye(t.allowPinchZoom);else{if(null==o||null===i){const t=Oxe(e).map(((e,t)=>r[t]-e)),n=Math.abs(t[0])>Math.abs(t[1])?"x":"y";o=n,i="x"===n?t[0]:t[1]}if("range"===a.type)s=!1;else{const e=Pxe(a,o,i,n);s=!n||!kxe(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},jxe=xt();function Lxe(){return wt(jxe)}function Dxe(){const e=Lxe();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var Ixe=xt();function Fxe(){const e=wt(Ixe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var Uxe=xt();function $xe(){const e=wt(Uxe);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function Vxe(e){let t;const n=$xe(),r=Dxe(),o=yve({id:n.generateId(`item-${Yt()}`)},e),[i,a]=Gt(o,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=at(),[c,u]=at(),[d,p]=at(),f=()=>r.listState().selectionManager(),h=()=>a.id,m=()=>{i.onSelect?.(),i.closeOnSelect&&setTimeout((()=>{r.close(!0)}))};Gve({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=dye({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{nve(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(ive(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{nve(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{nve(e,i.onPointerUp),i.disabled||0!==e.button||m()},x=e=>{if(nve(e,i.onKeyDown),!e.repeat&&!i.disabled)switch(e.key){case"Enter":case" ":m()}},w=ut((()=>i.indeterminate?"mixed":null!=i.checked?i.checked:void 0)),_=ut((()=>({"data-indeterminate":i.indeterminate?"":void 0,"data-checked":i.checked&&!i.indeterminate?"":void 0,"data-disabled":i.disabled?"":void 0,"data-highlighted":f().focusedKey()===h()?"":void 0}))),S={isChecked:()=>i.checked,dataset:_,setLabelRef:p,generateId:Kge((()=>a.id)),registerLabel:Tve(l),registerDescription:Tve(u)};return $t(Ixe.Provider,{value:S,get children(){return $t(Nve,qt({as:"div",ref(e){const n=Rge((e=>t=e),i.ref);"function"==typeof n&&n(e)},get tabIndex(){return g.tabIndex()},get"aria-checked"(){return w()},get"aria-disabled"(){return i.disabled},get"aria-labelledby"(){return s()},get"aria-describedby"(){return c()},get"data-key"(){return g.dataKey()},get onPointerDown(){return rve([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return rve([b,g.onPointerUp])},get onClick(){return rve([i.onClick,g.onClick])},get onKeyDown(){return rve([x,g.onKeyDown])},get onMouseDown(){return rve([i.onMouseDown,g.onMouseDown])},get onFocus(){return rve([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function Bxe(e){const t=yve({closeOnSelect:!1},e),[n,r]=Gt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=Ive({value:()=>Dme(e.isSelected),defaultValue:()=>!!Dme(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{Dme(e.isReadOnly)||Dme(e.isDisabled)||n(t)},toggle:()=>{Dme(e.isReadOnly)||Dme(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return $t(Vxe,qt({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var zxe=xt();function Hxe(){return wt(zxe)}var qxe={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>qxe.next("ltr"===e?"rtl":"ltr",t)},Gxe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",Kxe=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function Wxe(e){const t=$xe(),n=Dxe(),r=Hxe(),{direction:o}=rye(),i=yve({id:t.generateId("trigger")},e),[a,s]=Gt(i,["ref","id","disabled","onPointerDown","onClick","onKeyDown","onMouseOver","onFocus"]);let l=()=>t.value();void 0!==r&&(l=()=>t.value()??a.id,void 0===r.lastValue()&&r.setLastValue(l));const c=Cve((()=>n.triggerRef()),(()=>"button")),u=ut((()=>"a"===c()&&null!=n.triggerRef()?.getAttribute("href")));ct(ft((()=>r?.value()),(e=>{u()&&e===l()&&n.triggerRef()?.focus()})));const d=()=>{void 0!==r?n.isOpen()?r.value()===l()&&r.closeMenu():(r.autoFocusMenu()||r.setAutoFocusMenu(!0),n.open(!1)):n.toggle(!0)};return ct((()=>mt(n.registerTriggerId(a.id)))),$t(Cye,qt({ref(e){const t=Rge(n.setTriggerRef,a.ref);"function"==typeof t&&t(e)},get"data-kb-menu-value-trigger"(){return t.value()},get id(){return a.id},get disabled(){return a.disabled},"aria-haspopup":"true",get"aria-expanded"(){return n.isOpen()},get"aria-controls"(){return ut((()=>!!n.isOpen()))()?n.contentId():void 0},get"data-highlighted"(){return void 0!==l()&&r?.value()===l()||void 0},get tabIndex(){return void 0!==r?r.value()===l()||r.lastValue()===l()?0:-1:void 0},onPointerDown:e=>{nve(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{nve(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{nve(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if(nve(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case Gxe(t.orientation()):e.stopPropagation(),e.preventDefault(),function(e){if(document.contains(e)){const t=document.scrollingElement||document.documentElement;if("hidden"===window.getComputedStyle(t).overflow){let n=mve(e);for(;e&&n&&e!==t&&n!==t;)_ve(n,e),n=mve(e=n)}else{const{left:t,top:n}=e.getBoundingClientRect();e?.scrollIntoView?.({block:"nearest"});const{left:r,top:o}=e.getBoundingClientRect();(Math.abs(t-r)>1||Math.abs(n-o)>1)&&e.scrollIntoView?.({block:"nearest"})}}}(e.currentTarget),n.open("first"),r?.setAutoFocusMenu(!0),r?.setValue(l);break;case Kxe(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case qxe.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case qxe.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{nve(e,a.onFocus),void 0!==r&&"touch"!==e.currentTarget.dataset.pointerType&&r.setValue(l)},role:void 0!==r?"menuitem":void 0},(()=>n.dataset()),s))}var Yxe=xt();function Xxe(){return wt(Yxe)}function Zxe(e){let t;const n=$xe(),r=Dxe(),o=Hxe(),i=Xxe(),{direction:a}=rye(),s=yve({id:n.generateId(`content-${Yt()}`)},e),[l,c]=Gt(s,["ref","id","style","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onPointerEnter","onPointerMove","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]);let u=0;const d=()=>null==r.parentMenuContext()&&void 0===o&&n.isModal(),p=fxe({selectionManager:r.listState().selectionManager,collection:r.listState().collection,autoFocus:r.autoFocus,deferAutoFocus:!0,shouldFocusWrap:!0,disallowTypeAhead:()=>!r.listState().selectionManager().isFocused(),orientation:()=>"horizontal"===n.orientation()?"vertical":"horizontal"},(()=>t));yxe({trapFocus:()=>d()&&r.isOpen(),onMountAutoFocus:e=>{void 0===o&&l.onOpenAutoFocus?.(e)},onUnmountAutoFocus:l.onCloseAutoFocus},(()=>t));const f=e=>{l.onEscapeKeyDown?.(e),o?.setAutoFocusMenu(!1),r.close(!0)},h=e=>{l.onFocusOutside?.(e),n.isModal()&&e.preventDefault()};ct((()=>mt(r.registerContentId(l.id))));const m={ref:Rge((e=>{r.setContentRef(e),t=e}),l.ref),role:"menu",get id(){return l.id},get tabIndex(){return p.tabIndex()},get"aria-labelledby"(){return r.triggerId()},onKeyDown:rve([l.onKeyDown,p.onKeyDown,e=>{if(Wge(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case qxe.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case qxe.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:rve([l.onMouseDown,p.onMouseDown]),onFocusIn:rve([l.onFocusIn,p.onFocusIn]),onFocusOut:rve([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{nve(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if(nve(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;Wge(e.currentTarget,e.target)&&t&&(r.setPointerDir(e.clientX>u?"right":"left"),u=e.clientX)},get"data-orientation"(){return n.orientation()}};return $t(Jt,{get when(){return r.contentPresent()},get children(){return $t(Jt,{get when(){return void 0===i||null!=r.parentMenuContext()},get fallback(){return $t(Nve,qt({as:"div"},(()=>r.dataset()),m,c))},get children(){return $t(Gbe.Positioner,{get children(){return $t(Xbe,qt({get disableOutsidePointerEvents(){return ut((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Hge({"--kb-menu-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},l.style)},onEscapeKeyDown:f,onFocusOutside:h,get onDismiss(){return r.close}},(()=>r.dataset()),m,c))}})}})}})}function Qxe(e){let t;const n=$xe(),r=Dxe(),[o,i]=Gt(e,["ref"]);return Mxe({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),$t(Zxe,qt({ref(e){const n=Rge((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var Jxe=xt();function ewe(e){const t=yve({id:$xe().generateId(`group-${Yt()}`)},e),[n,r]=at(),o={generateId:Kge((()=>t.id)),registerLabelId:Tve(r)};return $t(Jxe.Provider,{value:o,get children(){return $t(Nve,qt({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function twe(e){const t=function(){const e=wt(Jxe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=yve({id:t.generateId("label")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerLabelId(r.id)))),$t(Nve,qt({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function nwe(e){const t=Dxe();return $t(Nve,qt({as:"span","aria-hidden":"true"},(()=>t.dataset()),yve({children:"▼"},e)))}function rwe(e){return $t(Vxe,qt({role:"menuitem",closeOnSelect:!0},e))}function owe(e){const t=Fxe(),n=yve({id:t.generateId("description")},e),[r,o]=Gt(n,["id"]);return ct((()=>mt(t.registerDescription(r.id)))),$t(Nve,qt({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function iwe(e){const t=Fxe(),n=yve({id:t.generateId("indicator")},e),[r,o]=Gt(n,["forceMount"]);return $t(Jt,{get when(){return r.forceMount||t.isChecked()},get children(){return $t(Nve,qt({as:"div"},(()=>t.dataset()),o))}})}function awe(e){const t=Fxe(),n=yve({id:t.generateId("label")},e),[r,o]=Gt(n,["ref","id"]);return ct((()=>mt(t.registerLabel(r.id)))),$t(Nve,qt({as:"div",ref(e){const n=Rge(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function swe(e){const t=Dxe();return $t(Jt,{get when(){return t.contentPresent()},get children(){return $t(On,e)}})}var lwe=xt();function cwe(e){const t=yve({id:$xe().generateId(`radiogroup-${Yt()}`)},e),[n,r]=Gt(t,["value","defaultValue","onChange","disabled"]),[o,i]=Dve({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return $t(lwe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return $t(ewe,r)}})}function uwe(e){const t=function(){const e=wt(lwe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=yve({closeOnSelect:!1},e),[r,o]=Gt(n,["value","onSelect"]);return $t(Vxe,qt({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function dwe(e,t,n){const r=e.split("-")[0],o=n.getBoundingClientRect(),i=[],a=t.clientX,s=t.clientY;switch(r){case"top":i.push([a,s+5]),i.push([o.left,o.bottom]),i.push([o.left,o.top]),i.push([o.right,o.top]),i.push([o.right,o.bottom]);break;case"right":i.push([a-5,s]),i.push([o.left,o.top]),i.push([o.right,o.top]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]);break;case"bottom":i.push([a,s-5]),i.push([o.right,o.top]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]),i.push([o.left,o.top]);break;case"left":i.push([a+5,s]),i.push([o.right,o.bottom]),i.push([o.left,o.bottom]),i.push([o.left,o.top]),i.push([o.right,o.top])}return i}function pwe(e){const t=$xe(),n=Vve(),r=Lxe(),o=Hxe(),i=Xxe(),a=yve({placement:"horizontal"===t.orientation()?"bottom-start":"right-start"},e),[s,l]=Gt(a,["open","defaultOpen","onOpenChange"]);let c=0,u=null,d="right";const[p,f]=at(),[h,m]=at(),[g,v]=at(),[y,b]=at(),[x,w]=at(!0),[_,S]=at(l.placement),[E,T]=at([]),[C,A]=at([]),{DomCollectionProvider:N}=qve({items:C,onItemsChange:A}),R=Zbe({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:O}=gye({show:()=>t.forceMount()||R.isOpen(),element:()=>y()??null}),P=function(e){const t=cye(e),n=Wve({dataSource:()=>Dme(e.dataSource),getKey:()=>Dme(e.getKey),getTextValue:()=>Dme(e.getTextValue),getDisabled:()=>Dme(e.getDisabled),getSectionChildren:()=>Dme(e.getSectionChildren),factory:t=>new fye(e.filter?e.filter(t):t)},[()=>e.filter]),r=new pye(n,t);return st((()=>{const e=t.focusedKey();null==e||n().getItem(e)||t.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>r}}({selectionMode:"none",dataSource:C}),k=e=>{w(e),R.open()},M=(e=!1)=>{R.close(),e&&r&&r.close(!0)},j=()=>{const e=y();e&&(ive(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},L=()=>{null!=i?setTimeout((()=>j())):j()},D=e=>{return d===u?.side&&(t=e,n=u?.area,!!n&&function(e,t){const[n,r]=e;let o=!1;for(let i=t.length,a=0,s=i-1;a<i;s=a++){const[e,l]=t[a],[c,u]=t[s],[,d]=t[0===s?i-1:s-1]||[0,0],p=(l-u)*(n-e)-(e-c)*(r-l);if(u<l){if(r>=u&&r<l){if(0===p)return!0;p>0&&(r===u?r>d&&(o=!o):o=!o)}}else if(l<u){if(r>l&&r<=u){if(0===p)return!0;p<0&&(r===u?r<d&&(o=!o):o=!o)}}else if(r==l&&(n>=c&&n<=e||n>=e&&n<=c))return!0}return o}([t.clientX,t.clientY],n));var t,n};xxe({isDisabled:()=>!(null==r&&R.isOpen()&&t.isModal()),targets:()=>[y(),...E()].filter(Boolean)}),ct((()=>{const e=y();if(!e||!r)return;const t=r.registerNestedMenu(e);mt((()=>{t()}))})),ct((()=>{void 0===r&&o?.registerMenu(t.value(),[y(),...E()])})),ct((()=>{void 0===r&&void 0!==o&&(o.value()===t.value()?(g()?.focus(),o.autoFocusMenu()&&k(!0)):M())})),ct((()=>{void 0===r&&void 0!==o&&R.isOpen()&&o.setValue(t.value())})),mt((()=>{void 0===r&&o?.unregisterMenu(t.value())}));const I={dataset:ut((()=>({"data-expanded":R.isOpen()?"":void 0,"data-closed":R.isOpen()?void 0:""}))),isOpen:R.isOpen,contentPresent:O,nestedMenus:E,currentPlacement:_,pointerGraceTimeoutId:()=>c,autoFocus:x,listState:()=>P,parentMenuContext:()=>r,triggerRef:g,contentRef:y,triggerId:p,contentId:h,setTriggerRef:v,setContentRef:b,open:k,close:M,toggle:e=>{w(e),R.toggle()},focusContent:L,onItemEnter:e=>{D(e)&&e.preventDefault()},onItemLeave:e=>{D(e)||L()},onTriggerLeave:e=>{D(e)&&e.preventDefault()},setPointerDir:e=>d=e,setPointerGraceTimeoutId:e=>c=e,setPointerGraceIntent:e=>u=e,registerNestedMenu:e=>{T((t=>[...t,e]));const t=r?.registerNestedMenu(e);return()=>{T((t=>qge(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:Tve(f),registerContentId:Tve(m)};return $t(N,{get children(){return $t(jxe.Provider,{value:I,get children(){return $t(Jt,{when:void 0===i,get fallback(){return l.children},get children(){return $t(Gbe,qt({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function fwe(e){const{direction:t}=rye();return $t(pwe,qt({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var hwe=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function mwe(e){const t=Dxe(),n=$xe(),[r,o]=Gt(e,["onFocusOutside","onKeyDown"]),{direction:i}=rye();return $t(Zxe,qt({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;Wge(t.triggerRef(),n)||t.close()},onKeyDown:e=>{nve(e,r.onKeyDown);const o=Wge(e.currentTarget,e.target),a=hwe(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),ive(t.triggerRef()))}},o))}var gwe=["Enter"," "],vwe=(e,t)=>"ltr"===e?[...gwe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...gwe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function ywe(e){let t;const n=$xe(),r=Dxe(),o=yve({id:n.generateId(`sub-trigger-${Yt()}`)},e),[i,a]=Gt(o,["ref","id","textValue","disabled","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);let s=null;const l=()=>{s&&window.clearTimeout(s),s=null},{direction:c}=rye(),u=()=>i.id,d=()=>{const e=r.parentMenuContext();if(null==e)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");return e.listState().selectionManager()},p=dye({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{nve(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{nve(e,i.onKeyDown),e.repeat||i.disabled||vwe(c(),n.orientation()).includes(e.key)&&(e.stopPropagation(),e.preventDefault(),d().setFocused(!1),d().setFocusedKey(void 0),r.isOpen()||r.open("first"),r.focusContent(),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(r.listState().collection().getFirstKey()))};return ct((()=>{if(null==r.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");mt(r.registerItemToParentDomCollection({ref:()=>t,type:"item",key:u(),textValue:i.textValue??t?.textContent??"",disabled:i.disabled??!1}))})),ct(ft((()=>r.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{mt((()=>{window.clearTimeout(e),r.parentMenuContext()?.setPointerGraceIntent(null)}))}))),ct((()=>mt(r.registerTriggerId(i.id)))),mt((()=>{l()})),$t(Nve,qt({as:"div",ref(e){const n=Rge((e=>{r.setTriggerRef(e),t=e}),i.ref);"function"==typeof n&&n(e)},get id(){return i.id},role:"menuitem",get tabIndex(){return p.tabIndex()},"aria-haspopup":"true",get"aria-expanded"(){return r.isOpen()},get"aria-controls"(){return ut((()=>!!r.isOpen()))()?r.contentId():void 0},get"aria-disabled"(){return i.disabled},get"data-key"(){return p.dataKey()},get"data-highlighted"(){return d().focusedKey()===u()?"":void 0},get"data-disabled"(){return i.disabled?"":void 0},get onPointerDown(){return rve([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return rve([i.onPointerUp,p.onPointerUp])},get onClick(){return rve([f,p.onClick])},get onKeyDown(){return rve([h,p.onKeyDown])},get onMouseDown(){return rve([i.onMouseDown,p.onMouseDown])},get onFocus(){return rve([i.onFocus,p.onFocus])},onPointerMove:e=>{if(nve(e,i.onPointerMove),"mouse"!==e.pointerType)return;const t=r.parentMenuContext();t?.onItemEnter(e),e.defaultPrevented||(i.disabled?t?.onItemLeave(e):(r.isOpen()||s||(r.parentMenuContext()?.setPointerGraceIntent(null),s=window.setTimeout((()=>{r.open(!1),l()}),100)),t?.onItemEnter(e),e.defaultPrevented||(r.listState().selectionManager().isFocused()&&(r.listState().selectionManager().setFocused(!1),r.listState().selectionManager().setFocusedKey(void 0)),ive(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if(nve(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:dwe(r.currentPlacement(),e,n),side:r.currentPlacement().split("-")[0]}),window.clearTimeout(t?.pointerGraceTimeoutId());const o=window.setTimeout((()=>{t?.setPointerGraceIntent(null)}),300);t?.setPointerGraceTimeoutId(o)}else{if(t?.onTriggerLeave(e),e.defaultPrevented)return;t?.setPointerGraceIntent(null)}t?.onItemLeave(e)}},(()=>r.dataset()),a))}function bwe(e){const t=Hxe(),n=yve({id:`menu-${Yt()}`,modal:!0},e),[r,o]=Gt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Zbe({open:()=>r.open,defaultOpen:()=>r.defaultOpen,onOpenChange:e=>r.onOpenChange?.(e)}),a={isModal:()=>r.modal??!0,preventScroll:()=>r.preventScroll??a.isModal(),forceMount:()=>r.forceMount??!1,generateId:Kge((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return $t(Uxe.Provider,{value:a,get children(){return $t(pwe,qt({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function xwe(e){let t;const n=yve({orientation:"horizontal"},e),[r,o]=Gt(n,["ref","orientation"]),i=Cve((()=>t),(()=>"hr"));return $t(Nve,qt({as:"hr",ref(e){const n=Rge((e=>t=e),r.ref);"function"==typeof n&&n(e)},get role(){return"hr"!==i()?"separator":void 0},get"aria-orientation"(){return"vertical"===r.orientation?"vertical":void 0},get"data-orientation"(){return r.orientation}},o))}Uve({},{Root:()=>xwe,Separator:()=>wwe});var wwe=xwe,_we={};function Swe(e){const t=$xe(),n=Dxe(),[r,o]=Gt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return $t(Qxe,qt({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||ive(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function Ewe(e){return $t(bwe,yve({id:`dropdownmenu-${Yt()}`},e))}Uve(_we,{Arrow:()=>Bbe,CheckboxItem:()=>Bxe,Content:()=>Swe,DropdownMenu:()=>Twe,Group:()=>ewe,GroupLabel:()=>twe,Icon:()=>nwe,Item:()=>rwe,ItemDescription:()=>owe,ItemIndicator:()=>iwe,ItemLabel:()=>awe,Portal:()=>swe,RadioGroup:()=>cwe,RadioItem:()=>uwe,Root:()=>Ewe,Separator:()=>xwe,Sub:()=>fwe,SubContent:()=>mwe,SubTrigger:()=>ywe,Trigger:()=>Wxe});var Twe=Object.assign(Ewe,{Arrow:Bbe,CheckboxItem:Bxe,Content:Swe,Group:ewe,GroupLabel:twe,Icon:nwe,Item:rwe,ItemDescription:owe,ItemIndicator:iwe,ItemLabel:awe,Portal:swe,RadioGroup:cwe,RadioItem:uwe,Separator:xwe,Sub:fwe,SubContent:mwe,SubTrigger:ywe,Trigger:Wxe}),Cwe={colors:{inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000000",white:"#ffffff",neutral:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},darkGray:{50:"#525c7a",100:"#49536e",200:"#414962",300:"#394056",400:"#313749",500:"#292e3d",600:"#212530",700:"#191c24",800:"#111318",900:"#0b0d10"},gray:{50:"#f9fafb",100:"#f2f4f7",200:"#eaecf0",300:"#d0d5dd",400:"#98a2b3",500:"#667085",600:"#475467",700:"#344054",800:"#1d2939",900:"#101828"},blue:{25:"#F5FAFF",50:"#EFF8FF",100:"#D1E9FF",200:"#B2DDFF",300:"#84CAFF",400:"#53B1FD",500:"#2E90FA",600:"#1570EF",700:"#175CD3",800:"#1849A9",900:"#194185"},green:{25:"#F6FEF9",50:"#ECFDF3",100:"#D1FADF",200:"#A6F4C5",300:"#6CE9A6",400:"#32D583",500:"#12B76A",600:"#039855",700:"#027A48",800:"#05603A",900:"#054F31"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},yellow:{25:"#FFFCF5",50:"#FFFAEB",100:"#FEF0C7",200:"#FEDF89",300:"#FEC84B",400:"#FDB022",500:"#F79009",600:"#DC6803",700:"#B54708",800:"#93370D",900:"#7A2E0E"},purple:{25:"#FAFAFF",50:"#F4F3FF",100:"#EBE9FE",200:"#D9D6FE",300:"#BDB4FE",400:"#9B8AFB",500:"#7A5AF8",600:"#6938EF",700:"#5925DC",800:"#4A1FB8",900:"#3E1C96"},teal:{25:"#F6FEFC",50:"#F0FDF9",100:"#CCFBEF",200:"#99F6E0",300:"#5FE9D0",400:"#2ED3B7",500:"#15B79E",600:"#0E9384",700:"#107569",800:"#125D56",900:"#134E48"},pink:{25:"#fdf2f8",50:"#fce7f3",100:"#fbcfe8",200:"#f9a8d4",300:"#f472b6",400:"#ec4899",500:"#db2777",600:"#be185d",700:"#9d174d",800:"#831843",900:"#500724"},cyan:{25:"#ecfeff",50:"#cffafe",100:"#a5f3fc",200:"#67e8f9",300:"#22d3ee",400:"#06b6d4",500:"#0891b2",600:"#0e7490",700:"#155e75",800:"#164e63",900:"#083344"}},alpha:{90:"e5",80:"cc"},font:{size:{xs:"calc(var(--tsqd-font-size) * 0.75)",sm:"calc(var(--tsqd-font-size) * 0.875)",md:"var(--tsqd-font-size)"},lineHeight:{xs:"calc(var(--tsqd-font-size) * 1)",sm:"calc(var(--tsqd-font-size) * 1.25)",md:"calc(var(--tsqd-font-size) * 1.5)"},weight:{medium:"500",semibold:"600",bold:"700"}},border:{radius:{xs:"calc(var(--tsqd-font-size) * 0.125)",sm:"calc(var(--tsqd-font-size) * 0.25)",full:"9999px"}},size:{.25:"calc(var(--tsqd-font-size) * 0.0625)",.5:"calc(var(--tsqd-font-size) * 0.125)",1:"calc(var(--tsqd-font-size) * 0.25)",1.5:"calc(var(--tsqd-font-size) * 0.375)",2:"calc(var(--tsqd-font-size) * 0.5)",2.5:"calc(var(--tsqd-font-size) * 0.625)",3:"calc(var(--tsqd-font-size) * 0.75)",3.5:"calc(var(--tsqd-font-size) * 0.875)",4:"calc(var(--tsqd-font-size) * 1)",4.5:"calc(var(--tsqd-font-size) * 1.125)",5:"calc(var(--tsqd-font-size) * 1.25)",6:"calc(var(--tsqd-font-size) * 1.5)",6.5:"calc(var(--tsqd-font-size) * 1.625)",14:"calc(var(--tsqd-font-size) * 3.5)"},shadow:{xs:(e="rgb(0 0 0 / 0.1)")=>"0 1px 2px 0 rgb(0 0 0 / 0.05)",sm:(e="rgb(0 0 0 / 0.1)")=>`0 1px 3px 0 ${e}, 0 1px 2px -1px ${e}`,md:(e="rgb(0 0 0 / 0.1)")=>`0 4px 6px -1px ${e}, 0 2px 4px -2px ${e}`,lg:(e="rgb(0 0 0 / 0.1)")=>`0 10px 15px -3px ${e}, 0 4px 6px -4px ${e}`,xl:(e="rgb(0 0 0 / 0.1)")=>`0 20px 25px -5px ${e}, 0 8px 10px -6px ${e}`,"2xl":(e="rgb(0 0 0 / 0.25)")=>`0 25px 50px -12px ${e}`,inner:(e="rgb(0 0 0 / 0.05)")=>`inset 0 2px 4px 0 ${e}`,none:()=>"none"}},Awe=pn('<svg width=14 height=14 viewBox="0 0 14 14"fill=none xmlns=http://www.w3.org/2000/svg><path d="M13 13L9.00007 9M10.3333 5.66667C10.3333 8.244 8.244 10.3333 5.66667 10.3333C3.08934 10.3333 1 8.244 1 5.66667C1 3.08934 3.08934 1 5.66667 1C8.244 1 10.3333 3.08934 10.3333 5.66667Z"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Nwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9 3H15M3 6H21M19 6L18.2987 16.5193C18.1935 18.0975 18.1409 18.8867 17.8 19.485C17.4999 20.0118 17.0472 20.4353 16.5017 20.6997C15.882 21 15.0911 21 13.5093 21H10.4907C8.90891 21 8.11803 21 7.49834 20.6997C6.95276 20.4353 6.50009 20.0118 6.19998 19.485C5.85911 18.8867 5.8065 18.0975 5.70129 16.5193L5 6M10 10.5V15.5M14 10.5V15.5"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Rwe=pn('<svg width=10 height=6 viewBox="0 0 10 6"fill=none xmlns=http://www.w3.org/2000/svg><path d="M1 1L5 5L9 1"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Owe=pn('<svg width=12 height=12 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 13.3333V2.66667M8 2.66667L4 6.66667M8 2.66667L12 6.66667"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),Pwe=pn('<svg width=12 height=12 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 2.66667V13.3333M8 13.3333L4 9.33333M8 13.3333L12 9.33333"stroke=currentColor stroke-width=1.66667 stroke-linecap=round stroke-linejoin=round>'),kwe=pn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M12 2v2m0 16v2M4 12H2m4.314-5.686L4.9 4.9m12.786 1.414L19.1 4.9M6.314 17.69 4.9 19.104m12.786-1.414 1.414 1.414M22 12h-2m-3 0a5 5 0 1 1-10 0 5 5 0 0 1 10 0Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Mwe=pn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M22 15.844a10.424 10.424 0 0 1-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 0 0 2 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),jwe=pn('<svg viewBox="0 0 24 24"height=12 width=12 fill=none xmlns=http://www.w3.org/2000/svg><path d="M8 21h8m-4-4v4m-5.2-4h10.4c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C22 14.72 22 13.88 22 12.2V7.8c0-1.68 0-2.52-.327-3.162a3 3 0 0 0-1.311-1.311C19.72 3 18.88 3 17.2 3H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2 5.28 2 6.12 2 7.8v4.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C4.28 17 5.12 17 6.8 17Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Lwe=pn('<svg stroke=currentColor fill=currentColor stroke-width=0 viewBox="0 0 24 24"height=1em width=1em xmlns=http://www.w3.org/2000/svg><path fill=none d="M0 0h24v24H0z"></path><path d="M1 9l2 2c4.97-4.97 13.03-4.97 18 0l2-2C16.93 2.93 7.08 2.93 1 9zm8 8l3 3 3-3a4.237 4.237 0 00-6 0zm-4-4l2 2a7.074 7.074 0 0110 0l2-2C15.14 9.14 8.87 9.14 5 13z">'),Dwe=pn('<svg stroke-width=0 viewBox="0 0 24 24"height=1em width=1em xmlns=http://www.w3.org/2000/svg><path fill=none d="M24 .01c0-.01 0-.01 0 0L0 0v24h24V.01zM0 0h24v24H0V0zm0 0h24v24H0V0z"></path><path d="M22.99 9C19.15 5.16 13.8 3.76 8.84 4.78l2.52 2.52c3.47-.17 6.99 1.05 9.63 3.7l2-2zm-4 4a9.793 9.793 0 00-4.49-2.56l3.53 3.53.96-.97zM2 3.05L5.07 6.1C3.6 6.82 2.22 7.78 1 9l1.99 2c1.24-1.24 2.67-2.16 4.2-2.77l2.24 2.24A9.684 9.684 0 005 13v.01L6.99 15a7.042 7.042 0 014.92-2.06L18.98 20l1.27-1.26L3.29 1.79 2 3.05zM9 17l3 3 3-3a4.237 4.237 0 00-6 0z">'),Iwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9.3951 19.3711L9.97955 20.6856C10.1533 21.0768 10.4368 21.4093 10.7958 21.6426C11.1547 21.8759 11.5737 22.0001 12.0018 22C12.4299 22.0001 12.8488 21.8759 13.2078 21.6426C13.5667 21.4093 13.8503 21.0768 14.024 20.6856L14.6084 19.3711C14.8165 18.9047 15.1664 18.5159 15.6084 18.26C16.0532 18.0034 16.5678 17.8941 17.0784 17.9478L18.5084 18.1C18.9341 18.145 19.3637 18.0656 19.7451 17.8713C20.1265 17.6771 20.4434 17.3763 20.6573 17.0056C20.8715 16.635 20.9735 16.2103 20.9511 15.7829C20.9286 15.3555 20.7825 14.9438 20.5307 14.5978L19.684 13.4344C19.3825 13.0171 19.2214 12.5148 19.224 12C19.2239 11.4866 19.3865 10.9864 19.6884 10.5711L20.5351 9.40778C20.787 9.06175 20.933 8.65007 20.9555 8.22267C20.978 7.79528 20.8759 7.37054 20.6618 7C20.4479 6.62923 20.131 6.32849 19.7496 6.13423C19.3681 5.93997 18.9386 5.86053 18.5129 5.90556L17.0829 6.05778C16.5722 6.11141 16.0577 6.00212 15.6129 5.74556C15.17 5.48825 14.82 5.09736 14.6129 4.62889L14.024 3.31444C13.8503 2.92317 13.5667 2.59072 13.2078 2.3574C12.8488 2.12408 12.4299 1.99993 12.0018 2C11.5737 1.99993 11.1547 2.12408 10.7958 2.3574C10.4368 2.59072 10.1533 2.92317 9.97955 3.31444L9.3951 4.62889C9.18803 5.09736 8.83798 5.48825 8.3951 5.74556C7.95032 6.00212 7.43577 6.11141 6.9251 6.05778L5.49066 5.90556C5.06499 5.86053 4.6354 5.93997 4.25397 6.13423C3.87255 6.32849 3.55567 6.62923 3.34177 7C3.12759 7.37054 3.02555 7.79528 3.04804 8.22267C3.07052 8.65007 3.21656 9.06175 3.46844 9.40778L4.3151 10.5711C4.61704 10.9864 4.77964 11.4866 4.77955 12C4.77964 12.5134 4.61704 13.0137 4.3151 13.4289L3.46844 14.5922C3.21656 14.9382 3.07052 15.3499 3.04804 15.7773C3.02555 16.2047 3.12759 16.6295 3.34177 17C3.55589 17.3706 3.8728 17.6712 4.25417 17.8654C4.63554 18.0596 5.06502 18.1392 5.49066 18.0944L6.92066 17.9422C7.43133 17.8886 7.94587 17.9979 8.39066 18.2544C8.83519 18.511 9.18687 18.902 9.3951 19.3711Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path><path d="M12 15C13.6568 15 15 13.6569 15 12C15 10.3431 13.6568 9 12 9C10.3431 9 8.99998 10.3431 8.99998 12C8.99998 13.6569 10.3431 15 12 15Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Fwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M16 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V8M11.5 12.5L17 7M17 7H12M17 7V12M6.2 21H8.8C9.9201 21 10.4802 21 10.908 20.782C11.2843 20.5903 11.5903 20.2843 11.782 19.908C12 19.4802 12 18.9201 12 17.8V15.2C12 14.0799 12 13.5198 11.782 13.092C11.5903 12.7157 11.2843 12.4097 10.908 12.218C10.4802 12 9.92011 12 8.8 12H6.2C5.0799 12 4.51984 12 4.09202 12.218C3.71569 12.4097 3.40973 12.7157 3.21799 13.092C3 13.5198 3 14.0799 3 15.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Uwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path class=copier d="M8 8V5.2C8 4.0799 8 3.51984 8.21799 3.09202C8.40973 2.71569 8.71569 2.40973 9.09202 2.21799C9.51984 2 10.0799 2 11.2 2H18.8C19.9201 2 20.4802 2 20.908 2.21799C21.2843 2.40973 21.5903 2.71569 21.782 3.09202C22 3.51984 22 4.0799 22 5.2V12.8C22 13.9201 22 14.4802 21.782 14.908C21.5903 15.2843 21.2843 15.5903 20.908 15.782C20.4802 16 19.9201 16 18.8 16H16M5.2 22H12.8C13.9201 22 14.4802 22 14.908 21.782C15.2843 21.5903 15.5903 21.2843 15.782 20.908C16 20.4802 16 19.9201 16 18.8V11.2C16 10.0799 16 9.51984 15.782 9.09202C15.5903 8.71569 15.2843 8.40973 14.908 8.21799C14.4802 8 13.9201 8 12.8 8H5.2C4.0799 8 3.51984 8 3.09202 8.21799C2.71569 8.40973 2.40973 8.71569 2.21799 9.09202C2 9.51984 2 10.0799 2 11.2V18.8C2 19.9201 2 20.4802 2.21799 20.908C2.40973 21.2843 2.71569 21.5903 3.09202 21.782C3.51984 22 4.07989 22 5.2 22Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round stroke=currentColor>'),$we=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M2.5 21.4998L8.04927 19.3655C8.40421 19.229 8.58168 19.1607 8.74772 19.0716C8.8952 18.9924 9.0358 18.901 9.16804 18.7984C9.31692 18.6829 9.45137 18.5484 9.72028 18.2795L21 6.99982C22.1046 5.89525 22.1046 4.10438 21 2.99981C19.8955 1.89525 18.1046 1.89524 17 2.99981L5.72028 14.2795C5.45138 14.5484 5.31692 14.6829 5.20139 14.8318C5.09877 14.964 5.0074 15.1046 4.92823 15.2521C4.83911 15.4181 4.77085 15.5956 4.63433 15.9506L2.5 21.4998ZM2.5 21.4998L4.55812 16.1488C4.7054 15.7659 4.77903 15.5744 4.90534 15.4867C5.01572 15.4101 5.1523 15.3811 5.2843 15.4063C5.43533 15.4351 5.58038 15.5802 5.87048 15.8703L8.12957 18.1294C8.41967 18.4195 8.56472 18.5645 8.59356 18.7155C8.61877 18.8475 8.58979 18.9841 8.51314 19.0945C8.42545 19.2208 8.23399 19.2944 7.85107 19.4417L2.5 21.4998Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Vwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M7.5 12L10.5 15L16.5 9M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Bwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9 9L15 15M15 9L9 15M7.8 21H16.2C17.8802 21 18.7202 21 19.362 20.673C19.9265 20.3854 20.3854 19.9265 20.673 19.362C21 18.7202 21 17.8802 21 16.2V7.8C21 6.11984 21 5.27976 20.673 4.63803C20.3854 4.07354 19.9265 3.6146 19.362 3.32698C18.7202 3 17.8802 3 16.2 3H7.8C6.11984 3 5.27976 3 4.63803 3.32698C4.07354 3.6146 3.6146 4.07354 3.32698 4.63803C3 5.27976 3 6.11984 3 7.8V16.2C3 17.8802 3 18.7202 3.32698 19.362C3.6146 19.9265 4.07354 20.3854 4.63803 20.673C5.27976 21 6.11984 21 7.8 21Z"stroke=#F04438 stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),zwe=pn('<svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 xmlns=http://www.w3.org/2000/svg><rect class=list width=20 height=20 y=2 x=2 rx=2></rect><line class=list-item y1=7 y2=7 x1=6 x2=18></line><line class=list-item y2=12 y1=12 x1=6 x2=18></line><line class=list-item y1=17 y2=17 x1=6 x2=18>'),Hwe=pn('<svg viewBox="0 0 24 24"height=20 width=20 fill=none xmlns=http://www.w3.org/2000/svg><path d="M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),qwe=pn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Gwe=pn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M12 2V6M12 18V22M6 12H2M22 12H18M19.0784 19.0784L16.25 16.25M19.0784 4.99994L16.25 7.82837M4.92157 19.0784L7.75 16.25M4.92157 4.99994L7.75 7.82837"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round></path><animateTransform attributeName=transform attributeType=XML type=rotate from=0 to=360 dur=2s repeatCount=indefinite>'),Kwe=pn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M15 9L9 15M9 9L15 15M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Wwe=pn('<svg width=14 height=14 viewBox="0 0 24 24"fill=none xmlns=http://www.w3.org/2000/svg><path d="M9.5 15V9M14.5 15V9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),Ywe=pn('<svg version=1.0 viewBox="0 0 633 633"><linearGradient x1=-666.45 x2=-666.45 y1=163.28 y2=163.99 gradientTransform="matrix(633 0 0 633 422177 -103358)"gradientUnits=userSpaceOnUse><stop stop-color=#6BDAFF offset=0></stop><stop stop-color=#F9FFB5 offset=.32></stop><stop stop-color=#FFA770 offset=.71></stop><stop stop-color=#FF7373 offset=1></stop></linearGradient><circle cx=316.5 cy=316.5 r=316.5></circle><defs><filter x=-137.5 y=412 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=412 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=610.5 rx=214.5 ry=186 fill=#015064 stroke=#00CFE2 stroke-width=25></ellipse></g><defs><filter x=316.5 y=412 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=412 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=610.5 rx=214.5 ry=186 fill=#015064 stroke=#00CFE2 stroke-width=25></ellipse></g><defs><filter x=-137.5 y=450 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=450 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=648.5 rx=214.5 ry=186 fill=#015064 stroke=#00A8B8 stroke-width=25></ellipse></g><defs><filter x=316.5 y=450 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=450 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=648.5 rx=214.5 ry=186 fill=#015064 stroke=#00A8B8 stroke-width=25></ellipse></g><defs><filter x=-137.5 y=486 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=-137.5 y=486 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=89.5 cy=684.5 rx=214.5 ry=186 fill=#015064 stroke=#007782 stroke-width=25></ellipse></g><defs><filter x=316.5 y=486 width=454 height=396.9 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=316.5 y=486 width=454 height=396.9 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><ellipse cx=543.5 cy=684.5 rx=214.5 ry=186 fill=#015064 stroke=#007782 stroke-width=25></ellipse></g><defs><filter x=272.2 y=308 width=176.9 height=129.3 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=272.2 y=308 width=176.9 height=129.3 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><line x1=436 x2=431 y1=403.2 y2=431.8 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><line x1=291 x2=280 y1=341.5 y2=403.5 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><line x1=332.9 x2=328.6 y1=384.1 y2=411.2 fill=none stroke=#000 stroke-linecap=round stroke-linejoin=bevel stroke-width=11></line><linearGradient x1=-670.75 x2=-671.59 y1=164.4 y2=164.49 gradientTransform="matrix(-184.16 -32.472 -11.461 64.997 -121359 -32126)"gradientUnits=userSpaceOnUse><stop stop-color=#EE2700 offset=0></stop><stop stop-color=#FF008E offset=1></stop></linearGradient><path d="m344.1 363 97.7 17.2c5.8 2.1 8.2 6.1 7.1 12.1s-4.7 9.2-11 9.9l-106-18.7-57.5-59.2c-3.2-4.8-2.9-9.1 0.8-12.8s8.3-4.4 13.7-2.1l55.2 53.6z"clip-rule=evenodd fill-rule=evenodd></path><line x1=428.2 x2=429.1 y1=384.5 y2=378 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=395.2 x2=396.1 y1=379.5 y2=373 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=362.2 x2=363.1 y1=373.5 y2=367.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=324.2 x2=328.4 y1=351.3 y2=347.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line><line x1=303.2 x2=307.4 y1=331.3 y2=327.4 fill=none stroke=#fff stroke-linecap=round stroke-linejoin=bevel stroke-width=7></line></g><defs><filter x=73.2 y=113.8 width=280.6 height=317.4 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=73.2 y=113.8 width=280.6 height=317.4 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-672.16 x2=-672.16 y1=165.03 y2=166.03 gradientTransform="matrix(-100.18 48.861 97.976 200.88 -83342 -93.059)"gradientUnits=userSpaceOnUse><stop stop-color=#A17500 offset=0></stop><stop stop-color=#5D2100 offset=1></stop></linearGradient><path d="m192.3 203c8.1 37.3 14 73.6 17.8 109.1 3.8 35.4 2.8 75.1-3 119.2l61.2-16.7c-15.6-59-25.2-97.9-28.6-116.6s-10.8-51.9-22.1-99.6l-25.3 4.6"clip-rule=evenodd fill-rule=evenodd></path><g stroke=#2F8A00><linearGradient x1=-660.23 x2=-660.23 y1=166.72 y2=167.72 gradientTransform="matrix(92.683 4.8573 -2.0259 38.657 61680 -3088.6)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m195 183.9s-12.6-22.1-36.5-29.9c-15.9-5.2-34.4-1.5-55.5 11.1 15.9 14.3 29.5 22.6 40.7 24.9 16.8 3.6 51.3-6.1 51.3-6.1z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-661.36 x2=-661.36 y1=164.18 y2=165.18 gradientTransform="matrix(110 5.7648 -6.3599 121.35 73933 -15933)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5s-47.5-8.5-83.2 15.7c-23.8 16.2-34.3 49.3-31.6 99.4 30.3-27.8 52.1-48.5 65.2-61.9 19.8-20.2 49.6-53.2 49.6-53.2z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-656.79 x2=-656.79 y1=165.15 y2=166.15 gradientTransform="matrix(62.954 3.2993 -3.5023 66.828 42156 -8754.1)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m195 183.9c-0.8-21.9 6-38 20.6-48.2s29.8-15.4 45.5-15.3c-6.1 21.4-14.5 35.8-25.2 43.4s-24.4 14.2-40.9 20.1z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-663.07 x2=-663.07 y1=165.44 y2=166.44 gradientTransform="matrix(152.47 7.9907 -3.0936 59.029 101884 -4318.7)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c31.9-30 64.1-39.7 96.7-29s50.8 30.4 54.6 59.1c-35.2-5.5-60.4-9.6-75.8-12.1-15.3-2.6-40.5-8.6-75.5-18z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-662.57 x2=-662.57 y1=164.44 y2=165.44 gradientTransform="matrix(136.46 7.1517 -5.2163 99.533 91536 -11442)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c35.8-7.6 65.6-0.2 89.2 22s37.7 49 42.3 80.3c-39.8-9.7-68.3-23.8-85.5-42.4s-32.5-38.5-46-59.9z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><linearGradient x1=-656.43 x2=-656.43 y1=163.86 y2=164.86 gradientTransform="matrix(60.866 3.1899 -8.7773 167.48 41560 -25168)"gradientUnits=userSpaceOnUse><stop stop-color=#2F8A00 offset=0></stop><stop stop-color=#90FF57 offset=1></stop></linearGradient><path d="m194.9 184.5c-33.6 13.8-53.6 35.7-60.1 65.6s-3.6 63.1 8.7 99.6c27.4-40.3 43.2-69.6 47.4-88s5.6-44.1 4-77.2z"clip-rule=evenodd fill-rule=evenodd stroke-width=13></path><path d="m196.5 182.3c-14.8 21.6-25.1 41.4-30.8 59.4s-9.5 33-11.1 45.1"fill=none stroke-linecap=round stroke-width=8></path><path d="m194.9 185.7c-24.4 1.7-43.8 9-58.1 21.8s-24.7 25.4-31.3 37.8"fill=none stroke-linecap=round stroke-width=8></path><path d="m204.5 176.4c29.7-6.7 52-8.4 67-5.1s26.9 8.6 35.8 15.9"fill=none stroke-linecap=round stroke-width=8></path><path d="m196.5 181.4c20.3 9.9 38.2 20.5 53.9 31.9s27.4 22.1 35.1 32"fill=none stroke-linecap=round stroke-width=8></path></g></g><defs><filter x=50.5 y=399 width=532 height=633 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=50.5 y=399 width=532 height=633 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-666.06 x2=-666.23 y1=163.36 y2=163.75 gradientTransform="matrix(532 0 0 633 354760 -102959)"gradientUnits=userSpaceOnUse><stop stop-color=#FFF400 offset=0></stop><stop stop-color=#3C8700 offset=1></stop></linearGradient><ellipse cx=316.5 cy=715.5 rx=266 ry=316.5></ellipse></g><defs><filter x=391 y=-24 width=288 height=283 filterUnits=userSpaceOnUse><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0"></feColorMatrix></filter></defs><mask x=391 y=-24 width=288 height=283 maskUnits=userSpaceOnUse><g><circle cx=316.5 cy=316.5 r=316.5 fill=#fff></circle></g></mask><g><linearGradient x1=-664.56 x2=-664.56 y1=163.79 y2=164.79 gradientTransform="matrix(227 0 0 227 151421 -37204)"gradientUnits=userSpaceOnUse><stop stop-color=#FFDF00 offset=0></stop><stop stop-color=#FF9D00 offset=1></stop></linearGradient><circle cx=565.5 cy=89.5 r=113.5></circle><linearGradient x1=-644.5 x2=-645.77 y1=342 y2=342 gradientTransform="matrix(30 0 0 1 19770 -253)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=427 x2=397 y1=89 y2=89 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-641.56 x2=-642.83 y1=196.02 y2=196.07 gradientTransform="matrix(26.5 0 0 5.5 17439 -1025.5)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=430.5 x2=404 y1=55.5 y2=50 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-643.73 x2=-645 y1=185.83 y2=185.9 gradientTransform="matrix(29 0 0 8 19107 -1361)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=431 x2=402 y1=122 y2=130 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-638.94 x2=-640.22 y1=177.09 y2=177.39 gradientTransform="matrix(24 0 0 13 15783 -2145)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=442 x2=418 y1=153 y2=166 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-633.42 x2=-634.7 y1=172.41 y2=173.31 gradientTransform="matrix(20 0 0 19 13137 -3096)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=464 x2=444 y1=180 y2=199 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-619.05 x2=-619.52 y1=170.82 y2=171.82 gradientTransform="matrix(13.83 0 0 22.85 9050 -3703.4)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=491.4 x2=477.5 y1=203 y2=225.9 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=-578.5 x2=-578.63 y1=170.31 y2=171.31 gradientTransform="matrix(7.5 0 0 24.5 4860 -3953)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=524.5 x2=517 y1=219.5 y2=244 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12></line><linearGradient x1=666.5 x2=666.5 y1=170.31 y2=171.31 gradientTransform="matrix(.5 0 0 24.5 231.5 -3944)"gradientUnits=userSpaceOnUse><stop stop-color=#FFA400 offset=0></stop><stop stop-color=#FF5E00 offset=1></stop></linearGradient><line x1=564.5 x2=565 y1=228.5 y2=253 fill=none stroke-linecap=round stroke-linejoin=bevel stroke-width=12>');function Xwe(){return Awe()}function Zwe(){return Nwe()}function Qwe(){return Rwe()}function Jwe(){return Owe()}function e_e(){return Pwe()}function t_e(){return(e=Pwe()).style.setProperty("transform","rotate(90deg)"),e;var e}function n_e(){return(e=Pwe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function r_e(){return kwe()}function o_e(){return Mwe()}function i_e(){return jwe()}function a_e(){return Lwe()}function s_e(){return Dwe()}function l_e(){return Iwe()}function c_e(){return Fwe()}function u_e(){return Uwe()}function d_e(){return $we()}function p_e(e){return t=Vwe(),n=t.firstChild,lt((()=>hn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function f_e(){return Bwe()}function h_e(){return zwe()}function m_e(e){return[$t(Jt,{get when(){return e.checked},get children(){var t=Vwe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}}),$t(Jt,{get when(){return!e.checked},get children(){var t=Hwe(),n=t.firstChild;return lt((()=>hn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function g_e(){return qwe()}function v_e(){return Gwe()}function y_e(){return Kwe()}function b_e(){return Wwe()}function x_e(){const e=Yt();return t=Ywe(),i=(o=(r=(n=t.firstChild).nextSibling).nextSibling).firstChild,s=(a=o.nextSibling).firstChild,u=(c=(l=a.nextSibling).nextSibling).firstChild,p=(d=c.nextSibling).firstChild,m=(h=(f=d.nextSibling).nextSibling).firstChild,v=(g=h.nextSibling).firstChild,x=(b=(y=g.nextSibling).nextSibling).firstChild,_=(w=b.nextSibling).firstChild,T=(E=(S=w.nextSibling).nextSibling).firstChild,A=(C=E.nextSibling).firstChild,O=(R=(N=C.nextSibling).nextSibling).firstChild,k=(P=R.nextSibling).firstChild,L=(j=(M=P.nextSibling).nextSibling).firstChild,I=(D=j.nextSibling).firstChild,$=(U=(F=D.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Q=(Z=(X=(Y=(W=(K=(G=(q=z.nextSibling).firstChild).nextSibling).nextSibling.firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,se=(ae=q.nextSibling).firstChild,ce=(le=ae.nextSibling).firstChild,pe=(de=(ue=le.nextSibling).firstChild).nextSibling,he=(fe=ue.nextSibling).firstChild,ge=(me=fe.nextSibling).firstChild,Le=(je=(Me=(ke=(Pe=(Oe=(Re=(Ne=(Ae=(Ce=(Te=(Ee=(Se=(_e=(we=(xe=(be=(ye=(ve=me.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,hn(n,"id",`a-${e}`),hn(r,"fill",`url(#a-${e})`),hn(i,"id",`am-${e}`),hn(a,"id",`b-${e}`),hn(s,"filter",`url(#am-${e})`),hn(l,"mask",`url(#b-${e})`),hn(u,"id",`ah-${e}`),hn(d,"id",`k-${e}`),hn(p,"filter",`url(#ah-${e})`),hn(f,"mask",`url(#k-${e})`),hn(m,"id",`ae-${e}`),hn(g,"id",`j-${e}`),hn(v,"filter",`url(#ae-${e})`),hn(y,"mask",`url(#j-${e})`),hn(x,"id",`ai-${e}`),hn(w,"id",`i-${e}`),hn(_,"filter",`url(#ai-${e})`),hn(S,"mask",`url(#i-${e})`),hn(T,"id",`aj-${e}`),hn(C,"id",`h-${e}`),hn(A,"filter",`url(#aj-${e})`),hn(N,"mask",`url(#h-${e})`),hn(O,"id",`ag-${e}`),hn(P,"id",`g-${e}`),hn(k,"filter",`url(#ag-${e})`),hn(M,"mask",`url(#g-${e})`),hn(L,"id",`af-${e}`),hn(D,"id",`f-${e}`),hn(I,"filter",`url(#af-${e})`),hn(F,"mask",`url(#f-${e})`),hn(U,"id",`m-${e}`),hn($,"fill",`url(#m-${e})`),hn(B,"id",`ak-${e}`),hn(z,"id",`e-${e}`),hn(H,"filter",`url(#ak-${e})`),hn(q,"mask",`url(#e-${e})`),hn(G,"id",`n-${e}`),hn(K,"fill",`url(#n-${e})`),hn(W,"id",`r-${e}`),hn(Y,"fill",`url(#r-${e})`),hn(X,"id",`s-${e}`),hn(Z,"fill",`url(#s-${e})`),hn(Q,"id",`q-${e}`),hn(J,"fill",`url(#q-${e})`),hn(ee,"id",`p-${e}`),hn(te,"fill",`url(#p-${e})`),hn(ne,"id",`o-${e}`),hn(re,"fill",`url(#o-${e})`),hn(oe,"id",`l-${e}`),hn(ie,"fill",`url(#l-${e})`),hn(se,"id",`al-${e}`),hn(le,"id",`d-${e}`),hn(ce,"filter",`url(#al-${e})`),hn(ue,"mask",`url(#d-${e})`),hn(de,"id",`u-${e}`),hn(pe,"fill",`url(#u-${e})`),hn(he,"id",`ad-${e}`),hn(me,"id",`c-${e}`),hn(ge,"filter",`url(#ad-${e})`),hn(ve,"mask",`url(#c-${e})`),hn(ye,"id",`t-${e}`),hn(be,"fill",`url(#t-${e})`),hn(xe,"id",`v-${e}`),hn(we,"stroke",`url(#v-${e})`),hn(_e,"id",`aa-${e}`),hn(Se,"stroke",`url(#aa-${e})`),hn(Ee,"id",`w-${e}`),hn(Te,"stroke",`url(#w-${e})`),hn(Ce,"id",`ac-${e}`),hn(Ae,"stroke",`url(#ac-${e})`),hn(Ne,"id",`ab-${e}`),hn(Re,"stroke",`url(#ab-${e})`),hn(Oe,"id",`y-${e}`),hn(Pe,"stroke",`url(#y-${e})`),hn(ke,"id",`x-${e}`),hn(Me,"stroke",`url(#x-${e})`),hn(je,"id",`z-${e}`),hn(Le,"stroke",`url(#z-${e})`),t;var t,n,r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x,w,_,S,E,T,C,A,N,R,O,P,k,M,j,L,D,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Z,Q,J,ee,te,ne,re,oe,ie,ae,se,le,ce,ue,de,pe,fe,he,me,ge,ve,ye,be,xe,we,_e,Se,Ee,Te,Ce,Ae,Ne,Re,Oe,Pe,ke,Me,je,Le}var w_e=pn('<span><svg width=16 height=16 viewBox="0 0 16 16"fill=none xmlns=http://www.w3.org/2000/svg><path d="M6 12L10 8L6 4"stroke-width=2 stroke-linecap=round stroke-linejoin=round>'),__e=pn('<button title="Copy object to clipboard">'),S_e=pn('<button title="Remove all items"aria-label="Remove all items">'),E_e=pn('<button title="Delete item"aria-label="Delete item">'),T_e=pn('<button title="Toggle value"aria-label="Toggle value">'),C_e=pn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),A_e=pn("<div>"),N_e=pn("<div><button> <span></span> <span> "),R_e=pn("<input>"),O_e=pn("<span>"),P_e=pn("<div><span>:"),k_e=pn("<div><div><button> [<!>...<!>]");var M_e=e=>{const t=ege(),n=Yme().shadowDOMTarget?Tge.bind({target:Yme().shadowDOMTarget}):Tge,r=ut((()=>"dark"===t()?B_e(n):V_e(n)));return o=w_e(),lt((()=>mn(o,Age(r().expander,n`
|
|
95
95
|
transform: rotate(${e.expanded?90:0}deg);
|
|
96
96
|
`,e.expanded&&n`
|
|
97
97
|
& svg {
|