@embedreach/components 0.2.1 → 0.2.2

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/index.umd.js CHANGED
@@ -90,7 +90,7 @@ function j3(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=
90
90
  *
91
91
  * This source code is licensed under the MIT license found in the
92
92
  * LICENSE file in the root directory of this source tree.
93
- */n7.exports="production"===process.env.NODE_ENV?function(){if(t7)return r7;t7=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 r7.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:s,r7}():(o7||(o7=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};i7.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())}()),i7);var a7=n7.exports,s7='[cmdk-group=""]',l7='[cmdk-group-items=""]',c7='[cmdk-item=""]',u7=`${c7}:not([aria-disabled="true"])`,d7="cmdk-item-select",p7="data-value",f7=(e,t,n)=>e7(e,t,n),h7=i.createContext(void 0),m7=()=>i.useContext(h7),g7=i.createContext(void 0),v7=()=>i.useContext(g7),y7=i.createContext(void 0),b7=i.forwardRef(((e,t)=>{let n=L7((()=>{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=L7((()=>new Set)),o=L7((()=>new Map)),a=L7((()=>new Map)),s=L7((()=>new Set)),l=P7(e),{label:c,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=sZ(),w=sZ(),x=sZ(),_=i.useRef(null),S=I7();k7((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,E.emit()}}),[d]),k7((()=>{S(6,N)}),[]);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)O(),A(),S(1,R);else if("value"===e&&(r||S(5,N),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,(()=>{O(),A(),n.current.value||R(),E.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();S(4,(()=>{O(),(null==t?void 0:t.getAttribute("id"))===e&&R(),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:x,labelId:w,listInnerRef:_})),[]);function C(e,t){var r,o;let i=null!=(o=null==(r=l.current)?void 0:r.filter)?o:f7;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(l7);t?t.appendChild(e.parentElement===t?e:e.closest(`${l7} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${l7} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{var t;let n=null==(t=_.current)?void 0:t.querySelector(`${s7}[${p7}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function R(){let e=k().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(p7);E.setState("value",t||void 0)}function O(){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 N(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(s7))?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(`${c7}[aria-selected="true"]`)}function k(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(u7))||[])}function L(e){let t=k()[e];t&&E.setState("value",t.getAttribute(p7))}function D(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(p7))}function M(e){let t,n=P(),r=null==n?void 0:n.closest(s7);for(;r&&!t;)r=e>0?O7(r,s7):N7(r,s7),t=null==r?void 0:r.querySelector(u7);t?E.setState("value",t.getAttribute(p7)):D(e)}let j=()=>L(k().length-1),I=e=>{e.preventDefault(),e.metaKey?j():e.altKey?M(1):D(1)},F=e=>{e.preventDefault(),e.metaKey?L(0):e.altKey?M(-1):D(-1)};return i.createElement(GQ.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(),L(0);break;case"End":e.preventDefault(),j();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=P();if(t){let e=new Event(d7);t.dispatchEvent(e)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:U7},c),F7(e,(e=>i.createElement(g7.Provider,{value:E},i.createElement(h7.Provider,{value:T},e)))))})),w7=i.forwardRef(((e,t)=>{var n,r;let o=sZ(),a=i.useRef(null),s=i.useContext(y7),l=m7(),c=P7(e),u=null!=(r=null==(n=c.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;k7((()=>{if(!u)return l.item(o,null==s?void 0:s.id)}),[u]);let d=j7(o,a,[e.value,e.children,a],e.keywords),p=v7(),f=M7((e=>e.value&&e.value===d.current)),h=M7((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(d7,m),()=>t.removeEventListener(d7,m)}),[h,e.onSelect,e.disabled]),!h)return null;let{disabled:v,value:y,onSelect:b,forceMount:w,keywords:x,..._}=e;return i.createElement(GQ.div,{ref:D7([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)})),x7=i.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,s=sZ(),l=i.useRef(null),c=i.useRef(null),u=sZ(),d=m7(),p=M7((e=>!(!o&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));k7((()=>d.group(s)),[]),j7(s,l,[e.value,e.heading,c]);let f=i.useMemo((()=>({id:s,forceMount:o})),[o]);return i.createElement(GQ.div,{ref:D7([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),F7(e,(e=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},i.createElement(y7.Provider,{value:f},e)))))})),_7=i.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=i.useRef(null),a=M7((e=>!e.search));return n||a?i.createElement(GQ.div,{ref:D7([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),S7=i.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=v7(),s=M7((e=>e.search)),l=M7((e=>e.value)),c=m7(),u=i.useMemo((()=>{var e;let t=null==(e=c.listInnerRef.current)?void 0:e.querySelector(`${c7}[${p7}="${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(GQ.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)}})})),E7=i.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=i.useRef(null),s=i.useRef(null),l=m7();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(GQ.div,{ref:D7([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},F7(e,(e=>i.createElement("div",{ref:D7([s,l.listInnerRef]),"cmdk-list-sizer":""},e))))})),T7=i.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:s,...l}=e;return i.createElement(pB,{open:n,onOpenChange:r},i.createElement(fB,{container:s},i.createElement(hB,{"cmdk-overlay":"",className:o}),i.createElement(mB,{"aria-label":e.label,"cmdk-dialog":"",className:a},i.createElement(b7,{ref:t,...l}))))})),C7=i.forwardRef(((e,t)=>M7((e=>0===e.filtered.count))?i.createElement(GQ.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),A7=i.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return i.createElement(GQ.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},F7(e,(e=>i.createElement("div",{"aria-hidden":!0},e))))})),R7=Object.assign(b7,{List:E7,Item:w7,Input:S7,Group:x7,Separator:_7,Dialog:T7,Empty:C7,Loading:A7});function O7(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function N7(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function P7(e){let t=i.useRef(e);return k7((()=>{t.current=e})),t}var k7="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function L7(e){let t=i.useRef();return void 0===t.current&&(t.current=e()),t}function D7(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function M7(e){let t=v7(),n=()=>e(t.snapshot());return a7.useSyncExternalStore(t.subscribe,n,n)}function j7(e,t,n,r=[]){let o=i.useRef(),a=m7();return k7((()=>{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(p7,s),o.current=s})),o}var I7=()=>{let[e,t]=i.useState(),n=L7((()=>new Map));return k7((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function F7({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 U7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const $7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7,{ref:r,className:Yd("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})));$7.displayName=R7.displayName;const V7=i.forwardRef((({className:e,searchIcon:n,...r},o)=>t.jsxs("div",{className:"flex items-center border-b px-3",children:[n||t.jsx($u,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),t.jsx(R7.Input,{ref:o,className:Yd("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})]})));V7.displayName=R7.Input.displayName;const B7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7.List,{ref:r,className:Yd("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n})));B7.displayName=R7.List.displayName;const z7=i.forwardRef(((e,n)=>t.jsx(R7.Empty,{ref:n,className:"py-6 text-center text-sm",...e})));z7.displayName=R7.Empty.displayName;const H7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7.Group,{ref:r,className:Yd("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})));H7.displayName=R7.Group.displayName;const q7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7.Separator,{ref:r,className:Yd("-mx-1 h-px bg-border",e),...n})));q7.displayName=R7.Separator.displayName;const G7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7.Item,{ref:r,className:Yd("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})));G7.displayName=R7.Item.displayName;const K7=({options:e,value:n,onChange:r,placeholder:o})=>{const[a,s]=i.useState(!1);return t.jsxs(d8,{modal:!0,open:a,onOpenChange:s,children:[t.jsx(p8,{asChild:!0,children:t.jsxs(VX,{"aria-expanded":a,className:"w-[200px] overflow-hidden justify-between",variant:"outline",children:[n?e.find((e=>e.value===n))?.label:o,t.jsx(gu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(f8,{className:"w-[200px] p-0",children:t.jsxs($7,{children:[t.jsx(V7,{placeholder:`${o}...`}),t.jsxs(B7,{children:[t.jsxs(z7,{children:["No ",o.toLowerCase()," found."]}),t.jsx(H7,{children:e.map((e=>t.jsxs(G7,{value:e.value,onSelect:e=>{r(e===n?"":e),s(!1)},children:[t.jsx(du,{className:Yd("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var W7=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find(Q7);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(Y7,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(Y7,{...o,ref:n,children:r})}));W7.displayName="Slot";var Y7=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?KU(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));Y7.displayName="SlotClone";var X7=({children:e})=>t.jsx(t.Fragment,{children:e});function Q7(e){return i.isValidElement(e)&&e.type===X7}var Z7=["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?W7: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}}),{}),J7="horizontal",eee=["horizontal","vertical"],tee=i.forwardRef(((e,n)=>{const{decorative:r,orientation:o=J7,...i}=e,a=function(e){return eee.includes(e)}(o)?o:J7;return t.jsx(Z7.div,{"data-orientation":a,...r?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...i,ref:n})}));tee.displayName="Separator";var nee=tee;const ree=i.forwardRef((({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>t.jsx(nee,{ref:i,decorative:r,orientation:n,className:Yd("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",e),...o})));ree.displayName=nee.displayName;const oee=nu("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"}}),iee=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($u,{className:"h-4 w-4 mr-2"}),selectedValues:m,setSelectedValues:g,...v},y)=>{const[b,w]=i.useState(!1),[x,_]=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(d8,{open:b,onOpenChange:w,modal:l,children:[t.jsx(p8,{asChild:!0,children:t.jsx("button",{type:"button",ref:y,...v,onClick:()=>{w((e=>!e))},className:Yd("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(n1,{className:Yd(x?"animate-bounce":"",oee({variant:r})),style:{animationDuration:`${a}s`},children:[i&&t.jsx(i,{className:"h-4 w-4 mr-2"}),o?.label,t.jsx(bu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),S(n)}})]},n)})),m.length>s&&t.jsxs(n1,{className:Yd("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",x?"animate-bounce":"",oee({variant:r})),style:{animationDuration:`${a}s`},children:[`+ ${m.length-s} more`,t.jsx(bu,{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(td,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:e=>{e.stopPropagation(),E()}}),t.jsx(ree,{orientation:"vertical",className:"flex min-h-6 h-full"}),t.jsx(pu,{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(pu,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),t.jsx(f8,{className:"w-auto p-0 z-[1000]",align:"start",onEscapeKeyDown:()=>w(!1),children:t.jsxs($7,{children:[t.jsx(V7,{searchIcon:h,placeholder:d,onKeyDown:e=>{if("Enter"===e.key)w(!0),p&&(p(e.currentTarget.value),w(!1));else if("Backspace"===e.key&&!e.currentTarget.value){const e=[...m];e.pop(),g(e),n(e)}}}),t.jsxs(B7,{children:[t.jsx(z7,{children:f}),t.jsxs(H7,{children:[t.jsxs(G7,{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:Yd("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(du,{className:"h-4 w-4"})}),t.jsx("span",{children:"(Select All)"})]},"all"),e.map((e=>{const n=m.includes(e.value);return t.jsxs(G7,{onSelect:()=>S(e.value),className:"cursor-pointer",children:[t.jsx("div",{className:Yd("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(du,{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(q7,{}),t.jsx(H7,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[m.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(G7,{onSelect:E,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),t.jsx(ree,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),t.jsx(G7,{onSelect:()=>w(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"}),u&&u.map((e=>e(w)))]})})]})]})}),a>0&&m.length>0&&t.jsx(ed,{className:Yd("cursor-pointer my-2 text-foreground bg-background w-3 h-3",x?"":"text-muted-foreground"),onClick:()=>_(!x)})]})}));function aee(e,[t,n]){return Math.min(n,Math.max(t,e))}function see(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function lee(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},cee(o,...n)]}function cee(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function uee(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function dee(...e){return t=>{let n=!1;const r=e.map((e=>{const r=uee(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():uee(e[t],null)}}}}function pee(...e){return i.useCallback(dee(...e),e)}function fee(e){const n=hee(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(gee);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function hee(e){const t=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?dee(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}iee.displayName="MultiSelect";var mee=Symbol("radix.slottable");function gee(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mee}var vee=i.createContext(void 0);var yee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=fee(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{});function bee(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}var wee,xee="dismissableLayer.update",_ee="dismissableLayer.pointerDownOutside",See="dismissableLayer.focusOutside",Eee=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Tee=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(Eee),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=pee(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=p?v.indexOf(p):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,_=w>=b,S=function(e,t=globalThis?.document){const n=bee(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Aee(_ee,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=bee(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){Aee(See,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return function(e,t=globalThis?.document){const n=bee(e);i.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[n,t])}((e=>{w===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(wee=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),Cee(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=wee)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),Cee())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(xee,e),()=>document.removeEventListener(xee,e)}),[]),t.jsx(yee.div,{...u,ref:g,style:{pointerEvents:x?_?"auto":"none":void 0,...e.style},onFocusCapture:see(e.onFocusCapture,E.onFocusCapture),onBlurCapture:see(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:see(e.onPointerDownCapture,S.onPointerDownCapture)})}));Tee.displayName="DismissableLayer";function Cee(){const e=new CustomEvent(xee);document.dispatchEvent(e)}function Aee(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&a.flushSync((()=>e.dispatchEvent(t)))}(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(Eee),o=i.useRef(null),a=pee(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(yee.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var Ree=0;function Oee(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Nee="focusScope.autoFocusOnMount",Pee="focusScope.autoFocusOnUnmount",kee={bubbles:!1,cancelable:!0},Lee=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=bee(a),p=bee(s),f=i.useRef(null),h=pee(n,(e=>u(e))),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect((()=>{if(o){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:Iee(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Iee(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Iee(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,c,m.paused]),i.useEffect((()=>{if(c){Fee.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(Nee,kee);c.addEventListener(Nee,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Iee(r,{select:t}),document.activeElement!==n)return}((e=Dee(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Iee(c))}return()=>{c.removeEventListener(Nee,d),setTimeout((()=>{const e=new CustomEvent(Pee,kee);c.addEventListener(Pee,p),c.dispatchEvent(e),e.defaultPrevented||Iee(t??document.body,{select:!0}),c.removeEventListener(Pee,p),Fee.remove(m)}),0)}}var e}),[c,d,p,m]);const g=i.useCallback((e=>{if(!r&&!o)return;if(m.paused)return;const t=document.activeElement;if("Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&t){const n=e.currentTarget,[o,i]=function(e){const t=Dee(e),n=Mee(t,e),r=Mee(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&Iee(i,{select:!0})):(e.preventDefault(),r&&Iee(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(yee.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function Dee(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}function Mee(e,t){for(const n of e)if(!jee(n,{upTo:t}))return n}function jee(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Iee(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Lee.displayName="FocusScope";var Fee=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Uee(e,t),e.unshift(t)},remove(t){e=Uee(e,t),e[0]?.resume()}}}();function Uee(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var $ee=globalThis?.document?i.useLayoutEffect:()=>{},Vee=i[" useId ".trim().toString()]||(()=>{}),Bee=0;function zee(e){const[t,n]=i.useState(Vee());return $ee((()=>{n((e=>e??String(Bee++)))}),[e]),e||(t?`radix-${t}`:"")}var Hee=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(yee.svg,{...a,ref:n,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})}));Hee.displayName="Arrow";var qee=Hee;var Gee="Popper",[Kee,Wee]=lee(Gee),[Yee,Xee]=Kee(Gee),Qee=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(Yee,{scope:n,anchor:o,onAnchorChange:a,children:r})};Qee.displayName=Gee;var Zee="PopperAnchor",Jee=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=Xee(Zee,r),l=i.useRef(null),c=pee(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(yee.div,{...a,ref:c})}));Jee.displayName=Zee;var ete="PopperContent",[tte,nte]=Kee(ete),rte=i.forwardRef(((e,n)=>{const{__scopePopper:r,side:o="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=e,y=Xee(ete,r),[b,w]=i.useState(null),x=pee(n,(e=>w(e))),[_,S]=i.useState(null),E=function(e){const[t,n]=i.useState(void 0);return $ee((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;n({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(_),T=E?.width??0,C=E?.height??0,A=o+("center"!==s?"-"+s:""),R="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},O=Array.isArray(d)?d:[d],N=O.length>0,P={padding:R,boundary:O.filter(ste),altBoundary:N},{refs:k,floatingStyles:L,placement:D,isPositioned:M,middlewareData:j}=AJ({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>fJ(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[OJ({mainAxis:a+C,alignmentAxis:l}),u&&NJ({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?PJ():void 0,...P}),u&&kJ({...P}),LJ({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),_&&MJ({element:_,padding:c}),lte({arrowWidth:T,arrowHeight:C}),h&&DJ({strategy:"referenceHidden",...P})]}),[I,F]=cte(D),U=bee(g);$ee((()=>{M&&U?.()}),[M,U]);const $=j.arrow?.x,V=j.arrow?.y,B=0!==j.arrow?.centerOffset,[z,H]=i.useState();return $ee((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:M?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[j.transformOrigin?.x,j.transformOrigin?.y].join(" "),...j.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(tte,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(yee.div,{"data-side":I,"data-align":F,...v,ref:x,style:{...v.style,animation:M?void 0:"none"}})})})}));rte.displayName=ete;var ote="PopperArrow",ite={top:"bottom",right:"left",bottom:"top",left:"right"},ate=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=nte(ote,r),a=ite[i.placedSide];return t.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:t.jsx(qee,{...o,ref:n,style:{...o.style,display:"block"}})})}));function ste(e){return null!==e}ate.displayName=ote;var lte=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=0!==o.arrow?.centerOffset,a=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,c]=cte(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(o.arrow?.x??0)+a/2,p=(o.arrow?.y??0)+s/2;let f="",h="";return"bottom"===l?(f=i?u:`${d}px`,h=-s+"px"):"top"===l?(f=i?u:`${d}px`,h=`${r.floating.height+s}px`):"right"===l?(f=-s+"px",h=i?u:`${p}px`):"left"===l&&(f=`${r.floating.width+s}px`,h=i?u:`${p}px`),{data:{x:f,y:h}}}});function cte(e){const[t,n="center"]=e.split("-");return[t,n]}var ute=Qee,dte=Jee,pte=rte,fte=ate,hte=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);$ee((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(yee.div,{...a,ref:n}),c):null}));hte.displayName="Portal";var mte=i[" useInsertionEffect ".trim().toString()]||$ee;function gte({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return mte((()=>{a.current=t}),[t]),i.useEffect((()=>{o.current!==n&&(a.current?.(n),o.current=n)}),[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=i.useRef(void 0!==e);i.useEffect((()=>{const e=t.current;if(e!==l){}t.current=l}),[l,r])}const u=i.useCallback((t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)}),[l,e,a,s]);return[c,u]}var vte=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});i.forwardRef(((e,n)=>t.jsx(yee.span,{...e,ref:n,style:{...vte,...e.style}}))).displayName="VisuallyHidden";var yte=[" ","Enter","ArrowUp","ArrowDown"],bte=[" ","Enter"],wte="Select",[xte,_te,Ste]=function(e){const r=e+"CollectionProvider",[o,i]=lee(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=fee(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=pee(n,s(c,r).collectionRef);return t.jsx(u,{ref:i,children:o})}));d.displayName=c;const p=e+"CollectionItemSlot",f="data-radix-collection-item",h=fee(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=pee(r,l),u=s(p,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(h,{[f]:"",ref:c,children:i})}));return m.displayName=p,[{Provider:l,Slot:d,ItemSlot:m},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(wte),[Ete,Tte]=lee(wte,[Ste,Wee]),Cte=Wee(),[Ate,Rte]=Ete(wte),[Ote,Nte]=Ete(wte),Pte=e=>{const{__scopeSelect:n,children:r,open:o,defaultOpen:a,onOpenChange:s,value:l,defaultValue:c,onValueChange:u,dir:d,name:p,autoComplete:f,disabled:h,required:m,form:g}=e,v=Cte(n),[y,b]=i.useState(null),[w,x]=i.useState(null),[_,S]=i.useState(!1),E=function(e){const t=i.useContext(vee);return e||t||"ltr"}(d),[T,C]=gte({prop:o,defaultProp:a??!1,onChange:s,caller:wte}),[A,R]=gte({prop:l,defaultProp:c,onChange:u,caller:wte}),O=i.useRef(null),N=!y||(g||!!y.closest("form")),[P,k]=i.useState(new Set),L=Array.from(P).map((e=>e.props.value)).join(";");return t.jsx(ute,{...v,children:t.jsxs(Ate,{required:m,scope:n,trigger:y,onTriggerChange:b,valueNode:w,onValueNodeChange:x,valueNodeHasChildren:_,onValueNodeHasChildrenChange:S,contentId:zee(),value:A,onValueChange:R,open:T,onOpenChange:C,dir:E,triggerPointerDownPosRef:O,disabled:h,children:[t.jsx(xte.Provider,{scope:n,children:t.jsx(Ote,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback((e=>{k((t=>new Set(t).add(e)))}),[]),onNativeOptionRemove:i.useCallback((e=>{k((t=>{const n=new Set(t);return n.delete(e),n}))}),[]),children:r})}),N?t.jsxs(vne,{"aria-hidden":!0,required:m,tabIndex:-1,name:p,autoComplete:f,value:A,onChange:e=>R(e.target.value),disabled:h,form:g,children:[void 0===A?t.jsx("option",{value:""}):null,Array.from(P)]},L):null]})})};Pte.displayName=wte;var kte="SelectTrigger",Lte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,disabled:o=!1,...a}=e,s=Cte(r),l=Rte(kte,r),c=l.disabled||o,u=pee(n,l.onTriggerChange),d=_te(r),p=i.useRef("touch"),[f,h,m]=bne((e=>{const t=d().filter((e=>!e.disabled)),n=t.find((e=>e.value===l.value)),r=wne(t,e,n);void 0!==r&&l.onValueChange(r.value)})),g=e=>{c||(l.onOpenChange(!0),m()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t.jsx(dte,{asChild:!0,...s,children:t.jsx(yee.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":yne(l.value)?"":void 0,...a,ref:u,onClick:see(a.onClick,(e=>{e.currentTarget.focus(),"mouse"!==p.current&&g(e)})),onPointerDown:see(a.onPointerDown,(e=>{p.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())})),onKeyDown:see(a.onKeyDown,(e=>{const t=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||yte.includes(e.key)&&(g(),e.preventDefault())}))})})}));Lte.displayName=kte;var Dte="SelectValue",Mte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:i,children:a,placeholder:s="",...l}=e,c=Rte(Dte,r),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,p=pee(n,c.onValueNodeChange);return $ee((()=>{u(d)}),[u,d]),t.jsx(yee.span,{...l,ref:p,style:{pointerEvents:"none"},children:yne(c.value)?t.jsx(t.Fragment,{children:s}):a})}));Mte.displayName=Dte;var jte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,children:o,...i}=e;return t.jsx(yee.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})}));jte.displayName="SelectIcon";var Ite=e=>t.jsx(hte,{asChild:!0,...e});Ite.displayName="SelectPortal";var Fte="SelectContent",Ute=i.forwardRef(((e,n)=>{const r=Rte(Fte,e.__scopeSelect),[o,s]=i.useState();if($ee((()=>{s(new DocumentFragment)}),[]),!r.open){const n=o;return n?a.createPortal(t.jsx(Vte,{scope:e.__scopeSelect,children:t.jsx(xte.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(Hte,{...e,ref:n})}));Ute.displayName=Fte;var $te=10,[Vte,Bte]=Ete(Fte),zte=fee("SelectContent.RemoveScroll"),Hte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,w=Rte(Fte,r),[x,_]=i.useState(null),[S,E]=i.useState(null),T=pee(n,(e=>_(e))),[C,A]=i.useState(null),[R,O]=i.useState(null),N=_te(r),[P,k]=i.useState(!1),L=i.useRef(!1);i.useEffect((()=>{if(x)return LV(x)}),[x]),i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Oee()),document.body.insertAdjacentElement("beforeend",e[1]??Oee()),Ree++,()=>{1===Ree&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),Ree--}}),[]);const D=i.useCallback((e=>{const[t,...n]=N().map((e=>e.ref.current)),[r]=n.slice(-1),o=document.activeElement;for(const i of e){if(i===o)return;if(i?.scrollIntoView({block:"nearest"}),i===t&&S&&(S.scrollTop=0),i===r&&S&&(S.scrollTop=S.scrollHeight),i?.focus(),document.activeElement!==o)return}}),[N,S]),M=i.useCallback((()=>D([C,x])),[D,C,x]);i.useEffect((()=>{P&&M()}),[P,M]);const{onOpenChange:j,triggerPointerDownPosRef:I}=w;i.useEffect((()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||j(!1),document.removeEventListener("pointermove",t),I.current=null};return null!==I.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}}),[x,j,I]),i.useEffect((()=>{const e=()=>j(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}}),[j]);const[F,U]=bne((e=>{const t=N().filter((e=>!e.disabled)),n=t.find((e=>e.ref.current===document.activeElement)),r=wne(t,e,n);r&&setTimeout((()=>r.ref.current.focus()))})),$=i.useCallback(((e,t,n)=>{const r=!L.current&&!n;(void 0!==w.value&&w.value===t||r)&&(A(e),r&&(L.current=!0))}),[w.value]),V=i.useCallback((()=>x?.focus()),[x]),B=i.useCallback(((e,t,n)=>{(void 0!==w.value&&w.value===t||!L.current&&!n)&&O(e)}),[w.value]),z="popper"===o?Gte:qte,H=z===Gte?{side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t.jsx(Vte,{scope:r,content:x,viewport:S,onViewportChange:E,itemRefCallback:$,selectedItem:C,onItemLeave:V,itemTextRefCallback:B,focusSelectedItem:M,selectedItemText:R,position:o,isPositioned:P,searchRef:F,children:t.jsx(CV,{as:zte,allowPinchZoom:!0,children:t.jsx(Lee,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:see(a,(e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()})),children:t.jsx(Tee,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t.jsx(z,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...b,...H,onPlaced:()=>k(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:see(b.onKeyDown,(e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||U(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=N().filter((e=>!e.disabled)).map((e=>e.ref.current));if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=t.indexOf(e.target);t=t.slice(n+1)}setTimeout((()=>D(t))),e.preventDefault()}}))})})})})})}));Hte.displayName="SelectContentImpl";var qte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onPlaced:o,...a}=e,s=Rte(Fte,r),l=Bte(Fte,r),[c,u]=i.useState(null),[d,p]=i.useState(null),f=pee(n,(e=>p(e))),h=_te(r),m=i.useRef(!1),g=i.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:w}=l,x=i.useCallback((()=>{if(s.trigger&&s.valueNode&&c&&d&&v&&y&&b){const e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if("rtl"!==s.dir){const o=n.left-(r.left-t.left),i=e.width+(e.left-o),a=Math.max(i,t.width),s=window.innerWidth-$te,l=aee(o,[$te,Math.max($te,s-a)]);c.style.minWidth=i+"px",c.style.left=l+"px"}else{const o=window.innerWidth-n.right-(t.right-r.right),i=window.innerWidth-e.right-o,a=e.width+i,s=Math.max(a,t.width),l=window.innerWidth-$te,u=aee(o,[$te,Math.max($te,l-s)]);c.style.minWidth=a+"px",c.style.right=u+"px"}const i=h(),a=window.innerHeight-2*$te,l=v.scrollHeight,u=window.getComputedStyle(d),p=parseInt(u.borderTopWidth,10),f=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),w=p+f+l+parseInt(u.paddingBottom,10)+g,x=Math.min(5*y.offsetHeight,w),_=window.getComputedStyle(v),S=parseInt(_.paddingTop,10),E=parseInt(_.paddingBottom,10),T=e.top+e.height/2-$te,C=a-T,A=y.offsetHeight/2,R=p+f+(y.offsetTop+A),O=w-R;if(R<=T){const e=i.length>0&&y===i[i.length-1].ref.current;c.style.bottom="0px";const t=Math.max(C,A+(e?E:0)+(d.clientHeight-v.offsetTop-v.offsetHeight)+g);c.style.height=R+t+"px"}else{const e=i.length>0&&y===i[0].ref.current;c.style.top="0px";const t=Math.max(T,p+v.offsetTop+(e?S:0)+A);c.style.height=t+O+"px",v.scrollTop=R-T+v.offsetTop}c.style.margin=`${$te}px 0`,c.style.minHeight=x+"px",c.style.maxHeight=a+"px",o?.(),requestAnimationFrame((()=>m.current=!0))}}),[h,s.trigger,s.valueNode,c,d,v,y,b,s.dir,o]);$ee((()=>x()),[x]);const[_,S]=i.useState();$ee((()=>{d&&S(window.getComputedStyle(d).zIndex)}),[d]);const E=i.useCallback((e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)}),[x,w]);return t.jsx(Kte,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:E,children:t.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:t.jsx(yee.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})}));qte.displayName="SelectItemAlignedPosition";var Gte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=$te,...a}=e,s=Cte(r);return t.jsx(pte,{...s,...a,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})}));Gte.displayName="SelectPopperPosition";var[Kte,Wte]=Ete(Fte,{}),Yte="SelectViewport",Xte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,nonce:o,...a}=e,s=Bte(Yte,r),l=Wte(Yte,r),c=pee(n,s.onViewportChange),u=i.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),t.jsx(xte.Slot,{scope:r,children:t.jsx(yee.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:see(a.onScroll,(e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=l;if(r?.current&&n){const e=Math.abs(u.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*$te,o=parseFloat(n.style.minHeight),i=parseFloat(n.style.height),a=Math.max(o,i);if(a<r){const o=a+e,i=Math.min(r,o),s=o-i;n.style.height=i+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}u.current=t.scrollTop}))})})]})}));Xte.displayName=Yte;var Qte="SelectGroup",[Zte,Jte]=Ete(Qte);i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=zee();return t.jsx(Zte,{scope:r,id:i,children:t.jsx(yee.div,{role:"group","aria-labelledby":i,...o,ref:n})})})).displayName=Qte;var ene="SelectLabel",tne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Jte(ene,r);return t.jsx(yee.div,{id:i.id,...o,ref:n})}));tne.displayName=ene;var nne="SelectItem",[rne,one]=Ete(nne),ine=i.forwardRef(((e,n)=>{const{__scopeSelect:r,value:o,disabled:a=!1,textValue:s,...l}=e,c=Rte(nne,r),u=Bte(nne,r),d=c.value===o,[p,f]=i.useState(s??""),[h,m]=i.useState(!1),g=pee(n,(e=>u.itemRefCallback?.(e,o,a))),v=zee(),y=i.useRef("touch"),b=()=>{a||(c.onValueChange(o),c.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(rne,{scope:r,value:o,disabled:a,textId:v,isSelected:d,onItemTextChange:i.useCallback((e=>{f((t=>t||(e?.textContent??"").trim()))}),[]),children:t.jsx(xte.ItemSlot,{scope:r,value:o,disabled:a,textValue:p,children:t.jsx(yee.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:g,onFocus:see(l.onFocus,(()=>m(!0))),onBlur:see(l.onBlur,(()=>m(!1))),onClick:see(l.onClick,(()=>{"mouse"!==y.current&&b()})),onPointerUp:see(l.onPointerUp,(()=>{"mouse"===y.current&&b()})),onPointerDown:see(l.onPointerDown,(e=>{y.current=e.pointerType})),onPointerMove:see(l.onPointerMove,(e=>{y.current=e.pointerType,a?u.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})})),onPointerLeave:see(l.onPointerLeave,(e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()})),onKeyDown:see(l.onKeyDown,(e=>{""!==u.searchRef?.current&&" "===e.key||(bte.includes(e.key)&&b()," "===e.key&&e.preventDefault())}))})})})}));ine.displayName=nne;var ane="SelectItemText",sne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:s,...l}=e,c=Rte(ane,r),u=Bte(ane,r),d=one(ane,r),p=Nte(ane,r),[f,h]=i.useState(null),m=pee(n,(e=>h(e)),d.onItemTextChange,(e=>u.itemTextRefCallback?.(e,d.value,d.disabled))),g=f?.textContent,v=i.useMemo((()=>t.jsx("option",{value:d.value,disabled:d.disabled,children:g},d.value)),[d.disabled,d.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=p;return $ee((()=>(y(v),()=>b(v))),[y,b,v]),t.jsxs(t.Fragment,{children:[t.jsx(yee.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})}));sne.displayName=ane;var lne="SelectItemIndicator",cne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return one(lne,r).isSelected?t.jsx(yee.span,{"aria-hidden":!0,...o,ref:n}):null}));cne.displayName=lne;var une="SelectScrollUpButton",dne=i.forwardRef(((e,n)=>{const r=Bte(une,e.__scopeSelect),o=Wte(une,e.__scopeSelect),[a,s]=i.useState(!1),l=pee(n,o.onScrollButtonChange);return $ee((()=>{if(r.viewport&&r.isPositioned){let e=function(){s(t.scrollTop>0)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}}),[r.viewport,r.isPositioned]),a?t.jsx(hne,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}));dne.displayName=une;var pne="SelectScrollDownButton",fne=i.forwardRef(((e,n)=>{const r=Bte(pne,e.__scopeSelect),o=Wte(pne,e.__scopeSelect),[a,s]=i.useState(!1),l=pee(n,o.onScrollButtonChange);return $ee((()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;s(n)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}}),[r.viewport,r.isPositioned]),a?t.jsx(hne,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}));fne.displayName=pne;var hne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onAutoScroll:o,...a}=e,s=Bte("SelectScrollButton",r),l=i.useRef(null),c=_te(r),u=i.useCallback((()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)}),[]);return i.useEffect((()=>()=>u()),[u]),$ee((()=>{const e=c().find((e=>e.ref.current===document.activeElement));e?.ref.current?.scrollIntoView({block:"nearest"})}),[c]),t.jsx(yee.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:see(a.onPointerDown,(()=>{null===l.current&&(l.current=window.setInterval(o,50))})),onPointerMove:see(a.onPointerMove,(()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(o,50))})),onPointerLeave:see(a.onPointerLeave,(()=>{u()}))})})),mne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return t.jsx(yee.div,{"aria-hidden":!0,...o,ref:n})}));mne.displayName="SelectSeparator";var gne="SelectArrow";i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Cte(r),a=Rte(gne,r),s=Bte(gne,r);return a.open&&"popper"===s.position?t.jsx(fte,{...i,...o,ref:n}):null})).displayName=gne;var vne=i.forwardRef((({__scopeSelect:e,value:n,...r},o)=>{const a=i.useRef(null),s=pee(o,a),l=function(e){const t=i.useRef({value:e,previous:e});return i.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}(n);return i.useEffect((()=>{const e=a.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}}),[l,n]),t.jsx(yee.select,{...r,style:{...vte,...r.style},ref:s,defaultValue:n})}));function yne(e){return""===e||void 0===e}function bne(e){const t=bee(e),n=i.useRef(""),r=i.useRef(0),o=i.useCallback((e=>{const o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout((()=>e("")),1e3))}(o)}),[t]),a=i.useCallback((()=>{n.current="",window.clearTimeout(r.current)}),[]);return i.useEffect((()=>()=>window.clearTimeout(r.current)),[]),[n,o,a]}function wne(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,o=n?e.indexOf(n):-1;let i=(a=e,s=Math.max(o,0),a.map(((e,t)=>a[(s+t)%a.length])));var a,s;1===r.length&&(i=i.filter((e=>e!==n)));const l=i.find((e=>e.textValue.toLowerCase().startsWith(r.toLowerCase())));return l!==n?l:void 0}vne.displayName="SelectBubbleInput";var xne=Lte,_ne=jte,Sne=Ite,Ene=Ute,Tne=Xte,Cne=tne,Ane=ine,Rne=sne,One=cne,Nne=dne,Pne=fne,kne=mne;const Lne=Pte,Dne=Mte,Mne=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(xne,{ref:o,className:Yd("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-border/10 px-3 py-2 text-sm shadow-sm ring-offset-background !placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[n,t.jsx(_ne,{asChild:!0,children:t.jsx(pu,{className:"h-4 w-4 opacity-50"})})]})));Mne.displayName=xne.displayName;const jne=i.forwardRef((({className:e,...n},r)=>t.jsx(Nne,{ref:r,className:Yd("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(mu,{className:"h-4 w-4"})})));jne.displayName=Nne.displayName;const Ine=i.forwardRef((({className:e,...n},r)=>t.jsx(Pne,{ref:r,className:Yd("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(pu,{className:"h-4 w-4"})})));Ine.displayName=Pne.displayName;const Fne=i.forwardRef((({className:e,children:n,position:r="popper",...o},i)=>t.jsx(Sne,{children:t.jsxs(Ene,{ref:i,className:Yd("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[t.jsx(jne,{}),t.jsx(Tne,{className:Yd("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),t.jsx(Ine,{})]})})));Fne.displayName=Ene.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(Cne,{ref:r,className:Yd("px-2 py-1.5 text-sm font-semibold text-muted-foreground",e),...n}))).displayName=Cne.displayName;const Une=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(Ane,{ref:o,className:Yd("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(One,{children:t.jsx(du,{className:"h-4 w-4"})})}),t.jsx(Rne,{children:n})]})));Une.displayName=Ane.displayName;function $ne(e){const t=i.useRef({value:e,previous:e});return i.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}i.forwardRef((({className:e,...n},r)=>t.jsx(kne,{ref:r,className:Yd("-mx-1 my-1 h-px bg-muted",e),...n}))).displayName=kne.displayName;var Vne="Switch",[Bne,zne]=UQ(Vne),[Hne,qne]=Bne(Vne),Gne=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=WU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,w]=u0({prop:a,defaultProp:s,onChange:d});return t.jsxs(Hne,{scope:r,checked:b,disabled:c,children:[t.jsx(GQ.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":Xne(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onClick:FQ(e.onClick,(e=>{w((e=>!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(Yne,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})}));Gne.displayName=Vne;var Kne="SwitchThumb",Wne=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=qne(Kne,r);return t.jsx(GQ.span,{"data-state":Xne(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})}));Wne.displayName=Kne;var Yne=e=>{const{control:n,checked:r,bubbles:o=!0,...a}=e,s=i.useRef(null),l=$ne(r),c=FJ(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 Xne(e){return e?"checked":"unchecked"}var Qne=Gne,Zne=Wne;const Jne=i.forwardRef((({className:e,...n},r)=>t.jsx(Qne,{className:Yd("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(Zne,{className:Yd("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")})})));function ere(e){return(ere="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tre(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function nre(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function rre(e){nre(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===ere(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):new Date(NaN)}function ore(e,t){nre(2,arguments);var n=rre(e),r=tre(t);return isNaN(r)?new Date(NaN):r?(n.setDate(n.getDate()+r),n):n}function ire(e,t){nre(2,arguments);var n=rre(e),r=tre(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());return i.setMonth(n.getMonth()+r+1,0),o>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}Jne.displayName=Qne.displayName;var are={};function sre(){return are}function lre(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=rre(e),f=p.getDay(),h=(f<d?7:0)+f-d;return p.setDate(p.getDate()-h),p.setHours(0,0,0,0),p}function cre(e){return nre(1,arguments),lre(e,{weekStartsOn:1})}function ure(e){nre(1,arguments);var t=function(e){nre(1,arguments);var t=rre(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=cre(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var a=cre(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}(e),n=new Date(0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),cre(n)}function dre(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function pre(e){nre(1,arguments);var t=rre(e);return t.setHours(0,0,0,0),t}function fre(e,t){nre(2,arguments);var n=pre(e),r=pre(t),o=n.getTime()-dre(n),i=r.getTime()-dre(r);return Math.round((o-i)/864e5)}function hre(e,t){return nre(2,arguments),ore(e,7*tre(t))}function mre(e,t){return nre(2,arguments),ire(e,12*tre(t))}function gre(e,t){nre(2,arguments);var n=pre(e),r=pre(t);return n.getTime()===r.getTime()}function vre(e){return nre(1,arguments),e instanceof Date||"object"===ere(e)&&"[object Date]"===Object.prototype.toString.call(e)}function yre(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function bre(e){nre(1,arguments);var t=rre(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function wre(e){nre(1,arguments);var t=rre(e);return t.setDate(1),t.setHours(0,0,0,0),t}function xre(e){nre(1,arguments);var t=rre(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function _re(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=rre(e),f=p.getDay(),h=6+(f<d?-7:0)-(f-d);return p.setDate(p.getDate()+h),p.setHours(23,59,59,999),p}function Sre(e){return nre(1,arguments),_re(e,{weekStartsOn:1})}function Ere(e,t){return nre(2,arguments),function(e,t){nre(2,arguments);var n=rre(e).getTime(),r=tre(t);return new Date(n+r)}(e,-tre(t))}function Tre(e){nre(1,arguments);var t=rre(e),n=t.getUTCDay(),r=(n<1?7:0)+n-1;return t.setUTCDate(t.getUTCDate()-r),t.setUTCHours(0,0,0,0),t}function Cre(e){nre(1,arguments);var t=rre(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=Tre(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var a=Tre(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function Are(e){nre(1,arguments);var t=rre(e),n=Tre(t).getTime()-function(e){nre(1,arguments);var t=Cre(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),Tre(n)}(t).getTime();return Math.round(n/6048e5)+1}function Rre(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=rre(e),f=p.getUTCDay(),h=(f<d?7:0)+f-d;return p.setUTCDate(p.getUTCDate()-h),p.setUTCHours(0,0,0,0),p}function Ore(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=rre(e),d=u.getUTCFullYear(),p=sre(),f=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:p.firstWeekContainsDate)&&void 0!==r?r:null===(l=p.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(d+1,0,f),h.setUTCHours(0,0,0,0);var m=Rre(h,t),g=new Date(0);g.setUTCFullYear(d,0,f),g.setUTCHours(0,0,0,0);var v=Rre(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function Nre(e,t){nre(1,arguments);var n=rre(e),r=Rre(n,t).getTime()-function(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:u.firstWeekContainsDate)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),p=Ore(e,t),f=new Date(0);return f.setUTCFullYear(p,0,d),f.setUTCHours(0,0,0,0),Rre(f,t)}(n,t).getTime();return Math.round(r/6048e5)+1}function Pre(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var kre=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return Pre("yy"===t?r%100:r,t.length)},Lre=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):Pre(n+1,2)},Dre=function(e,t){return Pre(e.getUTCDate(),t.length)},Mre=function(e,t){return Pre(e.getUTCHours()%12||12,t.length)},jre=function(e,t){return Pre(e.getUTCHours(),t.length)},Ire=function(e,t){return Pre(e.getUTCMinutes(),t.length)},Fre=function(e,t){return Pre(e.getUTCSeconds(),t.length)},Ure=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return Pre(Math.floor(r*Math.pow(10,n-3)),t.length)},$re="midnight",Vre="noon",Bre="morning",zre="afternoon",Hre="evening",qre="night",Gre={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear();return n.ordinalNumber(r>0?r:1-r,{unit:"year"})}return kre(e,t)},Y:function(e,t,n,r){var o=Ore(e,r),i=o>0?o:1-o;return"YY"===t?Pre(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):Pre(i,t.length)},R:function(e,t){return Pre(Cre(e),t.length)},u:function(e,t){return Pre(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Pre(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Pre(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return Lre(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return Pre(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var o=Nre(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):Pre(o,t.length)},I:function(e,t,n){var r=Are(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):Pre(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):Dre(e,t)},D:function(e,t,n){var r=function(e){nre(1,arguments);var t=rre(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime();return Math.floor((n-r)/864e5)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):Pre(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Pre(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Pre(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return Pre(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,o=e.getUTCHours();switch(r=12===o?Vre:0===o?$re:o/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,o=e.getUTCHours();switch(r=o>=17?Hre:o>=12?zre:o>=4?Bre:qre,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Mre(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):jre(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):Pre(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):Pre(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):Ire(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):Fre(e,t)},S:function(e,t){return Ure(e,t)},X:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Wre(o);case"XXXX":case"XX":return Yre(o);default:return Yre(o,":")}},x:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Wre(o);case"xxxx":case"xx":return Yre(o);default:return Yre(o,":")}},O:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Kre(o,":");default:return"GMT"+Yre(o,":")}},z:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Kre(o,":");default:return"GMT"+Yre(o,":")}},t:function(e,t,n,r){return Pre(Math.floor((r._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,r){return Pre((r._originalDate||e).getTime(),t.length)}};function Kre(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(0===i)return n+String(o);var a=t;return n+String(o)+a+Pre(i,2)}function Wre(e,t){return e%60==0?(e>0?"-":"+")+Pre(Math.abs(e)/60,2):Yre(e,t)}function Yre(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e);return r+Pre(Math.floor(o/60),2)+n+Pre(o%60,2)}var Xre=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Qre=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Zre={p:Qre,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return Xre(e,t);switch(o){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Xre(o,t)).replace("{{time}}",Qre(i,t))}},Jre=["D","DD"],eoe=["YY","YYYY"];function toe(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var noe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function roe(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var ooe={date:roe({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:roe({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:roe({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},ioe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function aoe(e){return function(t,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=null!=n&&n.width?String(n.width):o;r=e.formattingValues[i]||e.formattingValues[o]}else{var a=e.defaultWidth,s=null!=n&&n.width?String(n.width):e.defaultWidth;r=e.values[s]||e.values[a]}return r[e.argumentCallback?e.argumentCallback(t):t]}}var soe={ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:aoe({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:aoe({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:aoe({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:aoe({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:aoe({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function loe(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,o=t.match(r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth]);if(!o)return null;var i,a=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n;return}(s,(function(e){return e.test(a)})):function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n;return}(s,(function(e){return e.test(a)}));return i=e.valueCallback?e.valueCallback(l):l,{value:i=n.valueCallback?n.valueCallback(i):i,rest:t.slice(a.length)}}}var coe={ordinalNumber:function(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var a=e.valueCallback?e.valueCallback(i[0]):i[0];return{value:a=n.valueCallback?n.valueCallback(a):a,rest:t.slice(o.length)}}}({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:loe({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:loe({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:loe({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:loe({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:loe({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},uoe={code:"en-US",formatDistance:function(e,t,n){var r,o=noe[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:ooe,formatRelative:function(e,t,n,r){return ioe[e]},localize:soe,match:coe,options:{weekStartsOn:0,firstWeekContainsDate:1}},doe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,poe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,foe=/^'([^]*?)'?$/,hoe=/''/g,moe=/[a-zA-Z]/;function goe(e,t,n){var r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,w;nre(2,arguments);var x=String(t),_=sre(),S=null!==(r=null!==(o=null==n?void 0:n.locale)&&void 0!==o?o:_.locale)&&void 0!==r?r:uoe,E=tre(null!==(i=null!==(a=null!==(s=null!==(l=null==n?void 0:n.firstWeekContainsDate)&&void 0!==l?l:null==n||null===(c=n.locale)||void 0===c||null===(u=c.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==s?s:_.firstWeekContainsDate)&&void 0!==a?a:null===(d=_.locale)||void 0===d||null===(p=d.options)||void 0===p?void 0:p.firstWeekContainsDate)&&void 0!==i?i:1);if(!(E>=1&&E<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=tre(null!==(f=null!==(h=null!==(m=null!==(g=null==n?void 0:n.weekStartsOn)&&void 0!==g?g:null==n||null===(v=n.locale)||void 0===v||null===(y=v.options)||void 0===y?void 0:y.weekStartsOn)&&void 0!==m?m:_.weekStartsOn)&&void 0!==h?h:null===(b=_.locale)||void 0===b||null===(w=b.options)||void 0===w?void 0:w.weekStartsOn)&&void 0!==f?f:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!S.localize)throw new RangeError("locale must contain localize property");if(!S.formatLong)throw new RangeError("locale must contain formatLong property");var C=rre(e);if(!function(e){if(nre(1,arguments),!vre(e)&&"number"!=typeof e)return!1;var t=rre(e);return!isNaN(Number(t))}(C))throw new RangeError("Invalid time value");var A=Ere(C,dre(C)),R={firstWeekContainsDate:E,weekStartsOn:T,locale:S,_originalDate:C};return x.match(poe).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Zre[t])(e,S.formatLong):e})).join("").match(doe).map((function(r){if("''"===r)return"'";var o=r[0];if("'"===o)return function(e){var t=e.match(foe);if(!t)return e;return t[1].replace(hoe,"'")}(r);var i=Gre[o];if(i)return null!=n&&n.useAdditionalWeekYearTokens||-1===eoe.indexOf(r)||toe(r,t,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==Jre.indexOf(e)}(r)||toe(r,t,String(e)),i(A,r,S.localize,R);if(o.match(moe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return r})).join("")}function voe(e){return nre(1,arguments),Math.floor(function(e){return nre(1,arguments),rre(e).getTime()}(e)/1e3)}function yoe(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:u.firstWeekContainsDate)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),p=function(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=rre(e),d=u.getFullYear(),p=sre(),f=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:p.firstWeekContainsDate)&&void 0!==r?r:null===(l=p.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setFullYear(d+1,0,f),h.setHours(0,0,0,0);var m=lre(h,t),g=new Date(0);g.setFullYear(d,0,f),g.setHours(0,0,0,0);var v=lre(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}(e,t),f=new Date(0);return f.setFullYear(p,0,d),f.setHours(0,0,0,0),lre(f,t)}function boe(e,t){return nre(1,arguments),function(e,t,n){nre(2,arguments);var r=lre(e,n),o=lre(t,n),i=r.getTime()-dre(r),a=o.getTime()-dre(o);return Math.round((i-a)/6048e5)}(function(e){nre(1,arguments);var t=rre(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}(e),wre(e),t)+1}function woe(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return n.getTime()>r.getTime()}function xoe(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return n.getTime()<r.getTime()}function _oe(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function Soe(e,t){return nre(2,arguments),ore(e,-tre(t))}function Eoe(e,t){nre(2,arguments);var n=rre(e),r=tre(t),o=n.getFullYear(),i=n.getDate(),a=new Date(0);a.setFullYear(o,r,15),a.setHours(0,0,0,0);var s=function(e){nre(1,arguments);var t=rre(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}(a);return n.setMonth(r,Math.min(i,s)),n}function Toe(e,t){nre(2,arguments);var n=rre(e),r=tre(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var Coe=function(){return Coe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Coe.apply(this,arguments)};function Aoe(e,t,n){for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function Roe(e){return"multiple"===e.mode}function Ooe(e){return"range"===e.mode}function Noe(e){return"single"===e.mode}"function"==typeof SuppressedError&&SuppressedError;var Poe={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};var koe=Object.freeze({__proto__:null,formatCaption:function(e,t){return goe(e,"LLLL y",t)},formatDay:function(e,t){return goe(e,"d",t)},formatMonthCaption:function(e,t){return goe(e,"LLLL",t)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,t){return goe(e,"cccccc",t)},formatYearCaption:function(e,t){return goe(e,"yyyy",t)}}),Loe=Object.freeze({__proto__:null,labelDay:function(e,t,n){return goe(e,"do MMMM (EEEE)",n)},labelMonthDropdown:function(){return"Month: "},labelNext:function(){return"Go to next month"},labelPrevious:function(){return"Go to previous month"},labelWeekNumber:function(e){return"Week n. ".concat(e)},labelWeekday:function(e,t){return goe(e,"cccc",t)},labelYearDropdown:function(){return"Year: "}});var Doe=n.createContext(void 0);function Moe(e){var n,r,o=e.initialProps,i={captionLayout:"buttons",classNames:Poe,formatters:koe,labels:Loe,locale:uoe,modifiersClassNames:{},modifiers:{},numberOfMonths:1,styles:{},today:new Date,mode:"default"},a=function(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,a=e.toDate;return r?i=wre(r):t&&(i=new Date(t,0,1)),o?a=bre(o):n&&(a=new Date(n,11,31)),{fromDate:i?pre(i):void 0,toDate:a?pre(a):void 0}}(o),s=a.fromDate,l=a.toDate,c=null!==(n=o.captionLayout)&&void 0!==n?n:i.captionLayout;"buttons"===c||s&&l||(c="buttons"),(Noe(o)||Roe(o)||Ooe(o))&&(r=o.onSelect);var u=Coe(Coe(Coe({},i),o),{captionLayout:c,classNames:Coe(Coe({},i.classNames),o.classNames),components:Coe({},o.components),formatters:Coe(Coe({},i.formatters),o.formatters),fromDate:s,labels:Coe(Coe({},i.labels),o.labels),mode:o.mode||i.mode,modifiers:Coe(Coe({},i.modifiers),o.modifiers),modifiersClassNames:Coe(Coe({},i.modifiersClassNames),o.modifiersClassNames),onSelect:r,styles:Coe(Coe({},i.styles),o.styles),toDate:l});return t.jsx(Doe.Provider,{value:u,children:e.children})}function joe(){var e=n.useContext(Doe);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function Ioe(e){var n=joe();return t.jsx("div",{className:n.classNames.caption_label,style:n.styles.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:(0,n.formatters.formatCaption)(e.displayMonth,{locale:n.locale})})}function Foe(e){return t.jsx("svg",Coe({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:t.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Uoe(e){var n,r,o=e.onChange,i=e.value,a=e.children,s=e.caption,l=e.className,c=e.style,u=joe(),d=null!==(r=null===(n=u.components)||void 0===n?void 0:n.IconDropdown)&&void 0!==r?r:Foe;return t.jsxs("div",{className:l,style:c,children:[t.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),t.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:i,onChange:o,children:a}),t.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[s,t.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function $oe(e){var n,r=joe(),o=r.fromDate,i=r.toDate,a=r.styles,s=r.locale,l=r.formatters.formatMonthCaption,c=r.classNames,u=r.components,d=r.labels.labelMonthDropdown;if(!o)return t.jsx(t.Fragment,{});if(!i)return t.jsx(t.Fragment,{});var p=[];if(function(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return n.getFullYear()===r.getFullYear()}(o,i))for(var f=wre(o),h=o.getMonth();h<=i.getMonth();h++)p.push(Eoe(f,h));else for(f=wre(new Date),h=0;h<=11;h++)p.push(Eoe(f,h));var m=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:Uoe;return t.jsx(m,{name:"months","aria-label":d(),className:c.dropdown_month,style:a.dropdown_month,onChange:function(t){var n=Number(t.target.value),r=Eoe(wre(e.displayMonth),n);e.onChange(r)},value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:s}),children:p.map((function(e){return t.jsx("option",{value:e.getMonth(),children:l(e,{locale:s})},e.getMonth())}))})}function Voe(e){var n,r=e.displayMonth,o=joe(),i=o.fromDate,a=o.toDate,s=o.locale,l=o.styles,c=o.classNames,u=o.components,d=o.formatters.formatYearCaption,p=o.labels.labelYearDropdown,f=[];if(!i)return t.jsx(t.Fragment,{});if(!a)return t.jsx(t.Fragment,{});for(var h=i.getFullYear(),m=a.getFullYear(),g=h;g<=m;g++)f.push(Toe(xre(new Date),g));var v=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:Uoe;return t.jsx(v,{name:"years","aria-label":p(),className:c.dropdown_year,style:l.dropdown_year,onChange:function(t){var n=Toe(wre(r),Number(t.target.value));e.onChange(n)},value:r.getFullYear(),caption:d(r,{locale:s}),children:f.map((function(e){return t.jsx("option",{value:e.getFullYear(),children:d(e,{locale:s})},e.getFullYear())}))})}function Boe(){var e=joe(),t=function(e){var t=e.month||e.defaultMonth||e.today||new Date,n=e.toDate,r=e.fromDate,o=e.numberOfMonths,i=void 0===o?1:o;return n&&yre(n,t)<0&&(t=ire(n,-1*(i-1))),r&&yre(t,r)<0&&(t=r),wre(t)}(e),r=function(e,t){var r=n.useState(e);return[void 0===t?r[0]:t,r[1]]}(t,e.month),o=r[1];return[r[0],function(t){var n;if(!e.disableNavigation){var r=wre(t);o(r),null===(n=e.onMonthChange)||void 0===n||n.call(e,r)}}]}var zoe=n.createContext(void 0);function Hoe(e){var n=joe(),r=Boe(),o=r[0],i=r[1],a=function(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=wre(e),i=yre(wre(ire(o,r)),o),a=[],s=0;s<i;s++){var l=ire(o,s);a.push(l)}return n&&(a=a.reverse()),a}(o,n),s=function(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.numberOfMonths,o=void 0===r?1:r,i=t.pagedNavigation?o:1,a=wre(e);if(!n)return ire(a,i);if(!(yre(n,e)<o))return ire(a,i)}}(o,n),l=function(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.numberOfMonths,o=t.pagedNavigation?void 0===r?1:r:1,i=wre(e);if(!n)return ire(i,-o);if(!(yre(i,n)<=0))return ire(i,-o)}}(o,n),c=function(e){return a.some((function(t){return _oe(e,t)}))};return t.jsx(zoe.Provider,{value:{currentMonth:o,displayMonths:a,goToMonth:i,goToDate:function(e,t){c(e)||(t&&xoe(e,t)?i(ire(e,1+-1*n.numberOfMonths)):i(e))},previousMonth:l,nextMonth:s,isDateDisplayed:c},children:e.children})}function qoe(){var e=n.useContext(zoe);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Goe(e){var n,r=joe(),o=r.classNames,i=r.styles,a=r.components,s=qoe().goToMonth,l=function(t){s(ire(t,e.displayIndex?-e.displayIndex:0))},c=null!==(n=null==a?void 0:a.CaptionLabel)&&void 0!==n?n:Ioe,u=t.jsx(c,{id:e.id,displayMonth:e.displayMonth});return t.jsxs("div",{className:o.caption_dropdowns,style:i.caption_dropdowns,children:[t.jsx("div",{className:o.vhidden,children:u}),t.jsx($oe,{onChange:l,displayMonth:e.displayMonth}),t.jsx(Voe,{onChange:l,displayMonth:e.displayMonth})]})}function Koe(e){return t.jsx("svg",Coe({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:t.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Woe(e){return t.jsx("svg",Coe({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:t.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Yoe=n.forwardRef((function(e,n){var r=joe(),o=r.classNames,i=r.styles,a=[o.button_reset,o.button];e.className&&a.push(e.className);var s=a.join(" "),l=Coe(Coe({},i.button_reset),i.button);return e.style&&Object.assign(l,e.style),t.jsx("button",Coe({},e,{ref:n,type:"button",className:s,style:l}))}));function Xoe(e){var n,r,o=joe(),i=o.dir,a=o.locale,s=o.classNames,l=o.styles,c=o.labels,u=c.labelPrevious,d=c.labelNext,p=o.components;if(!e.nextMonth&&!e.previousMonth)return t.jsx(t.Fragment,{});var f=u(e.previousMonth,{locale:a}),h=[s.nav_button,s.nav_button_previous].join(" "),m=d(e.nextMonth,{locale:a}),g=[s.nav_button,s.nav_button_next].join(" "),v=null!==(n=null==p?void 0:p.IconRight)&&void 0!==n?n:Woe,y=null!==(r=null==p?void 0:p.IconLeft)&&void 0!==r?r:Koe;return t.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&t.jsx(Yoe,{name:"previous-month","aria-label":f,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:t.jsx("rtl"===i?v:y,{className:s.nav_icon,style:l.nav_icon})}),!e.hideNext&&t.jsx(Yoe,{name:"next-month","aria-label":m,className:g,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:t.jsx("rtl"===i?y:v,{className:s.nav_icon,style:l.nav_icon})})]})}function Qoe(e){var n=joe().numberOfMonths,r=qoe(),o=r.previousMonth,i=r.nextMonth,a=r.goToMonth,s=r.displayMonths,l=s.findIndex((function(t){return _oe(e.displayMonth,t)})),c=0===l,u=l===s.length-1;return t.jsx(Xoe,{displayMonth:e.displayMonth,hideNext:n>1&&(c||!u),hidePrevious:n>1&&(u||!c),nextMonth:i,previousMonth:o,onPreviousClick:function(){o&&a(o)},onNextClick:function(){i&&a(i)}})}function Zoe(e){var n,r,o=joe(),i=o.classNames,a=o.styles,s=o.captionLayout,l=o.components,c=null!==(n=null==l?void 0:l.CaptionLabel)&&void 0!==n?n:Ioe;return r=o.disableNavigation?t.jsx(c,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===s?t.jsx(Goe,{displayMonth:e.displayMonth,id:e.id}):t.jsxs(t.Fragment,"dropdown-buttons"===s?{children:[t.jsx(Goe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),t.jsx(Qoe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}:{children:[t.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(Qoe,{displayMonth:e.displayMonth,id:e.id})]}),t.jsx("div",{className:i.caption,style:a.caption,children:r})}function Joe(e){var n=joe(),r=n.footer;return r?t.jsx("tfoot",{className:n.classNames.tfoot,style:n.styles.tfoot,children:t.jsx("tr",{children:t.jsx("td",{colSpan:8,children:r})})}):t.jsx(t.Fragment,{})}function eie(){var e=joe(),n=e.classNames,r=e.styles,o=e.showWeekNumber,i=e.locale,a=e.formatters.formatWeekdayName,s=e.labels.labelWeekday,l=function(e,t,n){for(var r=n?cre(new Date):lre(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var a=ore(r,i);o.push(a)}return o}(i,e.weekStartsOn,e.ISOWeek);return t.jsxs("tr",{style:r.head_row,className:n.head_row,children:[o&&t.jsx("td",{style:r.head_cell,className:n.head_cell}),l.map((function(e,o){return t.jsx("th",{scope:"col",className:n.head_cell,style:r.head_cell,"aria-label":s(e,{locale:i}),children:a(e,{locale:i})},o)}))]})}function tie(){var e,n=joe(),r=n.components,o=null!==(e=null==r?void 0:r.HeadRow)&&void 0!==e?e:eie;return t.jsx("thead",{style:n.styles.head,className:n.classNames.head,children:t.jsx(o,{})})}function nie(e){var n=joe();return t.jsx(t.Fragment,{children:(0,n.formatters.formatDay)(e.date,{locale:n.locale})})}var rie=n.createContext(void 0);function oie(e){if(!Roe(e.initialProps)){return t.jsx(rie.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}return t.jsx(iie,{initialProps:e.initialProps,children:e.children})}function iie(e){var n=e.initialProps,r=e.children,o=n.selected,i=n.min,a=n.max,s={disabled:[]};return o&&s.disabled.push((function(e){var t=a&&o.length>a-1,n=o.some((function(t){return gre(t,e)}));return Boolean(t&&!n)})),t.jsx(rie.Provider,{value:{selected:o,onDayClick:function(e,t,r){var s,l;if((null===(s=n.onDayClick)||void 0===s||s.call(n,e,t,r),!Boolean(t.selected&&i&&(null==o?void 0:o.length)===i))&&!Boolean(!t.selected&&a&&(null==o?void 0:o.length)===a)){var c=o?Aoe([],o):[];if(t.selected){var u=c.findIndex((function(t){return gre(e,t)}));c.splice(u,1)}else c.push(e);null===(l=n.onSelect)||void 0===l||l.call(n,c,e,t,r)}},modifiers:s},children:r})}function aie(){var e=n.useContext(rie);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var sie,lie,cie=n.createContext(void 0);function uie(e){if(!Ooe(e.initialProps)){return t.jsx(cie.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}return t.jsx(die,{initialProps:e.initialProps,children:e.children})}function die(e){var n=e.initialProps,r=e.children,o=n.selected,i=o||{},a=i.from,s=i.to,l=n.min,c=n.max,u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(u.range_start=[a],s?(u.range_end=[s],gre(a,s)||(u.range_middle=[{after:a,before:s}])):u.range_end=[a]):s&&(u.range_start=[s],u.range_end=[s]),l&&(a&&!s&&u.disabled.push({after:Soe(a,l-1),before:ore(a,l-1)}),a&&s&&u.disabled.push({after:a,before:ore(a,l-1)}),!a&&s&&u.disabled.push({after:Soe(s,l-1),before:ore(s,l-1)})),c){if(a&&!s&&(u.disabled.push({before:ore(a,1-c)}),u.disabled.push({after:ore(a,c-1)})),a&&s){var d=c-(fre(s,a)+1);u.disabled.push({before:Soe(a,d)}),u.disabled.push({after:ore(s,d)})}!a&&s&&(u.disabled.push({before:ore(s,1-c)}),u.disabled.push({after:ore(s,c-1)}))}return t.jsx(cie.Provider,{value:{selected:o,onDayClick:function(e,t,r){var i,a;null===(i=n.onDayClick)||void 0===i||i.call(n,e,t,r);var s=function(e,t){var n=t||{},r=n.from,o=n.to;if(r&&o){if(gre(o,e)&&gre(r,e))return;if(gre(o,e))return{from:o,to:void 0};if(gre(r,e))return;return woe(r,e)?{from:e,to:o}:{from:r,to:e}}return o?woe(e,o)?{from:o,to:e}:{from:e,to:o}:r?xoe(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}(e,o);null===(a=n.onSelect)||void 0===a||a.call(n,s,e,t,r)},modifiers:u},children:r})}function pie(){var e=n.useContext(cie);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function fie(e){return Array.isArray(e)?Aoe([],e):void 0!==e?[e]:[]}(lie=sie||(sie={})).Outside="outside",lie.Disabled="disabled",lie.Selected="selected",lie.Hidden="hidden",lie.Today="today",lie.RangeStart="range_start",lie.RangeEnd="range_end",lie.RangeMiddle="range_middle";var hie=sie.Selected,mie=sie.Disabled,gie=sie.Hidden,vie=sie.Today,yie=sie.RangeEnd,bie=sie.RangeMiddle,wie=sie.RangeStart,xie=sie.Outside;var _ie=n.createContext(void 0);function Sie(e){var n=joe(),r=function(e,t,n){var r,o=((r={})[hie]=fie(e.selected),r[mie]=fie(e.disabled),r[gie]=fie(e.hidden),r[vie]=[e.today],r[yie]=[],r[bie]=[],r[wie]=[],r[xie]=[],r);return e.fromDate&&o[mie].push({before:e.fromDate}),e.toDate&&o[mie].push({after:e.toDate}),Roe(e)?o[mie]=o[mie].concat(t.modifiers[mie]):Ooe(e)&&(o[mie]=o[mie].concat(n.modifiers[mie]),o[wie]=n.modifiers[wie],o[bie]=n.modifiers[bie],o[yie]=n.modifiers[yie]),o}(n,aie(),pie()),o=function(e){var t={};return Object.entries(e).forEach((function(e){t[e[0]]=fie(e[1])})),t}(n.modifiers),i=Coe(Coe({},r),o);return t.jsx(_ie.Provider,{value:i,children:e.children})}function Eie(){var e=n.useContext(_ie);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Tie(e,t){return t.some((function(t){if("boolean"==typeof t)return t;if(vre(t))return gre(e,t);var n,r,o,i,a;if(function(e){return Array.isArray(e)&&e.every(vre)}(t))return t.includes(e);if(function(e){return Boolean(e&&"object"==typeof e&&"from"in e)}(t))return n=e,a=(r=t).to,(i=r.from)&&a?(fre(a,i)<0&&(i=(o=[a,i])[0],a=o[1]),fre(n,i)>=0&&fre(a,n)>=0):a?gre(a,n):!!i&&gre(i,n);if(function(e){return Boolean(e&&"object"==typeof e&&"dayOfWeek"in e)}(t))return t.dayOfWeek.includes(e.getDay());if(function(e){return Boolean(e&&"object"==typeof e&&"before"in e&&"after"in e)}(t)){var s=fre(t.before,e)>0,l=fre(t.after,e)<0;return woe(t.before,t.after)?l&&s:s||l}return function(e){return Boolean(e&&"object"==typeof e&&"after"in e)}(t)?fre(e,t.after)>0:function(e){return Boolean(e&&"object"==typeof e&&"before"in e)}(t)?fre(t.before,e)>0:"function"==typeof t&&t(e)}))}function Cie(e,t,n){var r=Object.keys(t).reduce((function(n,r){return Tie(e,t[r])&&n.push(r),n}),[]),o={};return r.forEach((function(e){return o[e]=!0})),n&&!_oe(e,n)&&(o.outside=!0),o}function Aie(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,a=t.retry,s=void 0===a?{count:0,lastFocused:e}:a,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,d=o.locale,p={day:ore,week:hre,month:ire,year:mre,startOfWeek:function(e){return o.ISOWeek?cre(e):lre(e,{locale:d,weekStartsOn:l})},endOfWeek:function(e){return o.ISOWeek?Sre(e):_re(e,{locale:d,weekStartsOn:l})}}[n](e,"after"===r?1:-1);"before"===r&&c?p=function(e){var t,n;if(nre(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==ere(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=rre(e);(void 0===n||n<t||isNaN(Number(t)))&&(n=t)})),n||new Date(NaN)}([c,p]):"after"===r&&u&&(p=function(e){var t,n;if(nre(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==ere(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=rre(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}([u,p]));var f=!0;if(i){var h=Cie(p,i);f=!h.disabled&&!h.hidden}return f?p:s.count>365?s.lastFocused:Aie(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:Coe(Coe({},s),{count:s.count+1})})}var Rie=n.createContext(void 0);function Oie(e){var r=qoe(),o=Eie(),i=n.useState(),a=i[0],s=i[1],l=n.useState(),c=l[0],u=l[1],d=function(e,t){for(var n,r,o=wre(e[0]),i=bre(e[e.length-1]),a=o;a<=i;){var s=Cie(a,t);if(s.disabled||s.hidden)a=ore(a,1);else{if(s.selected)return a;s.today&&!r&&(r=a),n||(n=a),a=ore(a,1)}}return r||n}(r.displayMonths,o),p=(null!=a?a:c&&r.isDateDisplayed(c))?c:d,f=function(e){s(e)},h=joe(),m=function(e,t){if(a){var n=Aie(a,{moveBy:e,direction:t,context:h,modifiers:o});gre(a,n)||(r.goToDate(n,a),f(n))}};return t.jsx(Rie.Provider,{value:{focusedDay:a,focusTarget:p,blur:function(){u(a),s(void 0)},focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}},children:e.children})}function Nie(){var e=n.useContext(Rie);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}var Pie=n.createContext(void 0);function kie(e){if(!Noe(e.initialProps)){return t.jsx(Pie.Provider,{value:{selected:void 0},children:e.children})}return t.jsx(Lie,{initialProps:e.initialProps,children:e.children})}function Lie(e){var n=e.initialProps;return t.jsx(Pie.Provider,{value:{selected:n.selected,onDayClick:function(e,t,r){var o,i,a;null===(o=n.onDayClick)||void 0===o||o.call(n,e,t,r),!t.selected||n.required?null===(a=n.onSelect)||void 0===a||a.call(n,e,e,t,r):null===(i=n.onSelect)||void 0===i||i.call(n,void 0,e,t,r)}},children:e.children})}function Die(){var e=n.useContext(Pie);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function Mie(e,t){var n=[e.classNames.day];return Object.keys(t).forEach((function(t){var r=e.modifiersClassNames[t];if(r)n.push(r);else if(function(e){return Object.values(sie).includes(e)}(t)){var o=e.classNames["day_".concat(t)];o&&n.push(o)}})),n}function jie(e,r,o){var i,a,s,l=joe(),c=Nie(),u=function(e,t){return Cie(e,Eie(),t)}(e,r),d=function(e,t){var n=joe(),r=Die(),o=aie(),i=pie(),a=Nie(),s=a.focusDayAfter,l=a.focusDayBefore,c=a.focusWeekAfter,u=a.focusWeekBefore,d=a.blur,p=a.focus,f=a.focusMonthBefore,h=a.focusMonthAfter,m=a.focusYearBefore,g=a.focusYearAfter,v=a.focusStartOfWeek,y=a.focusEndOfWeek;return{onClick:function(a){var s,l,c,u;Noe(n)?null===(s=r.onDayClick)||void 0===s||s.call(r,e,t,a):Roe(n)?null===(l=o.onDayClick)||void 0===l||l.call(o,e,t,a):Ooe(n)?null===(c=i.onDayClick)||void 0===c||c.call(i,e,t,a):null===(u=n.onDayClick)||void 0===u||u.call(n,e,t,a)},onFocus:function(r){var o;p(e),null===(o=n.onDayFocus)||void 0===o||o.call(n,e,t,r)},onBlur:function(r){var o;d(),null===(o=n.onDayBlur)||void 0===o||o.call(n,e,t,r)},onKeyDown:function(r){var o;switch(r.key){case"ArrowLeft":r.preventDefault(),r.stopPropagation(),"rtl"===n.dir?s():l();break;case"ArrowRight":r.preventDefault(),r.stopPropagation(),"rtl"===n.dir?l():s();break;case"ArrowDown":r.preventDefault(),r.stopPropagation(),c();break;case"ArrowUp":r.preventDefault(),r.stopPropagation(),u();break;case"PageUp":r.preventDefault(),r.stopPropagation(),r.shiftKey?m():f();break;case"PageDown":r.preventDefault(),r.stopPropagation(),r.shiftKey?g():h();break;case"Home":r.preventDefault(),r.stopPropagation(),v();break;case"End":r.preventDefault(),r.stopPropagation(),y()}null===(o=n.onDayKeyDown)||void 0===o||o.call(n,e,t,r)},onKeyUp:function(r){var o;null===(o=n.onDayKeyUp)||void 0===o||o.call(n,e,t,r)},onMouseEnter:function(r){var o;null===(o=n.onDayMouseEnter)||void 0===o||o.call(n,e,t,r)},onMouseLeave:function(r){var o;null===(o=n.onDayMouseLeave)||void 0===o||o.call(n,e,t,r)},onPointerEnter:function(r){var o;null===(o=n.onDayPointerEnter)||void 0===o||o.call(n,e,t,r)},onPointerLeave:function(r){var o;null===(o=n.onDayPointerLeave)||void 0===o||o.call(n,e,t,r)},onTouchCancel:function(r){var o;null===(o=n.onDayTouchCancel)||void 0===o||o.call(n,e,t,r)},onTouchEnd:function(r){var o;null===(o=n.onDayTouchEnd)||void 0===o||o.call(n,e,t,r)},onTouchMove:function(r){var o;null===(o=n.onDayTouchMove)||void 0===o||o.call(n,e,t,r)},onTouchStart:function(r){var o;null===(o=n.onDayTouchStart)||void 0===o||o.call(n,e,t,r)}}}(e,u),p=function(){var e=joe(),t=Die(),n=aie(),r=pie();return Noe(e)?t.selected:Roe(e)?n.selected:Ooe(e)?r.selected:void 0}(),f=Boolean(l.onDayClick||"default"!==l.mode);n.useEffect((function(){var t;u.outside||c.focusedDay&&f&&gre(c.focusedDay,e)&&(null===(t=o.current)||void 0===t||t.focus())}),[c.focusedDay,e,o,f,u.outside]);var h=Mie(l,u).join(" "),m=function(e,t){var n=Coe({},e.styles.day);return Object.keys(t).forEach((function(t){var r;n=Coe(Coe({},n),null===(r=e.modifiersStyles)||void 0===r?void 0:r[t])})),n}(l,u),g=Boolean(u.outside&&!l.showOutsideDays||u.hidden),v=null!==(s=null===(a=l.components)||void 0===a?void 0:a.DayContent)&&void 0!==s?s:nie,y={style:m,className:h,children:t.jsx(v,{date:e,displayMonth:r,activeModifiers:u}),role:"gridcell"},b=c.focusTarget&&gre(c.focusTarget,e)&&!u.outside,w=c.focusedDay&&gre(c.focusedDay,e),x=Coe(Coe(Coe({},y),((i={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,i.tabIndex=w||b?0:-1,i)),d);return{isButton:f,isHidden:g,activeModifiers:u,selectedDays:p,buttonProps:x,divProps:y}}function Iie(e){var r=n.useRef(null),o=jie(e.date,e.displayMonth,r);return o.isHidden?t.jsx("div",{role:"gridcell"}):o.isButton?t.jsx(Yoe,Coe({name:"day",ref:r},o.buttonProps)):t.jsx("div",Coe({},o.divProps))}function Fie(e){var n=e.number,r=e.dates,o=joe(),i=o.onWeekNumberClick,a=o.styles,s=o.classNames,l=o.locale,c=o.labels.labelWeekNumber,u=(0,o.formatters.formatWeekNumber)(Number(n),{locale:l});if(!i)return t.jsx("span",{className:s.weeknumber,style:a.weeknumber,children:u});var d=c(Number(n),{locale:l});return t.jsx(Yoe,{name:"week-number","aria-label":d,className:s.weeknumber,style:a.weeknumber,onClick:function(e){i(n,r,e)},children:u})}function Uie(e){var n,r,o,i=joe(),a=i.styles,s=i.classNames,l=i.components,c=null!==(n=null==l?void 0:l.Day)&&void 0!==n?n:Iie,u=null!==(r=null==l?void 0:l.WeekNumber)&&void 0!==r?r:Fie;return i.showWeekNumber&&(o=t.jsx("td",{className:s.cell,style:a.cell,children:t.jsx(u,{number:e.weekNumber,dates:e.dates})})),t.jsxs("tr",{className:s.row,style:a.row,children:[o,e.dates.map((function(n){return t.jsx("td",{className:s.cell,style:a.cell,role:"presentation",children:t.jsx(c,{displayMonth:e.displayMonth,date:n})},voe(n))}))]})}function $ie(e,t,n){for(var r=(null==n?void 0:n.ISOWeek)?Sre(t):_re(t,n),o=(null==n?void 0:n.ISOWeek)?cre(e):lre(e,n),i=fre(r,o),a=[],s=0;s<=i;s++)a.push(ore(o,s));var l=a.reduce((function(e,t){var r=(null==n?void 0:n.ISOWeek)?function(e){nre(1,arguments);var t=rre(e),n=cre(t).getTime()-ure(t).getTime();return Math.round(n/6048e5)+1}(t):function(e,t){nre(1,arguments);var n=rre(e),r=lre(n,t).getTime()-yoe(n,t).getTime();return Math.round(r/6048e5)+1}(t,n),o=e.find((function(e){return e.weekNumber===r}));return o?(o.dates.push(t),e):(e.push({weekNumber:r,dates:[t]}),e)}),[]);return l}function Vie(e){var n,r,o,i=joe(),a=i.locale,s=i.classNames,l=i.styles,c=i.hideHead,u=i.components,d=i.weekStartsOn,p=i.firstWeekContainsDate,f=i.ISOWeek,h=function(e,t){var n=$ie(wre(e),bre(e),t);if(null==t?void 0:t.useFixedWeeks){var r=boe(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],a=hre(i,6-r),s=$ie(hre(i,1),a,t);n.push.apply(n,s)}}return n}(e.displayMonth,{useFixedWeeks:Boolean(i.fixedWeeks),ISOWeek:f,locale:a,weekStartsOn:d,firstWeekContainsDate:p}),m=null!==(n=null==u?void 0:u.Head)&&void 0!==n?n:tie,g=null!==(r=null==u?void 0:u.Row)&&void 0!==r?r:Uie,v=null!==(o=null==u?void 0:u.Footer)&&void 0!==o?o:Joe;return t.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&t.jsx(m,{}),t.jsx("tbody",{className:s.tbody,style:l.tbody,children:h.map((function(n){return t.jsx(g,{displayMonth:e.displayMonth,dates:n.dates,weekNumber:n.weekNumber},n.weekNumber)}))}),t.jsx(v,{displayMonth:e.displayMonth})]})}var Bie="undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,zie=!1,Hie=0;function qie(){return"react-day-picker-".concat(++Hie)}function Gie(e){var r,o,i=joe(),a=i.dir,s=i.classNames,l=i.styles,c=i.components,u=qoe().displayMonths,d=function(e){var t,r=null!=e?e:zie?qie():null,o=n.useState(r),i=o[0],a=o[1];return Bie((function(){null===i&&a(qie())}),[]),n.useEffect((function(){!1===zie&&(zie=!0)}),[]),null!==(t=null!=e?e:i)&&void 0!==t?t:void 0}(i.id?"".concat(i.id,"-").concat(e.displayIndex):void 0),p=i.id?"".concat(i.id,"-grid-").concat(e.displayIndex):void 0,f=[s.month],h=l.month,m=0===e.displayIndex,g=e.displayIndex===u.length-1,v=!m&&!g;"rtl"===a&&(g=(r=[m,g])[0],m=r[1]),m&&(f.push(s.caption_start),h=Coe(Coe({},h),l.caption_start)),g&&(f.push(s.caption_end),h=Coe(Coe({},h),l.caption_end)),v&&(f.push(s.caption_between),h=Coe(Coe({},h),l.caption_between));var y=null!==(o=null==c?void 0:c.Caption)&&void 0!==o?o:Zoe;return t.jsxs("div",{className:f.join(" "),style:h,children:[t.jsx(y,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(Vie,{id:p,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function Kie(e){var n=joe();return t.jsx("div",{className:n.classNames.months,style:n.styles.months,children:e.children})}function Wie(e){var r,o,i=e.initialProps,a=joe(),s=Nie(),l=qoe(),c=n.useState(!1),u=c[0],d=c[1];n.useEffect((function(){a.initialFocus&&s.focusTarget&&(u||(s.focus(s.focusTarget),d(!0)))}),[a.initialFocus,u,s.focus,s.focusTarget,s]);var p=[a.classNames.root,a.className];a.numberOfMonths>1&&p.push(a.classNames.multiple_months),a.showWeekNumber&&p.push(a.classNames.with_weeknumber);var f=Coe(Coe({},a.styles.root),a.style),h=Object.keys(i).filter((function(e){return e.startsWith("data-")})).reduce((function(e,t){var n;return Coe(Coe({},e),((n={})[t]=i[t],n))}),{}),m=null!==(o=null===(r=i.components)||void 0===r?void 0:r.Months)&&void 0!==o?o:Kie;return t.jsx("div",Coe({className:p.join(" "),style:f,dir:a.dir,id:a.id,nonce:i.nonce,title:i.title,lang:i.lang},h,{children:t.jsx(m,{children:l.displayMonths.map((function(e,n){return t.jsx(Gie,{displayIndex:n,displayMonth:e},n)}))})}))}function Yie(e){var n=e.children,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children"]);return t.jsx(Moe,{initialProps:r,children:t.jsx(Hoe,{children:t.jsx(kie,{initialProps:r,children:t.jsx(oie,{initialProps:r,children:t.jsx(uie,{initialProps:r,children:t.jsx(Sie,{children:t.jsx(Oie,{children:n})})})})})})})}function Xie(e){return t.jsx(Yie,Coe({},e,{children:t.jsx(Wie,{initialProps:e})}))}function Qie({className:e,classNames:n,showOutsideDays:r=!0,...o}){return t.jsx(Xie,{showOutsideDays:r,className:Yd("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Yd($X({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:Yd("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===o.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:Yd($X({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...n},components:{IconLeft:()=>t.jsx(fu,{className:"h-4 w-4"}),IconRight:()=>t.jsx(hu,{className:"h-4 w-4"})},...o})}Qie.displayName="Calendar";const Zie=({onSelect:e,date:n,placeholder:r="Pick a date"})=>t.jsxs(d8,{modal:!0,children:[t.jsx(p8,{asChild:!0,children:t.jsxs(VX,{variant:"outline",className:Yd("w-[200px] justify-start text-left font-normal h-9",!n&&"text-muted-foreground"),children:[t.jsx(uu,{className:"mr-2 h-4 w-4"}),n?y9(n,"PPP"):t.jsx("span",{children:r})]})}),t.jsx(f8,{className:"w-auto p-0",align:"start",children:t.jsx(Qie,{mode:"single",selected:n,onSelect:e,initialFocus:!0})})]}),Jie=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===H9.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),eae=({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===_Q.Date||e===_Q.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:H9.DAYS,direction:"before"}),[v,y]=i.useState(u?r[0]:void 0),[b,w]=i.useState(!1);if(i.useEffect((()=>{n!==EQ.EQUALS_MONTH_DAY&&n!==EQ.EQUALS_MONTH_DAY_YEAR&&f&&(h(!1),o(d?[d]:[]))}),[n,f,d,o]),i.useEffect((()=>{if(u&&v?.startDate){w("object"==typeof v.startDate&&"type"in v.startDate)}}),[u,v]),e===_Q.String||e===_Q.ReachResource||e===_Q.Array)return n===EQ.EXISTS?null:t.jsx(iee,{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 _Q.ReachResource:case _Q.Array:case _Q.String:return t.length>0;case _Q.Number:return!isNaN(Number(t));case _Q.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case _Q.Boolean:return"true"===t||"false"===t;case _Q.Date:case _Q.DateTime:return!isNaN(new Date(t).getTime());default:throw eQ(n,_Q)}})({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===_Q.Date||e===_Q.DateTime){const e=n===EQ.EQUALS_MONTH_DAY||n===EQ.EQUALS_MONTH_DAY_YEAR,r=n===EQ.BETWEEN_MONTH_DAY||n===EQ.BETWEEN_MONTH_DAY_YEAR,i=e=>{Jie(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&&(!Jie(t)||!Jie(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&&Jie(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(Zie,{date:d,onSelect:l}),e&&f&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(tQ,{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(Lne,{value:m.direction,onValueChange:e=>{i({...m,direction:e})},children:[t.jsx(Mne,{className:"w-[180px] h-9","aria-label":"Relative direction",children:t.jsx(Dne,{placeholder:"Select direction..."})}),t.jsxs(Fne,{children:[t.jsx(Une,{value:"before",children:"days before today"}),t.jsx(Une,{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(tQ,{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:H9.DAYS,direction:v?.startDate?.direction||"before"};Jie(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),t.jsxs(Lne,{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:H9.DAYS,direction:e};Jie(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},children:[t.jsx(Mne,{className:"w-[180px] h-9",children:t.jsx(Dne,{placeholder:"Select direction..."})}),t.jsxs(Fne,{children:[t.jsx(Une,{value:"before",children:"days before today"}),t.jsx(Une,{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(Zie,{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(tQ,{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:H9.DAYS,direction:v?.endDate?.direction||"before"};Jie(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),t.jsxs(Lne,{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:H9.DAYS,direction:e};Jie(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},children:[t.jsx(Mne,{className:"w-[180px] h-9",children:t.jsx(Dne,{placeholder:"Select direction..."})}),t.jsxs(Fne,{children:[t.jsx(Une,{value:"before",children:"days before today"}),t.jsx(Une,{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(Zie,{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(Jne,{id:"between-relative-date-switch",checked:b,onCheckedChange:e=>{if(w(e),e){const e={type:"relative",value:0,unit:H9.DAYS,direction:"before"},t={type:"relative",value:0,unit:H9.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(z9,{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(Jne,{id:"relative-date-switch",checked:f,onCheckedChange:c,"aria-label":"Toggle relative date input"}),t.jsx(z9,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===_Q.Number||e===_Q.Integer)return n===EQ.EXISTS?null:t.jsx(tQ,{type:"number",value:r.length>0?String(r[0]):"",onChange:e=>o([Number(e.target.value)]),className:"w-[200px]"});if(e===_Q.Boolean){if(n===EQ.EXISTS)return null;const e=r.length>0&&Boolean(r[0]);return t.jsx(Jne,{checked:e,onCheckedChange:e=>o([e])})}return t.jsx(tQ,{value:r.length>0?String(r[0]):"",onChange:e=>o([e.target.value]),className:"w-[200px]",disabled:!0})},tae=({condition:e,onUpdate:n,onDuplicate:r,onDelete:o,segmentsConditions:i})=>{const{toast:a}=Ll(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:_Q.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:G9[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(K7,{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:q9[e]||e,fieldType:o.type}))),s=a[0]?.value;let l=[];switch(o.type){case _Q.Boolean:l=[!1];break;case _Q.Number:l=[0];break;case _Q.Date:case _Q.DateTime:l=[new Date];break;case _Q.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(K7,{options:l.map((e=>({value:e,label:q9[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(eae,{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(VX,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(xu,{className:"h-4 w-4"})}),t.jsx(VX,{size:"icon",variant:"ghost",onClick:o,children:t.jsx(Ku,{className:"h-4 w-4"})})]})]})},nae=({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(HX,{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(qu,{className:"w-full h-full"})})}),selected:"ai"===r}),t.jsx(HX,{onClick:()=>{o("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${df("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(Bu,{className:"w-full h-full"})})}),selected:"manual"===r})]})},rae=({segmentId:e,setOpen:n,setTextToSegment:r,promptBuilderStyle:o,textToSegment:i})=>t.jsx("div",{children:t.jsx(EB,{className:"",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(CB,{className:"text-3xl font-normal",children:e?`Edit ${df("engage:segment")}`:`Create ${df("engage:segment")}`}),t.jsxs("div",{className:"flex items-center gap-2",children:[!1===o&&!1===i&&t.jsx(V0,{children:t.jsxs(B0,{children:[t.jsx(z0,{asChild:!0,children:t.jsx(VX,{variant:"outline",size:"sm",onClick:()=>r(!0),children:t.jsx(qu,{className:"h-4 w-3"})})}),t.jsx(H0,{children:t.jsxs("p",{children:["Use AI to create ",df("engage:segment")," by describing them in natural language"]})})]})}),t.jsx(VX,{variant:"ghost",size:"icon",onClick:()=>{n(!1)},className:"h-8 w-8",children:t.jsx(td,{className:"h-4 w-4"})})]})]})})}),oae=({setTextToSegment:e,setSegment:r})=>{const[o,i]=n.useState(""),[a,s]=n.useState(!1),{toast:c}=Ll();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(VB,{children:[a&&t.jsx(UX,{children:t.jsx(FX,{})}),!a&&t.jsx(UX,{children:t.jsx(nQ,{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(VX,{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 Oe(`${l}/text-to-segment`,{method:"POST",body:JSON.stringify({text:e})})).data)(o);t.success&&t.conditions?(c({title:`${df("engage:segment")} conditions built successfully 🚀`,description:`Your ${df("engage:segment")} conditions have been built successfully`}),r(t.conditions)):c({title:`${df("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[t.jsx(qu,{className:"h-4 w-4"}),"Generate ",df("engage:segment")]})})]})]})};function iae({segmentId:e,setOpen:n,onSegmentUpdated:r}){const{toast:o}=Ll(),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}=wQ(e||""),{updateSegment:f}=xQ(e),{createSegment:h,isCreating:m,segmentsConditions:g}=yQ(),[v,y]=i.useState(!1),[b,w]=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 x=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(FX,{})});return t.jsx(t.Fragment,{children:t.jsxs(VB,{mode:"wait",children:[t.jsx(rae,{segmentId:e,setOpen:n,setTextToSegment:y,promptBuilderStyle:b,textToSegment:v},"segment-builder-header"),b?t.jsx(UX,{children:t.jsx(nae,{onSelectStyle:e=>{"ai"===e&&y(!0),w(!1)}})},"prompt-builder-style"):t.jsx(UX,{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(VB,{children:v?t.jsx(UX,{children:t.jsx(oae,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(UX,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(z9,{className:"text-muted-foreground text-xs",children:"Name"}),t.jsx(tQ,{placeholder:`${df("engage:segment")} name`,value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(z9,{className:"text-muted-foreground text-xs",children:"Description"}),t.jsx(tQ,{placeholder:`${df("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(VB,{mode:"popLayout",children:c.conditions.map(((e,n)=>t.jsxs(TX.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(TX.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[t.jsx(TX.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(TX.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),t.jsx(TX.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(tae,{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(VX,v?{variant:"secondary",onClick:()=>y(!1),children:[t.jsx(Bu,{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(Uu,{className:"h-4 w-4"}),"Add Condition"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(VX,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(VX,{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!==EQ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===EQ.EXISTS&&t.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${t.field}`};if(x(t)&&t.operator!==EQ.EQUALS_MONTH_DAY&&t.operator!==EQ.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(x(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!==EQ.BETWEEN_MONTH_DAY&&t.operator!==EQ.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===H9.DAYS)return e.value??0;throw LX(e.unit,H9)};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===_Q.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:`${df("engage:segment")} updated successfully`}),n(!1),r?.(e)},onError:()=>{o({title:`Error updating ${df("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}}):h({name:c.name,description:c.description,conditions:c.conditions},{onSuccess:e=>{o({title:`${df("engage:segment")} created successfully`}),r?.(e?.id??!1),n(!1)},onError:()=>{o({title:`Error creating ${df("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}})}catch(s){o({title:`Error saving ${df("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(Au,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})})}function aae({open:e,setOpen:n,segmentId:r,onSegmentUpdated:o}){return t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-4xl w-full",hideCloseButton:!0,children:[t.jsxs(e$,{children:[t.jsxs(CB,{children:[df("engage:segment")," Builder"]}),t.jsxs(AB,{children:["Build a ",df("engage:segment")," to target your audience"]})]}),t.jsx(iae,{segmentId:r,setOpen:n,onSegmentUpdated:e=>{o?.(e),n(!1)}})]})})}function sae(){const{toast:e}=Ll(),[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}=bQ({search:d||void 0,cursor:c,limit:s}),y=n.useCallback((e=>{a(e),o(!0)}),[a]),b=n.useMemo((()=>function(e){return[T9("name",`${df("engage:segment")} Name`,!0),C9(),x9({accessorKey:"user_count",header:df("engage:user_other"),meta:{align:"right",displayName:df("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const t=e.getValue()??0;return`${t.toLocaleString()} ${1===t?df("engage:user").toLowerCase():df("engage:user_other").toLowerCase()}`}}),A9("user_count_updated_at"),N9(e||(()=>{}))]}(y)),[y]),w=n.useMemo((()=>f?f.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[f]),x=n.useMemo((()=>t.jsxs(VX,{onClick:()=>{a(null),o(!0)},children:[t.jsx(Uu,{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(k6,{data:w,columns:b,paginationMode:"cursor",initialPageSize:s,headerActions:x,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(aae,{open:r,setOpen:o,segmentId:i??void 0,onSegmentUpdated:t=>{_9(o,e,t,`Error creating ${df("engage:segment")}`,"Please try again"),u(void 0),l(10),p("")}})]})}const lae=()=>{const e=[{id:"broadcasts",label:df("engage:one_time"),content:t.jsx(L9,{})},{id:"automations",label:df("engage:automation"),content:t.jsx(k9,{})},{id:"segments",label:df("engage:segment"),content:t.jsx(sae,{})},{id:"statistics",label:"Statistics",content:t.jsx(Y0,{})}],r=ce(),[o,i]=n.useState(!1),[a,s]=n.useState(e[0].id);return n.useEffect((()=>{r.prefetchQuery({queryKey:Ne.list()}),r.prefetchQuery({queryKey:vQ.lists()})}),[r]),t.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[t.jsx(c1,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(VX,{variant:"outline",onClick:()=>i(!0),children:t.jsx(zu,{className:"w-4 h-4"})})}),t.jsx("div",{className:"flex-1 w-full h-full flex flex-col gap-4",children:t.jsx(mQ,{activeTab:a,tabs:e,onTabChange:s})})]})},cae=e=>{const t=ve({queryKey:["communication-group",e],queryFn:()=>e?(async e=>(await Oe(`${d}/${e}`)).data)(e):null,enabled:!!e});return{communicationGroup:t.data,isGetting:t.isPending,getError:t.error,isGetSuccess:t.isSuccess}},uae=()=>{const e=ce(),t=ye({mutationFn:({groupId:e,params:t})=>(async(e,t)=>(await Oe(`${d}/${e}`,{method:"PATCH",body:JSON.stringify(t)})).data)(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:["communication-group"]})}});return{updateCommunicationGroup:t.mutate,isUpdating:t.isPending,updateError:t.error,isUpdateSuccess:t.isSuccess}},dae=()=>{const e=ye({mutationFn:({id:e,params:t})=>(async(e,t)=>(await Oe(`${d}/${e}/test`,{method:"POST",body:JSON.stringify(t)})).data)(e,t)});return{sendTestCommunication:e.mutate,isSending:e.isPending,sendError:e.error,isSendSuccess:e.isSuccess}},pae=e=>{const{data:t}=(e=>{const t=ce(),n=ve({queryKey:["segments","recipients","count"],queryFn:()=>gQ(e)});return{data:n.data,isFetching:n.isFetching,isLoading:n.isLoading,fetchError:n.error,refetchCount:()=>{t.invalidateQueries({queryKey:["segments","recipients","count"]})}}})({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}},fae=()=>{const e=n.useContext(fQ);if(void 0===e)throw new Error("useViewAutomationContext must be used within a ViewAutomationProvider");return e},hae=()=>{const{state:e}=fae();return e.automation},mae=()=>{const{state:e}=fae();return e.communicationGroup},gae=({automationId:e,children:n})=>t.jsx(hQ,{children:t.jsx(vae,{automationId:e,children:n})}),vae=({automationId:e,existingAutomation:r,children:o})=>((e=>{const{setAutomation:t}=n.useContext(fQ),{automation:r}=ke(e);n.useEffect((()=>{r&&t(r)}),[r,t])})(e),(e=>{const{isUpdating:t}=Me(e);n.useEffect((()=>{be.emit(t?lQ:cQ,null)}),[t])})(e),(()=>{const{setCommunicationGroup:e,state:t}=n.useContext(fQ),r=t.automation?.actionData?.find((e=>"send_communication"===e.actionType))?.actionMetadata.communicationGroupId,{communicationGroup:o}=cae(r);n.useEffect((()=>{o&&e(o)}),[o,e])})(),(()=>{const{isUpdating:e}=uae();n.useEffect((()=>{be.emit(e?uQ:dQ,null)}),[e])})(),(e=>{const{setRecipientStats:t}=fae(),{estimatedMatchesStats:r}=pae(e);n.useEffect((()=>{r&&t(r)}),[r,t])})(r),t.jsx(t.Fragment,{children:o}));var yae=e=>"checkbox"===e.type,bae=e=>e instanceof Date,wae=e=>null==e;const xae=e=>"object"==typeof e;var _ae=e=>!wae(e)&&!Array.isArray(e)&&xae(e)&&!bae(e),Sae=e=>_ae(e)&&e.target?yae(e.target)?e.target.checked:e.target.value:e,Eae=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Tae="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Cae(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(Tae&&(e instanceof Blob||r)||!n&&!_ae(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return _ae(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=Cae(e[n]));else t=e}return t}var Aae=e=>Array.isArray(e)?e.filter(Boolean):[],Rae=e=>void 0===e,Oae=(e,t,n)=>{if(!t||!_ae(e))return n;const r=Aae(t.split(/[,[\].]+?/)).reduce(((e,t)=>wae(e)?e:e[t]),e);return Rae(r)||r===e?Rae(e[t])?n:e[t]:r},Nae=e=>"boolean"==typeof e,Pae=e=>/^\w*$/.test(e),kae=e=>Aae(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Lae=(e,t,n)=>{let r=-1;const o=Pae(t)?[t]:kae(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=_ae(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const Dae="blur",Mae="focusout",jae="change",Iae="onBlur",Fae="onChange",Uae="onSubmit",$ae="onTouched",Vae="all",Bae="max",zae="min",Hae="maxLength",qae="minLength",Gae="pattern",Kae="required",Wae="validate",Yae=n.createContext(null),Xae=()=>n.useContext(Yae);var Qae=(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]!==Vae&&(t._proxyFormState[o]=!r||Vae),n&&(n[o]=!0),e[o]}});return o},Zae=e=>wae(e)||!xae(e);function Jae(e,t){if(Zae(e)||Zae(t))return e===t;if(bae(e)&&bae(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(bae(n)&&bae(e)||_ae(n)&&_ae(e)||Array.isArray(n)&&Array.isArray(e)?!Jae(n,e):n!==e)return!1}}return!0}const ese=(e,t)=>{const r=n.useRef(t);Jae(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var tse=e=>"string"==typeof e,nse=(e,t,n,r,o)=>tse(e)?(r&&t.watch.add(e),Oae(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),Oae(n,e)))):(r&&(t.watchAll=!0),n);function rse(e){const t=Xae(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=Eae(i._names.array,r),l=function(e){const t=Xae(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return ese((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c(nse(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:Oae(i._formValues,r,Oae(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=Xae(),{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 ese((()=>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((()=>Qae(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,...Nae(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Oae(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!Oae(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Oae(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Oae(c.validatingFields,r)},error:{enumerable:!0,get:()=>Oae(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:Sae(e),name:r},type:jae})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:Oae(i._formValues,r),name:r},type:Dae})),[r,i._formValues]),m=n.useCallback((e=>{const t=Oae(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,...Nae(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,...Nae(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=Oae(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=Cae(Oae(i._options.defaultValues,r));Lae(i._defaultValues,r,e),Rae(Oae(i._formValues,r))&&Lae(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 ose=e=>e.render(rse(e));var ise=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},ase=e=>Array.isArray(e)?e:[e],sse=()=>{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=[]}}},lse=e=>_ae(e)&&!Object.keys(e).length,cse=e=>"file"===e.type,use=e=>"function"==typeof e,dse=e=>{if(!Tae)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},pse=e=>"select-multiple"===e.type,fse=e=>"radio"===e.type,hse=e=>dse(e)&&e.isConnected;function mse(e,t){const n=Array.isArray(t)?t:Pae(t)?[t]:kae(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Rae(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(_ae(r)&&lse(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Rae(e[t]))return!1;return!0}(r))&&mse(e,n.slice(0,-1)),e}var gse=e=>{for(const t in e)if(use(e[t]))return!0;return!1};function vse(e,t={}){const n=Array.isArray(e);if(_ae(e)||n)for(const r in e)Array.isArray(e[r])||_ae(e[r])&&!gse(e[r])?(t[r]=Array.isArray(e[r])?[]:{},vse(e[r],t[r])):wae(e[r])||(t[r]=!0);return t}function yse(e,t,n){const r=Array.isArray(e);if(_ae(e)||r)for(const o in e)Array.isArray(e[o])||_ae(e[o])&&!gse(e[o])?Rae(t)||Zae(n[o])?n[o]=Array.isArray(e[o])?vse(e[o],[]):{...vse(e[o])}:yse(e[o],wae(t)?{}:t[o],n[o]):n[o]=!Jae(e[o],t[o]);return n}var bse=(e,t)=>yse(e,t,vse(t));const wse={value:!1,isValid:!1},xse={value:!0,isValid:!0};var _se=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&&!Rae(e[0].attributes.value)?Rae(e[0].value)||""===e[0].value?xse:{value:e[0].value,isValid:!0}:xse:wse}return wse},Sse=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Rae(e)?e:t?""===e?NaN:e?+e:e:n&&tse(e)?new Date(e):r?r(e):e;const Ese={isValid:!1,value:null};var Tse=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),Ese):Ese;function Cse(e){const t=e.ref;return cse(t)?t.files:fse(t)?Tse(e.refs).value:pse(t)?[...t.selectedOptions].map((({value:e})=>e)):yae(t)?_se(e.refs).value:Sse(Rae(t.value)?e.ref.value:t.value,e)}var Ase=e=>e instanceof RegExp,Rse=e=>Rae(e)?e:Ase(e)?e.source:_ae(e)?Ase(e.value)?e.value.source:e.value:e,Ose=e=>({isOnSubmit:!e||e===Uae,isOnBlur:e===Iae,isOnChange:e===Fae,isOnAll:e===Vae,isOnTouch:e===$ae});const Nse="AsyncFunction";var Pse=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const kse=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=Oae(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(kse(i,t))break}else if(_ae(i)&&kse(i,t))break}}};function Lse(e,t,n){const r=Oae(e,n);if(r||Pae(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=Oae(t,r),a=Oae(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 Dse=(e,t,n)=>{const r=ase(Oae(e,n));return Lae(r,"root",t[n]),Lae(e,n,r),e},Mse=e=>tse(e);function jse(e,t,n="validate"){if(Mse(e)||Array.isArray(e)&&e.every(Mse)||Nae(e)&&!e)return{type:n,message:Mse(e)?e:"",ref:t}}var Ise=e=>_ae(e)&&!Ase(e)?e:{value:e,message:""},Fse=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=Oae(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,w=e=>{o&&b.reportValidity&&(b.setCustomValidity(Nae(e)?"":e||""),b.reportValidity())},x={},_=fse(a),S=yae(a),E=_||S,T=(g||cse(a))&&Rae(a.value)&&Rae(y)||dse(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=ise.bind(null,m,r,x),A=(e,t,n,r=Hae,o=qae)=>{const i=e?t:n;x[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(i?!Array.isArray(y)||!y.length:l&&(!E&&(T||wae(y))||Nae(y)&&!y||S&&!_se(s).isValid||_&&!Tse(s).isValid)){const{value:e,message:t}=Mse(l)?{value:!!l,message:l}:Ise(l);if(e&&(x[m]={type:Kae,message:t,ref:b,...C(Kae,t)},!r))return w(t),x}if(!(T||wae(d)&&wae(p))){let e,t;const n=Ise(p),o=Ise(d);if(wae(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;tse(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),tse(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);wae(n.value)||(e=r>n.value),wae(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,Bae,zae),!r))return w(x[m].message),x}if((c||u)&&!T&&(tse(y)||i&&Array.isArray(y))){const e=Ise(c),t=Ise(u),n=!wae(e.value)&&y.length>+e.value,o=!wae(t.value)&&y.length<+t.value;if((n||o)&&(A(n,e.message,t.message),!r))return w(x[m].message),x}if(f&&!T&&tse(y)){const{value:e,message:t}=Ise(f);if(Ase(e)&&!y.match(e)&&(x[m]={type:Gae,message:t,ref:a,...C(Gae,t)},!r))return w(t),x}if(h)if(use(h)){const e=jse(await h(y,n),b);if(e&&(x[m]={...e,...C(Wae,e.message)},!r))return w(e.message),x}else if(_ae(h)){let e={};for(const t in h){if(!lse(e)&&!r)break;const o=jse(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},w(o.message),r&&(x[m]=e))}if(!lse(e)&&(x[m]={ref:b,...e},!r))return x}return w(!0),x};const Use={mode:Uae,reValidateMode:Fae,shouldFocusError:!0};function $se(e={}){let t={...Use,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:use(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=(_ae(t.defaultValues)||_ae(t.values))&&Cae(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:Cae(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:sse(),state:sse()},f=Ose(t.mode),h=Ose(t.reValidateMode),m=t.criteriaMode===Vae,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?lse((await x()).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?Lae(n.validatingFields,e,r):mse(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!lse(n.validatingFields)}))},y=(e,t,n,o)=>{const l=Oae(r,e);if(l){const r=Oae(a,e,Rae(n)?Oae(i,e):n);Rae(r)||o&&o.defaultChecked||t?Lae(a,e,t?r:Cse(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=Jae(Oae(i,e),r);c=!!Oae(n.dirtyFields,e),t?mse(n.dirtyFields,e):Lae(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=Oae(n.touchedFields,e);t||(Lae(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:{}},w=(e,r,i,a)=>{const s=Oae(n.errors,e),l=(u.isValid||d.isValid)&&Nae(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{Lae(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?Lae(n.errors,e,i):mse(n.errors,e)),(i?!Jae(s,i):s)||!lse(a)||l){const t={...a,...l&&Nae(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},x=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=Oae(t,i);e&&Lae(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&&!!(use(i.validate)&&i.validate.constructor.name===Nse||_ae(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===Nse))));p&&u.validatingFields&&v([s],!0);const f=await Fse(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(Oae(f,e.name)?d?Dse(n.errors,f,e.name):Lae(n.errors,e.name,f[e.name]):mse(n.errors,e.name))}!lse(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&Lae(a,e,n),!Jae(P(),i)),E=(e,t,n)=>nse(e,l,{...s.mount?a:Rae(t)?i:tse(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=Oae(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&Lae(a,e,Sse(t,n)),i=dse(n.ref)&&wae(t)?"":t,pse(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?yae(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)):cse(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:Cae(a)})))}(n.shouldDirty||n.shouldTouch)&&b(e,i,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&N(e)},C=(e,t,n)=>{for(const o in t){const i=t[o],a=`${e}.${o}`,s=Oae(r,a);(l.array.has(e)||_ae(i)||s&&!s._f)&&!bae(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=Oae(r,e),f=l.array.has(e),h=Cae(t);Lae(a,e,h),f?(p.array.next({name:e,values:Cae(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:bse(i,a),isDirty:S(e,h)})):!c||c._f||wae(h)?T(e,h,o):C(e,h,o),Pse(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:Cae(a)})},R=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=Oae(r,c),E=e=>{y=Number.isNaN(e)||bae(e)&&isNaN(e.getTime())||Jae(e,Oae(a,c,e))};if(S){let s,C;const A=i.type?Cse(S._f):Sae(e),R=e.type===Dae||e.type===Mae,O=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||Oae(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))(R,Oae(n.touchedFields,c),n.isSubmitted,h,f),P=Pse(c,l,R);Lae(a,c,A),R?(S._f.onBlur&&S._f.onBlur(e),o&&o(0)):S._f.onChange&&S._f.onChange(e);const k=b(c,A,R),L=!lse(k)||P;if(!R&&p.state.next({name:c,type:e.type,values:Cae(a)}),O)return(u.isValid||d.isValid)&&("onBlur"===t.mode?R&&g():R||g()),L&&p.state.next({name:c,...P?{}:k});if(!R&&P&&p.state.next({...n}),t.resolver){const{errors:e}=await x([c]);if(E(A),y){const t=Lse(n.errors,r,c),o=Lse(e,r,t.name||c);s=o.error,c=o.name,C=lse(e)}}else v([c],!0),s=(await Fse(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&&N(S._f.deps),w(c,C,s,k))}var T},O=(e,t)=>{if(Oae(n.errors,t)&&e.focus)return e.focus(),1},N=async(e,o={})=>{let i,a;const s=ase(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(e)for(const r of e){const e=Oae(t,r);e?Lae(n.errors,r,e):mse(n.errors,r)}else n.errors=t;return t})(Rae(e)?e:s);i=lse(t),a=e?!s.some((e=>Oae(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=Oae(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!tse(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&kse(r,O,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return Rae(e)?t:tse(e)?Oae(t,e):e.map((e=>Oae(t,e)))},k=(e,t)=>({invalid:!!Oae((t||n).errors,e),isDirty:!!Oae((t||n).dirtyFields,e),error:Oae((t||n).errors,e),isValidating:!!Oae(n.validatingFields,e),isTouched:!!Oae((t||n).touchedFields,e)}),L=(e,t,o)=>{const i=(Oae(r,e,{_f:{}})._f||{}).ref,a=Oae(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;Lae(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()},D=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!ase(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 lse(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||Vae)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,M=(e,o={})=>{for(const s of e?ase(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(mse(r,s),mse(a,s)),!o.keepError&&mse(n.errors,s),!o.keepDirty&&mse(n.dirtyFields,s),!o.keepTouched&&mse(n.touchedFields,s),!o.keepIsValidating&&mse(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&mse(i,s);p.state.next({values:Cae(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},j=({disabled:e,name:t})=>{(Nae(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=Oae(r,e);const a=Nae(n.disabled)||Nae(t.disabled);return Lae(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?j({disabled:Nae(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:Rse(n.min),max:Rse(n.max),minLength:Rse(n.minLength),maxLength:Rse(n.maxLength),pattern:Rse(n.pattern)}:{},name:e,onChange:R,onBlur:R,ref:a=>{if(a){I(e,n),o=Oae(r,e);const t=Rae(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>fse(e)||yae(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;Lae(r,e,{_f:{...o._f,...s?{refs:[...l.filter(hse),t,...Array.isArray(Oae(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=Oae(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!Eae(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&kse(r,O,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=Cae(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await x();n.errors=e,c=t}else await _(r);if(l.disabled.size)for(const e of l.disabled)Lae(c,e,void 0);if(mse(n.errors,"root"),lse(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:lse(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?Cae(e):i,d=Cae(c),f=lse(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(bse(i,a))]);for(const t of Array.from(e))Oae(n.dirtyFields,t)?Lae(h,t,Oae(a,t)):A(t,Oae(h,t))}else{if(Tae&&Rae(e))for(const e of l.mount){const t=Oae(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(dse(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,Oae(h,e))}a=Cae(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||Jae(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?bse(i,a):n.dirtyFields:o.keepDefaultValues&&e?bse(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)=>$(use(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:M,getFieldState:k,handleSubmit:U,setError:L,_subscribe:D,_runSchema:x,_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(Oae(r,e))){const t=l(Oae(r,e),c.argA,c.argB);f&&Lae(r,e,t)}if(h&&Array.isArray(Oae(n.errors,e))){const t=l(Oae(n.errors,e),c.argA,c.argB);f&&Lae(n.errors,e,t),((e,t)=>{!Aae(Oae(e,t)).length&&mse(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(Oae(n.touchedFields,e))){const t=l(Oae(n.touchedFields,e),c.argA,c.argB);f&&Lae(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=bse(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Lae(a,e,o)},_setDisabledField:j,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Aae(Oae(s.mount?a:i,e,t.shouldUnregister?Oae(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>use(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=Oae(r,e);t&&(t._f.refs?t._f.refs.every((e=>!hse(e))):!hse(t._f.ref))&&M(e)}l.unMount=new Set},_disableForm:e=>{Nae(e)&&(p.state.next({disabled:e}),kse(r,((t,n)=>{const o=Oae(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},D({...e,formState:d})),trigger:N,register:I,handleSubmit:U,watch:(e,t)=>use(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={})=>{Oae(r,e)&&(Rae(t.defaultValue)?A(e,Cae(Oae(i,e))):(A(e,t.defaultValue),Lae(i,e,Cae(t.defaultValue))),t.keepTouched||mse(n.touchedFields,e),t.keepDirty||(mse(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Cae(Oae(i,e))):S()),t.keepError||(mse(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&ase(e).forEach((e=>mse(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:M,setError:L,setFocus:(e,t={})=>{const n=Oae(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&use(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const Vse="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Bse(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:use(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:use(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:$se(e),formState:o},e.formControl&&e.defaultValues&&!use(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Vse((()=>{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&&!lse(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&&!Jae(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=Qae(o,a),t.current}const zse=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Oae(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Hse=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?zse(r.ref,n,e):r.refs&&r.refs.forEach((t=>zse(t,n,e)))}},qse=(e,t)=>{t.shouldUseNativeValidation&&Hse(e,t);const n={};for(const r in e){const o=Oae(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Gse(t.names||Object.keys(e),r)){const e=Object.assign({},Oae(n,r));Lae(e,"root",i),Lae(n,r,e)}else Lae(n,r,i)}return n},Gse=(e,t)=>e.some((e=>e.startsWith(t+".")));var Kse,Wse,Yse,Xse=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]=ise(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},Qse=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&&Hse({},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:qse(Xse(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};(Wse=Kse||(Kse={})).assertEqual=e=>e,Wse.assertIs=function(e){},Wse.assertNever=function(e){throw new Error},Wse.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Wse.getValidEnumValues=e=>{const t=Wse.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return Wse.objectValues(n)},Wse.objectValues=e=>Wse.objectKeys(e).map((function(t){return e[t]})),Wse.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},Wse.find=(e,t)=>{for(const n of e)if(t(n))return n},Wse.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,Wse.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},Wse.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Yse||(Yse={})).mergeShapes=(e,t)=>({...e,...t});const Zse=Kse.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jse=e=>{switch(typeof e){case"undefined":return Zse.undefined;case"string":return Zse.string;case"number":return isNaN(e)?Zse.nan:Zse.number;case"boolean":return Zse.boolean;case"function":return Zse.function;case"bigint":return Zse.bigint;case"symbol":return Zse.symbol;case"object":return Array.isArray(e)?Zse.array:null===e?Zse.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Zse.promise:"undefined"!=typeof Map&&e instanceof Map?Zse.map:"undefined"!=typeof Set&&e instanceof Set?Zse.set:"undefined"!=typeof Date&&e instanceof Date?Zse.date:Zse.object;default:return Zse.unknown}},ele=Kse.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 tle 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 tle))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Kse.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()}}tle.create=e=>new tle(e);const nle=(e,t)=>{let n;switch(e.code){case ele.invalid_type:n=e.received===Zse.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ele.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Kse.jsonStringifyReplacer)}`;break;case ele.unrecognized_keys:n=`Unrecognized key(s) in object: ${Kse.joinValues(e.keys,", ")}`;break;case ele.invalid_union:n="Invalid input";break;case ele.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Kse.joinValues(e.options)}`;break;case ele.invalid_enum_value:n=`Invalid enum value. Expected ${Kse.joinValues(e.options)}, received '${e.received}'`;break;case ele.invalid_arguments:n="Invalid function arguments";break;case ele.invalid_return_type:n="Invalid function return type";break;case ele.invalid_date:n="Invalid date";break;case ele.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}"`:Kse.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ele.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 ele.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 ele.custom:n="Invalid input";break;case ele.invalid_intersection_types:n="Intersection results could not be merged";break;case ele.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ele.not_finite:n="Number must be finite";break;default:n=t.defaultError,Kse.assertNever(e)}return{message:n}};let rle=nle;function ole(){return rle}const ile=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 ale(e,t){const n=ole(),r=ile({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===nle?void 0:nle].filter((e=>!!e))});e.common.issues.push(r)}class sle{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 lle;"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 sle.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 lle;if("aborted"===o.status)return lle;"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 lle=Object.freeze({status:"aborted"}),cle=e=>({status:"dirty",value:e}),ule=e=>({status:"valid",value:e}),dle=e=>"aborted"===e.status,ple=e=>"dirty"===e.status,fle=e=>"valid"===e.status,hle=e=>"undefined"!=typeof Promise&&e instanceof Promise;function mle(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 gle(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 vle,yle,ble,wle;"function"==typeof SuppressedError&&SuppressedError,(yle=vle||(vle={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},yle.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class xle{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 _le=(e,t)=>{if(fle(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 tle(e.common.issues);return this._error=t,this._error}}};function Sle(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 Ele{get description(){return this._def.description}_getType(e){return Jse(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Jse(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sle,ctx:{common:e.parent.common,data:e.data,parsedType:Jse(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(hle(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:Jse(e)},o=this._parseSync({data:e,path:r.path,parent:r});return _le(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:Jse(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return fle(t)?{value:t.value}:{issues:r.common.issues}}catch(O_e){(null===(n=null===(t=null==O_e?void 0:O_e.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=>fle(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:Jse(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(hle(r)?r:Promise.resolve(r));return _le(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:ele.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 xce({schema:this,typeName:Nce.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 _ce.create(this,this._def)}nullable(){return Sce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ace.create(this)}promise(){return wce.create(this,this._def)}or(e){return cce.create([this,e],this._def)}and(e){return dce.create(this,e,this._def)}transform(e){return new xce({...Sle(this._def),schema:this,typeName:Nce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ece({...Sle(this._def),innerType:this,defaultValue:t,typeName:Nce.ZodDefault})}brand(){return new Ace({typeName:Nce.ZodBranded,type:this,...Sle(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Tce({...Sle(this._def),innerType:this,catchValue:t,typeName:Nce.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Rce.create(this,e)}readonly(){return Oce.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Tle=/^c[^\s-]{8,}$/i,Cle=/^[0-9a-z]+$/,Ale=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rle=/^[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,Ole=/^[a-z0-9_-]{21}$/i,Nle=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ple=/^[-+]?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)?)??$/,kle=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Lle;const Dle=/^(?:(?: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])$/,Mle=/^(?:(?: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])$/,jle=/^(([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]))$/,Ile=/^(([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])$/,Fle=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ule=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$le="((\\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])))",Vle=new RegExp(`^${$le}$`);function Ble(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 zle(e){return new RegExp(`^${Ble(e)}$`)}function Hle(e){let t=`${$le}T${Ble(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 qle(e,t){if(!Nle.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(N_e){return!1}}function Gle(e,t){return!("v4"!==t&&t||!Mle.test(e))||!("v6"!==t&&t||!Ile.test(e))}class Kle extends Ele{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Zse.string){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.string,received:t.parsedType}),lle}const t=new sle;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.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),ale(n,{code:ele.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?ale(n,{code:ele.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&ale(n,{code:ele.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)kle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"email",code:ele.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Lle||(Lle=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Lle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"emoji",code:ele.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)Rle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"uuid",code:ele.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)Ole.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"nanoid",code:ele.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)Tle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"cuid",code:ele.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)Cle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"cuid2",code:ele.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)Ale.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"ulid",code:ele.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(N_e){n=this._getOrReturnCtx(e,n),ale(n,{validation:"url",code:ele.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),ale(n,{validation:"regex",code:ele.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),ale(n,{code:ele.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),ale(n,{code:ele.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),ale(n,{code:ele.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){Hle(i).test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Vle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){zle(i).test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?Ple.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"duration",code:ele.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!Dle.test(r))&&("v6"!==o&&o||!jle.test(r))&&(n=this._getOrReturnCtx(e,n),ale(n,{validation:"ip",code:ele.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?qle(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"jwt",code:ele.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Gle(e.data,i.version)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"cidr",code:ele.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?Fle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"base64",code:ele.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Ule.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"base64url",code:ele.invalid_string,message:i.message}),t.dirty()):Kse.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:ele.invalid_string,...vle.errToObj(n)})}_addCheck(e){return new Kle({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...vle.errToObj(e)})}url(e){return this._addCheck({kind:"url",...vle.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...vle.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...vle.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...vle.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...vle.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...vle.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...vle.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...vle.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...vle.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...vle.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...vle.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...vle.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,...vle.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,...vle.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...vle.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...vle.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...vle.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...vle.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...vle.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...vle.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...vle.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...vle.errToObj(t)})}nonempty(e){return this.min(1,vle.errToObj(e))}trim(){return new Kle({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Kle({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Kle({...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 Wle(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)}Kle.create=e=>{var t;return new Kle({checks:[],typeName:Nce.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Sle(e)})};class Yle extends Ele{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)!==Zse.number){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.number,received:t.parsedType}),lle}let t;const n=new sle;for(const r of this._def.checks)if("int"===r.kind)Kse.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ale(t,{code:ele.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),ale(t,{code:ele.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),ale(t,{code:ele.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==Wle(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),ale(t,{code:ele.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ale(t,{code:ele.not_finite,message:r.message}),n.dirty()):Kse.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,vle.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vle.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vle.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vle.toString(t))}setLimit(e,t,n,r){return new Yle({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:vle.toString(r)}]})}_addCheck(e){return new Yle({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:vle.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:vle.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:vle.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:vle.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:vle.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vle.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:vle.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:vle.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:vle.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&&Kse.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)}}Yle.create=e=>new Yle({checks:[],typeName:Nce.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Sle(e)});class Xle extends Ele{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(N_e){return this._getInvalidInput(e)}if(this._getType(e)!==Zse.bigint)return this._getInvalidInput(e);let t;const n=new sle;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),ale(t,{code:ele.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),ale(t,{code:ele.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),ale(t,{code:ele.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Kse.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.bigint,received:t.parsedType}),lle}gte(e,t){return this.setLimit("min",e,!0,vle.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vle.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vle.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vle.toString(t))}setLimit(e,t,n,r){return new Xle({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:vle.toString(r)}]})}_addCheck(e){return new Xle({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:vle.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:vle.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:vle.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:vle.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vle.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}}Xle.create=e=>{var t;return new Xle({checks:[],typeName:Nce.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Sle(e)})};class Qle extends Ele{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Zse.boolean){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.boolean,received:t.parsedType}),lle}return ule(e.data)}}Qle.create=e=>new Qle({typeName:Nce.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Sle(e)});class Zle extends Ele{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Zse.date){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.date,received:t.parsedType}),lle}if(isNaN(e.data.getTime())){return ale(this._getOrReturnCtx(e),{code:ele.invalid_date}),lle}const t=new sle;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.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),ale(n,{code:ele.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Kse.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Zle({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:vle.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:vle.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}}Zle.create=e=>new Zle({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Nce.ZodDate,...Sle(e)});class Jle extends Ele{_parse(e){if(this._getType(e)!==Zse.symbol){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.symbol,received:t.parsedType}),lle}return ule(e.data)}}Jle.create=e=>new Jle({typeName:Nce.ZodSymbol,...Sle(e)});class ece extends Ele{_parse(e){if(this._getType(e)!==Zse.undefined){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.undefined,received:t.parsedType}),lle}return ule(e.data)}}ece.create=e=>new ece({typeName:Nce.ZodUndefined,...Sle(e)});class tce extends Ele{_parse(e){if(this._getType(e)!==Zse.null){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.null,received:t.parsedType}),lle}return ule(e.data)}}tce.create=e=>new tce({typeName:Nce.ZodNull,...Sle(e)});class nce extends Ele{constructor(){super(...arguments),this._any=!0}_parse(e){return ule(e.data)}}nce.create=e=>new nce({typeName:Nce.ZodAny,...Sle(e)});class rce extends Ele{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ule(e.data)}}rce.create=e=>new rce({typeName:Nce.ZodUnknown,...Sle(e)});class oce extends Ele{_parse(e){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.never,received:t.parsedType}),lle}}oce.create=e=>new oce({typeName:Nce.ZodNever,...Sle(e)});class ice extends Ele{_parse(e){if(this._getType(e)!==Zse.undefined){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.void,received:t.parsedType}),lle}return ule(e.data)}}ice.create=e=>new ice({typeName:Nce.ZodVoid,...Sle(e)});class ace extends Ele{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Zse.array)return ale(t,{code:ele.invalid_type,expected:Zse.array,received:t.parsedType}),lle;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(ale(t,{code:e?ele.too_big:ele.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&&(ale(t,{code:ele.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&&(ale(t,{code:ele.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 xle(t,e,t.path,n))))).then((e=>sle.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new xle(t,e,t.path,n))));return sle.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new ace({...this._def,minLength:{value:e,message:vle.toString(t)}})}max(e,t){return new ace({...this._def,maxLength:{value:e,message:vle.toString(t)}})}length(e,t){return new ace({...this._def,exactLength:{value:e,message:vle.toString(t)}})}nonempty(e){return this.min(1,e)}}function sce(e){if(e instanceof lce){const t={};for(const n in e.shape){t[n]=_ce.create(sce(e.shape[n]))}return new lce({...e._def,shape:()=>t})}return e instanceof ace?new ace({...e._def,type:sce(e.element)}):e instanceof _ce?_ce.create(sce(e.unwrap())):e instanceof Sce?Sce.create(sce(e.unwrap())):e instanceof pce?pce.create(e.items.map((e=>sce(e)))):e}ace.create=(e,t)=>new ace({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Nce.ZodArray,...Sle(t)});class lce extends Ele{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=Kse.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Zse.object){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.object,received:t.parsedType}),lle}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof oce&&"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 xle(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof oce){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&&(ale(n,{code:ele.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 xle(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=>sle.mergeObjectSync(t,e))):sle.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new lce({...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=vle.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new lce({...this._def,unknownKeys:"strip"})}passthrough(){return new lce({...this._def,unknownKeys:"passthrough"})}extend(e){return new lce({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new lce({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Nce.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new lce({...this._def,catchall:e})}pick(e){const t={};return Kse.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new lce({...this._def,shape:()=>t})}omit(e){const t={};return Kse.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new lce({...this._def,shape:()=>t})}deepPartial(){return sce(this)}partial(e){const t={};return Kse.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new lce({...this._def,shape:()=>t})}required(e){const t={};return Kse.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof _ce;)e=e._def.innerType;t[n]=e}})),new lce({...this._def,shape:()=>t})}keyof(){return vce(Kse.objectKeys(this.shape))}}lce.create=(e,t)=>new lce({shape:()=>e,unknownKeys:"strip",catchall:oce.create(),typeName:Nce.ZodObject,...Sle(t)}),lce.strictCreate=(e,t)=>new lce({shape:()=>e,unknownKeys:"strict",catchall:oce.create(),typeName:Nce.ZodObject,...Sle(t)}),lce.lazycreate=(e,t)=>new lce({shape:e,unknownKeys:"strip",catchall:oce.create(),typeName:Nce.ZodObject,...Sle(t)});class cce extends Ele{_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 tle(e.ctx.common.issues)));return ale(t,{code:ele.invalid_union,unionErrors:n}),lle}));{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 tle(e)));return ale(t,{code:ele.invalid_union,unionErrors:o}),lle}}get options(){return this._def.options}}cce.create=(e,t)=>new cce({options:e,typeName:Nce.ZodUnion,...Sle(t)});function uce(e,t){const n=Jse(e),r=Jse(t);if(e===t)return{valid:!0,data:e};if(n===Zse.object&&r===Zse.object){const n=Kse.objectKeys(t),r=Kse.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=uce(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===Zse.array&&r===Zse.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=uce(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===Zse.date&&r===Zse.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class dce extends Ele{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(dle(e)||dle(r))return lle;const o=uce(e.value,r.value);return o.valid?((ple(e)||ple(r))&&t.dirty(),{status:t.value,value:o.data}):(ale(n,{code:ele.invalid_intersection_types}),lle)};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}))}}dce.create=(e,t,n)=>new dce({left:e,right:t,typeName:Nce.ZodIntersection,...Sle(n)});class pce extends Ele{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Zse.array)return ale(n,{code:ele.invalid_type,expected:Zse.array,received:n.parsedType}),lle;if(n.data.length<this._def.items.length)return ale(n,{code:ele.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),lle;!this._def.rest&&n.data.length>this._def.items.length&&(ale(n,{code:ele.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 xle(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>sle.mergeArray(t,e))):sle.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new pce({...this._def,rest:e})}}pce.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pce({items:e,typeName:Nce.ZodTuple,rest:null,...Sle(t)})};class fce extends Ele{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!==Zse.map)return ale(n,{code:ele.invalid_type,expected:Zse.map,received:n.parsedType}),lle;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new xle(n,e,n.path,[i,"key"])),value:o._parse(new xle(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 lle;"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 lle;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}fce.create=(e,t,n)=>new fce({valueType:t,keyType:e,typeName:Nce.ZodMap,...Sle(n)});class hce extends Ele{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Zse.set)return ale(n,{code:ele.invalid_type,expected:Zse.set,received:n.parsedType}),lle;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(ale(n,{code:ele.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&&(ale(n,{code:ele.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 lle;"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 xle(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new hce({...this._def,minSize:{value:e,message:vle.toString(t)}})}max(e,t){return new hce({...this._def,maxSize:{value:e,message:vle.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}hce.create=(e,t)=>new hce({valueType:e,minSize:null,maxSize:null,typeName:Nce.ZodSet,...Sle(t)});class mce extends Ele{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})}}mce.create=(e,t)=>new mce({getter:e,typeName:Nce.ZodLazy,...Sle(t)});class gce extends Ele{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ale(t,{received:t.data,code:ele.invalid_literal,expected:this._def.value}),lle}return{status:"valid",value:e.data}}get value(){return this._def.value}}function vce(e,t){return new yce({values:e,typeName:Nce.ZodEnum,...Sle(t)})}gce.create=(e,t)=>new gce({value:e,typeName:Nce.ZodLiteral,...Sle(t)});class yce extends Ele{constructor(){super(...arguments),ble.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return ale(t,{expected:Kse.joinValues(this._def.values),received:t.parsedType,code:ele.invalid_type}),lle}if(mle(this,ble)||gle(this,ble,new Set(this._def.values)),!mle(this,ble).has(e.data)){const t=this._getOrReturnCtx(e);return ale(t,{received:t.data,code:ele.invalid_enum_value,options:this._def.values}),lle}return ule(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 yce.create(e,{...this._def,...t})}exclude(e,t=this._def){return yce.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}ble=new WeakMap,yce.create=vce;class bce extends Ele{constructor(){super(...arguments),wle.set(this,void 0)}_parse(e){const t=Kse.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Zse.string&&n.parsedType!==Zse.number){const e=Kse.objectValues(t);return ale(n,{expected:Kse.joinValues(e),received:n.parsedType,code:ele.invalid_type}),lle}if(mle(this,wle)||gle(this,wle,new Set(Kse.getValidEnumValues(this._def.values))),!mle(this,wle).has(e.data)){const e=Kse.objectValues(t);return ale(n,{received:n.data,code:ele.invalid_enum_value,options:e}),lle}return ule(e.data)}get enum(){return this._def.values}}wle=new WeakMap,bce.create=(e,t)=>new bce({values:e,typeName:Nce.ZodNativeEnum,...Sle(t)});class wce extends Ele{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Zse.promise&&!1===t.common.async)return ale(t,{code:ele.invalid_type,expected:Zse.promise,received:t.parsedType}),lle;const n=t.parsedType===Zse.promise?t.data:Promise.resolve(t.data);return ule(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}wce.create=(e,t)=>new wce({type:e,typeName:Nce.ZodPromise,...Sle(t)});class xce extends Ele{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Nce.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=>{ale(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 lle;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?lle:"dirty"===r.status||"dirty"===t.value?cle(r.value):r}));{if("aborted"===t.value)return lle;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?lle:"dirty"===r.status||"dirty"===t.value?cle(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?lle:("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?lle:("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(!fle(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=>fle(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}Kse.assertNever(r)}}xce.create=(e,t,n)=>new xce({schema:e,typeName:Nce.ZodEffects,effect:t,...Sle(n)}),xce.createWithPreprocess=(e,t,n)=>new xce({schema:t,effect:{type:"preprocess",transform:e},typeName:Nce.ZodEffects,...Sle(n)});class _ce extends Ele{_parse(e){return this._getType(e)===Zse.undefined?ule(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_ce.create=(e,t)=>new _ce({innerType:e,typeName:Nce.ZodOptional,...Sle(t)});class Sce extends Ele{_parse(e){return this._getType(e)===Zse.null?ule(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sce.create=(e,t)=>new Sce({innerType:e,typeName:Nce.ZodNullable,...Sle(t)});class Ece extends Ele{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Zse.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ece.create=(e,t)=>new Ece({innerType:e,typeName:Nce.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Sle(t)});class Tce extends Ele{_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 hle(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new tle(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new tle(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Tce.create=(e,t)=>new Tce({innerType:e,typeName:Nce.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Sle(t)});class Cce extends Ele{_parse(e){if(this._getType(e)!==Zse.nan){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.nan,received:t.parsedType}),lle}return{status:"valid",value:e.data}}}Cce.create=e=>new Cce({typeName:Nce.ZodNaN,...Sle(e)});class Ace extends Ele{_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 Rce extends Ele{_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?lle:"dirty"===e.status?(t.dirty(),cle(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?lle:"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 Rce({in:e,out:t,typeName:Nce.ZodPipeline})}}class Oce extends Ele{_parse(e){const t=this._def.innerType._parse(e),n=e=>(fle(e)&&(e.value=Object.freeze(e.value)),e);return hle(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}var Nce,Pce;Oce.create=(e,t)=>new Oce({innerType:e,typeName:Nce.ZodReadonly,...Sle(t)}),(Pce=Nce||(Nce={})).ZodString="ZodString",Pce.ZodNumber="ZodNumber",Pce.ZodNaN="ZodNaN",Pce.ZodBigInt="ZodBigInt",Pce.ZodBoolean="ZodBoolean",Pce.ZodDate="ZodDate",Pce.ZodSymbol="ZodSymbol",Pce.ZodUndefined="ZodUndefined",Pce.ZodNull="ZodNull",Pce.ZodAny="ZodAny",Pce.ZodUnknown="ZodUnknown",Pce.ZodNever="ZodNever",Pce.ZodVoid="ZodVoid",Pce.ZodArray="ZodArray",Pce.ZodObject="ZodObject",Pce.ZodUnion="ZodUnion",Pce.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Pce.ZodIntersection="ZodIntersection",Pce.ZodTuple="ZodTuple",Pce.ZodRecord="ZodRecord",Pce.ZodMap="ZodMap",Pce.ZodSet="ZodSet",Pce.ZodFunction="ZodFunction",Pce.ZodLazy="ZodLazy",Pce.ZodLiteral="ZodLiteral",Pce.ZodEnum="ZodEnum",Pce.ZodEffects="ZodEffects",Pce.ZodNativeEnum="ZodNativeEnum",Pce.ZodOptional="ZodOptional",Pce.ZodNullable="ZodNullable",Pce.ZodDefault="ZodDefault",Pce.ZodCatch="ZodCatch",Pce.ZodPromise="ZodPromise",Pce.ZodBranded="ZodBranded",Pce.ZodPipeline="ZodPipeline",Pce.ZodReadonly="ZodReadonly";const kce=Kle.create,Lce=lce.create,Dce=e=>{const{children:t,...r}=e;return n.createElement(Yae.Provider,{value:r},t)},Mce=i.createContext({}),jce=({...e})=>t.jsx(Mce.Provider,{value:{name:e.name},children:t.jsx(ose,{...e})}),Ice=()=>{const e=i.useContext(Mce),t=i.useContext(Fce),{getFieldState:n,formState:r}=Xae(),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}},Fce=i.createContext({}),Uce=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(Fce.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:Yd("space-y-2",e),...n})})}));Uce.displayName="FormItem";const $ce=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=Ice();return t.jsx(z9,{ref:r,className:Yd(o&&"text-destructive",e),htmlFor:i,...n})}));$ce.displayName="FormLabel";const Vce=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=Ice();return t.jsx(YU,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));Vce.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=Ice();return t.jsx("p",{ref:r,id:o,className:Yd("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const Bce=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=Ice(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:Yd("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));Bce.displayName="FormMessage";const zce=Lce({name:kce().min(2,"Title must be at least 2 characters"),description:kce()});function Hce({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=hae(),{toast:i}=Ll(),a=Bse({resolver:Qse(zce),defaultValues:{name:`${o?.name} (copy)`,description:o?.description??""}});return t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"sm:max-w-[425px]",children:[t.jsx(EB,{children:t.jsx(CB,{children:"Duplicate Automation"})}),t.jsx(Dce,{...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 Oe(`${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(jce,{control:a.control,name:"name",disabled:!0,render:({field:e})=>t.jsxs(Uce,{children:[t.jsx($ce,{children:"Title"}),t.jsx(Vce,{children:t.jsx(tQ,{...e})}),t.jsx(Bce,{})]})}),t.jsx(jce,{control:a.control,name:"description",disabled:!0,render:({field:e})=>t.jsxs(Uce,{children:[t.jsx($ce,{children:"Description"}),t.jsx(Vce,{children:t.jsx(nQ,{...e})}),t.jsx(Bce,{})]})}),t.jsx(TB,{children:t.jsx(VX,{type:"submit",children:"Duplicate"})})]})})]})})}const qce=Lce({name:kce().min(2,"Title must be at least 2 characters"),description:kce()});function Gce({open:e,onOpenChange:n}){const r=hae(),{updateAutomation:o}=Me(r?.id||""),i=Bse({resolver:Qse(qce),defaultValues:{name:r?.name??"",description:r?.description??""}});return r?t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"sm:max-w-[425px]",children:[t.jsxs(EB,{children:[t.jsx(CB,{children:"Edit Automation"}),t.jsx(AB,{children:"Update the title and description of your automation."})]}),t.jsx(Dce,{...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(jce,{control:i.control,name:"name",render:({field:e})=>t.jsxs(Uce,{children:[t.jsx($ce,{children:"Title"}),t.jsx(Vce,{children:t.jsx(tQ,{...e})}),t.jsx(Bce,{})]})}),t.jsx(jce,{control:i.control,name:"description",render:({field:e})=>t.jsxs(Uce,{children:[t.jsx($ce,{children:"Description"}),t.jsx(Vce,{children:t.jsx(nQ,{...e})}),t.jsx(Bce,{})]})}),t.jsx(TB,{children:t.jsx(VX,{type:"submit",children:"Save changes"})})]})})]})}):null}function Kce({open:e,onOpenChange:n,setIsActive:r}){const o=hae(),{updateAutomation:i}=Me(o?.id||""),{toast:a}=Ll();return t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"sm:max-w-[425px]",children:[t.jsx(EB,{children:t.jsxs(CB,{children:["Deactivate ",df("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}),df("engage:automation"),"?"]}),t.jsxs(TB,{className:"gap-2 sm:gap-0",children:[t.jsx(VX,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(VX,{variant:"destructive",onClick:()=>{i({status:$e.DRAFT}),n(!1),r(!1),a({title:`Updated ${df("engage:automation")}`,description:`${df("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const Wce=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=hae(),a=s2(),{updateAutomation:s}=Me(i?.id||""),{toast:l}=Ll(),c=(()=>{const{state:e}=fae();return e.recipientStats})(),u=mae(),[d,p]=n.useState(void 0),[f,h]=n.useState(!1),[m,g]=n.useState(!1),[v,y]=n.useState(!1);n.useEffect((()=>{if(i&&void 0===d)switch(i.status){case $e.ACTIVE:p(!0);break;case $e.DRAFT:p(!1);break;case $e.RUNNING:case $e.COMPLETED:p(!0);break;case $e.FAILED:case $e.DEACTIVATED:p(!1);break;default:throw eQ(i.status,$e)}}),[i,d]);const b=n.useCallback((()=>{if(!i)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});if(!i)return null;let e=!1;switch(i.status){case $e.ACTIVE:case $e.DRAFT:e=!1;break;case $e.DEACTIVATED:case $e.RUNNING:case $e.COMPLETED:case $e.FAILED:e=!0;break;default:throw eQ(i.status,$e)}return t.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[t.jsx(d?du:bu,{className:"w-4 h-4"}),t.jsx("div",{className:"text-[13px] font-medium",children:d?"Active":"Inactive"}),t.jsx(Jne,{checked:d,onCheckedChange:async e=>{if(d&&!e)y(!0);else{if(o&&!0===e){let e=0;for(;!c&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!c)return void l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"});const t=await o({estimatedEmailRecipients:c?.emails??0,estimatedSmsRecipients:c?.phones??0});if(!0!==t)return void l({title:"Error while updating the status",description:t,variant:"destructive"})}switch(i.triggerType){case Fe.ONE_TIME:if(!i.triggerMetadata||!("scheduledAt"in i.triggerMetadata)||!i.triggerMetadata?.scheduledAt)return void l({title:"Ensure you have selected a scheduled time",variant:"destructive"});if(!u||!u.emailChannelSenderId&&!u.smsChannelSenderId)return void l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"});break;case Fe.TRIGGER_BASED:break;default:throw eQ(i.triggerType,Fe)}s({status:e?$e.ACTIVE:$e.DEACTIVATED},{onSuccess:()=>{p(e),l({title:`${df("engage:automation")} 🚀`,description:`${df("engage:automation")} status updated to ${e?"active":"inactive"} 🚀`})},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"})}})}},disabled:e})]})}),[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(VX,{variant:"ghost",size:"icon",onClick:()=>a(-1),children:t.jsx(su,{})}),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(VX,{variant:"ghost",size:"icon",onClick:()=>h(!0),children:t.jsx(qX.EditIcon,{})}),t.jsx(VX,{variant:"ghost",size:"icon",onClick:()=>g(!0),children:t.jsx(qX.DuplicateIcon,{})})]})}),b()]}),t.jsx(Gce,{open:f,onOpenChange:h}),t.jsx(Hce,{open:m,onOpenChange:g,onDuplicationCreated:r}),t.jsx(Kce,{open:v,onOpenChange:y,setIsActive:p})]}):null},Yce=()=>{const e=hae(),{isLoading:n}=je(e?.id);return!e||n?t.jsx(FX,{text:[`Fetching ${df("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(Y0,{automationId:e.id,automation:e,includeSales:!0})})},Xce=()=>{const e=hae(),{recipients:n,isLoading:r,fetchError:o}=Le(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(k6,{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(qX.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 ",df("engage:automation")," currently has no assigned recipients. Please update the include or exclude"," ",df("engage:segment",{count:2})," to add recipients."]})]}):t.jsx(FX,{text:["Fetching Recipients","Finishing up"]})},Qce=n.createContext(null);Qce.displayName="PanelGroupContext";const Zce="data-panel-group",Jce="data-panel-group-direction",eue="data-panel-group-id",tue="data-panel",nue="data-panel-collapsible",rue="data-panel-id",oue="data-panel-size",iue="data-resize-handle",aue="data-resize-handle-active",sue="data-panel-resize-handle-enabled",lue="data-panel-resize-handle-id",cue="data-resize-handle-state",uue=n.useLayoutEffect,due=i["useId".toString()],pue="function"==typeof due?due:()=>null;let fue=0;function hue(e=null){const t=pue(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+fue++),null!=e?e:r.current}function mue({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(Qce);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:b,getPanelSize:w,getPanelStyle:x,groupId:_,isPanelCollapsed:S,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:C,unregisterPanel:A}=v,R=hue(s),O=n.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:r,collapsible:o,defaultSize:i,maxSize:l,minSize:c},id:R,idIsFromProps:void 0!==s,order:f});n.useRef({didLogMissingDefaultSizeWarning:!1}),uue((()=>{const{callbacks:e,constraints:t}=O.current,n={...t};O.current.id=R,O.current.idIsFromProps=void 0!==s,O.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(O.current,n)})),uue((()=>{const e=O.current;return T(e),()=>{A(e)}}),[f,R,T,A]),n.useImperativeHandle(a,(()=>({collapse:()=>{y(O.current)},expand:e=>{b(O.current,e)},getId:()=>R,getSize:()=>w(O.current),isCollapsed:()=>S(O.current),isExpanded:()=>!S(O.current),resize:e=>{C(O.current,e)}})),[y,b,w,S,R,C]);const N=x(O.current,i);return n.createElement(m,{...g,children:e,className:t,id:R,style:{...N,...h},[eue]:_,[tue]:"",[nue]:o||void 0,[rue]:R,[oue]:parseFloat(""+N.flexGrow).toFixed(1)})}const gue=n.forwardRef(((e,t)=>n.createElement(mue,{...e,forwardedRef:t})));mue.displayName="Panel",gue.displayName="forwardRef(Panel)";let vue=null,yue=-1,bue=null;function wue(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&Lue),n=!!(t&Due);if(t&Pue)return e?"se-resize":n?"ne-resize":"e-resize";if(t&kue)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(vue!==o){var i;if(vue=o,null===bue&&(bue=document.createElement("style"),document.head.appendChild(bue)),yue>=0)null===(i=bue.sheet)||void 0===i||i.removeRule(yue);yue=null!==(n=null===(r=bue.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function xue(e){return"keydown"===e.type}function _ue(e){return e.type.startsWith("pointer")}function Sue(e){return e.type.startsWith("mouse")}function Eue(e){if(_ue(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Sue(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const Tue=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Cue(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=Nue(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||(!!Tue.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function Aue(e){let t=e.length;for(;t--;){const n=e[t];if(Que(n,"Missing node"),Cue(n))return n}return null}function Rue(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Oue(e){const t=[];for(;e;)t.push(e),e=Nue(e);return t}function Nue(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Pue=1,kue=2,Lue=4,Due=8,Mue="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let jue=[],Iue=!1,Fue=new Map,Uue=new Map;const $ue=new Set;function Vue(e){const{target:t}=e,{x:n,y:r}=Eue(e);Iue=!0,que({target:t,x:n,y:r}),Yue(),jue.length>0&&(Xue("down",e),e.preventDefault(),Hue(t)||e.stopImmediatePropagation())}function Bue(e){const{x:t,y:n}=Eue(e);if(Iue&&0===e.buttons&&(Iue=!1,Xue("up",e)),!Iue){const{target:r}=e;que({target:r,x:t,y:n})}Xue("move",e),Kue(),jue.length>0&&e.preventDefault()}function zue(e){const{target:t}=e,{x:n,y:r}=Eue(e);Uue.clear(),Iue=!1,jue.length>0&&(e.preventDefault(),Hue(t)||e.stopImmediatePropagation()),Xue("up",e),que({target:t,x:n,y:r}),Kue(),Yue()}function Hue(e){let t=e;for(;t;){if(t.hasAttribute(iue))return!0;t=t.parentElement}return!1}function que({target:e,x:t,y:n}){jue.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),$ue.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=Mue?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:Oue(e),b:Oue(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Que(r,"Stacking order can only be calculated for elements with a common ancestor");const o=Rue(Aue(n.a)),i=Rue(Aue(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}jue.push(e)}var p,f}))}function Gue(e,t){Uue.set(e,t)}function Kue(){let e=!1,t=!1;jue.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;Uue.forEach((e=>{n|=e})),e&&t?wue("intersection",n):e?wue("horizontal",n):t?wue("vertical",n):null!==bue&&(document.head.removeChild(bue),vue=null,bue=null,yue=-1)}let Wue=new AbortController;function Yue(){Wue.abort(),Wue=new AbortController;const e={capture:!0,signal:Wue.signal};$ue.size&&(Iue?(jue.length>0&&Fue.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",zue,e),r.addEventListener("pointerleave",Bue,e),r.addEventListener("pointermove",Bue,e))})),Fue.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",zue,e),r.addEventListener("pointercancel",zue,e)}))):Fue.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",Vue,e),r.addEventListener("pointermove",Bue,e))})))}function Xue(e,t){$ue.forEach((n=>{const{setResizeHandlerState:r}=n,o=jue.includes(n);r(e,o,t)}))}function Que(e,t){if(!e)throw Error(t)}function Zue(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Jue(e,t,n=10){return 0===Zue(e,t,n)}function ede(e,t,n){return 0===Zue(e,t,n)}function tde({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Que(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(Zue(n,s)<0)if(i){n=Zue(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function nde({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(ede(e,0))return t;const a=[...t],[s,l]=r;Que(null!=s,"Invalid first pivot index"),Que(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];Que(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(Que(null!=n,`Previous layout not found for panel index ${r}`),ede(n,i)){const t=c-n;Zue(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];Que(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(Que(null!=n,`Previous layout not found for panel index ${r}`),ede(n,c)){const t=n-i;Zue(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];Que(null!=e,`Previous layout not found for panel index ${o}`);if(i+=tde({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];Que(null!=i,`Previous layout not found for panel index ${r}`);const s=tde({panelConstraints:n,panelIndex:r,size:i-o});if(!ede(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(!ede(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];Que(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=tde({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!ede(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];Que(null!=o,`Previous layout not found for panel index ${r}`);const i=tde({panelConstraints:n,panelIndex:r,size:o+t});if(ede(o,i)||(t-=i-o,a[r]=i),ede(t,0))break;e>0?r--:r++}}}return ede(a.reduce(((e,t)=>t+e),0),100)?a:o}function rde({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];Que(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 ode(e,t=document){return Array.from(t.querySelectorAll(`[${lue}][data-panel-group-id="${e}"]`))}function ide(e,t,n=document){const r=ode(e,n).findIndex((e=>e.getAttribute(lue)===t));return null!=r?r:null}function ade(e,t,n){const r=ide(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function sde(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 lde(e,t=document){const n=t.querySelector(`[${lue}="${e}"]`);return n||null}function cde({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),uue((()=>{if(!a)return;const e=ode(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=rde({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];Que(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;Que(e,"Eager values not found");const{panelDataArray:n}=e;Que(null!=sde(r,a),`No group found for id "${r}"`);const i=ode(r,a);Que(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(lue);Que(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=lde(t,r),c=ode(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];Que(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=nde({delta:ede(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:ade(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 ude(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 dde(e,t){const n="horizontal"===e,{x:r,y:o}=Eue(t);return n?r:o}function pde(e,t,n,r,o,i){if(xue(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=lde(t,o);Que(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(eue);Que(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=dde(n,e),u=sde(s,o);Que(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 fde(e,t,n){t.forEach(((t,r)=>{const o=e[r];Que(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&&!Jue(u,l)||Jue(t,l)||r(),!e||null!=u&&Jue(u,l)||!Jue(t,l)||e())}}))}function hde(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 mde(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 gde(e){return`react-resizable-panels:${e}`}function vde(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 yde(e,t){try{const n=gde(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 bde(e,t,n,r,o){var i;const a=gde(e),s=vde(t),l=null!==(i=yde(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 wde({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(!ede(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];Que(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];Que(null!=e,`No layout data found for index ${i}`);const r=tde({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!ede(o,0))for(let i=0;i<t.length;i++){const e=n[i];Que(null!=e,`No layout data found for index ${i}`);const r=tde({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,ede(o,0)))break}return n}const xde={getItem:e=>(mde(xde),xde.getItem(e)),setItem:(e,t)=>{mde(xde),xde.setItem(e,t)}},_de={};function Sde({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=xde,style:u,tagName:d="div",...p}){const f=hue(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))),[])}(),w=n.useRef({}),x=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=wde({layout:e,panelConstraints:r.map((e=>e.constraints))});ude(n,o)||(y(o),E.current.layout=o,t&&t(o),fde(r,o,w.current))}})),[]),uue((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),cde({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=_de[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(bde,100),_de[e]=n);const r=[...t],o=new Map(x.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}=Cde(r,e,n);if(Que(null!=a,`Panel size not found for panel "${e.id}"`),!Jue(a,i)){x.current.set(e.id,a);const l=nde({delta:Tde(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});hde(n,l)||(y(l),E.current.layout=l,t&&t(l),fde(r,l,w.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}=Cde(o,e,r),u=null!=t?t:l;if(Jue(s,a)){const t=x.current.get(e.id),a=null!=t&&t>=u?t:u,l=nde({delta:Tde(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});hde(r,l)||(y(l),E.current.layout=l,n&&n(l),fde(o,l,w.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=Cde(n,e,t);return Que(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),R=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=Tde(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]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=Cde(n,e,t);return Que(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&Jue(i,r)}),[]),N=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=Cde(n,e,t);return Que(null!=i,`Panel size not found for panel "${e.id}"`),!o||Zue(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]);uue((()=>{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=yde(e,n))&&void 0!==r?r:{})[vde(t)])&&void 0!==o?o:null}(e,o,n);t&&(x.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];Que(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];Que(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=wde({layout:i,panelConstraints:o.map((e=>e.constraints))});ude(r,a)||(y(a),E.current.layout=a,t&&t(a),fde(o,a,w.current))}})),uue((()=>{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=ade(a,e,r);let f=pde(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=nde({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:xue(n)?"keyboard":"mouse-or-touch"}),v=!hde(c,g);(_ue(n)||Sue(n))&&_.current!=f&&(_.current=f,Gue(e,v||0===f?0:m?f<0?Pue:kue:f<0?Lue:Due)),v&&(y(g),E.current.layout=g,l&&l(g),fde(u,g,w.current))}}),[]),L=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}=Cde(o,e,r);Que(null!=a,`Panel size not found for panel "${e.id}"`);const l=nde({delta:Tde(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});hde(r,l)||(y(l),E.current.layout=l,n&&n(l),fde(o,l,w.current))}),[]),D=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}=Cde(r,e,n);null!=u&&(i&&s&&Jue(u,o)?Jue(o,a)||L(e,a):u<c?L(e,c):u>l&&L(e,l))}),[L]),M=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=lde(e,h.current);Que(o,`Drag handle element not found for id "${e}"`);const i=dde(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),j=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=Tde(t,e);n>=0&&(t.splice(n,1),delete w.current[e.id],E.current.panelDataArrayChanged=!0,b())}),[b]),F=n.useMemo((()=>({collapsePanel:T,direction:o,dragState:m,expandPanel:C,getPanelSize:A,getPanelStyle:R,groupId:f,isPanelCollapsed:O,isPanelExpanded:N,reevaluatePanelConstraints:D,registerPanel:P,registerResizeHandle:k,resizePanel:L,startDragging:M,stopDragging:j,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,R,f,O,N,D,P,k,L,M,j,I]);return n.createElement(Qce.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},[Zce]:"",[Jce]:o,[eue]:f}))}const Ede=n.forwardRef(((e,t)=>n.createElement(Sde,{...e,forwardedRef:t})));function Tde(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function Cde(e,t,n){const r=Tde(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function Ade({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 w=n.useContext(Qce);if(null===w)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:x,groupId:_,registerResizeHandle:S,startDragging:E,stopDragging:T,panelGroupElement:C}=w,A=hue(i),[R,O]=n.useState("inactive"),[N,P]=n.useState(!1),[k,L]=n.useState(null),D=n.useRef({state:R});uue((()=>{D.current.state=R})),n.useEffect((()=>{if(r)L(null);else{const e=S(A);L((()=>e))}}),[r,A,S]);const M=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,j=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;Que(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=Fue.get(a))&&void 0!==i?i:0;return Fue.set(a,l+1),$ue.add(s),Yue(),function(){var t;Uue.delete(e),$ue.delete(s);const n=null!==(t=Fue.get(a))&&void 0!==t?t:1;if(Fue.set(a,n-1),Yue(),1===n&&Fue.delete(a),jue.includes(s)){const e=jue.indexOf(s);e>=0&&jue.splice(e,1),Kue(),o("up",!0,null)}}}(A,e,x,{coarse:M,fine:j},((e,n,r)=>{if(n)switch(e){case"down":{O("drag"),t=!1,Que(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}=D.current;t=!0,"drag"!==e&&O("hover"),Que(r,'Expected event to be defined for "move" action'),k(r);break}case"up":{O("hover"),T();const{onClick:e,onDragging:n,onPointerUp:r}=b.current;null==n||n(!1),null==r||r(),t||null==e||e();break}}else O("inactive")}))}),[M,x,r,j,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=lde(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(eue);Que(r,`No group element found for id "${r}"`);const i=ode(r,o),a=ide(r,t,o);Que(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,[Jce]:x,[eue]:_,[iue]:"",[aue]:"drag"===R?"pointer":N?"keyboard":void 0,[sue]:!r,[lue]:A,[cue]:R})}Sde.displayName="PanelGroup",Ede.displayName="forwardRef(PanelGroup)",Ade.displayName="PanelResizeHandle";const Rde=({className:e,...n})=>t.jsx(Ede,{className:bB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),Ode=gue,Nde=({withHandle:e,className:n,...r})=>t.jsx(Ade,{className:bB("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(Su,{className:"h-2.5 w-2.5"})})});var Pde=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(Pde||{});const kde=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium",children:e}),Lde="rgba(245, 246, 247, 1)",Dde={[Ue.SEND_COMMUNICATION]:{color:{bg:"rgba(205, 241, 225, 1)",text:"rgba(30, 108, 74, 1)",bgUnselected:Lde},clickable:!0},[Ue.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:Lde},clickable:!1}},Mde={[Ue.SEND_COMMUNICATION]:"Send Email & SMS",[Ue.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},jde=({children:e,onClick:n,iconBgColor:r,iconStrokeColor:o,Icon:i,disabled:a=!1,selected:s=!1})=>{const l=i;return t.jsx(TX.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:Lde},className:Yd("flex gap-2 items-center rounded-md transition-colors group","border-2 border-transparent overflow-hidden",!a&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:t.jsxs(VX,{variant:"ghost",className:"text-left w-full h-full flex items-center gap-2 min-h-none whitespace-normal rounded-none px-2 group/trigger-audience",onClick:n,children:[t.jsx("div",{className:Yd("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:Yd("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})})},Ide=({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}),Fde=()=>{const e=hae(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(fQ),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=bQ(),u=n.useCallback((()=>c?.find((e=>e.type===SQ.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(jde,{selected:o===Pde.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(Pde.EditAudience)},Icon:qX.AudienceIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(OQ,{children:"Audience"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(kde,{copyText:`Send to all ${df("engage:user",{count:2})} in ${1===i.length?"this":"these"} ${df("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(Ide,{segmentName:n.name},e):null}))})]})]})})}):null},Ude=()=>{const e=hae(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(fQ),{segments:i}=bQ(),a=`Start this ${df("engage:automation").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||"USER_JOINED_SEGMENT"!==e.triggerMetadata.eventName||!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(jde,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:qX.TriggerIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(OQ,{children:a}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(kde,{copyText:`When ${df("engage:user").toLowerCase()} joins the`}),t.jsx(Ide,{segmentName:r})]})]})}):null}case Fe.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(jde,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(Pde.EditTime)},selected:o===Pde.EditTime,Icon:qX.TriggerIcon,children:[t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(OQ,{children:a}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(kde,n?{copyText:`Click to set the date and time for this ${df("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(Ide,{segmentName:y9(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),t.jsx("div",{className:"",children:n&&t.jsx(IQ,{className:"group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors"})})]})}default:throw eQ(e.triggerType,Fe)}})()})},$de=e=>{switch(e){case Ue.SEND_COMMUNICATION:return"Send Communication";case Ue.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw LX(e,Ue)}},Vde=e=>{switch(e){case Ue.SEND_COMMUNICATION:return t.jsx(qX.CommunicationIcon,{className:"w-4 h-4"});case Ue.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(qX.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw eQ(e,Ue)}},Bde=e=>{if(!(e&&e.actionType===Ue.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}`},zde=({actionData:e})=>{const{state:{selectedActionId:r},setActionId:o}=n.useContext(fQ),i=n.useMemo((()=>r===e.actionMetadata.currentActionId),[r,e.actionMetadata.currentActionId]),a=Dde[e.actionType],s=a.color,l=a.clickable;return t.jsx(TX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:Yd("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",i&&"border-primary",e.actionType!==Ue.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:i?s.bg:s.bgUnselected??Lde},onClick:()=>{l&&o(e.actionMetadata.currentActionId)},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:Vde(e.actionType)}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{style:{color:i?s.text:s.textUnselected},children:t.jsx(OQ,{children:Mde[e.actionType]})}),t.jsx("div",e.actionType===Ue.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:Bde(e.actionMetadata)}:{className:"text-xs font-medium",children:$de(e.actionType)})]})]})})},Hde=()=>{const[e,r]=n.useState(!1),o=hae(),{setActionId:i,state:{selectedActionId:a}}=n.useContext(fQ);if(n.useEffect((()=>{if(!o)return;if(a)return;const e=o.actionData?.find((e=>"send_communication"===e.actionType));e&&i(e.actionMetadata.currentActionId)}),[o,i,a]),!o)return null;const s=(e=>{const{steps:t,rootActionId:n}=e;if(!t||!n)return t??[];const r=new Map(t.map((e=>[e.actionMetadata.currentActionId,e]))),o=r.get(n);if(!o)return t;const i=[];let a=o;for(;a;){i.push(a);const e=a.actionMetadata.nextActionId;if(!e)break;a=r.get(e)}return i})({steps:o.actionData?.filter((t=>!!e||"send_communication"===t.actionType)),rootActionId:o.triggerMetadata?.triggerType===Fe.TRIGGER_BASED?o.triggerMetadata.rootActionId:void 0});let l=()=>t.jsx(t.Fragment,{});(e||o.triggerType===Fe.ONE_TIME)&&(l=()=>t.jsxs(t.Fragment,{children:[t.jsx(Ude,{}),o.triggerType===Fe.ONE_TIME&&t.jsx(Fde,{})]}));return t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[o.description?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",style:{containerType:"inline-size"},children:o.description}):null,o.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(Jne,{defaultChecked:e,onCheckedChange:()=>{r(!e)}})]})]}),t.jsx("div",{className:"flex-1 flex flex-col gap-3",children:t.jsxs(VB,{mode:"popLayout",children:[l(),s.map(((e,n)=>t.jsx(TX.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(zde,{actionData:e})},e.actionMetadata?.currentActionId??n)))]})})]})},qde=()=>{const e=hae(),{segments:n}=bQ();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(Hde,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(FX,{text:[`Getting details on your ${df("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})};function Gde(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Kde(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},Wde(o,...n)]}function Wde(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function Yde(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Xde(...e){return t=>{let n=!1;const r=e.map((e=>{const r=Yde(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():Yde(e[t],null)}}}}function Qde(...e){return i.useCallback(Xde(...e),e)}function Zde(e){const n=Jde(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(tpe);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function Jde(e){const t=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?Xde(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}var epe=Symbol("radix.slottable");function tpe(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===epe}var npe=globalThis?.document?i.useLayoutEffect:()=>{},rpe=i[" useId ".trim().toString()]||(()=>{}),ope=0;function ipe(e){const[t,n]=i.useState(rpe());return npe((()=>{n((e=>e??String(ope++)))}),[e]),e||(t?`radix-${t}`:"")}var ape=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=Zde(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{});var spe=i[" useInsertionEffect ".trim().toString()]||npe;function lpe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return spe((()=>{a.current=t}),[t]),i.useEffect((()=>{o.current!==n&&(a.current?.(n),o.current=n)}),[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=i.useRef(void 0!==e);i.useEffect((()=>{const e=t.current;if(e!==l){}t.current=l}),[l,r])}const u=i.useCallback((t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)}),[l,e,a,s]);return[c,u]}var cpe=i.createContext(void 0);function upe(e){const t=i.useContext(cpe);return e||t||"ltr"}var dpe="rovingFocusGroup.onEntryFocus",ppe={bubbles:!1,cancelable:!0},fpe="RovingFocusGroup",[hpe,mpe,gpe]=function(e){const r=e+"CollectionProvider",[o,i]=Kde(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=Zde(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=Qde(n,s(c,r).collectionRef);return t.jsx(u,{ref:i,children:o})}));d.displayName=c;const p=e+"CollectionItemSlot",f="data-radix-collection-item",h=Zde(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=Qde(r,l),u=s(p,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(h,{[f]:"",ref:c,children:i})}));return m.displayName=p,[{Provider:l,Slot:d,ItemSlot:m},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(fpe),[vpe,ype]=Kde(fpe,[gpe]),[bpe,wpe]=vpe(fpe),xpe=i.forwardRef(((e,n)=>t.jsx(hpe.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(hpe.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(_pe,{...e,ref:n})})})));xpe.displayName=fpe;var _pe=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:a=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...f}=e,h=i.useRef(null),m=Qde(n,h),g=upe(s),[v,y]=lpe({prop:l,defaultProp:c??null,onChange:u,caller:fpe}),[b,w]=i.useState(!1),x=function(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}(d),_=mpe(r),S=i.useRef(!1),[E,T]=i.useState(0);return i.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(dpe,x),()=>e.removeEventListener(dpe,x)}),[x]),t.jsx(bpe,{scope:r,orientation:o,dir:g,loop:a,currentTabStopId:v,onItemFocus:i.useCallback((e=>y(e)),[y]),onItemShiftTab:i.useCallback((()=>w(!0)),[]),onFocusableItemAdd:i.useCallback((()=>T((e=>e+1))),[]),onFocusableItemRemove:i.useCallback((()=>T((e=>e-1))),[]),children:t.jsx(ape.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:Gde(e.onMouseDown,(()=>{S.current=!0})),onFocus:Gde(e.onFocus,(e=>{if(e.target===e.currentTarget&&!S.current&&!b){const t=new CustomEvent(dpe,ppe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter((e=>e.focusable));Cpe([e.find((e=>e.active)),e.find((e=>e.id===v)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}S.current=!1})),onBlur:Gde(e.onBlur,(()=>w(!1)))})})})),Spe="RovingFocusGroupItem",Epe=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:a=!1,tabStopId:s,children:l,...c}=e,u=ipe(),d=s||u,p=wpe(Spe,r),f=p.currentTabStopId===d,h=mpe(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=p;return i.useEffect((()=>{if(o)return m(),()=>g()}),[o,m,g]),t.jsx(hpe.ItemSlot,{scope:r,id:d,focusable:o,active:a,children:t.jsx(ape.span,{tabIndex:f?0:-1,"data-orientation":p.orientation,...c,ref:n,onMouseDown:Gde(e.onMouseDown,(e=>{o?p.onItemFocus(d):e.preventDefault()})),onFocus:Gde(e.onFocus,(()=>p.onItemFocus(d))),onKeyDown:Gde(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void p.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:Tpe[r]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=h().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const i=o.indexOf(e.currentTarget);o=p.loop?(r=i+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(i+1)}setTimeout((()=>Cpe(o)))}var n,r})),children:"function"==typeof l?l({isCurrentTabStop:f,hasTabStop:null!=v}):l})})}));Epe.displayName=Spe;var Tpe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Cpe(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var Ape=xpe,Rpe=Epe;var Ope=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return i.useReducer(((e,n)=>t[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect((()=>{const e=Npe(r.current);a.current="mounted"===l?e:"none"}),[l]),npe((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=Npe(t);if(e)c("MOUNT");else if("none"===i||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,c]),npe((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=Npe(r.current).includes(i.animationName);if(i.target===t&&a&&(c("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)}))}},s=e=>{e.target===t&&(a.current=Npe(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:i.useCallback((e=>{r.current=e?getComputedStyle(e):null,n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):i.Children.only(n),a=Qde(r.ref,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}(o));return"function"==typeof n||r.isPresent?i.cloneElement(o,{ref:a}):null};function Npe(e){return e?.animationName||"none"}Ope.displayName="Presence";var Ppe="Tabs",[kpe,Lpe]=Kde(Ppe,[ype]),Dpe=ype(),[Mpe,jpe]=kpe(Ppe),Ipe=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=upe(l),[p,f]=lpe({prop:o,onChange:i,defaultProp:a??"",caller:Ppe});return t.jsx(Mpe,{scope:r,baseId:ipe(),value:p,onValueChange:f,orientation:s,dir:d,activationMode:c,children:t.jsx(ape.div,{dir:d,"data-orientation":s,...u,ref:n})})}));Ipe.displayName=Ppe;var Fpe="TabsList",Upe=i.forwardRef(((e,n)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,a=jpe(Fpe,r),s=Dpe(r);return t.jsx(Ape,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:o,children:t.jsx(ape.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:n})})}));Upe.displayName=Fpe;var $pe="TabsTrigger",Vpe=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...a}=e,s=jpe($pe,r),l=Dpe(r),c=Hpe(s.baseId,o),u=qpe(s.baseId,o),d=o===s.value;return t.jsx(Rpe,{asChild:!0,...l,focusable:!i,active:d,children:t.jsx(ape.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...a,ref:n,onMouseDown:Gde(e.onMouseDown,(e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(o)})),onKeyDown:Gde(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(o)})),onFocus:Gde(e.onFocus,(()=>{d||i||!("manual"!==s.activationMode)||s.onValueChange(o)}))})})}));Vpe.displayName=$pe;var Bpe="TabsContent",zpe=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,forceMount:a,children:s,...l}=e,c=jpe(Bpe,r),u=Hpe(c.baseId,o),d=qpe(c.baseId,o),p=o===c.value,f=i.useRef(p);return i.useEffect((()=>{const e=requestAnimationFrame((()=>f.current=!1));return()=>cancelAnimationFrame(e)}),[]),t.jsx(Ope,{present:a||p,children:({present:r})=>t.jsx(ape.div,{"data-state":p?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!r,id:d,tabIndex:0,...l,ref:n,style:{...e.style,animationDuration:f.current?"0s":void 0},children:r&&s})})}));function Hpe(e,t){return`${e}-trigger-${t}`}function qpe(e,t){return`${e}-content-${t}`}zpe.displayName=Bpe;var Gpe=Upe,Kpe=Vpe,Wpe=zpe;const Ype=Ipe,Xpe=i.forwardRef((({className:e,...n},r)=>t.jsx(Gpe,{ref:r,className:Yd("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...n})));Xpe.displayName=Gpe.displayName;const Qpe=i.forwardRef((({className:e,...n},r)=>t.jsx(Kpe,{ref:r,className:Yd("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...n})));Qpe.displayName=Kpe.displayName;const Zpe=i.forwardRef((({className:e,...n},r)=>t.jsx(Wpe,{ref:r,className:Yd("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n})));Zpe.displayName=Wpe.displayName;const Jpe=({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 hover:shadow-lg transition-all duration-300 ease-in-out "+(a?"scale-[1.02] hover:scale-[1.04] [border-color:hsl(var(--reach-primary))] shadow-lg":""),children:[t.jsxs("div",{className:"flex flex-col gap-1 items-start",children:[t.jsx("div",{className:"flex items-baseline gap-2",children:i?t.jsx("span",{className:"animate-pulse",children:"..."}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-3xl font-semibold text-foreground pl-2",children:e.toLocaleString()}),void 0!==r&&t.jsxs("div",{className:"text-muted-foreground/50 text-sm",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"})]}),efe=({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(OQ,{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(Jpe,{value:r.total,label:"Total",variant:"default",isLoading:void 0===e,selected:!0}),t.jsx(Jpe,{value:r.emails,label:"Email",percentage:o(r.emails),variant:"blue",isLoading:void 0===e}),t.jsx(Jpe,{value:r.phones,label:"Phone",percentage:o(r.phones),variant:"green",isLoading:void 0===e})]})]})},tfe=({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,nfe=({title:e,children:n,headerActions:r})=>t.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1 flex flex-col gap-4 pt-4",children:[t.jsxs("div",{className:"px-4 flex",children:[t.jsx(RQ,{children:e}),r&&t.jsx("div",{className:"ml-auto",children:r})]}),n]}),rfe=({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(OQ,{children:"Filter"}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[t.jsx(HX,{onClick:()=>a("all"),title:`All ${df("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(qX.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(HX,{onClick:()=>a("segments"),title:`Select ${df("engage:user",{count:2})}`,subtitle:`Choose from ${df("engage:segment",{count:2})}`,icon:t.jsx(qX.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===o})]})]})},ofe=({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(iee,{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(G7,{onSelect:()=>{e(!1),a(!0)},className:"cursor-pointer",children:[t.jsx(qX.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},ife=({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(ofe,{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(VX,{onClick:()=>u(!c),className:"flex items-center gap-1 transition-colors",size:"sm",children:[t.jsx(TX.div,{animate:{rotate:c?180:0},transition:{duration:.2},children:t.jsx(qX.DropdownMenuTrigger,{className:"w-5 h-5"})}),t.jsx("span",{children:"Don't send to"})]}),t.jsx(VB,{children:c&&t.jsx(TX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:t.jsx(ofe,{segments:r,allSegments:s||[],onAddSegment:e=>o(e,"exclude"),onRemoveSegment:e=>i(e,"exclude"),setOpenCreateSegmentDialog:a})})})]})]})},afe=()=>{const e=hae(),[r,o]=n.useState("all"),[i,a]=n.useState(e?.includeSegmentIds||[]),[s,l]=n.useState(e?.excludeSegmentIds||[]),[c,u]=n.useState(!1),[d,p]=n.useState(!1),{segments:f,isLoading:h}=bQ(),{updateAutomation:m}=Me(e?.id??""),[g,v]=n.useState(void 0),y=1===i.length&&0===s.length&&void 0!==f?.find((e=>e.type===SQ.ALL_USERS&&e.id===i[0]));n.useEffect((()=>{e&&!d&&(o(y?"all":"segments"),gQ({includeSegments:i,excludeSegments:s}).then((e=>{v(e)})),p(!0))}),[e,y,d,i,s]);return n.useEffect((()=>{e&&d&&(JSON.stringify(i)===JSON.stringify(e.includeSegmentIds)&&JSON.stringify(s)===JSON.stringify(e.excludeSegmentIds)||(m({includeSegments:i,excludeSegments:s}),gQ({includeSegments:i,excludeSegments:s}).then((e=>{v(e)}))))}),[i,s,e,d,m]),t.jsxs(nfe,{title:"Preview Audience",children:[!h&&f&&d?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(efe,{countResponse:g}),t.jsx(rfe,{onSelectionChange:e=>{if(o(e),"all"===e){const e=f?.find((e=>e.type===SQ.ALL_USERS));if(!e)return;a([e.id]),l([])}},defaultValue:r}),t.jsx(VB,{children:"segments"===r&&t.jsx(TX.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(ife,{includedSegments:i,excludedSegments:s,handleAddSegment:(e,t)=>{"include"===t?a((t=>[...t,e])):l((t=>[...t,e]))},handleRemoveSegment:(e,t)=>{"include"===t?a((t=>t.filter((t=>t!==e)))):l((t=>t.filter((t=>t!==e))))},setOpenCreateSegmentDialog:u,segments:f,defaultIsExcludeOpen:s.length>0})})})]}),t.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:g?.recipients&&t.jsx(tfe,{recipients:g.recipients})})]}):t.jsx("div",{children:t.jsx(FX,{text:["Fetching segments","Finishing up"]})}),t.jsx(aae,{open:c,setOpen:u})]})},sfe=({data:e,placeholder:n,searchPlaceholder:r,noResultsMessage:o,value:a,setValue:s})=>{const[l,c]=i.useState(!1);return t.jsxs(d8,{open:l,onOpenChange:c,modal:!0,children:[t.jsx(p8,{asChild:!0,children:t.jsxs(VX,{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(gu,{className:"opacity-50"})]})}),t.jsx(f8,{className:"w-[200px] p-0",children:t.jsxs($7,{children:[t.jsx(V7,{placeholder:r,className:"h-9"}),t.jsxs(B7,{children:[t.jsx(z7,{children:o}),t.jsx(H7,{children:e.map((e=>t.jsxs(G7,{value:e.value,onSelect:e=>{s(e===a?"":e),c(!1)},children:[e.label,t.jsx(du,{className:Yd("ml-auto",a===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},lfe=({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?y9(new Date(o),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),p=t=>{const n=P8(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(d8,{children:[t.jsx(p8,{asChild:!0,children:t.jsxs(VX,{variant:"outline",className:Yd("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[t.jsx(uu,{className:"mr-2 h-4 w-4"}),o?y9(new Date(o),"PPP"):t.jsx("span",{children:"Pick a date"})]})}),t.jsx(f8,{className:"w-auto p-0",children:t.jsx(Qie,{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:Yd("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(sfe,{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=P8(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]})]})})},cfe=()=>{const e=hae(),{updateAutomation:r}=Me(e?.id||""),{toast:o}=Ll(),[i,a]=n.useState(null),[s,l]=n.useState(e?.triggerMetadata?.triggerType===Fe.ONE_TIME?e?.triggerMetadata?.scheduledAt:null),[c,u]=n.useState(e?.triggerMetadata?.triggerType===Fe.ONE_TIME&&e?.triggerMetadata?.timezone||"America/New_York"),[d,p]=n.useState(!1);n.useEffect((()=>{}),[e]);return e?t.jsx(nfe,{title:"Edit Schedule Time",headerActions:t.jsx(VX,{onClick:()=>{if("sendNow"===i)r({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:new Date(Date.now()+3e5).toISOString()}}),o({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),p(!1);else{if(!s||!c)return;r({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:s,timezone:c}}),o({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(s).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),p(!1)}},disabled:!d,children:"Update"}),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(HX,{selected:"sendNow"===i,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(qX.SendButton,{}),onClick:()=>{a("sendNow"),l(new Date(Date.now()+3e5).toISOString()),u("America/New_York"),p(!0)}}),t.jsx(HX,{selected:"schedule"===i,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(qX.ScheduleButton,{}),onClick:()=>a("schedule")})]}),t.jsx(VB,{children:"schedule"===i&&t.jsx(UX,{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(lfe,{setScheduleTime:l,setTimezone:u,timezone:c,scheduleTime:s,setIsDirty:p})})})})]}),s&&t.jsxs(TX.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(TX.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(TX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(s).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:c||void 0})})]})]})})}):null},ufe=({type:e})=>t.jsxs("div",{className:"w-full h-full min-h-[300px] flex flex-col items-center justify-center bg-gradient-to-b from-gray-50 to-white p-8",children:[t.jsx("div",{className:"mb-4 text-gray-300",children:t.jsx("svg",{className:"w-16 h-16",fill:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z"})})}),t.jsxs("p",{className:"text-gray-400 font-medium text-lg text-center mb-2",children:["No ","email"===e?"Email":"SMS"," Preview Available"]}),t.jsxs("p",{className:"text-gray-400 text-sm text-center",children:["Edit your ","email"===e?"Email":"SMS"," template to see a preview here"]})]}),dfe=({html:e,height:n,width:r})=>t.jsx("div",{className:"w-full h-full bg-white rounded-lg border-0 overflow-hidden transition-all duration-300 ease-in-out flex flex-col items-center justify-center",children:e?t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("iframe",{title:"Email Preview",srcDoc:e,className:"transition-opacity duration-300",style:{border:"none",backgroundColor:"white",height:n||"100%",width:r||"100%",maxWidth:"100%",maxHeight:"100%"}})}):t.jsx(ufe,{type:"email"})}),pfe=()=>{const e=ve({queryKey:["channel-accounts"],queryFn:()=>(async()=>(await Oe("/channel/accounts",{method:"GET"})).data)()});return{channelAccounts:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelAccounts:e.refetch}};var ffe=(e=>(e.REACH_MANAGED="reach-managed",e.TWILLIO="twillio",e))(ffe||{});const hfe=()=>{const e=ve({queryKey:["channel-senders"],queryFn:()=>(async()=>(await Oe(`${u}`,{method:"GET"})).data)()});return{channelSenders:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelSenders:e.refetch}},mfe=()=>{const e=ce(),t=ye({mutationFn:e=>(async(e,t)=>(await Oe(`${u}/${t}`,{method:"PATCH",body:JSON.stringify(e)})).data)(e.toUpdate,e.id),onSuccess:()=>{e.invalidateQueries({queryKey:["channel-senders"]})}});return{updateChannelSender:t.mutate,isUpdating:t.isPending,updateError:t.error}},gfe=(e,t)=>{const[r,o]=n.useState(e);return n.useEffect((()=>{const n=setTimeout((()=>{o(e)}),t);return()=>clearTimeout(n)}),[e,t]),r},vfe=()=>t.jsxs("div",{className:"p-6 overflow-y-auto",children:[t.jsxs("div",{className:"mb-8 text-center",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Email Editor Help Center"}),t.jsx("p",{className:"text-gray-500",children:"Learn how to use our email editor's powerful features"})]}),t.jsxs("div",{className:"space-y-4 max-w-xl mx-auto",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Using Dynamic Content"}),t.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-gray-50",children:[t.jsx("img",{src:"https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",alt:"Merge Tags Demo",className:"w-full shadow-lg max-w-md mx-auto"}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 to-transparent p-4",children:t.jsx("p",{className:"text-white text-sm",children:"Demonstration: Adding merge tags to personalize your emails"})})]}),t.jsx("div",{className:"px-2",children:t.jsx(HX,{onClick:()=>{},title:"Dynamic Content",subtitle:"Dynamic content is a way to insert dynamic content into your email such as the customer's name, email, or other details.",icon:t.jsx(Pu,{}),selected:!0})})]})]}),yfe=({type:e})=>t.jsxs("div",{className:"flex items-start space-x-2 text-sm text-gray-600",children:[t.jsx("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),t.jsxs("span",{children:["Please configure at least one ",e," sender before editing the template"]})]}),bfe=({containerRef:e,stripoDialogDimensions:n,showSaving:r})=>t.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center",children:[t.jsx("div",{id:"externalSystemContainer",className:"flex items-center px-4 py-2"}),r&&t.jsx("div",{className:"absolute top-0 left-0 w-full h-full bg-black/50 flex items-center justify-center z-50",children:t.jsx(FX,{textColor:"text-white",text:["Saving..."]})}),t.jsx("div",{id:"stripoEditorContainer",ref:e,style:{width:n.width-75,height:n.height-75},className:"z-10"})]}),wfe="UiEditorScript",xfe=e=>new Promise(((t,n)=>{const r=()=>{window.UIEditor&&(window.UIEditor.initEditor(e.container,{metadata:{emailId:e.emailId,userId:e.businessId},html:e.html,css:e.css,locale:"en",onTokenRefreshRequest:e=>{Promise.resolve().then((async()=>{try{const{token:t}=await(async()=>(await Oe(`${p}/token`)).data)();e(t)}catch(t){}}))},messageSettingsEnabled:!1,conditionsEnabled:!1,syncModulesEnabled:!1,notifications:{info:console.info,error:console.error,warn:console.warn,success:console.log},mergeTags:e.mergeFields}),t(void 0))};if(document.getElementById(wfe))r();else{const e=document.createElement("script");e.id=wfe,e.type="module",e.src="https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",e.onload=()=>{window.UIEditor?r():n(new Error("UIEditor not found after script load"))},e.onerror=e=>{n(e)},document.head.appendChild(e)}})),_fe=({automation:e,setShowStripoEditor:r,saveClicked:o,setSaveClicked:i,stripoDialogDimensions:a,mergeFieldsResponse:s,cancelClicked:l,setCancelClicked:c})=>{const u=n.useRef(!1),d=n.useRef(null),{data:p,isLoading:f}=IX(e.id),{data:h,isLoading:m}=(()=>{const e=ce();return{...ve({queryKey:MX.editorData(),queryFn:jX,..._e}),invalidateEditorData:()=>e.invalidateQueries({queryKey:MX.editorData()})}})(),[g,v]=n.useState(!1),[y,b]=n.useState(!1),{updateCommunicationGroup:w}=uae(),x=n.useCallback((()=>{i(!1),c(!1),v(!1),b(!1),r(!1)}),[i,c,v,b,r]);return n.useEffect((()=>{if(o&&window.UIEditor&&p?.communicationGroupId&&window.StripoEditorApi?.actionsApi){window.StripoEditorApi.actionsApi.compileEmail({callback:function(e,t){e||(w({groupId:p.communicationGroupId,params:{emailHtmlBody:t}}),b(!0))},minimize:!0,mergeTags:[],forseAmp:!1,resetDataSavedFlag:!1,disableLineHeightsReplace:!0});window.StripoEditorApi.actionsApi.save((function(e){e||v(!0)}))}}),[o,d,i,r,p,w]),n.useEffect((()=>{(async()=>{g&&y&&(window.UIEditor&&window.UIEditor.removeEditor(),x())})()}),[g,y,r,i,x]),n.useEffect((()=>{l&&(window.UIEditor&&window.UIEditor.removeEditor(),x())}),[l,x]),n.useEffect((()=>{h?.businessId&&d.current&&p&&(u.current||(xfe({emailId:p.communicationGroupId,html:p.html||"<div></div>",css:p.css||"",container:d.current,businessId:h.businessId,mergeFields:s.mergeFields||[]}).catch((e=>{})),u.current=!0))}),[h,s,p]),t.jsx("div",f||m||!h||!p?{className:"w-full h-full flex flex-col items-center justify-center",children:t.jsx(FX,{text:["Loading editor..."]})}:{className:"w-full h-full flex flex-col",children:t.jsx(bfe,{containerRef:d,stripoDialogDimensions:a,showSaving:o})})},Sfe=({mergeFieldsResponse:e})=>{const r=mae(),o=hae(),{updateCommunicationGroup:i}=uae(),{refetchAutomation:a}=ke(o?.id||""),{channelSenders:s}=hfe(),{channelAccounts:l}=pfe(),{updateChannelSender:c}=mfe(),[u,d]=n.useState(!1),[p,f]=n.useState(r?.emailChannelSenderId||null),[h,m]=n.useState(r?.emailSubject||null),[g,v]=n.useState(r?.emailPreviewText||null),[y,b]=n.useState(r?.emailHtmlBody||null),[w,x]=n.useState(!1),[_,S]=n.useState(!1),[E,T]=n.useState(!1),[C,A]=n.useState(""),[R,O]=n.useState(""),[N,P]=n.useState(null),[k,L]=n.useState(!1),D=n.useRef(!0),[M,j]=n.useState(!0),[I,F]=n.useState(!1),[U,$]=n.useState({width:0,height:0}),[V,B]=n.useState(null),z=gfe(h,500),H=gfe(g,500),q=gfe(C,500),G=gfe(R,500),K=n.useMemo((()=>s?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=l?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===ffe.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[s?.results,l?.results]),W=n.useMemo((()=>({width:800,height:400})),[]),Y=n.useRef(null);return n.useEffect((()=>{const e=setTimeout((()=>{D.current=!1}),500);return()=>clearTimeout(e)}),[]),n.useEffect((()=>{r?.emailHtmlBody&&b(r.emailHtmlBody)}),[r?.emailHtmlBody,a]),n.useEffect((()=>{if(u){const e=setTimeout((()=>{d(!1)}),2e3);return()=>clearTimeout(e)}}),[u]),n.useEffect((()=>{const e=()=>{$({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),n.useEffect((()=>{if(!D.current&&p&&z&&y&&r?.id){d(!0);(async()=>{try{i({groupId:r.id,params:{emailChannelSenderId:p,emailHtmlBody:y,emailSubject:z,...H&&{emailPreviewText:H}}})}catch(e){}finally{d(!1)}})()}}),[p,z,H,y,r?.id,i]),n.useEffect((()=>{if(s?.results&&p){const e=s.results.find((e=>e.id===p));e&&(I&&!M||O(e.channelSenderMetadata.emailReplyTo),M&&A(e.channelSenderMetadata.emailFromName),j(!1))}}),[s?.results,p,I,M]),n.useEffect((()=>{if(s?.results&&!p){const e=s.results.filter((e=>e.channelSenderMetadata.userPart));if(e[0]){const t=e[0];f(t.id),i({groupId:r?.id||"",params:{emailChannelSenderId:t.id}})}}}),[s?.results,p,r?.id,i]),n.useEffect((()=>{if(!D.current&&q&&p){B("fromName");(async()=>{try{const e=s?.results?.find((e=>e.id===p));e&&await c({id:p,toUpdate:{channelSenderMetadata:{...e.channelSenderMetadata,emailFromName:q}}})}catch(e){}finally{B(null)}})()}}),[q,s?.results,p,c]),n.useEffect((()=>{if(G){const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(G),t=/\p{Emoji}/u.test(G);P(t?"Emojis are not allowed in email addresses":e?null:"Please enter a valid email address")}else P(null)}),[G]),n.useEffect((()=>{const e=async e=>{try{const t=s?.results?.find((t=>t.id===e.fromEmail));t&&c({id:e.fromEmail,toUpdate:{channelSenderMetadata:{...t.channelSenderMetadata,emailReplyTo:e.debouncedReplyToEmail}}})}catch(t){}finally{B(null)}};D.current||!p||N||(B("replyToEmail"),e(G?{fromEmail:p,debouncedReplyToEmail:G}:{fromEmail:p,debouncedReplyToEmail:null}))}),[G,s?.results,p,c,N]),n.useEffect((()=>{!1===w&&r?.id&&a()}),[w,r?.id,a]),l&&s?t.jsxs("div",{className:"relative",children:[t.jsx(wB,{open:k,onOpenChange:L,children:t.jsxs(SB,{className:"max-h-[86vh] gap-0 overflow-visible max-w-3xl w-full h-full",children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Email Preview Help"}),t.jsx(AB,{children:"Learn more about the email preview and how to use it to create your email."})]}),t.jsx(vfe,{})]})}),t.jsx(wB,{open:w,onOpenChange:x,children:t.jsxs(SB,{className:"min-w-[100vw] min-h-[100vh]",hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault()},children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Email Editor"}),t.jsx(AB,{children:"Learn more about the email editor and how to use it to create your email."})]}),t.jsxs("div",{className:"w-full h-full",children:[t.jsxs("div",{className:"flex justify-between items-center p-1 border-b",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-lg font-medium",children:"Email Editor"}),t.jsx(q0,{title:"Click to learn more about email template ",onClick:()=>L(!0)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(VX,{variant:"destructive",onClick:()=>{T(!0)},className:"text-sm px-3 py-1 rounded",children:"Cancel"}),t.jsx(VX,{onClick:()=>S(!0),className:"text-sm px-3 py-1 rounded",children:"Save"})]})]}),t.jsx("div",{className:" w-full",children:o&&t.jsx(_fe,{cancelClicked:E,setCancelClicked:T,showStripoEditor:w,automation:o,setShowStripoEditor:x,saveClicked:_,setSaveClicked:S,stripoDialogDimensions:U,mergeFieldsResponse:e})})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(z9,{children:"From Email"}),t.jsxs(Lne,{onValueChange:e=>{f(e),j(!0),F(!1)},value:p??void 0,disabled:u,children:[t.jsx(Mne,{children:t.jsx(Dne,{placeholder:"Select email",children:p?K?.find((e=>e.channelSenderId===p))?.fullDomain:""})}),t.jsx(Fne,{children:K?.map((e=>t.jsx(Une,{value:e.channelSenderId,children:e.fullDomain},e.channelSenderId)))})]})]}),t.jsxs("div",{children:[t.jsx(z9,{children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["From Name",t.jsx(q0,{title:"This will be the friendly name of the sender that the customer will see in the inbox",alertText:"Changes to the sender name will be applied across all emails using this address"})]})}),t.jsx(tQ,{placeholder:"Enter from name",value:C??"",onChange:e=>A(e.target.value),disabled:u&&"fromName"!==V||!p||M})]}),t.jsxs("div",{children:[t.jsx(z9,{children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["Reply To Email",t.jsx(q0,{title:"This will be the email address that customer can reply to on the email",alertText:"Changes to the reply to email will be applied across all emails using this address"})]})}),t.jsx(tQ,{placeholder:"Enter reply to email",value:R??"",onChange:e=>{O(e.target.value),I||F(!0)},disabled:u&&"replyToEmail"!==V||!p||M}),N&&t.jsx("p",{className:"text-sm text-red-500 mt-1",children:N})]}),t.jsxs("div",{children:[t.jsx(z9,{children:"Subject"}),t.jsx(tQ,{placeholder:"Enter email subject",value:h??"",onChange:e=>m(e.target.value),disabled:u||M})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(z9,{children:"Preview Text"}),t.jsx(q0,{title:"This text will be used for the preview text of the email in the inbox"})]}),t.jsx(tQ,{placeholder:"Enter preview text",value:g??"",onChange:e=>v(e.target.value),disabled:u||M})]})]}),t.jsxs("div",{className:"border rounded-lg p-4 h-full flex flex-col",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h3",{className:"font-medium",children:"Preview"}),t.jsxs("div",{children:[t.jsx(VX,{onClick:()=>x(!0),className:"text-sm px-3 py-1 rounded",disabled:u||0===(K?.length??0),children:"Edit"}),0===(K?.length??0)&&t.jsx("div",{className:"relative inline-block",children:t.jsx("div",{className:"absolute right-0 top-full mt-2 w-64 p-3 bg-white border rounded-lg shadow-lg z-10",children:t.jsx(yfe,{type:"email"})})})]})]}),t.jsx("div",{className:"flex-1 w-full overflow-auto",ref:Y,style:{height:"400px"},children:t.jsx(dfe,{html:y??"",height:W.height,width:W.width})})]})]})]}):t.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(FX,{text:["Fetching Email Preview..."]})})};var Efe="Checkbox",[Tfe,Cfe]=UQ(Efe),[Afe,Rfe]=Tfe(Efe),Ofe=i.forwardRef(((e,n)=>{const{__scopeCheckbox: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=WU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,w]=u0({prop:a,defaultProp:s,onChange:d}),x=i.useRef(b);return i.useEffect((()=>{const e=h?.form;if(e){const t=()=>w(x.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[h,w]),t.jsxs(Afe,{scope:r,state:b,disabled:c,children:[t.jsx(GQ.button,{type:"button",role:"checkbox","aria-checked":Lfe(b)?"mixed":b,"aria-required":l,"data-state":Dfe(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onKeyDown:FQ(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:FQ(e.onClick,(e=>{w((e=>!!Lfe(e)||!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(kfe,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:!Lfe(s)&&s})]})}));Ofe.displayName=Efe;var Nfe="CheckboxIndicator",Pfe=i.forwardRef(((e,n)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,a=Rfe(Nfe,r);return t.jsx(l0,{present:o||Lfe(a.state)||!0===a.state,children:t.jsx(GQ.span,{"data-state":Dfe(a.state),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})}));Pfe.displayName=Nfe;var kfe=e=>{const{control:n,checked:r,bubbles:o=!0,defaultChecked:a,...s}=e,l=i.useRef(null),c=$ne(r),u=FJ(n);i.useEffect((()=>{const e=l.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(c!==r&&n){const t=new Event("click",{bubbles:o});e.indeterminate=Lfe(r),n.call(e,!Lfe(r)&&r),e.dispatchEvent(t)}}),[c,r,o]);const d=i.useRef(!Lfe(r)&&r);return t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??d.current,...s,tabIndex:-1,ref:l,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Lfe(e){return"indeterminate"===e}function Dfe(e){return Lfe(e)?"indeterminate":e?"checked":"unchecked"}var Mfe=Ofe,jfe=Pfe;const Ife=({selectedChannels:e,setSelectedChannels:n,hasEmailChannelSenders:r,hasSmsChannelSenders:o})=>{const{toast:i}=Ll(),a=[...r?[{label:"Email",value:"email",icon:qX.EmailIcon,checked:e.includes("email")}]:[],...o?[{label:"SMS",value:"sms",icon:qX.SmsIcon,checked:e.includes("sms")}]:[]];return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-xl",children:"Message Types"}),t.jsx("p",{className:"text-gray-600 mb-2 text-sm",children:"Select the channels you want to use in this automation"})]}),t.jsx("div",{className:"w-full grid grid-cols-2 gap-3",children:a.map((r=>t.jsxs(Mfe,{checked:r.checked,onCheckedChange:()=>{"email"===r.value?e.includes("email")?e.includes("sms")?n(["sms"]):i({title:"Cant Remove Email",description:"At least one channel is required for an automation",variant:"destructive"}):n([...e,"email"]):e.includes("sms")?e.includes("email")?n(["email"]):i({title:"Cant Remove SMS",description:"At least one channel is required for an automation",variant:"destructive"}):n([...e,"sms"])},className:"relative ring-[1px] ring-border rounded-lg px-4 py-3 text-start text-muted-foreground data-[state=checked]:ring-2 data-[state=checked]:ring-primary data-[state=checked]:text-primary",children:[t.jsx(r.icon,{className:"mb-3",size:20}),t.jsx("span",{className:"font-medium tracking-tight",children:r.label}),t.jsx(jfe,{className:"absolute top-2 right-2",children:t.jsx(yu,{className:"fill-primary text-primary-foreground"})})]},r.value)))})]})},Ffe=e=>{const{companyName:t,smsBody:n}=e;return t&&n?`${t}:\n${n}`:n??""},Ufe=({body:e})=>t.jsx("div",{className:"sms-preview-outer @container",children:t.jsxs("div",{className:"sms-phone-mockup",children:[t.jsx("div",{className:"sms-phone-notch"}),t.jsx("div",{className:"sms-phone-inner",children:t.jsx("div",{className:"sms-message-row",children:t.jsx("div",{className:"sms-message-bubble",children:e})})}),t.jsx("div",{className:"sms-phone-home-indicator"})]})}),$fe=({mergeFieldsResponse:e,smsChannelSenders:r})=>{const o=hae(),i=n.useCallback((()=>{const e=o?.actionData?.find((e=>"send_communication"===e.actionType));return e?.actionMetadata.communicationGroupId}),[o?.actionData]),{channelSenders:a}=hfe(),{data:s,isLoading:l}=Z0(),{channelAccounts:c}=pfe(),{updateCommunicationGroup:u}=uae(),{communicationGroup:d}=cae(i()??void 0),[p,f]=n.useState(!1),[h,m]=n.useState(""),[g,v]=n.useState(null),[y,b]=n.useState(!1),[w,x]=n.useState(null),[_,S]=n.useState(null),[E,T]=n.useState(!1),C=n.useRef(null),A=gfe(_,1e3),R=gfe(g,1e3),O=gfe(w,1e3);n.useEffect((()=>{if(null!==R&&null!==A&&!p){f(!0);const e=i();e&&u({groupId:e,params:{smsChannelSenderId:R,smsMessageBody:A,textMessageCompanyName:O}}),f(!1)}}),[R,A,O,p,u,i]),n.useEffect((()=>{d&&(v(d.smsChannelSenderId),S(d.smsMessageBody),d.textMessageCompanyName&&x(d.textMessageCompanyName))}),[d]);return n.useEffect((()=>{if(void 0!==a&&!g){const e=a.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid));e?.[0]&&(v(e[0].id),d?.id&&u({groupId:d.id,params:{smsChannelSenderId:e[0].id}}))}}),[a,g,d?.id,u]),n.useEffect((()=>{w||!s?.name||y||(b(!0),x(s.name))}),[w,s?.name,y]),c&&a&&!l?t.jsxs("div",{children:[t.jsx(wB,{open:E,onOpenChange:T,children:t.jsxs(SB,{children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"SMS Editor"}),t.jsx(AB,{children:"Learn more about the SMS editor and how to use it to create your SMS."})]}),t.jsxs("div",{className:"",children:[t.jsx(nQ,{ref:C,className:"min-h-[300px]",placeholder:"Text message content...",value:_??"",onChange:e=>{S(e.target.value)},maxLength:1600-(w?.length||0)}),t.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[t.jsxs(Lne,{value:h,onValueChange:e=>{const t=C.current,n=_||"",r=t?.selectionStart??n.length,o=t?.selectionEnd??n.length,i=n.slice(0,r)+e+n.slice(o);S(i),m(""),setTimeout((()=>{const n=r+e.length;t?.focus(),t?.setSelectionRange(n,n)}),0)},children:[t.jsx(Mne,{className:"w-[50px]",children:t.jsx(qX.MergeField,{className:"w-4 h-4"})}),t.jsx(Fne,{children:e?.mergeFields?.map((e=>e.entries.map((e=>t.jsx(Une,{value:e.value,children:e.label},e.value))))).flat()})]}),t.jsx(q0,{title:"Dynamic content is a way to insert dynamic content into your messages such as the customer's name, email, or other details."})]}),t.jsxs("div",{className:"flex justify-end mt-2 text-sm transition-colors duration-300 "+(_&&_.length>1400?_.length>=1600?"text-red-500":"text-amber-500":"text-gray-500"),children:[_?_.length:0,"/",1600-(w?.length||0)," ","characters"]})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(z9,{children:"From Number"}),t.jsxs(Lne,{onValueChange:e=>{v(e)},value:g??void 0,children:[t.jsx(Mne,{children:t.jsx(Dne,{placeholder:"Select number",children:g?(N=g,r?.find((e=>e.id===N))?.channelSenderMetadata.friendlyName??r?.find((e=>e.id===N))?.channelSenderMetadata.from??N):"Select number"})}),t.jsx(Fne,{children:r?.map((e=>t.jsx(Une,{value:e.id,children:e.channelSenderMetadata.friendlyName??e.channelSenderMetadata.from??"Select number"},e.id)))})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(z9,{children:"Company Name"}),t.jsx(q0,{title:"Adding your company name can help customers identify who they are talking to"})]}),t.jsx(tQ,{placeholder:"Enter company name",value:w??"",onChange:e=>{x(e.target.value??null)},disabled:!g})]})]}),t.jsxs("div",{className:"border rounded-lg p-4",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h3",{className:"font-medium",children:"Preview"}),t.jsx("div",{children:t.jsx(VX,{onClick:()=>T(!0),className:"text-sm px-3 py-1 rounded ",disabled:0===(r?.length??0),children:"Edit"})})]}),t.jsx("div",{children:g?t.jsx(t.Fragment,{children:g&&_?t.jsx(Ufe,{body:Ffe({companyName:w??void 0,smsBody:_})}):t.jsx(ufe,{type:"sms"})}):t.jsx(yfe,{type:"sms"})})]})]})]}):t.jsx("div",{children:t.jsx(FX,{text:["Loading..."]})});var N},Vfe=({getExtraMergeFields:e})=>{const[r,o]=n.useState(null),i=n.useRef(null),{toast:a}=Ll(),s=mae(),{channelSenders:l}=hfe(),{channelAccounts:c}=pfe(),{updateCommunicationGroup:u}=uae(),d=hae(),{getMergeFields:p,isGetting:f}=(e=>{const t=ve({queryKey:["merge-fields",e],queryFn:()=>DX(e)});return{getMergeFields:t.data,isGetting:t.isPending,getError:t.error,isGetSuccess:t.isSuccess}})(s?.id??void 0),[h,m]=n.useState(void 0);n.useEffect((()=>{const e=s?.id;e&&r&&(r.includes("email")||null===s?.emailChannelSenderId||u({groupId:e,params:{emailChannelSenderId:null}}),r.includes("sms")||null===s?.smsChannelSenderId||u({groupId:e,params:{smsChannelSenderId:null}}))}),[r,u,s]),n.useEffect((()=>{const e=s?.id;e||r||o(["email"])}),[d,s,r]);const g=n.useCallback((e=>{const t=[];e.emailChannelSenderId&&t.push("email"),e.smsChannelSenderId&&t.push("sms"),0===t.length&&t.push("email"),o(t)}),[]);n.useEffect((()=>{s&&!r&&g(s)}),[s,g,r]),n.useEffect((()=>{f||void 0===h&&(e?e().then((e=>{s?.id&&(g(s),u({groupId:s?.id,params:{extraMergeFields:e}},{onSuccess:async()=>{try{const e=await DX(s?.id);m(e)}catch{a({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}},onError:e=>{a({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}}))})):(s?.id&&null!==s.extraMergeFields&&u({groupId:s?.id,params:{extraMergeFields:null}}),m(p)))}),[e,u,s,a,f,p,h,g]);const v=n.useMemo((()=>l?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=c?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===ffe.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[l?.results,c?.results]),y=n.useMemo((()=>l?.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))),[l?.results]);if(!r||f||!h||!v||!y)return t.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(FX,{text:["Fetching Content..."]})});return t.jsxs("div",{className:"flex flex-col gap-4 flex-shrink-0",children:[t.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(Ife,{selectedChannels:r,setSelectedChannels:o,hasEmailChannelSenders:v.length>0,hasSmsChannelSenders:y.length>0})}),r.includes("email")&&t.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",ref:i,children:[t.jsx("h4",{className:"text-xl",children:"Email Campaign"}),t.jsx(Sfe,{mergeFieldsResponse:h,emailChannelSendersWithChannelAccounts:v})]}),r.includes("sms")&&t.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:[t.jsx("h4",{className:"text-xl",children:"SMS Campaign"}),t.jsx($fe,{mergeFieldsResponse:h,smsChannelSenders:y})]})]})},Bfe=({open:e,onOpenChange:n})=>t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"max-w-[75vw] min-h-[75vh] overflow-y-auto max-h-[90vh]",children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Edit Campaign Content"}),t.jsx(AB,{children:"Edit the content of the campaign"})]}),t.jsx(Vfe,{})]})}),zfe=()=>t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"w-3 h-3 rounded-full bg-[#FF605C] border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-[#FFBD44] border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-[#00CA4E] border border-zinc-300 shadow-sm"})]}),Hfe=({children:e,actionButtons:n})=>t.jsxs("div",{className:"flex-1 w-full relative overflow-hidden",children:[t.jsxs("div",{className:"h-full relative w-full rounded-2xl shadow-xl bg-white border border-zinc-200 overflow-hidden min-h-[500px] flex flex-col",style:{containerType:"inline-size"},children:[t.jsxs("div",{className:"flex items-center space-x-3 pt-3 px-4 z-10 w-full justify-between",children:[t.jsx(zfe,{}),n&&t.jsx("div",{className:"flex items-center space-x-2",children:n})]}),e]}),t.jsx("div",{className:"text-center text-sm text-muted-foreground mt-4",children:t.jsx("p",{children:"These previews show exactly how your messages will appear to your customers"})})]}),qfe=()=>{const e=hae(),r=mae(),{channelSenders:o}=hfe(),{channelAccounts:i}=pfe(),a=n.useMemo((()=>o?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=i?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===ffe.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSenderMetadata:e.channelSenderMetadata}]:[]}))||[]),[o?.results,i?.results]),s=r?.emailChannelSenderId;if(!(e&&r&&a&&s))return null;const l=a.find((e=>e.channelSenderId===s)),c=l?.fullDomain,u=l?.channelSenderMetadata.emailReplyTo,d=r.emailSubject,p=r.emailPreviewText,f=l?.channelSenderMetadata.emailFromName;return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),t.jsxs("div",{className:"text-base font-medium",children:[c,f&&t.jsxs("span",{className:"text-muted-foreground",children:["<",c,">"]})]})]}),u&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Reply-To"}),t.jsx("div",{className:"text-base font-medium",children:u})]}),d&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Subject"}),t.jsx("div",{className:"text-base font-medium",children:d})]}),p&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Preview Text"}),t.jsx("div",{className:"text-sm font-medium line-clamp-2",children:p})]})]})},Gfe=({emailBody:e})=>{const[r,o]=n.useState({width:0,height:0}),i=n.useRef(null);return n.useEffect((()=>{const e=()=>{i.current&&requestAnimationFrame((()=>{o({width:i.current?i.current.offsetWidth-75:0,height:i.current?i.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[i]),t.jsxs(Hfe,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(qfe,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",ref:i,children:t.jsx(dfe,{html:e,height:r.height,width:r.width})})]})},Kfe=({expandDialogContent:e})=>{const[r,o]=n.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(wB,{open:r,onOpenChange:o,children:t.jsxs(SB,{hideCloseButton:!0,className:"w-[80vw] h-[80vh] max-w-none max-h-none bg-transparent border-none",children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Expanded Preview"}),t.jsx(AB,{children:"Expanded view of communication content"})]}),t.jsxs("div",{className:"h-full flex flex-col overflow-hidden rounded-xl",children:[e,t.jsx("div",{className:"absolute top-7 right-7 z-10",children:t.jsx(VX,{variant:"ghost",size:"sm",onClick:()=>o(!1),children:t.jsx(qX.CloseButton,{className:"w-4 h-4"})})})]})]})}),t.jsx(VX,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>o(!0),children:t.jsx(qX.ExpandIcon,{className:"w-4 h-4"})})]})},Wfe=({type:e})=>{const n="sms"===e?"SMS":"Email";return t.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center justify-center bg-zinc-50/80 border border-zinc-100 rounded-2xl shadow-md px-6 py-12 max-w-[90vw] w-full sm:max-w-md mx-auto text-center",style:{containerType:"inline-size"},children:[t.jsx("sms"===e?qX.SmsIcon:qX.EmailIcon,{className:"w-12 h-12 text-zinc-500 mb-4"}),t.jsxs("h2",{className:"text-xl font-semibold text-zinc-800 mb-2",children:["No ",n," Content Yet"]}),t.jsxs("p",{className:"text-zinc-500 text-base mb-1",children:["Click ",t.jsx("span",{className:"font-medium text-zinc-700",children:"Edit content"})," ","to start crafting your ",n," message."]})]})})},Yfe=({onClick:e})=>t.jsxs(VX,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:e,children:[t.jsx(qX.PreviewButton,{className:"w-4 h-4"}),t.jsx("span",{className:"font-medium text-sm",children:"Preview"})]}),Xfe=e=>/^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/.test(e),Qfe=e=>{if(!/^[0-9\s()+.-]+$/.test(e))return!1;const t=e.replace(/\D/g,"");return e.startsWith("+")?t.length>=10&&t.length<=15:10===t.length||!(11!==t.length||!t.startsWith("1"))},Zfe=({automation:e,type:r,setOpenSendPreviewPopup:o})=>{const[i,a]=n.useState(""),[s,l]=n.useState(""),[c,u]=n.useState(null),[d,p]=n.useState(!1),{sendTestCommunication:f,sendError:h,isSendSuccess:m}=dae(),{toast:g}=Ll(),v=e.actionData?.find((e=>"send_communication"===e.actionType)),y=v?.actionMetadata.communicationGroupId,{communicationGroup:b,isGetting:w}=cae(y??void 0),x=n.useCallback((()=>{if(!y)return Promise.resolve(null);if(!b)return Promise.reject(new Error("Communication group not loaded"));switch(r){case"email":return Promise.resolve(b.emailChannelSenderId);case"sms":return Promise.resolve(b.smsChannelSenderId);default:return Promise.reject(new Error(`Unsupported type: ${r}`))}}),[b,r,y]);n.useEffect((()=>{(async()=>{try{const e=await x();u(e)}catch(e){u(null)}finally{p(!0)}})()}),[x]),n.useEffect((()=>{m&&(g({title:"Success",description:`Preview ${"email"===r?"email":"SMS"} sent successfully!`}),o(!1))}),[m,r,o,g]),n.useEffect((()=>{h&&(g({title:"Error",description:`Failed to send preview: ${h.message}`,variant:"destructive"}),o(!1))}),[h,g,o]);return!d||w?t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsx(FX,{text:["Fetching sender id","Finishing up"]})}):c?t.jsxs("div",{className:"",children:[t.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:["Send Preview ","email"===r?"Email":"SMS"]}),t.jsx(tQ,{type:"email"===r?"email":"tel",placeholder:"email"===r?"Enter email address":"Enter phone number",value:i,onChange:e=>{a(e.target.value),l("")},className:"w-full px-3 py-3 border border-gray-300 rounded-lg text-base mb-4 \n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent\n placeholder-gray-400"}),s&&t.jsx("p",{className:"text-red-500 text-sm mb-4 -mt-2",children:s}),t.jsx(VX,{onClick:()=>{if(!("email"===r?Xfe(i):Qfe(i)))return void l("Please enter a valid "+("email"===r?"email address":"phone number"));if(!c)return void l("No sender found, please update the automation first!");const t=e.actionData?.find((e=>"send_communication"===e.actionType)),n=t?.actionMetadata.communicationGroupId;if(!n)return Promise.resolve(null);f({id:n,params:"email"===r?{emailAddress:i}:{phoneNumber:i}})},disabled:!i,className:"w-full bg-blue-600 text-white py-3 px-6 rounded-lg font-medium\n hover:bg-blue-700 transition-colors duration-200\n disabled:bg-gray-400 disabled:cursor-not-allowed",children:"Send Preview"})]}):t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsxs("div",{className:"text-center flex flex-col justify-center items-center gap-2",children:[t.jsx(qX.AlertCircleIcon,{className:"h-12 w-12 text-gray-400 mb-4"}),t.jsx("h3",{className:"text-lg font-semibold text-gray-700 mb-2",children:"No sender found"}),t.jsx("p",{className:"text-gray-500",children:"Please update the automation to include a sender for this type"})]})})},Jfe=({open:e,onOpenChange:n,automation:r})=>t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Send Preview Email"}),t.jsx(AB,{children:"Send a preview email to the automation."})]}),t.jsx(Zfe,{automation:r,type:"email",setOpenSendPreviewPopup:n})]})}),ehe=()=>{const e=hae(),r=mae(),[o,i]=n.useState({width:0,height:0}),[a,s]=n.useState(!1),[l,c]=n.useState(!1),u=n.useRef(null);if(n.useEffect((()=>{const e=()=>{u.current&&requestAnimationFrame((()=>{i({width:u.current?u.current.offsetWidth-75:0,height:u.current?u.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[u]),!e||!r)return null;const d=r?.emailHtmlBody||"",p=r?.emailChannelSenderId&&d.length>0;return t.jsxs("div",{className:"flex-1 flex flex-col items-center w-full",children:[t.jsx(Bfe,{open:l,onOpenChange:c}),t.jsx(Jfe,{open:a,onOpenChange:s,automation:e}),t.jsx(Hfe,{actionButtons:t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex items-center space-x-2",children:[p&&t.jsx(Yfe,{onClick:()=>s(!0)}),t.jsx(VX,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>c(!0),children:"Edit content"}),p&&t.jsx(Kfe,{expandDialogContent:t.jsx(Gfe,{emailBody:d})})]})}),children:p?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(qfe,{})})}),t.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),t.jsx("div",{className:"flex-1 w-full overflow-auto h-full",ref:u,children:t.jsx(dfe,{html:d,height:o.height,width:o.width})})]}):t.jsx(Wfe,{type:"email"})})]})},the=()=>{const e=hae(),r=mae(),{channelSenders:o}=hfe(),{channelAccounts:i}=pfe(),a=n.useMemo((()=>o?.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))),[o?.results]),s=a?.find((e=>e.id===r?.smsChannelSenderId));if(!s)return null;if(!(e&&r&&o&&i&&a&&s))return null;const l=s.channelSenderMetadata.friendlyName||s.channelSenderMetadata.from||s.channelSenderMetadata.messageServiceSid;return t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),t.jsx("div",{className:"text-base font-medium font-mono text-zinc-800",children:l})]})})},nhe=({smsBody:e})=>t.jsxs(Hfe,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(the,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",children:t.jsx(Ufe,{body:e})})]}),rhe=({open:e,onOpenChange:n,automation:r})=>t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Send Preview SMS"}),t.jsx(AB,{children:"Send a preview SMS to the automation."})]}),t.jsx(Zfe,{automation:r,type:"sms",setOpenSendPreviewPopup:n})]})}),ohe=()=>{const[e,r]=n.useState(!1),o=hae(),i=mae(),[a,s]=n.useState(!1);if(!o)return null;const l=i?.smsMessageBody||"",c=i?.smsChannelSenderId&&l.length>0,u=Ffe({companyName:i?.textMessageCompanyName??void 0,smsBody:l});return t.jsxs("div",{className:"flex flex-col items-center w-full h-full",children:[t.jsx(Bfe,{open:a,onOpenChange:s}),t.jsx(rhe,{open:e,onOpenChange:r,automation:o}),t.jsx(Hfe,{actionButtons:t.jsxs(t.Fragment,{children:[c&&t.jsx(Yfe,{onClick:()=>r(!0)}),t.jsx(VX,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>s(!0),children:"Edit content"}),c&&t.jsx(Kfe,{expandDialogContent:t.jsx(nhe,{smsBody:u})})]}),children:c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(the,{})})}),t.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),t.jsx("div",{className:"flex-1 w-full overflow-auto h-full flex items-center justify-center",children:t.jsx(Ufe,{body:u})})]}):t.jsx(Wfe,{type:"sms"})})]})},ihe=()=>{const{state:{selectedActionId:e}}=n.useContext(fQ);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(VB,{mode:"wait",children:e===Pde.EditTime?t.jsx(cfe,{}):e===Pde.EditAudience?t.jsx(afe,{}):t.jsxs(Ype,{defaultValue:"email",className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:[t.jsx("div",{className:"max-w-[640px] mx-auto w-full",children:t.jsxs(Xpe,{className:"grid w-full grid-cols-2",children:[t.jsx(Qpe,{value:"email",className:"group",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e",alt:"Email",className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block"}),t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%237A8599'%20/%3e%3c/svg%3e",alt:"Email",className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden"}),"Email"]})}),t.jsx(Qpe,{value:"sms",className:"group",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e",alt:"SMS",className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block"}),t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%237A8599'%20/%3e%3c/svg%3e",alt:"SMS",className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden"}),"SMS"]})})]})}),t.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1",children:[t.jsx(Zpe,{value:"sms",children:t.jsx(ohe,{})}),t.jsx(Zpe,{value:"email",className:"flex flex-col h-full",children:t.jsx(ehe,{})})]})]})})})},ahe=()=>t.jsxs(Rde,{direction:"horizontal",className:"flex-1",children:[t.jsx(Ode,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(qde,{})})}),t.jsx(Nde,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(Ode,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(ihe,{})})})]}),she=()=>{const[e,r]=n.useState("workflow"),o=[{id:"workflow",label:"Workflow",content:t.jsx(ahe,{})},{id:"recipients",label:"Recipients",content:t.jsx(Xce,{})},{id:"insights",label:df("engage:insight",{count:2}),content:t.jsx(Yce,{})}];return t.jsx("div",{className:"h-full w-full",children:t.jsx(mQ,{tabs:o,activeTab:e,onTabChange:r,tabsLocation:"left"})})},lhe=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i})=>{const a=hae(),s=mae(),{updateCommunicationGroup:l}=uae(),{toast:c}=Ll();return n.useEffect((()=>{if(s&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(s.extraMergeFields)&&l({groupId:s?.id,params:{extraMergeFields:e}},{onError:e=>{c({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[s,i,l,c]),a&&s?t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(Wce,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(she,{})})]}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(FX,{text:[`Fetching ${df("engage:automation").toLowerCase()} data`,"Finishing up"]})})},che=({...e})=>{const n=function(){let{matches:e}=i.useContext(t2),t=e[e.length-1];return t?t.params:{}}(),[r]=H2(),o=e.automationId||n?.automationId||r.get("automationId")||"",a="true"===r.get("showBackButton")||e.showBackButton;return t.jsx(gae,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(lhe,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var uhe=e=>null!=e;var dhe=e=>"function"!=typeof e||e.length?e:e(),phe=e=>Array.isArray(e)?e:e?[e]:[];var fhe=ht;var hhe,mhe=function(e){const[t,n]=it(),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=it(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(O_e){return r(O_e,`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&&ft((()=>{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(O_e){r(O_e,`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),ht((()=>globalThis.removeEventListener("storage",e)))):(o.forEach((t=>t.addEventListener?.("storage",e))),ht((()=>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(O_e){r(O_e,`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(O_e){r(O_e,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(O_e){r(O_e,`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(O_e){r(O_e,`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(O_e){r(O_e,`Error getting all values from ${e.name}`)}}})),t}}]},ghe=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},vhe=("function"==typeof(hhe={_cookies:[globalThis.document,"cookie"],getItem:e=>vhe._cookies[0][vhe._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=vhe.getItem(e);vhe._cookies[0][vhe._cookies[1]]=`${e}=${t}${ghe(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:vhe});window.dispatchEvent(o)},removeItem:e=>{vhe._cookies[0][vhe._cookies[1]]=`${e}=deleted${ghe({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return vhe._cookies[0][vhe._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return vhe._cookies[0][vhe._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(hhe.clear=()=>{let e;for(;e=hhe.key(0);)hhe.removeItem(e)}),hhe),yhe=796,bhe="bottom",whe="system",xhe=Object.keys(Ar)[0],_he=Object.keys(Nr)[0],She=bt({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Ehe(){return wt(She)}var The=bt(void 0),Che=e=>{const[t,n]=it(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[cn]){for(let t of e[cn].keys())e.removeEventListener(t,Sn);delete e[cn]}}(i.document),i.document.title="TanStack Query Devtools",i.document.body.style.margin="0",i.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(Ehe().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(R_e){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)}})),pn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],i.document),e.setLocalStore("pip_open","true"),n(i)};lt((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||o(Number(window.innerWidth),Number(e.localStore.height||500))})),lt((()=>{const e=(Ehe().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(Ehe().shadowDOMTarget||n.document).querySelector("#_goober");t&&(t.textContent=e.textContent)}));t.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),ht((()=>{t.disconnect()}))}}));const i=ct((()=>({pipWindow:t(),requestPipWindow:o,closePipWindow:r,disabled:e.disabled??!1})));return Ut(The.Provider,{value:i,get children(){return e.children}})},Ahe=()=>ct((()=>{const e=wt(The);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Rhe=bt((()=>"dark"));function Ohe(){return wt(Rhe)}var Nhe={"À":"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"},Phe=Object.keys(Nhe).join("|"),khe=new RegExp(Phe,"g");var Lhe=7,Dhe=6,Mhe=5,jhe=4,Ihe=3,Fhe=2,Uhe=1,$he=0;function Vhe(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:Uhe,!n.accessors){const r=Bhe(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=Ghe(o),a=Hhe(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:$he,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=Bhe(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=Uhe?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 Bhe(e,t,n){return e=zhe(e,n),(t=zhe(t,n)).length>e.length?$he:e===t?Lhe:(e=e.toLowerCase())===(t=t.toLowerCase())?Dhe:e.startsWith(t)?Mhe:e.includes(` ${t}`)?jhe:e.includes(t)?Ihe:1===t.length?$he:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?Fhe: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 Uhe+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return $he;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return $he}return i(r-a)}(e,t)}function zhe(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(khe,(e=>Nhe[e]))),e}function Hhe(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 qhe={maxRanking:1/0,minRanking:-1/0};function Ghe(e){return"function"==typeof e?qhe:{...qhe,...e}}var Khe={data:""},Whe=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Yhe=/\/\*[^]*?\*\/| +/g,Xhe=/\n+/g,Qhe=(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]?Qhe(a,i):i+"{"+Qhe(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=Qhe(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+=Qhe.p?Qhe.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},Zhe={},Jhe=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+Jhe(e[n]);return t}return e};function eme(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=Jhe(e),a=Zhe[i]||(Zhe[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!Zhe[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=Whe.exec(e.replace(Yhe,""));)t[4]?r.shift():t[3]?(n=t[3].replace(Xhe," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(Xhe," ").trim();return r[0]})(e);Zhe[a]=Qhe(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&Zhe.g?Zhe.g:null;return n&&(Zhe.g=Zhe[a]),l=Zhe[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?"":Qhe(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||Khe),t.g,t.o,t.k);var r}function tme(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=tme(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function nme(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=tme(e))&&(r&&(r+=" "),r+=t);return r}function rme(e,t){const n=dt(e),{onChange:r}=t;let o=new Set(t.appear?void 0:n);const i=new WeakSet,[a,s]=it([],{equals:!1}),[l]=[vt,gt],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 ct((t=>{const n=a(),s=e();if(dt(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 dt((()=>{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 ome(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}eme.bind({g:1}),eme.bind({k:1});var ime=e=>e instanceof Element;function ame(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return ame(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=ame(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function sme(e,t=ime,n=ime){const r=ct(e),o=ct((()=>ame(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function lme(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function cme(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()))})),lme((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function ume(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())),lme((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var dme=e=>{const t=function(e){return ct((()=>{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 rme(sme((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)cme(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)ume(a,e,t,(()=>o([t])))}})},pme=Symbol("fallback");function fme(e){for(const t of e)t.dispose()}function hme(e){const{by:t}=e;return ct(function(e,t,n,r={}){const o=new Map;return ht((()=>fme(o.values()))),()=>{const n=e()||[];return dt((()=>{if(!n.length)return fme(o.values()),o.clear(),r.fallback?[ot((e=>(o.set(pme,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(pme);if(!o.size||a){a?.dispose(),o.delete(pme);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){ot((a=>{const[s,l]=it(t),c={setItem:l,dispose:a};if(n.length>1){const[e,t]=it(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 mme(e,t,n,r){const o=()=>{phe(dhe(e)).forEach((e=>{e&&phe(dhe(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),fhe(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?lt(o):st(o)}function gme(e,t,n){const r=new WeakMap,{observe:o,unobserve:i}=function(e,t){const n=new ResizeObserver(e);return ht(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);lt((t=>{const n=phe(dhe(e)).filter(uhe);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 vme=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function yme(e){const t={};let n;for(;n=vme.exec(e);)t[n[1]]=n[2];return t}function bme(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=yme(e)}else"string"==typeof t&&(t=yme(t));return{...e,...t}}function wme(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function xme(e){return"[object String]"===Object.prototype.toString.call(e)}function _me(e){return t=>`${e()}-${t}`}function Sme(e,t){return!!e&&(e===t||e.contains(t))}function Eme(e,t=!1){const{activeElement:n}=Tme(e);if(!n?.nodeName)return null;if(Cme(n)&&n.contentDocument)return Eme(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Tme(n).getElementById(e);if(t)return t}}return n}function Tme(e){return e?e.ownerDocument||e:document}function Cme(e){return"IFRAME"===e.tagName}var Ame=(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))(Ame||{});function Rme(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function Ome(){return Rme(/^Mac/i)}function Nme(){return Rme(/^iPhone/i)||Rme(/^iPad/i)||Ome()&&navigator.maxTouchPoints>1}function Pme(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function kme(e){return t=>{for(const n of e)Pme(t,n)}}function Lme(e){return Ome()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function Dme(e){if(e)if(function(){if(null==Mme){Mme=!1;try{document.createElement("div").focus({get preventScroll(){return Mme=!0,!0}})}catch(R_e){}}return Mme}())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 Mme=null;var jme=["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'])"],Ime=[...jme,'[tabindex]:not([tabindex="-1"]):not([disabled])'],Fme=jme.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",Ume=Ime.join(':not([hidden]):not([tabindex="-1"]),');function $me(e,t){const n=Array.from(e.querySelectorAll(Fme)).filter(Vme);return t&&Vme(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Cme(e)&&e.contentDocument){const r=$me(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function Vme(e){return Bme(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function Bme(e){return e.matches(Fme)&&zme(e)}function zme(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||zme(e.parentElement,e))}function Hme(e){for(;e&&!qme(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function qme(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Gme(){}function Kme(e,t){return Ht(e,t)}var Wme=new Map,Yme=new Set;function Xme(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=Wme.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),Wme.delete(t.target)),0===Wme.size)){for(const e of Yme)e();Yme.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=Wme.get(t.target);n||(n=new Set,Wme.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function Qme(e,t){const n=Zme(e,t,"left"),r=Zme(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 Zme(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?Xme():document.addEventListener("DOMContentLoaded",Xme));var Jme={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 ege(e){return t=>(e(t),()=>e(void 0))}function tge(e,t){const[n,r]=it(nge(t?.()));return lt((()=>{r(e()?.tagName.toLowerCase()||nge(t?.()))})),n}function nge(e){return xme(e)?e:void 0}function rge(e){const[t,n]=qt(e,["as"]);if(!t.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return Ut(Nn,Ht(n,{get component(){return t.as}}))}var oge=["id","name","validationState","required","disabled","readOnly"];var ige=bt();function age(){const e=wt(ige);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function sge(e){const t=age(),n=Kme({id:t.generateId("description")},e);return lt((()=>ht(t.registerDescription(n.id)))),Ut(rge,Ht({as:"div"},(()=>t.dataset()),n))}function lge(e){const t=age(),n=Kme({id:t.generateId("error-message")},e),[r,o]=qt(n,["forceMount"]),i=()=>"invalid"===t.validationState();return lt((()=>{i()&&ht(t.registerErrorMessage(o.id))})),Ut(Zt,{get when(){return r.forceMount||i()},get children(){return Ut(rge,Ht({as:"div"},(()=>t.dataset()),o))}})}function cge(e){let t;const n=age(),r=Kme({id:n.generateId("label")},e),[o,i]=qt(r,["ref"]),a=tge((()=>t),(()=>"label"));return lt((()=>ht(n.registerLabel(i.id)))),Ut(rge,Ht({as:"label",ref(e){const n=ome((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ct((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function uge(e,t){lt(pt(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}),ht((()=>{n.removeEventListener("reset",t)})))})))}function dge(e){const[t,n]=it(e.defaultValue?.()),r=ct((()=>void 0!==e.value?.())),o=ct((()=>r()?e.value?.():t()));return[o,t=>{dt((()=>{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 pge(e){const[t,n]=dge(e);return[()=>t()??!1,n]}var fge=Object.defineProperty,hge=(e,t)=>{for(var n in t)fge(e,n,{get:t[n],enumerable:!0})},mge=bt();function gge(){return wt(mge)}function vge(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function yge(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?vge(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 bge(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){lt((()=>{const n=setTimeout((()=>{yge(e(),t)}));ht((()=>clearTimeout(n)))}))}(e,t);let n=[];lt((()=>{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 Tme(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&yge(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}ht((()=>o.disconnect()))}))}function wge(e={}){const[t,n]=function(e){const[t,n]=dge(e);return[()=>t()??[],n]}({value:()=>dhe(e.items),onChange:t=>e.onItemsChange?.(t)});bge(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&&vge(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=>Ut(mge.Provider,{value:{registerItem:r},get children(){return e.children}})}}function xge(e){const t=function(){const e=gge();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=Kme({shouldRegisterItem:!0},e);lt((()=>{if(!n.shouldRegisterItem)return;ht(t.registerItem(n.getItem()))}))}function _ge(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=xme(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=xme(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(xme(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return xme(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(xme(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=_ge({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 Sge(e,t=[]){return ct((()=>{const n=_ge({dataSource:dhe(e.dataSource),getKey:dhe(e.getKey),getTextValue:dhe(e.getTextValue),getDisabled:dhe(e.getDisabled),getSectionChildren:dhe(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var Ege=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Tge=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Cge(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return Ege.has(t)}const t=e.split("-")[0];return Tge.has(t)}(e)?"rtl":"ltr"}function Age(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Cge(e)}}var Rge=Age(),Oge=new Set;function Nge(){Rge=Age();for(const e of Oge)e(Rge)}var Pge=bt();function kge(){const e=function(){const[e,t]=it(Rge),n=ct((()=>e()));return ft((()=>{0===Oge.size&&window.addEventListener("languagechange",Nge),Oge.add(t),ht((()=>{Oge.delete(t),0===Oge.size&&window.removeEventListener("languagechange",Nge)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return wt(Pge)||e}var Lge=new Map;var Dge=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 Mge(e){return Ome()||Nme()?e.altKey:e.ctrlKey}function jge(e){return Ome()?e.metaKey:e.ctrlKey}function Ige(e){return new Dge(e)}function Fge(e){const t=Kme({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=it(!1),[o,i]=it(),a=ct((()=>{const e=dhe(t.selectedKeys);return null!=e?Ige(e):e})),s=ct((()=>{const e=dhe(t.defaultSelectedKeys);return null!=e?Ige(e):new Dge})),[l,c]=function(e){const[t,n]=dge(e);return[()=>t()??new Dge,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=it(dhe(t.selectionBehavior));return lt((()=>{const e=l();"replace"===dhe(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),lt((()=>{d(dhe(t.selectionBehavior)??"toggle")})),{selectionMode:()=>dhe(t.selectionMode),disallowEmptySelection:()=>dhe(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!dhe(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 Uge(e,t,n){const r=Ht({selectOnFocus:()=>"replace"===dhe(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=kge();let a={top:0,left:0};mme((()=>dhe(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]=it(""),[r,o]=it(-1);return{typeSelectHandlers:{onKeyDown:i=>{if(dhe(e.isDisabled))return;const a=dhe(e.keyboardDelegate),s=dhe(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:()=>dhe(r.disallowTypeAhead),keyboardDelegate:()=>dhe(r.keyboardDelegate),selectionManager:()=>dhe(r.selectionManager)}),l=()=>dhe(r.orientation)??"vertical",c=()=>{const e=dhe(r.autoFocus);if(!e)return;const n=dhe(r.selectionManager),o=dhe(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&&!dhe(r.shouldUseVirtualFocus)&&Dme(s)};ft((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),lt(pt([o,()=>dhe(r.isVirtualized),()=>dhe(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&&Qme(t,e)}})));return{tabIndex:ct((()=>{if(!dhe(r.shouldUseVirtualFocus))return null==dhe(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{Pme(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=dhe(r.selectionManager),a=dhe(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!Mge(e)&&o.replaceSelection(t))},u=dhe(r.keyboardDelegate),d=dhe(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,jge(e));null!=t&&(o.setFocusedKey(t),jge(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,jge(e));null!=t&&(o.setFocusedKey(t),jge(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":jge(e)&&"multiple"===o.selectionMode()&&!0!==dhe(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),dhe(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!dhe(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?Ume:Fme,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&zme(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)&&Dme(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=dhe(r.selectionManager),n=dhe(r.keyboardDelegate),i=dhe(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(!dhe(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(Dme(n),Qme(e,n))}}},onFocusOut:e=>{const t=dhe(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function $ge(e,t){const n=()=>dhe(e.selectionManager),r=()=>dhe(e.key),o=()=>dhe(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()||jge(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>dhe(e.disabled)||n().isDisabled(r()),s=()=>!a()&&n().canSelectItem(r());let l=null;const c=ct((()=>{if(!o()&&!a())return r()===n().focusedKey()?0:-1})),u=ct((()=>dhe(e.virtualized)?void 0:r()));return lt(pt([t,r,o,()=>n().focusedKey(),()=>n().isFocused()],(([t,n,r,o,i])=>{t&&n===o&&i&&!r&&document.activeElement!==t&&(e.focus?e.focus():Dme(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||dhe(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&dhe(e.shouldSelectOnPressUp)&&dhe(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(dhe(e.shouldSelectOnPressUp)&&!dhe(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(Mge(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 Vge=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 Dge(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 Dge(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 Dge([t],t,t):new Dge;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new Dge;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 Dge)}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}},Bge=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 zge,Hge=e=>"function"==typeof e?e():e,qge=e=>{const t=ct((()=>{const t=Hge(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=it(Hge(e.show)?"present":"hidden");let i="none";return lt((r=>{const a=Hge(e.show);return dt((()=>{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})),lt((()=>{const t=Hge(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),ht((()=>{t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}))})),{present:()=>"present"===r()||"hiding"===r(),state:r}},Gge="data-kb-top-layer",Kge=!1,Wge=[];function Yge(e){return Wge.findIndex((t=>t.node===e))}function Xge(){return Wge.filter((e=>e.isPointerBlocking))}function Qge(){return Xge().length>0}function Zge(e){const t=Yge([...Xge()].slice(-1)[0]?.node);return Yge(e)<t}var Jge={layers:Wge,isTopMostLayer:function(e){return Wge[Wge.length-1].node===e},hasPointerBlockingLayer:Qge,isBelowPointerBlockingLayer:Zge,addLayer:function(e){Wge.push(e)},removeLayer:function(e){const t=Yge(e);t<0||Wge.splice(t,1)},indexOf:Yge,find:function(e){return Wge[Yge(e)]},assignPointerEventToLayers:function(){for(const{node:e}of Wge)e.style.pointerEvents=Zge(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(Qge()&&!Kge){const t=Tme(e);zge=document.body.style.pointerEvents,t.body.style.pointerEvents="none",Kge=!0}},restoreBodyPointerEvents:function(e){if(Qge())return;const t=Tme(e);t.body.style.pointerEvents=zge,0===t.body.style.length&&t.body.removeAttribute("style"),Kge=!1}};hge({},{Button:()=>nve,Root:()=>tve});var eve=["button","color","file","image","reset","submit"];function tve(e){let t;const n=Kme({type:"button"},e),[r,o]=qt(n,["ref","type","disabled"]),i=tge((()=>t),(()=>"button")),a=ct((()=>{const e=i();return null!=e&&function(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==eve.indexOf(e.type)}({tagName:e,type:r.type})})),s=ct((()=>"input"===i())),l=ct((()=>"a"===i()&&null!=t?.getAttribute("href")));return Ut(rge,Ht({as:"button",ref(e){const n=ome((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 nve=tve,rve=["top","right","bottom","left"],ove=Math.min,ive=Math.max,ave=Math.round,sve=Math.floor,lve=e=>({x:e,y:e}),cve={left:"right",right:"left",bottom:"top",top:"bottom"},uve={start:"end",end:"start"};function dve(e,t,n){return ive(e,ove(t,n))}function pve(e,t){return"function"==typeof e?e(t):e}function fve(e){return e.split("-")[0]}function hve(e){return e.split("-")[1]}function mve(e){return"x"===e?"y":"x"}function gve(e){return"y"===e?"height":"width"}function vve(e){return["top","bottom"].includes(fve(e))?"y":"x"}function yve(e){return mve(vve(e))}function bve(e){return e.replace(/start|end/g,(e=>uve[e]))}function wve(e){return e.replace(/left|right|bottom|top/g,(e=>cve[e]))}function xve(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 _ve(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 Sve(e,t,n){let{reference:r,floating:o}=e;const i=vve(t),a=yve(t),s=gve(a),l=fve(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(hve(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function Eve(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}=pve(t,e),h=xve(f),m=s[p?"floating"===d?"reference":"floating":d],g=_ve(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},w=_ve(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-w.top+h.top)/b.y,bottom:(w.bottom-g.bottom+h.bottom)/b.y,left:(g.left-w.left+h.left)/b.x,right:(w.right-g.right+h.right)/b.x}}function Tve(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cve(e){return rve.some((t=>e[t]>=0))}function Ave(e){return Nve(e)?(e.nodeName||"").toLowerCase():"#document"}function Rve(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ove(e){var t;return null==(t=(Nve(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Nve(e){return e instanceof Node||e instanceof Rve(e).Node}function Pve(e){return e instanceof Element||e instanceof Rve(e).Element}function kve(e){return e instanceof HTMLElement||e instanceof Rve(e).HTMLElement}function Lve(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Rve(e).ShadowRoot)}function Dve(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Mve(e){return["table","td","th"].includes(Ave(e))}function jve(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(R_e){return!1}}))}function Ive(e){const t=Fve(),n=Pve(e)?$ve(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 Fve(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Uve(e){return["html","body","#document"].includes(Ave(e))}function $ve(e){return Rve(e).getComputedStyle(e)}function Vve(e){return Pve(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bve(e){if("html"===Ave(e))return e;const t=e.assignedSlot||e.parentNode||Lve(e)&&e.host||Ove(e);return Lve(t)?t.host:t}function zve(e){const t=Bve(e);return Uve(t)?e.ownerDocument?e.ownerDocument.body:e.body:kve(t)&&Dve(t)?t:zve(t)}function Hve(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=zve(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Rve(o);return i?t.concat(a,a.visualViewport||[],Dve(o)?o:[],a.frameElement&&n?Hve(a.frameElement):[]):t.concat(o,Hve(o,[],n))}function qve(e){const t=$ve(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=kve(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=ave(n)!==i||ave(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function Gve(e){return Pve(e)?e:e.contextElement}function Kve(e){const t=Gve(e);if(!kve(t))return lve(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=qve(t);let a=(i?ave(n.width):n.width)/r,s=(i?ave(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var Wve=lve(0);function Yve(e){const t=Rve(e);return Fve()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Wve}function Xve(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Gve(e);let a=lve(1);t&&(r?Pve(r)&&(a=Kve(r)):a=Kve(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Rve(e))&&t}(i,n,r)?Yve(i):lve(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=Rve(i),t=r&&Pve(r)?Rve(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=Kve(o),t=o.getBoundingClientRect(),r=$ve(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=Rve(o),o=n.frameElement}}return _ve({width:u,height:d,x:l,y:c})}function Qve(e){return Xve(Ove(e)).left+Vve(e).scrollLeft}function Zve(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Rve(e),r=Ove(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=Fve();(!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=Ove(e),n=Vve(e),r=e.ownerDocument.body,o=ive(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ive(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Qve(e);const s=-n.scrollTop;return"rtl"===$ve(r).direction&&(a+=ive(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Ove(e));else if(Pve(t))r=function(e,t){const n=Xve(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=kve(e)?Kve(e):lve(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=Yve(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return _ve(r)}function Jve(e,t){const n=Bve(e);return!(n===t||!Pve(n)||Uve(n))&&("fixed"===$ve(n).position||Jve(n,t))}function eye(e,t,n){const r=kve(t),o=Ove(t),i="fixed"===n,a=Xve(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=lve(0);if(r||!r&&!i)if(("body"!==Ave(t)||Dve(o))&&(s=Vve(t)),r){const e=Xve(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=Qve(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function tye(e){return"static"===$ve(e).position}function nye(e,t){return kve(e)&&"fixed"!==$ve(e).position?t?t(e):e.offsetParent:null}function rye(e,t){const n=Rve(e);if(jve(e))return n;if(!kve(e)){let t=Bve(e);for(;t&&!Uve(t);){if(Pve(t)&&!tye(t))return t;t=Bve(t)}return n}let r=nye(e,t);for(;r&&Mve(r)&&tye(r);)r=nye(r,t);return r&&Uve(r)&&tye(r)&&!Ive(r)?n:r||function(e){let t=Bve(e);for(;kve(t)&&!Uve(t);){if(Ive(t))return t;if(jve(t))return null;t=Bve(t)}return null}(e)||n}var oye={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ove(r),s=!!t&&jve(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=lve(1);const u=lve(0),d=kve(r);if((d||!d&&!i)&&(("body"!==Ave(r)||Dve(a))&&(l=Vve(r)),kve(r))){const e=Xve(r);c=Kve(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:Ove,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?jve(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Hve(e,[],!1).filter((e=>Pve(e)&&"body"!==Ave(e))),o=null;const i="fixed"===$ve(e).position;let a=i?Bve(e):e;for(;Pve(a)&&!Uve(a);){const t=$ve(a),n=Ive(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Dve(a)&&!n&&Jve(e,a))?r=r.filter((e=>e!==a)):o=t,a=Bve(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=Zve(t,n,o);return e.top=ive(r.top,e.top),e.right=ove(r.right,e.right),e.bottom=ove(r.bottom,e.bottom),e.left=ive(r.left,e.left),e}),Zve(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:rye,getElementRects:async function(e){const t=this.getOffsetParent||rye,n=this.getDimensions,r=await n(e.floating);return{reference:eye(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}=qve(e);return{width:t,height:n}},getScale:Kve,isElement:Pve,isRTL:function(e){return"rtl"===$ve(e).direction}};function iye(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=Gve(e),u=o||i?[...c?Hve(c):[],...Hve(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=Ove(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:-sve(u)+"px "+-sve(o.clientWidth-(c+d))+"px "+-sve(o.clientHeight-(u+p))+"px "+-sve(c)+"px",threshold:ive(0,ove(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(R_e){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?Xve(e):null;return l&&function t(){const r=Xve(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 aye=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=fve(n),s=hve(n),l="y"===vve(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=pve(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}}}}},sye=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}=pve(e,t),c={x:n,y:r},u=await Eve(t,l),d=vve(fve(o)),p=mve(d);let f=c[p],h=c[d];if(i){f=dve(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=dve(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}}}}},lye=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}=pve(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=fve(o),y=vve(s),b=fve(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=p||(b||!m?[wve(s)]:function(e){const t=wve(e);return[bve(e),t,bve(t)]}(s)),_="none"!==h;!p&&_&&x.push(...function(e,t,n,r){const o=hve(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[]}}(fve(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(bve)))),i}(s,m,h,w));const S=[s,...x],E=await Eve(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=hve(e),o=yve(e),i=gve(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=wve(a)),[a,wve(a)]}(o,a,w);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,R;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==(R=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:R.placement;if(!n)switch(f){case"bestFit":{var O;const e=null==(O=C.filter((e=>{if(_){const t=vve(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:O[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},cye=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}=pve(e,t),l=await Eve(t,s),c=fve(n),u=hve(n),d="y"===vve(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=ove(f-l[h],g),b=ove(p-l[m],v),w=!t.middlewareData.shift;let x=y,_=b;if(d?_=u||w?ove(b,v):v:x=u||w?ove(y,g):g,w&&!u){const e=ive(l.left,0),t=ive(l.right,0),n=ive(l.top,0),r=ive(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:ive(l.left,l.right)):x=f-2*(0!==n||0!==r?n+r:ive(l.top,l.bottom))}await a({...t,availableWidth:_,availableHeight:x});const S=await o.getDimensions(i.floating);return p!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},uye=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=pve(e,t);switch(r){case"referenceHidden":{const e=Tve(await Eve(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Cve(e)}}}case"escaped":{const e=Tve(await Eve(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Cve(e)}}}default:return{}}}}},dye=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}=pve(e,t)||{};if(null==c)return{};const d=xve(u),p={x:n,y:r},f=yve(o),h=gve(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=i.reference[h]+i.reference[f]-p[f]-i.floating[h],x=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=w/2-x/2,T=S/2-m[h]/2-1,C=ove(d[v],T),A=ove(d[y],T),R=C,O=S-m[h]-A,N=S/2-m[h]/2+E,P=dve(R,N,O),k=!l.arrow&&null!=hve(o)&&N!==P&&i.reference[h]/2-(N<R?C:A)-m[h]/2<0,L=k?N<R?N-R:N-O:0;return{[f]:p[f]+L,data:{[f]:P,centerOffset:N-P-L,...k&&{alignmentOffset:L}},reset:k}}}),pye=(e,t,n)=>{const r={platform:oye,...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}=Sve(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}=Sve(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},fye=bt();function hye(){const e=wt(fye);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var mye=dn('<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">'),gye={top:180,right:-90,bottom:0,left:90};function vye(e){const t=hye(),n=Kme({size:30},e),[r,o]=qt(n,["ref","style","size"]),i=()=>t.currentPlacement().split("-")[0],a=function(e){const[t,n]=it();return lt((()=>{const t=e();var r;t&&n((r=t,Tme(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return Ut(rge,Ht({as:"div",ref(e){const n=ome(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return bme({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=mye(),t=e.firstChild;return st((()=>fn(t,"transform",`rotate(${gye[i()]} 15 15) translate(0 2)`))),e}}))}function yye(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 bye(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var wye={top:"bottom",right:"left",bottom:"top",left:"right"};var xye=Object.assign((function(e){const t=Kme({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]=it(),[o,i]=it(),[a,s]=it(t.placement),l=()=>{return e=t.anchorRef?.(),n=t.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const t=n(e);return t?yye(t):e?e.getBoundingClientRect():yye()}};var e,n},{direction:c}=kge();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=[aye((({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(bye))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(lye({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(sye({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(cye({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(uye({padding:t.detachedPadding})),i&&d.push(dye({element:i,padding:t.arrowPadding}));const p=await pye(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...oye,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=wye[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 lt((()=>{const e=l(),t=n();if(!e||!t)return;ht(iye(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),lt((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),Ut(fye.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:vye,Context:fye,usePopperContext:hye,Positioner:function(e){const t=hye(),[n,r]=qt(e,["ref","style"]);return Ut(rge,Ht({as:"div",ref(e){const r=ome(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return bme({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var _ye="interactOutside.pointerDownOutside",Sye="interactOutside.focusOutside";var Eye=bt();function Tye(e){let t;const n=wt(Eye),[r,o]=qt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=Gme;const o=()=>Tme(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(`[${Gge}]`)&&!!Sme(o(),r)&&!Sme(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=kme([i,s]);r.addEventListener(_ye,o,{once:!0});const a=new CustomEvent(_ye,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||Lme(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=kme([a,s]);r.addEventListener(Sye,o,{once:!0});const i=new CustomEvent(Sye,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};lt((()=>{dhe(e.isDisabled)||(n=window.setTimeout((()=>{o().addEventListener("pointerdown",c,!0)}),0),o().addEventListener("focusin",u,!0),ht((()=>{window.clearTimeout(n),o().removeEventListener("click",r),o().removeEventListener("pointerdown",c,!0),o().removeEventListener("focusin",u,!0)})))}))}({shouldExcludeElement:e=>!!t&&(r.excludedElements?.some((t=>Sme(t(),e)))||[...i].some((t=>Sme(t,e)))),onPointerDownOutside:e=>{t&&!Jge.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||Jge.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===Ame.Escape&&e.onEscapeKeyDown?.(t)};lt((()=>{if(dhe(e.isDisabled))return;const n=e.ownerDocument?.()??Tme();n.addEventListener("keydown",t),ht((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Tme(t),onEscapeKeyDown:e=>{t&&Jge.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),ft((()=>{if(!t)return;Jge.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);Jge.assignPointerEventToLayers(),Jge.disableBodyPointerEvents(t),ht((()=>{t&&(Jge.removeLayer(t),e?.(),Jge.assignPointerEventToLayers(),Jge.restoreBodyPointerEvents(t))}))})),lt(pt([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=Jge.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,Jge.assignPointerEventToLayers()),t&&Jge.disableBodyPointerEvents(e),ht((()=>{Jge.restoreBodyPointerEvents(e)}))}),{defer:!0}));return Ut(Eye.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return Ut(rge,Ht({as:"div",ref(e){const n=ome((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Cye(e={}){const[t,n]=pge({value:()=>dhe(e.open),defaultValue:()=>!!dhe(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 Aye={};hge(Aye,{Description:()=>sge,ErrorMessage:()=>lge,Item:()=>kye,ItemControl:()=>Lye,ItemDescription:()=>Dye,ItemIndicator:()=>Mye,ItemInput:()=>jye,ItemLabel:()=>Iye,Label:()=>Fye,RadioGroup:()=>$ye,Root:()=>Uye});var Rye=bt();function Oye(){const e=wt(Rye);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var Nye=bt();function Pye(){const e=wt(Nye);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function kye(e){const t=age(),n=Oye(),r=Kme({id:`${t.generateId("item")}-${Wt()}`},e),[o,i]=qt(r,["value","disabled","onPointerDown"]),[a,s]=it(),[l,c]=it(),[u,d]=it(),[p,f]=it(),[h,m]=it(!1),g=ct((()=>n.isSelectedValue(o.value))),v=ct((()=>o.disabled||t.isDisabled()||!1)),y=e=>{Pme(e,o.onPointerDown),h()&&e.preventDefault()},b=ct((()=>({...t.dataset(),"data-disabled":v()?"":void 0,"data-checked":g()?"":void 0}))),w={value:()=>o.value,dataset:b,isSelected:g,isDisabled:v,inputId:a,labelId:l,descriptionId:u,inputRef:p,select:()=>n.setSelectedValue(o.value),generateId:_me((()=>i.id)),registerInput:ege(s),registerLabel:ege(c),registerDescription:ege(d),setIsFocused:m,setInputRef:f};return Ut(Nye.Provider,{value:w,get children(){return Ut(rge,Ht({as:"div",role:"group",onPointerDown:y},b,i))}})}function Lye(e){const t=Pye(),n=Kme({id:t.generateId("control")},e),[r,o]=qt(n,["onClick","onKeyDown"]);return Ut(rge,Ht({as:"div",onClick:e=>{Pme(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{Pme(e,r.onKeyDown),e.key===Ame.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function Dye(e){const t=Pye(),n=Kme({id:t.generateId("description")},e);return lt((()=>ht(t.registerDescription(n.id)))),Ut(rge,Ht({as:"div"},(()=>t.dataset()),n))}function Mye(e){const t=Pye(),n=Kme({id:t.generateId("indicator")},e),[r,o]=qt(n,["ref","forceMount"]),[i,a]=it(),{present:s}=qge({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return Ut(Zt,{get when(){return s()},get children(){return Ut(rge,Ht({as:"div",ref(e){const t=ome(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function jye(e){const t=age(),n=Oye(),r=Pye(),o=Kme({id:r.generateId("input")},e),[i,a]=qt(o,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=it(!1);return lt(pt([()=>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})),lt((()=>ht(r.registerInput(a.id)))),Ut(rge,Ht({as:"input",ref(e){const t=ome(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 bme({...Jme},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(Pme(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{Pme(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{Pme(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function Iye(e){const t=Pye(),n=Kme({id:t.generateId("label")},e);return lt((()=>ht(t.registerLabel(n.id)))),Ut(rge,Ht({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function Fye(e){return Ut(cge,Ht({as:"span"},e))}function Uye(e){let t;const n=Kme({id:`radiogroup-${Wt()}`,orientation:"vertical"},e),[r,o,i]=qt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],oge),[a,s]=dge({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=Kme({id:`form-control-${Wt()}`},e),[n,r]=it(),[o,i]=it(),[a,s]=it(),[l,c]=it();return{formControlContext:{name:()=>dhe(t.name)??dhe(t.id),dataset:ct((()=>({"data-valid":"valid"===dhe(t.validationState)?"":void 0,"data-invalid":"invalid"===dhe(t.validationState)?"":void 0,"data-required":dhe(t.required)?"":void 0,"data-disabled":dhe(t.disabled)?"":void 0,"data-readonly":dhe(t.readOnly)?"":void 0}))),validationState:()=>dhe(t.validationState),isRequired:()=>dhe(t.required),isDisabled:()=>dhe(t.disabled),isReadOnly:()=>dhe(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:_me((()=>dhe(t.id))),registerLabel:ege(r),registerField:ege(i),registerDescription:ege(s),registerErrorMessage:ege(c)}}}(o);uge((()=>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 Ut(ige.Provider,{value:l,get children(){return Ut(Rye.Provider,{value:d,get children(){return Ut(rge,Ht({as:"div",ref(e){const n=ome((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return dhe(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(dhe(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var $ye=Object.assign(Uye,{Description:sge,ErrorMessage:lge,Item:kye,ItemControl:Lye,ItemDescription:Dye,ItemIndicator:Mye,ItemInput:jye,ItemLabel:Iye,Label:Fye}),Vye=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 Bye(e,t,n){const r=function(e){const{locale:t}=kge(),n=ct((()=>t()+(e?Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1)).join():"")));return ct((()=>{const r=n();let o;return Lge.has(r)&&(o=Lge.get(r)),o||(o=new Intl.Collator(t(),e),Lge.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return Uge({selectionManager:()=>dhe(e.selectionManager),keyboardDelegate:ct((()=>{const n=dhe(e.keyboardDelegate);return n||new Vye(e.collection,t,r)})),autoFocus:()=>dhe(e.autoFocus),deferAutoFocus:()=>dhe(e.deferAutoFocus),shouldFocusWrap:()=>dhe(e.shouldFocusWrap),disallowEmptySelection:()=>dhe(e.disallowEmptySelection),selectOnFocus:()=>dhe(e.selectOnFocus),disallowTypeAhead:()=>dhe(e.disallowTypeAhead),shouldUseVirtualFocus:()=>dhe(e.shouldUseVirtualFocus),allowsTabNavigation:()=>dhe(e.allowsTabNavigation),isVirtualized:()=>dhe(e.isVirtualized),scrollToKey:t=>dhe(e.scrollToKey)?.(t),orientation:()=>dhe(e.orientation)},t)}var zye="focusScope.autoFocusOnMount",Hye="focusScope.autoFocusOnUnmount",qye={bubbles:!1,cancelable:!0},Gye={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=wme(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=wme(this.stack,e),this.active()?.resume()}};function Kye(e,t){const[n,r]=it(!1),o={pause(){r(!0)},resume(){r(!1)}};let i=null;const a=t=>e.onMountAutoFocus?.(t),s=t=>e.onUnmountAutoFocus?.(t),l=()=>Tme(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,Jme),e},u=()=>{const e=t();return e?$me(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=u();return e.length>0?e[0]:null};lt((()=>{const e=t();if(!e)return;Gye.add(o);const n=Eme(e);if(!Sme(e,n)){const t=new CustomEvent(zye,qye);e.addEventListener(zye,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{Dme(d()),Eme(e)===n&&Dme(e)}),0)}ht((()=>{e.removeEventListener(zye,a),setTimeout((()=>{const r=new CustomEvent(Hye,qye);(()=>{const e=t();if(!e)return!1;const n=Eme(e);return!!n&&!Sme(e,n)&&Bme(n)})()&&r.preventDefault(),e.addEventListener(Hye,s),e.dispatchEvent(r),r.defaultPrevented||Dme(n??l().body),e.removeEventListener(Hye,s),Gye.remove(o)}),0)}))})),lt((()=>{const r=t();if(!r||!dhe(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${Gge}]`)||(Sme(r,t)?i=t:Dme(i))},a=e=>{const t=e.relatedTarget??Eme(r);t?.closest(`[${Gge}]`)||Sme(r,t)||Dme(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),ht((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),lt((()=>{const r=t();if(!r||!dhe(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})();Dme(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}),ht((()=>{o.removeEventListener("focusin",a),i.removeEventListener("focusin",a),o.remove(),i.remove(),s.disconnect()}))}))}var Wye="data-live-announcer";function Yye(e){lt((()=>{dhe(e.isDisabled)||ht(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${Wye}], [${Gge}]`))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=Xye.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),Xye.set(e,t+1))};Qye.length&&Qye[Qye.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 Qye.push(s),()=>{a.disconnect();for(const e of r){const t=Xye.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),Xye.delete(e)):Xye.set(e,t-1)}s===Qye[Qye.length-1]?(Qye.pop(),Qye.length&&Qye[Qye.length-1].observe()):Qye.splice(Qye.indexOf(s),1)}}(dhe(e.targets),dhe(e.root)))}))}var Xye=new WeakMap,Qye=[];var Zye=new Map,Jye=e=>{lt((()=>{const t=Hge(e.style)??{},n=Hge(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=Zye.get(e.key);o?o.activeCount++:Zye.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);ht((()=>{const t=Zye.get(e.key);if(t)if(1===t.activeCount){Zye.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--}))}))},ebe=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},tbe=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[nbe,rbe]=it([]),obe=e=>[e.deltaX,e.deltaY],ibe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],abe=(e,t,n,r)=>{const o=null!==r&&sbe(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]=ebe(o,t),u=c-e-r*l;0===l&&0===u||!tbe(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)},sbe=(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},lbe=e=>{const t=Ht({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=Wt();let r=[0,0],o=null,i=null;lt((()=>{Hge(t.enabled)&&(rbe((e=>[...e,n])),ht((()=>{rbe((e=>e.filter((e=>e!==n))))})))})),lt((()=>{if(!Hge(t.enabled)||!Hge(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(Hge(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===Hge(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;Jye({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{Hge(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else Jye({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),lt((()=>{var e;(e=n,nbe().indexOf(e)===nbe().length-1&&Hge(t.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",a,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),ht((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",a),document.removeEventListener("touchmove",l)})))}));const a=e=>{r=ibe(e),o=null,i=null},s=e=>{const n=e.target,r=Hge(t.element),o=obe(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=abe(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!sbe(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=Hge(t.element),a=e.target;let s;if(2===e.touches.length)s=!Hge(t.allowPinchZoom);else{if(null==o||null===i){const t=ibe(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=abe(a,o,i,n);s=!n||!sbe(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},cbe=bt();function ube(){return wt(cbe)}function dbe(){const e=ube();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var pbe=bt();function fbe(){const e=wt(pbe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var hbe=bt();function mbe(){const e=wt(hbe);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function gbe(e){let t;const n=mbe(),r=dbe(),o=Kme({id:n.generateId(`item-${Wt()}`)},e),[i,a]=qt(o,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=it(),[c,u]=it(),[d,p]=it(),f=()=>r.listState().selectionManager(),h=()=>a.id,m=()=>{i.onSelect?.(),i.closeOnSelect&&setTimeout((()=>{r.close(!0)}))};xge({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=$ge({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{Pme(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(Dme(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{Pme(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{Pme(e,i.onPointerUp),i.disabled||0!==e.button||m()},w=e=>{if(Pme(e,i.onKeyDown),!e.repeat&&!i.disabled)switch(e.key){case"Enter":case" ":m()}},x=ct((()=>i.indeterminate?"mixed":null!=i.checked?i.checked:void 0)),_=ct((()=>({"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:_me((()=>a.id)),registerLabel:ege(l),registerDescription:ege(u)};return Ut(pbe.Provider,{value:S,get children(){return Ut(rge,Ht({as:"div",ref(e){const n=ome((e=>t=e),i.ref);"function"==typeof n&&n(e)},get tabIndex(){return g.tabIndex()},get"aria-checked"(){return x()},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 kme([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return kme([b,g.onPointerUp])},get onClick(){return kme([i.onClick,g.onClick])},get onKeyDown(){return kme([w,g.onKeyDown])},get onMouseDown(){return kme([i.onMouseDown,g.onMouseDown])},get onFocus(){return kme([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function vbe(e){const t=Kme({closeOnSelect:!1},e),[n,r]=qt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=pge({value:()=>dhe(e.isSelected),defaultValue:()=>!!dhe(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{dhe(e.isReadOnly)||dhe(e.isDisabled)||n(t)},toggle:()=>{dhe(e.isReadOnly)||dhe(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return Ut(gbe,Ht({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var ybe=bt();function bbe(){return wt(ybe)}var wbe={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>wbe.next("ltr"===e?"rtl":"ltr",t)},xbe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",_be=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function Sbe(e){const t=mbe(),n=dbe(),r=bbe(),{direction:o}=kge(),i=Kme({id:t.generateId("trigger")},e),[a,s]=qt(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=tge((()=>n.triggerRef()),(()=>"button")),u=ct((()=>"a"===c()&&null!=n.triggerRef()?.getAttribute("href")));lt(pt((()=>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 lt((()=>ht(n.registerTriggerId(a.id)))),Ut(tve,Ht({ref(e){const t=ome(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 ct((()=>!!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=>{Pme(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{Pme(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{Pme(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if(Pme(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case xbe(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=Hme(e);for(;e&&n&&e!==t&&n!==t;)Qme(n,e),n=Hme(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 _be(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case wbe.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case wbe.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{Pme(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 Ebe=bt();function Tbe(){return wt(Ebe)}function Cbe(e){let t;const n=mbe(),r=dbe(),o=bbe(),i=Tbe(),{direction:a}=kge(),s=Kme({id:n.generateId(`content-${Wt()}`)},e),[l,c]=qt(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=Bye({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));Kye({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()};lt((()=>ht(r.registerContentId(l.id))));const m={ref:ome((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:kme([l.onKeyDown,p.onKeyDown,e=>{if(Sme(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case wbe.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case wbe.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:kme([l.onMouseDown,p.onMouseDown]),onFocusIn:kme([l.onFocusIn,p.onFocusIn]),onFocusOut:kme([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{Pme(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if(Pme(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;Sme(e.currentTarget,e.target)&&t&&(r.setPointerDir(e.clientX>u?"right":"left"),u=e.clientX)},get"data-orientation"(){return n.orientation()}};return Ut(Zt,{get when(){return r.contentPresent()},get children(){return Ut(Zt,{get when(){return void 0===i||null!=r.parentMenuContext()},get fallback(){return Ut(rge,Ht({as:"div"},(()=>r.dataset()),m,c))},get children(){return Ut(xye.Positioner,{get children(){return Ut(Tye,Ht({get disableOutsidePointerEvents(){return ct((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return bme({"--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 Abe(e){let t;const n=mbe(),r=dbe(),[o,i]=qt(e,["ref"]);return lbe({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),Ut(Cbe,Ht({ref(e){const n=ome((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var Rbe=bt();function Obe(e){const t=Kme({id:mbe().generateId(`group-${Wt()}`)},e),[n,r]=it(),o={generateId:_me((()=>t.id)),registerLabelId:ege(r)};return Ut(Rbe.Provider,{value:o,get children(){return Ut(rge,Ht({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function Nbe(e){const t=function(){const e=wt(Rbe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=Kme({id:t.generateId("label")},e),[r,o]=qt(n,["id"]);return lt((()=>ht(t.registerLabelId(r.id)))),Ut(rge,Ht({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function Pbe(e){const t=dbe();return Ut(rge,Ht({as:"span","aria-hidden":"true"},(()=>t.dataset()),Kme({children:"▼"},e)))}function kbe(e){return Ut(gbe,Ht({role:"menuitem",closeOnSelect:!0},e))}function Lbe(e){const t=fbe(),n=Kme({id:t.generateId("description")},e),[r,o]=qt(n,["id"]);return lt((()=>ht(t.registerDescription(r.id)))),Ut(rge,Ht({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function Dbe(e){const t=fbe(),n=Kme({id:t.generateId("indicator")},e),[r,o]=qt(n,["forceMount"]);return Ut(Zt,{get when(){return r.forceMount||t.isChecked()},get children(){return Ut(rge,Ht({as:"div"},(()=>t.dataset()),o))}})}function Mbe(e){const t=fbe(),n=Kme({id:t.generateId("label")},e),[r,o]=qt(n,["ref","id"]);return lt((()=>ht(t.registerLabel(r.id)))),Ut(rge,Ht({as:"div",ref(e){const n=ome(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function jbe(e){const t=dbe();return Ut(Zt,{get when(){return t.contentPresent()},get children(){return Ut(On,e)}})}var Ibe=bt();function Fbe(e){const t=Kme({id:mbe().generateId(`radiogroup-${Wt()}`)},e),[n,r]=qt(t,["value","defaultValue","onChange","disabled"]),[o,i]=dge({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return Ut(Ibe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return Ut(Obe,r)}})}function Ube(e){const t=function(){const e=wt(Ibe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=Kme({closeOnSelect:!1},e),[r,o]=qt(n,["value","onSelect"]);return Ut(gbe,Ht({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function $be(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 Vbe(e){const t=mbe(),n=gge(),r=ube(),o=bbe(),i=Tbe(),a=Kme({placement:"horizontal"===t.orientation()?"bottom-start":"right-start"},e),[s,l]=qt(a,["open","defaultOpen","onOpenChange"]);let c=0,u=null,d="right";const[p,f]=it(),[h,m]=it(),[g,v]=it(),[y,b]=it(),[w,x]=it(!0),[_,S]=it(l.placement),[E,T]=it([]),[C,A]=it([]),{DomCollectionProvider:R}=wge({items:C,onItemsChange:A}),O=Cye({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:N}=qge({show:()=>t.forceMount()||O.isOpen(),element:()=>y()??null}),P=function(e){const t=Fge(e),n=Sge({dataSource:()=>dhe(e.dataSource),getKey:()=>dhe(e.getKey),getTextValue:()=>dhe(e.getTextValue),getDisabled:()=>dhe(e.getDisabled),getSectionChildren:()=>dhe(e.getSectionChildren),factory:t=>new Bge(e.filter?e.filter(t):t)},[()=>e.filter]),r=new Vge(n,t);return at((()=>{const e=t.focusedKey();null==e||n().getItem(e)||t.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>r}}({selectionMode:"none",dataSource:C}),k=e=>{x(e),O.open()},L=(e=!1)=>{O.close(),e&&r&&r.close(!0)},D=()=>{const e=y();e&&(Dme(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},M=()=>{null!=i?setTimeout((()=>D())):D()},j=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};Yye({isDisabled:()=>!(null==r&&O.isOpen()&&t.isModal()),targets:()=>[y(),...E()].filter(Boolean)}),lt((()=>{const e=y();if(!e||!r)return;const t=r.registerNestedMenu(e);ht((()=>{t()}))})),lt((()=>{void 0===r&&o?.registerMenu(t.value(),[y(),...E()])})),lt((()=>{void 0===r&&void 0!==o&&(o.value()===t.value()?(g()?.focus(),o.autoFocusMenu()&&k(!0)):L())})),lt((()=>{void 0===r&&void 0!==o&&O.isOpen()&&o.setValue(t.value())})),ht((()=>{void 0===r&&o?.unregisterMenu(t.value())}));const I={dataset:ct((()=>({"data-expanded":O.isOpen()?"":void 0,"data-closed":O.isOpen()?void 0:""}))),isOpen:O.isOpen,contentPresent:N,nestedMenus:E,currentPlacement:_,pointerGraceTimeoutId:()=>c,autoFocus:w,listState:()=>P,parentMenuContext:()=>r,triggerRef:g,contentRef:y,triggerId:p,contentId:h,setTriggerRef:v,setContentRef:b,open:k,close:L,toggle:e=>{x(e),O.toggle()},focusContent:M,onItemEnter:e=>{j(e)&&e.preventDefault()},onItemLeave:e=>{j(e)||M()},onTriggerLeave:e=>{j(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=>wme(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:ege(f),registerContentId:ege(m)};return Ut(R,{get children(){return Ut(cbe.Provider,{value:I,get children(){return Ut(Zt,{when:void 0===i,get fallback(){return l.children},get children(){return Ut(xye,Ht({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function Bbe(e){const{direction:t}=kge();return Ut(Vbe,Ht({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var zbe=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function Hbe(e){const t=dbe(),n=mbe(),[r,o]=qt(e,["onFocusOutside","onKeyDown"]),{direction:i}=kge();return Ut(Cbe,Ht({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;Sme(t.triggerRef(),n)||t.close()},onKeyDown:e=>{Pme(e,r.onKeyDown);const o=Sme(e.currentTarget,e.target),a=zbe(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),Dme(t.triggerRef()))}},o))}var qbe=["Enter"," "],Gbe=(e,t)=>"ltr"===e?[...qbe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...qbe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function Kbe(e){let t;const n=mbe(),r=dbe(),o=Kme({id:n.generateId(`sub-trigger-${Wt()}`)},e),[i,a]=qt(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}=kge(),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=$ge({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{Pme(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{Pme(e,i.onKeyDown),e.repeat||i.disabled||Gbe(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 lt((()=>{if(null==r.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");ht(r.registerItemToParentDomCollection({ref:()=>t,type:"item",key:u(),textValue:i.textValue??t?.textContent??"",disabled:i.disabled??!1}))})),lt(pt((()=>r.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{ht((()=>{window.clearTimeout(e),r.parentMenuContext()?.setPointerGraceIntent(null)}))}))),lt((()=>ht(r.registerTriggerId(i.id)))),ht((()=>{l()})),Ut(rge,Ht({as:"div",ref(e){const n=ome((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 ct((()=>!!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 kme([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return kme([i.onPointerUp,p.onPointerUp])},get onClick(){return kme([f,p.onClick])},get onKeyDown(){return kme([h,p.onKeyDown])},get onMouseDown(){return kme([i.onMouseDown,p.onMouseDown])},get onFocus(){return kme([i.onFocus,p.onFocus])},onPointerMove:e=>{if(Pme(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)),Dme(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if(Pme(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:$be(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 Wbe(e){const t=bbe(),n=Kme({id:`menu-${Wt()}`,modal:!0},e),[r,o]=qt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Cye({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:_me((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return Ut(hbe.Provider,{value:a,get children(){return Ut(Vbe,Ht({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function Ybe(e){let t;const n=Kme({orientation:"horizontal"},e),[r,o]=qt(n,["ref","orientation"]),i=tge((()=>t),(()=>"hr"));return Ut(rge,Ht({as:"hr",ref(e){const n=ome((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))}hge({},{Root:()=>Ybe,Separator:()=>Xbe});var Xbe=Ybe,Qbe={};function Zbe(e){const t=mbe(),n=dbe(),[r,o]=qt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return Ut(Abe,Ht({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||Dme(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function Jbe(e){return Ut(Wbe,Kme({id:`dropdownmenu-${Wt()}`},e))}hge(Qbe,{Arrow:()=>vye,CheckboxItem:()=>vbe,Content:()=>Zbe,DropdownMenu:()=>ewe,Group:()=>Obe,GroupLabel:()=>Nbe,Icon:()=>Pbe,Item:()=>kbe,ItemDescription:()=>Lbe,ItemIndicator:()=>Dbe,ItemLabel:()=>Mbe,Portal:()=>jbe,RadioGroup:()=>Fbe,RadioItem:()=>Ube,Root:()=>Jbe,Separator:()=>Ybe,Sub:()=>Bbe,SubContent:()=>Hbe,SubTrigger:()=>Kbe,Trigger:()=>Sbe});var ewe=Object.assign(Jbe,{Arrow:vye,CheckboxItem:vbe,Content:Zbe,Group:Obe,GroupLabel:Nbe,Icon:Pbe,Item:kbe,ItemDescription:Lbe,ItemIndicator:Dbe,ItemLabel:Mbe,Portal:jbe,RadioGroup:Fbe,RadioItem:Ube,Separator:Ybe,Sub:Bbe,SubContent:Hbe,SubTrigger:Kbe,Trigger:Sbe}),twe={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"}},nwe=dn('<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>'),rwe=dn('<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>'),owe=dn('<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>'),iwe=dn('<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>'),awe=dn('<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>'),swe=dn('<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>'),lwe=dn('<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>'),cwe=dn('<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>'),uwe=dn('<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=dn('<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">'),pwe=dn('<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=dn('<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>'),hwe=dn('<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>'),mwe=dn('<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>'),gwe=dn('<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>'),vwe=dn('<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>'),ywe=dn('<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>'),bwe=dn('<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>'),wwe=dn('<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>'),xwe=dn('<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>'),_we=dn('<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>'),Swe=dn('<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>'),Ewe=dn('<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 Twe(){return nwe()}function Cwe(){return rwe()}function Awe(){return owe()}function Rwe(){return iwe()}function Owe(){return awe()}function Nwe(){return(e=awe()).style.setProperty("transform","rotate(90deg)"),e;var e}function Pwe(){return(e=awe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function kwe(){return swe()}function Lwe(){return lwe()}function Dwe(){return cwe()}function Mwe(){return uwe()}function jwe(){return dwe()}function Iwe(){return pwe()}function Fwe(){return fwe()}function Uwe(){return hwe()}function $we(){return mwe()}function Vwe(e){return t=gwe(),n=t.firstChild,st((()=>fn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function Bwe(){return vwe()}function zwe(){return ywe()}function Hwe(e){return[Ut(Zt,{get when(){return e.checked},get children(){var t=gwe(),n=t.firstChild;return st((()=>fn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}}),Ut(Zt,{get when(){return!e.checked},get children(){var t=bwe(),n=t.firstChild;return st((()=>fn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function qwe(){return wwe()}function Gwe(){return xwe()}function Kwe(){return _we()}function Wwe(){return Swe()}function Ywe(){const e=Wt();return t=Ewe(),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,w=(b=(y=g.nextSibling).nextSibling).firstChild,_=(x=b.nextSibling).firstChild,T=(E=(S=x.nextSibling).nextSibling).firstChild,A=(C=E.nextSibling).firstChild,N=(O=(R=C.nextSibling).nextSibling).firstChild,k=(P=O.nextSibling).firstChild,M=(D=(L=P.nextSibling).nextSibling).firstChild,I=(j=D.nextSibling).firstChild,$=(U=(F=j.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Z=(Q=(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,Me=(De=(Le=(ke=(Pe=(Ne=(Oe=(Re=(Ae=(Ce=(Te=(Ee=(Se=(_e=(xe=(we=(be=(ye=(ve=me.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,fn(n,"id",`a-${e}`),fn(r,"fill",`url(#a-${e})`),fn(i,"id",`am-${e}`),fn(a,"id",`b-${e}`),fn(s,"filter",`url(#am-${e})`),fn(l,"mask",`url(#b-${e})`),fn(u,"id",`ah-${e}`),fn(d,"id",`k-${e}`),fn(p,"filter",`url(#ah-${e})`),fn(f,"mask",`url(#k-${e})`),fn(m,"id",`ae-${e}`),fn(g,"id",`j-${e}`),fn(v,"filter",`url(#ae-${e})`),fn(y,"mask",`url(#j-${e})`),fn(w,"id",`ai-${e}`),fn(x,"id",`i-${e}`),fn(_,"filter",`url(#ai-${e})`),fn(S,"mask",`url(#i-${e})`),fn(T,"id",`aj-${e}`),fn(C,"id",`h-${e}`),fn(A,"filter",`url(#aj-${e})`),fn(R,"mask",`url(#h-${e})`),fn(N,"id",`ag-${e}`),fn(P,"id",`g-${e}`),fn(k,"filter",`url(#ag-${e})`),fn(L,"mask",`url(#g-${e})`),fn(M,"id",`af-${e}`),fn(j,"id",`f-${e}`),fn(I,"filter",`url(#af-${e})`),fn(F,"mask",`url(#f-${e})`),fn(U,"id",`m-${e}`),fn($,"fill",`url(#m-${e})`),fn(B,"id",`ak-${e}`),fn(z,"id",`e-${e}`),fn(H,"filter",`url(#ak-${e})`),fn(q,"mask",`url(#e-${e})`),fn(G,"id",`n-${e}`),fn(K,"fill",`url(#n-${e})`),fn(W,"id",`r-${e}`),fn(Y,"fill",`url(#r-${e})`),fn(X,"id",`s-${e}`),fn(Q,"fill",`url(#s-${e})`),fn(Z,"id",`q-${e}`),fn(J,"fill",`url(#q-${e})`),fn(ee,"id",`p-${e}`),fn(te,"fill",`url(#p-${e})`),fn(ne,"id",`o-${e}`),fn(re,"fill",`url(#o-${e})`),fn(oe,"id",`l-${e}`),fn(ie,"fill",`url(#l-${e})`),fn(se,"id",`al-${e}`),fn(le,"id",`d-${e}`),fn(ce,"filter",`url(#al-${e})`),fn(ue,"mask",`url(#d-${e})`),fn(de,"id",`u-${e}`),fn(pe,"fill",`url(#u-${e})`),fn(he,"id",`ad-${e}`),fn(me,"id",`c-${e}`),fn(ge,"filter",`url(#ad-${e})`),fn(ve,"mask",`url(#c-${e})`),fn(ye,"id",`t-${e}`),fn(be,"fill",`url(#t-${e})`),fn(we,"id",`v-${e}`),fn(xe,"stroke",`url(#v-${e})`),fn(_e,"id",`aa-${e}`),fn(Se,"stroke",`url(#aa-${e})`),fn(Ee,"id",`w-${e}`),fn(Te,"stroke",`url(#w-${e})`),fn(Ce,"id",`ac-${e}`),fn(Ae,"stroke",`url(#ac-${e})`),fn(Re,"id",`ab-${e}`),fn(Oe,"stroke",`url(#ab-${e})`),fn(Ne,"id",`y-${e}`),fn(Pe,"stroke",`url(#y-${e})`),fn(ke,"id",`x-${e}`),fn(Le,"stroke",`url(#x-${e})`),fn(De,"id",`z-${e}`),fn(Me,"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,w,x,_,S,E,T,C,A,R,O,N,P,k,L,D,M,j,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Q,Z,J,ee,te,ne,re,oe,ie,ae,se,le,ce,ue,de,pe,fe,he,me,ge,ve,ye,be,we,xe,_e,Se,Ee,Te,Ce,Ae,Re,Oe,Ne,Pe,ke,Le,De,Me}var Xwe=dn('<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>'),Qwe=dn('<button title="Copy object to clipboard">'),Zwe=dn('<button title="Remove all items"aria-label="Remove all items">'),Jwe=dn('<button title="Delete item"aria-label="Delete item">'),exe=dn('<button title="Toggle value"aria-label="Toggle value">'),txe=dn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),nxe=dn("<div>"),rxe=dn("<div><button> <span></span> <span> "),oxe=dn("<input>"),ixe=dn("<span>"),axe=dn("<div><span>:"),sxe=dn("<div><div><button> [<!>...<!>]");var lxe=e=>{const t=Ohe(),n=Ehe().shadowDOMTarget?eme.bind({target:Ehe().shadowDOMTarget}):eme,r=ct((()=>"dark"===t()?vxe(n):gxe(n)));return o=Xwe(),st((()=>hn(o,nme(r().expander,n`
93
+ */n7.exports="production"===process.env.NODE_ENV?function(){if(t7)return r7;t7=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 r7.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:s,r7}():(o7||(o7=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};i7.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())}()),i7);var a7=n7.exports,s7='[cmdk-group=""]',l7='[cmdk-group-items=""]',c7='[cmdk-item=""]',u7=`${c7}:not([aria-disabled="true"])`,d7="cmdk-item-select",p7="data-value",f7=(e,t,n)=>e7(e,t,n),h7=i.createContext(void 0),m7=()=>i.useContext(h7),g7=i.createContext(void 0),v7=()=>i.useContext(g7),y7=i.createContext(void 0),b7=i.forwardRef(((e,t)=>{let n=L7((()=>{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=L7((()=>new Set)),o=L7((()=>new Map)),a=L7((()=>new Map)),s=L7((()=>new Set)),l=P7(e),{label:c,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=sZ(),w=sZ(),x=sZ(),_=i.useRef(null),S=I7();k7((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,E.emit()}}),[d]),k7((()=>{S(6,N)}),[]);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)O(),A(),S(1,R);else if("value"===e&&(r||S(5,N),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,(()=>{O(),A(),n.current.value||R(),E.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();S(4,(()=>{O(),(null==t?void 0:t.getAttribute("id"))===e&&R(),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:x,labelId:w,listInnerRef:_})),[]);function C(e,t){var r,o;let i=null!=(o=null==(r=l.current)?void 0:r.filter)?o:f7;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(l7);t?t.appendChild(e.parentElement===t?e:e.closest(`${l7} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${l7} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{var t;let n=null==(t=_.current)?void 0:t.querySelector(`${s7}[${p7}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function R(){let e=k().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(p7);E.setState("value",t||void 0)}function O(){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 N(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(s7))?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(`${c7}[aria-selected="true"]`)}function k(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(u7))||[])}function L(e){let t=k()[e];t&&E.setState("value",t.getAttribute(p7))}function D(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(p7))}function M(e){let t,n=P(),r=null==n?void 0:n.closest(s7);for(;r&&!t;)r=e>0?O7(r,s7):N7(r,s7),t=null==r?void 0:r.querySelector(u7);t?E.setState("value",t.getAttribute(p7)):D(e)}let j=()=>L(k().length-1),I=e=>{e.preventDefault(),e.metaKey?j():e.altKey?M(1):D(1)},F=e=>{e.preventDefault(),e.metaKey?L(0):e.altKey?M(-1):D(-1)};return i.createElement(GQ.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(),L(0);break;case"End":e.preventDefault(),j();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=P();if(t){let e=new Event(d7);t.dispatchEvent(e)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:U7},c),F7(e,(e=>i.createElement(g7.Provider,{value:E},i.createElement(h7.Provider,{value:T},e)))))})),w7=i.forwardRef(((e,t)=>{var n,r;let o=sZ(),a=i.useRef(null),s=i.useContext(y7),l=m7(),c=P7(e),u=null!=(r=null==(n=c.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;k7((()=>{if(!u)return l.item(o,null==s?void 0:s.id)}),[u]);let d=j7(o,a,[e.value,e.children,a],e.keywords),p=v7(),f=M7((e=>e.value&&e.value===d.current)),h=M7((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(d7,m),()=>t.removeEventListener(d7,m)}),[h,e.onSelect,e.disabled]),!h)return null;let{disabled:v,value:y,onSelect:b,forceMount:w,keywords:x,..._}=e;return i.createElement(GQ.div,{ref:D7([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)})),x7=i.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,s=sZ(),l=i.useRef(null),c=i.useRef(null),u=sZ(),d=m7(),p=M7((e=>!(!o&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));k7((()=>d.group(s)),[]),j7(s,l,[e.value,e.heading,c]);let f=i.useMemo((()=>({id:s,forceMount:o})),[o]);return i.createElement(GQ.div,{ref:D7([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),F7(e,(e=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},i.createElement(y7.Provider,{value:f},e)))))})),_7=i.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=i.useRef(null),a=M7((e=>!e.search));return n||a?i.createElement(GQ.div,{ref:D7([o,t]),...r,"cmdk-separator":"",role:"separator"}):null})),S7=i.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=v7(),s=M7((e=>e.search)),l=M7((e=>e.value)),c=m7(),u=i.useMemo((()=>{var e;let t=null==(e=c.listInnerRef.current)?void 0:e.querySelector(`${c7}[${p7}="${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(GQ.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)}})})),E7=i.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=i.useRef(null),s=i.useRef(null),l=m7();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(GQ.div,{ref:D7([a,t]),...o,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},F7(e,(e=>i.createElement("div",{ref:D7([s,l.listInnerRef]),"cmdk-list-sizer":""},e))))})),T7=i.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:s,...l}=e;return i.createElement(pB,{open:n,onOpenChange:r},i.createElement(fB,{container:s},i.createElement(hB,{"cmdk-overlay":"",className:o}),i.createElement(mB,{"aria-label":e.label,"cmdk-dialog":"",className:a},i.createElement(b7,{ref:t,...l}))))})),C7=i.forwardRef(((e,t)=>M7((e=>0===e.filtered.count))?i.createElement(GQ.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),A7=i.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return i.createElement(GQ.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},F7(e,(e=>i.createElement("div",{"aria-hidden":!0},e))))})),R7=Object.assign(b7,{List:E7,Item:w7,Input:S7,Group:x7,Separator:_7,Dialog:T7,Empty:C7,Loading:A7});function O7(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function N7(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function P7(e){let t=i.useRef(e);return k7((()=>{t.current=e})),t}var k7="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function L7(e){let t=i.useRef();return void 0===t.current&&(t.current=e()),t}function D7(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function M7(e){let t=v7(),n=()=>e(t.snapshot());return a7.useSyncExternalStore(t.subscribe,n,n)}function j7(e,t,n,r=[]){let o=i.useRef(),a=m7();return k7((()=>{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(p7,s),o.current=s})),o}var I7=()=>{let[e,t]=i.useState(),n=L7((()=>new Map));return k7((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function F7({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 U7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const $7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7,{ref:r,className:Yd("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})));$7.displayName=R7.displayName;const V7=i.forwardRef((({className:e,searchIcon:n,...r},o)=>t.jsxs("div",{className:"flex items-center border-b px-3",children:[n||t.jsx($u,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),t.jsx(R7.Input,{ref:o,className:Yd("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})]})));V7.displayName=R7.Input.displayName;const B7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7.List,{ref:r,className:Yd("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n})));B7.displayName=R7.List.displayName;const z7=i.forwardRef(((e,n)=>t.jsx(R7.Empty,{ref:n,className:"py-6 text-center text-sm",...e})));z7.displayName=R7.Empty.displayName;const H7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7.Group,{ref:r,className:Yd("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})));H7.displayName=R7.Group.displayName;const q7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7.Separator,{ref:r,className:Yd("-mx-1 h-px bg-border",e),...n})));q7.displayName=R7.Separator.displayName;const G7=i.forwardRef((({className:e,...n},r)=>t.jsx(R7.Item,{ref:r,className:Yd("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})));G7.displayName=R7.Item.displayName;const K7=({options:e,value:n,onChange:r,placeholder:o})=>{const[a,s]=i.useState(!1);return t.jsxs(d8,{modal:!0,open:a,onOpenChange:s,children:[t.jsx(p8,{asChild:!0,children:t.jsxs(VX,{"aria-expanded":a,className:"w-[200px] overflow-hidden justify-between",variant:"outline",children:[n?e.find((e=>e.value===n))?.label:o,t.jsx(gu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(f8,{className:"w-[200px] p-0",children:t.jsxs($7,{children:[t.jsx(V7,{placeholder:`${o}...`}),t.jsxs(B7,{children:[t.jsxs(z7,{children:["No ",o.toLowerCase()," found."]}),t.jsx(H7,{children:e.map((e=>t.jsxs(G7,{value:e.value,onSelect:e=>{r(e===n?"":e),s(!1)},children:[t.jsx(du,{className:Yd("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var W7=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find(Q7);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(Y7,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(Y7,{...o,ref:n,children:r})}));W7.displayName="Slot";var Y7=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?KU(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));Y7.displayName="SlotClone";var X7=({children:e})=>t.jsx(t.Fragment,{children:e});function Q7(e){return i.isValidElement(e)&&e.type===X7}var Z7=["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?W7: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}}),{}),J7="horizontal",eee=["horizontal","vertical"],tee=i.forwardRef(((e,n)=>{const{decorative:r,orientation:o=J7,...i}=e,a=function(e){return eee.includes(e)}(o)?o:J7;return t.jsx(Z7.div,{"data-orientation":a,...r?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...i,ref:n})}));tee.displayName="Separator";var nee=tee;const ree=i.forwardRef((({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>t.jsx(nee,{ref:i,decorative:r,orientation:n,className:Yd("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",e),...o})));ree.displayName=nee.displayName;const oee=nu("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"}}),iee=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($u,{className:"h-4 w-4 mr-2"}),selectedValues:m,setSelectedValues:g,...v},y)=>{const[b,w]=i.useState(!1),[x,_]=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(d8,{open:b,onOpenChange:w,modal:l,children:[t.jsx(p8,{asChild:!0,children:t.jsx("button",{type:"button",ref:y,...v,onClick:()=>{w((e=>!e))},className:Yd("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(n1,{className:Yd(x?"animate-bounce":"",oee({variant:r})),style:{animationDuration:`${a}s`},children:[i&&t.jsx(i,{className:"h-4 w-4 mr-2"}),o?.label,t.jsx(bu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),S(n)}})]},n)})),m.length>s&&t.jsxs(n1,{className:Yd("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",x?"animate-bounce":"",oee({variant:r})),style:{animationDuration:`${a}s`},children:[`+ ${m.length-s} more`,t.jsx(bu,{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(td,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:e=>{e.stopPropagation(),E()}}),t.jsx(ree,{orientation:"vertical",className:"flex min-h-6 h-full"}),t.jsx(pu,{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(pu,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),t.jsx(f8,{className:"w-auto p-0 z-[1000]",align:"start",onEscapeKeyDown:()=>w(!1),children:t.jsxs($7,{children:[t.jsx(V7,{searchIcon:h,placeholder:d,onKeyDown:e=>{if("Enter"===e.key)w(!0),p&&(p(e.currentTarget.value),w(!1));else if("Backspace"===e.key&&!e.currentTarget.value){const e=[...m];e.pop(),g(e),n(e)}}}),t.jsxs(B7,{children:[t.jsx(z7,{children:f}),t.jsxs(H7,{children:[t.jsxs(G7,{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:Yd("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(du,{className:"h-4 w-4"})}),t.jsx("span",{children:"(Select All)"})]},"all"),e.map((e=>{const n=m.includes(e.value);return t.jsxs(G7,{onSelect:()=>S(e.value),className:"cursor-pointer",children:[t.jsx("div",{className:Yd("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(du,{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(q7,{}),t.jsx(H7,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[m.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(G7,{onSelect:E,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),t.jsx(ree,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),t.jsx(G7,{onSelect:()=>w(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"}),u&&u.map((e=>e(w)))]})})]})]})}),a>0&&m.length>0&&t.jsx(ed,{className:Yd("cursor-pointer my-2 text-foreground bg-background w-3 h-3",x?"":"text-muted-foreground"),onClick:()=>_(!x)})]})}));function aee(e,[t,n]){return Math.min(n,Math.max(t,e))}function see(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function lee(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},cee(o,...n)]}function cee(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function uee(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function dee(...e){return t=>{let n=!1;const r=e.map((e=>{const r=uee(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():uee(e[t],null)}}}}function pee(...e){return i.useCallback(dee(...e),e)}function fee(e){const n=hee(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(gee);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function hee(e){const t=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?dee(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}iee.displayName="MultiSelect";var mee=Symbol("radix.slottable");function gee(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===mee}var vee=i.createContext(void 0);var yee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=fee(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{});function bee(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}var wee,xee="dismissableLayer.update",_ee="dismissableLayer.pointerDownOutside",See="dismissableLayer.focusOutside",Eee=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Tee=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(Eee),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=pee(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),w=p?v.indexOf(p):-1,x=d.layersWithOutsidePointerEventsDisabled.size>0,_=w>=b,S=function(e,t=globalThis?.document){const n=bee(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Aee(_ee,n,i,{discrete:!0})};const i={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",o.current),o.current=r,t.addEventListener("click",o.current,{once:!0})):r()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout((()=>{t.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",e),t.removeEventListener("click",o.current)}}),[t,n]),{onPointerDownCapture:()=>r.current=!0}}((e=>{const t=e.target,n=[...d.branches].some((e=>e.contains(t)));_&&!n&&(a?.(e),l?.(e),e.defaultPrevented||c?.())}),h),E=function(e,t=globalThis?.document){const n=bee(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){Aee(See,n,{originalEvent:e},{discrete:!1})}};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)}),[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}((e=>{const t=e.target;[...d.branches].some((e=>e.contains(t)))||(s?.(e),l?.(e),e.defaultPrevented||c?.())}),h);return function(e,t=globalThis?.document){const n=bee(e);i.useEffect((()=>{const e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})}),[n,t])}((e=>{w===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(wee=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),Cee(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=wee)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),Cee())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(xee,e),()=>document.removeEventListener(xee,e)}),[]),t.jsx(yee.div,{...u,ref:g,style:{pointerEvents:x?_?"auto":"none":void 0,...e.style},onFocusCapture:see(e.onFocusCapture,E.onFocusCapture),onBlurCapture:see(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:see(e.onPointerDownCapture,S.onPointerDownCapture)})}));Tee.displayName="DismissableLayer";function Cee(){const e=new CustomEvent(xee);document.dispatchEvent(e)}function Aee(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?function(e,t){e&&a.flushSync((()=>e.dispatchEvent(t)))}(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(Eee),o=i.useRef(null),a=pee(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(yee.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var Ree=0;function Oee(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Nee="focusScope.autoFocusOnMount",Pee="focusScope.autoFocusOnUnmount",kee={bubbles:!1,cancelable:!0},Lee=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=bee(a),p=bee(s),f=i.useRef(null),h=pee(n,(e=>u(e))),m=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect((()=>{if(o){let e=function(e){if(m.paused||!c)return;const t=e.target;c.contains(t)?f.current=t:Iee(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Iee(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Iee(c)};document.addEventListener("focusin",e),document.addEventListener("focusout",t);const r=new MutationObserver(n);return c&&r.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}}),[o,c,m.paused]),i.useEffect((()=>{if(c){Fee.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(Nee,kee);c.addEventListener(Nee,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Iee(r,{select:t}),document.activeElement!==n)return}((e=Dee(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Iee(c))}return()=>{c.removeEventListener(Nee,d),setTimeout((()=>{const e=new CustomEvent(Pee,kee);c.addEventListener(Pee,p),c.dispatchEvent(e),e.defaultPrevented||Iee(t??document.body,{select:!0}),c.removeEventListener(Pee,p),Fee.remove(m)}),0)}}var e}),[c,d,p,m]);const g=i.useCallback((e=>{if(!r&&!o)return;if(m.paused)return;const t=document.activeElement;if("Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&t){const n=e.currentTarget,[o,i]=function(e){const t=Dee(e),n=Mee(t,e),r=Mee(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&Iee(i,{select:!0})):(e.preventDefault(),r&&Iee(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(yee.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function Dee(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.disabled||e.hidden||"INPUT"===e.tagName&&"hidden"===e.type?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}function Mee(e,t){for(const n of e)if(!jee(n,{upTo:t}))return n}function jee(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function Iee(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&t&&e.select()}}Lee.displayName="FocusScope";var Fee=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Uee(e,t),e.unshift(t)},remove(t){e=Uee(e,t),e[0]?.resume()}}}();function Uee(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var $ee=globalThis?.document?i.useLayoutEffect:()=>{},Vee=i[" useId ".trim().toString()]||(()=>{}),Bee=0;function zee(e){const[t,n]=i.useState(Vee());return $ee((()=>{n((e=>e??String(Bee++)))}),[e]),e||(t?`radix-${t}`:"")}var Hee=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(yee.svg,{...a,ref:n,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:t.jsx("polygon",{points:"0,0 30,0 15,10"})})}));Hee.displayName="Arrow";var qee=Hee;var Gee="Popper",[Kee,Wee]=lee(Gee),[Yee,Xee]=Kee(Gee),Qee=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(Yee,{scope:n,anchor:o,onAnchorChange:a,children:r})};Qee.displayName=Gee;var Zee="PopperAnchor",Jee=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=Xee(Zee,r),l=i.useRef(null),c=pee(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(yee.div,{...a,ref:c})}));Jee.displayName=Zee;var ete="PopperContent",[tte,nte]=Kee(ete),rte=i.forwardRef(((e,n)=>{const{__scopePopper:r,side:o="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:g,...v}=e,y=Xee(ete,r),[b,w]=i.useState(null),x=pee(n,(e=>w(e))),[_,S]=i.useState(null),E=function(e){const[t,n]=i.useState(void 0);return $ee((()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let o,i;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,i=t.blockSize}else o=e.offsetWidth,i=e.offsetHeight;n({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)}),[e]),t}(_),T=E?.width??0,C=E?.height??0,A=o+("center"!==s?"-"+s:""),R="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},O=Array.isArray(d)?d:[d],N=O.length>0,P={padding:R,boundary:O.filter(ste),altBoundary:N},{refs:k,floatingStyles:L,placement:D,isPositioned:M,middlewareData:j}=AJ({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>fJ(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[OJ({mainAxis:a+C,alignmentAxis:l}),u&&NJ({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?PJ():void 0,...P}),u&&kJ({...P}),LJ({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=t.reference,a=e.floating.style;a.setProperty("--radix-popper-available-width",`${n}px`),a.setProperty("--radix-popper-available-height",`${r}px`),a.setProperty("--radix-popper-anchor-width",`${o}px`),a.setProperty("--radix-popper-anchor-height",`${i}px`)}}),_&&MJ({element:_,padding:c}),lte({arrowWidth:T,arrowHeight:C}),h&&DJ({strategy:"referenceHidden",...P})]}),[I,F]=cte(D),U=bee(g);$ee((()=>{M&&U?.()}),[M,U]);const $=j.arrow?.x,V=j.arrow?.y,B=0!==j.arrow?.centerOffset,[z,H]=i.useState();return $ee((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:M?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[j.transformOrigin?.x,j.transformOrigin?.y].join(" "),...j.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(tte,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(yee.div,{"data-side":I,"data-align":F,...v,ref:x,style:{...v.style,animation:M?void 0:"none"}})})})}));rte.displayName=ete;var ote="PopperArrow",ite={top:"bottom",right:"left",bottom:"top",left:"right"},ate=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=nte(ote,r),a=ite[i.placedSide];return t.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:t.jsx(qee,{...o,ref:n,style:{...o.style,display:"block"}})})}));function ste(e){return null!==e}ate.displayName=ote;var lte=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=0!==o.arrow?.centerOffset,a=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,c]=cte(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(o.arrow?.x??0)+a/2,p=(o.arrow?.y??0)+s/2;let f="",h="";return"bottom"===l?(f=i?u:`${d}px`,h=-s+"px"):"top"===l?(f=i?u:`${d}px`,h=`${r.floating.height+s}px`):"right"===l?(f=-s+"px",h=i?u:`${p}px`):"left"===l&&(f=`${r.floating.width+s}px`,h=i?u:`${p}px`),{data:{x:f,y:h}}}});function cte(e){const[t,n="center"]=e.split("-");return[t,n]}var ute=Qee,dte=Jee,pte=rte,fte=ate,hte=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);$ee((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(yee.div,{...a,ref:n}),c):null}));hte.displayName="Portal";var mte=i[" useInsertionEffect ".trim().toString()]||$ee;function gte({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return mte((()=>{a.current=t}),[t]),i.useEffect((()=>{o.current!==n&&(a.current?.(n),o.current=n)}),[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=i.useRef(void 0!==e);i.useEffect((()=>{const e=t.current;if(e!==l){}t.current=l}),[l,r])}const u=i.useCallback((t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)}),[l,e,a,s]);return[c,u]}var vte=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});i.forwardRef(((e,n)=>t.jsx(yee.span,{...e,ref:n,style:{...vte,...e.style}}))).displayName="VisuallyHidden";var yte=[" ","Enter","ArrowUp","ArrowDown"],bte=[" ","Enter"],wte="Select",[xte,_te,Ste]=function(e){const r=e+"CollectionProvider",[o,i]=lee(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=fee(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=pee(n,s(c,r).collectionRef);return t.jsx(u,{ref:i,children:o})}));d.displayName=c;const p=e+"CollectionItemSlot",f="data-radix-collection-item",h=fee(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=pee(r,l),u=s(p,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(h,{[f]:"",ref:c,children:i})}));return m.displayName=p,[{Provider:l,Slot:d,ItemSlot:m},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(wte),[Ete,Tte]=lee(wte,[Ste,Wee]),Cte=Wee(),[Ate,Rte]=Ete(wte),[Ote,Nte]=Ete(wte),Pte=e=>{const{__scopeSelect:n,children:r,open:o,defaultOpen:a,onOpenChange:s,value:l,defaultValue:c,onValueChange:u,dir:d,name:p,autoComplete:f,disabled:h,required:m,form:g}=e,v=Cte(n),[y,b]=i.useState(null),[w,x]=i.useState(null),[_,S]=i.useState(!1),E=function(e){const t=i.useContext(vee);return e||t||"ltr"}(d),[T,C]=gte({prop:o,defaultProp:a??!1,onChange:s,caller:wte}),[A,R]=gte({prop:l,defaultProp:c,onChange:u,caller:wte}),O=i.useRef(null),N=!y||(g||!!y.closest("form")),[P,k]=i.useState(new Set),L=Array.from(P).map((e=>e.props.value)).join(";");return t.jsx(ute,{...v,children:t.jsxs(Ate,{required:m,scope:n,trigger:y,onTriggerChange:b,valueNode:w,onValueNodeChange:x,valueNodeHasChildren:_,onValueNodeHasChildrenChange:S,contentId:zee(),value:A,onValueChange:R,open:T,onOpenChange:C,dir:E,triggerPointerDownPosRef:O,disabled:h,children:[t.jsx(xte.Provider,{scope:n,children:t.jsx(Ote,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback((e=>{k((t=>new Set(t).add(e)))}),[]),onNativeOptionRemove:i.useCallback((e=>{k((t=>{const n=new Set(t);return n.delete(e),n}))}),[]),children:r})}),N?t.jsxs(vne,{"aria-hidden":!0,required:m,tabIndex:-1,name:p,autoComplete:f,value:A,onChange:e=>R(e.target.value),disabled:h,form:g,children:[void 0===A?t.jsx("option",{value:""}):null,Array.from(P)]},L):null]})})};Pte.displayName=wte;var kte="SelectTrigger",Lte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,disabled:o=!1,...a}=e,s=Cte(r),l=Rte(kte,r),c=l.disabled||o,u=pee(n,l.onTriggerChange),d=_te(r),p=i.useRef("touch"),[f,h,m]=bne((e=>{const t=d().filter((e=>!e.disabled)),n=t.find((e=>e.value===l.value)),r=wne(t,e,n);void 0!==r&&l.onValueChange(r.value)})),g=e=>{c||(l.onOpenChange(!0),m()),e&&(l.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return t.jsx(dte,{asChild:!0,...s,children:t.jsx(yee.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":yne(l.value)?"":void 0,...a,ref:u,onClick:see(a.onClick,(e=>{e.currentTarget.focus(),"mouse"!==p.current&&g(e)})),onPointerDown:see(a.onPointerDown,(e=>{p.current=e.pointerType;const t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(g(e),e.preventDefault())})),onKeyDown:see(a.onKeyDown,(e=>{const t=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||yte.includes(e.key)&&(g(),e.preventDefault())}))})})}));Lte.displayName=kte;var Dte="SelectValue",Mte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:i,children:a,placeholder:s="",...l}=e,c=Rte(Dte,r),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,p=pee(n,c.onValueNodeChange);return $ee((()=>{u(d)}),[u,d]),t.jsx(yee.span,{...l,ref:p,style:{pointerEvents:"none"},children:yne(c.value)?t.jsx(t.Fragment,{children:s}):a})}));Mte.displayName=Dte;var jte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,children:o,...i}=e;return t.jsx(yee.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})}));jte.displayName="SelectIcon";var Ite=e=>t.jsx(hte,{asChild:!0,...e});Ite.displayName="SelectPortal";var Fte="SelectContent",Ute=i.forwardRef(((e,n)=>{const r=Rte(Fte,e.__scopeSelect),[o,s]=i.useState();if($ee((()=>{s(new DocumentFragment)}),[]),!r.open){const n=o;return n?a.createPortal(t.jsx(Vte,{scope:e.__scopeSelect,children:t.jsx(xte.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(Hte,{...e,ref:n})}));Ute.displayName=Fte;var $te=10,[Vte,Bte]=Ete(Fte),zte=fee("SelectContent.RemoveScroll"),Hte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:l,side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,w=Rte(Fte,r),[x,_]=i.useState(null),[S,E]=i.useState(null),T=pee(n,(e=>_(e))),[C,A]=i.useState(null),[R,O]=i.useState(null),N=_te(r),[P,k]=i.useState(!1),L=i.useRef(!1);i.useEffect((()=>{if(x)return LV(x)}),[x]),i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Oee()),document.body.insertAdjacentElement("beforeend",e[1]??Oee()),Ree++,()=>{1===Ree&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),Ree--}}),[]);const D=i.useCallback((e=>{const[t,...n]=N().map((e=>e.ref.current)),[r]=n.slice(-1),o=document.activeElement;for(const i of e){if(i===o)return;if(i?.scrollIntoView({block:"nearest"}),i===t&&S&&(S.scrollTop=0),i===r&&S&&(S.scrollTop=S.scrollHeight),i?.focus(),document.activeElement!==o)return}}),[N,S]),M=i.useCallback((()=>D([C,x])),[D,C,x]);i.useEffect((()=>{P&&M()}),[P,M]);const{onOpenChange:j,triggerPointerDownPosRef:I}=w;i.useEffect((()=>{if(x){let e={x:0,y:0};const t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():x.contains(n.target)||j(!1),document.removeEventListener("pointermove",t),I.current=null};return null!==I.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}}),[x,j,I]),i.useEffect((()=>{const e=()=>j(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}}),[j]);const[F,U]=bne((e=>{const t=N().filter((e=>!e.disabled)),n=t.find((e=>e.ref.current===document.activeElement)),r=wne(t,e,n);r&&setTimeout((()=>r.ref.current.focus()))})),$=i.useCallback(((e,t,n)=>{const r=!L.current&&!n;(void 0!==w.value&&w.value===t||r)&&(A(e),r&&(L.current=!0))}),[w.value]),V=i.useCallback((()=>x?.focus()),[x]),B=i.useCallback(((e,t,n)=>{(void 0!==w.value&&w.value===t||!L.current&&!n)&&O(e)}),[w.value]),z="popper"===o?Gte:qte,H=z===Gte?{side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t.jsx(Vte,{scope:r,content:x,viewport:S,onViewportChange:E,itemRefCallback:$,selectedItem:C,onItemLeave:V,itemTextRefCallback:B,focusSelectedItem:M,selectedItemText:R,position:o,isPositioned:P,searchRef:F,children:t.jsx(CV,{as:zte,allowPinchZoom:!0,children:t.jsx(Lee,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:see(a,(e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()})),children:t.jsx(Tee,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:t.jsx(z,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:e=>e.preventDefault(),...b,...H,onPlaced:()=>k(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:see(b.onKeyDown,(e=>{const t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||U(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=N().filter((e=>!e.disabled)).map((e=>e.ref.current));if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const n=t.indexOf(e.target);t=t.slice(n+1)}setTimeout((()=>D(t))),e.preventDefault()}}))})})})})})}));Hte.displayName="SelectContentImpl";var qte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onPlaced:o,...a}=e,s=Rte(Fte,r),l=Bte(Fte,r),[c,u]=i.useState(null),[d,p]=i.useState(null),f=pee(n,(e=>p(e))),h=_te(r),m=i.useRef(!1),g=i.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:w}=l,x=i.useCallback((()=>{if(s.trigger&&s.valueNode&&c&&d&&v&&y&&b){const e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=s.valueNode.getBoundingClientRect(),r=b.getBoundingClientRect();if("rtl"!==s.dir){const o=n.left-(r.left-t.left),i=e.width+(e.left-o),a=Math.max(i,t.width),s=window.innerWidth-$te,l=aee(o,[$te,Math.max($te,s-a)]);c.style.minWidth=i+"px",c.style.left=l+"px"}else{const o=window.innerWidth-n.right-(t.right-r.right),i=window.innerWidth-e.right-o,a=e.width+i,s=Math.max(a,t.width),l=window.innerWidth-$te,u=aee(o,[$te,Math.max($te,l-s)]);c.style.minWidth=a+"px",c.style.right=u+"px"}const i=h(),a=window.innerHeight-2*$te,l=v.scrollHeight,u=window.getComputedStyle(d),p=parseInt(u.borderTopWidth,10),f=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),w=p+f+l+parseInt(u.paddingBottom,10)+g,x=Math.min(5*y.offsetHeight,w),_=window.getComputedStyle(v),S=parseInt(_.paddingTop,10),E=parseInt(_.paddingBottom,10),T=e.top+e.height/2-$te,C=a-T,A=y.offsetHeight/2,R=p+f+(y.offsetTop+A),O=w-R;if(R<=T){const e=i.length>0&&y===i[i.length-1].ref.current;c.style.bottom="0px";const t=Math.max(C,A+(e?E:0)+(d.clientHeight-v.offsetTop-v.offsetHeight)+g);c.style.height=R+t+"px"}else{const e=i.length>0&&y===i[0].ref.current;c.style.top="0px";const t=Math.max(T,p+v.offsetTop+(e?S:0)+A);c.style.height=t+O+"px",v.scrollTop=R-T+v.offsetTop}c.style.margin=`${$te}px 0`,c.style.minHeight=x+"px",c.style.maxHeight=a+"px",o?.(),requestAnimationFrame((()=>m.current=!0))}}),[h,s.trigger,s.valueNode,c,d,v,y,b,s.dir,o]);$ee((()=>x()),[x]);const[_,S]=i.useState();$ee((()=>{d&&S(window.getComputedStyle(d).zIndex)}),[d]);const E=i.useCallback((e=>{e&&!0===g.current&&(x(),w?.(),g.current=!1)}),[x,w]);return t.jsx(Kte,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:E,children:t.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:t.jsx(yee.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})}));qte.displayName="SelectItemAlignedPosition";var Gte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=$te,...a}=e,s=Cte(r);return t.jsx(pte,{...s,...a,ref:n,align:o,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})}));Gte.displayName="SelectPopperPosition";var[Kte,Wte]=Ete(Fte,{}),Yte="SelectViewport",Xte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,nonce:o,...a}=e,s=Bte(Yte,r),l=Wte(Yte,r),c=pee(n,s.onViewportChange),u=i.useRef(0);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),t.jsx(xte.Slot,{scope:r,children:t.jsx(yee.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:see(a.onScroll,(e=>{const t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=l;if(r?.current&&n){const e=Math.abs(u.current-t.scrollTop);if(e>0){const r=window.innerHeight-2*$te,o=parseFloat(n.style.minHeight),i=parseFloat(n.style.height),a=Math.max(o,i);if(a<r){const o=a+e,i=Math.min(r,o),s=o-i;n.style.height=i+"px","0px"===n.style.bottom&&(t.scrollTop=s>0?s:0,n.style.justifyContent="flex-end")}}}u.current=t.scrollTop}))})})]})}));Xte.displayName=Yte;var Qte="SelectGroup",[Zte,Jte]=Ete(Qte);i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=zee();return t.jsx(Zte,{scope:r,id:i,children:t.jsx(yee.div,{role:"group","aria-labelledby":i,...o,ref:n})})})).displayName=Qte;var ene="SelectLabel",tne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Jte(ene,r);return t.jsx(yee.div,{id:i.id,...o,ref:n})}));tne.displayName=ene;var nne="SelectItem",[rne,one]=Ete(nne),ine=i.forwardRef(((e,n)=>{const{__scopeSelect:r,value:o,disabled:a=!1,textValue:s,...l}=e,c=Rte(nne,r),u=Bte(nne,r),d=c.value===o,[p,f]=i.useState(s??""),[h,m]=i.useState(!1),g=pee(n,(e=>u.itemRefCallback?.(e,o,a))),v=zee(),y=i.useRef("touch"),b=()=>{a||(c.onValueChange(o),c.onOpenChange(!1))};if(""===o)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return t.jsx(rne,{scope:r,value:o,disabled:a,textId:v,isSelected:d,onItemTextChange:i.useCallback((e=>{f((t=>t||(e?.textContent??"").trim()))}),[]),children:t.jsx(xte.ItemSlot,{scope:r,value:o,disabled:a,textValue:p,children:t.jsx(yee.div,{role:"option","aria-labelledby":v,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:g,onFocus:see(l.onFocus,(()=>m(!0))),onBlur:see(l.onBlur,(()=>m(!1))),onClick:see(l.onClick,(()=>{"mouse"!==y.current&&b()})),onPointerUp:see(l.onPointerUp,(()=>{"mouse"===y.current&&b()})),onPointerDown:see(l.onPointerDown,(e=>{y.current=e.pointerType})),onPointerMove:see(l.onPointerMove,(e=>{y.current=e.pointerType,a?u.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})})),onPointerLeave:see(l.onPointerLeave,(e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()})),onKeyDown:see(l.onKeyDown,(e=>{""!==u.searchRef?.current&&" "===e.key||(bte.includes(e.key)&&b()," "===e.key&&e.preventDefault())}))})})})}));ine.displayName=nne;var ane="SelectItemText",sne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:s,...l}=e,c=Rte(ane,r),u=Bte(ane,r),d=one(ane,r),p=Nte(ane,r),[f,h]=i.useState(null),m=pee(n,(e=>h(e)),d.onItemTextChange,(e=>u.itemTextRefCallback?.(e,d.value,d.disabled))),g=f?.textContent,v=i.useMemo((()=>t.jsx("option",{value:d.value,disabled:d.disabled,children:g},d.value)),[d.disabled,d.value,g]),{onNativeOptionAdd:y,onNativeOptionRemove:b}=p;return $ee((()=>(y(v),()=>b(v))),[y,b,v]),t.jsxs(t.Fragment,{children:[t.jsx(yee.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})}));sne.displayName=ane;var lne="SelectItemIndicator",cne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return one(lne,r).isSelected?t.jsx(yee.span,{"aria-hidden":!0,...o,ref:n}):null}));cne.displayName=lne;var une="SelectScrollUpButton",dne=i.forwardRef(((e,n)=>{const r=Bte(une,e.__scopeSelect),o=Wte(une,e.__scopeSelect),[a,s]=i.useState(!1),l=pee(n,o.onScrollButtonChange);return $ee((()=>{if(r.viewport&&r.isPositioned){let e=function(){s(t.scrollTop>0)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}}),[r.viewport,r.isPositioned]),a?t.jsx(hne,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}));dne.displayName=une;var pne="SelectScrollDownButton",fne=i.forwardRef(((e,n)=>{const r=Bte(pne,e.__scopeSelect),o=Wte(pne,e.__scopeSelect),[a,s]=i.useState(!1),l=pee(n,o.onScrollButtonChange);return $ee((()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;s(n)};const t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}}),[r.viewport,r.isPositioned]),a?t.jsx(hne,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}));fne.displayName=pne;var hne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onAutoScroll:o,...a}=e,s=Bte("SelectScrollButton",r),l=i.useRef(null),c=_te(r),u=i.useCallback((()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)}),[]);return i.useEffect((()=>()=>u()),[u]),$ee((()=>{const e=c().find((e=>e.ref.current===document.activeElement));e?.ref.current?.scrollIntoView({block:"nearest"})}),[c]),t.jsx(yee.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:see(a.onPointerDown,(()=>{null===l.current&&(l.current=window.setInterval(o,50))})),onPointerMove:see(a.onPointerMove,(()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(o,50))})),onPointerLeave:see(a.onPointerLeave,(()=>{u()}))})})),mne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return t.jsx(yee.div,{"aria-hidden":!0,...o,ref:n})}));mne.displayName="SelectSeparator";var gne="SelectArrow";i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Cte(r),a=Rte(gne,r),s=Bte(gne,r);return a.open&&"popper"===s.position?t.jsx(fte,{...i,...o,ref:n}):null})).displayName=gne;var vne=i.forwardRef((({__scopeSelect:e,value:n,...r},o)=>{const a=i.useRef(null),s=pee(o,a),l=function(e){const t=i.useRef({value:e,previous:e});return i.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}(n);return i.useEffect((()=>{const e=a.current;if(!e)return;const t=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(t,"value").set;if(l!==n&&r){const t=new Event("change",{bubbles:!0});r.call(e,n),e.dispatchEvent(t)}}),[l,n]),t.jsx(yee.select,{...r,style:{...vte,...r.style},ref:s,defaultValue:n})}));function yne(e){return""===e||void 0===e}function bne(e){const t=bee(e),n=i.useRef(""),r=i.useRef(0),o=i.useCallback((e=>{const o=n.current+e;t(o),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout((()=>e("")),1e3))}(o)}),[t]),a=i.useCallback((()=>{n.current="",window.clearTimeout(r.current)}),[]);return i.useEffect((()=>()=>window.clearTimeout(r.current)),[]),[n,o,a]}function wne(e,t,n){const r=t.length>1&&Array.from(t).every((e=>e===t[0]))?t[0]:t,o=n?e.indexOf(n):-1;let i=(a=e,s=Math.max(o,0),a.map(((e,t)=>a[(s+t)%a.length])));var a,s;1===r.length&&(i=i.filter((e=>e!==n)));const l=i.find((e=>e.textValue.toLowerCase().startsWith(r.toLowerCase())));return l!==n?l:void 0}vne.displayName="SelectBubbleInput";var xne=Lte,_ne=jte,Sne=Ite,Ene=Ute,Tne=Xte,Cne=tne,Ane=ine,Rne=sne,One=cne,Nne=dne,Pne=fne,kne=mne;const Lne=Pte,Dne=Mte,Mne=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(xne,{ref:o,className:Yd("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-border/10 px-3 py-2 text-sm shadow-sm ring-offset-background !placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[n,t.jsx(_ne,{asChild:!0,children:t.jsx(pu,{className:"h-4 w-4 opacity-50"})})]})));Mne.displayName=xne.displayName;const jne=i.forwardRef((({className:e,...n},r)=>t.jsx(Nne,{ref:r,className:Yd("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(mu,{className:"h-4 w-4"})})));jne.displayName=Nne.displayName;const Ine=i.forwardRef((({className:e,...n},r)=>t.jsx(Pne,{ref:r,className:Yd("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(pu,{className:"h-4 w-4"})})));Ine.displayName=Pne.displayName;const Fne=i.forwardRef((({className:e,children:n,position:r="popper",...o},i)=>t.jsx(Sne,{children:t.jsxs(Ene,{ref:i,className:Yd("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[t.jsx(jne,{}),t.jsx(Tne,{className:Yd("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),t.jsx(Ine,{})]})})));Fne.displayName=Ene.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(Cne,{ref:r,className:Yd("px-2 py-1.5 text-sm font-semibold text-muted-foreground",e),...n}))).displayName=Cne.displayName;const Une=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(Ane,{ref:o,className:Yd("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[t.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(One,{children:t.jsx(du,{className:"h-4 w-4"})})}),t.jsx(Rne,{children:n})]})));Une.displayName=Ane.displayName;function $ne(e){const t=i.useRef({value:e,previous:e});return i.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}i.forwardRef((({className:e,...n},r)=>t.jsx(kne,{ref:r,className:Yd("-mx-1 my-1 h-px bg-muted",e),...n}))).displayName=kne.displayName;var Vne="Switch",[Bne,zne]=UQ(Vne),[Hne,qne]=Bne(Vne),Gne=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=WU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,w]=u0({prop:a,defaultProp:s,onChange:d});return t.jsxs(Hne,{scope:r,checked:b,disabled:c,children:[t.jsx(GQ.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":Xne(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onClick:FQ(e.onClick,(e=>{w((e=>!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(Yne,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})}));Gne.displayName=Vne;var Kne="SwitchThumb",Wne=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=qne(Kne,r);return t.jsx(GQ.span,{"data-state":Xne(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})}));Wne.displayName=Kne;var Yne=e=>{const{control:n,checked:r,bubbles:o=!0,...a}=e,s=i.useRef(null),l=$ne(r),c=FJ(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 Xne(e){return e?"checked":"unchecked"}var Qne=Gne,Zne=Wne;const Jne=i.forwardRef((({className:e,...n},r)=>t.jsx(Qne,{className:Yd("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(Zne,{className:Yd("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")})})));function ere(e){return(ere="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tre(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function nre(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function rre(e){nre(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===ere(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):new Date(NaN)}function ore(e,t){nre(2,arguments);var n=rre(e),r=tre(t);return isNaN(r)?new Date(NaN):r?(n.setDate(n.getDate()+r),n):n}function ire(e,t){nre(2,arguments);var n=rre(e),r=tre(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var o=n.getDate(),i=new Date(n.getTime());return i.setMonth(n.getMonth()+r+1,0),o>=i.getDate()?i:(n.setFullYear(i.getFullYear(),i.getMonth(),o),n)}Jne.displayName=Qne.displayName;var are={};function sre(){return are}function lre(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=rre(e),f=p.getDay(),h=(f<d?7:0)+f-d;return p.setDate(p.getDate()-h),p.setHours(0,0,0,0),p}function cre(e){return nre(1,arguments),lre(e,{weekStartsOn:1})}function ure(e){nre(1,arguments);var t=function(e){nre(1,arguments);var t=rre(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=cre(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var a=cre(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}(e),n=new Date(0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),cre(n)}function dre(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function pre(e){nre(1,arguments);var t=rre(e);return t.setHours(0,0,0,0),t}function fre(e,t){nre(2,arguments);var n=pre(e),r=pre(t),o=n.getTime()-dre(n),i=r.getTime()-dre(r);return Math.round((o-i)/864e5)}function hre(e,t){return nre(2,arguments),ore(e,7*tre(t))}function mre(e,t){return nre(2,arguments),ire(e,12*tre(t))}function gre(e,t){nre(2,arguments);var n=pre(e),r=pre(t);return n.getTime()===r.getTime()}function vre(e){return nre(1,arguments),e instanceof Date||"object"===ere(e)&&"[object Date]"===Object.prototype.toString.call(e)}function yre(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function bre(e){nre(1,arguments);var t=rre(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function wre(e){nre(1,arguments);var t=rre(e);return t.setDate(1),t.setHours(0,0,0,0),t}function xre(e){nre(1,arguments);var t=rre(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function _re(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=rre(e),f=p.getDay(),h=6+(f<d?-7:0)-(f-d);return p.setDate(p.getDate()+h),p.setHours(23,59,59,999),p}function Sre(e){return nre(1,arguments),_re(e,{weekStartsOn:1})}function Ere(e,t){return nre(2,arguments),function(e,t){nre(2,arguments);var n=rre(e).getTime(),r=tre(t);return new Date(n+r)}(e,-tre(t))}function Tre(e){nre(1,arguments);var t=rre(e),n=t.getUTCDay(),r=(n<1?7:0)+n-1;return t.setUTCDate(t.getUTCDate()-r),t.setUTCHours(0,0,0,0),t}function Cre(e){nre(1,arguments);var t=rre(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=Tre(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var a=Tre(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function Are(e){nre(1,arguments);var t=rre(e),n=Tre(t).getTime()-function(e){nre(1,arguments);var t=Cre(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),Tre(n)}(t).getTime();return Math.round(n/6048e5)+1}function Rre(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.weekStartsOn)&&void 0!==o?o:u.weekStartsOn)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var p=rre(e),f=p.getUTCDay(),h=(f<d?7:0)+f-d;return p.setUTCDate(p.getUTCDate()-h),p.setUTCHours(0,0,0,0),p}function Ore(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=rre(e),d=u.getUTCFullYear(),p=sre(),f=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:p.firstWeekContainsDate)&&void 0!==r?r:null===(l=p.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(d+1,0,f),h.setUTCHours(0,0,0,0);var m=Rre(h,t),g=new Date(0);g.setUTCFullYear(d,0,f),g.setUTCHours(0,0,0,0);var v=Rre(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function Nre(e,t){nre(1,arguments);var n=rre(e),r=Rre(n,t).getTime()-function(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:u.firstWeekContainsDate)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),p=Ore(e,t),f=new Date(0);return f.setUTCFullYear(p,0,d),f.setUTCHours(0,0,0,0),Rre(f,t)}(n,t).getTime();return Math.round(r/6048e5)+1}function Pre(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var kre=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return Pre("yy"===t?r%100:r,t.length)},Lre=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):Pre(n+1,2)},Dre=function(e,t){return Pre(e.getUTCDate(),t.length)},Mre=function(e,t){return Pre(e.getUTCHours()%12||12,t.length)},jre=function(e,t){return Pre(e.getUTCHours(),t.length)},Ire=function(e,t){return Pre(e.getUTCMinutes(),t.length)},Fre=function(e,t){return Pre(e.getUTCSeconds(),t.length)},Ure=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return Pre(Math.floor(r*Math.pow(10,n-3)),t.length)},$re="midnight",Vre="noon",Bre="morning",zre="afternoon",Hre="evening",qre="night",Gre={G:function(e,t,n){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var r=e.getUTCFullYear();return n.ordinalNumber(r>0?r:1-r,{unit:"year"})}return kre(e,t)},Y:function(e,t,n,r){var o=Ore(e,r),i=o>0?o:1-o;return"YY"===t?Pre(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):Pre(i,t.length)},R:function(e,t){return Pre(Cre(e),t.length)},u:function(e,t){return Pre(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return Pre(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return Pre(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){var r=e.getUTCMonth();switch(t){case"M":case"MM":return Lre(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return Pre(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){var o=Nre(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):Pre(o,t.length)},I:function(e,t,n){var r=Are(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):Pre(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):Dre(e,t)},D:function(e,t,n){var r=function(e){nre(1,arguments);var t=rre(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime();return Math.floor((n-r)/864e5)+1}(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):Pre(r,t.length)},E:function(e,t,n){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Pre(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){var o=e.getUTCDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Pre(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){var r=e.getUTCDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return Pre(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){var r=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(e,t,n){var r,o=e.getUTCHours();switch(r=12===o?Vre:0===o?$re:o/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},B:function(e,t,n){var r,o=e.getUTCHours();switch(r=o>=17?Hre:o>=12?zre:o>=4?Bre:qre,t){case"B":case"BB":case"BBB":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var r=e.getUTCHours()%12;return 0===r&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Mre(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):jre(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):Pre(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):Pre(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):Ire(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):Fre(e,t)},S:function(e,t){return Ure(e,t)},X:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Wre(o);case"XXXX":case"XX":return Yre(o);default:return Yre(o,":")}},x:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Wre(o);case"xxxx":case"xx":return Yre(o);default:return Yre(o,":")}},O:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Kre(o,":");default:return"GMT"+Yre(o,":")}},z:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Kre(o,":");default:return"GMT"+Yre(o,":")}},t:function(e,t,n,r){return Pre(Math.floor((r._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,r){return Pre((r._originalDate||e).getTime(),t.length)}};function Kre(e,t){var n=e>0?"-":"+",r=Math.abs(e),o=Math.floor(r/60),i=r%60;if(0===i)return n+String(o);var a=t;return n+String(o)+a+Pre(i,2)}function Wre(e,t){return e%60==0?(e>0?"-":"+")+Pre(Math.abs(e)/60,2):Yre(e,t)}function Yre(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e);return r+Pre(Math.floor(o/60),2)+n+Pre(o%60,2)}var Xre=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},Qre=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},Zre={p:Qre,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return Xre(e,t);switch(o){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Xre(o,t)).replace("{{time}}",Qre(i,t))}},Jre=["D","DD"],eoe=["YY","YYYY"];function toe(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var noe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function roe(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var ooe={date:roe({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:roe({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:roe({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},ioe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function aoe(e){return function(t,n){var r;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=null!=n&&n.width?String(n.width):o;r=e.formattingValues[i]||e.formattingValues[o]}else{var a=e.defaultWidth,s=null!=n&&n.width?String(n.width):e.defaultWidth;r=e.values[s]||e.values[a]}return r[e.argumentCallback?e.argumentCallback(t):t]}}var soe={ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:aoe({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:aoe({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:aoe({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:aoe({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:aoe({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};function loe(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,o=t.match(r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth]);if(!o)return null;var i,a=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n;return}(s,(function(e){return e.test(a)})):function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n;return}(s,(function(e){return e.test(a)}));return i=e.valueCallback?e.valueCallback(l):l,{value:i=n.valueCallback?n.valueCallback(i):i,rest:t.slice(a.length)}}}var coe={ordinalNumber:function(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var o=r[0],i=t.match(e.parsePattern);if(!i)return null;var a=e.valueCallback?e.valueCallback(i[0]):i[0];return{value:a=n.valueCallback?n.valueCallback(a):a,rest:t.slice(o.length)}}}({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:loe({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:loe({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:loe({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:loe({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:loe({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},uoe={code:"en-US",formatDistance:function(e,t,n){var r,o=noe[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:ooe,formatRelative:function(e,t,n,r){return ioe[e]},localize:soe,match:coe,options:{weekStartsOn:0,firstWeekContainsDate:1}},doe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,poe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,foe=/^'([^]*?)'?$/,hoe=/''/g,moe=/[a-zA-Z]/;function goe(e,t,n){var r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,w;nre(2,arguments);var x=String(t),_=sre(),S=null!==(r=null!==(o=null==n?void 0:n.locale)&&void 0!==o?o:_.locale)&&void 0!==r?r:uoe,E=tre(null!==(i=null!==(a=null!==(s=null!==(l=null==n?void 0:n.firstWeekContainsDate)&&void 0!==l?l:null==n||null===(c=n.locale)||void 0===c||null===(u=c.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==s?s:_.firstWeekContainsDate)&&void 0!==a?a:null===(d=_.locale)||void 0===d||null===(p=d.options)||void 0===p?void 0:p.firstWeekContainsDate)&&void 0!==i?i:1);if(!(E>=1&&E<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=tre(null!==(f=null!==(h=null!==(m=null!==(g=null==n?void 0:n.weekStartsOn)&&void 0!==g?g:null==n||null===(v=n.locale)||void 0===v||null===(y=v.options)||void 0===y?void 0:y.weekStartsOn)&&void 0!==m?m:_.weekStartsOn)&&void 0!==h?h:null===(b=_.locale)||void 0===b||null===(w=b.options)||void 0===w?void 0:w.weekStartsOn)&&void 0!==f?f:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!S.localize)throw new RangeError("locale must contain localize property");if(!S.formatLong)throw new RangeError("locale must contain formatLong property");var C=rre(e);if(!function(e){if(nre(1,arguments),!vre(e)&&"number"!=typeof e)return!1;var t=rre(e);return!isNaN(Number(t))}(C))throw new RangeError("Invalid time value");var A=Ere(C,dre(C)),R={firstWeekContainsDate:E,weekStartsOn:T,locale:S,_originalDate:C};return x.match(poe).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Zre[t])(e,S.formatLong):e})).join("").match(doe).map((function(r){if("''"===r)return"'";var o=r[0];if("'"===o)return function(e){var t=e.match(foe);if(!t)return e;return t[1].replace(hoe,"'")}(r);var i=Gre[o];if(i)return null!=n&&n.useAdditionalWeekYearTokens||-1===eoe.indexOf(r)||toe(r,t,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==Jre.indexOf(e)}(r)||toe(r,t,String(e)),i(A,r,S.localize,R);if(o.match(moe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return r})).join("")}function voe(e){return nre(1,arguments),Math.floor(function(e){return nre(1,arguments),rre(e).getTime()}(e)/1e3)}function yoe(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=sre(),d=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:u.firstWeekContainsDate)&&void 0!==r?r:null===(l=u.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),p=function(e,t){var n,r,o,i,a,s,l,c;nre(1,arguments);var u=rre(e),d=u.getFullYear(),p=sre(),f=tre(null!==(n=null!==(r=null!==(o=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(a=t.locale)||void 0===a||null===(s=a.options)||void 0===s?void 0:s.firstWeekContainsDate)&&void 0!==o?o:p.firstWeekContainsDate)&&void 0!==r?r:null===(l=p.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(f>=1&&f<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setFullYear(d+1,0,f),h.setHours(0,0,0,0);var m=lre(h,t),g=new Date(0);g.setFullYear(d,0,f),g.setHours(0,0,0,0);var v=lre(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}(e,t),f=new Date(0);return f.setFullYear(p,0,d),f.setHours(0,0,0,0),lre(f,t)}function boe(e,t){return nre(1,arguments),function(e,t,n){nre(2,arguments);var r=lre(e,n),o=lre(t,n),i=r.getTime()-dre(r),a=o.getTime()-dre(o);return Math.round((i-a)/6048e5)}(function(e){nre(1,arguments);var t=rre(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}(e),wre(e),t)+1}function woe(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return n.getTime()>r.getTime()}function xoe(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return n.getTime()<r.getTime()}function _oe(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function Soe(e,t){return nre(2,arguments),ore(e,-tre(t))}function Eoe(e,t){nre(2,arguments);var n=rre(e),r=tre(t),o=n.getFullYear(),i=n.getDate(),a=new Date(0);a.setFullYear(o,r,15),a.setHours(0,0,0,0);var s=function(e){nre(1,arguments);var t=rre(e),n=t.getFullYear(),r=t.getMonth(),o=new Date(0);return o.setFullYear(n,r+1,0),o.setHours(0,0,0,0),o.getDate()}(a);return n.setMonth(r,Math.min(i,s)),n}function Toe(e,t){nre(2,arguments);var n=rre(e),r=tre(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var Coe=function(){return Coe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Coe.apply(this,arguments)};function Aoe(e,t,n){for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function Roe(e){return"multiple"===e.mode}function Ooe(e){return"range"===e.mode}function Noe(e){return"single"===e.mode}"function"==typeof SuppressedError&&SuppressedError;var Poe={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};var koe=Object.freeze({__proto__:null,formatCaption:function(e,t){return goe(e,"LLLL y",t)},formatDay:function(e,t){return goe(e,"d",t)},formatMonthCaption:function(e,t){return goe(e,"LLLL",t)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,t){return goe(e,"cccccc",t)},formatYearCaption:function(e,t){return goe(e,"yyyy",t)}}),Loe=Object.freeze({__proto__:null,labelDay:function(e,t,n){return goe(e,"do MMMM (EEEE)",n)},labelMonthDropdown:function(){return"Month: "},labelNext:function(){return"Go to next month"},labelPrevious:function(){return"Go to previous month"},labelWeekNumber:function(e){return"Week n. ".concat(e)},labelWeekday:function(e,t){return goe(e,"cccc",t)},labelYearDropdown:function(){return"Year: "}});var Doe=n.createContext(void 0);function Moe(e){var n,r,o=e.initialProps,i={captionLayout:"buttons",classNames:Poe,formatters:koe,labels:Loe,locale:uoe,modifiersClassNames:{},modifiers:{},numberOfMonths:1,styles:{},today:new Date,mode:"default"},a=function(e){var t=e.fromYear,n=e.toYear,r=e.fromMonth,o=e.toMonth,i=e.fromDate,a=e.toDate;return r?i=wre(r):t&&(i=new Date(t,0,1)),o?a=bre(o):n&&(a=new Date(n,11,31)),{fromDate:i?pre(i):void 0,toDate:a?pre(a):void 0}}(o),s=a.fromDate,l=a.toDate,c=null!==(n=o.captionLayout)&&void 0!==n?n:i.captionLayout;"buttons"===c||s&&l||(c="buttons"),(Noe(o)||Roe(o)||Ooe(o))&&(r=o.onSelect);var u=Coe(Coe(Coe({},i),o),{captionLayout:c,classNames:Coe(Coe({},i.classNames),o.classNames),components:Coe({},o.components),formatters:Coe(Coe({},i.formatters),o.formatters),fromDate:s,labels:Coe(Coe({},i.labels),o.labels),mode:o.mode||i.mode,modifiers:Coe(Coe({},i.modifiers),o.modifiers),modifiersClassNames:Coe(Coe({},i.modifiersClassNames),o.modifiersClassNames),onSelect:r,styles:Coe(Coe({},i.styles),o.styles),toDate:l});return t.jsx(Doe.Provider,{value:u,children:e.children})}function joe(){var e=n.useContext(Doe);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function Ioe(e){var n=joe();return t.jsx("div",{className:n.classNames.caption_label,style:n.styles.caption_label,"aria-live":"polite",role:"presentation",id:e.id,children:(0,n.formatters.formatCaption)(e.displayMonth,{locale:n.locale})})}function Foe(e){return t.jsx("svg",Coe({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e,{children:t.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Uoe(e){var n,r,o=e.onChange,i=e.value,a=e.children,s=e.caption,l=e.className,c=e.style,u=joe(),d=null!==(r=null===(n=u.components)||void 0===n?void 0:n.IconDropdown)&&void 0!==r?r:Foe;return t.jsxs("div",{className:l,style:c,children:[t.jsx("span",{className:u.classNames.vhidden,children:e["aria-label"]}),t.jsx("select",{name:e.name,"aria-label":e["aria-label"],className:u.classNames.dropdown,style:u.styles.dropdown,value:i,onChange:o,children:a}),t.jsxs("div",{className:u.classNames.caption_label,style:u.styles.caption_label,"aria-hidden":"true",children:[s,t.jsx(d,{className:u.classNames.dropdown_icon,style:u.styles.dropdown_icon})]})]})}function $oe(e){var n,r=joe(),o=r.fromDate,i=r.toDate,a=r.styles,s=r.locale,l=r.formatters.formatMonthCaption,c=r.classNames,u=r.components,d=r.labels.labelMonthDropdown;if(!o)return t.jsx(t.Fragment,{});if(!i)return t.jsx(t.Fragment,{});var p=[];if(function(e,t){nre(2,arguments);var n=rre(e),r=rre(t);return n.getFullYear()===r.getFullYear()}(o,i))for(var f=wre(o),h=o.getMonth();h<=i.getMonth();h++)p.push(Eoe(f,h));else for(f=wre(new Date),h=0;h<=11;h++)p.push(Eoe(f,h));var m=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:Uoe;return t.jsx(m,{name:"months","aria-label":d(),className:c.dropdown_month,style:a.dropdown_month,onChange:function(t){var n=Number(t.target.value),r=Eoe(wre(e.displayMonth),n);e.onChange(r)},value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:s}),children:p.map((function(e){return t.jsx("option",{value:e.getMonth(),children:l(e,{locale:s})},e.getMonth())}))})}function Voe(e){var n,r=e.displayMonth,o=joe(),i=o.fromDate,a=o.toDate,s=o.locale,l=o.styles,c=o.classNames,u=o.components,d=o.formatters.formatYearCaption,p=o.labels.labelYearDropdown,f=[];if(!i)return t.jsx(t.Fragment,{});if(!a)return t.jsx(t.Fragment,{});for(var h=i.getFullYear(),m=a.getFullYear(),g=h;g<=m;g++)f.push(Toe(xre(new Date),g));var v=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:Uoe;return t.jsx(v,{name:"years","aria-label":p(),className:c.dropdown_year,style:l.dropdown_year,onChange:function(t){var n=Toe(wre(r),Number(t.target.value));e.onChange(n)},value:r.getFullYear(),caption:d(r,{locale:s}),children:f.map((function(e){return t.jsx("option",{value:e.getFullYear(),children:d(e,{locale:s})},e.getFullYear())}))})}function Boe(){var e=joe(),t=function(e){var t=e.month||e.defaultMonth||e.today||new Date,n=e.toDate,r=e.fromDate,o=e.numberOfMonths,i=void 0===o?1:o;return n&&yre(n,t)<0&&(t=ire(n,-1*(i-1))),r&&yre(t,r)<0&&(t=r),wre(t)}(e),r=function(e,t){var r=n.useState(e);return[void 0===t?r[0]:t,r[1]]}(t,e.month),o=r[1];return[r[0],function(t){var n;if(!e.disableNavigation){var r=wre(t);o(r),null===(n=e.onMonthChange)||void 0===n||n.call(e,r)}}]}var zoe=n.createContext(void 0);function Hoe(e){var n=joe(),r=Boe(),o=r[0],i=r[1],a=function(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=wre(e),i=yre(wre(ire(o,r)),o),a=[],s=0;s<i;s++){var l=ire(o,s);a.push(l)}return n&&(a=a.reverse()),a}(o,n),s=function(e,t){if(!t.disableNavigation){var n=t.toDate,r=t.numberOfMonths,o=void 0===r?1:r,i=t.pagedNavigation?o:1,a=wre(e);if(!n)return ire(a,i);if(!(yre(n,e)<o))return ire(a,i)}}(o,n),l=function(e,t){if(!t.disableNavigation){var n=t.fromDate,r=t.numberOfMonths,o=t.pagedNavigation?void 0===r?1:r:1,i=wre(e);if(!n)return ire(i,-o);if(!(yre(i,n)<=0))return ire(i,-o)}}(o,n),c=function(e){return a.some((function(t){return _oe(e,t)}))};return t.jsx(zoe.Provider,{value:{currentMonth:o,displayMonths:a,goToMonth:i,goToDate:function(e,t){c(e)||(t&&xoe(e,t)?i(ire(e,1+-1*n.numberOfMonths)):i(e))},previousMonth:l,nextMonth:s,isDateDisplayed:c},children:e.children})}function qoe(){var e=n.useContext(zoe);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Goe(e){var n,r=joe(),o=r.classNames,i=r.styles,a=r.components,s=qoe().goToMonth,l=function(t){s(ire(t,e.displayIndex?-e.displayIndex:0))},c=null!==(n=null==a?void 0:a.CaptionLabel)&&void 0!==n?n:Ioe,u=t.jsx(c,{id:e.id,displayMonth:e.displayMonth});return t.jsxs("div",{className:o.caption_dropdowns,style:i.caption_dropdowns,children:[t.jsx("div",{className:o.vhidden,children:u}),t.jsx($oe,{onChange:l,displayMonth:e.displayMonth}),t.jsx(Voe,{onChange:l,displayMonth:e.displayMonth})]})}function Koe(e){return t.jsx("svg",Coe({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:t.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function Woe(e){return t.jsx("svg",Coe({width:"16px",height:"16px",viewBox:"0 0 120 120"},e,{children:t.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var Yoe=n.forwardRef((function(e,n){var r=joe(),o=r.classNames,i=r.styles,a=[o.button_reset,o.button];e.className&&a.push(e.className);var s=a.join(" "),l=Coe(Coe({},i.button_reset),i.button);return e.style&&Object.assign(l,e.style),t.jsx("button",Coe({},e,{ref:n,type:"button",className:s,style:l}))}));function Xoe(e){var n,r,o=joe(),i=o.dir,a=o.locale,s=o.classNames,l=o.styles,c=o.labels,u=c.labelPrevious,d=c.labelNext,p=o.components;if(!e.nextMonth&&!e.previousMonth)return t.jsx(t.Fragment,{});var f=u(e.previousMonth,{locale:a}),h=[s.nav_button,s.nav_button_previous].join(" "),m=d(e.nextMonth,{locale:a}),g=[s.nav_button,s.nav_button_next].join(" "),v=null!==(n=null==p?void 0:p.IconRight)&&void 0!==n?n:Woe,y=null!==(r=null==p?void 0:p.IconLeft)&&void 0!==r?r:Koe;return t.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&t.jsx(Yoe,{name:"previous-month","aria-label":f,className:h,style:l.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick,children:t.jsx("rtl"===i?v:y,{className:s.nav_icon,style:l.nav_icon})}),!e.hideNext&&t.jsx(Yoe,{name:"next-month","aria-label":m,className:g,style:l.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick,children:t.jsx("rtl"===i?y:v,{className:s.nav_icon,style:l.nav_icon})})]})}function Qoe(e){var n=joe().numberOfMonths,r=qoe(),o=r.previousMonth,i=r.nextMonth,a=r.goToMonth,s=r.displayMonths,l=s.findIndex((function(t){return _oe(e.displayMonth,t)})),c=0===l,u=l===s.length-1;return t.jsx(Xoe,{displayMonth:e.displayMonth,hideNext:n>1&&(c||!u),hidePrevious:n>1&&(u||!c),nextMonth:i,previousMonth:o,onPreviousClick:function(){o&&a(o)},onNextClick:function(){i&&a(i)}})}function Zoe(e){var n,r,o=joe(),i=o.classNames,a=o.styles,s=o.captionLayout,l=o.components,c=null!==(n=null==l?void 0:l.CaptionLabel)&&void 0!==n?n:Ioe;return r=o.disableNavigation?t.jsx(c,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===s?t.jsx(Goe,{displayMonth:e.displayMonth,id:e.id}):t.jsxs(t.Fragment,"dropdown-buttons"===s?{children:[t.jsx(Goe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),t.jsx(Qoe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}:{children:[t.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(Qoe,{displayMonth:e.displayMonth,id:e.id})]}),t.jsx("div",{className:i.caption,style:a.caption,children:r})}function Joe(e){var n=joe(),r=n.footer;return r?t.jsx("tfoot",{className:n.classNames.tfoot,style:n.styles.tfoot,children:t.jsx("tr",{children:t.jsx("td",{colSpan:8,children:r})})}):t.jsx(t.Fragment,{})}function eie(){var e=joe(),n=e.classNames,r=e.styles,o=e.showWeekNumber,i=e.locale,a=e.formatters.formatWeekdayName,s=e.labels.labelWeekday,l=function(e,t,n){for(var r=n?cre(new Date):lre(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var a=ore(r,i);o.push(a)}return o}(i,e.weekStartsOn,e.ISOWeek);return t.jsxs("tr",{style:r.head_row,className:n.head_row,children:[o&&t.jsx("td",{style:r.head_cell,className:n.head_cell}),l.map((function(e,o){return t.jsx("th",{scope:"col",className:n.head_cell,style:r.head_cell,"aria-label":s(e,{locale:i}),children:a(e,{locale:i})},o)}))]})}function tie(){var e,n=joe(),r=n.components,o=null!==(e=null==r?void 0:r.HeadRow)&&void 0!==e?e:eie;return t.jsx("thead",{style:n.styles.head,className:n.classNames.head,children:t.jsx(o,{})})}function nie(e){var n=joe();return t.jsx(t.Fragment,{children:(0,n.formatters.formatDay)(e.date,{locale:n.locale})})}var rie=n.createContext(void 0);function oie(e){if(!Roe(e.initialProps)){return t.jsx(rie.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}return t.jsx(iie,{initialProps:e.initialProps,children:e.children})}function iie(e){var n=e.initialProps,r=e.children,o=n.selected,i=n.min,a=n.max,s={disabled:[]};return o&&s.disabled.push((function(e){var t=a&&o.length>a-1,n=o.some((function(t){return gre(t,e)}));return Boolean(t&&!n)})),t.jsx(rie.Provider,{value:{selected:o,onDayClick:function(e,t,r){var s,l;if((null===(s=n.onDayClick)||void 0===s||s.call(n,e,t,r),!Boolean(t.selected&&i&&(null==o?void 0:o.length)===i))&&!Boolean(!t.selected&&a&&(null==o?void 0:o.length)===a)){var c=o?Aoe([],o):[];if(t.selected){var u=c.findIndex((function(t){return gre(e,t)}));c.splice(u,1)}else c.push(e);null===(l=n.onSelect)||void 0===l||l.call(n,c,e,t,r)}},modifiers:s},children:r})}function aie(){var e=n.useContext(rie);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var sie,lie,cie=n.createContext(void 0);function uie(e){if(!Ooe(e.initialProps)){return t.jsx(cie.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}return t.jsx(die,{initialProps:e.initialProps,children:e.children})}function die(e){var n=e.initialProps,r=e.children,o=n.selected,i=o||{},a=i.from,s=i.to,l=n.min,c=n.max,u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(a?(u.range_start=[a],s?(u.range_end=[s],gre(a,s)||(u.range_middle=[{after:a,before:s}])):u.range_end=[a]):s&&(u.range_start=[s],u.range_end=[s]),l&&(a&&!s&&u.disabled.push({after:Soe(a,l-1),before:ore(a,l-1)}),a&&s&&u.disabled.push({after:a,before:ore(a,l-1)}),!a&&s&&u.disabled.push({after:Soe(s,l-1),before:ore(s,l-1)})),c){if(a&&!s&&(u.disabled.push({before:ore(a,1-c)}),u.disabled.push({after:ore(a,c-1)})),a&&s){var d=c-(fre(s,a)+1);u.disabled.push({before:Soe(a,d)}),u.disabled.push({after:ore(s,d)})}!a&&s&&(u.disabled.push({before:ore(s,1-c)}),u.disabled.push({after:ore(s,c-1)}))}return t.jsx(cie.Provider,{value:{selected:o,onDayClick:function(e,t,r){var i,a;null===(i=n.onDayClick)||void 0===i||i.call(n,e,t,r);var s=function(e,t){var n=t||{},r=n.from,o=n.to;if(r&&o){if(gre(o,e)&&gre(r,e))return;if(gre(o,e))return{from:o,to:void 0};if(gre(r,e))return;return woe(r,e)?{from:e,to:o}:{from:r,to:e}}return o?woe(e,o)?{from:o,to:e}:{from:e,to:o}:r?xoe(e,r)?{from:e,to:r}:{from:r,to:e}:{from:e,to:void 0}}(e,o);null===(a=n.onSelect)||void 0===a||a.call(n,s,e,t,r)},modifiers:u},children:r})}function pie(){var e=n.useContext(cie);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function fie(e){return Array.isArray(e)?Aoe([],e):void 0!==e?[e]:[]}(lie=sie||(sie={})).Outside="outside",lie.Disabled="disabled",lie.Selected="selected",lie.Hidden="hidden",lie.Today="today",lie.RangeStart="range_start",lie.RangeEnd="range_end",lie.RangeMiddle="range_middle";var hie=sie.Selected,mie=sie.Disabled,gie=sie.Hidden,vie=sie.Today,yie=sie.RangeEnd,bie=sie.RangeMiddle,wie=sie.RangeStart,xie=sie.Outside;var _ie=n.createContext(void 0);function Sie(e){var n=joe(),r=function(e,t,n){var r,o=((r={})[hie]=fie(e.selected),r[mie]=fie(e.disabled),r[gie]=fie(e.hidden),r[vie]=[e.today],r[yie]=[],r[bie]=[],r[wie]=[],r[xie]=[],r);return e.fromDate&&o[mie].push({before:e.fromDate}),e.toDate&&o[mie].push({after:e.toDate}),Roe(e)?o[mie]=o[mie].concat(t.modifiers[mie]):Ooe(e)&&(o[mie]=o[mie].concat(n.modifiers[mie]),o[wie]=n.modifiers[wie],o[bie]=n.modifiers[bie],o[yie]=n.modifiers[yie]),o}(n,aie(),pie()),o=function(e){var t={};return Object.entries(e).forEach((function(e){t[e[0]]=fie(e[1])})),t}(n.modifiers),i=Coe(Coe({},r),o);return t.jsx(_ie.Provider,{value:i,children:e.children})}function Eie(){var e=n.useContext(_ie);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function Tie(e,t){return t.some((function(t){if("boolean"==typeof t)return t;if(vre(t))return gre(e,t);var n,r,o,i,a;if(function(e){return Array.isArray(e)&&e.every(vre)}(t))return t.includes(e);if(function(e){return Boolean(e&&"object"==typeof e&&"from"in e)}(t))return n=e,a=(r=t).to,(i=r.from)&&a?(fre(a,i)<0&&(i=(o=[a,i])[0],a=o[1]),fre(n,i)>=0&&fre(a,n)>=0):a?gre(a,n):!!i&&gre(i,n);if(function(e){return Boolean(e&&"object"==typeof e&&"dayOfWeek"in e)}(t))return t.dayOfWeek.includes(e.getDay());if(function(e){return Boolean(e&&"object"==typeof e&&"before"in e&&"after"in e)}(t)){var s=fre(t.before,e)>0,l=fre(t.after,e)<0;return woe(t.before,t.after)?l&&s:s||l}return function(e){return Boolean(e&&"object"==typeof e&&"after"in e)}(t)?fre(e,t.after)>0:function(e){return Boolean(e&&"object"==typeof e&&"before"in e)}(t)?fre(t.before,e)>0:"function"==typeof t&&t(e)}))}function Cie(e,t,n){var r=Object.keys(t).reduce((function(n,r){return Tie(e,t[r])&&n.push(r),n}),[]),o={};return r.forEach((function(e){return o[e]=!0})),n&&!_oe(e,n)&&(o.outside=!0),o}function Aie(e,t){var n=t.moveBy,r=t.direction,o=t.context,i=t.modifiers,a=t.retry,s=void 0===a?{count:0,lastFocused:e}:a,l=o.weekStartsOn,c=o.fromDate,u=o.toDate,d=o.locale,p={day:ore,week:hre,month:ire,year:mre,startOfWeek:function(e){return o.ISOWeek?cre(e):lre(e,{locale:d,weekStartsOn:l})},endOfWeek:function(e){return o.ISOWeek?Sre(e):_re(e,{locale:d,weekStartsOn:l})}}[n](e,"after"===r?1:-1);"before"===r&&c?p=function(e){var t,n;if(nre(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==ere(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=rre(e);(void 0===n||n<t||isNaN(Number(t)))&&(n=t)})),n||new Date(NaN)}([c,p]):"after"===r&&u&&(p=function(e){var t,n;if(nre(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==ere(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=rre(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}([u,p]));var f=!0;if(i){var h=Cie(p,i);f=!h.disabled&&!h.hidden}return f?p:s.count>365?s.lastFocused:Aie(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:Coe(Coe({},s),{count:s.count+1})})}var Rie=n.createContext(void 0);function Oie(e){var r=qoe(),o=Eie(),i=n.useState(),a=i[0],s=i[1],l=n.useState(),c=l[0],u=l[1],d=function(e,t){for(var n,r,o=wre(e[0]),i=bre(e[e.length-1]),a=o;a<=i;){var s=Cie(a,t);if(s.disabled||s.hidden)a=ore(a,1);else{if(s.selected)return a;s.today&&!r&&(r=a),n||(n=a),a=ore(a,1)}}return r||n}(r.displayMonths,o),p=(null!=a?a:c&&r.isDateDisplayed(c))?c:d,f=function(e){s(e)},h=joe(),m=function(e,t){if(a){var n=Aie(a,{moveBy:e,direction:t,context:h,modifiers:o});gre(a,n)||(r.goToDate(n,a),f(n))}};return t.jsx(Rie.Provider,{value:{focusedDay:a,focusTarget:p,blur:function(){u(a),s(void 0)},focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}},children:e.children})}function Nie(){var e=n.useContext(Rie);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}var Pie=n.createContext(void 0);function kie(e){if(!Noe(e.initialProps)){return t.jsx(Pie.Provider,{value:{selected:void 0},children:e.children})}return t.jsx(Lie,{initialProps:e.initialProps,children:e.children})}function Lie(e){var n=e.initialProps;return t.jsx(Pie.Provider,{value:{selected:n.selected,onDayClick:function(e,t,r){var o,i,a;null===(o=n.onDayClick)||void 0===o||o.call(n,e,t,r),!t.selected||n.required?null===(a=n.onSelect)||void 0===a||a.call(n,e,e,t,r):null===(i=n.onSelect)||void 0===i||i.call(n,void 0,e,t,r)}},children:e.children})}function Die(){var e=n.useContext(Pie);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function Mie(e,t){var n=[e.classNames.day];return Object.keys(t).forEach((function(t){var r=e.modifiersClassNames[t];if(r)n.push(r);else if(function(e){return Object.values(sie).includes(e)}(t)){var o=e.classNames["day_".concat(t)];o&&n.push(o)}})),n}function jie(e,r,o){var i,a,s,l=joe(),c=Nie(),u=function(e,t){return Cie(e,Eie(),t)}(e,r),d=function(e,t){var n=joe(),r=Die(),o=aie(),i=pie(),a=Nie(),s=a.focusDayAfter,l=a.focusDayBefore,c=a.focusWeekAfter,u=a.focusWeekBefore,d=a.blur,p=a.focus,f=a.focusMonthBefore,h=a.focusMonthAfter,m=a.focusYearBefore,g=a.focusYearAfter,v=a.focusStartOfWeek,y=a.focusEndOfWeek;return{onClick:function(a){var s,l,c,u;Noe(n)?null===(s=r.onDayClick)||void 0===s||s.call(r,e,t,a):Roe(n)?null===(l=o.onDayClick)||void 0===l||l.call(o,e,t,a):Ooe(n)?null===(c=i.onDayClick)||void 0===c||c.call(i,e,t,a):null===(u=n.onDayClick)||void 0===u||u.call(n,e,t,a)},onFocus:function(r){var o;p(e),null===(o=n.onDayFocus)||void 0===o||o.call(n,e,t,r)},onBlur:function(r){var o;d(),null===(o=n.onDayBlur)||void 0===o||o.call(n,e,t,r)},onKeyDown:function(r){var o;switch(r.key){case"ArrowLeft":r.preventDefault(),r.stopPropagation(),"rtl"===n.dir?s():l();break;case"ArrowRight":r.preventDefault(),r.stopPropagation(),"rtl"===n.dir?l():s();break;case"ArrowDown":r.preventDefault(),r.stopPropagation(),c();break;case"ArrowUp":r.preventDefault(),r.stopPropagation(),u();break;case"PageUp":r.preventDefault(),r.stopPropagation(),r.shiftKey?m():f();break;case"PageDown":r.preventDefault(),r.stopPropagation(),r.shiftKey?g():h();break;case"Home":r.preventDefault(),r.stopPropagation(),v();break;case"End":r.preventDefault(),r.stopPropagation(),y()}null===(o=n.onDayKeyDown)||void 0===o||o.call(n,e,t,r)},onKeyUp:function(r){var o;null===(o=n.onDayKeyUp)||void 0===o||o.call(n,e,t,r)},onMouseEnter:function(r){var o;null===(o=n.onDayMouseEnter)||void 0===o||o.call(n,e,t,r)},onMouseLeave:function(r){var o;null===(o=n.onDayMouseLeave)||void 0===o||o.call(n,e,t,r)},onPointerEnter:function(r){var o;null===(o=n.onDayPointerEnter)||void 0===o||o.call(n,e,t,r)},onPointerLeave:function(r){var o;null===(o=n.onDayPointerLeave)||void 0===o||o.call(n,e,t,r)},onTouchCancel:function(r){var o;null===(o=n.onDayTouchCancel)||void 0===o||o.call(n,e,t,r)},onTouchEnd:function(r){var o;null===(o=n.onDayTouchEnd)||void 0===o||o.call(n,e,t,r)},onTouchMove:function(r){var o;null===(o=n.onDayTouchMove)||void 0===o||o.call(n,e,t,r)},onTouchStart:function(r){var o;null===(o=n.onDayTouchStart)||void 0===o||o.call(n,e,t,r)}}}(e,u),p=function(){var e=joe(),t=Die(),n=aie(),r=pie();return Noe(e)?t.selected:Roe(e)?n.selected:Ooe(e)?r.selected:void 0}(),f=Boolean(l.onDayClick||"default"!==l.mode);n.useEffect((function(){var t;u.outside||c.focusedDay&&f&&gre(c.focusedDay,e)&&(null===(t=o.current)||void 0===t||t.focus())}),[c.focusedDay,e,o,f,u.outside]);var h=Mie(l,u).join(" "),m=function(e,t){var n=Coe({},e.styles.day);return Object.keys(t).forEach((function(t){var r;n=Coe(Coe({},n),null===(r=e.modifiersStyles)||void 0===r?void 0:r[t])})),n}(l,u),g=Boolean(u.outside&&!l.showOutsideDays||u.hidden),v=null!==(s=null===(a=l.components)||void 0===a?void 0:a.DayContent)&&void 0!==s?s:nie,y={style:m,className:h,children:t.jsx(v,{date:e,displayMonth:r,activeModifiers:u}),role:"gridcell"},b=c.focusTarget&&gre(c.focusTarget,e)&&!u.outside,w=c.focusedDay&&gre(c.focusedDay,e),x=Coe(Coe(Coe({},y),((i={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,i.tabIndex=w||b?0:-1,i)),d);return{isButton:f,isHidden:g,activeModifiers:u,selectedDays:p,buttonProps:x,divProps:y}}function Iie(e){var r=n.useRef(null),o=jie(e.date,e.displayMonth,r);return o.isHidden?t.jsx("div",{role:"gridcell"}):o.isButton?t.jsx(Yoe,Coe({name:"day",ref:r},o.buttonProps)):t.jsx("div",Coe({},o.divProps))}function Fie(e){var n=e.number,r=e.dates,o=joe(),i=o.onWeekNumberClick,a=o.styles,s=o.classNames,l=o.locale,c=o.labels.labelWeekNumber,u=(0,o.formatters.formatWeekNumber)(Number(n),{locale:l});if(!i)return t.jsx("span",{className:s.weeknumber,style:a.weeknumber,children:u});var d=c(Number(n),{locale:l});return t.jsx(Yoe,{name:"week-number","aria-label":d,className:s.weeknumber,style:a.weeknumber,onClick:function(e){i(n,r,e)},children:u})}function Uie(e){var n,r,o,i=joe(),a=i.styles,s=i.classNames,l=i.components,c=null!==(n=null==l?void 0:l.Day)&&void 0!==n?n:Iie,u=null!==(r=null==l?void 0:l.WeekNumber)&&void 0!==r?r:Fie;return i.showWeekNumber&&(o=t.jsx("td",{className:s.cell,style:a.cell,children:t.jsx(u,{number:e.weekNumber,dates:e.dates})})),t.jsxs("tr",{className:s.row,style:a.row,children:[o,e.dates.map((function(n){return t.jsx("td",{className:s.cell,style:a.cell,role:"presentation",children:t.jsx(c,{displayMonth:e.displayMonth,date:n})},voe(n))}))]})}function $ie(e,t,n){for(var r=(null==n?void 0:n.ISOWeek)?Sre(t):_re(t,n),o=(null==n?void 0:n.ISOWeek)?cre(e):lre(e,n),i=fre(r,o),a=[],s=0;s<=i;s++)a.push(ore(o,s));var l=a.reduce((function(e,t){var r=(null==n?void 0:n.ISOWeek)?function(e){nre(1,arguments);var t=rre(e),n=cre(t).getTime()-ure(t).getTime();return Math.round(n/6048e5)+1}(t):function(e,t){nre(1,arguments);var n=rre(e),r=lre(n,t).getTime()-yoe(n,t).getTime();return Math.round(r/6048e5)+1}(t,n),o=e.find((function(e){return e.weekNumber===r}));return o?(o.dates.push(t),e):(e.push({weekNumber:r,dates:[t]}),e)}),[]);return l}function Vie(e){var n,r,o,i=joe(),a=i.locale,s=i.classNames,l=i.styles,c=i.hideHead,u=i.components,d=i.weekStartsOn,p=i.firstWeekContainsDate,f=i.ISOWeek,h=function(e,t){var n=$ie(wre(e),bre(e),t);if(null==t?void 0:t.useFixedWeeks){var r=boe(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],a=hre(i,6-r),s=$ie(hre(i,1),a,t);n.push.apply(n,s)}}return n}(e.displayMonth,{useFixedWeeks:Boolean(i.fixedWeeks),ISOWeek:f,locale:a,weekStartsOn:d,firstWeekContainsDate:p}),m=null!==(n=null==u?void 0:u.Head)&&void 0!==n?n:tie,g=null!==(r=null==u?void 0:u.Row)&&void 0!==r?r:Uie,v=null!==(o=null==u?void 0:u.Footer)&&void 0!==o?o:Joe;return t.jsxs("table",{id:e.id,className:s.table,style:l.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!c&&t.jsx(m,{}),t.jsx("tbody",{className:s.tbody,style:l.tbody,children:h.map((function(n){return t.jsx(g,{displayMonth:e.displayMonth,dates:n.dates,weekNumber:n.weekNumber},n.weekNumber)}))}),t.jsx(v,{displayMonth:e.displayMonth})]})}var Bie="undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,zie=!1,Hie=0;function qie(){return"react-day-picker-".concat(++Hie)}function Gie(e){var r,o,i=joe(),a=i.dir,s=i.classNames,l=i.styles,c=i.components,u=qoe().displayMonths,d=function(e){var t,r=null!=e?e:zie?qie():null,o=n.useState(r),i=o[0],a=o[1];return Bie((function(){null===i&&a(qie())}),[]),n.useEffect((function(){!1===zie&&(zie=!0)}),[]),null!==(t=null!=e?e:i)&&void 0!==t?t:void 0}(i.id?"".concat(i.id,"-").concat(e.displayIndex):void 0),p=i.id?"".concat(i.id,"-grid-").concat(e.displayIndex):void 0,f=[s.month],h=l.month,m=0===e.displayIndex,g=e.displayIndex===u.length-1,v=!m&&!g;"rtl"===a&&(g=(r=[m,g])[0],m=r[1]),m&&(f.push(s.caption_start),h=Coe(Coe({},h),l.caption_start)),g&&(f.push(s.caption_end),h=Coe(Coe({},h),l.caption_end)),v&&(f.push(s.caption_between),h=Coe(Coe({},h),l.caption_between));var y=null!==(o=null==c?void 0:c.Caption)&&void 0!==o?o:Zoe;return t.jsxs("div",{className:f.join(" "),style:h,children:[t.jsx(y,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(Vie,{id:p,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function Kie(e){var n=joe();return t.jsx("div",{className:n.classNames.months,style:n.styles.months,children:e.children})}function Wie(e){var r,o,i=e.initialProps,a=joe(),s=Nie(),l=qoe(),c=n.useState(!1),u=c[0],d=c[1];n.useEffect((function(){a.initialFocus&&s.focusTarget&&(u||(s.focus(s.focusTarget),d(!0)))}),[a.initialFocus,u,s.focus,s.focusTarget,s]);var p=[a.classNames.root,a.className];a.numberOfMonths>1&&p.push(a.classNames.multiple_months),a.showWeekNumber&&p.push(a.classNames.with_weeknumber);var f=Coe(Coe({},a.styles.root),a.style),h=Object.keys(i).filter((function(e){return e.startsWith("data-")})).reduce((function(e,t){var n;return Coe(Coe({},e),((n={})[t]=i[t],n))}),{}),m=null!==(o=null===(r=i.components)||void 0===r?void 0:r.Months)&&void 0!==o?o:Kie;return t.jsx("div",Coe({className:p.join(" "),style:f,dir:a.dir,id:a.id,nonce:i.nonce,title:i.title,lang:i.lang},h,{children:t.jsx(m,{children:l.displayMonths.map((function(e,n){return t.jsx(Gie,{displayIndex:n,displayMonth:e},n)}))})}))}function Yie(e){var n=e.children,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(e,["children"]);return t.jsx(Moe,{initialProps:r,children:t.jsx(Hoe,{children:t.jsx(kie,{initialProps:r,children:t.jsx(oie,{initialProps:r,children:t.jsx(uie,{initialProps:r,children:t.jsx(Sie,{children:t.jsx(Oie,{children:n})})})})})})})}function Xie(e){return t.jsx(Yie,Coe({},e,{children:t.jsx(Wie,{initialProps:e})}))}function Qie({className:e,classNames:n,showOutsideDays:r=!0,...o}){return t.jsx(Xie,{showOutsideDays:r,className:Yd("p-3",e),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Yd($X({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:Yd("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md","range"===o.mode?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:Yd($X({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...n},components:{IconLeft:()=>t.jsx(fu,{className:"h-4 w-4"}),IconRight:()=>t.jsx(hu,{className:"h-4 w-4"})},...o})}Qie.displayName="Calendar";const Zie=({onSelect:e,date:n,placeholder:r="Pick a date"})=>t.jsxs(d8,{modal:!0,children:[t.jsx(p8,{asChild:!0,children:t.jsxs(VX,{variant:"outline",className:Yd("w-[200px] justify-start text-left font-normal h-9",!n&&"text-muted-foreground"),children:[t.jsx(uu,{className:"mr-2 h-4 w-4"}),n?y9(n,"PPP"):t.jsx("span",{children:r})]})}),t.jsx(f8,{className:"w-auto p-0",align:"start",children:t.jsx(Qie,{mode:"single",selected:n,onSelect:e,initialFocus:!0})})]}),Jie=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===H9.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),eae=({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===_Q.Date||e===_Q.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:H9.DAYS,direction:"before"}),[v,y]=i.useState(u?r[0]:void 0),[b,w]=i.useState(!1);if(i.useEffect((()=>{n!==EQ.EQUALS_MONTH_DAY&&n!==EQ.EQUALS_MONTH_DAY_YEAR&&f&&(h(!1),o(d?[d]:[]))}),[n,f,d,o]),i.useEffect((()=>{if(u&&v?.startDate){w("object"==typeof v.startDate&&"type"in v.startDate)}}),[u,v]),e===_Q.String||e===_Q.ReachResource||e===_Q.Array)return n===EQ.EXISTS?null:t.jsx(iee,{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 _Q.ReachResource:case _Q.Array:case _Q.String:return t.length>0;case _Q.Number:return!isNaN(Number(t));case _Q.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case _Q.Boolean:return"true"===t||"false"===t;case _Q.Date:case _Q.DateTime:return!isNaN(new Date(t).getTime());default:throw eQ(n,_Q)}})({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===_Q.Date||e===_Q.DateTime){const e=n===EQ.EQUALS_MONTH_DAY||n===EQ.EQUALS_MONTH_DAY_YEAR,r=n===EQ.BETWEEN_MONTH_DAY||n===EQ.BETWEEN_MONTH_DAY_YEAR,i=e=>{Jie(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&&(!Jie(t)||!Jie(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&&Jie(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(Zie,{date:d,onSelect:l}),e&&f&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(tQ,{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(Lne,{value:m.direction,onValueChange:e=>{i({...m,direction:e})},children:[t.jsx(Mne,{className:"w-[180px] h-9","aria-label":"Relative direction",children:t.jsx(Dne,{placeholder:"Select direction..."})}),t.jsxs(Fne,{children:[t.jsx(Une,{value:"before",children:"days before today"}),t.jsx(Une,{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(tQ,{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:H9.DAYS,direction:v?.startDate?.direction||"before"};Jie(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),t.jsxs(Lne,{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:H9.DAYS,direction:e};Jie(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},children:[t.jsx(Mne,{className:"w-[180px] h-9",children:t.jsx(Dne,{placeholder:"Select direction..."})}),t.jsxs(Fne,{children:[t.jsx(Une,{value:"before",children:"days before today"}),t.jsx(Une,{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(Zie,{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(tQ,{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:H9.DAYS,direction:v?.endDate?.direction||"before"};Jie(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),t.jsxs(Lne,{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:H9.DAYS,direction:e};Jie(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},children:[t.jsx(Mne,{className:"w-[180px] h-9",children:t.jsx(Dne,{placeholder:"Select direction..."})}),t.jsxs(Fne,{children:[t.jsx(Une,{value:"before",children:"days before today"}),t.jsx(Une,{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(Zie,{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(Jne,{id:"between-relative-date-switch",checked:b,onCheckedChange:e=>{if(w(e),e){const e={type:"relative",value:0,unit:H9.DAYS,direction:"before"},t={type:"relative",value:0,unit:H9.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(z9,{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(Jne,{id:"relative-date-switch",checked:f,onCheckedChange:c,"aria-label":"Toggle relative date input"}),t.jsx(z9,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===_Q.Number||e===_Q.Integer)return n===EQ.EXISTS?null:t.jsx(tQ,{type:"number",value:r.length>0?String(r[0]):"",onChange:e=>o([Number(e.target.value)]),className:"w-[200px]"});if(e===_Q.Boolean){if(n===EQ.EXISTS)return null;const e=r.length>0&&Boolean(r[0]);return t.jsx(Jne,{checked:e,onCheckedChange:e=>o([e])})}return t.jsx(tQ,{value:r.length>0?String(r[0]):"",onChange:e=>o([e.target.value]),className:"w-[200px]",disabled:!0})},tae=({condition:e,onUpdate:n,onDuplicate:r,onDelete:o,segmentsConditions:i})=>{const{toast:a}=Ll(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:_Q.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:G9[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(K7,{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:q9[e]||e,fieldType:o.type}))),s=a[0]?.value;let l=[];switch(o.type){case _Q.Boolean:l=[!1];break;case _Q.Number:l=[0];break;case _Q.Date:case _Q.DateTime:l=[new Date];break;case _Q.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(K7,{options:l.map((e=>({value:e,label:q9[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(eae,{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(VX,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(xu,{className:"h-4 w-4"})}),t.jsx(VX,{size:"icon",variant:"ghost",onClick:o,children:t.jsx(Ku,{className:"h-4 w-4"})})]})]})},nae=({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(HX,{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(qu,{className:"w-full h-full"})})}),selected:"ai"===r}),t.jsx(HX,{onClick:()=>{o("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${df("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(Bu,{className:"w-full h-full"})})}),selected:"manual"===r})]})},rae=({segmentId:e,setOpen:n,setTextToSegment:r,promptBuilderStyle:o,textToSegment:i})=>t.jsx("div",{children:t.jsx(EB,{className:"",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(CB,{className:"text-3xl font-normal",children:e?`Edit ${df("engage:segment")}`:`Create ${df("engage:segment")}`}),t.jsxs("div",{className:"flex items-center gap-2",children:[!1===o&&!1===i&&t.jsx(V0,{children:t.jsxs(B0,{children:[t.jsx(z0,{asChild:!0,children:t.jsx(VX,{variant:"outline",size:"sm",onClick:()=>r(!0),children:t.jsx(qu,{className:"h-4 w-3"})})}),t.jsx(H0,{children:t.jsxs("p",{children:["Use AI to create ",df("engage:segment")," by describing them in natural language"]})})]})}),t.jsx(VX,{variant:"ghost",size:"icon",onClick:()=>{n(!1)},className:"h-8 w-8",children:t.jsx(td,{className:"h-4 w-4"})})]})]})})}),oae=({setTextToSegment:e,setSegment:r})=>{const[o,i]=n.useState(""),[a,s]=n.useState(!1),{toast:c}=Ll();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(VB,{children:[a&&t.jsx(UX,{children:t.jsx(FX,{})}),!a&&t.jsx(UX,{children:t.jsx(nQ,{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(VX,{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 Oe(`${l}/text-to-segment`,{method:"POST",body:JSON.stringify({text:e})})).data)(o);t.success&&t.conditions?(c({title:`${df("engage:segment")} conditions built successfully 🚀`,description:`Your ${df("engage:segment")} conditions have been built successfully`}),r(t.conditions)):c({title:`${df("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[t.jsx(qu,{className:"h-4 w-4"}),"Generate ",df("engage:segment")]})})]})]})};function iae({segmentId:e,setOpen:n,onSegmentUpdated:r}){const{toast:o}=Ll(),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}=wQ(e||""),{updateSegment:f}=xQ(e),{createSegment:h,isCreating:m,segmentsConditions:g}=yQ(),[v,y]=i.useState(!1),[b,w]=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 x=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(FX,{})});return t.jsx(t.Fragment,{children:t.jsxs(VB,{mode:"wait",children:[t.jsx(rae,{segmentId:e,setOpen:n,setTextToSegment:y,promptBuilderStyle:b,textToSegment:v},"segment-builder-header"),b?t.jsx(UX,{children:t.jsx(nae,{onSelectStyle:e=>{"ai"===e&&y(!0),w(!1)}})},"prompt-builder-style"):t.jsx(UX,{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(VB,{children:v?t.jsx(UX,{children:t.jsx(oae,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(UX,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(z9,{className:"text-muted-foreground text-xs",children:"Name"}),t.jsx(tQ,{placeholder:`${df("engage:segment")} name`,value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(z9,{className:"text-muted-foreground text-xs",children:"Description"}),t.jsx(tQ,{placeholder:`${df("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(VB,{mode:"popLayout",children:c.conditions.map(((e,n)=>t.jsxs(TX.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(TX.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[t.jsx(TX.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(TX.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),t.jsx(TX.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(tae,{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(VX,v?{variant:"secondary",onClick:()=>y(!1),children:[t.jsx(Bu,{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(Uu,{className:"h-4 w-4"}),"Add Condition"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(VX,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(VX,{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!==EQ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===EQ.EXISTS&&t.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${t.field}`};if(x(t)&&t.operator!==EQ.EQUALS_MONTH_DAY&&t.operator!==EQ.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(x(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!==EQ.BETWEEN_MONTH_DAY&&t.operator!==EQ.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===H9.DAYS)return e.value??0;throw LX(e.unit,H9)};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===_Q.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:`${df("engage:segment")} updated successfully`}),n(!1),r?.(e)},onError:()=>{o({title:`Error updating ${df("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}}):h({name:c.name,description:c.description,conditions:c.conditions},{onSuccess:e=>{o({title:`${df("engage:segment")} created successfully`}),r?.(e?.id??!1),n(!1)},onError:()=>{o({title:`Error creating ${df("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}})}catch(s){o({title:`Error saving ${df("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(Au,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})})}function aae({open:e,setOpen:n,segmentId:r,onSegmentUpdated:o}){return t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-4xl w-full",hideCloseButton:!0,children:[t.jsxs(e$,{children:[t.jsxs(CB,{children:[df("engage:segment")," Builder"]}),t.jsxs(AB,{children:["Build a ",df("engage:segment")," to target your audience"]})]}),t.jsx(iae,{segmentId:r,setOpen:n,onSegmentUpdated:e=>{o?.(e),n(!1)}})]})})}function sae(){const{toast:e}=Ll(),[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}=bQ({search:d||void 0,cursor:c,limit:s}),y=n.useCallback((e=>{a(e),o(!0)}),[a]),b=n.useMemo((()=>function(e){return[T9("name",`${df("engage:segment")} Name`,!0),C9(),x9({accessorKey:"user_count",header:df("engage:user_other"),meta:{align:"right",displayName:df("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const t=e.getValue()??0;return`${t.toLocaleString()} ${1===t?df("engage:user").toLowerCase():df("engage:user_other").toLowerCase()}`}}),A9("user_count_updated_at"),N9(e||(()=>{}))]}(y)),[y]),w=n.useMemo((()=>f?f.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[f]),x=n.useMemo((()=>t.jsxs(VX,{onClick:()=>{a(null),o(!0)},children:[t.jsx(Uu,{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(k6,{data:w,columns:b,paginationMode:"cursor",initialPageSize:s,headerActions:x,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(aae,{open:r,setOpen:o,segmentId:i??void 0,onSegmentUpdated:t=>{_9(o,e,t,`Error creating ${df("engage:segment")}`,"Please try again"),u(void 0),l(10),p("")}})]})}const lae=()=>{const e=[{id:"broadcasts",label:df("engage:one_time"),content:t.jsx(L9,{})},{id:"automations",label:df("engage:automation"),content:t.jsx(k9,{})},{id:"segments",label:df("engage:segment"),content:t.jsx(sae,{})},{id:"statistics",label:"Statistics",content:t.jsx(Y0,{})}],r=ce(),[o,i]=n.useState(!1),[a,s]=n.useState(e[0].id);return n.useEffect((()=>{r.prefetchQuery({queryKey:Ne.list()}),r.prefetchQuery({queryKey:vQ.lists()})}),[r]),t.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[t.jsx(c1,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(VX,{variant:"outline",onClick:()=>i(!0),children:t.jsx(zu,{className:"w-4 h-4"})})}),t.jsx("div",{className:"flex-1 w-full h-full flex flex-col gap-4",children:t.jsx(mQ,{activeTab:a,tabs:e,onTabChange:s})})]})},cae=e=>{const t=ve({queryKey:["communication-group",e],queryFn:()=>e?(async e=>(await Oe(`${d}/${e}`)).data)(e):null,enabled:!!e});return{communicationGroup:t.data,isGetting:t.isPending,getError:t.error,isGetSuccess:t.isSuccess}},uae=()=>{const e=ce(),t=ye({mutationFn:({groupId:e,params:t})=>(async(e,t)=>(await Oe(`${d}/${e}`,{method:"PATCH",body:JSON.stringify(t)})).data)(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:["communication-group"]})}});return{updateCommunicationGroup:t.mutate,isUpdating:t.isPending,updateError:t.error,isUpdateSuccess:t.isSuccess}},dae=()=>{const e=ye({mutationFn:({id:e,params:t})=>(async(e,t)=>(await Oe(`${d}/${e}/test`,{method:"POST",body:JSON.stringify(t)})).data)(e,t)});return{sendTestCommunication:e.mutate,isSending:e.isPending,sendError:e.error,isSendSuccess:e.isSuccess}},pae=e=>{const{data:t}=(e=>{const t=ce(),n=ve({queryKey:["segments","recipients","count"],queryFn:()=>gQ(e)});return{data:n.data,isFetching:n.isFetching,isLoading:n.isLoading,fetchError:n.error,refetchCount:()=>{t.invalidateQueries({queryKey:["segments","recipients","count"]})}}})({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}},fae=()=>{const e=n.useContext(fQ);if(void 0===e)throw new Error("useViewAutomationContext must be used within a ViewAutomationProvider");return e},hae=()=>{const{state:e}=fae();return e.automation},mae=()=>{const{state:e}=fae();return e.communicationGroup},gae=({automationId:e,children:n})=>t.jsx(hQ,{children:t.jsx(vae,{automationId:e,children:n})}),vae=({automationId:e,existingAutomation:r,children:o})=>((e=>{const{setAutomation:t}=n.useContext(fQ),{automation:r}=ke(e);n.useEffect((()=>{r&&t(r)}),[r,t])})(e),(e=>{const{isUpdating:t}=Me(e);n.useEffect((()=>{be.emit(t?lQ:cQ,null)}),[t])})(e),(()=>{const{setCommunicationGroup:e,state:t}=n.useContext(fQ),r=t.automation?.actionData?.find((e=>"send_communication"===e.actionType))?.actionMetadata.communicationGroupId,{communicationGroup:o}=cae(r);n.useEffect((()=>{o&&e(o)}),[o,e])})(),(()=>{const{isUpdating:e}=uae();n.useEffect((()=>{be.emit(e?uQ:dQ,null)}),[e])})(),(e=>{const{setRecipientStats:t}=fae(),{estimatedMatchesStats:r}=pae(e);n.useEffect((()=>{r&&t(r)}),[r,t])})(r),t.jsx(t.Fragment,{children:o}));var yae=e=>"checkbox"===e.type,bae=e=>e instanceof Date,wae=e=>null==e;const xae=e=>"object"==typeof e;var _ae=e=>!wae(e)&&!Array.isArray(e)&&xae(e)&&!bae(e),Sae=e=>_ae(e)&&e.target?yae(e.target)?e.target.checked:e.target.value:e,Eae=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Tae="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Cae(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(Tae&&(e instanceof Blob||r)||!n&&!_ae(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return _ae(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=Cae(e[n]));else t=e}return t}var Aae=e=>Array.isArray(e)?e.filter(Boolean):[],Rae=e=>void 0===e,Oae=(e,t,n)=>{if(!t||!_ae(e))return n;const r=Aae(t.split(/[,[\].]+?/)).reduce(((e,t)=>wae(e)?e:e[t]),e);return Rae(r)||r===e?Rae(e[t])?n:e[t]:r},Nae=e=>"boolean"==typeof e,Pae=e=>/^\w*$/.test(e),kae=e=>Aae(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Lae=(e,t,n)=>{let r=-1;const o=Pae(t)?[t]:kae(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=_ae(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const Dae="blur",Mae="focusout",jae="change",Iae="onBlur",Fae="onChange",Uae="onSubmit",$ae="onTouched",Vae="all",Bae="max",zae="min",Hae="maxLength",qae="minLength",Gae="pattern",Kae="required",Wae="validate",Yae=n.createContext(null),Xae=()=>n.useContext(Yae);var Qae=(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]!==Vae&&(t._proxyFormState[o]=!r||Vae),n&&(n[o]=!0),e[o]}});return o},Zae=e=>wae(e)||!xae(e);function Jae(e,t){if(Zae(e)||Zae(t))return e===t;if(bae(e)&&bae(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(bae(n)&&bae(e)||_ae(n)&&_ae(e)||Array.isArray(n)&&Array.isArray(e)?!Jae(n,e):n!==e)return!1}}return!0}const ese=(e,t)=>{const r=n.useRef(t);Jae(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var tse=e=>"string"==typeof e,nse=(e,t,n,r,o)=>tse(e)?(r&&t.watch.add(e),Oae(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),Oae(n,e)))):(r&&(t.watchAll=!0),n);function rse(e){const t=Xae(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=Eae(i._names.array,r),l=function(e){const t=Xae(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return ese((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c(nse(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:Oae(i._formValues,r,Oae(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=Xae(),{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 ese((()=>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((()=>Qae(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,...Nae(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Oae(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!Oae(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Oae(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Oae(c.validatingFields,r)},error:{enumerable:!0,get:()=>Oae(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:Sae(e),name:r},type:jae})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:Oae(i._formValues,r),name:r},type:Dae})),[r,i._formValues]),m=n.useCallback((e=>{const t=Oae(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,...Nae(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,...Nae(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=Oae(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=Cae(Oae(i._options.defaultValues,r));Lae(i._defaultValues,r,e),Rae(Oae(i._formValues,r))&&Lae(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 ose=e=>e.render(rse(e));var ise=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},ase=e=>Array.isArray(e)?e:[e],sse=()=>{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=[]}}},lse=e=>_ae(e)&&!Object.keys(e).length,cse=e=>"file"===e.type,use=e=>"function"==typeof e,dse=e=>{if(!Tae)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},pse=e=>"select-multiple"===e.type,fse=e=>"radio"===e.type,hse=e=>dse(e)&&e.isConnected;function mse(e,t){const n=Array.isArray(t)?t:Pae(t)?[t]:kae(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Rae(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(_ae(r)&&lse(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Rae(e[t]))return!1;return!0}(r))&&mse(e,n.slice(0,-1)),e}var gse=e=>{for(const t in e)if(use(e[t]))return!0;return!1};function vse(e,t={}){const n=Array.isArray(e);if(_ae(e)||n)for(const r in e)Array.isArray(e[r])||_ae(e[r])&&!gse(e[r])?(t[r]=Array.isArray(e[r])?[]:{},vse(e[r],t[r])):wae(e[r])||(t[r]=!0);return t}function yse(e,t,n){const r=Array.isArray(e);if(_ae(e)||r)for(const o in e)Array.isArray(e[o])||_ae(e[o])&&!gse(e[o])?Rae(t)||Zae(n[o])?n[o]=Array.isArray(e[o])?vse(e[o],[]):{...vse(e[o])}:yse(e[o],wae(t)?{}:t[o],n[o]):n[o]=!Jae(e[o],t[o]);return n}var bse=(e,t)=>yse(e,t,vse(t));const wse={value:!1,isValid:!1},xse={value:!0,isValid:!0};var _se=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&&!Rae(e[0].attributes.value)?Rae(e[0].value)||""===e[0].value?xse:{value:e[0].value,isValid:!0}:xse:wse}return wse},Sse=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Rae(e)?e:t?""===e?NaN:e?+e:e:n&&tse(e)?new Date(e):r?r(e):e;const Ese={isValid:!1,value:null};var Tse=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),Ese):Ese;function Cse(e){const t=e.ref;return cse(t)?t.files:fse(t)?Tse(e.refs).value:pse(t)?[...t.selectedOptions].map((({value:e})=>e)):yae(t)?_se(e.refs).value:Sse(Rae(t.value)?e.ref.value:t.value,e)}var Ase=e=>e instanceof RegExp,Rse=e=>Rae(e)?e:Ase(e)?e.source:_ae(e)?Ase(e.value)?e.value.source:e.value:e,Ose=e=>({isOnSubmit:!e||e===Uae,isOnBlur:e===Iae,isOnChange:e===Fae,isOnAll:e===Vae,isOnTouch:e===$ae});const Nse="AsyncFunction";var Pse=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const kse=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=Oae(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(kse(i,t))break}else if(_ae(i)&&kse(i,t))break}}};function Lse(e,t,n){const r=Oae(e,n);if(r||Pae(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=Oae(t,r),a=Oae(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 Dse=(e,t,n)=>{const r=ase(Oae(e,n));return Lae(r,"root",t[n]),Lae(e,n,r),e},Mse=e=>tse(e);function jse(e,t,n="validate"){if(Mse(e)||Array.isArray(e)&&e.every(Mse)||Nae(e)&&!e)return{type:n,message:Mse(e)?e:"",ref:t}}var Ise=e=>_ae(e)&&!Ase(e)?e:{value:e,message:""},Fse=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=Oae(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,w=e=>{o&&b.reportValidity&&(b.setCustomValidity(Nae(e)?"":e||""),b.reportValidity())},x={},_=fse(a),S=yae(a),E=_||S,T=(g||cse(a))&&Rae(a.value)&&Rae(y)||dse(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=ise.bind(null,m,r,x),A=(e,t,n,r=Hae,o=qae)=>{const i=e?t:n;x[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(i?!Array.isArray(y)||!y.length:l&&(!E&&(T||wae(y))||Nae(y)&&!y||S&&!_se(s).isValid||_&&!Tse(s).isValid)){const{value:e,message:t}=Mse(l)?{value:!!l,message:l}:Ise(l);if(e&&(x[m]={type:Kae,message:t,ref:b,...C(Kae,t)},!r))return w(t),x}if(!(T||wae(d)&&wae(p))){let e,t;const n=Ise(p),o=Ise(d);if(wae(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;tse(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),tse(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);wae(n.value)||(e=r>n.value),wae(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,Bae,zae),!r))return w(x[m].message),x}if((c||u)&&!T&&(tse(y)||i&&Array.isArray(y))){const e=Ise(c),t=Ise(u),n=!wae(e.value)&&y.length>+e.value,o=!wae(t.value)&&y.length<+t.value;if((n||o)&&(A(n,e.message,t.message),!r))return w(x[m].message),x}if(f&&!T&&tse(y)){const{value:e,message:t}=Ise(f);if(Ase(e)&&!y.match(e)&&(x[m]={type:Gae,message:t,ref:a,...C(Gae,t)},!r))return w(t),x}if(h)if(use(h)){const e=jse(await h(y,n),b);if(e&&(x[m]={...e,...C(Wae,e.message)},!r))return w(e.message),x}else if(_ae(h)){let e={};for(const t in h){if(!lse(e)&&!r)break;const o=jse(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},w(o.message),r&&(x[m]=e))}if(!lse(e)&&(x[m]={ref:b,...e},!r))return x}return w(!0),x};const Use={mode:Uae,reValidateMode:Fae,shouldFocusError:!0};function $se(e={}){let t={...Use,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:use(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=(_ae(t.defaultValues)||_ae(t.values))&&Cae(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:Cae(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:sse(),state:sse()},f=Ose(t.mode),h=Ose(t.reValidateMode),m=t.criteriaMode===Vae,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?lse((await x()).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?Lae(n.validatingFields,e,r):mse(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!lse(n.validatingFields)}))},y=(e,t,n,o)=>{const l=Oae(r,e);if(l){const r=Oae(a,e,Rae(n)?Oae(i,e):n);Rae(r)||o&&o.defaultChecked||t?Lae(a,e,t?r:Cse(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=Jae(Oae(i,e),r);c=!!Oae(n.dirtyFields,e),t?mse(n.dirtyFields,e):Lae(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=Oae(n.touchedFields,e);t||(Lae(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:{}},w=(e,r,i,a)=>{const s=Oae(n.errors,e),l=(u.isValid||d.isValid)&&Nae(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{Lae(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?Lae(n.errors,e,i):mse(n.errors,e)),(i?!Jae(s,i):s)||!lse(a)||l){const t={...a,...l&&Nae(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},x=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=Oae(t,i);e&&Lae(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&&!!(use(i.validate)&&i.validate.constructor.name===Nse||_ae(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===Nse))));p&&u.validatingFields&&v([s],!0);const f=await Fse(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(Oae(f,e.name)?d?Dse(n.errors,f,e.name):Lae(n.errors,e.name,f[e.name]):mse(n.errors,e.name))}!lse(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&Lae(a,e,n),!Jae(P(),i)),E=(e,t,n)=>nse(e,l,{...s.mount?a:Rae(t)?i:tse(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=Oae(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&Lae(a,e,Sse(t,n)),i=dse(n.ref)&&wae(t)?"":t,pse(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?yae(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)):cse(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:Cae(a)})))}(n.shouldDirty||n.shouldTouch)&&b(e,i,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&N(e)},C=(e,t,n)=>{for(const o in t){const i=t[o],a=`${e}.${o}`,s=Oae(r,a);(l.array.has(e)||_ae(i)||s&&!s._f)&&!bae(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=Oae(r,e),f=l.array.has(e),h=Cae(t);Lae(a,e,h),f?(p.array.next({name:e,values:Cae(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:bse(i,a),isDirty:S(e,h)})):!c||c._f||wae(h)?T(e,h,o):C(e,h,o),Pse(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:Cae(a)})},R=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=Oae(r,c),E=e=>{y=Number.isNaN(e)||bae(e)&&isNaN(e.getTime())||Jae(e,Oae(a,c,e))};if(S){let s,C;const A=i.type?Cse(S._f):Sae(e),R=e.type===Dae||e.type===Mae,O=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||Oae(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))(R,Oae(n.touchedFields,c),n.isSubmitted,h,f),P=Pse(c,l,R);Lae(a,c,A),R?(S._f.onBlur&&S._f.onBlur(e),o&&o(0)):S._f.onChange&&S._f.onChange(e);const k=b(c,A,R),L=!lse(k)||P;if(!R&&p.state.next({name:c,type:e.type,values:Cae(a)}),O)return(u.isValid||d.isValid)&&("onBlur"===t.mode?R&&g():R||g()),L&&p.state.next({name:c,...P?{}:k});if(!R&&P&&p.state.next({...n}),t.resolver){const{errors:e}=await x([c]);if(E(A),y){const t=Lse(n.errors,r,c),o=Lse(e,r,t.name||c);s=o.error,c=o.name,C=lse(e)}}else v([c],!0),s=(await Fse(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&&N(S._f.deps),w(c,C,s,k))}var T},O=(e,t)=>{if(Oae(n.errors,t)&&e.focus)return e.focus(),1},N=async(e,o={})=>{let i,a;const s=ase(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await x(e);if(e)for(const r of e){const e=Oae(t,r);e?Lae(n.errors,r,e):mse(n.errors,r)}else n.errors=t;return t})(Rae(e)?e:s);i=lse(t),a=e?!s.some((e=>Oae(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=Oae(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!tse(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&kse(r,O,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return Rae(e)?t:tse(e)?Oae(t,e):e.map((e=>Oae(t,e)))},k=(e,t)=>({invalid:!!Oae((t||n).errors,e),isDirty:!!Oae((t||n).dirtyFields,e),error:Oae((t||n).errors,e),isValidating:!!Oae(n.validatingFields,e),isTouched:!!Oae((t||n).touchedFields,e)}),L=(e,t,o)=>{const i=(Oae(r,e,{_f:{}})._f||{}).ref,a=Oae(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;Lae(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()},D=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!ase(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 lse(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||Vae)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,M=(e,o={})=>{for(const s of e?ase(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(mse(r,s),mse(a,s)),!o.keepError&&mse(n.errors,s),!o.keepDirty&&mse(n.dirtyFields,s),!o.keepTouched&&mse(n.touchedFields,s),!o.keepIsValidating&&mse(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&mse(i,s);p.state.next({values:Cae(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},j=({disabled:e,name:t})=>{(Nae(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=Oae(r,e);const a=Nae(n.disabled)||Nae(t.disabled);return Lae(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?j({disabled:Nae(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:Rse(n.min),max:Rse(n.max),minLength:Rse(n.minLength),maxLength:Rse(n.maxLength),pattern:Rse(n.pattern)}:{},name:e,onChange:R,onBlur:R,ref:a=>{if(a){I(e,n),o=Oae(r,e);const t=Rae(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>fse(e)||yae(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;Lae(r,e,{_f:{...o._f,...s?{refs:[...l.filter(hse),t,...Array.isArray(Oae(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=Oae(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!Eae(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&kse(r,O,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=Cae(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await x();n.errors=e,c=t}else await _(r);if(l.disabled.size)for(const e of l.disabled)Lae(c,e,void 0);if(mse(n.errors,"root"),lse(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:lse(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?Cae(e):i,d=Cae(c),f=lse(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(bse(i,a))]);for(const t of Array.from(e))Oae(n.dirtyFields,t)?Lae(h,t,Oae(a,t)):A(t,Oae(h,t))}else{if(Tae&&Rae(e))for(const e of l.mount){const t=Oae(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(dse(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,Oae(h,e))}a=Cae(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||Jae(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?bse(i,a):n.dirtyFields:o.keepDefaultValues&&e?bse(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)=>$(use(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:M,getFieldState:k,handleSubmit:U,setError:L,_subscribe:D,_runSchema:x,_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(Oae(r,e))){const t=l(Oae(r,e),c.argA,c.argB);f&&Lae(r,e,t)}if(h&&Array.isArray(Oae(n.errors,e))){const t=l(Oae(n.errors,e),c.argA,c.argB);f&&Lae(n.errors,e,t),((e,t)=>{!Aae(Oae(e,t)).length&&mse(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(Oae(n.touchedFields,e))){const t=l(Oae(n.touchedFields,e),c.argA,c.argB);f&&Lae(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=bse(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Lae(a,e,o)},_setDisabledField:j,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Aae(Oae(s.mount?a:i,e,t.shouldUnregister?Oae(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>use(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=Oae(r,e);t&&(t._f.refs?t._f.refs.every((e=>!hse(e))):!hse(t._f.ref))&&M(e)}l.unMount=new Set},_disableForm:e=>{Nae(e)&&(p.state.next({disabled:e}),kse(r,((t,n)=>{const o=Oae(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},D({...e,formState:d})),trigger:N,register:I,handleSubmit:U,watch:(e,t)=>use(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={})=>{Oae(r,e)&&(Rae(t.defaultValue)?A(e,Cae(Oae(i,e))):(A(e,t.defaultValue),Lae(i,e,Cae(t.defaultValue))),t.keepTouched||mse(n.touchedFields,e),t.keepDirty||(mse(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Cae(Oae(i,e))):S()),t.keepError||(mse(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&ase(e).forEach((e=>mse(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:M,setError:L,setFocus:(e,t={})=>{const n=Oae(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&use(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const Vse="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Bse(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:use(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:use(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:$se(e),formState:o},e.formControl&&e.defaultValues&&!use(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Vse((()=>{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&&!lse(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&&!Jae(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=Qae(o,a),t.current}const zse=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Oae(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},Hse=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?zse(r.ref,n,e):r.refs&&r.refs.forEach((t=>zse(t,n,e)))}},qse=(e,t)=>{t.shouldUseNativeValidation&&Hse(e,t);const n={};for(const r in e){const o=Oae(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(Gse(t.names||Object.keys(e),r)){const e=Object.assign({},Oae(n,r));Lae(e,"root",i),Lae(n,r,e)}else Lae(n,r,i)}return n},Gse=(e,t)=>e.some((e=>e.startsWith(t+".")));var Kse,Wse,Yse,Xse=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]=ise(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},Qse=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&&Hse({},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:qse(Xse(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};(Wse=Kse||(Kse={})).assertEqual=e=>e,Wse.assertIs=function(e){},Wse.assertNever=function(e){throw new Error},Wse.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Wse.getValidEnumValues=e=>{const t=Wse.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return Wse.objectValues(n)},Wse.objectValues=e=>Wse.objectKeys(e).map((function(t){return e[t]})),Wse.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},Wse.find=(e,t)=>{for(const n of e)if(t(n))return n},Wse.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,Wse.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},Wse.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Yse||(Yse={})).mergeShapes=(e,t)=>({...e,...t});const Zse=Kse.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jse=e=>{switch(typeof e){case"undefined":return Zse.undefined;case"string":return Zse.string;case"number":return isNaN(e)?Zse.nan:Zse.number;case"boolean":return Zse.boolean;case"function":return Zse.function;case"bigint":return Zse.bigint;case"symbol":return Zse.symbol;case"object":return Array.isArray(e)?Zse.array:null===e?Zse.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Zse.promise:"undefined"!=typeof Map&&e instanceof Map?Zse.map:"undefined"!=typeof Set&&e instanceof Set?Zse.set:"undefined"!=typeof Date&&e instanceof Date?Zse.date:Zse.object;default:return Zse.unknown}},ele=Kse.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 tle 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 tle))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Kse.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()}}tle.create=e=>new tle(e);const nle=(e,t)=>{let n;switch(e.code){case ele.invalid_type:n=e.received===Zse.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ele.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Kse.jsonStringifyReplacer)}`;break;case ele.unrecognized_keys:n=`Unrecognized key(s) in object: ${Kse.joinValues(e.keys,", ")}`;break;case ele.invalid_union:n="Invalid input";break;case ele.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Kse.joinValues(e.options)}`;break;case ele.invalid_enum_value:n=`Invalid enum value. Expected ${Kse.joinValues(e.options)}, received '${e.received}'`;break;case ele.invalid_arguments:n="Invalid function arguments";break;case ele.invalid_return_type:n="Invalid function return type";break;case ele.invalid_date:n="Invalid date";break;case ele.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}"`:Kse.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ele.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 ele.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 ele.custom:n="Invalid input";break;case ele.invalid_intersection_types:n="Intersection results could not be merged";break;case ele.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ele.not_finite:n="Number must be finite";break;default:n=t.defaultError,Kse.assertNever(e)}return{message:n}};let rle=nle;function ole(){return rle}const ile=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 ale(e,t){const n=ole(),r=ile({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===nle?void 0:nle].filter((e=>!!e))});e.common.issues.push(r)}class sle{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 lle;"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 sle.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 lle;if("aborted"===o.status)return lle;"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 lle=Object.freeze({status:"aborted"}),cle=e=>({status:"dirty",value:e}),ule=e=>({status:"valid",value:e}),dle=e=>"aborted"===e.status,ple=e=>"dirty"===e.status,fle=e=>"valid"===e.status,hle=e=>"undefined"!=typeof Promise&&e instanceof Promise;function mle(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 gle(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 vle,yle,ble,wle;"function"==typeof SuppressedError&&SuppressedError,(yle=vle||(vle={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},yle.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class xle{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 _le=(e,t)=>{if(fle(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 tle(e.common.issues);return this._error=t,this._error}}};function Sle(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 Ele{get description(){return this._def.description}_getType(e){return Jse(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Jse(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sle,ctx:{common:e.parent.common,data:e.data,parsedType:Jse(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(hle(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:Jse(e)},o=this._parseSync({data:e,path:r.path,parent:r});return _le(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:Jse(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return fle(t)?{value:t.value}:{issues:r.common.issues}}catch(O_e){(null===(n=null===(t=null==O_e?void 0:O_e.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=>fle(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:Jse(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(hle(r)?r:Promise.resolve(r));return _le(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:ele.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 xce({schema:this,typeName:Nce.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 _ce.create(this,this._def)}nullable(){return Sce.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ace.create(this)}promise(){return wce.create(this,this._def)}or(e){return cce.create([this,e],this._def)}and(e){return dce.create(this,e,this._def)}transform(e){return new xce({...Sle(this._def),schema:this,typeName:Nce.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ece({...Sle(this._def),innerType:this,defaultValue:t,typeName:Nce.ZodDefault})}brand(){return new Ace({typeName:Nce.ZodBranded,type:this,...Sle(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Tce({...Sle(this._def),innerType:this,catchValue:t,typeName:Nce.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Rce.create(this,e)}readonly(){return Oce.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Tle=/^c[^\s-]{8,}$/i,Cle=/^[0-9a-z]+$/,Ale=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rle=/^[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,Ole=/^[a-z0-9_-]{21}$/i,Nle=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ple=/^[-+]?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)?)??$/,kle=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Lle;const Dle=/^(?:(?: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])$/,Mle=/^(?:(?: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])$/,jle=/^(([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]))$/,Ile=/^(([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])$/,Fle=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ule=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$le="((\\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])))",Vle=new RegExp(`^${$le}$`);function Ble(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 zle(e){return new RegExp(`^${Ble(e)}$`)}function Hle(e){let t=`${$le}T${Ble(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 qle(e,t){if(!Nle.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(N_e){return!1}}function Gle(e,t){return!("v4"!==t&&t||!Mle.test(e))||!("v6"!==t&&t||!Ile.test(e))}class Kle extends Ele{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Zse.string){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.string,received:t.parsedType}),lle}const t=new sle;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.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),ale(n,{code:ele.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?ale(n,{code:ele.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&ale(n,{code:ele.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)kle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"email",code:ele.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)Lle||(Lle=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Lle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"emoji",code:ele.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)Rle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"uuid",code:ele.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)Ole.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"nanoid",code:ele.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)Tle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"cuid",code:ele.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)Cle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"cuid2",code:ele.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)Ale.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"ulid",code:ele.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(N_e){n=this._getOrReturnCtx(e,n),ale(n,{validation:"url",code:ele.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),ale(n,{validation:"regex",code:ele.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),ale(n,{code:ele.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),ale(n,{code:ele.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),ale(n,{code:ele.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){Hle(i).test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Vle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){zle(i).test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?Ple.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"duration",code:ele.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!Dle.test(r))&&("v6"!==o&&o||!jle.test(r))&&(n=this._getOrReturnCtx(e,n),ale(n,{validation:"ip",code:ele.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?qle(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"jwt",code:ele.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Gle(e.data,i.version)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"cidr",code:ele.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?Fle.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"base64",code:ele.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Ule.test(e.data)||(n=this._getOrReturnCtx(e,n),ale(n,{validation:"base64url",code:ele.invalid_string,message:i.message}),t.dirty()):Kse.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:ele.invalid_string,...vle.errToObj(n)})}_addCheck(e){return new Kle({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...vle.errToObj(e)})}url(e){return this._addCheck({kind:"url",...vle.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...vle.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...vle.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...vle.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...vle.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...vle.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...vle.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...vle.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...vle.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...vle.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...vle.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...vle.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,...vle.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,...vle.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...vle.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...vle.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...vle.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...vle.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...vle.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...vle.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...vle.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...vle.errToObj(t)})}nonempty(e){return this.min(1,vle.errToObj(e))}trim(){return new Kle({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Kle({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Kle({...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 Wle(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)}Kle.create=e=>{var t;return new Kle({checks:[],typeName:Nce.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Sle(e)})};class Yle extends Ele{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)!==Zse.number){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.number,received:t.parsedType}),lle}let t;const n=new sle;for(const r of this._def.checks)if("int"===r.kind)Kse.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),ale(t,{code:ele.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),ale(t,{code:ele.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),ale(t,{code:ele.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==Wle(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),ale(t,{code:ele.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),ale(t,{code:ele.not_finite,message:r.message}),n.dirty()):Kse.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,vle.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vle.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vle.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vle.toString(t))}setLimit(e,t,n,r){return new Yle({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:vle.toString(r)}]})}_addCheck(e){return new Yle({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:vle.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:vle.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:vle.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:vle.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:vle.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vle.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:vle.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:vle.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:vle.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&&Kse.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)}}Yle.create=e=>new Yle({checks:[],typeName:Nce.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Sle(e)});class Xle extends Ele{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(N_e){return this._getInvalidInput(e)}if(this._getType(e)!==Zse.bigint)return this._getInvalidInput(e);let t;const n=new sle;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),ale(t,{code:ele.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),ale(t,{code:ele.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),ale(t,{code:ele.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Kse.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.bigint,received:t.parsedType}),lle}gte(e,t){return this.setLimit("min",e,!0,vle.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vle.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vle.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vle.toString(t))}setLimit(e,t,n,r){return new Xle({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:vle.toString(r)}]})}_addCheck(e){return new Xle({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:vle.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:vle.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:vle.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:vle.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vle.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}}Xle.create=e=>{var t;return new Xle({checks:[],typeName:Nce.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Sle(e)})};class Qle extends Ele{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Zse.boolean){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.boolean,received:t.parsedType}),lle}return ule(e.data)}}Qle.create=e=>new Qle({typeName:Nce.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Sle(e)});class Zle extends Ele{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Zse.date){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.date,received:t.parsedType}),lle}if(isNaN(e.data.getTime())){return ale(this._getOrReturnCtx(e),{code:ele.invalid_date}),lle}const t=new sle;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),ale(n,{code:ele.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),ale(n,{code:ele.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Kse.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Zle({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:vle.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:vle.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}}Zle.create=e=>new Zle({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Nce.ZodDate,...Sle(e)});class Jle extends Ele{_parse(e){if(this._getType(e)!==Zse.symbol){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.symbol,received:t.parsedType}),lle}return ule(e.data)}}Jle.create=e=>new Jle({typeName:Nce.ZodSymbol,...Sle(e)});class ece extends Ele{_parse(e){if(this._getType(e)!==Zse.undefined){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.undefined,received:t.parsedType}),lle}return ule(e.data)}}ece.create=e=>new ece({typeName:Nce.ZodUndefined,...Sle(e)});class tce extends Ele{_parse(e){if(this._getType(e)!==Zse.null){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.null,received:t.parsedType}),lle}return ule(e.data)}}tce.create=e=>new tce({typeName:Nce.ZodNull,...Sle(e)});class nce extends Ele{constructor(){super(...arguments),this._any=!0}_parse(e){return ule(e.data)}}nce.create=e=>new nce({typeName:Nce.ZodAny,...Sle(e)});class rce extends Ele{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ule(e.data)}}rce.create=e=>new rce({typeName:Nce.ZodUnknown,...Sle(e)});class oce extends Ele{_parse(e){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.never,received:t.parsedType}),lle}}oce.create=e=>new oce({typeName:Nce.ZodNever,...Sle(e)});class ice extends Ele{_parse(e){if(this._getType(e)!==Zse.undefined){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.void,received:t.parsedType}),lle}return ule(e.data)}}ice.create=e=>new ice({typeName:Nce.ZodVoid,...Sle(e)});class ace extends Ele{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Zse.array)return ale(t,{code:ele.invalid_type,expected:Zse.array,received:t.parsedType}),lle;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(ale(t,{code:e?ele.too_big:ele.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&&(ale(t,{code:ele.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&&(ale(t,{code:ele.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 xle(t,e,t.path,n))))).then((e=>sle.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new xle(t,e,t.path,n))));return sle.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new ace({...this._def,minLength:{value:e,message:vle.toString(t)}})}max(e,t){return new ace({...this._def,maxLength:{value:e,message:vle.toString(t)}})}length(e,t){return new ace({...this._def,exactLength:{value:e,message:vle.toString(t)}})}nonempty(e){return this.min(1,e)}}function sce(e){if(e instanceof lce){const t={};for(const n in e.shape){t[n]=_ce.create(sce(e.shape[n]))}return new lce({...e._def,shape:()=>t})}return e instanceof ace?new ace({...e._def,type:sce(e.element)}):e instanceof _ce?_ce.create(sce(e.unwrap())):e instanceof Sce?Sce.create(sce(e.unwrap())):e instanceof pce?pce.create(e.items.map((e=>sce(e)))):e}ace.create=(e,t)=>new ace({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Nce.ZodArray,...Sle(t)});class lce extends Ele{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=Kse.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Zse.object){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.object,received:t.parsedType}),lle}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof oce&&"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 xle(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof oce){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&&(ale(n,{code:ele.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 xle(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=>sle.mergeObjectSync(t,e))):sle.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new lce({...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=vle.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new lce({...this._def,unknownKeys:"strip"})}passthrough(){return new lce({...this._def,unknownKeys:"passthrough"})}extend(e){return new lce({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new lce({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Nce.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new lce({...this._def,catchall:e})}pick(e){const t={};return Kse.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new lce({...this._def,shape:()=>t})}omit(e){const t={};return Kse.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new lce({...this._def,shape:()=>t})}deepPartial(){return sce(this)}partial(e){const t={};return Kse.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new lce({...this._def,shape:()=>t})}required(e){const t={};return Kse.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof _ce;)e=e._def.innerType;t[n]=e}})),new lce({...this._def,shape:()=>t})}keyof(){return vce(Kse.objectKeys(this.shape))}}lce.create=(e,t)=>new lce({shape:()=>e,unknownKeys:"strip",catchall:oce.create(),typeName:Nce.ZodObject,...Sle(t)}),lce.strictCreate=(e,t)=>new lce({shape:()=>e,unknownKeys:"strict",catchall:oce.create(),typeName:Nce.ZodObject,...Sle(t)}),lce.lazycreate=(e,t)=>new lce({shape:e,unknownKeys:"strip",catchall:oce.create(),typeName:Nce.ZodObject,...Sle(t)});class cce extends Ele{_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 tle(e.ctx.common.issues)));return ale(t,{code:ele.invalid_union,unionErrors:n}),lle}));{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 tle(e)));return ale(t,{code:ele.invalid_union,unionErrors:o}),lle}}get options(){return this._def.options}}cce.create=(e,t)=>new cce({options:e,typeName:Nce.ZodUnion,...Sle(t)});function uce(e,t){const n=Jse(e),r=Jse(t);if(e===t)return{valid:!0,data:e};if(n===Zse.object&&r===Zse.object){const n=Kse.objectKeys(t),r=Kse.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=uce(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===Zse.array&&r===Zse.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=uce(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===Zse.date&&r===Zse.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class dce extends Ele{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(dle(e)||dle(r))return lle;const o=uce(e.value,r.value);return o.valid?((ple(e)||ple(r))&&t.dirty(),{status:t.value,value:o.data}):(ale(n,{code:ele.invalid_intersection_types}),lle)};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}))}}dce.create=(e,t,n)=>new dce({left:e,right:t,typeName:Nce.ZodIntersection,...Sle(n)});class pce extends Ele{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Zse.array)return ale(n,{code:ele.invalid_type,expected:Zse.array,received:n.parsedType}),lle;if(n.data.length<this._def.items.length)return ale(n,{code:ele.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),lle;!this._def.rest&&n.data.length>this._def.items.length&&(ale(n,{code:ele.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 xle(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>sle.mergeArray(t,e))):sle.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new pce({...this._def,rest:e})}}pce.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pce({items:e,typeName:Nce.ZodTuple,rest:null,...Sle(t)})};class fce extends Ele{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!==Zse.map)return ale(n,{code:ele.invalid_type,expected:Zse.map,received:n.parsedType}),lle;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new xle(n,e,n.path,[i,"key"])),value:o._parse(new xle(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 lle;"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 lle;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}fce.create=(e,t,n)=>new fce({valueType:t,keyType:e,typeName:Nce.ZodMap,...Sle(n)});class hce extends Ele{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Zse.set)return ale(n,{code:ele.invalid_type,expected:Zse.set,received:n.parsedType}),lle;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(ale(n,{code:ele.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&&(ale(n,{code:ele.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 lle;"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 xle(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new hce({...this._def,minSize:{value:e,message:vle.toString(t)}})}max(e,t){return new hce({...this._def,maxSize:{value:e,message:vle.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}hce.create=(e,t)=>new hce({valueType:e,minSize:null,maxSize:null,typeName:Nce.ZodSet,...Sle(t)});class mce extends Ele{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})}}mce.create=(e,t)=>new mce({getter:e,typeName:Nce.ZodLazy,...Sle(t)});class gce extends Ele{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return ale(t,{received:t.data,code:ele.invalid_literal,expected:this._def.value}),lle}return{status:"valid",value:e.data}}get value(){return this._def.value}}function vce(e,t){return new yce({values:e,typeName:Nce.ZodEnum,...Sle(t)})}gce.create=(e,t)=>new gce({value:e,typeName:Nce.ZodLiteral,...Sle(t)});class yce extends Ele{constructor(){super(...arguments),ble.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return ale(t,{expected:Kse.joinValues(this._def.values),received:t.parsedType,code:ele.invalid_type}),lle}if(mle(this,ble)||gle(this,ble,new Set(this._def.values)),!mle(this,ble).has(e.data)){const t=this._getOrReturnCtx(e);return ale(t,{received:t.data,code:ele.invalid_enum_value,options:this._def.values}),lle}return ule(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 yce.create(e,{...this._def,...t})}exclude(e,t=this._def){return yce.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}ble=new WeakMap,yce.create=vce;class bce extends Ele{constructor(){super(...arguments),wle.set(this,void 0)}_parse(e){const t=Kse.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Zse.string&&n.parsedType!==Zse.number){const e=Kse.objectValues(t);return ale(n,{expected:Kse.joinValues(e),received:n.parsedType,code:ele.invalid_type}),lle}if(mle(this,wle)||gle(this,wle,new Set(Kse.getValidEnumValues(this._def.values))),!mle(this,wle).has(e.data)){const e=Kse.objectValues(t);return ale(n,{received:n.data,code:ele.invalid_enum_value,options:e}),lle}return ule(e.data)}get enum(){return this._def.values}}wle=new WeakMap,bce.create=(e,t)=>new bce({values:e,typeName:Nce.ZodNativeEnum,...Sle(t)});class wce extends Ele{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Zse.promise&&!1===t.common.async)return ale(t,{code:ele.invalid_type,expected:Zse.promise,received:t.parsedType}),lle;const n=t.parsedType===Zse.promise?t.data:Promise.resolve(t.data);return ule(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}wce.create=(e,t)=>new wce({type:e,typeName:Nce.ZodPromise,...Sle(t)});class xce extends Ele{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Nce.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=>{ale(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 lle;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?lle:"dirty"===r.status||"dirty"===t.value?cle(r.value):r}));{if("aborted"===t.value)return lle;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?lle:"dirty"===r.status||"dirty"===t.value?cle(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?lle:("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?lle:("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(!fle(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=>fle(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}Kse.assertNever(r)}}xce.create=(e,t,n)=>new xce({schema:e,typeName:Nce.ZodEffects,effect:t,...Sle(n)}),xce.createWithPreprocess=(e,t,n)=>new xce({schema:t,effect:{type:"preprocess",transform:e},typeName:Nce.ZodEffects,...Sle(n)});class _ce extends Ele{_parse(e){return this._getType(e)===Zse.undefined?ule(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_ce.create=(e,t)=>new _ce({innerType:e,typeName:Nce.ZodOptional,...Sle(t)});class Sce extends Ele{_parse(e){return this._getType(e)===Zse.null?ule(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sce.create=(e,t)=>new Sce({innerType:e,typeName:Nce.ZodNullable,...Sle(t)});class Ece extends Ele{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Zse.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ece.create=(e,t)=>new Ece({innerType:e,typeName:Nce.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Sle(t)});class Tce extends Ele{_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 hle(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new tle(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new tle(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Tce.create=(e,t)=>new Tce({innerType:e,typeName:Nce.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Sle(t)});class Cce extends Ele{_parse(e){if(this._getType(e)!==Zse.nan){const t=this._getOrReturnCtx(e);return ale(t,{code:ele.invalid_type,expected:Zse.nan,received:t.parsedType}),lle}return{status:"valid",value:e.data}}}Cce.create=e=>new Cce({typeName:Nce.ZodNaN,...Sle(e)});class Ace extends Ele{_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 Rce extends Ele{_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?lle:"dirty"===e.status?(t.dirty(),cle(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?lle:"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 Rce({in:e,out:t,typeName:Nce.ZodPipeline})}}class Oce extends Ele{_parse(e){const t=this._def.innerType._parse(e),n=e=>(fle(e)&&(e.value=Object.freeze(e.value)),e);return hle(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}var Nce,Pce;Oce.create=(e,t)=>new Oce({innerType:e,typeName:Nce.ZodReadonly,...Sle(t)}),(Pce=Nce||(Nce={})).ZodString="ZodString",Pce.ZodNumber="ZodNumber",Pce.ZodNaN="ZodNaN",Pce.ZodBigInt="ZodBigInt",Pce.ZodBoolean="ZodBoolean",Pce.ZodDate="ZodDate",Pce.ZodSymbol="ZodSymbol",Pce.ZodUndefined="ZodUndefined",Pce.ZodNull="ZodNull",Pce.ZodAny="ZodAny",Pce.ZodUnknown="ZodUnknown",Pce.ZodNever="ZodNever",Pce.ZodVoid="ZodVoid",Pce.ZodArray="ZodArray",Pce.ZodObject="ZodObject",Pce.ZodUnion="ZodUnion",Pce.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Pce.ZodIntersection="ZodIntersection",Pce.ZodTuple="ZodTuple",Pce.ZodRecord="ZodRecord",Pce.ZodMap="ZodMap",Pce.ZodSet="ZodSet",Pce.ZodFunction="ZodFunction",Pce.ZodLazy="ZodLazy",Pce.ZodLiteral="ZodLiteral",Pce.ZodEnum="ZodEnum",Pce.ZodEffects="ZodEffects",Pce.ZodNativeEnum="ZodNativeEnum",Pce.ZodOptional="ZodOptional",Pce.ZodNullable="ZodNullable",Pce.ZodDefault="ZodDefault",Pce.ZodCatch="ZodCatch",Pce.ZodPromise="ZodPromise",Pce.ZodBranded="ZodBranded",Pce.ZodPipeline="ZodPipeline",Pce.ZodReadonly="ZodReadonly";const kce=Kle.create,Lce=lce.create,Dce=e=>{const{children:t,...r}=e;return n.createElement(Yae.Provider,{value:r},t)},Mce=i.createContext({}),jce=({...e})=>t.jsx(Mce.Provider,{value:{name:e.name},children:t.jsx(ose,{...e})}),Ice=()=>{const e=i.useContext(Mce),t=i.useContext(Fce),{getFieldState:n,formState:r}=Xae(),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}},Fce=i.createContext({}),Uce=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(Fce.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:Yd("space-y-2",e),...n})})}));Uce.displayName="FormItem";const $ce=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=Ice();return t.jsx(z9,{ref:r,className:Yd(o&&"text-destructive",e),htmlFor:i,...n})}));$ce.displayName="FormLabel";const Vce=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=Ice();return t.jsx(YU,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));Vce.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=Ice();return t.jsx("p",{ref:r,id:o,className:Yd("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const Bce=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=Ice(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:Yd("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));Bce.displayName="FormMessage";const zce=Lce({name:kce().min(2,"Title must be at least 2 characters"),description:kce()});function Hce({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=hae(),{toast:i}=Ll(),a=Bse({resolver:Qse(zce),defaultValues:{name:`${o?.name} (copy)`,description:o?.description??""}});return t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"sm:max-w-[425px]",children:[t.jsx(EB,{children:t.jsx(CB,{children:"Duplicate Automation"})}),t.jsx(Dce,{...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 Oe(`${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(jce,{control:a.control,name:"name",disabled:!0,render:({field:e})=>t.jsxs(Uce,{children:[t.jsx($ce,{children:"Title"}),t.jsx(Vce,{children:t.jsx(tQ,{...e})}),t.jsx(Bce,{})]})}),t.jsx(jce,{control:a.control,name:"description",disabled:!0,render:({field:e})=>t.jsxs(Uce,{children:[t.jsx($ce,{children:"Description"}),t.jsx(Vce,{children:t.jsx(nQ,{...e})}),t.jsx(Bce,{})]})}),t.jsx(TB,{children:t.jsx(VX,{type:"submit",children:"Duplicate"})})]})})]})})}const qce=Lce({name:kce().min(2,"Title must be at least 2 characters"),description:kce()});function Gce({open:e,onOpenChange:n}){const r=hae(),{updateAutomation:o}=Me(r?.id||""),i=Bse({resolver:Qse(qce),defaultValues:{name:r?.name??"",description:r?.description??""}});return r?t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"sm:max-w-[425px]",children:[t.jsxs(EB,{children:[t.jsx(CB,{children:"Edit Automation"}),t.jsx(AB,{children:"Update the title and description of your automation."})]}),t.jsx(Dce,{...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(jce,{control:i.control,name:"name",render:({field:e})=>t.jsxs(Uce,{children:[t.jsx($ce,{children:"Title"}),t.jsx(Vce,{children:t.jsx(tQ,{...e})}),t.jsx(Bce,{})]})}),t.jsx(jce,{control:i.control,name:"description",render:({field:e})=>t.jsxs(Uce,{children:[t.jsx($ce,{children:"Description"}),t.jsx(Vce,{children:t.jsx(nQ,{...e})}),t.jsx(Bce,{})]})}),t.jsx(TB,{children:t.jsx(VX,{type:"submit",children:"Save changes"})})]})})]})}):null}function Kce({open:e,onOpenChange:n,setIsActive:r}){const o=hae(),{updateAutomation:i}=Me(o?.id||""),{toast:a}=Ll();return t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"sm:max-w-[425px]",children:[t.jsx(EB,{children:t.jsxs(CB,{children:["Deactivate ",df("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}),df("engage:automation"),"?"]}),t.jsxs(TB,{className:"gap-2 sm:gap-0",children:[t.jsx(VX,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(VX,{variant:"destructive",onClick:()=>{i({status:$e.DRAFT}),n(!1),r(!1),a({title:`Updated ${df("engage:automation")}`,description:`${df("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const Wce=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=hae(),a=s2(),{updateAutomation:s}=Me(i?.id||""),{toast:l}=Ll(),c=(()=>{const{state:e}=fae();return e.recipientStats})(),u=mae(),[d,p]=n.useState(void 0),[f,h]=n.useState(!1),[m,g]=n.useState(!1),[v,y]=n.useState(!1);n.useEffect((()=>{if(i&&void 0===d)switch(i.status){case $e.ACTIVE:p(!0);break;case $e.DRAFT:p(!1);break;case $e.RUNNING:case $e.COMPLETED:p(!0);break;case $e.FAILED:case $e.DEACTIVATED:p(!1);break;default:throw eQ(i.status,$e)}}),[i,d]);const b=n.useCallback((()=>{if(!i)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});if(!i)return null;let e=!1;switch(i.status){case $e.ACTIVE:case $e.DRAFT:e=!1;break;case $e.DEACTIVATED:case $e.RUNNING:case $e.COMPLETED:case $e.FAILED:e=!0;break;default:throw eQ(i.status,$e)}return t.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[t.jsx(d?du:bu,{className:"w-4 h-4"}),t.jsx("div",{className:"text-[13px] font-medium",children:d?"Active":"Inactive"}),t.jsx(Jne,{checked:d,onCheckedChange:async e=>{if(d&&!e)y(!0);else{if(o&&!0===e){let e=0;for(;!c&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!c)return void l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"});const t=await o({estimatedEmailRecipients:c?.emails??0,estimatedSmsRecipients:c?.phones??0});if(!0!==t)return void l({title:"Error while updating the status",description:t,variant:"destructive"})}switch(i.triggerType){case Fe.ONE_TIME:if(!i.triggerMetadata||!("scheduledAt"in i.triggerMetadata)||!i.triggerMetadata?.scheduledAt)return void l({title:"Ensure you have selected a scheduled time",variant:"destructive"});if(!u||!u.emailChannelSenderId&&!u.smsChannelSenderId)return void l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"});break;case Fe.TRIGGER_BASED:break;default:throw eQ(i.triggerType,Fe)}s({status:e?$e.ACTIVE:$e.DEACTIVATED},{onSuccess:()=>{p(e),l({title:`${df("engage:automation")} 🚀`,description:`${df("engage:automation")} status updated to ${e?"active":"inactive"} 🚀`})},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"})}})}},disabled:e})]})}),[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(VX,{variant:"ghost",size:"icon",onClick:()=>a(-1),children:t.jsx(su,{})}),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(VX,{variant:"ghost",size:"icon",onClick:()=>h(!0),children:t.jsx(qX.EditIcon,{})}),t.jsx(VX,{variant:"ghost",size:"icon",onClick:()=>g(!0),children:t.jsx(qX.DuplicateIcon,{})})]})}),b()]}),t.jsx(Gce,{open:f,onOpenChange:h}),t.jsx(Hce,{open:m,onOpenChange:g,onDuplicationCreated:r}),t.jsx(Kce,{open:v,onOpenChange:y,setIsActive:p})]}):null},Yce=()=>{const e=hae(),{isLoading:n}=je(e?.id);return!e||n?t.jsx(FX,{text:[`Fetching ${df("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(Y0,{automationId:e.id,automation:e,includeSales:!0})})},Xce=()=>{const e=hae(),{recipients:n,isLoading:r,fetchError:o}=Le(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(k6,{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(qX.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 ",df("engage:automation")," currently has no assigned recipients. Please update the include or exclude"," ",df("engage:segment",{count:2})," to add recipients."]})]}):t.jsx(FX,{text:["Fetching Recipients","Finishing up"]})},Qce=n.createContext(null);Qce.displayName="PanelGroupContext";const Zce="data-panel-group",Jce="data-panel-group-direction",eue="data-panel-group-id",tue="data-panel",nue="data-panel-collapsible",rue="data-panel-id",oue="data-panel-size",iue="data-resize-handle",aue="data-resize-handle-active",sue="data-panel-resize-handle-enabled",lue="data-panel-resize-handle-id",cue="data-resize-handle-state",uue=n.useLayoutEffect,due=i["useId".toString()],pue="function"==typeof due?due:()=>null;let fue=0;function hue(e=null){const t=pue(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+fue++),null!=e?e:r.current}function mue({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(Qce);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:b,getPanelSize:w,getPanelStyle:x,groupId:_,isPanelCollapsed:S,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:C,unregisterPanel:A}=v,R=hue(s),O=n.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:r,collapsible:o,defaultSize:i,maxSize:l,minSize:c},id:R,idIsFromProps:void 0!==s,order:f});n.useRef({didLogMissingDefaultSizeWarning:!1}),uue((()=>{const{callbacks:e,constraints:t}=O.current,n={...t};O.current.id=R,O.current.idIsFromProps=void 0!==s,O.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(O.current,n)})),uue((()=>{const e=O.current;return T(e),()=>{A(e)}}),[f,R,T,A]),n.useImperativeHandle(a,(()=>({collapse:()=>{y(O.current)},expand:e=>{b(O.current,e)},getId:()=>R,getSize:()=>w(O.current),isCollapsed:()=>S(O.current),isExpanded:()=>!S(O.current),resize:e=>{C(O.current,e)}})),[y,b,w,S,R,C]);const N=x(O.current,i);return n.createElement(m,{...g,children:e,className:t,id:R,style:{...N,...h},[eue]:_,[tue]:"",[nue]:o||void 0,[rue]:R,[oue]:parseFloat(""+N.flexGrow).toFixed(1)})}const gue=n.forwardRef(((e,t)=>n.createElement(mue,{...e,forwardedRef:t})));mue.displayName="Panel",gue.displayName="forwardRef(Panel)";let vue=null,yue=-1,bue=null;function wue(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&Lue),n=!!(t&Due);if(t&Pue)return e?"se-resize":n?"ne-resize":"e-resize";if(t&kue)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(vue!==o){var i;if(vue=o,null===bue&&(bue=document.createElement("style"),document.head.appendChild(bue)),yue>=0)null===(i=bue.sheet)||void 0===i||i.removeRule(yue);yue=null!==(n=null===(r=bue.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function xue(e){return"keydown"===e.type}function _ue(e){return e.type.startsWith("pointer")}function Sue(e){return e.type.startsWith("mouse")}function Eue(e){if(_ue(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Sue(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const Tue=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Cue(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=Nue(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||(!!Tue.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function Aue(e){let t=e.length;for(;t--;){const n=e[t];if(Que(n,"Missing node"),Cue(n))return n}return null}function Rue(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Oue(e){const t=[];for(;e;)t.push(e),e=Nue(e);return t}function Nue(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Pue=1,kue=2,Lue=4,Due=8,Mue="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let jue=[],Iue=!1,Fue=new Map,Uue=new Map;const $ue=new Set;function Vue(e){const{target:t}=e,{x:n,y:r}=Eue(e);Iue=!0,que({target:t,x:n,y:r}),Yue(),jue.length>0&&(Xue("down",e),e.preventDefault(),Hue(t)||e.stopImmediatePropagation())}function Bue(e){const{x:t,y:n}=Eue(e);if(Iue&&0===e.buttons&&(Iue=!1,Xue("up",e)),!Iue){const{target:r}=e;que({target:r,x:t,y:n})}Xue("move",e),Kue(),jue.length>0&&e.preventDefault()}function zue(e){const{target:t}=e,{x:n,y:r}=Eue(e);Uue.clear(),Iue=!1,jue.length>0&&(e.preventDefault(),Hue(t)||e.stopImmediatePropagation()),Xue("up",e),que({target:t,x:n,y:r}),Kue(),Yue()}function Hue(e){let t=e;for(;t;){if(t.hasAttribute(iue))return!0;t=t.parentElement}return!1}function que({target:e,x:t,y:n}){jue.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),$ue.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=Mue?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:Oue(e),b:Oue(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Que(r,"Stacking order can only be calculated for elements with a common ancestor");const o=Rue(Aue(n.a)),i=Rue(Aue(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}jue.push(e)}var p,f}))}function Gue(e,t){Uue.set(e,t)}function Kue(){let e=!1,t=!1;jue.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;Uue.forEach((e=>{n|=e})),e&&t?wue("intersection",n):e?wue("horizontal",n):t?wue("vertical",n):null!==bue&&(document.head.removeChild(bue),vue=null,bue=null,yue=-1)}let Wue=new AbortController;function Yue(){Wue.abort(),Wue=new AbortController;const e={capture:!0,signal:Wue.signal};$ue.size&&(Iue?(jue.length>0&&Fue.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",zue,e),r.addEventListener("pointerleave",Bue,e),r.addEventListener("pointermove",Bue,e))})),Fue.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",zue,e),r.addEventListener("pointercancel",zue,e)}))):Fue.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",Vue,e),r.addEventListener("pointermove",Bue,e))})))}function Xue(e,t){$ue.forEach((n=>{const{setResizeHandlerState:r}=n,o=jue.includes(n);r(e,o,t)}))}function Que(e,t){if(!e)throw Error(t)}function Zue(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Jue(e,t,n=10){return 0===Zue(e,t,n)}function ede(e,t,n){return 0===Zue(e,t,n)}function tde({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Que(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(Zue(n,s)<0)if(i){n=Zue(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function nde({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(ede(e,0))return t;const a=[...t],[s,l]=r;Que(null!=s,"Invalid first pivot index"),Que(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];Que(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(Que(null!=n,`Previous layout not found for panel index ${r}`),ede(n,i)){const t=c-n;Zue(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];Que(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(Que(null!=n,`Previous layout not found for panel index ${r}`),ede(n,c)){const t=n-i;Zue(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];Que(null!=e,`Previous layout not found for panel index ${o}`);if(i+=tde({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];Que(null!=i,`Previous layout not found for panel index ${r}`);const s=tde({panelConstraints:n,panelIndex:r,size:i-o});if(!ede(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(!ede(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];Que(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=tde({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!ede(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];Que(null!=o,`Previous layout not found for panel index ${r}`);const i=tde({panelConstraints:n,panelIndex:r,size:o+t});if(ede(o,i)||(t-=i-o,a[r]=i),ede(t,0))break;e>0?r--:r++}}}return ede(a.reduce(((e,t)=>t+e),0),100)?a:o}function rde({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];Que(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 ode(e,t=document){return Array.from(t.querySelectorAll(`[${lue}][data-panel-group-id="${e}"]`))}function ide(e,t,n=document){const r=ode(e,n).findIndex((e=>e.getAttribute(lue)===t));return null!=r?r:null}function ade(e,t,n){const r=ide(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function sde(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 lde(e,t=document){const n=t.querySelector(`[${lue}="${e}"]`);return n||null}function cde({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),uue((()=>{if(!a)return;const e=ode(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=rde({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];Que(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;Que(e,"Eager values not found");const{panelDataArray:n}=e;Que(null!=sde(r,a),`No group found for id "${r}"`);const i=ode(r,a);Que(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(lue);Que(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=lde(t,r),c=ode(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];Que(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=nde({delta:ede(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:ade(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 ude(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 dde(e,t){const n="horizontal"===e,{x:r,y:o}=Eue(t);return n?r:o}function pde(e,t,n,r,o,i){if(xue(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=lde(t,o);Que(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(eue);Que(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=dde(n,e),u=sde(s,o);Que(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 fde(e,t,n){t.forEach(((t,r)=>{const o=e[r];Que(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&&!Jue(u,l)||Jue(t,l)||r(),!e||null!=u&&Jue(u,l)||!Jue(t,l)||e())}}))}function hde(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 mde(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 gde(e){return`react-resizable-panels:${e}`}function vde(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 yde(e,t){try{const n=gde(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 bde(e,t,n,r,o){var i;const a=gde(e),s=vde(t),l=null!==(i=yde(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 wde({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(!ede(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];Que(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];Que(null!=e,`No layout data found for index ${i}`);const r=tde({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!ede(o,0))for(let i=0;i<t.length;i++){const e=n[i];Que(null!=e,`No layout data found for index ${i}`);const r=tde({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,ede(o,0)))break}return n}const xde={getItem:e=>(mde(xde),xde.getItem(e)),setItem:(e,t)=>{mde(xde),xde.setItem(e,t)}},_de={};function Sde({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=xde,style:u,tagName:d="div",...p}){const f=hue(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))),[])}(),w=n.useRef({}),x=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=wde({layout:e,panelConstraints:r.map((e=>e.constraints))});ude(n,o)||(y(o),E.current.layout=o,t&&t(o),fde(r,o,w.current))}})),[]),uue((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),cde({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=_de[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(bde,100),_de[e]=n);const r=[...t],o=new Map(x.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}=Cde(r,e,n);if(Que(null!=a,`Panel size not found for panel "${e.id}"`),!Jue(a,i)){x.current.set(e.id,a);const l=nde({delta:Tde(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});hde(n,l)||(y(l),E.current.layout=l,t&&t(l),fde(r,l,w.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}=Cde(o,e,r),u=null!=t?t:l;if(Jue(s,a)){const t=x.current.get(e.id),a=null!=t&&t>=u?t:u,l=nde({delta:Tde(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});hde(r,l)||(y(l),E.current.layout=l,n&&n(l),fde(o,l,w.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=Cde(n,e,t);return Que(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),R=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=Tde(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]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=Cde(n,e,t);return Que(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&Jue(i,r)}),[]),N=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=Cde(n,e,t);return Que(null!=i,`Panel size not found for panel "${e.id}"`),!o||Zue(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]);uue((()=>{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=yde(e,n))&&void 0!==r?r:{})[vde(t)])&&void 0!==o?o:null}(e,o,n);t&&(x.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];Que(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];Que(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=wde({layout:i,panelConstraints:o.map((e=>e.constraints))});ude(r,a)||(y(a),E.current.layout=a,t&&t(a),fde(o,a,w.current))}})),uue((()=>{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=ade(a,e,r);let f=pde(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=nde({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:xue(n)?"keyboard":"mouse-or-touch"}),v=!hde(c,g);(_ue(n)||Sue(n))&&_.current!=f&&(_.current=f,Gue(e,v||0===f?0:m?f<0?Pue:kue:f<0?Lue:Due)),v&&(y(g),E.current.layout=g,l&&l(g),fde(u,g,w.current))}}),[]),L=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}=Cde(o,e,r);Que(null!=a,`Panel size not found for panel "${e.id}"`);const l=nde({delta:Tde(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});hde(r,l)||(y(l),E.current.layout=l,n&&n(l),fde(o,l,w.current))}),[]),D=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}=Cde(r,e,n);null!=u&&(i&&s&&Jue(u,o)?Jue(o,a)||L(e,a):u<c?L(e,c):u>l&&L(e,l))}),[L]),M=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=lde(e,h.current);Que(o,`Drag handle element not found for id "${e}"`);const i=dde(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),j=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=Tde(t,e);n>=0&&(t.splice(n,1),delete w.current[e.id],E.current.panelDataArrayChanged=!0,b())}),[b]),F=n.useMemo((()=>({collapsePanel:T,direction:o,dragState:m,expandPanel:C,getPanelSize:A,getPanelStyle:R,groupId:f,isPanelCollapsed:O,isPanelExpanded:N,reevaluatePanelConstraints:D,registerPanel:P,registerResizeHandle:k,resizePanel:L,startDragging:M,stopDragging:j,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,R,f,O,N,D,P,k,L,M,j,I]);return n.createElement(Qce.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},[Zce]:"",[Jce]:o,[eue]:f}))}const Ede=n.forwardRef(((e,t)=>n.createElement(Sde,{...e,forwardedRef:t})));function Tde(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function Cde(e,t,n){const r=Tde(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function Ade({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 w=n.useContext(Qce);if(null===w)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:x,groupId:_,registerResizeHandle:S,startDragging:E,stopDragging:T,panelGroupElement:C}=w,A=hue(i),[R,O]=n.useState("inactive"),[N,P]=n.useState(!1),[k,L]=n.useState(null),D=n.useRef({state:R});uue((()=>{D.current.state=R})),n.useEffect((()=>{if(r)L(null);else{const e=S(A);L((()=>e))}}),[r,A,S]);const M=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,j=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;Que(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=Fue.get(a))&&void 0!==i?i:0;return Fue.set(a,l+1),$ue.add(s),Yue(),function(){var t;Uue.delete(e),$ue.delete(s);const n=null!==(t=Fue.get(a))&&void 0!==t?t:1;if(Fue.set(a,n-1),Yue(),1===n&&Fue.delete(a),jue.includes(s)){const e=jue.indexOf(s);e>=0&&jue.splice(e,1),Kue(),o("up",!0,null)}}}(A,e,x,{coarse:M,fine:j},((e,n,r)=>{if(n)switch(e){case"down":{O("drag"),t=!1,Que(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}=D.current;t=!0,"drag"!==e&&O("hover"),Que(r,'Expected event to be defined for "move" action'),k(r);break}case"up":{O("hover"),T();const{onClick:e,onDragging:n,onPointerUp:r}=b.current;null==n||n(!1),null==r||r(),t||null==e||e();break}}else O("inactive")}))}),[M,x,r,j,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=lde(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(eue);Que(r,`No group element found for id "${r}"`);const i=ode(r,o),a=ide(r,t,o);Que(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,[Jce]:x,[eue]:_,[iue]:"",[aue]:"drag"===R?"pointer":N?"keyboard":void 0,[sue]:!r,[lue]:A,[cue]:R})}Sde.displayName="PanelGroup",Ede.displayName="forwardRef(PanelGroup)",Ade.displayName="PanelResizeHandle";const Rde=({className:e,...n})=>t.jsx(Ede,{className:bB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),Ode=gue,Nde=({withHandle:e,className:n,...r})=>t.jsx(Ade,{className:bB("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(Su,{className:"h-2.5 w-2.5"})})});var Pde=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(Pde||{});const kde=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium",children:e}),Lde="rgba(245, 246, 247, 1)",Dde={[Ue.SEND_COMMUNICATION]:{color:{bg:"rgba(205, 241, 225, 1)",text:"rgba(30, 108, 74, 1)",bgUnselected:Lde},clickable:!0},[Ue.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:Lde},clickable:!1}},Mde={[Ue.SEND_COMMUNICATION]:"Send Email & SMS",[Ue.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},jde=({children:e,onClick:n,iconBgColor:r,iconStrokeColor:o,Icon:i,disabled:a=!1,selected:s=!1})=>{const l=i;return t.jsx(TX.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:Lde},className:Yd("flex gap-2 items-center rounded-md transition-colors group","border-2 border-transparent overflow-hidden",!a&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:t.jsxs(VX,{variant:"ghost",className:"text-left w-full h-full flex items-center gap-2 min-h-none whitespace-normal rounded-none px-2 group/trigger-audience",onClick:n,children:[t.jsx("div",{className:Yd("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:Yd("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})})},Ide=({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}),Fde=()=>{const e=hae(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(fQ),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=bQ(),u=n.useCallback((()=>c?.find((e=>e.type===SQ.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(jde,{selected:o===Pde.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(Pde.EditAudience)},Icon:qX.AudienceIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(OQ,{children:"Audience"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(kde,{copyText:`Send to all ${df("engage:user",{count:2})} in ${1===i.length?"this":"these"} ${df("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(Ide,{segmentName:n.name},e):null}))})]})]})})}):null},Ude=()=>{const e=hae(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(fQ),{segments:i}=bQ(),a=`Start this ${df("engage:automation").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||"USER_JOINED_SEGMENT"!==e.triggerMetadata.eventName||!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(jde,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:qX.TriggerIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(OQ,{children:a}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(kde,{copyText:`When ${df("engage:user").toLowerCase()} joins the`}),t.jsx(Ide,{segmentName:r})]})]})}):null}case Fe.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(jde,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(Pde.EditTime)},selected:o===Pde.EditTime,Icon:qX.TriggerIcon,children:[t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(OQ,{children:a}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(kde,n?{copyText:`Click to set the date and time for this ${df("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(Ide,{segmentName:y9(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),t.jsx("div",{className:"",children:n&&t.jsx(IQ,{className:"group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors"})})]})}default:throw eQ(e.triggerType,Fe)}})()})},$de=e=>{switch(e){case Ue.SEND_COMMUNICATION:return"Send Communication";case Ue.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw LX(e,Ue)}},Vde=e=>{switch(e){case Ue.SEND_COMMUNICATION:return t.jsx(qX.CommunicationIcon,{className:"w-4 h-4"});case Ue.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(qX.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw eQ(e,Ue)}},Bde=e=>{if(!(e&&e.actionType===Ue.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}`},zde=({actionData:e})=>{const{state:{selectedActionId:r},setActionId:o}=n.useContext(fQ),i=n.useMemo((()=>r===e.actionMetadata.currentActionId),[r,e.actionMetadata.currentActionId]),a=Dde[e.actionType],s=a.color,l=a.clickable;return t.jsx(TX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:Yd("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",i&&"border-primary",e.actionType!==Ue.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:i?s.bg:s.bgUnselected??Lde},onClick:()=>{l&&o(e.actionMetadata.currentActionId)},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:Vde(e.actionType)}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{style:{color:i?s.text:s.textUnselected},children:t.jsx(OQ,{children:Mde[e.actionType]})}),t.jsx("div",e.actionType===Ue.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:Bde(e.actionMetadata)}:{className:"text-xs font-medium",children:$de(e.actionType)})]})]})})},Hde=()=>{const[e,r]=n.useState(!1),o=hae(),{setActionId:i,state:{selectedActionId:a}}=n.useContext(fQ);if(n.useEffect((()=>{if(!o)return;if(a)return;const e=o.actionData?.find((e=>"send_communication"===e.actionType));e&&i(e.actionMetadata.currentActionId)}),[o,i,a]),!o)return null;const s=(e=>{const{steps:t,rootActionId:n}=e;if(!t||!n)return t??[];const r=new Map(t.map((e=>[e.actionMetadata.currentActionId,e]))),o=r.get(n);if(!o)return t;const i=[];let a=o;for(;a;){i.push(a);const e=a.actionMetadata.nextActionId;if(!e)break;a=r.get(e)}return i})({steps:o.actionData?.filter((t=>!!e||"send_communication"===t.actionType)),rootActionId:o.triggerMetadata?.triggerType===Fe.TRIGGER_BASED?o.triggerMetadata.rootActionId:void 0});let l=()=>t.jsx("div",{});(e||o.triggerType===Fe.ONE_TIME)&&(l=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(Ude,{}),o.triggerType===Fe.ONE_TIME&&t.jsx(Fde,{})]}));return t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[o.description?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",style:{containerType:"inline-size"},children:o.description}):null,o.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(Jne,{defaultChecked:e,onCheckedChange:()=>{r(!e)}})]})]}),t.jsx("div",{className:"flex-1 flex flex-col gap-3",children:t.jsxs(VB,{mode:"popLayout",children:[l(),s.map(((e,n)=>t.jsx(TX.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(zde,{actionData:e})},e.actionMetadata?.currentActionId??n)))]})})]})},qde=()=>{const e=hae(),{segments:n}=bQ();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(Hde,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(FX,{text:[`Getting details on your ${df("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})};function Gde(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Kde(e,n=[]){let r=[];const o=()=>{const t=r.map((e=>i.createContext(e)));return function(n){const r=n?.[e]||t;return i.useMemo((()=>({[`__scope${e}`]:{...n,[e]:r}})),[n,r])}};return o.scopeName=e,[function(n,o){const a=i.createContext(o),s=r.length;r=[...r,o];const l=n=>{const{scope:r,children:o,...l}=n,c=r?.[e]?.[s]||a,u=i.useMemo((()=>l),Object.values(l));return t.jsx(c.Provider,{value:u,children:o})};return l.displayName=n+"Provider",[l,function(t,r){const l=i.useContext(r?.[e]?.[s]||a);if(l)return l;if(void 0!==o)return o;throw new Error(`\`${t}\` must be used within \`${n}\``)}]},Wde(o,...n)]}function Wde(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const r=n.reduce(((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]})),{});return i.useMemo((()=>({[`__scope${t.scopeName}`]:r})),[r])}};return n.scopeName=t.scopeName,n}function Yde(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Xde(...e){return t=>{let n=!1;const r=e.map((e=>{const r=Yde(e,t);return n||"function"!=typeof r||(n=!0),r}));if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():Yde(e[t],null)}}}}function Qde(...e){return i.useCallback(Xde(...e),e)}function Zde(e){const n=Jde(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(tpe);if(l){const e=l.props.children,o=s.map((t=>t===l?i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null:t));return t.jsx(n,{...a,ref:r,children:i.isValidElement(e)?i.cloneElement(e,void 0,o):null})}return t.jsx(n,{...a,ref:r,children:o})}));return r.displayName=`${e}.Slot`,r}function Jde(e){const t=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?Xde(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}var epe=Symbol("radix.slottable");function tpe(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===epe}var npe=globalThis?.document?i.useLayoutEffect:()=>{},rpe=i[" useId ".trim().toString()]||(()=>{}),ope=0;function ipe(e){const[t,n]=i.useState(rpe());return npe((()=>{n((e=>e??String(ope++)))}),[e]),e||(t?`radix-${t}`:"")}var ape=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=Zde(`Primitive.${n}`),o=i.forwardRef(((e,o)=>{const{asChild:i,...a}=e,s=i?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),t.jsx(s,{...a,ref:o})}));return o.displayName=`Primitive.${n}`,{...e,[n]:o}}),{});var spe=i[" useInsertionEffect ".trim().toString()]||npe;function lpe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,s]=function({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return spe((()=>{a.current=t}),[t]),i.useEffect((()=>{o.current!==n&&(a.current?.(n),o.current=n)}),[n,o]),[n,r,a]}({defaultProp:t,onChange:n}),l=void 0!==e,c=l?e:o;{const t=i.useRef(void 0!==e);i.useEffect((()=>{const e=t.current;if(e!==l){}t.current=l}),[l,r])}const u=i.useCallback((t=>{if(l){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&s.current?.(n)}else a(t)}),[l,e,a,s]);return[c,u]}var cpe=i.createContext(void 0);function upe(e){const t=i.useContext(cpe);return e||t||"ltr"}var dpe="rovingFocusGroup.onEntryFocus",ppe={bubbles:!1,cancelable:!0},fpe="RovingFocusGroup",[hpe,mpe,gpe]=function(e){const r=e+"CollectionProvider",[o,i]=Kde(r),[a,s]=o(r,{collectionRef:{current:null},itemMap:new Map}),l=e=>{const{scope:r,children:o}=e,i=n.useRef(null),s=n.useRef(new Map).current;return t.jsx(a,{scope:r,itemMap:s,collectionRef:i,children:o})};l.displayName=r;const c=e+"CollectionSlot",u=Zde(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=Qde(n,s(c,r).collectionRef);return t.jsx(u,{ref:i,children:o})}));d.displayName=c;const p=e+"CollectionItemSlot",f="data-radix-collection-item",h=Zde(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=Qde(r,l),u=s(p,o);return n.useEffect((()=>(u.itemMap.set(l,{ref:l,...a}),()=>{u.itemMap.delete(l)}))),t.jsx(h,{[f]:"",ref:c,children:i})}));return m.displayName=p,[{Provider:l,Slot:d,ItemSlot:m},function(t){const r=s(e+"CollectionConsumer",t);return n.useCallback((()=>{const e=r.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(r.itemMap.values()).sort(((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current)))}),[r.collectionRef,r.itemMap])},i]}(fpe),[vpe,ype]=Kde(fpe,[gpe]),[bpe,wpe]=vpe(fpe),xpe=i.forwardRef(((e,n)=>t.jsx(hpe.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(hpe.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(_pe,{...e,ref:n})})})));xpe.displayName=fpe;var _pe=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:a=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...f}=e,h=i.useRef(null),m=Qde(n,h),g=upe(s),[v,y]=lpe({prop:l,defaultProp:c??null,onChange:u,caller:fpe}),[b,w]=i.useState(!1),x=function(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}(d),_=mpe(r),S=i.useRef(!1),[E,T]=i.useState(0);return i.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(dpe,x),()=>e.removeEventListener(dpe,x)}),[x]),t.jsx(bpe,{scope:r,orientation:o,dir:g,loop:a,currentTabStopId:v,onItemFocus:i.useCallback((e=>y(e)),[y]),onItemShiftTab:i.useCallback((()=>w(!0)),[]),onFocusableItemAdd:i.useCallback((()=>T((e=>e+1))),[]),onFocusableItemRemove:i.useCallback((()=>T((e=>e-1))),[]),children:t.jsx(ape.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:Gde(e.onMouseDown,(()=>{S.current=!0})),onFocus:Gde(e.onFocus,(e=>{if(e.target===e.currentTarget&&!S.current&&!b){const t=new CustomEvent(dpe,ppe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter((e=>e.focusable));Cpe([e.find((e=>e.active)),e.find((e=>e.id===v)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}S.current=!1})),onBlur:Gde(e.onBlur,(()=>w(!1)))})})})),Spe="RovingFocusGroupItem",Epe=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:a=!1,tabStopId:s,children:l,...c}=e,u=ipe(),d=s||u,p=wpe(Spe,r),f=p.currentTabStopId===d,h=mpe(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=p;return i.useEffect((()=>{if(o)return m(),()=>g()}),[o,m,g]),t.jsx(hpe.ItemSlot,{scope:r,id:d,focusable:o,active:a,children:t.jsx(ape.span,{tabIndex:f?0:-1,"data-orientation":p.orientation,...c,ref:n,onMouseDown:Gde(e.onMouseDown,(e=>{o?p.onItemFocus(d):e.preventDefault()})),onFocus:Gde(e.onFocus,(()=>p.onItemFocus(d))),onKeyDown:Gde(e.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void p.onItemShiftTab();if(e.target!==e.currentTarget)return;const t=function(e,t,n){const r=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,n);return"vertical"===t&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)?void 0:Tpe[r]}(e,p.orientation,p.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=h().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===t)o.reverse();else if("prev"===t||"next"===t){"prev"===t&&o.reverse();const i=o.indexOf(e.currentTarget);o=p.loop?(r=i+1,(n=o).map(((e,t)=>n[(r+t)%n.length]))):o.slice(i+1)}setTimeout((()=>Cpe(o)))}var n,r})),children:"function"==typeof l?l({isCurrentTabStop:f,hasTabStop:null!=v}):l})})}));Epe.displayName=Spe;var Tpe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Cpe(e,t=!1){const n=document.activeElement;for(const r of e){if(r===n)return;if(r.focus({preventScroll:t}),document.activeElement!==n)return}}var Ape=xpe,Rpe=Epe;var Ope=e=>{const{present:t,children:n}=e,r=function(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),s=e?"mounted":"unmounted",[l,c]=function(e,t){return i.useReducer(((e,n)=>t[e][n]??e),e)}(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect((()=>{const e=Npe(r.current);a.current="mounted"===l?e:"none"}),[l]),npe((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=Npe(t);if(e)c("MOUNT");else if("none"===i||"none"===t?.display)c("UNMOUNT");else{c(n&&r!==i?"ANIMATION_OUT":"UNMOUNT")}o.current=e}}),[e,c]),npe((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=Npe(r.current).includes(i.animationName);if(i.target===t&&a&&(c("ANIMATION_END"),!o.current)){const r=t.style.animationFillMode;t.style.animationFillMode="forwards",e=n.setTimeout((()=>{"forwards"===t.style.animationFillMode&&(t.style.animationFillMode=r)}))}},s=e=>{e.target===t&&(a.current=Npe(r.current))};return t.addEventListener("animationstart",s),t.addEventListener("animationcancel",i),t.addEventListener("animationend",i),()=>{n.clearTimeout(e),t.removeEventListener("animationstart",s),t.removeEventListener("animationcancel",i),t.removeEventListener("animationend",i)}}c("ANIMATION_END")}),[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:i.useCallback((e=>{r.current=e?getComputedStyle(e):null,n(e)}),[])}}(t),o="function"==typeof n?n({present:r.isPresent}):i.Children.only(n),a=Qde(r.ref,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}(o));return"function"==typeof n||r.isPresent?i.cloneElement(o,{ref:a}):null};function Npe(e){return e?.animationName||"none"}Ope.displayName="Presence";var Ppe="Tabs",[kpe,Lpe]=Kde(Ppe,[ype]),Dpe=ype(),[Mpe,jpe]=kpe(Ppe),Ipe=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=upe(l),[p,f]=lpe({prop:o,onChange:i,defaultProp:a??"",caller:Ppe});return t.jsx(Mpe,{scope:r,baseId:ipe(),value:p,onValueChange:f,orientation:s,dir:d,activationMode:c,children:t.jsx(ape.div,{dir:d,"data-orientation":s,...u,ref:n})})}));Ipe.displayName=Ppe;var Fpe="TabsList",Upe=i.forwardRef(((e,n)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,a=jpe(Fpe,r),s=Dpe(r);return t.jsx(Ape,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:o,children:t.jsx(ape.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:n})})}));Upe.displayName=Fpe;var $pe="TabsTrigger",Vpe=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...a}=e,s=jpe($pe,r),l=Dpe(r),c=Hpe(s.baseId,o),u=qpe(s.baseId,o),d=o===s.value;return t.jsx(Rpe,{asChild:!0,...l,focusable:!i,active:d,children:t.jsx(ape.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...a,ref:n,onMouseDown:Gde(e.onMouseDown,(e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(o)})),onKeyDown:Gde(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(o)})),onFocus:Gde(e.onFocus,(()=>{d||i||!("manual"!==s.activationMode)||s.onValueChange(o)}))})})}));Vpe.displayName=$pe;var Bpe="TabsContent",zpe=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,forceMount:a,children:s,...l}=e,c=jpe(Bpe,r),u=Hpe(c.baseId,o),d=qpe(c.baseId,o),p=o===c.value,f=i.useRef(p);return i.useEffect((()=>{const e=requestAnimationFrame((()=>f.current=!1));return()=>cancelAnimationFrame(e)}),[]),t.jsx(Ope,{present:a||p,children:({present:r})=>t.jsx(ape.div,{"data-state":p?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":u,hidden:!r,id:d,tabIndex:0,...l,ref:n,style:{...e.style,animationDuration:f.current?"0s":void 0},children:r&&s})})}));function Hpe(e,t){return`${e}-trigger-${t}`}function qpe(e,t){return`${e}-content-${t}`}zpe.displayName=Bpe;var Gpe=Upe,Kpe=Vpe,Wpe=zpe;const Ype=Ipe,Xpe=i.forwardRef((({className:e,...n},r)=>t.jsx(Gpe,{ref:r,className:Yd("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...n})));Xpe.displayName=Gpe.displayName;const Qpe=i.forwardRef((({className:e,...n},r)=>t.jsx(Kpe,{ref:r,className:Yd("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...n})));Qpe.displayName=Kpe.displayName;const Zpe=i.forwardRef((({className:e,...n},r)=>t.jsx(Wpe,{ref:r,className:Yd("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n})));Zpe.displayName=Wpe.displayName;const Jpe=({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 hover:shadow-lg transition-all duration-300 ease-in-out "+(a?"scale-[1.02] hover:scale-[1.04] [border-color:hsl(var(--reach-primary))] shadow-lg":""),children:[t.jsxs("div",{className:"flex flex-col gap-1 items-start",children:[t.jsx("div",{className:"flex items-baseline gap-2",children:i?t.jsx("span",{className:"animate-pulse",children:"..."}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"text-3xl font-semibold text-foreground pl-2",children:e.toLocaleString()}),void 0!==r&&t.jsxs("div",{className:"text-muted-foreground/50 text-sm",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"})]}),efe=({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(OQ,{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(Jpe,{value:r.total,label:"Total",variant:"default",isLoading:void 0===e,selected:!0}),t.jsx(Jpe,{value:r.emails,label:"Email",percentage:o(r.emails),variant:"blue",isLoading:void 0===e}),t.jsx(Jpe,{value:r.phones,label:"Phone",percentage:o(r.phones),variant:"green",isLoading:void 0===e})]})]})},tfe=({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,nfe=({title:e,children:n,headerActions:r})=>t.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1 flex flex-col gap-4 pt-4",children:[t.jsxs("div",{className:"px-4 flex",children:[t.jsx(RQ,{children:e}),r&&t.jsx("div",{className:"ml-auto",children:r})]}),n]}),rfe=({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(OQ,{children:"Filter"}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[t.jsx(HX,{onClick:()=>a("all"),title:`All ${df("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(qX.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(HX,{onClick:()=>a("segments"),title:`Select ${df("engage:user",{count:2})}`,subtitle:`Choose from ${df("engage:segment",{count:2})}`,icon:t.jsx(qX.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===o})]})]})},ofe=({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(iee,{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(G7,{onSelect:()=>{e(!1),a(!0)},className:"cursor-pointer",children:[t.jsx(qX.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},ife=({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(ofe,{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(VX,{onClick:()=>u(!c),className:"flex items-center gap-1 transition-colors",size:"sm",children:[t.jsx(TX.div,{animate:{rotate:c?180:0},transition:{duration:.2},children:t.jsx(qX.DropdownMenuTrigger,{className:"w-5 h-5"})}),t.jsx("span",{children:"Don't send to"})]}),t.jsx(VB,{children:c&&t.jsx(TX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:t.jsx(ofe,{segments:r,allSegments:s||[],onAddSegment:e=>o(e,"exclude"),onRemoveSegment:e=>i(e,"exclude"),setOpenCreateSegmentDialog:a})})})]})]})},afe=()=>{const e=hae(),[r,o]=n.useState("all"),[i,a]=n.useState(e?.includeSegmentIds||[]),[s,l]=n.useState(e?.excludeSegmentIds||[]),[c,u]=n.useState(!1),[d,p]=n.useState(!1),{segments:f,isLoading:h}=bQ(),{updateAutomation:m}=Me(e?.id??""),[g,v]=n.useState(void 0),y=1===i.length&&0===s.length&&void 0!==f?.find((e=>e.type===SQ.ALL_USERS&&e.id===i[0]));n.useEffect((()=>{e&&!d&&(o(y?"all":"segments"),gQ({includeSegments:i,excludeSegments:s}).then((e=>{v(e)})),p(!0))}),[e,y,d,i,s]);return n.useEffect((()=>{e&&d&&(JSON.stringify(i)===JSON.stringify(e.includeSegmentIds)&&JSON.stringify(s)===JSON.stringify(e.excludeSegmentIds)||(m({includeSegments:i,excludeSegments:s}),gQ({includeSegments:i,excludeSegments:s}).then((e=>{v(e)}))))}),[i,s,e,d,m]),t.jsxs(nfe,{title:"Preview Audience",children:[!h&&f&&d?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(efe,{countResponse:g}),t.jsx(rfe,{onSelectionChange:e=>{if(o(e),"all"===e){const e=f?.find((e=>e.type===SQ.ALL_USERS));if(!e)return;a([e.id]),l([])}},defaultValue:r}),t.jsx(VB,{children:"segments"===r&&t.jsx(TX.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(ife,{includedSegments:i,excludedSegments:s,handleAddSegment:(e,t)=>{"include"===t?a((t=>[...t,e])):l((t=>[...t,e]))},handleRemoveSegment:(e,t)=>{"include"===t?a((t=>t.filter((t=>t!==e)))):l((t=>t.filter((t=>t!==e))))},setOpenCreateSegmentDialog:u,segments:f,defaultIsExcludeOpen:s.length>0})})})]}),t.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:g?.recipients&&t.jsx(tfe,{recipients:g.recipients})})]}):t.jsx("div",{children:t.jsx(FX,{text:["Fetching segments","Finishing up"]})}),t.jsx(aae,{open:c,setOpen:u})]})},sfe=({data:e,placeholder:n,searchPlaceholder:r,noResultsMessage:o,value:a,setValue:s})=>{const[l,c]=i.useState(!1);return t.jsxs(d8,{open:l,onOpenChange:c,modal:!0,children:[t.jsx(p8,{asChild:!0,children:t.jsxs(VX,{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(gu,{className:"opacity-50"})]})}),t.jsx(f8,{className:"w-[200px] p-0",children:t.jsxs($7,{children:[t.jsx(V7,{placeholder:r,className:"h-9"}),t.jsxs(B7,{children:[t.jsx(z7,{children:o}),t.jsx(H7,{children:e.map((e=>t.jsxs(G7,{value:e.value,onSelect:e=>{s(e===a?"":e),c(!1)},children:[e.label,t.jsx(du,{className:Yd("ml-auto",a===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},lfe=({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?y9(new Date(o),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),p=t=>{const n=P8(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(d8,{children:[t.jsx(p8,{asChild:!0,children:t.jsxs(VX,{variant:"outline",className:Yd("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[t.jsx(uu,{className:"mr-2 h-4 w-4"}),o?y9(new Date(o),"PPP"):t.jsx("span",{children:"Pick a date"})]})}),t.jsx(f8,{className:"w-auto p-0",children:t.jsx(Qie,{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:Yd("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(sfe,{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=P8(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]})]})})},cfe=()=>{const e=hae(),{updateAutomation:r}=Me(e?.id||""),{toast:o}=Ll(),[i,a]=n.useState(null),[s,l]=n.useState(e?.triggerMetadata?.triggerType===Fe.ONE_TIME?e?.triggerMetadata?.scheduledAt:null),[c,u]=n.useState(e?.triggerMetadata?.triggerType===Fe.ONE_TIME&&e?.triggerMetadata?.timezone||"America/New_York"),[d,p]=n.useState(!1);n.useEffect((()=>{}),[e]);return e?t.jsx(nfe,{title:"Edit Schedule Time",headerActions:t.jsx(VX,{onClick:()=>{if("sendNow"===i)r({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:new Date(Date.now()+3e5).toISOString()}}),o({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),p(!1);else{if(!s||!c)return;r({trigger:{triggerType:Fe.ONE_TIME,scheduledAt:s,timezone:c}}),o({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(s).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),p(!1)}},disabled:!d,children:"Update"}),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(HX,{selected:"sendNow"===i,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(qX.SendButton,{}),onClick:()=>{a("sendNow"),l(new Date(Date.now()+3e5).toISOString()),u("America/New_York"),p(!0)}}),t.jsx(HX,{selected:"schedule"===i,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(qX.ScheduleButton,{}),onClick:()=>a("schedule")})]}),t.jsx(VB,{children:"schedule"===i&&t.jsx(UX,{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(lfe,{setScheduleTime:l,setTimezone:u,timezone:c,scheduleTime:s,setIsDirty:p})})})})]}),s&&t.jsxs(TX.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(TX.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(TX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(s).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:c||void 0})})]})]})})}):null},ufe=({type:e})=>t.jsxs("div",{className:"w-full h-full min-h-[300px] flex flex-col items-center justify-center bg-gradient-to-b from-gray-50 to-white p-8",children:[t.jsx("div",{className:"mb-4 text-gray-300",children:t.jsx("svg",{className:"w-16 h-16",fill:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8l8 5 8-5v10zm-8-7L4 6h16l-8 5z"})})}),t.jsxs("p",{className:"text-gray-400 font-medium text-lg text-center mb-2",children:["No ","email"===e?"Email":"SMS"," Preview Available"]}),t.jsxs("p",{className:"text-gray-400 text-sm text-center",children:["Edit your ","email"===e?"Email":"SMS"," template to see a preview here"]})]}),dfe=({html:e,height:n,width:r})=>t.jsx("div",{className:"w-full h-full bg-white rounded-lg border-0 overflow-hidden transition-all duration-300 ease-in-out flex flex-col items-center justify-center",children:e?t.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t.jsx("iframe",{title:"Email Preview",srcDoc:e,className:"transition-opacity duration-300",style:{border:"none",backgroundColor:"white",height:n||"100%",width:r||"100%",maxWidth:"100%",maxHeight:"100%"}})}):t.jsx(ufe,{type:"email"})}),pfe=()=>{const e=ve({queryKey:["channel-accounts"],queryFn:()=>(async()=>(await Oe("/channel/accounts",{method:"GET"})).data)()});return{channelAccounts:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelAccounts:e.refetch}};var ffe=(e=>(e.REACH_MANAGED="reach-managed",e.TWILLIO="twillio",e))(ffe||{});const hfe=()=>{const e=ve({queryKey:["channel-senders"],queryFn:()=>(async()=>(await Oe(`${u}`,{method:"GET"})).data)()});return{channelSenders:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelSenders:e.refetch}},mfe=()=>{const e=ce(),t=ye({mutationFn:e=>(async(e,t)=>(await Oe(`${u}/${t}`,{method:"PATCH",body:JSON.stringify(e)})).data)(e.toUpdate,e.id),onSuccess:()=>{e.invalidateQueries({queryKey:["channel-senders"]})}});return{updateChannelSender:t.mutate,isUpdating:t.isPending,updateError:t.error}},gfe=(e,t)=>{const[r,o]=n.useState(e);return n.useEffect((()=>{const n=setTimeout((()=>{o(e)}),t);return()=>clearTimeout(n)}),[e,t]),r},vfe=()=>t.jsxs("div",{className:"p-6 overflow-y-auto",children:[t.jsxs("div",{className:"mb-8 text-center",children:[t.jsx("h2",{className:"text-2xl font-semibold mb-2",children:"Email Editor Help Center"}),t.jsx("p",{className:"text-gray-500",children:"Learn how to use our email editor's powerful features"})]}),t.jsxs("div",{className:"space-y-4 max-w-xl mx-auto",children:[t.jsx("h3",{className:"text-lg font-medium",children:"Using Dynamic Content"}),t.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-gray-50",children:[t.jsx("img",{src:"https://cdn.embedreach.com/assets/engage/merge-tags-demo.gif",alt:"Merge Tags Demo",className:"w-full shadow-lg max-w-md mx-auto"}),t.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/50 to-transparent p-4",children:t.jsx("p",{className:"text-white text-sm",children:"Demonstration: Adding merge tags to personalize your emails"})})]}),t.jsx("div",{className:"px-2",children:t.jsx(HX,{onClick:()=>{},title:"Dynamic Content",subtitle:"Dynamic content is a way to insert dynamic content into your email such as the customer's name, email, or other details.",icon:t.jsx(Pu,{}),selected:!0})})]})]}),yfe=({type:e})=>t.jsxs("div",{className:"flex items-start space-x-2 text-sm text-gray-600",children:[t.jsx("svg",{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),t.jsxs("span",{children:["Please configure at least one ",e," sender before editing the template"]})]}),bfe=({containerRef:e,stripoDialogDimensions:n,showSaving:r})=>t.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center",children:[t.jsx("div",{id:"externalSystemContainer",className:"flex items-center px-4 py-2"}),r&&t.jsx("div",{className:"absolute top-0 left-0 w-full h-full bg-black/50 flex items-center justify-center z-50",children:t.jsx(FX,{textColor:"text-white",text:["Saving..."]})}),t.jsx("div",{id:"stripoEditorContainer",ref:e,style:{width:n.width-75,height:n.height-75},className:"z-10"})]}),wfe="UiEditorScript",xfe=e=>new Promise(((t,n)=>{const r=()=>{window.UIEditor&&(window.UIEditor.initEditor(e.container,{metadata:{emailId:e.emailId,userId:e.businessId},html:e.html,css:e.css,locale:"en",onTokenRefreshRequest:e=>{Promise.resolve().then((async()=>{try{const{token:t}=await(async()=>(await Oe(`${p}/token`)).data)();e(t)}catch(t){}}))},messageSettingsEnabled:!1,conditionsEnabled:!1,syncModulesEnabled:!1,notifications:{info:console.info,error:console.error,warn:console.warn,success:console.log},mergeTags:e.mergeFields}),t(void 0))};if(document.getElementById(wfe))r();else{const e=document.createElement("script");e.id=wfe,e.type="module",e.src="https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js",e.onload=()=>{window.UIEditor?r():n(new Error("UIEditor not found after script load"))},e.onerror=e=>{n(e)},document.head.appendChild(e)}})),_fe=({automation:e,setShowStripoEditor:r,saveClicked:o,setSaveClicked:i,stripoDialogDimensions:a,mergeFieldsResponse:s,cancelClicked:l,setCancelClicked:c})=>{const u=n.useRef(!1),d=n.useRef(null),{data:p,isLoading:f}=IX(e.id),{data:h,isLoading:m}=(()=>{const e=ce();return{...ve({queryKey:MX.editorData(),queryFn:jX,..._e}),invalidateEditorData:()=>e.invalidateQueries({queryKey:MX.editorData()})}})(),[g,v]=n.useState(!1),[y,b]=n.useState(!1),{updateCommunicationGroup:w}=uae(),x=n.useCallback((()=>{i(!1),c(!1),v(!1),b(!1),r(!1)}),[i,c,v,b,r]);return n.useEffect((()=>{if(o&&window.UIEditor&&p?.communicationGroupId&&window.StripoEditorApi?.actionsApi){window.StripoEditorApi.actionsApi.compileEmail({callback:function(e,t){e||(w({groupId:p.communicationGroupId,params:{emailHtmlBody:t}}),b(!0))},minimize:!0,mergeTags:[],forseAmp:!1,resetDataSavedFlag:!1,disableLineHeightsReplace:!0});window.StripoEditorApi.actionsApi.save((function(e){e||v(!0)}))}}),[o,d,i,r,p,w]),n.useEffect((()=>{(async()=>{g&&y&&(window.UIEditor&&window.UIEditor.removeEditor(),x())})()}),[g,y,r,i,x]),n.useEffect((()=>{l&&(window.UIEditor&&window.UIEditor.removeEditor(),x())}),[l,x]),n.useEffect((()=>{h?.businessId&&d.current&&p&&(u.current||(xfe({emailId:p.communicationGroupId,html:p.html||"<div></div>",css:p.css||"",container:d.current,businessId:h.businessId,mergeFields:s.mergeFields||[]}).catch((e=>{})),u.current=!0))}),[h,s,p]),t.jsx("div",f||m||!h||!p?{className:"w-full h-full flex flex-col items-center justify-center",children:t.jsx(FX,{text:["Loading editor..."]})}:{className:"w-full h-full flex flex-col",children:t.jsx(bfe,{containerRef:d,stripoDialogDimensions:a,showSaving:o})})},Sfe=({mergeFieldsResponse:e})=>{const r=mae(),o=hae(),{updateCommunicationGroup:i}=uae(),{refetchAutomation:a}=ke(o?.id||""),{channelSenders:s}=hfe(),{channelAccounts:l}=pfe(),{updateChannelSender:c}=mfe(),[u,d]=n.useState(!1),[p,f]=n.useState(r?.emailChannelSenderId||null),[h,m]=n.useState(r?.emailSubject||null),[g,v]=n.useState(r?.emailPreviewText||null),[y,b]=n.useState(r?.emailHtmlBody||null),[w,x]=n.useState(!1),[_,S]=n.useState(!1),[E,T]=n.useState(!1),[C,A]=n.useState(""),[R,O]=n.useState(""),[N,P]=n.useState(null),[k,L]=n.useState(!1),D=n.useRef(!0),[M,j]=n.useState(!0),[I,F]=n.useState(!1),[U,$]=n.useState({width:0,height:0}),[V,B]=n.useState(null),z=gfe(h,500),H=gfe(g,500),q=gfe(C,500),G=gfe(R,500),K=n.useMemo((()=>s?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=l?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===ffe.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[s?.results,l?.results]),W=n.useMemo((()=>({width:800,height:400})),[]),Y=n.useRef(null);return n.useEffect((()=>{const e=setTimeout((()=>{D.current=!1}),500);return()=>clearTimeout(e)}),[]),n.useEffect((()=>{r?.emailHtmlBody&&b(r.emailHtmlBody)}),[r?.emailHtmlBody,a]),n.useEffect((()=>{if(u){const e=setTimeout((()=>{d(!1)}),2e3);return()=>clearTimeout(e)}}),[u]),n.useEffect((()=>{const e=()=>{$({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),n.useEffect((()=>{if(!D.current&&p&&z&&y&&r?.id){d(!0);(async()=>{try{i({groupId:r.id,params:{emailChannelSenderId:p,emailHtmlBody:y,emailSubject:z,...H&&{emailPreviewText:H}}})}catch(e){}finally{d(!1)}})()}}),[p,z,H,y,r?.id,i]),n.useEffect((()=>{if(s?.results&&p){const e=s.results.find((e=>e.id===p));e&&(I&&!M||O(e.channelSenderMetadata.emailReplyTo),M&&A(e.channelSenderMetadata.emailFromName),j(!1))}}),[s?.results,p,I,M]),n.useEffect((()=>{if(s?.results&&!p){const e=s.results.filter((e=>e.channelSenderMetadata.userPart));if(e[0]){const t=e[0];f(t.id),i({groupId:r?.id||"",params:{emailChannelSenderId:t.id}})}}}),[s?.results,p,r?.id,i]),n.useEffect((()=>{if(!D.current&&q&&p){B("fromName");(async()=>{try{const e=s?.results?.find((e=>e.id===p));e&&await c({id:p,toUpdate:{channelSenderMetadata:{...e.channelSenderMetadata,emailFromName:q}}})}catch(e){}finally{B(null)}})()}}),[q,s?.results,p,c]),n.useEffect((()=>{if(G){const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(G),t=/\p{Emoji}/u.test(G);P(t?"Emojis are not allowed in email addresses":e?null:"Please enter a valid email address")}else P(null)}),[G]),n.useEffect((()=>{const e=async e=>{try{const t=s?.results?.find((t=>t.id===e.fromEmail));t&&c({id:e.fromEmail,toUpdate:{channelSenderMetadata:{...t.channelSenderMetadata,emailReplyTo:e.debouncedReplyToEmail}}})}catch(t){}finally{B(null)}};D.current||!p||N||(B("replyToEmail"),e(G?{fromEmail:p,debouncedReplyToEmail:G}:{fromEmail:p,debouncedReplyToEmail:null}))}),[G,s?.results,p,c,N]),n.useEffect((()=>{!1===w&&r?.id&&a()}),[w,r?.id,a]),l&&s?t.jsxs("div",{className:"relative",children:[t.jsx(wB,{open:k,onOpenChange:L,children:t.jsxs(SB,{className:"max-h-[86vh] gap-0 overflow-visible max-w-3xl w-full h-full",children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Email Preview Help"}),t.jsx(AB,{children:"Learn more about the email preview and how to use it to create your email."})]}),t.jsx(vfe,{})]})}),t.jsx(wB,{open:w,onOpenChange:x,children:t.jsxs(SB,{className:"min-w-[100vw] min-h-[100vh]",hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault()},children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Email Editor"}),t.jsx(AB,{children:"Learn more about the email editor and how to use it to create your email."})]}),t.jsxs("div",{className:"w-full h-full",children:[t.jsxs("div",{className:"flex justify-between items-center p-1 border-b",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-lg font-medium",children:"Email Editor"}),t.jsx(q0,{title:"Click to learn more about email template ",onClick:()=>L(!0)})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(VX,{variant:"destructive",onClick:()=>{T(!0)},className:"text-sm px-3 py-1 rounded",children:"Cancel"}),t.jsx(VX,{onClick:()=>S(!0),className:"text-sm px-3 py-1 rounded",children:"Save"})]})]}),t.jsx("div",{className:" w-full",children:o&&t.jsx(_fe,{cancelClicked:E,setCancelClicked:T,showStripoEditor:w,automation:o,setShowStripoEditor:x,saveClicked:_,setSaveClicked:S,stripoDialogDimensions:U,mergeFieldsResponse:e})})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(z9,{children:"From Email"}),t.jsxs(Lne,{onValueChange:e=>{f(e),j(!0),F(!1)},value:p??void 0,disabled:u,children:[t.jsx(Mne,{children:t.jsx(Dne,{placeholder:"Select email",children:p?K?.find((e=>e.channelSenderId===p))?.fullDomain:""})}),t.jsx(Fne,{children:K?.map((e=>t.jsx(Une,{value:e.channelSenderId,children:e.fullDomain},e.channelSenderId)))})]})]}),t.jsxs("div",{children:[t.jsx(z9,{children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["From Name",t.jsx(q0,{title:"This will be the friendly name of the sender that the customer will see in the inbox",alertText:"Changes to the sender name will be applied across all emails using this address"})]})}),t.jsx(tQ,{placeholder:"Enter from name",value:C??"",onChange:e=>A(e.target.value),disabled:u&&"fromName"!==V||!p||M})]}),t.jsxs("div",{children:[t.jsx(z9,{children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["Reply To Email",t.jsx(q0,{title:"This will be the email address that customer can reply to on the email",alertText:"Changes to the reply to email will be applied across all emails using this address"})]})}),t.jsx(tQ,{placeholder:"Enter reply to email",value:R??"",onChange:e=>{O(e.target.value),I||F(!0)},disabled:u&&"replyToEmail"!==V||!p||M}),N&&t.jsx("p",{className:"text-sm text-red-500 mt-1",children:N})]}),t.jsxs("div",{children:[t.jsx(z9,{children:"Subject"}),t.jsx(tQ,{placeholder:"Enter email subject",value:h??"",onChange:e=>m(e.target.value),disabled:u||M})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(z9,{children:"Preview Text"}),t.jsx(q0,{title:"This text will be used for the preview text of the email in the inbox"})]}),t.jsx(tQ,{placeholder:"Enter preview text",value:g??"",onChange:e=>v(e.target.value),disabled:u||M})]})]}),t.jsxs("div",{className:"border rounded-lg p-4 h-full flex flex-col",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h3",{className:"font-medium",children:"Preview"}),t.jsxs("div",{children:[t.jsx(VX,{onClick:()=>x(!0),className:"text-sm px-3 py-1 rounded",disabled:u||0===(K?.length??0),children:"Edit"}),0===(K?.length??0)&&t.jsx("div",{className:"relative inline-block",children:t.jsx("div",{className:"absolute right-0 top-full mt-2 w-64 p-3 bg-white border rounded-lg shadow-lg z-10",children:t.jsx(yfe,{type:"email"})})})]})]}),t.jsx("div",{className:"flex-1 w-full overflow-auto",ref:Y,style:{height:"400px"},children:t.jsx(dfe,{html:y??"",height:W.height,width:W.width})})]})]})]}):t.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(FX,{text:["Fetching Email Preview..."]})})};var Efe="Checkbox",[Tfe,Cfe]=UQ(Efe),[Afe,Rfe]=Tfe(Efe),Ofe=i.forwardRef(((e,n)=>{const{__scopeCheckbox: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=WU(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,w]=u0({prop:a,defaultProp:s,onChange:d}),x=i.useRef(b);return i.useEffect((()=>{const e=h?.form;if(e){const t=()=>w(x.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[h,w]),t.jsxs(Afe,{scope:r,state:b,disabled:c,children:[t.jsx(GQ.button,{type:"button",role:"checkbox","aria-checked":Lfe(b)?"mixed":b,"aria-required":l,"data-state":Dfe(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onKeyDown:FQ(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:FQ(e.onClick,(e=>{w((e=>!!Lfe(e)||!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(kfe,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:!Lfe(s)&&s})]})}));Ofe.displayName=Efe;var Nfe="CheckboxIndicator",Pfe=i.forwardRef(((e,n)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,a=Rfe(Nfe,r);return t.jsx(l0,{present:o||Lfe(a.state)||!0===a.state,children:t.jsx(GQ.span,{"data-state":Dfe(a.state),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})}));Pfe.displayName=Nfe;var kfe=e=>{const{control:n,checked:r,bubbles:o=!0,defaultChecked:a,...s}=e,l=i.useRef(null),c=$ne(r),u=FJ(n);i.useEffect((()=>{const e=l.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(c!==r&&n){const t=new Event("click",{bubbles:o});e.indeterminate=Lfe(r),n.call(e,!Lfe(r)&&r),e.dispatchEvent(t)}}),[c,r,o]);const d=i.useRef(!Lfe(r)&&r);return t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??d.current,...s,tabIndex:-1,ref:l,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Lfe(e){return"indeterminate"===e}function Dfe(e){return Lfe(e)?"indeterminate":e?"checked":"unchecked"}var Mfe=Ofe,jfe=Pfe;const Ife=({selectedChannels:e,setSelectedChannels:n,hasEmailChannelSenders:r,hasSmsChannelSenders:o})=>{const{toast:i}=Ll(),a=[...r?[{label:"Email",value:"email",icon:qX.EmailIcon,checked:e.includes("email")}]:[],...o?[{label:"SMS",value:"sms",icon:qX.SmsIcon,checked:e.includes("sms")}]:[]];return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-xl",children:"Message Types"}),t.jsx("p",{className:"text-gray-600 mb-2 text-sm",children:"Select the channels you want to use in this automation"})]}),t.jsx("div",{className:"w-full grid grid-cols-2 gap-3",children:a.map((r=>t.jsxs(Mfe,{checked:r.checked,onCheckedChange:()=>{"email"===r.value?e.includes("email")?e.includes("sms")?n(["sms"]):i({title:"Cant Remove Email",description:"At least one channel is required for an automation",variant:"destructive"}):n([...e,"email"]):e.includes("sms")?e.includes("email")?n(["email"]):i({title:"Cant Remove SMS",description:"At least one channel is required for an automation",variant:"destructive"}):n([...e,"sms"])},className:"relative ring-[1px] ring-border rounded-lg px-4 py-3 text-start text-muted-foreground data-[state=checked]:ring-2 data-[state=checked]:ring-primary data-[state=checked]:text-primary",children:[t.jsx(r.icon,{className:"mb-3",size:20}),t.jsx("span",{className:"font-medium tracking-tight",children:r.label}),t.jsx(jfe,{className:"absolute top-2 right-2",children:t.jsx(yu,{className:"fill-primary text-primary-foreground"})})]},r.value)))})]})},Ffe=e=>{const{companyName:t,smsBody:n}=e;return t&&n?`${t}:\n${n}`:n??""},Ufe=({body:e})=>t.jsx("div",{className:"sms-preview-outer @container",children:t.jsxs("div",{className:"sms-phone-mockup",children:[t.jsx("div",{className:"sms-phone-notch"}),t.jsx("div",{className:"sms-phone-inner",children:t.jsx("div",{className:"sms-message-row",children:t.jsx("div",{className:"sms-message-bubble",children:e})})}),t.jsx("div",{className:"sms-phone-home-indicator"})]})}),$fe=({mergeFieldsResponse:e,smsChannelSenders:r})=>{const o=hae(),i=n.useCallback((()=>{const e=o?.actionData?.find((e=>"send_communication"===e.actionType));return e?.actionMetadata.communicationGroupId}),[o?.actionData]),{channelSenders:a}=hfe(),{data:s,isLoading:l}=Z0(),{channelAccounts:c}=pfe(),{updateCommunicationGroup:u}=uae(),{communicationGroup:d}=cae(i()??void 0),[p,f]=n.useState(!1),[h,m]=n.useState(""),[g,v]=n.useState(null),[y,b]=n.useState(!1),[w,x]=n.useState(null),[_,S]=n.useState(null),[E,T]=n.useState(!1),C=n.useRef(null),A=gfe(_,1e3),R=gfe(g,1e3),O=gfe(w,1e3);n.useEffect((()=>{if(null!==R&&null!==A&&!p){f(!0);const e=i();e&&u({groupId:e,params:{smsChannelSenderId:R,smsMessageBody:A,textMessageCompanyName:O}}),f(!1)}}),[R,A,O,p,u,i]),n.useEffect((()=>{d&&(v(d.smsChannelSenderId),S(d.smsMessageBody),d.textMessageCompanyName&&x(d.textMessageCompanyName))}),[d]);return n.useEffect((()=>{if(void 0!==a&&!g){const e=a.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid));e?.[0]&&(v(e[0].id),d?.id&&u({groupId:d.id,params:{smsChannelSenderId:e[0].id}}))}}),[a,g,d?.id,u]),n.useEffect((()=>{w||!s?.name||y||(b(!0),x(s.name))}),[w,s?.name,y]),c&&a&&!l?t.jsxs("div",{children:[t.jsx(wB,{open:E,onOpenChange:T,children:t.jsxs(SB,{children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"SMS Editor"}),t.jsx(AB,{children:"Learn more about the SMS editor and how to use it to create your SMS."})]}),t.jsxs("div",{className:"",children:[t.jsx(nQ,{ref:C,className:"min-h-[300px]",placeholder:"Text message content...",value:_??"",onChange:e=>{S(e.target.value)},maxLength:1600-(w?.length||0)}),t.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[t.jsxs(Lne,{value:h,onValueChange:e=>{const t=C.current,n=_||"",r=t?.selectionStart??n.length,o=t?.selectionEnd??n.length,i=n.slice(0,r)+e+n.slice(o);S(i),m(""),setTimeout((()=>{const n=r+e.length;t?.focus(),t?.setSelectionRange(n,n)}),0)},children:[t.jsx(Mne,{className:"w-[50px]",children:t.jsx(qX.MergeField,{className:"w-4 h-4"})}),t.jsx(Fne,{children:e?.mergeFields?.map((e=>e.entries.map((e=>t.jsx(Une,{value:e.value,children:e.label},e.value))))).flat()})]}),t.jsx(q0,{title:"Dynamic content is a way to insert dynamic content into your messages such as the customer's name, email, or other details."})]}),t.jsxs("div",{className:"flex justify-end mt-2 text-sm transition-colors duration-300 "+(_&&_.length>1400?_.length>=1600?"text-red-500":"text-amber-500":"text-gray-500"),children:[_?_.length:0,"/",1600-(w?.length||0)," ","characters"]})]})]})}),t.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx(z9,{children:"From Number"}),t.jsxs(Lne,{onValueChange:e=>{v(e)},value:g??void 0,children:[t.jsx(Mne,{children:t.jsx(Dne,{placeholder:"Select number",children:g?(N=g,r?.find((e=>e.id===N))?.channelSenderMetadata.friendlyName??r?.find((e=>e.id===N))?.channelSenderMetadata.from??N):"Select number"})}),t.jsx(Fne,{children:r?.map((e=>t.jsx(Une,{value:e.id,children:e.channelSenderMetadata.friendlyName??e.channelSenderMetadata.from??"Select number"},e.id)))})]})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(z9,{children:"Company Name"}),t.jsx(q0,{title:"Adding your company name can help customers identify who they are talking to"})]}),t.jsx(tQ,{placeholder:"Enter company name",value:w??"",onChange:e=>{x(e.target.value??null)},disabled:!g})]})]}),t.jsxs("div",{className:"border rounded-lg p-4",children:[t.jsxs("div",{className:"flex justify-between items-center mb-4",children:[t.jsx("h3",{className:"font-medium",children:"Preview"}),t.jsx("div",{children:t.jsx(VX,{onClick:()=>T(!0),className:"text-sm px-3 py-1 rounded ",disabled:0===(r?.length??0),children:"Edit"})})]}),t.jsx("div",{children:g?t.jsx(t.Fragment,{children:g&&_?t.jsx(Ufe,{body:Ffe({companyName:w??void 0,smsBody:_})}):t.jsx(ufe,{type:"sms"})}):t.jsx(yfe,{type:"sms"})})]})]})]}):t.jsx("div",{children:t.jsx(FX,{text:["Loading..."]})});var N},Vfe=({getExtraMergeFields:e})=>{const[r,o]=n.useState(null),i=n.useRef(null),{toast:a}=Ll(),s=mae(),{channelSenders:l}=hfe(),{channelAccounts:c}=pfe(),{updateCommunicationGroup:u}=uae(),d=hae(),{getMergeFields:p,isGetting:f}=(e=>{const t=ve({queryKey:["merge-fields",e],queryFn:()=>DX(e)});return{getMergeFields:t.data,isGetting:t.isPending,getError:t.error,isGetSuccess:t.isSuccess}})(s?.id??void 0),[h,m]=n.useState(void 0);n.useEffect((()=>{const e=s?.id;e&&r&&(r.includes("email")||null===s?.emailChannelSenderId||u({groupId:e,params:{emailChannelSenderId:null}}),r.includes("sms")||null===s?.smsChannelSenderId||u({groupId:e,params:{smsChannelSenderId:null}}))}),[r,u,s]),n.useEffect((()=>{const e=s?.id;e||r||o(["email"])}),[d,s,r]);const g=n.useCallback((e=>{const t=[];e.emailChannelSenderId&&t.push("email"),e.smsChannelSenderId&&t.push("sms"),0===t.length&&t.push("email"),o(t)}),[]);n.useEffect((()=>{s&&!r&&g(s)}),[s,g,r]),n.useEffect((()=>{f||void 0===h&&(e?e().then((e=>{s?.id&&(g(s),u({groupId:s?.id,params:{extraMergeFields:e}},{onSuccess:async()=>{try{const e=await DX(s?.id);m(e)}catch{a({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}},onError:e=>{a({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}}))})):(s?.id&&null!==s.extraMergeFields&&u({groupId:s?.id,params:{extraMergeFields:null}}),m(p)))}),[e,u,s,a,f,p,h,g]);const v=n.useMemo((()=>l?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=c?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===ffe.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[l?.results,c?.results]),y=n.useMemo((()=>l?.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))),[l?.results]);if(!r||f||!h||!v||!y)return t.jsx("div",{className:"flex justify-center items-center flex-1 h-full bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(FX,{text:["Fetching Content..."]})});return t.jsxs("div",{className:"flex flex-col gap-4 flex-shrink-0",children:[t.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:t.jsx(Ife,{selectedChannels:r,setSelectedChannels:o,hasEmailChannelSenders:v.length>0,hasSmsChannelSenders:y.length>0})}),r.includes("email")&&t.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",ref:i,children:[t.jsx("h4",{className:"text-xl",children:"Email Campaign"}),t.jsx(Sfe,{mergeFieldsResponse:h,emailChannelSendersWithChannelAccounts:v})]}),r.includes("sms")&&t.jsxs("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 space-y-4 relative",children:[t.jsx("h4",{className:"text-xl",children:"SMS Campaign"}),t.jsx($fe,{mergeFieldsResponse:h,smsChannelSenders:y})]})]})},Bfe=({open:e,onOpenChange:n})=>t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{className:"max-w-[75vw] min-h-[75vh] overflow-y-auto max-h-[90vh]",children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Edit Campaign Content"}),t.jsx(AB,{children:"Edit the content of the campaign"})]}),t.jsx(Vfe,{})]})}),zfe=()=>t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"w-3 h-3 rounded-full bg-[#FF605C] border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-[#FFBD44] border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-[#00CA4E] border border-zinc-300 shadow-sm"})]}),Hfe=({children:e,actionButtons:n})=>t.jsxs("div",{className:"flex-1 w-full relative overflow-hidden",children:[t.jsxs("div",{className:"h-full relative w-full rounded-2xl shadow-xl bg-white border border-zinc-200 overflow-hidden min-h-[500px] flex flex-col",style:{containerType:"inline-size"},children:[t.jsxs("div",{className:"flex items-center space-x-3 pt-3 px-4 z-10 w-full justify-between",children:[t.jsx(zfe,{}),n&&t.jsx("div",{className:"flex items-center space-x-2",children:n})]}),e]}),t.jsx("div",{className:"text-center text-sm text-muted-foreground mt-4",children:t.jsx("p",{children:"These previews show exactly how your messages will appear to your customers"})})]}),qfe=()=>{const e=hae(),r=mae(),{channelSenders:o}=hfe(),{channelAccounts:i}=pfe(),a=n.useMemo((()=>o?.results?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=i?.results?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===ffe.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSenderMetadata:e.channelSenderMetadata}]:[]}))||[]),[o?.results,i?.results]),s=r?.emailChannelSenderId;if(!(e&&r&&a&&s))return null;const l=a.find((e=>e.channelSenderId===s)),c=l?.fullDomain,u=l?.channelSenderMetadata.emailReplyTo,d=r.emailSubject,p=r.emailPreviewText,f=l?.channelSenderMetadata.emailFromName;return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),t.jsxs("div",{className:"text-base font-medium",children:[c,f&&t.jsxs("span",{className:"text-muted-foreground",children:["<",c,">"]})]})]}),u&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Reply-To"}),t.jsx("div",{className:"text-base font-medium",children:u})]}),d&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Subject"}),t.jsx("div",{className:"text-base font-medium",children:d})]}),p&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"Preview Text"}),t.jsx("div",{className:"text-sm font-medium line-clamp-2",children:p})]})]})},Gfe=({emailBody:e})=>{const[r,o]=n.useState({width:0,height:0}),i=n.useRef(null);return n.useEffect((()=>{const e=()=>{i.current&&requestAnimationFrame((()=>{o({width:i.current?i.current.offsetWidth-75:0,height:i.current?i.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[i]),t.jsxs(Hfe,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(qfe,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",ref:i,children:t.jsx(dfe,{html:e,height:r.height,width:r.width})})]})},Kfe=({expandDialogContent:e})=>{const[r,o]=n.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(wB,{open:r,onOpenChange:o,children:t.jsxs(SB,{hideCloseButton:!0,className:"w-[80vw] h-[80vh] max-w-none max-h-none bg-transparent border-none",children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Expanded Preview"}),t.jsx(AB,{children:"Expanded view of communication content"})]}),t.jsxs("div",{className:"h-full flex flex-col overflow-hidden rounded-xl",children:[e,t.jsx("div",{className:"absolute top-7 right-7 z-10",children:t.jsx(VX,{variant:"ghost",size:"sm",onClick:()=>o(!1),children:t.jsx(qX.CloseButton,{className:"w-4 h-4"})})})]})]})}),t.jsx(VX,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>o(!0),children:t.jsx(qX.ExpandIcon,{className:"w-4 h-4"})})]})},Wfe=({type:e})=>{const n="sms"===e?"SMS":"Email";return t.jsx("div",{className:"flex flex-1 w-full h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center justify-center bg-zinc-50/80 border border-zinc-100 rounded-2xl shadow-md px-6 py-12 max-w-[90vw] w-full sm:max-w-md mx-auto text-center",style:{containerType:"inline-size"},children:[t.jsx("sms"===e?qX.SmsIcon:qX.EmailIcon,{className:"w-12 h-12 text-zinc-500 mb-4"}),t.jsxs("h2",{className:"text-xl font-semibold text-zinc-800 mb-2",children:["No ",n," Content Yet"]}),t.jsxs("p",{className:"text-zinc-500 text-base mb-1",children:["Click ",t.jsx("span",{className:"font-medium text-zinc-700",children:"Edit content"})," ","to start crafting your ",n," message."]})]})})},Yfe=({onClick:e})=>t.jsxs(VX,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 flex items-center gap-2 shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:e,children:[t.jsx(qX.PreviewButton,{className:"w-4 h-4"}),t.jsx("span",{className:"font-medium text-sm",children:"Preview"})]}),Xfe=e=>/^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/.test(e),Qfe=e=>{if(!/^[0-9\s()+.-]+$/.test(e))return!1;const t=e.replace(/\D/g,"");return e.startsWith("+")?t.length>=10&&t.length<=15:10===t.length||!(11!==t.length||!t.startsWith("1"))},Zfe=({automation:e,type:r,setOpenSendPreviewPopup:o})=>{const[i,a]=n.useState(""),[s,l]=n.useState(""),[c,u]=n.useState(null),[d,p]=n.useState(!1),{sendTestCommunication:f,sendError:h,isSendSuccess:m}=dae(),{toast:g}=Ll(),v=e.actionData?.find((e=>"send_communication"===e.actionType)),y=v?.actionMetadata.communicationGroupId,{communicationGroup:b,isGetting:w}=cae(y??void 0),x=n.useCallback((()=>{if(!y)return Promise.resolve(null);if(!b)return Promise.reject(new Error("Communication group not loaded"));switch(r){case"email":return Promise.resolve(b.emailChannelSenderId);case"sms":return Promise.resolve(b.smsChannelSenderId);default:return Promise.reject(new Error(`Unsupported type: ${r}`))}}),[b,r,y]);n.useEffect((()=>{(async()=>{try{const e=await x();u(e)}catch(e){u(null)}finally{p(!0)}})()}),[x]),n.useEffect((()=>{m&&(g({title:"Success",description:`Preview ${"email"===r?"email":"SMS"} sent successfully!`}),o(!1))}),[m,r,o,g]),n.useEffect((()=>{h&&(g({title:"Error",description:`Failed to send preview: ${h.message}`,variant:"destructive"}),o(!1))}),[h,g,o]);return!d||w?t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsx(FX,{text:["Fetching sender id","Finishing up"]})}):c?t.jsxs("div",{className:"",children:[t.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:["Send Preview ","email"===r?"Email":"SMS"]}),t.jsx(tQ,{type:"email"===r?"email":"tel",placeholder:"email"===r?"Enter email address":"Enter phone number",value:i,onChange:e=>{a(e.target.value),l("")},className:"w-full px-3 py-3 border border-gray-300 rounded-lg text-base mb-4 \n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent\n placeholder-gray-400"}),s&&t.jsx("p",{className:"text-red-500 text-sm mb-4 -mt-2",children:s}),t.jsx(VX,{onClick:()=>{if(!("email"===r?Xfe(i):Qfe(i)))return void l("Please enter a valid "+("email"===r?"email address":"phone number"));if(!c)return void l("No sender found, please update the automation first!");const t=e.actionData?.find((e=>"send_communication"===e.actionType)),n=t?.actionMetadata.communicationGroupId;if(!n)return Promise.resolve(null);f({id:n,params:"email"===r?{emailAddress:i}:{phoneNumber:i}})},disabled:!i,className:"w-full bg-blue-600 text-white py-3 px-6 rounded-lg font-medium\n hover:bg-blue-700 transition-colors duration-200\n disabled:bg-gray-400 disabled:cursor-not-allowed",children:"Send Preview"})]}):t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsxs("div",{className:"text-center flex flex-col justify-center items-center gap-2",children:[t.jsx(qX.AlertCircleIcon,{className:"h-12 w-12 text-gray-400 mb-4"}),t.jsx("h3",{className:"text-lg font-semibold text-gray-700 mb-2",children:"No sender found"}),t.jsx("p",{className:"text-gray-500",children:"Please update the automation to include a sender for this type"})]})})},Jfe=({open:e,onOpenChange:n,automation:r})=>t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Send Preview Email"}),t.jsx(AB,{children:"Send a preview email to the automation."})]}),t.jsx(Zfe,{automation:r,type:"email",setOpenSendPreviewPopup:n})]})}),ehe=()=>{const e=hae(),r=mae(),[o,i]=n.useState({width:0,height:0}),[a,s]=n.useState(!1),[l,c]=n.useState(!1),u=n.useRef(null);if(n.useEffect((()=>{const e=()=>{u.current&&requestAnimationFrame((()=>{i({width:u.current?u.current.offsetWidth-75:0,height:u.current?u.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[u]),!e||!r)return null;const d=r?.emailHtmlBody||"",p=r?.emailChannelSenderId&&d.length>0;return t.jsxs("div",{className:"flex-1 flex flex-col items-center w-full",children:[t.jsx(Bfe,{open:l,onOpenChange:c}),t.jsx(Jfe,{open:a,onOpenChange:s,automation:e}),t.jsx(Hfe,{actionButtons:t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex items-center space-x-2",children:[p&&t.jsx(Yfe,{onClick:()=>s(!0)}),t.jsx(VX,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>c(!0),children:"Edit content"}),p&&t.jsx(Kfe,{expandDialogContent:t.jsx(Gfe,{emailBody:d})})]})}),children:p?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(qfe,{})})}),t.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),t.jsx("div",{className:"flex-1 w-full overflow-auto h-full",ref:u,children:t.jsx(dfe,{html:d,height:o.height,width:o.width})})]}):t.jsx(Wfe,{type:"email"})})]})},the=()=>{const e=hae(),r=mae(),{channelSenders:o}=hfe(),{channelAccounts:i}=pfe(),a=n.useMemo((()=>o?.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))),[o?.results]),s=a?.find((e=>e.id===r?.smsChannelSenderId));if(!s)return null;if(!(e&&r&&o&&i&&a&&s))return null;const l=s.channelSenderMetadata.friendlyName||s.channelSenderMetadata.from||s.channelSenderMetadata.messageServiceSid;return t.jsx("div",{className:"space-y-4",children:t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xs text-muted-foreground leading-none",children:"From"}),t.jsx("div",{className:"text-base font-medium font-mono text-zinc-800",children:l})]})})},nhe=({smsBody:e})=>t.jsxs(Hfe,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(the,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",children:t.jsx(Ufe,{body:e})})]}),rhe=({open:e,onOpenChange:n,automation:r})=>t.jsx(wB,{open:e,onOpenChange:n,children:t.jsxs(SB,{children:[t.jsxs(e$,{children:[t.jsx(CB,{children:"Send Preview SMS"}),t.jsx(AB,{children:"Send a preview SMS to the automation."})]}),t.jsx(Zfe,{automation:r,type:"sms",setOpenSendPreviewPopup:n})]})}),ohe=()=>{const[e,r]=n.useState(!1),o=hae(),i=mae(),[a,s]=n.useState(!1);if(!o)return null;const l=i?.smsMessageBody||"",c=i?.smsChannelSenderId&&l.length>0,u=Ffe({companyName:i?.textMessageCompanyName??void 0,smsBody:l});return t.jsxs("div",{className:"flex flex-col items-center w-full h-full",children:[t.jsx(Bfe,{open:a,onOpenChange:s}),t.jsx(rhe,{open:e,onOpenChange:r,automation:o}),t.jsx(Hfe,{actionButtons:t.jsxs(t.Fragment,{children:[c&&t.jsx(Yfe,{onClick:()=>r(!0)}),t.jsx(VX,{variant:"outline",size:"sm",className:"rounded-lg px-3 py-2 font-medium text-sm shadow-sm bg-white/80 hover:bg-zinc-100 border border-zinc-200",onClick:()=>s(!0),children:"Edit content"}),c&&t.jsx(Kfe,{expandDialogContent:t.jsx(nhe,{smsBody:u})})]}),children:c?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"pt-4 pb-2 px-6 flex flex-col gap-1",children:t.jsx("div",{className:"rounded-xl bg-zinc-50/80 shadow-sm border border-zinc-100 p-4",children:t.jsx(the,{})})}),t.jsx("div",{className:"w-full h-[1.5px] bg-zinc-200 my-2"}),t.jsx("div",{className:"flex-1 w-full overflow-auto h-full flex items-center justify-center",children:t.jsx(Ufe,{body:u})})]}):t.jsx(Wfe,{type:"sms"})})]})},ihe=()=>{const{state:{selectedActionId:e}}=n.useContext(fQ);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(VB,{mode:"wait",children:e===Pde.EditTime?t.jsx(cfe,{}):e===Pde.EditAudience?t.jsx(afe,{}):t.jsxs(Ype,{defaultValue:"email",className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:[t.jsx("div",{className:"max-w-[640px] mx-auto w-full",children:t.jsxs(Xpe,{className:"grid w-full grid-cols-2",children:[t.jsx(Qpe,{value:"email",className:"group",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e",alt:"Email",className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block"}),t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%237A8599'%20/%3e%3c/svg%3e",alt:"Email",className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden"}),"Email"]})}),t.jsx(Qpe,{value:"sms",className:"group",children:t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e",alt:"SMS",className:"w-4 h-4 mr-2 hidden group-data-[state=active]:block"}),t.jsx("img",{src:"data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%237A8599'%20/%3e%3c/svg%3e",alt:"SMS",className:"w-4 h-4 mr-2 block group-data-[state=active]:hidden"}),"SMS"]})})]})}),t.jsxs("div",{className:"max-w-[1000px] mx-auto w-full flex-1",children:[t.jsx(Zpe,{value:"sms",children:t.jsx(ohe,{})}),t.jsx(Zpe,{value:"email",className:"flex flex-col h-full",children:t.jsx(ehe,{})})]})]})})})},ahe=()=>t.jsxs(Rde,{direction:"horizontal",className:"flex-1",children:[t.jsx(Ode,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(qde,{})})}),t.jsx(Nde,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(Ode,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(ihe,{})})})]}),she=()=>{const[e,r]=n.useState("workflow"),o=[{id:"workflow",label:"Workflow",content:t.jsx(ahe,{})},{id:"recipients",label:"Recipients",content:t.jsx(Xce,{})},{id:"insights",label:df("engage:insight",{count:2}),content:t.jsx(Yce,{})}];return t.jsx("div",{className:"h-full w-full",children:t.jsx(mQ,{tabs:o,activeTab:e,onTabChange:r,tabsLocation:"left"})})},lhe=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i})=>{const a=hae(),s=mae(),{updateCommunicationGroup:l}=uae(),{toast:c}=Ll();return n.useEffect((()=>{if(s&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(s.extraMergeFields)&&l({groupId:s?.id,params:{extraMergeFields:e}},{onError:e=>{c({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[s,i,l,c]),a&&s?t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(Wce,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(she,{})})]}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(FX,{text:[`Fetching ${df("engage:automation").toLowerCase()} data`,"Finishing up"]})})},che=({...e})=>{const n=function(){let{matches:e}=i.useContext(t2),t=e[e.length-1];return t?t.params:{}}(),[r]=H2(),o=e.automationId||n?.automationId||r.get("automationId")||"",a="true"===r.get("showBackButton")||e.showBackButton;return t.jsx(gae,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(lhe,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var uhe=e=>null!=e;var dhe=e=>"function"!=typeof e||e.length?e:e(),phe=e=>Array.isArray(e)?e:e?[e]:[];var fhe=ht;var hhe,mhe=function(e){const[t,n]=it(),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=it(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(O_e){return r(O_e,`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&&ft((()=>{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(O_e){r(O_e,`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),ht((()=>globalThis.removeEventListener("storage",e)))):(o.forEach((t=>t.addEventListener?.("storage",e))),ht((()=>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(O_e){r(O_e,`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(O_e){r(O_e,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(O_e){r(O_e,`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(O_e){r(O_e,`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(O_e){r(O_e,`Error getting all values from ${e.name}`)}}})),t}}]},ghe=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},vhe=("function"==typeof(hhe={_cookies:[globalThis.document,"cookie"],getItem:e=>vhe._cookies[0][vhe._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=vhe.getItem(e);vhe._cookies[0][vhe._cookies[1]]=`${e}=${t}${ghe(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:vhe});window.dispatchEvent(o)},removeItem:e=>{vhe._cookies[0][vhe._cookies[1]]=`${e}=deleted${ghe({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return vhe._cookies[0][vhe._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return vhe._cookies[0][vhe._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(hhe.clear=()=>{let e;for(;e=hhe.key(0);)hhe.removeItem(e)}),hhe),yhe=796,bhe="bottom",whe="system",xhe=Object.keys(Ar)[0],_he=Object.keys(Nr)[0],She=bt({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function Ehe(){return wt(She)}var The=bt(void 0),Che=e=>{const[t,n]=it(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[cn]){for(let t of e[cn].keys())e.removeEventListener(t,Sn);delete e[cn]}}(i.document),i.document.title="TanStack Query Devtools",i.document.body.style.margin="0",i.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(Ehe().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(R_e){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)}})),pn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],i.document),e.setLocalStore("pip_open","true"),n(i)};lt((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||o(Number(window.innerWidth),Number(e.localStore.height||500))})),lt((()=>{const e=(Ehe().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(Ehe().shadowDOMTarget||n.document).querySelector("#_goober");t&&(t.textContent=e.textContent)}));t.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),ht((()=>{t.disconnect()}))}}));const i=ct((()=>({pipWindow:t(),requestPipWindow:o,closePipWindow:r,disabled:e.disabled??!1})));return Ut(The.Provider,{value:i,get children(){return e.children}})},Ahe=()=>ct((()=>{const e=wt(The);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Rhe=bt((()=>"dark"));function Ohe(){return wt(Rhe)}var Nhe={"À":"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"},Phe=Object.keys(Nhe).join("|"),khe=new RegExp(Phe,"g");var Lhe=7,Dhe=6,Mhe=5,jhe=4,Ihe=3,Fhe=2,Uhe=1,$he=0;function Vhe(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:Uhe,!n.accessors){const r=Bhe(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=Ghe(o),a=Hhe(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:$he,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=Bhe(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=Uhe?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 Bhe(e,t,n){return e=zhe(e,n),(t=zhe(t,n)).length>e.length?$he:e===t?Lhe:(e=e.toLowerCase())===(t=t.toLowerCase())?Dhe:e.startsWith(t)?Mhe:e.includes(` ${t}`)?jhe:e.includes(t)?Ihe:1===t.length?$he:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?Fhe: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 Uhe+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return $he;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return $he}return i(r-a)}(e,t)}function zhe(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(khe,(e=>Nhe[e]))),e}function Hhe(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 qhe={maxRanking:1/0,minRanking:-1/0};function Ghe(e){return"function"==typeof e?qhe:{...qhe,...e}}var Khe={data:""},Whe=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Yhe=/\/\*[^]*?\*\/| +/g,Xhe=/\n+/g,Qhe=(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]?Qhe(a,i):i+"{"+Qhe(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=Qhe(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+=Qhe.p?Qhe.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},Zhe={},Jhe=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+Jhe(e[n]);return t}return e};function eme(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=Jhe(e),a=Zhe[i]||(Zhe[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!Zhe[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=Whe.exec(e.replace(Yhe,""));)t[4]?r.shift():t[3]?(n=t[3].replace(Xhe," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(Xhe," ").trim();return r[0]})(e);Zhe[a]=Qhe(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&Zhe.g?Zhe.g:null;return n&&(Zhe.g=Zhe[a]),l=Zhe[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?"":Qhe(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||Khe),t.g,t.o,t.k);var r}function tme(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=tme(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function nme(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=tme(e))&&(r&&(r+=" "),r+=t);return r}function rme(e,t){const n=dt(e),{onChange:r}=t;let o=new Set(t.appear?void 0:n);const i=new WeakSet,[a,s]=it([],{equals:!1}),[l]=[vt,gt],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 ct((t=>{const n=a(),s=e();if(dt(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 dt((()=>{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 ome(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}eme.bind({g:1}),eme.bind({k:1});var ime=e=>e instanceof Element;function ame(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return ame(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=ame(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function sme(e,t=ime,n=ime){const r=ct(e),o=ct((()=>ame(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function lme(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function cme(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()))})),lme((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function ume(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())),lme((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var dme=e=>{const t=function(e){return ct((()=>{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 rme(sme((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)cme(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)ume(a,e,t,(()=>o([t])))}})},pme=Symbol("fallback");function fme(e){for(const t of e)t.dispose()}function hme(e){const{by:t}=e;return ct(function(e,t,n,r={}){const o=new Map;return ht((()=>fme(o.values()))),()=>{const n=e()||[];return dt((()=>{if(!n.length)return fme(o.values()),o.clear(),r.fallback?[ot((e=>(o.set(pme,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(pme);if(!o.size||a){a?.dispose(),o.delete(pme);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){ot((a=>{const[s,l]=it(t),c={setItem:l,dispose:a};if(n.length>1){const[e,t]=it(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 mme(e,t,n,r){const o=()=>{phe(dhe(e)).forEach((e=>{e&&phe(dhe(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),fhe(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?lt(o):st(o)}function gme(e,t,n){const r=new WeakMap,{observe:o,unobserve:i}=function(e,t){const n=new ResizeObserver(e);return ht(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);lt((t=>{const n=phe(dhe(e)).filter(uhe);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 vme=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function yme(e){const t={};let n;for(;n=vme.exec(e);)t[n[1]]=n[2];return t}function bme(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=yme(e)}else"string"==typeof t&&(t=yme(t));return{...e,...t}}function wme(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function xme(e){return"[object String]"===Object.prototype.toString.call(e)}function _me(e){return t=>`${e()}-${t}`}function Sme(e,t){return!!e&&(e===t||e.contains(t))}function Eme(e,t=!1){const{activeElement:n}=Tme(e);if(!n?.nodeName)return null;if(Cme(n)&&n.contentDocument)return Eme(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Tme(n).getElementById(e);if(t)return t}}return n}function Tme(e){return e?e.ownerDocument||e:document}function Cme(e){return"IFRAME"===e.tagName}var Ame=(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))(Ame||{});function Rme(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function Ome(){return Rme(/^Mac/i)}function Nme(){return Rme(/^iPhone/i)||Rme(/^iPad/i)||Ome()&&navigator.maxTouchPoints>1}function Pme(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function kme(e){return t=>{for(const n of e)Pme(t,n)}}function Lme(e){return Ome()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function Dme(e){if(e)if(function(){if(null==Mme){Mme=!1;try{document.createElement("div").focus({get preventScroll(){return Mme=!0,!0}})}catch(R_e){}}return Mme}())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 Mme=null;var jme=["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'])"],Ime=[...jme,'[tabindex]:not([tabindex="-1"]):not([disabled])'],Fme=jme.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",Ume=Ime.join(':not([hidden]):not([tabindex="-1"]),');function $me(e,t){const n=Array.from(e.querySelectorAll(Fme)).filter(Vme);return t&&Vme(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Cme(e)&&e.contentDocument){const r=$me(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function Vme(e){return Bme(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function Bme(e){return e.matches(Fme)&&zme(e)}function zme(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||zme(e.parentElement,e))}function Hme(e){for(;e&&!qme(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function qme(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function Gme(){}function Kme(e,t){return Ht(e,t)}var Wme=new Map,Yme=new Set;function Xme(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=Wme.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),Wme.delete(t.target)),0===Wme.size)){for(const e of Yme)e();Yme.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=Wme.get(t.target);n||(n=new Set,Wme.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function Qme(e,t){const n=Zme(e,t,"left"),r=Zme(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 Zme(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?Xme():document.addEventListener("DOMContentLoaded",Xme));var Jme={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 ege(e){return t=>(e(t),()=>e(void 0))}function tge(e,t){const[n,r]=it(nge(t?.()));return lt((()=>{r(e()?.tagName.toLowerCase()||nge(t?.()))})),n}function nge(e){return xme(e)?e:void 0}function rge(e){const[t,n]=qt(e,["as"]);if(!t.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return Ut(Nn,Ht(n,{get component(){return t.as}}))}var oge=["id","name","validationState","required","disabled","readOnly"];var ige=bt();function age(){const e=wt(ige);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function sge(e){const t=age(),n=Kme({id:t.generateId("description")},e);return lt((()=>ht(t.registerDescription(n.id)))),Ut(rge,Ht({as:"div"},(()=>t.dataset()),n))}function lge(e){const t=age(),n=Kme({id:t.generateId("error-message")},e),[r,o]=qt(n,["forceMount"]),i=()=>"invalid"===t.validationState();return lt((()=>{i()&&ht(t.registerErrorMessage(o.id))})),Ut(Zt,{get when(){return r.forceMount||i()},get children(){return Ut(rge,Ht({as:"div"},(()=>t.dataset()),o))}})}function cge(e){let t;const n=age(),r=Kme({id:n.generateId("label")},e),[o,i]=qt(r,["ref"]),a=tge((()=>t),(()=>"label"));return lt((()=>ht(n.registerLabel(i.id)))),Ut(rge,Ht({as:"label",ref(e){const n=ome((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ct((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function uge(e,t){lt(pt(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}),ht((()=>{n.removeEventListener("reset",t)})))})))}function dge(e){const[t,n]=it(e.defaultValue?.()),r=ct((()=>void 0!==e.value?.())),o=ct((()=>r()?e.value?.():t()));return[o,t=>{dt((()=>{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 pge(e){const[t,n]=dge(e);return[()=>t()??!1,n]}var fge=Object.defineProperty,hge=(e,t)=>{for(var n in t)fge(e,n,{get:t[n],enumerable:!0})},mge=bt();function gge(){return wt(mge)}function vge(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function yge(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?vge(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 bge(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){lt((()=>{const n=setTimeout((()=>{yge(e(),t)}));ht((()=>clearTimeout(n)))}))}(e,t);let n=[];lt((()=>{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 Tme(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&yge(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}ht((()=>o.disconnect()))}))}function wge(e={}){const[t,n]=function(e){const[t,n]=dge(e);return[()=>t()??[],n]}({value:()=>dhe(e.items),onChange:t=>e.onItemsChange?.(t)});bge(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&&vge(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=>Ut(mge.Provider,{value:{registerItem:r},get children(){return e.children}})}}function xge(e){const t=function(){const e=gge();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=Kme({shouldRegisterItem:!0},e);lt((()=>{if(!n.shouldRegisterItem)return;ht(t.registerItem(n.getItem()))}))}function _ge(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=xme(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=xme(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(xme(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return xme(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(xme(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=_ge({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 Sge(e,t=[]){return ct((()=>{const n=_ge({dataSource:dhe(e.dataSource),getKey:dhe(e.getKey),getTextValue:dhe(e.getTextValue),getDisabled:dhe(e.getDisabled),getSectionChildren:dhe(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var Ege=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Tge=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Cge(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return Ege.has(t)}const t=e.split("-")[0];return Tge.has(t)}(e)?"rtl":"ltr"}function Age(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Cge(e)}}var Rge=Age(),Oge=new Set;function Nge(){Rge=Age();for(const e of Oge)e(Rge)}var Pge=bt();function kge(){const e=function(){const[e,t]=it(Rge),n=ct((()=>e()));return ft((()=>{0===Oge.size&&window.addEventListener("languagechange",Nge),Oge.add(t),ht((()=>{Oge.delete(t),0===Oge.size&&window.removeEventListener("languagechange",Nge)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return wt(Pge)||e}var Lge=new Map;var Dge=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 Mge(e){return Ome()||Nme()?e.altKey:e.ctrlKey}function jge(e){return Ome()?e.metaKey:e.ctrlKey}function Ige(e){return new Dge(e)}function Fge(e){const t=Kme({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=it(!1),[o,i]=it(),a=ct((()=>{const e=dhe(t.selectedKeys);return null!=e?Ige(e):e})),s=ct((()=>{const e=dhe(t.defaultSelectedKeys);return null!=e?Ige(e):new Dge})),[l,c]=function(e){const[t,n]=dge(e);return[()=>t()??new Dge,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=it(dhe(t.selectionBehavior));return lt((()=>{const e=l();"replace"===dhe(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),lt((()=>{d(dhe(t.selectionBehavior)??"toggle")})),{selectionMode:()=>dhe(t.selectionMode),disallowEmptySelection:()=>dhe(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!dhe(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 Uge(e,t,n){const r=Ht({selectOnFocus:()=>"replace"===dhe(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=kge();let a={top:0,left:0};mme((()=>dhe(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]=it(""),[r,o]=it(-1);return{typeSelectHandlers:{onKeyDown:i=>{if(dhe(e.isDisabled))return;const a=dhe(e.keyboardDelegate),s=dhe(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:()=>dhe(r.disallowTypeAhead),keyboardDelegate:()=>dhe(r.keyboardDelegate),selectionManager:()=>dhe(r.selectionManager)}),l=()=>dhe(r.orientation)??"vertical",c=()=>{const e=dhe(r.autoFocus);if(!e)return;const n=dhe(r.selectionManager),o=dhe(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&&!dhe(r.shouldUseVirtualFocus)&&Dme(s)};ft((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),lt(pt([o,()=>dhe(r.isVirtualized),()=>dhe(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&&Qme(t,e)}})));return{tabIndex:ct((()=>{if(!dhe(r.shouldUseVirtualFocus))return null==dhe(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{Pme(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=dhe(r.selectionManager),a=dhe(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!Mge(e)&&o.replaceSelection(t))},u=dhe(r.keyboardDelegate),d=dhe(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,jge(e));null!=t&&(o.setFocusedKey(t),jge(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,jge(e));null!=t&&(o.setFocusedKey(t),jge(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":jge(e)&&"multiple"===o.selectionMode()&&!0!==dhe(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),dhe(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!dhe(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?Ume:Fme,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&zme(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)&&Dme(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=dhe(r.selectionManager),n=dhe(r.keyboardDelegate),i=dhe(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(!dhe(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(Dme(n),Qme(e,n))}}},onFocusOut:e=>{const t=dhe(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function $ge(e,t){const n=()=>dhe(e.selectionManager),r=()=>dhe(e.key),o=()=>dhe(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()||jge(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>dhe(e.disabled)||n().isDisabled(r()),s=()=>!a()&&n().canSelectItem(r());let l=null;const c=ct((()=>{if(!o()&&!a())return r()===n().focusedKey()?0:-1})),u=ct((()=>dhe(e.virtualized)?void 0:r()));return lt(pt([t,r,o,()=>n().focusedKey(),()=>n().isFocused()],(([t,n,r,o,i])=>{t&&n===o&&i&&!r&&document.activeElement!==t&&(e.focus?e.focus():Dme(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||dhe(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&dhe(e.shouldSelectOnPressUp)&&dhe(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(dhe(e.shouldSelectOnPressUp)&&!dhe(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(Mge(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 Vge=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 Dge(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 Dge(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 Dge([t],t,t):new Dge;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new Dge;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 Dge)}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}},Bge=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 zge,Hge=e=>"function"==typeof e?e():e,qge=e=>{const t=ct((()=>{const t=Hge(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=it(Hge(e.show)?"present":"hidden");let i="none";return lt((r=>{const a=Hge(e.show);return dt((()=>{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})),lt((()=>{const t=Hge(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),ht((()=>{t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}))})),{present:()=>"present"===r()||"hiding"===r(),state:r}},Gge="data-kb-top-layer",Kge=!1,Wge=[];function Yge(e){return Wge.findIndex((t=>t.node===e))}function Xge(){return Wge.filter((e=>e.isPointerBlocking))}function Qge(){return Xge().length>0}function Zge(e){const t=Yge([...Xge()].slice(-1)[0]?.node);return Yge(e)<t}var Jge={layers:Wge,isTopMostLayer:function(e){return Wge[Wge.length-1].node===e},hasPointerBlockingLayer:Qge,isBelowPointerBlockingLayer:Zge,addLayer:function(e){Wge.push(e)},removeLayer:function(e){const t=Yge(e);t<0||Wge.splice(t,1)},indexOf:Yge,find:function(e){return Wge[Yge(e)]},assignPointerEventToLayers:function(){for(const{node:e}of Wge)e.style.pointerEvents=Zge(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(Qge()&&!Kge){const t=Tme(e);zge=document.body.style.pointerEvents,t.body.style.pointerEvents="none",Kge=!0}},restoreBodyPointerEvents:function(e){if(Qge())return;const t=Tme(e);t.body.style.pointerEvents=zge,0===t.body.style.length&&t.body.removeAttribute("style"),Kge=!1}};hge({},{Button:()=>nve,Root:()=>tve});var eve=["button","color","file","image","reset","submit"];function tve(e){let t;const n=Kme({type:"button"},e),[r,o]=qt(n,["ref","type","disabled"]),i=tge((()=>t),(()=>"button")),a=ct((()=>{const e=i();return null!=e&&function(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==eve.indexOf(e.type)}({tagName:e,type:r.type})})),s=ct((()=>"input"===i())),l=ct((()=>"a"===i()&&null!=t?.getAttribute("href")));return Ut(rge,Ht({as:"button",ref(e){const n=ome((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 nve=tve,rve=["top","right","bottom","left"],ove=Math.min,ive=Math.max,ave=Math.round,sve=Math.floor,lve=e=>({x:e,y:e}),cve={left:"right",right:"left",bottom:"top",top:"bottom"},uve={start:"end",end:"start"};function dve(e,t,n){return ive(e,ove(t,n))}function pve(e,t){return"function"==typeof e?e(t):e}function fve(e){return e.split("-")[0]}function hve(e){return e.split("-")[1]}function mve(e){return"x"===e?"y":"x"}function gve(e){return"y"===e?"height":"width"}function vve(e){return["top","bottom"].includes(fve(e))?"y":"x"}function yve(e){return mve(vve(e))}function bve(e){return e.replace(/start|end/g,(e=>uve[e]))}function wve(e){return e.replace(/left|right|bottom|top/g,(e=>cve[e]))}function xve(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 _ve(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 Sve(e,t,n){let{reference:r,floating:o}=e;const i=vve(t),a=yve(t),s=gve(a),l=fve(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(hve(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function Eve(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}=pve(t,e),h=xve(f),m=s[p?"floating"===d?"reference":"floating":d],g=_ve(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},w=_ve(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-w.top+h.top)/b.y,bottom:(w.bottom-g.bottom+h.bottom)/b.y,left:(g.left-w.left+h.left)/b.x,right:(w.right-g.right+h.right)/b.x}}function Tve(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cve(e){return rve.some((t=>e[t]>=0))}function Ave(e){return Nve(e)?(e.nodeName||"").toLowerCase():"#document"}function Rve(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ove(e){var t;return null==(t=(Nve(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Nve(e){return e instanceof Node||e instanceof Rve(e).Node}function Pve(e){return e instanceof Element||e instanceof Rve(e).Element}function kve(e){return e instanceof HTMLElement||e instanceof Rve(e).HTMLElement}function Lve(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Rve(e).ShadowRoot)}function Dve(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$ve(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Mve(e){return["table","td","th"].includes(Ave(e))}function jve(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(R_e){return!1}}))}function Ive(e){const t=Fve(),n=Pve(e)?$ve(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 Fve(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Uve(e){return["html","body","#document"].includes(Ave(e))}function $ve(e){return Rve(e).getComputedStyle(e)}function Vve(e){return Pve(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bve(e){if("html"===Ave(e))return e;const t=e.assignedSlot||e.parentNode||Lve(e)&&e.host||Ove(e);return Lve(t)?t.host:t}function zve(e){const t=Bve(e);return Uve(t)?e.ownerDocument?e.ownerDocument.body:e.body:kve(t)&&Dve(t)?t:zve(t)}function Hve(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=zve(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Rve(o);return i?t.concat(a,a.visualViewport||[],Dve(o)?o:[],a.frameElement&&n?Hve(a.frameElement):[]):t.concat(o,Hve(o,[],n))}function qve(e){const t=$ve(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=kve(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=ave(n)!==i||ave(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function Gve(e){return Pve(e)?e:e.contextElement}function Kve(e){const t=Gve(e);if(!kve(t))return lve(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=qve(t);let a=(i?ave(n.width):n.width)/r,s=(i?ave(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var Wve=lve(0);function Yve(e){const t=Rve(e);return Fve()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Wve}function Xve(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Gve(e);let a=lve(1);t&&(r?Pve(r)&&(a=Kve(r)):a=Kve(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Rve(e))&&t}(i,n,r)?Yve(i):lve(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=Rve(i),t=r&&Pve(r)?Rve(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=Kve(o),t=o.getBoundingClientRect(),r=$ve(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=Rve(o),o=n.frameElement}}return _ve({width:u,height:d,x:l,y:c})}function Qve(e){return Xve(Ove(e)).left+Vve(e).scrollLeft}function Zve(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Rve(e),r=Ove(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=Fve();(!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=Ove(e),n=Vve(e),r=e.ownerDocument.body,o=ive(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ive(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Qve(e);const s=-n.scrollTop;return"rtl"===$ve(r).direction&&(a+=ive(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Ove(e));else if(Pve(t))r=function(e,t){const n=Xve(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=kve(e)?Kve(e):lve(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=Yve(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return _ve(r)}function Jve(e,t){const n=Bve(e);return!(n===t||!Pve(n)||Uve(n))&&("fixed"===$ve(n).position||Jve(n,t))}function eye(e,t,n){const r=kve(t),o=Ove(t),i="fixed"===n,a=Xve(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=lve(0);if(r||!r&&!i)if(("body"!==Ave(t)||Dve(o))&&(s=Vve(t)),r){const e=Xve(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=Qve(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function tye(e){return"static"===$ve(e).position}function nye(e,t){return kve(e)&&"fixed"!==$ve(e).position?t?t(e):e.offsetParent:null}function rye(e,t){const n=Rve(e);if(jve(e))return n;if(!kve(e)){let t=Bve(e);for(;t&&!Uve(t);){if(Pve(t)&&!tye(t))return t;t=Bve(t)}return n}let r=nye(e,t);for(;r&&Mve(r)&&tye(r);)r=nye(r,t);return r&&Uve(r)&&tye(r)&&!Ive(r)?n:r||function(e){let t=Bve(e);for(;kve(t)&&!Uve(t);){if(Ive(t))return t;if(jve(t))return null;t=Bve(t)}return null}(e)||n}var oye={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ove(r),s=!!t&&jve(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=lve(1);const u=lve(0),d=kve(r);if((d||!d&&!i)&&(("body"!==Ave(r)||Dve(a))&&(l=Vve(r)),kve(r))){const e=Xve(r);c=Kve(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:Ove,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?jve(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Hve(e,[],!1).filter((e=>Pve(e)&&"body"!==Ave(e))),o=null;const i="fixed"===$ve(e).position;let a=i?Bve(e):e;for(;Pve(a)&&!Uve(a);){const t=$ve(a),n=Ive(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Dve(a)&&!n&&Jve(e,a))?r=r.filter((e=>e!==a)):o=t,a=Bve(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=Zve(t,n,o);return e.top=ive(r.top,e.top),e.right=ove(r.right,e.right),e.bottom=ove(r.bottom,e.bottom),e.left=ive(r.left,e.left),e}),Zve(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:rye,getElementRects:async function(e){const t=this.getOffsetParent||rye,n=this.getDimensions,r=await n(e.floating);return{reference:eye(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}=qve(e);return{width:t,height:n}},getScale:Kve,isElement:Pve,isRTL:function(e){return"rtl"===$ve(e).direction}};function iye(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=Gve(e),u=o||i?[...c?Hve(c):[],...Hve(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=Ove(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:-sve(u)+"px "+-sve(o.clientWidth-(c+d))+"px "+-sve(o.clientHeight-(u+p))+"px "+-sve(c)+"px",threshold:ive(0,ove(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(R_e){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?Xve(e):null;return l&&function t(){const r=Xve(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 aye=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=fve(n),s=hve(n),l="y"===vve(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=pve(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}}}}},sye=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}=pve(e,t),c={x:n,y:r},u=await Eve(t,l),d=vve(fve(o)),p=mve(d);let f=c[p],h=c[d];if(i){f=dve(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=dve(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}}}}},lye=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}=pve(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=fve(o),y=vve(s),b=fve(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=p||(b||!m?[wve(s)]:function(e){const t=wve(e);return[bve(e),t,bve(t)]}(s)),_="none"!==h;!p&&_&&x.push(...function(e,t,n,r){const o=hve(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[]}}(fve(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(bve)))),i}(s,m,h,w));const S=[s,...x],E=await Eve(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=hve(e),o=yve(e),i=gve(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=wve(a)),[a,wve(a)]}(o,a,w);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,R;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==(R=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:R.placement;if(!n)switch(f){case"bestFit":{var O;const e=null==(O=C.filter((e=>{if(_){const t=vve(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:O[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},cye=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}=pve(e,t),l=await Eve(t,s),c=fve(n),u=hve(n),d="y"===vve(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=ove(f-l[h],g),b=ove(p-l[m],v),w=!t.middlewareData.shift;let x=y,_=b;if(d?_=u||w?ove(b,v):v:x=u||w?ove(y,g):g,w&&!u){const e=ive(l.left,0),t=ive(l.right,0),n=ive(l.top,0),r=ive(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:ive(l.left,l.right)):x=f-2*(0!==n||0!==r?n+r:ive(l.top,l.bottom))}await a({...t,availableWidth:_,availableHeight:x});const S=await o.getDimensions(i.floating);return p!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},uye=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=pve(e,t);switch(r){case"referenceHidden":{const e=Tve(await Eve(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Cve(e)}}}case"escaped":{const e=Tve(await Eve(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Cve(e)}}}default:return{}}}}},dye=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}=pve(e,t)||{};if(null==c)return{};const d=xve(u),p={x:n,y:r},f=yve(o),h=gve(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",w=i.reference[h]+i.reference[f]-p[f]-i.floating[h],x=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=w/2-x/2,T=S/2-m[h]/2-1,C=ove(d[v],T),A=ove(d[y],T),R=C,O=S-m[h]-A,N=S/2-m[h]/2+E,P=dve(R,N,O),k=!l.arrow&&null!=hve(o)&&N!==P&&i.reference[h]/2-(N<R?C:A)-m[h]/2<0,L=k?N<R?N-R:N-O:0;return{[f]:p[f]+L,data:{[f]:P,centerOffset:N-P-L,...k&&{alignmentOffset:L}},reset:k}}}),pye=(e,t,n)=>{const r={platform:oye,...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}=Sve(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}=Sve(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},fye=bt();function hye(){const e=wt(fye);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var mye=dn('<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">'),gye={top:180,right:-90,bottom:0,left:90};function vye(e){const t=hye(),n=Kme({size:30},e),[r,o]=qt(n,["ref","style","size"]),i=()=>t.currentPlacement().split("-")[0],a=function(e){const[t,n]=it();return lt((()=>{const t=e();var r;t&&n((r=t,Tme(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return Ut(rge,Ht({as:"div",ref(e){const n=ome(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return bme({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=mye(),t=e.firstChild;return st((()=>fn(t,"transform",`rotate(${gye[i()]} 15 15) translate(0 2)`))),e}}))}function yye(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 bye(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var wye={top:"bottom",right:"left",bottom:"top",left:"right"};var xye=Object.assign((function(e){const t=Kme({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]=it(),[o,i]=it(),[a,s]=it(t.placement),l=()=>{return e=t.anchorRef?.(),n=t.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const t=n(e);return t?yye(t):e?e.getBoundingClientRect():yye()}};var e,n},{direction:c}=kge();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=[aye((({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(bye))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(lye({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(sye({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(cye({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(uye({padding:t.detachedPadding})),i&&d.push(dye({element:i,padding:t.arrowPadding}));const p=await pye(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...oye,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=wye[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 lt((()=>{const e=l(),t=n();if(!e||!t)return;ht(iye(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),lt((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),Ut(fye.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:vye,Context:fye,usePopperContext:hye,Positioner:function(e){const t=hye(),[n,r]=qt(e,["ref","style"]);return Ut(rge,Ht({as:"div",ref(e){const r=ome(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return bme({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var _ye="interactOutside.pointerDownOutside",Sye="interactOutside.focusOutside";var Eye=bt();function Tye(e){let t;const n=wt(Eye),[r,o]=qt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=Gme;const o=()=>Tme(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(`[${Gge}]`)&&!!Sme(o(),r)&&!Sme(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=kme([i,s]);r.addEventListener(_ye,o,{once:!0});const a=new CustomEvent(_ye,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||Lme(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=kme([a,s]);r.addEventListener(Sye,o,{once:!0});const i=new CustomEvent(Sye,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};lt((()=>{dhe(e.isDisabled)||(n=window.setTimeout((()=>{o().addEventListener("pointerdown",c,!0)}),0),o().addEventListener("focusin",u,!0),ht((()=>{window.clearTimeout(n),o().removeEventListener("click",r),o().removeEventListener("pointerdown",c,!0),o().removeEventListener("focusin",u,!0)})))}))}({shouldExcludeElement:e=>!!t&&(r.excludedElements?.some((t=>Sme(t(),e)))||[...i].some((t=>Sme(t,e)))),onPointerDownOutside:e=>{t&&!Jge.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||Jge.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===Ame.Escape&&e.onEscapeKeyDown?.(t)};lt((()=>{if(dhe(e.isDisabled))return;const n=e.ownerDocument?.()??Tme();n.addEventListener("keydown",t),ht((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Tme(t),onEscapeKeyDown:e=>{t&&Jge.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),ft((()=>{if(!t)return;Jge.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);Jge.assignPointerEventToLayers(),Jge.disableBodyPointerEvents(t),ht((()=>{t&&(Jge.removeLayer(t),e?.(),Jge.assignPointerEventToLayers(),Jge.restoreBodyPointerEvents(t))}))})),lt(pt([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=Jge.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,Jge.assignPointerEventToLayers()),t&&Jge.disableBodyPointerEvents(e),ht((()=>{Jge.restoreBodyPointerEvents(e)}))}),{defer:!0}));return Ut(Eye.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return Ut(rge,Ht({as:"div",ref(e){const n=ome((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Cye(e={}){const[t,n]=pge({value:()=>dhe(e.open),defaultValue:()=>!!dhe(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 Aye={};hge(Aye,{Description:()=>sge,ErrorMessage:()=>lge,Item:()=>kye,ItemControl:()=>Lye,ItemDescription:()=>Dye,ItemIndicator:()=>Mye,ItemInput:()=>jye,ItemLabel:()=>Iye,Label:()=>Fye,RadioGroup:()=>$ye,Root:()=>Uye});var Rye=bt();function Oye(){const e=wt(Rye);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var Nye=bt();function Pye(){const e=wt(Nye);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function kye(e){const t=age(),n=Oye(),r=Kme({id:`${t.generateId("item")}-${Wt()}`},e),[o,i]=qt(r,["value","disabled","onPointerDown"]),[a,s]=it(),[l,c]=it(),[u,d]=it(),[p,f]=it(),[h,m]=it(!1),g=ct((()=>n.isSelectedValue(o.value))),v=ct((()=>o.disabled||t.isDisabled()||!1)),y=e=>{Pme(e,o.onPointerDown),h()&&e.preventDefault()},b=ct((()=>({...t.dataset(),"data-disabled":v()?"":void 0,"data-checked":g()?"":void 0}))),w={value:()=>o.value,dataset:b,isSelected:g,isDisabled:v,inputId:a,labelId:l,descriptionId:u,inputRef:p,select:()=>n.setSelectedValue(o.value),generateId:_me((()=>i.id)),registerInput:ege(s),registerLabel:ege(c),registerDescription:ege(d),setIsFocused:m,setInputRef:f};return Ut(Nye.Provider,{value:w,get children(){return Ut(rge,Ht({as:"div",role:"group",onPointerDown:y},b,i))}})}function Lye(e){const t=Pye(),n=Kme({id:t.generateId("control")},e),[r,o]=qt(n,["onClick","onKeyDown"]);return Ut(rge,Ht({as:"div",onClick:e=>{Pme(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{Pme(e,r.onKeyDown),e.key===Ame.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function Dye(e){const t=Pye(),n=Kme({id:t.generateId("description")},e);return lt((()=>ht(t.registerDescription(n.id)))),Ut(rge,Ht({as:"div"},(()=>t.dataset()),n))}function Mye(e){const t=Pye(),n=Kme({id:t.generateId("indicator")},e),[r,o]=qt(n,["ref","forceMount"]),[i,a]=it(),{present:s}=qge({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return Ut(Zt,{get when(){return s()},get children(){return Ut(rge,Ht({as:"div",ref(e){const t=ome(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function jye(e){const t=age(),n=Oye(),r=Pye(),o=Kme({id:r.generateId("input")},e),[i,a]=qt(o,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=it(!1);return lt(pt([()=>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})),lt((()=>ht(r.registerInput(a.id)))),Ut(rge,Ht({as:"input",ref(e){const t=ome(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 bme({...Jme},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(Pme(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{Pme(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{Pme(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function Iye(e){const t=Pye(),n=Kme({id:t.generateId("label")},e);return lt((()=>ht(t.registerLabel(n.id)))),Ut(rge,Ht({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function Fye(e){return Ut(cge,Ht({as:"span"},e))}function Uye(e){let t;const n=Kme({id:`radiogroup-${Wt()}`,orientation:"vertical"},e),[r,o,i]=qt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],oge),[a,s]=dge({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=Kme({id:`form-control-${Wt()}`},e),[n,r]=it(),[o,i]=it(),[a,s]=it(),[l,c]=it();return{formControlContext:{name:()=>dhe(t.name)??dhe(t.id),dataset:ct((()=>({"data-valid":"valid"===dhe(t.validationState)?"":void 0,"data-invalid":"invalid"===dhe(t.validationState)?"":void 0,"data-required":dhe(t.required)?"":void 0,"data-disabled":dhe(t.disabled)?"":void 0,"data-readonly":dhe(t.readOnly)?"":void 0}))),validationState:()=>dhe(t.validationState),isRequired:()=>dhe(t.required),isDisabled:()=>dhe(t.disabled),isReadOnly:()=>dhe(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:_me((()=>dhe(t.id))),registerLabel:ege(r),registerField:ege(i),registerDescription:ege(s),registerErrorMessage:ege(c)}}}(o);uge((()=>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 Ut(ige.Provider,{value:l,get children(){return Ut(Rye.Provider,{value:d,get children(){return Ut(rge,Ht({as:"div",ref(e){const n=ome((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return dhe(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(dhe(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var $ye=Object.assign(Uye,{Description:sge,ErrorMessage:lge,Item:kye,ItemControl:Lye,ItemDescription:Dye,ItemIndicator:Mye,ItemInput:jye,ItemLabel:Iye,Label:Fye}),Vye=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 Bye(e,t,n){const r=function(e){const{locale:t}=kge(),n=ct((()=>t()+(e?Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1)).join():"")));return ct((()=>{const r=n();let o;return Lge.has(r)&&(o=Lge.get(r)),o||(o=new Intl.Collator(t(),e),Lge.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return Uge({selectionManager:()=>dhe(e.selectionManager),keyboardDelegate:ct((()=>{const n=dhe(e.keyboardDelegate);return n||new Vye(e.collection,t,r)})),autoFocus:()=>dhe(e.autoFocus),deferAutoFocus:()=>dhe(e.deferAutoFocus),shouldFocusWrap:()=>dhe(e.shouldFocusWrap),disallowEmptySelection:()=>dhe(e.disallowEmptySelection),selectOnFocus:()=>dhe(e.selectOnFocus),disallowTypeAhead:()=>dhe(e.disallowTypeAhead),shouldUseVirtualFocus:()=>dhe(e.shouldUseVirtualFocus),allowsTabNavigation:()=>dhe(e.allowsTabNavigation),isVirtualized:()=>dhe(e.isVirtualized),scrollToKey:t=>dhe(e.scrollToKey)?.(t),orientation:()=>dhe(e.orientation)},t)}var zye="focusScope.autoFocusOnMount",Hye="focusScope.autoFocusOnUnmount",qye={bubbles:!1,cancelable:!0},Gye={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=wme(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=wme(this.stack,e),this.active()?.resume()}};function Kye(e,t){const[n,r]=it(!1),o={pause(){r(!0)},resume(){r(!1)}};let i=null;const a=t=>e.onMountAutoFocus?.(t),s=t=>e.onUnmountAutoFocus?.(t),l=()=>Tme(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,Jme),e},u=()=>{const e=t();return e?$me(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=u();return e.length>0?e[0]:null};lt((()=>{const e=t();if(!e)return;Gye.add(o);const n=Eme(e);if(!Sme(e,n)){const t=new CustomEvent(zye,qye);e.addEventListener(zye,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{Dme(d()),Eme(e)===n&&Dme(e)}),0)}ht((()=>{e.removeEventListener(zye,a),setTimeout((()=>{const r=new CustomEvent(Hye,qye);(()=>{const e=t();if(!e)return!1;const n=Eme(e);return!!n&&!Sme(e,n)&&Bme(n)})()&&r.preventDefault(),e.addEventListener(Hye,s),e.dispatchEvent(r),r.defaultPrevented||Dme(n??l().body),e.removeEventListener(Hye,s),Gye.remove(o)}),0)}))})),lt((()=>{const r=t();if(!r||!dhe(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${Gge}]`)||(Sme(r,t)?i=t:Dme(i))},a=e=>{const t=e.relatedTarget??Eme(r);t?.closest(`[${Gge}]`)||Sme(r,t)||Dme(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),ht((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),lt((()=>{const r=t();if(!r||!dhe(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})();Dme(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}),ht((()=>{o.removeEventListener("focusin",a),i.removeEventListener("focusin",a),o.remove(),i.remove(),s.disconnect()}))}))}var Wye="data-live-announcer";function Yye(e){lt((()=>{dhe(e.isDisabled)||ht(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${Wye}], [${Gge}]`))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=Xye.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),Xye.set(e,t+1))};Qye.length&&Qye[Qye.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 Qye.push(s),()=>{a.disconnect();for(const e of r){const t=Xye.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),Xye.delete(e)):Xye.set(e,t-1)}s===Qye[Qye.length-1]?(Qye.pop(),Qye.length&&Qye[Qye.length-1].observe()):Qye.splice(Qye.indexOf(s),1)}}(dhe(e.targets),dhe(e.root)))}))}var Xye=new WeakMap,Qye=[];var Zye=new Map,Jye=e=>{lt((()=>{const t=Hge(e.style)??{},n=Hge(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=Zye.get(e.key);o?o.activeCount++:Zye.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);ht((()=>{const t=Zye.get(e.key);if(t)if(1===t.activeCount){Zye.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--}))}))},ebe=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},tbe=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[nbe,rbe]=it([]),obe=e=>[e.deltaX,e.deltaY],ibe=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],abe=(e,t,n,r)=>{const o=null!==r&&sbe(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]=ebe(o,t),u=c-e-r*l;0===l&&0===u||!tbe(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)},sbe=(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},lbe=e=>{const t=Ht({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=Wt();let r=[0,0],o=null,i=null;lt((()=>{Hge(t.enabled)&&(rbe((e=>[...e,n])),ht((()=>{rbe((e=>e.filter((e=>e!==n))))})))})),lt((()=>{if(!Hge(t.enabled)||!Hge(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(Hge(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===Hge(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;Jye({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{Hge(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else Jye({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),lt((()=>{var e;(e=n,nbe().indexOf(e)===nbe().length-1&&Hge(t.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",a,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),ht((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",a),document.removeEventListener("touchmove",l)})))}));const a=e=>{r=ibe(e),o=null,i=null},s=e=>{const n=e.target,r=Hge(t.element),o=obe(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=abe(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!sbe(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=Hge(t.element),a=e.target;let s;if(2===e.touches.length)s=!Hge(t.allowPinchZoom);else{if(null==o||null===i){const t=ibe(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=abe(a,o,i,n);s=!n||!sbe(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},cbe=bt();function ube(){return wt(cbe)}function dbe(){const e=ube();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var pbe=bt();function fbe(){const e=wt(pbe);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var hbe=bt();function mbe(){const e=wt(hbe);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function gbe(e){let t;const n=mbe(),r=dbe(),o=Kme({id:n.generateId(`item-${Wt()}`)},e),[i,a]=qt(o,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=it(),[c,u]=it(),[d,p]=it(),f=()=>r.listState().selectionManager(),h=()=>a.id,m=()=>{i.onSelect?.(),i.closeOnSelect&&setTimeout((()=>{r.close(!0)}))};xge({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=$ge({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{Pme(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(Dme(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{Pme(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{Pme(e,i.onPointerUp),i.disabled||0!==e.button||m()},w=e=>{if(Pme(e,i.onKeyDown),!e.repeat&&!i.disabled)switch(e.key){case"Enter":case" ":m()}},x=ct((()=>i.indeterminate?"mixed":null!=i.checked?i.checked:void 0)),_=ct((()=>({"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:_me((()=>a.id)),registerLabel:ege(l),registerDescription:ege(u)};return Ut(pbe.Provider,{value:S,get children(){return Ut(rge,Ht({as:"div",ref(e){const n=ome((e=>t=e),i.ref);"function"==typeof n&&n(e)},get tabIndex(){return g.tabIndex()},get"aria-checked"(){return x()},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 kme([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return kme([b,g.onPointerUp])},get onClick(){return kme([i.onClick,g.onClick])},get onKeyDown(){return kme([w,g.onKeyDown])},get onMouseDown(){return kme([i.onMouseDown,g.onMouseDown])},get onFocus(){return kme([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function vbe(e){const t=Kme({closeOnSelect:!1},e),[n,r]=qt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=pge({value:()=>dhe(e.isSelected),defaultValue:()=>!!dhe(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{dhe(e.isReadOnly)||dhe(e.isDisabled)||n(t)},toggle:()=>{dhe(e.isReadOnly)||dhe(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return Ut(gbe,Ht({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var ybe=bt();function bbe(){return wt(ybe)}var wbe={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>wbe.next("ltr"===e?"rtl":"ltr",t)},xbe=e=>"horizontal"===e?"ArrowDown":"ArrowRight",_be=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function Sbe(e){const t=mbe(),n=dbe(),r=bbe(),{direction:o}=kge(),i=Kme({id:t.generateId("trigger")},e),[a,s]=qt(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=tge((()=>n.triggerRef()),(()=>"button")),u=ct((()=>"a"===c()&&null!=n.triggerRef()?.getAttribute("href")));lt(pt((()=>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 lt((()=>ht(n.registerTriggerId(a.id)))),Ut(tve,Ht({ref(e){const t=ome(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 ct((()=>!!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=>{Pme(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{Pme(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{Pme(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if(Pme(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case xbe(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=Hme(e);for(;e&&n&&e!==t&&n!==t;)Qme(n,e),n=Hme(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 _be(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case wbe.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case wbe.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{Pme(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 Ebe=bt();function Tbe(){return wt(Ebe)}function Cbe(e){let t;const n=mbe(),r=dbe(),o=bbe(),i=Tbe(),{direction:a}=kge(),s=Kme({id:n.generateId(`content-${Wt()}`)},e),[l,c]=qt(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=Bye({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));Kye({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()};lt((()=>ht(r.registerContentId(l.id))));const m={ref:ome((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:kme([l.onKeyDown,p.onKeyDown,e=>{if(Sme(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case wbe.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case wbe.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:kme([l.onMouseDown,p.onMouseDown]),onFocusIn:kme([l.onFocusIn,p.onFocusIn]),onFocusOut:kme([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{Pme(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if(Pme(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;Sme(e.currentTarget,e.target)&&t&&(r.setPointerDir(e.clientX>u?"right":"left"),u=e.clientX)},get"data-orientation"(){return n.orientation()}};return Ut(Zt,{get when(){return r.contentPresent()},get children(){return Ut(Zt,{get when(){return void 0===i||null!=r.parentMenuContext()},get fallback(){return Ut(rge,Ht({as:"div"},(()=>r.dataset()),m,c))},get children(){return Ut(xye.Positioner,{get children(){return Ut(Tye,Ht({get disableOutsidePointerEvents(){return ct((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return bme({"--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 Abe(e){let t;const n=mbe(),r=dbe(),[o,i]=qt(e,["ref"]);return lbe({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),Ut(Cbe,Ht({ref(e){const n=ome((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var Rbe=bt();function Obe(e){const t=Kme({id:mbe().generateId(`group-${Wt()}`)},e),[n,r]=it(),o={generateId:_me((()=>t.id)),registerLabelId:ege(r)};return Ut(Rbe.Provider,{value:o,get children(){return Ut(rge,Ht({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function Nbe(e){const t=function(){const e=wt(Rbe);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=Kme({id:t.generateId("label")},e),[r,o]=qt(n,["id"]);return lt((()=>ht(t.registerLabelId(r.id)))),Ut(rge,Ht({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function Pbe(e){const t=dbe();return Ut(rge,Ht({as:"span","aria-hidden":"true"},(()=>t.dataset()),Kme({children:"▼"},e)))}function kbe(e){return Ut(gbe,Ht({role:"menuitem",closeOnSelect:!0},e))}function Lbe(e){const t=fbe(),n=Kme({id:t.generateId("description")},e),[r,o]=qt(n,["id"]);return lt((()=>ht(t.registerDescription(r.id)))),Ut(rge,Ht({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function Dbe(e){const t=fbe(),n=Kme({id:t.generateId("indicator")},e),[r,o]=qt(n,["forceMount"]);return Ut(Zt,{get when(){return r.forceMount||t.isChecked()},get children(){return Ut(rge,Ht({as:"div"},(()=>t.dataset()),o))}})}function Mbe(e){const t=fbe(),n=Kme({id:t.generateId("label")},e),[r,o]=qt(n,["ref","id"]);return lt((()=>ht(t.registerLabel(r.id)))),Ut(rge,Ht({as:"div",ref(e){const n=ome(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function jbe(e){const t=dbe();return Ut(Zt,{get when(){return t.contentPresent()},get children(){return Ut(On,e)}})}var Ibe=bt();function Fbe(e){const t=Kme({id:mbe().generateId(`radiogroup-${Wt()}`)},e),[n,r]=qt(t,["value","defaultValue","onChange","disabled"]),[o,i]=dge({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return Ut(Ibe.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return Ut(Obe,r)}})}function Ube(e){const t=function(){const e=wt(Ibe);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=Kme({closeOnSelect:!1},e),[r,o]=qt(n,["value","onSelect"]);return Ut(gbe,Ht({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function $be(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 Vbe(e){const t=mbe(),n=gge(),r=ube(),o=bbe(),i=Tbe(),a=Kme({placement:"horizontal"===t.orientation()?"bottom-start":"right-start"},e),[s,l]=qt(a,["open","defaultOpen","onOpenChange"]);let c=0,u=null,d="right";const[p,f]=it(),[h,m]=it(),[g,v]=it(),[y,b]=it(),[w,x]=it(!0),[_,S]=it(l.placement),[E,T]=it([]),[C,A]=it([]),{DomCollectionProvider:R}=wge({items:C,onItemsChange:A}),O=Cye({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:N}=qge({show:()=>t.forceMount()||O.isOpen(),element:()=>y()??null}),P=function(e){const t=Fge(e),n=Sge({dataSource:()=>dhe(e.dataSource),getKey:()=>dhe(e.getKey),getTextValue:()=>dhe(e.getTextValue),getDisabled:()=>dhe(e.getDisabled),getSectionChildren:()=>dhe(e.getSectionChildren),factory:t=>new Bge(e.filter?e.filter(t):t)},[()=>e.filter]),r=new Vge(n,t);return at((()=>{const e=t.focusedKey();null==e||n().getItem(e)||t.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>r}}({selectionMode:"none",dataSource:C}),k=e=>{x(e),O.open()},L=(e=!1)=>{O.close(),e&&r&&r.close(!0)},D=()=>{const e=y();e&&(Dme(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},M=()=>{null!=i?setTimeout((()=>D())):D()},j=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};Yye({isDisabled:()=>!(null==r&&O.isOpen()&&t.isModal()),targets:()=>[y(),...E()].filter(Boolean)}),lt((()=>{const e=y();if(!e||!r)return;const t=r.registerNestedMenu(e);ht((()=>{t()}))})),lt((()=>{void 0===r&&o?.registerMenu(t.value(),[y(),...E()])})),lt((()=>{void 0===r&&void 0!==o&&(o.value()===t.value()?(g()?.focus(),o.autoFocusMenu()&&k(!0)):L())})),lt((()=>{void 0===r&&void 0!==o&&O.isOpen()&&o.setValue(t.value())})),ht((()=>{void 0===r&&o?.unregisterMenu(t.value())}));const I={dataset:ct((()=>({"data-expanded":O.isOpen()?"":void 0,"data-closed":O.isOpen()?void 0:""}))),isOpen:O.isOpen,contentPresent:N,nestedMenus:E,currentPlacement:_,pointerGraceTimeoutId:()=>c,autoFocus:w,listState:()=>P,parentMenuContext:()=>r,triggerRef:g,contentRef:y,triggerId:p,contentId:h,setTriggerRef:v,setContentRef:b,open:k,close:L,toggle:e=>{x(e),O.toggle()},focusContent:M,onItemEnter:e=>{j(e)&&e.preventDefault()},onItemLeave:e=>{j(e)||M()},onTriggerLeave:e=>{j(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=>wme(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:ege(f),registerContentId:ege(m)};return Ut(R,{get children(){return Ut(cbe.Provider,{value:I,get children(){return Ut(Zt,{when:void 0===i,get fallback(){return l.children},get children(){return Ut(xye,Ht({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function Bbe(e){const{direction:t}=kge();return Ut(Vbe,Ht({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var zbe=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function Hbe(e){const t=dbe(),n=mbe(),[r,o]=qt(e,["onFocusOutside","onKeyDown"]),{direction:i}=kge();return Ut(Cbe,Ht({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;Sme(t.triggerRef(),n)||t.close()},onKeyDown:e=>{Pme(e,r.onKeyDown);const o=Sme(e.currentTarget,e.target),a=zbe(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),Dme(t.triggerRef()))}},o))}var qbe=["Enter"," "],Gbe=(e,t)=>"ltr"===e?[...qbe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...qbe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function Kbe(e){let t;const n=mbe(),r=dbe(),o=Kme({id:n.generateId(`sub-trigger-${Wt()}`)},e),[i,a]=qt(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}=kge(),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=$ge({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{Pme(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{Pme(e,i.onKeyDown),e.repeat||i.disabled||Gbe(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 lt((()=>{if(null==r.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");ht(r.registerItemToParentDomCollection({ref:()=>t,type:"item",key:u(),textValue:i.textValue??t?.textContent??"",disabled:i.disabled??!1}))})),lt(pt((()=>r.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{ht((()=>{window.clearTimeout(e),r.parentMenuContext()?.setPointerGraceIntent(null)}))}))),lt((()=>ht(r.registerTriggerId(i.id)))),ht((()=>{l()})),Ut(rge,Ht({as:"div",ref(e){const n=ome((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 ct((()=>!!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 kme([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return kme([i.onPointerUp,p.onPointerUp])},get onClick(){return kme([f,p.onClick])},get onKeyDown(){return kme([h,p.onKeyDown])},get onMouseDown(){return kme([i.onMouseDown,p.onMouseDown])},get onFocus(){return kme([i.onFocus,p.onFocus])},onPointerMove:e=>{if(Pme(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)),Dme(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if(Pme(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:$be(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 Wbe(e){const t=bbe(),n=Kme({id:`menu-${Wt()}`,modal:!0},e),[r,o]=qt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Cye({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:_me((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return Ut(hbe.Provider,{value:a,get children(){return Ut(Vbe,Ht({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function Ybe(e){let t;const n=Kme({orientation:"horizontal"},e),[r,o]=qt(n,["ref","orientation"]),i=tge((()=>t),(()=>"hr"));return Ut(rge,Ht({as:"hr",ref(e){const n=ome((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))}hge({},{Root:()=>Ybe,Separator:()=>Xbe});var Xbe=Ybe,Qbe={};function Zbe(e){const t=mbe(),n=dbe(),[r,o]=qt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return Ut(Abe,Ht({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||Dme(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function Jbe(e){return Ut(Wbe,Kme({id:`dropdownmenu-${Wt()}`},e))}hge(Qbe,{Arrow:()=>vye,CheckboxItem:()=>vbe,Content:()=>Zbe,DropdownMenu:()=>ewe,Group:()=>Obe,GroupLabel:()=>Nbe,Icon:()=>Pbe,Item:()=>kbe,ItemDescription:()=>Lbe,ItemIndicator:()=>Dbe,ItemLabel:()=>Mbe,Portal:()=>jbe,RadioGroup:()=>Fbe,RadioItem:()=>Ube,Root:()=>Jbe,Separator:()=>Ybe,Sub:()=>Bbe,SubContent:()=>Hbe,SubTrigger:()=>Kbe,Trigger:()=>Sbe});var ewe=Object.assign(Jbe,{Arrow:vye,CheckboxItem:vbe,Content:Zbe,Group:Obe,GroupLabel:Nbe,Icon:Pbe,Item:kbe,ItemDescription:Lbe,ItemIndicator:Dbe,ItemLabel:Mbe,Portal:jbe,RadioGroup:Fbe,RadioItem:Ube,Separator:Ybe,Sub:Bbe,SubContent:Hbe,SubTrigger:Kbe,Trigger:Sbe}),twe={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"}},nwe=dn('<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>'),rwe=dn('<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>'),owe=dn('<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>'),iwe=dn('<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>'),awe=dn('<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>'),swe=dn('<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>'),lwe=dn('<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>'),cwe=dn('<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>'),uwe=dn('<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=dn('<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">'),pwe=dn('<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=dn('<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>'),hwe=dn('<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>'),mwe=dn('<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>'),gwe=dn('<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>'),vwe=dn('<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>'),ywe=dn('<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>'),bwe=dn('<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>'),wwe=dn('<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>'),xwe=dn('<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>'),_we=dn('<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>'),Swe=dn('<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>'),Ewe=dn('<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 Twe(){return nwe()}function Cwe(){return rwe()}function Awe(){return owe()}function Rwe(){return iwe()}function Owe(){return awe()}function Nwe(){return(e=awe()).style.setProperty("transform","rotate(90deg)"),e;var e}function Pwe(){return(e=awe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function kwe(){return swe()}function Lwe(){return lwe()}function Dwe(){return cwe()}function Mwe(){return uwe()}function jwe(){return dwe()}function Iwe(){return pwe()}function Fwe(){return fwe()}function Uwe(){return hwe()}function $we(){return mwe()}function Vwe(e){return t=gwe(),n=t.firstChild,st((()=>fn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function Bwe(){return vwe()}function zwe(){return ywe()}function Hwe(e){return[Ut(Zt,{get when(){return e.checked},get children(){var t=gwe(),n=t.firstChild;return st((()=>fn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}}),Ut(Zt,{get when(){return!e.checked},get children(){var t=bwe(),n=t.firstChild;return st((()=>fn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function qwe(){return wwe()}function Gwe(){return xwe()}function Kwe(){return _we()}function Wwe(){return Swe()}function Ywe(){const e=Wt();return t=Ewe(),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,w=(b=(y=g.nextSibling).nextSibling).firstChild,_=(x=b.nextSibling).firstChild,T=(E=(S=x.nextSibling).nextSibling).firstChild,A=(C=E.nextSibling).firstChild,N=(O=(R=C.nextSibling).nextSibling).firstChild,k=(P=O.nextSibling).firstChild,M=(D=(L=P.nextSibling).nextSibling).firstChild,I=(j=D.nextSibling).firstChild,$=(U=(F=j.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Z=(Q=(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,Me=(De=(Le=(ke=(Pe=(Ne=(Oe=(Re=(Ae=(Ce=(Te=(Ee=(Se=(_e=(xe=(we=(be=(ye=(ve=me.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,fn(n,"id",`a-${e}`),fn(r,"fill",`url(#a-${e})`),fn(i,"id",`am-${e}`),fn(a,"id",`b-${e}`),fn(s,"filter",`url(#am-${e})`),fn(l,"mask",`url(#b-${e})`),fn(u,"id",`ah-${e}`),fn(d,"id",`k-${e}`),fn(p,"filter",`url(#ah-${e})`),fn(f,"mask",`url(#k-${e})`),fn(m,"id",`ae-${e}`),fn(g,"id",`j-${e}`),fn(v,"filter",`url(#ae-${e})`),fn(y,"mask",`url(#j-${e})`),fn(w,"id",`ai-${e}`),fn(x,"id",`i-${e}`),fn(_,"filter",`url(#ai-${e})`),fn(S,"mask",`url(#i-${e})`),fn(T,"id",`aj-${e}`),fn(C,"id",`h-${e}`),fn(A,"filter",`url(#aj-${e})`),fn(R,"mask",`url(#h-${e})`),fn(N,"id",`ag-${e}`),fn(P,"id",`g-${e}`),fn(k,"filter",`url(#ag-${e})`),fn(L,"mask",`url(#g-${e})`),fn(M,"id",`af-${e}`),fn(j,"id",`f-${e}`),fn(I,"filter",`url(#af-${e})`),fn(F,"mask",`url(#f-${e})`),fn(U,"id",`m-${e}`),fn($,"fill",`url(#m-${e})`),fn(B,"id",`ak-${e}`),fn(z,"id",`e-${e}`),fn(H,"filter",`url(#ak-${e})`),fn(q,"mask",`url(#e-${e})`),fn(G,"id",`n-${e}`),fn(K,"fill",`url(#n-${e})`),fn(W,"id",`r-${e}`),fn(Y,"fill",`url(#r-${e})`),fn(X,"id",`s-${e}`),fn(Q,"fill",`url(#s-${e})`),fn(Z,"id",`q-${e}`),fn(J,"fill",`url(#q-${e})`),fn(ee,"id",`p-${e}`),fn(te,"fill",`url(#p-${e})`),fn(ne,"id",`o-${e}`),fn(re,"fill",`url(#o-${e})`),fn(oe,"id",`l-${e}`),fn(ie,"fill",`url(#l-${e})`),fn(se,"id",`al-${e}`),fn(le,"id",`d-${e}`),fn(ce,"filter",`url(#al-${e})`),fn(ue,"mask",`url(#d-${e})`),fn(de,"id",`u-${e}`),fn(pe,"fill",`url(#u-${e})`),fn(he,"id",`ad-${e}`),fn(me,"id",`c-${e}`),fn(ge,"filter",`url(#ad-${e})`),fn(ve,"mask",`url(#c-${e})`),fn(ye,"id",`t-${e}`),fn(be,"fill",`url(#t-${e})`),fn(we,"id",`v-${e}`),fn(xe,"stroke",`url(#v-${e})`),fn(_e,"id",`aa-${e}`),fn(Se,"stroke",`url(#aa-${e})`),fn(Ee,"id",`w-${e}`),fn(Te,"stroke",`url(#w-${e})`),fn(Ce,"id",`ac-${e}`),fn(Ae,"stroke",`url(#ac-${e})`),fn(Re,"id",`ab-${e}`),fn(Oe,"stroke",`url(#ab-${e})`),fn(Ne,"id",`y-${e}`),fn(Pe,"stroke",`url(#y-${e})`),fn(ke,"id",`x-${e}`),fn(Le,"stroke",`url(#x-${e})`),fn(De,"id",`z-${e}`),fn(Me,"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,w,x,_,S,E,T,C,A,R,O,N,P,k,L,D,M,j,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Q,Z,J,ee,te,ne,re,oe,ie,ae,se,le,ce,ue,de,pe,fe,he,me,ge,ve,ye,be,we,xe,_e,Se,Ee,Te,Ce,Ae,Re,Oe,Ne,Pe,ke,Le,De,Me}var Xwe=dn('<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>'),Qwe=dn('<button title="Copy object to clipboard">'),Zwe=dn('<button title="Remove all items"aria-label="Remove all items">'),Jwe=dn('<button title="Delete item"aria-label="Delete item">'),exe=dn('<button title="Toggle value"aria-label="Toggle value">'),txe=dn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),nxe=dn("<div>"),rxe=dn("<div><button> <span></span> <span> "),oxe=dn("<input>"),ixe=dn("<span>"),axe=dn("<div><span>:"),sxe=dn("<div><div><button> [<!>...<!>]");var lxe=e=>{const t=Ohe(),n=Ehe().shadowDOMTarget?eme.bind({target:Ehe().shadowDOMTarget}):eme,r=ct((()=>"dark"===t()?vxe(n):gxe(n)));return o=Xwe(),st((()=>hn(o,nme(r().expander,n`
94
94
  transform: rotate(${e.expanded?90:0}deg);
95
95
  `,e.expanded&&n`
96
96
  & svg {