@embedreach/components 0.2.22 → 0.2.24

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
@@ -82,7 +82,7 @@ function eJ(e,t){return e?function(e){return"function"==typeof e&&(()=>{const t=
82
82
  * LICENSE.md file in the root directory of this source tree.
83
83
  *
84
84
  * @license MIT
85
- */(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);i+="; Expires="+n.expires.toUTCString()}n.httpOnly&&(i+="; HttpOnly");n.secure&&(i+="; Secure");n.partitioned&&(i+="; Partitioned");if(n.priority){switch("string"==typeof n.priority?n.priority.toLowerCase():void 0){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}}if(n.sameSite){switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}}return i};const d5=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,p5=/^[\u0021-\u003A\u003C-\u007E]*$/,f5=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,h5=/^[\u0020-\u003A\u003D-\u007E]*$/,m5=Object.prototype.toString,g5=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function v5(e,t,n){do{const n=e.charCodeAt(t);if(32!==n&&9!==n)return t}while(++t<n);return n}function y5(e,t,n){for(;t>n;){const n=e.charCodeAt(--t);if(32!==n&&9!==n)return t+1}return n}function b5(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(ITe){return e}}function x5(e={}){let t,{initialEntries:n=["/"],initialIndex:r,v5Compat:o=!1}=e;t=n.map(((e,t)=>u(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let i=l(null==r?t.length-1:r),a="POP",s=null;function l(e){return Math.min(Math.max(e,0),t.length-1)}function c(){return t[i]}function u(e,n=null,r){let o=function(e,t,n=null,r){let o={pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?T5(t):t,state:n,key:t&&t.key||r||S5()};return o}(t?c().pathname:"/",e,n,r);return _5("/"===o.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),o}function d(e){return"string"==typeof e?e:E5(e)}return{get index(){return i},get action(){return a},get location(){return c()},createHref:d,createURL:e=>new URL(d(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?T5(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,n){a="PUSH";let r=u(e,n);i+=1,t.splice(i,t.length,r),o&&s&&s({action:a,location:r,delta:1})},replace(e,n){a="REPLACE";let r=u(e,n);t[i]=r,o&&s&&s({action:a,location:r,delta:0})},go(e){a="POP";let n=l(i+e);i=n,s&&s({action:a,location:t[n],delta:e})},listen:e=>(s=e,()=>{s=null})}}function w5(e,t){if(!1===e||null==e)throw new Error(t)}function _5(e,t){if(!e)try{throw new Error(t)}catch(ITe){}}function S5(){return Math.random().toString(36).substring(2,10)}function E5({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function T5(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function C5(e,t,n="/"){return function(e,t,n,r){let o="string"==typeof t?T5(t):t,i=$5(o.pathname||"/",n);if(null==i)return null;let a=A5(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(a);let s=null;for(let l=0;null==s&&l<a.length;++l){let e=U5(i);s=I5(a[l],e,r)}return s}(e,t,n,!1)}function A5(e,t=[],n=[],r=""){let o=(e,o,i)=>{let a={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};a.relativePath.startsWith("/")&&(w5(a.relativePath.startsWith(r),`Absolute route path "${a.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),a.relativePath=a.relativePath.slice(r.length));let s=H5([r,a.relativePath]),l=n.concat(a);e.children&&e.children.length>0&&(w5(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${s}".`),A5(e.children,t,l,s)),(null!=e.path||e.index)&&t.push({path:s,score:D5(s,e.index),routesMeta:l})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of N5(e.path))o(e,t,n);else o(e,t)})),t}function N5(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(0===r.length)return o?[i,""]:[i];let a=N5(r.join("/")),s=[];return s.push(...a.map((e=>""===e?i:[i,e].join("/")))),o&&s.push(...a),s.map((t=>e.startsWith("/")&&""===t?"/":t))}var R5=/^:[\w-]+$/,O5=3,P5=2,k5=1,j5=10,M5=-2,L5=e=>"*"===e;function D5(e,t){let n=e.split("/"),r=n.length;return n.some(L5)&&(r+=M5),t&&(r+=P5),n.filter((e=>!L5(e))).reduce(((e,t)=>e+(R5.test(t)?O5:""===t?k5:j5)),r)}function I5(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let s=0;s<r.length;++s){let e=r[s],l=s===r.length-1,c="/"===i?t:t.slice(i.length)||"/",u=F5({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},c),d=e.route;if(!u&&l&&n&&!r[r.length-1].route.index&&(u=F5({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!u)return null;Object.assign(o,u.params),a.push({params:o,pathname:H5([i,u.pathname]),pathnameBase:q5(H5([i,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(i=H5([i,u.pathnameBase]))}return a}function F5(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t=!1,n=!0){_5("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");let i=new RegExp(o,t?void 0:"i");return[i,r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],a=i.replace(/(.)\/+$/,"$1"),s=o.slice(1);return{params:r.reduce(((e,{paramName:t,isOptional:n},r)=>{if("*"===t){a=i.slice(0,i.length-(s[r]||"").length).replace(/(.)\/+$/,"$1")}const o=s[r];return e[t]=n&&!o?void 0:(o||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:a,pattern:e}}function U5(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return _5(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $5(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function V5(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function B5(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,n)=>n===t.length-1?e.pathname:e.pathnameBase))}function z5(e,t,n,r=!1){let o;"string"==typeof e?o=T5(e):(o={...e},w5(!o.pathname||!o.pathname.includes("?"),V5("?","pathname","search",o)),w5(!o.pathname||!o.pathname.includes("#"),V5("#","pathname","hash",o)),w5(!o.search||!o.search.includes("#"),V5("#","search","hash",o)));let i,a=""===e||""===o.pathname,s=a?"/":o.pathname;if(null==s)i=n;else{let e=t.length-1;if(!r&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?t[e]:"/"}let l=function(e,t="/"){let{pathname:n,search:r="",hash:o=""}="string"==typeof e?T5(e):e,i=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:i,search:G5(r),hash:K5(o)}}(o,i),c=s&&"/"!==s&&s.endsWith("/"),u=(a||"."===s)&&n.endsWith("/");return l.pathname.endsWith("/")||!c&&!u||(l.pathname+="/"),l}var H5=e=>e.join("/").replace(/\/\/+/g,"/"),q5=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),G5=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",K5=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var W5=["POST","PUT","PATCH","DELETE"];new Set(W5);var Y5=["GET",...W5];new Set(Y5);var X5=i.createContext(null);X5.displayName="DataRouter";var Z5=i.createContext(null);Z5.displayName="DataRouterState";var Q5=i.createContext({isTransitioning:!1});Q5.displayName="ViewTransition",i.createContext(new Map).displayName="Fetchers",i.createContext(null).displayName="Await";var J5=i.createContext(null);J5.displayName="Navigation";var e4=i.createContext(null);e4.displayName="Location";var t4=i.createContext({outlet:null,matches:[],isDataRoute:!1});t4.displayName="Route";var n4=i.createContext(null);function r4(){return null!=i.useContext(e4)}function o4(){return w5(r4(),"useLocation() may be used only in the context of a <Router> component."),i.useContext(e4).location}n4.displayName="RouteError";var i4="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function a4(e){i.useContext(J5).static||i.useLayoutEffect(e)}function s4(){let{isDataRoute:e}=i.useContext(t4);return e?function(){let{router:e}=function(e){let t=i.useContext(X5);return w5(t,h4(e)),t}("useNavigate"),t=m4("useNavigate"),n=i.useRef(!1);return a4((()=>{n.current=!0})),i.useCallback((async(r,o={})=>{_5(n.current,i4),n.current&&("number"==typeof r?e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))}),[e,t])}():function(){w5(r4(),"useNavigate() may be used only in the context of a <Router> component.");let e=i.useContext(X5),{basename:t,navigator:n}=i.useContext(J5),{matches:r}=i.useContext(t4),{pathname:o}=o4(),a=JSON.stringify(B5(r)),s=i.useRef(!1);return a4((()=>{s.current=!0})),i.useCallback(((r,i={})=>{if(_5(s.current,i4),!s.current)return;if("number"==typeof r)return void n.go(r);let l=z5(r,JSON.parse(a),o,"path"===i.relative);null==e&&"/"!==t&&(l.pathname="/"===l.pathname?t:H5([t,l.pathname])),(i.replace?n.replace:n.push)(l,i.state,i)}),[t,n,a,o,e])}()}function l4(e,{relative:t}={}){let{matches:n}=i.useContext(t4),{pathname:r}=o4(),o=JSON.stringify(B5(n));return i.useMemo((()=>z5(e,JSON.parse(o),r,"path"===t)),[e,o,r,t])}function c4(e,t,n,r){w5(r4(),"useRoutes() may be used only in the context of a <Router> component.");let o,{navigator:a,static:s}=i.useContext(J5),{matches:l}=i.useContext(t4),c=l[l.length-1],u=c?c.params:{},d=c?c.pathname:"/",p=c?c.pathnameBase:"/",f=c&&c.route;{let e=f&&f.path||"";v4(d,!f||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}o=o4();let h=o.pathname||"/",m=h;if("/"!==p){let e=p.replace(/^\//,"").split("/");m="/"+h.replace(/^\//,"").split("/").slice(e.length).join("/")}let g=!s&&n&&n.matches&&n.matches.length>0?n.matches:C5(e,{pathname:m});_5(f||null!=g,`No routes matched location "${o.pathname}${o.search}${o.hash}" `),_5(null==g||void 0!==g[g.length-1].route.element||void 0!==g[g.length-1].route.Component||void 0!==g[g.length-1].route.lazy,`Matched leaf route at location "${o.pathname}${o.search}${o.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=function(e,t=[],n=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==t.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let r=e,o=n?.errors;if(null!=o){let e=r.findIndex((e=>e.route.id&&void 0!==o?.[e.route.id]));w5(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,e+1))}let a=!1,s=-1;if(n)for(let i=0;i<r.length;i++){let e=r[i];if((e.route.HydrateFallback||e.route.hydrateFallbackElement)&&(s=i),e.route.id){let{loaderData:t,errors:o}=n,i=e.route.loader&&!t.hasOwnProperty(e.route.id)&&(!o||void 0===o[e.route.id]);if(e.route.lazy||i){a=!0,r=s>=0?r.slice(0,s+1):[r[0]];break}}}return r.reduceRight(((e,l,c)=>{let u,d=!1,p=null,f=null;n&&(u=o&&l.route.id?o[l.route.id]:void 0,p=l.route.errorElement||d4,a&&(s<0&&0===c?(v4("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,f=null):s===c&&(d=!0,f=l.route.hydrateFallbackElement||null)));let h=t.concat(r.slice(0,c+1)),m=()=>{let t;return t=u?p:d?f:l.route.Component?i.createElement(l.route.Component,null):l.route.element?l.route.element:e,i.createElement(f4,{match:l,routeContext:{outlet:e,matches:h,isDataRoute:null!=n},children:t})};return n&&(l.route.ErrorBoundary||l.route.errorElement||0===c)?i.createElement(p4,{location:n.location,revalidation:n.revalidation,component:p,error:u,children:m(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):m()}),null)}(g&&g.map((e=>Object.assign({},e,{params:Object.assign({},u,e.params),pathname:H5([p,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:H5([p,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,n,r);return v}function u4(){let e=function(){let e=i.useContext(n4),t=function(e){let t=i.useContext(Z5);return w5(t,h4(e)),t}("useRouteError"),n=m4("useRouteError");if(void 0!==e)return e;return t.errors?.[n]}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},s=null;return s=i.createElement(i.Fragment,null,i.createElement("p",null,"💿 Hey developer 👋"),i.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",i.createElement("code",{style:a},"ErrorBoundary")," or"," ",i.createElement("code",{style:a},"errorElement")," prop on your route.")),i.createElement(i.Fragment,null,i.createElement("h2",null,"Unexpected Application Error!"),i.createElement("h3",{style:{fontStyle:"italic"}},t),n?i.createElement("pre",{style:o},n):null,s)}i.createContext(null);var d4=i.createElement(u4,null),p4=class extends i.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){}render(){return void 0!==this.state.error?i.createElement(t4.Provider,{value:this.props.routeContext},i.createElement(n4.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function f4({routeContext:e,match:t,children:n}){let r=i.useContext(X5);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),i.createElement(t4.Provider,{value:e},n)}function h4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function m4(e){let t=function(e){let t=i.useContext(t4);return w5(t,h4(e)),t}(e),n=t.matches[t.matches.length-1];return w5(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}var g4={};function v4(e,t,n){t||g4[e]||(g4[e]=!0,_5(!1,n))}function y4({basename:e,children:t,initialEntries:n,initialIndex:r}){let o=i.useRef();null==o.current&&(o.current=x5({initialEntries:n,initialIndex:r,v5Compat:!0}));let a=o.current,[s,l]=i.useState({action:a.action,location:a.location}),c=i.useCallback((e=>{i.startTransition((()=>l(e)))}),[l]);return i.useLayoutEffect((()=>a.listen(c)),[a,c]),i.createElement(b4,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}function b4({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1}){w5(!r4(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=i.useMemo((()=>({basename:s,navigator:o,static:a,future:{}})),[s,o,a]);"string"==typeof n&&(n=T5(n));let{pathname:c="/",search:u="",hash:d="",state:p=null,key:f="default"}=n,h=i.useMemo((()=>{let e=$5(c,s);return null==e?null:{location:{pathname:e,search:u,hash:d,state:p,key:f},navigationType:r}}),[s,c,u,d,p,f,r]);return _5(null!=h,`<Router basename="${s}"> is not able to match the URL "${c}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),null==h?null:i.createElement(J5.Provider,{value:l},i.createElement(e4.Provider,{children:t,value:h}))}i.memo((function({routes:e,future:t,state:n}){return c4(e,0,n,t)}));var x4="get",w4="application/x-www-form-urlencoded";function _4(e){return null!=e&&"string"==typeof e.tagName}function S4(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}var E4=null;var T4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function C4(e){return null==e||T4.has(e)?e:(_5(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${w4}"`),null)}function A4(e,t){let n,r,o,i,a;if(function(e){return _4(e)&&"form"===e.tagName.toLowerCase()}(e)){let a=e.getAttribute("action");r=a?$5(a,t):null,n=e.getAttribute("method")||x4,o=C4(e.getAttribute("enctype"))||w4,i=new FormData(e)}else if(function(e){return _4(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return _4(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let a=e.form;if(null==a)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||a.getAttribute("action");if(r=s?$5(s,t):null,n=e.getAttribute("formmethod")||a.getAttribute("method")||x4,o=C4(e.getAttribute("formenctype"))||C4(a.getAttribute("enctype"))||w4,i=new FormData(a,e),!function(){if(null===E4)try{new FormData(document.createElement("form"),0),E4=!1}catch(ITe){E4=!0}return E4}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";i.append(`${e}x`,"0"),i.append(`${e}y`,"0")}else t&&i.append(t,r)}}else{if(_4(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=x4,r=null,o=w4,a=e}return i&&"text/plain"===o&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:a}}function N4(e,t){if(!1===e||null==e)throw new Error(t)}function R4(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function O4(e,t,n){return function(e,t){let n=new Set;return new Set(t),e.reduce(((e,t)=>{let r=JSON.stringify(function(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}(t));return n.has(r)||(n.add(r),e.push({key:r,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let r=t.routes[e.route.id];if(r){let e=await async function(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return window.__reactRouterContext&&window,window.location.reload(),new Promise((()=>{}))}}(r,n);return e.links?e.links():[]}return[]})))).flat(1).filter(R4).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function P4(e,t,n,r,o,i){let a=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith("*")&&n[t].params["*"]!==e.params["*"];return"assets"===i?t.filter(((e,t)=>a(e,t)||s(e,t))):"data"===i?t.filter(((t,i)=>{let l=r.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(a(t,i)||s(t,i))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof r)return r}return!0})):[]}function k4(e,t,{includeHydrateFallback:n}={}){return r=e.map((e=>{let r=t.routes[e.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o})).flat(1),[...new Set(r)];var r}function j4(){let e=i.useContext(X5);return N4(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}var M4=i.createContext(void 0);function L4(){let e=i.useContext(M4);return N4(e,"You must render this element inside a <HydratedRouter> element"),e}function D4(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function I4({page:e,...t}){let{router:n}=j4(),r=i.useMemo((()=>C5(n.routes,e,n.basename)),[n.routes,e,n.basename]);return r?i.createElement(F4,{page:e,matches:r,...t}):null}function F4({page:e,matches:t,...n}){let r=o4(),{manifest:o,routeModules:a}=L4(),{basename:s}=j4(),{loaderData:l,matches:c}=function(){let e=i.useContext(Z5);return N4(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}(),u=i.useMemo((()=>P4(e,t,c,o,r,"data")),[e,t,c,o,r]),d=i.useMemo((()=>P4(e,t,c,o,r,"assets")),[e,t,c,o,r]),p=i.useMemo((()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,i=!1;if(t.forEach((e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!u.some((t=>t.route.id===e.route.id))&&e.route.id in l&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?i=!0:n.add(e.route.id))})),0===n.size)return[];let c=function(e,t){let n="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return n.pathname="/"===n.pathname?"_root.data":t&&"/"===$5(n.pathname,t)?`${t.replace(/\/$/,"")}/_root.data`:`${n.pathname.replace(/\/$/,"")}.data`,n}(e,s);return i&&n.size>0&&c.searchParams.set("_routes",t.filter((e=>n.has(e.route.id))).map((e=>e.route.id)).join(",")),[c.pathname+c.search]}),[s,l,r,o,u,t,e,a]),f=i.useMemo((()=>k4(d,o)),[d,o]),h=function(e){let{manifest:t,routeModules:n}=L4(),[r,o]=i.useState([]);return i.useEffect((()=>{let r=!1;return O4(e,t,n).then((e=>{r||o(e)})),()=>{r=!0}}),[e,t,n]),r}(d);return i.createElement(i.Fragment,null,p.map((e=>i.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),f.map((e=>i.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),h.map((({key:e,link:t})=>i.createElement("link",{key:e,...t}))))}function U4(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}M4.displayName="FrameworkContext";var $4="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{$4&&(window.__reactRouterVersion="7.5.2")}catch(ITe){}var V4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,B4=i.forwardRef((function({onClick:e,discover:t="render",prefetch:n="none",relative:r,reloadDocument:o,replace:a,state:s,target:l,to:c,preventScrollReset:u,viewTransition:d,...p},f){let h,{basename:m}=i.useContext(J5),g="string"==typeof c&&V4.test(c),v=!1;if("string"==typeof c&&g&&(h=c,$4))try{let e=new URL(window.location.href),t=c.startsWith("//")?new URL(e.protocol+c):new URL(c),n=$5(t.pathname,m);t.origin===e.origin&&null!=n?c=n+t.search+t.hash:v=!0}catch(ITe){_5(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let y=function(e,{relative:t}={}){w5(r4(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=i.useContext(J5),{hash:o,pathname:a,search:s}=l4(e,{relative:t}),l=a;return"/"!==n&&(l="/"===a?n:H5([n,a])),r.createHref({pathname:l,search:s,hash:o})}(c,{relative:r}),[b,x,w]=function(e,t){let n=i.useContext(M4),[r,o]=i.useState(!1),[a,s]=i.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,f=i.useRef(null);i.useEffect((()=>{if("render"===e&&s(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}}),[e]),i.useEffect((()=>{if(r){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[r]);let h=()=>{o(!0)},m=()=>{o(!1),s(!1)};return n?"intent"!==e?[a,f,{}]:[a,f,{onFocus:D4(l,h),onBlur:D4(c,m),onMouseEnter:D4(u,h),onMouseLeave:D4(d,m),onTouchStart:D4(p,h)}]:[!1,f,{}]}(n,p),_=function(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:a,viewTransition:s}={}){let l=s4(),c=o4(),u=l4(e,{relative:a});return i.useCallback((i=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(i,t)){i.preventDefault();let t=void 0!==n?n:E5(c)===E5(u);l(e,{replace:t,state:r,preventScrollReset:o,relative:a,viewTransition:s})}}),[c,l,u,n,r,t,e,o,a,s])}(c,{replace:a,state:s,target:l,preventScrollReset:u,relative:r,viewTransition:d});let S=i.createElement("a",{...p,...w,href:h||y,onClick:v||o?e:function(t){e&&e(t),t.defaultPrevented||_(t)},ref:U4(f,x),target:l,"data-discover":g||"render"!==t?void 0:"true"});return b&&!g?i.createElement(i.Fragment,null,S,i.createElement(I4,{page:y})):S}));function z4(e){let t=i.useContext(X5);return w5(t,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(e)),t}function H4(e){_5("undefined"!=typeof URLSearchParams,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=i.useRef(S4(e)),n=i.useRef(!1),r=o4(),o=i.useMemo((()=>function(e,t){let n=S4(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(r.search,n.current?null:t.current)),[r.search]),a=s4(),s=i.useCallback(((e,t)=>{const r=S4("function"==typeof e?e(o):e);n.current=!0,a("?"+r,t)}),[a,o]);return[o,s]}B4.displayName="Link",i.forwardRef((function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:r=!1,style:o,to:a,viewTransition:s,children:l,...c},u){let d=l4(a,{relative:c.relative}),p=o4(),f=i.useContext(Z5),{navigator:h,basename:m}=i.useContext(J5),g=null!=f&&function(e,t={}){let n=i.useContext(Q5);w5(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=z4("useViewTransitionState"),o=l4(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=$5(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=$5(n.nextLocation.pathname,r)||n.nextLocation.pathname;return null!=F5(o.pathname,s)||null!=F5(o.pathname,a)}(d)&&!0===s,v=h.encodeLocation?h.encodeLocation(d).pathname:d.pathname,y=p.pathname,b=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(y=y.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&m&&(b=$5(b,m)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let w,_=y===v||!r&&y.startsWith(v)&&"/"===y.charAt(x),S=null!=b&&(b===v||!r&&b.startsWith(v)&&"/"===b.charAt(v.length)),E={isActive:_,isPending:S,isTransitioning:g},T=_?e:void 0;w="function"==typeof n?n(E):[n,_?"active":null,S?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let C="function"==typeof o?o(E):o;return i.createElement(B4,{...c,"aria-current":T,className:w,ref:u,style:C,to:a,viewTransition:s},"function"==typeof l?l(E):l)})).displayName="NavLink",i.forwardRef((({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:s=x4,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:p,...f},h)=>{let m=function(){let{router:e}=z4("useSubmit"),{basename:t}=i.useContext(J5),n=m4("useRouteId");return i.useCallback((async(r,o={})=>{let{action:i,method:a,encType:s,formData:l,body:c}=A4(r,t);if(!1===o.navigate){let t=o.fetcherKey||G4();await e.fetch(t,n,o.action||i,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||a,formEncType:o.encType||s,flushSync:o.flushSync})}else await e.navigate(o.action||i,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||a,formEncType:o.encType||s,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})}),[e,t,n])}(),g=function(e,{relative:t}={}){let{basename:n}=i.useContext(J5),r=i.useContext(t4);w5(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...l4(e||".",{relative:t})},s=o4();if(null==e){a.search=s.search;let e=new URLSearchParams(a.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();a.search=n?`?${n}`:""}}e&&"."!==e||!o.route.index||(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(a.pathname="/"===a.pathname?n:H5([n,a.pathname]));return E5(a)}(l,{relative:u}),v="get"===s.toLowerCase()?"get":"post",y="string"==typeof l&&V4.test(l);return i.createElement("form",{ref:h,method:v,action:g,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,i=r?.getAttribute("formmethod")||s;m(r||e.currentTarget,{fetcherKey:t,method:i,navigate:n,replace:o,state:a,relative:u,preventScrollReset:d,viewTransition:p})},...f,"data-discover":y||"render"!==e?void 0:"true"})})).displayName="Form";var q4=0,G4=()=>`__${String(++q4)}__`;new TextEncoder;var K4,W4="dismissableLayer.update",Y4="dismissableLayer.pointerDownOutside",X4="dismissableLayer.focusOutside",Z4=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Q4=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(Z4),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=NZ(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=oJ(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){e6(Y4,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=oJ(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){e6(X4,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 gJ((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(K4=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),J4(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=K4)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),J4())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(W4,e),()=>document.removeEventListener(W4,e)}),[]),t.jsx(dJ.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:tJ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:tJ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:tJ(e.onPointerDownCapture,S.onPointerDownCapture)})}));Q4.displayName="DismissableLayer";function J4(){const e=new CustomEvent(W4);document.dispatchEvent(e)}function e6(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?pJ(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(Z4),o=i.useRef(null),a=NZ(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(dJ.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var t6=i.forwardRef(((e,n)=>t.jsx(dJ.span,{...e,ref:n,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}})));t6.displayName="VisuallyHidden";var n6=t6,[r6,o6]=nJ("Tooltip",[x1]),i6=x1(),a6="TooltipProvider",s6=700,l6="tooltip.open",[c6,u6]=r6(a6),d6=e=>{const{__scopeTooltip:n,delayDuration:r=s6,skipDelayDuration:o=300,disableHoverableContent:a=!1,children:s}=e,[l,c]=i.useState(!0),u=i.useRef(!1),d=i.useRef(0);return i.useEffect((()=>{const e=d.current;return()=>window.clearTimeout(e)}),[]),t.jsx(c6,{scope:n,isOpenDelayed:l,delayDuration:r,onOpen:i.useCallback((()=>{window.clearTimeout(d.current),c(!1)}),[]),onClose:i.useCallback((()=>{window.clearTimeout(d.current),d.current=window.setTimeout((()=>c(!0)),o)}),[o]),isPointerInTransitRef:u,onPointerInTransitChange:i.useCallback((e=>{u.current=e}),[]),disableHoverableContent:a,children:s})};d6.displayName=a6;var p6="Tooltip",[f6,h6]=r6(p6),m6=e=>{const{__scopeTooltip:n,children:r,open:o,defaultOpen:a=!1,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=e,u=u6(p6,e.__scopeTooltip),d=i6(n),[p,f]=i.useState(null),h=$J(),m=i.useRef(0),g=l??u.disableHoverableContent,v=c??u.delayDuration,y=i.useRef(!1),[b=!1,x]=iJ({prop:o,defaultProp:a,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(l6))):u.onClose(),s?.(e)}}),w=i.useMemo((()=>b?y.current?"delayed-open":"instant-open":"closed"),[b]),_=i.useCallback((()=>{window.clearTimeout(m.current),m.current=0,y.current=!1,x(!0)}),[x]),S=i.useCallback((()=>{window.clearTimeout(m.current),m.current=0,x(!1)}),[x]),E=i.useCallback((()=>{window.clearTimeout(m.current),m.current=window.setTimeout((()=>{y.current=!0,x(!0),m.current=0}),v)}),[v,x]);return i.useEffect((()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)}),[]),t.jsx(D1,{...d,children:t.jsx(f6,{scope:n,contentId:h,open:b,stateAttribute:w,trigger:p,onTriggerChange:f,onTriggerEnter:i.useCallback((()=>{u.isOpenDelayed?E():_()}),[u.isOpenDelayed,E,_]),onTriggerLeave:i.useCallback((()=>{g?S():(window.clearTimeout(m.current),m.current=0)}),[S,g]),onOpen:_,onClose:S,disableHoverableContent:g,children:r})})};m6.displayName=p6;var g6="TooltipTrigger",v6=i.forwardRef(((e,n)=>{const{__scopeTooltip:r,...o}=e,a=h6(g6,r),s=u6(g6,r),l=i6(r),c=NZ(n,i.useRef(null),a.onTriggerChange),u=i.useRef(!1),d=i.useRef(!1),p=i.useCallback((()=>u.current=!1),[]);return i.useEffect((()=>()=>document.removeEventListener("pointerup",p)),[p]),t.jsx(I1,{asChild:!0,...l,children:t.jsx(dJ.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...o,ref:c,onPointerMove:tJ(e.onPointerMove,(e=>{"touch"!==e.pointerType&&(d.current||s.isPointerInTransitRef.current||(a.onTriggerEnter(),d.current=!0))})),onPointerLeave:tJ(e.onPointerLeave,(()=>{a.onTriggerLeave(),d.current=!1})),onPointerDown:tJ(e.onPointerDown,(()=>{u.current=!0,document.addEventListener("pointerup",p,{once:!0})})),onFocus:tJ(e.onFocus,(()=>{u.current||a.onOpen()})),onBlur:tJ(e.onBlur,a.onClose),onClick:tJ(e.onClick,a.onClose)})})}));v6.displayName=g6;var y6="TooltipPortal",[b6,x6]=r6(y6,{forceMount:void 0}),w6=e=>{const{__scopeTooltip:n,forceMount:r,children:o,container:i}=e,a=h6(y6,n);return t.jsx(b6,{scope:n,forceMount:r,children:t.jsx(V1,{present:r||a.open,children:t.jsx($1,{asChild:!0,container:i,children:o})})})};w6.displayName=y6;var _6="TooltipContent",S6=i.forwardRef(((e,n)=>{const r=x6(_6,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...a}=e,s=h6(_6,e.__scopeTooltip);return t.jsx(V1,{present:o||s.open,children:t.jsx(s.disableHoverableContent?A6:E6,{side:i,...a,ref:n})})})),E6=i.forwardRef(((e,n)=>{const r=h6(_6,e.__scopeTooltip),o=u6(_6,e.__scopeTooltip),a=i.useRef(null),s=NZ(n,a),[l,c]=i.useState(null),{trigger:u,onClose:d}=r,p=a.current,{onPointerInTransitChange:f}=o,h=i.useCallback((()=>{c(null),f(!1)}),[f]),m=i.useCallback(((e,t)=>{const n={x:e.clientX,y:e.clientY},r=function(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(n,function(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}(n,e.currentTarget.getBoundingClientRect())),o=function(e){const t=e.slice();return t.sort(((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0)),function(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const n=e[r];for(;t.length>=2;){const e=t[t.length-1],r=t[t.length-2];if(!((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x)))break;t.pop()}t.push(n)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const t=e[r];for(;n.length>=2;){const e=n[n.length-1],r=n[n.length-2];if(!((e.x-r.x)*(t.y-r.y)>=(e.y-r.y)*(t.x-r.x)))break;n.pop()}n.push(t)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...r,...function(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}(t.getBoundingClientRect())]);c(o),f(!0)}),[f]);return i.useEffect((()=>()=>h()),[h]),i.useEffect((()=>{if(u&&p){const e=e=>m(e,p),t=e=>m(e,u);return u.addEventListener("pointerleave",e),p.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),p.removeEventListener("pointerleave",t)}}}),[u,p,m,h]),i.useEffect((()=>{if(l){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},r=u?.contains(t)||p?.contains(t),o=!function(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const e=t[i].x,s=t[i].y,l=t[a].y;s>r!=l>r&&n<(t[a].x-e)*(r-s)/(l-s)+e&&(o=!o)}return o}(n,l);r?h():o&&(h(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[u,p,l,d,h]),t.jsx(A6,{...e,ref:s})})),[T6,C6]=r6(p6,{isInside:!1}),A6=i.forwardRef(((e,n)=>{const{__scopeTooltip:r,children:o,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=e,u=h6(_6,r),d=i6(r),{onClose:p}=u;return i.useEffect((()=>(document.addEventListener(l6,p),()=>document.removeEventListener(l6,p))),[p]),i.useEffect((()=>{if(u.trigger){const e=e=>{const t=e.target;t?.contains(u.trigger)&&p()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[u.trigger,p]),t.jsx(Q4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:t.jsxs(F1,{"data-state":u.stateAttribute,...d,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[t.jsx(lJ,{children:o}),t.jsx(T6,{scope:r,isInside:!0,children:t.jsx(n6,{id:u.contentId,role:"tooltip",children:a||o})})]})})}));S6.displayName=_6;var N6="TooltipArrow";i.forwardRef(((e,n)=>{const{__scopeTooltip:r,...o}=e,i=i6(r);return C6(N6,r).isInside?null:t.jsx(U1,{...i,...o,ref:n})})).displayName=N6;var R6=w6,O6=S6;const P6=d6,k6=m6,j6=v6,M6=i.forwardRef((({className:e,sideOffset:n=4,...r},o)=>t.jsx(R6,{children:t.jsx(O6,{ref:o,sideOffset:n,className:rp("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...r})})));M6.displayName=O6.displayName;const L6=({rowOriginal:e,constructNavigationUrl:n,cellText:r,cellIcon:o=null,tooltipIcon:i=null,tooltipText:a=null})=>{const s=s4();return a?t.jsx(P6,{children:t.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:t.jsxs(k6,{children:[t.jsx(j6,{asChild:!0,children:t.jsxs(MZ,{variant:"outline",onClick:()=>s(n(e.id)),children:[o,r,i]})}),t.jsx(M6,{className:"max-w-[300px] text-sm bg-white border border-gray-200 rounded-lg p-4",children:t.jsx("p",{className:"text-muted-foreground",children:a})})]})})}):t.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:t.jsxs(MZ,{variant:"outline",onClick:()=>s(n(e.id)),children:[o,r,i]})})};function D6(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function I6(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function F6(...e){return t=>{let n=!1;const r=e.map((e=>{const r=I6(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():I6(e[t],null)}}}}function U6(...e){return i.useCallback(F6(...e),e)}function $6(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}\``)}]},V6(o,...n)]}function V6(...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 B6(e){const n=z6(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(q6);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 z6(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)=>{const t=i(...e);return o(...e),t}: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?F6(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 H6=Symbol("radix.slottable");function q6(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===H6}var G6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=B6(`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 K6(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}var W6,Y6="dismissableLayer.update",X6="dismissableLayer.pointerDownOutside",Z6="dismissableLayer.focusOutside",Q6=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),J6=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(Q6),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=U6(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=K6(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){t8(X6,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=K6(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){t8(Z6,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=K6(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=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(W6=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),e8(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=W6)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),e8())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(Y6,e),()=>document.removeEventListener(Y6,e)}),[]),t.jsx(G6.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:D6(e.onFocusCapture,E.onFocusCapture),onBlurCapture:D6(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:D6(e.onPointerDownCapture,S.onPointerDownCapture)})}));J6.displayName="DismissableLayer";function e8(){const e=new CustomEvent(Y6);document.dispatchEvent(e)}function t8(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(Q6),o=i.useRef(null),a=U6(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(G6.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var n8=0;function r8(){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 o8="focusScope.autoFocusOnMount",i8="focusScope.autoFocusOnUnmount",a8={bubbles:!1,cancelable:!0},s8=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=K6(a),p=K6(s),f=i.useRef(null),h=U6(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:d8(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||d8(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&d8(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){p8.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(o8,a8);c.addEventListener(o8,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(d8(r,{select:t}),document.activeElement!==n)return}((e=l8(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&d8(c))}return()=>{c.removeEventListener(o8,d),setTimeout((()=>{const e=new CustomEvent(i8,a8);c.addEventListener(i8,p),c.dispatchEvent(e),e.defaultPrevented||d8(t??document.body,{select:!0}),c.removeEventListener(i8,p),p8.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=l8(e),n=c8(t,e),r=c8(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&d8(i,{select:!0})):(e.preventDefault(),r&&d8(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(G6.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function l8(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 c8(e,t){for(const n of e)if(!u8(n,{upTo:t}))return n}function u8(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 d8(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()}}s8.displayName="FocusScope";var p8=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=f8(e,t),e.unshift(t)},remove(t){e=f8(e,t),e[0]?.resume()}}}();function f8(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var h8=globalThis?.document?i.useLayoutEffect:()=>{},m8=i[" useId ".trim().toString()]||(()=>{}),g8=0;function v8(e){const[t,n]=i.useState(m8());return h8((()=>{n((e=>e??String(g8++)))}),[e]),e||(t?`radix-${t}`:"")}var y8=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(G6.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"})})}));y8.displayName="Arrow";var b8=y8;var x8="Popper",[w8,_8]=$6(x8),[S8,E8]=w8(x8),T8=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(S8,{scope:n,anchor:o,onAnchorChange:a,children:r})};T8.displayName=x8;var C8="PopperAnchor",A8=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=E8(C8,r),l=i.useRef(null),c=U6(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(G6.div,{...a,ref:c})}));A8.displayName=C8;var N8="PopperContent",[R8,O8]=w8(N8),P8=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=E8(N8,r),[b,x]=i.useState(null),w=U6(n,(e=>x(e))),[_,S]=i.useState(null),E=function(e){const[t,n]=i.useState(void 0);return h8((()=>{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:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},R=Array.isArray(d)?d:[d],O=R.length>0,P={padding:N,boundary:R.filter(L8),altBoundary:O},{refs:k,floatingStyles:j,placement:M,isPositioned:L,middlewareData:D}=a1({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>G0(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[l1({mainAxis:a+C,alignmentAxis:l}),u&&c1({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?u1():void 0,...P}),u&&d1({...P}),p1({...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`)}}),_&&h1({element:_,padding:c}),D8({arrowWidth:T,arrowHeight:C}),h&&f1({strategy:"referenceHidden",...P})]}),[I,F]=I8(M),U=K6(g);h8((()=>{L&&U?.()}),[L,U]);const $=D.arrow?.x,V=D.arrow?.y,B=0!==D.arrow?.centerOffset,[z,H]=i.useState();return h8((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:L?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(R8,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(G6.div,{"data-side":I,"data-align":F,...v,ref:w,style:{...v.style,animation:L?void 0:"none"}})})})}));P8.displayName=N8;var k8="PopperArrow",j8={top:"bottom",right:"left",bottom:"top",left:"right"},M8=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=O8(k8,r),a=j8[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(b8,{...o,ref:n,style:{...o.style,display:"block"}})})}));function L8(e){return null!==e}M8.displayName=k8;var D8=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]=I8(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 I8(e){const[t,n="center"]=e.split("-");return[t,n]}var F8=T8,U8=A8,$8=P8,V8=M8,B8=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);h8((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(G6.div,{...a,ref:n}),c):null}));B8.displayName="Portal";var z8=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=H8(r.current);a.current="mounted"===l?e:"none"}),[l]),h8((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=H8(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]),h8((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=H8(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=H8(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=U6(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 H8(e){return e?.animationName||"none"}z8.displayName="Presence";var q8=i[" useInsertionEffect ".trim().toString()]||h8;function G8({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 q8((()=>{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 K8="Popover",[W8,Y8]=$6(K8,[_8]),X8=_8(),[Z8,Q8]=W8(K8),J8=e=>{const{__scopePopover:n,children:r,open:o,defaultOpen:a,onOpenChange:s,modal:l=!1}=e,c=X8(n),u=i.useRef(null),[d,p]=i.useState(!1),[f,h]=G8({prop:o,defaultProp:a??!1,onChange:s,caller:K8});return t.jsx(F8,{...c,children:t.jsx(Z8,{scope:n,contentId:v8(),triggerRef:u,open:f,onOpenChange:h,onOpenToggle:i.useCallback((()=>h((e=>!e))),[h]),hasCustomAnchor:d,onCustomAnchorAdd:i.useCallback((()=>p(!0)),[]),onCustomAnchorRemove:i.useCallback((()=>p(!1)),[]),modal:l,children:r})})};J8.displayName=K8;var e9="PopoverAnchor";i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,a=Q8(e9,r),s=X8(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=a;return i.useEffect((()=>(l(),()=>c())),[l,c]),t.jsx(U8,{...s,...o,ref:n})})).displayName=e9;var t9="PopoverTrigger",n9=i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=Q8(t9,r),a=X8(r),s=U6(n,i.triggerRef),l=t.jsx(G6.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":h9(i.open),...o,ref:s,onClick:D6(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:t.jsx(U8,{asChild:!0,...a,children:l})}));n9.displayName=t9;var r9="PopoverPortal",[o9,i9]=W8(r9,{forceMount:void 0}),a9=e=>{const{__scopePopover:n,forceMount:r,children:o,container:i}=e,a=Q8(r9,n);return t.jsx(o9,{scope:n,forceMount:r,children:t.jsx(z8,{present:r||a.open,children:t.jsx(B8,{asChild:!0,container:i,children:o})})})};a9.displayName=r9;var s9="PopoverContent",l9=i.forwardRef(((e,n)=>{const r=i9(s9,e.__scopePopover),{forceMount:o=r.forceMount,...i}=e,a=Q8(s9,e.__scopePopover);return t.jsx(z8,{present:o||a.open,children:t.jsx(a.modal?u9:d9,{...i,ref:n})})}));l9.displayName=s9;var c9=B6("PopoverContent.RemoveScroll"),u9=i.forwardRef(((e,n)=>{const r=Q8(s9,e.__scopePopover),o=i.useRef(null),a=U6(n,o),s=i.useRef(!1);return i.useEffect((()=>{const e=o.current;if(e)return HV(e)}),[]),t.jsx(IV,{as:c9,allowPinchZoom:!0,children:t.jsx(p9,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:D6(e.onCloseAutoFocus,(e=>{e.preventDefault(),s.current||r.triggerRef.current?.focus()})),onPointerDownOutside:D6(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent;s.current=2===t.button||0===t.button&&!0===t.ctrlKey}),{checkForDefaultPrevented:!1}),onFocusOutside:D6(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})})})})),d9=i.forwardRef(((e,n)=>{const r=Q8(s9,e.__scopePopover),o=i.useRef(!1),a=i.useRef(!1);return t.jsx(p9,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||r.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));const n=t.target,i=r.triggerRef.current?.contains(n);i&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})})),p9=i.forwardRef(((e,n)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:p,...f}=e,h=Q8(s9,r),m=X8(r);return i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??r8()),document.body.insertAdjacentElement("beforeend",e[1]??r8()),n8++,()=>{1===n8&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),n8--}}),[]),t.jsx(s8,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:s,children:t.jsx(J6,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:p,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>h.onOpenChange(!1),children:t.jsx($8,{"data-state":h9(h.open),role:"dialog",id:h.contentId,...m,...f,ref:n,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})})),f9="PopoverClose";i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=Q8(f9,r);return t.jsx(G6.button,{type:"button",...o,ref:n,onClick:D6(e.onClick,(()=>i.onOpenChange(!1)))})})).displayName=f9;function h9(e){return e?"open":"closed"}i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=X8(r);return t.jsx(V8,{...i,...o,ref:n})})).displayName="PopoverArrow";var m9=a9,g9=l9;const v9=J8,y9=n9,b9=n.forwardRef((({className:e,align:n="center",sideOffset:r=4,...o},i)=>t.jsx(m9,{children:t.jsx(g9,{ref:i,align:n,sideOffset:r,className:rp("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...o})})));b9.displayName=g9.displayName;const x9={[ze.DRAFT]:"Draft",[ze.ACTIVE]:"Active",[ze.RUNNING]:"Running",[ze.COMPLETED]:"Completed",[ze.FAILED]:"Failed",[ze.DEACTIVATED]:"Deactivated"},w9={[ze.DRAFT]:"bg-gray-500",[ze.ACTIVE]:"bg-blue-500",[ze.RUNNING]:"bg-yellow-500",[ze.COMPLETED]:"bg-green-500",[ze.FAILED]:"bg-red-500",[ze.DEACTIVATED]:"bg-red-500"},_9={[ze.DRAFT]:"bg-gray-100 text-gray-700 px-2 py-1",[ze.ACTIVE]:"bg-blue-100 text-blue-700 px-2 py-1",[ze.RUNNING]:"bg-yellow-100 text-yellow-700 px-2 py-1",[ze.COMPLETED]:"bg-green-100 text-green-700 px-2 py-1",[ze.FAILED]:"bg-red-100 text-red-700 px-2 py-1",[ze.DEACTIVATED]:"bg-red-100 text-red-700 px-2 py-1"},S9={[ze.DRAFT]:`Draft ${bf("engage:automation")?.toLowerCase()} can be activated or deactivated`,[ze.ACTIVE]:`Active ${bf("engage:automation")?.toLowerCase()} can be drafted, deactivated, run, or marked as failed`,[ze.RUNNING]:`Running ${bf("engage:automation")?.toLowerCase()} can be completed or marked as failed`,[ze.COMPLETED]:`Completed ${bf("engage:automation")?.toLowerCase()} can only be marked as failed`,[ze.FAILED]:`Failed ${bf("engage:automation")?.toLowerCase()} requires manual intervention to change state`,[ze.DEACTIVATED]:`Deactivated ${bf("engage:automation")?.toLowerCase()} cannot be reactivated - create a new one instead`},E9={[ze.DRAFT]:[ze.ACTIVE,ze.DEACTIVATED],[ze.ACTIVE]:[ze.DRAFT],[ze.RUNNING]:[],[ze.COMPLETED]:[],[ze.FAILED]:[],[ze.DEACTIVATED]:[]},T9=({rowOriginal:e,id:r,onToggle:o,className:i="",vsaasManaged:a=!1})=>{const[s,l]=n.useState(!1),c=e.status,u=(E9[c]||[]).filter((e=>!1===a||e!==ze.DEACTIVATED)),d=u.length>0;return t.jsx("div",{className:`${i}`,onClick:e=>e.stopPropagation(),children:t.jsx(P6,{children:t.jsxs(v9,{open:!!d&&s,onOpenChange:l,children:[t.jsx(y9,{asChild:!0,children:t.jsx("div",{className:"relative",children:t.jsxs(MZ,{variant:"outline",className:`flex items-center justify-between px-4 py-2 rounded-md w-full ${_9[c]} ${d?"":"cursor-not-allowed opacity-80"}`,onClick:e=>{e.stopPropagation(),d&&l(!s)},children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${w9[c]}`}),t.jsx("span",{children:x9[c]})]}),d?t.jsx(gu,{className:"h-4 w-4 ml-2"}):t.jsxs(k6,{children:[t.jsx(j6,{asChild:!0,children:t.jsx(ku,{className:"h-4 w-4 ml-2 text-gray-500"})}),t.jsx(M6,{className:"max-w-xs p-2",children:t.jsx("p",{children:S9[c]})})]})]})})}),d&&t.jsx(b9,{className:"w-full p-2",align:"center",sideOffset:5,children:t.jsx("div",{className:"py-1 flex flex-col gap-2 justify-start items-center",onClick:e=>e.stopPropagation(),children:u.map((e=>t.jsxs(MZ,{variant:"ghost",className:"flex justify-start items-center px-4 py-2 text-sm w-full text-left hover:bg-gray-100 rounded-none "+(c===e?"font-medium":""),onClick:()=>(o(r,e),void l(!1)),children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${w9[e]} mr-2`}),x9[e]]},e)))})})]})})})};function C9(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function A9(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const N9=6048e5,R9=43200;let O9={};function P9(){return O9}function k9(e,t){const n=P9(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=C9(e),i=o.getDay(),a=(i<r?7:0)+i-r;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function j9(e){return k9(e,{weekStartsOn:1})}function M9(e){const t=C9(e),n=t.getFullYear(),r=A9(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const o=j9(r),i=A9(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const a=j9(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function L9(e){const t=C9(e);return t.setHours(0,0,0,0),t}function D9(e){const t=C9(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function I9(e,t){return function(e,t){return A9(e,+C9(e)+t)}(e,6e4*t)}function F9(e,t){const n=C9(e),r=C9(t),o=n.getTime()-r.getTime();return o<0?-1:o>0?1:o}function U9(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=C9(e);return!isNaN(Number(n))}function $9(e){const t=C9(e);return+function(e){const t=C9(e);return t.setHours(23,59,59,999),t}(t)==+function(e){const t=C9(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}(t)}function V9(e,t){const n=C9(e),r=C9(t),o=F9(n,r),i=Math.abs(function(e,t){const n=C9(e),r=C9(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}(n,r));let a;if(i<1)a=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-o*i);let t=F9(n,r)===-o;$9(C9(e))&&1===i&&1===F9(e,r)&&(t=!1),a=o*(i-Number(t))}return 0===a?0:a}function B9(e,t,n){const r=function(e,t){return+C9(e)-+C9(t)}(e,t)/1e3;return(o=n?.roundingMethod,e=>{const t=(o?Math[o]:Math.trunc)(e);return 0===t?0:t})(r);var o}const z9={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 H9(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const q9={date:H9({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:H9({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:H9({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},G9={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function K9(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,o=n?.width?String(n.width):t;r=e.formattingValues[o]||e.formattingValues[t]}else{const t=e.defaultWidth,o=n?.width?String(n.width):e.defaultWidth;r=e.values[o]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function W9(e){return(t,n={})=>{const r=n.width,o=t.match(r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth]);if(!o)return null;const i=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(a)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(a,(e=>e.test(i))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(a,(e=>e.test(i)));let l;l=e.valueCallback?e.valueCallback(s):s,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(i.length)}}}var Y9;const X9={code:"en-US",formatDistance:(e,t,n)=>{let r;const o=z9[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:q9,formatRelative:(e,t,n,r)=>G9[e],localize:{ordinalNumber:(e,t)=>{const 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:K9({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:K9({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:K9({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:K9({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:K9({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"})},match:{ordinalNumber:(Y9={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(Y9.matchPattern);if(!n)return null;const r=n[0],o=e.match(Y9.parsePattern);if(!o)return null;let i=Y9.valueCallback?Y9.valueCallback(o[0]):o[0];return i=t.valueCallback?t.valueCallback(i):i,{value:i,rest:e.slice(r.length)}}),era:W9({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:W9({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:e=>e+1}),month:W9({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:W9({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:W9({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"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Z9(e){const t=C9(e),n=function(e,t){const n=L9(e),r=L9(t),o=+n-D9(n),i=+r-D9(r);return Math.round((o-i)/864e5)}(t,function(e){const t=C9(e),n=A9(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function Q9(e){const t=C9(e),n=+j9(t)-+function(e){const t=M9(e),n=A9(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),j9(n)}(t);return Math.round(n/N9)+1}function J9(e,t){const n=C9(e),r=n.getFullYear(),o=P9(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=A9(e,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const s=k9(a,t),l=A9(e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const c=k9(l,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function e7(e,t){const n=C9(e),r=+k9(n,t)-+function(e,t){const n=P9(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=J9(e,t),i=A9(e,0);return i.setFullYear(o,0,r),i.setHours(0,0,0,0),k9(i,t)}(n,t);return Math.round(r/N9)+1}function t7(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const n7={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return t7("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):t7(n+1,2)},d:(e,t)=>t7(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>t7(e.getHours()%12||12,t.length),H:(e,t)=>t7(e.getHours(),t.length),m:(e,t)=>t7(e.getMinutes(),t.length),s:(e,t)=>t7(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return t7(Math.trunc(r*Math.pow(10,n-3)),t.length)}},r7="midnight",o7="noon",i7="morning",a7="afternoon",s7="evening",l7="night",c7={G:function(e,t,n){const r=e.getFullYear()>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){const t=e.getFullYear();return n.ordinalNumber(t>0?t:1-t,{unit:"year"})}return n7.y(e,t)},Y:function(e,t,n,r){const o=J9(e,r),i=o>0?o:1-o;if("YY"===t){return t7(i%100,2)}return"Yo"===t?n.ordinalNumber(i,{unit:"year"}):t7(i,t.length)},R:function(e,t){return t7(M9(e),t.length)},u:function(e,t){return t7(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return t7(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){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return t7(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){const r=e.getMonth();switch(t){case"M":case"MM":return n7.M(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){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return t7(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){const o=e7(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):t7(o,t.length)},I:function(e,t,n){const r=Q9(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):t7(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):n7.d(e,t)},D:function(e,t,n){const r=Z9(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):t7(r,t.length)},E:function(e,t,n){const r=e.getDay();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){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return t7(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){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return t7(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){const r=e.getDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return t7(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){const r=e.getHours()/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){const r=e.getHours();let o;switch(o=12===r?o7:0===r?r7:r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(o=r>=17?s7:r>=12?a7:r>=4?i7:l7,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return n7.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):n7.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):t7(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):t7(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):n7.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):n7.s(e,t)},S:function(e,t){return n7.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return d7(r);case"XXXX":case"XX":return p7(r);default:return p7(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return d7(r);case"xxxx":case"xx":return p7(r);default:return p7(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+u7(r,":");default:return"GMT"+p7(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+u7(r,":");default:return"GMT"+p7(r,":")}},t:function(e,t,n){return t7(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return t7(e.getTime(),t.length)}};function u7(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),i=r%60;return 0===i?n+String(o):n+String(o)+t+t7(i,2)}function d7(e,t){if(e%60==0){return(e>0?"-":"+")+t7(Math.abs(e)/60,2)}return p7(e,t)}function p7(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+t7(Math.trunc(r/60),2)+t+t7(r%60,2)}const f7=(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"})}},h7=(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"})}},m7={p:h7,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return f7(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;default:i=t.dateTime({width:"full"})}return i.replace("{{date}}",f7(r,t)).replace("{{time}}",h7(o,t))}},g7=/^D+$/,v7=/^Y+$/,y7=["D","DD","YY","YYYY"];const b7=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x7=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,w7=/^'([^]*?)'?$/,_7=/''/g,S7=/[a-zA-Z]/;function E7(e,t,n){const r=P9(),o=r.locale??X9,i=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=C9(e);if(!U9(s))throw new RangeError("Invalid time value");let l=t.match(x7).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,m7[t])(e,o.formatLong)}return e})).join("").match(b7).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:T7(e)};if(c7[t])return{isToken:!0,value:e};if(t.match(S7))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));o.localize.preprocessor&&(l=o.localize.preprocessor(s,l));const c={firstWeekContainsDate:i,weekStartsOn:a,locale:o};return l.map((n=>{if(!n.isToken)return n.value;const r=n.value;(function(e){return v7.test(e)}(r)||function(e){return g7.test(e)}(r))&&function(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(y7.includes(e))throw new RangeError(r)}(r,t,String(e));return(0,c7[r[0]])(s,r,o.localize,c)})).join("")}function T7(e){const t=e.match(w7);return t?t[1].replace(_7,"'"):e}function C7(e,t){return function(e,t,n){const r=P9(),o=n?.locale??r.locale??X9,i=F9(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:i});let s,l;i>0?(s=C9(t),l=C9(e)):(s=C9(e),l=C9(t));const c=B9(l,s),u=(D9(l)-D9(s))/1e3,d=Math.round((c-u)/60);let p;if(d<2)return n?.includeSeconds?c<5?o.formatDistance("lessThanXSeconds",5,a):c<10?o.formatDistance("lessThanXSeconds",10,a):c<20?o.formatDistance("lessThanXSeconds",20,a):c<40?o.formatDistance("halfAMinute",0,a):o.formatDistance(c<60?"lessThanXMinutes":"xMinutes",1,a):0===d?o.formatDistance("lessThanXMinutes",1,a):o.formatDistance("xMinutes",d,a);if(d<45)return o.formatDistance("xMinutes",d,a);if(d<90)return o.formatDistance("aboutXHours",1,a);if(d<1440){const e=Math.round(d/60);return o.formatDistance("aboutXHours",e,a)}if(d<2520)return o.formatDistance("xDays",1,a);if(d<R9){const e=Math.round(d/1440);return o.formatDistance("xDays",e,a)}if(d<86400)return p=Math.round(d/R9),o.formatDistance("aboutXMonths",p,a);if(p=V9(l,s),p<12){const e=Math.round(d/R9);return o.formatDistance("xMonths",e,a)}{const e=p%12,t=Math.trunc(p/12);return e<3?o.formatDistance("aboutXYears",t,a):e<9?o.formatDistance("overXYears",t,a):o.formatDistance("almostXYears",t+1,a)}}(e,function(e){return A9(e,Date.now())}(e),t)}function A7({accessorKey:e,header:n,meta:r,size:o,minSize:i,maxSize:a,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,cellFormatter:d}){return{accessorKey:e,header:()=>t.jsx("div",{className:`flex items-center h-8 px-3 font-medium whitespace-nowrap text-muted-foreground ${"right"===r?.align?"justify-end float-right":"center"===r?.align?"justify-center":"justify-start"} ${c||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>t.jsx("div",{className:`flex items-center h-8 ${"right"===r?.align?"justify-end":"center"===r?.align?"justify-center":"justify-start"} ${u||""} ${r?.className||""}`.trim(),children:d?d(e):e.getValue()}),size:o,minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}const N7=(e,t,n,r="Error",o="Please try again")=>{e(!1),"error"===n&&t({title:r,description:o,variant:"destructive"})},R7=e=>{switch(e){case ze.ACTIVE:return"statusActive";case ze.COMPLETED:return"statusCompleted";case ze.DRAFT:return"statusDraft";case ze.DEACTIVATED:return"statusDeactivated";case ze.FAILED:return"statusFailed";case ze.RUNNING:return"statusRunning";default:throw HX(e,ze)}},O7=e=>{switch(e){case gZ.ALL_USERS:return`Default ${bf("engage:segment").toLowerCase()} that contains all ${bf("engage:user").toLowerCase()}}. This is not editable or deletable.`;case gZ.MANAGED:return`System-defined ${bf("engage:segment").toLowerCase()} that are not editable or deletable.`;case gZ.CUSTOM:return`Custom ${bf("engage:segment").toLowerCase()} that you can edit and delete as needed.`;default:throw HX(e,gZ)}};function P7(e="name",n,r=!1){return A7({accessorKey:e,header:n,meta:{align:"left",displayName:n,className:"min-w-[240px] w-full"},cellClassName:"pl-3 pr-2",cellFormatter:e=>{const n=e.getValue(),{original:o}=e.row,i=o.status,a=o.type,s=i?i[0].toUpperCase()+i.slice(1):"",l={[ze.ACTIVE]:"bg-blue-500",[ze.COMPLETED]:"bg-green-500",[ze.DRAFT]:"bg-gray-500",[ze.DEACTIVATED]:"bg-red-500",[ze.FAILED]:"bg-red-500",[ze.RUNNING]:"bg-yellow-500"};return t.jsxs("div",{className:"w-full flex gap-6 justify-between items-center",children:[t.jsxs("div",{className:"flex gap-1 items-center w-full",children:[t.jsx("div",{className:`w-2 h-2 rounded-full mr-3 flex-shrink-0 ${a?{[gZ.ALL_USERS]:"bg-purple-500",[gZ.MANAGED]:"bg-teal-500",[gZ.CUSTOM]:"bg-amber-500"}[a]:i?l[i]:"bg-blue-500"}`}),t.jsxs("div",{className:"flex-1 flex flex-col gap-0.5",children:[t.jsx("span",{className:"leading-tight font-medium text-sm overflow-hidden text-ellipsis",children:n}),r&&o?.description&&t.jsx("div",{className:"relative h-4",children:t.jsx("div",{className:"absolute inset-0 text-muted-foreground text-xs truncate whitespace-nowrap overflow-hidden w-full",children:o?.description})})]})]}),i&&t.jsx("div",{className:"flex-shrink-0",children:t.jsx(YZ,{variant:R7(i),children:s})})]})}})}function k7(){return A7({accessorKey:"type",header:"Type",meta:{align:"right",displayName:`${bf("engage:segment")} type`},cellClassName:"pr-4",cellFormatter:e=>{const n=e.getValue(),r=n?n.split("_").map((e=>e[0].toUpperCase()+e.slice(1).toLowerCase())).join(" "):"Unknown";let o;if(!n||n!==gZ.ALL_USERS&&n!==gZ.MANAGED&&n!==gZ.CUSTOM)o="statusDraft";else try{o=(e=>{switch(e){case gZ.ALL_USERS:return"segmentAllUsers";case gZ.MANAGED:return"segmentManaged";case gZ.CUSTOM:return"segmentCustom";default:throw HX(e,gZ)}})(n)}catch(ITe){if(!(ITe instanceof HX))throw ITe;o="statusDraft"}return t.jsx(P6,{children:t.jsxs(k6,{children:[t.jsx(j6,{asChild:!0,children:t.jsx(YZ,{variant:o,className:"cursor-help",children:r})}),t.jsx(M6,{side:"top",className:"max-w-[250px] text-sm bg-white border border-gray-200 rounded-lg p-3",children:t.jsx("p",{className:"text-muted-foreground",children:n&&O7(n)||`Unknown ${bf("engage:segment").toLowerCase()} type`})})]})})}})}function j7(e="updated_at"){return function({accessorKey:e,header:n,meta:r={align:"right"},size:o=160,minSize:i,maxSize:a,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,formatType:d="relative"}){return{accessorKey:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:t.jsx("span",{children:n})}),cell:e=>{const n=e.getValue();let o="N/A";return n&&(o="relative"===d?C7(new Date(n),{addSuffix:!0}):new Date(n).toLocaleDateString()),t.jsx("div",{className:`font-variant-numeric w-full h-8 flex items-center justify-end pr-4 whitespace-nowrap ${u||""} ${r?.className||""}`.trim(),children:o})},size:o,minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}({accessorKey:e,header:"Last Modified",formatType:"relative",size:160,meta:{align:"right",displayName:"Last Modified"}})}function M7(e,n,r){return function({accessorKey:e,header:n,meta:r={align:"right"},size:o,minSize:i,maxSize:a=120,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,prefix:d="",suffix:p="",localeStringOptions:f}){return{accessorKey:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>{const n=e.getValue()??0;return t.jsxs("div",{className:`font-variant-numeric h-8 flex items-center justify-end pr-4 ${u||""} ${r?.className||""}`.trim(),children:[d,n.toLocaleString(void 0,f),p]})},size:o||(r?.className?.includes("w-")?void 0:100),minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}({accessorKey:e,header:n,prefix:r,meta:{align:"right",displayName:n}})}function L7(e){const{setUrl:n,onToggle:r,automationName:o,vsaasManaged:i}=e;return A7({accessorKey:"status",header:"Status",enableHiding:!1,size:180,maxSize:200,meta:{align:"right"},cellClassName:"pr-4",cellFormatter:e=>{const{original:a}=e.row;return(a.status??null)===ze.DRAFT&&n&&!1===i?t.jsx(L6,{rowOriginal:a,constructNavigationUrl:()=>n(a.id),cellText:"Action Required",tooltipIcon:t.jsx(ku,{className:"h-4 w-4 text-muted-foreground !cursor-help z-99"}),tooltipText:`Your ${o?.toLowerCase()} is currently in draft mode. Please review and activate it to begin sending messages.`}):t.jsx(T9,{className:"flex items-center justify-end",rowOriginal:a,id:a.id,onToggle:r||(()=>{}),vsaasManaged:i})}})}function D7(e){const n={align:"right",displayName:`Update ${bf("engage:segment").toLowerCase()}`};return function({id:e="actions",header:n,meta:r={align:"center"},text:o,size:i=80,minSize:a=80,maxSize:s=80,enableSorting:l=!1,enableHiding:c=!1,headerClassName:u,icon:d,onAction:p,actionButtonVariant:f="outline",actionButtonSize:h="default"}){return{id:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${u||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>{const n=e.row.original,i=n?.type,a="custom"!==i;return t.jsx("div",{className:`flex items-center h-8 pr-3 ${"right"===r?.align?"justify-end":"center"===r?.align?"justify-center":"justify-start"} ${r?.className||""}`.trim(),children:t.jsxs(MZ,{variant:f,size:h,disabled:a,onClick:()=>p(n),children:[t.jsx(d,{className:"h-4 w-4"}),t.jsx("span",{children:o})]})})},size:i,minSize:a,maxSize:s,enableSorting:l,enableHiding:c,meta:r}}({id:"edit",header:`${bf("engage:segment")} actions`,icon:Hu,onAction:t=>{e(t.id)},text:"Edit",enableHiding:!1,size:80,meta:n})}function I7(e){const{automationName:t,setUrl:n,onToggle:r,vsaasManaged:o=!1}=e;return[P7("name","Name",!0),M7("derivedRevenue","Sales","$"),M7("emailsSent","Email Sent"),M7("smsSent","SMS Sent"),j7(),L7({setUrl:n,onToggle:r,automationName:t,vsaasManaged:o})]}const F7=({handleBack:e,handleNext:n,handleSkipAndSaveAsDraft:r,backText:o,nextText:i,backDisabled:a,nextDisabled:s,hideBack:l})=>t.jsxs("div",{className:"flex gap-4 py-2",children:[!l&&t.jsxs(MZ,{onClick:e,disabled:a,variant:"secondary",className:rp("flex items-center gap-2",a&&"opacity-50 cursor-not-allowed"),children:[t.jsx(FZ.BackButton,{}),t.jsx("span",{children:o})]}),t.jsx(MZ,{onClick:r,variant:"secondary",className:"flex items-center gap-2",children:"Skip & Save as Draft"}),t.jsxs(MZ,{onClick:n,disabled:s,className:rp("flex items-center gap-2 --reach-destructive",s&&"opacity-50 cursor-not-allowed"),children:[t.jsx("span",{children:i}),t.jsx(FZ.NextButton,{})]})]}),U7=()=>{const e=ye({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 $7=(e=>(e.REACH_MANAGED="reach-managed",e.TWILLIO="twillio",e))($7||{});const V7=()=>{const e=ye({queryKey:["channel-senders"],queryFn:()=>(async()=>{let e=[],t=null,n=!0;do{const r=t?`${u}?cursor=${encodeURIComponent(t)}`:`${u}`,o=(await Oe(r,{method:"GET"})).data;e=e.concat(o.results),n=o.pagination?.hasNextPage??!1,t=o.pagination?.cursor??null}while(n&&t);return{results:e}})()});return{channelSenders:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelSenders:e.refetch}},B7=()=>{const e=ue(),t=be({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}},z7=e=>{const{channelSenders:t,channelAccounts:n}=e;return t?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=n?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===$7.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSender:e}]:[]}))||[]},H7=e=>{const{channelSenders:t}=e;return t?.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))||[]},q7=(e,t)=>{const[r,o]=n.useState(e);return n.useEffect((()=>{const n=setTimeout((()=>{o(e)}),t);return()=>clearTimeout(n)}),[e,t]),r},G7=({title:e,alertText:r,Icon:o=ku,onClick:i,asChild:a=!0,link:s})=>{const[l,c]=n.useState(!1);return t.jsx(P6,{children:t.jsxs(k6,{open:l,onOpenChange:c,children:[t.jsx(j6,{asChild:a,onClick:e=>{e.stopPropagation(),i?(i(),c(!1)):c(!l)},children:t.jsx(o,{className:"h-3.5 w-3.5 cursor-pointer transition-colors"})}),t.jsx(M6,{className:"bg-white text-gray-900 border border-gray-200 shadow-lg text-left",children:t.jsxs("div",{className:"flex flex-col items-center justify-center w-full gap-2 max-w-[300px]",children:[r&&t.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[t.jsx(FZ.AlertTriangleIcon,{className:"text-amber-500 w-6 h-6"}),t.jsx("p",{className:"font-medium text-amber-500 text-center text-[14px]",children:r})]}),t.jsx("p",{className:"text-[13px] leading-relaxed text-black text-center",children:e}),s&&t.jsx("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"text-[13px] text-blue-500 hover:text-blue-600 hover:underline transition-colors",onClick:e=>e.stopPropagation(),children:s.text})]})})]})})};function K7(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function W7(e){const n=Y7(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(Z7);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 Y7(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?function(...e){return t=>{let n=!1;const r=e.map((e=>{const r=K7(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():K7(e[t],null)}}}}(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 X7=Symbol("radix.slottable");function Z7(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===X7}var Q7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=W7(`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}}),{}),J7=i.forwardRef(((e,n)=>t.jsx(Q7.label,{...e,ref:n,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})));J7.displayName="Label";var eee=J7;const tee=au("text-foreground text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),nee=i.forwardRef((({className:e,...n},r)=>t.jsx(eee,{ref:r,className:rp(tee(),e),...n})));function ree(e,[t,n]){return Math.min(n,Math.max(t,e))}function oee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function iee(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}\``)}]},aee(o,...n)]}function aee(...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 see(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function lee(...e){return t=>{let n=!1;const r=e.map((e=>{const r=see(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():see(e[t],null)}}}}function cee(...e){return i.useCallback(lee(...e),e)}function uee(e){const n=dee(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(fee);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 dee(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?lee(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}nee.displayName=eee.displayName;var pee=Symbol("radix.slottable");function fee(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pee}var hee=i.createContext(void 0);var mee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=uee(`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 gee(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}var vee,yee="dismissableLayer.update",bee="dismissableLayer.pointerDownOutside",xee="dismissableLayer.focusOutside",wee=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_ee=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(wee),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=cee(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=gee(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Eee(bee,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=gee(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){Eee(xee,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=gee(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=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(vee=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),See(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=vee)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),See())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(yee,e),()=>document.removeEventListener(yee,e)}),[]),t.jsx(mee.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:oee(e.onFocusCapture,E.onFocusCapture),onBlurCapture:oee(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:oee(e.onPointerDownCapture,S.onPointerDownCapture)})}));_ee.displayName="DismissableLayer";function See(){const e=new CustomEvent(yee);document.dispatchEvent(e)}function Eee(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(wee),o=i.useRef(null),a=cee(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(mee.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var Tee=0;function Cee(){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 Aee="focusScope.autoFocusOnMount",Nee="focusScope.autoFocusOnUnmount",Ree={bubbles:!1,cancelable:!0},Oee=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=gee(a),p=gee(s),f=i.useRef(null),h=cee(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:Mee(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Mee(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Mee(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){Lee.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(Aee,Ree);c.addEventListener(Aee,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Mee(r,{select:t}),document.activeElement!==n)return}((e=Pee(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Mee(c))}return()=>{c.removeEventListener(Aee,d),setTimeout((()=>{const e=new CustomEvent(Nee,Ree);c.addEventListener(Nee,p),c.dispatchEvent(e),e.defaultPrevented||Mee(t??document.body,{select:!0}),c.removeEventListener(Nee,p),Lee.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=Pee(e),n=kee(t,e),r=kee(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&Mee(i,{select:!0})):(e.preventDefault(),r&&Mee(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(mee.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function Pee(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 kee(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 Mee(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()}}Oee.displayName="FocusScope";var Lee=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Dee(e,t),e.unshift(t)},remove(t){e=Dee(e,t),e[0]?.resume()}}}();function Dee(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var Iee=globalThis?.document?i.useLayoutEffect:()=>{},Fee=i[" useId ".trim().toString()]||(()=>{}),Uee=0;function $ee(e){const[t,n]=i.useState(Fee());return Iee((()=>{n((e=>e??String(Uee++)))}),[e]),e||(t?`radix-${t}`:"")}var Vee=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(mee.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"})})}));Vee.displayName="Arrow";var Bee=Vee;var zee="Popper",[Hee,qee]=iee(zee),[Gee,Kee]=Hee(zee),Wee=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(Gee,{scope:n,anchor:o,onAnchorChange:a,children:r})};Wee.displayName=zee;var Yee="PopperAnchor",Xee=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=Kee(Yee,r),l=i.useRef(null),c=cee(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(mee.div,{...a,ref:c})}));Xee.displayName=Yee;var Zee="PopperContent",[Qee,Jee]=Hee(Zee),ete=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=Kee(Zee,r),[b,x]=i.useState(null),w=cee(n,(e=>x(e))),[_,S]=i.useState(null),E=function(e){const[t,n]=i.useState(void 0);return Iee((()=>{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:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},R=Array.isArray(d)?d:[d],O=R.length>0,P={padding:N,boundary:R.filter(ote),altBoundary:O},{refs:k,floatingStyles:j,placement:M,isPositioned:L,middlewareData:D}=a1({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>G0(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[l1({mainAxis:a+C,alignmentAxis:l}),u&&c1({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?u1():void 0,...P}),u&&d1({...P}),p1({...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`)}}),_&&h1({element:_,padding:c}),ite({arrowWidth:T,arrowHeight:C}),h&&f1({strategy:"referenceHidden",...P})]}),[I,F]=ate(M),U=gee(g);Iee((()=>{L&&U?.()}),[L,U]);const $=D.arrow?.x,V=D.arrow?.y,B=0!==D.arrow?.centerOffset,[z,H]=i.useState();return Iee((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:L?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(Qee,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(mee.div,{"data-side":I,"data-align":F,...v,ref:w,style:{...v.style,animation:L?void 0:"none"}})})})}));ete.displayName=Zee;var tte="PopperArrow",nte={top:"bottom",right:"left",bottom:"top",left:"right"},rte=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=Jee(tte,r),a=nte[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(Bee,{...o,ref:n,style:{...o.style,display:"block"}})})}));function ote(e){return null!==e}rte.displayName=tte;var ite=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]=ate(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 ate(e){const[t,n="center"]=e.split("-");return[t,n]}var ste=Wee,lte=Xee,cte=ete,ute=rte,dte=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);Iee((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(mee.div,{...a,ref:n}),c):null}));dte.displayName="Portal";var pte=i[" useInsertionEffect ".trim().toString()]||Iee;function fte({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 pte((()=>{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 hte=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(mee.span,{...e,ref:n,style:{...hte,...e.style}}))).displayName="VisuallyHidden";var mte=[" ","Enter","ArrowUp","ArrowDown"],gte=[" ","Enter"],vte="Select",[yte,bte,xte]=function(e){const r=e+"CollectionProvider",[o,i]=iee(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=uee(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=cee(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=uee(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=cee(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]}(vte),[wte,_te]=iee(vte,[xte,qee]),Ste=qee(),[Ete,Tte]=wte(vte),[Cte,Ate]=wte(vte),Nte=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=Ste(n),[y,b]=i.useState(null),[x,w]=i.useState(null),[_,S]=i.useState(!1),E=function(e){const t=i.useContext(hee);return e||t||"ltr"}(d),[T,C]=fte({prop:o,defaultProp:a??!1,onChange:s,caller:vte}),[A,N]=fte({prop:l,defaultProp:c,onChange:u,caller:vte}),R=i.useRef(null),O=!y||(g||!!y.closest("form")),[P,k]=i.useState(new Set),j=Array.from(P).map((e=>e.props.value)).join(";");return t.jsx(ste,{...v,children:t.jsxs(Ete,{required:m,scope:n,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:_,onValueNodeHasChildrenChange:S,contentId:$ee(),value:A,onValueChange:N,open:T,onOpenChange:C,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t.jsx(yte.Provider,{scope:n,children:t.jsx(Cte,{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})}),O?t.jsxs(mne,{"aria-hidden":!0,required:m,tabIndex:-1,name:p,autoComplete:f,value:A,onChange:e=>N(e.target.value),disabled:h,form:g,children:[void 0===A?t.jsx("option",{value:""}):null,Array.from(P)]},j):null]})})};Nte.displayName=vte;var Rte="SelectTrigger",Ote=i.forwardRef(((e,n)=>{const{__scopeSelect:r,disabled:o=!1,...a}=e,s=Ste(r),l=Tte(Rte,r),c=l.disabled||o,u=cee(n,l.onTriggerChange),d=bte(r),p=i.useRef("touch"),[f,h,m]=vne((e=>{const t=d().filter((e=>!e.disabled)),n=t.find((e=>e.value===l.value)),r=yne(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(lte,{asChild:!0,...s,children:t.jsx(mee.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":gne(l.value)?"":void 0,...a,ref:u,onClick:oee(a.onClick,(e=>{e.currentTarget.focus(),"mouse"!==p.current&&g(e)})),onPointerDown:oee(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:oee(a.onKeyDown,(e=>{const t=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||mte.includes(e.key)&&(g(),e.preventDefault())}))})})}));Ote.displayName=Rte;var Pte="SelectValue",kte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:i,children:a,placeholder:s="",...l}=e,c=Tte(Pte,r),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,p=cee(n,c.onValueNodeChange);return Iee((()=>{u(d)}),[u,d]),t.jsx(mee.span,{...l,ref:p,style:{pointerEvents:"none"},children:gne(c.value)?t.jsx(t.Fragment,{children:s}):a})}));kte.displayName=Pte;var jte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,children:o,...i}=e;return t.jsx(mee.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})}));jte.displayName="SelectIcon";var Mte=e=>t.jsx(dte,{asChild:!0,...e});Mte.displayName="SelectPortal";var Lte="SelectContent",Dte=i.forwardRef(((e,n)=>{const r=Tte(Lte,e.__scopeSelect),[o,s]=i.useState();if(Iee((()=>{s(new DocumentFragment)}),[]),!r.open){const n=o;return n?a.createPortal(t.jsx(Fte,{scope:e.__scopeSelect,children:t.jsx(yte.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(Vte,{...e,ref:n})}));Dte.displayName=Lte;var Ite=10,[Fte,Ute]=wte(Lte),$te=uee("SelectContent.RemoveScroll"),Vte=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,x=Tte(Lte,r),[w,_]=i.useState(null),[S,E]=i.useState(null),T=cee(n,(e=>_(e))),[C,A]=i.useState(null),[N,R]=i.useState(null),O=bte(r),[P,k]=i.useState(!1),j=i.useRef(!1);i.useEffect((()=>{if(w)return HV(w)}),[w]),i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Cee()),document.body.insertAdjacentElement("beforeend",e[1]??Cee()),Tee++,()=>{1===Tee&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),Tee--}}),[]);const M=i.useCallback((e=>{const[t,...n]=O().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}}),[O,S]),L=i.useCallback((()=>M([C,w])),[M,C,w]);i.useEffect((()=>{P&&L()}),[P,L]);const{onOpenChange:D,triggerPointerDownPosRef:I}=x;i.useEffect((()=>{if(w){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():w.contains(n.target)||D(!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})}}}),[w,D,I]),i.useEffect((()=>{const e=()=>D(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}}),[D]);const[F,U]=vne((e=>{const t=O().filter((e=>!e.disabled)),n=t.find((e=>e.ref.current===document.activeElement)),r=yne(t,e,n);r&&setTimeout((()=>r.ref.current.focus()))})),$=i.useCallback(((e,t,n)=>{const r=!j.current&&!n;(void 0!==x.value&&x.value===t||r)&&(A(e),r&&(j.current=!0))}),[x.value]),V=i.useCallback((()=>w?.focus()),[w]),B=i.useCallback(((e,t,n)=>{(void 0!==x.value&&x.value===t||!j.current&&!n)&&R(e)}),[x.value]),z="popper"===o?zte:Bte,H=z===zte?{side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t.jsx(Fte,{scope:r,content:w,viewport:S,onViewportChange:E,itemRefCallback:$,selectedItem:C,onItemLeave:V,itemTextRefCallback:B,focusSelectedItem:L,selectedItemText:N,position:o,isPositioned:P,searchRef:F,children:t.jsx(IV,{as:$te,allowPinchZoom:!0,children:t.jsx(Oee,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:oee(a,(e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()})),children:t.jsx(_ee,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:t.jsx(z,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...H,onPlaced:()=>k(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:oee(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=O().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((()=>M(t))),e.preventDefault()}}))})})})})})}));Vte.displayName="SelectContentImpl";var Bte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onPlaced:o,...a}=e,s=Tte(Lte,r),l=Ute(Lte,r),[c,u]=i.useState(null),[d,p]=i.useState(null),f=cee(n,(e=>p(e))),h=bte(r),m=i.useRef(!1),g=i.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=l,w=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-Ite,l=ree(o,[Ite,Math.max(Ite,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-Ite,u=ree(o,[Ite,Math.max(Ite,l-s)]);c.style.minWidth=a+"px",c.style.right=u+"px"}const i=h(),a=window.innerHeight-2*Ite,l=v.scrollHeight,u=window.getComputedStyle(d),p=parseInt(u.borderTopWidth,10),f=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),x=p+f+l+parseInt(u.paddingBottom,10)+g,w=Math.min(5*y.offsetHeight,x),_=window.getComputedStyle(v),S=parseInt(_.paddingTop,10),E=parseInt(_.paddingBottom,10),T=e.top+e.height/2-Ite,C=a-T,A=y.offsetHeight/2,N=p+f+(y.offsetTop+A),R=x-N;if(N<=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=N+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+R+"px",v.scrollTop=N-T+v.offsetTop}c.style.margin=`${Ite}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=a+"px",o?.(),requestAnimationFrame((()=>m.current=!0))}}),[h,s.trigger,s.valueNode,c,d,v,y,b,s.dir,o]);Iee((()=>w()),[w]);const[_,S]=i.useState();Iee((()=>{d&&S(window.getComputedStyle(d).zIndex)}),[d]);const E=i.useCallback((e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)}),[w,x]);return t.jsx(Hte,{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(mee.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})}));Bte.displayName="SelectItemAlignedPosition";var zte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=Ite,...a}=e,s=Ste(r);return t.jsx(cte,{...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)"}})}));zte.displayName="SelectPopperPosition";var[Hte,qte]=wte(Lte,{}),Gte="SelectViewport",Kte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,nonce:o,...a}=e,s=Ute(Gte,r),l=qte(Gte,r),c=cee(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(yte.Slot,{scope:r,children:t.jsx(mee.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:oee(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*Ite,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}))})})]})}));Kte.displayName=Gte;var Wte="SelectGroup",[Yte,Xte]=wte(Wte),Zte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=$ee();return t.jsx(Yte,{scope:r,id:i,children:t.jsx(mee.div,{role:"group","aria-labelledby":i,...o,ref:n})})}));Zte.displayName=Wte;var Qte="SelectLabel",Jte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Xte(Qte,r);return t.jsx(mee.div,{id:i.id,...o,ref:n})}));Jte.displayName=Qte;var ene="SelectItem",[tne,nne]=wte(ene),rne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,value:o,disabled:a=!1,textValue:s,...l}=e,c=Tte(ene,r),u=Ute(ene,r),d=c.value===o,[p,f]=i.useState(s??""),[h,m]=i.useState(!1),g=cee(n,(e=>u.itemRefCallback?.(e,o,a))),v=$ee(),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(tne,{scope:r,value:o,disabled:a,textId:v,isSelected:d,onItemTextChange:i.useCallback((e=>{f((t=>t||(e?.textContent??"").trim()))}),[]),children:t.jsx(yte.ItemSlot,{scope:r,value:o,disabled:a,textValue:p,children:t.jsx(mee.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:oee(l.onFocus,(()=>m(!0))),onBlur:oee(l.onBlur,(()=>m(!1))),onClick:oee(l.onClick,(()=>{"mouse"!==y.current&&b()})),onPointerUp:oee(l.onPointerUp,(()=>{"mouse"===y.current&&b()})),onPointerDown:oee(l.onPointerDown,(e=>{y.current=e.pointerType})),onPointerMove:oee(l.onPointerMove,(e=>{y.current=e.pointerType,a?u.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})})),onPointerLeave:oee(l.onPointerLeave,(e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()})),onKeyDown:oee(l.onKeyDown,(e=>{""!==u.searchRef?.current&&" "===e.key||(gte.includes(e.key)&&b()," "===e.key&&e.preventDefault())}))})})})}));rne.displayName=ene;var one="SelectItemText",ine=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:s,...l}=e,c=Tte(one,r),u=Ute(one,r),d=nne(one,r),p=Ate(one,r),[f,h]=i.useState(null),m=cee(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 Iee((()=>(y(v),()=>b(v))),[y,b,v]),t.jsxs(t.Fragment,{children:[t.jsx(mee.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})}));ine.displayName=one;var ane="SelectItemIndicator",sne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return nne(ane,r).isSelected?t.jsx(mee.span,{"aria-hidden":!0,...o,ref:n}):null}));sne.displayName=ane;var lne="SelectScrollUpButton",cne=i.forwardRef(((e,n)=>{const r=Ute(lne,e.__scopeSelect),o=qte(lne,e.__scopeSelect),[a,s]=i.useState(!1),l=cee(n,o.onScrollButtonChange);return Iee((()=>{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(pne,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}));cne.displayName=lne;var une="SelectScrollDownButton",dne=i.forwardRef(((e,n)=>{const r=Ute(une,e.__scopeSelect),o=qte(une,e.__scopeSelect),[a,s]=i.useState(!1),l=cee(n,o.onScrollButtonChange);return Iee((()=>{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(pne,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}));dne.displayName=une;var pne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onAutoScroll:o,...a}=e,s=Ute("SelectScrollButton",r),l=i.useRef(null),c=bte(r),u=i.useCallback((()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)}),[]);return i.useEffect((()=>()=>u()),[u]),Iee((()=>{const e=c().find((e=>e.ref.current===document.activeElement));e?.ref.current?.scrollIntoView({block:"nearest"})}),[c]),t.jsx(mee.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:oee(a.onPointerDown,(()=>{null===l.current&&(l.current=window.setInterval(o,50))})),onPointerMove:oee(a.onPointerMove,(()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(o,50))})),onPointerLeave:oee(a.onPointerLeave,(()=>{u()}))})})),fne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return t.jsx(mee.div,{"aria-hidden":!0,...o,ref:n})}));fne.displayName="SelectSeparator";var hne="SelectArrow";i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Ste(r),a=Tte(hne,r),s=Ute(hne,r);return a.open&&"popper"===s.position?t.jsx(ute,{...i,...o,ref:n}):null})).displayName=hne;var mne=i.forwardRef((({__scopeSelect:e,value:n,...r},o)=>{const a=i.useRef(null),s=cee(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(mee.select,{...r,style:{...hte,...r.style},ref:s,defaultValue:n})}));function gne(e){return""===e||void 0===e}function vne(e){const t=gee(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 yne(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}mne.displayName="SelectBubbleInput";var bne=Ote,xne=jte,wne=Mte,_ne=Dte,Sne=Kte,Ene=Jte,Tne=rne,Cne=ine,Ane=sne,Nne=cne,Rne=dne,One=fne;const Pne=Nte,kne=Zte,jne=kte,Mne=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(bne,{ref:o,className:rp("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(xne,{asChild:!0,children:t.jsx(gu,{className:"h-4 w-4 opacity-50"})})]})));Mne.displayName=bne.displayName;const Lne=i.forwardRef((({className:e,...n},r)=>t.jsx(Nne,{ref:r,className:rp("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(bu,{className:"h-4 w-4"})})));Lne.displayName=Nne.displayName;const Dne=i.forwardRef((({className:e,...n},r)=>t.jsx(Rne,{ref:r,className:rp("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(gu,{className:"h-4 w-4"})})));Dne.displayName=Rne.displayName;const Ine=i.forwardRef((({className:e,children:n,position:r="popper",...o},i)=>t.jsx(wne,{children:t.jsxs(_ne,{ref:i,className:rp("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(Lne,{}),t.jsx(Sne,{className:rp("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),t.jsx(Dne,{})]})})));Ine.displayName=_ne.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(Ene,{ref:r,className:rp("px-2 py-1.5 text-sm font-semibold text-muted-foreground",e),...n}))).displayName=Ene.displayName;const Fne=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(Tne,{ref:o,className:rp("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(Ane,{children:t.jsx(mu,{className:"h-4 w-4"})})}),t.jsx(Cne,{children:n})]})));Fne.displayName=Tne.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(One,{ref:r,className:rp("-mx-1 my-1 h-px bg-muted",e),...n}))).displayName=One.displayName;const Une=({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"]})]}),$ne=({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(Une,{type:"email"})}),Vne=()=>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(IZ,{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(Fu,{}),selected:!0})})]})]}),Bne=({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"]})]}),zne=({containerRef:e,stripoDialogDimensions:r,showSaving:o})=>(n.useEffect((()=>{const t=t=>{const n=e.current;if(!n)return;const r=n.querySelector("ui-editor");if(!r)return;const o=r.shadowRoot;if(!o)return;const i=o.host.getBoundingClientRect();const a=function(e){for(;e;){const t=getComputedStyle(e);if(("auto"===t.overflowY||"scroll"===t.overflowY)&&e.scrollHeight>e.clientHeight)return e;e=e.parentElement}return null}(o.elementFromPoint(t.clientX-i.left,t.clientY-i.top))||o.firstElementChild;a&&(a.scrollTop+=t.deltaY,a.scrollLeft+=t.deltaX,t.preventDefault())},n=e.current;return n&&n.addEventListener("wheel",t,{passive:!1}),()=>{n&&n.removeEventListener("wheel",t)}}),[e]),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"}),o&&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(EZ,{textColor:"text-white",text:["Saving..."]})}),t.jsx("div",{id:"stripoEditorContainer",ref:e,style:{width:r.width-75,height:r.height-75},className:"z-10"})]})),Hne="UiEditorScript",qne=e=>new Promise(((t,n)=>{const r=()=>{let n=!0;e.updatedFromDefault&&(n=!1),window.UIEditor&&(window.UIEditor.initEditor(e.container,{forceRecreate:n,metadata:{emailId:e.emailId},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(Hne))r();else{const e=document.createElement("script");e.id=Hne,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)}})),Gne=({automation:e,setShowStripoEditor:r,saveClicked:o,setSaveClicked:i,stripoDialogDimensions:a,mergeFieldsResponse:s,cancelClicked:l,setCancelClicked:c,actionId:u})=>{const d=n.useRef(!1),p=n.useRef(null),{data:f,isLoading:h}=(e=>{const{automationId:t,actionId:n}=e;return ye({queryKey:eZ.templateForActionId(t,n),queryFn:()=>nZ({automationId:t,actionId:n}),...Se})})({automationId:e.id,actionId:u}),{data:m,isLoading:g}=(()=>{const e=ue();return{...ye({queryKey:eZ.editorData(),queryFn:tZ,...Se}),invalidateEditorData:()=>e.invalidateQueries({queryKey:eZ.editorData()})}})(),[v,y]=n.useState(!1),[b,x]=n.useState(!1),{updateCommunicationGroup:w}=iZ(),_=n.useCallback((()=>{i(!1),c(!1),y(!1),x(!1),r(!1)}),[i,c,y,x,r]);return n.useEffect((()=>{if(o&&window.UIEditor&&f?.communicationGroupId&&window.StripoEditorApi?.actionsApi){window.StripoEditorApi.actionsApi.compileEmail({callback:function(e,t){e||(w({groupId:f.communicationGroupId,params:{emailHtmlBody:t}}),x(!0))},minimize:!0,mergeTags:[],forceAmp:!1,resetDataSavedFlag:!1,disableLineHeightsReplace:!0});window.StripoEditorApi.actionsApi.save((function(e){e||y(!0)}))}}),[o,p,i,r,f,w]),n.useEffect((()=>{(async()=>{v&&b&&(window.UIEditor&&window.UIEditor.removeEditor(),_())})()}),[v,b,r,i,_]),n.useEffect((()=>{l&&(window.UIEditor&&window.UIEditor.removeEditor(),_())}),[l,_]),n.useEffect((()=>{m?.businessId&&p.current&&f&&(d.current||(qne({emailId:f.communicationGroupId,html:f.html||"<div></div>",css:f.css||"",container:p.current,businessId:m.businessId,mergeFields:s.mergeFields||[],updatedFromDefault:f.updatedFromDefault}).catch((e=>{})),d.current=!0))}),[m,s,f]),t.jsx("div",h||g||!m||!f?{className:"w-full h-full flex flex-col items-center justify-center",children:t.jsx(EZ,{text:["Loading editor..."]})}:{className:"w-full h-full flex flex-col",children:t.jsx(zne,{containerRef:p,stripoDialogDimensions:a,showSaving:o})})},Kne=({mergeFieldsResponse:e})=>{const r=xZ(),o=bZ(),{updateCommunicationGroup:i}=iZ(),{refetchAutomation:a}=je(o?.id||""),{channelSenders:s}=V7(),{channelAccounts:l}=U7(),{state:{selectedActionId:c}}=n.useContext(XX),{state:{replyToSettingsText:u,replyToSettingsLink:d,fromNameSettingsText:p,fromNameSettingsLink:f}}=n.useContext(l$),[h,m]=n.useState(!1),[g,v]=n.useState(r?.emailChannelSenderId||null),[y,b]=n.useState(r?.emailSubject||null),[x,w]=n.useState(r?.emailPreviewText||null),[_,S]=n.useState(r?.emailHtmlBody||null),[E,T]=n.useState(!1),[C,A]=n.useState(!1),[N,R]=n.useState(!1),[O,P]=n.useState(""),[k,j]=n.useState(""),[M,L]=n.useState(!1),D=n.useRef(!0),[I,F]=n.useState(!0),[U,$]=n.useState(!1),[V,B]=n.useState({width:0,height:0}),z=q7(y,500),H=q7(x,500),q=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===$7.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[s?.results,l?.results]),G=n.useMemo((()=>({width:800,height:400})),[]),K=n.useRef(null);return n.useEffect((()=>{const e=setTimeout((()=>{D.current=!1}),500);return()=>clearTimeout(e)}),[]),n.useEffect((()=>{r?.emailHtmlBody&&S(r.emailHtmlBody)}),[r?.emailHtmlBody,a]),n.useEffect((()=>{if(h){const e=setTimeout((()=>{m(!1)}),2e3);return()=>clearTimeout(e)}}),[h]),n.useEffect((()=>{const e=()=>{B({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),n.useEffect((()=>{if(!D.current&&g&&z&&_&&r?.id){m(!0);(async()=>{try{i({groupId:r.id,params:{emailChannelSenderId:g,emailHtmlBody:_,emailSubject:z,...H&&{emailPreviewText:H}}})}catch(e){}finally{m(!1)}})()}}),[g,z,H,_,r?.id,i]),n.useEffect((()=>{if(s?.results&&g){const e=s.results.find((e=>e.id===g));e&&(U&&!I||j(e.channelSenderMetadata.emailReplyTo),I&&P(e.channelSenderMetadata.emailFromName),F(!1))}}),[s?.results,g,U,I]),n.useEffect((()=>{if(s?.results&&!g){const e=s.results.filter((e=>e.channelSenderMetadata.userPart));if(e[0]){const t=e[0];v(t.id),i({groupId:r?.id||"",params:{emailChannelSenderId:t.id}})}}}),[s?.results,g,r?.id,i]),n.useEffect((()=>{!1===E&&r?.id&&a()}),[E,r?.id,a]),l&&s&&c?t.jsxs("div",{className:"relative",children:[t.jsx(PB,{open:M,onOpenChange:L,children:t.jsxs(MB,{className:"max-h-[86vh] gap-0 overflow-visible max-w-3xl w-full h-full",children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Email Preview Help"}),t.jsx(FB,{children:"Learn more about the email preview and how to use it to create your email."})]}),t.jsx(Vne,{})]})}),t.jsx(PB,{open:E,onOpenChange:T,children:t.jsxs(MB,{className:"min-w-[100vw] min-h-[100vh]",hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault()},children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Email Editor"}),t.jsx(FB,{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(MZ,{size:"sm",onClick:()=>L(!0),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-medium text-sm",children:"Help"}),t.jsx(FZ.InfoIcon,{className:"w-4 h-4"})]})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(MZ,{variant:"destructive",onClick:()=>{R(!0)},className:"text-sm px-3 py-1 rounded",children:"Cancel"}),t.jsx(MZ,{onClick:()=>A(!0),className:"text-sm px-3 py-1 rounded",children:"Save"})]})]}),t.jsx("div",{className:" w-full",children:o&&t.jsx(Gne,{cancelClicked:N,setCancelClicked:R,showStripoEditor:E,automation:o,setShowStripoEditor:T,saveClicked:C,setSaveClicked:A,stripoDialogDimensions:V,mergeFieldsResponse:e,actionId:c})})]})]})}),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(nee,{className:"text-foreground",children:"From Email"}),t.jsxs(Pne,{onValueChange:e=>{v(e),F(!0),$(!1)},value:g??void 0,disabled:h,children:[t.jsx(Mne,{children:t.jsx(jne,{placeholder:"Select email",className:"text-muted-foreground",children:g?q?.find((e=>e.channelSenderId===g))?.fullDomain:""})}),t.jsx(Ine,{children:q?.map((e=>t.jsx(Fne,{value:e.channelSenderId,children:e.fullDomain},e.channelSenderId)))})]})]}),t.jsxs("div",{children:[t.jsx(nee,{children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["From Name",t.jsx(G7,{title:p||"From name can be configured under settings in the home screen",onClick:()=>{f&&window.open(f,"_blank")}})]})}),t.jsx(s5,{value:O??"",className:"text-muted-foreground",disabled:!0})]}),t.jsxs("div",{children:[t.jsx(nee,{children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["Reply To Email",t.jsx(G7,{title:u||"Reply to email can be configured under settings in the home screen",onClick:()=>{d&&window.open(d,"_blank")}})]})}),t.jsx(s5,{value:k??(g?q?.find((e=>e.channelSenderId===g))?.fullDomain:""),className:"text-muted-foreground",disabled:!0})]}),t.jsxs("div",{children:[t.jsx(nee,{className:"text-foreground",children:"Subject"}),t.jsx(s5,{placeholder:"Enter email subject",className:"text-muted-foreground",value:y??"",onChange:e=>b(e.target.value),disabled:h||I})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(nee,{className:"text-foreground",children:"Preview Text"}),t.jsx(G7,{title:"This text will be used for the preview text of the email in the inbox"})]}),t.jsx(s5,{placeholder:"Enter preview text",className:"text-muted-foreground",value:x??"",onChange:e=>w(e.target.value),disabled:h||I})]})]}),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(MZ,{onClick:()=>T(!0),className:"text-sm px-3 py-1 rounded",disabled:h||0===(q?.length??0),children:"Edit"}),0===(q?.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(Bne,{type:"email"})})})]})]}),t.jsx("div",{className:"flex-1 w-full overflow-auto",ref:K,style:{height:"400px"},children:t.jsx($ne,{html:_??"",height:G.height,width:G.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(EZ,{text:["Fetching Email Preview..."]})})};function Wne(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])}var Yne="Checkbox",[Xne,Zne]=nJ(Yne),[Qne,Jne]=Xne(Yne),ere=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=NZ(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=iJ({prop:a,defaultProp:s,onChange:d}),w=i.useRef(b);return i.useEffect((()=>{const e=h?.form;if(e){const t=()=>x(w.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[h,x]),t.jsxs(Qne,{scope:r,state:b,disabled:c,children:[t.jsx(dJ.button,{type:"button",role:"checkbox","aria-checked":ore(b)?"mixed":b,"aria-required":l,"data-state":ire(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onKeyDown:tJ(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:tJ(e.onClick,(e=>{x((e=>!!ore(e)||!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(rre,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:!ore(s)&&s})]})}));ere.displayName=Yne;var tre="CheckboxIndicator",nre=i.forwardRef(((e,n)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,a=Jne(tre,r);return t.jsx(V1,{present:o||ore(a.state)||!0===a.state,children:t.jsx(dJ.span,{"data-state":ire(a.state),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})}));nre.displayName=tre;var rre=e=>{const{control:n,checked:r,bubbles:o=!0,defaultChecked:a,...s}=e,l=i.useRef(null),c=Wne(r),u=v1(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=ore(r),n.call(e,!ore(r)&&r),e.dispatchEvent(t)}}),[c,r,o]);const d=i.useRef(!ore(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 ore(e){return"indeterminate"===e}function ire(e){return ore(e)?"indeterminate":e?"checked":"unchecked"}var are=ere,sre=nre;const lre=({selectedChannels:e,setSelectedChannels:n,hasEmailChannelSenders:r,hasSmsChannelSenders:o,automationType:i})=>{const{toast:a}=Il(),s=[...r?[{label:"Email",value:"email",icon:FZ.EmailIcon,checked:e.includes("email")}]:[],...o?[{label:"SMS",value:"sms",icon:FZ.SmsIcon,checked:e.includes("sms")}]:[]];return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-xl font-medium text-foreground",children:"Message Types"}),t.jsx("p",{className:"text-muted-foreground 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:s.map((r=>t.jsxs(are,{checked:r.checked,onCheckedChange:()=>{"email"===r.value?e.includes("email")?e.includes("sms")?n(["sms"]):a({title:"Cant Remove Email",description:`At least one channel is required for an ${i===Ue.ONE_TIME?bf("engage:broadcast").toLowerCase():bf("engage:automation").toLowerCase()}`,variant:"destructive"}):n([...e,"email"]):e.includes("sms")?e.includes("email")?n(["email"]):a({title:"Cant Remove SMS",description:`At least one channel is required for an ${i===Ue.ONE_TIME?bf("engage:broadcast").toLowerCase():bf("engage:automation").toLowerCase()}`,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]:font-medium",children:[t.jsx(r.icon,{className:"mb-3",size:20}),t.jsx("span",{className:"font-medium tracking-tight",children:r.label}),t.jsx(sre,{className:"absolute top-2 right-2",children:t.jsx(Su,{className:"fill-primary text-primary-foreground"})})]},r.value)))})]})},cre=async()=>(await Oe(s)).data,ure=["me"],dre=()=>ye({queryKey:ure,queryFn:cre,...Se}),pre=()=>{const e=ue(),t=dre(),n=be({mutationFn:e=>(async e=>(await Oe(s,{method:"PATCH",body:JSON.stringify({website:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:ure})}}),r=be({mutationFn:e=>(async e=>(await Oe(s,{method:"PATCH",body:JSON.stringify({locations:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:ure})}}),o=be({mutationFn:e=>(async e=>(await Oe(s,{method:"PATCH",body:JSON.stringify({branding:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:ure})}});return{data:t.data,isLoading:t.isLoading,error:t.error,refetch:t.refetch,updateWebsite:n.mutate,updateLocations:r.mutate,updateBrandSettings:o.mutate,isUpdatingWebsite:n.isPending,isUpdatingLocations:r.isPending,isUpdatingBrandSettings:o.isPending}},fre="undefined"!=typeof window&&"undefined"!=typeof document;var hre=.999,mre=/[\\\/_+.#"@\[\(\{&]/,gre=/[\\\/_+.#"@\[\(\{&]/g,vre=/[\s-]/,yre=/[\s-]/g;function bre(e,t,n,r,o,i,a){if(i===t.length)return o===e.length?1:.99;var s=`${o},${i}`;if(void 0!==a[s])return a[s];for(var l,c,u,d,p=r.charAt(i),f=n.indexOf(p,o),h=0;f>=0;)(l=bre(e,t,n,r,f+1,i+1,a))>h&&(f===o?l*=1:mre.test(e.charAt(f-1))?(l*=.8,(u=e.slice(o,f-1).match(gre))&&o>0&&(l*=Math.pow(hre,u.length))):vre.test(e.charAt(f-1))?(l*=.9,(d=e.slice(o,f-1).match(yre))&&o>0&&(l*=Math.pow(hre,d.length))):(l*=.17,o>0&&(l*=Math.pow(hre,f-o))),e.charAt(f)!==t.charAt(i)&&(l*=.9999)),(l<.1&&n.charAt(f-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(f-1)!==r.charAt(i))&&(.1*(c=bre(e,t,n,r,f+1,i+2,a))>l&&(l=.1*c)),l>h&&(h=l),f=n.indexOf(p,f+1);return a[s]=h,h}function xre(e){return e.toLowerCase().replace(yre," ")}function wre(e,t,n){return bre(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,t,xre(e),xre(t),0,0,{})}function _re(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Sre(...e){return t=>{let n=!1;const r=e.map((e=>{const r=_re(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():_re(e[t],null)}}}}function Ere(e){const n=Tre(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(Are);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 Tre(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)=>{const t=i(...e);return o(...e),t}: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?Sre(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 Cre=Symbol("radix.slottable");function Are(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Cre}var Nre=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=Ere(`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}}),{}),Rre='[cmdk-group=""]',Ore='[cmdk-group-items=""]',Pre='[cmdk-item=""]',kre=`${Pre}:not([aria-disabled="true"])`,jre="cmdk-item-select",Mre="data-value",Lre=(e,t,n)=>wre(e,t,n),Dre=i.createContext(void 0),Ire=()=>i.useContext(Dre),Fre=i.createContext(void 0),Ure=()=>i.useContext(Fre),$re=i.createContext(void 0),Vre=i.forwardRef(((e,t)=>{let n=toe((()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}})),r=toe((()=>new Set)),o=toe((()=>new Map)),a=toe((()=>new Map)),s=toe((()=>new Set)),l=Jre(e),{label:c,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=$J(),x=$J(),w=$J(),_=i.useRef(null),S=ooe();eoe((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,E.emit()}}),[d]),eoe((()=>{S(6,O)}),[]);let E=i.useMemo((()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,i,a,s;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)R(),A(),S(1,N);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(o=document.getElementById(b))||o.focus()}if(S(7,(()=>{var e;n.current.selectedItemId=null==(e=P())?void 0:e.id,E.emit()})),r||S(5,O),void 0!==(null==(i=l.current)?void 0:i.value)){return void(null==(s=(a=l.current).onValueChange)||s.call(a,null!=t?t:""))}}E.emit()}},emit:()=>{s.current.forEach((e=>e()))}})),[]),T=i.useMemo((()=>({value:(e,t,r)=>{var o;t!==(null==(o=a.current.get(e))?void 0:o.value)&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),S(2,(()=>{A(),E.emit()})))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),S(3,(()=>{R(),A(),n.current.value||N(),E.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();S(4,(()=>{R(),(null==t?void 0:t.getAttribute("id"))===e&&N(),E.emit()}))}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{a.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:w,labelId:x,listInnerRef:_})),[]);function C(e,t){var r,o;let i=null!=(o=null==(r=l.current)?void 0:r.filter)?o:Lre;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(Ore);t?t.appendChild(e.parentElement===t?e:e.closest(`${Ore} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Ore} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{var t;let n=null==(t=_.current)?void 0:t.querySelector(`${Rre}[${Mre}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function N(){let e=k().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(Mre);E.setState("value",t||void 0)}function R(){var e,t,i,s;if(!n.current.search||!1===l.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let c=0;for(let o of r.current){let r=C(null!=(t=null==(e=a.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(i=a.current.get(o))?void 0:i.keywords)?s:[]);n.current.filtered.items.set(o,r),r>0&&c++}for(let[r,a]of o.current)for(let e of a)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(r);break}n.current.filtered.count=c}function O(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(Rre))?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(`${Pre}[aria-selected="true"]`)}function k(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(kre))||[])}function j(e){let t=k()[e];t&&E.setState("value",t.getAttribute(Mre))}function M(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(Mre))}function L(e){let t,n=P(),r=null==n?void 0:n.closest(Rre);for(;r&&!t;)r=e>0?Zre(r,Rre):Qre(r,Rre),t=null==r?void 0:r.querySelector(kre);t?E.setState("value",t.getAttribute(Mre)):M(e)}let D=()=>j(k().length-1),I=e=>{e.preventDefault(),e.metaKey?D():e.altKey?L(1):M(1)},F=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?L(-1):M(-1)};return i.createElement(Nre.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=y.onKeyDown)||t.call(y,e),!e.defaultPrevented&&!(e.nativeEvent.isComposing||229===e.keyCode))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(),j(0);break;case"End":e.preventDefault(),D();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(jre);t.dispatchEvent(e)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:aoe},c),ioe(e,(e=>i.createElement(Fre.Provider,{value:E},i.createElement(Dre.Provider,{value:T},e)))))})),Bre=i.forwardRef(((e,t)=>{var n,r;let o=$J(),a=i.useRef(null),s=i.useContext($re),l=Ire(),c=Jre(e),u=null!=(r=null==(n=c.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;eoe((()=>{if(!u)return l.item(o,null==s?void 0:s.id)}),[u]);let d=roe(o,a,[e.value,e.children,a],e.keywords),p=Ure(),f=noe((e=>e.value&&e.value===d.current)),h=noe((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(jre,m),()=>t.removeEventListener(jre,m)}),[h,e.onSelect,e.disabled]),!h)return null;let{disabled:v,value:y,onSelect:b,forceMount:x,keywords:w,..._}=e;return i.createElement(Nre.div,{ref:Sre(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)})),zre=i.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,s=$J(),l=i.useRef(null),c=i.useRef(null),u=$J(),d=Ire(),p=noe((e=>!(!o&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));eoe((()=>d.group(s)),[]),roe(s,l,[e.value,e.heading,c]);let f=i.useMemo((()=>({id:s,forceMount:o})),[o]);return i.createElement(Nre.div,{ref:Sre(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),ioe(e,(e=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},i.createElement($re.Provider,{value:f},e)))))})),Hre=i.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=i.useRef(null),a=noe((e=>!e.search));return n||a?i.createElement(Nre.div,{ref:Sre(o,t),...r,"cmdk-separator":"",role:"separator"}):null})),qre=i.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=Ure(),s=noe((e=>e.search)),l=noe((e=>e.selectedItemId)),c=Ire();return i.useEffect((()=>{null!=e.value&&a.setState("search",e.value)}),[e.value]),i.createElement(Nre.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":l,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)}})})),Gre=i.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=i.useRef(null),s=i.useRef(null),l=noe((e=>e.selectedItemId)),c=Ire();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(Nre.div,{ref:Sre(a,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},ioe(e,(e=>i.createElement("div",{ref:Sre(s,c.listInnerRef),"cmdk-list-sizer":""},e))))})),Kre=i.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:s,...l}=e;return i.createElement(SB,{open:n,onOpenChange:r},i.createElement(EB,{container:s},i.createElement(TB,{"cmdk-overlay":"",className:o}),i.createElement(CB,{"aria-label":e.label,"cmdk-dialog":"",className:a},i.createElement(Vre,{ref:t,...l}))))})),Wre=i.forwardRef(((e,t)=>noe((e=>0===e.filtered.count))?i.createElement(Nre.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),Yre=i.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return i.createElement(Nre.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},ioe(e,(e=>i.createElement("div",{"aria-hidden":!0},e))))})),Xre=Object.assign(Vre,{List:Gre,Item:Bre,Input:qre,Group:zre,Separator:Hre,Dialog:Kre,Empty:Wre,Loading:Yre});function Zre(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Qre(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Jre(e){let t=i.useRef(e);return eoe((()=>{t.current=e})),t}var eoe="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function toe(e){let t=i.useRef();return void 0===t.current&&(t.current=e()),t}function noe(e){let t=Ure(),n=()=>e(t.snapshot());return i.useSyncExternalStore(t.subscribe,n,n)}function roe(e,t,n,r=[]){let o=i.useRef(),a=Ire();return eoe((()=>{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(Mre,s),o.current=s})),o}var ooe=()=>{let[e,t]=i.useState(),n=toe((()=>new Map));return eoe((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function ioe({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 aoe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const soe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre,{ref:r,className:rp("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})));soe.displayName=Xre.displayName;const loe=i.forwardRef((({className:e,searchIcon:n,...r},o)=>t.jsxs("div",{className:"flex items-center border-b px-3",children:[n||t.jsx(Wu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),t.jsx(Xre.Input,{ref:o,className:rp("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})]})));loe.displayName=Xre.Input.displayName;const coe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre.List,{ref:r,className:rp("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n})));coe.displayName=Xre.List.displayName;const uoe=i.forwardRef(((e,n)=>t.jsx(Xre.Empty,{ref:n,className:"py-6 text-center text-sm",...e})));uoe.displayName=Xre.Empty.displayName;const doe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre.Group,{ref:r,className:rp("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})));doe.displayName=Xre.Group.displayName;const poe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre.Separator,{ref:r,className:rp("-mx-1 h-px bg-border",e),...n})));poe.displayName=Xre.Separator.displayName;const foe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre.Item,{ref:r,className:rp("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})));foe.displayName=Xre.Item.displayName;const hoe=i.forwardRef((({className:e,...n},r)=>t.jsx("textarea",{className:rp("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n})));hoe.displayName="Textarea";const moe=e=>{const{companyName:t,smsBody:n}=e;return t&&n?`${t}:\n${n}`:n??""},goe=({body:e,imageUrls:n})=>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.jsxs("div",{className:"sms-phone-inner",children:[n&&n.length>0&&n.map(((e,n)=>t.jsx("div",{className:"sms-message-row",children:t.jsx("div",{className:"sms-message-bubble",children:t.jsx("img",{src:e,alt:"MMS attachment",className:"sms-message-image",loading:"lazy"})})},e+n))),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"})]})}),voe=({mergeFieldsResponse:e,smsChannelSenders:r})=>{const o=bZ(),i=xZ(),a=n.useCallback((()=>{const e=o?.actionData?.find((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId===i?.id));return e?.actionMetadata.communicationGroupId}),[o?.actionData,i?.id]),{channelSenders:s}=V7(),{data:l,isLoading:c}=dre(),{channelAccounts:u}=U7(),{toast:d}=Il(),{updateCommunicationGroup:p,isUpdating:f}=iZ(),[h,m]=n.useState(null),[g,v]=n.useState(!1),[y,b]=n.useState(null),[x,w]=n.useState(null),[_,S]=n.useState([]),[E,T]=n.useState(null),[C,A]=n.useState(!1),[N,R]=n.useState(!1),O=n.useRef(null),P=n.useRef(null),[k,j]=n.useState(null),[M,L]=n.useState(null),[D,I]=n.useState(!1);n.useEffect((()=>{C&&(T(x),_.length>0&&!k&&!D&&j(_[0]))}),[C,x,_,k,D]),n.useEffect((()=>{C||(j(_.length>0?_[0]:null),L(null),I(!1))}),[C,_]);n.useEffect((()=>{i&&(m(i.smsChannelSenderId),w(i.smsMessageBody),i.textMessageCompanyName&&b(i.textMessageCompanyName),i.textMessageMediaUrls&&S(i.textMessageMediaUrls))}),[i]);n.useEffect((()=>{if(void 0!==s&&!h){const e=H7({channelSenders:s?.results??[]});e?.[0]&&(m(e[0].id),i?.id&&p({groupId:i.id,params:{smsChannelSenderId:e[0].id}}))}}),[s,h,i?.id,p]),n.useEffect((()=>{y||!l?.name||g||(v(!0),b(l.name))}),[y,l?.name,g]);return u&&s&&!c?t.jsxs("div",{children:[t.jsx(PB,{open:C,onOpenChange:A,children:t.jsxs(MB,{hideCloseButton:!0,className:"max-w-[50vw]",children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"SMS Editor"}),t.jsx(FB,{children:"Learn more about the SMS editor and how to use it to create your SMS."})]}),t.jsxs("div",{className:"",children:[k&&t.jsx("div",{className:"flex justify-center mb-6",children:t.jsxs("div",{className:"relative group w-fit",children:[t.jsx("img",{src:k,alt:"SMS attachment preview",className:"max-h-48 max-w-xs rounded-xl shadow-lg border border-gray-200 object-contain bg-white transition-transform duration-200 group-hover:scale-105",style:{boxShadow:"0 4px 24px 0 rgba(0,0,0,0.08)"}}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"absolute -top-3 -right-3 bg-white/80 hover:bg-red-100 text-gray-500 hover:text-red-500 shadow-md border border-gray-200 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{j(null),L(null),I(!0)},style:{boxShadow:"0 2px 8px 0 rgba(0,0,0,0.10)"},children:t.jsx(cd,{className:"h-4 w-4"})})]})}),t.jsx(hoe,{ref:O,className:"min-h-[300px]",placeholder:"Text message content...",value:E??"",onChange:e=>{T(e.target.value)},maxLength:1600-(y?.length||0)}),t.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(v9,{modal:!0,open:N,onOpenChange:R,children:[t.jsx(y9,{asChild:!0,children:t.jsx(MZ,{variant:"outline",role:"combobox",className:"w-[50px] justify-center",children:t.jsx(FZ.MergeField,{className:"w-4 h-4 text-primary"})})}),t.jsx(b9,{className:"w-[300px] p-0",align:"start",children:t.jsxs(soe,{children:[t.jsx(loe,{placeholder:"Search merge fields..."}),t.jsxs(coe,{children:[t.jsx(uoe,{children:"No merge fields found."}),e?.mergeFields?.map((e=>t.jsx(doe,{heading:e.category,children:e.entries.map((e=>t.jsx(foe,{onSelect:()=>{const t=O.current,n=E||"",r=t?.selectionStart??n.length,o=t?.selectionEnd??n.length,i=n.slice(0,r)+e.value+n.slice(o);T(i),R(!1),setTimeout((()=>{const n=r+e.value.length;t?.focus(),t?.setSelectionRange(n,n)}),0)},children:e.label},e.value)))},e.category)))]})]})})]}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Merge Fields"}),t.jsx(G7,{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 gap-2",children:[t.jsx("input",{type:"file",ref:P,onChange:async e=>{const t=e.target.files?.[0];if(t){const e=new FileReader;e.onloadend=async()=>{try{const t=await async function(e){if(!fre)throw new Error("Image conversion is only supported in browser environments");return new Promise(((t,n)=>{try{const r=new window.Image;r.crossOrigin="anonymous",r.onload=()=>{try{const e=document.createElement("canvas");e.width=r.naturalWidth,e.height=r.naturalHeight;const o=e.getContext("2d");if(!o)return void n(new Error("Failed to get canvas context"));o.drawImage(r,0,0);const i=e.toDataURL("image/png",1);t(i)}catch(e){n(e)}},r.onerror=()=>{n(new Error("Failed to load image"))},r.src=e}catch(r){n(r)}}))}(e.result),n=function(e){const t=e.match(/^data:([A-Za-z-+/]+);base64,(.+)$/);if(!t||3!==t.length)throw new Error("Invalid data URL format");return t[2]}(t);L(n),j(t),I(!1)}catch(t){d({title:"Error converting image",description:"Failed to convert image to PNG format",variant:"destructive"})}},e.readAsDataURL(t)}},accept:"image/*",className:"hidden"}),t.jsx(MZ,{variant:"outline",onClick:()=>{P.current?.click()},className:"px-4",disabled:_.length>=1||D||null!==M,children:"Add Image"}),t.jsx(MZ,{variant:"outline",onClick:()=>{T(x),A(!1),j(_.length>0?_[0]:null),L(null),I(!1)},className:"px-4",children:"Cancel"}),t.jsx(MZ,{onClick:()=>{w(E);const e=a();e&&p({groupId:e,params:{smsChannelSenderId:h,smsMessageBody:E,textMessageCompanyName:y,textMessageMedia:M?[M]:D?[]:void 0}},{onSuccess:()=>{A(!1),j(null),L(null),I(!1)},onError:()=>{d({title:"Error updating SMS",description:"Please contact your administrator"})}})},className:"px-4",disabled:f,children:"Save Changes"})]})]}),t.jsxs("div",{className:"flex justify-end mt-2 text-sm transition-colors duration-300 "+(E&&E.length>1400?E.length>=1600?"text-red-500":"text-amber-500":"text-gray-500"),children:[E?E.length:0,"/",1600-(y?.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(nee,{className:"text-foreground",children:"From Number"}),t.jsxs(Pne,{onValueChange:e=>{m(e)},value:h??void 0,children:[t.jsx(Mne,{children:t.jsx(jne,{placeholder:"Select number",children:h?(F=h,r?.find((e=>e.id===F))?.channelSenderMetadata.friendlyName??r?.find((e=>e.id===F))?.channelSenderMetadata.from??F):"Select number"})}),t.jsx(Ine,{children:r?.map((e=>t.jsx(Fne,{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(nee,{className:"text-foreground",children:"Company Name"}),t.jsx(G7,{title:"Adding your company name can help customers identify who they are talking to"})]}),t.jsx(s5,{placeholder:"Enter company name",value:y??"",className:"text-muted-foreground",onChange:e=>{b(e.target.value??null)},disabled:!h})]})]}),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(MZ,{onClick:()=>A(!0),className:"text-sm px-3 py-1 rounded ",disabled:0===(r?.length??0),children:"Edit"})})]}),t.jsx("div",{children:h?t.jsx(t.Fragment,{children:h&&x?t.jsx(goe,{body:moe({companyName:y??void 0,smsBody:x}),imageUrls:_}):t.jsx(Une,{type:"sms"})}):t.jsx(Bne,{type:"sms"})})]})]})]}):t.jsx("div",{children:t.jsx(EZ,{text:["Loading..."]})});var F};var yoe=(e=>(e.CUSTOM="custom",e.MANAGED="managed",e))(yoe||{}),boe=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(boe||{});const xoe=({title:e,type:r})=>{const o=xZ(),i=bZ(),{toast:a}=Il(),[s,l]=n.useState(!1),{resetCommunicationGroupToDefault:c,isPending:u}=sZ(),d=!!o&&(o.type===yoe.MANAGED&&("sms"===r?o.updatedFromDefault?.text_message_body:o.updatedFromDefault?.email_text_body||o.updatedFromDefault?.email_html_body));return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h4",{className:"text-xl font-medium text-foreground",children:e}),t.jsx("div",{className:"flex items-center gap-2",children:d&&t.jsx(t.Fragment,{children:u?t.jsx(EZ,{}):t.jsx(MZ,{variant:"outline",size:"sm",onClick:()=>l(!0),children:"Reset To Default"})})})]}),t.jsx(PB,{open:s,onOpenChange:l,children:t.jsxs(MB,{className:"sm:max-w-[425px]",children:[t.jsxs(LB,{children:[t.jsx(IB,{className:"text-xl font-semibold",children:"Reset to Default"}),t.jsxs(FB,{className:"text-base text-muted-foreground",children:["Are you sure you want to reset this"," ","email"===r?"email":"SMS"," template to its default state? This action cannot be undone."]})]}),t.jsxs(DB,{className:"flex flex-row justify-end gap-3 mt-6",children:[t.jsx(MZ,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),t.jsx(MZ,{variant:"destructive",onClick:async()=>{o&&i?c({communicationGroupId:o.id,automationId:i.id,type:r},{onSuccess:()=>{a({title:"Communication reset to default!"}),l(!1)},onSettled:()=>{l(!1)},onError:()=>{a({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})}}):a({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})},children:"Reset to Default"})]})]})})]})},woe=({getExtraMergeFields:e})=>{const[r,o]=n.useState(null),i=n.useRef(null),{toast:a}=Il(),s=xZ(),{channelSenders:l}=V7(),{channelAccounts:c}=U7(),{updateCommunicationGroup:u}=iZ(),d=bZ(),{getMergeFields:p,isGetting:f}=(e=>{const t=ye({queryKey:["merge-fields",e],queryFn:()=>JX(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 JX(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"})}}))})):m(p))}),[e,u,s,a,f,p,h,g]);const v=n.useMemo((()=>z7({channelSenders:l?.results??[],channelAccounts:c?.results??[]})),[l?.results,c?.results]),y=n.useMemo((()=>H7({channelSenders:l?.results??[]})),[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(EZ,{text:["Fetching Content..."]})});const b=v.length>0,x=y.length>0;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(lre,{automationType:d?.triggerMetadata?.triggerType,selectedChannels:r,setSelectedChannels:o,hasEmailChannelSenders:b,hasSmsChannelSenders:x})}),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(xoe,{title:"Email Campaign",type:"email"}),t.jsx(Kne,{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(xoe,{title:"SMS Campaign",type:"sms"}),t.jsx(voe,{mergeFieldsResponse:h,smsChannelSenders:y})]})]})},_oe=({content:e,className:n})=>t.jsx("div",{className:OB("flex flex-col gap-4 w-full p-6",n),children:t.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 relative",children:e})}),Soe=e=>e.friendlyName||e.from||e.messageServiceSid||"Unknown Sender";function Eoe(e,t){throw new Error(`Unreachable case statement: ${JSON.stringify(e)}. Valid values are: ${Object.values(t).join(", ")}`)}function Toe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Coe(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}\``)}]},Aoe(o,...n)]}function Aoe(...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 Noe(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Roe(...e){return t=>{let n=!1;const r=e.map((e=>{const r=Noe(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():Noe(e[t],null)}}}}function Ooe(...e){return i.useCallback(Roe(...e),e)}function Poe(e){const n=koe(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(Moe);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 koe(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?Roe(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 joe=Symbol("radix.slottable");function Moe(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===joe}var Loe=globalThis?.document?i.useLayoutEffect:()=>{},Doe=i[" useId ".trim().toString()]||(()=>{}),Ioe=0;function Foe(e){const[t,n]=i.useState(Doe());return Loe((()=>{n((e=>e??String(Ioe++)))}),[e]),e||(t?`radix-${t}`:"")}var Uoe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=Poe(`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 $oe=i[" useInsertionEffect ".trim().toString()]||Loe;function Voe({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 $oe((()=>{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 Boe=i.createContext(void 0);function zoe(e){const t=i.useContext(Boe);return e||t||"ltr"}var Hoe="rovingFocusGroup.onEntryFocus",qoe={bubbles:!1,cancelable:!0},Goe="RovingFocusGroup",[Koe,Woe,Yoe]=function(e){const r=e+"CollectionProvider",[o,i]=Coe(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=Poe(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=Ooe(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=Poe(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=Ooe(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]}(Goe),[Xoe,Zoe]=Coe(Goe,[Yoe]),[Qoe,Joe]=Xoe(Goe),eie=i.forwardRef(((e,n)=>t.jsx(Koe.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Koe.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(tie,{...e,ref:n})})})));eie.displayName=Goe;var tie=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=Ooe(n,h),g=zoe(s),[v,y]=Voe({prop:l,defaultProp:c??null,onChange:u,caller:Goe}),[b,x]=i.useState(!1),w=function(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}(d),_=Woe(r),S=i.useRef(!1),[E,T]=i.useState(0);return i.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(Hoe,w),()=>e.removeEventListener(Hoe,w)}),[w]),t.jsx(Qoe,{scope:r,orientation:o,dir:g,loop:a,currentTabStopId:v,onItemFocus:i.useCallback((e=>y(e)),[y]),onItemShiftTab:i.useCallback((()=>x(!0)),[]),onFocusableItemAdd:i.useCallback((()=>T((e=>e+1))),[]),onFocusableItemRemove:i.useCallback((()=>T((e=>e-1))),[]),children:t.jsx(Uoe.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:Toe(e.onMouseDown,(()=>{S.current=!0})),onFocus:Toe(e.onFocus,(e=>{if(e.target===e.currentTarget&&!S.current&&!b){const t=new CustomEvent(Hoe,qoe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter((e=>e.focusable));iie([e.find((e=>e.active)),e.find((e=>e.id===v)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}S.current=!1})),onBlur:Toe(e.onBlur,(()=>x(!1)))})})})),nie="RovingFocusGroupItem",rie=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:a=!1,tabStopId:s,children:l,...c}=e,u=Foe(),d=s||u,p=Joe(nie,r),f=p.currentTabStopId===d,h=Woe(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=p;return i.useEffect((()=>{if(o)return m(),()=>g()}),[o,m,g]),t.jsx(Koe.ItemSlot,{scope:r,id:d,focusable:o,active:a,children:t.jsx(Uoe.span,{tabIndex:f?0:-1,"data-orientation":p.orientation,...c,ref:n,onMouseDown:Toe(e.onMouseDown,(e=>{o?p.onItemFocus(d):e.preventDefault()})),onFocus:Toe(e.onFocus,(()=>p.onItemFocus(d))),onKeyDown:Toe(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:oie[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((()=>iie(o)))}var n,r})),children:"function"==typeof l?l({isCurrentTabStop:f,hasTabStop:null!=v}):l})})}));rie.displayName=nie;var oie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iie(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 aie=eie,sie=rie;var lie=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=cie(r.current);a.current="mounted"===l?e:"none"}),[l]),Loe((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=cie(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]),Loe((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=cie(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=cie(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=Ooe(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 cie(e){return e?.animationName||"none"}lie.displayName="Presence";var uie="Tabs",[die,pie]=Coe(uie,[Zoe]),fie=Zoe(),[hie,mie]=die(uie),gie=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=zoe(l),[p,f]=Voe({prop:o,onChange:i,defaultProp:a??"",caller:uie});return t.jsx(hie,{scope:r,baseId:Foe(),value:p,onValueChange:f,orientation:s,dir:d,activationMode:c,children:t.jsx(Uoe.div,{dir:d,"data-orientation":s,...u,ref:n})})}));gie.displayName=uie;var vie="TabsList",yie=i.forwardRef(((e,n)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,a=mie(vie,r),s=fie(r);return t.jsx(aie,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:o,children:t.jsx(Uoe.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:n})})}));yie.displayName=vie;var bie="TabsTrigger",xie=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...a}=e,s=mie(bie,r),l=fie(r),c=Sie(s.baseId,o),u=Eie(s.baseId,o),d=o===s.value;return t.jsx(sie,{asChild:!0,...l,focusable:!i,active:d,children:t.jsx(Uoe.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:Toe(e.onMouseDown,(e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(o)})),onKeyDown:Toe(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(o)})),onFocus:Toe(e.onFocus,(()=>{d||i||!("manual"!==s.activationMode)||s.onValueChange(o)}))})})}));xie.displayName=bie;var wie="TabsContent",_ie=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,forceMount:a,children:s,...l}=e,c=mie(wie,r),u=Sie(c.baseId,o),d=Eie(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(lie,{present:a||p,children:({present:r})=>t.jsx(Uoe.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 Sie(e,t){return`${e}-trigger-${t}`}function Eie(e,t){return`${e}-content-${t}`}_ie.displayName=wie;var Tie=yie,Cie=xie,Aie=_ie;const Nie=gie,Rie=i.forwardRef((({className:e,...n},r)=>t.jsx(Tie,{ref:r,className:rp("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...n})));Rie.displayName=Tie.displayName;const Oie=i.forwardRef((({className:e,...n},r)=>t.jsx(Cie,{ref:r,className:rp("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})));Oie.displayName=Cie.displayName;const Pie=i.forwardRef((({className:e,...n},r)=>t.jsx(Aie,{ref:r,className:rp("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n})));Pie.displayName=Aie.displayName;const kie=({open:e,onOpenChange:n})=>t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{className:"max-w-[75vw] min-h-[75vh] overflow-y-auto max-h-[90vh] po",hideCloseButton:!0,children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Edit Campaign Content"}),t.jsx(FB,{children:"Edit the content of the campaign"})]}),t.jsx(MZ,{"aria-label":"Close dialog",onClick:()=>n(!1),className:"absolute top-3 right-3 z-20 rounded-full p-2 bg-white/80 shadow-lg border border-gray-200 hover:bg-primary/90 hover:text-white active:bg-primary/95 transition-all duration-200 focus:outline-none focus:ring-4 focus:ring-primary/30 focus:ring-offset-2 group",style:{boxShadow:"0 4px 24px 0 rgba(0,0,0,0.10)"},children:t.jsx(FZ.CloseButton,{className:"w-7 h-7 text-primary group-hover:text-white group-active:text-white transition-colors duration-200"})}),t.jsx(woe,{})]})}),jie=()=>t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"})]}),Mie=({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 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(jie,{}),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"})})]}),Lie=()=>{const e=bZ(),r=xZ(),{channelSenders:o}=V7(),{channelAccounts:i}=U7(),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===$7.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-1 overflow-hidden",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:["<",f,">"]})]})]}),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})]})]})},Die=({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(Mie,{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(Lie,{})})}),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($ne,{html:e,height:r.height,width:r.width})})]})},Iie=({expandDialogContent:e})=>{const[r,o]=n.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(PB,{open:r,onOpenChange:o,children:t.jsxs(MB,{hideCloseButton:!0,className:"w-[80vw] h-[80vh] max-w-none max-h-none bg-transparent border-none",children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Expanded Preview"}),t.jsx(FB,{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(MZ,{variant:"ghost",size:"sm",onClick:()=>o(!1),children:t.jsx(FZ.CloseButton,{className:"w-4 h-4 text-primary"})})})]})]})}),t.jsx(MZ,{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(FZ.ExpandIcon,{className:"w-4 h-4 text-muted-foreground"})})]})},Fie=({type:e,disablePreviewSubtext:n=!1})=>{const r="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?FZ.SmsIcon:FZ.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 ",r," Content Yet"]}),!n&&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 ",r," message."]})]})})},Uie=({onClick:e})=>t.jsxs(MZ,{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(FZ.PreviewButton,{className:"w-4 h-4"}),t.jsx("span",{className:"font-medium text-sm",children:"Test"})]}),$ie=e=>/^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/.test(e),Vie=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"))},Bie=e=>{const t=e.replace(/\D/g,"");if(10===t.length)return`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`;if(11===t.length&&t.startsWith("1"))return`+1 (${t.slice(1,4)}) ${t.slice(4,7)}-${t.slice(7)}`;if(t.length>0){const n=e.startsWith("+")?"+":"",r=t.slice((e.startsWith("+"),0));return`${n}${r.match(/.{1,4}/g)?.join("-")||r}`}return e},zie=({automation:e,type:r,setOpenSendPreviewPopup:o,open:i})=>{const[a,s]=n.useState(""),[l,c]=n.useState(""),[u,d]=n.useState(null),[p,f]=n.useState(!1),[h,m]=n.useState(""),{sendTestCommunication:g,sendError:v,isSendSuccess:y}=aZ(),{toast:b}=Il(),x=e.actionData?.find((e=>"send_communication"===e.actionType)),w=x?.actionMetadata.communicationGroupId,{communicationGroup:_,isGetting:S}=oZ(w??void 0),{data:E}=pZ({includeSegments:e.includeSegmentIds,excludeSegments:e.excludeSegmentIds,automationId:e.id}),T=n.useCallback((()=>{if(!w)return Promise.resolve(null);if(!_)return Promise.reject(new Error("Communication group not loaded"));switch(r){case"email":return Promise.resolve(_.emailChannelSenderId);case"sms":return Promise.resolve(_.smsChannelSenderId);default:return Promise.reject(new Error(`Unsupported type: ${r}`))}}),[_,r,w]);n.useEffect((()=>{(async()=>{try{const e=await T();d(e)}catch(e){d(null)}finally{f(!0)}})()}),[T]),n.useEffect((()=>{y&&(b({title:"Success",description:`Preview ${"email"===r?"email":"SMS"} sent successfully!`}),o(!1))}),[y,r,o,b]),n.useEffect((()=>{v&&(b({title:"Error",description:`Failed to send preview: ${v.message}`,variant:"destructive"}),o(!1))}),[v,b,o]),n.useEffect((()=>{i&&(s(""),c(""),m(""))}),[i]);return p&&!S&&E?u?t.jsxs("div",{className:"",children:[t.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:["Send Test ","email"===r?"Email":"Text"]}),t.jsx(s5,{type:"email"===r?"email":"tel",placeholder:"email"===r?"Enter email address":"Enter phone number",value:a,onChange:e=>{s(e.target.value),c("")},className:"w-full px-3 py-3 border border-gray-300 rounded-lg text-base \n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent\n placeholder-gray-400"}),t.jsxs("p",{className:"text-sm text-muted-foreground mt-1.5",children:["Enter a valid ","email"===r?"email address":"phone number"," to send a test to that recipient."]}),t.jsx("div",{className:"my-4 border-t border-gray-200"}),t.jsxs("div",{className:"mb-4",children:[t.jsxs(Pne,{value:h,onValueChange:e=>{m(e)},children:[t.jsx(Mne,{className:"w-full bg-white border border-gray-300 rounded-lg text-base\n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:t.jsx(jne,{children:h?E?.recipients.find((e=>e.id===h))?.firstName+" "+E?.recipients.find((e=>e.id===h))?.lastName:"Preview as"})}),t.jsx(Ine,{children:t.jsx(kne,{children:(E?.recipients??[]).map((e=>t.jsx(Fne,{value:e.id,className:"cursor-pointer hover:bg-gray-50",children:t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{className:"font-medium",children:[e.firstName," ",e.lastName]}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.email&&`Email: ${e.email}`,e.email&&e.phone&&" • ",e.phone&&`Phone: ${e.phone}`]})]})},`${e.firstName}-${e.lastName}`)))})})]}),t.jsx("p",{className:"text-sm text-muted-foreground mt-1.5",children:"Optional: Test as a specific recipient to see how the message will appear with their data. If not selected, raw merge tags will be used."})]}),l&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-4 border-t border-gray-200"}),t.jsx("p",{className:"text-red-500 text-sm mb-4 -mt-2",children:l})]}),t.jsx(MZ,{onClick:()=>{if(!("email"===r?$ie(a):Vie(a)))return void c("Please enter a valid "+("email"===r?"email address":"phone number"));if(!u)return void c("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);g({id:n,params:"email"===r?{emailAddress:a,previewAsRecipientId:h}:{phoneNumber:a,previewAsRecipientId:h}})},disabled:!a,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 Test"})]}):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(FZ.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"})]})}):t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsx(EZ,{text:["Fetching sender data","Fetching recipients"]})})},Hie=({open:e,onOpenChange:n,automation:r})=>t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Send Preview Email"}),t.jsx(FB,{children:"Send a preview email to the automation."})]}),t.jsx(zie,{automation:r,type:"email",setOpenSendPreviewPopup:n,open:e})]})}),qie=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1})=>{const i=bZ(),a=xZ(),[s,l]=n.useState({width:0,height:0}),[c,u]=n.useState(!1),[d,p]=n.useState(!1),f=n.useRef(null);if(n.useEffect((()=>{const e=()=>{f.current&&requestAnimationFrame((()=>{l({width:f.current?f.current.offsetWidth-75:0,height:f.current?f.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[f]),!i||!a)return null;const h=a?.emailHtmlBody||"",m=a?.emailChannelSenderId&&h.length>0;return t.jsxs("div",{className:"flex-1 flex flex-col items-center w-full",children:[t.jsx(kie,{open:d,onOpenChange:p}),t.jsx(Hie,{open:c,onOpenChange:u,automation:i}),t.jsx(Mie,{actionButtons:t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex items-center space-x-2",children:[!e&&m&&t.jsx(Uie,{onClick:()=>u(!0)}),(i.status===ze.DRAFT||!r)&&t.jsx(MZ,{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:()=>p(!0),children:"Edit content"}),m&&t.jsx(Iie,{expandDialogContent:t.jsx(Die,{emailBody:h})})]})}),children:m?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(Lie,{})})}),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 min-h-[500px]",ref:f,children:t.jsx($ne,{html:h,height:s.height,width:s.width})})]}):t.jsx(Fie,{type:"email",disablePreviewSubtext:o})})]})},Gie={all:["sms-registration-application"]},Kie=async()=>(await Oe(`${f}/`)).data,Wie=()=>{const e=ue(),t=be({mutationFn:e=>(async e=>(await Oe(`${f}/`,{method:"POST",body:JSON.stringify({application:e.application})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:Gie.all})}});return{createSmsRegistrationApplication:t.mutate,isCreating:t.isPending,createError:t.error,isCreateSuccess:t.isSuccess}};var Yie,Xie,Zie;(Xie=Yie||(Yie={})).assertEqual=e=>e,Xie.assertIs=function(e){},Xie.assertNever=function(e){throw new Error},Xie.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Xie.getValidEnumValues=e=>{const t=Xie.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return Xie.objectValues(n)},Xie.objectValues=e=>Xie.objectKeys(e).map((function(t){return e[t]})),Xie.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},Xie.find=(e,t)=>{for(const n of e)if(t(n))return n},Xie.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,Xie.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},Xie.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Zie||(Zie={})).mergeShapes=(e,t)=>({...e,...t});const Qie=Yie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jie=e=>{switch(typeof e){case"undefined":return Qie.undefined;case"string":return Qie.string;case"number":return isNaN(e)?Qie.nan:Qie.number;case"boolean":return Qie.boolean;case"function":return Qie.function;case"bigint":return Qie.bigint;case"symbol":return Qie.symbol;case"object":return Array.isArray(e)?Qie.array:null===e?Qie.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Qie.promise:"undefined"!=typeof Map&&e instanceof Map?Qie.map:"undefined"!=typeof Set&&e instanceof Set?Qie.set:"undefined"!=typeof Date&&e instanceof Date?Qie.date:Qie.object;default:return Qie.unknown}},eae=Yie.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 tae 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 tae))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Yie.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()}}tae.create=e=>new tae(e);const nae=(e,t)=>{let n;switch(e.code){case eae.invalid_type:n=e.received===Qie.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case eae.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Yie.jsonStringifyReplacer)}`;break;case eae.unrecognized_keys:n=`Unrecognized key(s) in object: ${Yie.joinValues(e.keys,", ")}`;break;case eae.invalid_union:n="Invalid input";break;case eae.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Yie.joinValues(e.options)}`;break;case eae.invalid_enum_value:n=`Invalid enum value. Expected ${Yie.joinValues(e.options)}, received '${e.received}'`;break;case eae.invalid_arguments:n="Invalid function arguments";break;case eae.invalid_return_type:n="Invalid function return type";break;case eae.invalid_date:n="Invalid date";break;case eae.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}"`:Yie.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case eae.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 eae.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 eae.custom:n="Invalid input";break;case eae.invalid_intersection_types:n="Intersection results could not be merged";break;case eae.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case eae.not_finite:n="Number must be finite";break;default:n=t.defaultError,Yie.assertNever(e)}return{message:n}};let rae=nae;function oae(){return rae}const iae=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 aae(e,t){const n=oae(),r=iae({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===nae?void 0:nae].filter((e=>!!e))});e.common.issues.push(r)}class sae{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 lae;"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 sae.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 lae;if("aborted"===o.status)return lae;"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 lae=Object.freeze({status:"aborted"}),cae=e=>({status:"dirty",value:e}),uae=e=>({status:"valid",value:e}),dae=e=>"aborted"===e.status,pae=e=>"dirty"===e.status,fae=e=>"valid"===e.status,hae=e=>"undefined"!=typeof Promise&&e instanceof Promise;function mae(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 gae(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 vae,yae,bae,xae;"function"==typeof SuppressedError&&SuppressedError,(yae=vae||(vae={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},yae.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class wae{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 _ae=(e,t)=>{if(fae(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 tae(e.common.issues);return this._error=t,this._error}}};function Sae(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 Eae{get description(){return this._def.description}_getType(e){return Jie(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Jie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sae,ctx:{common:e.parent.common,data:e.data,parsedType:Jie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(hae(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:Jie(e)},o=this._parseSync({data:e,path:r.path,parent:r});return _ae(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:Jie(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return fae(t)?{value:t.value}:{issues:r.common.issues}}catch(FTe){(null===(n=null===(t=null==FTe?void 0:FTe.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=>fae(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:Jie(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(hae(r)?r:Promise.resolve(r));return _ae(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:eae.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 Tse({schema:this,typeName:Fse.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 Cse.create(this,this._def)}nullable(){return Ase.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ase.create(this)}promise(){return Ese.create(this,this._def)}or(e){return cse.create([this,e],this._def)}and(e){return fse.create(this,e,this._def)}transform(e){return new Tse({...Sae(this._def),schema:this,typeName:Fse.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Nse({...Sae(this._def),innerType:this,defaultValue:t,typeName:Fse.ZodDefault})}brand(){return new kse({typeName:Fse.ZodBranded,type:this,...Sae(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Rse({...Sae(this._def),innerType:this,catchValue:t,typeName:Fse.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jse.create(this,e)}readonly(){return Mse.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Tae=/^c[^\s-]{8,}$/i,Cae=/^[0-9a-z]+$/,Aae=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nae=/^[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,Rae=/^[a-z0-9_-]{21}$/i,Oae=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pae=/^[-+]?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)?)??$/,kae=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let jae;const Mae=/^(?:(?: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])$/,Lae=/^(?:(?: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])$/,Dae=/^(([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]))$/,Iae=/^(([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])$/,Fae=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Uae=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$ae="((\\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])))",Vae=new RegExp(`^${$ae}$`);function Bae(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 zae(e){return new RegExp(`^${Bae(e)}$`)}function Hae(e){let t=`${$ae}T${Bae(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 qae(e,t){if(!Oae.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(UTe){return!1}}function Gae(e,t){return!("v4"!==t&&t||!Lae.test(e))||!("v6"!==t&&t||!Iae.test(e))}class Kae extends Eae{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Qie.string){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.string,received:t.parsedType}),lae}const t=new sae;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.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),aae(n,{code:eae.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?aae(n,{code:eae.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&aae(n,{code:eae.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)kae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"email",code:eae.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)jae||(jae=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"emoji",code:eae.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)Nae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"uuid",code:eae.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)Rae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"nanoid",code:eae.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)Tae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"cuid",code:eae.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)Cae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"cuid2",code:eae.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)Aae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"ulid",code:eae.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(UTe){n=this._getOrReturnCtx(e,n),aae(n,{validation:"url",code:eae.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),aae(n,{validation:"regex",code:eae.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),aae(n,{code:eae.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),aae(n,{code:eae.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),aae(n,{code:eae.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){Hae(i).test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Vae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){zae(i).test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?Pae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"duration",code:eae.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!Mae.test(r))&&("v6"!==o&&o||!Dae.test(r))&&(n=this._getOrReturnCtx(e,n),aae(n,{validation:"ip",code:eae.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?qae(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"jwt",code:eae.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Gae(e.data,i.version)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"cidr",code:eae.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?Fae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"base64",code:eae.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Uae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"base64url",code:eae.invalid_string,message:i.message}),t.dirty()):Yie.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:eae.invalid_string,...vae.errToObj(n)})}_addCheck(e){return new Kae({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...vae.errToObj(e)})}url(e){return this._addCheck({kind:"url",...vae.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...vae.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...vae.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...vae.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...vae.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...vae.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...vae.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...vae.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...vae.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...vae.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...vae.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...vae.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,...vae.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,...vae.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...vae.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...vae.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...vae.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...vae.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...vae.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...vae.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...vae.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...vae.errToObj(t)})}nonempty(e){return this.min(1,vae.errToObj(e))}trim(){return new Kae({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Kae({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Kae({...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 Wae(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)}Kae.create=e=>{var t;return new Kae({checks:[],typeName:Fse.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Sae(e)})};class Yae extends Eae{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)!==Qie.number){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.number,received:t.parsedType}),lae}let t;const n=new sae;for(const r of this._def.checks)if("int"===r.kind)Yie.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),aae(t,{code:eae.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),aae(t,{code:eae.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),aae(t,{code:eae.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==Wae(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),aae(t,{code:eae.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),aae(t,{code:eae.not_finite,message:r.message}),n.dirty()):Yie.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,vae.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vae.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vae.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vae.toString(t))}setLimit(e,t,n,r){return new Yae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:vae.toString(r)}]})}_addCheck(e){return new Yae({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:vae.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:vae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:vae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:vae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:vae.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vae.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:vae.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:vae.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:vae.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&&Yie.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)}}Yae.create=e=>new Yae({checks:[],typeName:Fse.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Sae(e)});class Xae extends Eae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(UTe){return this._getInvalidInput(e)}if(this._getType(e)!==Qie.bigint)return this._getInvalidInput(e);let t;const n=new sae;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),aae(t,{code:eae.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),aae(t,{code:eae.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),aae(t,{code:eae.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Yie.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.bigint,received:t.parsedType}),lae}gte(e,t){return this.setLimit("min",e,!0,vae.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vae.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vae.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vae.toString(t))}setLimit(e,t,n,r){return new Xae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:vae.toString(r)}]})}_addCheck(e){return new Xae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:vae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:vae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:vae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:vae.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vae.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}}Xae.create=e=>{var t;return new Xae({checks:[],typeName:Fse.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Sae(e)})};class Zae extends Eae{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Qie.boolean){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.boolean,received:t.parsedType}),lae}return uae(e.data)}}Zae.create=e=>new Zae({typeName:Fse.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Sae(e)});class Qae extends Eae{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Qie.date){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.date,received:t.parsedType}),lae}if(isNaN(e.data.getTime())){return aae(this._getOrReturnCtx(e),{code:eae.invalid_date}),lae}const t=new sae;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.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),aae(n,{code:eae.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Yie.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qae({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:vae.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:vae.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}}Qae.create=e=>new Qae({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Fse.ZodDate,...Sae(e)});class Jae extends Eae{_parse(e){if(this._getType(e)!==Qie.symbol){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.symbol,received:t.parsedType}),lae}return uae(e.data)}}Jae.create=e=>new Jae({typeName:Fse.ZodSymbol,...Sae(e)});class ese extends Eae{_parse(e){if(this._getType(e)!==Qie.undefined){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.undefined,received:t.parsedType}),lae}return uae(e.data)}}ese.create=e=>new ese({typeName:Fse.ZodUndefined,...Sae(e)});class tse extends Eae{_parse(e){if(this._getType(e)!==Qie.null){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.null,received:t.parsedType}),lae}return uae(e.data)}}tse.create=e=>new tse({typeName:Fse.ZodNull,...Sae(e)});class nse extends Eae{constructor(){super(...arguments),this._any=!0}_parse(e){return uae(e.data)}}nse.create=e=>new nse({typeName:Fse.ZodAny,...Sae(e)});class rse extends Eae{constructor(){super(...arguments),this._unknown=!0}_parse(e){return uae(e.data)}}rse.create=e=>new rse({typeName:Fse.ZodUnknown,...Sae(e)});class ose extends Eae{_parse(e){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.never,received:t.parsedType}),lae}}ose.create=e=>new ose({typeName:Fse.ZodNever,...Sae(e)});class ise extends Eae{_parse(e){if(this._getType(e)!==Qie.undefined){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.void,received:t.parsedType}),lae}return uae(e.data)}}ise.create=e=>new ise({typeName:Fse.ZodVoid,...Sae(e)});class ase extends Eae{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Qie.array)return aae(t,{code:eae.invalid_type,expected:Qie.array,received:t.parsedType}),lae;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(aae(t,{code:e?eae.too_big:eae.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&&(aae(t,{code:eae.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&&(aae(t,{code:eae.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 wae(t,e,t.path,n))))).then((e=>sae.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new wae(t,e,t.path,n))));return sae.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new ase({...this._def,minLength:{value:e,message:vae.toString(t)}})}max(e,t){return new ase({...this._def,maxLength:{value:e,message:vae.toString(t)}})}length(e,t){return new ase({...this._def,exactLength:{value:e,message:vae.toString(t)}})}nonempty(e){return this.min(1,e)}}function sse(e){if(e instanceof lse){const t={};for(const n in e.shape){t[n]=Cse.create(sse(e.shape[n]))}return new lse({...e._def,shape:()=>t})}return e instanceof ase?new ase({...e._def,type:sse(e.element)}):e instanceof Cse?Cse.create(sse(e.unwrap())):e instanceof Ase?Ase.create(sse(e.unwrap())):e instanceof hse?hse.create(e.items.map((e=>sse(e)))):e}ase.create=(e,t)=>new ase({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Fse.ZodArray,...Sae(t)});class lse extends Eae{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=Yie.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Qie.object){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.object,received:t.parsedType}),lae}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof ose&&"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 wae(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof ose){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&&(aae(n,{code:eae.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 wae(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=>sae.mergeObjectSync(t,e))):sae.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new lse({...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=vae.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new lse({...this._def,unknownKeys:"strip"})}passthrough(){return new lse({...this._def,unknownKeys:"passthrough"})}extend(e){return new lse({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new lse({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Fse.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new lse({...this._def,catchall:e})}pick(e){const t={};return Yie.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new lse({...this._def,shape:()=>t})}omit(e){const t={};return Yie.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new lse({...this._def,shape:()=>t})}deepPartial(){return sse(this)}partial(e){const t={};return Yie.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new lse({...this._def,shape:()=>t})}required(e){const t={};return Yie.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Cse;)e=e._def.innerType;t[n]=e}})),new lse({...this._def,shape:()=>t})}keyof(){return wse(Yie.objectKeys(this.shape))}}lse.create=(e,t)=>new lse({shape:()=>e,unknownKeys:"strip",catchall:ose.create(),typeName:Fse.ZodObject,...Sae(t)}),lse.strictCreate=(e,t)=>new lse({shape:()=>e,unknownKeys:"strict",catchall:ose.create(),typeName:Fse.ZodObject,...Sae(t)}),lse.lazycreate=(e,t)=>new lse({shape:e,unknownKeys:"strip",catchall:ose.create(),typeName:Fse.ZodObject,...Sae(t)});class cse extends Eae{_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 tae(e.ctx.common.issues)));return aae(t,{code:eae.invalid_union,unionErrors:n}),lae}));{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 tae(e)));return aae(t,{code:eae.invalid_union,unionErrors:o}),lae}}get options(){return this._def.options}}cse.create=(e,t)=>new cse({options:e,typeName:Fse.ZodUnion,...Sae(t)});const use=e=>e instanceof bse?use(e.schema):e instanceof Tse?use(e.innerType()):e instanceof xse?[e.value]:e instanceof _se?e.options:e instanceof Sse?Yie.objectValues(e.enum):e instanceof Nse?use(e._def.innerType):e instanceof ese?[void 0]:e instanceof tse?[null]:e instanceof Cse?[void 0,...use(e.unwrap())]:e instanceof Ase?[null,...use(e.unwrap())]:e instanceof kse||e instanceof Mse?use(e.unwrap()):e instanceof Rse?use(e._def.innerType):[];class dse extends Eae{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qie.object)return aae(t,{code:eae.invalid_type,expected:Qie.object,received:t.parsedType}),lae;const n=this.discriminator,r=this.optionsMap.get(t.data[n]);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(aae(t,{code:eae.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),lae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const o of t){const t=use(o.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,o)}}return new dse({typeName:Fse.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Sae(n)})}}function pse(e,t){const n=Jie(e),r=Jie(t);if(e===t)return{valid:!0,data:e};if(n===Qie.object&&r===Qie.object){const n=Yie.objectKeys(t),r=Yie.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=pse(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===Qie.array&&r===Qie.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=pse(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===Qie.date&&r===Qie.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class fse extends Eae{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(dae(e)||dae(r))return lae;const o=pse(e.value,r.value);return o.valid?((pae(e)||pae(r))&&t.dirty(),{status:t.value,value:o.data}):(aae(n,{code:eae.invalid_intersection_types}),lae)};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}))}}fse.create=(e,t,n)=>new fse({left:e,right:t,typeName:Fse.ZodIntersection,...Sae(n)});class hse extends Eae{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qie.array)return aae(n,{code:eae.invalid_type,expected:Qie.array,received:n.parsedType}),lae;if(n.data.length<this._def.items.length)return aae(n,{code:eae.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),lae;!this._def.rest&&n.data.length>this._def.items.length&&(aae(n,{code:eae.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 wae(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>sae.mergeArray(t,e))):sae.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new hse({...this._def,rest:e})}}hse.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hse({items:e,typeName:Fse.ZodTuple,rest:null,...Sae(t)})};class mse extends Eae{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!==Qie.object)return aae(n,{code:eae.invalid_type,expected:Qie.object,received:n.parsedType}),lae;const r=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)r.push({key:o._parse(new wae(n,a,n.path,a)),value:i._parse(new wae(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?sae.mergeObjectAsync(t,r):sae.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new mse(t instanceof Eae?{keyType:e,valueType:t,typeName:Fse.ZodRecord,...Sae(n)}:{keyType:Kae.create(),valueType:e,typeName:Fse.ZodRecord,...Sae(t)})}}class gse extends Eae{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!==Qie.map)return aae(n,{code:eae.invalid_type,expected:Qie.map,received:n.parsedType}),lae;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new wae(n,e,n.path,[i,"key"])),value:o._parse(new wae(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 lae;"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 lae;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}gse.create=(e,t,n)=>new gse({valueType:t,keyType:e,typeName:Fse.ZodMap,...Sae(n)});class vse extends Eae{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qie.set)return aae(n,{code:eae.invalid_type,expected:Qie.set,received:n.parsedType}),lae;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(aae(n,{code:eae.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&&(aae(n,{code:eae.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 lae;"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 wae(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new vse({...this._def,minSize:{value:e,message:vae.toString(t)}})}max(e,t){return new vse({...this._def,maxSize:{value:e,message:vae.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}vse.create=(e,t)=>new vse({valueType:e,minSize:null,maxSize:null,typeName:Fse.ZodSet,...Sae(t)});class yse extends Eae{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qie.function)return aae(t,{code:eae.invalid_type,expected:Qie.function,received:t.parsedType}),lae;function n(e,n){return iae({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oae(),nae].filter((e=>!!e)),issueData:{code:eae.invalid_arguments,argumentsError:n}})}function r(e,n){return iae({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oae(),nae].filter((e=>!!e)),issueData:{code:eae.invalid_return_type,returnTypeError:n}})}const o={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ese){const e=this;return uae((async function(...t){const a=new tae([]),s=await e._def.args.parseAsync(t,o).catch((e=>{throw a.addIssue(n(t,e)),a})),l=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(l,o).catch((e=>{throw a.addIssue(r(l,e)),a}))}))}{const e=this;return uae((function(...t){const a=e._def.args.safeParse(t,o);if(!a.success)throw new tae([n(t,a.error)]);const s=Reflect.apply(i,this,a.data),l=e._def.returns.safeParse(s,o);if(!l.success)throw new tae([r(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new yse({...this._def,args:hse.create(e).rest(rse.create())})}returns(e){return new yse({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new yse({args:e||hse.create([]).rest(rse.create()),returns:t||rse.create(),typeName:Fse.ZodFunction,...Sae(n)})}}class bse extends Eae{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})}}bse.create=(e,t)=>new bse({getter:e,typeName:Fse.ZodLazy,...Sae(t)});class xse extends Eae{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return aae(t,{received:t.data,code:eae.invalid_literal,expected:this._def.value}),lae}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wse(e,t){return new _se({values:e,typeName:Fse.ZodEnum,...Sae(t)})}xse.create=(e,t)=>new xse({value:e,typeName:Fse.ZodLiteral,...Sae(t)});class _se extends Eae{constructor(){super(...arguments),bae.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return aae(t,{expected:Yie.joinValues(this._def.values),received:t.parsedType,code:eae.invalid_type}),lae}if(mae(this,bae)||gae(this,bae,new Set(this._def.values)),!mae(this,bae).has(e.data)){const t=this._getOrReturnCtx(e);return aae(t,{received:t.data,code:eae.invalid_enum_value,options:this._def.values}),lae}return uae(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 _se.create(e,{...this._def,...t})}exclude(e,t=this._def){return _se.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}bae=new WeakMap,_se.create=wse;class Sse extends Eae{constructor(){super(...arguments),xae.set(this,void 0)}_parse(e){const t=Yie.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Qie.string&&n.parsedType!==Qie.number){const e=Yie.objectValues(t);return aae(n,{expected:Yie.joinValues(e),received:n.parsedType,code:eae.invalid_type}),lae}if(mae(this,xae)||gae(this,xae,new Set(Yie.getValidEnumValues(this._def.values))),!mae(this,xae).has(e.data)){const e=Yie.objectValues(t);return aae(n,{received:n.data,code:eae.invalid_enum_value,options:e}),lae}return uae(e.data)}get enum(){return this._def.values}}xae=new WeakMap,Sse.create=(e,t)=>new Sse({values:e,typeName:Fse.ZodNativeEnum,...Sae(t)});class Ese extends Eae{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qie.promise&&!1===t.common.async)return aae(t,{code:eae.invalid_type,expected:Qie.promise,received:t.parsedType}),lae;const n=t.parsedType===Qie.promise?t.data:Promise.resolve(t.data);return uae(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Ese.create=(e,t)=>new Ese({type:e,typeName:Fse.ZodPromise,...Sae(t)});class Tse extends Eae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Fse.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=>{aae(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 lae;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?lae:"dirty"===r.status||"dirty"===t.value?cae(r.value):r}));{if("aborted"===t.value)return lae;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?lae:"dirty"===r.status||"dirty"===t.value?cae(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?lae:("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?lae:("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(!fae(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=>fae(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}Yie.assertNever(r)}}Tse.create=(e,t,n)=>new Tse({schema:e,typeName:Fse.ZodEffects,effect:t,...Sae(n)}),Tse.createWithPreprocess=(e,t,n)=>new Tse({schema:t,effect:{type:"preprocess",transform:e},typeName:Fse.ZodEffects,...Sae(n)});class Cse extends Eae{_parse(e){return this._getType(e)===Qie.undefined?uae(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Cse.create=(e,t)=>new Cse({innerType:e,typeName:Fse.ZodOptional,...Sae(t)});class Ase extends Eae{_parse(e){return this._getType(e)===Qie.null?uae(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ase.create=(e,t)=>new Ase({innerType:e,typeName:Fse.ZodNullable,...Sae(t)});class Nse extends Eae{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Qie.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Nse.create=(e,t)=>new Nse({innerType:e,typeName:Fse.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Sae(t)});class Rse extends Eae{_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 hae(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new tae(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new tae(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Rse.create=(e,t)=>new Rse({innerType:e,typeName:Fse.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Sae(t)});class Ose extends Eae{_parse(e){if(this._getType(e)!==Qie.nan){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.nan,received:t.parsedType}),lae}return{status:"valid",value:e.data}}}Ose.create=e=>new Ose({typeName:Fse.ZodNaN,...Sae(e)});const Pse=Symbol("zod_brand");class kse extends Eae{_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 jse extends Eae{_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?lae:"dirty"===e.status?(t.dirty(),cae(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?lae:"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 jse({in:e,out:t,typeName:Fse.ZodPipeline})}}class Mse extends Eae{_parse(e){const t=this._def.innerType._parse(e),n=e=>(fae(e)&&(e.value=Object.freeze(e.value)),e);return hae(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Lse(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Dse(e,t={},n){return e?nse.create().superRefine(((r,o)=>{var i,a;const s=e(r);if(s instanceof Promise)return s.then((e=>{var i,a;if(!e){const e=Lse(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=Lse(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}})):nse.create()}Mse.create=(e,t)=>new Mse({innerType:e,typeName:Fse.ZodReadonly,...Sae(t)});const Ise={object:lse.lazycreate};var Fse,Use;(Use=Fse||(Fse={})).ZodString="ZodString",Use.ZodNumber="ZodNumber",Use.ZodNaN="ZodNaN",Use.ZodBigInt="ZodBigInt",Use.ZodBoolean="ZodBoolean",Use.ZodDate="ZodDate",Use.ZodSymbol="ZodSymbol",Use.ZodUndefined="ZodUndefined",Use.ZodNull="ZodNull",Use.ZodAny="ZodAny",Use.ZodUnknown="ZodUnknown",Use.ZodNever="ZodNever",Use.ZodVoid="ZodVoid",Use.ZodArray="ZodArray",Use.ZodObject="ZodObject",Use.ZodUnion="ZodUnion",Use.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Use.ZodIntersection="ZodIntersection",Use.ZodTuple="ZodTuple",Use.ZodRecord="ZodRecord",Use.ZodMap="ZodMap",Use.ZodSet="ZodSet",Use.ZodFunction="ZodFunction",Use.ZodLazy="ZodLazy",Use.ZodLiteral="ZodLiteral",Use.ZodEnum="ZodEnum",Use.ZodEffects="ZodEffects",Use.ZodNativeEnum="ZodNativeEnum",Use.ZodOptional="ZodOptional",Use.ZodNullable="ZodNullable",Use.ZodDefault="ZodDefault",Use.ZodCatch="ZodCatch",Use.ZodPromise="ZodPromise",Use.ZodBranded="ZodBranded",Use.ZodPipeline="ZodPipeline",Use.ZodReadonly="ZodReadonly";const $se=Kae.create,Vse=Yae.create,Bse=Ose.create,zse=Xae.create,Hse=Zae.create,qse=Qae.create,Gse=Jae.create,Kse=ese.create,Wse=tse.create,Yse=nse.create,Xse=rse.create,Zse=ose.create,Qse=ise.create,Jse=ase.create,ele=lse.create,tle=lse.strictCreate,nle=cse.create,rle=dse.create,ole=fse.create,ile=hse.create,ale=mse.create,sle=gse.create,lle=vse.create,cle=yse.create,ule=bse.create,dle=xse.create,ple=_se.create,fle=Sse.create,hle=Ese.create,mle=Tse.create,gle=Cse.create,vle=Ase.create,yle=Tse.createWithPreprocess,ble=jse.create,xle={string:e=>Kae.create({...e,coerce:!0}),number:e=>Yae.create({...e,coerce:!0}),boolean:e=>Zae.create({...e,coerce:!0}),bigint:e=>Xae.create({...e,coerce:!0}),date:e=>Qae.create({...e,coerce:!0})},wle=lae;var _le=Object.freeze({__proto__:null,defaultErrorMap:nae,setErrorMap:function(e){rae=e},getErrorMap:oae,makeIssue:iae,EMPTY_PATH:[],addIssueToContext:aae,ParseStatus:sae,INVALID:lae,DIRTY:cae,OK:uae,isAborted:dae,isDirty:pae,isValid:fae,isAsync:hae,get util(){return Yie},get objectUtil(){return Zie},ZodParsedType:Qie,getParsedType:Jie,ZodType:Eae,datetimeRegex:Hae,ZodString:Kae,ZodNumber:Yae,ZodBigInt:Xae,ZodBoolean:Zae,ZodDate:Qae,ZodSymbol:Jae,ZodUndefined:ese,ZodNull:tse,ZodAny:nse,ZodUnknown:rse,ZodNever:ose,ZodVoid:ise,ZodArray:ase,ZodObject:lse,ZodUnion:cse,ZodDiscriminatedUnion:dse,ZodIntersection:fse,ZodTuple:hse,ZodRecord:mse,ZodMap:gse,ZodSet:vse,ZodFunction:yse,ZodLazy:bse,ZodLiteral:xse,ZodEnum:_se,ZodNativeEnum:Sse,ZodPromise:Ese,ZodEffects:Tse,ZodTransformer:Tse,ZodOptional:Cse,ZodNullable:Ase,ZodDefault:Nse,ZodCatch:Rse,ZodNaN:Ose,BRAND:Pse,ZodBranded:kse,ZodPipeline:jse,ZodReadonly:Mse,custom:Dse,Schema:Eae,ZodSchema:Eae,late:Ise,get ZodFirstPartyTypeKind(){return Fse},coerce:xle,any:Yse,array:Jse,bigint:zse,boolean:Hse,date:qse,discriminatedUnion:rle,effect:mle,enum:ple,function:cle,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dse((t=>t instanceof e),t),intersection:ole,lazy:ule,literal:dle,map:sle,nan:Bse,nativeEnum:fle,never:Zse,null:Wse,nullable:vle,number:Vse,object:ele,oboolean:()=>Hse().optional(),onumber:()=>Vse().optional(),optional:gle,ostring:()=>$se().optional(),pipeline:ble,preprocess:yle,promise:hle,record:ale,set:lle,strictObject:tle,string:$se,symbol:Gse,transformer:mle,tuple:ile,undefined:Kse,union:nle,unknown:Xse,void:Qse,NEVER:wle,ZodIssueCode:eae,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:tae}),Sle=(e=>(e.AWS_TOLL_FREE_NUMBER="aws_toll_free_number",e))(Sle||{}),Ele=(e=>(e.TWO_FACTOR_AUTH="two_factor_authentication",e.ONE_TIME_PASSWORD="one_time_passwords",e.NOTIFICATIONS="notifications",e.POLLING_SURVEYS="polling_and_surveys",e.INFO_ON_DEMAND="info_on_demand",e.PROMOTIONS_MARKETING="promotions_and_marketing",e.OTHER="other",e))(Ele||{});const Tle=_le.object({type:_le.literal("aws_toll_free_number"),tollFreeNumber:_le.string(),company:_le.object({name:_le.string().describe("The legal name of the company"),website:_le.string().url(),address1:_le.string(),address2:_le.string().optional(),city:_le.string(),stateProvince:_le.string(),zipCode:_le.string(),country:_le.string().length(2)}),contact:_le.object({firstName:_le.string(),lastName:_le.string(),email:_le.string().email(),phoneNumber:_le.string().regex(/^\+\d+$/,{message:"Phone number must start with '+' and contain only digits"})}),messagingUseCase:_le.object({monthlyVolume:_le.number().int().positive(),category:_le.nativeEnum(Ele),useCaseDetails:_le.string().optional().refine((e=>void 0!==e||""!==e),{message:"Use case details are required when category is 'Other'"})}),messageSamples:_le.array(_le.string()).min(1).max(3).describe("Enter an example message of an SMS message body that will be sent to your end users")}),Cle=_le.discriminatedUnion("type",[Tle]);var Ale=(e=>(e.PENDING="pending",e.APPROVED="approved",e.REJECTED="rejected",e))(Ale||{}),Nle=e=>"checkbox"===e.type,Rle=e=>e instanceof Date,Ole=e=>null==e;const Ple=e=>"object"==typeof e;var kle=e=>!Ole(e)&&!Array.isArray(e)&&Ple(e)&&!Rle(e),jle=e=>kle(e)&&e.target?Nle(e.target)?e.target.checked:e.target.value:e,Mle=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Lle="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Dle(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(Lle&&(e instanceof Blob||r)||!n&&!kle(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return kle(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=Dle(e[n]));else t=e}return t}var Ile=e=>Array.isArray(e)?e.filter(Boolean):[],Fle=e=>void 0===e,Ule=(e,t,n)=>{if(!t||!kle(e))return n;const r=Ile(t.split(/[,[\].]+?/)).reduce(((e,t)=>Ole(e)?e:e[t]),e);return Fle(r)||r===e?Fle(e[t])?n:e[t]:r},$le=e=>"boolean"==typeof e,Vle=e=>/^\w*$/.test(e),Ble=e=>Ile(e.replace(/["|']|\]/g,"").split(/\.|\[/)),zle=(e,t,n)=>{let r=-1;const o=Vle(t)?[t]:Ble(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=kle(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const Hle="blur",qle="focusout",Gle="change",Kle="onBlur",Wle="onChange",Yle="onSubmit",Xle="onTouched",Zle="all",Qle="max",Jle="min",ece="maxLength",tce="minLength",nce="pattern",rce="required",oce="validate",ice=n.createContext(null),ace=()=>n.useContext(ice);var sce=(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]!==Zle&&(t._proxyFormState[o]=!r||Zle),n&&(n[o]=!0),e[o]}});return o},lce=e=>Ole(e)||!Ple(e);function cce(e,t){if(lce(e)||lce(t))return e===t;if(Rle(e)&&Rle(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(Rle(n)&&Rle(e)||kle(n)&&kle(e)||Array.isArray(n)&&Array.isArray(e)?!cce(n,e):n!==e)return!1}}return!0}const uce=(e,t)=>{const r=n.useRef(t);cce(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var dce=e=>"string"==typeof e,pce=(e,t,n,r,o)=>dce(e)?(r&&t.watch.add(e),Ule(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),Ule(n,e)))):(r&&(t.watchAll=!0),n);function fce(e){const t=ace(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=Mle(i._names.array,r),l=function(e){const t=ace(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return uce((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c(pce(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:Ule(i._formValues,r,Ule(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=ace(),{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 uce((()=>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((()=>sce(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,...$le(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ule(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!Ule(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Ule(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Ule(c.validatingFields,r)},error:{enumerable:!0,get:()=>Ule(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:jle(e),name:r},type:Gle})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:Ule(i._formValues,r),name:r},type:Hle})),[r,i._formValues]),m=n.useCallback((e=>{const t=Ule(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,...$le(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,...$le(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=Ule(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=Dle(Ule(i._options.defaultValues,r));zle(i._defaultValues,r,e),Fle(Ule(i._formValues,r))&&zle(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 hce=e=>e.render(fce(e));var mce=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},gce=e=>Array.isArray(e)?e:[e],vce=()=>{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=[]}}},yce=e=>kle(e)&&!Object.keys(e).length,bce=e=>"file"===e.type,xce=e=>"function"==typeof e,wce=e=>{if(!Lle)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},_ce=e=>"select-multiple"===e.type,Sce=e=>"radio"===e.type,Ece=e=>wce(e)&&e.isConnected;function Tce(e,t){const n=Array.isArray(t)?t:Vle(t)?[t]:Ble(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Fle(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(kle(r)&&yce(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fle(e[t]))return!1;return!0}(r))&&Tce(e,n.slice(0,-1)),e}var Cce=e=>{for(const t in e)if(xce(e[t]))return!0;return!1};function Ace(e,t={}){const n=Array.isArray(e);if(kle(e)||n)for(const r in e)Array.isArray(e[r])||kle(e[r])&&!Cce(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Ace(e[r],t[r])):Ole(e[r])||(t[r]=!0);return t}function Nce(e,t,n){const r=Array.isArray(e);if(kle(e)||r)for(const o in e)Array.isArray(e[o])||kle(e[o])&&!Cce(e[o])?Fle(t)||lce(n[o])?n[o]=Array.isArray(e[o])?Ace(e[o],[]):{...Ace(e[o])}:Nce(e[o],Ole(t)?{}:t[o],n[o]):n[o]=!cce(e[o],t[o]);return n}var Rce=(e,t)=>Nce(e,t,Ace(t));const Oce={value:!1,isValid:!1},Pce={value:!0,isValid:!0};var kce=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&&!Fle(e[0].attributes.value)?Fle(e[0].value)||""===e[0].value?Pce:{value:e[0].value,isValid:!0}:Pce:Oce}return Oce},jce=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Fle(e)?e:t?""===e?NaN:e?+e:e:n&&dce(e)?new Date(e):r?r(e):e;const Mce={isValid:!1,value:null};var Lce=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),Mce):Mce;function Dce(e){const t=e.ref;return bce(t)?t.files:Sce(t)?Lce(e.refs).value:_ce(t)?[...t.selectedOptions].map((({value:e})=>e)):Nle(t)?kce(e.refs).value:jce(Fle(t.value)?e.ref.value:t.value,e)}var Ice=e=>e instanceof RegExp,Fce=e=>Fle(e)?e:Ice(e)?e.source:kle(e)?Ice(e.value)?e.value.source:e.value:e,Uce=e=>({isOnSubmit:!e||e===Yle,isOnBlur:e===Kle,isOnChange:e===Wle,isOnAll:e===Zle,isOnTouch:e===Xle});const $ce="AsyncFunction";var Vce=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const Bce=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=Ule(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(Bce(i,t))break}else if(kle(i)&&Bce(i,t))break}}};function zce(e,t,n){const r=Ule(e,n);if(r||Vle(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=Ule(t,r),a=Ule(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 Hce=(e,t,n)=>{const r=gce(Ule(e,n));return zle(r,"root",t[n]),zle(e,n,r),e},qce=e=>dce(e);function Gce(e,t,n="validate"){if(qce(e)||Array.isArray(e)&&e.every(qce)||$le(e)&&!e)return{type:n,message:qce(e)?e:"",ref:t}}var Kce=e=>kle(e)&&!Ice(e)?e:{value:e,message:""},Wce=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=Ule(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,x=e=>{o&&b.reportValidity&&(b.setCustomValidity($le(e)?"":e||""),b.reportValidity())},w={},_=Sce(a),S=Nle(a),E=_||S,T=(g||bce(a))&&Fle(a.value)&&Fle(y)||wce(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=mce.bind(null,m,r,w),A=(e,t,n,r=ece,o=tce)=>{const i=e?t:n;w[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(i?!Array.isArray(y)||!y.length:l&&(!E&&(T||Ole(y))||$le(y)&&!y||S&&!kce(s).isValid||_&&!Lce(s).isValid)){const{value:e,message:t}=qce(l)?{value:!!l,message:l}:Kce(l);if(e&&(w[m]={type:rce,message:t,ref:b,...C(rce,t)},!r))return x(t),w}if(!(T||Ole(d)&&Ole(p))){let e,t;const n=Kce(p),o=Kce(d);if(Ole(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;dce(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),dce(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);Ole(n.value)||(e=r>n.value),Ole(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,Qle,Jle),!r))return x(w[m].message),w}if((c||u)&&!T&&(dce(y)||i&&Array.isArray(y))){const e=Kce(c),t=Kce(u),n=!Ole(e.value)&&y.length>+e.value,o=!Ole(t.value)&&y.length<+t.value;if((n||o)&&(A(n,e.message,t.message),!r))return x(w[m].message),w}if(f&&!T&&dce(y)){const{value:e,message:t}=Kce(f);if(Ice(e)&&!y.match(e)&&(w[m]={type:nce,message:t,ref:a,...C(nce,t)},!r))return x(t),w}if(h)if(xce(h)){const e=Gce(await h(y,n),b);if(e&&(w[m]={...e,...C(oce,e.message)},!r))return x(e.message),w}else if(kle(h)){let e={};for(const t in h){if(!yce(e)&&!r)break;const o=Gce(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},x(o.message),r&&(w[m]=e))}if(!yce(e)&&(w[m]={ref:b,...e},!r))return w}return x(!0),w};const Yce={mode:Yle,reValidateMode:Wle,shouldFocusError:!0};function Xce(e={}){let t={...Yce,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:xce(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=(kle(t.defaultValues)||kle(t.values))&&Dle(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:Dle(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:vce(),state:vce()},f=Uce(t.mode),h=Uce(t.reValidateMode),m=t.criteriaMode===Zle,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?yce((await w()).errors):await _(r,!0);e!==n.isValid&&p.state.next({isValid:e})}},v=(e,r)=>{!t.disabled&&(u.isValidating||u.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(r?zle(n.validatingFields,e,r):Tce(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!yce(n.validatingFields)}))},y=(e,t,n,o)=>{const l=Ule(r,e);if(l){const r=Ule(a,e,Fle(n)?Ule(i,e):n);Fle(r)||o&&o.defaultChecked||t?zle(a,e,t?r:Dce(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=cce(Ule(i,e),r);c=!!Ule(n.dirtyFields,e),t?Tce(n.dirtyFields,e):zle(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=Ule(n.touchedFields,e);t||(zle(n.touchedFields,e,o),f.touchedFields=n.touchedFields,l=l||(u.touchedFields||d.touchedFields)&&t!==o)}l&&s&&p.state.next(f)}return l?f:{}},x=(e,r,i,a)=>{const s=Ule(n.errors,e),l=(u.isValid||d.isValid)&&$le(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{zle(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?zle(n.errors,e,i):Tce(n.errors,e)),(i?!cce(s,i):s)||!yce(a)||l){const t={...a,...l&&$le(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{v(e,!0);const n=await t.resolver(a,t.context,((e,t,n,r)=>{const o={};for(const i of e){const e=Ule(t,i);e&&zle(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&&!!(xce(i.validate)&&i.validate.constructor.name===$ce||kle(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===$ce))));p&&u.validatingFields&&v([s],!0);const f=await Wce(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(Ule(f,e.name)?d?Hce(n.errors,f,e.name):zle(n.errors,e.name,f[e.name]):Tce(n.errors,e.name))}!yce(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&zle(a,e,n),!cce(P(),i)),E=(e,t,n)=>pce(e,l,{...s.mount?a:Fle(t)?i:dce(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=Ule(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&zle(a,e,jce(t,n)),i=wce(n.ref)&&Ole(t)?"":t,_ce(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?Nle(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)):bce(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:Dle(a)})))}(n.shouldDirty||n.shouldTouch)&&b(e,i,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&O(e)},C=(e,t,n)=>{for(const o in t){const i=t[o],a=`${e}.${o}`,s=Ule(r,a);(l.array.has(e)||kle(i)||s&&!s._f)&&!Rle(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=Ule(r,e),f=l.array.has(e),h=Dle(t);zle(a,e,h),f?(p.array.next({name:e,values:Dle(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:Rce(i,a),isDirty:S(e,h)})):!c||c._f||Ole(h)?T(e,h,o):C(e,h,o),Vce(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:Dle(a)})},N=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=Ule(r,c),E=e=>{y=Number.isNaN(e)||Rle(e)&&isNaN(e.getTime())||cce(e,Ule(a,c,e))};if(S){let s,C;const A=i.type?Dce(S._f):jle(e),N=e.type===Hle||e.type===qle,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||Ule(n.errors,c)||S._f.deps)||((e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e))(N,Ule(n.touchedFields,c),n.isSubmitted,h,f),P=Vce(c,l,N);zle(a,c,A),N?(S._f.onBlur&&S._f.onBlur(e),o&&o(0)):S._f.onChange&&S._f.onChange(e);const k=b(c,A,N),j=!yce(k)||P;if(!N&&p.state.next({name:c,type:e.type,values:Dle(a)}),R)return(u.isValid||d.isValid)&&("onBlur"===t.mode?N&&g():N||g()),j&&p.state.next({name:c,...P?{}:k});if(!N&&P&&p.state.next({...n}),t.resolver){const{errors:e}=await w([c]);if(E(A),y){const t=zce(n.errors,r,c),o=zce(e,r,t.name||c);s=o.error,c=o.name,C=yce(e)}}else v([c],!0),s=(await Wce(S,l.disabled,a,m,t.shouldUseNativeValidation))[c],v([c]),E(A),y&&(s?C=!1:(u.isValid||d.isValid)&&(C=await _(r,!0)));y&&(S._f.deps&&O(S._f.deps),x(c,C,s,k))}var T},R=(e,t)=>{if(Ule(n.errors,t)&&e.focus)return e.focus(),1},O=async(e,o={})=>{let i,a;const s=gce(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=Ule(t,r);e?zle(n.errors,r,e):Tce(n.errors,r)}else n.errors=t;return t})(Fle(e)?e:s);i=yce(t),a=e?!s.some((e=>Ule(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=Ule(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!dce(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&Bce(r,R,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return Fle(e)?t:dce(e)?Ule(t,e):e.map((e=>Ule(t,e)))},k=(e,t)=>({invalid:!!Ule((t||n).errors,e),isDirty:!!Ule((t||n).dirtyFields,e),error:Ule((t||n).errors,e),isValidating:!!Ule(n.validatingFields,e),isTouched:!!Ule((t||n).touchedFields,e)}),j=(e,t,o)=>{const i=(Ule(r,e,{_f:{}})._f||{}).ref,a=Ule(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;zle(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()},M=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!gce(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 yce(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||Zle)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,L=(e,o={})=>{for(const s of e?gce(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(Tce(r,s),Tce(a,s)),!o.keepError&&Tce(n.errors,s),!o.keepDirty&&Tce(n.dirtyFields,s),!o.keepTouched&&Tce(n.touchedFields,s),!o.keepIsValidating&&Tce(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&Tce(i,s);p.state.next({values:Dle(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},D=({disabled:e,name:t})=>{($le(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=Ule(r,e);const a=$le(n.disabled)||$le(t.disabled);return zle(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?D({disabled:$le(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:Fce(n.min),max:Fce(n.max),minLength:Fce(n.minLength),maxLength:Fce(n.maxLength),pattern:Fce(n.pattern)}:{},name:e,onChange:N,onBlur:N,ref:a=>{if(a){I(e,n),o=Ule(r,e);const t=Fle(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>Sce(e)||Nle(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;zle(r,e,{_f:{...o._f,...s?{refs:[...l.filter(Ece),t,...Array.isArray(Ule(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=Ule(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!Mle(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&Bce(r,R,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=Dle(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await w();n.errors=e,c=t}else await _(r);if(l.disabled.size)for(const e of l.disabled)zle(c,e,void 0);if(Tce(n.errors,"root"),yce(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:yce(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?Dle(e):i,d=Dle(c),f=yce(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Rce(i,a))]);for(const t of Array.from(e))Ule(n.dirtyFields,t)?zle(h,t,Ule(a,t)):A(t,Ule(h,t))}else{if(Lle&&Fle(e))for(const e of l.mount){const t=Ule(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(wce(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,Ule(h,e))}a=Dle(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||cce(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?Rce(i,a):n.dirtyFields:o.keepDefaultValues&&e?Rce(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)=>$(xce(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:L,getFieldState:k,handleSubmit:U,setError:j,_subscribe:M,_runSchema:w,_getWatch:E,_getDirty:S,_setValid:g,_setFieldArray:(e,o=[],l,c,f=!0,h=!0)=>{if(c&&l&&!t.disabled){if(s.action=!0,h&&Array.isArray(Ule(r,e))){const t=l(Ule(r,e),c.argA,c.argB);f&&zle(r,e,t)}if(h&&Array.isArray(Ule(n.errors,e))){const t=l(Ule(n.errors,e),c.argA,c.argB);f&&zle(n.errors,e,t),((e,t)=>{!Ile(Ule(e,t)).length&&Tce(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(Ule(n.touchedFields,e))){const t=l(Ule(n.touchedFields,e),c.argA,c.argB);f&&zle(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=Rce(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else zle(a,e,o)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Ile(Ule(s.mount?a:i,e,t.shouldUnregister?Ule(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>xce(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=Ule(r,e);t&&(t._f.refs?t._f.refs.every((e=>!Ece(e))):!Ece(t._f.ref))&&L(e)}l.unMount=new Set},_disableForm:e=>{$le(e)&&(p.state.next({disabled:e}),Bce(r,((t,n)=>{const o=Ule(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},M({...e,formState:d})),trigger:O,register:I,handleSubmit:U,watch:(e,t)=>xce(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={})=>{Ule(r,e)&&(Fle(t.defaultValue)?A(e,Dle(Ule(i,e))):(A(e,t.defaultValue),zle(i,e,Dle(t.defaultValue))),t.keepTouched||Tce(n.touchedFields,e),t.keepDirty||(Tce(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Dle(Ule(i,e))):S()),t.keepError||(Tce(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&gce(e).forEach((e=>Tce(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:L,setError:j,setFocus:(e,t={})=>{const n=Ule(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&xce(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const Zce="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Qce(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:xce(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:xce(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:Xce(e),formState:o},e.formControl&&e.defaultValues&&!xce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Zce((()=>{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&&!yce(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&&!cce(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=sce(o,a),t.current}const Jce=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Ule(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},eue=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Jce(r.ref,n,e):r.refs&&r.refs.forEach((t=>Jce(t,n,e)))}},tue=(e,t)=>{t.shouldUseNativeValidation&&eue(e,t);const n={};for(const r in e){const o=Ule(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(nue(t.names||Object.keys(e),r)){const e=Object.assign({},Ule(n,r));zle(e,"root",i),zle(n,r,e)}else zle(n,r,i)}return n},nue=(e,t)=>e.some((e=>e.startsWith(t+".")));var rue=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]=mce(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},oue=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&&eue({},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:tue(rue(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};const iue=e=>{const{children:t,...r}=e;return n.createElement(ice.Provider,{value:r},t)},aue=i.createContext({}),sue=({...e})=>t.jsx(aue.Provider,{value:{name:e.name},children:t.jsx(hce,{...e})}),lue=()=>{const e=i.useContext(aue),t=i.useContext(cue),{getFieldState:n,formState:r}=ace(),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}},cue=i.createContext({}),uue=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(cue.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:rp("space-y-2",e),...n})})}));uue.displayName="FormItem";const due=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=lue();return t.jsx(nee,{ref:r,className:rp(o&&"text-destructive",e),htmlFor:i,...n})}));due.displayName="FormLabel";const pue=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=lue();return t.jsx(RZ,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));pue.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=lue();return t.jsx("p",{ref:r,id:o,className:rp("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const fue=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=lue(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:rp("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));fue.displayName="FormMessage";const hue=({title:e,description:n,children:r})=>t.jsxs("div",{className:"text-left",children:[t.jsx("h3",{className:"text-lg font-medium text-foreground mb-1",children:e}),t.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:n}),t.jsx("div",{className:"space-y-4",children:r})]}),mue=Cle,gue=({control:e,name:n,label:r,placeholder:o,type:i="text",disabled:a})=>t.jsx(sue,{control:e,name:n,render:({field:e})=>t.jsxs(uue,{children:[t.jsx(due,{className:"text-sm font-medium",children:r}),t.jsx(pue,{children:t.jsx(s5,{...e,value:"number"===i?e.value||"":e.value,type:i,placeholder:o,className:"h-10",disabled:a,onChange:t=>{if("number"===i){const n=""===t.target.value?"":Number(t.target.value);e.onChange(n)}else e.onChange(t)}})}),t.jsx(fue,{})]})}),vue=({isSubmitting:e,onSubmit:n})=>{const r=Qce({resolver:oue(mue),defaultValues:{type:Sle.AWS_TOLL_FREE_NUMBER,tollFreeNumber:"",company:{name:"",website:"",address1:"",address2:"",city:"",stateProvince:"",zipCode:"",country:""},contact:{firstName:"",lastName:"",email:"",phoneNumber:""},messagingUseCase:{monthlyVolume:0,category:Ele.PROMOTIONS_MARKETING,useCaseDetails:""},messageSamples:[""]},values:void 0}),o=r.watch("messageSamples");return t.jsx("div",{className:"w-full max-w-4xl",children:t.jsx(iue,{...r,children:t.jsxs("form",{onSubmit:r.handleSubmit((async e=>{const t={...e,messagingUseCase:{...e.messagingUseCase,monthlyVolume:Number(e.messagingUseCase.monthlyVolume)}};await n(t)})),className:"space-y-6",children:[t.jsxs(hue,{title:"Legal business settings",description:"Provide your legal business information required for SMS channel verification and future communications.",children:[t.jsx(gue,{control:r.control,name:"company.name",label:"Business Name",placeholder:"Enter your business name",disabled:e}),t.jsx(gue,{control:r.control,name:"company.website",label:"Business Website",placeholder:"https://example.com",type:"url",disabled:e}),t.jsxs("div",{children:[t.jsx(due,{className:"text-sm font-medium",children:"Business Address"}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 mt-2",children:[t.jsx(gue,{control:r.control,name:"company.address1",placeholder:"Street address",disabled:e}),t.jsx(gue,{control:r.control,name:"company.address2",placeholder:"Apartment, suite, unit, etc. (optional)",disabled:e}),t.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[t.jsx(gue,{control:r.control,name:"company.city",placeholder:"City",disabled:e}),t.jsx(gue,{control:r.control,name:"company.stateProvince",placeholder:"State/Province",disabled:e}),t.jsx(gue,{control:r.control,name:"company.zipCode",placeholder:"ZIP code",disabled:e})]}),t.jsx(gue,{control:r.control,name:"company.country",placeholder:"Country code (e.g., US)",disabled:e})]})]})]}),t.jsxs(hue,{title:"Contact Information",description:"Provide the contact information of the person authorized to represent your business.",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsx(gue,{control:r.control,name:"contact.firstName",label:"First Name",placeholder:"First name",disabled:e}),t.jsx(gue,{control:r.control,name:"contact.lastName",label:"Last Name",placeholder:"Last name",disabled:e})]}),t.jsx(gue,{control:r.control,name:"contact.email",label:"Email",placeholder:"Email address",type:"email",disabled:e}),t.jsx(gue,{control:r.control,name:"contact.phoneNumber",label:"Contact Phone",placeholder:"+1234567890",type:"tel",disabled:e})]}),t.jsxs(hue,{title:"Messaging Use Case",description:"Tell us about how you plan to use SMS messaging.",children:[t.jsx(gue,{control:r.control,name:"messagingUseCase.monthlyVolume",label:"Expected Monthly Volume",placeholder:"1000",type:"number",disabled:e}),t.jsx(gue,{control:r.control,name:"messagingUseCase.useCaseDetails",label:"Use Case Details",placeholder:"Describe your use case in detail",disabled:e})]}),t.jsxs(hue,{title:"Message Samples",description:"Provide examples of messages you plan to send (up to 3 samples).",children:[t.jsx(QB,{children:o.map(((n,i)=>t.jsxs(DX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2},className:"relative",children:[t.jsx(gue,{control:r.control,name:`messageSamples.${i}`,label:`Sample Message ${i+1}`,placeholder:"Enter a sample message",disabled:e}),o.length>1&&t.jsx(DX.button,{type:"button",onClick:()=>(e=>{if(o.length>1){const t=o.filter(((t,n)=>n!==e));r.setValue("messageSamples",t)}})(i),className:"absolute -right-2 -top-2 rounded-full bg-red-100 p-1 text-red-600 hover:bg-red-200",whileHover:{scale:1.1},whileTap:{scale:.9},children:t.jsx(FZ.CloseButton,{className:"h-4 w-4"})})]},i)))}),o.length<3&&t.jsxs(DX.button,{type:"button",onClick:()=>{o.length<3&&r.setValue("messageSamples",[...o,""])},className:"mt-4 flex items-center gap-2 rounded-lg border border-dashed border-gray-300 px-4 py-2 text-sm text-gray-600 hover:border-gray-400 hover:text-gray-700",whileHover:{scale:1.02},whileTap:{scale:.98},children:[t.jsx(FZ.PlusIcon,{className:"h-4 w-4"}),"Add another sample"]})]}),t.jsx("div",{className:"flex gap-3 pt-4 justify-end",children:t.jsx(MZ,{type:"submit",disabled:e,children:e?"Submitting...":"Submit for approval"})})]})})})},yue=()=>{const[e,r]=n.useState(!1),{data:o,isLoading:i}={...ye({queryKey:Gie.all,queryFn:Kie,...Se})},{createSmsRegistrationApplication:a,isCreating:s}=Wie(),{toast:l}=Il();if(!o||i)return t.jsx("div",{className:"flex flex-col items-center justify-center p-8",children:t.jsx(EZ,{text:["Loading business information..."]})});const c={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.4,0,.2,1]}}},u=o&&o.status===Ale.PENDING;return t.jsxs(DX.div,{initial:"hidden",animate:"visible",exit:"exit",variants:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.4,0,.2,1],staggerChildren:.1}},exit:{opacity:0,y:-20,transition:{duration:.3,ease:[.4,0,1,1]}}},className:rp("flex flex-col items-center text-center w-full max-w-[72ch] rounded-xl p-6 gap-3 border border-border mx-auto mb-16","bg-background"),children:[t.jsx(DX.div,{variants:c,className:"w-16 h-16 rounded-xl flex items-center justify-center",children:t.jsx(FZ.SmsIcon,{})}),t.jsx(DX.h2,{variants:c,className:"text-sm font-medium text-foreground",children:"Request your SMS sending number"}),t.jsxs(DX.div,{variants:c,className:"max-w-xl mx-auto",children:[t.jsx("p",{className:"text-sm font-normal text-muted-foreground mb-2",children:"Before you can send messages, we need to verify your business info with our SMS provider. Once approved, we'll assign you a phone number to send SMS campaigns."}),t.jsx("p",{className:"text-sm font-normal text-muted-foreground",children:"This usually takes 3-7 business days."})]}),t.jsx(QB,{mode:"wait",children:e?t.jsx(DX.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.3,ease:[.4,0,.2,1]},className:"w-full",children:t.jsx(vue,{isSubmitting:s,onSubmit:async e=>{try{a({application:e},{onSuccess:()=>{l({title:"SMS setup submission successful"}),r(!1)},onError:()=>{l({title:"SMS setup submission failed",description:"Please contact your administrator."})}})}catch(t){}}})},"form"):u?t.jsxs(DX.div,{variants:c,className:"flex items-center gap-2 px-3 py-1.5 bg-orange-50 border border-orange-200 rounded-full",children:[t.jsx(DX.div,{animate:{scale:[1,1.2,1],opacity:[1,.8,1]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-2 h-2 bg-orange-500 rounded-full"}),t.jsx("span",{className:"text-sm font-medium text-orange-800",children:"Pending approval"})]},"pending"):t.jsx(DX.div,{variants:c,children:t.jsx(MZ,{variant:"outline",className:"bg-background",onClick:()=>r(!0),children:"Request approval"})},"button")})]})},bue=()=>{const e=bZ(),r=xZ(),{channelSenders:o}=V7(),{channelAccounts:i}=U7(),a=n.useMemo((()=>H7({channelSenders:o?.results??[]})),[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.from&&null!==s.channelSenderMetadata.from?s.channelSenderMetadata.from:null,c=s.channelSenderMetadata.friendlyName||l&&null!==l?Bie(l??""):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:c})]})})},xue=({smsBody:e,imageUrls:n})=>t.jsxs(Mie,{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(bue,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",children:t.jsx(goe,{body:e,imageUrls:n})})]}),wue=({open:e,onOpenChange:n,automation:r})=>t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Send Preview SMS"}),t.jsx(FB,{children:"Send a preview SMS to the automation."})]}),t.jsx(zie,{automation:r,type:"sms",setOpenSendPreviewPopup:n,open:e})]})}),_ue=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1,setupRequired:i=!1})=>{const[a,s]=n.useState(!1),l=bZ(),c=xZ(),[u,d]=n.useState(!1);if(!l)return null;const p=c?.smsMessageBody||"",f=c?.smsChannelSenderId&&p.length>0,h=moe({companyName:c?.textMessageCompanyName??void 0,smsBody:p}),m=c?.textMessageMediaUrls??[];return i?t.jsx("div",{className:"w-full pt-8 mx-auto",children:t.jsx(yue,{})}):t.jsxs("div",{className:"flex flex-col items-center w-full h-full",children:[t.jsx(kie,{open:u,onOpenChange:d}),t.jsx(wue,{open:a,onOpenChange:s,automation:l}),t.jsx(Mie,{actionButtons:t.jsxs(t.Fragment,{children:[!e&&f&&t.jsx(Uie,{onClick:()=>s(!0)}),(l.status===ze.DRAFT||!r)&&t.jsx(MZ,{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:()=>d(!0),children:"Edit content"}),f&&t.jsx(Iie,{expandDialogContent:t.jsx(xue,{smsBody:h,imageUrls:m})})]}),children:f?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(bue,{})})}),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(goe,{body:h,imageUrls:m})})]}):t.jsx(Fie,{type:"sms",disablePreviewSubtext:o})})]})},Sue=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1})=>{const i=(()=>{const{flags:e}=n.useContext(cl.reactContext);return e})()["show-settings-modal"]??!1,{state:{hideSms:a}}=n.useContext(l$),{channelSenders:s}=V7(),l=n.useMemo((()=>H7({channelSenders:s?.results??[]})),[s?.results]);if(!xZ()||!s)return t.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:t.jsx(EZ,{text:["Loading..."]})});const c=!0===i&&0===l.length;return t.jsxs(Nie,{defaultValue:"email",className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md pb-4",children:[t.jsx("div",{className:"max-w-[640px] mx-auto w-full",children:t.jsxs(Rie,{className:"grid w-full "+(a?"grid-cols-1":"grid-cols-2"),children:[t.jsx(Oie,{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"}),t.jsx("span",{children:"Email"})]})}),!a&&t.jsx(Oie,{value:"sms",className:"group data-[state=active]:bg-background",children:t.jsxs("div",{className:"flex items-center gap-2",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"}),t.jsx("span",{children:"SMS"}),c&&t.jsx(G7,{title:"To enable SMS, please complete your business information and request approval from Twilio"})]})})]})}),t.jsx(Pie,{value:"email",children:t.jsx(qie,{disablePreview:e,disableEditContent:r,disablePreviewSubtext:o})}),t.jsx(Pie,{value:"sms",children:t.jsx(_ue,{disablePreview:e,disableEditContent:r,disablePreviewSubtext:o,setupRequired:c})})]})},Eue="reach-styles-module__h2___J-48W",Tue="reach-styles-module__minorText___1TEN6",Cue=({children:e,className:n})=>t.jsx("h2",{className:rp(Eue,n),children:e}),Aue=({children:e,className:n})=>t.jsx("p",{className:rp(Tue,n),children:e}),Nue=({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(Cue,{className:"text-primary",children:e}),r&&t.jsx("div",{className:"ml-auto",children:r})]}),n]}),Rue=()=>t.jsx(Nue,{title:"Preview & Schedule",children:t.jsx(Sue,{disablePreview:!0,disableEditContent:!0,disablePreviewSubtext:!0})}),Oue=()=>{const e=bZ(),r=xZ(),{channelSenders:o}=V7(),{channelAccounts:i}=U7(),[a,s]=n.useState(null),[l,c]=n.useState(null),[u,d]=n.useState(null),[p,f]=n.useState(null);return n.useEffect((()=>{o&&d(o),i&&f(i)}),[o,i]),n.useEffect((()=>{if(r&&u&&p){const e=r.emailChannelSenderId,t=r.smsChannelSenderId,n=u.results.find((t=>t.id===e)),o=u.results.find((e=>e.id===t));if(n&&r.emailSubject&&r.emailHtmlBody){const e=n.channelSenderMetadata?.userPart,t=p.results.find((e=>e.id===n.channelAccountId));if(t)switch(t.channelAccountMetadata.type){case $7.REACH_MANAGED:s({fromEmail:`${e}@${t.channelAccountMetadata.baseDomain}.embedreach.com`,fromName:n.channelSenderMetadata?.emailFromName,subject:r.emailSubject,previewText:r.emailPreviewText,body:r.emailHtmlBody});break;case $7.TWILLIO:break;default:throw Eoe(t.channelAccountMetadata.type,$7)}}o&&r.smsMessageBody&&c({fromPhone:Soe(o.channelSenderMetadata),body:r.smsMessageBody,companyName:r.textMessageCompanyName})}}),[r,u,p]),e?t.jsx("div",a||l?{className:"w-full",children:t.jsx("div",{className:"flex flex-col gap-4 w-full",children:t.jsx(Rue,{})})}:{className:"flex justify-center items-center h-full",children:t.jsx("div",{children:"No preview data Please complete previous steps"})}):t.jsx(EZ,{text:["Loading..."]})};function Pue(e){return(Pue="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 kue(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 jue(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Mue(e){jue(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Pue(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):new Date(NaN)}function Lue(e,t){jue(2,arguments);var n=Mue(e),r=kue(t);return isNaN(r)?new Date(NaN):r?(n.setDate(n.getDate()+r),n):n}function Due(e,t){jue(2,arguments);var n=Mue(e),r=kue(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)}var Iue={};function Fue(){return Iue}function Uue(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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=Mue(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 $ue(e){return jue(1,arguments),Uue(e,{weekStartsOn:1})}function Vue(e){jue(1,arguments);var t=function(e){jue(1,arguments);var t=Mue(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=$ue(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var a=$ue(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),$ue(n)}function Bue(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 zue(e){jue(1,arguments);var t=Mue(e);return t.setHours(0,0,0,0),t}function Hue(e,t){jue(2,arguments);var n=zue(e),r=zue(t),o=n.getTime()-Bue(n),i=r.getTime()-Bue(r);return Math.round((o-i)/864e5)}function que(e,t){return jue(2,arguments),Lue(e,7*kue(t))}function Gue(e,t){return jue(2,arguments),Due(e,12*kue(t))}function Kue(e,t){jue(2,arguments);var n=zue(e),r=zue(t);return n.getTime()===r.getTime()}function Wue(e){return jue(1,arguments),e instanceof Date||"object"===Pue(e)&&"[object Date]"===Object.prototype.toString.call(e)}function Yue(e,t){jue(2,arguments);var n=Mue(e),r=Mue(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function Xue(e){jue(1,arguments);var t=Mue(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Zue(e){jue(1,arguments);var t=Mue(e);return t.setDate(1),t.setHours(0,0,0,0),t}function Que(e){jue(1,arguments);var t=Mue(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Jue(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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=Mue(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 ede(e){return jue(1,arguments),Jue(e,{weekStartsOn:1})}function tde(e,t){return jue(2,arguments),function(e,t){jue(2,arguments);var n=Mue(e).getTime(),r=kue(t);return new Date(n+r)}(e,-kue(t))}function nde(e){jue(1,arguments);var t=Mue(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 rde(e){jue(1,arguments);var t=Mue(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=nde(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var a=nde(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function ode(e){jue(1,arguments);var t=Mue(e),n=nde(t).getTime()-function(e){jue(1,arguments);var t=rde(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),nde(n)}(t).getTime();return Math.round(n/6048e5)+1}function ide(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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=Mue(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 ade(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Mue(e),d=u.getUTCFullYear(),p=Fue(),f=kue(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=ide(h,t),g=new Date(0);g.setUTCFullYear(d,0,f),g.setUTCHours(0,0,0,0);var v=ide(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function sde(e,t){jue(1,arguments);var n=Mue(e),r=ide(n,t).getTime()-function(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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=ade(e,t),f=new Date(0);return f.setUTCFullYear(p,0,d),f.setUTCHours(0,0,0,0),ide(f,t)}(n,t).getTime();return Math.round(r/6048e5)+1}function lde(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var cde=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return lde("yy"===t?r%100:r,t.length)},ude=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):lde(n+1,2)},dde=function(e,t){return lde(e.getUTCDate(),t.length)},pde=function(e,t){return lde(e.getUTCHours()%12||12,t.length)},fde=function(e,t){return lde(e.getUTCHours(),t.length)},hde=function(e,t){return lde(e.getUTCMinutes(),t.length)},mde=function(e,t){return lde(e.getUTCSeconds(),t.length)},gde=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return lde(Math.floor(r*Math.pow(10,n-3)),t.length)},vde="midnight",yde="noon",bde="morning",xde="afternoon",wde="evening",_de="night",Sde={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 cde(e,t)},Y:function(e,t,n,r){var o=ade(e,r),i=o>0?o:1-o;return"YY"===t?lde(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):lde(i,t.length)},R:function(e,t){return lde(rde(e),t.length)},u:function(e,t){return lde(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 lde(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 lde(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 ude(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 lde(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=sde(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):lde(o,t.length)},I:function(e,t,n){var r=ode(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):lde(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):dde(e,t)},D:function(e,t,n){var r=function(e){jue(1,arguments);var t=Mue(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"}):lde(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 lde(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 lde(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 lde(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?yde:0===o?vde: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?wde:o>=12?xde:o>=4?bde:_de,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 pde(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):fde(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):lde(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):lde(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):hde(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):mde(e,t)},S:function(e,t){return gde(e,t)},X:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Tde(o);case"XXXX":case"XX":return Cde(o);default:return Cde(o,":")}},x:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Tde(o);case"xxxx":case"xx":return Cde(o);default:return Cde(o,":")}},O:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ede(o,":");default:return"GMT"+Cde(o,":")}},z:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ede(o,":");default:return"GMT"+Cde(o,":")}},t:function(e,t,n,r){return lde(Math.floor((r._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,r){return lde((r._originalDate||e).getTime(),t.length)}};function Ede(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+lde(i,2)}function Tde(e,t){return e%60==0?(e>0?"-":"+")+lde(Math.abs(e)/60,2):Cde(e,t)}function Cde(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e);return r+lde(Math.floor(o/60),2)+n+lde(o%60,2)}var Ade=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"})}},Nde=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"})}},Rde={p:Nde,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return Ade(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}}",Ade(o,t)).replace("{{time}}",Nde(i,t))}},Ode=["D","DD"],Pde=["YY","YYYY"];function kde(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 jde={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 Mde(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 Lde={date:Mde({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Mde({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:Mde({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Dde={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Ide(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 Fde={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:Ide({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Ide({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:Ide({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:Ide({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:Ide({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 Ude(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 $de={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:Ude({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:Ude({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:Ude({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:Ude({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:Ude({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"})},Vde={code:"en-US",formatDistance:function(e,t,n){var r,o=jde[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:Lde,formatRelative:function(e,t,n,r){return Dde[e]},localize:Fde,match:$de,options:{weekStartsOn:0,firstWeekContainsDate:1}},Bde=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zde=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hde=/^'([^]*?)'?$/,qde=/''/g,Gde=/[a-zA-Z]/;function Kde(e,t,n){var r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x;jue(2,arguments);var w=String(t),_=Fue(),S=null!==(r=null!==(o=null==n?void 0:n.locale)&&void 0!==o?o:_.locale)&&void 0!==r?r:Vde,E=kue(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=kue(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===(x=b.options)||void 0===x?void 0:x.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=Mue(e);if(!function(e){if(jue(1,arguments),!Wue(e)&&"number"!=typeof e)return!1;var t=Mue(e);return!isNaN(Number(t))}(C))throw new RangeError("Invalid time value");var A=tde(C,Bue(C)),N={firstWeekContainsDate:E,weekStartsOn:T,locale:S,_originalDate:C};return w.match(zde).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Rde[t])(e,S.formatLong):e})).join("").match(Bde).map((function(r){if("''"===r)return"'";var o=r[0];if("'"===o)return function(e){var t=e.match(Hde);if(!t)return e;return t[1].replace(qde,"'")}(r);var i=Sde[o];if(i)return null!=n&&n.useAdditionalWeekYearTokens||-1===Pde.indexOf(r)||kde(r,t,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==Ode.indexOf(e)}(r)||kde(r,t,String(e)),i(A,r,S.localize,N);if(o.match(Gde))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return r})).join("")}function Wde(e){return jue(1,arguments),Math.floor(function(e){return jue(1,arguments),Mue(e).getTime()}(e)/1e3)}function Yde(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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;jue(1,arguments);var u=Mue(e),d=u.getFullYear(),p=Fue(),f=kue(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=Uue(h,t),g=new Date(0);g.setFullYear(d,0,f),g.setHours(0,0,0,0);var v=Uue(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),Uue(f,t)}function Xde(e,t){return jue(1,arguments),function(e,t,n){jue(2,arguments);var r=Uue(e,n),o=Uue(t,n),i=r.getTime()-Bue(r),a=o.getTime()-Bue(o);return Math.round((i-a)/6048e5)}(function(e){jue(1,arguments);var t=Mue(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}(e),Zue(e),t)+1}function Zde(e,t){jue(2,arguments);var n=Mue(e),r=Mue(t);return n.getTime()>r.getTime()}function Qde(e,t){jue(2,arguments);var n=Mue(e),r=Mue(t);return n.getTime()<r.getTime()}function Jde(e,t){jue(2,arguments);var n=Mue(e),r=Mue(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function epe(e,t){return jue(2,arguments),Lue(e,-kue(t))}function tpe(e,t){jue(2,arguments);var n=Mue(e),r=kue(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){jue(1,arguments);var t=Mue(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 npe(e,t){jue(2,arguments);var n=Mue(e),r=kue(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var rpe=function(){return rpe=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},rpe.apply(this,arguments)};function ope(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 ipe(e){return"multiple"===e.mode}function ape(e){return"range"===e.mode}function spe(e){return"single"===e.mode}"function"==typeof SuppressedError&&SuppressedError;var lpe={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 cpe=Object.freeze({__proto__:null,formatCaption:function(e,t){return Kde(e,"LLLL y",t)},formatDay:function(e,t){return Kde(e,"d",t)},formatMonthCaption:function(e,t){return Kde(e,"LLLL",t)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,t){return Kde(e,"cccccc",t)},formatYearCaption:function(e,t){return Kde(e,"yyyy",t)}}),upe=Object.freeze({__proto__:null,labelDay:function(e,t,n){return Kde(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 Kde(e,"cccc",t)},labelYearDropdown:function(){return"Year: "}});var dpe=n.createContext(void 0);function ppe(e){var n,r,o=e.initialProps,i={captionLayout:"buttons",classNames:lpe,formatters:cpe,labels:upe,locale:Vde,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=Zue(r):t&&(i=new Date(t,0,1)),o?a=Xue(o):n&&(a=new Date(n,11,31)),{fromDate:i?zue(i):void 0,toDate:a?zue(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"),(spe(o)||ipe(o)||ape(o))&&(r=o.onSelect);var u=rpe(rpe(rpe({},i),o),{captionLayout:c,classNames:rpe(rpe({},i.classNames),o.classNames),components:rpe({},o.components),formatters:rpe(rpe({},i.formatters),o.formatters),fromDate:s,labels:rpe(rpe({},i.labels),o.labels),mode:o.mode||i.mode,modifiers:rpe(rpe({},i.modifiers),o.modifiers),modifiersClassNames:rpe(rpe({},i.modifiersClassNames),o.modifiersClassNames),onSelect:r,styles:rpe(rpe({},i.styles),o.styles),toDate:l});return t.jsx(dpe.Provider,{value:u,children:e.children})}function fpe(){var e=n.useContext(dpe);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function hpe(e){var n=fpe();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 mpe(e){return t.jsx("svg",rpe({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 gpe(e){var n,r,o=e.onChange,i=e.value,a=e.children,s=e.caption,l=e.className,c=e.style,u=fpe(),d=null!==(r=null===(n=u.components)||void 0===n?void 0:n.IconDropdown)&&void 0!==r?r:mpe;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 vpe(e){var n,r=fpe(),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){jue(2,arguments);var n=Mue(e),r=Mue(t);return n.getFullYear()===r.getFullYear()}(o,i))for(var f=Zue(o),h=o.getMonth();h<=i.getMonth();h++)p.push(tpe(f,h));else for(f=Zue(new Date),h=0;h<=11;h++)p.push(tpe(f,h));var m=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:gpe;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=tpe(Zue(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 ype(e){var n,r=e.displayMonth,o=fpe(),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(npe(Que(new Date),g));var v=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:gpe;return t.jsx(v,{name:"years","aria-label":p(),className:c.dropdown_year,style:l.dropdown_year,onChange:function(t){var n=npe(Zue(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 bpe(){var e=fpe(),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&&Yue(n,t)<0&&(t=Due(n,-1*(i-1))),r&&Yue(t,r)<0&&(t=r),Zue(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=Zue(t);o(r),null===(n=e.onMonthChange)||void 0===n||n.call(e,r)}}]}var xpe=n.createContext(void 0);function wpe(e){var n=fpe(),r=bpe(),o=r[0],i=r[1],a=function(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=Zue(e),i=Yue(Zue(Due(o,r)),o),a=[],s=0;s<i;s++){var l=Due(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=Zue(e);if(!n)return Due(a,i);if(!(Yue(n,e)<o))return Due(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=Zue(e);if(!n)return Due(i,-o);if(!(Yue(i,n)<=0))return Due(i,-o)}}(o,n),c=function(e){return a.some((function(t){return Jde(e,t)}))};return t.jsx(xpe.Provider,{value:{currentMonth:o,displayMonths:a,goToMonth:i,goToDate:function(e,t){c(e)||(t&&Qde(e,t)?i(Due(e,1+-1*n.numberOfMonths)):i(e))},previousMonth:l,nextMonth:s,isDateDisplayed:c},children:e.children})}function _pe(){var e=n.useContext(xpe);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Spe(e){var n,r=fpe(),o=r.classNames,i=r.styles,a=r.components,s=_pe().goToMonth,l=function(t){s(Due(t,e.displayIndex?-e.displayIndex:0))},c=null!==(n=null==a?void 0:a.CaptionLabel)&&void 0!==n?n:hpe,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(vpe,{onChange:l,displayMonth:e.displayMonth}),t.jsx(ype,{onChange:l,displayMonth:e.displayMonth})]})}function Epe(e){return t.jsx("svg",rpe({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 Tpe(e){return t.jsx("svg",rpe({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 Cpe=n.forwardRef((function(e,n){var r=fpe(),o=r.classNames,i=r.styles,a=[o.button_reset,o.button];e.className&&a.push(e.className);var s=a.join(" "),l=rpe(rpe({},i.button_reset),i.button);return e.style&&Object.assign(l,e.style),t.jsx("button",rpe({},e,{ref:n,type:"button",className:s,style:l}))}));function Ape(e){var n,r,o=fpe(),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:Tpe,y=null!==(r=null==p?void 0:p.IconLeft)&&void 0!==r?r:Epe;return t.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&t.jsx(Cpe,{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(Cpe,{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 Npe(e){var n=fpe().numberOfMonths,r=_pe(),o=r.previousMonth,i=r.nextMonth,a=r.goToMonth,s=r.displayMonths,l=s.findIndex((function(t){return Jde(e.displayMonth,t)})),c=0===l,u=l===s.length-1;return t.jsx(Ape,{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 Rpe(e){var n,r,o=fpe(),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:hpe;return r=o.disableNavigation?t.jsx(c,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===s?t.jsx(Spe,{displayMonth:e.displayMonth,id:e.id}):t.jsxs(t.Fragment,"dropdown-buttons"===s?{children:[t.jsx(Spe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),t.jsx(Npe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}:{children:[t.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(Npe,{displayMonth:e.displayMonth,id:e.id})]}),t.jsx("div",{className:i.caption,style:a.caption,children:r})}function Ope(e){var n=fpe(),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 Ppe(){var e=fpe(),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?$ue(new Date):Uue(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var a=Lue(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 kpe(){var e,n=fpe(),r=n.components,o=null!==(e=null==r?void 0:r.HeadRow)&&void 0!==e?e:Ppe;return t.jsx("thead",{style:n.styles.head,className:n.classNames.head,children:t.jsx(o,{})})}function jpe(e){var n=fpe();return t.jsx(t.Fragment,{children:(0,n.formatters.formatDay)(e.date,{locale:n.locale})})}var Mpe=n.createContext(void 0);function Lpe(e){if(!ipe(e.initialProps)){return t.jsx(Mpe.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}return t.jsx(Dpe,{initialProps:e.initialProps,children:e.children})}function Dpe(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 Kue(t,e)}));return Boolean(t&&!n)})),t.jsx(Mpe.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?ope([],o):[];if(t.selected){var u=c.findIndex((function(t){return Kue(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 Ipe(){var e=n.useContext(Mpe);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var Fpe,Upe,$pe=n.createContext(void 0);function Vpe(e){if(!ape(e.initialProps)){return t.jsx($pe.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}return t.jsx(Bpe,{initialProps:e.initialProps,children:e.children})}function Bpe(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],Kue(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:epe(a,l-1),before:Lue(a,l-1)}),a&&s&&u.disabled.push({after:a,before:Lue(a,l-1)}),!a&&s&&u.disabled.push({after:epe(s,l-1),before:Lue(s,l-1)})),c){if(a&&!s&&(u.disabled.push({before:Lue(a,1-c)}),u.disabled.push({after:Lue(a,c-1)})),a&&s){var d=c-(Hue(s,a)+1);u.disabled.push({before:epe(a,d)}),u.disabled.push({after:Lue(s,d)})}!a&&s&&(u.disabled.push({before:Lue(s,1-c)}),u.disabled.push({after:Lue(s,c-1)}))}return t.jsx($pe.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(Kue(o,e)&&Kue(r,e))return;if(Kue(o,e))return{from:o,to:void 0};if(Kue(r,e))return;return Zde(r,e)?{from:e,to:o}:{from:r,to:e}}return o?Zde(e,o)?{from:o,to:e}:{from:e,to:o}:r?Qde(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 zpe(){var e=n.useContext($pe);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Hpe(e){return Array.isArray(e)?ope([],e):void 0!==e?[e]:[]}(Upe=Fpe||(Fpe={})).Outside="outside",Upe.Disabled="disabled",Upe.Selected="selected",Upe.Hidden="hidden",Upe.Today="today",Upe.RangeStart="range_start",Upe.RangeEnd="range_end",Upe.RangeMiddle="range_middle";var qpe=Fpe.Selected,Gpe=Fpe.Disabled,Kpe=Fpe.Hidden,Wpe=Fpe.Today,Ype=Fpe.RangeEnd,Xpe=Fpe.RangeMiddle,Zpe=Fpe.RangeStart,Qpe=Fpe.Outside;var Jpe=n.createContext(void 0);function efe(e){var n=fpe(),r=function(e,t,n){var r,o=((r={})[qpe]=Hpe(e.selected),r[Gpe]=Hpe(e.disabled),r[Kpe]=Hpe(e.hidden),r[Wpe]=[e.today],r[Ype]=[],r[Xpe]=[],r[Zpe]=[],r[Qpe]=[],r);return e.fromDate&&o[Gpe].push({before:e.fromDate}),e.toDate&&o[Gpe].push({after:e.toDate}),ipe(e)?o[Gpe]=o[Gpe].concat(t.modifiers[Gpe]):ape(e)&&(o[Gpe]=o[Gpe].concat(n.modifiers[Gpe]),o[Zpe]=n.modifiers[Zpe],o[Xpe]=n.modifiers[Xpe],o[Ype]=n.modifiers[Ype]),o}(n,Ipe(),zpe()),o=function(e){var t={};return Object.entries(e).forEach((function(e){t[e[0]]=Hpe(e[1])})),t}(n.modifiers),i=rpe(rpe({},r),o);return t.jsx(Jpe.Provider,{value:i,children:e.children})}function tfe(){var e=n.useContext(Jpe);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function nfe(e,t){return t.some((function(t){if("boolean"==typeof t)return t;if(Wue(t))return Kue(e,t);var n,r,o,i,a;if(function(e){return Array.isArray(e)&&e.every(Wue)}(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?(Hue(a,i)<0&&(i=(o=[a,i])[0],a=o[1]),Hue(n,i)>=0&&Hue(a,n)>=0):a?Kue(a,n):!!i&&Kue(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=Hue(t.before,e)>0,l=Hue(t.after,e)<0;return Zde(t.before,t.after)?l&&s:s||l}return function(e){return Boolean(e&&"object"==typeof e&&"after"in e)}(t)?Hue(e,t.after)>0:function(e){return Boolean(e&&"object"==typeof e&&"before"in e)}(t)?Hue(t.before,e)>0:"function"==typeof t&&t(e)}))}function rfe(e,t,n){var r=Object.keys(t).reduce((function(n,r){return nfe(e,t[r])&&n.push(r),n}),[]),o={};return r.forEach((function(e){return o[e]=!0})),n&&!Jde(e,n)&&(o.outside=!0),o}function ofe(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:Lue,week:que,month:Due,year:Gue,startOfWeek:function(e){return o.ISOWeek?$ue(e):Uue(e,{locale:d,weekStartsOn:l})},endOfWeek:function(e){return o.ISOWeek?ede(e):Jue(e,{locale:d,weekStartsOn:l})}}[n](e,"after"===r?1:-1);"before"===r&&c?p=function(e){var t,n;if(jue(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==Pue(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Mue(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(jue(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==Pue(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Mue(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}([u,p]));var f=!0;if(i){var h=rfe(p,i);f=!h.disabled&&!h.hidden}return f?p:s.count>365?s.lastFocused:ofe(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:rpe(rpe({},s),{count:s.count+1})})}var ife=n.createContext(void 0);function afe(e){var r=_pe(),o=tfe(),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=Zue(e[0]),i=Xue(e[e.length-1]),a=o;a<=i;){var s=rfe(a,t);if(s.disabled||s.hidden)a=Lue(a,1);else{if(s.selected)return a;s.today&&!r&&(r=a),n||(n=a),a=Lue(a,1)}}return r||n}(r.displayMonths,o),p=(null!=a?a:c&&r.isDateDisplayed(c))?c:d,f=function(e){s(e)},h=fpe(),m=function(e,t){if(a){var n=ofe(a,{moveBy:e,direction:t,context:h,modifiers:o});Kue(a,n)||(r.goToDate(n,a),f(n))}};return t.jsx(ife.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 sfe(){var e=n.useContext(ife);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}var lfe=n.createContext(void 0);function cfe(e){if(!spe(e.initialProps)){return t.jsx(lfe.Provider,{value:{selected:void 0},children:e.children})}return t.jsx(ufe,{initialProps:e.initialProps,children:e.children})}function ufe(e){var n=e.initialProps;return t.jsx(lfe.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 dfe(){var e=n.useContext(lfe);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function pfe(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(Fpe).includes(e)}(t)){var o=e.classNames["day_".concat(t)];o&&n.push(o)}})),n}function ffe(e,r,o){var i,a,s,l=fpe(),c=sfe(),u=function(e,t){return rfe(e,tfe(),t)}(e,r),d=function(e,t){var n=fpe(),r=dfe(),o=Ipe(),i=zpe(),a=sfe(),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;spe(n)?null===(s=r.onDayClick)||void 0===s||s.call(r,e,t,a):ipe(n)?null===(l=o.onDayClick)||void 0===l||l.call(o,e,t,a):ape(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=fpe(),t=dfe(),n=Ipe(),r=zpe();return spe(e)?t.selected:ipe(e)?n.selected:ape(e)?r.selected:void 0}(),f=Boolean(l.onDayClick||"default"!==l.mode);n.useEffect((function(){var t;u.outside||c.focusedDay&&f&&Kue(c.focusedDay,e)&&(null===(t=o.current)||void 0===t||t.focus())}),[c.focusedDay,e,o,f,u.outside]);var h=pfe(l,u).join(" "),m=function(e,t){var n=rpe({},e.styles.day);return Object.keys(t).forEach((function(t){var r;n=rpe(rpe({},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:jpe,y={style:m,className:h,children:t.jsx(v,{date:e,displayMonth:r,activeModifiers:u}),role:"gridcell"},b=c.focusTarget&&Kue(c.focusTarget,e)&&!u.outside,x=c.focusedDay&&Kue(c.focusedDay,e),w=rpe(rpe(rpe({},y),((i={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,i.tabIndex=x||b?0:-1,i)),d);return{isButton:f,isHidden:g,activeModifiers:u,selectedDays:p,buttonProps:w,divProps:y}}function hfe(e){var r=n.useRef(null),o=ffe(e.date,e.displayMonth,r);return o.isHidden?t.jsx("div",{role:"gridcell"}):o.isButton?t.jsx(Cpe,rpe({name:"day",ref:r},o.buttonProps)):t.jsx("div",rpe({},o.divProps))}function mfe(e){var n=e.number,r=e.dates,o=fpe(),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(Cpe,{name:"week-number","aria-label":d,className:s.weeknumber,style:a.weeknumber,onClick:function(e){i(n,r,e)},children:u})}function gfe(e){var n,r,o,i=fpe(),a=i.styles,s=i.classNames,l=i.components,c=null!==(n=null==l?void 0:l.Day)&&void 0!==n?n:hfe,u=null!==(r=null==l?void 0:l.WeekNumber)&&void 0!==r?r:mfe;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})},Wde(n))}))]})}function vfe(e,t,n){for(var r=(null==n?void 0:n.ISOWeek)?ede(t):Jue(t,n),o=(null==n?void 0:n.ISOWeek)?$ue(e):Uue(e,n),i=Hue(r,o),a=[],s=0;s<=i;s++)a.push(Lue(o,s));var l=a.reduce((function(e,t){var r=(null==n?void 0:n.ISOWeek)?function(e){jue(1,arguments);var t=Mue(e),n=$ue(t).getTime()-Vue(t).getTime();return Math.round(n/6048e5)+1}(t):function(e,t){jue(1,arguments);var n=Mue(e),r=Uue(n,t).getTime()-Yde(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 yfe(e){var n,r,o,i=fpe(),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=vfe(Zue(e),Xue(e),t);if(null==t?void 0:t.useFixedWeeks){var r=Xde(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],a=que(i,6-r),s=vfe(que(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:kpe,g=null!==(r=null==u?void 0:u.Row)&&void 0!==r?r:gfe,v=null!==(o=null==u?void 0:u.Footer)&&void 0!==o?o:Ope;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 bfe="undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,xfe=!1,wfe=0;function _fe(){return"react-day-picker-".concat(++wfe)}function Sfe(e){var r,o,i=fpe(),a=i.dir,s=i.classNames,l=i.styles,c=i.components,u=_pe().displayMonths,d=function(e){var t,r=null!=e?e:xfe?_fe():null,o=n.useState(r),i=o[0],a=o[1];return bfe((function(){null===i&&a(_fe())}),[]),n.useEffect((function(){!1===xfe&&(xfe=!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=rpe(rpe({},h),l.caption_start)),g&&(f.push(s.caption_end),h=rpe(rpe({},h),l.caption_end)),v&&(f.push(s.caption_between),h=rpe(rpe({},h),l.caption_between));var y=null!==(o=null==c?void 0:c.Caption)&&void 0!==o?o:Rpe;return t.jsxs("div",{className:f.join(" "),style:h,children:[t.jsx(y,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(yfe,{id:p,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function Efe(e){var n=fpe();return t.jsx("div",{className:n.classNames.months,style:n.styles.months,children:e.children})}function Tfe(e){var r,o,i=e.initialProps,a=fpe(),s=sfe(),l=_pe(),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=rpe(rpe({},a.styles.root),a.style),h=Object.keys(i).filter((function(e){return e.startsWith("data-")})).reduce((function(e,t){var n;return rpe(rpe({},e),((n={})[t]=i[t],n))}),{}),m=null!==(o=null===(r=i.components)||void 0===r?void 0:r.Months)&&void 0!==o?o:Efe;return t.jsx("div",rpe({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(Sfe,{displayIndex:n,displayMonth:e},n)}))})}))}function Cfe(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(ppe,{initialProps:r,children:t.jsx(wpe,{children:t.jsx(cfe,{initialProps:r,children:t.jsx(Lpe,{initialProps:r,children:t.jsx(Vpe,{initialProps:r,children:t.jsx(efe,{children:t.jsx(afe,{children:n})})})})})})})}function Afe(e){return t.jsx(Cfe,rpe({},e,{children:t.jsx(Tfe,{initialProps:e})}))}function Nfe({className:e,classNames:n,showOutsideDays:r=!0,...o}){return t.jsx(Afe,{showOutsideDays:r,className:rp("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:rp(jZ({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:rp("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:rp(jZ({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(vu,{className:"h-4 w-4"}),IconRight:()=>t.jsx(yu,{className:"h-4 w-4"})},...o})}Nfe.displayName="Calendar";const Rfe=({data:e,placeholder:n,searchPlaceholder:r,noResultsMessage:o,value:a,setValue:s})=>{const[l,c]=i.useState(!1);return t.jsxs(v9,{open:l,onOpenChange:c,modal:!0,children:[t.jsx(y9,{asChild:!0,children:t.jsxs(MZ,{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(xu,{className:"opacity-50"})]})}),t.jsx(b9,{className:"w-[200px] p-0",children:t.jsxs(soe,{children:[t.jsx(loe,{placeholder:r,className:"h-9"}),t.jsxs(coe,{children:[t.jsx(uoe,{children:o}),t.jsx(doe,{children:e.map((e=>t.jsxs(foe,{value:e.value,onSelect:e=>{s(e===a?"":e),c(!1)},children:[e.label,t.jsx(mu,{className:rp("ml-auto",a===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},Ofe=({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?E7(new Date(o),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),p=t=>{const n=I9(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(v9,{children:[t.jsx(y9,{asChild:!0,children:t.jsxs(MZ,{variant:"outline",className:rp("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[t.jsx(hu,{className:"mr-2 h-4 w-4"}),o?E7(new Date(o),"PPP"):t.jsx("span",{children:"Pick a date"})]})}),t.jsx(b9,{className:"w-auto p-0 z-[60] pointer-events-auto",children:t.jsx(Nfe,{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:rp("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(Rfe,{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=I9(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]})]})})},Pfe=({title:e="Edit Schedule Time",autoSave:r=!1})=>{const o=bZ(),{updateAutomation:i}=De(o?.id||""),{toast:a}=Il(),[s,l]=n.useState(null),[c,u]=n.useState(o?.triggerMetadata?.triggerType===Ue.ONE_TIME?o?.triggerMetadata?.scheduledAt:null),[d,p]=n.useState(o?.triggerMetadata?.triggerType===Ue.ONE_TIME&&o?.triggerMetadata?.timezone||"America/New_York"),[f,h]=n.useState(!1),m=n.useCallback((()=>{if("sendNow"===s)i({trigger:{triggerType:Ue.ONE_TIME,scheduledAt:new Date(Date.now()+3e5).toISOString()}}),a({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),h(!1);else{if(!c||!d)return;i({trigger:{triggerType:Ue.ONE_TIME,scheduledAt:c,timezone:d}}),a({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),h(!1)}}),[s,c,d,i,a]);return n.useEffect((()=>{}),[o]),n.useEffect((()=>{r&&f&&(m(),h(!1))}),[r,f,m]),o?t.jsx(Nue,{title:e,headerActions:r?void 0:t.jsx(MZ,{onClick:m,disabled:!f,children:"Save"}),children:t.jsx("div",{className:"@container flex-1 mx-4",children:t.jsxs("div",{className:"flex @[1000px]:flex-row flex-col gap-8 items-center",children:[t.jsxs("div",{className:"flex-1 w-full",children:[t.jsxs("div",{className:"grid grid-cols-1 @[480px]:grid-cols-2 gap-4",children:[t.jsx(IZ,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(FZ.SendButton,{className:"text-primary"}),onClick:()=>{l("sendNow"),u(new Date(Date.now()+3e5).toISOString()),p("America/New_York"),h(!0)}}),t.jsx(IZ,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(FZ.ScheduleButton,{className:"text-primary"}),onClick:()=>l("schedule")})]}),t.jsx(QB,{children:"schedule"===s&&t.jsx(TZ,{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(Ofe,{setScheduleTime:u,setTimezone:p,timezone:d,scheduleTime:c,setIsDirty:h})})})})]}),c&&t.jsxs(DX.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(DX.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(DX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:d||void 0})})]})]})})}):null},kfe=()=>t.jsx("div",{children:t.jsx(Pfe,{title:"Set Schedule Time",autoSave:!0})});var jfe=(e=>(e.DAYS="days",e))(jfe||{});const Mfe={[vZ.EQUALS]:"Equals",[vZ.NOT_EQUALS]:"Not Equals",[vZ.GREATER_THAN]:"Greater Than",[vZ.LESS_THAN]:"Less Than",[vZ.EXISTS]:"Exists",[vZ.EQUALS_MONTH_DAY]:"Month and Day Matches",[vZ.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[vZ.BETWEEN_MONTH_DAY]:"Between Month Day",[vZ.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[vZ.ARRAY_CONTAINS]:"List Contains"},Lfe={email:"Email Address",phone:"Phone Number",firstName:"First Name",lastName:"Last Name"},Dfe=({options:e,value:n,onChange:r,placeholder:o,className:a=""})=>{const[s,l]=i.useState(!1);return t.jsxs(v9,{modal:!0,open:s,onOpenChange:l,children:[t.jsx(y9,{asChild:!0,children:t.jsxs(MZ,{"aria-expanded":s,className:rp("w-full overflow-hidden justify-between",a),variant:"outline",children:[n?e.find((e=>e.value===n))?.label:o,t.jsx(xu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(b9,{className:rp("w-full min-w-[120px] max-w-[600px] p-0",a),children:t.jsxs(soe,{children:[t.jsx(loe,{placeholder:`${o}...`}),t.jsxs(coe,{children:[t.jsxs(uoe,{children:["No ",o.toLowerCase()," found."]}),t.jsx(doe,{children:e.map((e=>t.jsxs(foe,{value:e.value,onSelect:e=>{r(e===n?"":e),l(!1)},children:[t.jsx(mu,{className:rp("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var Ife=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find($fe);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(Ffe,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(Ffe,{...o,ref:n,children:r})}));Ife.displayName="Slot";var Ffe=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?AZ(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));Ffe.displayName="SlotClone";var Ufe=({children:e})=>t.jsx(t.Fragment,{children:e});function $fe(e){return i.isValidElement(e)&&e.type===Ufe}var Vfe=["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?Ife: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}}),{}),Bfe="horizontal",zfe=["horizontal","vertical"],Hfe=i.forwardRef(((e,n)=>{const{decorative:r,orientation:o=Bfe,...i}=e,a=function(e){return zfe.includes(e)}(o)?o:Bfe;return t.jsx(Vfe.div,{"data-orientation":a,...r?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...i,ref:n})}));Hfe.displayName="Separator";var qfe=Hfe;const Gfe=i.forwardRef((({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>t.jsx(qfe,{ref:i,decorative:r,orientation:n,className:rp("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",e),...o})));Gfe.displayName=qfe.displayName;const Kfe=au("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"}}),Wfe=i.forwardRef((({options:e,onValueChange:n,variant:r,placeholder:o="Select options",animation:a=0,maxCount:s=3,className:l,extraCommandItems:c,searchPlaceholder:u="Search...",handleSearchInput:d,emptyMessage:p="No results found.",searchIcon:f=t.jsx(Wu,{className:"h-4 w-4 mr-2"}),selectedValues:h,setSelectedValues:m,...g},v)=>{const[y,b]=i.useState(!1),[x,w]=i.useState(!1);i.useEffect((()=>{const e=e=>{"Escape"===e.key&&y&&b(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[y]),i.useEffect((()=>{y||(document.body.style.pointerEvents="")}),[y]);const _=e=>{const t=h.includes(e)?h.filter((t=>t!==e)):[...h,e];m(t),n(t)},S=()=>{m([]),n([])};return t.jsxs(v9,{open:y,onOpenChange:e=>{b(e)},modal:!1,children:[t.jsx(y9,{asChild:!0,children:t.jsx("button",{type:"button",ref:v,...g,onClick:()=>{b((e=>!e))},className:rp("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",l),children:t.jsxs("div",h.length>0?{className:"flex justify-between items-center w-full",children:[t.jsxs("div",{className:"flex flex-wrap items-center",children:[h.slice(0,s).map((n=>{const o=e.find((e=>e.value===n)),i=o?.icon;return t.jsxs(YZ,{className:rp(x?"animate-bounce":"",Kfe({variant:r})),style:{animationDuration:`${a}s`},children:[i&&t.jsx(i,{className:"h-4 w-4 mr-2"}),o?.label,t.jsx(Eu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),_(n)}})]},n)})),h.length>s&&t.jsxs(YZ,{className:rp("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",x?"animate-bounce":"",Kfe({variant:r})),style:{animationDuration:`${a}s`},children:[`+ ${h.length-s} more`,t.jsx(Eu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),(()=>{const e=h.slice(0,s);m(e),n(e)})()}})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(cd,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:e=>{e.stopPropagation(),S()}}),t.jsx(Gfe,{orientation:"vertical",className:"flex min-h-6 h-full"}),t.jsx(gu,{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(gu,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),t.jsx(b9,{className:"w-auto p-0",align:"start",onEscapeKeyDown:()=>{b(!1),document.body.style.pointerEvents=""},children:t.jsxs(soe,{children:[t.jsx(loe,{searchIcon:f,placeholder:u,onKeyDown:e=>{if("Enter"===e.key)b(!0),d&&(d(e.currentTarget.value),b(!1));else if("Backspace"===e.key&&!e.currentTarget.value){const e=[...h];e.pop(),m(e),n(e)}}}),t.jsxs(coe,{children:[t.jsx(uoe,{children:p}),t.jsxs(doe,{children:[t.jsxs(foe,{onSelect:()=>{if(h.length===e.length)S();else{const t=e.map((e=>e.value));m(t),n(t)}},className:"cursor-pointer",children:[t.jsx("div",{className:rp("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",h.length===e.length?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(mu,{className:"h-4 w-4"})}),t.jsx("span",{children:"(Select All)"})]},"all"),e.map((e=>{const n=h.includes(e.value);return t.jsxs(foe,{onSelect:()=>_(e.value),className:"cursor-pointer",children:[t.jsx("div",{className:rp("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(mu,{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(poe,{}),t.jsx(doe,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[h.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(foe,{onSelect:S,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),t.jsx(Gfe,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),t.jsx(foe,{onSelect:()=>b(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"}),c&&c.map((e=>e(b)))]})})]})]})}),a>0&&h.length>0&&t.jsx(ld,{className:rp("cursor-pointer my-2 text-foreground bg-background w-3 h-3",x?"":"text-muted-foreground"),onClick:()=>w(!x)})]})}));Wfe.displayName="MultiSelect";var Yfe="Switch",[Xfe,Zfe]=nJ(Yfe),[Qfe,Jfe]=Xfe(Yfe),ehe=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=NZ(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=iJ({prop:a,defaultProp:s,onChange:d});return t.jsxs(Qfe,{scope:r,checked:b,disabled:c,children:[t.jsx(dJ.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":ohe(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onClick:tJ(e.onClick,(e=>{x((e=>!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(rhe,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})}));ehe.displayName=Yfe;var the="SwitchThumb",nhe=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=Jfe(the,r);return t.jsx(dJ.span,{"data-state":ohe(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})}));nhe.displayName=the;var rhe=e=>{const{control:n,checked:r,bubbles:o=!0,...a}=e,s=i.useRef(null),l=Wne(r),c=v1(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 ohe(e){return e?"checked":"unchecked"}var ihe=ehe,ahe=nhe;const she=i.forwardRef((({className:e,...n},r)=>t.jsx(ihe,{className:rp("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(ahe,{className:rp("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")})})));she.displayName=ihe.displayName;const lhe=({onSelect:e,date:n,placeholder:r="Pick a date",monthDayOnly:o=!1})=>t.jsxs(v9,{modal:!0,children:[t.jsx(y9,{asChild:!0,children:t.jsxs(MZ,{variant:"outline",className:rp("w-[200px] justify-start text-left font-normal h-9",!n&&"text-muted-foreground"),children:[t.jsx(hu,{className:"mr-2 h-4 w-4"}),n?E7(n,o?"MMMM d":"PPP"):t.jsx("span",{children:r})]})}),t.jsx(b9,{className:"w-auto p-0",align:"start",children:t.jsx(Nfe,{mode:"single",selected:n,onSelect:e,initialFocus:!0})})]}),che=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===jfe.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),uhe=({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===mZ.Date||e===mZ.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:jfe.DAYS,direction:"before"}),[v,y]=i.useState(u?r[0]:void 0),[b,x]=i.useState(!1);if(i.useEffect((()=>{n!==vZ.EQUALS_MONTH_DAY&&n!==vZ.EQUALS_MONTH_DAY_YEAR&&f&&(h(!1),o(d?[d]:[]))}),[n,f,d,o]),i.useEffect((()=>{if(u&&v?.startDate){x("object"==typeof v.startDate&&"type"in v.startDate)}}),[u,v]),e===mZ.String||e===mZ.ReachResource||e===mZ.Array)return n===vZ.EXISTS?null:t.jsx(Wfe,{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 mZ.ReachResource:case mZ.Array:case mZ.String:return t.length>0;case mZ.Number:return!isNaN(Number(t));case mZ.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case mZ.Boolean:return"true"===t||"false"===t;case mZ.Date:case mZ.DateTime:return!isNaN(new Date(t).getTime());default:throw Eoe(n,mZ)}})({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===mZ.Date||e===mZ.DateTime){const e=n===vZ.EQUALS_MONTH_DAY||n===vZ.EQUALS_MONTH_DAY_YEAR,r=n===vZ.BETWEEN_MONTH_DAY||n===vZ.BETWEEN_MONTH_DAY_YEAR,i=e=>{che(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&&(!che(t)||!che(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&&che(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(lhe,{date:d,onSelect:l,monthDayOnly:n===vZ.EQUALS_MONTH_DAY}),e&&f&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(s5,{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(Pne,{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(jne,{placeholder:"Select direction..."})}),t.jsxs(Ine,{children:[t.jsx(Fne,{value:"before",children:"days before today"}),t.jsx(Fne,{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(s5,{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:jfe.DAYS,direction:v?.startDate?.direction||"before"};che(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),t.jsxs(Pne,{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:jfe.DAYS,direction:e};che(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},children:[t.jsx(Mne,{className:"w-[180px] h-9",children:t.jsx(jne,{placeholder:"Select direction..."})}),t.jsxs(Ine,{children:[t.jsx(Fne,{value:"before",children:"days before today"}),t.jsx(Fne,{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(lhe,{placeholder:"Start date",date:v?.startDate instanceof Date||"string"==typeof v?.startDate?v.startDate instanceof Date?v.startDate:new Date(v.startDate):void 0,monthDayOnly:n===vZ.BETWEEN_MONTH_DAY,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(s5,{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:jfe.DAYS,direction:v?.endDate?.direction||"before"};che(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),t.jsxs(Pne,{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:jfe.DAYS,direction:e};che(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},children:[t.jsx(Mne,{className:"w-[180px] h-9",children:t.jsx(jne,{placeholder:"Select direction..."})}),t.jsxs(Ine,{children:[t.jsx(Fne,{value:"before",children:"days before today"}),t.jsx(Fne,{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(lhe,{placeholder:"End date",date:v?.endDate instanceof Date||"string"==typeof v?.endDate?v.endDate instanceof Date?v.endDate:new Date(v.endDate):void 0,monthDayOnly:n===vZ.BETWEEN_MONTH_DAY,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(she,{id:"between-relative-date-switch",checked:b,onCheckedChange:e=>{if(x(e),e){const e={type:"relative",value:0,unit:jfe.DAYS,direction:"before"},t={type:"relative",value:0,unit:jfe.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(nee,{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(she,{id:"relative-date-switch",checked:f,onCheckedChange:c,"aria-label":"Toggle relative date input"}),t.jsx(nee,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===mZ.Number||e===mZ.Integer)return n===vZ.EXISTS?null:t.jsx(s5,{type:"number",value:r.length>0?String(r[0]):"",onChange:e=>o([Number(e.target.value)]),className:"w-[200px]"});if(e===mZ.Boolean){if(n===vZ.EXISTS)return null;const e=r.length>0&&Boolean(r[0]);return t.jsx(she,{checked:e,onCheckedChange:e=>o([e])})}return t.jsx(s5,{value:r.length>0?String(r[0]):"",onChange:e=>o([e.target.value]),className:"w-[200px]",disabled:!0})},dhe=({condition:e,onUpdate:n,onDuplicate:r,onDelete:o,segmentsConditions:i})=>{const{toast:a}=Il(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:mZ.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:Lfe[e]||e})));return t.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch gap-2 min-w-0 w-full",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row flex-1 items-stretch gap-2 min-w-0 w-full",children:[t.jsx("div",{className:"flex-1 min-w-0 items-center flex",children:t.jsx(Dfe,{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:Mfe[e]||e,fieldType:o.type}))),s=a[0]?.value;let l=[];switch(o.type){case mZ.Boolean:l=[!1];break;case mZ.Number:l=[0];break;case mZ.Date:case mZ.DateTime:l=[new Date];break;case mZ.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",className:"w-full"})}),t.jsxs("div",{className:"flex-1 min-w-0 max-w-xs flex gap-2 items-center",children:[(e.operator===vZ.EQUALS_MONTH_DAY||e.operator===vZ.EQUALS_MONTH_DAY_YEAR||e.operator===vZ.BETWEEN_MONTH_DAY||e.operator===vZ.BETWEEN_MONTH_DAY_YEAR)&&t.jsx("div",{className:"flex items-center",children:(e=>{let n;switch(e){case vZ.EQUALS_MONTH_DAY:n="This operator will check if only the month and day are equal. This is useful for things like birthday, where year does not matter";break;case vZ.EQUALS_MONTH_DAY_YEAR:n="This operator will check if only the month and day are equal. This is useful for things like appointment dates, where specific day and month is important but year does not matter";break;case vZ.BETWEEN_MONTH_DAY:n="This operator will check if the date is between the two dates, but only checking the month and the day, not the year. This is helpful for things like birthday, where year does not matter";break;case vZ.BETWEEN_MONTH_DAY_YEAR:n="This operator will check if the date is between the two dates, checking the month, day and year. This is helpful for things like appointment dates, where specific day, month and year is important";break;default:return null}return t.jsx(G7,{title:n})})(e.operator)}),t.jsx(Dfe,{options:l.map((e=>({value:e,label:Mfe[e]||e}))),value:e.operator,onChange:t=>n({...e,operator:t}),placeholder:"Select operator",className:"w-full"})]}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(uhe,{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 flex-shrink-0 pl-2",children:[t.jsx(MZ,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(Cu,{className:"h-4 w-4"})}),t.jsx(MZ,{size:"icon",variant:"ghost",onClick:o,children:t.jsx(td,{className:"h-4 w-4"})})]})]})},phe=({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(IZ,{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(Ju,{className:"w-full h-full"})})}),selected:"ai"===r}),t.jsx(IZ,{onClick:()=>{o("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${bf("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(Xu,{className:"w-full h-full"})})}),selected:"manual"===r})]})},fhe=({segmentId:e,setOpen:n,setTextToSegment:r,promptBuilderStyle:o,textToSegment:i})=>t.jsx("div",{children:t.jsx(LB,{className:"",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(IB,{className:"text-3xl font-normal",children:e?`Edit ${bf("engage:segment")}`:`Create ${bf("engage:segment")}`}),t.jsxs("div",{className:"flex items-center gap-2",children:[!1===o&&!1===i&&t.jsx(P6,{children:t.jsxs(k6,{children:[t.jsx(j6,{asChild:!0,children:t.jsx(MZ,{variant:"outline",size:"sm",onClick:()=>r(!0),children:t.jsx(Ju,{className:"h-4 w-3"})})}),t.jsx(M6,{children:t.jsxs("p",{children:["Use AI to create ",bf("engage:segment")," by describing them in natural language"]})})]})}),t.jsx(MZ,{variant:"ghost",size:"icon",onClick:()=>{n(!1)},className:"h-8 w-8",children:t.jsx(cd,{className:"h-4 w-4"})})]})]})})}),hhe=({setTextToSegment:e,setSegment:r})=>{const[o,i]=n.useState(""),[a,s]=n.useState(!1),{toast:c}=Il();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(QB,{children:[a&&t.jsx(TZ,{children:t.jsx(EZ,{})}),!a&&t.jsx(TZ,{children:t.jsx(hoe,{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(MZ,{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:`${bf("engage:segment")} conditions built successfully 🚀`,description:`Your ${bf("engage:segment")} conditions have been built successfully`}),r(t.conditions)):c({title:`${bf("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[t.jsx(Ju,{className:"h-4 w-4"}),"Generate ",bf("engage:segment")]})})]})]})};function mhe({segmentId:e,setOpen:n,onSegmentUpdated:r}){const{toast:o}=Il(),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}=fZ(e||""),{updateSegment:f}=hZ(e),{createSegment:h,isCreating:m,segmentsConditions:g}=uZ(),[v,y]=i.useState(!1),[b,x]=i.useState(!!a);i.useEffect((()=>{g&&u(d?{version:"1.0",id:d.id,name:d.name,description:d.description,logic:"AND",conditions:d.conditions}:{version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[{field:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})}),[d,g]);const w=e=>e.value.some((e=>"object"==typeof e&&"type"in e&&"relative"===e.type)),_=e=>e.value.some((e=>"object"==typeof e&&"startDate"in e&&"endDate"in e));if(!g||p)return t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(EZ,{})});return t.jsxs(t.Fragment,{children:[t.jsx(fhe,{segmentId:e,setOpen:n,setTextToSegment:y,promptBuilderStyle:b,textToSegment:v},"segment-builder-header"),b?t.jsx(TZ,{children:t.jsx(phe,{onSelectStyle:e=>{"ai"===e&&y(!0),x(!1)}})},"prompt-builder-style"):t.jsx(TZ,{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(QB,{children:v?t.jsx(TZ,{children:t.jsx(hhe,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(TZ,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(nee,{className:"text-muted-foreground text-xs",children:"Name"}),t.jsx(s5,{placeholder:`${bf("engage:segment")} name`,value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(nee,{className:"text-muted-foreground text-xs",children:"Description"}),t.jsx(s5,{placeholder:`${bf("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(QB,{mode:"popLayout",children:c.conditions.map(((e,n)=>t.jsxs(DX.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(DX.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[t.jsx(DX.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(DX.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),t.jsx(DX.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(dhe,{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(MZ,v?{variant:"secondary",onClick:()=>y(!1),children:[t.jsx(Xu,{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(Gu,{className:"h-4 w-4"}),"Add Condition"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(MZ,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(MZ,{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!==vZ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===vZ.EXISTS&&t.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${t.field}`};if(w(t)&&t.operator!==vZ.EQUALS_MONTH_DAY&&t.operator!==vZ.EQUALS_MONTH_DAY_YEAR)return{valid:!1,error:`Relative dates can only be used with the month and day or month, day, and year operator for ${t.field}`};if(w(t)&&void 0===t.value[0].value)return{valid:!1,error:`Please select a value for the relative date for ${t.field}`};if(_(t)&&t.operator!==vZ.BETWEEN_MONTH_DAY&&t.operator!==vZ.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===jfe.DAYS)return e.value??0;throw HX(e.unit,jfe)};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===mZ.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:`${bf("engage:segment")} updated successfully`}),n(!1),r?.(e)},onError:()=>{o({title:`Error updating ${bf("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}}):h({name:c.name,description:c.description,conditions:c.conditions},{onSuccess:e=>{o({title:`${bf("engage:segment")} created successfully`}),r?.(e?.id??!1),n(!1)},onError:()=>{o({title:`Error creating ${bf("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}})}catch(s){o({title:`Error saving ${bf("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(Mu,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})}function ghe({open:e,setOpen:n,segmentId:r,onSegmentUpdated:o}){return t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-6xl w-full",hideCloseButton:!0,children:[t.jsxs(s$,{children:[t.jsxs(IB,{children:[bf("engage:segment")," Builder"]}),t.jsxs(FB,{children:["Build a ",bf("engage:segment")," to target your audience"]})]}),t.jsx(mhe,{segmentId:r,setOpen:n,onSegmentUpdated:e=>{o?.(e),n(!1)}})]})})}const vhe=({value:e,label:n,percentage:r,variant:o,isLoading:i,selected:a})=>t.jsxs("div",{className:"rounded-md border-2 border-muted-foreground/20 px-2 pt-2 pb-3 duration-300 ease-in-out overflow-x-auto max-w-full min-w-0 "+(a?"scale-[1.02] [border-color:hsl(var(--reach-primary))] shadow-lg":""),style:{containerType:"inline-size"},"data-card-container":!0,children:[t.jsxs("div",{className:"flex flex-col gap-1 items-start w-full min-w-0",children:[t.jsx("div",{className:"flex items-baseline gap-2 w-full min-w-0 @container/num",children:i?t.jsx("span",{className:"animate-pulse",children:"..."}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-semibold pl-2 break-words max-w-full min-w-0 truncate\n text-xl @[250px]/card:text-2xl @[350px]/card:text-3xl @[500px]/card:text-4xl text-primary",children:e.toLocaleString()}),void 0!==r&&e.toLocaleString().replace(/,/g,"").length<5&&t.jsxs("span",{className:"text-muted-foreground/50 text-sm hidden @[120px]/num:inline",children:["(",r,"%)"]})]})}),t.jsx("span",{className:`px-2 sm:px-2.5 py-1 text-xs font-medium rounded-lg ${{default:"bg-gray-100/50 text-gray-700",blue:"bg-blue-100/50 text-blue-700",green:"bg-green-100/50 text-green-700"}[o]}`,children:n})]}),t.jsx("p",{className:"text-sm text-muted-fore hidden @[250px]/card:inline mt-1",children:1===e?"contact":"contacts"})]}),yhe=({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(Aue,{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(vhe,{value:r.total,label:"Total",variant:"default",isLoading:void 0===e}),t.jsx(vhe,{value:r.emails,label:"Email",percentage:o(r.emails),variant:"blue",isLoading:void 0===e}),t.jsx(vhe,{value:r.phones,label:"Phone",percentage:o(r.phones),variant:"green",isLoading:void 0===e})]})]})},bhe=({recipients:e})=>e?.length?t.jsx("div",{className:"bg-foreground/5 rounded-lg h-full relative overflow-hidden",children:t.jsx("div",{className:"absolute inset-0 w-full h-full overflow-y-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"sticky top-0 bg-foreground/5 backdrop-blur-sm",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Name"}),t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Contact"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-200/50",children:e.map(((e,n)=>t.jsxs("tr",{className:"hover:bg-white/50 transition-colors",children:[t.jsx("td",{className:"px-3 sm:px-4 py-3 text-sm text-gray-900",children:e.firstName||e.lastName?`${e.firstName||""} ${e.lastName||""}`.trim():"Not Provided"}),t.jsx("td",{className:"px-3 sm:px-4 py-3",children:t.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[e.email&&t.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-blue-100/50 text-blue-700 rounded-lg",children:"Email"}),e.phone&&t.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-green-100/50 text-green-700 rounded-lg",children:"Phone"})]})})]},n)))})]})})}):null,xhe=({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(Aue,{children:"Filter"}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[t.jsx(IZ,{onClick:()=>a("all"),title:`All ${bf("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(FZ.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(IZ,{onClick:()=>a("segments"),title:`Select ${bf("engage:user",{count:2})}`,subtitle:`Choose from ${bf("engage:segment",{count:2})}`,icon:t.jsx(FZ.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===o})]})]})},whe=({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(Wfe,{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(foe,{onSelect:()=>{e(!1),a(!0)},className:"cursor-pointer",children:[t.jsx(FZ.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},_he=({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(whe,{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(MZ,{onClick:()=>u(!c),className:"flex items-center gap-1 transition-colors",size:"sm",children:[t.jsx(DX.div,{animate:{rotate:c?180:0},transition:{duration:.2},children:t.jsx(FZ.DropdownMenuTrigger,{className:"w-5 h-5"})}),t.jsx("span",{children:"Don't send to"})]}),t.jsx(QB,{children:c&&t.jsx(DX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:t.jsx(whe,{segments:r,allSegments:s||[],onAddSegment:e=>o(e,"exclude"),onRemoveSegment:e=>i(e,"exclude"),setOpenCreateSegmentDialog:a})})})]})]})},She=({title:e="Preview Audience"})=>{const r=bZ(),[o,i]=n.useState("all"),[a,s]=n.useState(r?.includeSegmentIds||[]),[l,c]=n.useState(r?.excludeSegmentIds||[]),[u,d]=n.useState(!1),[p,f]=n.useState(!1),{segments:h,isLoading:m}=dZ(),{updateAutomation:g}=De(r?.id??""),[v,y]=n.useState(void 0),b=1===a.length&&0===l.length&&void 0!==h?.find((e=>e.type===gZ.ALL_USERS&&e.id===a[0]));n.useEffect((()=>{r&&!p&&(i(b||a.length>0&&0===l.length?"all":"segments"),lZ({includeSegments:a,excludeSegments:l}).then((e=>{y(e)})),f(!0))}),[r,b,p,a,l]);return n.useEffect((()=>{r&&p&&(JSON.stringify(a)===JSON.stringify(r.includeSegmentIds)&&JSON.stringify(l)===JSON.stringify(r.excludeSegmentIds)||(g({includeSegments:a,excludeSegments:l}),lZ({includeSegments:a,excludeSegments:l}).then((e=>{y(e)}))))}),[a,l,r,p,g]),t.jsxs(Nue,{title:e,children:[!m&&h&&p?t.jsxs("div",{className:"flex gap-8 w-full pb-4 px-4",children:[t.jsxs("div",{className:"flex flex-col flex-1 relative overflow-y-auto pb-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:[t.jsx(yhe,{countResponse:v}),t.jsx(xhe,{onSelectionChange:e=>{if(i(e),"all"===e){const e=h?.find((e=>e.type===gZ.ALL_USERS));if(!e)return;s([e.id]),c([])}},defaultValue:o}),t.jsx(QB,{children:"segments"===o&&t.jsx(DX.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(_he,{includedSegments:a,excludedSegments:l,handleAddSegment:(e,t)=>{"include"===t?s((t=>[...t,e])):c((t=>[...t,e]))},handleRemoveSegment:(e,t)=>{"include"===t?s((t=>t.filter((t=>t!==e)))):c((t=>t.filter((t=>t!==e))))},setOpenCreateSegmentDialog:d,segments:h,defaultIsExcludeOpen:l.length>0})})})]}),t.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:v?.recipients&&t.jsx(bhe,{recipients:v.recipients})})]}):t.jsx("div",{children:t.jsx(EZ,{text:["Fetching segments","Finishing up"]})}),t.jsx(ghe,{open:u,setOpen:d})]})},Ehe=()=>t.jsx(She,{title:"Select Audience"});var The=(e=>(e[e.SelectAudience=1]="SelectAudience",e[e.SelectCommunication=2]="SelectCommunication",e[e.Schedule=3]="Schedule",e[e.PreviewAndSend=4]="PreviewAndSend",e))(The||{});const Che="https://assets.embedreach.com/defaults/logo-placeholder-128.png",Ahe="You have not uploaded a custom logo. Please make sure to double check your email before sending!",Nhe=()=>{const e=bZ(),t=xZ(),r=n.useCallback((async n=>e?await(async e=>{const{currentStep:t,automation:n,communicationGroup:r}=e;switch(t){case The.SelectAudience:return{canMove:n.includeSegmentIds.length>0,errorMessage:"Please ensure you have selected at least one segment"};case The.SelectCommunication:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));if(!e)return{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"};if(!r||!r.smsChannelSenderId&&!r.emailChannelSenderId)return{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"};if(r.emailChannelSenderId&&(!r.emailHtmlBody||!r.emailSubject))return{canMove:!1,errorMessage:"Please ensure you have a email body and subject"};if(r.smsChannelSenderId&&!r.smsMessageBody)return{canMove:!1,errorMessage:"Please ensure you have a sms message body"};let t=null;return r.emailHtmlBody?.includes(Che)&&(t=Ahe),{canMove:!0,errorMessage:null,warningMessage:t}}case The.Schedule:{if(!n.triggerMetadata)return{canMove:!1,errorMessage:"Please make sure to select a time to send before starting!"};if(n.triggerMetadata.triggerType!==Ue.ONE_TIME)return{canMove:Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:null};if(!n.triggerMetadata?.scheduledAt)return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${bf("engage:broadcast")}`};if(!Boolean(n.triggerMetadata?.scheduledAt&&new Date(n.triggerMetadata.scheduledAt)>new Date))return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${bf("engage:broadcast")}`};if(!Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))))return{canMove:!1,errorMessage:"Please ensure you have set a valid email or sms communication"};const e=n.triggerMetadata;return{canMove:Boolean(e.scheduledAt&&new Date(e.scheduledAt)>new Date&&n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:`Please ensure you have set a valid future date for your ${bf("engage:broadcast")} automation`}}case The.PreviewAndSend:return{canMove:!0,errorMessage:null};default:Eoe(t,The)}})({currentStep:n,automation:e,communicationGroup:t}):{canMove:!1,errorMessage:`${bf("engage:broadcast")} not loaded`}),[e,t]);return{validateStep:r}},Rhe=({onFinish:e,getExtraMergeFields:r,onBeforeSchedule:o})=>{const i=bZ(),a=xZ(),{updateAutomation:s}=De(i?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:t}=pZ({automationId:e?.id??"",includeSegments:e?.includeSegmentIds??[],excludeSegments:e?.excludeSegmentIds??[]}),r=n.useMemo((()=>t?.recipients?t.recipients.reduce(((e,t)=>({emails:e.emails+(t.email?1:0),phones:e.phones+(t.phone?1:0)})),{emails:0,phones:0}):{emails:0,phones:0}),[t?.recipients]);return{estimatedMatches:t,estimatedMatchesStats:r}})(i??void 0),{validateStep:c}=Nhe(),[u,d]=n.useState(!1),[p,f]=n.useState(The.SelectAudience);if(!i||!p||!a)return t.jsx("div",{className:"flex-1 flex flex-col @container justify-center items-center h-[500px]",children:t.jsx(EZ,{text:[`Fetching ${bf("engage:broadcast")} data`,"Finishing up"]})});const h=(({automation:e,communicationGroup:n,getExtraMergeFields:r})=>e?[{id:"audience",title:"Audience",step:1,isValid:()=>e.includeSegmentIds.length>0,content:t.jsx(_oe,{content:t.jsx(Ehe,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Ue.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},{id:"content",title:"Content",step:2,isValid:()=>{const t=e.actionData?.find((e=>"send_communication"===e.actionType));return!(!t||!t.actionMetadata.communicationGroupId||!n||!n.smsChannelSenderId&&!n.emailChannelSenderId||!(!n.emailChannelSenderId||n.emailHtmlBody&&n.emailSubject)||n.smsChannelSenderId&&!n.smsMessageBody)},content:t.jsxs("div",{className:"flex flex-col gap-4 w-full p-6 rounded-xl bg-gray-100 flex-1 h-full",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:"Edit Content"}),t.jsx(woe,{getExtraMergeFields:r})]},"content"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"schedule",title:"Schedule",step:3,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Ue.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(_oe,{className:"flex-1",content:t.jsx(kfe,{})},"schedule"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"send",title:"Send",step:4,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Ue.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date(Date.now()+18e4)&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(_oe,{className:"flex-1",content:t.jsx(Oue,{})},"send"),footerConfig:{backText:"Back",nextText:"Schedule",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[])({automation:i,communicationGroup:a,getExtraMergeFields:r}),m=async()=>{const{canMove:t,errorMessage:n,warningMessage:r}=await c(p);t?(r&&Dl({title:r,variant:"warning"}),p===The.PreviewAndSend?await(async()=>{if(o)try{const t=await o({estimatedEmailRecipients:l?.emails||0,estimatedSmsRecipients:l?.phones||0});!0===t?(s({status:ze.ACTIVE}),Dl({title:`${bf("engage:broadcast")} scheduled!`}),e()):Dl({title:"Oops!",description:t,variant:"destructive"})}catch(t){Dl({title:"Oops!",description:"An error occurred while checking scheduling conditions",variant:"destructive"})}else s({status:ze.ACTIVE}),Dl({title:`${bf("engage:broadcast")} scheduled!`}),e()})():f(p+1)):Dl({title:"Oops!",description:n,variant:"destructive"})},g=()=>{p>The.SelectAudience&&f(p-1)},v=()=>{e()};return t.jsxs("div",{className:"flex-1 flex flex-col @container h-full min-h-0",children:[t.jsxs("header",{className:"w-full flex items-center gap-4 h-16 px-6",children:[t.jsx("h1",{className:"text-xl font-bold leading-none",children:i.name}),t.jsx("div",{className:"flex items-center gap-4",children:t.jsx(YZ,{variant:R7(i.status),children:x9[i.status]})})]}),t.jsxs("main",{className:"flex gap-4 flex-1 min-h-0",children:[t.jsx("div",{className:"hidden @[1000px]:block",children:t.jsx("nav",{className:"space-y-0 w-50 self-start pr-6 pl-8 pt-4 ",children:h.map((e=>t.jsx("div",{className:`\n rounded-md transition-colors\n ${e.step===p?"bg-[var(--reach-secondary)] text-[var(--reach-primary-foreground)] font-medium":e.step<p?"text-muted-foreground hover:bg-muted":"text-muted-foreground/60"}\n `,children:t.jsx(iQ,{label:e.title,isActive:e.step===p,isCompleted:e.isValid(),onClick:async()=>{if(!u)if(e.step>p){const{canMove:t,errorMessage:n,warningMessages:r}=await(async e=>{if(e<=p)return{canMove:!0,errorMessage:null};d(!0);try{const t=[];for(let n=p;n<e;n++){const{canMove:e,errorMessage:r,warningMessage:o}=await c(n);if(!e)return{canMove:e,errorMessage:r};o&&t.push(o)}return{canMove:!0,errorMessage:null,warningMessages:t}}finally{d(!1)}})(e.step);if(t){if(r&&r.length>0)for(const e of r)Dl({title:e,variant:"warning"});f(e.step)}else n&&Dl({title:"Cannot navigate to this step",description:n,variant:"destructive"})}else f(e.step)}})},e.step)))})}),t.jsx("section",{className:"flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0",children:t.jsx("div",{className:" overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex",children:t.jsx(QB,{children:t.jsx(TZ,{className:"pt-0 h-full",children:h.find((e=>e.step===p))?.content},p)})})})]}),t.jsx("footer",{className:"w-full flex justify-end shadow-md z-10 items-center h-16 px-6",children:t.jsx(F7,{handleSkipAndSaveAsDraft:v,handleBack:g,handleNext:m,hideBack:h.find((e=>e.step===p))?.footerConfig.hideBack??!1,backText:h.find((e=>e.step===p))?.footerConfig.backText??"Back",nextText:h.find((e=>e.step===p))?.footerConfig.nextText??"Next",backDisabled:h.find((e=>e.step===p))?.footerConfig.backDisabled??!1,nextDisabled:h.find((e=>e.step===p))?.footerConfig.nextDisabled()??!1})})]})},Ohe=({children:e,actionId:r})=>{const{setActionId:o}=n.useContext(XX);return n.useEffect((()=>{o(r)}),[r,o]),t.jsx("div",{children:e})},Phe=()=>t.jsxs("div",{children:[t.jsx("div",{className:BZ,children:t.jsx(FZ.OneTimeBroadcast,{})}),t.jsxs("h3",{className:zZ,children:[bf("engage:broadcast")," Broadcast"]}),t.jsx("p",{className:HZ,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),khe=()=>t.jsxs("div",{children:[t.jsx("div",{className:qZ,children:"Coming Soon"}),t.jsx("div",{className:BZ,children:t.jsx(FZ.RealtimeActivity,{})}),t.jsx("h3",{className:zZ,children:"Realtime Activity"}),t.jsx("p",{className:HZ,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),jhe=({selectedType:e,setAutomationName:n,automationName:r,setAutomationDescription:o,automationDescription:i})=>t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 max-w-lg mx-auto",children:[t.jsxs("h2",{className:"text-2xl font-semibold mb-8 text-center",children:["Name Your"," ",bf(e===Ue.ONE_TIME?"engage:broadcast":"engage:trigger_based")]}),t.jsxs("div",{className:"w-full space-y-6",children:[t.jsx("div",{className:"bg-gray-50 p-6 rounded-xl items-center justify-center text-center",children:(()=>{switch(e){case Ue.ONE_TIME:return t.jsx(Phe,{});case Ue.TRIGGER_BASED:return t.jsx(khe,{});default:throw Eoe(e,Ue)}})()}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationName",className:"block text-sm font-medium text-gray-900",children:"Name"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Only visible to your team"})]}),t.jsx(s5,{id:"automationName",type:"text",value:r,onChange:e=>n(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500 shadow-sm",placeholder:"e.g. April Newsletter Campaign",autoFocus:!0})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationDescription",className:"block text-sm font-medium text-gray-900",children:"Description"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Optional"})]}),t.jsx(hoe,{id:"automationDescription",value:i,onChange:e=>o(e.target.value),className:"w-full min-h-[80px] resize-none",placeholder:`Add any helpful context for your team. If left blank, we'll generate one for you when you start the ${bf("engage:broadcast").toLowerCase()}`})]})]})]})]}),Mhe=({onClose:e,automationType:r,currentStep:o,setCurrentStep:i,getExtraMergeFields:a,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:c}=Le(),[u,p]=n.useState(!1),[f,h]=n.useState(void 0),[m,g]=n.useState(void 0),[v,y]=n.useState(!1),[b,x]=n.useState(r?{name:void 0,description:void 0,type:r}:{name:void 0,description:void 0,type:void 0}),w=void 0!==b.name&&void 0!==b.type&&""!==b.name;n.useEffect((()=>{if(b.type&&!b.name&&!v){const e=new Date,t=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=e.toLocaleDateString([],{month:"long",day:"numeric"}),r=`${bf("engage:broadcast")} ${n} ${t}`,o="";x((e=>({...e,name:r,description:o}))),y(!0)}}),[b,v]);if(c||u)return t.jsx("div",{className:VZ,children:t.jsx(EZ,{text:[`Creating ${bf("engage:broadcast")}`,"Finishing up"]})});return t.jsxs("div",{className:OB("relative overflow-y-auto h-full p-8",o===LZ.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[t.jsx(QB,{mode:"wait",children:t.jsx(TZ,{className:"h-full",children:(()=>{switch(o){case LZ.ChooseAutomationType:return t.jsx(GZ,{onNext:e=>{x({...b,type:e}),i(LZ.SetAutomationName)}});case LZ.SetAutomationName:return b.type?t.jsx(jhe,{selectedType:b.type,setAutomationName:e=>{x({...b,name:e})},automationName:b.name??"",setAutomationDescription:e=>{x({...b,description:e})},automationDescription:b.description??""}):null;case LZ.OneTimeWizard:return f&&m?t.jsx(_Z,{automationId:f,children:t.jsx(Ohe,{actionId:m,children:t.jsx(Rhe,{onFinish:()=>{e?.(f)},getExtraMergeFields:a,onBeforeSchedule:s})})}):null;default:throw HX(o,LZ)}})()},o)}),o!==LZ.OneTimeWizard&&t.jsx("div",{className:"pt-2",children:t.jsx(DZ,{onClose:e,currentStep:o,setCurrentStep:i,isDisabled:!w,createAutomation:async()=>{if(!w||!b.name||!b.type)return;p(!0);l({name:b.name,type:b.type,description:b.description},{onSuccess:async t=>{if(t.id){const n=await(async e=>(await Oe(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),o=zX().toString();await ke(t.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:o}}]}),h(t.id),await nZ({automationId:t.id,actionId:o}),r===Ue.ONE_TIME?(i(LZ.OneTimeWizard),g(o),p(!1)):e?.(t.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{x({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==r})})]})};function Lhe({open:e,setOpen:r,onClose:o,automationType:i,getExtraMergeFields:a,replyToSettingsText:s,replyToSettingsLink:l,fromNameSettingsText:c,fromNameSettingsLink:u}){const[d,p]=n.useState(i?LZ.SetAutomationName:LZ.ChooseAutomationType);return n.useEffect((()=>{e&&p(i?LZ.SetAutomationName:LZ.ChooseAutomationType)}),[e,i]),t.jsx(c$,{children:t.jsx(u$,{replyToSettingsText:s,replyToSettingsLink:l,fromNameSettingsText:c,fromNameSettingsLink:u,children:t.jsx(PB,{open:e,onOpenChange:r,children:t.jsxs(MB,{hideCloseButton:d===LZ.OneTimeWizard,className:`flex max-h-[86vh] ${d===LZ.OneTimeWizard?"max-w-[90vw]":"max-w-4xl"} flex-col gap-0 overflow-visible p-0`,children:[t.jsx(LB,{children:t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs(s$,{children:[t.jsx(IB,{className:"text-3xl font-normal",children:"Create Automation"}),t.jsx(FB,{children:"Create a new automation to send messages to your customers."})]})})}),t.jsx(Mhe,{onClose:e=>{o?.(e),r(!1)},automationType:i,currentStep:d,setCurrentStep:p,getExtraMergeFields:a})]})})})})}const Dhe=({tabs:e,activeTab:r,onTabChange:o,tabsLocation:i="left",secondaryTabs:a=!1})=>{const s=n.useRef([]),[l,c]=n.useState({width:0,left:0});n.useEffect((()=>{const t=s.current[e.findIndex((e=>e.id===r))];t&&c({width:t.offsetWidth,left:t.offsetLeft})}),[r,e]);const u=e.find((e=>e.id===r));return t.jsxs("div",{className:"flex flex-col gap-4 w-full overflow-x-hidden h-full",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{className:"relative flex items-center gap-8 "+("left"===i?"w-full justify-start":"w-full justify-center"),children:[t.jsx("div",{className:"absolute bottom-0 h-[1px] rounded-full transition-all duration-300 ease-out\n bg-gradient-to-r from-primary to-primary/90\n shadow-[0_0_8px_rgba(var(--primary-rgb),0.3)]",style:{width:`${l.width}px`,left:`${l.left}px`}}),e.map(((e,n)=>t.jsx("button",{ref:e=>s.current[n]=e,onClick:()=>o(e.id),className:OB("relative px-7 py-3 transition-all duration-200 text-lg",r!==e.id&&"text-muted-foreground",a&&"text-sm"),children:e.label},e.id)))]})}),t.jsx("div",{className:"relative overflow-hidden flex-grow min-h-0",children:t.jsx("div",{className:"relative h-full",children:u?u.content:null})})]})},Ihe=e=>{if(!e)return"$0.00";const t="string"==typeof e?e.replace(/,/g,""):e,n=Number(t);return Number.isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(n)},Fhe="reach-styles-module__header___-izE2",Uhe="reach-styles-module__title___n1hA9",$he="reach-styles-module__description___EvXM-",Vhe="reach-styles-module__content___okv68",Bhe="reach-styles-module__footer___YA4U4",zhe=au("reach-styles-module__base___zJcoE",{variants:{variant:{default:"reach-styles-module__default___88Q0d",destructive:"reach-styles-module__destructive___5EWhN",outline:"reach-styles-module__outline___gj9sC",secondary:"reach-styles-module__secondary___cN5Wj"}},defaultVariants:{variant:"default"}}),Hhe=i.forwardRef((({className:e,variant:n,...r},o)=>t.jsx("div",{ref:o,className:rp(zhe({variant:n}),e),...r})));Hhe.displayName="Card";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp(Fhe,e),...n}))).displayName="CardHeader";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp(Uhe,e),...n}))).displayName="CardTitle";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp($he,e),...n}))).displayName="CardDescription";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp(Vhe,e),...n}))).displayName="CardContent";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp(Bhe,e),...n}))).displayName="CardFooter";const qhe=({Icon:e,title:n,value:r,tooltipText:o,change:i})=>t.jsxs(Hhe,{className:"relative flex flex-col justify-between min-h-[130px] transition-all duration-300 hover:shadow-md p-4",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsx("div",{className:"rounded-lg p-2 bg-primary/10 flex items-center justify-center",children:t.jsx(e,{className:"w-5 h-5 text-primary"})}),t.jsx("div",{className:"absolute top-3 right-3",children:t.jsx(G7,{title:o})})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx("div",{className:"text-2xl font-bold leading-tight text-primary",children:r}),t.jsx(Aue,{children:n})]}),i&&t.jsx("div",{className:"absolute bottom-3 right-3",children:t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-green-100 text-green-600 text-xs font-semibold",children:i})})]}),Ghe=({activeTab:e,automation:n})=>{if(!n)return null;const r={sales:[{Icon:FZ.SalesAmount,title:"Order Amount",value:Ihe(n.derivedRevenue),tooltipText:"Total derived revenue from this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx(qhe,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Khe=({activeTab:e,statistics:n})=>{const r={email:[{Icon:FZ.MessagesSent,title:"Emails Sent",value:n.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:FZ.OpenRate,title:"Open Rate",value:`${(100*n.email.openPercentage).toFixed(2)}%`,tooltipText:"Percentage of recipients who opened the email out of total emails delivered"},{Icon:FZ.TotalBounceRate,title:"Total Bounce Rate",value:`${(100*(n.email.softBounceRate+n.email.hardBounceRate)).toFixed(2)}%`,tooltipText:"Percentage of emails that were not delivered due to permanent (hard) or temporary (soft) delivery failures"},{Icon:FZ.LinksClicked,title:"Links Clicked",value:n.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:FZ.SpamComplies,title:"Spam Complaints",value:`${(100*n.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:FZ.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*n.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:FZ.MessagesSent,title:"SMS Sent",value:n.sms.numberSent,tooltipText:"Total number of SMS messages that were successfully sent in this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx(qhe,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Whe=({automationId:e,includeSales:r=!1,includeSms:o=!1,automation:i})=>{const[a,s]=n.useState("email"),{statistics:l,isLoading:c}=Ie(e);if(c||!l)return t.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:t.jsx(EZ,{text:[`Fetching ${bf("engage:insight",{count:2})}`,"Finishing up"]})});const u=[{id:"email",label:`Email ${bf("engage:insight",{count:2})}`,content:t.jsx(Khe,{activeTab:"email",statistics:l})},...o?[{id:"sms",label:`SMS ${bf("engage:insight",{count:2})}`,content:t.jsx(Khe,{activeTab:"sms",statistics:l})}]:[],...r?[{id:"sales",label:`Sales ${bf("engage:insight",{count:2})}`,content:t.jsx(Ghe,{activeTab:"sales",automation:i})}]:[]];return t.jsx(Dhe,{tabs:u,activeTab:a,onTabChange:e=>s(e),tabsLocation:"left"})},Yhe={all:["website"],content:()=>[...Yhe.all,"content"],analyze:()=>[...Yhe.all,"analyze"],brandSettings:()=>[...Yhe.all,"brand-settings"]},Xhe=async()=>(await Oe("/web-presence/brand-settings",{method:"POST"})).data,Zhe=({isLoading:e,brandSettings:r,onComplete:o})=>{const[i,a]=n.useState(0),s=[{text:"Analyzing your brand palette",icon:Bu},{text:"Extracting your visual identity",icon:Nu},{text:"Discovering your brand personality",icon:Ou},{text:"Crafting your email style",icon:Du},{text:"Finalizing your brand profile",icon:_u}];n.useEffect((()=>{if(!e)return;const t=setInterval((()=>{a((e=>{const n=e+1;return n>=s.length?(clearInterval(t),setTimeout((()=>{o()}),1500),e):n}))}),2500);return()=>clearInterval(t)}),[e,o,s.length]);return t.jsx(DX.div,{className:"flex flex-col items-center justify-center h-full w-full bg-background p-6",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},children:t.jsxs("div",{className:"flex flex-col items-center gap-8 max-w-2xl w-full",children:[t.jsx(DX.div,r?.logoUrl?{className:"w-24 h-24 sm:w-32 sm:h-32 flex items-center justify-center rounded-xl overflow-hidden bg-card shadow-md border",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:t.jsx("img",{src:r.logoUrl,alt:"Brand Logo",className:"max-w-full max-h-full object-contain"})}:{className:"w-24 h-24 sm:w-32 sm:h-32 rounded-xl flex items-center justify-center shadow-md border bg-primary",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:r?.brandName?t.jsx("span",{className:"text-4xl sm:text-5xl font-bold text-white",children:r.brandName.charAt(0)}):t.jsx(Ju,{className:"w-12 h-12 sm:w-16 sm:h-16 text-white"})}),t.jsx(DX.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-xl font-medium text-center text-foreground",children:s[i].text},`loading-${i}`),t.jsx("div",{className:"flex items-center justify-center space-x-8 sm:space-x-12",children:s.map(((e,n)=>{const r=n<=i,o=n===i;return t.jsxs(DX.div,{className:"relative flex items-center justify-center w-12 h-12 rounded-full border-2 "+(r?"bg-card shadow-md border-primary":"bg-muted border-muted-foreground/30"),initial:{scale:.8,opacity:.5},animate:{scale:o?1.1:1,opacity:r?1:.5},transition:{duration:.3},children:[t.jsx(e.icon,{className:"w-5 h-5 "+(r?"text-primary":"text-muted-foreground")}),o&&t.jsx(DX.div,{className:"absolute inset-0 rounded-full border-2 border-primary",initial:{scale:1,opacity:.8},animate:{scale:2.5,opacity:0},transition:{duration:3,repeat:1/0,ease:"easeOut"}})]},`step-${n}`)}))}),t.jsx(DX.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.8,duration:.6},className:"w-full",children:t.jsx("div",{className:"h-[140px] w-full max-w-lg mx-auto p-5 bg-gradient-to-br from-card/70 to-card/40 backdrop-blur-md rounded-2xl border border-border/60 shadow-lg",children:t.jsxs("div",{className:"h-full flex flex-col justify-center",children:[0===i&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80 text-center",children:"Extracted Color Palette"}),t.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[r?.primaryColor,...r?.secondaryColors||[]]?.slice(0,4).map(((e,n)=>t.jsx("div",{className:"flex flex-col items-center gap-1",children:t.jsx("div",{className:"w-10 h-10 rounded-xl border-2 border-white/50 shadow-md",style:{backgroundColor:e}})},n)))}),t.jsx("div",{className:"text-center text-xs text-muted-foreground",children:"Brand colors identified"})]}),1===i&&t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Identity"}),r?.brandName?t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xl font-bold",children:r.brandName}),r.brandTagline&&t.jsxs("div",{className:"text-sm text-muted-foreground italic px-4",children:['"',r.brandTagline,'"']}),t.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Visual identity extracted"})]}):t.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Extracting brand elements..."})]}),2===i&&t.jsxs("div",{className:"text-center space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Personality"}),r?.brandPersonality?t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-center gap-4",children:[r.brandPersonality.tone&&t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Tone"}),t.jsx("div",{className:"text-sm font-medium text-foreground capitalize px-2 py-1 bg-background/50 rounded-md",children:r.brandPersonality.tone})]}),r.brandPersonality.voice&&t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Voice"}),t.jsx("div",{className:"text-sm font-medium text-foreground capitalize px-2 py-1 bg-background/50 rounded-md",children:r.brandPersonality.voice})]})]}),r.brandPersonality.values&&r.brandPersonality.values.length>0&&t.jsx("div",{className:"flex justify-center gap-1 flex-wrap",children:r.brandPersonality.values.slice(0,3).map(((e,n)=>t.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded-full",children:e},n)))})]}):t.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Analyzing brand tone and voice..."})]}),3===i&&t.jsxs("div",{className:"text-center space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Email Template Preview"}),t.jsxs("div",{className:"bg-background/60 rounded-lg p-3 border border-border/30",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx("div",{className:"w-4 h-4 rounded"}),t.jsx("div",{className:"text-xs font-medium text-foreground",children:r?.brandName||"Your Brand"})]}),t.jsxs("div",{className:"text-xs text-muted-foreground text-left",children:["Email styling applied with your brand colors",r?.brandPersonality?.tone&&`, ${r.brandPersonality.tone} tone`,", and visual identity"]})]})]}),4===i&&t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Kit Complete"}),t.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[t.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Identity"}),t.jsx("div",{className:"text-sm font-medium text-foreground",children:r?.brandName?"✓":"—"})]}),t.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Colors"}),t.jsx("div",{className:"text-sm font-medium text-foreground",children:r?.primaryColor?"✓":"—"})]}),t.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Personality"}),t.jsx("div",{className:"text-sm font-medium text-foreground",children:r?.brandPersonality?.tone?"✓":"—"})]})]})]}),(0===i&&!r?.primaryColor&&!r?.colorPalette||1===i&&!r?.brandName||2===i&&!r?.brandPersonality)&&t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Analyzing brand data..."}),t.jsx("div",{className:"flex justify-center gap-1 mt-2",children:[...Array(3)].map(((e,n)=>t.jsx(DX.div,{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/50",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:1,repeat:1/0,delay:.2*n}},n)))})]})]})})},`content-${i}`)]})})},Qhe=({setAutoParse:e,onBrandSettingsGenerated:r,onForceRefresh:o})=>{const{data:i,updateWebsite:a,isUpdatingWebsite:s,updateBrandSettings:l}=pre(),c=be({mutationFn:Xhe,mutationKey:Yhe.brandSettings()}),[u,d]=n.useState(i?.website||""),[p,f]=n.useState(!1),[h,m]=n.useState(null),[g,v]=n.useState(!1),[y,b]=n.useState(!1),x=()=>{e(!1)};return y&&h?t.jsx(DX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(eme,{initialBrandSettings:h,onSave:()=>{h&&(l({logoBase64:h.logo_base64,primaryColor:h.primaryColor,secondaryColors:h.secondaryColors,brandTagline:h.brandTagline,brandName:h.brandName,brandPersonality:h.brandPersonality,colorPalette:h.colorPalette}),o&&o(),Dl({title:"Brand settings saved successfully 🚀",description:"Your brand identity has been updated."}),e(!1))},onBack:x,showAutoParseButton:!1})},"results"):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[t.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.jsxs(QB,{mode:"wait",children:[!g&&!y&&t.jsx(DX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col h-full",children:t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 space-y-8",children:[t.jsxs("div",{className:"space-y-2 w-full max-w-md",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block text-center",children:"Your Website URL"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-center",children:[t.jsx(s5,{type:"url",value:u,onChange:e=>d(e.target.value),placeholder:"https://example.com",className:"flex-1",disabled:!p}),t.jsx(QB,{mode:"wait",children:p?t.jsxs(DX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex gap-2",children:[t.jsx(MZ,{variant:"outline",size:"sm",onClick:()=>{f(!1),d(i?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),t.jsx(MZ,{size:"sm",onClick:async()=>{try{a(u),f(!1),Dl({title:"Website URL updated successfully 🎉",description:"Your website URL has been saved."})}catch(e){Dl({title:"Error updating website URL",description:"Please try again.",variant:"destructive"})}},disabled:s||!u,className:"w-full sm:w-auto",children:s?t.jsx(EZ,{}):"Save Changes"})]},"save"):t.jsx(DX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:t.jsx(MZ,{variant:"outline",size:"sm",onClick:()=>f(!0),className:"w-full sm:w-auto",children:"Edit URL"})},"edit")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl",children:[t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"What we'll analyze"}),t.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[t.jsx("li",{children:"• Your brand colors and color palette"}),t.jsx("li",{children:"• Your logo (if detectable)"}),t.jsx("li",{children:"• Your brand name and tagline"}),t.jsx("li",{children:"• Your brand's tone and personality"})]})]}),t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"How it helps you"}),t.jsx("p",{className:"text-sm text-gray-600",children:"Our AI will automatically extract your brand assets to create consistently styled emails that match your website. This helps maintain brand recognition and professionalism in all your communications."})]})]}),t.jsx(DX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"text-sm text-muted-foreground text-center max-w-md",children:"We'll use AI to analyze your website and extract your brand elements to create perfectly matched email templates."})]})},"url-confirmation"),g&&h&&t.jsx(DX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(Zhe,{isLoading:g,brandSettings:h,onComplete:()=>{v(!1),b(!0),Dl({title:"Brand settings generated successfully!",description:"Your brand identity has been analyzed."})}})},"analyzing"),g&&!h&&t.jsx(DX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 flex flex-col items-center justify-center h-full",children:t.jsxs(DX.div,{className:"flex flex-col items-center gap-8",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:5,repeat:1/0,repeatType:"reverse"},children:[t.jsxs(DX.div,{className:"relative w-24 h-24 flex items-center justify-center",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:[t.jsx(Wu,{className:"w-12 h-12 text-primary drop-shadow-md"}),t.jsx(DX.div,{className:"absolute inset-0 rounded-full border-2",style:{borderColor:"var(--primary)"},initial:{scale:1,opacity:.8},animate:{scale:2.5,opacity:0},transition:{duration:3,repeat:1/0,ease:"easeOut"}})]}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:"Analyzing your website"}),t.jsx(QB,{mode:"wait",children:t.jsx(DX.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-gray-600 max-w-md text-center px-4",children:"Generating your brand's unique visual identity and personality"},"loading-message")})]})]})},"pre-analyzing")]})}),!g&&!y&&t.jsxs(DB,{className:"p-4",children:[t.jsx(MZ,{variant:"outline",onClick:x,className:"gap-1",children:"Go Back"}),t.jsxs(MZ,{onClick:async()=>{try{v(!0);const e=await c.mutateAsync();m(e),r&&r(e)}catch(e){v(!1),m(null),Dl({title:"Error generating brand settings",description:"Please try again.",variant:"destructive"})}},disabled:!u||c.isPending,className:"gap-1",children:[t.jsx(Ju,{className:"h-4 w-4 text-amber-500"}),c.isPending?t.jsx(EZ,{}):"Analyze Website"]})]})]})},Jhe=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],eme=({initialBrandSettings:e,onSave:r,onBack:o,showAutoParseButton:i=!0})=>{const{data:a,isLoading:s,updateBrandSettings:l,isUpdatingBrandSettings:c}=pre(),[u,d]=n.useState({}),[p,f]=n.useState(!1),[h,m]=n.useState({}),[g,v]=n.useState(""),[y,b]=n.useState(""),[x,w]=n.useState("#000000"),[_,S]=n.useState(Date.now()),[E,T]=n.useState(!1),[C,A]=n.useState(null),[N,R]=n.useState({identity:!0,colors:!0,personality:!0}),O=n.useRef(null),{toast:P}=Il();n.useEffect((()=>{if(e)return d({brandName:e.brandName,brandTagline:e.brandTagline,logoUrl:e.logoUrl,primaryColor:e.primaryColor||"#000000",secondaryColors:e.secondaryColors||[],brandPersonality:{tone:e.brandPersonality?.tone,voice:e.brandPersonality?.voice,values:e.brandPersonality?.values||[]}}),void S(Date.now());a?.branding&&(d({brandName:a.branding.brandName||a.name,brandTagline:a.branding.brandTagline||"",logoUrl:a.branding.logoUrl||"",primaryColor:a.branding.primaryColor||"#000000",secondaryColors:a.branding.secondaryColors||[],brandPersonality:{tone:a.branding.brandPersonality?.tone,voice:a.branding.brandPersonality?.voice,values:a.branding.brandPersonality?.values||[]}}),S(Date.now()))}),[a,e]);const k=e=>{R((t=>({...t,[e]:!t[e]})))},j=e=>{m((t=>{const n={...t,[e]:!t[e]};return n[e]&&("brandName"===e?v(u.brandName||""):"brandTagline"===e?v(u.brandTagline||""):"primaryColor"===e?v(u.primaryColor||"#000000"):"tone"===e?v(u.brandPersonality?.tone||""):"voice"===e&&v(u.brandPersonality?.voice||"")),n}))},M=e=>{"brandName"===e?d((e=>({...e,brandName:g}))):"brandTagline"===e?d((e=>({...e,brandTagline:g}))):"primaryColor"===e?d((e=>({...e,primaryColor:g}))):"tone"===e?d((e=>({...e,brandPersonality:{...e.brandPersonality,tone:g||void 0}}))):"voice"===e&&d((e=>({...e,brandPersonality:{...e.brandPersonality,voice:g||void 0}}))),j(e)},L=e=>{j(e)},D=e=>{d((t=>({...t,primaryColor:e})))},I=()=>{y.trim()&&(d((e=>{const t=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:[...t,y.trim()]}}})),b(""))};return s?t.jsx("div",{className:"flex justify-center items-center h-full min-h-[500px] w-full bg-white rounded-lg shadow-sm",children:t.jsx(EZ,{})}):p?t.jsx(Qhe,{setAutoParse:f,onForceRefresh:()=>S(Date.now())}):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16",children:[t.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 px-6 pt-2",children:[t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>k("identity"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Identity"})]}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(N.identity?bu:gu,{className:"h-4 w-4"})})]}),N.identity&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Name"}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("brandName"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandName?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>L("brandName"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandName"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm font-medium",children:u.brandName})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Tagline"}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("brandTagline"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandTagline?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0,placeholder:"Your brand's tagline"}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>L("brandTagline"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandTagline"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm italic",children:u.brandTagline||"No tagline set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Logo"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Square image, 128x128px, PNG recommended"})]})}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-24 h-24 rounded-lg border-2 border-dashed border-gray-200 flex items-center justify-center bg-gray-50 overflow-hidden",children:u.logoUrl?t.jsx("img",{src:u?.logoUrl,alt:u.brandName||"Brand logo",className:"w-full h-full object-contain"},_):t.jsx(Pu,{className:"h-10 w-10 text-gray-300"})}),t.jsxs("div",{className:"absolute inset-0 bg-black bg-opacity-40 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:[t.jsx("input",{type:"file",ref:O,onChange:e=>{const t=e.target.files?.[0];if(t){const e=new FileReader;e.onloadend=async()=>{const n=e.result.split(",")[1];A(n);const r=URL.createObjectURL(t);d((e=>({...e,logoUrl:r}))),S(Date.now()),l({logoBase64:n})},e.readAsDataURL(t)}},accept:"image/*",className:"hidden"}),t.jsxs(MZ,{variant:"ghost",size:"sm",onClick:()=>{O.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[t.jsx(rd,{className:"h-4 w-4 mr-1"}),"Update"]})]})]}),u.logoUrl&&t.jsxs("div",{className:"flex-1 flex items-center gap-2 max-w-md bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx("div",{className:"flex-1 truncate text-sm text-gray-600 font-mono",children:u.logoUrl}),t.jsxs(MZ,{variant:"ghost",size:"sm",onClick:async()=>{if(u.logoUrl)try{await navigator.clipboard.writeText(u.logoUrl),T(!0),setTimeout((()=>T(!1)),1500),P({title:"Logo URL copied to clipboard"})}catch(FTe){try{const e=document.createElement("textarea");e.value=u.logoUrl,e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.focus(),e.select();const t=document.execCommand("copy");if(document.body.removeChild(e),!t)throw new Error("Fallback copy command failed");T(!0),setTimeout((()=>T(!1)),1500),P({title:"Logo URL copied to clipboard"})}catch(e){P({title:"Failed to copy URL",description:"Could not copy the URL to clipboard. Please try again or copy manually.",variant:"destructive"})}}},className:"h-7 px-2 text-xs shrink-0",children:[E?t.jsx(mu,{className:"h-3.5 w-3.5 mr-1 text-green-500"}):t.jsx(Cu,{className:"h-3.5 w-3.5 mr-1"}),E?"Copied":"Copy"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>k("colors"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Colors"})]}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(N.colors?bu:gu,{className:"h-4 w-4"})})]}),N.colors&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Primary Color"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Your main brand color used throughout the interface"})]}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("primaryColor"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-14 h-14 rounded-lg shadow-md",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsxs("div",h.primaryColor?{className:"flex flex-1 gap-2 max-w-sm",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Bu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx(s5,{type:"text",value:g,onChange:e=>v(e.target.value),className:"pl-10 h-10 font-mono text-sm flex-1",placeholder:"#000000",maxLength:7,autoFocus:!0})]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>L("primaryColor"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("primaryColor"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}:{className:"flex-1 max-w-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx(Bu,{className:"h-4 w-4 text-gray-400"}),t.jsx("div",{className:"text-sm font-mono",children:u.primaryColor||"#000000"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(s5,{type:"color",value:u.primaryColor||"#000000",onChange:e=>D(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:Jhe.map(((e,n)=>t.jsx(MZ,{variant:"ghost",size:"icon",className:"w-6 h-6 rounded-full border border-gray-200 "+(u.primaryColor===e?"ring-2 ring-gray-400 ring-offset-1":""),style:{backgroundColor:e},onClick:()=>D(e)},n)))})]})]})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Secondary Colors"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Additional colors that complement your primary brand color"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"flex flex-wrap gap-3 mb-4",children:u.secondaryColors?.length?u.secondaryColors.map(((e,n)=>t.jsxs("div",{className:"group relative flex flex-col items-center",children:[t.jsx("div",{className:"w-12 h-12 rounded-lg shadow-sm border border-gray-200 mb-1 group-hover:ring-2 ring-gray-200",style:{backgroundColor:e}}),t.jsx("div",{className:"text-xs font-mono text-gray-600",children:e}),t.jsx(MZ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.secondaryColors||[];return{...e,secondaryColors:n.filter((e=>e!==t))}}));var t},className:"absolute -top-1 -right-1 w-5 h-5 bg-white rounded-full shadow border border-gray-200 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(cd,{className:"w-3 h-3 text-gray-500"})})]},n))):t.jsx("div",{className:"text-sm text-gray-500 italic my-2",children:"No secondary colors set"})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex-1 max-w-xs",children:[t.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Add color"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(s5,{type:"color",value:x,onChange:e=>w(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded-md"}),t.jsx(s5,{type:"text",value:x,onChange:e=>w(e.target.value),className:"h-10 font-mono text-sm",placeholder:"#000000",maxLength:7})]})]}),t.jsxs(MZ,{variant:"outline",onClick:()=>{x&&(d((e=>{const t=e.secondaryColors||[];return{...e,secondaryColors:[...t,x]}})),w("#000000"))},className:"h-10",children:[t.jsx(Gu,{className:"h-4 w-4 mr-1"}),"Add Color"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>k("personality"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Personality"})]}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(N.personality?bu:gu,{className:"h-4 w-4"})})]}),N.personality&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Tone"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"The overall feeling and attitude your brand conveys"})]}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("tone"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.tone?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>L("tone"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("tone"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.tone||"No tone set"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Voice"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"How your brand expresses itself in communication"})]}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("voice"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.voice?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>L("voice"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("voice"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.voice||"No voice set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Values"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Core principles and beliefs that drive your brand"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"mb-4",children:t.jsx("div",u.brandPersonality?.values&&u.brandPersonality.values.length>0?{className:"flex flex-wrap gap-2",children:u.brandPersonality.values.map(((e,n)=>t.jsxs(YZ,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",style:{borderColor:`${u.primaryColor}30`||"#f3f4f6",backgroundColor:`${u.primaryColor}08`||"#f9fafb"},children:[e,t.jsx(MZ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:n.filter((e=>e!==t))}}}));var t},className:"ml-1.5 w-4 h-4 flex items-center justify-center rounded-full bg-gray-200 hover:bg-red-100 hover:text-red-500 transition-colors",children:t.jsx(cd,{className:"w-2.5 h-2.5"})})]},n)))}:{className:"text-sm text-gray-500 italic py-2",children:"No brand values set"})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{placeholder:"Add a brand value",value:y,onChange:e=>b(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&I()}),t.jsxs(MZ,{variant:"outline",onClick:I,disabled:!y.trim(),children:[t.jsx(Gu,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),t.jsxs(DB,{className:"pb-4 px-6",children:[o?t.jsx(MZ,{variant:"outline",className:"gap-1.5",onClick:o,children:"Go Back"}):i&&t.jsxs(MZ,{variant:"outline",className:"gap-1.5",onClick:()=>{f(!0)},children:[t.jsx(Ju,{className:"h-4 w-4 text-amber-500"}),"Auto Parse"]}),t.jsx(MZ,{className:"px-4",onClick:async()=>{let e;C?e=C:u.logoUrl?.startsWith("data:image/png;base64,")?e=u.logoUrl.split(",")[1]:u.logoUrl?.startsWith("blob:")&&(e=void 0),l({brandName:u.brandName,brandTagline:u.brandTagline,logoBase64:e,primaryColor:u.primaryColor,secondaryColors:u.secondaryColors,brandPersonality:u.brandPersonality}),P({title:"Brand settings saved 🚀"}),r&&r(),A(null)},disabled:c,children:c?"Saving":"Save Changes"})]})]})},tme=_le.object({channelSenderId:_le.string().min(1,"Please select a channel sender"),replyTo:_le.string().trim().min(1).email("Please enter a valid email address").or(_le.literal("").transform((()=>null))).or(_le.null()).optional(),fromName:_le.string().trim().min(1).or(_le.literal("").transform((()=>null))).or(_le.null()).optional()}),nme=()=>{const{channelSenders:e,isLoading:r}=V7(),{channelAccounts:o,isLoading:i}=U7(),{updateChannelSender:a,isUpdating:s}=B7(),{toast:l}=Il(),c=Qce({resolver:oue(tme),defaultValues:{channelSenderId:"",replyTo:"",fromName:""}}),u=n.useMemo((()=>z7({channelSenders:e?.results??[],channelAccounts:o?.results??[]})),[e?.results,o?.results]);if(n.useEffect((()=>{if(u&&u.length>0&&!c.getValues("channelSenderId")){const e=u[0];c.setValue("channelSenderId",e.channelSenderId),c.setValue("replyTo",e.channelSender.channelSenderMetadata.emailReplyTo??""),c.setValue("fromName",e.channelSender.channelSenderMetadata.emailFromName??"")}}),[u,c]),r||void 0===e||i||void 0===o)return t.jsx("div",{className:"flex justify-center items-center h-full py-10",children:t.jsx(EZ,{})});return t.jsxs("div",{className:"w-full max-w-4xl mx-auto mt-8",children:[t.jsxs("div",{className:"mb-6",children:[t.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-gray-900 mb-1",children:"Set up Your Email Channel"}),t.jsx("p",{className:"text-muted-foreground text-base",children:"Define your default sender name, email address, and reply-to to start sending emails with confidence."})]}),t.jsx(iue,{...c,children:t.jsxs("form",{onSubmit:c.handleSubmit((async e=>{const t=u.find((t=>t.channelSenderId===e.channelSenderId));t&&a({toUpdate:{channelSenderMetadata:{...t.channelSender.channelSenderMetadata,emailReplyTo:e.replyTo?e.replyTo:null,emailFromName:e.fromName?e.fromName:null}},id:t.channelSender.id},{onSuccess:()=>{l({title:"Email channel sender updated successfully!"})},onError:()=>{l({title:"Failed to update email channel sender",description:"Please contact your administrator",variant:"destructive"})}})})),className:"bg-white border border-gray-200 rounded-2xl shadow-sm p-8 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[t.jsx(due,{className:"flex items-center gap-1 text-base font-medium mb-2",children:"Email Channel Sender"}),t.jsxs(Pne,{value:c.watch("channelSenderId"),onValueChange:e=>{c.setValue("channelSenderId",e);const t=u.find((t=>t.channelSenderId===e));t&&c.setValue("replyTo",t.channelSender.channelSenderMetadata.emailReplyTo??"")},children:[t.jsx(Mne,{className:"w-full bg-gray-50 border-gray-200 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 rounded-lg min-h-[48px] text-base",children:t.jsx(jne,{placeholder:"Select a sender"})}),t.jsx(Ine,{children:u.map((e=>t.jsx(Fne,{value:e.channelSenderId,children:t.jsxs("div",{className:"flex flex-col text-left",children:[t.jsx("span",{className:"font-medium",children:e.fullDomain}),t.jsx("span",{className:"text-xs text-muted-foreground",children:e.channelSender.channelSenderMetadata.emailReplyTo||"No reply-to set"})]})},e.channelSenderId)))})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[t.jsxs(due,{className:"flex items-center gap-1 text-base font-medium mb-0.5",children:["Reply-to Email",t.jsx(G7,{title:"Reply to email to use when the reply button is clicked"})]}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal mb-1",children:["Optional – will use"," ",t.jsx("span",{className:"font-mono",children:c.watch("channelSenderId")?u.find((e=>e.channelSenderId===c.watch("channelSenderId")))?.fullDomain:"sender domain"})," ","if empty"]}),t.jsx(gue,{control:c.control,name:"replyTo",type:"email",placeholder:"Replies from recipients will go to this email (optional)"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[t.jsxs(due,{className:"flex items-center gap-1 text-base font-medium mb-0.5",children:["From Name",t.jsx(G7,{title:"From name to use when the email is sent"})]}),t.jsx(gue,{control:c.control,name:"fromName",placeholder:"From name to use when the email is sent"})]}),t.jsx("div",{className:"flex gap-3 pt-4 justify-end border-t border-gray-100",children:t.jsx(MZ,{type:"submit",disabled:s,className:"min-w-[120px]",children:s?"Saving...":"Save"})})]})})]})};function rme({tabs:e,activeTab:n,onTabChange:r,title:o}){return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:"w-48 py-2 pl-4",children:[o&&t.jsx("h2",{className:"px-4 pt-4 pb-5 text-lg font-medium",children:o}),e.map((e=>t.jsx(MZ,{variant:"ghost",className:rp("w-full justify-start mb-1",n===e.id&&"bg-accent"),onClick:()=>r(e.id),children:e.label},e.id)))]}),t.jsx("div",{className:"flex-1",children:e.find((e=>e.id===n))?.content})]})}function ome({open:e,setOpen:r}){const[o,i]=n.useState("brand");n.useEffect((()=>{e&&i("brand")}),[e]);const a=[{id:"brand",label:"Brand",content:t.jsx(eme,{})},{id:"email-channel",label:"Email Channel",content:t.jsx(nme,{})}];return t.jsx(PB,{open:e,onOpenChange:r,children:t.jsxs(MB,{className:"flex w-[90vw] h-[90vh] flex-col gap-0 overflow-hidden sm:max-w-xl md:max-w-3xl lg:max-w-4xl xl:max-w-5xl p-0",children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Settings"}),t.jsx(FB,{children:"Edit your business and brand settings"})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(rme,{tabs:a,activeTab:o,onTabChange:i,title:"Settings"})})]})})}const ime=e=>{const{updateAutomation:t,updateError:r,isUpdateSuccess:o}=De(e),{toast:i}=Il();return n.useEffect((()=>{o?i({title:"Status updated",description:"The status has been updated successfully"}):r&&i({title:"Error updating status",description:"Please try again",variant:"destructive"})}),[o,r,i]),{toggleStatus:async e=>{try{return await t({status:e?ze.ACTIVE:ze.DRAFT}),!0}catch(n){return i({title:"Error updating status",description:"Please try again",variant:"destructive"}),!1}}}};function ame(){const{toast:e}=Il(),[r,o]=n.useState(null),{toggleStatus:i}=ime(r||""),a=s4(),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{automations:f,nextCursor:h,isLoading:m,error:g,isFetching:v,isPlaceholderData:y}=Fe({cursor:c,limit:s,triggerType:Ue.TRIGGER_BASED,search:d||void 0});n.useEffect((()=>{g&&e({title:`Error Fetching ${bf("engage:automation")}`,description:g?.message||"Please try again.",variant:"destructive"})}),[g,e]);const b=n.useMemo((()=>(f||[]).map((e=>({...e,emailsSent:0,smsSent:0,updated_at:e.updatedAt||e.createdAt})))),[f]),x=n.useCallback((async(e,t)=>{try{o(e);const n=t===ze.ACTIVE;await i(n)}finally{o(null)}}),[i,o]),w=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]),_=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),S=n.useMemo((()=>I7({automationName:bf("engage:automation"),setUrl:_,onToggle:x,vsaasManaged:!0})),[x,_]);return t.jsx("div",{className:"w-full h-[75vh] flex flex-col",children:t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(c5,{data:b,columns:S,paginationMode:"cursor",initialPageSize:s,isLoading:m&&!y,onRowClick:e=>{a(`/automations/view-modal/${e.id}?showBackButton=true`)},cursorPaginationQueryResult:{nextCursor:h,isLoading:m,isFetching:v,isPlaceholderData:y},onQueryParametersChange:w,searchValue:d,onSearchChange:p})})})}function sme(){const{toast:e}=Il(),[r,o]=n.useState(!1),[i,a]=n.useState(null),{toggleStatus:s}=ime(i||""),l=s4(),[c,u]=n.useState(10),[d,p]=n.useState(void 0),[f,h]=n.useState(""),{automations:m,nextCursor:g,isLoading:v,error:y,isFetching:b,isPlaceholderData:x}=Fe({cursor:d,limit:c,triggerType:Ue.ONE_TIME,search:f||void 0});n.useEffect((()=>{y&&e({title:`Error Fetching ${bf("engage:broadcast")}`,description:y?.message||"Please try again.",variant:"destructive"})}),[y,e]);const w=n.useMemo((()=>(m||[]).map((e=>({...e,updated_at:e.updatedAt})))),[m]),_=n.useCallback((async(e,t)=>{try{a(e);const n=t===ze.ACTIVE;await s(n)}finally{a(null)}}),[s,a]),S=n.useCallback((e=>{p(e.cursor),u(e.pageSize)}),[]),E=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),T=n.useMemo((()=>I7({automationName:bf("engage:broadcast"),setUrl:E,onToggle:_})),[_,E]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(c5,{data:w,columns:T,paginationMode:"cursor",initialPageSize:c,headerActions:t.jsxs(MZ,{className:"bg-primary",onClick:()=>o(!0),children:[t.jsx(Gu,{className:"h-4 w-4 mr-1"}),"New"]}),isLoading:v&&!x,cursorPaginationQueryResult:{nextCursor:g,isLoading:v,isFetching:b,isPlaceholderData:x},onRowClick:e=>{l(`/automations/view-modal/${e.id}?showBackButton=true`)},onQueryParametersChange:S,searchValue:f,onSearchChange:h})}),t.jsx(Lhe,{open:r,setOpen:o,onClose:t=>{N7(o,e,t,`Error creating ${bf("engage:broadcast")}`,"Please try again"),p(void 0),u(10),h(""),!1!==t&&l(`/automations/view-modal/${t}?showBackButton=true`)},automationType:Ue.ONE_TIME})]})}function lme(){const{toast:e}=Il(),[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}=dZ({search:d||void 0,cursor:c,limit:s}),y=n.useCallback((e=>{a(e),o(!0)}),[a]),b=n.useMemo((()=>function(e){return[P7("name",`${bf("engage:segment")} Name`,!0),k7(),A7({accessorKey:"user_count",header:bf("engage:user_other"),meta:{align:"right",displayName:bf("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const t=e.getValue()??0;return`${t.toLocaleString()} ${1===t?bf("engage:user").toLowerCase():bf("engage:user_other").toLowerCase()}`}}),j7("user_count_updated_at"),D7(e||(()=>{}))]}(y)),[y]),x=n.useMemo((()=>f?f.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[f]),w=n.useMemo((()=>t.jsxs(MZ,{onClick:()=>{a(null),o(!0)},children:[t.jsx(Gu,{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(c5,{data:x,columns:b,paginationMode:"cursor",initialPageSize:s,headerActions:w,isLoading:h&&!v,cursorPaginationQueryResult:{nextCursor:m,isLoading:h,isFetching:g,isPlaceholderData:v},onQueryParametersChange:_,onRowClick:t=>{t.type!==gZ.MANAGED?(a(t.id),o(!0)):e({title:`Managed ${bf("engage:segment")} cannot be edited!`,variant:"destructive"})},searchValue:d,onSearchChange:p})}),t.jsx(ghe,{open:r,setOpen:o,segmentId:i??void 0,onSegmentUpdated:t=>{N7(o,e,t,`Error creating ${bf("engage:segment")}`,"Please try again"),u(void 0),l(10),p("")}})]})}const cme=()=>{const e=[{id:"automations",label:bf("engage:automation",{count:2}),content:t.jsx(ame,{})},{id:"broadcasts",label:bf("engage:broadcast",{count:2}),content:t.jsx(sme,{})},{id:"segments",label:bf("engage:segment",{count:2}),content:t.jsx(lme,{})},{id:"statistics",label:bf("engage:insight",{count:2}),content:t.jsx(Whe,{})}],r=ue(),[o,i]=n.useState(!1),[a,s]=n.useState(e[0].id);return n.useEffect((()=>{r.prefetchQuery({queryKey:Pe.list()}),r.prefetchQuery({queryKey:cZ.lists()})}),[r]),t.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[t.jsx(ome,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(MZ,{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(Dhe,{activeTab:a,tabs:e,onTabChange:s})})]})};function ume({value:e,schema:r,onSubmit:o,fieldName:i,className:a,successMessage:s="Updated successfully",errorMessage:l="Failed to update",placeholderText:c}){const[u,d]=n.useState(!1),[p,f]=n.useState(!1),[h,m]=n.useState(0),[g,v]=n.useState(0),[y,b]=n.useState(e),[x,w]=n.useState(e),_=n.useRef(null),S=n.useRef(null),E=n.useRef(null),T=n.useRef(null),{toast:C}=Il(),A=Qce({resolver:oue(r),defaultValues:{[i]:e}});n.useEffect((()=>{A.reset({[i]:e}),b(e),w(e)}),[e,i,A]),n.useEffect((()=>{S.current&&m(S.current.offsetWidth),T.current&&!u&&v(T.current.offsetWidth)}),[u]),n.useEffect((()=>{E.current&&y&&m(E.current.offsetWidth)}),[y]),n.useEffect((()=>{u&&_.current&&(_.current.focus(),_.current.select())}),[u]);const N=async e=>{f(!0);const t=e[i];try{await o(e),w(t),C({variant:"success",title:s}),d(!1)}catch(n){C({variant:"destructive",title:l})}finally{f(!1)}},R=()=>{A.reset(),d(!1),b(x)},O=e=>{"Escape"===e.key&&R()};return u?t.jsx(iue,{...A,children:t.jsxs("form",{onSubmit:A.handleSubmit(N),className:OB("inline-flex items-center gap-2 min-h-[20px]",a),style:{minWidth:g?`${g}px`:"auto"},children:[t.jsx("span",{ref:E,className:"absolute invisible whitespace-pre leading-none select-none pointer-events-none",style:{font:"inherit"},children:y||x}),t.jsx(sue,{control:A.control,name:i,render:({field:e})=>t.jsx(uue,{className:"flex-1 min-w-0",children:t.jsx(pue,{children:t.jsx("input",{...e,ref:_,style:{width:`${Math.max(h+40,120)}px`,minWidth:`${Math.max(h,100)}px`,font:"inherit"},className:"bg-transparent outline-none leading-none h-[20px] border-none p-0 m-0",onChange:t=>{e.onChange(t),b(t.target.value)},onKeyDown:O,disabled:p,onBlur:t=>{e.onBlur(),setTimeout((()=>{t.currentTarget.form?.contains(document.activeElement)||R()}),0)}})})})}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.jsx(MZ,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 p-0",onClick:R,disabled:p,children:t.jsx(cd,{className:"h-3 w-3"})}),t.jsx(MZ,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 p-0",disabled:p,onClick:()=>{A.handleSubmit(N)()},children:p?t.jsx(Mu,{className:"h-3 w-3 animate-spin"}):t.jsx(mu,{className:"h-3 w-3"})})]})]})}):t.jsxs("button",{ref:T,type:"button",className:OB("group relative inline-flex items-center gap-2 cursor-pointer min-h-[20px] bg-transparent border-none p-0 text-left",a),onClick:()=>d(!0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),d(!0))},"aria-label":"Edit field",children:[t.jsx("span",{ref:S,className:OB("leading-none select-none",a,{italic:!x}),children:x||c}),t.jsx(Hu,{className:"h-3 w-3 transition-opacity duration-200 flex-shrink-0 opacity-0 group-hover:opacity-100"})]})}const dme=ele({name:$se().min(2,"Title must be at least 2 characters"),description:$se()});function pme({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=bZ(),{toast:i}=Il(),a=Qce({resolver:oue(dme),defaultValues:{name:`${o?.name} (copy)`,description:o?.description??""}});return t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{className:"sm:max-w-[425px]",children:[t.jsx(LB,{children:t.jsx(IB,{children:"Duplicate Automation"})}),t.jsx(iue,{...a,children:t.jsxs("form",{onSubmit:a.handleSubmit((async function(e){if(!o||!e.name)return void i({title:"Error duplicating automation",description:"Please try again. Please make sure to fill in the name of the automation."});const{id:t}=await(async(e,t,n)=>(await Oe(`${c}`,{method:"POST",body:JSON.stringify({duplicate:!0,source_id:e,name:t,description:n})})).data)(o.id,e.name,e.description);t?(r?.(t),i({title:"Automation duplicated!",description:"The automation has been duplicated"}),n(!1)):i({title:"Error duplicating automation",description:"Please try again"})})),className:"space-y-4",children:[t.jsxs("div",{children:["Create a copy of the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),"automation with a new title and description."]}),t.jsx(sue,{control:a.control,name:"name",render:({field:e})=>t.jsxs(uue,{children:[t.jsx(due,{children:"Title"}),t.jsx(pue,{children:t.jsx(s5,{...e})}),t.jsx(fue,{})]})}),t.jsx(sue,{control:a.control,name:"description",render:({field:e})=>t.jsxs(uue,{children:[t.jsx(due,{children:"Description"}),t.jsx(pue,{children:t.jsx(hoe,{...e})}),t.jsx(fue,{})]})}),t.jsx(DB,{children:t.jsx(MZ,{type:"submit",children:"Duplicate"})})]})})]})})}function fme({open:e,onOpenChange:n,setIsActive:r}){const o=bZ(),{updateAutomation:i}=De(o?.id||""),{toast:a}=Il();return t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{className:"sm:max-w-[425px]",children:[t.jsx(LB,{children:t.jsxs(IB,{children:["Deactivate ",bf("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}),bf("engage:automation"),"?"]}),t.jsxs(DB,{className:"gap-2 sm:gap-0",children:[t.jsx(MZ,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(MZ,{variant:"destructive",onClick:()=>{i({status:ze.DRAFT}),n(!1),r(!1),a({title:`Updated ${bf("engage:automation")}`,description:`${bf("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const hme=ele({name:$se().min(2,"Title must be at least 2 characters")}),mme=ele({description:$se().max(300,"Description must be less than 300 characters")}),gme=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=bZ(),a=s4(),{updateAutomation:s}=De(i?.id||""),{toast:l}=Il(),c=(()=>{const{state:e}=yZ();return e.recipientStats})(),u=xZ(),[d,p]=n.useState(void 0),[f,h]=n.useState(!1),[m,g]=n.useState(!1),[v,y]=n.useState(!1),[b,x]=n.useState(0);n.useEffect((()=>{if(i&&void 0===d)switch(i.status){case ze.ACTIVE:p(!0);break;case ze.DRAFT:p(!1);break;case ze.RUNNING:case ze.COMPLETED:p(!0);break;case ze.FAILED:case ze.DEACTIVATED:p(!1);break;default:throw Eoe(i.status,ze)}}),[i,d]);const w=n.useCallback((()=>{if(!i)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});const e=async e=>{if(d&&!e)g(!0);else{if(y(!0),o&&!0===e){let e=0;for(;!c&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!c)return l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),void y(!1);const t=await o({estimatedEmailRecipients:c?.emails??0,estimatedSmsRecipients:c?.phones??0});if(!0!==t)return l({title:"Error while updating the status",description:t,variant:"destructive"}),void y(!1)}if(u?.emailHtmlBody?.includes(Che)){if(0===b)return l({title:Ahe,variant:"warning"}),x(b+1),void y(!1);x(b+1)}switch(i.triggerType){case Ue.ONE_TIME:if(!i.triggerMetadata||!("scheduledAt"in i.triggerMetadata)||!i.triggerMetadata?.scheduledAt)return l({title:"Ensure you have selected a scheduled time",variant:"destructive"}),void y(!1);if(!u||!u.emailChannelSenderId&&!u.smsChannelSenderId)return l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"}),void y(!1);break;case Ue.TRIGGER_BASED:break;default:throw Eoe(i.triggerType,Ue)}s({status:e?ze.ACTIVE:ze.DEACTIVATED},{onSuccess:()=>{p(e),l({title:`${bf("engage:automation")}`,description:`${bf("engage:automation")} status updated to ${e?"active":"inactive"}`}),y(!1)},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),y(!1)}})}};if(!i)return null;let n=!1,r=!0;switch(i.status){case ze.ACTIVE:case ze.DRAFT:n=!1;break;case ze.DEACTIVATED:n=!0,r=!1;break;case ze.RUNNING:n=!0,r=i.triggerType===Ue.TRIGGER_BASED;break;case ze.COMPLETED:case ze.FAILED:n=!0,r=!1;break;default:throw Eoe(i.status,ze)}if(!r)return t.jsx(YZ,{variant:R7(i.status),children:x9[i.status]});switch(i.triggerType){case Ue.TRIGGER_BASED:return t.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[t.jsx(d?mu:Eu,{className:"w-4 h-4"}),t.jsx("div",{className:"text-[13px] font-medium",children:d?"Active":"Inactive"}),t.jsx(she,{checked:d,onCheckedChange:e,disabled:n})]});case Ue.ONE_TIME:if(!i.triggerMetadata||i.triggerMetadata?.triggerType===Ue.ONE_TIME&&!i.triggerMetadata?.scheduledAt)return t.jsx(MZ,{variant:"outline",className:"flex items-center gap-2",disabled:!0,children:"Set Scheduled Time"});if(!d){let r="Schedule Send";return i.triggerMetadata.triggerType===Ue.ONE_TIME&&i.triggerMetadata.scheduledAt&&new Date(i.triggerMetadata.scheduledAt)<new Date(Date.now()+3e5)&&(r="Send Now"),t.jsx(MZ,{variant:"default",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:r})}return t.jsx(MZ,{variant:"outline",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:"Convert to Draft"});default:throw Eoe(i.triggerType,Ue)}}),[i,d,l,o,s,c,u,b]);return i&&void 0!==d?t.jsxs("header",{className:"flex px-1 pt-1",children:[t.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e&&t.jsx(MZ,{variant:"ghost",size:"icon",onClick:()=>a(-1),children:t.jsx(du,{})}),t.jsxs("div",{className:"flex flex-col gap-0 items-start",children:[t.jsx(ume,{value:i.name,schema:hme,onSubmit:e=>s({name:e.name}),fieldName:"name",className:"text-lg",successMessage:"Automation name updated",errorMessage:"Failed to update automation name"}),i.automationType!==Ve.MANAGED?t.jsx(ume,{value:i.description||"",schema:mme,onSubmit:e=>s({description:e.description}),fieldName:"description",className:"text-sm "+(i.description?"text-current":"text-muted-foreground"),successMessage:"Description updated",errorMessage:"Failed to update description",placeholderText:"Describe the goal of the automation"}):i.description&&t.jsx("div",{className:"text-sm text-current",children:i.description})]})]}),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===Ue.ONE_TIME&&t.jsx("div",{role:"button",tabIndex:0,className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",onClick:()=>h(!0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||h(!0)},children:t.jsx(G7,{title:"Duplicate",Icon:FZ.DuplicateIcon,asChild:!1,onClick:()=>h(!0)})})}),v?t.jsx("div",{className:"flex items-center text-muted-foreground pr-2",children:t.jsx(EZ,{size:"sm"})}):w()]}),t.jsx(pme,{open:f,onOpenChange:h,onDuplicationCreated:r}),t.jsx(fme,{open:m,onOpenChange:g,setIsActive:p})]}):null},vme=()=>{const e=bZ(),{isLoading:r}=Ie(e?.id),{state:{hideSales:o,hideSms:i}}=n.useContext(l$);return!e||r?t.jsx(EZ,{text:[`Fetching ${bf("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(Whe,{automationId:e.id,automation:e,includeSales:!o,includeSms:!i})})},yme=()=>{const e=bZ(),[r,o]=n.useState(10),[i,a]=n.useState(void 0),[s,l]=n.useState(""),{sentCommunications:c,isLoading:u,isFetching:d,isPlaceholderData:p,fetchError:f}=Me({automationId:e?.id??"",cursor:i,limit:r,search:s||void 0}),h=n.useCallback((e=>{a(e.cursor),o(e.pageSize)}),[]),m=[{accessorKey:"communicationsSent",id:"lastCommunication",header:"Updated At",cell:({row:e})=>{const n=e.original.communicationsSent||[];if(0===n.length)return t.jsx("span",{className:"text-gray-400",children:"None"});const r=n.reduce(((e,t)=>e&&e.updatedAt?t.updatedAt&&new Date(t.updatedAt)>new Date(e.updatedAt)?t:e:t));return r?.updatedAt?t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("span",{className:"text-sm text-gray-600",children:E7(new Date(r.updatedAt),"MMM d, yyyy h:mm a")})}):t.jsx("span",{className:"text-gray-400",children:"Not available"})}},{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?Bie(e.original.phone):t.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"communicationsSent",id:"communicationsSent",header:"Communications Sent",cell:({row:e})=>{const n=e.original.communicationsSent||[],r=n.filter((e=>e.type===He.EMAIL)),o=n.filter((e=>e.type===He.SMS)),i=r.length>0,a=o.length>0,s=r.some((e=>e.delivered)),l=o.some((e=>e.delivered));return t.jsxs("div",{className:"flex items-center gap-3",children:[i&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs("div",{className:"relative",children:[t.jsx(FZ.EmailIcon,{className:"h-4 w-4 "+(s?"text-green-500":"text-gray-400")}),s&&t.jsx("div",{className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white"})]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"text-sm font-medium",children:"Email"}),t.jsx("span",{className:"text-xs "+(s?"text-green-600":"text-gray-500"),children:s?"Delivered":"Pending"})]})]}),i&&a&&t.jsx("div",{className:"h-8 w-px bg-gray-200"}),a&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs("div",{className:"relative",children:[t.jsx(FZ.SmsIcon,{className:"h-4 w-4 "+(l?"text-green-500":"text-gray-400")}),l&&t.jsx("div",{className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white"})]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"text-sm font-medium",children:"SMS"}),t.jsx("span",{className:"text-xs "+(l?"text-green-600":"text-gray-500"),children:l?"Delivered":"Pending"})]})]}),!i&&!a&&t.jsx("span",{className:"text-sm text-gray-400",children:"None"})]})}}];return e&&!u&&c?f?t.jsxs("div",{children:["Error: ",f.message]}):!c||!s&&0===c.results.length?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(FZ.UserIcon,{className:"h-12 w-12 text-gray-400"})}),t.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Communications Sent Yet"}),t.jsxs("p",{className:"text-gray-500",children:["This"," ",bf(e.triggerType===Ue.ONE_TIME?"engage:broadcast":"engage:automation")," ","hasn't sent any communications yet. Please check back later to see recipient details once communications have been sent."]})]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(c5,{data:c.results,columns:m,paginationMode:"cursor",initialPageSize:r,isLoading:u&&!p,cursorPaginationQueryResult:{nextCursor:c.pagination.cursor,isLoading:u,isFetching:d,isPlaceholderData:p},onQueryParametersChange:h,searchValue:s,onSearchChange:l})}):t.jsx(EZ,{text:["Fetching Recipients","Finishing up"]})},bme=()=>{const e=bZ();return e?e?.triggerType===Ue.ONE_TIME&&e?.status===ze.DRAFT?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(FZ.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 Available Yet"}),t.jsxs("p",{className:"text-gray-500",children:["Recipients will be available once this"," ",bf(e.triggerType===Ue.ONE_TIME?"engage:broadcast":"engage:automation")," ","has completed running. Please check back after the automation has finished."]})]}):t.jsx(yme,{}):t.jsx(EZ,{text:["Fetching Recipients","Finishing up"]})},xme=n.createContext(null);xme.displayName="PanelGroupContext";const wme="data-panel-group",_me="data-panel-group-direction",Sme="data-panel-group-id",Eme="data-panel",Tme="data-panel-collapsible",Cme="data-panel-id",Ame="data-panel-size",Nme="data-resize-handle",Rme="data-resize-handle-active",Ome="data-panel-resize-handle-enabled",Pme="data-panel-resize-handle-id",kme="data-resize-handle-state",jme=n.useLayoutEffect,Mme=i["useId".toString()],Lme="function"==typeof Mme?Mme:()=>null;let Dme=0;function Ime(e=null){const t=Lme(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+Dme++),null!=e?e:r.current}function Fme({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(xme);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:b,getPanelSize:x,getPanelStyle:w,groupId:_,isPanelCollapsed:S,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:C,unregisterPanel:A}=v,N=Ime(s),R=n.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:r,collapsible:o,defaultSize:i,maxSize:l,minSize:c},id:N,idIsFromProps:void 0!==s,order:f});n.useRef({didLogMissingDefaultSizeWarning:!1}),jme((()=>{const{callbacks:e,constraints:t}=R.current,n={...t};R.current.id=N,R.current.idIsFromProps=void 0!==s,R.current.order=f,e.onCollapse=u,e.onExpand=d,e.onResize=p,t.collapsedSize=r,t.collapsible=o,t.defaultSize=i,t.maxSize=l,t.minSize=c,n.collapsedSize===t.collapsedSize&&n.collapsible===t.collapsible&&n.maxSize===t.maxSize&&n.minSize===t.minSize||E(R.current,n)})),jme((()=>{const e=R.current;return T(e),()=>{A(e)}}),[f,N,T,A]),n.useImperativeHandle(a,(()=>({collapse:()=>{y(R.current)},expand:e=>{b(R.current,e)},getId:()=>N,getSize:()=>x(R.current),isCollapsed:()=>S(R.current),isExpanded:()=>!S(R.current),resize:e=>{C(R.current,e)}})),[y,b,x,S,N,C]);const O=w(R.current,i);return n.createElement(m,{...g,children:e,className:t,id:N,style:{...O,...h},[Sme]:_,[Eme]:"",[Tme]:o||void 0,[Cme]:N,[Ame]:parseFloat(""+O.flexGrow).toFixed(1)})}const Ume=n.forwardRef(((e,t)=>n.createElement(Fme,{...e,forwardedRef:t})));Fme.displayName="Panel",Ume.displayName="forwardRef(Panel)";let $me=null,Vme=-1,Bme=null;function zme(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&nge),n=!!(t&rge);if(t&ege)return e?"se-resize":n?"ne-resize":"e-resize";if(t&tge)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($me!==o){var i;if($me=o,null===Bme&&(Bme=document.createElement("style"),document.head.appendChild(Bme)),Vme>=0)null===(i=Bme.sheet)||void 0===i||i.removeRule(Vme);Vme=null!==(n=null===(r=Bme.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function Hme(e){return"keydown"===e.type}function qme(e){return e.type.startsWith("pointer")}function Gme(e){return e.type.startsWith("mouse")}function Kme(e){if(qme(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Gme(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const Wme=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Yme(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=Jme(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||(!!Wme.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function Xme(e){let t=e.length;for(;t--;){const n=e[t];if(xge(n,"Missing node"),Yme(n))return n}return null}function Zme(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Qme(e){const t=[];for(;e;)t.push(e),e=Jme(e);return t}function Jme(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const ege=1,tge=2,nge=4,rge=8,oge="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let ige=[],age=!1,sge=new Map,lge=new Map;const cge=new Set;function uge(e){const{target:t}=e,{x:n,y:r}=Kme(e);age=!0,hge({target:t,x:n,y:r}),yge(),ige.length>0&&(bge("down",e),e.preventDefault(),fge(t)||e.stopImmediatePropagation())}function dge(e){const{x:t,y:n}=Kme(e);if(age&&0===e.buttons&&(age=!1,bge("up",e)),!age){const{target:r}=e;hge({target:r,x:t,y:n})}bge("move",e),gge(),ige.length>0&&e.preventDefault()}function pge(e){const{target:t}=e,{x:n,y:r}=Kme(e);lge.clear(),age=!1,ige.length>0&&(e.preventDefault(),fge(t)||e.stopImmediatePropagation()),bge("up",e),hge({target:t,x:n,y:r}),gge(),yge()}function fge(e){let t=e;for(;t;){if(t.hasAttribute(Nme))return!0;t=t.parentElement}return!1}function hge({target:e,x:t,y:n}){ige.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),cge.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=oge?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:Qme(e),b:Qme(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;xge(r,"Stacking order can only be calculated for elements with a common ancestor");const o=Zme(Xme(n.a)),i=Zme(Xme(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}ige.push(e)}var p,f}))}function mge(e,t){lge.set(e,t)}function gge(){let e=!1,t=!1;ige.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;lge.forEach((e=>{n|=e})),e&&t?zme("intersection",n):e?zme("horizontal",n):t?zme("vertical",n):null!==Bme&&(document.head.removeChild(Bme),$me=null,Bme=null,Vme=-1)}let vge=new AbortController;function yge(){vge.abort(),vge=new AbortController;const e={capture:!0,signal:vge.signal};cge.size&&(age?(ige.length>0&&sge.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",pge,e),r.addEventListener("pointerleave",dge,e),r.addEventListener("pointermove",dge,e))})),sge.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",pge,e),r.addEventListener("pointercancel",pge,e)}))):sge.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",uge,e),r.addEventListener("pointermove",dge,e))})))}function bge(e,t){cge.forEach((n=>{const{setResizeHandlerState:r}=n,o=ige.includes(n);r(e,o,t)}))}function xge(e,t){if(!e)throw Error(t)}function wge(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function _ge(e,t,n=10){return 0===wge(e,t,n)}function Sge(e,t,n){return 0===wge(e,t,n)}function Ege({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];xge(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(wge(n,s)<0)if(i){n=wge(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function Tge({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Sge(e,0))return t;const a=[...t],[s,l]=r;xge(null!=s,"Invalid first pivot index"),xge(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];xge(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(xge(null!=n,`Previous layout not found for panel index ${r}`),Sge(n,i)){const t=c-n;wge(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];xge(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(xge(null!=n,`Previous layout not found for panel index ${r}`),Sge(n,c)){const t=n-i;wge(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];xge(null!=e,`Previous layout not found for panel index ${o}`);if(i+=Ege({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];xge(null!=i,`Previous layout not found for panel index ${r}`);const s=Ege({panelConstraints:n,panelIndex:r,size:i-o});if(!Sge(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(!Sge(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];xge(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=Ege({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!Sge(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];xge(null!=o,`Previous layout not found for panel index ${r}`);const i=Ege({panelConstraints:n,panelIndex:r,size:o+t});if(Sge(o,i)||(t-=i-o,a[r]=i),Sge(t,0))break;e>0?r--:r++}}}return Sge(a.reduce(((e,t)=>t+e),0),100)?a:o}function Cge({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];xge(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 Age(e,t=document){return Array.from(t.querySelectorAll(`[${Pme}][data-panel-group-id="${e}"]`))}function Nge(e,t,n=document){const r=Age(e,n).findIndex((e=>e.getAttribute(Pme)===t));return null!=r?r:null}function Rge(e,t,n){const r=Nge(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function Oge(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 Pge(e,t=document){const n=t.querySelector(`[${Pme}="${e}"]`);return n||null}function kge({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),jme((()=>{if(!a)return;const e=Age(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=Cge({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];xge(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;xge(e,"Eager values not found");const{panelDataArray:n}=e;xge(null!=Oge(r,a),`No group found for id "${r}"`);const i=Age(r,a);xge(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(Pme);xge(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=Pge(t,r),c=Age(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];xge(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=Tge({delta:Sge(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:Rge(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 jge(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 Mge(e,t){const n="horizontal"===e,{x:r,y:o}=Kme(t);return n?r:o}function Lge(e,t,n,r,o,i){if(Hme(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=Pge(t,o);xge(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(Sme);xge(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Mge(n,e),u=Oge(s,o);xge(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 Dge(e,t,n){t.forEach(((t,r)=>{const o=e[r];xge(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&&!_ge(u,l)||_ge(t,l)||r(),!e||null!=u&&_ge(u,l)||!_ge(t,l)||e())}}))}function Ige(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 Fge(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 Uge(e){return`react-resizable-panels:${e}`}function $ge(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 Vge(e,t){try{const n=Uge(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 Bge(e,t,n,r,o){var i;const a=Uge(e),s=$ge(t),l=null!==(i=Vge(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 zge({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(!Sge(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];xge(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];xge(null!=e,`No layout data found for index ${i}`);const r=Ege({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!Sge(o,0))for(let i=0;i<t.length;i++){const e=n[i];xge(null!=e,`No layout data found for index ${i}`);const r=Ege({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,Sge(o,0)))break}return n}const Hge={getItem:e=>(Fge(Hge),Hge.getItem(e)),setItem:(e,t)=>{Fge(Hge),Hge.setItem(e,t)}},qge={};function Gge({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=Hge,style:u,tagName:d="div",...p}){const f=Ime(a),h=n.useRef(null),[m,g]=n.useState(null),[v,y]=n.useState([]),b=function(){const[e,t]=n.useState(0);return n.useCallback((()=>t((e=>e+1))),[])}(),x=n.useRef({}),w=n.useRef(new Map),_=n.useRef(0),S=n.useRef({autoSaveId:e,direction:o,dragState:m,id:f,keyboardResizeBy:l,onLayout:s,storage:c}),E=n.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});n.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),n.useImperativeHandle(i,(()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:e}=E.current;return e},setLayout:e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current,o=zge({layout:e,panelConstraints:r.map((e=>e.constraints))});jge(n,o)||(y(o),E.current.layout=o,t&&t(o),Dge(r,o,x.current))}})),[]),jme((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),kge({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=qge[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(Bge,100),qge[e]=n);const r=[...t],o=new Map(w.current);n(e,r,o,v,c)}}),[e,v,c]),n.useEffect((()=>{}));const T=n.useCallback((e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current;if(e.constraints.collapsible){const o=r.map((e=>e.constraints)),{collapsedSize:i=0,panelSize:a,pivotIndices:s}=Yge(r,e,n);if(xge(null!=a,`Panel size not found for panel "${e.id}"`),!_ge(a,i)){w.current.set(e.id,a);const l=Tge({delta:Wge(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Ige(n,l)||(y(l),E.current.layout=l,t&&t(l),Dge(r,l,x.current))}}}),[]),C=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current;if(e.constraints.collapsible){const i=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s=0,minSize:l=0,pivotIndices:c}=Yge(o,e,r),u=null!=t?t:l;if(_ge(s,a)){const t=w.current.get(e.id),a=null!=t&&t>=u?t:u,l=Tge({delta:Wge(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});Ige(r,l)||(y(l),E.current.layout=l,n&&n(l),Dge(o,l,x.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=Yge(n,e,t);return xge(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),N=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=Wge(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const a=n[o];let s;return s=null==a?null!=e?e.toPrecision(i):"1":1===r.length?"1":a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:v,panelData:n,panelIndex:r})}),[m,v]),R=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=Yge(n,e,t);return xge(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&_ge(i,r)}),[]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=Yge(n,e,t);return xge(null!=i,`Panel size not found for panel "${e.id}"`),!o||wge(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]);jme((()=>{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=Vge(e,n))&&void 0!==r?r:{})[$ge(t)])&&void 0!==o?o:null}(e,o,n);t&&(w.current=new Map(Object.entries(t.expandToSizes)),i=t.layout)}null==i&&(i=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let r=0,o=100;for(let i=0;i<e.length;i++){const e=n[i];xge(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];xge(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=zge({layout:i,panelConstraints:o.map((e=>e.constraints))});jge(r,a)||(y(a),E.current.layout=a,t&&t(a),Dge(o,a,x.current))}})),jme((()=>{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=Rge(a,e,r);let f=Lge(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=Tge({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:Hme(n)?"keyboard":"mouse-or-touch"}),v=!Ige(c,g);(qme(n)||Gme(n))&&_.current!=f&&(_.current=f,mge(e,v||0===f?0:m?f<0?ege:tge:f<0?nge:rge)),v&&(y(g),E.current.layout=g,l&&l(g),Dge(u,g,x.current))}}),[]),j=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}=Yge(o,e,r);xge(null!=a,`Panel size not found for panel "${e.id}"`);const l=Tge({delta:Wge(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});Ige(r,l)||(y(l),E.current.layout=l,n&&n(l),Dge(o,l,x.current))}),[]),M=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}=Yge(r,e,n);null!=u&&(i&&s&&_ge(u,o)?_ge(o,a)||j(e,a):u<c?j(e,c):u>l&&j(e,l))}),[j]),L=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=Pge(e,h.current);xge(o,`Drag handle element not found for id "${e}"`);const i=Mge(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),D=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=Wge(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],E.current.panelDataArrayChanged=!0,b())}),[b]),F=n.useMemo((()=>({collapsePanel:T,direction:o,dragState:m,expandPanel:C,getPanelSize:A,getPanelStyle:N,groupId:f,isPanelCollapsed:R,isPanelExpanded:O,reevaluatePanelConstraints:M,registerPanel:P,registerResizeHandle:k,resizePanel:j,startDragging:L,stopDragging:D,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,N,f,R,O,M,P,k,j,L,D,I]);return n.createElement(xme.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},[wme]:"",[_me]:o,[Sme]:f}))}const Kge=n.forwardRef(((e,t)=>n.createElement(Gge,{...e,forwardedRef:t})));function Wge(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function Yge(e,t,n){const r=Wge(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function Xge({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:o,id:i,onBlur:a,onClick:s,onDragging:l,onFocus:c,onPointerDown:u,onPointerUp:d,style:p={},tabIndex:f=0,tagName:h="div",...m}){var g,v;const y=n.useRef(null),b=n.useRef({onClick:s,onDragging:l,onPointerDown:u,onPointerUp:d});n.useEffect((()=>{b.current.onClick=s,b.current.onDragging=l,b.current.onPointerDown=u,b.current.onPointerUp=d}));const x=n.useContext(xme);if(null===x)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:w,groupId:_,registerResizeHandle:S,startDragging:E,stopDragging:T,panelGroupElement:C}=x,A=Ime(i),[N,R]=n.useState("inactive"),[O,P]=n.useState(!1),[k,j]=n.useState(null),M=n.useRef({state:N});jme((()=>{M.current.state=N})),n.useEffect((()=>{if(r)j(null);else{const e=S(A);j((()=>e))}}),[r,A,S]);const L=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,D=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;xge(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=sge.get(a))&&void 0!==i?i:0;return sge.set(a,l+1),cge.add(s),yge(),function(){var t;lge.delete(e),cge.delete(s);const n=null!==(t=sge.get(a))&&void 0!==t?t:1;if(sge.set(a,n-1),yge(),1===n&&sge.delete(a),ige.includes(s)){const e=ige.indexOf(s);e>=0&&ige.splice(e,1),gge(),o("up",!0,null)}}}(A,e,w,{coarse:L,fine:D},((e,n,r)=>{if(n)switch(e){case"down":{R("drag"),t=!1,xge(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}=M.current;t=!0,"drag"!==e&&R("hover"),xge(r,'Expected event to be defined for "move" action'),k(r);break}case"up":{R("hover"),T();const{onClick:e,onDragging:n,onPointerUp:r}=b.current;null==n||n(!1),null==r||r(),t||null==e||e();break}}else R("inactive")}))}),[L,w,r,D,S,A,k,E,T]),function({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:o}){n.useEffect((()=>{if(e||null==r||null==o)return;const n=Pge(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(Sme);xge(r,`No group element found for id "${r}"`);const i=Age(r,o),a=Nge(r,t,o);xge(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,[_me]:w,[Sme]:_,[Nme]:"",[Rme]:"drag"===N?"pointer":O?"keyboard":void 0,[Ome]:!r,[Pme]:A,[kme]:N})}Gge.displayName="PanelGroup",Kge.displayName="forwardRef(PanelGroup)",Xge.displayName="PanelResizeHandle";const Zge=({className:e,...n})=>t.jsx(Kge,{className:OB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),Qge=Ume,Jge=({withHandle:e,className:n,...r})=>t.jsx(Xge,{className:OB("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(Ru,{className:"h-2.5 w-2.5"})})}),eve=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),tve="rgba(245, 246, 247, 1)",nve={[Be.SEND_COMMUNICATION]:{color:{bg:tve},clickable:!0},[Be.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:tve},clickable:!1}},rve={[Be.SEND_COMMUNICATION]:"Send Email & SMS",[Be.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},ove=({children:e,onClick:n,iconBgColor:r,iconStrokeColor:o,Icon:i,disabled:a=!1,selected:s=!1})=>{const l=i;return t.jsxs(DX.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:tve},onClick:n,className:rp("flex gap-2 items-center rounded-md transition-colors group","p-2 border-2 border-transparent overflow-hidden",!a&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:[t.jsx("div",{className:rp("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:rp("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})},ive=({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}),ave=()=>{const e=bZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(XX),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=dZ(),u=n.useCallback((()=>c?.find((e=>e.type===gZ.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(ove,{selected:o===boe.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(boe.EditAudience)},Icon:FZ.AudienceIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Aue,{children:"Audience"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(eve,{copyText:`Send to all ${bf("engage:user",{count:2})} in ${1===i.length?"this":"these"} ${bf("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(ive,{segmentName:n.name},e):null}))})]})]})})}):null},sve=()=>{const e=bZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(XX),{segments:i}=dZ(),a=bf(e?.triggerType===Ue.TRIGGER_BASED?"engage:automation":"engage:broadcast"),s=`Start this ${a?.toLowerCase()}`;if(!e||!i)return null;return t.jsx(t.Fragment,{children:(()=>{switch(e.triggerType){case Ue.TRIGGER_BASED:{if(e.triggerMetadata.triggerType!==Ue.TRIGGER_BASED||e.triggerMetadata.eventName!==$e.USER_ENTERS_SEGMENT||!e.triggerMetadata.eventFilter.segment_id)return null;const n=e.triggerMetadata.eventFilter.segment_id,r=i.find((e=>e.id===n))?.name;return r?t.jsx(ove,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:FZ.TriggerIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Aue,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(eve,{copyText:`When ${bf("engage:user").toLowerCase()} joins the`}),t.jsx(ive,{segmentName:r})]})]})}):null}case Ue.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(ove,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(boe.EditTime)},selected:o===boe.EditTime,Icon:FZ.TriggerIcon,children:[t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Aue,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(eve,n?{copyText:`Click to set the date and time for this ${bf("engage:broadcast")}`}:{copyText:"Bulk send at"}),!1===n&&"scheduledAt"in e.triggerMetadata&&e.triggerMetadata.scheduledAt&&t.jsx("div",{className:"text-xs font-medium",children:t.jsx(ive,{segmentName:E7(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),t.jsx("div",{className:"",children:n&&t.jsx(FZ.AlertTriangleIcon,{className:"group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors"})})]})}default:throw Eoe(e.triggerType,Ue)}})()})},lve=e=>{switch(e){case Be.SEND_COMMUNICATION:return"Send Communication";case Be.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw HX(e,Be)}},cve=e=>{switch(e){case Be.SEND_COMMUNICATION:return t.jsx(FZ.CommunicationIcon,{className:"w-4 h-4"});case Be.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(FZ.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw Eoe(e,Be)}},uve=e=>{if(!(e&&e.actionType===Be.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}`},dve=({actionDataWithMetadata:e})=>{const{actionData:r,communicationGroup:o}=e,{state:{selectedActionId:i},setActionId:a,setSelectedCommunicationGroupId:s}=n.useContext(XX),l=n.useMemo((()=>i===r.actionMetadata.currentActionId),[i,r.actionMetadata.currentActionId]),c=nve[r.actionType],u=c.color,d=c.clickable;return t.jsx(DX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:rp("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",l&&"border-primary",r.actionType!==Be.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:l?u.bg:u.bgUnselected??tve},onClick:()=>{d&&(a(r.actionMetadata.currentActionId),r.actionType===Be.SEND_COMMUNICATION&&s(r.actionMetadata.communicationGroupId))},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white",children:cve(r.actionType)}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{style:{color:l?u.text:u.textUnselected},children:t.jsx(Aue,{children:rve[r.actionType]})}),t.jsx("div",r.actionType===Be.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:uve(r.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:r.actionType===Be.SEND_COMMUNICATION&&o?.emailSubject?o?.emailSubject:lve(r.actionType)})]})]})})},pve=()=>{const[e,r]=n.useState(!1),[o,i]=n.useState(void 0),a=bZ(),{setActionId:s,state:{selectedActionId:l}}=n.useContext(XX);if(De(a?.id||""),n.useEffect((()=>{if(!a)return;if(l)return;const e=a.actionData?.find((e=>"send_communication"===e.actionType));e&&s(e.actionMetadata.currentActionId)}),[a,s,l]),n.useEffect((()=>{if(!a)return;(async()=>{const e=[];for(const t of a.actionData??[])switch(t.actionType){case Be.SEND_COMMUNICATION:{const n=await QX(t.actionMetadata.communicationGroupId);e.push({actionData:t,communicationGroup:n});break}case Be.WAIT_UNTIL_NEXT_FIXED_TIME:e.push({actionData:t});break;default:throw HX(t.actionType,Be)}i(e)})()}),[a]),!a||!o)return null;const c=(e=>{const{steps:t,rootActionId:n}=e;if(!t||!n)return t??[];const r=new Map(t.map((e=>[e.actionData.actionMetadata.currentActionId,e]))),o=r.get(n);if(!o)return t;const i=[];let a=o;for(;a;){i.push(a);const e=a.actionData.actionMetadata.nextActionId;if(!e)break;a=r.get(e)}return i})({steps:o,rootActionId:a.triggerMetadata?.triggerType===Ue.TRIGGER_BASED?a.triggerMetadata.rootActionId:void 0}).filter((t=>!!e||"send_communication"===t.actionData.actionType));let u=()=>t.jsx("div",{},"empty-trigger-audience");return(e||a.triggerType===Ue.ONE_TIME)&&(u=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[a.triggerType===Ue.ONE_TIME&&t.jsx(ave,{}),a.triggerType!==Ue.ONE_TIME&&t.jsx(sve,{})]})),t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[a.triggerType===Ue.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(she,{defaultChecked:e,onCheckedChange:()=>{r(!e)}})]})]}),t.jsx("div",{className:"flex-1 flex flex-col gap-3",children:t.jsxs(QB,{mode:"popLayout",children:[u(),c.map(((e,n)=>t.jsx(DX.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(dve,{actionDataWithMetadata:e})},e.actionData.actionMetadata?.currentActionId??n))),a.triggerType===Ue.ONE_TIME&&t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx(sve,{})},"one-time-trigger")]})})]})},fve=()=>{const e=bZ(),{segments:n}=dZ();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(pve,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(EZ,{text:[`Getting details on your ${bf("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},hve=()=>{const{state:{selectedActionId:e}}=n.useContext(XX);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(QB,{mode:"wait",children:t.jsx(e===boe.EditTime?Pfe:e===boe.EditAudience?She:Sue,{})})})},mve=()=>t.jsxs(Zge,{direction:"horizontal",className:"flex-1",children:[t.jsx(Qge,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(fve,{})})}),t.jsx(Jge,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(Qge,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(hve,{})})})]}),gve=()=>{const[e,r]=n.useState("workflow"),o=[{id:"workflow",label:"Workflow",content:t.jsx(mve,{})},{id:"recipients",label:"Recipients",content:t.jsx(bme,{})},{id:"insights",label:bf("engage:insight",{count:2}),content:t.jsx(vme,{})}];return t.jsx(Dhe,{tabs:o,activeTab:e,onTabChange:r,tabsLocation:"left"})},vve=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i,hideSms:a,hideSales:s,replyToSettingsText:l,replyToSettingsLink:c,fromNameSettingsText:u,fromNameSettingsLink:d})=>{const p=bZ(),f=xZ(),{updateCommunicationGroup:h}=iZ(),{toast:m}=Il(),{channelSenders:g}=V7();return n.useEffect((()=>{if(f&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(f.extraMergeFields)&&h({groupId:f?.id,params:{extraMergeFields:e}},{onError:e=>{m({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[f,i,h,m]),n.useEffect((()=>{if(p&&f&&g){if(!f.emailChannelSenderId){const e=g.results.filter((e=>e.channelSenderMetadata.userPart));e.length>0&&h({groupId:f.id,params:{emailChannelSenderId:e[0].id}})}if(!f.smsChannelSenderId){const e=g.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid));e.length>0&&h({groupId:f.id,params:{smsChannelSenderId:e[0].id}})}}}),[p,f,g,h]),p&&f?t.jsx(c$,{children:t.jsx(u$,{replyToSettingsText:l,replyToSettingsLink:c,fromNameSettingsText:u,fromNameSettingsLink:d,hideSms:a,hideSales:s,children:t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(gme,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(gve,{})})]})})}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(EZ,{text:[`Fetching ${bf("engage:automation").toLowerCase()} data`,"Finishing up"]})})},yve=({...e})=>{const n=function(){let{matches:e}=i.useContext(t4),t=e[e.length-1];return t?t.params:{}}(),[r]=H4(),o=e.automationId||n?.automationId||r.get("automationId")||"",a="true"===r.get("showBackButton")||e.showBackButton;return t.jsx(_Z,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(vve,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var bve=e=>null!=e;var xve=e=>"function"!=typeof e||e.length?e:e(),wve=e=>Array.isArray(e)?e:e?[e]:[];var _ve=yt;var Sve,Eve=function(e){const[t,n]=ct(),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=ct(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(FTe){return r(FTe,`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&&vt((()=>{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(FTe){r(FTe,`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),yt((()=>globalThis.removeEventListener("storage",e)))):(o.forEach((t=>t.addEventListener?.("storage",e))),yt((()=>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(FTe){r(FTe,`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(FTe){r(FTe,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(FTe){r(FTe,`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(FTe){r(FTe,`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(FTe){r(FTe,`Error getting all values from ${e.name}`)}}})),t}}]},Tve=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},Cve=("function"==typeof(Sve={_cookies:[globalThis.document,"cookie"],getItem:e=>Cve._cookies[0][Cve._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=Cve.getItem(e);Cve._cookies[0][Cve._cookies[1]]=`${e}=${t}${Tve(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:Cve});window.dispatchEvent(o)},removeItem:e=>{Cve._cookies[0][Cve._cookies[1]]=`${e}=deleted${Tve({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return Cve._cookies[0][Cve._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return Cve._cookies[0][Cve._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(Sve.clear=()=>{let e;for(;e=Sve.key(0);)Sve.removeItem(e)}),Sve),Ave=796,Nve="bottom",Rve="system",Ove=Object.keys(Pr)[0],Pve=Object.keys(Mr)[0],kve=St({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function jve(){return Et(kve)}var Mve=St(void 0),Lve=e=>{const[t,n]=ct(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[fn]){for(let t of e[fn].keys())e.removeEventListener(t,An);delete e[fn]}}(i.document),i.document.title="TanStack Query Devtools",i.document.body.style.margin="0",i.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(jve().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(ITe){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)}})),gn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],i.document),e.setLocalStore("pip_open","true"),n(i)};pt((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||o(Number(window.innerWidth),Number(e.localStore.height||500))})),pt((()=>{const e=(jve().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(jve().shadowDOMTarget||n.document).querySelector("#_goober");t&&(t.textContent=e.textContent)}));t.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),yt((()=>{t.disconnect()}))}}));const i=ft((()=>({pipWindow:t(),requestPipWindow:o,closePipWindow:r,disabled:e.disabled??!1})));return zt(Mve.Provider,{value:i,get children(){return e.children}})},Dve=()=>ft((()=>{const e=Et(Mve);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Ive=St((()=>"dark"));function Fve(){return Et(Ive)}var Uve={"À":"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"},$ve=Object.keys(Uve).join("|"),Vve=new RegExp($ve,"g");var Bve=7,zve=6,Hve=5,qve=4,Gve=3,Kve=2,Wve=1,Yve=0;function Xve(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:Wve,!n.accessors){const r=Zve(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=tye(o),a=Jve(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:Yve,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=Zve(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=Wve?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 Zve(e,t,n){return e=Qve(e,n),(t=Qve(t,n)).length>e.length?Yve:e===t?Bve:(e=e.toLowerCase())===(t=t.toLowerCase())?zve:e.startsWith(t)?Hve:e.includes(` ${t}`)?qve:e.includes(t)?Gve:1===t.length?Yve:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?Kve: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 Wve+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return Yve;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return Yve}return i(r-a)}(e,t)}function Qve(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(Vve,(e=>Uve[e]))),e}function Jve(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 eye={maxRanking:1/0,minRanking:-1/0};function tye(e){return"function"==typeof e?eye:{...eye,...e}}var nye={data:""},rye=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,oye=/\/\*[^]*?\*\/| +/g,iye=/\n+/g,aye=(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]?aye(a,i):i+"{"+aye(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=aye(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+=aye.p?aye.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},sye={},lye=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+lye(e[n]);return t}return e};function cye(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=lye(e),a=sye[i]||(sye[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!sye[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=rye.exec(e.replace(oye,""));)t[4]?r.shift():t[3]?(n=t[3].replace(iye," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(iye," ").trim();return r[0]})(e);sye[a]=aye(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&sye.g?sye.g:null;return n&&(sye.g=sye[a]),l=sye[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?"":aye(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||nye),t.g,t.o,t.k);var r}function uye(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=uye(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function dye(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=uye(e))&&(r&&(r+=" "),r+=t);return r}function pye(e,t){const n=mt(e),{onChange:r}=t;let o=new Set(t.appear?void 0:n);const i=new WeakSet,[a,s]=ct([],{equals:!1}),[l]=[wt,xt],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 ft((t=>{const n=a(),s=e();if(mt(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 mt((()=>{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 fye(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}cye.bind({g:1}),cye.bind({k:1});var hye=e=>e instanceof Element;function mye(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return mye(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=mye(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function gye(e,t=hye,n=hye){const r=ft(e),o=ft((()=>mye(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function vye(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function yye(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()))})),vye((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function bye(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())),vye((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var xye=e=>{const t=function(e){return ft((()=>{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 pye(gye((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)yye(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)bye(a,e,t,(()=>o([t])))}})},wye=Symbol("fallback");function _ye(e){for(const t of e)t.dispose()}function Sye(e){const{by:t}=e;return ft(function(e,t,n,r={}){const o=new Map;return yt((()=>_ye(o.values()))),()=>{const n=e()||[];return mt((()=>{if(!n.length)return _ye(o.values()),o.clear(),r.fallback?[lt((e=>(o.set(wye,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(wye);if(!o.size||a){a?.dispose(),o.delete(wye);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){lt((a=>{const[s,l]=ct(t),c={setItem:l,dispose:a};if(n.length>1){const[e,t]=ct(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 Eye(e,t,n,r){const o=()=>{wve(xve(e)).forEach((e=>{e&&wve(xve(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),_ve(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?pt(o):dt(o)}function Tye(e,t,n){const r=new WeakMap,{observe:o,unobserve:i}=function(e,t){const n=new ResizeObserver(e);return yt(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);pt((t=>{const n=wve(xve(e)).filter(bve);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 Cye=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function Aye(e){const t={};let n;for(;n=Cye.exec(e);)t[n[1]]=n[2];return t}function Nye(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=Aye(e)}else"string"==typeof t&&(t=Aye(t));return{...e,...t}}function Rye(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function Oye(e){return"[object String]"===Object.prototype.toString.call(e)}function Pye(e){return t=>`${e()}-${t}`}function kye(e,t){return!!e&&(e===t||e.contains(t))}function jye(e,t=!1){const{activeElement:n}=Mye(e);if(!n?.nodeName)return null;if(Lye(n)&&n.contentDocument)return jye(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Mye(n).getElementById(e);if(t)return t}}return n}function Mye(e){return e?e.ownerDocument||e:document}function Lye(e){return"IFRAME"===e.tagName}var Dye=(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))(Dye||{});function Iye(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function Fye(){return Iye(/^Mac/i)}function Uye(){return Iye(/^iPhone/i)||Iye(/^iPad/i)||Fye()&&navigator.maxTouchPoints>1}function $ye(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function Vye(e){return t=>{for(const n of e)$ye(t,n)}}function Bye(e){return Fye()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function zye(e){if(e)if(function(){if(null==Hye){Hye=!1;try{document.createElement("div").focus({get preventScroll(){return Hye=!0,!0}})}catch(ITe){}}return Hye}())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 Hye=null;var qye=["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'])"],Gye=[...qye,'[tabindex]:not([tabindex="-1"]):not([disabled])'],Kye=qye.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",Wye=Gye.join(':not([hidden]):not([tabindex="-1"]),');function Yye(e,t){const n=Array.from(e.querySelectorAll(Kye)).filter(Xye);return t&&Xye(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Lye(e)&&e.contentDocument){const r=Yye(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function Xye(e){return Zye(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function Zye(e){return e.matches(Kye)&&Qye(e)}function Qye(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||Qye(e.parentElement,e))}function Jye(e){for(;e&&!ebe(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function ebe(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function tbe(){}function nbe(e,t){return Wt(e,t)}var rbe=new Map,obe=new Set;function ibe(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=rbe.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),rbe.delete(t.target)),0===rbe.size)){for(const e of obe)e();obe.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=rbe.get(t.target);n||(n=new Set,rbe.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function abe(e,t){const n=sbe(e,t,"left"),r=sbe(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 sbe(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?ibe():document.addEventListener("DOMContentLoaded",ibe));var lbe={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 cbe(e){return t=>(e(t),()=>e(void 0))}function ube(e,t){const[n,r]=ct(dbe(t?.()));return pt((()=>{r(e()?.tagName.toLowerCase()||dbe(t?.()))})),n}function dbe(e){return Oye(e)?e:void 0}function pbe(e){const[t,n]=Yt(e,["as"]);if(!t.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return zt(Mn,Wt(n,{get component(){return t.as}}))}var fbe=["id","name","validationState","required","disabled","readOnly"];var hbe=St();function mbe(){const e=Et(hbe);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function gbe(e){const t=mbe(),n=nbe({id:t.generateId("description")},e);return pt((()=>yt(t.registerDescription(n.id)))),zt(pbe,Wt({as:"div"},(()=>t.dataset()),n))}function vbe(e){const t=mbe(),n=nbe({id:t.generateId("error-message")},e),[r,o]=Yt(n,["forceMount"]),i=()=>"invalid"===t.validationState();return pt((()=>{i()&&yt(t.registerErrorMessage(o.id))})),zt(nn,{get when(){return r.forceMount||i()},get children(){return zt(pbe,Wt({as:"div"},(()=>t.dataset()),o))}})}function ybe(e){let t;const n=mbe(),r=nbe({id:n.generateId("label")},e),[o,i]=Yt(r,["ref"]),a=ube((()=>t),(()=>"label"));return pt((()=>yt(n.registerLabel(i.id)))),zt(pbe,Wt({as:"label",ref(e){const n=fye((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ft((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function bbe(e,t){pt(gt(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}),yt((()=>{n.removeEventListener("reset",t)})))})))}function xbe(e){const[t,n]=ct(e.defaultValue?.()),r=ft((()=>void 0!==e.value?.())),o=ft((()=>r()?e.value?.():t()));return[o,t=>{mt((()=>{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 wbe(e){const[t,n]=xbe(e);return[()=>t()??!1,n]}var _be=Object.defineProperty,Sbe=(e,t)=>{for(var n in t)_be(e,n,{get:t[n],enumerable:!0})},Ebe=St();function Tbe(){return Et(Ebe)}function Cbe(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Abe(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?Cbe(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 Nbe(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){pt((()=>{const n=setTimeout((()=>{Abe(e(),t)}));yt((()=>clearTimeout(n)))}))}(e,t);let n=[];pt((()=>{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 Mye(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&Abe(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}yt((()=>o.disconnect()))}))}function Rbe(e={}){const[t,n]=function(e){const[t,n]=xbe(e);return[()=>t()??[],n]}({value:()=>xve(e.items),onChange:t=>e.onItemsChange?.(t)});Nbe(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&&Cbe(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=>zt(Ebe.Provider,{value:{registerItem:r},get children(){return e.children}})}}function Obe(e){const t=function(){const e=Tbe();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=nbe({shouldRegisterItem:!0},e);pt((()=>{if(!n.shouldRegisterItem)return;yt(t.registerItem(n.getItem()))}))}function Pbe(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=Oye(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=Oye(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(Oye(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return Oye(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(Oye(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=Pbe({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 kbe(e,t=[]){return ft((()=>{const n=Pbe({dataSource:xve(e.dataSource),getKey:xve(e.getKey),getTextValue:xve(e.getTextValue),getDisabled:xve(e.getDisabled),getSectionChildren:xve(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var jbe=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Mbe=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Lbe(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return jbe.has(t)}const t=e.split("-")[0];return Mbe.has(t)}(e)?"rtl":"ltr"}function Dbe(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Lbe(e)}}var Ibe=Dbe(),Fbe=new Set;function Ube(){Ibe=Dbe();for(const e of Fbe)e(Ibe)}var $be=St();function Vbe(){const e=function(){const[e,t]=ct(Ibe),n=ft((()=>e()));return vt((()=>{0===Fbe.size&&window.addEventListener("languagechange",Ube),Fbe.add(t),yt((()=>{Fbe.delete(t),0===Fbe.size&&window.removeEventListener("languagechange",Ube)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return Et($be)||e}var Bbe=new Map;var zbe=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 Hbe(e){return Fye()||Uye()?e.altKey:e.ctrlKey}function qbe(e){return Fye()?e.metaKey:e.ctrlKey}function Gbe(e){return new zbe(e)}function Kbe(e){const t=nbe({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=ct(!1),[o,i]=ct(),a=ft((()=>{const e=xve(t.selectedKeys);return null!=e?Gbe(e):e})),s=ft((()=>{const e=xve(t.defaultSelectedKeys);return null!=e?Gbe(e):new zbe})),[l,c]=function(e){const[t,n]=xbe(e);return[()=>t()??new zbe,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=ct(xve(t.selectionBehavior));return pt((()=>{const e=l();"replace"===xve(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),pt((()=>{d(xve(t.selectionBehavior)??"toggle")})),{selectionMode:()=>xve(t.selectionMode),disallowEmptySelection:()=>xve(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!xve(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 Wbe(e,t,n){const r=Wt({selectOnFocus:()=>"replace"===xve(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=Vbe();let a={top:0,left:0};Eye((()=>xve(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]=ct(""),[r,o]=ct(-1);return{typeSelectHandlers:{onKeyDown:i=>{if(xve(e.isDisabled))return;const a=xve(e.keyboardDelegate),s=xve(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:()=>xve(r.disallowTypeAhead),keyboardDelegate:()=>xve(r.keyboardDelegate),selectionManager:()=>xve(r.selectionManager)}),l=()=>xve(r.orientation)??"vertical",c=()=>{const e=xve(r.autoFocus);if(!e)return;const n=xve(r.selectionManager),o=xve(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&&!xve(r.shouldUseVirtualFocus)&&zye(s)};vt((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),pt(gt([o,()=>xve(r.isVirtualized),()=>xve(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&&abe(t,e)}})));return{tabIndex:ft((()=>{if(!xve(r.shouldUseVirtualFocus))return null==xve(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{$ye(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=xve(r.selectionManager),a=xve(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!Hbe(e)&&o.replaceSelection(t))},u=xve(r.keyboardDelegate),d=xve(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,qbe(e));null!=t&&(o.setFocusedKey(t),qbe(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,qbe(e));null!=t&&(o.setFocusedKey(t),qbe(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":qbe(e)&&"multiple"===o.selectionMode()&&!0!==xve(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),xve(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!xve(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?Wye:Kye,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&Qye(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)&&zye(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=xve(r.selectionManager),n=xve(r.keyboardDelegate),i=xve(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(!xve(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(zye(n),abe(e,n))}}},onFocusOut:e=>{const t=xve(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function Ybe(e,t){const n=()=>xve(e.selectionManager),r=()=>xve(e.key),o=()=>xve(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()||qbe(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>xve(e.disabled)||n().isDisabled(r()),s=()=>!a()&&n().canSelectItem(r());let l=null;const c=ft((()=>{if(!o()&&!a())return r()===n().focusedKey()?0:-1})),u=ft((()=>xve(e.virtualized)?void 0:r()));return pt(gt([t,r,o,()=>n().focusedKey(),()=>n().isFocused()],(([t,n,r,o,i])=>{t&&n===o&&i&&!r&&document.activeElement!==t&&(e.focus?e.focus():zye(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||xve(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&xve(e.shouldSelectOnPressUp)&&xve(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(xve(e.shouldSelectOnPressUp)&&!xve(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(Hbe(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 Xbe=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 zbe(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 zbe(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 zbe([t],t,t):new zbe;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new zbe;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 zbe)}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}},Zbe=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 Qbe,Jbe=e=>"function"==typeof e?e():e,exe=e=>{const t=ft((()=>{const t=Jbe(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=ct(Jbe(e.show)?"present":"hidden");let i="none";return pt((r=>{const a=Jbe(e.show);return mt((()=>{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})),pt((()=>{const t=Jbe(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),yt((()=>{t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}))})),{present:()=>"present"===r()||"hiding"===r(),state:r}},txe="data-kb-top-layer",nxe=!1,rxe=[];function oxe(e){return rxe.findIndex((t=>t.node===e))}function ixe(){return rxe.filter((e=>e.isPointerBlocking))}function axe(){return ixe().length>0}function sxe(e){const t=oxe([...ixe()].slice(-1)[0]?.node);return oxe(e)<t}var lxe={layers:rxe,isTopMostLayer:function(e){return rxe[rxe.length-1].node===e},hasPointerBlockingLayer:axe,isBelowPointerBlockingLayer:sxe,addLayer:function(e){rxe.push(e)},removeLayer:function(e){const t=oxe(e);t<0||rxe.splice(t,1)},indexOf:oxe,find:function(e){return rxe[oxe(e)]},assignPointerEventToLayers:function(){for(const{node:e}of rxe)e.style.pointerEvents=sxe(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(axe()&&!nxe){const t=Mye(e);Qbe=document.body.style.pointerEvents,t.body.style.pointerEvents="none",nxe=!0}},restoreBodyPointerEvents:function(e){if(axe())return;const t=Mye(e);t.body.style.pointerEvents=Qbe,0===t.body.style.length&&t.body.removeAttribute("style"),nxe=!1}};Sbe({},{Button:()=>dxe,Root:()=>uxe});var cxe=["button","color","file","image","reset","submit"];function uxe(e){let t;const n=nbe({type:"button"},e),[r,o]=Yt(n,["ref","type","disabled"]),i=ube((()=>t),(()=>"button")),a=ft((()=>{const e=i();return null!=e&&function(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==cxe.indexOf(e.type)}({tagName:e,type:r.type})})),s=ft((()=>"input"===i())),l=ft((()=>"a"===i()&&null!=t?.getAttribute("href")));return zt(pbe,Wt({as:"button",ref(e){const n=fye((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 dxe=uxe,pxe=["top","right","bottom","left"],fxe=Math.min,hxe=Math.max,mxe=Math.round,gxe=Math.floor,vxe=e=>({x:e,y:e}),yxe={left:"right",right:"left",bottom:"top",top:"bottom"},bxe={start:"end",end:"start"};function xxe(e,t,n){return hxe(e,fxe(t,n))}function wxe(e,t){return"function"==typeof e?e(t):e}function _xe(e){return e.split("-")[0]}function Sxe(e){return e.split("-")[1]}function Exe(e){return"x"===e?"y":"x"}function Txe(e){return"y"===e?"height":"width"}function Cxe(e){return["top","bottom"].includes(_xe(e))?"y":"x"}function Axe(e){return Exe(Cxe(e))}function Nxe(e){return e.replace(/start|end/g,(e=>bxe[e]))}function Rxe(e){return e.replace(/left|right|bottom|top/g,(e=>yxe[e]))}function Oxe(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 Pxe(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 kxe(e,t,n){let{reference:r,floating:o}=e;const i=Cxe(t),a=Axe(t),s=Txe(a),l=_xe(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(Sxe(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function jxe(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}=wxe(t,e),h=Oxe(f),m=s[p?"floating"===d?"reference":"floating":d],g=Pxe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Pxe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function Mxe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Lxe(e){return pxe.some((t=>e[t]>=0))}function Dxe(e){return Uxe(e)?(e.nodeName||"").toLowerCase():"#document"}function Ixe(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Fxe(e){var t;return null==(t=(Uxe(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Uxe(e){return e instanceof Node||e instanceof Ixe(e).Node}function $xe(e){return e instanceof Element||e instanceof Ixe(e).Element}function Vxe(e){return e instanceof HTMLElement||e instanceof Ixe(e).HTMLElement}function Bxe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Ixe(e).ShadowRoot)}function zxe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Yxe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Hxe(e){return["table","td","th"].includes(Dxe(e))}function qxe(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(ITe){return!1}}))}function Gxe(e){const t=Kxe(),n=$xe(e)?Yxe(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 Kxe(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Wxe(e){return["html","body","#document"].includes(Dxe(e))}function Yxe(e){return Ixe(e).getComputedStyle(e)}function Xxe(e){return $xe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zxe(e){if("html"===Dxe(e))return e;const t=e.assignedSlot||e.parentNode||Bxe(e)&&e.host||Fxe(e);return Bxe(t)?t.host:t}function Qxe(e){const t=Zxe(e);return Wxe(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vxe(t)&&zxe(t)?t:Qxe(t)}function Jxe(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Qxe(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Ixe(o);return i?t.concat(a,a.visualViewport||[],zxe(o)?o:[],a.frameElement&&n?Jxe(a.frameElement):[]):t.concat(o,Jxe(o,[],n))}function ewe(e){const t=Yxe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Vxe(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=mxe(n)!==i||mxe(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function twe(e){return $xe(e)?e:e.contextElement}function nwe(e){const t=twe(e);if(!Vxe(t))return vxe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ewe(t);let a=(i?mxe(n.width):n.width)/r,s=(i?mxe(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var rwe=vxe(0);function owe(e){const t=Ixe(e);return Kxe()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:rwe}function iwe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=twe(e);let a=vxe(1);t&&(r?$xe(r)&&(a=nwe(r)):a=nwe(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Ixe(e))&&t}(i,n,r)?owe(i):vxe(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=Ixe(i),t=r&&$xe(r)?Ixe(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=nwe(o),t=o.getBoundingClientRect(),r=Yxe(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=Ixe(o),o=n.frameElement}}return Pxe({width:u,height:d,x:l,y:c})}function awe(e){return iwe(Fxe(e)).left+Xxe(e).scrollLeft}function swe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Ixe(e),r=Fxe(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=Kxe();(!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=Fxe(e),n=Xxe(e),r=e.ownerDocument.body,o=hxe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=hxe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+awe(e);const s=-n.scrollTop;return"rtl"===Yxe(r).direction&&(a+=hxe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Fxe(e));else if($xe(t))r=function(e,t){const n=iwe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Vxe(e)?nwe(e):vxe(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=owe(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Pxe(r)}function lwe(e,t){const n=Zxe(e);return!(n===t||!$xe(n)||Wxe(n))&&("fixed"===Yxe(n).position||lwe(n,t))}function cwe(e,t,n){const r=Vxe(t),o=Fxe(t),i="fixed"===n,a=iwe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=vxe(0);if(r||!r&&!i)if(("body"!==Dxe(t)||zxe(o))&&(s=Xxe(t)),r){const e=iwe(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=awe(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function uwe(e){return"static"===Yxe(e).position}function dwe(e,t){return Vxe(e)&&"fixed"!==Yxe(e).position?t?t(e):e.offsetParent:null}function pwe(e,t){const n=Ixe(e);if(qxe(e))return n;if(!Vxe(e)){let t=Zxe(e);for(;t&&!Wxe(t);){if($xe(t)&&!uwe(t))return t;t=Zxe(t)}return n}let r=dwe(e,t);for(;r&&Hxe(r)&&uwe(r);)r=dwe(r,t);return r&&Wxe(r)&&uwe(r)&&!Gxe(r)?n:r||function(e){let t=Zxe(e);for(;Vxe(t)&&!Wxe(t);){if(Gxe(t))return t;if(qxe(t))return null;t=Zxe(t)}return null}(e)||n}var fwe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Fxe(r),s=!!t&&qxe(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=vxe(1);const u=vxe(0),d=Vxe(r);if((d||!d&&!i)&&(("body"!==Dxe(r)||zxe(a))&&(l=Xxe(r)),Vxe(r))){const e=iwe(r);c=nwe(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:Fxe,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?qxe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Jxe(e,[],!1).filter((e=>$xe(e)&&"body"!==Dxe(e))),o=null;const i="fixed"===Yxe(e).position;let a=i?Zxe(e):e;for(;$xe(a)&&!Wxe(a);){const t=Yxe(a),n=Gxe(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||zxe(a)&&!n&&lwe(e,a))?r=r.filter((e=>e!==a)):o=t,a=Zxe(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=swe(t,n,o);return e.top=hxe(r.top,e.top),e.right=fxe(r.right,e.right),e.bottom=fxe(r.bottom,e.bottom),e.left=hxe(r.left,e.left),e}),swe(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:pwe,getElementRects:async function(e){const t=this.getOffsetParent||pwe,n=this.getDimensions,r=await n(e.floating);return{reference:cwe(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}=ewe(e);return{width:t,height:n}},getScale:nwe,isElement:$xe,isRTL:function(e){return"rtl"===Yxe(e).direction}};function hwe(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=twe(e),u=o||i?[...c?Jxe(c):[],...Jxe(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=Fxe(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:-gxe(u)+"px "+-gxe(o.clientWidth-(c+d))+"px "+-gxe(o.clientHeight-(u+p))+"px "+-gxe(c)+"px",threshold:hxe(0,fxe(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(ITe){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?iwe(e):null;return l&&function t(){const r=iwe(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 mwe=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=_xe(n),s=Sxe(n),l="y"===Cxe(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=wxe(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}}}}},gwe=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}=wxe(e,t),c={x:n,y:r},u=await jxe(t,l),d=Cxe(_xe(o)),p=Exe(d);let f=c[p],h=c[d];if(i){f=xxe(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=xxe(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}}}}},vwe=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}=wxe(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=_xe(o),y=Cxe(s),b=_xe(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[Rxe(s)]:function(e){const t=Rxe(e);return[Nxe(e),t,Nxe(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=Sxe(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[]}}(_xe(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Nxe)))),i}(s,m,h,x));const S=[s,...w],E=await jxe(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=Sxe(e),o=Axe(e),i=Txe(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Rxe(a)),[a,Rxe(a)]}(o,a,x);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,N;const e=((null==(A=i.flip)?void 0:A.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(N=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(f){case"bestFit":{var R;const e=null==(R=C.filter((e=>{if(_){const t=Cxe(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},ywe=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}=wxe(e,t),l=await jxe(t,s),c=_xe(n),u=Sxe(n),d="y"===Cxe(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=fxe(f-l[h],g),b=fxe(p-l[m],v),x=!t.middlewareData.shift;let w=y,_=b;if(d?_=u||x?fxe(b,v):v:w=u||x?fxe(y,g):g,x&&!u){const e=hxe(l.left,0),t=hxe(l.right,0),n=hxe(l.top,0),r=hxe(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:hxe(l.left,l.right)):w=f-2*(0!==n||0!==r?n+r:hxe(l.top,l.bottom))}await a({...t,availableWidth:_,availableHeight:w});const S=await o.getDimensions(i.floating);return p!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},bwe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=wxe(e,t);switch(r){case"referenceHidden":{const e=Mxe(await jxe(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Lxe(e)}}}case"escaped":{const e=Mxe(await jxe(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Lxe(e)}}}default:return{}}}}},xwe=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}=wxe(e,t)||{};if(null==c)return{};const d=Oxe(u),p={x:n,y:r},f=Axe(o),h=Txe(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],w=p[f]-i.reference[f],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=_?_[b]:0;S&&await(null==a.isElement?void 0:a.isElement(_))||(S=s.floating[b]||i.floating[h]);const E=x/2-w/2,T=S/2-m[h]/2-1,C=fxe(d[v],T),A=fxe(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=xxe(N,O,R),k=!l.arrow&&null!=Sxe(o)&&O!==P&&i.reference[h]/2-(O<N?C:A)-m[h]/2<0,j=k?O<N?O-N:O-R:0;return{[f]:p[f]+j,data:{[f]:P,centerOffset:O-P-j,...k&&{alignmentOffset:j}},reset:k}}}),wwe=(e,t,n)=>{const r={platform:fwe,...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}=kxe(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}=kxe(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},_we=St();function Swe(){const e=Et(_we);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var Ewe=mn('<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">'),Twe={top:180,right:-90,bottom:0,left:90};function Cwe(e){const t=Swe(),n=nbe({size:30},e),[r,o]=Yt(n,["ref","style","size"]),i=()=>t.currentPlacement().split("-")[0],a=function(e){const[t,n]=ct();return pt((()=>{const t=e();var r;t&&n((r=t,Mye(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return zt(pbe,Wt({as:"div",ref(e){const n=fye(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Nye({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=Ewe(),t=e.firstChild;return dt((()=>vn(t,"transform",`rotate(${Twe[i()]} 15 15) translate(0 2)`))),e}}))}function Awe(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 Nwe(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var Rwe={top:"bottom",right:"left",bottom:"top",left:"right"};var Owe=Object.assign((function(e){const t=nbe({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]=ct(),[o,i]=ct(),[a,s]=ct(t.placement),l=()=>{return e=t.anchorRef?.(),n=t.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const t=n(e);return t?Awe(t):e?e.getBoundingClientRect():Awe()}};var e,n},{direction:c}=Vbe();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=[mwe((({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(Nwe))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(vwe({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(gwe({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(ywe({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(bwe({padding:t.detachedPadding})),i&&d.push(xwe({element:i,padding:t.arrowPadding}));const p=await wwe(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...fwe,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=Rwe[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 pt((()=>{const e=l(),t=n();if(!e||!t)return;yt(hwe(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),pt((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),zt(_we.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:Cwe,Context:_we,usePopperContext:Swe,Positioner:function(e){const t=Swe(),[n,r]=Yt(e,["ref","style"]);return zt(pbe,Wt({as:"div",ref(e){const r=fye(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return Nye({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var Pwe="interactOutside.pointerDownOutside",kwe="interactOutside.focusOutside";var jwe=St();function Mwe(e){let t;const n=Et(jwe),[r,o]=Yt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=tbe;const o=()=>Mye(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(`[${txe}]`)&&!!kye(o(),r)&&!kye(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=Vye([i,s]);r.addEventListener(Pwe,o,{once:!0});const a=new CustomEvent(Pwe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||Bye(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=Vye([a,s]);r.addEventListener(kwe,o,{once:!0});const i=new CustomEvent(kwe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};pt((()=>{xve(e.isDisabled)||(n=window.setTimeout((()=>{o().addEventListener("pointerdown",c,!0)}),0),o().addEventListener("focusin",u,!0),yt((()=>{window.clearTimeout(n),o().removeEventListener("click",r),o().removeEventListener("pointerdown",c,!0),o().removeEventListener("focusin",u,!0)})))}))}({shouldExcludeElement:e=>!!t&&(r.excludedElements?.some((t=>kye(t(),e)))||[...i].some((t=>kye(t,e)))),onPointerDownOutside:e=>{t&&!lxe.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||lxe.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===Dye.Escape&&e.onEscapeKeyDown?.(t)};pt((()=>{if(xve(e.isDisabled))return;const n=e.ownerDocument?.()??Mye();n.addEventListener("keydown",t),yt((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Mye(t),onEscapeKeyDown:e=>{t&&lxe.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),vt((()=>{if(!t)return;lxe.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);lxe.assignPointerEventToLayers(),lxe.disableBodyPointerEvents(t),yt((()=>{t&&(lxe.removeLayer(t),e?.(),lxe.assignPointerEventToLayers(),lxe.restoreBodyPointerEvents(t))}))})),pt(gt([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=lxe.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,lxe.assignPointerEventToLayers()),t&&lxe.disableBodyPointerEvents(e),yt((()=>{lxe.restoreBodyPointerEvents(e)}))}),{defer:!0}));return zt(jwe.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return zt(pbe,Wt({as:"div",ref(e){const n=fye((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Lwe(e={}){const[t,n]=wbe({value:()=>xve(e.open),defaultValue:()=>!!xve(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 Dwe={};Sbe(Dwe,{Description:()=>gbe,ErrorMessage:()=>vbe,Item:()=>Vwe,ItemControl:()=>Bwe,ItemDescription:()=>zwe,ItemIndicator:()=>Hwe,ItemInput:()=>qwe,ItemLabel:()=>Gwe,Label:()=>Kwe,RadioGroup:()=>Ywe,Root:()=>Wwe});var Iwe=St();function Fwe(){const e=Et(Iwe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var Uwe=St();function $we(){const e=Et(Uwe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function Vwe(e){const t=mbe(),n=Fwe(),r=nbe({id:`${t.generateId("item")}-${Qt()}`},e),[o,i]=Yt(r,["value","disabled","onPointerDown"]),[a,s]=ct(),[l,c]=ct(),[u,d]=ct(),[p,f]=ct(),[h,m]=ct(!1),g=ft((()=>n.isSelectedValue(o.value))),v=ft((()=>o.disabled||t.isDisabled()||!1)),y=e=>{$ye(e,o.onPointerDown),h()&&e.preventDefault()},b=ft((()=>({...t.dataset(),"data-disabled":v()?"":void 0,"data-checked":g()?"":void 0}))),x={value:()=>o.value,dataset:b,isSelected:g,isDisabled:v,inputId:a,labelId:l,descriptionId:u,inputRef:p,select:()=>n.setSelectedValue(o.value),generateId:Pye((()=>i.id)),registerInput:cbe(s),registerLabel:cbe(c),registerDescription:cbe(d),setIsFocused:m,setInputRef:f};return zt(Uwe.Provider,{value:x,get children(){return zt(pbe,Wt({as:"div",role:"group",onPointerDown:y},b,i))}})}function Bwe(e){const t=$we(),n=nbe({id:t.generateId("control")},e),[r,o]=Yt(n,["onClick","onKeyDown"]);return zt(pbe,Wt({as:"div",onClick:e=>{$ye(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{$ye(e,r.onKeyDown),e.key===Dye.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function zwe(e){const t=$we(),n=nbe({id:t.generateId("description")},e);return pt((()=>yt(t.registerDescription(n.id)))),zt(pbe,Wt({as:"div"},(()=>t.dataset()),n))}function Hwe(e){const t=$we(),n=nbe({id:t.generateId("indicator")},e),[r,o]=Yt(n,["ref","forceMount"]),[i,a]=ct(),{present:s}=exe({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return zt(nn,{get when(){return s()},get children(){return zt(pbe,Wt({as:"div",ref(e){const t=fye(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function qwe(e){const t=mbe(),n=Fwe(),r=$we(),o=nbe({id:r.generateId("input")},e),[i,a]=Yt(o,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=ct(!1);return pt(gt([()=>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})),pt((()=>yt(r.registerInput(a.id)))),zt(pbe,Wt({as:"input",ref(e){const t=fye(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 Nye({...lbe},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($ye(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{$ye(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{$ye(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function Gwe(e){const t=$we(),n=nbe({id:t.generateId("label")},e);return pt((()=>yt(t.registerLabel(n.id)))),zt(pbe,Wt({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function Kwe(e){return zt(ybe,Wt({as:"span"},e))}function Wwe(e){let t;const n=nbe({id:`radiogroup-${Qt()}`,orientation:"vertical"},e),[r,o,i]=Yt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],fbe),[a,s]=xbe({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=nbe({id:`form-control-${Qt()}`},e),[n,r]=ct(),[o,i]=ct(),[a,s]=ct(),[l,c]=ct();return{formControlContext:{name:()=>xve(t.name)??xve(t.id),dataset:ft((()=>({"data-valid":"valid"===xve(t.validationState)?"":void 0,"data-invalid":"invalid"===xve(t.validationState)?"":void 0,"data-required":xve(t.required)?"":void 0,"data-disabled":xve(t.disabled)?"":void 0,"data-readonly":xve(t.readOnly)?"":void 0}))),validationState:()=>xve(t.validationState),isRequired:()=>xve(t.required),isDisabled:()=>xve(t.disabled),isReadOnly:()=>xve(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:Pye((()=>xve(t.id))),registerLabel:cbe(r),registerField:cbe(i),registerDescription:cbe(s),registerErrorMessage:cbe(c)}}}(o);bbe((()=>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 zt(hbe.Provider,{value:l,get children(){return zt(Iwe.Provider,{value:d,get children(){return zt(pbe,Wt({as:"div",ref(e){const n=fye((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return xve(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(xve(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var Ywe=Object.assign(Wwe,{Description:gbe,ErrorMessage:vbe,Item:Vwe,ItemControl:Bwe,ItemDescription:zwe,ItemIndicator:Hwe,ItemInput:qwe,ItemLabel:Gwe,Label:Kwe}),Xwe=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 Zwe(e,t,n){const r=function(e){const{locale:t}=Vbe(),n=ft((()=>t()+(e?Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1)).join():"")));return ft((()=>{const r=n();let o;return Bbe.has(r)&&(o=Bbe.get(r)),o||(o=new Intl.Collator(t(),e),Bbe.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return Wbe({selectionManager:()=>xve(e.selectionManager),keyboardDelegate:ft((()=>{const n=xve(e.keyboardDelegate);return n||new Xwe(e.collection,t,r)})),autoFocus:()=>xve(e.autoFocus),deferAutoFocus:()=>xve(e.deferAutoFocus),shouldFocusWrap:()=>xve(e.shouldFocusWrap),disallowEmptySelection:()=>xve(e.disallowEmptySelection),selectOnFocus:()=>xve(e.selectOnFocus),disallowTypeAhead:()=>xve(e.disallowTypeAhead),shouldUseVirtualFocus:()=>xve(e.shouldUseVirtualFocus),allowsTabNavigation:()=>xve(e.allowsTabNavigation),isVirtualized:()=>xve(e.isVirtualized),scrollToKey:t=>xve(e.scrollToKey)?.(t),orientation:()=>xve(e.orientation)},t)}var Qwe="focusScope.autoFocusOnMount",Jwe="focusScope.autoFocusOnUnmount",e_e={bubbles:!1,cancelable:!0},t_e={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=Rye(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=Rye(this.stack,e),this.active()?.resume()}};function n_e(e,t){const[n,r]=ct(!1),o={pause(){r(!0)},resume(){r(!1)}};let i=null;const a=t=>e.onMountAutoFocus?.(t),s=t=>e.onUnmountAutoFocus?.(t),l=()=>Mye(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,lbe),e},u=()=>{const e=t();return e?Yye(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=u();return e.length>0?e[0]:null};pt((()=>{const e=t();if(!e)return;t_e.add(o);const n=jye(e);if(!kye(e,n)){const t=new CustomEvent(Qwe,e_e);e.addEventListener(Qwe,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{zye(d()),jye(e)===n&&zye(e)}),0)}yt((()=>{e.removeEventListener(Qwe,a),setTimeout((()=>{const r=new CustomEvent(Jwe,e_e);(()=>{const e=t();if(!e)return!1;const n=jye(e);return!!n&&!kye(e,n)&&Zye(n)})()&&r.preventDefault(),e.addEventListener(Jwe,s),e.dispatchEvent(r),r.defaultPrevented||zye(n??l().body),e.removeEventListener(Jwe,s),t_e.remove(o)}),0)}))})),pt((()=>{const r=t();if(!r||!xve(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${txe}]`)||(kye(r,t)?i=t:zye(i))},a=e=>{const t=e.relatedTarget??jye(r);t?.closest(`[${txe}]`)||kye(r,t)||zye(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),yt((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),pt((()=>{const r=t();if(!r||!xve(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})();zye(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}),yt((()=>{o.removeEventListener("focusin",a),i.removeEventListener("focusin",a),o.remove(),i.remove(),s.disconnect()}))}))}var r_e="data-live-announcer";function o_e(e){pt((()=>{xve(e.isDisabled)||yt(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${r_e}], [${txe}]`))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=i_e.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),i_e.set(e,t+1))};a_e.length&&a_e[a_e.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 a_e.push(s),()=>{a.disconnect();for(const e of r){const t=i_e.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),i_e.delete(e)):i_e.set(e,t-1)}s===a_e[a_e.length-1]?(a_e.pop(),a_e.length&&a_e[a_e.length-1].observe()):a_e.splice(a_e.indexOf(s),1)}}(xve(e.targets),xve(e.root)))}))}var i_e=new WeakMap,a_e=[];var s_e=new Map,l_e=e=>{pt((()=>{const t=Jbe(e.style)??{},n=Jbe(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=s_e.get(e.key);o?o.activeCount++:s_e.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);yt((()=>{const t=s_e.get(e.key);if(t)if(1===t.activeCount){s_e.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--}))}))},c_e=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},u_e=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[d_e,p_e]=ct([]),f_e=e=>[e.deltaX,e.deltaY],h_e=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],m_e=(e,t,n,r)=>{const o=null!==r&&g_e(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]=c_e(o,t),u=c-e-r*l;0===l&&0===u||!u_e(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)},g_e=(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},v_e=e=>{const t=Wt({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=Qt();let r=[0,0],o=null,i=null;pt((()=>{Jbe(t.enabled)&&(p_e((e=>[...e,n])),yt((()=>{p_e((e=>e.filter((e=>e!==n))))})))})),pt((()=>{if(!Jbe(t.enabled)||!Jbe(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(Jbe(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===Jbe(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;l_e({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{Jbe(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else l_e({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),pt((()=>{var e;(e=n,d_e().indexOf(e)===d_e().length-1&&Jbe(t.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",a,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),yt((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",a),document.removeEventListener("touchmove",l)})))}));const a=e=>{r=h_e(e),o=null,i=null},s=e=>{const n=e.target,r=Jbe(t.element),o=f_e(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=m_e(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!g_e(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=Jbe(t.element),a=e.target;let s;if(2===e.touches.length)s=!Jbe(t.allowPinchZoom);else{if(null==o||null===i){const t=h_e(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=m_e(a,o,i,n);s=!n||!g_e(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},y_e=St();function b_e(){return Et(y_e)}function x_e(){const e=b_e();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var w_e=St();function __e(){const e=Et(w_e);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var S_e=St();function E_e(){const e=Et(S_e);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function T_e(e){let t;const n=E_e(),r=x_e(),o=nbe({id:n.generateId(`item-${Qt()}`)},e),[i,a]=Yt(o,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=ct(),[c,u]=ct(),[d,p]=ct(),f=()=>r.listState().selectionManager(),h=()=>a.id,m=()=>{i.onSelect?.(),i.closeOnSelect&&setTimeout((()=>{r.close(!0)}))};Obe({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=Ybe({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{$ye(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(zye(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{$ye(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{$ye(e,i.onPointerUp),i.disabled||0!==e.button||m()},x=e=>{if($ye(e,i.onKeyDown),!e.repeat&&!i.disabled)switch(e.key){case"Enter":case" ":m()}},w=ft((()=>i.indeterminate?"mixed":null!=i.checked?i.checked:void 0)),_=ft((()=>({"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:Pye((()=>a.id)),registerLabel:cbe(l),registerDescription:cbe(u)};return zt(w_e.Provider,{value:S,get children(){return zt(pbe,Wt({as:"div",ref(e){const n=fye((e=>t=e),i.ref);"function"==typeof n&&n(e)},get tabIndex(){return g.tabIndex()},get"aria-checked"(){return w()},get"aria-disabled"(){return i.disabled},get"aria-labelledby"(){return s()},get"aria-describedby"(){return c()},get"data-key"(){return g.dataKey()},get onPointerDown(){return Vye([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return Vye([b,g.onPointerUp])},get onClick(){return Vye([i.onClick,g.onClick])},get onKeyDown(){return Vye([x,g.onKeyDown])},get onMouseDown(){return Vye([i.onMouseDown,g.onMouseDown])},get onFocus(){return Vye([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function C_e(e){const t=nbe({closeOnSelect:!1},e),[n,r]=Yt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=wbe({value:()=>xve(e.isSelected),defaultValue:()=>!!xve(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{xve(e.isReadOnly)||xve(e.isDisabled)||n(t)},toggle:()=>{xve(e.isReadOnly)||xve(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return zt(T_e,Wt({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var A_e=St();function N_e(){return Et(A_e)}var R_e={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>R_e.next("ltr"===e?"rtl":"ltr",t)},O_e=e=>"horizontal"===e?"ArrowDown":"ArrowRight",P_e=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function k_e(e){const t=E_e(),n=x_e(),r=N_e(),{direction:o}=Vbe(),i=nbe({id:t.generateId("trigger")},e),[a,s]=Yt(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=ube((()=>n.triggerRef()),(()=>"button")),u=ft((()=>"a"===c()&&null!=n.triggerRef()?.getAttribute("href")));pt(gt((()=>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 pt((()=>yt(n.registerTriggerId(a.id)))),zt(uxe,Wt({ref(e){const t=fye(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 ft((()=>!!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=>{$ye(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{$ye(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{$ye(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if($ye(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case O_e(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=Jye(e);for(;e&&n&&e!==t&&n!==t;)abe(n,e),n=Jye(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 P_e(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case R_e.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case R_e.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{$ye(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 j_e=St();function M_e(){return Et(j_e)}function L_e(e){let t;const n=E_e(),r=x_e(),o=N_e(),i=M_e(),{direction:a}=Vbe(),s=nbe({id:n.generateId(`content-${Qt()}`)},e),[l,c]=Yt(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=Zwe({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));n_e({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()};pt((()=>yt(r.registerContentId(l.id))));const m={ref:fye((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:Vye([l.onKeyDown,p.onKeyDown,e=>{if(kye(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case R_e.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case R_e.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:Vye([l.onMouseDown,p.onMouseDown]),onFocusIn:Vye([l.onFocusIn,p.onFocusIn]),onFocusOut:Vye([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{$ye(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if($ye(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;kye(e.currentTarget,e.target)&&t&&(r.setPointerDir(e.clientX>u?"right":"left"),u=e.clientX)},get"data-orientation"(){return n.orientation()}};return zt(nn,{get when(){return r.contentPresent()},get children(){return zt(nn,{get when(){return void 0===i||null!=r.parentMenuContext()},get fallback(){return zt(pbe,Wt({as:"div"},(()=>r.dataset()),m,c))},get children(){return zt(Owe.Positioner,{get children(){return zt(Mwe,Wt({get disableOutsidePointerEvents(){return ft((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Nye({"--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 D_e(e){let t;const n=E_e(),r=x_e(),[o,i]=Yt(e,["ref"]);return v_e({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),zt(L_e,Wt({ref(e){const n=fye((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var I_e=St();function F_e(e){const t=nbe({id:E_e().generateId(`group-${Qt()}`)},e),[n,r]=ct(),o={generateId:Pye((()=>t.id)),registerLabelId:cbe(r)};return zt(I_e.Provider,{value:o,get children(){return zt(pbe,Wt({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function U_e(e){const t=function(){const e=Et(I_e);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=nbe({id:t.generateId("label")},e),[r,o]=Yt(n,["id"]);return pt((()=>yt(t.registerLabelId(r.id)))),zt(pbe,Wt({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function $_e(e){const t=x_e();return zt(pbe,Wt({as:"span","aria-hidden":"true"},(()=>t.dataset()),nbe({children:"▼"},e)))}function V_e(e){return zt(T_e,Wt({role:"menuitem",closeOnSelect:!0},e))}function B_e(e){const t=__e(),n=nbe({id:t.generateId("description")},e),[r,o]=Yt(n,["id"]);return pt((()=>yt(t.registerDescription(r.id)))),zt(pbe,Wt({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function z_e(e){const t=__e(),n=nbe({id:t.generateId("indicator")},e),[r,o]=Yt(n,["forceMount"]);return zt(nn,{get when(){return r.forceMount||t.isChecked()},get children(){return zt(pbe,Wt({as:"div"},(()=>t.dataset()),o))}})}function H_e(e){const t=__e(),n=nbe({id:t.generateId("label")},e),[r,o]=Yt(n,["ref","id"]);return pt((()=>yt(t.registerLabel(r.id)))),zt(pbe,Wt({as:"div",ref(e){const n=fye(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function q_e(e){const t=x_e();return zt(nn,{get when(){return t.contentPresent()},get children(){return zt(jn,e)}})}var G_e=St();function K_e(e){const t=nbe({id:E_e().generateId(`radiogroup-${Qt()}`)},e),[n,r]=Yt(t,["value","defaultValue","onChange","disabled"]),[o,i]=xbe({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return zt(G_e.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return zt(F_e,r)}})}function W_e(e){const t=function(){const e=Et(G_e);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=nbe({closeOnSelect:!1},e),[r,o]=Yt(n,["value","onSelect"]);return zt(T_e,Wt({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function Y_e(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 X_e(e){const t=E_e(),n=Tbe(),r=b_e(),o=N_e(),i=M_e(),a=nbe({placement:"horizontal"===t.orientation()?"bottom-start":"right-start"},e),[s,l]=Yt(a,["open","defaultOpen","onOpenChange"]);let c=0,u=null,d="right";const[p,f]=ct(),[h,m]=ct(),[g,v]=ct(),[y,b]=ct(),[x,w]=ct(!0),[_,S]=ct(l.placement),[E,T]=ct([]),[C,A]=ct([]),{DomCollectionProvider:N}=Rbe({items:C,onItemsChange:A}),R=Lwe({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:O}=exe({show:()=>t.forceMount()||R.isOpen(),element:()=>y()??null}),P=function(e){const t=Kbe(e),n=kbe({dataSource:()=>xve(e.dataSource),getKey:()=>xve(e.getKey),getTextValue:()=>xve(e.getTextValue),getDisabled:()=>xve(e.getDisabled),getSectionChildren:()=>xve(e.getSectionChildren),factory:t=>new Zbe(e.filter?e.filter(t):t)},[()=>e.filter]),r=new Xbe(n,t);return ut((()=>{const e=t.focusedKey();null==e||n().getItem(e)||t.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>r}}({selectionMode:"none",dataSource:C}),k=e=>{w(e),R.open()},j=(e=!1)=>{R.close(),e&&r&&r.close(!0)},M=()=>{const e=y();e&&(zye(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},L=()=>{null!=i?setTimeout((()=>M())):M()},D=e=>{return d===u?.side&&(t=e,n=u?.area,!!n&&function(e,t){const[n,r]=e;let o=!1;for(let i=t.length,a=0,s=i-1;a<i;s=a++){const[e,l]=t[a],[c,u]=t[s],[,d]=t[0===s?i-1:s-1]||[0,0],p=(l-u)*(n-e)-(e-c)*(r-l);if(u<l){if(r>=u&&r<l){if(0===p)return!0;p>0&&(r===u?r>d&&(o=!o):o=!o)}}else if(l<u){if(r>l&&r<=u){if(0===p)return!0;p<0&&(r===u?r<d&&(o=!o):o=!o)}}else if(r==l&&(n>=c&&n<=e||n>=e&&n<=c))return!0}return o}([t.clientX,t.clientY],n));var t,n};o_e({isDisabled:()=>!(null==r&&R.isOpen()&&t.isModal()),targets:()=>[y(),...E()].filter(Boolean)}),pt((()=>{const e=y();if(!e||!r)return;const t=r.registerNestedMenu(e);yt((()=>{t()}))})),pt((()=>{void 0===r&&o?.registerMenu(t.value(),[y(),...E()])})),pt((()=>{void 0===r&&void 0!==o&&(o.value()===t.value()?(g()?.focus(),o.autoFocusMenu()&&k(!0)):j())})),pt((()=>{void 0===r&&void 0!==o&&R.isOpen()&&o.setValue(t.value())})),yt((()=>{void 0===r&&o?.unregisterMenu(t.value())}));const I={dataset:ft((()=>({"data-expanded":R.isOpen()?"":void 0,"data-closed":R.isOpen()?void 0:""}))),isOpen:R.isOpen,contentPresent:O,nestedMenus:E,currentPlacement:_,pointerGraceTimeoutId:()=>c,autoFocus:x,listState:()=>P,parentMenuContext:()=>r,triggerRef:g,contentRef:y,triggerId:p,contentId:h,setTriggerRef:v,setContentRef:b,open:k,close:j,toggle:e=>{w(e),R.toggle()},focusContent:L,onItemEnter:e=>{D(e)&&e.preventDefault()},onItemLeave:e=>{D(e)||L()},onTriggerLeave:e=>{D(e)&&e.preventDefault()},setPointerDir:e=>d=e,setPointerGraceTimeoutId:e=>c=e,setPointerGraceIntent:e=>u=e,registerNestedMenu:e=>{T((t=>[...t,e]));const t=r?.registerNestedMenu(e);return()=>{T((t=>Rye(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:cbe(f),registerContentId:cbe(m)};return zt(N,{get children(){return zt(y_e.Provider,{value:I,get children(){return zt(nn,{when:void 0===i,get fallback(){return l.children},get children(){return zt(Owe,Wt({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function Z_e(e){const{direction:t}=Vbe();return zt(X_e,Wt({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var Q_e=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function J_e(e){const t=x_e(),n=E_e(),[r,o]=Yt(e,["onFocusOutside","onKeyDown"]),{direction:i}=Vbe();return zt(L_e,Wt({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;kye(t.triggerRef(),n)||t.close()},onKeyDown:e=>{$ye(e,r.onKeyDown);const o=kye(e.currentTarget,e.target),a=Q_e(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),zye(t.triggerRef()))}},o))}var eSe=["Enter"," "],tSe=(e,t)=>"ltr"===e?[...eSe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...eSe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function nSe(e){let t;const n=E_e(),r=x_e(),o=nbe({id:n.generateId(`sub-trigger-${Qt()}`)},e),[i,a]=Yt(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}=Vbe(),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=Ybe({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{$ye(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{$ye(e,i.onKeyDown),e.repeat||i.disabled||tSe(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 pt((()=>{if(null==r.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");yt(r.registerItemToParentDomCollection({ref:()=>t,type:"item",key:u(),textValue:i.textValue??t?.textContent??"",disabled:i.disabled??!1}))})),pt(gt((()=>r.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{yt((()=>{window.clearTimeout(e),r.parentMenuContext()?.setPointerGraceIntent(null)}))}))),pt((()=>yt(r.registerTriggerId(i.id)))),yt((()=>{l()})),zt(pbe,Wt({as:"div",ref(e){const n=fye((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 ft((()=>!!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 Vye([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return Vye([i.onPointerUp,p.onPointerUp])},get onClick(){return Vye([f,p.onClick])},get onKeyDown(){return Vye([h,p.onKeyDown])},get onMouseDown(){return Vye([i.onMouseDown,p.onMouseDown])},get onFocus(){return Vye([i.onFocus,p.onFocus])},onPointerMove:e=>{if($ye(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)),zye(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if($ye(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:Y_e(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 rSe(e){const t=N_e(),n=nbe({id:`menu-${Qt()}`,modal:!0},e),[r,o]=Yt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Lwe({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:Pye((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return zt(S_e.Provider,{value:a,get children(){return zt(X_e,Wt({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function oSe(e){let t;const n=nbe({orientation:"horizontal"},e),[r,o]=Yt(n,["ref","orientation"]),i=ube((()=>t),(()=>"hr"));return zt(pbe,Wt({as:"hr",ref(e){const n=fye((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))}Sbe({},{Root:()=>oSe,Separator:()=>iSe});var iSe=oSe,aSe={};function sSe(e){const t=E_e(),n=x_e(),[r,o]=Yt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return zt(D_e,Wt({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||zye(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function lSe(e){return zt(rSe,nbe({id:`dropdownmenu-${Qt()}`},e))}Sbe(aSe,{Arrow:()=>Cwe,CheckboxItem:()=>C_e,Content:()=>sSe,DropdownMenu:()=>cSe,Group:()=>F_e,GroupLabel:()=>U_e,Icon:()=>$_e,Item:()=>V_e,ItemDescription:()=>B_e,ItemIndicator:()=>z_e,ItemLabel:()=>H_e,Portal:()=>q_e,RadioGroup:()=>K_e,RadioItem:()=>W_e,Root:()=>lSe,Separator:()=>oSe,Sub:()=>Z_e,SubContent:()=>J_e,SubTrigger:()=>nSe,Trigger:()=>k_e});var cSe=Object.assign(lSe,{Arrow:Cwe,CheckboxItem:C_e,Content:sSe,Group:F_e,GroupLabel:U_e,Icon:$_e,Item:V_e,ItemDescription:B_e,ItemIndicator:z_e,ItemLabel:H_e,Portal:q_e,RadioGroup:K_e,RadioItem:W_e,Separator:oSe,Sub:Z_e,SubContent:J_e,SubTrigger:nSe,Trigger:k_e}),uSe={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"}},dSe=mn('<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>'),pSe=mn('<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>'),fSe=mn('<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>'),hSe=mn('<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>'),mSe=mn('<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>'),gSe=mn('<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>'),vSe=mn('<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>'),ySe=mn('<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>'),bSe=mn('<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">'),xSe=mn('<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">'),wSe=mn('<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>'),_Se=mn('<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>'),SSe=mn('<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>'),ESe=mn('<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>'),TSe=mn('<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>'),CSe=mn('<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>'),ASe=mn('<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>'),NSe=mn('<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>'),RSe=mn('<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>'),OSe=mn('<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>'),PSe=mn('<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>'),kSe=mn('<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>'),jSe=mn('<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 MSe(){return dSe()}function LSe(){return pSe()}function DSe(){return fSe()}function ISe(){return hSe()}function FSe(){return mSe()}function USe(){return(e=mSe()).style.setProperty("transform","rotate(90deg)"),e;var e}function $Se(){return(e=mSe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function VSe(){return gSe()}function BSe(){return vSe()}function zSe(){return ySe()}function HSe(){return bSe()}function qSe(){return xSe()}function GSe(){return wSe()}function KSe(){return _Se()}function WSe(){return SSe()}function YSe(){return ESe()}function XSe(e){return t=TSe(),n=t.firstChild,dt((()=>vn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function ZSe(){return CSe()}function QSe(){return ASe()}function JSe(e){return[zt(nn,{get when(){return e.checked},get children(){var t=TSe(),n=t.firstChild;return dt((()=>vn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}}),zt(nn,{get when(){return!e.checked},get children(){var t=NSe(),n=t.firstChild;return dt((()=>vn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function eEe(){return RSe()}function tEe(){return OSe()}function nEe(){return PSe()}function rEe(){return kSe()}function oEe(){const e=Qt();return t=jSe(),i=(o=(r=(n=t.firstChild).nextSibling).nextSibling).firstChild,s=(a=o.nextSibling).firstChild,u=(c=(l=a.nextSibling).nextSibling).firstChild,p=(d=c.nextSibling).firstChild,m=(h=(f=d.nextSibling).nextSibling).firstChild,v=(g=h.nextSibling).firstChild,x=(b=(y=g.nextSibling).nextSibling).firstChild,_=(w=b.nextSibling).firstChild,T=(E=(S=w.nextSibling).nextSibling).firstChild,A=(C=E.nextSibling).firstChild,O=(R=(N=C.nextSibling).nextSibling).firstChild,k=(P=R.nextSibling).firstChild,L=(M=(j=P.nextSibling).nextSibling).firstChild,I=(D=M.nextSibling).firstChild,$=(U=(F=D.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Q=(Z=(X=(Y=(W=(K=(G=(q=z.nextSibling).firstChild).nextSibling).nextSibling.firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,se=(ae=q.nextSibling).firstChild,ce=(le=ae.nextSibling).firstChild,pe=(de=(ue=le.nextSibling).firstChild).nextSibling,he=(fe=ue.nextSibling).firstChild,ge=(me=fe.nextSibling).firstChild,Le=(Me=(je=(ke=(Pe=(Oe=(Re=(Ne=(Ae=(Ce=(Te=(Ee=(Se=(_e=(we=(xe=(be=(ye=(ve=me.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,vn(n,"id",`a-${e}`),vn(r,"fill",`url(#a-${e})`),vn(i,"id",`am-${e}`),vn(a,"id",`b-${e}`),vn(s,"filter",`url(#am-${e})`),vn(l,"mask",`url(#b-${e})`),vn(u,"id",`ah-${e}`),vn(d,"id",`k-${e}`),vn(p,"filter",`url(#ah-${e})`),vn(f,"mask",`url(#k-${e})`),vn(m,"id",`ae-${e}`),vn(g,"id",`j-${e}`),vn(v,"filter",`url(#ae-${e})`),vn(y,"mask",`url(#j-${e})`),vn(x,"id",`ai-${e}`),vn(w,"id",`i-${e}`),vn(_,"filter",`url(#ai-${e})`),vn(S,"mask",`url(#i-${e})`),vn(T,"id",`aj-${e}`),vn(C,"id",`h-${e}`),vn(A,"filter",`url(#aj-${e})`),vn(N,"mask",`url(#h-${e})`),vn(O,"id",`ag-${e}`),vn(P,"id",`g-${e}`),vn(k,"filter",`url(#ag-${e})`),vn(j,"mask",`url(#g-${e})`),vn(L,"id",`af-${e}`),vn(D,"id",`f-${e}`),vn(I,"filter",`url(#af-${e})`),vn(F,"mask",`url(#f-${e})`),vn(U,"id",`m-${e}`),vn($,"fill",`url(#m-${e})`),vn(B,"id",`ak-${e}`),vn(z,"id",`e-${e}`),vn(H,"filter",`url(#ak-${e})`),vn(q,"mask",`url(#e-${e})`),vn(G,"id",`n-${e}`),vn(K,"fill",`url(#n-${e})`),vn(W,"id",`r-${e}`),vn(Y,"fill",`url(#r-${e})`),vn(X,"id",`s-${e}`),vn(Z,"fill",`url(#s-${e})`),vn(Q,"id",`q-${e}`),vn(J,"fill",`url(#q-${e})`),vn(ee,"id",`p-${e}`),vn(te,"fill",`url(#p-${e})`),vn(ne,"id",`o-${e}`),vn(re,"fill",`url(#o-${e})`),vn(oe,"id",`l-${e}`),vn(ie,"fill",`url(#l-${e})`),vn(se,"id",`al-${e}`),vn(le,"id",`d-${e}`),vn(ce,"filter",`url(#al-${e})`),vn(ue,"mask",`url(#d-${e})`),vn(de,"id",`u-${e}`),vn(pe,"fill",`url(#u-${e})`),vn(he,"id",`ad-${e}`),vn(me,"id",`c-${e}`),vn(ge,"filter",`url(#ad-${e})`),vn(ve,"mask",`url(#c-${e})`),vn(ye,"id",`t-${e}`),vn(be,"fill",`url(#t-${e})`),vn(xe,"id",`v-${e}`),vn(we,"stroke",`url(#v-${e})`),vn(_e,"id",`aa-${e}`),vn(Se,"stroke",`url(#aa-${e})`),vn(Ee,"id",`w-${e}`),vn(Te,"stroke",`url(#w-${e})`),vn(Ce,"id",`ac-${e}`),vn(Ae,"stroke",`url(#ac-${e})`),vn(Ne,"id",`ab-${e}`),vn(Re,"stroke",`url(#ab-${e})`),vn(Oe,"id",`y-${e}`),vn(Pe,"stroke",`url(#y-${e})`),vn(ke,"id",`x-${e}`),vn(je,"stroke",`url(#x-${e})`),vn(Me,"id",`z-${e}`),vn(Le,"stroke",`url(#z-${e})`),t;var t,n,r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x,w,_,S,E,T,C,A,N,R,O,P,k,j,M,L,D,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Z,Q,J,ee,te,ne,re,oe,ie,ae,se,le,ce,ue,de,pe,fe,he,me,ge,ve,ye,be,xe,we,_e,Se,Ee,Te,Ce,Ae,Ne,Re,Oe,Pe,ke,je,Me,Le}var iEe=mn('<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>'),aEe=mn('<button title="Copy object to clipboard">'),sEe=mn('<button title="Remove all items"aria-label="Remove all items">'),lEe=mn('<button title="Delete item"aria-label="Delete item">'),cEe=mn('<button title="Toggle value"aria-label="Toggle value">'),uEe=mn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),dEe=mn("<div>"),pEe=mn("<div><button> <span></span> <span> "),fEe=mn("<input>"),hEe=mn("<span>"),mEe=mn("<div><span>:"),gEe=mn("<div><div><button> [<!>...<!>]");var vEe=e=>{const t=Fve(),n=jve().shadowDOMTarget?cye.bind({target:jve().shadowDOMTarget}):cye,r=ft((()=>"dark"===t()?CEe(n):TEe(n)));return o=iEe(),dt((()=>yn(o,dye(r().expander,n`
85
+ */(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);i+="; Expires="+n.expires.toUTCString()}n.httpOnly&&(i+="; HttpOnly");n.secure&&(i+="; Secure");n.partitioned&&(i+="; Partitioned");if(n.priority){switch("string"==typeof n.priority?n.priority.toLowerCase():void 0){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}}if(n.sameSite){switch("string"==typeof n.sameSite?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}}return i};const d5=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,p5=/^[\u0021-\u003A\u003C-\u007E]*$/,f5=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,h5=/^[\u0020-\u003A\u003D-\u007E]*$/,m5=Object.prototype.toString,g5=(()=>{const e=function(){};return e.prototype=Object.create(null),e})();function v5(e,t,n){do{const n=e.charCodeAt(t);if(32!==n&&9!==n)return t}while(++t<n);return n}function y5(e,t,n){for(;t>n;){const n=e.charCodeAt(--t);if(32!==n&&9!==n)return t+1}return n}function b5(e){if(-1===e.indexOf("%"))return e;try{return decodeURIComponent(e)}catch(ITe){return e}}function x5(e={}){let t,{initialEntries:n=["/"],initialIndex:r,v5Compat:o=!1}=e;t=n.map(((e,t)=>u(e,"string"==typeof e?null:e.state,0===t?"default":void 0)));let i=l(null==r?t.length-1:r),a="POP",s=null;function l(e){return Math.min(Math.max(e,0),t.length-1)}function c(){return t[i]}function u(e,n=null,r){let o=function(e,t,n=null,r){let o={pathname:"string"==typeof e?e:e.pathname,search:"",hash:"",..."string"==typeof t?T5(t):t,state:n,key:t&&t.key||r||S5()};return o}(t?c().pathname:"/",e,n,r);return _5("/"===o.pathname.charAt(0),`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),o}function d(e){return"string"==typeof e?e:E5(e)}return{get index(){return i},get action(){return a},get location(){return c()},createHref:d,createURL:e=>new URL(d(e),"http://localhost"),encodeLocation(e){let t="string"==typeof e?T5(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,n){a="PUSH";let r=u(e,n);i+=1,t.splice(i,t.length,r),o&&s&&s({action:a,location:r,delta:1})},replace(e,n){a="REPLACE";let r=u(e,n);t[i]=r,o&&s&&s({action:a,location:r,delta:0})},go(e){a="POP";let n=l(i+e);i=n,s&&s({action:a,location:t[n],delta:e})},listen:e=>(s=e,()=>{s=null})}}function w5(e,t){if(!1===e||null==e)throw new Error(t)}function _5(e,t){if(!e)try{throw new Error(t)}catch(ITe){}}function S5(){return Math.random().toString(36).substring(2,10)}function E5({pathname:e="/",search:t="",hash:n=""}){return t&&"?"!==t&&(e+="?"===t.charAt(0)?t:"?"+t),n&&"#"!==n&&(e+="#"===n.charAt(0)?n:"#"+n),e}function T5(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function C5(e,t,n="/"){return function(e,t,n,r){let o="string"==typeof t?T5(t):t,i=$5(o.pathname||"/",n);if(null==i)return null;let a=A5(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(a);let s=null;for(let l=0;null==s&&l<a.length;++l){let e=U5(i);s=I5(a[l],e,r)}return s}(e,t,n,!1)}function A5(e,t=[],n=[],r=""){let o=(e,o,i)=>{let a={relativePath:void 0===i?e.path||"":i,caseSensitive:!0===e.caseSensitive,childrenIndex:o,route:e};a.relativePath.startsWith("/")&&(w5(a.relativePath.startsWith(r),`Absolute route path "${a.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),a.relativePath=a.relativePath.slice(r.length));let s=H5([r,a.relativePath]),l=n.concat(a);e.children&&e.children.length>0&&(w5(!0!==e.index,`Index routes must not have child routes. Please remove all child routes from route path "${s}".`),A5(e.children,t,l,s)),(null!=e.path||e.index)&&t.push({path:s,score:D5(s,e.index),routesMeta:l})};return e.forEach(((e,t)=>{if(""!==e.path&&e.path?.includes("?"))for(let n of N5(e.path))o(e,t,n);else o(e,t)})),t}function N5(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(0===r.length)return o?[i,""]:[i];let a=N5(r.join("/")),s=[];return s.push(...a.map((e=>""===e?i:[i,e].join("/")))),o&&s.push(...a),s.map((t=>e.startsWith("/")&&""===t?"/":t))}var R5=/^:[\w-]+$/,O5=3,P5=2,k5=1,j5=10,M5=-2,L5=e=>"*"===e;function D5(e,t){let n=e.split("/"),r=n.length;return n.some(L5)&&(r+=M5),t&&(r+=P5),n.filter((e=>!L5(e))).reduce(((e,t)=>e+(R5.test(t)?O5:""===t?k5:j5)),r)}function I5(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let s=0;s<r.length;++s){let e=r[s],l=s===r.length-1,c="/"===i?t:t.slice(i.length)||"/",u=F5({path:e.relativePath,caseSensitive:e.caseSensitive,end:l},c),d=e.route;if(!u&&l&&n&&!r[r.length-1].route.index&&(u=F5({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},c)),!u)return null;Object.assign(o,u.params),a.push({params:o,pathname:H5([i,u.pathname]),pathnameBase:q5(H5([i,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(i=H5([i,u.pathnameBase]))}return a}function F5(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t=!1,n=!0){_5("*"===e||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(r.push({paramName:"*"}),o+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":""!==e&&"/"!==e&&(o+="(?:(?=\\/|$))");let i=new RegExp(o,t?void 0:"i");return[i,r]}(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],a=i.replace(/(.)\/+$/,"$1"),s=o.slice(1);return{params:r.reduce(((e,{paramName:t,isOptional:n},r)=>{if("*"===t){a=i.slice(0,i.length-(s[r]||"").length).replace(/(.)\/+$/,"$1")}const o=s[r];return e[t]=n&&!o?void 0:(o||"").replace(/%2F/g,"/"),e}),{}),pathname:i,pathnameBase:a,pattern:e}}function U5(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return _5(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $5(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function V5(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function B5(e){let t=function(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}(e);return t.map(((e,n)=>n===t.length-1?e.pathname:e.pathnameBase))}function z5(e,t,n,r=!1){let o;"string"==typeof e?o=T5(e):(o={...e},w5(!o.pathname||!o.pathname.includes("?"),V5("?","pathname","search",o)),w5(!o.pathname||!o.pathname.includes("#"),V5("#","pathname","hash",o)),w5(!o.search||!o.search.includes("#"),V5("#","search","hash",o)));let i,a=""===e||""===o.pathname,s=a?"/":o.pathname;if(null==s)i=n;else{let e=t.length-1;if(!r&&s.startsWith("..")){let t=s.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}i=e>=0?t[e]:"/"}let l=function(e,t="/"){let{pathname:n,search:r="",hash:o=""}="string"==typeof e?T5(e):e,i=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:i,search:G5(r),hash:K5(o)}}(o,i),c=s&&"/"!==s&&s.endsWith("/"),u=(a||"."===s)&&n.endsWith("/");return l.pathname.endsWith("/")||!c&&!u||(l.pathname+="/"),l}var H5=e=>e.join("/").replace(/\/\/+/g,"/"),q5=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),G5=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",K5=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";var W5=["POST","PUT","PATCH","DELETE"];new Set(W5);var Y5=["GET",...W5];new Set(Y5);var X5=i.createContext(null);X5.displayName="DataRouter";var Z5=i.createContext(null);Z5.displayName="DataRouterState";var Q5=i.createContext({isTransitioning:!1});Q5.displayName="ViewTransition",i.createContext(new Map).displayName="Fetchers",i.createContext(null).displayName="Await";var J5=i.createContext(null);J5.displayName="Navigation";var e4=i.createContext(null);e4.displayName="Location";var t4=i.createContext({outlet:null,matches:[],isDataRoute:!1});t4.displayName="Route";var n4=i.createContext(null);function r4(){return null!=i.useContext(e4)}function o4(){return w5(r4(),"useLocation() may be used only in the context of a <Router> component."),i.useContext(e4).location}n4.displayName="RouteError";var i4="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function a4(e){i.useContext(J5).static||i.useLayoutEffect(e)}function s4(){let{isDataRoute:e}=i.useContext(t4);return e?function(){let{router:e}=function(e){let t=i.useContext(X5);return w5(t,h4(e)),t}("useNavigate"),t=m4("useNavigate"),n=i.useRef(!1);return a4((()=>{n.current=!0})),i.useCallback((async(r,o={})=>{_5(n.current,i4),n.current&&("number"==typeof r?e.navigate(r):await e.navigate(r,{fromRouteId:t,...o}))}),[e,t])}():function(){w5(r4(),"useNavigate() may be used only in the context of a <Router> component.");let e=i.useContext(X5),{basename:t,navigator:n}=i.useContext(J5),{matches:r}=i.useContext(t4),{pathname:o}=o4(),a=JSON.stringify(B5(r)),s=i.useRef(!1);return a4((()=>{s.current=!0})),i.useCallback(((r,i={})=>{if(_5(s.current,i4),!s.current)return;if("number"==typeof r)return void n.go(r);let l=z5(r,JSON.parse(a),o,"path"===i.relative);null==e&&"/"!==t&&(l.pathname="/"===l.pathname?t:H5([t,l.pathname])),(i.replace?n.replace:n.push)(l,i.state,i)}),[t,n,a,o,e])}()}function l4(e,{relative:t}={}){let{matches:n}=i.useContext(t4),{pathname:r}=o4(),o=JSON.stringify(B5(n));return i.useMemo((()=>z5(e,JSON.parse(o),r,"path"===t)),[e,o,r,t])}function c4(e,t,n,r){w5(r4(),"useRoutes() may be used only in the context of a <Router> component.");let o,{navigator:a,static:s}=i.useContext(J5),{matches:l}=i.useContext(t4),c=l[l.length-1],u=c?c.params:{},d=c?c.pathname:"/",p=c?c.pathnameBase:"/",f=c&&c.route;{let e=f&&f.path||"";v4(d,!f||e.endsWith("*")||e.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.\n\nPlease change the parent <Route path="${e}"> to <Route path="${"/"===e?"*":`${e}/*`}">.`)}o=o4();let h=o.pathname||"/",m=h;if("/"!==p){let e=p.replace(/^\//,"").split("/");m="/"+h.replace(/^\//,"").split("/").slice(e.length).join("/")}let g=!s&&n&&n.matches&&n.matches.length>0?n.matches:C5(e,{pathname:m});_5(f||null!=g,`No routes matched location "${o.pathname}${o.search}${o.hash}" `),_5(null==g||void 0!==g[g.length-1].route.element||void 0!==g[g.length-1].route.Component||void 0!==g[g.length-1].route.lazy,`Matched leaf route at location "${o.pathname}${o.search}${o.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=function(e,t=[],n=null){if(null==e){if(!n)return null;if(n.errors)e=n.matches;else{if(0!==t.length||n.initialized||!(n.matches.length>0))return null;e=n.matches}}let r=e,o=n?.errors;if(null!=o){let e=r.findIndex((e=>e.route.id&&void 0!==o?.[e.route.id]));w5(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),r=r.slice(0,Math.min(r.length,e+1))}let a=!1,s=-1;if(n)for(let i=0;i<r.length;i++){let e=r[i];if((e.route.HydrateFallback||e.route.hydrateFallbackElement)&&(s=i),e.route.id){let{loaderData:t,errors:o}=n,i=e.route.loader&&!t.hasOwnProperty(e.route.id)&&(!o||void 0===o[e.route.id]);if(e.route.lazy||i){a=!0,r=s>=0?r.slice(0,s+1):[r[0]];break}}}return r.reduceRight(((e,l,c)=>{let u,d=!1,p=null,f=null;n&&(u=o&&l.route.id?o[l.route.id]:void 0,p=l.route.errorElement||d4,a&&(s<0&&0===c?(v4("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,f=null):s===c&&(d=!0,f=l.route.hydrateFallbackElement||null)));let h=t.concat(r.slice(0,c+1)),m=()=>{let t;return t=u?p:d?f:l.route.Component?i.createElement(l.route.Component,null):l.route.element?l.route.element:e,i.createElement(f4,{match:l,routeContext:{outlet:e,matches:h,isDataRoute:null!=n},children:t})};return n&&(l.route.ErrorBoundary||l.route.errorElement||0===c)?i.createElement(p4,{location:n.location,revalidation:n.revalidation,component:p,error:u,children:m(),routeContext:{outlet:null,matches:h,isDataRoute:!0}}):m()}),null)}(g&&g.map((e=>Object.assign({},e,{params:Object.assign({},u,e.params),pathname:H5([p,a.encodeLocation?a.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?p:H5([p,a.encodeLocation?a.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),l,n,r);return v}function u4(){let e=function(){let e=i.useContext(n4),t=function(e){let t=i.useContext(Z5);return w5(t,h4(e)),t}("useRouteError"),n=m4("useRouteError");if(void 0!==e)return e;return t.errors?.[n]}(),t=function(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={padding:"2px 4px",backgroundColor:r},s=null;return s=i.createElement(i.Fragment,null,i.createElement("p",null,"💿 Hey developer 👋"),i.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",i.createElement("code",{style:a},"ErrorBoundary")," or"," ",i.createElement("code",{style:a},"errorElement")," prop on your route.")),i.createElement(i.Fragment,null,i.createElement("h2",null,"Unexpected Application Error!"),i.createElement("h3",{style:{fontStyle:"italic"}},t),n?i.createElement("pre",{style:o},n):null,s)}i.createContext(null);var d4=i.createElement(u4,null),p4=class extends i.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){}render(){return void 0!==this.state.error?i.createElement(t4.Provider,{value:this.props.routeContext},i.createElement(n4.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function f4({routeContext:e,match:t,children:n}){let r=i.useContext(X5);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),i.createElement(t4.Provider,{value:e},n)}function h4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function m4(e){let t=function(e){let t=i.useContext(t4);return w5(t,h4(e)),t}(e),n=t.matches[t.matches.length-1];return w5(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}var g4={};function v4(e,t,n){t||g4[e]||(g4[e]=!0,_5(!1,n))}function y4({basename:e,children:t,initialEntries:n,initialIndex:r}){let o=i.useRef();null==o.current&&(o.current=x5({initialEntries:n,initialIndex:r,v5Compat:!0}));let a=o.current,[s,l]=i.useState({action:a.action,location:a.location}),c=i.useCallback((e=>{i.startTransition((()=>l(e)))}),[l]);return i.useLayoutEffect((()=>a.listen(c)),[a,c]),i.createElement(b4,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}function b4({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1}){w5(!r4(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),l=i.useMemo((()=>({basename:s,navigator:o,static:a,future:{}})),[s,o,a]);"string"==typeof n&&(n=T5(n));let{pathname:c="/",search:u="",hash:d="",state:p=null,key:f="default"}=n,h=i.useMemo((()=>{let e=$5(c,s);return null==e?null:{location:{pathname:e,search:u,hash:d,state:p,key:f},navigationType:r}}),[s,c,u,d,p,f,r]);return _5(null!=h,`<Router basename="${s}"> is not able to match the URL "${c}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),null==h?null:i.createElement(J5.Provider,{value:l},i.createElement(e4.Provider,{children:t,value:h}))}i.memo((function({routes:e,future:t,state:n}){return c4(e,0,n,t)}));var x4="get",w4="application/x-www-form-urlencoded";function _4(e){return null!=e&&"string"==typeof e.tagName}function S4(e=""){return new URLSearchParams("string"==typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce(((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map((e=>[n,e])):[[n,r]])}),[]))}var E4=null;var T4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function C4(e){return null==e||T4.has(e)?e:(_5(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${w4}"`),null)}function A4(e,t){let n,r,o,i,a;if(function(e){return _4(e)&&"form"===e.tagName.toLowerCase()}(e)){let a=e.getAttribute("action");r=a?$5(a,t):null,n=e.getAttribute("method")||x4,o=C4(e.getAttribute("enctype"))||w4,i=new FormData(e)}else if(function(e){return _4(e)&&"button"===e.tagName.toLowerCase()}(e)||function(e){return _4(e)&&"input"===e.tagName.toLowerCase()}(e)&&("submit"===e.type||"image"===e.type)){let a=e.form;if(null==a)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||a.getAttribute("action");if(r=s?$5(s,t):null,n=e.getAttribute("formmethod")||a.getAttribute("method")||x4,o=C4(e.getAttribute("formenctype"))||C4(a.getAttribute("enctype"))||w4,i=new FormData(a,e),!function(){if(null===E4)try{new FormData(document.createElement("form"),0),E4=!1}catch(ITe){E4=!0}return E4}()){let{name:t,type:n,value:r}=e;if("image"===n){let e=t?`${t}.`:"";i.append(`${e}x`,"0"),i.append(`${e}y`,"0")}else t&&i.append(t,r)}}else{if(_4(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=x4,r=null,o=w4,a=e}return i&&"text/plain"===o&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:a}}function N4(e,t){if(!1===e||null==e)throw new Error(t)}function R4(e){return null!=e&&(null==e.href?"preload"===e.rel&&"string"==typeof e.imageSrcSet&&"string"==typeof e.imageSizes:"string"==typeof e.rel&&"string"==typeof e.href)}async function O4(e,t,n){return function(e,t){let n=new Set;return new Set(t),e.reduce(((e,t)=>{let r=JSON.stringify(function(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}(t));return n.has(r)||(n.add(r),e.push({key:r,link:t})),e}),[])}((await Promise.all(e.map((async e=>{let r=t.routes[e.route.id];if(r){let e=await async function(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return window.__reactRouterContext&&window,window.location.reload(),new Promise((()=>{}))}}(r,n);return e.links?e.links():[]}return[]})))).flat(1).filter(R4).filter((e=>"stylesheet"===e.rel||"preload"===e.rel)).map((e=>"stylesheet"===e.rel?{...e,rel:"prefetch",as:"style"}:{...e,rel:"prefetch"})))}function P4(e,t,n,r,o,i){let a=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith("*")&&n[t].params["*"]!==e.params["*"];return"assets"===i?t.filter(((e,t)=>a(e,t)||s(e,t))):"data"===i?t.filter(((t,i)=>{let l=r.routes[t.route.id];if(!l||!l.hasLoader)return!1;if(a(t,i)||s(t,i))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if("boolean"==typeof r)return r}return!0})):[]}function k4(e,t,{includeHydrateFallback:n}={}){return r=e.map((e=>{let r=t.routes[e.route.id];if(!r)return[];let o=[r.module];return r.clientActionModule&&(o=o.concat(r.clientActionModule)),r.clientLoaderModule&&(o=o.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(o=o.concat(r.hydrateFallbackModule)),r.imports&&(o=o.concat(r.imports)),o})).flat(1),[...new Set(r)];var r}function j4(){let e=i.useContext(X5);return N4(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}var M4=i.createContext(void 0);function L4(){let e=i.useContext(M4);return N4(e,"You must render this element inside a <HydratedRouter> element"),e}function D4(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function I4({page:e,...t}){let{router:n}=j4(),r=i.useMemo((()=>C5(n.routes,e,n.basename)),[n.routes,e,n.basename]);return r?i.createElement(F4,{page:e,matches:r,...t}):null}function F4({page:e,matches:t,...n}){let r=o4(),{manifest:o,routeModules:a}=L4(),{basename:s}=j4(),{loaderData:l,matches:c}=function(){let e=i.useContext(Z5);return N4(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}(),u=i.useMemo((()=>P4(e,t,c,o,r,"data")),[e,t,c,o,r]),d=i.useMemo((()=>P4(e,t,c,o,r,"assets")),[e,t,c,o,r]),p=i.useMemo((()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,i=!1;if(t.forEach((e=>{let t=o.routes[e.route.id];t&&t.hasLoader&&(!u.some((t=>t.route.id===e.route.id))&&e.route.id in l&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?i=!0:n.add(e.route.id))})),0===n.size)return[];let c=function(e,t){let n="string"==typeof e?new URL(e,"undefined"==typeof window?"server://singlefetch/":window.location.origin):e;return n.pathname="/"===n.pathname?"_root.data":t&&"/"===$5(n.pathname,t)?`${t.replace(/\/$/,"")}/_root.data`:`${n.pathname.replace(/\/$/,"")}.data`,n}(e,s);return i&&n.size>0&&c.searchParams.set("_routes",t.filter((e=>n.has(e.route.id))).map((e=>e.route.id)).join(",")),[c.pathname+c.search]}),[s,l,r,o,u,t,e,a]),f=i.useMemo((()=>k4(d,o)),[d,o]),h=function(e){let{manifest:t,routeModules:n}=L4(),[r,o]=i.useState([]);return i.useEffect((()=>{let r=!1;return O4(e,t,n).then((e=>{r||o(e)})),()=>{r=!0}}),[e,t,n]),r}(d);return i.createElement(i.Fragment,null,p.map((e=>i.createElement("link",{key:e,rel:"prefetch",as:"fetch",href:e,...n}))),f.map((e=>i.createElement("link",{key:e,rel:"modulepreload",href:e,...n}))),h.map((({key:e,link:t})=>i.createElement("link",{key:e,...t}))))}function U4(...e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}M4.displayName="FrameworkContext";var $4="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;try{$4&&(window.__reactRouterVersion="7.5.2")}catch(ITe){}var V4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,B4=i.forwardRef((function({onClick:e,discover:t="render",prefetch:n="none",relative:r,reloadDocument:o,replace:a,state:s,target:l,to:c,preventScrollReset:u,viewTransition:d,...p},f){let h,{basename:m}=i.useContext(J5),g="string"==typeof c&&V4.test(c),v=!1;if("string"==typeof c&&g&&(h=c,$4))try{let e=new URL(window.location.href),t=c.startsWith("//")?new URL(e.protocol+c):new URL(c),n=$5(t.pathname,m);t.origin===e.origin&&null!=n?c=n+t.search+t.hash:v=!0}catch(ITe){_5(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let y=function(e,{relative:t}={}){w5(r4(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=i.useContext(J5),{hash:o,pathname:a,search:s}=l4(e,{relative:t}),l=a;return"/"!==n&&(l="/"===a?n:H5([n,a])),r.createHref({pathname:l,search:s,hash:o})}(c,{relative:r}),[b,x,w]=function(e,t){let n=i.useContext(M4),[r,o]=i.useState(!1),[a,s]=i.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,f=i.useRef(null);i.useEffect((()=>{if("render"===e&&s(!0),"viewport"===e){let e=new IntersectionObserver((e=>{e.forEach((e=>{s(e.isIntersecting)}))}),{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}}),[e]),i.useEffect((()=>{if(r){let e=setTimeout((()=>{s(!0)}),100);return()=>{clearTimeout(e)}}}),[r]);let h=()=>{o(!0)},m=()=>{o(!1),s(!1)};return n?"intent"!==e?[a,f,{}]:[a,f,{onFocus:D4(l,h),onBlur:D4(c,m),onMouseEnter:D4(u,h),onMouseLeave:D4(d,m),onTouchStart:D4(p,h)}]:[!1,f,{}]}(n,p),_=function(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:a,viewTransition:s}={}){let l=s4(),c=o4(),u=l4(e,{relative:a});return i.useCallback((i=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(i,t)){i.preventDefault();let t=void 0!==n?n:E5(c)===E5(u);l(e,{replace:t,state:r,preventScrollReset:o,relative:a,viewTransition:s})}}),[c,l,u,n,r,t,e,o,a,s])}(c,{replace:a,state:s,target:l,preventScrollReset:u,relative:r,viewTransition:d});let S=i.createElement("a",{...p,...w,href:h||y,onClick:v||o?e:function(t){e&&e(t),t.defaultPrevented||_(t)},ref:U4(f,x),target:l,"data-discover":g||"render"!==t?void 0:"true"});return b&&!g?i.createElement(i.Fragment,null,S,i.createElement(I4,{page:y})):S}));function z4(e){let t=i.useContext(X5);return w5(t,function(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}(e)),t}function H4(e){_5("undefined"!=typeof URLSearchParams,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=i.useRef(S4(e)),n=i.useRef(!1),r=o4(),o=i.useMemo((()=>function(e,t){let n=S4(e);return t&&t.forEach(((e,r)=>{n.has(r)||t.getAll(r).forEach((e=>{n.append(r,e)}))})),n}(r.search,n.current?null:t.current)),[r.search]),a=s4(),s=i.useCallback(((e,t)=>{const r=S4("function"==typeof e?e(o):e);n.current=!0,a("?"+r,t)}),[a,o]);return[o,s]}B4.displayName="Link",i.forwardRef((function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:r=!1,style:o,to:a,viewTransition:s,children:l,...c},u){let d=l4(a,{relative:c.relative}),p=o4(),f=i.useContext(Z5),{navigator:h,basename:m}=i.useContext(J5),g=null!=f&&function(e,t={}){let n=i.useContext(Q5);w5(null!=n,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=z4("useViewTransitionState"),o=l4(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=$5(n.currentLocation.pathname,r)||n.currentLocation.pathname,s=$5(n.nextLocation.pathname,r)||n.nextLocation.pathname;return null!=F5(o.pathname,s)||null!=F5(o.pathname,a)}(d)&&!0===s,v=h.encodeLocation?h.encodeLocation(d).pathname:d.pathname,y=p.pathname,b=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(y=y.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&m&&(b=$5(b,m)||b);const x="/"!==v&&v.endsWith("/")?v.length-1:v.length;let w,_=y===v||!r&&y.startsWith(v)&&"/"===y.charAt(x),S=null!=b&&(b===v||!r&&b.startsWith(v)&&"/"===b.charAt(v.length)),E={isActive:_,isPending:S,isTransitioning:g},T=_?e:void 0;w="function"==typeof n?n(E):[n,_?"active":null,S?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let C="function"==typeof o?o(E):o;return i.createElement(B4,{...c,"aria-current":T,className:w,ref:u,style:C,to:a,viewTransition:s},"function"==typeof l?l(E):l)})).displayName="NavLink",i.forwardRef((({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:s=x4,action:l,onSubmit:c,relative:u,preventScrollReset:d,viewTransition:p,...f},h)=>{let m=function(){let{router:e}=z4("useSubmit"),{basename:t}=i.useContext(J5),n=m4("useRouteId");return i.useCallback((async(r,o={})=>{let{action:i,method:a,encType:s,formData:l,body:c}=A4(r,t);if(!1===o.navigate){let t=o.fetcherKey||G4();await e.fetch(t,n,o.action||i,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||a,formEncType:o.encType||s,flushSync:o.flushSync})}else await e.navigate(o.action||i,{preventScrollReset:o.preventScrollReset,formData:l,body:c,formMethod:o.method||a,formEncType:o.encType||s,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})}),[e,t,n])}(),g=function(e,{relative:t}={}){let{basename:n}=i.useContext(J5),r=i.useContext(t4);w5(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...l4(e||".",{relative:t})},s=o4();if(null==e){a.search=s.search;let e=new URLSearchParams(a.search),t=e.getAll("index");if(t.some((e=>""===e))){e.delete("index"),t.filter((e=>e)).forEach((t=>e.append("index",t)));let n=e.toString();a.search=n?`?${n}`:""}}e&&"."!==e||!o.route.index||(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index");"/"!==n&&(a.pathname="/"===a.pathname?n:H5([n,a.pathname]));return E5(a)}(l,{relative:u}),v="get"===s.toLowerCase()?"get":"post",y="string"==typeof l&&V4.test(l);return i.createElement("form",{ref:h,method:v,action:g,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,i=r?.getAttribute("formmethod")||s;m(r||e.currentTarget,{fetcherKey:t,method:i,navigate:n,replace:o,state:a,relative:u,preventScrollReset:d,viewTransition:p})},...f,"data-discover":y||"render"!==e?void 0:"true"})})).displayName="Form";var q4=0,G4=()=>`__${String(++q4)}__`;new TextEncoder;var K4,W4="dismissableLayer.update",Y4="dismissableLayer.pointerDownOutside",X4="dismissableLayer.focusOutside",Z4=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Q4=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(Z4),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=NZ(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=oJ(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){e6(Y4,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=oJ(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){e6(X4,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 gJ((e=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(K4=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),J4(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=K4)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),J4())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(W4,e),()=>document.removeEventListener(W4,e)}),[]),t.jsx(dJ.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:tJ(e.onFocusCapture,E.onFocusCapture),onBlurCapture:tJ(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:tJ(e.onPointerDownCapture,S.onPointerDownCapture)})}));Q4.displayName="DismissableLayer";function J4(){const e=new CustomEvent(W4);document.dispatchEvent(e)}function e6(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?pJ(o,i):o.dispatchEvent(i)}i.forwardRef(((e,n)=>{const r=i.useContext(Z4),o=i.useRef(null),a=NZ(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(dJ.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var t6=i.forwardRef(((e,n)=>t.jsx(dJ.span,{...e,ref:n,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}})));t6.displayName="VisuallyHidden";var n6=t6,[r6,o6]=nJ("Tooltip",[x1]),i6=x1(),a6="TooltipProvider",s6=700,l6="tooltip.open",[c6,u6]=r6(a6),d6=e=>{const{__scopeTooltip:n,delayDuration:r=s6,skipDelayDuration:o=300,disableHoverableContent:a=!1,children:s}=e,[l,c]=i.useState(!0),u=i.useRef(!1),d=i.useRef(0);return i.useEffect((()=>{const e=d.current;return()=>window.clearTimeout(e)}),[]),t.jsx(c6,{scope:n,isOpenDelayed:l,delayDuration:r,onOpen:i.useCallback((()=>{window.clearTimeout(d.current),c(!1)}),[]),onClose:i.useCallback((()=>{window.clearTimeout(d.current),d.current=window.setTimeout((()=>c(!0)),o)}),[o]),isPointerInTransitRef:u,onPointerInTransitChange:i.useCallback((e=>{u.current=e}),[]),disableHoverableContent:a,children:s})};d6.displayName=a6;var p6="Tooltip",[f6,h6]=r6(p6),m6=e=>{const{__scopeTooltip:n,children:r,open:o,defaultOpen:a=!1,onOpenChange:s,disableHoverableContent:l,delayDuration:c}=e,u=u6(p6,e.__scopeTooltip),d=i6(n),[p,f]=i.useState(null),h=$J(),m=i.useRef(0),g=l??u.disableHoverableContent,v=c??u.delayDuration,y=i.useRef(!1),[b=!1,x]=iJ({prop:o,defaultProp:a,onChange:e=>{e?(u.onOpen(),document.dispatchEvent(new CustomEvent(l6))):u.onClose(),s?.(e)}}),w=i.useMemo((()=>b?y.current?"delayed-open":"instant-open":"closed"),[b]),_=i.useCallback((()=>{window.clearTimeout(m.current),m.current=0,y.current=!1,x(!0)}),[x]),S=i.useCallback((()=>{window.clearTimeout(m.current),m.current=0,x(!1)}),[x]),E=i.useCallback((()=>{window.clearTimeout(m.current),m.current=window.setTimeout((()=>{y.current=!0,x(!0),m.current=0}),v)}),[v,x]);return i.useEffect((()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)}),[]),t.jsx(D1,{...d,children:t.jsx(f6,{scope:n,contentId:h,open:b,stateAttribute:w,trigger:p,onTriggerChange:f,onTriggerEnter:i.useCallback((()=>{u.isOpenDelayed?E():_()}),[u.isOpenDelayed,E,_]),onTriggerLeave:i.useCallback((()=>{g?S():(window.clearTimeout(m.current),m.current=0)}),[S,g]),onOpen:_,onClose:S,disableHoverableContent:g,children:r})})};m6.displayName=p6;var g6="TooltipTrigger",v6=i.forwardRef(((e,n)=>{const{__scopeTooltip:r,...o}=e,a=h6(g6,r),s=u6(g6,r),l=i6(r),c=NZ(n,i.useRef(null),a.onTriggerChange),u=i.useRef(!1),d=i.useRef(!1),p=i.useCallback((()=>u.current=!1),[]);return i.useEffect((()=>()=>document.removeEventListener("pointerup",p)),[p]),t.jsx(I1,{asChild:!0,...l,children:t.jsx(dJ.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...o,ref:c,onPointerMove:tJ(e.onPointerMove,(e=>{"touch"!==e.pointerType&&(d.current||s.isPointerInTransitRef.current||(a.onTriggerEnter(),d.current=!0))})),onPointerLeave:tJ(e.onPointerLeave,(()=>{a.onTriggerLeave(),d.current=!1})),onPointerDown:tJ(e.onPointerDown,(()=>{u.current=!0,document.addEventListener("pointerup",p,{once:!0})})),onFocus:tJ(e.onFocus,(()=>{u.current||a.onOpen()})),onBlur:tJ(e.onBlur,a.onClose),onClick:tJ(e.onClick,a.onClose)})})}));v6.displayName=g6;var y6="TooltipPortal",[b6,x6]=r6(y6,{forceMount:void 0}),w6=e=>{const{__scopeTooltip:n,forceMount:r,children:o,container:i}=e,a=h6(y6,n);return t.jsx(b6,{scope:n,forceMount:r,children:t.jsx(V1,{present:r||a.open,children:t.jsx($1,{asChild:!0,container:i,children:o})})})};w6.displayName=y6;var _6="TooltipContent",S6=i.forwardRef(((e,n)=>{const r=x6(_6,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...a}=e,s=h6(_6,e.__scopeTooltip);return t.jsx(V1,{present:o||s.open,children:t.jsx(s.disableHoverableContent?A6:E6,{side:i,...a,ref:n})})})),E6=i.forwardRef(((e,n)=>{const r=h6(_6,e.__scopeTooltip),o=u6(_6,e.__scopeTooltip),a=i.useRef(null),s=NZ(n,a),[l,c]=i.useState(null),{trigger:u,onClose:d}=r,p=a.current,{onPointerInTransitChange:f}=o,h=i.useCallback((()=>{c(null),f(!1)}),[f]),m=i.useCallback(((e,t)=>{const n={x:e.clientX,y:e.clientY},r=function(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(n,function(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}(n,e.currentTarget.getBoundingClientRect())),o=function(e){const t=e.slice();return t.sort(((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0)),function(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const n=e[r];for(;t.length>=2;){const e=t[t.length-1],r=t[t.length-2];if(!((e.x-r.x)*(n.y-r.y)>=(e.y-r.y)*(n.x-r.x)))break;t.pop()}t.push(n)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const t=e[r];for(;n.length>=2;){const e=n[n.length-1],r=n[n.length-2];if(!((e.x-r.x)*(t.y-r.y)>=(e.y-r.y)*(t.x-r.x)))break;n.pop()}n.push(t)}return n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}(t)}([...r,...function(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}(t.getBoundingClientRect())]);c(o),f(!0)}),[f]);return i.useEffect((()=>()=>h()),[h]),i.useEffect((()=>{if(u&&p){const e=e=>m(e,p),t=e=>m(e,u);return u.addEventListener("pointerleave",e),p.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),p.removeEventListener("pointerleave",t)}}}),[u,p,m,h]),i.useEffect((()=>{if(l){const e=e=>{const t=e.target,n={x:e.clientX,y:e.clientY},r=u?.contains(t)||p?.contains(t),o=!function(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const e=t[i].x,s=t[i].y,l=t[a].y;s>r!=l>r&&n<(t[a].x-e)*(r-s)/(l-s)+e&&(o=!o)}return o}(n,l);r?h():o&&(h(),d())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}}),[u,p,l,d,h]),t.jsx(A6,{...e,ref:s})})),[T6,C6]=r6(p6,{isInside:!1}),A6=i.forwardRef(((e,n)=>{const{__scopeTooltip:r,children:o,"aria-label":a,onEscapeKeyDown:s,onPointerDownOutside:l,...c}=e,u=h6(_6,r),d=i6(r),{onClose:p}=u;return i.useEffect((()=>(document.addEventListener(l6,p),()=>document.removeEventListener(l6,p))),[p]),i.useEffect((()=>{if(u.trigger){const e=e=>{const t=e.target;t?.contains(u.trigger)&&p()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}}),[u.trigger,p]),t.jsx(Q4,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:p,children:t.jsxs(F1,{"data-state":u.stateAttribute,...d,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[t.jsx(lJ,{children:o}),t.jsx(T6,{scope:r,isInside:!0,children:t.jsx(n6,{id:u.contentId,role:"tooltip",children:a||o})})]})})}));S6.displayName=_6;var N6="TooltipArrow";i.forwardRef(((e,n)=>{const{__scopeTooltip:r,...o}=e,i=i6(r);return C6(N6,r).isInside?null:t.jsx(U1,{...i,...o,ref:n})})).displayName=N6;var R6=w6,O6=S6;const P6=d6,k6=m6,j6=v6,M6=i.forwardRef((({className:e,sideOffset:n=4,...r},o)=>t.jsx(R6,{children:t.jsx(O6,{ref:o,sideOffset:n,className:rp("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",e),...r})})));M6.displayName=O6.displayName;const L6=({rowOriginal:e,constructNavigationUrl:n,cellText:r,cellIcon:o=null,tooltipIcon:i=null,tooltipText:a=null})=>{const s=s4();return a?t.jsx(P6,{children:t.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:t.jsxs(k6,{children:[t.jsx(j6,{asChild:!0,children:t.jsxs(MZ,{variant:"outline",onClick:()=>s(n(e.id)),children:[o,r,i]})}),t.jsx(M6,{className:"max-w-[300px] text-sm bg-white border border-gray-200 rounded-lg p-4",children:t.jsx("p",{className:"text-muted-foreground",children:a})})]})})}):t.jsx("div",{className:"text-sm h-8 flex items-center justify-end",children:t.jsxs(MZ,{variant:"outline",onClick:()=>s(n(e.id)),children:[o,r,i]})})};function D6(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function I6(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function F6(...e){return t=>{let n=!1;const r=e.map((e=>{const r=I6(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():I6(e[t],null)}}}}function U6(...e){return i.useCallback(F6(...e),e)}function $6(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}\``)}]},V6(o,...n)]}function V6(...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 B6(e){const n=z6(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(q6);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 z6(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)=>{const t=i(...e);return o(...e),t}: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?F6(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 H6=Symbol("radix.slottable");function q6(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===H6}var G6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=B6(`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 K6(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}var W6,Y6="dismissableLayer.update",X6="dismissableLayer.pointerDownOutside",Z6="dismissableLayer.focusOutside",Q6=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),J6=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(Q6),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=U6(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=K6(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){t8(X6,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=K6(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){t8(Z6,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=K6(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=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(W6=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),e8(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=W6)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),e8())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(Y6,e),()=>document.removeEventListener(Y6,e)}),[]),t.jsx(G6.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:D6(e.onFocusCapture,E.onFocusCapture),onBlurCapture:D6(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:D6(e.onPointerDownCapture,S.onPointerDownCapture)})}));J6.displayName="DismissableLayer";function e8(){const e=new CustomEvent(Y6);document.dispatchEvent(e)}function t8(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(Q6),o=i.useRef(null),a=U6(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(G6.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var n8=0;function r8(){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 o8="focusScope.autoFocusOnMount",i8="focusScope.autoFocusOnUnmount",a8={bubbles:!1,cancelable:!0},s8=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=K6(a),p=K6(s),f=i.useRef(null),h=U6(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:d8(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||d8(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&d8(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){p8.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(o8,a8);c.addEventListener(o8,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(d8(r,{select:t}),document.activeElement!==n)return}((e=l8(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&d8(c))}return()=>{c.removeEventListener(o8,d),setTimeout((()=>{const e=new CustomEvent(i8,a8);c.addEventListener(i8,p),c.dispatchEvent(e),e.defaultPrevented||d8(t??document.body,{select:!0}),c.removeEventListener(i8,p),p8.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=l8(e),n=c8(t,e),r=c8(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&d8(i,{select:!0})):(e.preventDefault(),r&&d8(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(G6.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function l8(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 c8(e,t){for(const n of e)if(!u8(n,{upTo:t}))return n}function u8(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 d8(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()}}s8.displayName="FocusScope";var p8=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=f8(e,t),e.unshift(t)},remove(t){e=f8(e,t),e[0]?.resume()}}}();function f8(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var h8=globalThis?.document?i.useLayoutEffect:()=>{},m8=i[" useId ".trim().toString()]||(()=>{}),g8=0;function v8(e){const[t,n]=i.useState(m8());return h8((()=>{n((e=>e??String(g8++)))}),[e]),e||(t?`radix-${t}`:"")}var y8=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(G6.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"})})}));y8.displayName="Arrow";var b8=y8;var x8="Popper",[w8,_8]=$6(x8),[S8,E8]=w8(x8),T8=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(S8,{scope:n,anchor:o,onAnchorChange:a,children:r})};T8.displayName=x8;var C8="PopperAnchor",A8=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=E8(C8,r),l=i.useRef(null),c=U6(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(G6.div,{...a,ref:c})}));A8.displayName=C8;var N8="PopperContent",[R8,O8]=w8(N8),P8=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=E8(N8,r),[b,x]=i.useState(null),w=U6(n,(e=>x(e))),[_,S]=i.useState(null),E=function(e){const[t,n]=i.useState(void 0);return h8((()=>{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:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},R=Array.isArray(d)?d:[d],O=R.length>0,P={padding:N,boundary:R.filter(L8),altBoundary:O},{refs:k,floatingStyles:j,placement:M,isPositioned:L,middlewareData:D}=a1({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>G0(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[l1({mainAxis:a+C,alignmentAxis:l}),u&&c1({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?u1():void 0,...P}),u&&d1({...P}),p1({...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`)}}),_&&h1({element:_,padding:c}),D8({arrowWidth:T,arrowHeight:C}),h&&f1({strategy:"referenceHidden",...P})]}),[I,F]=I8(M),U=K6(g);h8((()=>{L&&U?.()}),[L,U]);const $=D.arrow?.x,V=D.arrow?.y,B=0!==D.arrow?.centerOffset,[z,H]=i.useState();return h8((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:L?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(R8,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(G6.div,{"data-side":I,"data-align":F,...v,ref:w,style:{...v.style,animation:L?void 0:"none"}})})})}));P8.displayName=N8;var k8="PopperArrow",j8={top:"bottom",right:"left",bottom:"top",left:"right"},M8=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=O8(k8,r),a=j8[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(b8,{...o,ref:n,style:{...o.style,display:"block"}})})}));function L8(e){return null!==e}M8.displayName=k8;var D8=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]=I8(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 I8(e){const[t,n="center"]=e.split("-");return[t,n]}var F8=T8,U8=A8,$8=P8,V8=M8,B8=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);h8((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(G6.div,{...a,ref:n}),c):null}));B8.displayName="Portal";var z8=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=H8(r.current);a.current="mounted"===l?e:"none"}),[l]),h8((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=H8(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]),h8((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=H8(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=H8(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=U6(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 H8(e){return e?.animationName||"none"}z8.displayName="Presence";var q8=i[" useInsertionEffect ".trim().toString()]||h8;function G8({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 q8((()=>{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 K8="Popover",[W8,Y8]=$6(K8,[_8]),X8=_8(),[Z8,Q8]=W8(K8),J8=e=>{const{__scopePopover:n,children:r,open:o,defaultOpen:a,onOpenChange:s,modal:l=!1}=e,c=X8(n),u=i.useRef(null),[d,p]=i.useState(!1),[f,h]=G8({prop:o,defaultProp:a??!1,onChange:s,caller:K8});return t.jsx(F8,{...c,children:t.jsx(Z8,{scope:n,contentId:v8(),triggerRef:u,open:f,onOpenChange:h,onOpenToggle:i.useCallback((()=>h((e=>!e))),[h]),hasCustomAnchor:d,onCustomAnchorAdd:i.useCallback((()=>p(!0)),[]),onCustomAnchorRemove:i.useCallback((()=>p(!1)),[]),modal:l,children:r})})};J8.displayName=K8;var e9="PopoverAnchor";i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,a=Q8(e9,r),s=X8(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:c}=a;return i.useEffect((()=>(l(),()=>c())),[l,c]),t.jsx(U8,{...s,...o,ref:n})})).displayName=e9;var t9="PopoverTrigger",n9=i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=Q8(t9,r),a=X8(r),s=U6(n,i.triggerRef),l=t.jsx(G6.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":h9(i.open),...o,ref:s,onClick:D6(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?l:t.jsx(U8,{asChild:!0,...a,children:l})}));n9.displayName=t9;var r9="PopoverPortal",[o9,i9]=W8(r9,{forceMount:void 0}),a9=e=>{const{__scopePopover:n,forceMount:r,children:o,container:i}=e,a=Q8(r9,n);return t.jsx(o9,{scope:n,forceMount:r,children:t.jsx(z8,{present:r||a.open,children:t.jsx(B8,{asChild:!0,container:i,children:o})})})};a9.displayName=r9;var s9="PopoverContent",l9=i.forwardRef(((e,n)=>{const r=i9(s9,e.__scopePopover),{forceMount:o=r.forceMount,...i}=e,a=Q8(s9,e.__scopePopover);return t.jsx(z8,{present:o||a.open,children:t.jsx(a.modal?u9:d9,{...i,ref:n})})}));l9.displayName=s9;var c9=B6("PopoverContent.RemoveScroll"),u9=i.forwardRef(((e,n)=>{const r=Q8(s9,e.__scopePopover),o=i.useRef(null),a=U6(n,o),s=i.useRef(!1);return i.useEffect((()=>{const e=o.current;if(e)return HV(e)}),[]),t.jsx(IV,{as:c9,allowPinchZoom:!0,children:t.jsx(p9,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:D6(e.onCloseAutoFocus,(e=>{e.preventDefault(),s.current||r.triggerRef.current?.focus()})),onPointerDownOutside:D6(e.onPointerDownOutside,(e=>{const t=e.detail.originalEvent;s.current=2===t.button||0===t.button&&!0===t.ctrlKey}),{checkForDefaultPrevented:!1}),onFocusOutside:D6(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})})})})),d9=i.forwardRef(((e,n)=>{const r=Q8(s9,e.__scopePopover),o=i.useRef(!1),a=i.useRef(!1);return t.jsx(p9,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||r.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));const n=t.target,i=r.triggerRef.current?.contains(n);i&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})})),p9=i.forwardRef(((e,n)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:p,...f}=e,h=Q8(s9,r),m=X8(r);return i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??r8()),document.body.insertAdjacentElement("beforeend",e[1]??r8()),n8++,()=>{1===n8&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),n8--}}),[]),t.jsx(s8,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:s,children:t.jsx(J6,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:p,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>h.onOpenChange(!1),children:t.jsx($8,{"data-state":h9(h.open),role:"dialog",id:h.contentId,...m,...f,ref:n,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})})),f9="PopoverClose";i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=Q8(f9,r);return t.jsx(G6.button,{type:"button",...o,ref:n,onClick:D6(e.onClick,(()=>i.onOpenChange(!1)))})})).displayName=f9;function h9(e){return e?"open":"closed"}i.forwardRef(((e,n)=>{const{__scopePopover:r,...o}=e,i=X8(r);return t.jsx(V8,{...i,...o,ref:n})})).displayName="PopoverArrow";var m9=a9,g9=l9;const v9=J8,y9=n9,b9=n.forwardRef((({className:e,align:n="center",sideOffset:r=4,...o},i)=>t.jsx(m9,{children:t.jsx(g9,{ref:i,align:n,sideOffset:r,className:rp("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...o})})));b9.displayName=g9.displayName;const x9={[ze.DRAFT]:"Draft",[ze.ACTIVE]:"Active",[ze.RUNNING]:"Running",[ze.COMPLETED]:"Completed",[ze.FAILED]:"Failed",[ze.DEACTIVATED]:"Deactivated"},w9={[ze.DRAFT]:"bg-gray-500",[ze.ACTIVE]:"bg-blue-500",[ze.RUNNING]:"bg-yellow-500",[ze.COMPLETED]:"bg-green-500",[ze.FAILED]:"bg-red-500",[ze.DEACTIVATED]:"bg-red-500"},_9={[ze.DRAFT]:"bg-gray-100 text-gray-700 px-2 py-1",[ze.ACTIVE]:"bg-blue-100 text-blue-700 px-2 py-1",[ze.RUNNING]:"bg-yellow-100 text-yellow-700 px-2 py-1",[ze.COMPLETED]:"bg-green-100 text-green-700 px-2 py-1",[ze.FAILED]:"bg-red-100 text-red-700 px-2 py-1",[ze.DEACTIVATED]:"bg-red-100 text-red-700 px-2 py-1"},S9={[ze.DRAFT]:`Draft ${bf("engage:automation")?.toLowerCase()} can be activated or deactivated`,[ze.ACTIVE]:`Active ${bf("engage:automation")?.toLowerCase()} can be drafted, deactivated, run, or marked as failed`,[ze.RUNNING]:`Running ${bf("engage:automation")?.toLowerCase()} can be completed or marked as failed`,[ze.COMPLETED]:`Completed ${bf("engage:automation")?.toLowerCase()} can only be marked as failed`,[ze.FAILED]:`Failed ${bf("engage:automation")?.toLowerCase()} requires manual intervention to change state`,[ze.DEACTIVATED]:`Deactivated ${bf("engage:automation")?.toLowerCase()} cannot be reactivated - create a new one instead`},E9={[ze.DRAFT]:[ze.ACTIVE,ze.DEACTIVATED],[ze.ACTIVE]:[ze.DRAFT],[ze.RUNNING]:[],[ze.COMPLETED]:[],[ze.FAILED]:[],[ze.DEACTIVATED]:[]},T9=({rowOriginal:e,id:r,onToggle:o,className:i="",vsaasManaged:a=!1})=>{const[s,l]=n.useState(!1),c=e.status,u=(E9[c]||[]).filter((e=>!1===a||e!==ze.DEACTIVATED)),d=u.length>0;return t.jsx("div",{className:`${i}`,onClick:e=>e.stopPropagation(),children:t.jsx(P6,{children:t.jsxs(v9,{open:!!d&&s,onOpenChange:l,children:[t.jsx(y9,{asChild:!0,children:t.jsx("div",{className:"relative",children:t.jsxs(MZ,{variant:"outline",className:`flex items-center justify-between px-4 py-2 rounded-md w-full ${_9[c]} ${d?"":"cursor-not-allowed opacity-80"}`,onClick:e=>{e.stopPropagation(),d&&l(!s)},children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${w9[c]}`}),t.jsx("span",{children:x9[c]})]}),d?t.jsx(gu,{className:"h-4 w-4 ml-2"}):t.jsxs(k6,{children:[t.jsx(j6,{asChild:!0,children:t.jsx(ku,{className:"h-4 w-4 ml-2 text-gray-500"})}),t.jsx(M6,{className:"max-w-xs p-2",children:t.jsx("p",{children:S9[c]})})]})]})})}),d&&t.jsx(b9,{className:"w-full p-2",align:"center",sideOffset:5,children:t.jsx("div",{className:"py-1 flex flex-col gap-2 justify-start items-center",onClick:e=>e.stopPropagation(),children:u.map((e=>t.jsxs(MZ,{variant:"ghost",className:"flex justify-start items-center px-4 py-2 text-sm w-full text-left hover:bg-gray-100 rounded-none "+(c===e?"font-medium":""),onClick:()=>(o(r,e),void l(!1)),children:[t.jsx("div",{className:`w-2 h-2 rounded-full ${w9[e]} mr-2`}),x9[e]]},e)))})})]})})})};function C9(e){const t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new e.constructor(+e):"number"==typeof e||"[object Number]"===t||"string"==typeof e||"[object String]"===t?new Date(e):new Date(NaN)}function A9(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const N9=6048e5,R9=43200;let O9={};function P9(){return O9}function k9(e,t){const n=P9(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=C9(e),i=o.getDay(),a=(i<r?7:0)+i-r;return o.setDate(o.getDate()-a),o.setHours(0,0,0,0),o}function j9(e){return k9(e,{weekStartsOn:1})}function M9(e){const t=C9(e),n=t.getFullYear(),r=A9(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const o=j9(r),i=A9(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const a=j9(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function L9(e){const t=C9(e);return t.setHours(0,0,0,0),t}function D9(e){const t=C9(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function I9(e,t){return function(e,t){return A9(e,+C9(e)+t)}(e,6e4*t)}function F9(e,t){const n=C9(e),r=C9(t),o=n.getTime()-r.getTime();return o<0?-1:o>0?1:o}function U9(e){if(!(t=e,t instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t)||"number"==typeof e))return!1;var t;const n=C9(e);return!isNaN(Number(n))}function $9(e){const t=C9(e);return+function(e){const t=C9(e);return t.setHours(23,59,59,999),t}(t)==+function(e){const t=C9(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}(t)}function V9(e,t){const n=C9(e),r=C9(t),o=F9(n,r),i=Math.abs(function(e,t){const n=C9(e),r=C9(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}(n,r));let a;if(i<1)a=0;else{1===n.getMonth()&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-o*i);let t=F9(n,r)===-o;$9(C9(e))&&1===i&&1===F9(e,r)&&(t=!1),a=o*(i-Number(t))}return 0===a?0:a}function B9(e,t,n){const r=function(e,t){return+C9(e)-+C9(t)}(e,t)/1e3;return(o=n?.roundingMethod,e=>{const t=(o?Math[o]:Math.trunc)(e);return 0===t?0:t})(r);var o}const z9={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 H9(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const q9={date:H9({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:H9({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:H9({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},G9={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function K9(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,o=n?.width?String(n.width):t;r=e.formattingValues[o]||e.formattingValues[t]}else{const t=e.defaultWidth,o=n?.width?String(n.width):e.defaultWidth;r=e.values[o]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function W9(e){return(t,n={})=>{const r=n.width,o=t.match(r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth]);if(!o)return null;const i=o[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],s=Array.isArray(a)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(a,(e=>e.test(i))):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(a,(e=>e.test(i)));let l;l=e.valueCallback?e.valueCallback(s):s,l=n.valueCallback?n.valueCallback(l):l;return{value:l,rest:t.slice(i.length)}}}var Y9;const X9={code:"en-US",formatDistance:(e,t,n)=>{let r;const o=z9[e];return r="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:q9,formatRelative:(e,t,n,r)=>G9[e],localize:{ordinalNumber:(e,t)=>{const 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:K9({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:K9({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:K9({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:K9({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:K9({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"})},match:{ordinalNumber:(Y9={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(Y9.matchPattern);if(!n)return null;const r=n[0],o=e.match(Y9.parsePattern);if(!o)return null;let i=Y9.valueCallback?Y9.valueCallback(o[0]):o[0];return i=t.valueCallback?t.valueCallback(i):i,{value:i,rest:e.slice(r.length)}}),era:W9({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:W9({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:e=>e+1}),month:W9({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:W9({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:W9({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"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Z9(e){const t=C9(e),n=function(e,t){const n=L9(e),r=L9(t),o=+n-D9(n),i=+r-D9(r);return Math.round((o-i)/864e5)}(t,function(e){const t=C9(e),n=A9(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}(t));return n+1}function Q9(e){const t=C9(e),n=+j9(t)-+function(e){const t=M9(e),n=A9(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),j9(n)}(t);return Math.round(n/N9)+1}function J9(e,t){const n=C9(e),r=n.getFullYear(),o=P9(),i=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,a=A9(e,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const s=k9(a,t),l=A9(e,0);l.setFullYear(r,0,i),l.setHours(0,0,0,0);const c=k9(l,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function e7(e,t){const n=C9(e),r=+k9(n,t)-+function(e,t){const n=P9(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=J9(e,t),i=A9(e,0);return i.setFullYear(o,0,r),i.setHours(0,0,0,0),k9(i,t)}(n,t);return Math.round(r/N9)+1}function t7(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}const n7={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return t7("yy"===t?r%100:r,t.length)},M(e,t){const n=e.getMonth();return"M"===t?String(n+1):t7(n+1,2)},d:(e,t)=>t7(e.getDate(),t.length),a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(e,t)=>t7(e.getHours()%12||12,t.length),H:(e,t)=>t7(e.getHours(),t.length),m:(e,t)=>t7(e.getMinutes(),t.length),s:(e,t)=>t7(e.getSeconds(),t.length),S(e,t){const n=t.length,r=e.getMilliseconds();return t7(Math.trunc(r*Math.pow(10,n-3)),t.length)}},r7="midnight",o7="noon",i7="morning",a7="afternoon",s7="evening",l7="night",c7={G:function(e,t,n){const r=e.getFullYear()>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){const t=e.getFullYear();return n.ordinalNumber(t>0?t:1-t,{unit:"year"})}return n7.y(e,t)},Y:function(e,t,n,r){const o=J9(e,r),i=o>0?o:1-o;if("YY"===t){return t7(i%100,2)}return"Yo"===t?n.ordinalNumber(i,{unit:"year"}):t7(i,t.length)},R:function(e,t){return t7(M9(e),t.length)},u:function(e,t){return t7(e.getFullYear(),t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return t7(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){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return t7(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){const r=e.getMonth();switch(t){case"M":case"MM":return n7.M(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){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return t7(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){const o=e7(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):t7(o,t.length)},I:function(e,t,n){const r=Q9(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):t7(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getDate(),{unit:"date"}):n7.d(e,t)},D:function(e,t,n){const r=Z9(e);return"Do"===t?n.ordinalNumber(r,{unit:"dayOfYear"}):t7(r,t.length)},E:function(e,t,n){const r=e.getDay();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){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return t7(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){const o=e.getDay(),i=(o-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return t7(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){const r=e.getDay(),o=0===r?7:r;switch(t){case"i":return String(o);case"ii":return t7(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){const r=e.getHours()/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){const r=e.getHours();let o;switch(o=12===r?o7:0===r?r7:r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let o;switch(o=r>=17?s7:r>=12?a7:r>=4?i7:l7,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),n.ordinalNumber(t,{unit:"hour"})}return n7.h(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getHours(),{unit:"hour"}):n7.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):t7(r,t.length)},k:function(e,t,n){let r=e.getHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):t7(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):n7.m(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getSeconds(),{unit:"second"}):n7.s(e,t)},S:function(e,t){return n7.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return d7(r);case"XXXX":case"XX":return p7(r);default:return p7(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return d7(r);case"xxxx":case"xx":return p7(r);default:return p7(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+u7(r,":");default:return"GMT"+p7(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+u7(r,":");default:return"GMT"+p7(r,":")}},t:function(e,t,n){return t7(Math.trunc(e.getTime()/1e3),t.length)},T:function(e,t,n){return t7(e.getTime(),t.length)}};function u7(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),o=Math.trunc(r/60),i=r%60;return 0===i?n+String(o):n+String(o)+t+t7(i,2)}function d7(e,t){if(e%60==0){return(e>0?"-":"+")+t7(Math.abs(e)/60,2)}return p7(e,t)}function p7(e,t=""){const n=e>0?"-":"+",r=Math.abs(e);return n+t7(Math.trunc(r/60),2)+t+t7(r%60,2)}const f7=(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"})}},h7=(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"})}},m7={p:h7,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],o=n[2];if(!o)return f7(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;default:i=t.dateTime({width:"full"})}return i.replace("{{date}}",f7(r,t)).replace("{{time}}",h7(o,t))}},g7=/^D+$/,v7=/^Y+$/,y7=["D","DD","YY","YYYY"];const b7=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,x7=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,w7=/^'([^]*?)'?$/,_7=/''/g,S7=/[a-zA-Z]/;function E7(e,t,n){const r=P9(),o=r.locale??X9,i=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=C9(e);if(!U9(s))throw new RangeError("Invalid time value");let l=t.match(x7).map((e=>{const t=e[0];if("p"===t||"P"===t){return(0,m7[t])(e,o.formatLong)}return e})).join("").match(b7).map((e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:T7(e)};if(c7[t])return{isToken:!0,value:e};if(t.match(S7))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}}));o.localize.preprocessor&&(l=o.localize.preprocessor(s,l));const c={firstWeekContainsDate:i,weekStartsOn:a,locale:o};return l.map((n=>{if(!n.isToken)return n.value;const r=n.value;(function(e){return v7.test(e)}(r)||function(e){return g7.test(e)}(r))&&function(e,t,n){const r=function(e,t,n){const r="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,n);if(y7.includes(e))throw new RangeError(r)}(r,t,String(e));return(0,c7[r[0]])(s,r,o.localize,c)})).join("")}function T7(e){const t=e.match(w7);return t?t[1].replace(_7,"'"):e}function C7(e,t){return function(e,t,n){const r=P9(),o=n?.locale??r.locale??X9,i=F9(e,t);if(isNaN(i))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:i});let s,l;i>0?(s=C9(t),l=C9(e)):(s=C9(e),l=C9(t));const c=B9(l,s),u=(D9(l)-D9(s))/1e3,d=Math.round((c-u)/60);let p;if(d<2)return n?.includeSeconds?c<5?o.formatDistance("lessThanXSeconds",5,a):c<10?o.formatDistance("lessThanXSeconds",10,a):c<20?o.formatDistance("lessThanXSeconds",20,a):c<40?o.formatDistance("halfAMinute",0,a):o.formatDistance(c<60?"lessThanXMinutes":"xMinutes",1,a):0===d?o.formatDistance("lessThanXMinutes",1,a):o.formatDistance("xMinutes",d,a);if(d<45)return o.formatDistance("xMinutes",d,a);if(d<90)return o.formatDistance("aboutXHours",1,a);if(d<1440){const e=Math.round(d/60);return o.formatDistance("aboutXHours",e,a)}if(d<2520)return o.formatDistance("xDays",1,a);if(d<R9){const e=Math.round(d/1440);return o.formatDistance("xDays",e,a)}if(d<86400)return p=Math.round(d/R9),o.formatDistance("aboutXMonths",p,a);if(p=V9(l,s),p<12){const e=Math.round(d/R9);return o.formatDistance("xMonths",e,a)}{const e=p%12,t=Math.trunc(p/12);return e<3?o.formatDistance("aboutXYears",t,a):e<9?o.formatDistance("overXYears",t,a):o.formatDistance("almostXYears",t+1,a)}}(e,function(e){return A9(e,Date.now())}(e),t)}function A7({accessorKey:e,header:n,meta:r,size:o,minSize:i,maxSize:a,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,cellFormatter:d}){return{accessorKey:e,header:()=>t.jsx("div",{className:`flex items-center h-8 px-3 font-medium whitespace-nowrap text-muted-foreground ${"right"===r?.align?"justify-end float-right":"center"===r?.align?"justify-center":"justify-start"} ${c||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>t.jsx("div",{className:`flex items-center h-8 ${"right"===r?.align?"justify-end":"center"===r?.align?"justify-center":"justify-start"} ${u||""} ${r?.className||""}`.trim(),children:d?d(e):e.getValue()}),size:o,minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}const N7=(e,t,n,r="Error",o="Please try again")=>{e(!1),"error"===n&&t({title:r,description:o,variant:"destructive"})},R7=e=>{switch(e){case ze.ACTIVE:return"statusActive";case ze.COMPLETED:return"statusCompleted";case ze.DRAFT:return"statusDraft";case ze.DEACTIVATED:return"statusDeactivated";case ze.FAILED:return"statusFailed";case ze.RUNNING:return"statusRunning";default:throw HX(e,ze)}},O7=e=>{switch(e){case gZ.ALL_USERS:return`Default ${bf("engage:segment").toLowerCase()} that contains all ${bf("engage:user").toLowerCase()}}. This is not editable or deletable.`;case gZ.MANAGED:return`System-defined ${bf("engage:segment").toLowerCase()} that are not editable or deletable.`;case gZ.CUSTOM:return`Custom ${bf("engage:segment").toLowerCase()} that you can edit and delete as needed.`;default:throw HX(e,gZ)}};function P7(e="name",n,r=!1){return A7({accessorKey:e,header:n,meta:{align:"left",displayName:n,className:"min-w-[240px] w-full"},cellClassName:"pl-3 pr-2",cellFormatter:e=>{const n=e.getValue(),{original:o}=e.row,i=o.status,a=o.type,s=i?i[0].toUpperCase()+i.slice(1):"",l={[ze.ACTIVE]:"bg-blue-500",[ze.COMPLETED]:"bg-green-500",[ze.DRAFT]:"bg-gray-500",[ze.DEACTIVATED]:"bg-red-500",[ze.FAILED]:"bg-red-500",[ze.RUNNING]:"bg-yellow-500"};return t.jsxs("div",{className:"w-full flex gap-6 justify-between items-center",children:[t.jsxs("div",{className:"flex gap-1 items-center w-full",children:[t.jsx("div",{className:`w-2 h-2 rounded-full mr-3 flex-shrink-0 ${a?{[gZ.ALL_USERS]:"bg-purple-500",[gZ.MANAGED]:"bg-teal-500",[gZ.CUSTOM]:"bg-amber-500"}[a]:i?l[i]:"bg-blue-500"}`}),t.jsxs("div",{className:"flex-1 flex flex-col gap-0.5",children:[t.jsx("span",{className:"leading-tight font-medium text-sm overflow-hidden text-ellipsis",children:n}),r&&o?.description&&t.jsx("div",{className:"relative h-4",children:t.jsx("div",{className:"absolute inset-0 text-muted-foreground text-xs truncate whitespace-nowrap overflow-hidden w-full",children:o?.description})})]})]}),i&&t.jsx("div",{className:"flex-shrink-0",children:t.jsx(YZ,{variant:R7(i),children:s})})]})}})}function k7(){return A7({accessorKey:"type",header:"Type",meta:{align:"right",displayName:`${bf("engage:segment")} type`},cellClassName:"pr-4",cellFormatter:e=>{const n=e.getValue(),r=n?n.split("_").map((e=>e[0].toUpperCase()+e.slice(1).toLowerCase())).join(" "):"Unknown";let o;if(!n||n!==gZ.ALL_USERS&&n!==gZ.MANAGED&&n!==gZ.CUSTOM)o="statusDraft";else try{o=(e=>{switch(e){case gZ.ALL_USERS:return"segmentAllUsers";case gZ.MANAGED:return"segmentManaged";case gZ.CUSTOM:return"segmentCustom";default:throw HX(e,gZ)}})(n)}catch(ITe){if(!(ITe instanceof HX))throw ITe;o="statusDraft"}return t.jsx(P6,{children:t.jsxs(k6,{children:[t.jsx(j6,{asChild:!0,children:t.jsx(YZ,{variant:o,className:"cursor-help",children:r})}),t.jsx(M6,{side:"top",className:"max-w-[250px] text-sm bg-white border border-gray-200 rounded-lg p-3",children:t.jsx("p",{className:"text-muted-foreground",children:n&&O7(n)||`Unknown ${bf("engage:segment").toLowerCase()} type`})})]})})}})}function j7(e="updated_at"){return function({accessorKey:e,header:n,meta:r={align:"right"},size:o=160,minSize:i,maxSize:a,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,formatType:d="relative"}){return{accessorKey:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:t.jsx("span",{children:n})}),cell:e=>{const n=e.getValue();let o="N/A";return n&&(o="relative"===d?C7(new Date(n),{addSuffix:!0}):new Date(n).toLocaleDateString()),t.jsx("div",{className:`font-variant-numeric w-full h-8 flex items-center justify-end pr-4 whitespace-nowrap ${u||""} ${r?.className||""}`.trim(),children:o})},size:o,minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}({accessorKey:e,header:"Last Modified",formatType:"relative",size:160,meta:{align:"right",displayName:"Last Modified"}})}function M7(e,n,r){return function({accessorKey:e,header:n,meta:r={align:"right"},size:o,minSize:i,maxSize:a=120,enableSorting:s=!0,enableHiding:l=!0,headerClassName:c,cellClassName:u,prefix:d="",suffix:p="",localeStringOptions:f}){return{accessorKey:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${c||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>{const n=e.getValue()??0;return t.jsxs("div",{className:`font-variant-numeric h-8 flex items-center justify-end pr-4 ${u||""} ${r?.className||""}`.trim(),children:[d,n.toLocaleString(void 0,f),p]})},size:o||(r?.className?.includes("w-")?void 0:100),minSize:i,maxSize:a,enableSorting:s,enableHiding:l,meta:r}}({accessorKey:e,header:n,prefix:r,meta:{align:"right",displayName:n}})}function L7(e){const{setUrl:n,onToggle:r,automationName:o,vsaasManaged:i}=e;return A7({accessorKey:"status",header:"Status",enableHiding:!1,size:180,maxSize:200,meta:{align:"right"},cellClassName:"pr-4",cellFormatter:e=>{const{original:a}=e.row;return(a.status??null)===ze.DRAFT&&n&&!1===i?t.jsx(L6,{rowOriginal:a,constructNavigationUrl:()=>n(a.id),cellText:"Action Required",tooltipIcon:t.jsx(ku,{className:"h-4 w-4 text-muted-foreground !cursor-help z-99"}),tooltipText:`Your ${o?.toLowerCase()} is currently in draft mode. Please review and activate it to begin sending messages.`}):t.jsx(T9,{className:"flex items-center justify-end",rowOriginal:a,id:a.id,onToggle:r||(()=>{}),vsaasManaged:i})}})}function D7(e){const n={align:"right",displayName:`Update ${bf("engage:segment").toLowerCase()}`};return function({id:e="actions",header:n,meta:r={align:"center"},text:o,size:i=80,minSize:a=80,maxSize:s=80,enableSorting:l=!1,enableHiding:c=!1,headerClassName:u,icon:d,onAction:p,actionButtonVariant:f="outline",actionButtonSize:h="default"}){return{id:e,header:()=>t.jsx("div",{className:`float-right h-8 flex items-center justify-end px-3 font-medium whitespace-nowrap text-muted-foreground ${u||""}`.trim(),children:"function"==typeof n?n():t.jsx("span",{children:n})}),cell:e=>{const n=e.row.original,i=n?.type,a="custom"!==i;return t.jsx("div",{className:`flex items-center h-8 pr-3 ${"right"===r?.align?"justify-end":"center"===r?.align?"justify-center":"justify-start"} ${r?.className||""}`.trim(),children:t.jsxs(MZ,{variant:f,size:h,disabled:a,onClick:()=>p(n),children:[t.jsx(d,{className:"h-4 w-4"}),t.jsx("span",{children:o})]})})},size:i,minSize:a,maxSize:s,enableSorting:l,enableHiding:c,meta:r}}({id:"edit",header:`${bf("engage:segment")} actions`,icon:Hu,onAction:t=>{e(t.id)},text:"Edit",enableHiding:!1,size:80,meta:n})}function I7(e){const{automationName:t,setUrl:n,onToggle:r,vsaasManaged:o=!1}=e;return[P7("name","Name",!0),M7("derivedRevenue","Sales","$"),M7("emailsSent","Email Sent"),M7("smsSent","SMS Sent"),j7(),L7({setUrl:n,onToggle:r,automationName:t,vsaasManaged:o})]}const F7=({handleBack:e,handleNext:n,handleSkipAndSaveAsDraft:r,backText:o,nextText:i,backDisabled:a,nextDisabled:s,hideBack:l})=>t.jsxs("div",{className:"flex gap-4 py-2",children:[!l&&t.jsxs(MZ,{onClick:e,disabled:a,variant:"secondary",className:rp("flex items-center gap-2",a&&"opacity-50 cursor-not-allowed"),children:[t.jsx(FZ.BackButton,{}),t.jsx("span",{children:o})]}),t.jsx(MZ,{onClick:r,variant:"secondary",className:"flex items-center gap-2",children:"Skip & Save as Draft"}),t.jsxs(MZ,{onClick:n,disabled:s,className:rp("flex items-center gap-2 --reach-destructive",s&&"opacity-50 cursor-not-allowed"),children:[t.jsx("span",{children:i}),t.jsx(FZ.NextButton,{})]})]}),U7=()=>{const e=ye({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 $7=(e=>(e.REACH_MANAGED="reach-managed",e.TWILLIO="twillio",e))($7||{});const V7=()=>{const e=ye({queryKey:["channel-senders"],queryFn:()=>(async()=>{let e=[],t=null,n=!0;do{const r=t?`${u}?cursor=${encodeURIComponent(t)}`:`${u}`,o=(await Oe(r,{method:"GET"})).data;e=e.concat(o.results),n=o.pagination?.hasNextPage??!1,t=o.pagination?.cursor??null}while(n&&t);return{results:e}})()});return{channelSenders:e.data,isFetching:e.isFetching,isLoading:e.isLoading,fetchError:e.error,refetchChannelSenders:e.refetch}},B7=()=>{const e=ue(),t=be({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}},z7=e=>{const{channelSenders:t,channelAccounts:n}=e;return t?.filter((e=>e.channelSenderMetadata.userPart))?.flatMap((e=>{const t=n?.find((t=>t.id===e.channelAccountId));return t&&t.channelAccountMetadata.type===$7.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`,channelSender:e}]:[]}))||[]},H7=e=>{const{channelSenders:t}=e;return t?.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid))||[]},q7=(e,t)=>{const[r,o]=n.useState(e);return n.useEffect((()=>{const n=setTimeout((()=>{o(e)}),t);return()=>clearTimeout(n)}),[e,t]),r},G7=({title:e,alertText:r,Icon:o=ku,onClick:i,asChild:a=!0,link:s})=>{const[l,c]=n.useState(!1);return t.jsx(P6,{children:t.jsxs(k6,{open:l,onOpenChange:c,children:[t.jsx(j6,{asChild:a,onClick:e=>{e.stopPropagation(),i?(i(),c(!1)):c(!l)},children:t.jsx(o,{className:"h-3.5 w-3.5 cursor-pointer transition-colors"})}),t.jsx(M6,{className:"bg-white text-gray-900 border border-gray-200 shadow-lg text-left",children:t.jsxs("div",{className:"flex flex-col items-center justify-center w-full gap-2 max-w-[300px]",children:[r&&t.jsxs("div",{className:"flex flex-col items-center justify-center w-full",children:[t.jsx(FZ.AlertTriangleIcon,{className:"text-amber-500 w-6 h-6"}),t.jsx("p",{className:"font-medium text-amber-500 text-center text-[14px]",children:r})]}),t.jsx("p",{className:"text-[13px] leading-relaxed text-black text-center",children:e}),s&&t.jsx("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"text-[13px] text-blue-500 hover:text-blue-600 hover:underline transition-colors",onClick:e=>e.stopPropagation(),children:s.text})]})})]})})};function K7(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function W7(e){const n=Y7(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(Z7);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 Y7(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?function(...e){return t=>{let n=!1;const r=e.map((e=>{const r=K7(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():K7(e[t],null)}}}}(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 X7=Symbol("radix.slottable");function Z7(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===X7}var Q7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=W7(`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}}),{}),J7=i.forwardRef(((e,n)=>t.jsx(Q7.label,{...e,ref:n,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}})));J7.displayName="Label";var eee=J7;const tee=au("text-foreground text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),nee=i.forwardRef((({className:e,...n},r)=>t.jsx(eee,{ref:r,className:rp(tee(),e),...n})));function ree(e,[t,n]){return Math.min(n,Math.max(t,e))}function oee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function iee(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}\``)}]},aee(o,...n)]}function aee(...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 see(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function lee(...e){return t=>{let n=!1;const r=e.map((e=>{const r=see(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():see(e[t],null)}}}}function cee(...e){return i.useCallback(lee(...e),e)}function uee(e){const n=dee(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(fee);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 dee(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?lee(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));return t.displayName=`${e}.SlotClone`,t}nee.displayName=eee.displayName;var pee=Symbol("radix.slottable");function fee(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pee}var hee=i.createContext(void 0);var mee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=uee(`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 gee(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}var vee,yee="dismissableLayer.update",bee="dismissableLayer.pointerDownOutside",xee="dismissableLayer.focusOutside",wee=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_ee=i.forwardRef(((e,n)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:l,onDismiss:c,...u}=e,d=i.useContext(wee),[p,f]=i.useState(null),h=p?.ownerDocument??globalThis?.document,[,m]=i.useState({}),g=cee(n,(e=>f(e))),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(y),x=p?v.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,_=x>=b,S=function(e,t=globalThis?.document){const n=gee(e),r=i.useRef(!1),o=i.useRef((()=>{}));return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){let r=function(){Eee(bee,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=gee(e),r=i.useRef(!1);return i.useEffect((()=>{const e=e=>{if(e.target&&!r.current){Eee(xee,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=gee(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=>{x===d.layers.size-1&&(o?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))}),h),i.useEffect((()=>{if(p)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(vee=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),See(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=vee)}}),[p,h,r,d]),i.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),See())}),[p,d]),i.useEffect((()=>{const e=()=>m({});return document.addEventListener(yee,e),()=>document.removeEventListener(yee,e)}),[]),t.jsx(mee.div,{...u,ref:g,style:{pointerEvents:w?_?"auto":"none":void 0,...e.style},onFocusCapture:oee(e.onFocusCapture,E.onFocusCapture),onBlurCapture:oee(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:oee(e.onPointerDownCapture,S.onPointerDownCapture)})}));_ee.displayName="DismissableLayer";function See(){const e=new CustomEvent(yee);document.dispatchEvent(e)}function Eee(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(wee),o=i.useRef(null),a=cee(n,o);return i.useEffect((()=>{const e=o.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}}),[r.branches]),t.jsx(mee.div,{...e,ref:a})})).displayName="DismissableLayerBranch";var Tee=0;function Cee(){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 Aee="focusScope.autoFocusOnMount",Nee="focusScope.autoFocusOnUnmount",Ree={bubbles:!1,cancelable:!0},Oee=i.forwardRef(((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...l}=e,[c,u]=i.useState(null),d=gee(a),p=gee(s),f=i.useRef(null),h=cee(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:Mee(f.current,{select:!0})},t=function(e){if(m.paused||!c)return;const t=e.relatedTarget;null!==t&&(c.contains(t)||Mee(f.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(const t of e)t.removedNodes.length>0&&Mee(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){Lee.add(m);const t=document.activeElement;if(!c.contains(t)){const n=new CustomEvent(Aee,Ree);c.addEventListener(Aee,d),c.dispatchEvent(n),n.defaultPrevented||(!function(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Mee(r,{select:t}),document.activeElement!==n)return}((e=Pee(c),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===t&&Mee(c))}return()=>{c.removeEventListener(Aee,d),setTimeout((()=>{const e=new CustomEvent(Nee,Ree);c.addEventListener(Nee,p),c.dispatchEvent(e),e.defaultPrevented||Mee(t??document.body,{select:!0}),c.removeEventListener(Nee,p),Lee.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=Pee(e),n=kee(t,e),r=kee(t.reverse(),e);return[n,r]}(n);o&&i?e.shiftKey||t!==i?e.shiftKey&&t===o&&(e.preventDefault(),r&&Mee(i,{select:!0})):(e.preventDefault(),r&&Mee(o,{select:!0})):t===n&&e.preventDefault()}}),[r,o,m.paused]);return t.jsx(mee.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})}));function Pee(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 kee(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 Mee(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()}}Oee.displayName="FocusScope";var Lee=function(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Dee(e,t),e.unshift(t)},remove(t){e=Dee(e,t),e[0]?.resume()}}}();function Dee(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}var Iee=globalThis?.document?i.useLayoutEffect:()=>{},Fee=i[" useId ".trim().toString()]||(()=>{}),Uee=0;function $ee(e){const[t,n]=i.useState(Fee());return Iee((()=>{n((e=>e??String(Uee++)))}),[e]),e||(t?`radix-${t}`:"")}var Vee=i.forwardRef(((e,n)=>{const{children:r,width:o=10,height:i=5,...a}=e;return t.jsx(mee.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"})})}));Vee.displayName="Arrow";var Bee=Vee;var zee="Popper",[Hee,qee]=iee(zee),[Gee,Kee]=Hee(zee),Wee=e=>{const{__scopePopper:n,children:r}=e,[o,a]=i.useState(null);return t.jsx(Gee,{scope:n,anchor:o,onAnchorChange:a,children:r})};Wee.displayName=zee;var Yee="PopperAnchor",Xee=i.forwardRef(((e,n)=>{const{__scopePopper:r,virtualRef:o,...a}=e,s=Kee(Yee,r),l=i.useRef(null),c=cee(n,l);return i.useEffect((()=>{s.onAnchorChange(o?.current||l.current)})),o?null:t.jsx(mee.div,{...a,ref:c})}));Xee.displayName=Yee;var Zee="PopperContent",[Qee,Jee]=Hee(Zee),ete=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=Kee(Zee,r),[b,x]=i.useState(null),w=cee(n,(e=>x(e))),[_,S]=i.useState(null),E=function(e){const[t,n]=i.useState(void 0);return Iee((()=>{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:""),N="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},R=Array.isArray(d)?d:[d],O=R.length>0,P={padding:N,boundary:R.filter(ote),altBoundary:O},{refs:k,floatingStyles:j,placement:M,isPositioned:L,middlewareData:D}=a1({strategy:"fixed",placement:A,whileElementsMounted:(...e)=>G0(...e,{animationFrame:"always"===m}),elements:{reference:y.anchor},middleware:[l1({mainAxis:a+C,alignmentAxis:l}),u&&c1({mainAxis:!0,crossAxis:!1,limiter:"partial"===f?u1():void 0,...P}),u&&d1({...P}),p1({...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`)}}),_&&h1({element:_,padding:c}),ite({arrowWidth:T,arrowHeight:C}),h&&f1({strategy:"referenceHidden",...P})]}),[I,F]=ate(M),U=gee(g);Iee((()=>{L&&U?.()}),[L,U]);const $=D.arrow?.x,V=D.arrow?.y,B=0!==D.arrow?.centerOffset,[z,H]=i.useState();return Iee((()=>{b&&H(window.getComputedStyle(b).zIndex)}),[b]),t.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:L?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[D.transformOrigin?.x,D.transformOrigin?.y].join(" "),...D.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(Qee,{scope:r,placedSide:I,onArrowChange:S,arrowX:$,arrowY:V,shouldHideArrow:B,children:t.jsx(mee.div,{"data-side":I,"data-align":F,...v,ref:w,style:{...v.style,animation:L?void 0:"none"}})})})}));ete.displayName=Zee;var tte="PopperArrow",nte={top:"bottom",right:"left",bottom:"top",left:"right"},rte=i.forwardRef((function(e,n){const{__scopePopper:r,...o}=e,i=Jee(tte,r),a=nte[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(Bee,{...o,ref:n,style:{...o.style,display:"block"}})})}));function ote(e){return null!==e}rte.displayName=tte;var ite=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]=ate(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 ate(e){const[t,n="center"]=e.split("-");return[t,n]}var ste=Wee,lte=Xee,cte=ete,ute=rte,dte=i.forwardRef(((e,n)=>{const{container:o,...a}=e,[s,l]=i.useState(!1);Iee((()=>l(!0)),[]);const c=o||s&&globalThis?.document?.body;return c?r.createPortal(t.jsx(mee.div,{...a,ref:n}),c):null}));dte.displayName="Portal";var pte=i[" useInsertionEffect ".trim().toString()]||Iee;function fte({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 pte((()=>{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 hte=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(mee.span,{...e,ref:n,style:{...hte,...e.style}}))).displayName="VisuallyHidden";var mte=[" ","Enter","ArrowUp","ArrowDown"],gte=[" ","Enter"],vte="Select",[yte,bte,xte]=function(e){const r=e+"CollectionProvider",[o,i]=iee(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=uee(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=cee(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=uee(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=cee(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]}(vte),[wte,_te]=iee(vte,[xte,qee]),Ste=qee(),[Ete,Tte]=wte(vte),[Cte,Ate]=wte(vte),Nte=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=Ste(n),[y,b]=i.useState(null),[x,w]=i.useState(null),[_,S]=i.useState(!1),E=function(e){const t=i.useContext(hee);return e||t||"ltr"}(d),[T,C]=fte({prop:o,defaultProp:a??!1,onChange:s,caller:vte}),[A,N]=fte({prop:l,defaultProp:c,onChange:u,caller:vte}),R=i.useRef(null),O=!y||(g||!!y.closest("form")),[P,k]=i.useState(new Set),j=Array.from(P).map((e=>e.props.value)).join(";");return t.jsx(ste,{...v,children:t.jsxs(Ete,{required:m,scope:n,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:_,onValueNodeHasChildrenChange:S,contentId:$ee(),value:A,onValueChange:N,open:T,onOpenChange:C,dir:E,triggerPointerDownPosRef:R,disabled:h,children:[t.jsx(yte.Provider,{scope:n,children:t.jsx(Cte,{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})}),O?t.jsxs(mne,{"aria-hidden":!0,required:m,tabIndex:-1,name:p,autoComplete:f,value:A,onChange:e=>N(e.target.value),disabled:h,form:g,children:[void 0===A?t.jsx("option",{value:""}):null,Array.from(P)]},j):null]})})};Nte.displayName=vte;var Rte="SelectTrigger",Ote=i.forwardRef(((e,n)=>{const{__scopeSelect:r,disabled:o=!1,...a}=e,s=Ste(r),l=Tte(Rte,r),c=l.disabled||o,u=cee(n,l.onTriggerChange),d=bte(r),p=i.useRef("touch"),[f,h,m]=vne((e=>{const t=d().filter((e=>!e.disabled)),n=t.find((e=>e.value===l.value)),r=yne(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(lte,{asChild:!0,...s,children:t.jsx(mee.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":gne(l.value)?"":void 0,...a,ref:u,onClick:oee(a.onClick,(e=>{e.currentTarget.focus(),"mouse"!==p.current&&g(e)})),onPointerDown:oee(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:oee(a.onKeyDown,(e=>{const t=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||h(e.key),t&&" "===e.key||mte.includes(e.key)&&(g(),e.preventDefault())}))})})}));Ote.displayName=Rte;var Pte="SelectValue",kte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:i,children:a,placeholder:s="",...l}=e,c=Tte(Pte,r),{onValueNodeHasChildrenChange:u}=c,d=void 0!==a,p=cee(n,c.onValueNodeChange);return Iee((()=>{u(d)}),[u,d]),t.jsx(mee.span,{...l,ref:p,style:{pointerEvents:"none"},children:gne(c.value)?t.jsx(t.Fragment,{children:s}):a})}));kte.displayName=Pte;var jte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,children:o,...i}=e;return t.jsx(mee.span,{"aria-hidden":!0,...i,ref:n,children:o||"▼"})}));jte.displayName="SelectIcon";var Mte=e=>t.jsx(dte,{asChild:!0,...e});Mte.displayName="SelectPortal";var Lte="SelectContent",Dte=i.forwardRef(((e,n)=>{const r=Tte(Lte,e.__scopeSelect),[o,s]=i.useState();if(Iee((()=>{s(new DocumentFragment)}),[]),!r.open){const n=o;return n?a.createPortal(t.jsx(Fte,{scope:e.__scopeSelect,children:t.jsx(yte.Slot,{scope:e.__scopeSelect,children:t.jsx("div",{children:e.children})})}),n):null}return t.jsx(Vte,{...e,ref:n})}));Dte.displayName=Lte;var Ite=10,[Fte,Ute]=wte(Lte),$te=uee("SelectContent.RemoveScroll"),Vte=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,x=Tte(Lte,r),[w,_]=i.useState(null),[S,E]=i.useState(null),T=cee(n,(e=>_(e))),[C,A]=i.useState(null),[N,R]=i.useState(null),O=bte(r),[P,k]=i.useState(!1),j=i.useRef(!1);i.useEffect((()=>{if(w)return HV(w)}),[w]),i.useEffect((()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Cee()),document.body.insertAdjacentElement("beforeend",e[1]??Cee()),Tee++,()=>{1===Tee&&document.querySelectorAll("[data-radix-focus-guard]").forEach((e=>e.remove())),Tee--}}),[]);const M=i.useCallback((e=>{const[t,...n]=O().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}}),[O,S]),L=i.useCallback((()=>M([C,w])),[M,C,w]);i.useEffect((()=>{P&&L()}),[P,L]);const{onOpenChange:D,triggerPointerDownPosRef:I}=x;i.useEffect((()=>{if(w){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():w.contains(n.target)||D(!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})}}}),[w,D,I]),i.useEffect((()=>{const e=()=>D(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}}),[D]);const[F,U]=vne((e=>{const t=O().filter((e=>!e.disabled)),n=t.find((e=>e.ref.current===document.activeElement)),r=yne(t,e,n);r&&setTimeout((()=>r.ref.current.focus()))})),$=i.useCallback(((e,t,n)=>{const r=!j.current&&!n;(void 0!==x.value&&x.value===t||r)&&(A(e),r&&(j.current=!0))}),[x.value]),V=i.useCallback((()=>w?.focus()),[w]),B=i.useCallback(((e,t,n)=>{(void 0!==x.value&&x.value===t||!j.current&&!n)&&R(e)}),[x.value]),z="popper"===o?zte:Bte,H=z===zte?{side:c,sideOffset:u,align:d,alignOffset:p,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return t.jsx(Fte,{scope:r,content:w,viewport:S,onViewportChange:E,itemRefCallback:$,selectedItem:C,onItemLeave:V,itemTextRefCallback:B,focusSelectedItem:L,selectedItemText:N,position:o,isPositioned:P,searchRef:F,children:t.jsx(IV,{as:$te,allowPinchZoom:!0,children:t.jsx(Oee,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:oee(a,(e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()})),children:t.jsx(_ee,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:t.jsx(z,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...H,onPlaced:()=>k(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:oee(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=O().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((()=>M(t))),e.preventDefault()}}))})})})})})}));Vte.displayName="SelectContentImpl";var Bte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onPlaced:o,...a}=e,s=Tte(Lte,r),l=Ute(Lte,r),[c,u]=i.useState(null),[d,p]=i.useState(null),f=cee(n,(e=>p(e))),h=bte(r),m=i.useRef(!1),g=i.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=l,w=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-Ite,l=ree(o,[Ite,Math.max(Ite,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-Ite,u=ree(o,[Ite,Math.max(Ite,l-s)]);c.style.minWidth=a+"px",c.style.right=u+"px"}const i=h(),a=window.innerHeight-2*Ite,l=v.scrollHeight,u=window.getComputedStyle(d),p=parseInt(u.borderTopWidth,10),f=parseInt(u.paddingTop,10),g=parseInt(u.borderBottomWidth,10),x=p+f+l+parseInt(u.paddingBottom,10)+g,w=Math.min(5*y.offsetHeight,x),_=window.getComputedStyle(v),S=parseInt(_.paddingTop,10),E=parseInt(_.paddingBottom,10),T=e.top+e.height/2-Ite,C=a-T,A=y.offsetHeight/2,N=p+f+(y.offsetTop+A),R=x-N;if(N<=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=N+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+R+"px",v.scrollTop=N-T+v.offsetTop}c.style.margin=`${Ite}px 0`,c.style.minHeight=w+"px",c.style.maxHeight=a+"px",o?.(),requestAnimationFrame((()=>m.current=!0))}}),[h,s.trigger,s.valueNode,c,d,v,y,b,s.dir,o]);Iee((()=>w()),[w]);const[_,S]=i.useState();Iee((()=>{d&&S(window.getComputedStyle(d).zIndex)}),[d]);const E=i.useCallback((e=>{e&&!0===g.current&&(w(),x?.(),g.current=!1)}),[w,x]);return t.jsx(Hte,{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(mee.div,{...a,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})}));Bte.displayName="SelectItemAlignedPosition";var zte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,align:o="start",collisionPadding:i=Ite,...a}=e,s=Ste(r);return t.jsx(cte,{...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)"}})}));zte.displayName="SelectPopperPosition";var[Hte,qte]=wte(Lte,{}),Gte="SelectViewport",Kte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,nonce:o,...a}=e,s=Ute(Gte,r),l=qte(Gte,r),c=cee(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(yte.Slot,{scope:r,children:t.jsx(mee.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:oee(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*Ite,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}))})})]})}));Kte.displayName=Gte;var Wte="SelectGroup",[Yte,Xte]=wte(Wte),Zte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=$ee();return t.jsx(Yte,{scope:r,id:i,children:t.jsx(mee.div,{role:"group","aria-labelledby":i,...o,ref:n})})}));Zte.displayName=Wte;var Qte="SelectLabel",Jte=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Xte(Qte,r);return t.jsx(mee.div,{id:i.id,...o,ref:n})}));Jte.displayName=Qte;var ene="SelectItem",[tne,nne]=wte(ene),rne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,value:o,disabled:a=!1,textValue:s,...l}=e,c=Tte(ene,r),u=Ute(ene,r),d=c.value===o,[p,f]=i.useState(s??""),[h,m]=i.useState(!1),g=cee(n,(e=>u.itemRefCallback?.(e,o,a))),v=$ee(),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(tne,{scope:r,value:o,disabled:a,textId:v,isSelected:d,onItemTextChange:i.useCallback((e=>{f((t=>t||(e?.textContent??"").trim()))}),[]),children:t.jsx(yte.ItemSlot,{scope:r,value:o,disabled:a,textValue:p,children:t.jsx(mee.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:oee(l.onFocus,(()=>m(!0))),onBlur:oee(l.onBlur,(()=>m(!1))),onClick:oee(l.onClick,(()=>{"mouse"!==y.current&&b()})),onPointerUp:oee(l.onPointerUp,(()=>{"mouse"===y.current&&b()})),onPointerDown:oee(l.onPointerDown,(e=>{y.current=e.pointerType})),onPointerMove:oee(l.onPointerMove,(e=>{y.current=e.pointerType,a?u.onItemLeave?.():"mouse"===y.current&&e.currentTarget.focus({preventScroll:!0})})),onPointerLeave:oee(l.onPointerLeave,(e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()})),onKeyDown:oee(l.onKeyDown,(e=>{""!==u.searchRef?.current&&" "===e.key||(gte.includes(e.key)&&b()," "===e.key&&e.preventDefault())}))})})})}));rne.displayName=ene;var one="SelectItemText",ine=i.forwardRef(((e,n)=>{const{__scopeSelect:r,className:o,style:s,...l}=e,c=Tte(one,r),u=Ute(one,r),d=nne(one,r),p=Ate(one,r),[f,h]=i.useState(null),m=cee(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 Iee((()=>(y(v),()=>b(v))),[y,b,v]),t.jsxs(t.Fragment,{children:[t.jsx(mee.span,{id:d.textId,...l,ref:m}),d.isSelected&&c.valueNode&&!c.valueNodeHasChildren?a.createPortal(l.children,c.valueNode):null]})}));ine.displayName=one;var ane="SelectItemIndicator",sne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return nne(ane,r).isSelected?t.jsx(mee.span,{"aria-hidden":!0,...o,ref:n}):null}));sne.displayName=ane;var lne="SelectScrollUpButton",cne=i.forwardRef(((e,n)=>{const r=Ute(lne,e.__scopeSelect),o=qte(lne,e.__scopeSelect),[a,s]=i.useState(!1),l=cee(n,o.onScrollButtonChange);return Iee((()=>{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(pne,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}));cne.displayName=lne;var une="SelectScrollDownButton",dne=i.forwardRef(((e,n)=>{const r=Ute(une,e.__scopeSelect),o=qte(une,e.__scopeSelect),[a,s]=i.useState(!1),l=cee(n,o.onScrollButtonChange);return Iee((()=>{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(pne,{...e,ref:l,onAutoScroll:()=>{const{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}));dne.displayName=une;var pne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,onAutoScroll:o,...a}=e,s=Ute("SelectScrollButton",r),l=i.useRef(null),c=bte(r),u=i.useCallback((()=>{null!==l.current&&(window.clearInterval(l.current),l.current=null)}),[]);return i.useEffect((()=>()=>u()),[u]),Iee((()=>{const e=c().find((e=>e.ref.current===document.activeElement));e?.ref.current?.scrollIntoView({block:"nearest"})}),[c]),t.jsx(mee.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:oee(a.onPointerDown,(()=>{null===l.current&&(l.current=window.setInterval(o,50))})),onPointerMove:oee(a.onPointerMove,(()=>{s.onItemLeave?.(),null===l.current&&(l.current=window.setInterval(o,50))})),onPointerLeave:oee(a.onPointerLeave,(()=>{u()}))})})),fne=i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e;return t.jsx(mee.div,{"aria-hidden":!0,...o,ref:n})}));fne.displayName="SelectSeparator";var hne="SelectArrow";i.forwardRef(((e,n)=>{const{__scopeSelect:r,...o}=e,i=Ste(r),a=Tte(hne,r),s=Ute(hne,r);return a.open&&"popper"===s.position?t.jsx(ute,{...i,...o,ref:n}):null})).displayName=hne;var mne=i.forwardRef((({__scopeSelect:e,value:n,...r},o)=>{const a=i.useRef(null),s=cee(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(mee.select,{...r,style:{...hte,...r.style},ref:s,defaultValue:n})}));function gne(e){return""===e||void 0===e}function vne(e){const t=gee(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 yne(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}mne.displayName="SelectBubbleInput";var bne=Ote,xne=jte,wne=Mte,_ne=Dte,Sne=Kte,Ene=Jte,Tne=rne,Cne=ine,Ane=sne,Nne=cne,Rne=dne,One=fne;const Pne=Nte,kne=Zte,jne=kte,Mne=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(bne,{ref:o,className:rp("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(xne,{asChild:!0,children:t.jsx(gu,{className:"h-4 w-4 opacity-50"})})]})));Mne.displayName=bne.displayName;const Lne=i.forwardRef((({className:e,...n},r)=>t.jsx(Nne,{ref:r,className:rp("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(bu,{className:"h-4 w-4"})})));Lne.displayName=Nne.displayName;const Dne=i.forwardRef((({className:e,...n},r)=>t.jsx(Rne,{ref:r,className:rp("flex cursor-default items-center justify-center py-1",e),...n,children:t.jsx(gu,{className:"h-4 w-4"})})));Dne.displayName=Rne.displayName;const Ine=i.forwardRef((({className:e,children:n,position:r="popper",...o},i)=>t.jsx(wne,{children:t.jsxs(_ne,{ref:i,className:rp("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(Lne,{}),t.jsx(Sne,{className:rp("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),t.jsx(Dne,{})]})})));Ine.displayName=_ne.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(Ene,{ref:r,className:rp("px-2 py-1.5 text-sm font-semibold text-muted-foreground",e),...n}))).displayName=Ene.displayName;const Fne=i.forwardRef((({className:e,children:n,...r},o)=>t.jsxs(Tne,{ref:o,className:rp("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(Ane,{children:t.jsx(mu,{className:"h-4 w-4"})})}),t.jsx(Cne,{children:n})]})));Fne.displayName=Tne.displayName;i.forwardRef((({className:e,...n},r)=>t.jsx(One,{ref:r,className:rp("-mx-1 my-1 h-px bg-muted",e),...n}))).displayName=One.displayName;const Une=({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"]})]}),$ne=({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(Une,{type:"email"})}),Vne=()=>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(IZ,{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(Fu,{}),selected:!0})})]})]}),Bne=({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"]})]}),zne=({containerRef:e,stripoDialogDimensions:r,showSaving:o})=>(n.useEffect((()=>{const t=t=>{const n=e.current;if(!n)return;const r=n.querySelector("ui-editor");if(!r)return;const o=r.shadowRoot;if(!o)return;const i=o.host.getBoundingClientRect();const a=function(e){for(;e;){const t=getComputedStyle(e);if(("auto"===t.overflowY||"scroll"===t.overflowY)&&e.scrollHeight>e.clientHeight)return e;e=e.parentElement}return null}(o.elementFromPoint(t.clientX-i.left,t.clientY-i.top))||o.firstElementChild;a&&(a.scrollTop+=t.deltaY,a.scrollLeft+=t.deltaX,t.preventDefault())},n=e.current;return n&&n.addEventListener("wheel",t,{passive:!1}),()=>{n&&n.removeEventListener("wheel",t)}}),[e]),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"}),o&&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(EZ,{textColor:"text-white",text:["Saving..."]})}),t.jsx("div",{id:"stripoEditorContainer",ref:e,style:{width:r.width-75,height:r.height-75},className:"z-10"})]})),Hne="UiEditorScript",qne=e=>new Promise(((t,n)=>{const r=()=>{let n=!0;e.updatedFromDefault&&(n=!1),window.UIEditor&&(window.UIEditor.initEditor(e.container,{forceRecreate:n,metadata:{emailId:e.emailId},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(Hne))r();else{const e=document.createElement("script");e.id=Hne,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)}})),Gne=({automation:e,setShowStripoEditor:r,saveClicked:o,setSaveClicked:i,stripoDialogDimensions:a,mergeFieldsResponse:s,cancelClicked:l,setCancelClicked:c,actionId:u})=>{const d=n.useRef(!1),p=n.useRef(null),{data:f,isLoading:h}=(e=>{const{automationId:t,actionId:n}=e;return ye({queryKey:eZ.templateForActionId(t,n),queryFn:()=>nZ({automationId:t,actionId:n}),...Se})})({automationId:e.id,actionId:u}),{data:m,isLoading:g}=(()=>{const e=ue();return{...ye({queryKey:eZ.editorData(),queryFn:tZ,...Se}),invalidateEditorData:()=>e.invalidateQueries({queryKey:eZ.editorData()})}})(),[v,y]=n.useState(!1),[b,x]=n.useState(!1),{updateCommunicationGroup:w}=iZ(),_=n.useCallback((()=>{i(!1),c(!1),y(!1),x(!1),r(!1)}),[i,c,y,x,r]);return n.useEffect((()=>{if(o&&window.UIEditor&&f?.communicationGroupId&&window.StripoEditorApi?.actionsApi){window.StripoEditorApi.actionsApi.compileEmail({callback:function(e,t){e||(w({groupId:f.communicationGroupId,params:{emailHtmlBody:t}}),x(!0))},minimize:!0,mergeTags:[],forceAmp:!1,resetDataSavedFlag:!1,disableLineHeightsReplace:!0});window.StripoEditorApi.actionsApi.save((function(e){e||y(!0)}))}}),[o,p,i,r,f,w]),n.useEffect((()=>{(async()=>{v&&b&&(window.UIEditor&&window.UIEditor.removeEditor(),_())})()}),[v,b,r,i,_]),n.useEffect((()=>{l&&(window.UIEditor&&window.UIEditor.removeEditor(),_())}),[l,_]),n.useEffect((()=>{m?.businessId&&p.current&&f&&(d.current||(qne({emailId:f.communicationGroupId,html:f.html||"<div></div>",css:f.css||"",container:p.current,businessId:m.businessId,mergeFields:s.mergeFields||[],updatedFromDefault:f.updatedFromDefault}).catch((e=>{})),d.current=!0))}),[m,s,f]),t.jsx("div",h||g||!m||!f?{className:"w-full h-full flex flex-col items-center justify-center",children:t.jsx(EZ,{text:["Loading editor..."]})}:{className:"w-full h-full flex flex-col",children:t.jsx(zne,{containerRef:p,stripoDialogDimensions:a,showSaving:o})})},Kne=({mergeFieldsResponse:e})=>{const r=xZ(),o=bZ(),{updateCommunicationGroup:i}=iZ(),{refetchAutomation:a}=je(o?.id||""),{channelSenders:s}=V7(),{channelAccounts:l}=U7(),{state:{selectedActionId:c}}=n.useContext(XX),{state:{replyToSettingsText:u,replyToSettingsLink:d,fromNameSettingsText:p,fromNameSettingsLink:f}}=n.useContext(l$),[h,m]=n.useState(!1),[g,v]=n.useState(r?.emailChannelSenderId||null),[y,b]=n.useState(r?.emailSubject||null),[x,w]=n.useState(r?.emailPreviewText||null),[_,S]=n.useState(r?.emailHtmlBody||null),[E,T]=n.useState(!1),[C,A]=n.useState(!1),[N,R]=n.useState(!1),[O,P]=n.useState(""),[k,j]=n.useState(""),[M,L]=n.useState(!1),D=n.useRef(!0),[I,F]=n.useState(!0),[U,$]=n.useState(!1),[V,B]=n.useState({width:0,height:0}),z=q7(y,500),H=q7(x,500),q=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===$7.REACH_MANAGED?[{channelSenderId:e.id,fullDomain:`${e.channelSenderMetadata.userPart}@${e.channelSenderMetadata.baseDomain}`}]:[]}))||[]),[s?.results,l?.results]),G=n.useMemo((()=>({width:800,height:400})),[]),K=n.useRef(null);return n.useEffect((()=>{const e=setTimeout((()=>{D.current=!1}),500);return()=>clearTimeout(e)}),[]),n.useEffect((()=>{r?.emailHtmlBody&&S(r.emailHtmlBody)}),[r?.emailHtmlBody,a]),n.useEffect((()=>{if(h){const e=setTimeout((()=>{m(!1)}),2e3);return()=>clearTimeout(e)}}),[h]),n.useEffect((()=>{const e=()=>{B({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),n.useEffect((()=>{if(!D.current&&g&&z&&_&&r?.id){m(!0);(async()=>{try{i({groupId:r.id,params:{emailChannelSenderId:g,emailHtmlBody:_,emailSubject:z,...H&&{emailPreviewText:H}}})}catch(e){}finally{m(!1)}})()}}),[g,z,H,_,r?.id,i]),n.useEffect((()=>{if(s?.results&&g){const e=s.results.find((e=>e.id===g));e&&(U&&!I||j(e.channelSenderMetadata.emailReplyTo),I&&P(e.channelSenderMetadata.emailFromName),F(!1))}}),[s?.results,g,U,I]),n.useEffect((()=>{if(s?.results&&!g){const e=s.results.filter((e=>e.channelSenderMetadata.userPart));if(e[0]){const t=e[0];v(t.id),i({groupId:r?.id||"",params:{emailChannelSenderId:t.id}})}}}),[s?.results,g,r?.id,i]),n.useEffect((()=>{!1===E&&r?.id&&a()}),[E,r?.id,a]),l&&s&&c?t.jsxs("div",{className:"relative",children:[t.jsx(PB,{open:M,onOpenChange:L,children:t.jsxs(MB,{className:"max-h-[86vh] gap-0 overflow-visible max-w-3xl w-full h-full",children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Email Preview Help"}),t.jsx(FB,{children:"Learn more about the email preview and how to use it to create your email."})]}),t.jsx(Vne,{})]})}),t.jsx(PB,{open:E,onOpenChange:T,children:t.jsxs(MB,{className:"min-w-[100vw] min-h-[100vh]",hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault()},children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Email Editor"}),t.jsx(FB,{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(MZ,{size:"sm",onClick:()=>L(!0),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"font-medium text-sm",children:"Help"}),t.jsx(FZ.InfoIcon,{className:"w-4 h-4"})]})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(MZ,{variant:"destructive",onClick:()=>{R(!0)},className:"text-sm px-3 py-1 rounded",children:"Cancel"}),t.jsx(MZ,{onClick:()=>A(!0),className:"text-sm px-3 py-1 rounded",children:"Save"})]})]}),t.jsx("div",{className:" w-full",children:o&&t.jsx(Gne,{cancelClicked:N,setCancelClicked:R,showStripoEditor:E,automation:o,setShowStripoEditor:T,saveClicked:C,setSaveClicked:A,stripoDialogDimensions:V,mergeFieldsResponse:e,actionId:c})})]})]})}),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(nee,{className:"text-foreground",children:"From Email"}),t.jsxs(Pne,{onValueChange:e=>{v(e),F(!0),$(!1)},value:g??void 0,disabled:h,children:[t.jsx(Mne,{children:t.jsx(jne,{placeholder:"Select email",className:"text-muted-foreground",children:g?q?.find((e=>e.channelSenderId===g))?.fullDomain:""})}),t.jsx(Ine,{children:q?.map((e=>t.jsx(Fne,{value:e.channelSenderId,children:e.fullDomain},e.channelSenderId)))})]})]}),t.jsxs("div",{children:[t.jsx(nee,{children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["From Name",t.jsx(G7,{title:p||"From name can be configured under settings in the home screen",onClick:()=>{f&&window.open(f,"_blank")}})]})}),t.jsx(s5,{value:O??"",className:"text-muted-foreground",disabled:!0})]}),t.jsxs("div",{children:[t.jsx(nee,{children:t.jsxs("div",{className:"flex items-center gap-2 py-1",children:["Reply To Email",t.jsx(G7,{title:u||"Reply to email can be configured under settings in the home screen",onClick:()=>{d&&window.open(d,"_blank")}})]})}),t.jsx(s5,{value:k??(g?q?.find((e=>e.channelSenderId===g))?.fullDomain:""),className:"text-muted-foreground",disabled:!0})]}),t.jsxs("div",{children:[t.jsx(nee,{className:"text-foreground",children:"Subject"}),t.jsx(s5,{placeholder:"Enter email subject",className:"text-muted-foreground",value:y??"",onChange:e=>b(e.target.value),disabled:h||I})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 py-1",children:[t.jsx(nee,{className:"text-foreground",children:"Preview Text"}),t.jsx(G7,{title:"This text will be used for the preview text of the email in the inbox"})]}),t.jsx(s5,{placeholder:"Enter preview text",className:"text-muted-foreground",value:x??"",onChange:e=>w(e.target.value),disabled:h||I})]})]}),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(MZ,{onClick:()=>T(!0),className:"text-sm px-3 py-1 rounded",disabled:h||0===(q?.length??0),children:"Edit"}),0===(q?.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(Bne,{type:"email"})})})]})]}),t.jsx("div",{className:"flex-1 w-full overflow-auto",ref:K,style:{height:"400px"},children:t.jsx($ne,{html:_??"",height:G.height,width:G.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(EZ,{text:["Fetching Email Preview..."]})})};function Wne(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])}var Yne="Checkbox",[Xne,Zne]=nJ(Yne),[Qne,Jne]=Xne(Yne),ere=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=NZ(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=iJ({prop:a,defaultProp:s,onChange:d}),w=i.useRef(b);return i.useEffect((()=>{const e=h?.form;if(e){const t=()=>x(w.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}}),[h,x]),t.jsxs(Qne,{scope:r,state:b,disabled:c,children:[t.jsx(dJ.button,{type:"button",role:"checkbox","aria-checked":ore(b)?"mixed":b,"aria-required":l,"data-state":ire(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onKeyDown:tJ(e.onKeyDown,(e=>{"Enter"===e.key&&e.preventDefault()})),onClick:tJ(e.onClick,(e=>{x((e=>!!ore(e)||!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(rre,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:!ore(s)&&s})]})}));ere.displayName=Yne;var tre="CheckboxIndicator",nre=i.forwardRef(((e,n)=>{const{__scopeCheckbox:r,forceMount:o,...i}=e,a=Jne(tre,r);return t.jsx(V1,{present:o||ore(a.state)||!0===a.state,children:t.jsx(dJ.span,{"data-state":ire(a.state),"data-disabled":a.disabled?"":void 0,...i,ref:n,style:{pointerEvents:"none",...e.style}})})}));nre.displayName=tre;var rre=e=>{const{control:n,checked:r,bubbles:o=!0,defaultChecked:a,...s}=e,l=i.useRef(null),c=Wne(r),u=v1(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=ore(r),n.call(e,!ore(r)&&r),e.dispatchEvent(t)}}),[c,r,o]);const d=i.useRef(!ore(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 ore(e){return"indeterminate"===e}function ire(e){return ore(e)?"indeterminate":e?"checked":"unchecked"}var are=ere,sre=nre;const lre=({selectedChannels:e,setSelectedChannels:n,hasEmailChannelSenders:r,hasSmsChannelSenders:o,automationType:i})=>{const{toast:a}=Il(),s=[...r?[{label:"Email",value:"email",icon:FZ.EmailIcon,checked:e.includes("email")}]:[],...o?[{label:"SMS",value:"sms",icon:FZ.SmsIcon,checked:e.includes("sms")}]:[]];return t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-xl font-medium text-foreground",children:"Message Types"}),t.jsx("p",{className:"text-muted-foreground 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:s.map((r=>t.jsxs(are,{checked:r.checked,onCheckedChange:()=>{"email"===r.value?e.includes("email")?e.includes("sms")?n(["sms"]):a({title:"Cant Remove Email",description:`At least one channel is required for an ${i===Ue.ONE_TIME?bf("engage:broadcast").toLowerCase():bf("engage:automation").toLowerCase()}`,variant:"destructive"}):n([...e,"email"]):e.includes("sms")?e.includes("email")?n(["email"]):a({title:"Cant Remove SMS",description:`At least one channel is required for an ${i===Ue.ONE_TIME?bf("engage:broadcast").toLowerCase():bf("engage:automation").toLowerCase()}`,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]:font-medium",children:[t.jsx(r.icon,{className:"mb-3",size:20}),t.jsx("span",{className:"font-medium tracking-tight",children:r.label}),t.jsx(sre,{className:"absolute top-2 right-2",children:t.jsx(Su,{className:"fill-primary text-primary-foreground"})})]},r.value)))})]})},cre=async()=>(await Oe(s)).data,ure=["me"],dre=()=>ye({queryKey:ure,queryFn:cre,...Se}),pre=()=>{const e=ue(),t=dre(),n=be({mutationFn:e=>(async e=>(await Oe(s,{method:"PATCH",body:JSON.stringify({website:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:ure})}}),r=be({mutationFn:e=>(async e=>(await Oe(s,{method:"PATCH",body:JSON.stringify({locations:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:ure})}}),o=be({mutationFn:e=>(async e=>(await Oe(s,{method:"PATCH",body:JSON.stringify({branding:e})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:ure})}});return{data:t.data,isLoading:t.isLoading,error:t.error,refetch:t.refetch,updateWebsite:n.mutate,updateLocations:r.mutate,updateBrandSettings:o.mutate,isUpdatingWebsite:n.isPending,isUpdatingLocations:r.isPending,isUpdatingBrandSettings:o.isPending}},fre="undefined"!=typeof window&&"undefined"!=typeof document;var hre=.999,mre=/[\\\/_+.#"@\[\(\{&]/,gre=/[\\\/_+.#"@\[\(\{&]/g,vre=/[\s-]/,yre=/[\s-]/g;function bre(e,t,n,r,o,i,a){if(i===t.length)return o===e.length?1:.99;var s=`${o},${i}`;if(void 0!==a[s])return a[s];for(var l,c,u,d,p=r.charAt(i),f=n.indexOf(p,o),h=0;f>=0;)(l=bre(e,t,n,r,f+1,i+1,a))>h&&(f===o?l*=1:mre.test(e.charAt(f-1))?(l*=.8,(u=e.slice(o,f-1).match(gre))&&o>0&&(l*=Math.pow(hre,u.length))):vre.test(e.charAt(f-1))?(l*=.9,(d=e.slice(o,f-1).match(yre))&&o>0&&(l*=Math.pow(hre,d.length))):(l*=.17,o>0&&(l*=Math.pow(hre,f-o))),e.charAt(f)!==t.charAt(i)&&(l*=.9999)),(l<.1&&n.charAt(f-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(f-1)!==r.charAt(i))&&(.1*(c=bre(e,t,n,r,f+1,i+2,a))>l&&(l=.1*c)),l>h&&(h=l),f=n.indexOf(p,f+1);return a[s]=h,h}function xre(e){return e.toLowerCase().replace(yre," ")}function wre(e,t,n){return bre(e=n&&n.length>0?""+(e+" "+n.join(" ")):e,t,xre(e),xre(t),0,0,{})}function _re(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Sre(...e){return t=>{let n=!1;const r=e.map((e=>{const r=_re(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():_re(e[t],null)}}}}function Ere(e){const n=Tre(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(Are);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 Tre(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)=>{const t=i(...e);return o(...e),t}: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?Sre(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 Cre=Symbol("radix.slottable");function Are(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Cre}var Nre=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=Ere(`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}}),{}),Rre='[cmdk-group=""]',Ore='[cmdk-group-items=""]',Pre='[cmdk-item=""]',kre=`${Pre}:not([aria-disabled="true"])`,jre="cmdk-item-select",Mre="data-value",Lre=(e,t,n)=>wre(e,t,n),Dre=i.createContext(void 0),Ire=()=>i.useContext(Dre),Fre=i.createContext(void 0),Ure=()=>i.useContext(Fre),$re=i.createContext(void 0),Vre=i.forwardRef(((e,t)=>{let n=toe((()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}})),r=toe((()=>new Set)),o=toe((()=>new Map)),a=toe((()=>new Map)),s=toe((()=>new Set)),l=Jre(e),{label:c,children:u,value:d,onValueChange:p,filter:f,shouldFilter:h,loop:m,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=$J(),x=$J(),w=$J(),_=i.useRef(null),S=ooe();eoe((()=>{if(void 0!==d){let e=d.trim();n.current.value=e,E.emit()}}),[d]),eoe((()=>{S(6,O)}),[]);let E=i.useMemo((()=>({subscribe:e=>(s.current.add(e),()=>s.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var o,i,a,s;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)R(),A(),S(1,N);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(o=document.getElementById(b))||o.focus()}if(S(7,(()=>{var e;n.current.selectedItemId=null==(e=P())?void 0:e.id,E.emit()})),r||S(5,O),void 0!==(null==(i=l.current)?void 0:i.value)){return void(null==(s=(a=l.current).onValueChange)||s.call(a,null!=t?t:""))}}E.emit()}},emit:()=>{s.current.forEach((e=>e()))}})),[]),T=i.useMemo((()=>({value:(e,t,r)=>{var o;t!==(null==(o=a.current.get(e))?void 0:o.value)&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),S(2,(()=>{A(),E.emit()})))},item:(e,t)=>(r.current.add(e),t&&(o.current.has(t)?o.current.get(t).add(e):o.current.set(t,new Set([e]))),S(3,(()=>{R(),A(),n.current.value||N(),E.emit()})),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();S(4,(()=>{R(),(null==t?void 0:t.getAttribute("id"))===e&&N(),E.emit()}))}),group:e=>(o.current.has(e)||o.current.set(e,new Set),()=>{a.current.delete(e),o.current.delete(e)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:w,labelId:x,listInnerRef:_})),[]);function C(e,t){var r,o;let i=null!=(o=null==(r=l.current)?void 0:r.filter)?o:Lre;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(Ore);t?t.appendChild(e.parentElement===t?e:e.closest(`${Ore} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Ore} > *`))})),t.sort(((e,t)=>t[1]-e[1])).forEach((e=>{var t;let n=null==(t=_.current)?void 0:t.querySelector(`${Rre}[${Mre}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)}))}function N(){let e=k().find((e=>"true"!==e.getAttribute("aria-disabled"))),t=null==e?void 0:e.getAttribute(Mre);E.setState("value",t||void 0)}function R(){var e,t,i,s;if(!n.current.search||!1===l.current.shouldFilter)return void(n.current.filtered.count=r.current.size);n.current.filtered.groups=new Set;let c=0;for(let o of r.current){let r=C(null!=(t=null==(e=a.current.get(o))?void 0:e.value)?t:"",null!=(s=null==(i=a.current.get(o))?void 0:i.keywords)?s:[]);n.current.filtered.items.set(o,r),r>0&&c++}for(let[r,a]of o.current)for(let e of a)if(n.current.filtered.items.get(e)>0){n.current.filtered.groups.add(r);break}n.current.filtered.count=c}function O(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(Rre))?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(`${Pre}[aria-selected="true"]`)}function k(){var e;return Array.from((null==(e=_.current)?void 0:e.querySelectorAll(kre))||[])}function j(e){let t=k()[e];t&&E.setState("value",t.getAttribute(Mre))}function M(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(Mre))}function L(e){let t,n=P(),r=null==n?void 0:n.closest(Rre);for(;r&&!t;)r=e>0?Zre(r,Rre):Qre(r,Rre),t=null==r?void 0:r.querySelector(kre);t?E.setState("value",t.getAttribute(Mre)):M(e)}let D=()=>j(k().length-1),I=e=>{e.preventDefault(),e.metaKey?D():e.altKey?L(1):M(1)},F=e=>{e.preventDefault(),e.metaKey?j(0):e.altKey?L(-1):M(-1)};return i.createElement(Nre.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=y.onKeyDown)||t.call(y,e),!e.defaultPrevented&&!(e.nativeEvent.isComposing||229===e.keyCode))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(),j(0);break;case"End":e.preventDefault(),D();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(jre);t.dispatchEvent(e)}}}}},i.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:aoe},c),ioe(e,(e=>i.createElement(Fre.Provider,{value:E},i.createElement(Dre.Provider,{value:T},e)))))})),Bre=i.forwardRef(((e,t)=>{var n,r;let o=$J(),a=i.useRef(null),s=i.useContext($re),l=Ire(),c=Jre(e),u=null!=(r=null==(n=c.current)?void 0:n.forceMount)?r:null==s?void 0:s.forceMount;eoe((()=>{if(!u)return l.item(o,null==s?void 0:s.id)}),[u]);let d=roe(o,a,[e.value,e.children,a],e.keywords),p=Ure(),f=noe((e=>e.value&&e.value===d.current)),h=noe((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(jre,m),()=>t.removeEventListener(jre,m)}),[h,e.onSelect,e.disabled]),!h)return null;let{disabled:v,value:y,onSelect:b,forceMount:x,keywords:w,..._}=e;return i.createElement(Nre.div,{ref:Sre(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)})),zre=i.forwardRef(((e,t)=>{let{heading:n,children:r,forceMount:o,...a}=e,s=$J(),l=i.useRef(null),c=i.useRef(null),u=$J(),d=Ire(),p=noe((e=>!(!o&&!1!==d.filter())||(!e.search||e.filtered.groups.has(s))));eoe((()=>d.group(s)),[]),roe(s,l,[e.value,e.heading,c]);let f=i.useMemo((()=>({id:s,forceMount:o})),[o]);return i.createElement(Nre.div,{ref:Sre(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),ioe(e,(e=>i.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},i.createElement($re.Provider,{value:f},e)))))})),Hre=i.forwardRef(((e,t)=>{let{alwaysRender:n,...r}=e,o=i.useRef(null),a=noe((e=>!e.search));return n||a?i.createElement(Nre.div,{ref:Sre(o,t),...r,"cmdk-separator":"",role:"separator"}):null})),qre=i.forwardRef(((e,t)=>{let{onValueChange:n,...r}=e,o=null!=e.value,a=Ure(),s=noe((e=>e.search)),l=noe((e=>e.selectedItemId)),c=Ire();return i.useEffect((()=>{null!=e.value&&a.setState("search",e.value)}),[e.value]),i.createElement(Nre.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":l,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)}})})),Gre=i.forwardRef(((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,a=i.useRef(null),s=i.useRef(null),l=noe((e=>e.selectedItemId)),c=Ire();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(Nre.div,{ref:Sre(a,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},ioe(e,(e=>i.createElement("div",{ref:Sre(s,c.listInnerRef),"cmdk-list-sizer":""},e))))})),Kre=i.forwardRef(((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:a,container:s,...l}=e;return i.createElement(SB,{open:n,onOpenChange:r},i.createElement(EB,{container:s},i.createElement(TB,{"cmdk-overlay":"",className:o}),i.createElement(CB,{"aria-label":e.label,"cmdk-dialog":"",className:a},i.createElement(Vre,{ref:t,...l}))))})),Wre=i.forwardRef(((e,t)=>noe((e=>0===e.filtered.count))?i.createElement(Nre.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null)),Yre=i.forwardRef(((e,t)=>{let{progress:n,children:r,label:o="Loading...",...a}=e;return i.createElement(Nre.div,{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},ioe(e,(e=>i.createElement("div",{"aria-hidden":!0},e))))})),Xre=Object.assign(Vre,{List:Gre,Item:Bre,Input:qre,Group:zre,Separator:Hre,Dialog:Kre,Empty:Wre,Loading:Yre});function Zre(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Qre(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Jre(e){let t=i.useRef(e);return eoe((()=>{t.current=e})),t}var eoe="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function toe(e){let t=i.useRef();return void 0===t.current&&(t.current=e()),t}function noe(e){let t=Ure(),n=()=>e(t.snapshot());return i.useSyncExternalStore(t.subscribe,n,n)}function roe(e,t,n,r=[]){let o=i.useRef(),a=Ire();return eoe((()=>{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(Mre,s),o.current=s})),o}var ooe=()=>{let[e,t]=i.useState(),n=toe((()=>new Map));return eoe((()=>{n.current.forEach((e=>e())),n.current=new Map}),[e]),(e,r)=>{n.current.set(e,r),t({})}};function ioe({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 aoe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const soe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre,{ref:r,className:rp("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...n})));soe.displayName=Xre.displayName;const loe=i.forwardRef((({className:e,searchIcon:n,...r},o)=>t.jsxs("div",{className:"flex items-center border-b px-3",children:[n||t.jsx(Wu,{className:"mr-2 h-4 w-4 shrink-0 opacity-50 "}),t.jsx(Xre.Input,{ref:o,className:rp("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})]})));loe.displayName=Xre.Input.displayName;const coe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre.List,{ref:r,className:rp("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...n})));coe.displayName=Xre.List.displayName;const uoe=i.forwardRef(((e,n)=>t.jsx(Xre.Empty,{ref:n,className:"py-6 text-center text-sm",...e})));uoe.displayName=Xre.Empty.displayName;const doe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre.Group,{ref:r,className:rp("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})));doe.displayName=Xre.Group.displayName;const poe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre.Separator,{ref:r,className:rp("-mx-1 h-px bg-border",e),...n})));poe.displayName=Xre.Separator.displayName;const foe=i.forwardRef((({className:e,...n},r)=>t.jsx(Xre.Item,{ref:r,className:rp("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})));foe.displayName=Xre.Item.displayName;const hoe=i.forwardRef((({className:e,...n},r)=>t.jsx("textarea",{className:rp("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n})));hoe.displayName="Textarea";const moe=e=>{const{companyName:t,smsBody:n}=e;return t&&n?`${t}:\n${n}`:n??""},goe=({body:e,imageUrls:n})=>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.jsxs("div",{className:"sms-phone-inner",children:[n&&n.length>0&&n.map(((e,n)=>t.jsx("div",{className:"sms-message-row",children:t.jsx("div",{className:"sms-message-bubble",children:t.jsx("img",{src:e,alt:"MMS attachment",className:"sms-message-image",loading:"lazy"})})},e+n))),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"})]})}),voe=({mergeFieldsResponse:e,smsChannelSenders:r})=>{const o=bZ(),i=xZ(),a=n.useCallback((()=>{const e=o?.actionData?.find((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId===i?.id));return e?.actionMetadata.communicationGroupId}),[o?.actionData,i?.id]),{channelSenders:s}=V7(),{data:l,isLoading:c}=dre(),{channelAccounts:u}=U7(),{toast:d}=Il(),{updateCommunicationGroup:p,isUpdating:f}=iZ(),[h,m]=n.useState(null),[g,v]=n.useState(!1),[y,b]=n.useState(null),[x,w]=n.useState(null),[_,S]=n.useState([]),[E,T]=n.useState(null),[C,A]=n.useState(!1),[N,R]=n.useState(!1),O=n.useRef(null),P=n.useRef(null),[k,j]=n.useState(null),[M,L]=n.useState(null),[D,I]=n.useState(!1);n.useEffect((()=>{C&&(T(x),_.length>0&&!k&&!D&&j(_[0]))}),[C,x,_,k,D]),n.useEffect((()=>{C||(j(_.length>0?_[0]:null),L(null),I(!1))}),[C,_]);n.useEffect((()=>{i&&(m(i.smsChannelSenderId),w(i.smsMessageBody),i.textMessageCompanyName&&b(i.textMessageCompanyName),i.textMessageMediaUrls&&S(i.textMessageMediaUrls))}),[i]);n.useEffect((()=>{if(void 0!==s&&!h){const e=H7({channelSenders:s?.results??[]});e?.[0]&&(m(e[0].id),i?.id&&p({groupId:i.id,params:{smsChannelSenderId:e[0].id}}))}}),[s,h,i?.id,p]),n.useEffect((()=>{y||!l?.name||g||(v(!0),b(l.name))}),[y,l?.name,g]);return u&&s&&!c?t.jsxs("div",{children:[t.jsx(PB,{open:C,onOpenChange:A,children:t.jsxs(MB,{hideCloseButton:!0,className:"max-w-[50vw]",children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"SMS Editor"}),t.jsx(FB,{children:"Learn more about the SMS editor and how to use it to create your SMS."})]}),t.jsxs("div",{className:"",children:[k&&t.jsx("div",{className:"flex justify-center mb-6",children:t.jsxs("div",{className:"relative group w-fit",children:[t.jsx("img",{src:k,alt:"SMS attachment preview",className:"max-h-48 max-w-xs rounded-xl shadow-lg border border-gray-200 object-contain bg-white transition-transform duration-200 group-hover:scale-105",style:{boxShadow:"0 4px 24px 0 rgba(0,0,0,0.08)"}}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"absolute -top-3 -right-3 bg-white/80 hover:bg-red-100 text-gray-500 hover:text-red-500 shadow-md border border-gray-200 rounded-full opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{j(null),L(null),I(!0)},style:{boxShadow:"0 2px 8px 0 rgba(0,0,0,0.10)"},children:t.jsx(cd,{className:"h-4 w-4"})})]})}),t.jsx(hoe,{ref:O,className:"min-h-[300px]",placeholder:"Text message content...",value:E??"",onChange:e=>{T(e.target.value)},maxLength:1600-(y?.length||0)}),t.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(v9,{modal:!0,open:N,onOpenChange:R,children:[t.jsx(y9,{asChild:!0,children:t.jsx(MZ,{variant:"outline",role:"combobox",className:"w-[50px] justify-center",children:t.jsx(FZ.MergeField,{className:"w-4 h-4 text-primary"})})}),t.jsx(b9,{className:"w-[300px] p-0",align:"start",children:t.jsxs(soe,{children:[t.jsx(loe,{placeholder:"Search merge fields..."}),t.jsxs(coe,{children:[t.jsx(uoe,{children:"No merge fields found."}),e?.mergeFields?.map((e=>t.jsx(doe,{heading:e.category,children:e.entries.map((e=>t.jsx(foe,{onSelect:()=>{const t=O.current,n=E||"",r=t?.selectionStart??n.length,o=t?.selectionEnd??n.length,i=n.slice(0,r)+e.value+n.slice(o);T(i),R(!1),setTimeout((()=>{const n=r+e.value.length;t?.focus(),t?.setSelectionRange(n,n)}),0)},children:e.label},e.value)))},e.category)))]})]})})]}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Merge Fields"}),t.jsx(G7,{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 gap-2",children:[t.jsx("input",{type:"file",ref:P,onChange:async e=>{const t=e.target.files?.[0];if(t){const e=new FileReader;e.onloadend=async()=>{try{const t=await async function(e){if(!fre)throw new Error("Image conversion is only supported in browser environments");return new Promise(((t,n)=>{try{const r=new window.Image;r.crossOrigin="anonymous",r.onload=()=>{try{const e=document.createElement("canvas");e.width=r.naturalWidth,e.height=r.naturalHeight;const o=e.getContext("2d");if(!o)return void n(new Error("Failed to get canvas context"));o.drawImage(r,0,0);const i=e.toDataURL("image/png",1);t(i)}catch(e){n(e)}},r.onerror=()=>{n(new Error("Failed to load image"))},r.src=e}catch(r){n(r)}}))}(e.result),n=function(e){const t=e.match(/^data:([A-Za-z-+/]+);base64,(.+)$/);if(!t||3!==t.length)throw new Error("Invalid data URL format");return t[2]}(t);L(n),j(t),I(!1)}catch(t){d({title:"Error converting image",description:"Failed to convert image to PNG format",variant:"destructive"})}},e.readAsDataURL(t)}},accept:"image/*",className:"hidden"}),t.jsx(MZ,{variant:"outline",onClick:()=>{P.current?.click()},className:"px-4",disabled:_.length>=1||D||null!==M,children:"Add Image"}),t.jsx(MZ,{variant:"outline",onClick:()=>{T(x),A(!1),j(_.length>0?_[0]:null),L(null),I(!1)},className:"px-4",children:"Cancel"}),t.jsx(MZ,{onClick:()=>{w(E);const e=a();e&&p({groupId:e,params:{smsChannelSenderId:h,smsMessageBody:E,textMessageCompanyName:y,textMessageMedia:M?[M]:D?[]:void 0}},{onSuccess:()=>{A(!1),j(null),L(null),I(!1)},onError:()=>{d({title:"Error updating SMS",description:"Please contact your administrator"})}})},className:"px-4",disabled:f,children:"Save Changes"})]})]}),t.jsxs("div",{className:"flex justify-end mt-2 text-sm transition-colors duration-300 "+(E&&E.length>1400?E.length>=1600?"text-red-500":"text-amber-500":"text-gray-500"),children:[E?E.length:0,"/",1600-(y?.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(nee,{className:"text-foreground",children:"From Number"}),t.jsxs(Pne,{onValueChange:e=>{m(e)},value:h??void 0,children:[t.jsx(Mne,{children:t.jsx(jne,{placeholder:"Select number",children:h?(F=h,r?.find((e=>e.id===F))?.channelSenderMetadata.friendlyName??r?.find((e=>e.id===F))?.channelSenderMetadata.from??F):"Select number"})}),t.jsx(Ine,{children:r?.map((e=>t.jsx(Fne,{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(nee,{className:"text-foreground",children:"Company Name"}),t.jsx(G7,{title:"Adding your company name can help customers identify who they are talking to"})]}),t.jsx(s5,{placeholder:"Enter company name",value:y??"",className:"text-muted-foreground",onChange:e=>{b(e.target.value??null)},disabled:!h})]})]}),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(MZ,{onClick:()=>A(!0),className:"text-sm px-3 py-1 rounded ",disabled:0===(r?.length??0),children:"Edit"})})]}),t.jsx("div",{children:h?t.jsx(t.Fragment,{children:h&&x?t.jsx(goe,{body:moe({companyName:y??void 0,smsBody:x}),imageUrls:_}):t.jsx(Une,{type:"sms"})}):t.jsx(Bne,{type:"sms"})})]})]})]}):t.jsx("div",{children:t.jsx(EZ,{text:["Loading..."]})});var F};var yoe=(e=>(e.CUSTOM="custom",e.MANAGED="managed",e))(yoe||{}),boe=(e=>(e.EditAudience="edit-audience",e.EditTime="edit-time",e))(boe||{});const xoe=({title:e,type:r})=>{const o=xZ(),i=bZ(),{toast:a}=Il(),[s,l]=n.useState(!1),{resetCommunicationGroupToDefault:c,isPending:u}=sZ(),d=!!o&&(o.type===yoe.MANAGED&&("sms"===r?o.updatedFromDefault?.text_message_body:o.updatedFromDefault?.email_text_body||o.updatedFromDefault?.email_html_body));return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h4",{className:"text-xl font-medium text-foreground",children:e}),t.jsx("div",{className:"flex items-center gap-2",children:d&&t.jsx(t.Fragment,{children:u?t.jsx(EZ,{}):t.jsx(MZ,{variant:"outline",size:"sm",onClick:()=>l(!0),children:"Reset To Default"})})})]}),t.jsx(PB,{open:s,onOpenChange:l,children:t.jsxs(MB,{className:"sm:max-w-[425px]",children:[t.jsxs(LB,{children:[t.jsx(IB,{className:"text-xl font-semibold",children:"Reset to Default"}),t.jsxs(FB,{className:"text-base text-muted-foreground",children:["Are you sure you want to reset this"," ","email"===r?"email":"SMS"," template to its default state? This action cannot be undone."]})]}),t.jsxs(DB,{className:"flex flex-row justify-end gap-3 mt-6",children:[t.jsx(MZ,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),t.jsx(MZ,{variant:"destructive",onClick:async()=>{o&&i?c({communicationGroupId:o.id,automationId:i.id,type:r},{onSuccess:()=>{a({title:"Communication reset to default!"}),l(!1)},onSettled:()=>{l(!1)},onError:()=>{a({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})}}):a({title:"Error resetting communication",description:"Please contact your administrator",variant:"destructive"})},children:"Reset to Default"})]})]})})]})},woe=({getExtraMergeFields:e})=>{const[r,o]=n.useState(null),i=n.useRef(null),{toast:a}=Il(),s=xZ(),{channelSenders:l}=V7(),{channelAccounts:c}=U7(),{updateCommunicationGroup:u}=iZ(),d=bZ(),{getMergeFields:p,isGetting:f}=(e=>{const t=ye({queryKey:["merge-fields",e],queryFn:()=>JX(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 JX(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"})}}))})):m(p))}),[e,u,s,a,f,p,h,g]);const v=n.useMemo((()=>z7({channelSenders:l?.results??[],channelAccounts:c?.results??[]})),[l?.results,c?.results]),y=n.useMemo((()=>H7({channelSenders:l?.results??[]})),[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(EZ,{text:["Fetching Content..."]})});const b=v.length>0,x=y.length>0;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(lre,{automationType:d?.triggerMetadata?.triggerType,selectedChannels:r,setSelectedChannels:o,hasEmailChannelSenders:b,hasSmsChannelSenders:x})}),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(xoe,{title:"Email Campaign",type:"email"}),t.jsx(Kne,{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(xoe,{title:"SMS Campaign",type:"sms"}),t.jsx(voe,{mergeFieldsResponse:h,smsChannelSenders:y})]})]})},_oe=({content:e,className:n})=>t.jsx("div",{className:OB("flex flex-col gap-4 w-full p-6",n),children:t.jsx("div",{className:"bg-white rounded-2xl w-full border border-gray-200 p-6 relative",children:e})}),Soe=e=>e.friendlyName||e.from||e.messageServiceSid||"Unknown Sender";function Eoe(e,t){throw new Error(`Unreachable case statement: ${JSON.stringify(e)}. Valid values are: ${Object.values(t).join(", ")}`)}function Toe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function Coe(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}\``)}]},Aoe(o,...n)]}function Aoe(...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 Noe(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Roe(...e){return t=>{let n=!1;const r=e.map((e=>{const r=Noe(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():Noe(e[t],null)}}}}function Ooe(...e){return i.useCallback(Roe(...e),e)}function Poe(e){const n=koe(e),r=i.forwardRef(((e,r)=>{const{children:o,...a}=e,s=i.Children.toArray(o),l=s.find(Moe);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 koe(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?Roe(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 joe=Symbol("radix.slottable");function Moe(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===joe}var Loe=globalThis?.document?i.useLayoutEffect:()=>{},Doe=i[" useId ".trim().toString()]||(()=>{}),Ioe=0;function Foe(e){const[t,n]=i.useState(Doe());return Loe((()=>{n((e=>e??String(Ioe++)))}),[e]),e||(t?`radix-${t}`:"")}var Uoe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce(((e,n)=>{const r=Poe(`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 $oe=i[" useInsertionEffect ".trim().toString()]||Loe;function Voe({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 $oe((()=>{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 Boe=i.createContext(void 0);function zoe(e){const t=i.useContext(Boe);return e||t||"ltr"}var Hoe="rovingFocusGroup.onEntryFocus",qoe={bubbles:!1,cancelable:!0},Goe="RovingFocusGroup",[Koe,Woe,Yoe]=function(e){const r=e+"CollectionProvider",[o,i]=Coe(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=Poe(c),d=n.forwardRef(((e,n)=>{const{scope:r,children:o}=e,i=Ooe(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=Poe(p),m=n.forwardRef(((e,r)=>{const{scope:o,children:i,...a}=e,l=n.useRef(null),c=Ooe(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]}(Goe),[Xoe,Zoe]=Coe(Goe,[Yoe]),[Qoe,Joe]=Xoe(Goe),eie=i.forwardRef(((e,n)=>t.jsx(Koe.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Koe.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(tie,{...e,ref:n})})})));eie.displayName=Goe;var tie=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=Ooe(n,h),g=zoe(s),[v,y]=Voe({prop:l,defaultProp:c??null,onChange:u,caller:Goe}),[b,x]=i.useState(!1),w=function(e){const t=i.useRef(e);return i.useEffect((()=>{t.current=e})),i.useMemo((()=>(...e)=>t.current?.(...e)),[])}(d),_=Woe(r),S=i.useRef(!1),[E,T]=i.useState(0);return i.useEffect((()=>{const e=h.current;if(e)return e.addEventListener(Hoe,w),()=>e.removeEventListener(Hoe,w)}),[w]),t.jsx(Qoe,{scope:r,orientation:o,dir:g,loop:a,currentTabStopId:v,onItemFocus:i.useCallback((e=>y(e)),[y]),onItemShiftTab:i.useCallback((()=>x(!0)),[]),onFocusableItemAdd:i.useCallback((()=>T((e=>e+1))),[]),onFocusableItemRemove:i.useCallback((()=>T((e=>e-1))),[]),children:t.jsx(Uoe.div,{tabIndex:b||0===E?-1:0,"data-orientation":o,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:Toe(e.onMouseDown,(()=>{S.current=!0})),onFocus:Toe(e.onFocus,(e=>{if(e.target===e.currentTarget&&!S.current&&!b){const t=new CustomEvent(Hoe,qoe);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){const e=_().filter((e=>e.focusable));iie([e.find((e=>e.active)),e.find((e=>e.id===v)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}S.current=!1})),onBlur:Toe(e.onBlur,(()=>x(!1)))})})})),nie="RovingFocusGroupItem",rie=i.forwardRef(((e,n)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:a=!1,tabStopId:s,children:l,...c}=e,u=Foe(),d=s||u,p=Joe(nie,r),f=p.currentTabStopId===d,h=Woe(r),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=p;return i.useEffect((()=>{if(o)return m(),()=>g()}),[o,m,g]),t.jsx(Koe.ItemSlot,{scope:r,id:d,focusable:o,active:a,children:t.jsx(Uoe.span,{tabIndex:f?0:-1,"data-orientation":p.orientation,...c,ref:n,onMouseDown:Toe(e.onMouseDown,(e=>{o?p.onItemFocus(d):e.preventDefault()})),onFocus:Toe(e.onFocus,(()=>p.onItemFocus(d))),onKeyDown:Toe(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:oie[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((()=>iie(o)))}var n,r})),children:"function"==typeof l?l({isCurrentTabStop:f,hasTabStop:null!=v}):l})})}));rie.displayName=nie;var oie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iie(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 aie=eie,sie=rie;var lie=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=cie(r.current);a.current="mounted"===l?e:"none"}),[l]),Loe((()=>{const t=r.current,n=o.current;if(n!==e){const r=a.current,i=cie(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]),Loe((()=>{if(t){let e;const n=t.ownerDocument.defaultView??window,i=i=>{const a=cie(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=cie(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=Ooe(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 cie(e){return e?.animationName||"none"}lie.displayName="Presence";var uie="Tabs",[die,pie]=Coe(uie,[Zoe]),fie=Zoe(),[hie,mie]=die(uie),gie=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,onValueChange:i,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=zoe(l),[p,f]=Voe({prop:o,onChange:i,defaultProp:a??"",caller:uie});return t.jsx(hie,{scope:r,baseId:Foe(),value:p,onValueChange:f,orientation:s,dir:d,activationMode:c,children:t.jsx(Uoe.div,{dir:d,"data-orientation":s,...u,ref:n})})}));gie.displayName=uie;var vie="TabsList",yie=i.forwardRef(((e,n)=>{const{__scopeTabs:r,loop:o=!0,...i}=e,a=mie(vie,r),s=fie(r);return t.jsx(aie,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:o,children:t.jsx(Uoe.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:n})})}));yie.displayName=vie;var bie="TabsTrigger",xie=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,disabled:i=!1,...a}=e,s=mie(bie,r),l=fie(r),c=Sie(s.baseId,o),u=Eie(s.baseId,o),d=o===s.value;return t.jsx(sie,{asChild:!0,...l,focusable:!i,active:d,children:t.jsx(Uoe.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:Toe(e.onMouseDown,(e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():s.onValueChange(o)})),onKeyDown:Toe(e.onKeyDown,(e=>{[" ","Enter"].includes(e.key)&&s.onValueChange(o)})),onFocus:Toe(e.onFocus,(()=>{d||i||!("manual"!==s.activationMode)||s.onValueChange(o)}))})})}));xie.displayName=bie;var wie="TabsContent",_ie=i.forwardRef(((e,n)=>{const{__scopeTabs:r,value:o,forceMount:a,children:s,...l}=e,c=mie(wie,r),u=Sie(c.baseId,o),d=Eie(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(lie,{present:a||p,children:({present:r})=>t.jsx(Uoe.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 Sie(e,t){return`${e}-trigger-${t}`}function Eie(e,t){return`${e}-content-${t}`}_ie.displayName=wie;var Tie=yie,Cie=xie,Aie=_ie;const Nie=gie,Rie=i.forwardRef((({className:e,...n},r)=>t.jsx(Tie,{ref:r,className:rp("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...n})));Rie.displayName=Tie.displayName;const Oie=i.forwardRef((({className:e,...n},r)=>t.jsx(Cie,{ref:r,className:rp("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})));Oie.displayName=Cie.displayName;const Pie=i.forwardRef((({className:e,...n},r)=>t.jsx(Aie,{ref:r,className:rp("ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...n})));Pie.displayName=Aie.displayName;const kie=({open:e,onOpenChange:n})=>t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{className:"max-w-[75vw] min-h-[75vh] overflow-y-auto max-h-[90vh] po",hideCloseButton:!0,children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Edit Campaign Content"}),t.jsx(FB,{children:"Edit the content of the campaign"})]}),t.jsx(MZ,{"aria-label":"Close dialog",onClick:()=>n(!1),className:"absolute top-3 right-3 z-20 rounded-full p-2 bg-white/80 shadow-lg border border-gray-200 hover:bg-primary/90 hover:text-white active:bg-primary/95 transition-all duration-200 focus:outline-none focus:ring-4 focus:ring-primary/30 focus:ring-offset-2 group",style:{boxShadow:"0 4px 24px 0 rgba(0,0,0,0.10)"},children:t.jsx(FZ.CloseButton,{className:"w-7 h-7 text-primary group-hover:text-white group-active:text-white transition-colors duration-200"})}),t.jsx(woe,{})]})}),jie=()=>t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"}),t.jsx("span",{className:"w-3 h-3 rounded-full bg-zinc-300 border border-zinc-300 shadow-sm"})]}),Mie=({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 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(jie,{}),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"})})]}),Lie=()=>{const e=bZ(),r=xZ(),{channelSenders:o}=V7(),{channelAccounts:i}=U7(),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===$7.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-1 overflow-hidden",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:["<",f,">"]})]})]}),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})]})]})},Die=({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(Mie,{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(Lie,{})})}),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($ne,{html:e,height:r.height,width:r.width})})]})},Iie=({expandDialogContent:e})=>{const[r,o]=n.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(PB,{open:r,onOpenChange:o,children:t.jsxs(MB,{hideCloseButton:!0,className:"w-[80vw] h-[80vh] max-w-none max-h-none bg-transparent border-none",children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Expanded Preview"}),t.jsx(FB,{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(MZ,{variant:"ghost",size:"sm",onClick:()=>o(!1),children:t.jsx(FZ.CloseButton,{className:"w-4 h-4 text-primary"})})})]})]})}),t.jsx(MZ,{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(FZ.ExpandIcon,{className:"w-4 h-4 text-muted-foreground"})})]})},Fie=({type:e,disablePreviewSubtext:n=!1})=>{const r="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?FZ.SmsIcon:FZ.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 ",r," Content Yet"]}),!n&&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 ",r," message."]})]})})},Uie=({onClick:e})=>t.jsxs(MZ,{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(FZ.PreviewButton,{className:"w-4 h-4"}),t.jsx("span",{className:"font-medium text-sm",children:"Test"})]}),$ie=e=>/^[^\s@.]+(?:\.[^\s@.]+)*@[^\s@.]+(?:\.[^\s@.]+)+$/.test(e),Vie=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"))},Bie=e=>{const t=e.replace(/\D/g,"");if(10===t.length)return`(${t.slice(0,3)}) ${t.slice(3,6)}-${t.slice(6)}`;if(11===t.length&&t.startsWith("1"))return`+1 (${t.slice(1,4)}) ${t.slice(4,7)}-${t.slice(7)}`;if(t.length>0){const n=e.startsWith("+")?"+":"",r=t.slice((e.startsWith("+"),0));return`${n}${r.match(/.{1,4}/g)?.join("-")||r}`}return e},zie=({automation:e,type:r,setOpenSendPreviewPopup:o,open:i})=>{const[a,s]=n.useState(""),[l,c]=n.useState(""),[u,d]=n.useState(null),[p,f]=n.useState(!1),[h,m]=n.useState(""),{sendTestCommunication:g,sendError:v,isSendSuccess:y}=aZ(),{toast:b}=Il(),x=e.actionData?.find((e=>"send_communication"===e.actionType)),w=x?.actionMetadata.communicationGroupId,{communicationGroup:_,isGetting:S}=oZ(w??void 0),{data:E}=pZ({includeSegments:e.includeSegmentIds,excludeSegments:e.excludeSegmentIds,automationId:e.id}),T=n.useCallback((()=>{if(!w)return Promise.resolve(null);if(!_)return Promise.reject(new Error("Communication group not loaded"));switch(r){case"email":return Promise.resolve(_.emailChannelSenderId);case"sms":return Promise.resolve(_.smsChannelSenderId);default:return Promise.reject(new Error(`Unsupported type: ${r}`))}}),[_,r,w]);n.useEffect((()=>{(async()=>{try{const e=await T();d(e)}catch(e){d(null)}finally{f(!0)}})()}),[T]),n.useEffect((()=>{y&&(b({title:"Success",description:`Preview ${"email"===r?"email":"SMS"} sent successfully!`}),o(!1))}),[y,r,o,b]),n.useEffect((()=>{v&&(b({title:"Error",description:`Failed to send preview: ${v.message}`,variant:"destructive"}),o(!1))}),[v,b,o]),n.useEffect((()=>{i&&(s(""),c(""),m(""))}),[i]);return p&&!S&&E?u?t.jsxs("div",{className:"",children:[t.jsxs("h3",{className:"text-xl font-semibold text-gray-900 mb-4",children:["Send Test ","email"===r?"Email":"Text"]}),t.jsx(s5,{type:"email"===r?"email":"tel",placeholder:"email"===r?"Enter email address":"Enter phone number",value:a,onChange:e=>{s(e.target.value),c("")},className:"w-full px-3 py-3 border border-gray-300 rounded-lg text-base \n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent\n placeholder-gray-400"}),t.jsxs("p",{className:"text-sm text-muted-foreground mt-1.5",children:["Enter a valid ","email"===r?"email address":"phone number"," to send a test to that recipient."]}),t.jsx("div",{className:"my-4 border-t border-gray-200"}),t.jsxs("div",{className:"mb-4",children:[t.jsxs(Pne,{value:h,onValueChange:e=>{m(e)},children:[t.jsx(Mne,{className:"w-full bg-white border border-gray-300 rounded-lg text-base\n focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:t.jsx(jne,{children:h?E?.recipients.find((e=>e.id===h))?.firstName+" "+E?.recipients.find((e=>e.id===h))?.lastName:"Preview as"})}),t.jsx(Ine,{children:t.jsx(kne,{children:(E?.recipients??[]).map((e=>t.jsx(Fne,{value:e.id,className:"cursor-pointer hover:bg-gray-50",children:t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("span",{className:"font-medium",children:[e.firstName," ",e.lastName]}),t.jsxs("span",{className:"text-sm text-muted-foreground",children:[e.email&&`Email: ${e.email}`,e.email&&e.phone&&" • ",e.phone&&`Phone: ${e.phone}`]})]})},`${e.firstName}-${e.lastName}`)))})})]}),t.jsx("p",{className:"text-sm text-muted-foreground mt-1.5",children:"Optional: Test as a specific recipient to see how the message will appear with their data. If not selected, raw merge tags will be used."})]}),l&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-4 border-t border-gray-200"}),t.jsx("p",{className:"text-red-500 text-sm mb-4 -mt-2",children:l})]}),t.jsx(MZ,{onClick:()=>{if(!("email"===r?$ie(a):Vie(a)))return void c("Please enter a valid "+("email"===r?"email address":"phone number"));if(!u)return void c("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);g({id:n,params:"email"===r?{emailAddress:a,previewAsRecipientId:h}:{phoneNumber:a,previewAsRecipientId:h}})},disabled:!a,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 Test"})]}):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(FZ.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"})]})}):t.jsx("div",{className:"flex justify-center items-center h-full",children:t.jsx(EZ,{text:["Fetching sender data","Fetching recipients"]})})},Hie=({open:e,onOpenChange:n,automation:r})=>t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Send Preview Email"}),t.jsx(FB,{children:"Send a preview email to the automation."})]}),t.jsx(zie,{automation:r,type:"email",setOpenSendPreviewPopup:n,open:e})]})}),qie=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1})=>{const i=bZ(),a=xZ(),[s,l]=n.useState({width:0,height:0}),[c,u]=n.useState(!1),[d,p]=n.useState(!1),f=n.useRef(null);if(n.useEffect((()=>{const e=()=>{f.current&&requestAnimationFrame((()=>{l({width:f.current?f.current.offsetWidth-75:0,height:f.current?f.current.offsetHeight-75:0})}))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)}),[f]),!i||!a)return null;const h=a?.emailHtmlBody||"",m=a?.emailChannelSenderId&&h.length>0;return t.jsxs("div",{className:"flex-1 flex flex-col items-center w-full",children:[t.jsx(kie,{open:d,onOpenChange:p}),t.jsx(Hie,{open:c,onOpenChange:u,automation:i}),t.jsx(Mie,{actionButtons:t.jsx(t.Fragment,{children:t.jsxs("div",{className:"flex items-center space-x-2",children:[!e&&m&&t.jsx(Uie,{onClick:()=>u(!0)}),(i.status===ze.DRAFT||!r)&&t.jsx(MZ,{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:()=>p(!0),children:"Edit content"}),m&&t.jsx(Iie,{expandDialogContent:t.jsx(Die,{emailBody:h})})]})}),children:m?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(Lie,{})})}),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 min-h-[500px]",ref:f,children:t.jsx($ne,{html:h,height:s.height,width:s.width})})]}):t.jsx(Fie,{type:"email",disablePreviewSubtext:o})})]})},Gie={all:["sms-registration-application"]},Kie=async()=>(await Oe(`${f}/`)).data,Wie=()=>{const e=ue(),t=be({mutationFn:e=>(async e=>(await Oe(`${f}/`,{method:"POST",body:JSON.stringify({application:e.application})})).data)(e),onSuccess:()=>{e.invalidateQueries({queryKey:Gie.all})}});return{createSmsRegistrationApplication:t.mutate,isCreating:t.isPending,createError:t.error,isCreateSuccess:t.isSuccess}};var Yie,Xie,Zie;(Xie=Yie||(Yie={})).assertEqual=e=>e,Xie.assertIs=function(e){},Xie.assertNever=function(e){throw new Error},Xie.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},Xie.getValidEnumValues=e=>{const t=Xie.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),n={};for(const r of t)n[r]=e[r];return Xie.objectValues(n)},Xie.objectValues=e=>Xie.objectKeys(e).map((function(t){return e[t]})),Xie.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},Xie.find=(e,t)=>{for(const n of e)if(t(n))return n},Xie.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,Xie.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},Xie.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Zie||(Zie={})).mergeShapes=(e,t)=>({...e,...t});const Qie=Yie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jie=e=>{switch(typeof e){case"undefined":return Qie.undefined;case"string":return Qie.string;case"number":return isNaN(e)?Qie.nan:Qie.number;case"boolean":return Qie.boolean;case"function":return Qie.function;case"bigint":return Qie.bigint;case"symbol":return Qie.symbol;case"object":return Array.isArray(e)?Qie.array:null===e?Qie.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Qie.promise:"undefined"!=typeof Map&&e instanceof Map?Qie.map:"undefined"!=typeof Set&&e instanceof Set?Qie.set:"undefined"!=typeof Date&&e instanceof Date?Qie.date:Qie.object;default:return Qie.unknown}},eae=Yie.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 tae 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 tae))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Yie.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()}}tae.create=e=>new tae(e);const nae=(e,t)=>{let n;switch(e.code){case eae.invalid_type:n=e.received===Qie.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case eae.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Yie.jsonStringifyReplacer)}`;break;case eae.unrecognized_keys:n=`Unrecognized key(s) in object: ${Yie.joinValues(e.keys,", ")}`;break;case eae.invalid_union:n="Invalid input";break;case eae.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Yie.joinValues(e.options)}`;break;case eae.invalid_enum_value:n=`Invalid enum value. Expected ${Yie.joinValues(e.options)}, received '${e.received}'`;break;case eae.invalid_arguments:n="Invalid function arguments";break;case eae.invalid_return_type:n="Invalid function return type";break;case eae.invalid_date:n="Invalid date";break;case eae.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}"`:Yie.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case eae.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 eae.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 eae.custom:n="Invalid input";break;case eae.invalid_intersection_types:n="Intersection results could not be merged";break;case eae.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case eae.not_finite:n="Number must be finite";break;default:n=t.defaultError,Yie.assertNever(e)}return{message:n}};let rae=nae;function oae(){return rae}const iae=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 aae(e,t){const n=oae(),r=iae({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===nae?void 0:nae].filter((e=>!!e))});e.common.issues.push(r)}class sae{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 lae;"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 sae.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 lae;if("aborted"===o.status)return lae;"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 lae=Object.freeze({status:"aborted"}),cae=e=>({status:"dirty",value:e}),uae=e=>({status:"valid",value:e}),dae=e=>"aborted"===e.status,pae=e=>"dirty"===e.status,fae=e=>"valid"===e.status,hae=e=>"undefined"!=typeof Promise&&e instanceof Promise;function mae(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 gae(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 vae,yae,bae,xae;"function"==typeof SuppressedError&&SuppressedError,(yae=vae||(vae={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},yae.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class wae{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 _ae=(e,t)=>{if(fae(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 tae(e.common.issues);return this._error=t,this._error}}};function Sae(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 Eae{get description(){return this._def.description}_getType(e){return Jie(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Jie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new sae,ctx:{common:e.parent.common,data:e.data,parsedType:Jie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(hae(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:Jie(e)},o=this._parseSync({data:e,path:r.path,parent:r});return _ae(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:Jie(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return fae(t)?{value:t.value}:{issues:r.common.issues}}catch(FTe){(null===(n=null===(t=null==FTe?void 0:FTe.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=>fae(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:Jie(e)},r=this._parse({data:e,path:n.path,parent:n}),o=await(hae(r)?r:Promise.resolve(r));return _ae(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:eae.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 Tse({schema:this,typeName:Fse.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 Cse.create(this,this._def)}nullable(){return Ase.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ase.create(this)}promise(){return Ese.create(this,this._def)}or(e){return cse.create([this,e],this._def)}and(e){return fse.create(this,e,this._def)}transform(e){return new Tse({...Sae(this._def),schema:this,typeName:Fse.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Nse({...Sae(this._def),innerType:this,defaultValue:t,typeName:Fse.ZodDefault})}brand(){return new kse({typeName:Fse.ZodBranded,type:this,...Sae(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Rse({...Sae(this._def),innerType:this,catchValue:t,typeName:Fse.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return jse.create(this,e)}readonly(){return Mse.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Tae=/^c[^\s-]{8,}$/i,Cae=/^[0-9a-z]+$/,Aae=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nae=/^[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,Rae=/^[a-z0-9_-]{21}$/i,Oae=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pae=/^[-+]?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)?)??$/,kae=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let jae;const Mae=/^(?:(?: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])$/,Lae=/^(?:(?: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])$/,Dae=/^(([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]))$/,Iae=/^(([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])$/,Fae=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Uae=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$ae="((\\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])))",Vae=new RegExp(`^${$ae}$`);function Bae(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 zae(e){return new RegExp(`^${Bae(e)}$`)}function Hae(e){let t=`${$ae}T${Bae(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 qae(e,t){if(!Oae.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(UTe){return!1}}function Gae(e,t){return!("v4"!==t&&t||!Lae.test(e))||!("v6"!==t&&t||!Iae.test(e))}class Kae extends Eae{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Qie.string){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.string,received:t.parsedType}),lae}const t=new sae;let n;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.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),aae(n,{code:eae.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?aae(n,{code:eae.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&aae(n,{code:eae.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)kae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"email",code:eae.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)jae||(jae=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),jae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"emoji",code:eae.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)Nae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"uuid",code:eae.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)Rae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"nanoid",code:eae.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)Tae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"cuid",code:eae.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)Cae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"cuid2",code:eae.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)Aae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"ulid",code:eae.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(UTe){n=this._getOrReturnCtx(e,n),aae(n,{validation:"url",code:eae.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),aae(n,{validation:"regex",code:eae.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),aae(n,{code:eae.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),aae(n,{code:eae.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),aae(n,{code:eae.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){Hae(i).test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){Vae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){zae(i).test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?Pae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"duration",code:eae.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(r=e.data,("v4"!==(o=i.version)&&o||!Mae.test(r))&&("v6"!==o&&o||!Dae.test(r))&&(n=this._getOrReturnCtx(e,n),aae(n,{validation:"ip",code:eae.invalid_string,message:i.message}),t.dirty())):"jwt"===i.kind?qae(e.data,i.alg)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"jwt",code:eae.invalid_string,message:i.message}),t.dirty()):"cidr"===i.kind?Gae(e.data,i.version)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"cidr",code:eae.invalid_string,message:i.message}),t.dirty()):"base64"===i.kind?Fae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"base64",code:eae.invalid_string,message:i.message}),t.dirty()):"base64url"===i.kind?Uae.test(e.data)||(n=this._getOrReturnCtx(e,n),aae(n,{validation:"base64url",code:eae.invalid_string,message:i.message}),t.dirty()):Yie.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:eae.invalid_string,...vae.errToObj(n)})}_addCheck(e){return new Kae({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...vae.errToObj(e)})}url(e){return this._addCheck({kind:"url",...vae.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...vae.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...vae.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...vae.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...vae.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...vae.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...vae.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...vae.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...vae.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...vae.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...vae.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...vae.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,...vae.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,...vae.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...vae.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...vae.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...vae.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...vae.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...vae.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...vae.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...vae.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...vae.errToObj(t)})}nonempty(e){return this.min(1,vae.errToObj(e))}trim(){return new Kae({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Kae({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Kae({...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 Wae(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)}Kae.create=e=>{var t;return new Kae({checks:[],typeName:Fse.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Sae(e)})};class Yae extends Eae{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)!==Qie.number){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.number,received:t.parsedType}),lae}let t;const n=new sae;for(const r of this._def.checks)if("int"===r.kind)Yie.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),aae(t,{code:eae.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),aae(t,{code:eae.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),aae(t,{code:eae.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==Wae(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),aae(t,{code:eae.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),aae(t,{code:eae.not_finite,message:r.message}),n.dirty()):Yie.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,vae.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vae.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vae.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vae.toString(t))}setLimit(e,t,n,r){return new Yae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:vae.toString(r)}]})}_addCheck(e){return new Yae({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:vae.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:vae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:vae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:vae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:vae.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vae.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:vae.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:vae.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:vae.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&&Yie.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)}}Yae.create=e=>new Yae({checks:[],typeName:Fse.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Sae(e)});class Xae extends Eae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(UTe){return this._getInvalidInput(e)}if(this._getType(e)!==Qie.bigint)return this._getInvalidInput(e);let t;const n=new sae;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),aae(t,{code:eae.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),aae(t,{code:eae.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),aae(t,{code:eae.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Yie.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.bigint,received:t.parsedType}),lae}gte(e,t){return this.setLimit("min",e,!0,vae.toString(t))}gt(e,t){return this.setLimit("min",e,!1,vae.toString(t))}lte(e,t){return this.setLimit("max",e,!0,vae.toString(t))}lt(e,t){return this.setLimit("max",e,!1,vae.toString(t))}setLimit(e,t,n,r){return new Xae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:vae.toString(r)}]})}_addCheck(e){return new Xae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:vae.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:vae.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:vae.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:vae.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:vae.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}}Xae.create=e=>{var t;return new Xae({checks:[],typeName:Fse.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Sae(e)})};class Zae extends Eae{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Qie.boolean){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.boolean,received:t.parsedType}),lae}return uae(e.data)}}Zae.create=e=>new Zae({typeName:Fse.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Sae(e)});class Qae extends Eae{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Qie.date){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.date,received:t.parsedType}),lae}if(isNaN(e.data.getTime())){return aae(this._getOrReturnCtx(e),{code:eae.invalid_date}),lae}const t=new sae;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),aae(n,{code:eae.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),aae(n,{code:eae.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Yie.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qae({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:vae.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:vae.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}}Qae.create=e=>new Qae({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Fse.ZodDate,...Sae(e)});class Jae extends Eae{_parse(e){if(this._getType(e)!==Qie.symbol){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.symbol,received:t.parsedType}),lae}return uae(e.data)}}Jae.create=e=>new Jae({typeName:Fse.ZodSymbol,...Sae(e)});class ese extends Eae{_parse(e){if(this._getType(e)!==Qie.undefined){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.undefined,received:t.parsedType}),lae}return uae(e.data)}}ese.create=e=>new ese({typeName:Fse.ZodUndefined,...Sae(e)});class tse extends Eae{_parse(e){if(this._getType(e)!==Qie.null){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.null,received:t.parsedType}),lae}return uae(e.data)}}tse.create=e=>new tse({typeName:Fse.ZodNull,...Sae(e)});class nse extends Eae{constructor(){super(...arguments),this._any=!0}_parse(e){return uae(e.data)}}nse.create=e=>new nse({typeName:Fse.ZodAny,...Sae(e)});class rse extends Eae{constructor(){super(...arguments),this._unknown=!0}_parse(e){return uae(e.data)}}rse.create=e=>new rse({typeName:Fse.ZodUnknown,...Sae(e)});class ose extends Eae{_parse(e){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.never,received:t.parsedType}),lae}}ose.create=e=>new ose({typeName:Fse.ZodNever,...Sae(e)});class ise extends Eae{_parse(e){if(this._getType(e)!==Qie.undefined){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.void,received:t.parsedType}),lae}return uae(e.data)}}ise.create=e=>new ise({typeName:Fse.ZodVoid,...Sae(e)});class ase extends Eae{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Qie.array)return aae(t,{code:eae.invalid_type,expected:Qie.array,received:t.parsedType}),lae;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(e||o)&&(aae(t,{code:e?eae.too_big:eae.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&&(aae(t,{code:eae.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&&(aae(t,{code:eae.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 wae(t,e,t.path,n))))).then((e=>sae.mergeArray(n,e)));const o=[...t.data].map(((e,n)=>r.type._parseSync(new wae(t,e,t.path,n))));return sae.mergeArray(n,o)}get element(){return this._def.type}min(e,t){return new ase({...this._def,minLength:{value:e,message:vae.toString(t)}})}max(e,t){return new ase({...this._def,maxLength:{value:e,message:vae.toString(t)}})}length(e,t){return new ase({...this._def,exactLength:{value:e,message:vae.toString(t)}})}nonempty(e){return this.min(1,e)}}function sse(e){if(e instanceof lse){const t={};for(const n in e.shape){t[n]=Cse.create(sse(e.shape[n]))}return new lse({...e._def,shape:()=>t})}return e instanceof ase?new ase({...e._def,type:sse(e.element)}):e instanceof Cse?Cse.create(sse(e.unwrap())):e instanceof Ase?Ase.create(sse(e.unwrap())):e instanceof hse?hse.create(e.items.map((e=>sse(e)))):e}ase.create=(e,t)=>new ase({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Fse.ZodArray,...Sae(t)});class lse extends Eae{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=Yie.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Qie.object){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.object,received:t.parsedType}),lae}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof ose&&"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 wae(n,n.data[s],n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof ose){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&&(aae(n,{code:eae.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 wae(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=>sae.mergeObjectSync(t,e))):sae.mergeObjectSync(t,a)}get shape(){return this._def.shape()}strict(e){return new lse({...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=vae.errToObj(e).message)&&void 0!==a?a:s}:{message:s}}}:{}})}strip(){return new lse({...this._def,unknownKeys:"strip"})}passthrough(){return new lse({...this._def,unknownKeys:"passthrough"})}extend(e){return new lse({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new lse({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Fse.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new lse({...this._def,catchall:e})}pick(e){const t={};return Yie.objectKeys(e).forEach((n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])})),new lse({...this._def,shape:()=>t})}omit(e){const t={};return Yie.objectKeys(this.shape).forEach((n=>{e[n]||(t[n]=this.shape[n])})),new lse({...this._def,shape:()=>t})}deepPartial(){return sse(this)}partial(e){const t={};return Yie.objectKeys(this.shape).forEach((n=>{const r=this.shape[n];t[n]=e&&!e[n]?r:r.optional()})),new lse({...this._def,shape:()=>t})}required(e){const t={};return Yie.objectKeys(this.shape).forEach((n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Cse;)e=e._def.innerType;t[n]=e}})),new lse({...this._def,shape:()=>t})}keyof(){return wse(Yie.objectKeys(this.shape))}}lse.create=(e,t)=>new lse({shape:()=>e,unknownKeys:"strip",catchall:ose.create(),typeName:Fse.ZodObject,...Sae(t)}),lse.strictCreate=(e,t)=>new lse({shape:()=>e,unknownKeys:"strict",catchall:ose.create(),typeName:Fse.ZodObject,...Sae(t)}),lse.lazycreate=(e,t)=>new lse({shape:e,unknownKeys:"strip",catchall:ose.create(),typeName:Fse.ZodObject,...Sae(t)});class cse extends Eae{_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 tae(e.ctx.common.issues)));return aae(t,{code:eae.invalid_union,unionErrors:n}),lae}));{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 tae(e)));return aae(t,{code:eae.invalid_union,unionErrors:o}),lae}}get options(){return this._def.options}}cse.create=(e,t)=>new cse({options:e,typeName:Fse.ZodUnion,...Sae(t)});const use=e=>e instanceof bse?use(e.schema):e instanceof Tse?use(e.innerType()):e instanceof xse?[e.value]:e instanceof _se?e.options:e instanceof Sse?Yie.objectValues(e.enum):e instanceof Nse?use(e._def.innerType):e instanceof ese?[void 0]:e instanceof tse?[null]:e instanceof Cse?[void 0,...use(e.unwrap())]:e instanceof Ase?[null,...use(e.unwrap())]:e instanceof kse||e instanceof Mse?use(e.unwrap()):e instanceof Rse?use(e._def.innerType):[];class dse extends Eae{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qie.object)return aae(t,{code:eae.invalid_type,expected:Qie.object,received:t.parsedType}),lae;const n=this.discriminator,r=this.optionsMap.get(t.data[n]);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(aae(t,{code:eae.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),lae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const o of t){const t=use(o.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,o)}}return new dse({typeName:Fse.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Sae(n)})}}function pse(e,t){const n=Jie(e),r=Jie(t);if(e===t)return{valid:!0,data:e};if(n===Qie.object&&r===Qie.object){const n=Yie.objectKeys(t),r=Yie.objectKeys(e).filter((e=>-1!==n.indexOf(e))),o={...e,...t};for(const i of r){const n=pse(e[i],t[i]);if(!n.valid)return{valid:!1};o[i]=n.data}return{valid:!0,data:o}}if(n===Qie.array&&r===Qie.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const o=pse(e[r],t[r]);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}return n===Qie.date&&r===Qie.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class fse extends Eae{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(dae(e)||dae(r))return lae;const o=pse(e.value,r.value);return o.valid?((pae(e)||pae(r))&&t.dirty(),{status:t.value,value:o.data}):(aae(n,{code:eae.invalid_intersection_types}),lae)};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}))}}fse.create=(e,t,n)=>new fse({left:e,right:t,typeName:Fse.ZodIntersection,...Sae(n)});class hse extends Eae{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qie.array)return aae(n,{code:eae.invalid_type,expected:Qie.array,received:n.parsedType}),lae;if(n.data.length<this._def.items.length)return aae(n,{code:eae.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),lae;!this._def.rest&&n.data.length>this._def.items.length&&(aae(n,{code:eae.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 wae(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(r).then((e=>sae.mergeArray(t,e))):sae.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new hse({...this._def,rest:e})}}hse.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hse({items:e,typeName:Fse.ZodTuple,rest:null,...Sae(t)})};class mse extends Eae{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!==Qie.object)return aae(n,{code:eae.invalid_type,expected:Qie.object,received:n.parsedType}),lae;const r=[],o=this._def.keyType,i=this._def.valueType;for(const a in n.data)r.push({key:o._parse(new wae(n,a,n.path,a)),value:i._parse(new wae(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?sae.mergeObjectAsync(t,r):sae.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new mse(t instanceof Eae?{keyType:e,valueType:t,typeName:Fse.ZodRecord,...Sae(n)}:{keyType:Kae.create(),valueType:e,typeName:Fse.ZodRecord,...Sae(t)})}}class gse extends Eae{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!==Qie.map)return aae(n,{code:eae.invalid_type,expected:Qie.map,received:n.parsedType}),lae;const r=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map((([e,t],i)=>({key:r._parse(new wae(n,e,n.path,[i,"key"])),value:o._parse(new wae(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 lae;"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 lae;"dirty"!==r.status&&"dirty"!==o.status||t.dirty(),e.set(r.value,o.value)}return{status:t.value,value:e}}}}gse.create=(e,t,n)=>new gse({valueType:t,keyType:e,typeName:Fse.ZodMap,...Sae(n)});class vse extends Eae{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Qie.set)return aae(n,{code:eae.invalid_type,expected:Qie.set,received:n.parsedType}),lae;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(aae(n,{code:eae.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&&(aae(n,{code:eae.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 lae;"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 wae(n,e,n.path,t))));return n.common.async?Promise.all(a).then((e=>i(e))):i(a)}min(e,t){return new vse({...this._def,minSize:{value:e,message:vae.toString(t)}})}max(e,t){return new vse({...this._def,maxSize:{value:e,message:vae.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}vse.create=(e,t)=>new vse({valueType:e,minSize:null,maxSize:null,typeName:Fse.ZodSet,...Sae(t)});class yse extends Eae{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qie.function)return aae(t,{code:eae.invalid_type,expected:Qie.function,received:t.parsedType}),lae;function n(e,n){return iae({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oae(),nae].filter((e=>!!e)),issueData:{code:eae.invalid_arguments,argumentsError:n}})}function r(e,n){return iae({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,oae(),nae].filter((e=>!!e)),issueData:{code:eae.invalid_return_type,returnTypeError:n}})}const o={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ese){const e=this;return uae((async function(...t){const a=new tae([]),s=await e._def.args.parseAsync(t,o).catch((e=>{throw a.addIssue(n(t,e)),a})),l=await Reflect.apply(i,this,s);return await e._def.returns._def.type.parseAsync(l,o).catch((e=>{throw a.addIssue(r(l,e)),a}))}))}{const e=this;return uae((function(...t){const a=e._def.args.safeParse(t,o);if(!a.success)throw new tae([n(t,a.error)]);const s=Reflect.apply(i,this,a.data),l=e._def.returns.safeParse(s,o);if(!l.success)throw new tae([r(s,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new yse({...this._def,args:hse.create(e).rest(rse.create())})}returns(e){return new yse({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new yse({args:e||hse.create([]).rest(rse.create()),returns:t||rse.create(),typeName:Fse.ZodFunction,...Sae(n)})}}class bse extends Eae{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})}}bse.create=(e,t)=>new bse({getter:e,typeName:Fse.ZodLazy,...Sae(t)});class xse extends Eae{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return aae(t,{received:t.data,code:eae.invalid_literal,expected:this._def.value}),lae}return{status:"valid",value:e.data}}get value(){return this._def.value}}function wse(e,t){return new _se({values:e,typeName:Fse.ZodEnum,...Sae(t)})}xse.create=(e,t)=>new xse({value:e,typeName:Fse.ZodLiteral,...Sae(t)});class _se extends Eae{constructor(){super(...arguments),bae.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e);return aae(t,{expected:Yie.joinValues(this._def.values),received:t.parsedType,code:eae.invalid_type}),lae}if(mae(this,bae)||gae(this,bae,new Set(this._def.values)),!mae(this,bae).has(e.data)){const t=this._getOrReturnCtx(e);return aae(t,{received:t.data,code:eae.invalid_enum_value,options:this._def.values}),lae}return uae(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 _se.create(e,{...this._def,...t})}exclude(e,t=this._def){return _se.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}bae=new WeakMap,_se.create=wse;class Sse extends Eae{constructor(){super(...arguments),xae.set(this,void 0)}_parse(e){const t=Yie.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Qie.string&&n.parsedType!==Qie.number){const e=Yie.objectValues(t);return aae(n,{expected:Yie.joinValues(e),received:n.parsedType,code:eae.invalid_type}),lae}if(mae(this,xae)||gae(this,xae,new Set(Yie.getValidEnumValues(this._def.values))),!mae(this,xae).has(e.data)){const e=Yie.objectValues(t);return aae(n,{received:n.data,code:eae.invalid_enum_value,options:e}),lae}return uae(e.data)}get enum(){return this._def.values}}xae=new WeakMap,Sse.create=(e,t)=>new Sse({values:e,typeName:Fse.ZodNativeEnum,...Sae(t)});class Ese extends Eae{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Qie.promise&&!1===t.common.async)return aae(t,{code:eae.invalid_type,expected:Qie.promise,received:t.parsedType}),lae;const n=t.parsedType===Qie.promise?t.data:Promise.resolve(t.data);return uae(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Ese.create=(e,t)=>new Ese({type:e,typeName:Fse.ZodPromise,...Sae(t)});class Tse extends Eae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Fse.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=>{aae(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 lae;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?lae:"dirty"===r.status||"dirty"===t.value?cae(r.value):r}));{if("aborted"===t.value)return lae;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?lae:"dirty"===r.status||"dirty"===t.value?cae(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?lae:("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?lae:("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(!fae(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=>fae(e)?Promise.resolve(r.transform(e.value,o)).then((e=>({status:t.value,value:e}))):e))}Yie.assertNever(r)}}Tse.create=(e,t,n)=>new Tse({schema:e,typeName:Fse.ZodEffects,effect:t,...Sae(n)}),Tse.createWithPreprocess=(e,t,n)=>new Tse({schema:t,effect:{type:"preprocess",transform:e},typeName:Fse.ZodEffects,...Sae(n)});class Cse extends Eae{_parse(e){return this._getType(e)===Qie.undefined?uae(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Cse.create=(e,t)=>new Cse({innerType:e,typeName:Fse.ZodOptional,...Sae(t)});class Ase extends Eae{_parse(e){return this._getType(e)===Qie.null?uae(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ase.create=(e,t)=>new Ase({innerType:e,typeName:Fse.ZodNullable,...Sae(t)});class Nse extends Eae{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Qie.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Nse.create=(e,t)=>new Nse({innerType:e,typeName:Fse.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Sae(t)});class Rse extends Eae{_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 hae(r)?r.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new tae(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new tae(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Rse.create=(e,t)=>new Rse({innerType:e,typeName:Fse.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Sae(t)});class Ose extends Eae{_parse(e){if(this._getType(e)!==Qie.nan){const t=this._getOrReturnCtx(e);return aae(t,{code:eae.invalid_type,expected:Qie.nan,received:t.parsedType}),lae}return{status:"valid",value:e.data}}}Ose.create=e=>new Ose({typeName:Fse.ZodNaN,...Sae(e)});const Pse=Symbol("zod_brand");class kse extends Eae{_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 jse extends Eae{_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?lae:"dirty"===e.status?(t.dirty(),cae(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?lae:"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 jse({in:e,out:t,typeName:Fse.ZodPipeline})}}class Mse extends Eae{_parse(e){const t=this._def.innerType._parse(e),n=e=>(fae(e)&&(e.value=Object.freeze(e.value)),e);return hae(t)?t.then((e=>n(e))):n(t)}unwrap(){return this._def.innerType}}function Lse(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Dse(e,t={},n){return e?nse.create().superRefine(((r,o)=>{var i,a;const s=e(r);if(s instanceof Promise)return s.then((e=>{var i,a;if(!e){const e=Lse(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}}));if(!s){const e=Lse(t,r),s=null===(a=null!==(i=e.fatal)&&void 0!==i?i:n)||void 0===a||a;o.addIssue({code:"custom",...e,fatal:s})}})):nse.create()}Mse.create=(e,t)=>new Mse({innerType:e,typeName:Fse.ZodReadonly,...Sae(t)});const Ise={object:lse.lazycreate};var Fse,Use;(Use=Fse||(Fse={})).ZodString="ZodString",Use.ZodNumber="ZodNumber",Use.ZodNaN="ZodNaN",Use.ZodBigInt="ZodBigInt",Use.ZodBoolean="ZodBoolean",Use.ZodDate="ZodDate",Use.ZodSymbol="ZodSymbol",Use.ZodUndefined="ZodUndefined",Use.ZodNull="ZodNull",Use.ZodAny="ZodAny",Use.ZodUnknown="ZodUnknown",Use.ZodNever="ZodNever",Use.ZodVoid="ZodVoid",Use.ZodArray="ZodArray",Use.ZodObject="ZodObject",Use.ZodUnion="ZodUnion",Use.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Use.ZodIntersection="ZodIntersection",Use.ZodTuple="ZodTuple",Use.ZodRecord="ZodRecord",Use.ZodMap="ZodMap",Use.ZodSet="ZodSet",Use.ZodFunction="ZodFunction",Use.ZodLazy="ZodLazy",Use.ZodLiteral="ZodLiteral",Use.ZodEnum="ZodEnum",Use.ZodEffects="ZodEffects",Use.ZodNativeEnum="ZodNativeEnum",Use.ZodOptional="ZodOptional",Use.ZodNullable="ZodNullable",Use.ZodDefault="ZodDefault",Use.ZodCatch="ZodCatch",Use.ZodPromise="ZodPromise",Use.ZodBranded="ZodBranded",Use.ZodPipeline="ZodPipeline",Use.ZodReadonly="ZodReadonly";const $se=Kae.create,Vse=Yae.create,Bse=Ose.create,zse=Xae.create,Hse=Zae.create,qse=Qae.create,Gse=Jae.create,Kse=ese.create,Wse=tse.create,Yse=nse.create,Xse=rse.create,Zse=ose.create,Qse=ise.create,Jse=ase.create,ele=lse.create,tle=lse.strictCreate,nle=cse.create,rle=dse.create,ole=fse.create,ile=hse.create,ale=mse.create,sle=gse.create,lle=vse.create,cle=yse.create,ule=bse.create,dle=xse.create,ple=_se.create,fle=Sse.create,hle=Ese.create,mle=Tse.create,gle=Cse.create,vle=Ase.create,yle=Tse.createWithPreprocess,ble=jse.create,xle={string:e=>Kae.create({...e,coerce:!0}),number:e=>Yae.create({...e,coerce:!0}),boolean:e=>Zae.create({...e,coerce:!0}),bigint:e=>Xae.create({...e,coerce:!0}),date:e=>Qae.create({...e,coerce:!0})},wle=lae;var _le=Object.freeze({__proto__:null,defaultErrorMap:nae,setErrorMap:function(e){rae=e},getErrorMap:oae,makeIssue:iae,EMPTY_PATH:[],addIssueToContext:aae,ParseStatus:sae,INVALID:lae,DIRTY:cae,OK:uae,isAborted:dae,isDirty:pae,isValid:fae,isAsync:hae,get util(){return Yie},get objectUtil(){return Zie},ZodParsedType:Qie,getParsedType:Jie,ZodType:Eae,datetimeRegex:Hae,ZodString:Kae,ZodNumber:Yae,ZodBigInt:Xae,ZodBoolean:Zae,ZodDate:Qae,ZodSymbol:Jae,ZodUndefined:ese,ZodNull:tse,ZodAny:nse,ZodUnknown:rse,ZodNever:ose,ZodVoid:ise,ZodArray:ase,ZodObject:lse,ZodUnion:cse,ZodDiscriminatedUnion:dse,ZodIntersection:fse,ZodTuple:hse,ZodRecord:mse,ZodMap:gse,ZodSet:vse,ZodFunction:yse,ZodLazy:bse,ZodLiteral:xse,ZodEnum:_se,ZodNativeEnum:Sse,ZodPromise:Ese,ZodEffects:Tse,ZodTransformer:Tse,ZodOptional:Cse,ZodNullable:Ase,ZodDefault:Nse,ZodCatch:Rse,ZodNaN:Ose,BRAND:Pse,ZodBranded:kse,ZodPipeline:jse,ZodReadonly:Mse,custom:Dse,Schema:Eae,ZodSchema:Eae,late:Ise,get ZodFirstPartyTypeKind(){return Fse},coerce:xle,any:Yse,array:Jse,bigint:zse,boolean:Hse,date:qse,discriminatedUnion:rle,effect:mle,enum:ple,function:cle,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Dse((t=>t instanceof e),t),intersection:ole,lazy:ule,literal:dle,map:sle,nan:Bse,nativeEnum:fle,never:Zse,null:Wse,nullable:vle,number:Vse,object:ele,oboolean:()=>Hse().optional(),onumber:()=>Vse().optional(),optional:gle,ostring:()=>$se().optional(),pipeline:ble,preprocess:yle,promise:hle,record:ale,set:lle,strictObject:tle,string:$se,symbol:Gse,transformer:mle,tuple:ile,undefined:Kse,union:nle,unknown:Xse,void:Qse,NEVER:wle,ZodIssueCode:eae,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:tae}),Sle=(e=>(e.AWS_TOLL_FREE_NUMBER="aws_toll_free_number",e))(Sle||{}),Ele=(e=>(e.TWO_FACTOR_AUTH="two_factor_authentication",e.ONE_TIME_PASSWORD="one_time_passwords",e.NOTIFICATIONS="notifications",e.POLLING_SURVEYS="polling_and_surveys",e.INFO_ON_DEMAND="info_on_demand",e.PROMOTIONS_MARKETING="promotions_and_marketing",e.OTHER="other",e))(Ele||{});const Tle=_le.object({type:_le.literal("aws_toll_free_number"),tollFreeNumber:_le.string(),company:_le.object({name:_le.string().describe("The legal name of the company"),website:_le.string().url(),address1:_le.string(),address2:_le.string().optional(),city:_le.string(),stateProvince:_le.string(),zipCode:_le.string(),country:_le.string().length(2)}),contact:_le.object({firstName:_le.string(),lastName:_le.string(),email:_le.string().email(),phoneNumber:_le.string().regex(/^\+\d+$/,{message:"Phone number must start with '+' and contain only digits"})}),messagingUseCase:_le.object({monthlyVolume:_le.number().int().positive(),category:_le.nativeEnum(Ele),useCaseDetails:_le.string().optional().refine((e=>void 0!==e||""!==e),{message:"Use case details are required when category is 'Other'"})}),messageSamples:_le.array(_le.string()).min(1).max(3).describe("Enter an example message of an SMS message body that will be sent to your end users")}),Cle=_le.discriminatedUnion("type",[Tle]);var Ale=(e=>(e.PENDING="pending",e.APPROVED="approved",e.REJECTED="rejected",e))(Ale||{}),Nle=e=>"checkbox"===e.type,Rle=e=>e instanceof Date,Ole=e=>null==e;const Ple=e=>"object"==typeof e;var kle=e=>!Ole(e)&&!Array.isArray(e)&&Ple(e)&&!Rle(e),jle=e=>kle(e)&&e.target?Nle(e.target)?e.target.checked:e.target.value:e,Mle=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),Lle="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function Dle(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(Lle&&(e instanceof Blob||r)||!n&&!kle(e))return e;if(t=n?[]:{},n||(e=>{const t=e.constructor&&e.constructor.prototype;return kle(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const n in e)e.hasOwnProperty(n)&&(t[n]=Dle(e[n]));else t=e}return t}var Ile=e=>Array.isArray(e)?e.filter(Boolean):[],Fle=e=>void 0===e,Ule=(e,t,n)=>{if(!t||!kle(e))return n;const r=Ile(t.split(/[,[\].]+?/)).reduce(((e,t)=>Ole(e)?e:e[t]),e);return Fle(r)||r===e?Fle(e[t])?n:e[t]:r},$le=e=>"boolean"==typeof e,Vle=e=>/^\w*$/.test(e),Ble=e=>Ile(e.replace(/["|']|\]/g,"").split(/\.|\[/)),zle=(e,t,n)=>{let r=-1;const o=Vle(t)?[t]:Ble(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=kle(n)||Array.isArray(n)?n:isNaN(+o[r+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=i,e=e[t]}};const Hle="blur",qle="focusout",Gle="change",Kle="onBlur",Wle="onChange",Yle="onSubmit",Xle="onTouched",Zle="all",Qle="max",Jle="min",ece="maxLength",tce="minLength",nce="pattern",rce="required",oce="validate",ice=n.createContext(null),ace=()=>n.useContext(ice);var sce=(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]!==Zle&&(t._proxyFormState[o]=!r||Zle),n&&(n[o]=!0),e[o]}});return o},lce=e=>Ole(e)||!Ple(e);function cce(e,t){if(lce(e)||lce(t))return e===t;if(Rle(e)&&Rle(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(Rle(n)&&Rle(e)||kle(n)&&kle(e)||Array.isArray(n)&&Array.isArray(e)?!cce(n,e):n!==e)return!1}}return!0}const uce=(e,t)=>{const r=n.useRef(t);cce(t,r.current)||(r.current=t),n.useEffect(e,r.current)};var dce=e=>"string"==typeof e,pce=(e,t,n,r,o)=>dce(e)?(r&&t.watch.add(e),Ule(n,e,o)):Array.isArray(e)?e.map((e=>(r&&t.watch.add(e),Ule(n,e)))):(r&&(t.watchAll=!0),n);function fce(e){const t=ace(),{name:r,disabled:o,control:i=t.control,shouldUnregister:a}=e,s=Mle(i._names.array,r),l=function(e){const t=ace(),{control:r=t.control,name:o,defaultValue:i,disabled:a,exact:s}=e||{},[l,c]=n.useState(r._getWatch(o,i));return uce((()=>r._subscribe({name:o,formState:{values:!0},exact:s,callback:e=>!a&&c(pce(o,r._names,e.values||r._formValues,!1,i))})),[o,i,a,s]),n.useEffect((()=>r._removeUnmounted())),l}({control:i,name:r,defaultValue:Ule(i._formValues,r,Ule(i._defaultValues,r,e.defaultValue)),exact:!0}),c=function(e){const t=ace(),{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 uce((()=>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((()=>sce(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,...$le(e.disabled)?{disabled:e.disabled}:{}})),p=n.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ule(c.errors,r)},isDirty:{enumerable:!0,get:()=>!!Ule(c.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Ule(c.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Ule(c.validatingFields,r)},error:{enumerable:!0,get:()=>Ule(c.errors,r)}})),[c,r]),f=n.useCallback((e=>d.current.onChange({target:{value:jle(e),name:r},type:Gle})),[r]),h=n.useCallback((()=>d.current.onBlur({target:{value:Ule(i._formValues,r),name:r},type:Hle})),[r,i._formValues]),m=n.useCallback((e=>{const t=Ule(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,...$le(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,...$le(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const n=Ule(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(r,!0),e){const e=Dle(Ule(i._options.defaultValues,r));zle(i._defaultValues,r,e),Fle(Ule(i._formValues,r))&&zle(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 hce=e=>e.render(fce(e));var mce=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},gce=e=>Array.isArray(e)?e:[e],vce=()=>{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=[]}}},yce=e=>kle(e)&&!Object.keys(e).length,bce=e=>"file"===e.type,xce=e=>"function"==typeof e,wce=e=>{if(!Lle)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},_ce=e=>"select-multiple"===e.type,Sce=e=>"radio"===e.type,Ece=e=>wce(e)&&e.isConnected;function Tce(e,t){const n=Array.isArray(t)?t:Vle(t)?[t]:Ble(t),r=1===n.length?e:function(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Fle(e)?r++:e[t[r++]];return e}(e,n),o=n.length-1;return r&&delete r[n[o]],0!==o&&(kle(r)&&yce(r)||Array.isArray(r)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!Fle(e[t]))return!1;return!0}(r))&&Tce(e,n.slice(0,-1)),e}var Cce=e=>{for(const t in e)if(xce(e[t]))return!0;return!1};function Ace(e,t={}){const n=Array.isArray(e);if(kle(e)||n)for(const r in e)Array.isArray(e[r])||kle(e[r])&&!Cce(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Ace(e[r],t[r])):Ole(e[r])||(t[r]=!0);return t}function Nce(e,t,n){const r=Array.isArray(e);if(kle(e)||r)for(const o in e)Array.isArray(e[o])||kle(e[o])&&!Cce(e[o])?Fle(t)||lce(n[o])?n[o]=Array.isArray(e[o])?Ace(e[o],[]):{...Ace(e[o])}:Nce(e[o],Ole(t)?{}:t[o],n[o]):n[o]=!cce(e[o],t[o]);return n}var Rce=(e,t)=>Nce(e,t,Ace(t));const Oce={value:!1,isValid:!1},Pce={value:!0,isValid:!0};var kce=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&&!Fle(e[0].attributes.value)?Fle(e[0].value)||""===e[0].value?Pce:{value:e[0].value,isValid:!0}:Pce:Oce}return Oce},jce=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Fle(e)?e:t?""===e?NaN:e?+e:e:n&&dce(e)?new Date(e):r?r(e):e;const Mce={isValid:!1,value:null};var Lce=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),Mce):Mce;function Dce(e){const t=e.ref;return bce(t)?t.files:Sce(t)?Lce(e.refs).value:_ce(t)?[...t.selectedOptions].map((({value:e})=>e)):Nle(t)?kce(e.refs).value:jce(Fle(t.value)?e.ref.value:t.value,e)}var Ice=e=>e instanceof RegExp,Fce=e=>Fle(e)?e:Ice(e)?e.source:kle(e)?Ice(e.value)?e.value.source:e.value:e,Uce=e=>({isOnSubmit:!e||e===Yle,isOnBlur:e===Kle,isOnChange:e===Wle,isOnAll:e===Zle,isOnTouch:e===Xle});const $ce="AsyncFunction";var Vce=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const Bce=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const n=Ule(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(Bce(i,t))break}else if(kle(i)&&Bce(i,t))break}}};function zce(e,t,n){const r=Ule(e,n);if(r||Vle(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const r=o.join("."),i=Ule(t,r),a=Ule(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 Hce=(e,t,n)=>{const r=gce(Ule(e,n));return zle(r,"root",t[n]),zle(e,n,r),e},qce=e=>dce(e);function Gce(e,t,n="validate"){if(qce(e)||Array.isArray(e)&&e.every(qce)||$le(e)&&!e)return{type:n,message:qce(e)?e:"",ref:t}}var Kce=e=>kle(e)&&!Ice(e)?e:{value:e,message:""},Wce=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=Ule(n,m);if(!v||t.has(m))return{};const b=s?s[0]:a,x=e=>{o&&b.reportValidity&&(b.setCustomValidity($le(e)?"":e||""),b.reportValidity())},w={},_=Sce(a),S=Nle(a),E=_||S,T=(g||bce(a))&&Fle(a.value)&&Fle(y)||wce(a)&&""===a.value||""===y||Array.isArray(y)&&!y.length,C=mce.bind(null,m,r,w),A=(e,t,n,r=ece,o=tce)=>{const i=e?t:n;w[m]={type:e?r:o,message:i,ref:a,...C(e?r:o,i)}};if(i?!Array.isArray(y)||!y.length:l&&(!E&&(T||Ole(y))||$le(y)&&!y||S&&!kce(s).isValid||_&&!Lce(s).isValid)){const{value:e,message:t}=qce(l)?{value:!!l,message:l}:Kce(l);if(e&&(w[m]={type:rce,message:t,ref:b,...C(rce,t)},!r))return x(t),w}if(!(T||Ole(d)&&Ole(p))){let e,t;const n=Kce(p),o=Kce(d);if(Ole(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;dce(n.value)&&y&&(e=s?i(y)>i(n.value):l?y>n.value:r>new Date(n.value)),dce(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);Ole(n.value)||(e=r>n.value),Ole(o.value)||(t=r<o.value)}if((e||t)&&(A(!!e,n.message,o.message,Qle,Jle),!r))return x(w[m].message),w}if((c||u)&&!T&&(dce(y)||i&&Array.isArray(y))){const e=Kce(c),t=Kce(u),n=!Ole(e.value)&&y.length>+e.value,o=!Ole(t.value)&&y.length<+t.value;if((n||o)&&(A(n,e.message,t.message),!r))return x(w[m].message),w}if(f&&!T&&dce(y)){const{value:e,message:t}=Kce(f);if(Ice(e)&&!y.match(e)&&(w[m]={type:nce,message:t,ref:a,...C(nce,t)},!r))return x(t),w}if(h)if(xce(h)){const e=Gce(await h(y,n),b);if(e&&(w[m]={...e,...C(oce,e.message)},!r))return x(e.message),w}else if(kle(h)){let e={};for(const t in h){if(!yce(e)&&!r)break;const o=Gce(await h[t](y,n),b,t);o&&(e={...o,...C(t,o.message)},x(o.message),r&&(w[m]=e))}if(!yce(e)&&(w[m]={ref:b,...e},!r))return w}return x(!0),w};const Yce={mode:Yle,reValidateMode:Wle,shouldFocusError:!0};function Xce(e={}){let t={...Yce,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:xce(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=(kle(t.defaultValues)||kle(t.values))&&Dle(t.values||t.defaultValues)||{},a=t.shouldUnregister?{}:Dle(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:vce(),state:vce()},f=Uce(t.mode),h=Uce(t.reValidateMode),m=t.criteriaMode===Zle,g=async e=>{if(!t.disabled&&(u.isValid||d.isValid||e)){const e=t.resolver?yce((await w()).errors):await _(r,!0);e!==n.isValid&&p.state.next({isValid:e})}},v=(e,r)=>{!t.disabled&&(u.isValidating||u.validatingFields||d.isValidating||d.validatingFields)&&((e||Array.from(l.mount)).forEach((e=>{e&&(r?zle(n.validatingFields,e,r):Tce(n.validatingFields,e))})),p.state.next({validatingFields:n.validatingFields,isValidating:!yce(n.validatingFields)}))},y=(e,t,n,o)=>{const l=Ule(r,e);if(l){const r=Ule(a,e,Fle(n)?Ule(i,e):n);Fle(r)||o&&o.defaultChecked||t?zle(a,e,t?r:Dce(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=cce(Ule(i,e),r);c=!!Ule(n.dirtyFields,e),t?Tce(n.dirtyFields,e):zle(n.dirtyFields,e,!0),f.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||d.dirtyFields)&&c!==!t}if(o){const t=Ule(n.touchedFields,e);t||(zle(n.touchedFields,e,o),f.touchedFields=n.touchedFields,l=l||(u.touchedFields||d.touchedFields)&&t!==o)}l&&s&&p.state.next(f)}return l?f:{}},x=(e,r,i,a)=>{const s=Ule(n.errors,e),l=(u.isValid||d.isValid)&&$le(r)&&n.isValid!==r;if(t.delayError&&i?(o=(e=>t=>{clearTimeout(c),c=setTimeout(e,t)})((()=>((e,t)=>{zle(n.errors,e,t),p.state.next({errors:n.errors})})(e,i))),o(t.delayError)):(clearTimeout(c),o=null,i?zle(n.errors,e,i):Tce(n.errors,e)),(i?!cce(s,i):s)||!yce(a)||l){const t={...a,...l&&$le(r)?{isValid:r}:{},errors:n.errors,name:e};n={...n,...t},p.state.next(t)}},w=async e=>{v(e,!0);const n=await t.resolver(a,t.context,((e,t,n,r)=>{const o={};for(const i of e){const e=Ule(t,i);e&&zle(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&&!!(xce(i.validate)&&i.validate.constructor.name===$ce||kle(i.validate)&&Object.values(i.validate).find((e=>e.constructor.name===$ce))));p&&u.validatingFields&&v([s],!0);const f=await Wce(c,l.disabled,a,m,t.shouldUseNativeValidation&&!r,d);if(p&&u.validatingFields&&v([s]),f[e.name]&&(o.valid=!1,r))break;!r&&(Ule(f,e.name)?d?Hce(n.errors,f,e.name):zle(n.errors,e.name,f[e.name]):Tce(n.errors,e.name))}!yce(d)&&await _(d,r,o)}}var i;return o.valid},S=(e,n)=>!t.disabled&&(e&&n&&zle(a,e,n),!cce(P(),i)),E=(e,t,n)=>pce(e,l,{...s.mount?a:Fle(t)?i:dce(e)?{[e]:t}:t},n,t),T=(e,t,n={})=>{const o=Ule(r,e);let i=t;if(o){const n=o._f;n&&(!n.disabled&&zle(a,e,jce(t,n)),i=wce(n.ref)&&Ole(t)?"":t,_ce(n.ref)?[...n.ref.options].forEach((e=>e.selected=i.includes(e.value))):n.refs?Nle(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)):bce(n.ref)?n.ref.value="":(n.ref.value=i,n.ref.type||p.state.next({name:e,values:Dle(a)})))}(n.shouldDirty||n.shouldTouch)&&b(e,i,n.shouldTouch,n.shouldDirty,!0),n.shouldValidate&&O(e)},C=(e,t,n)=>{for(const o in t){const i=t[o],a=`${e}.${o}`,s=Ule(r,a);(l.array.has(e)||kle(i)||s&&!s._f)&&!Rle(i)?C(a,i,n):T(a,i,n)}},A=(e,t,o={})=>{const c=Ule(r,e),f=l.array.has(e),h=Dle(t);zle(a,e,h),f?(p.array.next({name:e,values:Dle(a)}),(u.isDirty||u.dirtyFields||d.isDirty||d.dirtyFields)&&o.shouldDirty&&p.state.next({name:e,dirtyFields:Rce(i,a),isDirty:S(e,h)})):!c||c._f||Ole(h)?T(e,h,o):C(e,h,o),Vce(e,l)&&p.state.next({...n}),p.state.next({name:s.mount?e:void 0,values:Dle(a)})},N=async e=>{s.mount=!0;const i=e.target;let c=i.name,y=!0;const S=Ule(r,c),E=e=>{y=Number.isNaN(e)||Rle(e)&&isNaN(e.getTime())||cce(e,Ule(a,c,e))};if(S){let s,C;const A=i.type?Dce(S._f):jle(e),N=e.type===Hle||e.type===qle,R=!((T=S._f).mount&&(T.required||T.min||T.max||T.maxLength||T.minLength||T.pattern||T.validate)||t.resolver||Ule(n.errors,c)||S._f.deps)||((e,t,n,r,o)=>!o.isOnAll&&(!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:!(n?r.isOnChange:o.isOnChange)||e))(N,Ule(n.touchedFields,c),n.isSubmitted,h,f),P=Vce(c,l,N);zle(a,c,A),N?(S._f.onBlur&&S._f.onBlur(e),o&&o(0)):S._f.onChange&&S._f.onChange(e);const k=b(c,A,N),j=!yce(k)||P;if(!N&&p.state.next({name:c,type:e.type,values:Dle(a)}),R)return(u.isValid||d.isValid)&&("onBlur"===t.mode?N&&g():N||g()),j&&p.state.next({name:c,...P?{}:k});if(!N&&P&&p.state.next({...n}),t.resolver){const{errors:e}=await w([c]);if(E(A),y){const t=zce(n.errors,r,c),o=zce(e,r,t.name||c);s=o.error,c=o.name,C=yce(e)}}else v([c],!0),s=(await Wce(S,l.disabled,a,m,t.shouldUseNativeValidation))[c],v([c]),E(A),y&&(s?C=!1:(u.isValid||d.isValid)&&(C=await _(r,!0)));y&&(S._f.deps&&O(S._f.deps),x(c,C,s,k))}var T},R=(e,t)=>{if(Ule(n.errors,t)&&e.focus)return e.focus(),1},O=async(e,o={})=>{let i,a;const s=gce(e);if(t.resolver){const t=await(async e=>{const{errors:t}=await w(e);if(e)for(const r of e){const e=Ule(t,r);e?zle(n.errors,r,e):Tce(n.errors,r)}else n.errors=t;return t})(Fle(e)?e:s);i=yce(t),a=e?!s.some((e=>Ule(t,e))):i}else e?(a=(await Promise.all(s.map((async e=>{const t=Ule(r,e);return await _(t&&t._f?{[e]:t}:t)})))).every(Boolean),(a||n.isValid)&&g()):a=i=await _(r);return p.state.next({...!dce(e)||(u.isValid||d.isValid)&&i!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:i}:{},errors:n.errors}),o.shouldFocus&&!a&&Bce(r,R,e?s:l.mount),a},P=e=>{const t={...s.mount?a:i};return Fle(e)?t:dce(e)?Ule(t,e):e.map((e=>Ule(t,e)))},k=(e,t)=>({invalid:!!Ule((t||n).errors,e),isDirty:!!Ule((t||n).dirtyFields,e),error:Ule((t||n).errors,e),isValidating:!!Ule(n.validatingFields,e),isTouched:!!Ule((t||n).touchedFields,e)}),j=(e,t,o)=>{const i=(Ule(r,e,{_f:{}})._f||{}).ref,a=Ule(n.errors,e)||{},{ref:s,message:l,type:c,...u}=a;zle(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()},M=e=>p.state.subscribe({next:t=>{var r,o,i;o=t.name,i=e.exact,(r=e.name)&&o&&r!==o&&!gce(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 yce(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find((e=>t[e]===(!r||Zle)))})(t,e.formState||u,B,e.reRenderRoot)||e.callback({values:{...a},...n,...t})}}).unsubscribe,L=(e,o={})=>{for(const s of e?gce(e):l.mount)l.mount.delete(s),l.array.delete(s),o.keepValue||(Tce(r,s),Tce(a,s)),!o.keepError&&Tce(n.errors,s),!o.keepDirty&&Tce(n.dirtyFields,s),!o.keepTouched&&Tce(n.touchedFields,s),!o.keepIsValidating&&Tce(n.validatingFields,s),!t.shouldUnregister&&!o.keepDefaultValue&&Tce(i,s);p.state.next({values:Dle(a)}),p.state.next({...n,...o.keepDirty?{isDirty:S()}:{}}),!o.keepIsValid&&g()},D=({disabled:e,name:t})=>{($le(e)&&s.mount||e||l.disabled.has(t))&&(e?l.disabled.add(t):l.disabled.delete(t))},I=(e,n={})=>{let o=Ule(r,e);const a=$le(n.disabled)||$le(t.disabled);return zle(r,e,{...o||{},_f:{...o&&o._f?o._f:{ref:{name:e}},name:e,mount:!0,...n}}),l.mount.add(e),o?D({disabled:$le(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:Fce(n.min),max:Fce(n.max),minLength:Fce(n.minLength),maxLength:Fce(n.maxLength),pattern:Fce(n.pattern)}:{},name:e,onChange:N,onBlur:N,ref:a=>{if(a){I(e,n),o=Ule(r,e);const t=Fle(a.value)&&a.querySelectorAll&&a.querySelectorAll("input,select,textarea")[0]||a,s=(e=>Sce(e)||Nle(e))(t),l=o._f.refs||[];if(s?l.find((e=>e===t)):t===o._f.ref)return;zle(r,e,{_f:{...o._f,...s?{refs:[...l.filter(Ece),t,...Array.isArray(Ule(i,e))?[{}]:[]],ref:{type:t.type,name:e}}:{ref:t}}}),y(e,!1,void 0,t)}else o=Ule(r,e,{}),o._f&&(o._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&(!Mle(l.array,e)||!s.action)&&l.unMount.add(e)}}},F=()=>t.shouldFocusError&&Bce(r,R,l.mount),U=(e,o)=>async i=>{let s;i&&(i.preventDefault&&i.preventDefault(),i.persist&&i.persist());let c=Dle(a);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:e,values:t}=await w();n.errors=e,c=t}else await _(r);if(l.disabled.size)for(const e of l.disabled)zle(c,e,void 0);if(Tce(n.errors,"root"),yce(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:yce(n.errors)&&!s,submitCount:n.submitCount+1,errors:n.errors}),s)throw s},$=(e,o={})=>{const c=e?Dle(e):i,d=Dle(c),f=yce(e),h=f?i:d;if(o.keepDefaultValues||(i=c),!o.keepValues){if(o.keepDirtyValues){const e=new Set([...l.mount,...Object.keys(Rce(i,a))]);for(const t of Array.from(e))Ule(n.dirtyFields,t)?zle(h,t,Ule(a,t)):A(t,Ule(h,t))}else{if(Lle&&Fle(e))for(const e of l.mount){const t=Ule(r,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(wce(e)){const t=e.closest("form");if(t){t.reset();break}}}}for(const e of l.mount)A(e,Ule(h,e))}a=Dle(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||cce(e,i))),isSubmitted:!!o.keepIsSubmitted&&n.isSubmitted,dirtyFields:f?{}:o.keepDirtyValues?o.keepDefaultValues&&a?Rce(i,a):n.dirtyFields:o.keepDefaultValues&&e?Rce(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)=>$(xce(e)?e(a):e,t),B=e=>{n={...n,...e}},z={control:{register:I,unregister:L,getFieldState:k,handleSubmit:U,setError:j,_subscribe:M,_runSchema:w,_getWatch:E,_getDirty:S,_setValid:g,_setFieldArray:(e,o=[],l,c,f=!0,h=!0)=>{if(c&&l&&!t.disabled){if(s.action=!0,h&&Array.isArray(Ule(r,e))){const t=l(Ule(r,e),c.argA,c.argB);f&&zle(r,e,t)}if(h&&Array.isArray(Ule(n.errors,e))){const t=l(Ule(n.errors,e),c.argA,c.argB);f&&zle(n.errors,e,t),((e,t)=>{!Ile(Ule(e,t)).length&&Tce(e,t)})(n.errors,e)}if((u.touchedFields||d.touchedFields)&&h&&Array.isArray(Ule(n.touchedFields,e))){const t=l(Ule(n.touchedFields,e),c.argA,c.argB);f&&zle(n.touchedFields,e,t)}(u.dirtyFields||d.dirtyFields)&&(n.dirtyFields=Rce(i,a)),p.state.next({name:e,isDirty:S(e,o),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else zle(a,e,o)},_setDisabledField:D,_setErrors:e=>{n.errors=e,p.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>Ile(Ule(s.mount?a:i,e,t.shouldUnregister?Ule(i,e,[]):[])),_reset:$,_resetDefaultValues:()=>xce(t.defaultValues)&&t.defaultValues().then((e=>{V(e,t.resetOptions),p.state.next({isLoading:!1})})),_removeUnmounted:()=>{for(const e of l.unMount){const t=Ule(r,e);t&&(t._f.refs?t._f.refs.every((e=>!Ece(e))):!Ece(t._f.ref))&&L(e)}l.unMount=new Set},_disableForm:e=>{$le(e)&&(p.state.next({disabled:e}),Bce(r,((t,n)=>{const o=Ule(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},M({...e,formState:d})),trigger:O,register:I,handleSubmit:U,watch:(e,t)=>xce(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={})=>{Ule(r,e)&&(Fle(t.defaultValue)?A(e,Dle(Ule(i,e))):(A(e,t.defaultValue),zle(i,e,Dle(t.defaultValue))),t.keepTouched||Tce(n.touchedFields,e),t.keepDirty||(Tce(n.dirtyFields,e),n.isDirty=t.defaultValue?S(e,Dle(Ule(i,e))):S()),t.keepError||(Tce(n.errors,e),u.isValid&&g()),p.state.next({...n}))},clearErrors:e=>{e&&gce(e).forEach((e=>Tce(n.errors,e))),p.state.next({errors:e?n.errors:{}})},unregister:L,setError:j,setFocus:(e,t={})=>{const n=Ule(r,e),o=n&&n._f;if(o){const e=o.refs?o.refs[0]:o.ref;e.focus&&(e.focus(),t.shouldSelect&&xce(e.select)&&e.select())}},getFieldState:k};return{...z,formControl:z}}const Zce="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function Qce(e={}){const t=n.useRef(void 0),r=n.useRef(void 0),[o,i]=n.useState({isDirty:!1,isValidating:!1,isLoading:xce(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:xce(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...e.formControl?e.formControl:Xce(e),formState:o},e.formControl&&e.defaultValues&&!xce(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions));const a=t.current.control;return a._options=e,Zce((()=>{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&&!yce(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&&!cce(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=sce(o,a),t.current}const Jce=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Ule(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},eue=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?Jce(r.ref,n,e):r.refs&&r.refs.forEach((t=>Jce(t,n,e)))}},tue=(e,t)=>{t.shouldUseNativeValidation&&eue(e,t);const n={};for(const r in e){const o=Ule(t.fields,r),i=Object.assign(e[r]||{},{ref:o&&o.ref});if(nue(t.names||Object.keys(e),r)){const e=Object.assign({},Ule(n,r));zle(e,"root",i),zle(n,r,e)}else zle(n,r,i)}return n},nue=(e,t)=>e.some((e=>e.startsWith(t+".")));var rue=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]=mce(a,t,n,o,c?[].concat(c,r.message):r.message)}e.shift()}return n},oue=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&&eue({},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:tue(rue(e.errors,!i.shouldUseNativeValidation&&"all"===i.criteriaMode),i)};var t;throw e})))}catch(a){return Promise.reject(a)}}};const iue=e=>{const{children:t,...r}=e;return n.createElement(ice.Provider,{value:r},t)},aue=i.createContext({}),sue=({...e})=>t.jsx(aue.Provider,{value:{name:e.name},children:t.jsx(hce,{...e})}),lue=()=>{const e=i.useContext(aue),t=i.useContext(cue),{getFieldState:n,formState:r}=ace(),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}},cue=i.createContext({}),uue=i.forwardRef((({className:e,...n},r)=>{const o=i.useId();return t.jsx(cue.Provider,{value:{id:o},children:t.jsx("div",{ref:r,className:rp("space-y-2",e),...n})})}));uue.displayName="FormItem";const due=i.forwardRef((({className:e,...n},r)=>{const{error:o,formItemId:i}=lue();return t.jsx(nee,{ref:r,className:rp(o&&"text-destructive",e),htmlFor:i,...n})}));due.displayName="FormLabel";const pue=i.forwardRef((({...e},n)=>{const{error:r,formItemId:o,formDescriptionId:i,formMessageId:a}=lue();return t.jsx(RZ,{ref:n,id:o,"aria-describedby":r?`${i} ${a}`:`${i}`,"aria-invalid":!!r,...e})}));pue.displayName="FormControl";i.forwardRef((({className:e,...n},r)=>{const{formDescriptionId:o}=lue();return t.jsx("p",{ref:r,id:o,className:rp("text-[0.8rem] text-muted-foreground",e),...n})})).displayName="FormDescription";const fue=i.forwardRef((({className:e,children:n,...r},o)=>{const{error:i,formMessageId:a}=lue(),s=i?String(i?.message):n;return s?t.jsx("p",{ref:o,id:a,className:rp("text-[0.8rem] font-medium text-destructive",e),...r,children:s}):null}));fue.displayName="FormMessage";const hue=({title:e,description:n,children:r})=>t.jsxs("div",{className:"text-left",children:[t.jsx("h3",{className:"text-lg font-medium text-foreground mb-1",children:e}),t.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:n}),t.jsx("div",{className:"space-y-4",children:r})]}),mue=Cle,gue=({control:e,name:n,label:r,placeholder:o,type:i="text",disabled:a})=>t.jsx(sue,{control:e,name:n,render:({field:e})=>t.jsxs(uue,{children:[t.jsx(due,{className:"text-sm font-medium",children:r}),t.jsx(pue,{children:t.jsx(s5,{...e,value:"number"===i?e.value||"":e.value,type:i,placeholder:o,className:"h-10",disabled:a,onChange:t=>{if("number"===i){const n=""===t.target.value?"":Number(t.target.value);e.onChange(n)}else e.onChange(t)}})}),t.jsx(fue,{})]})}),vue=({isSubmitting:e,onSubmit:n})=>{const r=Qce({resolver:oue(mue),defaultValues:{type:Sle.AWS_TOLL_FREE_NUMBER,tollFreeNumber:"",company:{name:"",website:"",address1:"",address2:"",city:"",stateProvince:"",zipCode:"",country:""},contact:{firstName:"",lastName:"",email:"",phoneNumber:""},messagingUseCase:{monthlyVolume:0,category:Ele.PROMOTIONS_MARKETING,useCaseDetails:""},messageSamples:[""]},values:void 0}),o=r.watch("messageSamples");return t.jsx("div",{className:"w-full max-w-4xl",children:t.jsx(iue,{...r,children:t.jsxs("form",{onSubmit:r.handleSubmit((async e=>{const t={...e,messagingUseCase:{...e.messagingUseCase,monthlyVolume:Number(e.messagingUseCase.monthlyVolume)}};await n(t)})),className:"space-y-6",children:[t.jsxs(hue,{title:"Legal business settings",description:"Provide your legal business information required for SMS channel verification and future communications.",children:[t.jsx(gue,{control:r.control,name:"company.name",label:"Business Name",placeholder:"Enter your business name",disabled:e}),t.jsx(gue,{control:r.control,name:"company.website",label:"Business Website",placeholder:"https://example.com",type:"url",disabled:e}),t.jsxs("div",{children:[t.jsx(due,{className:"text-sm font-medium",children:"Business Address"}),t.jsxs("div",{className:"grid grid-cols-1 gap-3 mt-2",children:[t.jsx(gue,{control:r.control,name:"company.address1",placeholder:"Street address",disabled:e}),t.jsx(gue,{control:r.control,name:"company.address2",placeholder:"Apartment, suite, unit, etc. (optional)",disabled:e}),t.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[t.jsx(gue,{control:r.control,name:"company.city",placeholder:"City",disabled:e}),t.jsx(gue,{control:r.control,name:"company.stateProvince",placeholder:"State/Province",disabled:e}),t.jsx(gue,{control:r.control,name:"company.zipCode",placeholder:"ZIP code",disabled:e})]}),t.jsx(gue,{control:r.control,name:"company.country",placeholder:"Country code (e.g., US)",disabled:e})]})]})]}),t.jsxs(hue,{title:"Contact Information",description:"Provide the contact information of the person authorized to represent your business.",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsx(gue,{control:r.control,name:"contact.firstName",label:"First Name",placeholder:"First name",disabled:e}),t.jsx(gue,{control:r.control,name:"contact.lastName",label:"Last Name",placeholder:"Last name",disabled:e})]}),t.jsx(gue,{control:r.control,name:"contact.email",label:"Email",placeholder:"Email address",type:"email",disabled:e}),t.jsx(gue,{control:r.control,name:"contact.phoneNumber",label:"Contact Phone",placeholder:"+1234567890",type:"tel",disabled:e})]}),t.jsxs(hue,{title:"Messaging Use Case",description:"Tell us about how you plan to use SMS messaging.",children:[t.jsx(gue,{control:r.control,name:"messagingUseCase.monthlyVolume",label:"Expected Monthly Volume",placeholder:"1000",type:"number",disabled:e}),t.jsx(gue,{control:r.control,name:"messagingUseCase.useCaseDetails",label:"Use Case Details",placeholder:"Describe your use case in detail",disabled:e})]}),t.jsxs(hue,{title:"Message Samples",description:"Provide examples of messages you plan to send (up to 3 samples).",children:[t.jsx(QB,{children:o.map(((n,i)=>t.jsxs(DX.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2},className:"relative",children:[t.jsx(gue,{control:r.control,name:`messageSamples.${i}`,label:`Sample Message ${i+1}`,placeholder:"Enter a sample message",disabled:e}),o.length>1&&t.jsx(DX.button,{type:"button",onClick:()=>(e=>{if(o.length>1){const t=o.filter(((t,n)=>n!==e));r.setValue("messageSamples",t)}})(i),className:"absolute -right-2 -top-2 rounded-full bg-red-100 p-1 text-red-600 hover:bg-red-200",whileHover:{scale:1.1},whileTap:{scale:.9},children:t.jsx(FZ.CloseButton,{className:"h-4 w-4"})})]},i)))}),o.length<3&&t.jsxs(DX.button,{type:"button",onClick:()=>{o.length<3&&r.setValue("messageSamples",[...o,""])},className:"mt-4 flex items-center gap-2 rounded-lg border border-dashed border-gray-300 px-4 py-2 text-sm text-gray-600 hover:border-gray-400 hover:text-gray-700",whileHover:{scale:1.02},whileTap:{scale:.98},children:[t.jsx(FZ.PlusIcon,{className:"h-4 w-4"}),"Add another sample"]})]}),t.jsx("div",{className:"flex gap-3 pt-4 justify-end",children:t.jsx(MZ,{type:"submit",disabled:e,children:e?"Submitting...":"Submit for approval"})})]})})})},yue=()=>{const[e,r]=n.useState(!1),{data:o,isLoading:i}={...ye({queryKey:Gie.all,queryFn:Kie,...Se})},{createSmsRegistrationApplication:a,isCreating:s}=Wie(),{toast:l}=Il();if(!o||i)return t.jsx("div",{className:"flex flex-col items-center justify-center p-8",children:t.jsx(EZ,{text:["Loading business information..."]})});const c={hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.4,0,.2,1]}}},u=o&&o.status===Ale.PENDING;return t.jsxs(DX.div,{initial:"hidden",animate:"visible",exit:"exit",variants:{hidden:{opacity:0,y:20},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.4,0,.2,1],staggerChildren:.1}},exit:{opacity:0,y:-20,transition:{duration:.3,ease:[.4,0,1,1]}}},className:rp("flex flex-col items-center text-center w-full max-w-[72ch] rounded-xl p-6 gap-3 border border-border mx-auto mb-16","bg-background"),children:[t.jsx(DX.div,{variants:c,className:"w-16 h-16 rounded-xl flex items-center justify-center",children:t.jsx(FZ.SmsIcon,{})}),t.jsx(DX.h2,{variants:c,className:"text-sm font-medium text-foreground",children:"Request your SMS sending number"}),t.jsxs(DX.div,{variants:c,className:"max-w-xl mx-auto",children:[t.jsx("p",{className:"text-sm font-normal text-muted-foreground mb-2",children:"Before you can send messages, we need to verify your business info with our SMS provider. Once approved, we'll assign you a phone number to send SMS campaigns."}),t.jsx("p",{className:"text-sm font-normal text-muted-foreground",children:"This usually takes 3-7 business days."})]}),t.jsx(QB,{mode:"wait",children:e?t.jsx(DX.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.3,ease:[.4,0,.2,1]},className:"w-full",children:t.jsx(vue,{isSubmitting:s,onSubmit:async e=>{try{a({application:e},{onSuccess:()=>{l({title:"SMS setup submission successful"}),r(!1)},onError:()=>{l({title:"SMS setup submission failed",description:"Please contact your administrator."})}})}catch(t){}}})},"form"):u?t.jsxs(DX.div,{variants:c,className:"flex items-center gap-2 px-3 py-1.5 bg-orange-50 border border-orange-200 rounded-full",children:[t.jsx(DX.div,{animate:{scale:[1,1.2,1],opacity:[1,.8,1]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-2 h-2 bg-orange-500 rounded-full"}),t.jsx("span",{className:"text-sm font-medium text-orange-800",children:"Pending approval"})]},"pending"):t.jsx(DX.div,{variants:c,children:t.jsx(MZ,{variant:"outline",className:"bg-background",onClick:()=>r(!0),children:"Request approval"})},"button")})]})},bue=()=>{const e=bZ(),r=xZ(),{channelSenders:o}=V7(),{channelAccounts:i}=U7(),a=n.useMemo((()=>H7({channelSenders:o?.results??[]})),[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.from&&null!==s.channelSenderMetadata.from?s.channelSenderMetadata.from:null,c=s.channelSenderMetadata.friendlyName||l&&null!==l?Bie(l??""):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:c})]})})},xue=({smsBody:e,imageUrls:n})=>t.jsxs(Mie,{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(bue,{})})}),t.jsx("div",{className:"rounded-lg p-6 bg-white flex-1 min-h-0 flex items-center justify-center",children:t.jsx(goe,{body:e,imageUrls:n})})]}),wue=({open:e,onOpenChange:n,automation:r})=>t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Send Preview SMS"}),t.jsx(FB,{children:"Send a preview SMS to the automation."})]}),t.jsx(zie,{automation:r,type:"sms",setOpenSendPreviewPopup:n,open:e})]})}),_ue=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1,setupRequired:i=!1})=>{const[a,s]=n.useState(!1),l=bZ(),c=xZ(),[u,d]=n.useState(!1);if(!l)return null;const p=c?.smsMessageBody||"",f=c?.smsChannelSenderId&&p.length>0,h=moe({companyName:c?.textMessageCompanyName??void 0,smsBody:p}),m=c?.textMessageMediaUrls??[];return i?t.jsx("div",{className:"w-full pt-8 mx-auto",children:t.jsx(yue,{})}):t.jsxs("div",{className:"flex flex-col items-center w-full h-full",children:[t.jsx(kie,{open:u,onOpenChange:d}),t.jsx(wue,{open:a,onOpenChange:s,automation:l}),t.jsx(Mie,{actionButtons:t.jsxs(t.Fragment,{children:[!e&&f&&t.jsx(Uie,{onClick:()=>s(!0)}),(l.status===ze.DRAFT||!r)&&t.jsx(MZ,{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:()=>d(!0),children:"Edit content"}),f&&t.jsx(Iie,{expandDialogContent:t.jsx(xue,{smsBody:h,imageUrls:m})})]}),children:f?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(bue,{})})}),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(goe,{body:h,imageUrls:m})})]}):t.jsx(Fie,{type:"sms",disablePreviewSubtext:o})})]})},Sue=({disablePreview:e=!1,disableEditContent:r=!1,disablePreviewSubtext:o=!1})=>{const i=(()=>{const{flags:e}=n.useContext(cl.reactContext);return e})()["show-settings-modal"]??!1,{state:{hideSms:a}}=n.useContext(l$),{channelSenders:s}=V7(),l=n.useMemo((()=>H7({channelSenders:s?.results??[]})),[s?.results]);if(!xZ()||!s)return t.jsx("div",{className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md",children:t.jsx(EZ,{text:["Loading..."]})});const c=!0===i&&0===l.length;return t.jsxs(Nie,{defaultValue:"email",className:"flex flex-col gap-4 pt-4 flex-1 bg-muted rounded-md pb-4",children:[t.jsx("div",{className:"max-w-[640px] mx-auto w-full",children:t.jsxs(Rie,{className:"grid w-full "+(a?"grid-cols-1":"grid-cols-2"),children:[t.jsx(Oie,{value:"email",className:"group data-[state=active]:bg-white",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"}),t.jsx("span",{children:"Email"})]})}),!a&&t.jsx(Oie,{value:"sms",className:"group data-[state=active]:bg-white",children:t.jsxs("div",{className:"flex items-center gap-2",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"}),t.jsx("span",{children:"SMS"}),c&&t.jsx(G7,{title:"To enable SMS, please complete your business information and request approval from Twilio"})]})})]})}),t.jsx(Pie,{value:"email",children:t.jsx(qie,{disablePreview:e,disableEditContent:r,disablePreviewSubtext:o})}),t.jsx(Pie,{value:"sms",children:t.jsx(_ue,{disablePreview:e,disableEditContent:r,disablePreviewSubtext:o,setupRequired:c})})]})},Eue="reach-styles-module__h2___J-48W",Tue="reach-styles-module__minorText___1TEN6",Cue=({children:e,className:n})=>t.jsx("h2",{className:rp(Eue,n),children:e}),Aue=({children:e,className:n})=>t.jsx("p",{className:rp(Tue,n),children:e}),Nue=({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(Cue,{className:"text-primary",children:e}),r&&t.jsx("div",{className:"ml-auto",children:r})]}),n]}),Rue=()=>t.jsx(Nue,{title:"Preview & Schedule",children:t.jsx(Sue,{disablePreview:!0,disableEditContent:!0,disablePreviewSubtext:!0})}),Oue=()=>{const e=bZ(),r=xZ(),{channelSenders:o}=V7(),{channelAccounts:i}=U7(),[a,s]=n.useState(null),[l,c]=n.useState(null),[u,d]=n.useState(null),[p,f]=n.useState(null);return n.useEffect((()=>{o&&d(o),i&&f(i)}),[o,i]),n.useEffect((()=>{if(r&&u&&p){const e=r.emailChannelSenderId,t=r.smsChannelSenderId,n=u.results.find((t=>t.id===e)),o=u.results.find((e=>e.id===t));if(n&&r.emailSubject&&r.emailHtmlBody){const e=n.channelSenderMetadata?.userPart,t=p.results.find((e=>e.id===n.channelAccountId));if(t)switch(t.channelAccountMetadata.type){case $7.REACH_MANAGED:s({fromEmail:`${e}@${t.channelAccountMetadata.baseDomain}.embedreach.com`,fromName:n.channelSenderMetadata?.emailFromName,subject:r.emailSubject,previewText:r.emailPreviewText,body:r.emailHtmlBody});break;case $7.TWILLIO:break;default:throw Eoe(t.channelAccountMetadata.type,$7)}}o&&r.smsMessageBody&&c({fromPhone:Soe(o.channelSenderMetadata),body:r.smsMessageBody,companyName:r.textMessageCompanyName})}}),[r,u,p]),e?t.jsx("div",a||l?{className:"w-full",children:t.jsx("div",{className:"flex flex-col gap-4 w-full",children:t.jsx(Rue,{})})}:{className:"flex justify-center items-center h-full",children:t.jsx("div",{children:"No preview data Please complete previous steps"})}):t.jsx(EZ,{text:["Loading..."]})};function Pue(e){return(Pue="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 kue(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 jue(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function Mue(e){jue(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===Pue(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):new Date(NaN)}function Lue(e,t){jue(2,arguments);var n=Mue(e),r=kue(t);return isNaN(r)?new Date(NaN):r?(n.setDate(n.getDate()+r),n):n}function Due(e,t){jue(2,arguments);var n=Mue(e),r=kue(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)}var Iue={};function Fue(){return Iue}function Uue(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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=Mue(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 $ue(e){return jue(1,arguments),Uue(e,{weekStartsOn:1})}function Vue(e){jue(1,arguments);var t=function(e){jue(1,arguments);var t=Mue(e),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);var o=$ue(r),i=new Date(0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);var a=$ue(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),$ue(n)}function Bue(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 zue(e){jue(1,arguments);var t=Mue(e);return t.setHours(0,0,0,0),t}function Hue(e,t){jue(2,arguments);var n=zue(e),r=zue(t),o=n.getTime()-Bue(n),i=r.getTime()-Bue(r);return Math.round((o-i)/864e5)}function que(e,t){return jue(2,arguments),Lue(e,7*kue(t))}function Gue(e,t){return jue(2,arguments),Due(e,12*kue(t))}function Kue(e,t){jue(2,arguments);var n=zue(e),r=zue(t);return n.getTime()===r.getTime()}function Wue(e){return jue(1,arguments),e instanceof Date||"object"===Pue(e)&&"[object Date]"===Object.prototype.toString.call(e)}function Yue(e,t){jue(2,arguments);var n=Mue(e),r=Mue(t);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}function Xue(e){jue(1,arguments);var t=Mue(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Zue(e){jue(1,arguments);var t=Mue(e);return t.setDate(1),t.setHours(0,0,0,0),t}function Que(e){jue(1,arguments);var t=Mue(e),n=new Date(0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Jue(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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=Mue(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 ede(e){return jue(1,arguments),Jue(e,{weekStartsOn:1})}function tde(e,t){return jue(2,arguments),function(e,t){jue(2,arguments);var n=Mue(e).getTime(),r=kue(t);return new Date(n+r)}(e,-kue(t))}function nde(e){jue(1,arguments);var t=Mue(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 rde(e){jue(1,arguments);var t=Mue(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var o=nde(r),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var a=nde(i);return t.getTime()>=o.getTime()?n+1:t.getTime()>=a.getTime()?n:n-1}function ode(e){jue(1,arguments);var t=Mue(e),n=nde(t).getTime()-function(e){jue(1,arguments);var t=rde(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),nde(n)}(t).getTime();return Math.round(n/6048e5)+1}function ide(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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=Mue(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 ade(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Mue(e),d=u.getUTCFullYear(),p=Fue(),f=kue(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=ide(h,t),g=new Date(0);g.setUTCFullYear(d,0,f),g.setUTCHours(0,0,0,0);var v=ide(g,t);return u.getTime()>=m.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function sde(e,t){jue(1,arguments);var n=Mue(e),r=ide(n,t).getTime()-function(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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=ade(e,t),f=new Date(0);return f.setUTCFullYear(p,0,d),f.setUTCHours(0,0,0,0),ide(f,t)}(n,t).getTime();return Math.round(r/6048e5)+1}function lde(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var cde=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return lde("yy"===t?r%100:r,t.length)},ude=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):lde(n+1,2)},dde=function(e,t){return lde(e.getUTCDate(),t.length)},pde=function(e,t){return lde(e.getUTCHours()%12||12,t.length)},fde=function(e,t){return lde(e.getUTCHours(),t.length)},hde=function(e,t){return lde(e.getUTCMinutes(),t.length)},mde=function(e,t){return lde(e.getUTCSeconds(),t.length)},gde=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return lde(Math.floor(r*Math.pow(10,n-3)),t.length)},vde="midnight",yde="noon",bde="morning",xde="afternoon",wde="evening",_de="night",Sde={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 cde(e,t)},Y:function(e,t,n,r){var o=ade(e,r),i=o>0?o:1-o;return"YY"===t?lde(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):lde(i,t.length)},R:function(e,t){return lde(rde(e),t.length)},u:function(e,t){return lde(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 lde(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 lde(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 ude(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 lde(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=sde(e,r);return"wo"===t?n.ordinalNumber(o,{unit:"week"}):lde(o,t.length)},I:function(e,t,n){var r=ode(e);return"Io"===t?n.ordinalNumber(r,{unit:"week"}):lde(r,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):dde(e,t)},D:function(e,t,n){var r=function(e){jue(1,arguments);var t=Mue(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"}):lde(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 lde(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 lde(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 lde(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?yde:0===o?vde: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?wde:o>=12?xde:o>=4?bde:_de,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 pde(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):fde(e,t)},K:function(e,t,n){var r=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(r,{unit:"hour"}):lde(r,t.length)},k:function(e,t,n){var r=e.getUTCHours();return 0===r&&(r=24),"ko"===t?n.ordinalNumber(r,{unit:"hour"}):lde(r,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):hde(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):mde(e,t)},S:function(e,t){return gde(e,t)},X:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();if(0===o)return"Z";switch(t){case"X":return Tde(o);case"XXXX":case"XX":return Cde(o);default:return Cde(o,":")}},x:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"x":return Tde(o);case"xxxx":case"xx":return Cde(o);default:return Cde(o,":")}},O:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ede(o,":");default:return"GMT"+Cde(o,":")}},z:function(e,t,n,r){var o=(r._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ede(o,":");default:return"GMT"+Cde(o,":")}},t:function(e,t,n,r){return lde(Math.floor((r._originalDate||e).getTime()/1e3),t.length)},T:function(e,t,n,r){return lde((r._originalDate||e).getTime(),t.length)}};function Ede(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+lde(i,2)}function Tde(e,t){return e%60==0?(e>0?"-":"+")+lde(Math.abs(e)/60,2):Cde(e,t)}function Cde(e,t){var n=t||"",r=e>0?"-":"+",o=Math.abs(e);return r+lde(Math.floor(o/60),2)+n+lde(o%60,2)}var Ade=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"})}},Nde=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"})}},Rde={p:Nde,P:function(e,t){var n,r=e.match(/(P+)(p+)?/)||[],o=r[1],i=r[2];if(!i)return Ade(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}}",Ade(o,t)).replace("{{time}}",Nde(i,t))}},Ode=["D","DD"],Pde=["YY","YYYY"];function kde(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 jde={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 Mde(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 Lde={date:Mde({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:Mde({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:Mde({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Dde={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function Ide(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 Fde={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:Ide({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:Ide({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:Ide({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:Ide({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:Ide({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 Ude(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 $de={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:Ude({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:Ude({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:Ude({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:Ude({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:Ude({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"})},Vde={code:"en-US",formatDistance:function(e,t,n){var r,o=jde[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:Lde,formatRelative:function(e,t,n,r){return Dde[e]},localize:Fde,match:$de,options:{weekStartsOn:0,firstWeekContainsDate:1}},Bde=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zde=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hde=/^'([^]*?)'?$/,qde=/''/g,Gde=/[a-zA-Z]/;function Kde(e,t,n){var r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x;jue(2,arguments);var w=String(t),_=Fue(),S=null!==(r=null!==(o=null==n?void 0:n.locale)&&void 0!==o?o:_.locale)&&void 0!==r?r:Vde,E=kue(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=kue(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===(x=b.options)||void 0===x?void 0:x.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=Mue(e);if(!function(e){if(jue(1,arguments),!Wue(e)&&"number"!=typeof e)return!1;var t=Mue(e);return!isNaN(Number(t))}(C))throw new RangeError("Invalid time value");var A=tde(C,Bue(C)),N={firstWeekContainsDate:E,weekStartsOn:T,locale:S,_originalDate:C};return w.match(zde).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,Rde[t])(e,S.formatLong):e})).join("").match(Bde).map((function(r){if("''"===r)return"'";var o=r[0];if("'"===o)return function(e){var t=e.match(Hde);if(!t)return e;return t[1].replace(qde,"'")}(r);var i=Sde[o];if(i)return null!=n&&n.useAdditionalWeekYearTokens||-1===Pde.indexOf(r)||kde(r,t,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==Ode.indexOf(e)}(r)||kde(r,t,String(e)),i(A,r,S.localize,N);if(o.match(Gde))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return r})).join("")}function Wde(e){return jue(1,arguments),Math.floor(function(e){return jue(1,arguments),Mue(e).getTime()}(e)/1e3)}function Yde(e,t){var n,r,o,i,a,s,l,c;jue(1,arguments);var u=Fue(),d=kue(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;jue(1,arguments);var u=Mue(e),d=u.getFullYear(),p=Fue(),f=kue(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=Uue(h,t),g=new Date(0);g.setFullYear(d,0,f),g.setHours(0,0,0,0);var v=Uue(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),Uue(f,t)}function Xde(e,t){return jue(1,arguments),function(e,t,n){jue(2,arguments);var r=Uue(e,n),o=Uue(t,n),i=r.getTime()-Bue(r),a=o.getTime()-Bue(o);return Math.round((i-a)/6048e5)}(function(e){jue(1,arguments);var t=Mue(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(0,0,0,0),t}(e),Zue(e),t)+1}function Zde(e,t){jue(2,arguments);var n=Mue(e),r=Mue(t);return n.getTime()>r.getTime()}function Qde(e,t){jue(2,arguments);var n=Mue(e),r=Mue(t);return n.getTime()<r.getTime()}function Jde(e,t){jue(2,arguments);var n=Mue(e),r=Mue(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function epe(e,t){return jue(2,arguments),Lue(e,-kue(t))}function tpe(e,t){jue(2,arguments);var n=Mue(e),r=kue(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){jue(1,arguments);var t=Mue(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 npe(e,t){jue(2,arguments);var n=Mue(e),r=kue(t);return isNaN(n.getTime())?new Date(NaN):(n.setFullYear(r),n)}var rpe=function(){return rpe=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},rpe.apply(this,arguments)};function ope(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 ipe(e){return"multiple"===e.mode}function ape(e){return"range"===e.mode}function spe(e){return"single"===e.mode}"function"==typeof SuppressedError&&SuppressedError;var lpe={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 cpe=Object.freeze({__proto__:null,formatCaption:function(e,t){return Kde(e,"LLLL y",t)},formatDay:function(e,t){return Kde(e,"d",t)},formatMonthCaption:function(e,t){return Kde(e,"LLLL",t)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,t){return Kde(e,"cccccc",t)},formatYearCaption:function(e,t){return Kde(e,"yyyy",t)}}),upe=Object.freeze({__proto__:null,labelDay:function(e,t,n){return Kde(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 Kde(e,"cccc",t)},labelYearDropdown:function(){return"Year: "}});var dpe=n.createContext(void 0);function ppe(e){var n,r,o=e.initialProps,i={captionLayout:"buttons",classNames:lpe,formatters:cpe,labels:upe,locale:Vde,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=Zue(r):t&&(i=new Date(t,0,1)),o?a=Xue(o):n&&(a=new Date(n,11,31)),{fromDate:i?zue(i):void 0,toDate:a?zue(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"),(spe(o)||ipe(o)||ape(o))&&(r=o.onSelect);var u=rpe(rpe(rpe({},i),o),{captionLayout:c,classNames:rpe(rpe({},i.classNames),o.classNames),components:rpe({},o.components),formatters:rpe(rpe({},i.formatters),o.formatters),fromDate:s,labels:rpe(rpe({},i.labels),o.labels),mode:o.mode||i.mode,modifiers:rpe(rpe({},i.modifiers),o.modifiers),modifiersClassNames:rpe(rpe({},i.modifiersClassNames),o.modifiersClassNames),onSelect:r,styles:rpe(rpe({},i.styles),o.styles),toDate:l});return t.jsx(dpe.Provider,{value:u,children:e.children})}function fpe(){var e=n.useContext(dpe);if(!e)throw new Error("useDayPicker must be used within a DayPickerProvider.");return e}function hpe(e){var n=fpe();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 mpe(e){return t.jsx("svg",rpe({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 gpe(e){var n,r,o=e.onChange,i=e.value,a=e.children,s=e.caption,l=e.className,c=e.style,u=fpe(),d=null!==(r=null===(n=u.components)||void 0===n?void 0:n.IconDropdown)&&void 0!==r?r:mpe;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 vpe(e){var n,r=fpe(),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){jue(2,arguments);var n=Mue(e),r=Mue(t);return n.getFullYear()===r.getFullYear()}(o,i))for(var f=Zue(o),h=o.getMonth();h<=i.getMonth();h++)p.push(tpe(f,h));else for(f=Zue(new Date),h=0;h<=11;h++)p.push(tpe(f,h));var m=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:gpe;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=tpe(Zue(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 ype(e){var n,r=e.displayMonth,o=fpe(),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(npe(Que(new Date),g));var v=null!==(n=null==u?void 0:u.Dropdown)&&void 0!==n?n:gpe;return t.jsx(v,{name:"years","aria-label":p(),className:c.dropdown_year,style:l.dropdown_year,onChange:function(t){var n=npe(Zue(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 bpe(){var e=fpe(),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&&Yue(n,t)<0&&(t=Due(n,-1*(i-1))),r&&Yue(t,r)<0&&(t=r),Zue(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=Zue(t);o(r),null===(n=e.onMonthChange)||void 0===n||n.call(e,r)}}]}var xpe=n.createContext(void 0);function wpe(e){var n=fpe(),r=bpe(),o=r[0],i=r[1],a=function(e,t){for(var n=t.reverseMonths,r=t.numberOfMonths,o=Zue(e),i=Yue(Zue(Due(o,r)),o),a=[],s=0;s<i;s++){var l=Due(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=Zue(e);if(!n)return Due(a,i);if(!(Yue(n,e)<o))return Due(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=Zue(e);if(!n)return Due(i,-o);if(!(Yue(i,n)<=0))return Due(i,-o)}}(o,n),c=function(e){return a.some((function(t){return Jde(e,t)}))};return t.jsx(xpe.Provider,{value:{currentMonth:o,displayMonths:a,goToMonth:i,goToDate:function(e,t){c(e)||(t&&Qde(e,t)?i(Due(e,1+-1*n.numberOfMonths)):i(e))},previousMonth:l,nextMonth:s,isDateDisplayed:c},children:e.children})}function _pe(){var e=n.useContext(xpe);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e}function Spe(e){var n,r=fpe(),o=r.classNames,i=r.styles,a=r.components,s=_pe().goToMonth,l=function(t){s(Due(t,e.displayIndex?-e.displayIndex:0))},c=null!==(n=null==a?void 0:a.CaptionLabel)&&void 0!==n?n:hpe,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(vpe,{onChange:l,displayMonth:e.displayMonth}),t.jsx(ype,{onChange:l,displayMonth:e.displayMonth})]})}function Epe(e){return t.jsx("svg",rpe({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 Tpe(e){return t.jsx("svg",rpe({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 Cpe=n.forwardRef((function(e,n){var r=fpe(),o=r.classNames,i=r.styles,a=[o.button_reset,o.button];e.className&&a.push(e.className);var s=a.join(" "),l=rpe(rpe({},i.button_reset),i.button);return e.style&&Object.assign(l,e.style),t.jsx("button",rpe({},e,{ref:n,type:"button",className:s,style:l}))}));function Ape(e){var n,r,o=fpe(),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:Tpe,y=null!==(r=null==p?void 0:p.IconLeft)&&void 0!==r?r:Epe;return t.jsxs("div",{className:s.nav,style:l.nav,children:[!e.hidePrevious&&t.jsx(Cpe,{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(Cpe,{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 Npe(e){var n=fpe().numberOfMonths,r=_pe(),o=r.previousMonth,i=r.nextMonth,a=r.goToMonth,s=r.displayMonths,l=s.findIndex((function(t){return Jde(e.displayMonth,t)})),c=0===l,u=l===s.length-1;return t.jsx(Ape,{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 Rpe(e){var n,r,o=fpe(),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:hpe;return r=o.disableNavigation?t.jsx(c,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===s?t.jsx(Spe,{displayMonth:e.displayMonth,id:e.id}):t.jsxs(t.Fragment,"dropdown-buttons"===s?{children:[t.jsx(Spe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),t.jsx(Npe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}:{children:[t.jsx(c,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(Npe,{displayMonth:e.displayMonth,id:e.id})]}),t.jsx("div",{className:i.caption,style:a.caption,children:r})}function Ope(e){var n=fpe(),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 Ppe(){var e=fpe(),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?$ue(new Date):Uue(new Date,{locale:e,weekStartsOn:t}),o=[],i=0;i<7;i++){var a=Lue(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 kpe(){var e,n=fpe(),r=n.components,o=null!==(e=null==r?void 0:r.HeadRow)&&void 0!==e?e:Ppe;return t.jsx("thead",{style:n.styles.head,className:n.classNames.head,children:t.jsx(o,{})})}function jpe(e){var n=fpe();return t.jsx(t.Fragment,{children:(0,n.formatters.formatDay)(e.date,{locale:n.locale})})}var Mpe=n.createContext(void 0);function Lpe(e){if(!ipe(e.initialProps)){return t.jsx(Mpe.Provider,{value:{selected:void 0,modifiers:{disabled:[]}},children:e.children})}return t.jsx(Dpe,{initialProps:e.initialProps,children:e.children})}function Dpe(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 Kue(t,e)}));return Boolean(t&&!n)})),t.jsx(Mpe.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?ope([],o):[];if(t.selected){var u=c.findIndex((function(t){return Kue(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 Ipe(){var e=n.useContext(Mpe);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}var Fpe,Upe,$pe=n.createContext(void 0);function Vpe(e){if(!ape(e.initialProps)){return t.jsx($pe.Provider,{value:{selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}},children:e.children})}return t.jsx(Bpe,{initialProps:e.initialProps,children:e.children})}function Bpe(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],Kue(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:epe(a,l-1),before:Lue(a,l-1)}),a&&s&&u.disabled.push({after:a,before:Lue(a,l-1)}),!a&&s&&u.disabled.push({after:epe(s,l-1),before:Lue(s,l-1)})),c){if(a&&!s&&(u.disabled.push({before:Lue(a,1-c)}),u.disabled.push({after:Lue(a,c-1)})),a&&s){var d=c-(Hue(s,a)+1);u.disabled.push({before:epe(a,d)}),u.disabled.push({after:Lue(s,d)})}!a&&s&&(u.disabled.push({before:Lue(s,1-c)}),u.disabled.push({after:Lue(s,c-1)}))}return t.jsx($pe.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(Kue(o,e)&&Kue(r,e))return;if(Kue(o,e))return{from:o,to:void 0};if(Kue(r,e))return;return Zde(r,e)?{from:e,to:o}:{from:r,to:e}}return o?Zde(e,o)?{from:o,to:e}:{from:e,to:o}:r?Qde(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 zpe(){var e=n.useContext($pe);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Hpe(e){return Array.isArray(e)?ope([],e):void 0!==e?[e]:[]}(Upe=Fpe||(Fpe={})).Outside="outside",Upe.Disabled="disabled",Upe.Selected="selected",Upe.Hidden="hidden",Upe.Today="today",Upe.RangeStart="range_start",Upe.RangeEnd="range_end",Upe.RangeMiddle="range_middle";var qpe=Fpe.Selected,Gpe=Fpe.Disabled,Kpe=Fpe.Hidden,Wpe=Fpe.Today,Ype=Fpe.RangeEnd,Xpe=Fpe.RangeMiddle,Zpe=Fpe.RangeStart,Qpe=Fpe.Outside;var Jpe=n.createContext(void 0);function efe(e){var n=fpe(),r=function(e,t,n){var r,o=((r={})[qpe]=Hpe(e.selected),r[Gpe]=Hpe(e.disabled),r[Kpe]=Hpe(e.hidden),r[Wpe]=[e.today],r[Ype]=[],r[Xpe]=[],r[Zpe]=[],r[Qpe]=[],r);return e.fromDate&&o[Gpe].push({before:e.fromDate}),e.toDate&&o[Gpe].push({after:e.toDate}),ipe(e)?o[Gpe]=o[Gpe].concat(t.modifiers[Gpe]):ape(e)&&(o[Gpe]=o[Gpe].concat(n.modifiers[Gpe]),o[Zpe]=n.modifiers[Zpe],o[Xpe]=n.modifiers[Xpe],o[Ype]=n.modifiers[Ype]),o}(n,Ipe(),zpe()),o=function(e){var t={};return Object.entries(e).forEach((function(e){t[e[0]]=Hpe(e[1])})),t}(n.modifiers),i=rpe(rpe({},r),o);return t.jsx(Jpe.Provider,{value:i,children:e.children})}function tfe(){var e=n.useContext(Jpe);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function nfe(e,t){return t.some((function(t){if("boolean"==typeof t)return t;if(Wue(t))return Kue(e,t);var n,r,o,i,a;if(function(e){return Array.isArray(e)&&e.every(Wue)}(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?(Hue(a,i)<0&&(i=(o=[a,i])[0],a=o[1]),Hue(n,i)>=0&&Hue(a,n)>=0):a?Kue(a,n):!!i&&Kue(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=Hue(t.before,e)>0,l=Hue(t.after,e)<0;return Zde(t.before,t.after)?l&&s:s||l}return function(e){return Boolean(e&&"object"==typeof e&&"after"in e)}(t)?Hue(e,t.after)>0:function(e){return Boolean(e&&"object"==typeof e&&"before"in e)}(t)?Hue(t.before,e)>0:"function"==typeof t&&t(e)}))}function rfe(e,t,n){var r=Object.keys(t).reduce((function(n,r){return nfe(e,t[r])&&n.push(r),n}),[]),o={};return r.forEach((function(e){return o[e]=!0})),n&&!Jde(e,n)&&(o.outside=!0),o}function ofe(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:Lue,week:que,month:Due,year:Gue,startOfWeek:function(e){return o.ISOWeek?$ue(e):Uue(e,{locale:d,weekStartsOn:l})},endOfWeek:function(e){return o.ISOWeek?ede(e):Jue(e,{locale:d,weekStartsOn:l})}}[n](e,"after"===r?1:-1);"before"===r&&c?p=function(e){var t,n;if(jue(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==Pue(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Mue(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(jue(1,arguments),e&&"function"==typeof e.forEach)t=e;else{if("object"!==Pue(e)||null===e)return new Date(NaN);t=Array.prototype.slice.call(e)}return t.forEach((function(e){var t=Mue(e);(void 0===n||n>t||isNaN(t.getDate()))&&(n=t)})),n||new Date(NaN)}([u,p]));var f=!0;if(i){var h=rfe(p,i);f=!h.disabled&&!h.hidden}return f?p:s.count>365?s.lastFocused:ofe(p,{moveBy:n,direction:r,context:o,modifiers:i,retry:rpe(rpe({},s),{count:s.count+1})})}var ife=n.createContext(void 0);function afe(e){var r=_pe(),o=tfe(),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=Zue(e[0]),i=Xue(e[e.length-1]),a=o;a<=i;){var s=rfe(a,t);if(s.disabled||s.hidden)a=Lue(a,1);else{if(s.selected)return a;s.today&&!r&&(r=a),n||(n=a),a=Lue(a,1)}}return r||n}(r.displayMonths,o),p=(null!=a?a:c&&r.isDateDisplayed(c))?c:d,f=function(e){s(e)},h=fpe(),m=function(e,t){if(a){var n=ofe(a,{moveBy:e,direction:t,context:h,modifiers:o});Kue(a,n)||(r.goToDate(n,a),f(n))}};return t.jsx(ife.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 sfe(){var e=n.useContext(ife);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}var lfe=n.createContext(void 0);function cfe(e){if(!spe(e.initialProps)){return t.jsx(lfe.Provider,{value:{selected:void 0},children:e.children})}return t.jsx(ufe,{initialProps:e.initialProps,children:e.children})}function ufe(e){var n=e.initialProps;return t.jsx(lfe.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 dfe(){var e=n.useContext(lfe);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function pfe(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(Fpe).includes(e)}(t)){var o=e.classNames["day_".concat(t)];o&&n.push(o)}})),n}function ffe(e,r,o){var i,a,s,l=fpe(),c=sfe(),u=function(e,t){return rfe(e,tfe(),t)}(e,r),d=function(e,t){var n=fpe(),r=dfe(),o=Ipe(),i=zpe(),a=sfe(),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;spe(n)?null===(s=r.onDayClick)||void 0===s||s.call(r,e,t,a):ipe(n)?null===(l=o.onDayClick)||void 0===l||l.call(o,e,t,a):ape(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=fpe(),t=dfe(),n=Ipe(),r=zpe();return spe(e)?t.selected:ipe(e)?n.selected:ape(e)?r.selected:void 0}(),f=Boolean(l.onDayClick||"default"!==l.mode);n.useEffect((function(){var t;u.outside||c.focusedDay&&f&&Kue(c.focusedDay,e)&&(null===(t=o.current)||void 0===t||t.focus())}),[c.focusedDay,e,o,f,u.outside]);var h=pfe(l,u).join(" "),m=function(e,t){var n=rpe({},e.styles.day);return Object.keys(t).forEach((function(t){var r;n=rpe(rpe({},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:jpe,y={style:m,className:h,children:t.jsx(v,{date:e,displayMonth:r,activeModifiers:u}),role:"gridcell"},b=c.focusTarget&&Kue(c.focusTarget,e)&&!u.outside,x=c.focusedDay&&Kue(c.focusedDay,e),w=rpe(rpe(rpe({},y),((i={disabled:u.disabled,role:"gridcell"})["aria-selected"]=u.selected,i.tabIndex=x||b?0:-1,i)),d);return{isButton:f,isHidden:g,activeModifiers:u,selectedDays:p,buttonProps:w,divProps:y}}function hfe(e){var r=n.useRef(null),o=ffe(e.date,e.displayMonth,r);return o.isHidden?t.jsx("div",{role:"gridcell"}):o.isButton?t.jsx(Cpe,rpe({name:"day",ref:r},o.buttonProps)):t.jsx("div",rpe({},o.divProps))}function mfe(e){var n=e.number,r=e.dates,o=fpe(),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(Cpe,{name:"week-number","aria-label":d,className:s.weeknumber,style:a.weeknumber,onClick:function(e){i(n,r,e)},children:u})}function gfe(e){var n,r,o,i=fpe(),a=i.styles,s=i.classNames,l=i.components,c=null!==(n=null==l?void 0:l.Day)&&void 0!==n?n:hfe,u=null!==(r=null==l?void 0:l.WeekNumber)&&void 0!==r?r:mfe;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})},Wde(n))}))]})}function vfe(e,t,n){for(var r=(null==n?void 0:n.ISOWeek)?ede(t):Jue(t,n),o=(null==n?void 0:n.ISOWeek)?$ue(e):Uue(e,n),i=Hue(r,o),a=[],s=0;s<=i;s++)a.push(Lue(o,s));var l=a.reduce((function(e,t){var r=(null==n?void 0:n.ISOWeek)?function(e){jue(1,arguments);var t=Mue(e),n=$ue(t).getTime()-Vue(t).getTime();return Math.round(n/6048e5)+1}(t):function(e,t){jue(1,arguments);var n=Mue(e),r=Uue(n,t).getTime()-Yde(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 yfe(e){var n,r,o,i=fpe(),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=vfe(Zue(e),Xue(e),t);if(null==t?void 0:t.useFixedWeeks){var r=Xde(e,t);if(r<6){var o=n[n.length-1],i=o.dates[o.dates.length-1],a=que(i,6-r),s=vfe(que(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:kpe,g=null!==(r=null==u?void 0:u.Row)&&void 0!==r?r:gfe,v=null!==(o=null==u?void 0:u.Footer)&&void 0!==o?o:Ope;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 bfe="undefined"!=typeof window&&window.document&&window.document.createElement?n.useLayoutEffect:n.useEffect,xfe=!1,wfe=0;function _fe(){return"react-day-picker-".concat(++wfe)}function Sfe(e){var r,o,i=fpe(),a=i.dir,s=i.classNames,l=i.styles,c=i.components,u=_pe().displayMonths,d=function(e){var t,r=null!=e?e:xfe?_fe():null,o=n.useState(r),i=o[0],a=o[1];return bfe((function(){null===i&&a(_fe())}),[]),n.useEffect((function(){!1===xfe&&(xfe=!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=rpe(rpe({},h),l.caption_start)),g&&(f.push(s.caption_end),h=rpe(rpe({},h),l.caption_end)),v&&(f.push(s.caption_between),h=rpe(rpe({},h),l.caption_between));var y=null!==(o=null==c?void 0:c.Caption)&&void 0!==o?o:Rpe;return t.jsxs("div",{className:f.join(" "),style:h,children:[t.jsx(y,{id:d,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),t.jsx(yfe,{id:p,"aria-labelledby":d,displayMonth:e.displayMonth})]},e.displayIndex)}function Efe(e){var n=fpe();return t.jsx("div",{className:n.classNames.months,style:n.styles.months,children:e.children})}function Tfe(e){var r,o,i=e.initialProps,a=fpe(),s=sfe(),l=_pe(),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=rpe(rpe({},a.styles.root),a.style),h=Object.keys(i).filter((function(e){return e.startsWith("data-")})).reduce((function(e,t){var n;return rpe(rpe({},e),((n={})[t]=i[t],n))}),{}),m=null!==(o=null===(r=i.components)||void 0===r?void 0:r.Months)&&void 0!==o?o:Efe;return t.jsx("div",rpe({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(Sfe,{displayIndex:n,displayMonth:e},n)}))})}))}function Cfe(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(ppe,{initialProps:r,children:t.jsx(wpe,{children:t.jsx(cfe,{initialProps:r,children:t.jsx(Lpe,{initialProps:r,children:t.jsx(Vpe,{initialProps:r,children:t.jsx(efe,{children:t.jsx(afe,{children:n})})})})})})})}function Afe(e){return t.jsx(Cfe,rpe({},e,{children:t.jsx(Tfe,{initialProps:e})}))}function Nfe({className:e,classNames:n,showOutsideDays:r=!0,...o}){return t.jsx(Afe,{showOutsideDays:r,className:rp("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:rp(jZ({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:rp("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:rp(jZ({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(vu,{className:"h-4 w-4"}),IconRight:()=>t.jsx(yu,{className:"h-4 w-4"})},...o})}Nfe.displayName="Calendar";const Rfe=({data:e,placeholder:n,searchPlaceholder:r,noResultsMessage:o,value:a,setValue:s})=>{const[l,c]=i.useState(!1);return t.jsxs(v9,{open:l,onOpenChange:c,modal:!0,children:[t.jsx(y9,{asChild:!0,children:t.jsxs(MZ,{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(xu,{className:"opacity-50"})]})}),t.jsx(b9,{className:"w-[200px] p-0",children:t.jsxs(soe,{children:[t.jsx(loe,{placeholder:r,className:"h-9"}),t.jsxs(coe,{children:[t.jsx(uoe,{children:o}),t.jsx(doe,{children:e.map((e=>t.jsxs(foe,{value:e.value,onSelect:e=>{s(e===a?"":e),c(!1)},children:[e.label,t.jsx(mu,{className:rp("ml-auto",a===e.value?"opacity-100":"opacity-0")})]},e.value)))})]})]})})]})},Ofe=({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?E7(new Date(o),"HH:mm"):"00:00"),d=Intl.supportedValuesOf("timeZone").map((e=>({label:e,value:e}))),p=t=>{const n=I9(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(v9,{children:[t.jsx(y9,{asChild:!0,children:t.jsxs(MZ,{variant:"outline",className:rp("bg-background w-full sm:w-[280px] justify-start text-left font-normal",!o&&"text-muted-foreground"),children:[t.jsx(hu,{className:"mr-2 h-4 w-4"}),o?E7(new Date(o),"PPP"):t.jsx("span",{children:"Pick a date"})]})}),t.jsx(b9,{className:"w-auto p-0 z-[60] pointer-events-auto",children:t.jsx(Nfe,{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:rp("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(Rfe,{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=I9(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]})]})})},Pfe=({title:e="Edit Schedule Time",autoSave:r=!1})=>{const o=bZ(),{updateAutomation:i}=De(o?.id||""),{toast:a}=Il(),[s,l]=n.useState(null),[c,u]=n.useState(o?.triggerMetadata?.triggerType===Ue.ONE_TIME?o?.triggerMetadata?.scheduledAt:null),[d,p]=n.useState(o?.triggerMetadata?.triggerType===Ue.ONE_TIME&&o?.triggerMetadata?.timezone||"America/New_York"),[f,h]=n.useState(!1),m=n.useCallback((()=>{if("sendNow"===s)i({trigger:{triggerType:Ue.ONE_TIME,scheduledAt:new Date(Date.now()+3e5).toISOString()}}),a({title:"Schedule time updated successfully 🚀",description:"Campaign scheduled to begin sending in 5 minutes"}),h(!1);else{if(!c||!d)return;i({trigger:{triggerType:Ue.ONE_TIME,scheduledAt:c,timezone:d}}),a({title:"Schedule time updated successfully 🚀",description:`Campaign scheduled to start at ${new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric"})}`}),h(!1)}}),[s,c,d,i,a]);return n.useEffect((()=>{}),[o]),n.useEffect((()=>{r&&f&&(m(),h(!1))}),[r,f,m]),o?t.jsx(Nue,{title:e,headerActions:r?void 0:t.jsx(MZ,{onClick:m,disabled:!f,children:"Save"}),children:t.jsx("div",{className:"@container flex-1 mx-4",children:t.jsxs("div",{className:"flex @[1000px]:flex-row flex-col gap-8 items-center",children:[t.jsxs("div",{className:"flex-1 w-full",children:[t.jsxs("div",{className:"grid grid-cols-1 @[480px]:grid-cols-2 gap-4",children:[t.jsx(IZ,{selected:"sendNow"===s,title:"Send Now",subtitle:"Campaign will begin sending in 5 minutes",icon:t.jsx(FZ.SendButton,{className:"text-primary"}),onClick:()=>{l("sendNow"),u(new Date(Date.now()+3e5).toISOString()),p("America/New_York"),h(!0)}}),t.jsx(IZ,{selected:"schedule"===s,title:"Schedule",subtitle:"Choose date and time",icon:t.jsx(FZ.ScheduleButton,{className:"text-primary"}),onClick:()=>l("schedule")})]}),t.jsx(QB,{children:"schedule"===s&&t.jsx(TZ,{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(Ofe,{setScheduleTime:u,setTimezone:p,timezone:d,scheduleTime:c,setIsDirty:h})})})})]}),c&&t.jsxs(DX.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(DX.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(DX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4,duration:.4},className:"text-md font-bold text-gray-800",children:new Date(c).toLocaleString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short",timeZone:d||void 0})})]})]})})}):null},kfe=()=>t.jsx("div",{children:t.jsx(Pfe,{title:"Set Schedule Time",autoSave:!0})});var jfe=(e=>(e.DAYS="days",e))(jfe||{});const Mfe={[vZ.EQUALS]:"Equals",[vZ.NOT_EQUALS]:"Not Equals",[vZ.GREATER_THAN]:"Greater Than",[vZ.LESS_THAN]:"Less Than",[vZ.EXISTS]:"Exists",[vZ.EQUALS_MONTH_DAY]:"Month and Day Matches",[vZ.EQUALS_MONTH_DAY_YEAR]:"Month, Day, and Year Matches",[vZ.BETWEEN_MONTH_DAY]:"Between Month Day",[vZ.BETWEEN_MONTH_DAY_YEAR]:"Between Month Day Year",[vZ.ARRAY_CONTAINS]:"List Contains"},Lfe={email:"Email Address",phone:"Phone Number",firstName:"First Name",lastName:"Last Name"},Dfe=({options:e,value:n,onChange:r,placeholder:o,className:a=""})=>{const[s,l]=i.useState(!1);return t.jsxs(v9,{modal:!0,open:s,onOpenChange:l,children:[t.jsx(y9,{asChild:!0,children:t.jsxs(MZ,{"aria-expanded":s,className:rp("w-full overflow-hidden justify-between",a),variant:"outline",children:[n?e.find((e=>e.value===n))?.label:o,t.jsx(xu,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),t.jsx(b9,{className:rp("w-full min-w-[120px] max-w-[600px] p-0",a),children:t.jsxs(soe,{children:[t.jsx(loe,{placeholder:`${o}...`}),t.jsxs(coe,{children:[t.jsxs(uoe,{children:["No ",o.toLowerCase()," found."]}),t.jsx(doe,{children:e.map((e=>t.jsxs(foe,{value:e.value,onSelect:e=>{r(e===n?"":e),l(!1)},children:[t.jsx(mu,{className:rp("mr-2 h-4 w-4",n===e.value?"opacity-100":"opacity-0")}),e.label]},e.id||e.value)))})]})]})})]})};var Ife=i.forwardRef(((e,n)=>{const{children:r,...o}=e,a=i.Children.toArray(r),s=a.find($fe);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(Ffe,{...o,ref:n,children:i.isValidElement(e)?i.cloneElement(e,void 0,r):null})}return t.jsx(Ffe,{...o,ref:n,children:r})}));Ife.displayName="Slot";var Ffe=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?AZ(t,e):e),i.cloneElement(n,o)}return i.Children.count(n)>1?i.Children.only(null):null}));Ffe.displayName="SlotClone";var Ufe=({children:e})=>t.jsx(t.Fragment,{children:e});function $fe(e){return i.isValidElement(e)&&e.type===Ufe}var Vfe=["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?Ife: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}}),{}),Bfe="horizontal",zfe=["horizontal","vertical"],Hfe=i.forwardRef(((e,n)=>{const{decorative:r,orientation:o=Bfe,...i}=e,a=function(e){return zfe.includes(e)}(o)?o:Bfe;return t.jsx(Vfe.div,{"data-orientation":a,...r?{role:"none"}:{"aria-orientation":"vertical"===a?a:void 0,role:"separator"},...i,ref:n})}));Hfe.displayName="Separator";var qfe=Hfe;const Gfe=i.forwardRef((({className:e,orientation:n="horizontal",decorative:r=!0,...o},i)=>t.jsx(qfe,{ref:i,decorative:r,orientation:n,className:rp("shrink-0 bg-border","horizontal"===n?"h-[1px] w-full":"h-full w-[1px]",e),...o})));Gfe.displayName=qfe.displayName;const Kfe=au("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"}}),Wfe=i.forwardRef((({options:e,onValueChange:n,variant:r,placeholder:o="Select options",animation:a=0,maxCount:s=3,className:l,extraCommandItems:c,searchPlaceholder:u="Search...",handleSearchInput:d,emptyMessage:p="No results found.",searchIcon:f=t.jsx(Wu,{className:"h-4 w-4 mr-2"}),selectedValues:h,setSelectedValues:m,...g},v)=>{const[y,b]=i.useState(!1),[x,w]=i.useState(!1);i.useEffect((()=>{const e=e=>{"Escape"===e.key&&y&&b(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[y]),i.useEffect((()=>{y||(document.body.style.pointerEvents="")}),[y]);const _=e=>{const t=h.includes(e)?h.filter((t=>t!==e)):[...h,e];m(t),n(t)},S=()=>{m([]),n([])};return t.jsxs(v9,{open:y,onOpenChange:e=>{b(e)},modal:!1,children:[t.jsx(y9,{asChild:!0,children:t.jsx("button",{type:"button",ref:v,...g,onClick:()=>{b((e=>!e))},className:rp("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",l),children:t.jsxs("div",h.length>0?{className:"flex justify-between items-center w-full",children:[t.jsxs("div",{className:"flex flex-wrap items-center",children:[h.slice(0,s).map((n=>{const o=e.find((e=>e.value===n)),i=o?.icon;return t.jsxs(YZ,{className:rp(x?"animate-bounce":"",Kfe({variant:r})),style:{animationDuration:`${a}s`},children:[i&&t.jsx(i,{className:"h-4 w-4 mr-2"}),o?.label,t.jsx(Eu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),_(n)}})]},n)})),h.length>s&&t.jsxs(YZ,{className:rp("bg-transparent text-foreground border-foreground/1 hover:bg-transparent",x?"animate-bounce":"",Kfe({variant:r})),style:{animationDuration:`${a}s`},children:[`+ ${h.length-s} more`,t.jsx(Eu,{className:"ml-2 h-4 w-4 cursor-pointer",onClick:e=>{e.stopPropagation(),(()=>{const e=h.slice(0,s);m(e),n(e)})()}})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(cd,{className:"h-4 mx-2 cursor-pointer text-muted-foreground",onClick:e=>{e.stopPropagation(),S()}}),t.jsx(Gfe,{orientation:"vertical",className:"flex min-h-6 h-full"}),t.jsx(gu,{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(gu,{className:"h-4 cursor-pointer text-muted-foreground mx-2"})]})})}),t.jsx(b9,{className:"w-auto p-0",align:"start",onEscapeKeyDown:()=>{b(!1),document.body.style.pointerEvents=""},children:t.jsxs(soe,{children:[t.jsx(loe,{searchIcon:f,placeholder:u,onKeyDown:e=>{if("Enter"===e.key)b(!0),d&&(d(e.currentTarget.value),b(!1));else if("Backspace"===e.key&&!e.currentTarget.value){const e=[...h];e.pop(),m(e),n(e)}}}),t.jsxs(coe,{children:[t.jsx(uoe,{children:p}),t.jsxs(doe,{children:[t.jsxs(foe,{onSelect:()=>{if(h.length===e.length)S();else{const t=e.map((e=>e.value));m(t),n(t)}},className:"cursor-pointer",children:[t.jsx("div",{className:rp("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",h.length===e.length?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:t.jsx(mu,{className:"h-4 w-4"})}),t.jsx("span",{children:"(Select All)"})]},"all"),e.map((e=>{const n=h.includes(e.value);return t.jsxs(foe,{onSelect:()=>_(e.value),className:"cursor-pointer",children:[t.jsx("div",{className:rp("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(mu,{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(poe,{}),t.jsx(doe,{children:t.jsxs("div",{className:"flex items-center justify-between",children:[h.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(foe,{onSelect:S,className:"flex-1 justify-center cursor-pointer",children:"Clear"}),t.jsx(Gfe,{orientation:"vertical",className:"flex min-h-6 h-full"})]}),t.jsx(foe,{onSelect:()=>b(!1),className:"flex-1 justify-center cursor-pointer max-w-full",children:"Close"}),c&&c.map((e=>e(b)))]})})]})]})}),a>0&&h.length>0&&t.jsx(ld,{className:rp("cursor-pointer my-2 text-foreground bg-background w-3 h-3",x?"":"text-muted-foreground"),onClick:()=>w(!x)})]})}));Wfe.displayName="MultiSelect";var Yfe="Switch",[Xfe,Zfe]=nJ(Yfe),[Qfe,Jfe]=Xfe(Yfe),ehe=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=NZ(n,(e=>m(e))),v=i.useRef(!1),y=!h||(p||!!h.closest("form")),[b=!1,x]=iJ({prop:a,defaultProp:s,onChange:d});return t.jsxs(Qfe,{scope:r,checked:b,disabled:c,children:[t.jsx(dJ.button,{type:"button",role:"switch","aria-checked":b,"aria-required":l,"data-state":ohe(b),"data-disabled":c?"":void 0,disabled:c,value:u,...f,ref:g,onClick:tJ(e.onClick,(e=>{x((e=>!e)),y&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())}))}),y&&t.jsx(rhe,{control:h,bubbles:!v.current,name:o,value:u,checked:b,required:l,disabled:c,form:p,style:{transform:"translateX(-100%)"}})]})}));ehe.displayName=Yfe;var the="SwitchThumb",nhe=i.forwardRef(((e,n)=>{const{__scopeSwitch:r,...o}=e,i=Jfe(the,r);return t.jsx(dJ.span,{"data-state":ohe(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:n})}));nhe.displayName=the;var rhe=e=>{const{control:n,checked:r,bubbles:o=!0,...a}=e,s=i.useRef(null),l=Wne(r),c=v1(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 ohe(e){return e?"checked":"unchecked"}var ihe=ehe,ahe=nhe;const she=i.forwardRef((({className:e,...n},r)=>t.jsx(ihe,{className:rp("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(ahe,{className:rp("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")})})));she.displayName=ihe.displayName;const lhe=({onSelect:e,date:n,placeholder:r="Pick a date",monthDayOnly:o=!1})=>t.jsxs(v9,{modal:!0,children:[t.jsx(y9,{asChild:!0,children:t.jsxs(MZ,{variant:"outline",className:rp("w-[200px] justify-start text-left font-normal h-9",!n&&"text-muted-foreground"),children:[t.jsx(hu,{className:"mr-2 h-4 w-4"}),n?E7(n,o?"MMMM d":"PPP"):t.jsx("span",{children:r})]})}),t.jsx(b9,{className:"w-auto p-0",align:"start",children:t.jsx(Nfe,{mode:"single",selected:n,onSelect:e,initialFocus:!0})})]}),che=e=>void 0===e.value||!("number"!=typeof e.value||e.value<0)&&(e.unit===jfe.DAYS&&(("before"===e.direction||"after"===e.direction)&&"relative"===e.type)),uhe=({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===mZ.Date||e===mZ.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:jfe.DAYS,direction:"before"}),[v,y]=i.useState(u?r[0]:void 0),[b,x]=i.useState(!1);if(i.useEffect((()=>{n!==vZ.EQUALS_MONTH_DAY&&n!==vZ.EQUALS_MONTH_DAY_YEAR&&f&&(h(!1),o(d?[d]:[]))}),[n,f,d,o]),i.useEffect((()=>{if(u&&v?.startDate){x("object"==typeof v.startDate&&"type"in v.startDate)}}),[u,v]),e===mZ.String||e===mZ.ReachResource||e===mZ.Array)return n===vZ.EXISTS?null:t.jsx(Wfe,{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 mZ.ReachResource:case mZ.Array:case mZ.String:return t.length>0;case mZ.Number:return!isNaN(Number(t));case mZ.Integer:return!isNaN(Number(t))&&Number(t)%1==0;case mZ.Boolean:return"true"===t||"false"===t;case mZ.Date:case mZ.DateTime:return!isNaN(new Date(t).getTime());default:throw Eoe(n,mZ)}})({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===mZ.Date||e===mZ.DateTime){const e=n===vZ.EQUALS_MONTH_DAY||n===vZ.EQUALS_MONTH_DAY_YEAR,r=n===vZ.BETWEEN_MONTH_DAY||n===vZ.BETWEEN_MONTH_DAY_YEAR,i=e=>{che(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&&(!che(t)||!che(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&&che(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(lhe,{date:d,onSelect:l,monthDayOnly:n===vZ.EQUALS_MONTH_DAY}),e&&f&&t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx(s5,{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(Pne,{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(jne,{placeholder:"Select direction..."})}),t.jsxs(Ine,{children:[t.jsx(Fne,{value:"before",children:"days before today"}),t.jsx(Fne,{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(s5,{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:jfe.DAYS,direction:v?.startDate?.direction||"before"};che(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},className:"w-20 h-9",min:"0","aria-label":"Start date relative days"}),t.jsxs(Pne,{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:jfe.DAYS,direction:e};che(t)&&(y({...v,startDate:t}),a({...v,startDate:t}))},children:[t.jsx(Mne,{className:"w-[180px] h-9",children:t.jsx(jne,{placeholder:"Select direction..."})}),t.jsxs(Ine,{children:[t.jsx(Fne,{value:"before",children:"days before today"}),t.jsx(Fne,{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(lhe,{placeholder:"Start date",date:v?.startDate instanceof Date||"string"==typeof v?.startDate?v.startDate instanceof Date?v.startDate:new Date(v.startDate):void 0,monthDayOnly:n===vZ.BETWEEN_MONTH_DAY,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(s5,{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:jfe.DAYS,direction:v?.endDate?.direction||"before"};che(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},className:"w-20 h-9",min:"0","aria-label":"End date relative days"}),t.jsxs(Pne,{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:jfe.DAYS,direction:e};che(t)&&(y({...v,endDate:t}),a({...v,endDate:t}))},children:[t.jsx(Mne,{className:"w-[180px] h-9",children:t.jsx(jne,{placeholder:"Select direction..."})}),t.jsxs(Ine,{children:[t.jsx(Fne,{value:"before",children:"days before today"}),t.jsx(Fne,{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(lhe,{placeholder:"End date",date:v?.endDate instanceof Date||"string"==typeof v?.endDate?v.endDate instanceof Date?v.endDate:new Date(v.endDate):void 0,monthDayOnly:n===vZ.BETWEEN_MONTH_DAY,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(she,{id:"between-relative-date-switch",checked:b,onCheckedChange:e=>{if(x(e),e){const e={type:"relative",value:0,unit:jfe.DAYS,direction:"before"},t={type:"relative",value:0,unit:jfe.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(nee,{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(she,{id:"relative-date-switch",checked:f,onCheckedChange:c,"aria-label":"Toggle relative date input"}),t.jsx(nee,{htmlFor:"relative-date-switch",className:"text-xs font-normal text-muted-foreground cursor-pointer",children:"Relative"})]})]})}if(e===mZ.Number||e===mZ.Integer)return n===vZ.EXISTS?null:t.jsx(s5,{type:"number",value:r.length>0?String(r[0]):"",onChange:e=>o([Number(e.target.value)]),className:"w-[200px]"});if(e===mZ.Boolean){if(n===vZ.EXISTS)return null;const e=r.length>0&&Boolean(r[0]);return t.jsx(she,{checked:e,onCheckedChange:e=>o([e])})}return t.jsx(s5,{value:r.length>0?String(r[0]):"",onChange:e=>o([e.target.value]),className:"w-[200px]",disabled:!0})},dhe=({condition:e,onUpdate:n,onDuplicate:r,onDelete:o,segmentsConditions:i})=>{const{toast:a}=Il(),s=(e=>{const t=i.conditions.find((t=>t.field===e));return t||null})(e.field)||{operators:[],type:mZ.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:Lfe[e]||e})));return t.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch gap-2 min-w-0 w-full",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row flex-1 items-stretch gap-2 min-w-0 w-full",children:[t.jsx("div",{className:"flex-1 min-w-0 items-center flex",children:t.jsx(Dfe,{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:Mfe[e]||e,fieldType:o.type}))),s=a[0]?.value;let l=[];switch(o.type){case mZ.Boolean:l=[!1];break;case mZ.Number:l=[0];break;case mZ.Date:case mZ.DateTime:l=[new Date];break;case mZ.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",className:"w-full"})}),t.jsxs("div",{className:"flex-1 min-w-0 max-w-xs flex gap-2 items-center",children:[(e.operator===vZ.EQUALS_MONTH_DAY||e.operator===vZ.EQUALS_MONTH_DAY_YEAR||e.operator===vZ.BETWEEN_MONTH_DAY||e.operator===vZ.BETWEEN_MONTH_DAY_YEAR)&&t.jsx("div",{className:"flex items-center",children:(e=>{let n;switch(e){case vZ.EQUALS_MONTH_DAY:n="This operator will check if only the month and day are equal. This is useful for things like birthday, where year does not matter";break;case vZ.EQUALS_MONTH_DAY_YEAR:n="This operator will check if only the month and day are equal. This is useful for things like appointment dates, where specific day and month is important but year does not matter";break;case vZ.BETWEEN_MONTH_DAY:n="This operator will check if the date is between the two dates, but only checking the month and the day, not the year. This is helpful for things like birthday, where year does not matter";break;case vZ.BETWEEN_MONTH_DAY_YEAR:n="This operator will check if the date is between the two dates, checking the month, day and year. This is helpful for things like appointment dates, where specific day, month and year is important";break;default:return null}return t.jsx(G7,{title:n})})(e.operator)}),t.jsx(Dfe,{options:l.map((e=>({value:e,label:Mfe[e]||e}))),value:e.operator,onChange:t=>n({...e,operator:t}),placeholder:"Select operator",className:"w-full"})]}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(uhe,{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 flex-shrink-0 pl-2",children:[t.jsx(MZ,{size:"icon",variant:"ghost",onClick:r,children:t.jsx(Cu,{className:"h-4 w-4"})}),t.jsx(MZ,{size:"icon",variant:"ghost",onClick:o,children:t.jsx(td,{className:"h-4 w-4"})})]})]})},phe=({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(IZ,{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(Ju,{className:"w-full h-full"})})}),selected:"ai"===r}),t.jsx(IZ,{onClick:()=>{o("manual"),e("manual")},title:"Build Manually",subtitle:`Create your ${bf("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(Xu,{className:"w-full h-full"})})}),selected:"manual"===r})]})},fhe=({segmentId:e,setOpen:n,setTextToSegment:r,promptBuilderStyle:o,textToSegment:i})=>t.jsx("div",{children:t.jsx(LB,{className:"",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(IB,{className:"text-3xl font-normal",children:e?`Edit ${bf("engage:segment")}`:`Create ${bf("engage:segment")}`}),t.jsxs("div",{className:"flex items-center gap-2",children:[!1===o&&!1===i&&t.jsx(P6,{children:t.jsxs(k6,{children:[t.jsx(j6,{asChild:!0,children:t.jsx(MZ,{variant:"outline",size:"sm",onClick:()=>r(!0),children:t.jsx(Ju,{className:"h-4 w-3"})})}),t.jsx(M6,{children:t.jsxs("p",{children:["Use AI to create ",bf("engage:segment")," by describing them in natural language"]})})]})}),t.jsx(MZ,{variant:"ghost",size:"icon",onClick:()=>{n(!1)},className:"h-8 w-8",children:t.jsx(cd,{className:"h-4 w-4"})})]})]})})}),hhe=({setTextToSegment:e,setSegment:r})=>{const[o,i]=n.useState(""),[a,s]=n.useState(!1),{toast:c}=Il();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(QB,{children:[a&&t.jsx(TZ,{children:t.jsx(EZ,{})}),!a&&t.jsx(TZ,{children:t.jsx(hoe,{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(MZ,{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:`${bf("engage:segment")} conditions built successfully 🚀`,description:`Your ${bf("engage:segment")} conditions have been built successfully`}),r(t.conditions)):c({title:`${bf("engage:segment")} build failed`,description:"Please try again",variant:"destructive"}),e(!1),s(!1)},children:[t.jsx(Ju,{className:"h-4 w-4"}),"Generate ",bf("engage:segment")]})})]})]})};function mhe({segmentId:e,setOpen:n,onSegmentUpdated:r}){const{toast:o}=Il(),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}=fZ(e||""),{updateSegment:f}=hZ(e),{createSegment:h,isCreating:m,segmentsConditions:g}=uZ(),[v,y]=i.useState(!1),[b,x]=i.useState(!!a);i.useEffect((()=>{g&&u(d?{version:"1.0",id:d.id,name:d.name,description:d.description,logic:"AND",conditions:d.conditions}:{version:"1.0",id:"",name:"",description:"",logic:"AND",conditions:[{field:g.conditions[0].field,operator:g.conditions[0].operators[0],value:[]}]})}),[d,g]);const w=e=>e.value.some((e=>"object"==typeof e&&"type"in e&&"relative"===e.type)),_=e=>e.value.some((e=>"object"==typeof e&&"startDate"in e&&"endDate"in e));if(!g||p)return t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(EZ,{})});return t.jsxs(t.Fragment,{children:[t.jsx(fhe,{segmentId:e,setOpen:n,setTextToSegment:y,promptBuilderStyle:b,textToSegment:v},"segment-builder-header"),b?t.jsx(TZ,{children:t.jsx(phe,{onSelectStyle:e=>{"ai"===e&&y(!0),x(!1)}})},"prompt-builder-style"):t.jsx(TZ,{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(QB,{children:v?t.jsx(TZ,{children:t.jsx(hhe,{setTextToSegment:y,setSegment:e=>u({...c,conditions:e})})}):t.jsxs(TZ,{children:[t.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(nee,{className:"text-muted-foreground text-xs",children:"Name"}),t.jsx(s5,{placeholder:`${bf("engage:segment")} name`,value:c.name,onChange:e=>u({...c,name:e.target.value})})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(nee,{className:"text-muted-foreground text-xs",children:"Description"}),t.jsx(s5,{placeholder:`${bf("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(QB,{mode:"popLayout",children:c.conditions.map(((e,n)=>t.jsxs(DX.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(DX.div,{className:"relative flex items-center gap-3 py-1",initial:{opacity:0},animate:{opacity:1},transition:{delay:.1},children:[t.jsx(DX.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(DX.span,{className:"text-muted-foreground text-xs",initial:{opacity:0},animate:{opacity:1},transition:{delay:.2},children:"AND"}),t.jsx(DX.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(dhe,{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(MZ,v?{variant:"secondary",onClick:()=>y(!1),children:[t.jsx(Xu,{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(Gu,{className:"h-4 w-4"}),"Add Condition"]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(MZ,{variant:"destructive",onClick:()=>n(!1),children:"Cancel"}),t.jsx(MZ,{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!==vZ.EXISTS&&0===t.value.length)return{valid:!1,error:`Please ensure a value is selected for ${t.field}`};if(t.operator===vZ.EXISTS&&t.value.length>0)return{valid:!1,error:`EXISTS operator can only be used with an empty array for ${t.field}`};if(w(t)&&t.operator!==vZ.EQUALS_MONTH_DAY&&t.operator!==vZ.EQUALS_MONTH_DAY_YEAR)return{valid:!1,error:`Relative dates can only be used with the month and day or month, day, and year operator for ${t.field}`};if(w(t)&&void 0===t.value[0].value)return{valid:!1,error:`Please select a value for the relative date for ${t.field}`};if(_(t)&&t.operator!==vZ.BETWEEN_MONTH_DAY&&t.operator!==vZ.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===jfe.DAYS)return e.value??0;throw HX(e.unit,jfe)};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===mZ.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:`${bf("engage:segment")} updated successfully`}),n(!1),r?.(e)},onError:()=>{o({title:`Error updating ${bf("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}}):h({name:c.name,description:c.description,conditions:c.conditions},{onSuccess:e=>{o({title:`${bf("engage:segment")} created successfully`}),r?.(e?.id??!1),n(!1)},onError:()=>{o({title:`Error creating ${bf("engage:segment")}`,description:"Please try again",variant:"destructive"}),r?.("error")}})}catch(s){o({title:`Error saving ${bf("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(Mu,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Updating...":"Creating..."]}):e?"Update":"Create"})]})]})})]})},"manual-builder-style")]})}function ghe({open:e,setOpen:n,segmentId:r,onSegmentUpdated:o}){return t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{className:"flex max-h-[86vh] flex-col gap-0 overflow-visible max-w-6xl w-full",hideCloseButton:!0,children:[t.jsxs(s$,{children:[t.jsxs(IB,{children:[bf("engage:segment")," Builder"]}),t.jsxs(FB,{children:["Build a ",bf("engage:segment")," to target your audience"]})]}),t.jsx(mhe,{segmentId:r,setOpen:n,onSegmentUpdated:e=>{o?.(e),n(!1)}})]})})}const vhe=({value:e,label:n,percentage:r,variant:o,isLoading:i,selected:a})=>t.jsxs("div",{className:"rounded-md border-2 border-muted-foreground/20 px-2 pt-2 pb-3 duration-300 ease-in-out overflow-x-auto max-w-full min-w-0 "+(a?"scale-[1.02] [border-color:hsl(var(--reach-primary))] shadow-lg":""),style:{containerType:"inline-size"},"data-card-container":!0,children:[t.jsxs("div",{className:"flex flex-col gap-1 items-start w-full min-w-0",children:[t.jsx("div",{className:"flex items-baseline gap-2 w-full min-w-0 @container/num",children:i?t.jsx("span",{className:"animate-pulse",children:"..."}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"font-semibold pl-2 break-words max-w-full min-w-0 truncate\n text-xl @[250px]/card:text-2xl @[350px]/card:text-3xl @[500px]/card:text-4xl text-primary",children:e.toLocaleString()}),void 0!==r&&e.toLocaleString().replace(/,/g,"").length<5&&t.jsxs("span",{className:"text-muted-foreground/50 text-sm hidden @[120px]/num:inline",children:["(",r,"%)"]})]})}),t.jsx("span",{className:`px-2 sm:px-2.5 py-1 text-xs font-medium rounded-lg ${{default:"bg-gray-100/50 text-gray-700",blue:"bg-blue-100/50 text-blue-700",green:"bg-green-100/50 text-green-700"}[o]}`,children:n})]}),t.jsx("p",{className:"text-sm text-muted-fore hidden @[250px]/card:inline mt-1",children:1===e?"contact":"contacts"})]}),yhe=({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(Aue,{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(vhe,{value:r.total,label:"Total",variant:"default",isLoading:void 0===e}),t.jsx(vhe,{value:r.emails,label:"Email",percentage:o(r.emails),variant:"blue",isLoading:void 0===e}),t.jsx(vhe,{value:r.phones,label:"Phone",percentage:o(r.phones),variant:"green",isLoading:void 0===e})]})]})},bhe=({recipients:e})=>e?.length?t.jsx("div",{className:"bg-foreground/5 rounded-lg h-full relative overflow-hidden",children:t.jsx("div",{className:"absolute inset-0 w-full h-full overflow-y-auto",children:t.jsxs("table",{className:"w-full",children:[t.jsx("thead",{className:"sticky top-0 bg-foreground/5 backdrop-blur-sm",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Name"}),t.jsx("th",{className:"px-3 sm:px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wide",children:"Contact"})]})}),t.jsx("tbody",{className:"divide-y divide-gray-200/50",children:e.map(((e,n)=>t.jsxs("tr",{className:"hover:bg-white/50 transition-colors",children:[t.jsx("td",{className:"px-3 sm:px-4 py-3 text-sm text-gray-900",children:e.firstName||e.lastName?`${e.firstName||""} ${e.lastName||""}`.trim():"Not Provided"}),t.jsx("td",{className:"px-3 sm:px-4 py-3",children:t.jsxs("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:[e.email&&t.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-blue-100/50 text-blue-700 rounded-lg",children:"Email"}),e.phone&&t.jsx("span",{className:"px-2 sm:px-2.5 py-1 text-xs font-medium bg-green-100/50 text-green-700 rounded-lg",children:"Phone"})]})})]},n)))})]})})}):null,xhe=({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(Aue,{children:"Filter"}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 p-1",children:[t.jsx(IZ,{onClick:()=>a("all"),title:`All ${bf("engage:user",{count:2})}`,subtitle:"Send to everyone",icon:t.jsx(FZ.UsersIcon,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"all"===o}),t.jsx(IZ,{onClick:()=>a("segments"),title:`Select ${bf("engage:user",{count:2})}`,subtitle:`Choose from ${bf("engage:segment",{count:2})}`,icon:t.jsx(FZ.UserEdit,{className:"w-5 h-5 mb-2 text-gray-600"}),selected:"segments"===o})]})]})},whe=({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(Wfe,{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(foe,{onSelect:()=>{e(!1),a(!0)},className:"cursor-pointer",children:[t.jsx(FZ.PlusIcon,{className:"w-4 h-4"}),"New"]},"new-segment")]})})},_he=({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(whe,{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(MZ,{onClick:()=>u(!c),className:"flex items-center gap-1 transition-colors",size:"sm",children:[t.jsx(DX.div,{animate:{rotate:c?180:0},transition:{duration:.2},children:t.jsx(FZ.DropdownMenuTrigger,{className:"w-5 h-5"})}),t.jsx("span",{children:"Don't send to"})]}),t.jsx(QB,{children:c&&t.jsx(DX.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeInOut"},children:t.jsx(whe,{segments:r,allSegments:s||[],onAddSegment:e=>o(e,"exclude"),onRemoveSegment:e=>i(e,"exclude"),setOpenCreateSegmentDialog:a})})})]})]})},She=({title:e="Preview Audience"})=>{const r=bZ(),[o,i]=n.useState("all"),[a,s]=n.useState(r?.includeSegmentIds||[]),[l,c]=n.useState(r?.excludeSegmentIds||[]),[u,d]=n.useState(!1),[p,f]=n.useState(!1),{segments:h,isLoading:m}=dZ(),{updateAutomation:g}=De(r?.id??""),[v,y]=n.useState(void 0),b=1===a.length&&0===l.length&&void 0!==h?.find((e=>e.type===gZ.ALL_USERS&&e.id===a[0]));n.useEffect((()=>{r&&!p&&(i(b||a.length>0&&0===l.length?"all":"segments"),lZ({includeSegments:a,excludeSegments:l}).then((e=>{y(e)})),f(!0))}),[r,b,p,a,l]);return n.useEffect((()=>{r&&p&&(JSON.stringify(a)===JSON.stringify(r.includeSegmentIds)&&JSON.stringify(l)===JSON.stringify(r.excludeSegmentIds)||(g({includeSegments:a,excludeSegments:l}),lZ({includeSegments:a,excludeSegments:l}).then((e=>{y(e)}))))}),[a,l,r,p,g]),t.jsxs(Nue,{title:e,children:[!m&&h&&p?t.jsxs("div",{className:"flex gap-8 w-full pb-4 px-4",children:[t.jsxs("div",{className:"flex flex-col flex-1 relative overflow-y-auto pb-4 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:[t.jsx(yhe,{countResponse:v}),t.jsx(xhe,{onSelectionChange:e=>{if(i(e),"all"===e){const e=h?.find((e=>e.type===gZ.ALL_USERS));if(!e)return;s([e.id]),c([])}},defaultValue:o}),t.jsx(QB,{children:"segments"===o&&t.jsx(DX.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(_he,{includedSegments:a,excludedSegments:l,handleAddSegment:(e,t)=>{"include"===t?s((t=>[...t,e])):c((t=>[...t,e]))},handleRemoveSegment:(e,t)=>{"include"===t?s((t=>t.filter((t=>t!==e)))):c((t=>t.filter((t=>t!==e))))},setOpenCreateSegmentDialog:d,segments:h,defaultIsExcludeOpen:l.length>0})})})]}),t.jsx("div",{className:"flex flex-col flex-1 relative overflow-hidden",children:v?.recipients&&t.jsx(bhe,{recipients:v.recipients})})]}):t.jsx("div",{children:t.jsx(EZ,{text:["Fetching segments","Finishing up"]})}),t.jsx(ghe,{open:u,setOpen:d})]})},Ehe=()=>t.jsx(She,{title:"Select Audience"});var The=(e=>(e[e.SelectAudience=1]="SelectAudience",e[e.SelectCommunication=2]="SelectCommunication",e[e.Schedule=3]="Schedule",e[e.PreviewAndSend=4]="PreviewAndSend",e))(The||{});const Che="https://assets.embedreach.com/defaults/logo-placeholder-128.png",Ahe="You have not uploaded a custom logo. Please make sure to double check your email before sending!",Nhe=()=>{const e=bZ(),t=xZ(),r=n.useCallback((async n=>e?await(async e=>{const{currentStep:t,automation:n,communicationGroup:r}=e;switch(t){case The.SelectAudience:return{canMove:n.includeSegmentIds.length>0,errorMessage:"Please ensure you have selected at least one segment"};case The.SelectCommunication:{const e=n.actionData?.find((e=>"send_communication"===e.actionType));if(!e)return{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"};if(!r||!r.smsChannelSenderId&&!r.emailChannelSenderId)return{canMove:!1,errorMessage:"Please ensure you have selected either a email communication or text communication"};if(r.emailChannelSenderId&&(!r.emailHtmlBody||!r.emailSubject))return{canMove:!1,errorMessage:"Please ensure you have a email body and subject"};if(r.smsChannelSenderId&&!r.smsMessageBody)return{canMove:!1,errorMessage:"Please ensure you have a sms message body"};let t=null;return r.emailHtmlBody?.includes(Che)&&(t=Ahe),{canMove:!0,errorMessage:null,warningMessage:t}}case The.Schedule:{if(!n.triggerMetadata)return{canMove:!1,errorMessage:"Please make sure to select a time to send before starting!"};if(n.triggerMetadata.triggerType!==Ue.ONE_TIME)return{canMove:Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:null};if(!n.triggerMetadata?.scheduledAt)return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${bf("engage:broadcast")}`};if(!Boolean(n.triggerMetadata?.scheduledAt&&new Date(n.triggerMetadata.scheduledAt)>new Date))return{canMove:!1,errorMessage:`Please ensure you have set a valid future date for your ${bf("engage:broadcast")}`};if(!Boolean(n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))))return{canMove:!1,errorMessage:"Please ensure you have set a valid email or sms communication"};const e=n.triggerMetadata;return{canMove:Boolean(e.scheduledAt&&new Date(e.scheduledAt)>new Date&&n.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),errorMessage:`Please ensure you have set a valid future date for your ${bf("engage:broadcast")} automation`}}case The.PreviewAndSend:return{canMove:!0,errorMessage:null};default:Eoe(t,The)}})({currentStep:n,automation:e,communicationGroup:t}):{canMove:!1,errorMessage:`${bf("engage:broadcast")} not loaded`}),[e,t]);return{validateStep:r}},Rhe=({onFinish:e,getExtraMergeFields:r,onBeforeSchedule:o})=>{const i=bZ(),a=xZ(),{updateAutomation:s}=De(i?.id||""),{estimatedMatchesStats:l}=(e=>{const{data:t}=pZ({automationId:e?.id??"",includeSegments:e?.includeSegmentIds??[],excludeSegments:e?.excludeSegmentIds??[]}),r=n.useMemo((()=>t?.recipients?t.recipients.reduce(((e,t)=>({emails:e.emails+(t.email?1:0),phones:e.phones+(t.phone?1:0)})),{emails:0,phones:0}):{emails:0,phones:0}),[t?.recipients]);return{estimatedMatches:t,estimatedMatchesStats:r}})(i??void 0),{validateStep:c}=Nhe(),[u,d]=n.useState(!1),[p,f]=n.useState(The.SelectAudience);if(!i||!p||!a)return t.jsx("div",{className:"flex-1 flex flex-col @container justify-center items-center h-[500px]",children:t.jsx(EZ,{text:[`Fetching ${bf("engage:broadcast")} data`,"Finishing up"]})});const h=(({automation:e,communicationGroup:n,getExtraMergeFields:r})=>e?[{id:"audience",title:"Audience",step:1,isValid:()=>e.includeSegmentIds.length>0,content:t.jsx(_oe,{content:t.jsx(Ehe,{})},"audience"),footerConfig:{backText:"Back",nextText:"Next",hideBack:e.triggerType===Ue.ONE_TIME,backDisabled:!1,nextDisabled:()=>!1}},{id:"content",title:"Content",step:2,isValid:()=>{const t=e.actionData?.find((e=>"send_communication"===e.actionType));return!(!t||!t.actionMetadata.communicationGroupId||!n||!n.smsChannelSenderId&&!n.emailChannelSenderId||!(!n.emailChannelSenderId||n.emailHtmlBody&&n.emailSubject)||n.smsChannelSenderId&&!n.smsMessageBody)},content:t.jsxs("div",{className:"flex flex-col gap-4 w-full p-6 rounded-xl bg-gray-100 flex-1 h-full",children:[t.jsx("h2",{className:"text-2xl font-semibold text-primary",children:"Edit Content"}),t.jsx(woe,{getExtraMergeFields:r})]},"content"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"schedule",title:"Schedule",step:3,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Ue.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(_oe,{className:"flex-1",content:t.jsx(kfe,{})},"schedule"),footerConfig:{backText:"Back",nextText:"Next",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}},{id:"send",title:"Send",step:4,isValid:()=>Boolean(e.triggerMetadata?.triggerType===Ue.ONE_TIME&&e.triggerMetadata?.scheduledAt&&new Date(e.triggerMetadata.scheduledAt)>new Date(Date.now()+18e4)&&e.actionData?.some((e=>"send_communication"===e.actionType&&e.actionMetadata.communicationGroupId))),content:t.jsx(_oe,{className:"flex-1",content:t.jsx(Oue,{})},"send"),footerConfig:{backText:"Back",nextText:"Schedule",hideBack:!1,backDisabled:!1,nextDisabled:()=>!1}}]:[])({automation:i,communicationGroup:a,getExtraMergeFields:r}),m=async()=>{const{canMove:t,errorMessage:n,warningMessage:r}=await c(p);t?(r&&Dl({title:r,variant:"warning"}),p===The.PreviewAndSend?await(async()=>{if(o)try{const t=await o({estimatedEmailRecipients:l?.emails||0,estimatedSmsRecipients:l?.phones||0});!0===t?(s({status:ze.ACTIVE}),Dl({title:`${bf("engage:broadcast")} scheduled!`}),e()):Dl({title:"Oops!",description:t,variant:"destructive"})}catch(t){Dl({title:"Oops!",description:"An error occurred while checking scheduling conditions",variant:"destructive"})}else s({status:ze.ACTIVE}),Dl({title:`${bf("engage:broadcast")} scheduled!`}),e()})():f(p+1)):Dl({title:"Oops!",description:n,variant:"destructive"})},g=()=>{p>The.SelectAudience&&f(p-1)},v=()=>{e()};return t.jsxs("div",{className:"flex-1 flex flex-col @container h-full min-h-0",children:[t.jsxs("header",{className:"w-full flex items-center gap-4 h-16 px-6",children:[t.jsx("h1",{className:"text-xl font-bold leading-none",children:i.name}),t.jsx("div",{className:"flex items-center gap-4",children:t.jsx(YZ,{variant:R7(i.status),children:x9[i.status]})})]}),t.jsxs("main",{className:"flex gap-4 flex-1 min-h-0",children:[t.jsx("div",{className:"hidden @[1000px]:block",children:t.jsx("nav",{className:"space-y-0 w-50 self-start pr-6 pl-8 pt-4 ",children:h.map((e=>t.jsx("div",{className:`\n rounded-md transition-colors\n ${e.step===p?"bg-[var(--reach-secondary)] text-[var(--reach-primary-foreground)] font-medium":e.step<p?"text-muted-foreground hover:bg-muted":"text-muted-foreground/60"}\n `,children:t.jsx(iQ,{label:e.title,isActive:e.step===p,isCompleted:e.isValid(),onClick:async()=>{if(!u)if(e.step>p){const{canMove:t,errorMessage:n,warningMessages:r}=await(async e=>{if(e<=p)return{canMove:!0,errorMessage:null};d(!0);try{const t=[];for(let n=p;n<e;n++){const{canMove:e,errorMessage:r,warningMessage:o}=await c(n);if(!e)return{canMove:e,errorMessage:r};o&&t.push(o)}return{canMove:!0,errorMessage:null,warningMessages:t}}finally{d(!1)}})(e.step);if(t){if(r&&r.length>0)for(const e of r)Dl({title:e,variant:"warning"});f(e.step)}else n&&Dl({title:"Cannot navigate to this step",description:n,variant:"destructive"})}else f(e.step)}})},e.step)))})}),t.jsx("section",{className:"flex-1 mr-6 w-full relative rounded-xl bg-gray-100 ml-6 @[1000px]:ml-0",children:t.jsx("div",{className:" overflow-y-auto top-0 left-0 right-0 bottom-0 flex-1 h-full flex-col flex",children:t.jsx(QB,{children:t.jsx(TZ,{className:"pt-0 h-full",children:h.find((e=>e.step===p))?.content},p)})})})]}),t.jsx("footer",{className:"w-full flex justify-end shadow-md z-10 items-center h-16 px-6",children:t.jsx(F7,{handleSkipAndSaveAsDraft:v,handleBack:g,handleNext:m,hideBack:h.find((e=>e.step===p))?.footerConfig.hideBack??!1,backText:h.find((e=>e.step===p))?.footerConfig.backText??"Back",nextText:h.find((e=>e.step===p))?.footerConfig.nextText??"Next",backDisabled:h.find((e=>e.step===p))?.footerConfig.backDisabled??!1,nextDisabled:h.find((e=>e.step===p))?.footerConfig.nextDisabled()??!1})})]})},Ohe=({children:e,actionId:r})=>{const{setActionId:o}=n.useContext(XX);return n.useEffect((()=>{o(r)}),[r,o]),t.jsx("div",{children:e})},Phe=()=>t.jsxs("div",{children:[t.jsx("div",{className:BZ,children:t.jsx(FZ.OneTimeBroadcast,{})}),t.jsxs("h3",{className:zZ,children:[bf("engage:broadcast")," Broadcast"]}),t.jsx("p",{className:HZ,children:"Send a single message to your current list, like announcing a sale or newsletter."})]}),khe=()=>t.jsxs("div",{children:[t.jsx("div",{className:qZ,children:"Coming Soon"}),t.jsx("div",{className:BZ,children:t.jsx(FZ.RealtimeActivity,{})}),t.jsx("h3",{className:zZ,children:"Realtime Activity"}),t.jsx("p",{className:HZ,children:"Responds to immediate actions your contacts take, like abandoned carts, form submissions, or appointment bookings."})]}),jhe=({selectedType:e,setAutomationName:n,automationName:r,setAutomationDescription:o,automationDescription:i})=>t.jsxs("div",{className:"flex flex-col items-center justify-center p-8 max-w-lg mx-auto",children:[t.jsxs("h2",{className:"text-2xl font-semibold mb-8 text-center",children:["Name Your"," ",bf(e===Ue.ONE_TIME?"engage:broadcast":"engage:trigger_based")]}),t.jsxs("div",{className:"w-full space-y-6",children:[t.jsx("div",{className:"bg-gray-50 p-6 rounded-xl items-center justify-center text-center",children:(()=>{switch(e){case Ue.ONE_TIME:return t.jsx(Phe,{});case Ue.TRIGGER_BASED:return t.jsx(khe,{});default:throw Eoe(e,Ue)}})()}),t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationName",className:"block text-sm font-medium text-gray-900",children:"Name"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Only visible to your team"})]}),t.jsx(s5,{id:"automationName",type:"text",value:r,onChange:e=>n(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-indigo-500 focus:border-indigo-500 shadow-sm",placeholder:"e.g. April Newsletter Campaign",autoFocus:!0})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[t.jsx("label",{htmlFor:"automationDescription",className:"block text-sm font-medium text-gray-900",children:"Description"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Optional"})]}),t.jsx(hoe,{id:"automationDescription",value:i,onChange:e=>o(e.target.value),className:"w-full min-h-[80px] resize-none",placeholder:`Add any helpful context for your team. If left blank, we'll generate one for you when you start the ${bf("engage:broadcast").toLowerCase()}`})]})]})]})]}),Mhe=({onClose:e,automationType:r,currentStep:o,setCurrentStep:i,getExtraMergeFields:a,onBeforeSchedule:s})=>{const{createAutomation:l,isCreating:c}=Le(),[u,p]=n.useState(!1),[f,h]=n.useState(void 0),[m,g]=n.useState(void 0),[v,y]=n.useState(!1),[b,x]=n.useState(r?{name:void 0,description:void 0,type:r}:{name:void 0,description:void 0,type:void 0}),w=void 0!==b.name&&void 0!==b.type&&""!==b.name;n.useEffect((()=>{if(b.type&&!b.name&&!v){const e=new Date,t=e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=e.toLocaleDateString([],{month:"long",day:"numeric"}),r=`${bf("engage:broadcast")} ${n} ${t}`,o="";x((e=>({...e,name:r,description:o}))),y(!0)}}),[b,v]);if(c||u)return t.jsx("div",{className:VZ,children:t.jsx(EZ,{text:[`Creating ${bf("engage:broadcast")}`,"Finishing up"]})});return t.jsxs("div",{className:OB("relative overflow-y-auto h-full p-8",o===LZ.OneTimeWizard?"max-h-[90vh]":"h-full"),children:[t.jsx(QB,{mode:"wait",children:t.jsx(TZ,{className:"h-full",children:(()=>{switch(o){case LZ.ChooseAutomationType:return t.jsx(GZ,{onNext:e=>{x({...b,type:e}),i(LZ.SetAutomationName)}});case LZ.SetAutomationName:return b.type?t.jsx(jhe,{selectedType:b.type,setAutomationName:e=>{x({...b,name:e})},automationName:b.name??"",setAutomationDescription:e=>{x({...b,description:e})},automationDescription:b.description??""}):null;case LZ.OneTimeWizard:return f&&m?t.jsx(_Z,{automationId:f,children:t.jsx(Ohe,{actionId:m,children:t.jsx(Rhe,{onFinish:()=>{e?.(f)},getExtraMergeFields:a,onBeforeSchedule:s})})}):null;default:throw HX(o,LZ)}})()},o)}),o!==LZ.OneTimeWizard&&t.jsx("div",{className:"pt-2",children:t.jsx(DZ,{onClose:e,currentStep:o,setCurrentStep:i,isDisabled:!w,createAutomation:async()=>{if(!w||!b.name||!b.type)return;p(!0);l({name:b.name,type:b.type,description:b.description},{onSuccess:async t=>{if(t.id){const n=await(async e=>(await Oe(`${d}`,{method:"POST",body:JSON.stringify(e)})).data)({}),o=zX().toString();await ke(t.id,{action:[{actionType:"send_communication",actionMetadata:{actionType:"send_communication",communicationGroupId:n.id,currentActionId:o}}]}),h(t.id),await nZ({automationId:t.id,actionId:o}),r===Ue.ONE_TIME?(i(LZ.OneTimeWizard),g(o),p(!1)):e?.(t.id)}else e?.("error")},onError:()=>{e?.("error")},onSettled:()=>{x({name:void 0,description:void 0,type:void 0})}})},disableBackButton:void 0!==r})})]})};function Lhe({open:e,setOpen:r,onClose:o,automationType:i,getExtraMergeFields:a,replyToSettingsText:s,replyToSettingsLink:l,fromNameSettingsText:c,fromNameSettingsLink:u}){const[d,p]=n.useState(i?LZ.SetAutomationName:LZ.ChooseAutomationType);return n.useEffect((()=>{e&&p(i?LZ.SetAutomationName:LZ.ChooseAutomationType)}),[e,i]),t.jsx(c$,{children:t.jsx(u$,{replyToSettingsText:s,replyToSettingsLink:l,fromNameSettingsText:c,fromNameSettingsLink:u,children:t.jsx(PB,{open:e,onOpenChange:r,children:t.jsxs(MB,{hideCloseButton:d===LZ.OneTimeWizard,className:`flex max-h-[86vh] ${d===LZ.OneTimeWizard?"max-w-[90vw]":"max-w-4xl"} flex-col gap-0 overflow-visible p-0`,children:[t.jsx(LB,{children:t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs(s$,{children:[t.jsx(IB,{className:"text-3xl font-normal",children:"Create Automation"}),t.jsx(FB,{children:"Create a new automation to send messages to your customers."})]})})}),t.jsx(Mhe,{onClose:e=>{o?.(e),r(!1)},automationType:i,currentStep:d,setCurrentStep:p,getExtraMergeFields:a})]})})})})}const Dhe=({tabs:e,activeTab:r,onTabChange:o,tabsLocation:i="left",secondaryTabs:a=!1})=>{const s=n.useRef([]),[l,c]=n.useState({width:0,left:0});n.useEffect((()=>{const t=s.current[e.findIndex((e=>e.id===r))];t&&c({width:t.offsetWidth,left:t.offsetLeft})}),[r,e]);const u=e.find((e=>e.id===r));return t.jsxs("div",{className:"flex flex-col gap-4 w-full overflow-x-hidden h-full",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsxs("div",{className:"relative flex items-center gap-8 "+("left"===i?"w-full justify-start":"w-full justify-center"),children:[t.jsx("div",{className:"absolute bottom-0 h-[1px] rounded-full transition-all duration-300 ease-out\n bg-gradient-to-r from-primary to-primary/90\n shadow-[0_0_8px_rgba(var(--primary-rgb),0.3)]",style:{width:`${l.width}px`,left:`${l.left}px`}}),e.map(((e,n)=>t.jsx("button",{ref:e=>s.current[n]=e,onClick:()=>o(e.id),className:OB("relative px-7 py-3 transition-all duration-200 text-lg",r!==e.id&&"text-muted-foreground",a&&"text-sm"),children:e.label},e.id)))]})}),t.jsx("div",{className:"relative overflow-hidden flex-grow min-h-0",children:t.jsx("div",{className:"relative h-full",children:u?u.content:null})})]})},Ihe=e=>{if(!e)return"$0.00";const t="string"==typeof e?e.replace(/,/g,""):e,n=Number(t);return Number.isNaN(n)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(n)},Fhe="reach-styles-module__header___-izE2",Uhe="reach-styles-module__title___n1hA9",$he="reach-styles-module__description___EvXM-",Vhe="reach-styles-module__content___okv68",Bhe="reach-styles-module__footer___YA4U4",zhe=au("reach-styles-module__base___zJcoE",{variants:{variant:{default:"reach-styles-module__default___88Q0d",destructive:"reach-styles-module__destructive___5EWhN",outline:"reach-styles-module__outline___gj9sC",secondary:"reach-styles-module__secondary___cN5Wj"}},defaultVariants:{variant:"default"}}),Hhe=i.forwardRef((({className:e,variant:n,...r},o)=>t.jsx("div",{ref:o,className:rp(zhe({variant:n}),e),...r})));Hhe.displayName="Card";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp(Fhe,e),...n}))).displayName="CardHeader";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp(Uhe,e),...n}))).displayName="CardTitle";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp($he,e),...n}))).displayName="CardDescription";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp(Vhe,e),...n}))).displayName="CardContent";i.forwardRef((({className:e,...n},r)=>t.jsx("div",{ref:r,className:rp(Bhe,e),...n}))).displayName="CardFooter";const qhe=({Icon:e,title:n,value:r,tooltipText:o,change:i})=>t.jsxs(Hhe,{className:"relative flex flex-col justify-between min-h-[130px] transition-all duration-300 hover:shadow-md p-4",children:[t.jsxs("div",{className:"flex justify-between items-start",children:[t.jsx("div",{className:"rounded-lg p-2 bg-primary/10 flex items-center justify-center",children:t.jsx(e,{className:"w-5 h-5 text-primary"})}),t.jsx("div",{className:"absolute top-3 right-3",children:t.jsx(G7,{title:o})})]}),t.jsxs("div",{className:"mt-4",children:[t.jsx("div",{className:"text-2xl font-bold leading-tight text-primary",children:r}),t.jsx(Aue,{children:n})]}),i&&t.jsx("div",{className:"absolute bottom-3 right-3",children:t.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full bg-green-100 text-green-600 text-xs font-semibold",children:i})})]}),Ghe=({activeTab:e,automation:n})=>{if(!n)return null;const r={sales:[{Icon:FZ.SalesAmount,title:"Order Amount",value:Ihe(n.derivedRevenue),tooltipText:"Total derived revenue from this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx(qhe,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Khe=({activeTab:e,statistics:n})=>{const r={email:[{Icon:FZ.MessagesSent,title:"Emails Sent",value:n.email.numberSent,tooltipText:"Total number of emails that were successfully sent in this campaign"},{Icon:FZ.OpenRate,title:"Open Rate",value:`${(100*n.email.openPercentage).toFixed(2)}%`,tooltipText:"Percentage of recipients who opened the email out of total emails delivered"},{Icon:FZ.TotalBounceRate,title:"Total Bounce Rate",value:`${(100*(n.email.softBounceRate+n.email.hardBounceRate)).toFixed(2)}%`,tooltipText:"Percentage of emails that were not delivered due to permanent (hard) or temporary (soft) delivery failures"},{Icon:FZ.LinksClicked,title:"Links Clicked",value:n.email.linksClicked,tooltipText:"Total number of times recipients clicked on links within the email"},{Icon:FZ.SpamComplies,title:"Spam Complaints",value:`${(100*n.email.spamComplaintRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who marked this email as spam"},{Icon:FZ.UnsubscribeRate,title:"Unsubscribe Rate",value:`${(100*n.email.unsubscribedRate).toFixed(2)}%`,tooltipText:"Percentage of recipients who unsubscribed after receiving this email"}],sms:[{Icon:FZ.MessagesSent,title:"SMS Sent",value:n.sms.numberSent,tooltipText:"Total number of SMS messages that were successfully sent in this campaign"}]};return t.jsx("div",{className:"grid gap-2 transition-all duration-300 grid-cols-3 pb-4",children:r[e].map(((e,n)=>t.jsx(qhe,{Icon:e.Icon,title:e.title,value:e.value,tooltipText:e.tooltipText},n)))})},Whe=({automationId:e,includeSales:r=!1,includeSms:o=!1,automation:i})=>{const[a,s]=n.useState("email"),{statistics:l,isLoading:c}=Ie(e);if(c||!l)return t.jsx("div",{className:"bg-white rounded-2xl w-full p-6 space-y-4 relative h-[14.05rem]",children:t.jsx(EZ,{text:[`Fetching ${bf("engage:insight",{count:2})}`,"Finishing up"]})});const u=[{id:"email",label:`Email ${bf("engage:insight",{count:2})}`,content:t.jsx(Khe,{activeTab:"email",statistics:l})},...o?[{id:"sms",label:`SMS ${bf("engage:insight",{count:2})}`,content:t.jsx(Khe,{activeTab:"sms",statistics:l})}]:[],...r?[{id:"sales",label:`Sales ${bf("engage:insight",{count:2})}`,content:t.jsx(Ghe,{activeTab:"sales",automation:i})}]:[]];return t.jsx(Dhe,{tabs:u,activeTab:a,onTabChange:e=>s(e),tabsLocation:"left"})},Yhe={all:["website"],content:()=>[...Yhe.all,"content"],analyze:()=>[...Yhe.all,"analyze"],brandSettings:()=>[...Yhe.all,"brand-settings"]},Xhe=async()=>(await Oe("/web-presence/brand-settings",{method:"POST"})).data,Zhe=({isLoading:e,brandSettings:r,onComplete:o})=>{const[i,a]=n.useState(0),s=[{text:"Analyzing your brand palette",icon:Bu},{text:"Extracting your visual identity",icon:Nu},{text:"Discovering your brand personality",icon:Ou},{text:"Crafting your email style",icon:Du},{text:"Finalizing your brand profile",icon:_u}];n.useEffect((()=>{if(!e)return;const t=setInterval((()=>{a((e=>{const n=e+1;return n>=s.length?(clearInterval(t),setTimeout((()=>{o()}),1500),e):n}))}),2500);return()=>clearInterval(t)}),[e,o,s.length]);return t.jsx(DX.div,{className:"flex flex-col items-center justify-center h-full w-full bg-background p-6",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.6},children:t.jsxs("div",{className:"flex flex-col items-center gap-8 max-w-2xl w-full",children:[t.jsx(DX.div,r?.logoUrl?{className:"w-24 h-24 sm:w-32 sm:h-32 flex items-center justify-center rounded-xl overflow-hidden bg-card shadow-md border",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:t.jsx("img",{src:r.logoUrl,alt:"Brand Logo",className:"max-w-full max-h-full object-contain"})}:{className:"w-24 h-24 sm:w-32 sm:h-32 rounded-xl flex items-center justify-center shadow-md border bg-primary",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:r?.brandName?t.jsx("span",{className:"text-4xl sm:text-5xl font-bold text-white",children:r.brandName.charAt(0)}):t.jsx(Ju,{className:"w-12 h-12 sm:w-16 sm:h-16 text-white"})}),t.jsx(DX.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-xl font-medium text-center text-foreground",children:s[i].text},`loading-${i}`),t.jsx("div",{className:"flex items-center justify-center space-x-8 sm:space-x-12",children:s.map(((e,n)=>{const r=n<=i,o=n===i;return t.jsxs(DX.div,{className:"relative flex items-center justify-center w-12 h-12 rounded-full border-2 "+(r?"bg-card shadow-md border-primary":"bg-muted border-muted-foreground/30"),initial:{scale:.8,opacity:.5},animate:{scale:o?1.1:1,opacity:r?1:.5},transition:{duration:.3},children:[t.jsx(e.icon,{className:"w-5 h-5 "+(r?"text-primary":"text-muted-foreground")}),o&&t.jsx(DX.div,{className:"absolute inset-0 rounded-full border-2 border-primary",initial:{scale:1,opacity:.8},animate:{scale:2.5,opacity:0},transition:{duration:3,repeat:1/0,ease:"easeOut"}})]},`step-${n}`)}))}),t.jsx(DX.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.8,duration:.6},className:"w-full",children:t.jsx("div",{className:"h-[140px] w-full max-w-lg mx-auto p-5 bg-gradient-to-br from-card/70 to-card/40 backdrop-blur-md rounded-2xl border border-border/60 shadow-lg",children:t.jsxs("div",{className:"h-full flex flex-col justify-center",children:[0===i&&t.jsxs("div",{className:"space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80 text-center",children:"Extracted Color Palette"}),t.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:[r?.primaryColor,...r?.secondaryColors||[]]?.slice(0,4).map(((e,n)=>t.jsx("div",{className:"flex flex-col items-center gap-1",children:t.jsx("div",{className:"w-10 h-10 rounded-xl border-2 border-white/50 shadow-md",style:{backgroundColor:e}})},n)))}),t.jsx("div",{className:"text-center text-xs text-muted-foreground",children:"Brand colors identified"})]}),1===i&&t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Identity"}),r?.brandName?t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-xl font-bold",children:r.brandName}),r.brandTagline&&t.jsxs("div",{className:"text-sm text-muted-foreground italic px-4",children:['"',r.brandTagline,'"']}),t.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Visual identity extracted"})]}):t.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Extracting brand elements..."})]}),2===i&&t.jsxs("div",{className:"text-center space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Personality"}),r?.brandPersonality?t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex justify-center gap-4",children:[r.brandPersonality.tone&&t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Tone"}),t.jsx("div",{className:"text-sm font-medium text-foreground capitalize px-2 py-1 bg-background/50 rounded-md",children:r.brandPersonality.tone})]}),r.brandPersonality.voice&&t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Voice"}),t.jsx("div",{className:"text-sm font-medium text-foreground capitalize px-2 py-1 bg-background/50 rounded-md",children:r.brandPersonality.voice})]})]}),r.brandPersonality.values&&r.brandPersonality.values.length>0&&t.jsx("div",{className:"flex justify-center gap-1 flex-wrap",children:r.brandPersonality.values.slice(0,3).map(((e,n)=>t.jsx("span",{className:"px-2 py-1 text-xs font-medium rounded-full",children:e},n)))})]}):t.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Analyzing brand tone and voice..."})]}),3===i&&t.jsxs("div",{className:"text-center space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Email Template Preview"}),t.jsxs("div",{className:"bg-background/60 rounded-lg p-3 border border-border/30",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[t.jsx("div",{className:"w-4 h-4 rounded"}),t.jsx("div",{className:"text-xs font-medium text-foreground",children:r?.brandName||"Your Brand"})]}),t.jsxs("div",{className:"text-xs text-muted-foreground text-left",children:["Email styling applied with your brand colors",r?.brandPersonality?.tone&&`, ${r.brandPersonality.tone} tone`,", and visual identity"]})]})]}),4===i&&t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground/80",children:"Brand Kit Complete"}),t.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[t.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Identity"}),t.jsx("div",{className:"text-sm font-medium text-foreground",children:r?.brandName?"✓":"—"})]}),t.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Colors"}),t.jsx("div",{className:"text-sm font-medium text-foreground",children:r?.primaryColor?"✓":"—"})]}),t.jsxs("div",{className:"bg-background/40 rounded-lg p-2",children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Personality"}),t.jsx("div",{className:"text-sm font-medium text-foreground",children:r?.brandPersonality?.tone?"✓":"—"})]})]})]}),(0===i&&!r?.primaryColor&&!r?.colorPalette||1===i&&!r?.brandName||2===i&&!r?.brandPersonality)&&t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"text-sm text-muted-foreground italic",children:"Analyzing brand data..."}),t.jsx("div",{className:"flex justify-center gap-1 mt-2",children:[...Array(3)].map(((e,n)=>t.jsx(DX.div,{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground/50",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:1,repeat:1/0,delay:.2*n}},n)))})]})]})})},`content-${i}`)]})})},Qhe=({setAutoParse:e,onBrandSettingsGenerated:r,onForceRefresh:o})=>{const{data:i,updateWebsite:a,isUpdatingWebsite:s,updateBrandSettings:l}=pre(),c=be({mutationFn:Xhe,mutationKey:Yhe.brandSettings()}),[u,d]=n.useState(i?.website||""),[p,f]=n.useState(!1),[h,m]=n.useState(null),[g,v]=n.useState(!1),[y,b]=n.useState(!1),x=()=>{e(!1)};return y&&h?t.jsx(DX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(eme,{initialBrandSettings:h,onSave:()=>{h&&(l({logoBase64:h.logo_base64,primaryColor:h.primaryColor,secondaryColors:h.secondaryColors,brandTagline:h.brandTagline,brandName:h.brandName,brandPersonality:h.brandPersonality,colorPalette:h.colorPalette}),o&&o(),Dl({title:"Brand settings saved successfully 🚀",description:"Your brand identity has been updated."}),e(!1))},onBack:x,showAutoParseButton:!1})},"results"):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden",children:[t.jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.jsxs(QB,{mode:"wait",children:[!g&&!y&&t.jsx(DX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-col h-full",children:t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 space-y-8",children:[t.jsxs("div",{className:"space-y-2 w-full max-w-md",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block text-center",children:"Your Website URL"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 items-center",children:[t.jsx(s5,{type:"url",value:u,onChange:e=>d(e.target.value),placeholder:"https://example.com",className:"flex-1",disabled:!p}),t.jsx(QB,{mode:"wait",children:p?t.jsxs(DX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},className:"flex gap-2",children:[t.jsx(MZ,{variant:"outline",size:"sm",onClick:()=>{f(!1),d(i?.website||"")},className:"w-full sm:w-auto",children:"Cancel"}),t.jsx(MZ,{size:"sm",onClick:async()=>{try{a(u),f(!1),Dl({title:"Website URL updated successfully 🎉",description:"Your website URL has been saved."})}catch(e){Dl({title:"Error updating website URL",description:"Please try again.",variant:"destructive"})}},disabled:s||!u,className:"w-full sm:w-auto",children:s?t.jsx(EZ,{}):"Save Changes"})]},"save"):t.jsx(DX.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},children:t.jsx(MZ,{variant:"outline",size:"sm",onClick:()=>f(!0),className:"w-full sm:w-auto",children:"Edit URL"})},"edit")})]})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 w-full max-w-2xl",children:[t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"What we'll analyze"}),t.jsxs("ul",{className:"text-sm text-gray-600 space-y-1",children:[t.jsx("li",{children:"• Your brand colors and color palette"}),t.jsx("li",{children:"• Your logo (if detectable)"}),t.jsx("li",{children:"• Your brand name and tagline"}),t.jsx("li",{children:"• Your brand's tone and personality"})]})]}),t.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-100",children:[t.jsx("h3",{className:"font-medium text-gray-900 mb-2",children:"How it helps you"}),t.jsx("p",{className:"text-sm text-gray-600",children:"Our AI will automatically extract your brand assets to create consistently styled emails that match your website. This helps maintain brand recognition and professionalism in all your communications."})]})]}),t.jsx(DX.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"text-sm text-muted-foreground text-center max-w-md",children:"We'll use AI to analyze your website and extract your brand elements to create perfectly matched email templates."})]})},"url-confirmation"),g&&h&&t.jsx(DX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 h-full",children:t.jsx(Zhe,{isLoading:g,brandSettings:h,onComplete:()=>{v(!1),b(!0),Dl({title:"Brand settings generated successfully!",description:"Your brand identity has been analyzed."})}})},"analyzing"),g&&!h&&t.jsx(DX.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex-1 flex flex-col items-center justify-center h-full",children:t.jsxs(DX.div,{className:"flex flex-col items-center gap-8",initial:{backgroundPosition:"0% 0%"},animate:{backgroundPosition:"100% 100%"},transition:{duration:5,repeat:1/0,repeatType:"reverse"},children:[t.jsxs(DX.div,{className:"relative w-24 h-24 flex items-center justify-center",initial:{scale:.9},animate:{scale:1},transition:{scale:{duration:2,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},children:[t.jsx(Wu,{className:"w-12 h-12 text-primary drop-shadow-md"}),t.jsx(DX.div,{className:"absolute inset-0 rounded-full border-2",style:{borderColor:"var(--primary)"},initial:{scale:1,opacity:.8},animate:{scale:2.5,opacity:0},transition:{duration:3,repeat:1/0,ease:"easeOut"}})]}),t.jsxs("div",{className:"text-center space-y-2",children:[t.jsx("h3",{className:"text-xl font-semibold text-gray-800",children:"Analyzing your website"}),t.jsx(QB,{mode:"wait",children:t.jsx(DX.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.5},className:"text-gray-600 max-w-md text-center px-4",children:"Generating your brand's unique visual identity and personality"},"loading-message")})]})]})},"pre-analyzing")]})}),!g&&!y&&t.jsxs(DB,{className:"p-4",children:[t.jsx(MZ,{variant:"outline",onClick:x,className:"gap-1",children:"Go Back"}),t.jsxs(MZ,{onClick:async()=>{try{v(!0);const e=await c.mutateAsync();m(e),r&&r(e)}catch(e){v(!1),m(null),Dl({title:"Error generating brand settings",description:"Please try again.",variant:"destructive"})}},disabled:!u||c.isPending,className:"gap-1",children:[t.jsx(Ju,{className:"h-4 w-4 text-amber-500"}),c.isPending?t.jsx(EZ,{}):"Analyze Website"]})]})]})},Jhe=["#a91919","#2563eb","#16a34a","#f59e0b","#6d28d9"],eme=({initialBrandSettings:e,onSave:r,onBack:o,showAutoParseButton:i=!0})=>{const{data:a,isLoading:s,updateBrandSettings:l,isUpdatingBrandSettings:c}=pre(),[u,d]=n.useState({}),[p,f]=n.useState(!1),[h,m]=n.useState({}),[g,v]=n.useState(""),[y,b]=n.useState(""),[x,w]=n.useState("#000000"),[_,S]=n.useState(Date.now()),[E,T]=n.useState(!1),[C,A]=n.useState(null),[N,R]=n.useState({identity:!0,colors:!0,personality:!0}),O=n.useRef(null),{toast:P}=Il();n.useEffect((()=>{if(e)return d({brandName:e.brandName,brandTagline:e.brandTagline,logoUrl:e.logoUrl,primaryColor:e.primaryColor||"#000000",secondaryColors:e.secondaryColors||[],brandPersonality:{tone:e.brandPersonality?.tone,voice:e.brandPersonality?.voice,values:e.brandPersonality?.values||[]}}),void S(Date.now());a?.branding&&(d({brandName:a.branding.brandName||a.name,brandTagline:a.branding.brandTagline||"",logoUrl:a.branding.logoUrl||"",primaryColor:a.branding.primaryColor||"#000000",secondaryColors:a.branding.secondaryColors||[],brandPersonality:{tone:a.branding.brandPersonality?.tone,voice:a.branding.brandPersonality?.voice,values:a.branding.brandPersonality?.values||[]}}),S(Date.now()))}),[a,e]);const k=e=>{R((t=>({...t,[e]:!t[e]})))},j=e=>{m((t=>{const n={...t,[e]:!t[e]};return n[e]&&("brandName"===e?v(u.brandName||""):"brandTagline"===e?v(u.brandTagline||""):"primaryColor"===e?v(u.primaryColor||"#000000"):"tone"===e?v(u.brandPersonality?.tone||""):"voice"===e&&v(u.brandPersonality?.voice||"")),n}))},M=e=>{"brandName"===e?d((e=>({...e,brandName:g}))):"brandTagline"===e?d((e=>({...e,brandTagline:g}))):"primaryColor"===e?d((e=>({...e,primaryColor:g}))):"tone"===e?d((e=>({...e,brandPersonality:{...e.brandPersonality,tone:g||void 0}}))):"voice"===e&&d((e=>({...e,brandPersonality:{...e.brandPersonality,voice:g||void 0}}))),j(e)},L=e=>{j(e)},D=e=>{d((t=>({...t,primaryColor:e})))},I=()=>{y.trim()&&(d((e=>{const t=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:[...t,y.trim()]}}})),b(""))};return s?t.jsx("div",{className:"flex justify-center items-center h-full min-h-[500px] w-full bg-white rounded-lg shadow-sm",children:t.jsx(EZ,{})}):p?t.jsx(Qhe,{setAutoParse:f,onForceRefresh:()=>S(Date.now())}):t.jsxs("div",{className:"w-full h-full flex flex-col bg-white rounded-lg overflow-hidden gap-4 pt-16",children:[t.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4 px-6 pt-2",children:[t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>k("identity"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Identity"})]}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(N.identity?bu:gu,{className:"h-4 w-4"})})]}),N.identity&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Name"}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("brandName"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandName?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>L("brandName"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandName"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm font-medium",children:u.brandName})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("label",{className:"text-sm font-medium text-gray-700",children:"Brand Tagline"}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("brandTagline"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.brandTagline?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{value:g,onChange:e=>v(e.target.value),className:"flex-1",autoFocus:!0,placeholder:"Your brand's tagline"}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>L("brandTagline"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-9 w-9 rounded-full hover:bg-gray-100",onClick:()=>M("brandTagline"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"p-3 bg-gray-50 rounded-lg border border-gray-200 text-sm italic",children:u.brandTagline||"No tagline set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-3",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Logo"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Square image, 128x128px, PNG recommended"})]})}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"w-24 h-24 rounded-lg border-2 border-dashed border-gray-200 flex items-center justify-center bg-gray-50 overflow-hidden",children:u.logoUrl?t.jsx("img",{src:u?.logoUrl,alt:u.brandName||"Brand logo",className:"w-full h-full object-contain"},_):t.jsx(Pu,{className:"h-10 w-10 text-gray-300"})}),t.jsxs("div",{className:"absolute inset-0 bg-black bg-opacity-40 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:[t.jsx("input",{type:"file",ref:O,onChange:e=>{const t=e.target.files?.[0];if(t){const e=new FileReader;e.onloadend=async()=>{const n=e.result.split(",")[1];A(n);const r=URL.createObjectURL(t);d((e=>({...e,logoUrl:r}))),S(Date.now()),l({logoBase64:n})},e.readAsDataURL(t)}},accept:"image/*",className:"hidden"}),t.jsxs(MZ,{variant:"ghost",size:"sm",onClick:()=>{O.current?.click()},className:"text-white hover:text-white hover:bg-black hover:bg-opacity-20",children:[t.jsx(rd,{className:"h-4 w-4 mr-1"}),"Update"]})]})]}),u.logoUrl&&t.jsxs("div",{className:"flex-1 flex items-center gap-2 max-w-md bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx("div",{className:"flex-1 truncate text-sm text-gray-600 font-mono",children:u.logoUrl}),t.jsxs(MZ,{variant:"ghost",size:"sm",onClick:async()=>{if(u.logoUrl)try{await navigator.clipboard.writeText(u.logoUrl),T(!0),setTimeout((()=>T(!1)),1500),P({title:"Logo URL copied to clipboard"})}catch(FTe){try{const e=document.createElement("textarea");e.value=u.logoUrl,e.style.position="fixed",e.style.left="-9999px",document.body.appendChild(e),e.focus(),e.select();const t=document.execCommand("copy");if(document.body.removeChild(e),!t)throw new Error("Fallback copy command failed");T(!0),setTimeout((()=>T(!1)),1500),P({title:"Logo URL copied to clipboard"})}catch(e){P({title:"Failed to copy URL",description:"Could not copy the URL to clipboard. Please try again or copy manually.",variant:"destructive"})}}},className:"h-7 px-2 text-xs shrink-0",children:[E?t.jsx(mu,{className:"h-3.5 w-3.5 mr-1 text-green-500"}):t.jsx(Cu,{className:"h-3.5 w-3.5 mr-1"}),E?"Copied":"Copy"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>k("colors"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Colors"})]}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(N.colors?bu:gu,{className:"h-4 w-4"})})]}),N.colors&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Primary Color"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Your main brand color used throughout the interface"})]}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("primaryColor"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"w-14 h-14 rounded-lg shadow-md",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsxs("div",h.primaryColor?{className:"flex flex-1 gap-2 max-w-sm",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(Bu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),t.jsx(s5,{type:"text",value:g,onChange:e=>v(e.target.value),className:"pl-10 h-10 font-mono text-sm flex-1",placeholder:"#000000",maxLength:7,autoFocus:!0})]}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>L("primaryColor"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("primaryColor"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}:{className:"flex-1 max-w-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 rounded-lg px-3 py-2 border border-gray-200",children:[t.jsx(Bu,{className:"h-4 w-4 text-gray-400"}),t.jsx("div",{className:"text-sm font-mono",children:u.primaryColor||"#000000"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(s5,{type:"color",value:u.primaryColor||"#000000",onChange:e=>D(e.target.value),className:"w-8 h-8 p-1 cursor-pointer rounded-md"}),t.jsx("div",{className:"flex gap-1 flex-wrap",children:Jhe.map(((e,n)=>t.jsx(MZ,{variant:"ghost",size:"icon",className:"w-6 h-6 rounded-full border border-gray-200 "+(u.primaryColor===e?"ring-2 ring-gray-400 ring-offset-1":""),style:{backgroundColor:e},onClick:()=>D(e)},n)))})]})]})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Secondary Colors"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Additional colors that complement your primary brand color"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"flex flex-wrap gap-3 mb-4",children:u.secondaryColors?.length?u.secondaryColors.map(((e,n)=>t.jsxs("div",{className:"group relative flex flex-col items-center",children:[t.jsx("div",{className:"w-12 h-12 rounded-lg shadow-sm border border-gray-200 mb-1 group-hover:ring-2 ring-gray-200",style:{backgroundColor:e}}),t.jsx("div",{className:"text-xs font-mono text-gray-600",children:e}),t.jsx(MZ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.secondaryColors||[];return{...e,secondaryColors:n.filter((e=>e!==t))}}));var t},className:"absolute -top-1 -right-1 w-5 h-5 bg-white rounded-full shadow border border-gray-200 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(cd,{className:"w-3 h-3 text-gray-500"})})]},n))):t.jsx("div",{className:"text-sm text-gray-500 italic my-2",children:"No secondary colors set"})}),t.jsxs("div",{className:"flex items-end gap-3",children:[t.jsxs("div",{className:"flex-1 max-w-xs",children:[t.jsx("label",{className:"text-xs text-gray-500 block mb-1",children:"Add color"}),t.jsxs("div",{className:"flex gap-2 items-center",children:[t.jsx(s5,{type:"color",value:x,onChange:e=>w(e.target.value),className:"w-10 h-10 p-1 cursor-pointer rounded-md"}),t.jsx(s5,{type:"text",value:x,onChange:e=>w(e.target.value),className:"h-10 font-mono text-sm",placeholder:"#000000",maxLength:7})]})]}),t.jsxs(MZ,{variant:"outline",onClick:()=>{x&&(d((e=>{const t=e.secondaryColors||[];return{...e,secondaryColors:[...t,x]}})),w("#000000"))},className:"h-10",children:[t.jsx(Gu,{className:"h-4 w-4 mr-1"}),"Add Color"]})]})]})]})]})]}),t.jsxs("div",{className:"bg-white rounded-xl shadow border border-gray-100 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 cursor-pointer",onClick:()=>k("personality"),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"w-2 h-8 rounded-full",style:{backgroundColor:u.primaryColor||"#000000"}}),t.jsx("h3",{className:"text-base font-medium",children:"Brand Personality"})]}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full",children:t.jsx(N.personality?bu:gu,{className:"h-4 w-4"})})]}),N.personality&&t.jsxs("div",{className:"p-5 border-t border-gray-100 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Tone"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"The overall feeling and attitude your brand conveys"})]}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("tone"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.tone?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>L("tone"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("tone"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.tone||"No tone set"})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Voice"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"How your brand expresses itself in communication"})]}),t.jsx(MZ,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full hover:bg-gray-100",onClick:()=>j("voice"),children:t.jsx(zu,{className:"h-3.5 w-3.5 text-gray-500"})})]}),h.voice?t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{type:"text",value:g,onChange:e=>v(e.target.value),className:"flex-1 h-10 rounded-md border border-gray-200 px-3 py-2",autoFocus:!0}),t.jsxs("div",{className:"flex gap-1",children:[t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>L("voice"),children:t.jsx(cd,{className:"h-4 w-4 text-gray-500"})}),t.jsx(MZ,{variant:"ghost",size:"icon",className:"h-10 w-10 rounded-full hover:bg-gray-100",onClick:()=>M("voice"),children:t.jsx(mu,{className:"h-4 w-4 text-green-500"})})]})]}):t.jsx("div",{className:"flex h-10 items-center px-4 bg-gray-50 rounded-lg border border-gray-200 text-sm",children:u.brandPersonality?.voice||"No voice set"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsxs("div",{children:[t.jsx("label",{className:"text-sm font-medium text-gray-700 block",children:"Brand Values"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Core principles and beliefs that drive your brand"})]})}),t.jsxs("div",{className:"p-4 bg-gray-50 rounded-lg border border-gray-200",children:[t.jsx("div",{className:"mb-4",children:t.jsx("div",u.brandPersonality?.values&&u.brandPersonality.values.length>0?{className:"flex flex-wrap gap-2",children:u.brandPersonality.values.map(((e,n)=>t.jsxs(YZ,{variant:"outline",className:"px-3 py-1.5 border-2 hover:border-red-100 group transition-colors text-primary",style:{borderColor:`${u.primaryColor}30`||"#f3f4f6",backgroundColor:`${u.primaryColor}08`||"#f9fafb"},children:[e,t.jsx(MZ,{variant:"ghost",size:"icon",onClick:()=>{return t=e,void d((e=>{const n=e.brandPersonality?.values||[];return{...e,brandPersonality:{...e.brandPersonality,values:n.filter((e=>e!==t))}}}));var t},className:"ml-1.5 w-4 h-4 flex items-center justify-center rounded-full bg-gray-200 hover:bg-red-100 hover:text-red-500 transition-colors",children:t.jsx(cd,{className:"w-2.5 h-2.5"})})]},n)))}:{className:"text-sm text-gray-500 italic py-2",children:"No brand values set"})}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(s5,{placeholder:"Add a brand value",value:y,onChange:e=>b(e.target.value),className:"flex-1",onKeyDown:e=>"Enter"===e.key&&I()}),t.jsxs(MZ,{variant:"outline",onClick:I,disabled:!y.trim(),children:[t.jsx(Gu,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})]})]})]})]}),t.jsxs(DB,{className:"pb-4 px-6",children:[o?t.jsx(MZ,{variant:"outline",className:"gap-1.5",onClick:o,children:"Go Back"}):i&&t.jsxs(MZ,{variant:"outline",className:"gap-1.5",onClick:()=>{f(!0)},children:[t.jsx(Ju,{className:"h-4 w-4 text-amber-500"}),"Auto Parse"]}),t.jsx(MZ,{className:"px-4",onClick:async()=>{let e;C?e=C:u.logoUrl?.startsWith("data:image/png;base64,")?e=u.logoUrl.split(",")[1]:u.logoUrl?.startsWith("blob:")&&(e=void 0),l({brandName:u.brandName,brandTagline:u.brandTagline,logoBase64:e,primaryColor:u.primaryColor,secondaryColors:u.secondaryColors,brandPersonality:u.brandPersonality}),P({title:"Brand settings saved 🚀"}),r&&r(),A(null)},disabled:c,children:c?"Saving":"Save Changes"})]})]})},tme=_le.object({channelSenderId:_le.string().min(1,"Please select a channel sender"),replyTo:_le.string().trim().min(1).email("Please enter a valid email address").or(_le.literal("").transform((()=>null))).or(_le.null()).optional(),fromName:_le.string().trim().min(1).or(_le.literal("").transform((()=>null))).or(_le.null()).optional()}),nme=()=>{const{channelSenders:e,isLoading:r}=V7(),{channelAccounts:o,isLoading:i}=U7(),{updateChannelSender:a,isUpdating:s}=B7(),{toast:l}=Il(),c=Qce({resolver:oue(tme),defaultValues:{channelSenderId:"",replyTo:"",fromName:""}}),u=n.useMemo((()=>z7({channelSenders:e?.results??[],channelAccounts:o?.results??[]})),[e?.results,o?.results]);if(n.useEffect((()=>{if(u&&u.length>0&&!c.getValues("channelSenderId")){const e=u[0];c.setValue("channelSenderId",e.channelSenderId),c.setValue("replyTo",e.channelSender.channelSenderMetadata.emailReplyTo??""),c.setValue("fromName",e.channelSender.channelSenderMetadata.emailFromName??"")}}),[u,c]),r||void 0===e||i||void 0===o)return t.jsx("div",{className:"flex justify-center items-center h-full py-10",children:t.jsx(EZ,{})});return t.jsxs("div",{className:"w-full max-w-4xl mx-auto mt-8",children:[t.jsxs("div",{className:"mb-6",children:[t.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-gray-900 mb-1",children:"Set up Your Email Channel"}),t.jsx("p",{className:"text-muted-foreground text-base",children:"Define your default sender name, email address, and reply-to to start sending emails with confidence."})]}),t.jsx(iue,{...c,children:t.jsxs("form",{onSubmit:c.handleSubmit((async e=>{const t=u.find((t=>t.channelSenderId===e.channelSenderId));t&&a({toUpdate:{channelSenderMetadata:{...t.channelSender.channelSenderMetadata,emailReplyTo:e.replyTo?e.replyTo:null,emailFromName:e.fromName?e.fromName:null}},id:t.channelSender.id},{onSuccess:()=>{l({title:"Email channel sender updated successfully!"})},onError:()=>{l({title:"Failed to update email channel sender",description:"Please contact your administrator",variant:"destructive"})}})})),className:"bg-white border border-gray-200 rounded-2xl shadow-sm p-8 space-y-6",children:[t.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[t.jsx(due,{className:"flex items-center gap-1 text-base font-medium mb-2",children:"Email Channel Sender"}),t.jsxs(Pne,{value:c.watch("channelSenderId"),onValueChange:e=>{c.setValue("channelSenderId",e);const t=u.find((t=>t.channelSenderId===e));t&&c.setValue("replyTo",t.channelSender.channelSenderMetadata.emailReplyTo??"")},children:[t.jsx(Mne,{className:"w-full bg-gray-50 border-gray-200 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 rounded-lg min-h-[48px] text-base",children:t.jsx(jne,{placeholder:"Select a sender"})}),t.jsx(Ine,{children:u.map((e=>t.jsx(Fne,{value:e.channelSenderId,children:t.jsxs("div",{className:"flex flex-col text-left",children:[t.jsx("span",{className:"font-medium",children:e.fullDomain}),t.jsx("span",{className:"text-xs text-muted-foreground",children:e.channelSender.channelSenderMetadata.emailReplyTo||"No reply-to set"})]})},e.channelSenderId)))})]})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[t.jsxs(due,{className:"flex items-center gap-1 text-base font-medium mb-0.5",children:["Reply-to Email",t.jsx(G7,{title:"Reply to email to use when the reply button is clicked"})]}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal mb-1",children:["Optional – will use"," ",t.jsx("span",{className:"font-mono",children:c.watch("channelSenderId")?u.find((e=>e.channelSenderId===c.watch("channelSenderId")))?.fullDomain:"sender domain"})," ","if empty"]}),t.jsx(gue,{control:c.control,name:"replyTo",type:"email",placeholder:"Replies from recipients will go to this email (optional)"})]}),t.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[t.jsxs(due,{className:"flex items-center gap-1 text-base font-medium mb-0.5",children:["From Name",t.jsx(G7,{title:"From name to use when the email is sent"})]}),t.jsx(gue,{control:c.control,name:"fromName",placeholder:"From name to use when the email is sent"})]}),t.jsx("div",{className:"flex gap-3 pt-4 justify-end border-t border-gray-100",children:t.jsx(MZ,{type:"submit",disabled:s,className:"min-w-[120px]",children:s?"Saving...":"Save"})})]})})]})};function rme({tabs:e,activeTab:n,onTabChange:r,title:o}){return t.jsxs("div",{className:"flex h-full",children:[t.jsxs("div",{className:"w-48 py-2 pl-4",children:[o&&t.jsx("h2",{className:"px-4 pt-4 pb-5 text-lg font-medium",children:o}),e.map((e=>t.jsx(MZ,{variant:"ghost",className:rp("w-full justify-start mb-1",n===e.id&&"bg-accent"),onClick:()=>r(e.id),children:e.label},e.id)))]}),t.jsx("div",{className:"flex-1",children:e.find((e=>e.id===n))?.content})]})}function ome({open:e,setOpen:r}){const[o,i]=n.useState("brand");n.useEffect((()=>{e&&i("brand")}),[e]);const a=[{id:"brand",label:"Brand",content:t.jsx(eme,{})},{id:"email-channel",label:"Email Channel",content:t.jsx(nme,{})}];return t.jsx(PB,{open:e,onOpenChange:r,children:t.jsxs(MB,{className:"flex w-[90vw] h-[90vh] flex-col gap-0 overflow-hidden sm:max-w-xl md:max-w-3xl lg:max-w-4xl xl:max-w-5xl p-0",children:[t.jsxs(s$,{children:[t.jsx(IB,{children:"Settings"}),t.jsx(FB,{children:"Edit your business and brand settings"})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(rme,{tabs:a,activeTab:o,onTabChange:i,title:"Settings"})})]})})}const ime=e=>{const{updateAutomation:t,updateError:r,isUpdateSuccess:o}=De(e),{toast:i}=Il();return n.useEffect((()=>{o?i({title:"Status updated",description:"The status has been updated successfully"}):r&&i({title:"Error updating status",description:"Please try again",variant:"destructive"})}),[o,r,i]),{toggleStatus:async e=>{try{return await t({status:e?ze.ACTIVE:ze.DRAFT}),!0}catch(n){return i({title:"Error updating status",description:"Please try again",variant:"destructive"}),!1}}}};function ame(){const{toast:e}=Il(),[r,o]=n.useState(null),{toggleStatus:i}=ime(r||""),a=s4(),[s,l]=n.useState(10),[c,u]=n.useState(void 0),[d,p]=n.useState(""),{automations:f,nextCursor:h,isLoading:m,error:g,isFetching:v,isPlaceholderData:y}=Fe({cursor:c,limit:s,triggerType:Ue.TRIGGER_BASED,search:d||void 0});n.useEffect((()=>{g&&e({title:`Error Fetching ${bf("engage:automation")}`,description:g?.message||"Please try again.",variant:"destructive"})}),[g,e]);const b=n.useMemo((()=>(f||[]).map((e=>({...e,emailsSent:0,smsSent:0,updated_at:e.updatedAt||e.createdAt})))),[f]),x=n.useCallback((async(e,t)=>{try{o(e);const n=t===ze.ACTIVE;await i(n)}finally{o(null)}}),[i,o]),w=n.useCallback((e=>{u(e.cursor),l(e.pageSize)}),[]),_=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),S=n.useMemo((()=>I7({automationName:bf("engage:automation"),setUrl:_,onToggle:x,vsaasManaged:!0})),[x,_]);return t.jsx("div",{className:"w-full h-[75vh] flex flex-col",children:t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(c5,{data:b,columns:S,paginationMode:"cursor",initialPageSize:s,isLoading:m&&!y,onRowClick:e=>{a(`/automations/view-modal/${e.id}?showBackButton=true`)},cursorPaginationQueryResult:{nextCursor:h,isLoading:m,isFetching:v,isPlaceholderData:y},onQueryParametersChange:w,searchValue:d,onSearchChange:p})})})}function sme(){const{toast:e}=Il(),[r,o]=n.useState(!1),[i,a]=n.useState(null),{toggleStatus:s}=ime(i||""),l=s4(),[c,u]=n.useState(10),[d,p]=n.useState(void 0),[f,h]=n.useState(""),{automations:m,nextCursor:g,isLoading:v,error:y,isFetching:b,isPlaceholderData:x}=Fe({cursor:d,limit:c,triggerType:Ue.ONE_TIME,search:f||void 0});n.useEffect((()=>{y&&e({title:`Error Fetching ${bf("engage:broadcast")}`,description:y?.message||"Please try again.",variant:"destructive"})}),[y,e]);const w=n.useMemo((()=>(m||[]).map((e=>({...e,updated_at:e.updatedAt})))),[m]),_=n.useCallback((async(e,t)=>{try{a(e);const n=t===ze.ACTIVE;await s(n)}finally{a(null)}}),[s,a]),S=n.useCallback((e=>{p(e.cursor),u(e.pageSize)}),[]),E=n.useCallback((e=>`/automations/view-modal/${e}?showBackButton=true`),[]),T=n.useMemo((()=>I7({automationName:bf("engage:broadcast"),setUrl:E,onToggle:_})),[_,E]);return t.jsxs("div",{className:"w-full h-[75vh] flex flex-col",children:[t.jsx("div",{className:"flex-grow min-h-0 p-2",children:t.jsx(c5,{data:w,columns:T,paginationMode:"cursor",initialPageSize:c,headerActions:t.jsxs(MZ,{className:"bg-primary",onClick:()=>o(!0),children:[t.jsx(Gu,{className:"h-4 w-4 mr-1"}),"New"]}),isLoading:v&&!x,cursorPaginationQueryResult:{nextCursor:g,isLoading:v,isFetching:b,isPlaceholderData:x},onRowClick:e=>{l(`/automations/view-modal/${e.id}?showBackButton=true`)},onQueryParametersChange:S,searchValue:f,onSearchChange:h})}),t.jsx(Lhe,{open:r,setOpen:o,onClose:t=>{N7(o,e,t,`Error creating ${bf("engage:broadcast")}`,"Please try again"),p(void 0),u(10),h(""),!1!==t&&l(`/automations/view-modal/${t}?showBackButton=true`)},automationType:Ue.ONE_TIME})]})}function lme(){const{toast:e}=Il(),[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}=dZ({search:d||void 0,cursor:c,limit:s}),y=n.useCallback((e=>{a(e),o(!0)}),[a]),b=n.useMemo((()=>function(e){return[P7("name",`${bf("engage:segment")} Name`,!0),k7(),A7({accessorKey:"user_count",header:bf("engage:user_other"),meta:{align:"right",displayName:bf("engage:user_other")},cellClassName:"text-muted-foreground pr-4",cellFormatter:e=>{const t=e.getValue()??0;return`${t.toLocaleString()} ${1===t?bf("engage:user").toLowerCase():bf("engage:user_other").toLowerCase()}`}}),j7("user_count_updated_at"),D7(e||(()=>{}))]}(y)),[y]),x=n.useMemo((()=>f?f.map((e=>({...e,updated_at:e.createdAt.toString(),user_count:e.userCount,user_count_updated_at:e.userCountUpdatedAt}))):[]),[f]),w=n.useMemo((()=>t.jsxs(MZ,{onClick:()=>{a(null),o(!0)},children:[t.jsx(Gu,{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(c5,{data:x,columns:b,paginationMode:"cursor",initialPageSize:s,headerActions:w,isLoading:h&&!v,cursorPaginationQueryResult:{nextCursor:m,isLoading:h,isFetching:g,isPlaceholderData:v},onQueryParametersChange:_,onRowClick:t=>{t.type!==gZ.MANAGED?(a(t.id),o(!0)):e({title:`Managed ${bf("engage:segment")} cannot be edited!`,variant:"destructive"})},searchValue:d,onSearchChange:p})}),t.jsx(ghe,{open:r,setOpen:o,segmentId:i??void 0,onSegmentUpdated:t=>{N7(o,e,t,`Error creating ${bf("engage:segment")}`,"Please try again"),u(void 0),l(10),p("")}})]})}const cme=()=>{const e=[{id:"automations",label:bf("engage:automation",{count:2}),content:t.jsx(ame,{})},{id:"broadcasts",label:bf("engage:broadcast",{count:2}),content:t.jsx(sme,{})},{id:"segments",label:bf("engage:segment",{count:2}),content:t.jsx(lme,{})},{id:"statistics",label:bf("engage:insight",{count:2}),content:t.jsx(Whe,{})}],r=ue(),[o,i]=n.useState(!1),[a,s]=n.useState(e[0].id);return n.useEffect((()=>{r.prefetchQuery({queryKey:Pe.list()}),r.prefetchQuery({queryKey:cZ.lists()})}),[r]),t.jsxs("div",{className:"w-full h-full flex flex-col gap-4",children:[t.jsx(ome,{open:o,setOpen:i}),t.jsx("div",{className:"flex justify-end",children:t.jsx(MZ,{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(Dhe,{activeTab:a,tabs:e,onTabChange:s})})]})};function ume({value:e,schema:r,onSubmit:o,fieldName:i,className:a,successMessage:s="Updated successfully",errorMessage:l="Failed to update",placeholderText:c}){const[u,d]=n.useState(!1),[p,f]=n.useState(!1),[h,m]=n.useState(0),[g,v]=n.useState(0),[y,b]=n.useState(e),[x,w]=n.useState(e),_=n.useRef(null),S=n.useRef(null),E=n.useRef(null),T=n.useRef(null),{toast:C}=Il(),A=Qce({resolver:oue(r),defaultValues:{[i]:e}});n.useEffect((()=>{A.reset({[i]:e}),b(e),w(e)}),[e,i,A]),n.useEffect((()=>{S.current&&m(S.current.offsetWidth),T.current&&!u&&v(T.current.offsetWidth)}),[u]),n.useEffect((()=>{E.current&&y&&m(E.current.offsetWidth)}),[y]),n.useEffect((()=>{u&&_.current&&(_.current.focus(),_.current.select())}),[u]);const N=async e=>{f(!0);const t=e[i];try{await o(e),w(t),C({variant:"success",title:s}),d(!1)}catch(n){C({variant:"destructive",title:l})}finally{f(!1)}},R=()=>{A.reset(),d(!1),b(x)},O=e=>{"Escape"===e.key&&R()};return u?t.jsx(iue,{...A,children:t.jsxs("form",{onSubmit:A.handleSubmit(N),className:OB("inline-flex items-center gap-2 min-h-[20px]",a),style:{minWidth:g?`${g}px`:"auto"},children:[t.jsx("span",{ref:E,className:"absolute invisible whitespace-pre leading-none select-none pointer-events-none",style:{font:"inherit"},children:y||x}),t.jsx(sue,{control:A.control,name:i,render:({field:e})=>t.jsx(uue,{className:"flex-1 min-w-0",children:t.jsx(pue,{children:t.jsx("input",{...e,ref:_,style:{width:`${Math.max(h+40,120)}px`,minWidth:`${Math.max(h,100)}px`,font:"inherit"},className:"bg-transparent outline-none leading-none h-[20px] border-none p-0 m-0",onChange:t=>{e.onChange(t),b(t.target.value)},onKeyDown:O,disabled:p,onBlur:t=>{e.onBlur(),setTimeout((()=>{t.currentTarget.form?.contains(document.activeElement)||R()}),0)}})})})}),t.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[t.jsx(MZ,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 p-0",onClick:R,disabled:p,children:t.jsx(cd,{className:"h-3 w-3"})}),t.jsx(MZ,{type:"button",size:"icon",variant:"ghost",className:"h-5 w-5 p-0",disabled:p,onClick:()=>{A.handleSubmit(N)()},children:p?t.jsx(Mu,{className:"h-3 w-3 animate-spin"}):t.jsx(mu,{className:"h-3 w-3"})})]})]})}):t.jsxs("button",{ref:T,type:"button",className:OB("group relative inline-flex items-center gap-2 cursor-pointer min-h-[20px] bg-transparent border-none p-0 text-left",a),onClick:()=>d(!0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),d(!0))},"aria-label":"Edit field",children:[t.jsx("span",{ref:S,className:OB("leading-none select-none",a,{italic:!x}),children:x||c}),t.jsx(Hu,{className:"h-3 w-3 transition-opacity duration-200 flex-shrink-0 opacity-0 group-hover:opacity-100"})]})}const dme=ele({name:$se().min(2,"Title must be at least 2 characters"),description:$se()});function pme({open:e,onOpenChange:n,onDuplicationCreated:r}){const o=bZ(),{toast:i}=Il(),a=Qce({resolver:oue(dme),defaultValues:{name:`${o?.name} (copy)`,description:o?.description??""}});return t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{className:"sm:max-w-[425px]",children:[t.jsx(LB,{children:t.jsx(IB,{children:"Duplicate Automation"})}),t.jsx(iue,{...a,children:t.jsxs("form",{onSubmit:a.handleSubmit((async function(e){if(!o||!e.name)return void i({title:"Error duplicating automation",description:"Please try again. Please make sure to fill in the name of the automation."});const{id:t}=await(async(e,t,n)=>(await Oe(`${c}`,{method:"POST",body:JSON.stringify({duplicate:!0,source_id:e,name:t,description:n})})).data)(o.id,e.name,e.description);t?(r?.(t),i({title:"Automation duplicated!",description:"The automation has been duplicated"}),n(!1)):i({title:"Error duplicating automation",description:"Please try again"})})),className:"space-y-4",children:[t.jsxs("div",{children:["Create a copy of the",t.jsx("span",{className:"font-bold px-1 text-primary",children:o?.name}),"automation with a new title and description."]}),t.jsx(sue,{control:a.control,name:"name",render:({field:e})=>t.jsxs(uue,{children:[t.jsx(due,{children:"Title"}),t.jsx(pue,{children:t.jsx(s5,{...e})}),t.jsx(fue,{})]})}),t.jsx(sue,{control:a.control,name:"description",render:({field:e})=>t.jsxs(uue,{children:[t.jsx(due,{children:"Description"}),t.jsx(pue,{children:t.jsx(hoe,{...e})}),t.jsx(fue,{})]})}),t.jsx(DB,{children:t.jsx(MZ,{type:"submit",children:"Duplicate"})})]})})]})})}function fme({open:e,onOpenChange:n,setIsActive:r}){const o=bZ(),{updateAutomation:i}=De(o?.id||""),{toast:a}=Il();return t.jsx(PB,{open:e,onOpenChange:n,children:t.jsxs(MB,{className:"sm:max-w-[425px]",children:[t.jsx(LB,{children:t.jsxs(IB,{children:["Deactivate ",bf("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}),bf("engage:automation"),"?"]}),t.jsxs(DB,{className:"gap-2 sm:gap-0",children:[t.jsx(MZ,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),t.jsx(MZ,{variant:"destructive",onClick:()=>{i({status:ze.DRAFT}),n(!1),r(!1),a({title:`Updated ${bf("engage:automation")}`,description:`${bf("engage:automation")} status updated to draft`})},children:"Deactivate"})]})]})})}const hme=ele({name:$se().min(2,"Title must be at least 2 characters")}),mme=ele({description:$se().max(300,"Description must be less than 300 characters")}),gme=({showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o})=>{const i=bZ(),a=s4(),{updateAutomation:s}=De(i?.id||""),{toast:l}=Il(),c=(()=>{const{state:e}=yZ();return e.recipientStats})(),u=xZ(),[d,p]=n.useState(void 0),[f,h]=n.useState(!1),[m,g]=n.useState(!1),[v,y]=n.useState(!1),[b,x]=n.useState(0);n.useEffect((()=>{if(i&&void 0===d)switch(i.status){case ze.ACTIVE:p(!0);break;case ze.DRAFT:p(!1);break;case ze.RUNNING:case ze.COMPLETED:p(!0);break;case ze.FAILED:case ze.DEACTIVATED:p(!1);break;default:throw Eoe(i.status,ze)}}),[i,d]);const w=n.useCallback((()=>{if(!i)return void l({title:"Automation not found",description:"Please contact your administrator",variant:"destructive"});const e=async e=>{if(d&&!e)g(!0);else{if(y(!0),o&&!0===e){let e=0;for(;!c&&e<20;)await new Promise((e=>setTimeout(e,100))),e++;if(!c)return l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),void y(!1);const t=await o({estimatedEmailRecipients:c?.emails??0,estimatedSmsRecipients:c?.phones??0});if(!0!==t)return l({title:"Error while updating the status",description:t,variant:"destructive"}),void y(!1)}if(u?.emailHtmlBody?.includes(Che)){if(0===b)return l({title:Ahe,variant:"warning"}),x(b+1),void y(!1);x(b+1)}switch(i.triggerType){case Ue.ONE_TIME:if(!i.triggerMetadata||!("scheduledAt"in i.triggerMetadata)||!i.triggerMetadata?.scheduledAt)return l({title:"Ensure you have selected a scheduled time",variant:"destructive"}),void y(!1);if(!u||!u.emailChannelSenderId&&!u.smsChannelSenderId)return l({title:"Ensure you have selected at least one kind of communication",variant:"destructive"}),void y(!1);break;case Ue.TRIGGER_BASED:break;default:throw Eoe(i.triggerType,Ue)}s({status:e?ze.ACTIVE:ze.DEACTIVATED},{onSuccess:()=>{p(e),l({title:`${bf("engage:automation")}`,description:`${bf("engage:automation")} status updated to ${e?"active":"inactive"}`}),y(!1)},onError:()=>{l({title:"Error while updating the status",description:"Please contact your administrator",variant:"destructive"}),y(!1)}})}};if(!i)return null;let n=!1,r=!0;switch(i.status){case ze.ACTIVE:case ze.DRAFT:n=!1;break;case ze.DEACTIVATED:n=!0,r=!1;break;case ze.RUNNING:n=!0,r=i.triggerType===Ue.TRIGGER_BASED;break;case ze.COMPLETED:case ze.FAILED:n=!0,r=!1;break;default:throw Eoe(i.status,ze)}if(!r)return t.jsx(YZ,{variant:R7(i.status),children:x9[i.status]});switch(i.triggerType){case Ue.TRIGGER_BASED:return t.jsxs("div",{className:"flex items-center gap-2 w-[12ch] cursor-pointer",children:[t.jsx(d?mu:Eu,{className:"w-4 h-4"}),t.jsx("div",{className:"text-[13px] font-medium",children:d?"Active":"Inactive"}),t.jsx(she,{checked:d,onCheckedChange:e,disabled:n})]});case Ue.ONE_TIME:if(!i.triggerMetadata||i.triggerMetadata?.triggerType===Ue.ONE_TIME&&!i.triggerMetadata?.scheduledAt)return t.jsx(MZ,{variant:"outline",className:"flex items-center gap-2",disabled:!0,children:"Set Scheduled Time"});if(!d){let r="Schedule Send";return i.triggerMetadata.triggerType===Ue.ONE_TIME&&i.triggerMetadata.scheduledAt&&new Date(i.triggerMetadata.scheduledAt)<new Date(Date.now()+3e5)&&(r="Send Now"),t.jsx(MZ,{variant:"default",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:r})}return t.jsx(MZ,{variant:"outline",className:"flex items-center gap-2",onClick:()=>e(!d),disabled:n,children:"Convert to Draft"});default:throw Eoe(i.triggerType,Ue)}}),[i,d,l,o,s,c,u,b]);return i&&void 0!==d?t.jsxs("header",{className:"flex px-1 pt-1",children:[t.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[e&&t.jsx(MZ,{variant:"ghost",size:"icon",onClick:()=>a(-1),children:t.jsx(du,{})}),t.jsxs("div",{className:"flex flex-col gap-0 items-start",children:[t.jsx(ume,{value:i.name,schema:hme,onSubmit:e=>s({name:e.name}),fieldName:"name",className:"text-lg",successMessage:"Automation name updated",errorMessage:"Failed to update automation name"}),i.automationType!==Ve.MANAGED?t.jsx(ume,{value:i.description||"",schema:mme,onSubmit:e=>s({description:e.description}),fieldName:"description",className:"text-sm "+(i.description?"text-current":"text-muted-foreground"),successMessage:"Description updated",errorMessage:"Failed to update description",placeholderText:"Describe the goal of the automation"}):i.description&&t.jsx("div",{className:"text-sm text-current",children:i.description})]})]}),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===Ue.ONE_TIME&&t.jsx("div",{role:"button",tabIndex:0,className:"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 hover:bg-accent hover:text-accent-foreground h-10 w-10 cursor-pointer",onClick:()=>h(!0),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||h(!0)},children:t.jsx(G7,{title:"Duplicate",Icon:FZ.DuplicateIcon,asChild:!1,onClick:()=>h(!0)})})}),v?t.jsx("div",{className:"flex items-center text-muted-foreground pr-2",children:t.jsx(EZ,{size:"sm"})}):w()]}),t.jsx(pme,{open:f,onOpenChange:h,onDuplicationCreated:r}),t.jsx(fme,{open:m,onOpenChange:g,setIsActive:p})]}):null},vme=()=>{const e=bZ(),{isLoading:r}=Ie(e?.id),{state:{hideSales:o,hideSms:i}}=n.useContext(l$);return!e||r?t.jsx(EZ,{text:[`Fetching ${bf("engage:insight",{count:2})}`,"Finishing up"]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(Whe,{automationId:e.id,automation:e,includeSales:!o,includeSms:!i})})},yme=()=>{const e=bZ(),[r,o]=n.useState(10),[i,a]=n.useState(void 0),[s,l]=n.useState(""),{sentCommunications:c,isLoading:u,isFetching:d,isPlaceholderData:p,fetchError:f}=Me({automationId:e?.id??"",cursor:i,limit:r,search:s||void 0}),h=n.useCallback((e=>{a(e.cursor),o(e.pageSize)}),[]),m=[{accessorKey:"communicationsSent",id:"lastCommunication",header:"Updated At",cell:({row:e})=>{const n=e.original.communicationsSent||[];if(0===n.length)return t.jsx("span",{className:"text-gray-400",children:"None"});const r=n.reduce(((e,t)=>e&&e.updatedAt?t.updatedAt&&new Date(t.updatedAt)>new Date(e.updatedAt)?t:e:t));return r?.updatedAt?t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("span",{className:"text-sm text-gray-600",children:E7(new Date(r.updatedAt),"MMM d, yyyy h:mm a")})}):t.jsx("span",{className:"text-gray-400",children:"Not available"})}},{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?Bie(e.original.phone):t.jsx("span",{className:"text-gray-400",children:"Not provided"})},{accessorKey:"communicationsSent",id:"communicationsSent",header:"Communications Sent",cell:({row:e})=>{const n=e.original.communicationsSent||[],r=n.filter((e=>e.type===He.EMAIL)),o=n.filter((e=>e.type===He.SMS)),i=r.length>0,a=o.length>0,s=r.some((e=>e.delivered)),l=o.some((e=>e.delivered));return t.jsxs("div",{className:"flex items-center gap-3",children:[i&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs("div",{className:"relative",children:[t.jsx(FZ.EmailIcon,{className:"h-4 w-4 "+(s?"text-green-500":"text-gray-400")}),s&&t.jsx("div",{className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white"})]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"text-sm font-medium",children:"Email"}),t.jsx("span",{className:"text-xs "+(s?"text-green-600":"text-gray-500"),children:s?"Delivered":"Pending"})]})]}),i&&a&&t.jsx("div",{className:"h-8 w-px bg-gray-200"}),a&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs("div",{className:"relative",children:[t.jsx(FZ.SmsIcon,{className:"h-4 w-4 "+(l?"text-green-500":"text-gray-400")}),l&&t.jsx("div",{className:"absolute -right-1 -top-1 h-2 w-2 rounded-full bg-green-500 ring-1 ring-white"})]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"text-sm font-medium",children:"SMS"}),t.jsx("span",{className:"text-xs "+(l?"text-green-600":"text-gray-500"),children:l?"Delivered":"Pending"})]})]}),!i&&!a&&t.jsx("span",{className:"text-sm text-gray-400",children:"None"})]})}}];return e&&!u&&c?f?t.jsxs("div",{children:["Error: ",f.message]}):!c||!s&&0===c.results.length?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(FZ.UserIcon,{className:"h-12 w-12 text-gray-400"})}),t.jsx("h3",{className:"mb-2 text-lg font-semibold text-gray-700",children:"No Communications Sent Yet"}),t.jsxs("p",{className:"text-gray-500",children:["This"," ",bf(e.triggerType===Ue.ONE_TIME?"engage:broadcast":"engage:automation")," ","hasn't sent any communications yet. Please check back later to see recipient details once communications have been sent."]})]}):t.jsx("div",{className:"h-full p-4",children:t.jsx(c5,{data:c.results,columns:m,paginationMode:"cursor",initialPageSize:r,isLoading:u&&!p,cursorPaginationQueryResult:{nextCursor:c.pagination.cursor,isLoading:u,isFetching:d,isPlaceholderData:p},onQueryParametersChange:h,searchValue:s,onSearchChange:l})}):t.jsx(EZ,{text:["Fetching Recipients","Finishing up"]})},bme=()=>{const e=bZ();return e?e?.triggerType===Ue.ONE_TIME&&e?.status===ze.DRAFT?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(FZ.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 Available Yet"}),t.jsxs("p",{className:"text-gray-500",children:["Recipients will be available once this"," ",bf(e.triggerType===Ue.ONE_TIME?"engage:broadcast":"engage:automation")," ","has completed running. Please check back after the automation has finished."]})]}):t.jsx(yme,{}):t.jsx(EZ,{text:["Fetching Recipients","Finishing up"]})},xme=n.createContext(null);xme.displayName="PanelGroupContext";const wme="data-panel-group",_me="data-panel-group-direction",Sme="data-panel-group-id",Eme="data-panel",Tme="data-panel-collapsible",Cme="data-panel-id",Ame="data-panel-size",Nme="data-resize-handle",Rme="data-resize-handle-active",Ome="data-panel-resize-handle-enabled",Pme="data-panel-resize-handle-id",kme="data-resize-handle-state",jme=n.useLayoutEffect,Mme=i["useId".toString()],Lme="function"==typeof Mme?Mme:()=>null;let Dme=0;function Ime(e=null){const t=Lme(),r=n.useRef(e||t||null);return null===r.current&&(r.current=""+Dme++),null!=e?e:r.current}function Fme({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(xme);if(null===v)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:b,getPanelSize:x,getPanelStyle:w,groupId:_,isPanelCollapsed:S,reevaluatePanelConstraints:E,registerPanel:T,resizePanel:C,unregisterPanel:A}=v,N=Ime(s),R=n.useRef({callbacks:{onCollapse:u,onExpand:d,onResize:p},constraints:{collapsedSize:r,collapsible:o,defaultSize:i,maxSize:l,minSize:c},id:N,idIsFromProps:void 0!==s,order:f});n.useRef({didLogMissingDefaultSizeWarning:!1}),jme((()=>{const{callbacks:e,constraints:t}=R.current,n={...t};R.current.id=N,R.current.idIsFromProps=void 0!==s,R.current.order=f,e.onCollapse=u,e.onExpand=d,e.onResize=p,t.collapsedSize=r,t.collapsible=o,t.defaultSize=i,t.maxSize=l,t.minSize=c,n.collapsedSize===t.collapsedSize&&n.collapsible===t.collapsible&&n.maxSize===t.maxSize&&n.minSize===t.minSize||E(R.current,n)})),jme((()=>{const e=R.current;return T(e),()=>{A(e)}}),[f,N,T,A]),n.useImperativeHandle(a,(()=>({collapse:()=>{y(R.current)},expand:e=>{b(R.current,e)},getId:()=>N,getSize:()=>x(R.current),isCollapsed:()=>S(R.current),isExpanded:()=>!S(R.current),resize:e=>{C(R.current,e)}})),[y,b,x,S,N,C]);const O=w(R.current,i);return n.createElement(m,{...g,children:e,className:t,id:N,style:{...O,...h},[Sme]:_,[Eme]:"",[Tme]:o||void 0,[Cme]:N,[Ame]:parseFloat(""+O.flexGrow).toFixed(1)})}const Ume=n.forwardRef(((e,t)=>n.createElement(Fme,{...e,forwardedRef:t})));Fme.displayName="Panel",Ume.displayName="forwardRef(Panel)";let $me=null,Vme=-1,Bme=null;function zme(e,t){var n,r;const o=function(e,t){if(t){const e=!!(t&nge),n=!!(t&rge);if(t&ege)return e?"se-resize":n?"ne-resize":"e-resize";if(t&tge)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($me!==o){var i;if($me=o,null===Bme&&(Bme=document.createElement("style"),document.head.appendChild(Bme)),Vme>=0)null===(i=Bme.sheet)||void 0===i||i.removeRule(Vme);Vme=null!==(n=null===(r=Bme.sheet)||void 0===r?void 0:r.insertRule(`*{cursor: ${o} !important;}`))&&void 0!==n?n:-1}}function Hme(e){return"keydown"===e.type}function qme(e){return e.type.startsWith("pointer")}function Gme(e){return e.type.startsWith("mouse")}function Kme(e){if(qme(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Gme(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}const Wme=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Yme(e){const t=getComputedStyle(e);return"fixed"===t.position||(!("auto"===t.zIndex||"static"===t.position&&!function(e){var t;const n=getComputedStyle(null!==(t=Jme(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||(!!Wme.test(t.willChange)||"touch"===t.webkitOverflowScrolling)))))))))}function Xme(e){let t=e.length;for(;t--;){const n=e[t];if(xge(n,"Missing node"),Yme(n))return n}return null}function Zme(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Qme(e){const t=[];for(;e;)t.push(e),e=Jme(e);return t}function Jme(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const ege=1,tge=2,nge=4,rge=8,oge="coarse"===function(){if("function"==typeof matchMedia)return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}();let ige=[],age=!1,sge=new Map,lge=new Map;const cge=new Set;function uge(e){const{target:t}=e,{x:n,y:r}=Kme(e);age=!0,hge({target:t,x:n,y:r}),yge(),ige.length>0&&(bge("down",e),e.preventDefault(),fge(t)||e.stopImmediatePropagation())}function dge(e){const{x:t,y:n}=Kme(e);if(age&&0===e.buttons&&(age=!1,bge("up",e)),!age){const{target:r}=e;hge({target:r,x:t,y:n})}bge("move",e),gge(),ige.length>0&&e.preventDefault()}function pge(e){const{target:t}=e,{x:n,y:r}=Kme(e);lge.clear(),age=!1,ige.length>0&&(e.preventDefault(),fge(t)||e.stopImmediatePropagation()),bge("up",e),hge({target:t,x:n,y:r}),gge(),yge()}function fge(e){let t=e;for(;t;){if(t.hasAttribute(Nme))return!0;t=t.parentElement}return!1}function hge({target:e,x:t,y:n}){ige.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),cge.forEach((e=>{const{element:o,hitAreaMargins:i}=e,a=o.getBoundingClientRect(),{bottom:s,left:l,right:c,top:u}=a,d=oge?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:Qme(e),b:Qme(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;xge(r,"Stacking order can only be calculated for elements with a common ancestor");const o=Zme(Xme(n.a)),i=Zme(Xme(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}ige.push(e)}var p,f}))}function mge(e,t){lge.set(e,t)}function gge(){let e=!1,t=!1;ige.forEach((n=>{const{direction:r}=n;"horizontal"===r?e=!0:t=!0}));let n=0;lge.forEach((e=>{n|=e})),e&&t?zme("intersection",n):e?zme("horizontal",n):t?zme("vertical",n):null!==Bme&&(document.head.removeChild(Bme),$me=null,Bme=null,Vme=-1)}let vge=new AbortController;function yge(){vge.abort(),vge=new AbortController;const e={capture:!0,signal:vge.signal};cge.size&&(age?(ige.length>0&&sge.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("contextmenu",pge,e),r.addEventListener("pointerleave",dge,e),r.addEventListener("pointermove",dge,e))})),sge.forEach(((t,n)=>{const{body:r}=n;r.addEventListener("pointerup",pge,e),r.addEventListener("pointercancel",pge,e)}))):sge.forEach(((t,n)=>{const{body:r}=n;t>0&&(r.addEventListener("pointerdown",uge,e),r.addEventListener("pointermove",dge,e))})))}function bge(e,t){cge.forEach((n=>{const{setResizeHandlerState:r}=n,o=ige.includes(n);r(e,o,t)}))}function xge(e,t){if(!e)throw Error(t)}function wge(e,t,n=10){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function _ge(e,t,n=10){return 0===wge(e,t,n)}function Sge(e,t,n){return 0===wge(e,t,n)}function Ege({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];xge(null!=r,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:a=100,minSize:s=0}=r;if(wge(n,s)<0)if(i){n=wge(n,(o+s)/2)<0?o:s}else n=s;return n=Math.min(a,n),n=parseFloat(n.toFixed(10))}function Tge({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Sge(e,0))return t;const a=[...t],[s,l]=r;xge(null!=s,"Invalid first pivot index"),xge(null!=l,"Invalid second pivot index");let c=0;if("keyboard"===i){{const r=e<0?l:s,o=n[r];xge(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(xge(null!=n,`Previous layout not found for panel index ${r}`),Sge(n,i)){const t=c-n;wge(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{const r=e<0?s:l,o=n[r];xge(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(xge(null!=n,`Previous layout not found for panel index ${r}`),Sge(n,c)){const t=n-i;wge(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];xge(null!=e,`Previous layout not found for panel index ${o}`);if(i+=Ege({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];xge(null!=i,`Previous layout not found for panel index ${r}`);const s=Ege({panelConstraints:n,panelIndex:r,size:i-o});if(!Sge(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(!Sge(e[r],t[r],n))return!1;return!0}(o,a))return o;{const r=e<0?l:s,o=t[r];xge(null!=o,`Previous layout not found for panel index ${r}`);const i=o+c,u=Ege({panelConstraints:n,panelIndex:r,size:i});if(a[r]=u,!Sge(u,i)){let t=i-u;let r=e<0?l:s;for(;r>=0&&r<n.length;){const o=a[r];xge(null!=o,`Previous layout not found for panel index ${r}`);const i=Ege({panelConstraints:n,panelIndex:r,size:o+t});if(Sge(o,i)||(t-=i-o,a[r]=i),Sge(t,0))break;e>0?r--:r++}}}return Sge(a.reduce(((e,t)=>t+e),0),100)?a:o}function Cge({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,a=0;const s=n[0];xge(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 Age(e,t=document){return Array.from(t.querySelectorAll(`[${Pme}][data-panel-group-id="${e}"]`))}function Nge(e,t,n=document){const r=Age(e,n).findIndex((e=>e.getAttribute(Pme)===t));return null!=r?r:null}function Rge(e,t,n){const r=Nge(e,t,n);return null!=r?[r,r+1]:[-1,-1]}function Oge(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 Pge(e,t=document){const n=t.querySelector(`[${Pme}="${e}"]`);return n||null}function kge({committedValuesRef:e,eagerValuesRef:t,groupId:r,layout:o,panelDataArray:i,panelGroupElement:a,setLayout:s}){n.useRef({didWarnAboutMissingResizeHandle:!1}),jme((()=>{if(!a)return;const e=Age(r,a);for(let t=0;t<i.length-1;t++){const{valueMax:n,valueMin:r,valueNow:a}=Cge({layout:o,panelsArray:i,pivotIndices:[t,t+1]}),s=e[t];if(null==s);else{const e=i[t];xge(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;xge(e,"Eager values not found");const{panelDataArray:n}=e;xge(null!=Oge(r,a),`No group found for id "${r}"`);const i=Age(r,a);xge(i,`No resize handles found for group id "${r}"`);const l=i.map((e=>{const t=e.getAttribute(Pme);xge(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=Pge(t,r),c=Age(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];xge(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=Tge({delta:Sge(i,c)?d-c:c-i,initialLayout:o,panelConstraints:n.map((e=>e.constraints)),pivotIndices:Rge(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 jge(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 Mge(e,t){const n="horizontal"===e,{x:r,y:o}=Kme(t);return n?r:o}function Lge(e,t,n,r,o,i){if(Hme(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=Pge(t,o);xge(a,`No resize handle element found for id "${t}"`);const s=a.getAttribute(Sme);xge(s,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Mge(n,e),u=Oge(s,o);xge(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 Dge(e,t,n){t.forEach(((t,r)=>{const o=e[r];xge(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&&!_ge(u,l)||_ge(t,l)||r(),!e||null!=u&&_ge(u,l)||!_ge(t,l)||e())}}))}function Ige(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 Fge(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 Uge(e){return`react-resizable-panels:${e}`}function $ge(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 Vge(e,t){try{const n=Uge(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 Bge(e,t,n,r,o){var i;const a=Uge(e),s=$ge(t),l=null!==(i=Vge(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 zge({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(!Sge(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const e=n[i];xge(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];xge(null!=e,`No layout data found for index ${i}`);const r=Ege({panelConstraints:t,panelIndex:i,size:e});e!=r&&(o+=e-r,n[i]=r)}if(!Sge(o,0))for(let i=0;i<t.length;i++){const e=n[i];xge(null!=e,`No layout data found for index ${i}`);const r=Ege({panelConstraints:t,panelIndex:i,size:e+o});if(e!==r&&(o-=r-e,n[i]=r,Sge(o,0)))break}return n}const Hge={getItem:e=>(Fge(Hge),Hge.getItem(e)),setItem:(e,t)=>{Fge(Hge),Hge.setItem(e,t)}},qge={};function Gge({autoSaveId:e=null,children:t,className:r="",direction:o,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:l=null,storage:c=Hge,style:u,tagName:d="div",...p}){const f=Ime(a),h=n.useRef(null),[m,g]=n.useState(null),[v,y]=n.useState([]),b=function(){const[e,t]=n.useState(0);return n.useCallback((()=>t((e=>e+1))),[])}(),x=n.useRef({}),w=n.useRef(new Map),_=n.useRef(0),S=n.useRef({autoSaveId:e,direction:o,dragState:m,id:f,keyboardResizeBy:l,onLayout:s,storage:c}),E=n.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});n.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),n.useImperativeHandle(i,(()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:e}=E.current;return e},setLayout:e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current,o=zge({layout:e,panelConstraints:r.map((e=>e.constraints))});jge(n,o)||(y(o),E.current.layout=o,t&&t(o),Dge(r,o,x.current))}})),[]),jme((()=>{S.current.autoSaveId=e,S.current.direction=o,S.current.dragState=m,S.current.id=f,S.current.onLayout=s,S.current.storage=c})),kge({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=qge[e];null==n&&(n=function(e,t=10){let n=null;return(...r)=>{null!==n&&clearTimeout(n),n=setTimeout((()=>{e(...r)}),t)}}(Bge,100),qge[e]=n);const r=[...t],o=new Map(w.current);n(e,r,o,v,c)}}),[e,v,c]),n.useEffect((()=>{}));const T=n.useCallback((e=>{const{onLayout:t}=S.current,{layout:n,panelDataArray:r}=E.current;if(e.constraints.collapsible){const o=r.map((e=>e.constraints)),{collapsedSize:i=0,panelSize:a,pivotIndices:s}=Yge(r,e,n);if(xge(null!=a,`Panel size not found for panel "${e.id}"`),!_ge(a,i)){w.current.set(e.id,a);const l=Tge({delta:Wge(r,e)===r.length-1?a-i:i-a,initialLayout:n,panelConstraints:o,pivotIndices:s,prevLayout:n,trigger:"imperative-api"});Ige(n,l)||(y(l),E.current.layout=l,t&&t(l),Dge(r,l,x.current))}}}),[]),C=n.useCallback(((e,t)=>{const{onLayout:n}=S.current,{layout:r,panelDataArray:o}=E.current;if(e.constraints.collapsible){const i=o.map((e=>e.constraints)),{collapsedSize:a=0,panelSize:s=0,minSize:l=0,pivotIndices:c}=Yge(o,e,r),u=null!=t?t:l;if(_ge(s,a)){const t=w.current.get(e.id),a=null!=t&&t>=u?t:u,l=Tge({delta:Wge(o,e)===o.length-1?s-a:a-s,initialLayout:r,panelConstraints:i,pivotIndices:c,prevLayout:r,trigger:"imperative-api"});Ige(r,l)||(y(l),E.current.layout=l,n&&n(l),Dge(o,l,x.current))}}}),[]),A=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{panelSize:r}=Yge(n,e,t);return xge(null!=r,`Panel size not found for panel "${e.id}"`),r}),[]),N=n.useCallback(((e,t)=>{const{panelDataArray:n}=E.current,r=Wge(n,e);return function({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const a=n[o];let s;return s=null==a?null!=e?e.toPrecision(i):"1":1===r.length?"1":a.toPrecision(i),{flexBasis:0,flexGrow:s,flexShrink:1,overflow:"hidden",pointerEvents:null!==t?"none":void 0}}({defaultSize:t,dragState:m,layout:v,panelData:n,panelIndex:r})}),[m,v]),R=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=Yge(n,e,t);return xge(null!=i,`Panel size not found for panel "${e.id}"`),!0===o&&_ge(i,r)}),[]),O=n.useCallback((e=>{const{layout:t,panelDataArray:n}=E.current,{collapsedSize:r=0,collapsible:o,panelSize:i}=Yge(n,e,t);return xge(null!=i,`Panel size not found for panel "${e.id}"`),!o||wge(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]);jme((()=>{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=Vge(e,n))&&void 0!==r?r:{})[$ge(t)])&&void 0!==o?o:null}(e,o,n);t&&(w.current=new Map(Object.entries(t.expandToSizes)),i=t.layout)}null==i&&(i=function({panelDataArray:e}){const t=Array(e.length),n=e.map((e=>e.constraints));let r=0,o=100;for(let i=0;i<e.length;i++){const e=n[i];xge(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];xge(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=zge({layout:i,panelConstraints:o.map((e=>e.constraints))});jge(r,a)||(y(a),E.current.layout=a,t&&t(a),Dge(o,a,x.current))}})),jme((()=>{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=Rge(a,e,r);let f=Lge(n,e,o,i,s,r);const m="horizontal"===o;m&&t&&(f=-f);const g=Tge({delta:f,initialLayout:null!=d?d:c,panelConstraints:u.map((e=>e.constraints)),pivotIndices:p,prevLayout:c,trigger:Hme(n)?"keyboard":"mouse-or-touch"}),v=!Ige(c,g);(qme(n)||Gme(n))&&_.current!=f&&(_.current=f,mge(e,v||0===f?0:m?f<0?ege:tge:f<0?nge:rge)),v&&(y(g),E.current.layout=g,l&&l(g),Dge(u,g,x.current))}}),[]),j=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}=Yge(o,e,r);xge(null!=a,`Panel size not found for panel "${e.id}"`);const l=Tge({delta:Wge(o,e)===o.length-1?a-t:t-a,initialLayout:r,panelConstraints:i,pivotIndices:s,prevLayout:r,trigger:"imperative-api"});Ige(r,l)||(y(l),E.current.layout=l,n&&n(l),Dge(o,l,x.current))}),[]),M=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}=Yge(r,e,n);null!=u&&(i&&s&&_ge(u,o)?_ge(o,a)||j(e,a):u<c?j(e,c):u>l&&j(e,l))}),[j]),L=n.useCallback(((e,t)=>{const{direction:n}=S.current,{layout:r}=E.current;if(!h.current)return;const o=Pge(e,h.current);xge(o,`Drag handle element not found for id "${e}"`);const i=Mge(n,t);g({dragHandleId:e,dragHandleRect:o.getBoundingClientRect(),initialCursorPosition:i,initialLayout:r})}),[]),D=n.useCallback((()=>{g(null)}),[]),I=n.useCallback((e=>{const{panelDataArray:t}=E.current,n=Wge(t,e);n>=0&&(t.splice(n,1),delete x.current[e.id],E.current.panelDataArrayChanged=!0,b())}),[b]),F=n.useMemo((()=>({collapsePanel:T,direction:o,dragState:m,expandPanel:C,getPanelSize:A,getPanelStyle:N,groupId:f,isPanelCollapsed:R,isPanelExpanded:O,reevaluatePanelConstraints:M,registerPanel:P,registerResizeHandle:k,resizePanel:j,startDragging:L,stopDragging:D,unregisterPanel:I,panelGroupElement:h.current})),[T,m,o,C,A,N,f,R,O,M,P,k,j,L,D,I]);return n.createElement(xme.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},[wme]:"",[_me]:o,[Sme]:f}))}const Kge=n.forwardRef(((e,t)=>n.createElement(Gge,{...e,forwardedRef:t})));function Wge(e,t){return e.findIndex((e=>e===t||e.id===t.id))}function Yge(e,t,n){const r=Wge(e,t);return{...t.constraints,panelSize:n[r],pivotIndices:r===e.length-1?[r-1,r]:[r,r+1]}}function Xge({children:e=null,className:t="",disabled:r=!1,hitAreaMargins:o,id:i,onBlur:a,onClick:s,onDragging:l,onFocus:c,onPointerDown:u,onPointerUp:d,style:p={},tabIndex:f=0,tagName:h="div",...m}){var g,v;const y=n.useRef(null),b=n.useRef({onClick:s,onDragging:l,onPointerDown:u,onPointerUp:d});n.useEffect((()=>{b.current.onClick=s,b.current.onDragging=l,b.current.onPointerDown=u,b.current.onPointerUp=d}));const x=n.useContext(xme);if(null===x)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:w,groupId:_,registerResizeHandle:S,startDragging:E,stopDragging:T,panelGroupElement:C}=x,A=Ime(i),[N,R]=n.useState("inactive"),[O,P]=n.useState(!1),[k,j]=n.useState(null),M=n.useRef({state:N});jme((()=>{M.current.state=N})),n.useEffect((()=>{if(r)j(null);else{const e=S(A);j((()=>e))}}),[r,A,S]);const L=null!==(g=null==o?void 0:o.coarse)&&void 0!==g?g:15,D=null!==(v=null==o?void 0:o.fine)&&void 0!==v?v:5;n.useEffect((()=>{if(r||null==k)return;const e=y.current;xge(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=sge.get(a))&&void 0!==i?i:0;return sge.set(a,l+1),cge.add(s),yge(),function(){var t;lge.delete(e),cge.delete(s);const n=null!==(t=sge.get(a))&&void 0!==t?t:1;if(sge.set(a,n-1),yge(),1===n&&sge.delete(a),ige.includes(s)){const e=ige.indexOf(s);e>=0&&ige.splice(e,1),gge(),o("up",!0,null)}}}(A,e,w,{coarse:L,fine:D},((e,n,r)=>{if(n)switch(e){case"down":{R("drag"),t=!1,xge(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}=M.current;t=!0,"drag"!==e&&R("hover"),xge(r,'Expected event to be defined for "move" action'),k(r);break}case"up":{R("hover"),T();const{onClick:e,onDragging:n,onPointerUp:r}=b.current;null==n||n(!1),null==r||r(),t||null==e||e();break}}else R("inactive")}))}),[L,w,r,D,S,A,k,E,T]),function({disabled:e,handleId:t,resizeHandler:r,panelGroupElement:o}){n.useEffect((()=>{if(e||null==r||null==o)return;const n=Pge(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(Sme);xge(r,`No group element found for id "${r}"`);const i=Age(r,o),a=Nge(r,t,o);xge(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,[_me]:w,[Sme]:_,[Nme]:"",[Rme]:"drag"===N?"pointer":O?"keyboard":void 0,[Ome]:!r,[Pme]:A,[kme]:N})}Gge.displayName="PanelGroup",Kge.displayName="forwardRef(PanelGroup)",Xge.displayName="PanelResizeHandle";const Zge=({className:e,...n})=>t.jsx(Kge,{className:OB("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...n}),Qge=Ume,Jge=({withHandle:e,className:n,...r})=>t.jsx(Xge,{className:OB("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(Ru,{className:"h-2.5 w-2.5"})})}),eve=({copyText:e})=>t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:e}),tve="rgba(245, 246, 247, 1)",nve={[Be.SEND_COMMUNICATION]:{color:{bg:tve},clickable:!0},[Be.WAIT_UNTIL_NEXT_FIXED_TIME]:{color:{bg:tve},clickable:!1}},rve={[Be.SEND_COMMUNICATION]:"Send Email & SMS",[Be.WAIT_UNTIL_NEXT_FIXED_TIME]:"Wait"},ove=({children:e,onClick:n,iconBgColor:r,iconStrokeColor:o,Icon:i,disabled:a=!1,selected:s=!1})=>{const l=i;return t.jsxs(DX.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:tve},onClick:n,className:rp("flex gap-2 items-center rounded-md transition-colors group","p-2 border-2 border-transparent overflow-hidden",!a&&"hover:border-primary cursor-pointer",s&&"border-primary"),children:[t.jsx("div",{className:rp("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:rp("w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",o)})}),e]})},ive=({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}),ave=()=>{const e=bZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(XX),[i,a]=n.useState(e?.includeSegmentIds||null),[s,l]=n.useState(e?.excludeSegmentIds||null),{segments:c}=dZ(),u=n.useCallback((()=>c?.find((e=>e.type===gZ.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(ove,{selected:o===boe.EditAudience,iconBgColor:"bg-purple-50",iconStrokeColor:"stroke-purple-500",onClick:()=>{r(boe.EditAudience)},Icon:FZ.AudienceIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Aue,{children:"Audience"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(eve,{copyText:`Send to all ${bf("engage:user",{count:2})} in ${1===i.length?"this":"these"} ${bf("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(ive,{segmentName:n.name},e):null}))})]})]})})}):null},sve=()=>{const e=bZ(),{setActionId:r,state:{selectedActionId:o}}=n.useContext(XX),{segments:i}=dZ(),a=bf(e?.triggerType===Ue.TRIGGER_BASED?"engage:automation":"engage:broadcast"),s=`Start this ${a?.toLowerCase()}`;if(!e||!i)return null;return t.jsx(t.Fragment,{children:(()=>{switch(e.triggerType){case Ue.TRIGGER_BASED:{if(e.triggerMetadata.triggerType!==Ue.TRIGGER_BASED||e.triggerMetadata.eventName!==$e.USER_ENTERS_SEGMENT||!e.triggerMetadata.eventFilter.segment_id)return null;const n=e.triggerMetadata.eventFilter.segment_id,r=i.find((e=>e.id===n))?.name;return r?t.jsx(ove,{iconBgColor:"bg-amber-100",disabled:!0,iconStrokeColor:"stroke-amber-500",onClick:()=>{},Icon:FZ.TriggerIcon,children:t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Aue,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(eve,{copyText:`When ${bf("engage:user").toLowerCase()} joins the`}),t.jsx(ive,{segmentName:r})]})]})}):null}case Ue.ONE_TIME:{const n=!e.triggerMetadata||!("scheduledAt"in e.triggerMetadata);return t.jsxs(ove,{iconBgColor:"bg-amber-100",iconStrokeColor:"stroke-amber-500",onClick:()=>{r(boe.EditTime)},selected:o===boe.EditTime,Icon:FZ.TriggerIcon,children:[t.jsxs("div",{className:"flex flex-col gap-0.5 flex-1",children:[t.jsx(Aue,{children:s}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(eve,n?{copyText:`Click to set the date and time for this ${bf("engage:broadcast")}`}:{copyText:"Bulk send at"}),!1===n&&"scheduledAt"in e.triggerMetadata&&e.triggerMetadata.scheduledAt&&t.jsx("div",{className:"text-xs font-medium",children:t.jsx(ive,{segmentName:E7(new Date(e.triggerMetadata.scheduledAt),"h:mma MM/dd/yy")})})]})]}),t.jsx("div",{className:"",children:n&&t.jsx(FZ.AlertTriangleIcon,{className:"group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors"})})]})}default:throw Eoe(e.triggerType,Ue)}})()})},lve=e=>{switch(e){case Be.SEND_COMMUNICATION:return"Send Communication";case Be.WAIT_UNTIL_NEXT_FIXED_TIME:return"Wait";default:throw HX(e,Be)}},cve=e=>{switch(e){case Be.SEND_COMMUNICATION:return t.jsx(FZ.CommunicationIcon,{className:"w-4 h-4"});case Be.WAIT_UNTIL_NEXT_FIXED_TIME:return t.jsx(FZ.WaitUntilNextFixedTimeIcon,{className:"w-4 h-4"});default:throw Eoe(e,Be)}},uve=e=>{if(!(e&&e.actionType===Be.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}`},dve=({actionDataWithMetadata:e})=>{const{actionData:r,communicationGroup:o}=e,{state:{selectedActionId:i},setActionId:a,setSelectedCommunicationGroupId:s}=n.useContext(XX),l=n.useMemo((()=>i===r.actionMetadata.currentActionId),[i,r.actionMetadata.currentActionId]),c=nve[r.actionType],u=c.color,d=c.clickable;return t.jsx(DX.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeInOut"},className:rp("p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group"," border-2 border-transparent",l&&"border-primary",r.actionType!==Be.WAIT_UNTIL_NEXT_FIXED_TIME&&"hover:border-primary"),style:{backgroundColor:l?u.bg:u.bgUnselected??tve},onClick:()=>{d&&(a(r.actionMetadata.currentActionId),r.actionType===Be.SEND_COMMUNICATION&&s(r.actionMetadata.communicationGroupId))},children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white",children:cve(r.actionType)}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{style:{color:l?u.text:u.textUnselected},children:t.jsx(Aue,{children:rve[r.actionType]})}),t.jsx("div",r.actionType===Be.WAIT_UNTIL_NEXT_FIXED_TIME?{className:"text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate",children:uve(r.actionMetadata)}:{className:"text-xs font-medium text-muted-foreground",children:r.actionType===Be.SEND_COMMUNICATION&&o?.emailSubject?o?.emailSubject:lve(r.actionType)})]})]})})},pve=()=>{const[e,r]=n.useState(!1),[o,i]=n.useState(void 0),a=bZ(),{setActionId:s,state:{selectedActionId:l}}=n.useContext(XX);if(De(a?.id||""),n.useEffect((()=>{if(!a)return;if(l)return;const e=a.actionData?.find((e=>"send_communication"===e.actionType));e&&s(e.actionMetadata.currentActionId)}),[a,s,l]),n.useEffect((()=>{if(!a)return;(async()=>{const e=[];for(const t of a.actionData??[])switch(t.actionType){case Be.SEND_COMMUNICATION:{const n=await QX(t.actionMetadata.communicationGroupId);e.push({actionData:t,communicationGroup:n});break}case Be.WAIT_UNTIL_NEXT_FIXED_TIME:e.push({actionData:t});break;default:throw HX(t.actionType,Be)}i(e)})()}),[a]),!a||!o)return null;const c=(e=>{const{steps:t,rootActionId:n}=e;if(!t||!n)return t??[];const r=new Map(t.map((e=>[e.actionData.actionMetadata.currentActionId,e]))),o=r.get(n);if(!o)return t;const i=[];let a=o;for(;a;){i.push(a);const e=a.actionData.actionMetadata.nextActionId;if(!e)break;a=r.get(e)}return i})({steps:o,rootActionId:a.triggerMetadata?.triggerType===Ue.TRIGGER_BASED?a.triggerMetadata.rootActionId:void 0}).filter((t=>!!e||"send_communication"===t.actionData.actionType));let u=()=>t.jsx("div",{},"empty-trigger-audience");return(e||a.triggerType===Ue.ONE_TIME)&&(u=()=>t.jsxs("div",{className:"flex flex-col gap-3",children:[a.triggerType===Ue.ONE_TIME&&t.jsx(ave,{}),a.triggerType!==Ue.ONE_TIME&&t.jsx(sve,{})]})),t.jsxs("div",{className:"flex-1 flex flex-col gap-2 w-full overflow-visible",children:[a.triggerType===Ue.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(she,{defaultChecked:e,onCheckedChange:()=>{r(!e)}})]})]}),t.jsx("div",{className:"flex-1 flex flex-col gap-3",children:t.jsxs(QB,{mode:"popLayout",children:[u(),c.map(((e,n)=>t.jsx(DX.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(dve,{actionDataWithMetadata:e})},e.actionData.actionMetadata?.currentActionId??n))),a.triggerType===Ue.ONE_TIME&&t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx(sve,{})},"one-time-trigger")]})})]})},fve=()=>{const e=bZ(),{segments:n}=dZ();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(pve,{})})}:{className:"flex h-full items-center justify-center",children:t.jsx(EZ,{text:[`Getting details on your ${bf("engage:automation",{count:1}).toLowerCase()}`,"Finishing up"]})})},hve=()=>{const{state:{selectedActionId:e}}=n.useContext(XX);return t.jsx("div",{className:"flex flex-col gap-4 h-full w-full",children:t.jsx(QB,{mode:"wait",children:t.jsx(e===boe.EditTime?Pfe:e===boe.EditAudience?She:Sue,{})})})},mve=()=>t.jsxs(Zge,{direction:"horizontal",className:"flex-1",children:[t.jsx(Qge,{defaultSize:30,minSize:16,maxSize:48,children:t.jsx("aside",{className:"h-full",children:t.jsx(fve,{})})}),t.jsx(Jge,{className:"px-1 opacity-0 hover:opacity-100 transition-opacity duration-200 mx-1"}),t.jsx(Qge,{defaultSize:70,children:t.jsx("main",{className:"h-full",children:t.jsx(hve,{})})})]}),gve=()=>{const[e,r]=n.useState("workflow"),o=[{id:"workflow",label:"Workflow",content:t.jsx(mve,{})},{id:"recipients",label:"Recipients",content:t.jsx(bme,{})},{id:"insights",label:bf("engage:insight",{count:2}),content:t.jsx(vme,{})}];return t.jsx(Dhe,{tabs:o,activeTab:e,onTabChange:r,tabsLocation:"left"})},vve=({showBackButton:e=!1,onDuplicationCreated:r,onBeforeSchedule:o,getExtraMergeFields:i,hideSms:a,hideSales:s,replyToSettingsText:l,replyToSettingsLink:c,fromNameSettingsText:u,fromNameSettingsLink:d})=>{const p=bZ(),f=xZ(),{updateCommunicationGroup:h}=iZ(),{toast:m}=Il(),{channelSenders:g}=V7();return n.useEffect((()=>{if(f&&i){(async()=>{const e=await i();JSON.stringify(e)!==JSON.stringify(f.extraMergeFields)&&h({groupId:f?.id,params:{extraMergeFields:e}},{onError:e=>{m({title:"Error saving merge fields!",description:"Please contact your administrator if this issue persists.",variant:"destructive"})}})})()}}),[f,i,h,m]),n.useEffect((()=>{if(p&&f&&g){if(!f.emailChannelSenderId){const e=g.results.filter((e=>e.channelSenderMetadata.userPart));e.length>0&&h({groupId:f.id,params:{emailChannelSenderId:e[0].id}})}if(!f.smsChannelSenderId){const e=g.results.filter((e=>e.channelSenderMetadata.from||e.channelSenderMetadata.messageServiceSid));e.length>0&&h({groupId:f.id,params:{smsChannelSenderId:e[0].id}})}}}),[p,f,g,h]),p&&f?t.jsx(c$,{children:t.jsx(u$,{replyToSettingsText:l,replyToSettingsLink:c,fromNameSettingsText:u,fromNameSettingsLink:d,hideSms:a,hideSales:s,children:t.jsxs("div",{className:"h-full flex flex-col gap-4",children:[t.jsx(gme,{showBackButton:e,onDuplicationCreated:r,onBeforeSchedule:o}),t.jsx("div",{className:"flex-1 border-t",children:t.jsx(gve,{})})]})})}):t.jsx("div",{className:"flex h-screen items-center justify-center",children:t.jsx(EZ,{text:[`Fetching ${bf("engage:automation").toLowerCase()} data`,"Finishing up"]})})},yve=({...e})=>{const n=function(){let{matches:e}=i.useContext(t4),t=e[e.length-1];return t?t.params:{}}(),[r]=H4(),o=e.automationId||n?.automationId||r.get("automationId")||"",a="true"===r.get("showBackButton")||e.showBackButton;return t.jsx(_Z,{automationId:o,children:t.jsx("div",{className:"bg-background h-full",children:t.jsx(vve,{...e,showBackButton:a})})})};Object.values(Object.assign({}));var bve=e=>null!=e;var xve=e=>"function"!=typeof e||e.length?e:e(),wve=e=>Array.isArray(e)?e:e?[e]:[];var _ve=yt;var Sve,Eve=function(e){const[t,n]=ct(),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=ct(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(FTe){return r(FTe,`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&&vt((()=>{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(FTe){r(FTe,`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),yt((()=>globalThis.removeEventListener("storage",e)))):(o.forEach((t=>t.addEventListener?.("storage",e))),yt((()=>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(FTe){r(FTe,`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(FTe){r(FTe,`Error clearing ${e.name}`)}})),error:t,remove:e=>o.forEach((t=>{try{t.removeItem(`${i}${e}`)}catch(FTe){r(FTe,`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(FTe){r(FTe,`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(FTe){r(FTe,`Error getting all values from ${e.name}`)}}})),t}}]},Tve=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},Cve=("function"==typeof(Sve={_cookies:[globalThis.document,"cookie"],getItem:e=>Cve._cookies[0][Cve._cookies[1]].match("(^|;)\\s*"+e+"\\s*=\\s*([^;]+)")?.pop()??null,setItem:(e,t,n)=>{const r=Cve.getItem(e);Cve._cookies[0][Cve._cookies[1]]=`${e}=${t}${Tve(n)}`;const o=Object.assign(new Event("storage"),{key:e,oldValue:r,newValue:t,url:globalThis.document.URL,storageArea:Cve});window.dispatchEvent(o)},removeItem:e=>{Cve._cookies[0][Cve._cookies[1]]=`${e}=deleted${Tve({expires:new Date(0)})}`},key:e=>{let t=null,n=0;return Cve._cookies[0][Cve._cookies[1]].replace(/(?:^|;)\s*(.+?)\s*=\s*[^;]+/g,((r,o)=>(!t&&o&&n++===e&&(t=o),""))),t},get length(){let e=0;return Cve._cookies[0][Cve._cookies[1]].replace(/(?:^|;)\s*.+?\s*=\s*[^;]+/g,(t=>(e+=t?1:0,""))),e}}).clear||(Sve.clear=()=>{let e;for(;e=Sve.key(0);)Sve.removeItem(e)}),Sve),Ave=796,Nve="bottom",Rve="system",Ove=Object.keys(Pr)[0],Pve=Object.keys(Mr)[0],kve=St({client:void 0,onlineManager:void 0,queryFlavor:"",version:"",shadowDOMTarget:void 0});function jve(){return Et(kve)}var Mve=St(void 0),Lve=e=>{const[t,n]=ct(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[fn]){for(let t of e[fn].keys())e.removeEventListener(t,An);delete e[fn]}}(i.document),i.document.title="TanStack Query Devtools",i.document.body.style.margin="0",i.addEventListener("pagehide",(()=>{e.setLocalStore("pip_open","false"),n(null)})),[...(jve().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(ITe){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)}})),gn(["focusin","focusout","pointermove","keydown","pointerdown","pointerup","click","mousedown","input"],i.document),e.setLocalStore("pip_open","true"),n(i)};pt((()=>{"true"!==(e.localStore.pip_open??"false")||e.disabled||o(Number(window.innerWidth),Number(e.localStore.height||500))})),pt((()=>{const e=(jve().shadowDOMTarget||document).querySelector("#_goober"),n=t();if(e&&n){const t=new MutationObserver((()=>{const t=(jve().shadowDOMTarget||n.document).querySelector("#_goober");t&&(t.textContent=e.textContent)}));t.observe(e,{childList:!0,subtree:!0,characterDataOldValue:!0}),yt((()=>{t.disconnect()}))}}));const i=ft((()=>({pipWindow:t(),requestPipWindow:o,closePipWindow:r,disabled:e.disabled??!1})));return zt(Mve.Provider,{value:i,get children(){return e.children}})},Dve=()=>ft((()=>{const e=Et(Mve);if(!e)throw new Error("usePiPWindow must be used within a PiPProvider");return e()})),Ive=St((()=>"dark"));function Fve(){return Et(Ive)}var Uve={"À":"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"},$ve=Object.keys(Uve).join("|"),Vve=new RegExp($ve,"g");var Bve=7,zve=6,Hve=5,qve=4,Gve=3,Kve=2,Wve=1,Yve=0;function Xve(e,t,n){var r;if((n=n||{}).threshold=null!=(r=n.threshold)?r:Wve,!n.accessors){const r=Zve(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=tye(o),a=Jve(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:Yve,accessorIndex:-1,accessorThreshold:n.threshold,passed:!1};for(let a=0;a<o.length;a++){const e=o[a];let r=Zve(e.itemValue,t,n);const{minRanking:s,maxRanking:l,threshold:c=n.threshold}=e.attributes;r<s&&r>=Wve?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 Zve(e,t,n){return e=Qve(e,n),(t=Qve(t,n)).length>e.length?Yve:e===t?Bve:(e=e.toLowerCase())===(t=t.toLowerCase())?zve:e.startsWith(t)?Hve:e.includes(` ${t}`)?qve:e.includes(t)?Gve:1===t.length?Yve:function(e){let t="";return e.split(" ").forEach((e=>{e.split("-").forEach((e=>{t+=e.substr(0,1)}))})),t}(e).includes(t)?Kve: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 Wve+n/t.length*(1/e)}const a=o(t[0],e,0);if(a<0)return Yve;r=a;for(let s=1,l=t.length;s<l;s++){r=o(t[s],e,r);if(!(r>-1))return Yve}return i(r-a)}(e,t)}function Qve(e,t){let{keepDiacritics:n}=t;return e=`${e}`,n||(e=e.replace(Vve,(e=>Uve[e]))),e}function Jve(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 eye={maxRanking:1/0,minRanking:-1/0};function tye(e){return"function"==typeof e?eye:{...eye,...e}}var nye={data:""},rye=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,oye=/\/\*[^]*?\*\/| +/g,iye=/\n+/g,aye=(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]?aye(a,i):i+"{"+aye(a,"k"==i[1]?"":t)+"}":"object"==typeof a?r+=aye(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+=aye.p?aye.p(i,a):i+":"+a+";")}return n+(t&&o?t+"{"+o+"}":o)+r},sye={},lye=e=>{if("object"==typeof e){let t="";for(let n in e)t+=n+lye(e[n]);return t}return e};function cye(e){let t=this||{},n=e.call?e(t.p):e;return((e,t,n,r,o)=>{let i=lye(e),a=sye[i]||(sye[i]=(e=>{let t=0,n=11;for(;t<e.length;)n=101*n+e.charCodeAt(t++)>>>0;return"go"+n})(i));if(!sye[a]){let t=i!==e?e:(e=>{let t,n,r=[{}];for(;t=rye.exec(e.replace(oye,""));)t[4]?r.shift():t[3]?(n=t[3].replace(iye," ").trim(),r.unshift(r[0][n]=r[0][n]||{})):r[0][t[1]]=t[2].replace(iye," ").trim();return r[0]})(e);sye[a]=aye(o?{["@keyframes "+a]:t}:t,n?"":"."+a)}let s=n&&sye.g?sye.g:null;return n&&(sye.g=sye[a]),l=sye[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?"":aye(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||nye),t.g,t.o,t.k);var r}function uye(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=uye(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function dye(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=uye(e))&&(r&&(r+=" "),r+=t);return r}function pye(e,t){const n=mt(e),{onChange:r}=t;let o=new Set(t.appear?void 0:n);const i=new WeakSet,[a,s]=ct([],{equals:!1}),[l]=[wt,xt],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 ft((t=>{const n=a(),s=e();if(mt(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 mt((()=>{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 fye(...e){return t=e,(...e)=>{for(const n of t)n&&n(...e)};var t}cye.bind({g:1}),cye.bind({k:1});var hye=e=>e instanceof Element;function mye(e,t){if(t(e))return e;if("function"==typeof e&&!e.length)return mye(e(),t);if(Array.isArray(e)){const n=[];for(const r of e){const e=mye(r,t);e&&(Array.isArray(e)?n.push.apply(n,e):n.push(e))}return n.length?n:null}return null}function gye(e,t=hye,n=hye){const r=ft(e),o=ft((()=>mye(r(),t)));return o.toArray=()=>{const e=o();return Array.isArray(e)?e:e?[e]:[]},o}function vye(e){requestAnimationFrame((()=>requestAnimationFrame(e)))}function yye(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()))})),vye((()=>{n.classList.remove(...e.enter),n.classList.add(...e.enterTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}function bye(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())),vye((()=>{n.classList.remove(...e.exit),n.classList.add(...e.exitTo),(!i||i.length<2)&&(n.addEventListener("transitionend",s),n.addEventListener("animationend",s))}))}var xye=e=>{const t=function(e){return ft((()=>{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 pye(gye((()=>e.children)).toArray,{appear:e.appear,onChange({added:n,removed:r,finishRemoved:o,list:i}){const a=t();for(const t of n)yye(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)bye(a,e,t,(()=>o([t])))}})},wye=Symbol("fallback");function _ye(e){for(const t of e)t.dispose()}function Sye(e){const{by:t}=e;return ft(function(e,t,n,r={}){const o=new Map;return yt((()=>_ye(o.values()))),()=>{const n=e()||[];return mt((()=>{if(!n.length)return _ye(o.values()),o.clear(),r.fallback?[lt((e=>(o.set(wye,{dispose:e}),r.fallback())))]:[];const e=new Array(n.length),a=o.get(wye);if(!o.size||a){a?.dispose(),o.delete(wye);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){lt((a=>{const[s,l]=ct(t),c={setItem:l,dispose:a};if(n.length>1){const[e,t]=ct(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 Eye(e,t,n,r){const o=()=>{wve(xve(e)).forEach((e=>{e&&wve(xve(t)).forEach((t=>function(e,t,n,r){return e.addEventListener(t,n,r),_ve(e.removeEventListener.bind(e,t,n,r))}(e,t,n,r)))}))};"function"==typeof e?pt(o):dt(o)}function Tye(e,t,n){const r=new WeakMap,{observe:o,unobserve:i}=function(e,t){const n=new ResizeObserver(e);return yt(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);pt((t=>{const n=wve(xve(e)).filter(bve);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 Cye=/((?:--)?(?:\w+-?)+)\s*:\s*([^;]*)/g;function Aye(e){const t={};let n;for(;n=Cye.exec(e);)t[n[1]]=n[2];return t}function Nye(e,t){if("string"==typeof e){if("string"==typeof t)return`${e};${t}`;e=Aye(e)}else"string"==typeof t&&(t=Aye(t));return{...e,...t}}function Rye(e,t){const n=[...e],r=n.indexOf(t);return-1!==r&&n.splice(r,1),n}function Oye(e){return"[object String]"===Object.prototype.toString.call(e)}function Pye(e){return t=>`${e()}-${t}`}function kye(e,t){return!!e&&(e===t||e.contains(t))}function jye(e,t=!1){const{activeElement:n}=Mye(e);if(!n?.nodeName)return null;if(Lye(n)&&n.contentDocument)return jye(n.contentDocument.body,t);if(t){const e=n.getAttribute("aria-activedescendant");if(e){const t=Mye(n).getElementById(e);if(t)return t}}return n}function Mye(e){return e?e.ownerDocument||e:document}function Lye(e){return"IFRAME"===e.tagName}var Dye=(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))(Dye||{});function Iye(e){return"undefined"!=typeof window&&null!=window.navigator&&e.test(window.navigator.userAgentData?.platform||window.navigator.platform)}function Fye(){return Iye(/^Mac/i)}function Uye(){return Iye(/^iPhone/i)||Iye(/^iPad/i)||Fye()&&navigator.maxTouchPoints>1}function $ye(e,t){return t&&("function"==typeof t?t(e):t[0](t[1],e)),e?.defaultPrevented}function Vye(e){return t=>{for(const n of e)$ye(t,n)}}function Bye(e){return Fye()?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey}function zye(e){if(e)if(function(){if(null==Hye){Hye=!1;try{document.createElement("div").focus({get preventScroll(){return Hye=!0,!0}})}catch(ITe){}}return Hye}())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 Hye=null;var qye=["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'])"],Gye=[...qye,'[tabindex]:not([tabindex="-1"]):not([disabled])'],Kye=qye.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])",Wye=Gye.join(':not([hidden]):not([tabindex="-1"]),');function Yye(e,t){const n=Array.from(e.querySelectorAll(Kye)).filter(Xye);return t&&Xye(e)&&n.unshift(e),n.forEach(((e,t)=>{if(Lye(e)&&e.contentDocument){const r=Yye(e.contentDocument.body,!1);n.splice(t,1,...r)}})),n}function Xye(e){return Zye(e)&&!function(e){const t=parseInt(e.getAttribute("tabindex")||"0",10);return t<0}(e)}function Zye(e){return e.matches(Kye)&&Qye(e)}function Qye(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||Qye(e.parentElement,e))}function Jye(e){for(;e&&!ebe(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}function ebe(e){const t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function tbe(){}function nbe(e,t){return Wt(e,t)}var rbe=new Map,obe=new Set;function ibe(){if("undefined"==typeof window)return;const e=t=>{if(!t.target)return;const n=rbe.get(t.target);if(n&&(n.delete(t.propertyName),0===n.size&&(t.target.removeEventListener("transitioncancel",e),rbe.delete(t.target)),0===rbe.size)){for(const e of obe)e();obe.clear()}};document.body.addEventListener("transitionrun",(t=>{if(!t.target)return;let n=rbe.get(t.target);n||(n=new Set,rbe.set(t.target,n),t.target.addEventListener("transitioncancel",e)),n.add(t.propertyName)})),document.body.addEventListener("transitionend",e)}function abe(e,t){const n=sbe(e,t,"left"),r=sbe(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 sbe(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?ibe():document.addEventListener("DOMContentLoaded",ibe));var lbe={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 cbe(e){return t=>(e(t),()=>e(void 0))}function ube(e,t){const[n,r]=ct(dbe(t?.()));return pt((()=>{r(e()?.tagName.toLowerCase()||dbe(t?.()))})),n}function dbe(e){return Oye(e)?e:void 0}function pbe(e){const[t,n]=Yt(e,["as"]);if(!t.as)throw new Error("[kobalte]: Polymorphic is missing the required `as` prop.");return zt(Mn,Wt(n,{get component(){return t.as}}))}var fbe=["id","name","validationState","required","disabled","readOnly"];var hbe=St();function mbe(){const e=Et(hbe);if(void 0===e)throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");return e}function gbe(e){const t=mbe(),n=nbe({id:t.generateId("description")},e);return pt((()=>yt(t.registerDescription(n.id)))),zt(pbe,Wt({as:"div"},(()=>t.dataset()),n))}function vbe(e){const t=mbe(),n=nbe({id:t.generateId("error-message")},e),[r,o]=Yt(n,["forceMount"]),i=()=>"invalid"===t.validationState();return pt((()=>{i()&&yt(t.registerErrorMessage(o.id))})),zt(nn,{get when(){return r.forceMount||i()},get children(){return zt(pbe,Wt({as:"div"},(()=>t.dataset()),o))}})}function ybe(e){let t;const n=mbe(),r=nbe({id:n.generateId("label")},e),[o,i]=Yt(r,["ref"]),a=ube((()=>t),(()=>"label"));return pt((()=>yt(n.registerLabel(i.id)))),zt(pbe,Wt({as:"label",ref(e){const n=fye((e=>t=e),o.ref);"function"==typeof n&&n(e)},get for(){return ft((()=>"label"===a()))()?n.fieldId():void 0}},(()=>n.dataset()),i))}function bbe(e,t){pt(gt(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}),yt((()=>{n.removeEventListener("reset",t)})))})))}function xbe(e){const[t,n]=ct(e.defaultValue?.()),r=ft((()=>void 0!==e.value?.())),o=ft((()=>r()?e.value?.():t()));return[o,t=>{mt((()=>{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 wbe(e){const[t,n]=xbe(e);return[()=>t()??!1,n]}var _be=Object.defineProperty,Sbe=(e,t)=>{for(var n in t)_be(e,n,{get:t[n],enumerable:!0})},Ebe=St();function Tbe(){return Et(Ebe)}function Cbe(e,t){return Boolean(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Abe(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?Cbe(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 Nbe(e,t){if("function"!=typeof IntersectionObserver)return void function(e,t){pt((()=>{const n=setTimeout((()=>{Abe(e(),t)}));yt((()=>clearTimeout(n)))}))}(e,t);let n=[];pt((()=>{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 Mye(r).body}(e()),o=new IntersectionObserver((()=>{const r=!!n.length;n=e(),r&&Abe(e(),t)}),{root:r});for(const t of e()){const e=t.ref();e&&o.observe(e)}yt((()=>o.disconnect()))}))}function Rbe(e={}){const[t,n]=function(e){const[t,n]=xbe(e);return[()=>t()??[],n]}({value:()=>xve(e.items),onChange:t=>e.onItemsChange?.(t)});Nbe(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&&Cbe(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=>zt(Ebe.Provider,{value:{registerItem:r},get children(){return e.children}})}}function Obe(e){const t=function(){const e=Tbe();if(void 0===e)throw new Error("[kobalte]: `useDomCollectionContext` must be used within a `DomCollectionProvider` component");return e}(),n=nbe({shouldRegisterItem:!0},e);pt((()=>{if(!n.shouldRegisterItem)return;yt(t.registerItem(n.getItem()))}))}function Pbe(e){let t=e.startIndex??0;const n=e.startLevel??0,r=[],o=t=>{if(null==t)return"";const n=e.getKey??"key",r=Oye(n)?t[n]:n(t);return null!=r?String(r):""},i=t=>{if(null==t)return"";const n=e.getTextValue??"textValue",r=Oye(n)?t[n]:n(t);return null!=r?String(r):""},a=t=>{if(null==t)return!1;const n=e.getDisabled??"disabled";return(Oye(n)?t[n]:n(t))??!1},s=t=>{if(null!=t)return Oye(e.getSectionChildren)?t[e.getSectionChildren]:e.getSectionChildren?.(t)};for(const l of e.dataSource)if(Oye(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=Pbe({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 kbe(e,t=[]){return ft((()=>{const n=Pbe({dataSource:xve(e.dataSource),getKey:xve(e.getKey),getTextValue:xve(e.getTextValue),getDisabled:xve(e.getDisabled),getSectionChildren:xve(e.getSectionChildren)});for(let e=0;e<t.length;e++)t[e]();return e.factory(n)}))}var jbe=new Set(["Avst","Arab","Armi","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Mbe=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Lbe(e){return function(e){if(Intl.Locale){const t=new Intl.Locale(e).maximize().script??"";return jbe.has(t)}const t=e.split("-")[0];return Mbe.has(t)}(e)?"rtl":"ltr"}function Dbe(){let e="undefined"!=typeof navigator&&(navigator.language||navigator.userLanguage)||"en-US";return{locale:e,direction:Lbe(e)}}var Ibe=Dbe(),Fbe=new Set;function Ube(){Ibe=Dbe();for(const e of Fbe)e(Ibe)}var $be=St();function Vbe(){const e=function(){const[e,t]=ct(Ibe),n=ft((()=>e()));return vt((()=>{0===Fbe.size&&window.addEventListener("languagechange",Ube),Fbe.add(t),yt((()=>{Fbe.delete(t),0===Fbe.size&&window.removeEventListener("languagechange",Ube)}))})),{locale:()=>n().locale,direction:()=>n().direction}}();return Et($be)||e}var Bbe=new Map;var zbe=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 Hbe(e){return Fye()||Uye()?e.altKey:e.ctrlKey}function qbe(e){return Fye()?e.metaKey:e.ctrlKey}function Gbe(e){return new zbe(e)}function Kbe(e){const t=nbe({selectionMode:"none",selectionBehavior:"toggle"},e),[n,r]=ct(!1),[o,i]=ct(),a=ft((()=>{const e=xve(t.selectedKeys);return null!=e?Gbe(e):e})),s=ft((()=>{const e=xve(t.defaultSelectedKeys);return null!=e?Gbe(e):new zbe})),[l,c]=function(e){const[t,n]=xbe(e);return[()=>t()??new zbe,n]}({value:a,defaultValue:s,onChange:e=>t.onSelectionChange?.(e)}),[u,d]=ct(xve(t.selectionBehavior));return pt((()=>{const e=l();"replace"===xve(t.selectionBehavior)&&"toggle"===u()&&"object"==typeof e&&0===e.size&&d("replace")})),pt((()=>{d(xve(t.selectionBehavior)??"toggle")})),{selectionMode:()=>xve(t.selectionMode),disallowEmptySelection:()=>xve(t.disallowEmptySelection)??!1,selectionBehavior:u,setSelectionBehavior:d,isFocused:n,setFocused:r,focusedKey:o,setFocusedKey:i,selectedKeys:l,setSelectedKeys:e=>{!xve(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 Wbe(e,t,n){const r=Wt({selectOnFocus:()=>"replace"===xve(e.selectionManager).selectionBehavior()},e),o=()=>t(),{direction:i}=Vbe();let a={top:0,left:0};Eye((()=>xve(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]=ct(""),[r,o]=ct(-1);return{typeSelectHandlers:{onKeyDown:i=>{if(xve(e.isDisabled))return;const a=xve(e.keyboardDelegate),s=xve(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:()=>xve(r.disallowTypeAhead),keyboardDelegate:()=>xve(r.keyboardDelegate),selectionManager:()=>xve(r.selectionManager)}),l=()=>xve(r.orientation)??"vertical",c=()=>{const e=xve(r.autoFocus);if(!e)return;const n=xve(r.selectionManager),o=xve(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&&!xve(r.shouldUseVirtualFocus)&&zye(s)};vt((()=>{r.deferAutoFocus?setTimeout(c,0):c()})),pt(gt([o,()=>xve(r.isVirtualized),()=>xve(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&&abe(t,e)}})));return{tabIndex:ft((()=>{if(!xve(r.shouldUseVirtualFocus))return null==xve(r.selectionManager).focusedKey()?0:-1})),onKeyDown:e=>{$ye(e,s.onKeyDown),e.altKey&&"Tab"===e.key&&e.preventDefault();const n=t();if(!n?.contains(e.target))return;const o=xve(r.selectionManager),a=xve(r.selectOnFocus),c=t=>{null!=t&&(o.setFocusedKey(t),e.shiftKey&&"multiple"===o.selectionMode()?o.extendSelection(t):a&&!Hbe(e)&&o.replaceSelection(t))},u=xve(r.keyboardDelegate),d=xve(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,qbe(e));null!=t&&(o.setFocusedKey(t),qbe(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,qbe(e));null!=t&&(o.setFocusedKey(t),qbe(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":qbe(e)&&"multiple"===o.selectionMode()&&!0!==xve(r.disallowSelectAll)&&(e.preventDefault(),o.selectAll());break;case"Escape":e.defaultPrevented||(e.preventDefault(),xve(r.disallowEmptySelection)||o.clearSelection());break;case"Tab":if(!xve(r.allowsTabNavigation)){if(e.shiftKey)n.focus();else{const e=function(e,t){const n=t?.tabbable?Wye:Kye,r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>t?.from?.contains(e)?NodeFilter.FILTER_REJECT:e.matches(n)&&Qye(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)&&zye(t)}break}}},onMouseDown:e=>{o()===e.target&&e.preventDefault()},onFocusIn:e=>{const t=xve(r.selectionManager),n=xve(r.keyboardDelegate),i=xve(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(!xve(r.isVirtualized)){const e=o();if(e){e.scrollTop=a.top,e.scrollLeft=a.left;const n=e.querySelector(`[data-key="${t.focusedKey()}"]`);n&&(zye(n),abe(e,n))}}},onFocusOut:e=>{const t=xve(r.selectionManager);e.currentTarget.contains(e.relatedTarget)||t.setFocused(!1)}}}function Ybe(e,t){const n=()=>xve(e.selectionManager),r=()=>xve(e.key),o=()=>xve(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()||qbe(e)||"pointerType"in e&&"touch"===e.pointerType?n().toggleSelection(r()):n().replaceSelection(r()))},a=()=>xve(e.disabled)||n().isDisabled(r()),s=()=>!a()&&n().canSelectItem(r());let l=null;const c=ft((()=>{if(!o()&&!a())return r()===n().focusedKey()?0:-1})),u=ft((()=>xve(e.virtualized)?void 0:r()));return pt(gt([t,r,o,()=>n().focusedKey(),()=>n().isFocused()],(([t,n,r,o,i])=>{t&&n===o&&i&&!r&&document.activeElement!==t&&(e.focus?e.focus():zye(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||xve(e.shouldSelectOnPressUp)||i(t))},onPointerUp:t=>{s()&&"mouse"===t.pointerType&&0===t.button&&xve(e.shouldSelectOnPressUp)&&xve(e.allowsDifferentPressOrigin)&&i(t)},onClick:t=>{s()&&(xve(e.shouldSelectOnPressUp)&&!xve(e.allowsDifferentPressOrigin)||"mouse"!==l)&&i(t)},onKeyDown:e=>{s()&&["Enter"," "].includes(e.key)&&(Hbe(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 Xbe=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 zbe(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 zbe(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 zbe([t],t,t):new zbe;this.state.setSelectedKeys(n)}setSelectedKeys(e){if("none"===this.selectionMode())return;const t=new zbe;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 zbe)}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}},Zbe=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 Qbe,Jbe=e=>"function"==typeof e?e():e,exe=e=>{const t=ft((()=>{const t=Jbe(e.element);if(t)return getComputedStyle(t)})),n=()=>t()?.animationName??"none",[r,o]=ct(Jbe(e.show)?"present":"hidden");let i="none";return pt((r=>{const a=Jbe(e.show);return mt((()=>{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})),pt((()=>{const t=Jbe(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),yt((()=>{t.removeEventListener("animationstart",a),t.removeEventListener("animationcancel",s),t.removeEventListener("animationend",s)}))})),{present:()=>"present"===r()||"hiding"===r(),state:r}},txe="data-kb-top-layer",nxe=!1,rxe=[];function oxe(e){return rxe.findIndex((t=>t.node===e))}function ixe(){return rxe.filter((e=>e.isPointerBlocking))}function axe(){return ixe().length>0}function sxe(e){const t=oxe([...ixe()].slice(-1)[0]?.node);return oxe(e)<t}var lxe={layers:rxe,isTopMostLayer:function(e){return rxe[rxe.length-1].node===e},hasPointerBlockingLayer:axe,isBelowPointerBlockingLayer:sxe,addLayer:function(e){rxe.push(e)},removeLayer:function(e){const t=oxe(e);t<0||rxe.splice(t,1)},indexOf:oxe,find:function(e){return rxe[oxe(e)]},assignPointerEventToLayers:function(){for(const{node:e}of rxe)e.style.pointerEvents=sxe(e)?"none":"auto"},disableBodyPointerEvents:function(e){if(axe()&&!nxe){const t=Mye(e);Qbe=document.body.style.pointerEvents,t.body.style.pointerEvents="none",nxe=!0}},restoreBodyPointerEvents:function(e){if(axe())return;const t=Mye(e);t.body.style.pointerEvents=Qbe,0===t.body.style.length&&t.body.removeAttribute("style"),nxe=!1}};Sbe({},{Button:()=>dxe,Root:()=>uxe});var cxe=["button","color","file","image","reset","submit"];function uxe(e){let t;const n=nbe({type:"button"},e),[r,o]=Yt(n,["ref","type","disabled"]),i=ube((()=>t),(()=>"button")),a=ft((()=>{const e=i();return null!=e&&function(e){const t=e.tagName.toLowerCase();return"button"===t||!("input"!==t||!e.type)&&-1!==cxe.indexOf(e.type)}({tagName:e,type:r.type})})),s=ft((()=>"input"===i())),l=ft((()=>"a"===i()&&null!=t?.getAttribute("href")));return zt(pbe,Wt({as:"button",ref(e){const n=fye((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 dxe=uxe,pxe=["top","right","bottom","left"],fxe=Math.min,hxe=Math.max,mxe=Math.round,gxe=Math.floor,vxe=e=>({x:e,y:e}),yxe={left:"right",right:"left",bottom:"top",top:"bottom"},bxe={start:"end",end:"start"};function xxe(e,t,n){return hxe(e,fxe(t,n))}function wxe(e,t){return"function"==typeof e?e(t):e}function _xe(e){return e.split("-")[0]}function Sxe(e){return e.split("-")[1]}function Exe(e){return"x"===e?"y":"x"}function Txe(e){return"y"===e?"height":"width"}function Cxe(e){return["top","bottom"].includes(_xe(e))?"y":"x"}function Axe(e){return Exe(Cxe(e))}function Nxe(e){return e.replace(/start|end/g,(e=>bxe[e]))}function Rxe(e){return e.replace(/left|right|bottom|top/g,(e=>yxe[e]))}function Oxe(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 Pxe(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 kxe(e,t,n){let{reference:r,floating:o}=e;const i=Cxe(t),a=Axe(t),s=Txe(a),l=_xe(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(Sxe(t)){case"start":f[a]-=p*(n&&c?-1:1);break;case"end":f[a]+=p*(n&&c?-1:1)}return f}async function jxe(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}=wxe(t,e),h=Oxe(f),m=s[p?"floating"===d?"reference":"floating":d],g=Pxe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Pxe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-x.top+h.top)/b.y,bottom:(x.bottom-g.bottom+h.bottom)/b.y,left:(g.left-x.left+h.left)/b.x,right:(x.right-g.right+h.right)/b.x}}function Mxe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Lxe(e){return pxe.some((t=>e[t]>=0))}function Dxe(e){return Uxe(e)?(e.nodeName||"").toLowerCase():"#document"}function Ixe(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Fxe(e){var t;return null==(t=(Uxe(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Uxe(e){return e instanceof Node||e instanceof Ixe(e).Node}function $xe(e){return e instanceof Element||e instanceof Ixe(e).Element}function Vxe(e){return e instanceof HTMLElement||e instanceof Ixe(e).HTMLElement}function Bxe(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Ixe(e).ShadowRoot)}function zxe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Yxe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Hxe(e){return["table","td","th"].includes(Dxe(e))}function qxe(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(ITe){return!1}}))}function Gxe(e){const t=Kxe(),n=$xe(e)?Yxe(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 Kxe(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Wxe(e){return["html","body","#document"].includes(Dxe(e))}function Yxe(e){return Ixe(e).getComputedStyle(e)}function Xxe(e){return $xe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zxe(e){if("html"===Dxe(e))return e;const t=e.assignedSlot||e.parentNode||Bxe(e)&&e.host||Fxe(e);return Bxe(t)?t.host:t}function Qxe(e){const t=Zxe(e);return Wxe(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vxe(t)&&zxe(t)?t:Qxe(t)}function Jxe(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Qxe(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=Ixe(o);return i?t.concat(a,a.visualViewport||[],zxe(o)?o:[],a.frameElement&&n?Jxe(a.frameElement):[]):t.concat(o,Jxe(o,[],n))}function ewe(e){const t=Yxe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Vxe(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=mxe(n)!==i||mxe(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function twe(e){return $xe(e)?e:e.contextElement}function nwe(e){const t=twe(e);if(!Vxe(t))return vxe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ewe(t);let a=(i?mxe(n.width):n.width)/r,s=(i?mxe(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}var rwe=vxe(0);function owe(e){const t=Ixe(e);return Kxe()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:rwe}function iwe(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=twe(e);let a=vxe(1);t&&(r?$xe(r)&&(a=nwe(r)):a=nwe(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Ixe(e))&&t}(i,n,r)?owe(i):vxe(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=Ixe(i),t=r&&$xe(r)?Ixe(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=nwe(o),t=o.getBoundingClientRect(),r=Yxe(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=Ixe(o),o=n.frameElement}}return Pxe({width:u,height:d,x:l,y:c})}function awe(e){return iwe(Fxe(e)).left+Xxe(e).scrollLeft}function swe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Ixe(e),r=Fxe(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=Kxe();(!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=Fxe(e),n=Xxe(e),r=e.ownerDocument.body,o=hxe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=hxe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+awe(e);const s=-n.scrollTop;return"rtl"===Yxe(r).direction&&(a+=hxe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Fxe(e));else if($xe(t))r=function(e,t){const n=iwe(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Vxe(e)?nwe(e):vxe(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=owe(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Pxe(r)}function lwe(e,t){const n=Zxe(e);return!(n===t||!$xe(n)||Wxe(n))&&("fixed"===Yxe(n).position||lwe(n,t))}function cwe(e,t,n){const r=Vxe(t),o=Fxe(t),i="fixed"===n,a=iwe(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=vxe(0);if(r||!r&&!i)if(("body"!==Dxe(t)||zxe(o))&&(s=Xxe(t)),r){const e=iwe(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=awe(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function uwe(e){return"static"===Yxe(e).position}function dwe(e,t){return Vxe(e)&&"fixed"!==Yxe(e).position?t?t(e):e.offsetParent:null}function pwe(e,t){const n=Ixe(e);if(qxe(e))return n;if(!Vxe(e)){let t=Zxe(e);for(;t&&!Wxe(t);){if($xe(t)&&!uwe(t))return t;t=Zxe(t)}return n}let r=dwe(e,t);for(;r&&Hxe(r)&&uwe(r);)r=dwe(r,t);return r&&Wxe(r)&&uwe(r)&&!Gxe(r)?n:r||function(e){let t=Zxe(e);for(;Vxe(t)&&!Wxe(t);){if(Gxe(t))return t;if(qxe(t))return null;t=Zxe(t)}return null}(e)||n}var fwe={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Fxe(r),s=!!t&&qxe(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=vxe(1);const u=vxe(0),d=Vxe(r);if((d||!d&&!i)&&(("body"!==Dxe(r)||zxe(a))&&(l=Xxe(r)),Vxe(r))){const e=iwe(r);c=nwe(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:Fxe,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?qxe(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=Jxe(e,[],!1).filter((e=>$xe(e)&&"body"!==Dxe(e))),o=null;const i="fixed"===Yxe(e).position;let a=i?Zxe(e):e;for(;$xe(a)&&!Wxe(a);){const t=Yxe(a),n=Gxe(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||zxe(a)&&!n&&lwe(e,a))?r=r.filter((e=>e!==a)):o=t,a=Zxe(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i.reduce(((e,n)=>{const r=swe(t,n,o);return e.top=hxe(r.top,e.top),e.right=fxe(r.right,e.right),e.bottom=fxe(r.bottom,e.bottom),e.left=hxe(r.left,e.left),e}),swe(t,i[0],o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:pwe,getElementRects:async function(e){const t=this.getOffsetParent||pwe,n=this.getDimensions,r=await n(e.floating);return{reference:cwe(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}=ewe(e);return{width:t,height:n}},getScale:nwe,isElement:$xe,isRTL:function(e){return"rtl"===Yxe(e).direction}};function hwe(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=twe(e),u=o||i?[...c?Jxe(c):[],...Jxe(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=Fxe(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:-gxe(u)+"px "+-gxe(o.clientWidth-(c+d))+"px "+-gxe(o.clientHeight-(u+p))+"px "+-gxe(c)+"px",threshold:hxe(0,fxe(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(ITe){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?iwe(e):null;return l&&function t(){const r=iwe(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 mwe=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=_xe(n),s=Sxe(n),l="y"===Cxe(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,d=wxe(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}}}}},gwe=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}=wxe(e,t),c={x:n,y:r},u=await jxe(t,l),d=Cxe(_xe(o)),p=Exe(d);let f=c[p],h=c[d];if(i){f=xxe(f+u["y"===p?"top":"left"],f,f-u["y"===p?"bottom":"right"])}if(a){h=xxe(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}}}}},vwe=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}=wxe(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=_xe(o),y=Cxe(s),b=_xe(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(b||!m?[Rxe(s)]:function(e){const t=Rxe(e);return[Nxe(e),t,Nxe(t)]}(s)),_="none"!==h;!p&&_&&w.push(...function(e,t,n,r){const o=Sxe(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[]}}(_xe(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Nxe)))),i}(s,m,h,x));const S=[s,...w],E=await jxe(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=Sxe(e),o=Axe(e),i=Txe(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Rxe(a)),[a,Rxe(a)]}(o,a,x);T.push(E[e[0]],E[e[1]])}if(C=[...C,{placement:o,overflows:T}],!T.every((e=>e<=0))){var A,N;const e=((null==(A=i.flip)?void 0:A.index)||0)+1,t=S[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(N=C.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(f){case"bestFit":{var R;const e=null==(R=C.filter((e=>{if(_){const t=Cxe(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:R[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},ywe=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}=wxe(e,t),l=await jxe(t,s),c=_xe(n),u=Sxe(n),d="y"===Cxe(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=fxe(f-l[h],g),b=fxe(p-l[m],v),x=!t.middlewareData.shift;let w=y,_=b;if(d?_=u||x?fxe(b,v):v:w=u||x?fxe(y,g):g,x&&!u){const e=hxe(l.left,0),t=hxe(l.right,0),n=hxe(l.top,0),r=hxe(l.bottom,0);d?_=p-2*(0!==e||0!==t?e+t:hxe(l.left,l.right)):w=f-2*(0!==n||0!==r?n+r:hxe(l.top,l.bottom))}await a({...t,availableWidth:_,availableHeight:w});const S=await o.getDimensions(i.floating);return p!==S.width||f!==S.height?{reset:{rects:!0}}:{}}}},bwe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=wxe(e,t);switch(r){case"referenceHidden":{const e=Mxe(await jxe(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Lxe(e)}}}case"escaped":{const e=Mxe(await jxe(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Lxe(e)}}}default:return{}}}}},xwe=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}=wxe(e,t)||{};if(null==c)return{};const d=Oxe(u),p={x:n,y:r},f=Axe(o),h=Txe(f),m=await a.getDimensions(c),g="y"===f,v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],w=p[f]-i.reference[f],_=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c));let S=_?_[b]:0;S&&await(null==a.isElement?void 0:a.isElement(_))||(S=s.floating[b]||i.floating[h]);const E=x/2-w/2,T=S/2-m[h]/2-1,C=fxe(d[v],T),A=fxe(d[y],T),N=C,R=S-m[h]-A,O=S/2-m[h]/2+E,P=xxe(N,O,R),k=!l.arrow&&null!=Sxe(o)&&O!==P&&i.reference[h]/2-(O<N?C:A)-m[h]/2<0,j=k?O<N?O-N:O-R:0;return{[f]:p[f]+j,data:{[f]:P,centerOffset:O-P-j,...k&&{alignmentOffset:j}},reset:k}}}),wwe=(e,t,n)=>{const r={platform:fwe,...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}=kxe(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}=kxe(c,p,l))),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:f}})(e,t,{...r,platform:o})},_we=St();function Swe(){const e=Et(_we);if(void 0===e)throw new Error("[kobalte]: `usePopperContext` must be used within a `Popper` component");return e}var Ewe=mn('<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">'),Twe={top:180,right:-90,bottom:0,left:90};function Cwe(e){const t=Swe(),n=nbe({size:30},e),[r,o]=Yt(n,["ref","style","size"]),i=()=>t.currentPlacement().split("-")[0],a=function(e){const[t,n]=ct();return pt((()=>{const t=e();var r;t&&n((r=t,Mye(r).defaultView||window).getComputedStyle(t))})),t}(t.contentRef),s=()=>2*Number.parseInt(a()?.getPropertyValue(`border-${i()}-width`)||"0px")*(30/r.size);return zt(pbe,Wt({as:"div",ref(e){const n=fye(t.setArrowRef,r.ref);"function"==typeof n&&n(e)},"aria-hidden":"true",get style(){return Nye({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=Ewe(),t=e.firstChild;return dt((()=>vn(t,"transform",`rotate(${Twe[i()]} 15 15) translate(0 2)`))),e}}))}function Awe(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 Nwe(e){return/^(?:top|bottom|left|right)(?:-(?:start|end))?$/.test(e)}var Rwe={top:"bottom",right:"left",bottom:"top",left:"right"};var Owe=Object.assign((function(e){const t=nbe({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]=ct(),[o,i]=ct(),[a,s]=ct(t.placement),l=()=>{return e=t.anchorRef?.(),n=t.getAnchorRect,{contextElement:e,getBoundingClientRect:()=>{const t=n(e);return t?Awe(t):e?e.getBoundingClientRect():Awe()}};var e,n},{direction:c}=Vbe();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=[mwe((({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(Nwe))throw new Error("`flip` expects a spaced-delimited list of placements");d.push(vwe({padding:t.overflowPadding,fallbackPlacements:e}))}(t.slide||t.overlap)&&d.push(gwe({mainAxis:t.slide,crossAxis:t.overlap,padding:t.overflowPadding})),d.push(ywe({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(bwe({padding:t.detachedPadding})),i&&d.push(xwe({element:i,padding:t.arrowPadding}));const p=await wwe(e,r,{placement:t.placement,strategy:"absolute",middleware:d,platform:{...fwe,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=Rwe[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 pt((()=>{const e=l(),t=n();if(!e||!t)return;yt(hwe(e,t,u,{elementResize:"function"==typeof ResizeObserver}))})),pt((()=>{const e=n(),r=t.contentRef?.();e&&r&&queueMicrotask((()=>{e.style.zIndex=getComputedStyle(r).zIndex}))})),zt(_we.Provider,{value:{currentPlacement:a,contentRef:()=>t.contentRef?.(),setPositionerRef:r,setArrowRef:i},get children(){return t.children}})}),{Arrow:Cwe,Context:_we,usePopperContext:Swe,Positioner:function(e){const t=Swe(),[n,r]=Yt(e,["ref","style"]);return zt(pbe,Wt({as:"div",ref(e){const r=fye(t.setPositionerRef,n.ref);"function"==typeof r&&r(e)},"data-popper-positioner":"",get style(){return Nye({position:"absolute",top:0,left:0,"min-width":"max-content"},n.style)}},r))}});var Pwe="interactOutside.pointerDownOutside",kwe="interactOutside.focusOutside";var jwe=St();function Mwe(e){let t;const n=Et(jwe),[r,o]=Yt(e,["ref","disableOutsidePointerEvents","excludedElements","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","bypassTopMostLayerCheck"]),i=new Set([]);!function(e,t){let n,r=tbe;const o=()=>Mye(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(`[${txe}]`)&&!!kye(o(),r)&&!kye(t(),r)&&!e.shouldExcludeElement?.(r)},c=e=>{function n(){const n=t(),r=e.target;if(!n||!r||!l(e))return;const o=Vye([i,s]);r.addEventListener(Pwe,o,{once:!0});const a=new CustomEvent(Pwe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:2===e.button||Bye(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=Vye([a,s]);r.addEventListener(kwe,o,{once:!0});const i=new CustomEvent(kwe,{bubbles:!1,cancelable:!0,detail:{originalEvent:e,isContextMenu:!1}});r.dispatchEvent(i)};pt((()=>{xve(e.isDisabled)||(n=window.setTimeout((()=>{o().addEventListener("pointerdown",c,!0)}),0),o().addEventListener("focusin",u,!0),yt((()=>{window.clearTimeout(n),o().removeEventListener("click",r),o().removeEventListener("pointerdown",c,!0),o().removeEventListener("focusin",u,!0)})))}))}({shouldExcludeElement:e=>!!t&&(r.excludedElements?.some((t=>kye(t(),e)))||[...i].some((t=>kye(t,e)))),onPointerDownOutside:e=>{t&&!lxe.isBelowPointerBlockingLayer(t)&&(r.bypassTopMostLayerCheck||lxe.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===Dye.Escape&&e.onEscapeKeyDown?.(t)};pt((()=>{if(xve(e.isDisabled))return;const n=e.ownerDocument?.()??Mye();n.addEventListener("keydown",t),yt((()=>{n.removeEventListener("keydown",t)}))}))}({ownerDocument:()=>Mye(t),onEscapeKeyDown:e=>{t&&lxe.isTopMostLayer(t)&&(r.onEscapeKeyDown?.(e),!e.defaultPrevented&&r.onDismiss&&(e.preventDefault(),r.onDismiss()))}}),vt((()=>{if(!t)return;lxe.addLayer({node:t,isPointerBlocking:r.disableOutsidePointerEvents,dismiss:r.onDismiss});const e=n?.registerNestedLayer(t);lxe.assignPointerEventToLayers(),lxe.disableBodyPointerEvents(t),yt((()=>{t&&(lxe.removeLayer(t),e?.(),lxe.assignPointerEventToLayers(),lxe.restoreBodyPointerEvents(t))}))})),pt(gt([()=>t,()=>r.disableOutsidePointerEvents],(([e,t])=>{if(!e)return;const n=lxe.find(e);n&&n.isPointerBlocking!==t&&(n.isPointerBlocking=t,lxe.assignPointerEventToLayers()),t&&lxe.disableBodyPointerEvents(e),yt((()=>{lxe.restoreBodyPointerEvents(e)}))}),{defer:!0}));return zt(jwe.Provider,{value:{registerNestedLayer:e=>{i.add(e);const t=n?.registerNestedLayer(e);return()=>{i.delete(e),t?.()}}},get children(){return zt(pbe,Wt({as:"div",ref(e){const n=fye((e=>t=e),r.ref);"function"==typeof n&&n(e)}},o))}})}function Lwe(e={}){const[t,n]=wbe({value:()=>xve(e.open),defaultValue:()=>!!xve(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 Dwe={};Sbe(Dwe,{Description:()=>gbe,ErrorMessage:()=>vbe,Item:()=>Vwe,ItemControl:()=>Bwe,ItemDescription:()=>zwe,ItemIndicator:()=>Hwe,ItemInput:()=>qwe,ItemLabel:()=>Gwe,Label:()=>Kwe,RadioGroup:()=>Ywe,Root:()=>Wwe});var Iwe=St();function Fwe(){const e=Et(Iwe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");return e}var Uwe=St();function $we(){const e=Et(Uwe);if(void 0===e)throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");return e}function Vwe(e){const t=mbe(),n=Fwe(),r=nbe({id:`${t.generateId("item")}-${Qt()}`},e),[o,i]=Yt(r,["value","disabled","onPointerDown"]),[a,s]=ct(),[l,c]=ct(),[u,d]=ct(),[p,f]=ct(),[h,m]=ct(!1),g=ft((()=>n.isSelectedValue(o.value))),v=ft((()=>o.disabled||t.isDisabled()||!1)),y=e=>{$ye(e,o.onPointerDown),h()&&e.preventDefault()},b=ft((()=>({...t.dataset(),"data-disabled":v()?"":void 0,"data-checked":g()?"":void 0}))),x={value:()=>o.value,dataset:b,isSelected:g,isDisabled:v,inputId:a,labelId:l,descriptionId:u,inputRef:p,select:()=>n.setSelectedValue(o.value),generateId:Pye((()=>i.id)),registerInput:cbe(s),registerLabel:cbe(c),registerDescription:cbe(d),setIsFocused:m,setInputRef:f};return zt(Uwe.Provider,{value:x,get children(){return zt(pbe,Wt({as:"div",role:"group",onPointerDown:y},b,i))}})}function Bwe(e){const t=$we(),n=nbe({id:t.generateId("control")},e),[r,o]=Yt(n,["onClick","onKeyDown"]);return zt(pbe,Wt({as:"div",onClick:e=>{$ye(e,r.onClick),t.select(),t.inputRef()?.focus()},onKeyDown:e=>{$ye(e,r.onKeyDown),e.key===Dye.Space&&(t.select(),t.inputRef()?.focus())}},(()=>t.dataset()),o))}function zwe(e){const t=$we(),n=nbe({id:t.generateId("description")},e);return pt((()=>yt(t.registerDescription(n.id)))),zt(pbe,Wt({as:"div"},(()=>t.dataset()),n))}function Hwe(e){const t=$we(),n=nbe({id:t.generateId("indicator")},e),[r,o]=Yt(n,["ref","forceMount"]),[i,a]=ct(),{present:s}=exe({show:()=>r.forceMount||t.isSelected(),element:()=>i()??null});return zt(nn,{get when(){return s()},get children(){return zt(pbe,Wt({as:"div",ref(e){const t=fye(a,r.ref);"function"==typeof t&&t(e)}},(()=>t.dataset()),o))}})}function qwe(e){const t=mbe(),n=Fwe(),r=$we(),o=nbe({id:r.generateId("input")},e),[i,a]=Yt(o,["ref","style","aria-labelledby","aria-describedby","onChange","onFocus","onBlur"]),[s,l]=ct(!1);return pt(gt([()=>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})),pt((()=>yt(r.registerInput(a.id)))),zt(pbe,Wt({as:"input",ref(e){const t=fye(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 Nye({...lbe},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($ye(e,i.onChange),e.stopPropagation(),!s()){n.setSelectedValue(r.value());e.target.checked=r.isSelected()}l(!1)},onFocus:e=>{$ye(e,i.onFocus),r.setIsFocused(!0)},onBlur:e=>{$ye(e,i.onBlur),r.setIsFocused(!1)}},(()=>r.dataset()),a))}function Gwe(e){const t=$we(),n=nbe({id:t.generateId("label")},e);return pt((()=>yt(t.registerLabel(n.id)))),zt(pbe,Wt({as:"label",get for(){return t.inputId()}},(()=>t.dataset()),n))}function Kwe(e){return zt(ybe,Wt({as:"span"},e))}function Wwe(e){let t;const n=nbe({id:`radiogroup-${Qt()}`,orientation:"vertical"},e),[r,o,i]=Yt(n,["ref","value","defaultValue","onChange","orientation","aria-labelledby","aria-describedby"],fbe),[a,s]=xbe({value:()=>r.value,defaultValue:()=>r.defaultValue,onChange:e=>r.onChange?.(e)}),{formControlContext:l}=function(e){const t=nbe({id:`form-control-${Qt()}`},e),[n,r]=ct(),[o,i]=ct(),[a,s]=ct(),[l,c]=ct();return{formControlContext:{name:()=>xve(t.name)??xve(t.id),dataset:ft((()=>({"data-valid":"valid"===xve(t.validationState)?"":void 0,"data-invalid":"invalid"===xve(t.validationState)?"":void 0,"data-required":xve(t.required)?"":void 0,"data-disabled":xve(t.disabled)?"":void 0,"data-readonly":xve(t.readOnly)?"":void 0}))),validationState:()=>xve(t.validationState),isRequired:()=>xve(t.required),isDisabled:()=>xve(t.disabled),isReadOnly:()=>xve(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:Pye((()=>xve(t.id))),registerLabel:cbe(r),registerField:cbe(i),registerDescription:cbe(s),registerErrorMessage:cbe(c)}}}(o);bbe((()=>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 zt(hbe.Provider,{value:l,get children(){return zt(Iwe.Provider,{value:d,get children(){return zt(pbe,Wt({as:"div",ref(e){const n=fye((e=>t=e),r.ref);"function"==typeof n&&n(e)},role:"radiogroup",get id(){return xve(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(xve(o.id),i["aria-label"],r["aria-labelledby"])},get"aria-describedby"(){return c()}},(()=>l.dataset()),i))}})}})}var Ywe=Object.assign(Wwe,{Description:gbe,ErrorMessage:vbe,Item:Vwe,ItemControl:Bwe,ItemDescription:zwe,ItemIndicator:Hwe,ItemInput:qwe,ItemLabel:Gwe,Label:Kwe}),Xwe=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 Zwe(e,t,n){const r=function(e){const{locale:t}=Vbe(),n=ft((()=>t()+(e?Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1)).join():"")));return ft((()=>{const r=n();let o;return Bbe.has(r)&&(o=Bbe.get(r)),o||(o=new Intl.Collator(t(),e),Bbe.set(r,o)),o}))}({usage:"search",sensitivity:"base"});return Wbe({selectionManager:()=>xve(e.selectionManager),keyboardDelegate:ft((()=>{const n=xve(e.keyboardDelegate);return n||new Xwe(e.collection,t,r)})),autoFocus:()=>xve(e.autoFocus),deferAutoFocus:()=>xve(e.deferAutoFocus),shouldFocusWrap:()=>xve(e.shouldFocusWrap),disallowEmptySelection:()=>xve(e.disallowEmptySelection),selectOnFocus:()=>xve(e.selectOnFocus),disallowTypeAhead:()=>xve(e.disallowTypeAhead),shouldUseVirtualFocus:()=>xve(e.shouldUseVirtualFocus),allowsTabNavigation:()=>xve(e.allowsTabNavigation),isVirtualized:()=>xve(e.isVirtualized),scrollToKey:t=>xve(e.scrollToKey)?.(t),orientation:()=>xve(e.orientation)},t)}var Qwe="focusScope.autoFocusOnMount",Jwe="focusScope.autoFocusOnUnmount",e_e={bubbles:!1,cancelable:!0},t_e={stack:[],active(){return this.stack[0]},add(e){e!==this.active()&&this.active()?.pause(),this.stack=Rye(this.stack,e),this.stack.unshift(e)},remove(e){this.stack=Rye(this.stack,e),this.active()?.resume()}};function n_e(e,t){const[n,r]=ct(!1),o={pause(){r(!0)},resume(){r(!1)}};let i=null;const a=t=>e.onMountAutoFocus?.(t),s=t=>e.onUnmountAutoFocus?.(t),l=()=>Mye(t()),c=()=>{const e=l().createElement("span");return e.setAttribute("data-focus-trap",""),e.tabIndex=0,Object.assign(e.style,lbe),e},u=()=>{const e=t();return e?Yye(e,!0).filter((e=>!e.hasAttribute("data-focus-trap"))):[]},d=()=>{const e=u();return e.length>0?e[0]:null};pt((()=>{const e=t();if(!e)return;t_e.add(o);const n=jye(e);if(!kye(e,n)){const t=new CustomEvent(Qwe,e_e);e.addEventListener(Qwe,a),e.dispatchEvent(t),t.defaultPrevented||setTimeout((()=>{zye(d()),jye(e)===n&&zye(e)}),0)}yt((()=>{e.removeEventListener(Qwe,a),setTimeout((()=>{const r=new CustomEvent(Jwe,e_e);(()=>{const e=t();if(!e)return!1;const n=jye(e);return!!n&&!kye(e,n)&&Zye(n)})()&&r.preventDefault(),e.addEventListener(Jwe,s),e.dispatchEvent(r),r.defaultPrevented||zye(n??l().body),e.removeEventListener(Jwe,s),t_e.remove(o)}),0)}))})),pt((()=>{const r=t();if(!r||!xve(e.trapFocus)||n())return;const o=e=>{const t=e.target;t?.closest(`[${txe}]`)||(kye(r,t)?i=t:zye(i))},a=e=>{const t=e.relatedTarget??jye(r);t?.closest(`[${txe}]`)||kye(r,t)||zye(i)};l().addEventListener("focusin",o),l().addEventListener("focusout",a),yt((()=>{l().removeEventListener("focusin",o),l().removeEventListener("focusout",a)}))})),pt((()=>{const r=t();if(!r||!xve(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})();zye(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}),yt((()=>{o.removeEventListener("focusin",a),i.removeEventListener("focusin",a),o.remove(),i.remove(),s.disconnect()}))}))}var r_e="data-live-announcer";function o_e(e){pt((()=>{xve(e.isDisabled)||yt(function(e,t=document.body){const n=new Set(e),r=new Set,o=e=>{for(const r of e.querySelectorAll(`[${r_e}], [${txe}]`))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=i_e.get(e)??0;"true"===e.getAttribute("aria-hidden")&&0===t||(0===t&&e.setAttribute("aria-hidden","true"),r.add(e),i_e.set(e,t+1))};a_e.length&&a_e[a_e.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 a_e.push(s),()=>{a.disconnect();for(const e of r){const t=i_e.get(e);if(null==t)return;1===t?(e.removeAttribute("aria-hidden"),i_e.delete(e)):i_e.set(e,t-1)}s===a_e[a_e.length-1]?(a_e.pop(),a_e.length&&a_e[a_e.length-1].observe()):a_e.splice(a_e.indexOf(s),1)}}(xve(e.targets),xve(e.root)))}))}var i_e=new WeakMap,a_e=[];var s_e=new Map,l_e=e=>{pt((()=>{const t=Jbe(e.style)??{},n=Jbe(e.properties)??[],r={};for(const i in t)r[i]=e.element.style[i];const o=s_e.get(e.key);o?o.activeCount++:s_e.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);yt((()=>{const t=s_e.get(e.key);if(t)if(1===t.activeCount){s_e.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--}))}))},c_e=(e,t)=>{switch(t){case"x":return[e.clientWidth,e.scrollLeft,e.scrollWidth];case"y":return[e.clientHeight,e.scrollTop,e.scrollHeight]}},u_e=(e,t)=>{const n=getComputedStyle(e),r="x"===t?n.overflowX:n.overflowY;return"auto"===r||"scroll"===r||"HTML"===e.tagName&&"visible"===r},[d_e,p_e]=ct([]),f_e=e=>[e.deltaX,e.deltaY],h_e=e=>e.changedTouches[0]?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0],m_e=(e,t,n,r)=>{const o=null!==r&&g_e(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]=c_e(o,t),u=c-e-r*l;0===l&&0===u||!u_e(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)},g_e=(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},v_e=e=>{const t=Wt({element:null,enabled:!0,hideScrollbar:!0,preventScrollbarShift:!0,preventScrollbarShiftMode:"padding",restoreScrollPosition:!0,allowPinchZoom:!1},e),n=Qt();let r=[0,0],o=null,i=null;pt((()=>{Jbe(t.enabled)&&(p_e((e=>[...e,n])),yt((()=>{p_e((e=>e.filter((e=>e!==n))))})))})),pt((()=>{if(!Jbe(t.enabled)||!Jbe(t.hideScrollbar))return;const{body:e}=document,n=window.innerWidth-e.offsetWidth;if(Jbe(t.preventScrollbarShift)){const r={overflow:"hidden"},o=[];n>0&&("padding"===Jbe(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;l_e({key:"prevent-scroll",element:e,style:r,properties:o,cleanup:()=>{Jbe(t.restoreScrollPosition)&&n>0&&window.scrollTo(a,i)}})}else l_e({key:"prevent-scroll",element:e,style:{overflow:"hidden"}})})),pt((()=>{var e;(e=n,d_e().indexOf(e)===d_e().length-1&&Jbe(t.enabled))&&(document.addEventListener("wheel",s,{passive:!1}),document.addEventListener("touchstart",a,{passive:!1}),document.addEventListener("touchmove",l,{passive:!1}),yt((()=>{document.removeEventListener("wheel",s),document.removeEventListener("touchstart",a),document.removeEventListener("touchmove",l)})))}));const a=e=>{r=h_e(e),o=null,i=null},s=e=>{const n=e.target,r=Jbe(t.element),o=f_e(e),i=Math.abs(o[0])>Math.abs(o[1])?"x":"y",a=m_e(n,i,"x"===i?o[0]:o[1],r);let s;s=!r||!g_e(r,n)||!a,s&&e.cancelable&&e.preventDefault()},l=e=>{const n=Jbe(t.element),a=e.target;let s;if(2===e.touches.length)s=!Jbe(t.allowPinchZoom);else{if(null==o||null===i){const t=h_e(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=m_e(a,o,i,n);s=!n||!g_e(n,a)||!e}}s&&e.cancelable&&e.preventDefault()}},y_e=St();function b_e(){return Et(y_e)}function x_e(){const e=b_e();if(void 0===e)throw new Error("[kobalte]: `useMenuContext` must be used within a `Menu` component");return e}var w_e=St();function __e(){const e=Et(w_e);if(void 0===e)throw new Error("[kobalte]: `useMenuItemContext` must be used within a `Menu.Item` component");return e}var S_e=St();function E_e(){const e=Et(S_e);if(void 0===e)throw new Error("[kobalte]: `useMenuRootContext` must be used within a `MenuRoot` component");return e}function T_e(e){let t;const n=E_e(),r=x_e(),o=nbe({id:n.generateId(`item-${Qt()}`)},e),[i,a]=Yt(o,["ref","textValue","disabled","closeOnSelect","checked","indeterminate","onSelect","onPointerMove","onPointerLeave","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]),[s,l]=ct(),[c,u]=ct(),[d,p]=ct(),f=()=>r.listState().selectionManager(),h=()=>a.id,m=()=>{i.onSelect?.(),i.closeOnSelect&&setTimeout((()=>{r.close(!0)}))};Obe({getItem:()=>({ref:()=>t,type:"item",key:h(),textValue:i.textValue??d()?.textContent??t?.textContent??"",disabled:i.disabled??!1})});const g=Ybe({key:h,selectionManager:f,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),v=e=>{$ye(e,i.onPointerMove),"mouse"===e.pointerType&&(i.disabled?r.onItemLeave(e):(r.onItemEnter(e),e.defaultPrevented||(zye(e.currentTarget),r.listState().selectionManager().setFocused(!0),r.listState().selectionManager().setFocusedKey(h()))))},y=e=>{$ye(e,i.onPointerLeave),"mouse"===e.pointerType&&r.onItemLeave(e)},b=e=>{$ye(e,i.onPointerUp),i.disabled||0!==e.button||m()},x=e=>{if($ye(e,i.onKeyDown),!e.repeat&&!i.disabled)switch(e.key){case"Enter":case" ":m()}},w=ft((()=>i.indeterminate?"mixed":null!=i.checked?i.checked:void 0)),_=ft((()=>({"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:Pye((()=>a.id)),registerLabel:cbe(l),registerDescription:cbe(u)};return zt(w_e.Provider,{value:S,get children(){return zt(pbe,Wt({as:"div",ref(e){const n=fye((e=>t=e),i.ref);"function"==typeof n&&n(e)},get tabIndex(){return g.tabIndex()},get"aria-checked"(){return w()},get"aria-disabled"(){return i.disabled},get"aria-labelledby"(){return s()},get"aria-describedby"(){return c()},get"data-key"(){return g.dataKey()},get onPointerDown(){return Vye([i.onPointerDown,g.onPointerDown])},get onPointerUp(){return Vye([b,g.onPointerUp])},get onClick(){return Vye([i.onClick,g.onClick])},get onKeyDown(){return Vye([x,g.onKeyDown])},get onMouseDown(){return Vye([i.onMouseDown,g.onMouseDown])},get onFocus(){return Vye([i.onFocus,g.onFocus])},onPointerMove:v,onPointerLeave:y},_,a))}})}function C_e(e){const t=nbe({closeOnSelect:!1},e),[n,r]=Yt(t,["checked","defaultChecked","onChange","onSelect"]),o=function(e={}){const[t,n]=wbe({value:()=>xve(e.isSelected),defaultValue:()=>!!xve(e.defaultIsSelected),onChange:t=>e.onSelectedChange?.(t)});return{isSelected:t,setIsSelected:t=>{xve(e.isReadOnly)||xve(e.isDisabled)||n(t)},toggle:()=>{xve(e.isReadOnly)||xve(e.isDisabled)||n(!t())}}}({isSelected:()=>n.checked,defaultIsSelected:()=>n.defaultChecked,onSelectedChange:e=>n.onChange?.(e),isDisabled:()=>r.disabled});return zt(T_e,Wt({role:"menuitemcheckbox",get checked(){return o.isSelected()},onSelect:()=>{n.onSelect?.(),o.toggle()}},r))}var A_e=St();function N_e(){return Et(A_e)}var R_e={next:(e,t)=>"ltr"===e?"horizontal"===t?"ArrowRight":"ArrowDown":"horizontal"===t?"ArrowLeft":"ArrowUp",previous:(e,t)=>R_e.next("ltr"===e?"rtl":"ltr",t)},O_e=e=>"horizontal"===e?"ArrowDown":"ArrowRight",P_e=e=>"horizontal"===e?"ArrowUp":"ArrowLeft";function k_e(e){const t=E_e(),n=x_e(),r=N_e(),{direction:o}=Vbe(),i=nbe({id:t.generateId("trigger")},e),[a,s]=Yt(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=ube((()=>n.triggerRef()),(()=>"button")),u=ft((()=>"a"===c()&&null!=n.triggerRef()?.getAttribute("href")));pt(gt((()=>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 pt((()=>yt(n.registerTriggerId(a.id)))),zt(uxe,Wt({ref(e){const t=fye(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 ft((()=>!!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=>{$ye(e,a.onPointerDown),e.currentTarget.dataset.pointerType=e.pointerType,a.disabled||"touch"===e.pointerType||0!==e.button||d()},onMouseOver:e=>{$ye(e,a.onMouseOver),"touch"!==n.triggerRef()?.dataset.pointerType&&(a.disabled||void 0===r||void 0===r.value()||r.setValue(l))},onClick:e=>{$ye(e,a.onClick),a.disabled||"touch"===e.currentTarget.dataset.pointerType&&d()},onKeyDown:e=>{if($ye(e,a.onKeyDown),!a.disabled){if(u())switch(e.key){case"Enter":case" ":return}switch(e.key){case"Enter":case" ":case O_e(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=Jye(e);for(;e&&n&&e!==t&&n!==t;)abe(n,e),n=Jye(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 P_e(t.orientation()):e.stopPropagation(),e.preventDefault(),n.open("last");break;case R_e.next(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.nextMenu();break;case R_e.previous(o(),t.orientation()):if(void 0===r)break;e.stopPropagation(),e.preventDefault(),r.previousMenu()}}},onFocus:e=>{$ye(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 j_e=St();function M_e(){return Et(j_e)}function L_e(e){let t;const n=E_e(),r=x_e(),o=N_e(),i=M_e(),{direction:a}=Vbe(),s=nbe({id:n.generateId(`content-${Qt()}`)},e),[l,c]=Yt(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=Zwe({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));n_e({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()};pt((()=>yt(r.registerContentId(l.id))));const m={ref:fye((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:Vye([l.onKeyDown,p.onKeyDown,e=>{if(kye(e.currentTarget,e.target)&&("Tab"===e.key&&r.isOpen()&&e.preventDefault(),void 0!==o&&"true"!==e.currentTarget.getAttribute("aria-haspopup")))switch(e.key){case R_e.next(a(),n.orientation()):e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.nextMenu();break;case R_e.previous(a(),n.orientation()):if(e.currentTarget.hasAttribute("data-closed"))break;e.stopPropagation(),e.preventDefault(),r.close(!0),o.setAutoFocusMenu(!0),o.previousMenu()}}]),onMouseDown:Vye([l.onMouseDown,p.onMouseDown]),onFocusIn:Vye([l.onFocusIn,p.onFocusIn]),onFocusOut:Vye([l.onFocusOut,p.onFocusOut]),onPointerEnter:e=>{$ye(e,l.onPointerEnter),r.isOpen()&&(r.parentMenuContext()?.listState().selectionManager().setFocused(!1),r.parentMenuContext()?.listState().selectionManager().setFocusedKey(void 0))},onPointerMove:e=>{if($ye(e,l.onPointerMove),"mouse"!==e.pointerType)return;const t=u!==e.clientX;kye(e.currentTarget,e.target)&&t&&(r.setPointerDir(e.clientX>u?"right":"left"),u=e.clientX)},get"data-orientation"(){return n.orientation()}};return zt(nn,{get when(){return r.contentPresent()},get children(){return zt(nn,{get when(){return void 0===i||null!=r.parentMenuContext()},get fallback(){return zt(pbe,Wt({as:"div"},(()=>r.dataset()),m,c))},get children(){return zt(Owe.Positioner,{get children(){return zt(Mwe,Wt({get disableOutsidePointerEvents(){return ft((()=>!!d()))()&&r.isOpen()},get excludedElements(){return[r.triggerRef]},bypassTopMostLayerCheck:!0,get style(){return Nye({"--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 D_e(e){let t;const n=E_e(),r=x_e(),[o,i]=Yt(e,["ref"]);return v_e({element:()=>t??null,enabled:()=>r.contentPresent()&&n.preventScroll()}),zt(L_e,Wt({ref(e){const n=fye((e=>{t=e}),o.ref);"function"==typeof n&&n(e)}},i))}var I_e=St();function F_e(e){const t=nbe({id:E_e().generateId(`group-${Qt()}`)},e),[n,r]=ct(),o={generateId:Pye((()=>t.id)),registerLabelId:cbe(r)};return zt(I_e.Provider,{value:o,get children(){return zt(pbe,Wt({as:"div",role:"group",get"aria-labelledby"(){return n()}},t))}})}function U_e(e){const t=function(){const e=Et(I_e);if(void 0===e)throw new Error("[kobalte]: `useMenuGroupContext` must be used within a `Menu.Group` component");return e}(),n=nbe({id:t.generateId("label")},e),[r,o]=Yt(n,["id"]);return pt((()=>yt(t.registerLabelId(r.id)))),zt(pbe,Wt({as:"span",get id(){return r.id},"aria-hidden":"true"},o))}function $_e(e){const t=x_e();return zt(pbe,Wt({as:"span","aria-hidden":"true"},(()=>t.dataset()),nbe({children:"▼"},e)))}function V_e(e){return zt(T_e,Wt({role:"menuitem",closeOnSelect:!0},e))}function B_e(e){const t=__e(),n=nbe({id:t.generateId("description")},e),[r,o]=Yt(n,["id"]);return pt((()=>yt(t.registerDescription(r.id)))),zt(pbe,Wt({as:"div",get id(){return r.id}},(()=>t.dataset()),o))}function z_e(e){const t=__e(),n=nbe({id:t.generateId("indicator")},e),[r,o]=Yt(n,["forceMount"]);return zt(nn,{get when(){return r.forceMount||t.isChecked()},get children(){return zt(pbe,Wt({as:"div"},(()=>t.dataset()),o))}})}function H_e(e){const t=__e(),n=nbe({id:t.generateId("label")},e),[r,o]=Yt(n,["ref","id"]);return pt((()=>yt(t.registerLabel(r.id)))),zt(pbe,Wt({as:"div",ref(e){const n=fye(t.setLabelRef,r.ref);"function"==typeof n&&n(e)},get id(){return r.id}},(()=>t.dataset()),o))}function q_e(e){const t=x_e();return zt(nn,{get when(){return t.contentPresent()},get children(){return zt(jn,e)}})}var G_e=St();function K_e(e){const t=nbe({id:E_e().generateId(`radiogroup-${Qt()}`)},e),[n,r]=Yt(t,["value","defaultValue","onChange","disabled"]),[o,i]=xbe({value:()=>n.value,defaultValue:()=>n.defaultValue,onChange:e=>n.onChange?.(e)});return zt(G_e.Provider,{value:{isDisabled:()=>n.disabled,isSelectedValue:e=>e===o(),setSelectedValue:i},get children(){return zt(F_e,r)}})}function W_e(e){const t=function(){const e=Et(G_e);if(void 0===e)throw new Error("[kobalte]: `useMenuRadioGroupContext` must be used within a `Menu.RadioGroup` component");return e}(),n=nbe({closeOnSelect:!1},e),[r,o]=Yt(n,["value","onSelect"]);return zt(T_e,Wt({role:"menuitemradio",get checked(){return t.isSelectedValue(r.value)},onSelect:()=>{r.onSelect?.(),t.setSelectedValue(r.value)}},o))}function Y_e(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 X_e(e){const t=E_e(),n=Tbe(),r=b_e(),o=N_e(),i=M_e(),a=nbe({placement:"horizontal"===t.orientation()?"bottom-start":"right-start"},e),[s,l]=Yt(a,["open","defaultOpen","onOpenChange"]);let c=0,u=null,d="right";const[p,f]=ct(),[h,m]=ct(),[g,v]=ct(),[y,b]=ct(),[x,w]=ct(!0),[_,S]=ct(l.placement),[E,T]=ct([]),[C,A]=ct([]),{DomCollectionProvider:N}=Rbe({items:C,onItemsChange:A}),R=Lwe({open:()=>s.open,defaultOpen:()=>s.defaultOpen,onOpenChange:e=>s.onOpenChange?.(e)}),{present:O}=exe({show:()=>t.forceMount()||R.isOpen(),element:()=>y()??null}),P=function(e){const t=Kbe(e),n=kbe({dataSource:()=>xve(e.dataSource),getKey:()=>xve(e.getKey),getTextValue:()=>xve(e.getTextValue),getDisabled:()=>xve(e.getDisabled),getSectionChildren:()=>xve(e.getSectionChildren),factory:t=>new Zbe(e.filter?e.filter(t):t)},[()=>e.filter]),r=new Xbe(n,t);return ut((()=>{const e=t.focusedKey();null==e||n().getItem(e)||t.setFocusedKey(void 0)})),{collection:n,selectionManager:()=>r}}({selectionMode:"none",dataSource:C}),k=e=>{w(e),R.open()},j=(e=!1)=>{R.close(),e&&r&&r.close(!0)},M=()=>{const e=y();e&&(zye(e),P.selectionManager().setFocused(!0),P.selectionManager().setFocusedKey(void 0))},L=()=>{null!=i?setTimeout((()=>M())):M()},D=e=>{return d===u?.side&&(t=e,n=u?.area,!!n&&function(e,t){const[n,r]=e;let o=!1;for(let i=t.length,a=0,s=i-1;a<i;s=a++){const[e,l]=t[a],[c,u]=t[s],[,d]=t[0===s?i-1:s-1]||[0,0],p=(l-u)*(n-e)-(e-c)*(r-l);if(u<l){if(r>=u&&r<l){if(0===p)return!0;p>0&&(r===u?r>d&&(o=!o):o=!o)}}else if(l<u){if(r>l&&r<=u){if(0===p)return!0;p<0&&(r===u?r<d&&(o=!o):o=!o)}}else if(r==l&&(n>=c&&n<=e||n>=e&&n<=c))return!0}return o}([t.clientX,t.clientY],n));var t,n};o_e({isDisabled:()=>!(null==r&&R.isOpen()&&t.isModal()),targets:()=>[y(),...E()].filter(Boolean)}),pt((()=>{const e=y();if(!e||!r)return;const t=r.registerNestedMenu(e);yt((()=>{t()}))})),pt((()=>{void 0===r&&o?.registerMenu(t.value(),[y(),...E()])})),pt((()=>{void 0===r&&void 0!==o&&(o.value()===t.value()?(g()?.focus(),o.autoFocusMenu()&&k(!0)):j())})),pt((()=>{void 0===r&&void 0!==o&&R.isOpen()&&o.setValue(t.value())})),yt((()=>{void 0===r&&o?.unregisterMenu(t.value())}));const I={dataset:ft((()=>({"data-expanded":R.isOpen()?"":void 0,"data-closed":R.isOpen()?void 0:""}))),isOpen:R.isOpen,contentPresent:O,nestedMenus:E,currentPlacement:_,pointerGraceTimeoutId:()=>c,autoFocus:x,listState:()=>P,parentMenuContext:()=>r,triggerRef:g,contentRef:y,triggerId:p,contentId:h,setTriggerRef:v,setContentRef:b,open:k,close:j,toggle:e=>{w(e),R.toggle()},focusContent:L,onItemEnter:e=>{D(e)&&e.preventDefault()},onItemLeave:e=>{D(e)||L()},onTriggerLeave:e=>{D(e)&&e.preventDefault()},setPointerDir:e=>d=e,setPointerGraceTimeoutId:e=>c=e,setPointerGraceIntent:e=>u=e,registerNestedMenu:e=>{T((t=>[...t,e]));const t=r?.registerNestedMenu(e);return()=>{T((t=>Rye(t,e))),t?.()}},registerItemToParentDomCollection:n?.registerItem,registerTriggerId:cbe(f),registerContentId:cbe(m)};return zt(N,{get children(){return zt(y_e.Provider,{value:I,get children(){return zt(nn,{when:void 0===i,get fallback(){return l.children},get children(){return zt(Owe,Wt({anchorRef:g,contentRef:y,onCurrentPlacementChange:S},l))}})}})}})}function Z_e(e){const{direction:t}=Vbe();return zt(X_e,Wt({get placement(){return"rtl"===t()?"left-start":"right-start"},flip:!0},e))}var Q_e=(e,t)=>"ltr"===e?["horizontal"===t?"ArrowLeft":"ArrowUp"]:["horizontal"===t?"ArrowRight":"ArrowDown"];function J_e(e){const t=x_e(),n=E_e(),[r,o]=Yt(e,["onFocusOutside","onKeyDown"]),{direction:i}=Vbe();return zt(L_e,Wt({onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onFocusOutside:e=>{r.onFocusOutside?.(e);const n=e.target;kye(t.triggerRef(),n)||t.close()},onKeyDown:e=>{$ye(e,r.onKeyDown);const o=kye(e.currentTarget,e.target),a=Q_e(i(),n.orientation()).includes(e.key),s=null!=t.parentMenuContext();o&&a&&s&&(t.close(),zye(t.triggerRef()))}},o))}var eSe=["Enter"," "],tSe=(e,t)=>"ltr"===e?[...eSe,"horizontal"===t?"ArrowRight":"ArrowDown"]:[...eSe,"horizontal"===t?"ArrowLeft":"ArrowUp"];function nSe(e){let t;const n=E_e(),r=x_e(),o=nbe({id:n.generateId(`sub-trigger-${Qt()}`)},e),[i,a]=Yt(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}=Vbe(),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=Ybe({key:u,selectionManager:d,shouldSelectOnPressUp:!0,allowsDifferentPressOrigin:!0,disabled:()=>i.disabled},(()=>t)),f=e=>{$ye(e,i.onClick),r.isOpen()||i.disabled||r.open(!0)},h=e=>{$ye(e,i.onKeyDown),e.repeat||i.disabled||tSe(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 pt((()=>{if(null==r.registerItemToParentDomCollection)throw new Error("[kobalte]: `Menu.SubTrigger` must be used within a `Menu.Sub` component");yt(r.registerItemToParentDomCollection({ref:()=>t,type:"item",key:u(),textValue:i.textValue??t?.textContent??"",disabled:i.disabled??!1}))})),pt(gt((()=>r.parentMenuContext()?.pointerGraceTimeoutId()),(e=>{yt((()=>{window.clearTimeout(e),r.parentMenuContext()?.setPointerGraceIntent(null)}))}))),pt((()=>yt(r.registerTriggerId(i.id)))),yt((()=>{l()})),zt(pbe,Wt({as:"div",ref(e){const n=fye((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 ft((()=>!!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 Vye([i.onPointerDown,p.onPointerDown])},get onPointerUp(){return Vye([i.onPointerUp,p.onPointerUp])},get onClick(){return Vye([f,p.onClick])},get onKeyDown(){return Vye([h,p.onKeyDown])},get onMouseDown(){return Vye([i.onMouseDown,p.onMouseDown])},get onFocus(){return Vye([i.onFocus,p.onFocus])},onPointerMove:e=>{if($ye(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)),zye(e.currentTarget),t?.listState().selectionManager().setFocused(!0),t?.listState().selectionManager().setFocusedKey(u()))))},onPointerLeave:e=>{if($ye(e,i.onPointerLeave),"mouse"!==e.pointerType)return;l();const t=r.parentMenuContext(),n=r.contentRef();if(n){t?.setPointerGraceIntent({area:Y_e(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 rSe(e){const t=N_e(),n=nbe({id:`menu-${Qt()}`,modal:!0},e),[r,o]=Yt(n,["id","modal","preventScroll","forceMount","open","defaultOpen","onOpenChange","value","orientation"]),i=Lwe({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:Pye((()=>r.id)),value:()=>r.value,orientation:()=>r.orientation??t?.orientation()??"horizontal"};return zt(S_e.Provider,{value:a,get children(){return zt(X_e,Wt({get open(){return i.isOpen()},get onOpenChange(){return i.setIsOpen}},o))}})}function oSe(e){let t;const n=nbe({orientation:"horizontal"},e),[r,o]=Yt(n,["ref","orientation"]),i=ube((()=>t),(()=>"hr"));return zt(pbe,Wt({as:"hr",ref(e){const n=fye((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))}Sbe({},{Root:()=>oSe,Separator:()=>iSe});var iSe=oSe,aSe={};function sSe(e){const t=E_e(),n=x_e(),[r,o]=Yt(e,["onCloseAutoFocus","onInteractOutside"]);let i=!1;return zt(D_e,Wt({onCloseAutoFocus:e=>{r.onCloseAutoFocus?.(e),i||zye(n.triggerRef()),i=!1,e.preventDefault()},onInteractOutside:e=>{r.onInteractOutside?.(e),t.isModal()&&!e.detail.isContextMenu||(i=!0)}},o))}function lSe(e){return zt(rSe,nbe({id:`dropdownmenu-${Qt()}`},e))}Sbe(aSe,{Arrow:()=>Cwe,CheckboxItem:()=>C_e,Content:()=>sSe,DropdownMenu:()=>cSe,Group:()=>F_e,GroupLabel:()=>U_e,Icon:()=>$_e,Item:()=>V_e,ItemDescription:()=>B_e,ItemIndicator:()=>z_e,ItemLabel:()=>H_e,Portal:()=>q_e,RadioGroup:()=>K_e,RadioItem:()=>W_e,Root:()=>lSe,Separator:()=>oSe,Sub:()=>Z_e,SubContent:()=>J_e,SubTrigger:()=>nSe,Trigger:()=>k_e});var cSe=Object.assign(lSe,{Arrow:Cwe,CheckboxItem:C_e,Content:sSe,Group:F_e,GroupLabel:U_e,Icon:$_e,Item:V_e,ItemDescription:B_e,ItemIndicator:z_e,ItemLabel:H_e,Portal:q_e,RadioGroup:K_e,RadioItem:W_e,Separator:oSe,Sub:Z_e,SubContent:J_e,SubTrigger:nSe,Trigger:k_e}),uSe={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"}},dSe=mn('<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>'),pSe=mn('<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>'),fSe=mn('<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>'),hSe=mn('<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>'),mSe=mn('<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>'),gSe=mn('<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>'),vSe=mn('<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>'),ySe=mn('<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>'),bSe=mn('<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">'),xSe=mn('<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">'),wSe=mn('<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>'),_Se=mn('<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>'),SSe=mn('<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>'),ESe=mn('<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>'),TSe=mn('<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>'),CSe=mn('<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>'),ASe=mn('<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>'),NSe=mn('<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>'),RSe=mn('<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>'),OSe=mn('<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>'),PSe=mn('<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>'),kSe=mn('<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>'),jSe=mn('<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 MSe(){return dSe()}function LSe(){return pSe()}function DSe(){return fSe()}function ISe(){return hSe()}function FSe(){return mSe()}function USe(){return(e=mSe()).style.setProperty("transform","rotate(90deg)"),e;var e}function $Se(){return(e=mSe()).style.setProperty("transform","rotate(-90deg)"),e;var e}function VSe(){return gSe()}function BSe(){return vSe()}function zSe(){return ySe()}function HSe(){return bSe()}function qSe(){return xSe()}function GSe(){return wSe()}function KSe(){return _Se()}function WSe(){return SSe()}function YSe(){return ESe()}function XSe(e){return t=TSe(),n=t.firstChild,dt((()=>vn(n,"stroke","dark"===e.theme?"#12B76A":"#027A48"))),t;var t,n}function ZSe(){return CSe()}function QSe(){return ASe()}function JSe(e){return[zt(nn,{get when(){return e.checked},get children(){var t=TSe(),n=t.firstChild;return dt((()=>vn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}}),zt(nn,{get when(){return!e.checked},get children(){var t=NSe(),n=t.firstChild;return dt((()=>vn(n,"stroke","dark"===e.theme?"#9B8AFB":"#6938EF"))),t}})]}function eEe(){return RSe()}function tEe(){return OSe()}function nEe(){return PSe()}function rEe(){return kSe()}function oEe(){const e=Qt();return t=jSe(),i=(o=(r=(n=t.firstChild).nextSibling).nextSibling).firstChild,s=(a=o.nextSibling).firstChild,u=(c=(l=a.nextSibling).nextSibling).firstChild,p=(d=c.nextSibling).firstChild,m=(h=(f=d.nextSibling).nextSibling).firstChild,v=(g=h.nextSibling).firstChild,x=(b=(y=g.nextSibling).nextSibling).firstChild,_=(w=b.nextSibling).firstChild,T=(E=(S=w.nextSibling).nextSibling).firstChild,A=(C=E.nextSibling).firstChild,O=(R=(N=C.nextSibling).nextSibling).firstChild,k=(P=R.nextSibling).firstChild,L=(M=(j=P.nextSibling).nextSibling).firstChild,I=(D=M.nextSibling).firstChild,$=(U=(F=D.nextSibling).firstChild.nextSibling.nextSibling.nextSibling).nextSibling,B=(V=F.nextSibling).firstChild,H=(z=V.nextSibling).firstChild,ie=(oe=(re=(ne=(te=(ee=(J=(Q=(Z=(X=(Y=(W=(K=(G=(q=z.nextSibling).firstChild).nextSibling).nextSibling.firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,se=(ae=q.nextSibling).firstChild,ce=(le=ae.nextSibling).firstChild,pe=(de=(ue=le.nextSibling).firstChild).nextSibling,he=(fe=ue.nextSibling).firstChild,ge=(me=fe.nextSibling).firstChild,Le=(Me=(je=(ke=(Pe=(Oe=(Re=(Ne=(Ae=(Ce=(Te=(Ee=(Se=(_e=(we=(xe=(be=(ye=(ve=me.nextSibling).firstChild).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling).nextSibling,vn(n,"id",`a-${e}`),vn(r,"fill",`url(#a-${e})`),vn(i,"id",`am-${e}`),vn(a,"id",`b-${e}`),vn(s,"filter",`url(#am-${e})`),vn(l,"mask",`url(#b-${e})`),vn(u,"id",`ah-${e}`),vn(d,"id",`k-${e}`),vn(p,"filter",`url(#ah-${e})`),vn(f,"mask",`url(#k-${e})`),vn(m,"id",`ae-${e}`),vn(g,"id",`j-${e}`),vn(v,"filter",`url(#ae-${e})`),vn(y,"mask",`url(#j-${e})`),vn(x,"id",`ai-${e}`),vn(w,"id",`i-${e}`),vn(_,"filter",`url(#ai-${e})`),vn(S,"mask",`url(#i-${e})`),vn(T,"id",`aj-${e}`),vn(C,"id",`h-${e}`),vn(A,"filter",`url(#aj-${e})`),vn(N,"mask",`url(#h-${e})`),vn(O,"id",`ag-${e}`),vn(P,"id",`g-${e}`),vn(k,"filter",`url(#ag-${e})`),vn(j,"mask",`url(#g-${e})`),vn(L,"id",`af-${e}`),vn(D,"id",`f-${e}`),vn(I,"filter",`url(#af-${e})`),vn(F,"mask",`url(#f-${e})`),vn(U,"id",`m-${e}`),vn($,"fill",`url(#m-${e})`),vn(B,"id",`ak-${e}`),vn(z,"id",`e-${e}`),vn(H,"filter",`url(#ak-${e})`),vn(q,"mask",`url(#e-${e})`),vn(G,"id",`n-${e}`),vn(K,"fill",`url(#n-${e})`),vn(W,"id",`r-${e}`),vn(Y,"fill",`url(#r-${e})`),vn(X,"id",`s-${e}`),vn(Z,"fill",`url(#s-${e})`),vn(Q,"id",`q-${e}`),vn(J,"fill",`url(#q-${e})`),vn(ee,"id",`p-${e}`),vn(te,"fill",`url(#p-${e})`),vn(ne,"id",`o-${e}`),vn(re,"fill",`url(#o-${e})`),vn(oe,"id",`l-${e}`),vn(ie,"fill",`url(#l-${e})`),vn(se,"id",`al-${e}`),vn(le,"id",`d-${e}`),vn(ce,"filter",`url(#al-${e})`),vn(ue,"mask",`url(#d-${e})`),vn(de,"id",`u-${e}`),vn(pe,"fill",`url(#u-${e})`),vn(he,"id",`ad-${e}`),vn(me,"id",`c-${e}`),vn(ge,"filter",`url(#ad-${e})`),vn(ve,"mask",`url(#c-${e})`),vn(ye,"id",`t-${e}`),vn(be,"fill",`url(#t-${e})`),vn(xe,"id",`v-${e}`),vn(we,"stroke",`url(#v-${e})`),vn(_e,"id",`aa-${e}`),vn(Se,"stroke",`url(#aa-${e})`),vn(Ee,"id",`w-${e}`),vn(Te,"stroke",`url(#w-${e})`),vn(Ce,"id",`ac-${e}`),vn(Ae,"stroke",`url(#ac-${e})`),vn(Ne,"id",`ab-${e}`),vn(Re,"stroke",`url(#ab-${e})`),vn(Oe,"id",`y-${e}`),vn(Pe,"stroke",`url(#y-${e})`),vn(ke,"id",`x-${e}`),vn(je,"stroke",`url(#x-${e})`),vn(Me,"id",`z-${e}`),vn(Le,"stroke",`url(#z-${e})`),t;var t,n,r,o,i,a,s,l,c,u,d,p,f,h,m,g,v,y,b,x,w,_,S,E,T,C,A,N,R,O,P,k,j,M,L,D,I,F,U,$,V,B,z,H,q,G,K,W,Y,X,Z,Q,J,ee,te,ne,re,oe,ie,ae,se,le,ce,ue,de,pe,fe,he,me,ge,ve,ye,be,xe,we,_e,Se,Ee,Te,Ce,Ae,Ne,Re,Oe,Pe,ke,je,Me,Le}var iEe=mn('<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>'),aEe=mn('<button title="Copy object to clipboard">'),sEe=mn('<button title="Remove all items"aria-label="Remove all items">'),lEe=mn('<button title="Delete item"aria-label="Delete item">'),cEe=mn('<button title="Toggle value"aria-label="Toggle value">'),uEe=mn('<button title="Bulk Edit Data"aria-label="Bulk Edit Data">'),dEe=mn("<div>"),pEe=mn("<div><button> <span></span> <span> "),fEe=mn("<input>"),hEe=mn("<span>"),mEe=mn("<div><span>:"),gEe=mn("<div><div><button> [<!>...<!>]");var vEe=e=>{const t=Fve(),n=jve().shadowDOMTarget?cye.bind({target:jve().shadowDOMTarget}):cye,r=ft((()=>"dark"===t()?CEe(n):TEe(n)));return o=iEe(),dt((()=>yn(o,dye(r().expander,n`
86
86
  transform: rotate(${e.expanded?90:0}deg);
87
87
  `,e.expanded&&n`
88
88
  & svg {