PageSourceSearch

https://app.honeygrid.ai/assets/index-BE4xRSrU.js

js honeygrid.ai collected 2026-10-05 13:48:11 UTC 499,166 bytes, 28 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_-CA6uVo2t.js","assets/react-vendor-D22-vaMD.js","assets/rolldown-runtime-DS2seoW7.js","assets/mapbox-DBcE-ZnU.js","assets/mapbox-bpFrQ5yG.css","assets/_authenticated-CyIoY9hQ.js","assets/authenticate-4xCUBq7z.js","assets/useStytchPresentation-lKexggXO.js","assets/StytchB2BContext-Y95XElEa.js","assets/brandColors-hfYopsPm.js","assets/useAuthStateMachine-CBmAVj9b.js","assets/schemas-BWAwCoAd.js","assets/AuthPageLayout-D9JdurCM.js","assets/utils-Cad6z8_M.js","assets/viz-vendor-_y3T25c5.js","assets/bundle-mjs-BYiGeXfY.js","assets/honey-grid-logo-icon-Ds-viUoe.js","assets/honey-grid-wordmark-BerZi4ru.js","assets/HomePageBackground-RvN1JWsf.js","assets/password-reset-8NyrV7Mz.js","assets/button-CFwAJNZT.js","assets/input-_m2Gfxro.js","assets/ui-vendor-DfM-fJXp.js","assets/shadowDom-BQdimR9a.js","assets/createBaseUIEventDetails-DUZzpBuI.js","assets/PasswordStrengthIndicator-C4zyQQIo.js","assets/success-B4BCD7DD.js","assets/_workspaceSlug-C1vUMuGh.js","assets/StytchB2BContext-mCnhXg8j.js","assets/useStytchWorkspaces-CQnr3hF1.js","assets/state-vendor-DS8SoX7t.js","assets/react-BEMpy6Be.js","assets/mic-DrB9X6wa.js","assets/BeeConnectionContext-BwcTrqKy.js","assets/dist-CGwWmYqD.js","assets/chevrons-up-down-BaSzkdEQ.js","assets/circle-check-big-CXMapqYj.js","assets/useStytchWorkspaceMembers-TehX7uOC.js","assets/useHoneyGridApiFetch-B-daByYU.js","assets/errors-Dlz5sdPd.js","assets/megaphone-BhNklzmK.js","assets/message-circle-DEC4RJNV.js","assets/beeVoiceState-CyfLEcOF.js","assets/sidebar-BZPEOe7I.js","assets/tooltip-DfgzkIWB.js","assets/use-reduced-motion-DwX6AVil.js","assets/reduced-motion-DSWJC5GQ.js","assets/sheet-nQwexDLL.js","assets/x-BRFATNVy.js","assets/panels-top-left-DqX535rb.js","assets/settings-D_bvd-Pq.js","assets/shield-alert-COODeY1x.js","assets/user-CAZtJgHD.js","assets/useLiveQuery-BEXh5xu8.js","assets/local-storage-Cmq2Flu3.js","assets/contacts-CwBIwUpi.js","assets/queryClient-BlAZbXD-.js","assets/query-BzO0V7Zd.js","assets/collection-fetch-laqlOruu.js","assets/dialog-wfFVY4AM.js","assets/addEventListener-DdWxric6.js","assets/alert-dialog-DCf_5zLZ.js","assets/approvals-DHqFSp57.js","assets/iso-bAQt4Unr.js","assets/coerce-BzpSXA23.js","assets/HtmlMediaAuthoringTypes-CA7an3qH.js","assets/media-asset-selection-BgHbf2Uj.js","assets/bee-optimization-chat-J5WJmnVZ.js","assets/uuid-gen-eeYkmzW6.js","assets/json-value-B8b3OCmh.js","assets/json-BpdNl4u4.js","assets/brand-competitor-config-BP14nZOv.js","assets/lazy-schema-CR1lNiAe.js","assets/brand-media-guide-DqrRQ2bW.js","assets/campaign-DL5reA8K.js","assets/avatar-B1iCrJ7F.js","assets/react-BpLxTokU.js","assets/dropdown-menu-2nJSt-ul.js","assets/check-CFRhPUTG.js","assets/chevron-right-YVFp_cvn.js","assets/circle-CL9SDs-T.js","assets/BeeErrorBoundary-CokYanfs.js","assets/triangle-alert-D7JAFNvh.js","assets/bee-sidebar-preferences-Da3xEeMW.js","assets/BeeSidebarConnectionHandoffContext-CvqGK-zE.js","assets/avatar-DH2QawRj.js","assets/WorkspaceList-DYkpSlqj.js","assets/external-link-JGYwDCIt.js","assets/map-pin-BwGdM9VN.js","assets/plus-BVBrkYiP.js","assets/search-DBBzXBq2.js","assets/users-Cb9n_nX2.js","assets/empty-DoWTLrf_.js","assets/empty-state-C5MPRBBs.js","assets/dashboard-gxgCLmsW.js","assets/authorize-DJfxANA4.js","assets/ads-CyIoY9hQ.js","assets/approvals-n3MoGJTn.js","assets/funnel-C-fLf4eC.js","assets/GoogleAdPreview-DjIh155t.js","assets/camera-BQSGYs6_.js","assets/ellipsis-ComOgmHu.js","assets/globe-MbvCJk6F.js","assets/image-De2M_5Ca.js","assets/useDirtyCreationNavigationGuard-BU44tC7l.js","assets/WorkspaceSchemaValidators-CFlJM8Uo.js","assets/brand-media-resources-BXEx4HWN.js","assets/asset-groups-DmLD9yIm.js","assets/relations-DHgkpNKa.js","assets/meta-ads-tab-B3YYqVO0.js","assets/monitor-BWU2qGSz.js","assets/send-YYN-bQ95.js","assets/share-2-CCjBui7w.js","assets/smartphone-lWlEx_bN.js","assets/square-CWm_TnYC.js","assets/wifi-Dz8ou9Yy.js","assets/AnimatePresence-DPxyTbB-.js","assets/toggle-group-BZmD-VmI.js","assets/chevron-down-Ptch8a1m.js","assets/circle-check-BwHZr3zZ.js","assets/top-nav-bar-BKKJ--1g.js","assets/command-CiYY3CVf.js","assets/earth-BeY1-WgB.js","assets/history-Bcx098-M.js","assets/layout-grid-D3B5E1pK.js","assets/checkbox-BbyvA2HN.js","assets/color-swatches-C3HbNkmg.js","assets/phone-BjjgOnTa.js","assets/SocialNetworkLinking-Bp5GY09W.js","assets/copy-D9Eimykv.js","assets/link-2-CEl_Q11q.js","assets/data-sources-hkU0sMTx.js","assets/useCanEditWorksp
1ace-CDxGUAzF.js","assets/useConnections-dH0w-lj4.js","assets/rotate-ccw-B2YcMe_b.js","assets/shield-check-C4A7nhHe.js","assets/sparkles-LCJ-GSHX.js","assets/table-2-B5kD0-5c.js","assets/upload-BRiUKYnA.js","assets/separator-DZTSQdVt.js","assets/useReviewCommandIdentity-DviGvxeO.js","assets/collapsible-CZZ-YqBF.js","assets/approval-labels-BOM15naS.js","assets/progress-C1gnvU0G.js","assets/meta-icon-B5W7sHmH.js","assets/table-C0XuuMwZ.js","assets/button-group-DXKEmhSc.js","assets/alert-DAal7lMK.js","assets/useWorkspaceMediaAssets-BdYCZ58k.js","assets/useWorkspaceBrandMedia-CJdOlEti.js","assets/useCampaign-Bd90wyPb.js","assets/campaignKeys-lGhbPB1A.js","assets/SearchTermOverrideDialog-D0uepBmk.js","assets/pencil-BgAV2fEH.js","assets/format-BauZ_02y.js","assets/tabs-BdNGob6a.js","assets/competitorWorkflowOutcome-CU1j57nh.js","assets/accordion-rGd-woim.js","assets/useUploadDataSource-FdG66Jd5.js","assets/brand-media-guide-sections-DrmcONPk.js","assets/bee-CXDVv09d.js","assets/arrow-up-right-BySGNKzD.js","assets/empty-state-BDk35ksl.js","assets/mail-CdHsunf_.js","assets/useBeeChat-CXS4jo86.js","assets/arrow-down-B4VO7Iyg.js","assets/circle-x-DlEhtBcW.js","assets/clock-3-BbIwzwFZ.js","assets/lock-keyhole-FHecWp1X.js","assets/message-square-iyiA9XZz.js","assets/formatters-BRQlnE6k.js","assets/differenceInYears-CymWdh1r.js","assets/trash-2-Bd7E__PG.js","assets/item-Dmw-Fufo.js","assets/slider-DgOHEAq1.js","assets/file-text-DhlymQeP.js","assets/SessionReplayPlayer-DZtIVD8l.js","assets/clock-FlYZPacy.js","assets/SessionReplayPlayer-BqP7cP1k.css","assets/play-D44DRsxz.js","assets/contacts-DonLSyac.js","assets/BeeChatEmptyConversations-BcM5C8kM.js","assets/page-error-boundary-CBmBDGko.js","assets/campaigns-DL8xHy6N.js","assets/CampaignsTopNavBar-KfkBgjV1.js","assets/swords-D3STDq7M.js","assets/create-button-Di4cWwX0.js","assets/CampaignsTopNavActionsContext-Ds6HUJkU.js","assets/dashboard-DiFHjXhp.js","assets/circle-question-mark-DYiUtq0Z.js","assets/grid-3x3-D3wgwn6o.js","assets/shopping-cart-Cu6BBeO5.js","assets/target-DxWuNtxy.js","assets/trending-up-kijBoI0F.js","assets/wallet-cards-obsvmVPQ.js","assets/useDashboardCampaignMetricsQuery-DjON8mvf.js","assets/metric-card-CWmoYTyx.js","assets/chart-BdS3Y9Xs.js","assets/debug-DPLyI1lp.js","assets/chart-column-BjOdcQml.js","assets/source-badge-B4J8IUF_.js","assets/messages-square-D2qfuTtB.js","assets/ImageDetailModal-CF7flJuo.js","assets/image-off-CBxbhoPz.js","assets/layers-D4ZUQOCG.js","assets/grids-Cmh7N59-.js","assets/chevron-up-XN9Yf4OU.js","assets/redo-2--9gHbtev.js","assets/GridEditorTopNav-Cy49v2JU.js","assets/arrow-up-DFhLu_Ml.js","assets/ConnectionTypes-D8fdzNL_.js","assets/landing-pages-8T97YCQ8.js","assets/local-only-6yc7Iro8.js","assets/map-Br06f0os.js","assets/formatters-_vCOfYzn.js","assets/differenceInMonths-B-rMqH7D.js","assets/useGrids-D8coImXs.js","assets/useGoogleAdsCampaigns-BLUN_lvk.js","assets/mouse-pointer-click-6W4Pe_Mx.js","assets/undo-2-C0n-KH7g.js","assets/useResize-CW5bYuds.js","assets/loading-CJp19t9T.js","assets/grids-DSztRxDt.css","assets/handbook-Bn-MJdmi.js","assets/inbox-C7Nl8mdL.js","assets/message-C5Mm6G6p.js","assets/lightbulb-DGWj1kTN.js","assets/message-square-text-D-ppVS2S.js","assets/zap-BZY3YekV.js","assets/useLeadAgentPlan-BOmAvICB.js","assets/landing-pages-CyIoY9hQ.js","assets/media-assets-BrtZFUVd.js","assets/AdsTopNavBar-BGlb8jlV.js","assets/database-BgzmsK62.js","assets/save-9EHP-dq6.js","assets/sliders-horizontal-J1D-b4mh.js","assets/BeeActivityIndicator-CLKE3hLI.js","assets/BeeActivityIndicator-BOCvEVQG.css","assets/useWorkflowProgress-7nNXpbfv.js","assets/AdsHeaderAction-CK-RhhRr.js","assets/brand-component-library-BhYaZtHJ.js","assets/PracticePhotoReview-YPbPwaBy.js","assets/orders-m9hI_EEE.js","assets/calendar-CL5hZSuy.js","assets/dollar-sign-BrXnOCQO.js","assets/record-panel-header-CaMzYzZo.js","assets/drawer-C29Eeg9T.js","assets/record-panel-footer-CMj0d2iO.js","assets/slide-over-panel-CkFJi4aO.js","assets/postcards-CyIoY9hQ.js","assets/practice-information-qtTs_GUH.js","assets/settings-CyIoY9hQ.js","assets/sign-up-CrLGznYD.js","assets/record-panel-layout-DUP_2jVZ.js","assets/local-codex.pair-Cp4NjSfR.js","assets/LocalCodexBrowserClient-BKfI2-yD.js","assets/ads.index-DaBFFI4e.js","assets/AdsPage-DSllu6sc.js","assets/HtmlMediaAuthoringPage-CE97gT7o.js","assets/chevron-left-B9sHgMf5.js","assets/useHtmlMediaPhoneBinding-B8Gcl7U7.js","assets/crosshair-DQUhh7Dd.js","assets/list-checks-DkLboAhj.js","assets/switch-PgI2Z63i.js","assets/campaign-platform-icon-BY8WT48e.js","assets/status-badge-m-N9UXx1.js","assets/small-metric-card-DJChYixt.js","assets/useCampaigns-y5Ehb3Bb.js","assets/useApplyAll
1Configurations-DnvSxGXv.js","assets/useBatchUpdateTargeting-B48GLEc6.js","assets/campaigns-uotApug_.js","assets/delete-confirmation-dialog-BsHLzOt4.js","assets/ads._artifactSlug-B4-e96vw.js","assets/ads.new-TTKUl4dc.js","assets/ads.recommendations-DcBdndrT.js","assets/shared-SKaNw3qp.js","assets/index.browser-Blyirbpw.js","assets/bee_.recommendations-CHezk2jE.js","assets/campaigns.index-BlHmGdP-.js","assets/lock-Cza8CRYH.js","assets/core-validators-D9iL0XdY.js","assets/metrics-Dsfy-UyR.js","assets/budget-CZiv3IJW.js","assets/campaign-status-badge-BaYdGj3x.js","assets/campaigns._campaignUuid-BVESYM-m.js","assets/ellipsis-vertical-DhzINhCn.js","assets/bidding-queries-3F9nmyHv.js","assets/pmax-queries-BP2AfCKl.js","assets/input-group-CgtQI_PR.js","assets/campaigns.brand-aliases-BgrR260v.js","assets/campaigns.competitors-jMeF0-Iz.js","assets/useLocations-JdRmN8w0.js","assets/campaigns.import-Bp822a3r.js","assets/types-CDPn9NCi.js","assets/campaigns.new-BAeb30Q6.js","assets/data-sources.index-DwUDXnnb.js","assets/data-source-card-C5YydFVH.js","assets/hash-CNEilPFD.js","assets/grids.index-CMW4cduK.js","assets/GridDetails-CwZzel03.js","assets/input-field-D6NRPDfo.js","assets/grids._uuid-DBGf-fwe.js","assets/grids.add-DBGf-fwe.js","assets/landing-pages.index-DO4VZHt4.js","assets/LandingPagesPage-CcZPecgZ.js","assets/HtmlMediaCollectionRoutePage-BeFezQfw.js","assets/landing-pages._artifactSlug-Dg2aYGIs.js","assets/landing-pages.new-BnZVQQHH.js","assets/postcards.index-CGLkseY_.js","assets/PostcardsPage-C5c5cY9g.js","assets/postcards._artifactSlug-xwWBB-OD.js","assets/postcards.new-BPPcZAjH.js","assets/settings.index-DVu-JH10.js","assets/SettingsPage-C73E17gd.js","assets/base-B_BDClia.js","assets/settings._entity-B5nZoCGl.js","assets/landing-pages._pageId.analytics-DsPtOnar.js"])))=>i.map(i=>d[i]);
2import{a as za,t as H}from"./rolldown-runtime-DS2seoW7.js";import{B as Wc,C as ve,I as Dr,L as Hc,N as Kc,O as Ii,R as Gc,S as Yc,T as Xc,V as Qc,_ as Jc,b as Zc,g as eu,h as tu,j as ru,k as _o,m as su,p as nu,w as fe,y as au,z as iu}from"./react-vendor-D22-vaMD.js";import{n as ye,r as be}from"./mapbox-DBcE-ZnU.js";import{c as ou,l as lu,r as So}from"./StytchB2BContext-Y95XElEa.js";import{i as qa,r as Wa,t as cu}from"./StytchB2BContext-mCnhXg8j.js";import{i as ys,n as rr,o as uu,s as Lt}from"./state-vendor-DS8SoX7t.js";import{t as _r}from"./queryClient-BlAZbXD-.js";import{n as Ha,t as du}from"./useStytchWorkspaces-CQnr3hF1.js";import{c as va,d as wo,f as ms,g as qt,h as fn,i as It,l as ir,m as Qr,n as fu,o as Pi,p as Lr,r as on,s as us,t as dt}from"./button-CFwAJNZT.js";import{t as pu}from"./check-CFRhPUTG.js";import{t as xo}from"./chevron-down-Ptch8a1m.js";import{t as mu}from"./chevron-up-XN9Yf4OU.js";import{t as hu}from"./chevrons-up-down-BaSzkdEQ.js";import{t as gu}from"./circle-CL9SDs-T.js";import{t as vu}from"./clock-FlYZPacy.js";import{t as Ka}from"./globe-MbvCJk6F.js";import{t as yu}from"./image-off-CBxbhoPz.js";import{t as pn}from"./map-pin-BwGdM9VN.js";import{t as Co}from"./checkbox-BbyvA2HN.js";import{t as Ga}from"./phone-BjjgOnTa.js";import{t as bu}from"./search-DBBzXBq2.js";import{t as mn}from"./x-BRFATNVy.js";import{t as _u}from"./base-B_BDClia.js";import{An as mt,Ft as hn,Jt as Ao,Wn as oe,_n as Su,ir as wu,jn as Re,jt as ko,rr as xu,wt as Qe,zn as Cu}from"./schemas-BWAwCoAd.js";import{u as Au}from"./HtmlMediaAuthoringTypes-CA7an3qH.js";import{h as bs,t as wr}from"./useLiveQuery-BEXh5xu8.js";import{t as Io}from"./local-only-6yc7Iro8.js";import{t as ku}from"./local-storage-Cmq2Flu3.js";import{t as Iu}from"./data-sources-hkU0sMTx.js";import{t as Z}from"./utils-Cad6z8_M.js";import{a as Pu,i as Po,n as Eu,p as Yn,r as Eo,s as Jr,t as Ro,u as Ru}from"./useAuthStateMachine-CBmAVj9b.js";import{$t as Ei,At as Tu,Bt as Ri,Ct as Mu,Dt as Ou,Et as Fu,Gt as Du,Jt as Ya,Kt as Lu,Mt as Nu,Nt as ju,Ot as $u,Pt as Ti,Qt as Qs,Rt as To,St as Vu,Tt as Bu,Xt as Uu,Yt as zu,Zt as qu,_t as Wu,an as Hu,bt as Ku,dn as Gu,en as Yu,gt as Xu,ht as Qu,jt as Ju,kt as Zu,ln as ed,nn as td,tn as rd,vt as sd,wt as nd,xt as ad,yt as id,zt as Br}from"./ui-vendor-DfM-fJXp.js";import{a as od,h as ld,t as cd}
2from"./map-Br06f0os.js";import{n as ud,r as ht,t as Pt}from"./useHoneyGridApiFetch-B-daByYU.js";import{t as Mo}from"./query-BzO0V7Zd.js";import{n as dd}from"./campaigns-uotApug_.js";import{n as Js,t as Oo}from"./collection-fetch-laqlOruu.js";import{t as fd}from"./contacts-CwBIwUpi.js";import{a as pd,j as md}from"./bee-optimization-chat-J5WJmnVZ.js";import{a as hd,i as Fo,n as gt,o as qe,r as Gr,s as $e,t as Xn}from"./shadowDom-BQdimR9a.js";import{a as Do,c as gd,d as vd,i as Lo,l as gn,n as yd,o as bd,r as Qn,s as _d,t as No,u as Sd}from"./input-_m2Gfxro.js";import{a as wd,c as Ds,d as xd,f as ya,i as Cd,l as lr,n as as,o as Ad,p as Jt,r as Mi,t as Ye,u as kd,v as Yr}from"./createBaseUIEventDetails-DUZzpBuI.js";import{a as Oi,o as Id,r as Fr,t as Pd}from"./addEventListener-DdWxric6.js";import{$ as Ed,A as Rd,B as Fi,C as Td,D as Md,E as Od,F as er,G as Fd,H as Dd,I as Ld,J as Nd,K as ba,L as jo,M as Ee,N as jd,O as $d,P as $o,Q as Vd,R as Xa,S as Vo,T as Bo,U as Di,V as Ls,W as Jn,X as kt,Y as Bd,Z as Ud,_ as Ns,a as Li,at as zd,b as qd,d as Wd,et as Uo,f as zo,g as Hd,h as vn,i as Kd,it as Gd,j as Y,k as Yd,l as Xd,m as Qd,nt as Jd,o as Zd,p as ef,q as tf,rt as rf,s as Zs,t as sf,tt as qo,u as nf,v as af,w as Wo,x as of,y as lf,z as Ho}from"./dialog-wfFVY4AM.js";import{i as cf,n as Zn,r as uf,t as df}from"./input-group-CgtQI_PR.js";import{a as ff,i as pf,l as mf,o as hf,r as gf,s as vf,t as yf}from"./alert-dialog-DCf_5zLZ.js";import{s as bf,u as _f}from"./approvals-DHqFSp57.js";import{t as _s}from"./useReviewCommandIdentity-DviGvxeO.js";import{t as Zr}from"./useHtmlMediaRouteHandle-A7k8ngAr.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const a of n)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function r(n){const a={};return n.integrity&&(a.integrity=n.integrity),n.referrerPolicy&&(a.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?a.credentials="include":n.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(n){if(n.ep)return;n.ep=!0;const a=r(n);fetch(n.href,a)}})();var Sf="local-codex",wf="honeygrid.local-codex.pairing.v1";function xf(t){const e=t.replaceAll("-","+").replaceAll("_","/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return decodeURIComponent(Array.from(atob(r),s=>`%${s.charCodeAt(0).toString(16).padStart(2,"0")}`).join(""))}function Ni(t,e){if(typeof t!="string")return!1;try{const r=new URL(t);return r.protocol===e&&r.hostname==="127.0.0.1"&&r.username===""&&r.password===""}catch{return!1}}function Cf(t){if(t===null||typeof t!="object"||Array.isArray(t))return null;const e=t,r=["sessionId","workspaceId","accountSubject","listenerNonce","expiresAt"];return e.version!==1||r.some(s=>typeof e[s]!="string"||e[s].length===0)||typeof e.capability!="string"||e.capability.length!==0&&e.capability.length<32||!Ni(e.webSocketUrl,"ws:")||!Ni(e.healthUrl,"http:")||new URL(e.webSocketUrl).port!==new URL(e.healthUrl).port||Number.isNaN(Date.parse(e.expiresAt))?null:{version:1,sessionId:e.sessionId,workspaceId:e.workspaceId,accountSubject:e.accountSubject,capability:e.capability,listenerNonce:e.listenerNonce,webSocketUrl:e.webSocketUrl,healthUrl:e.healthUrl,expiresAt:e.expiresAt}}function Af(t=window.location,e=window.history,r=window.sessionStorage){const s=new URLSearchParams(t.hash.slice(1)).get(Sf);if(!s)return null;e.replaceState(null,"",`${t.pathname}${t.search}`);let n=null;try{n=Cf(JSON.parse(xf(s)))}catch{n=null}return n&&r.setItem(wf,JSON.stringify(n)),n}typeof window<"u"&&Af();var kf=iu(),V=Gc(),b=za(Qc(),1),f=Hc();function If(){return(0,V.c)(1),null}function Ko(t){const e="organization-live-966f713d-ba1a-413d-81c3-597329848eb4";return t.some(r=>r.organization_id===e)}var ea=["[Stytch]"],Pf=!1,ct={debug:(...t)=>Pf,log:(...t)=>console.log(...ea,...t),warn:(...t)=>console.warn(...ea,...t),error:(...t)=>console.error(...ea,...t)},ji="bootstrap",ta=()=>({displayWatermark:!1,projectName:null,cnameDomain:null,emailDomains:["stytch.com"],captchaSettings:{enabled:!1},pkceRequiredForEmailMagicLinks:!1,pkceRequiredForPasswordResets:!1,pkceRequiredForOAuth:!1,pkceRequiredForSso:!1,slugPattern:null,createOrganizationEnabled:!1,passwordConfig:null,runDFPProtectedAuth:!1,rbacPolicy:null,siweRequiredFor
2CryptoWallets:!1,vertical:null}),Ef=class Go{_publicToken;_networkClient;_dataLayer;_bootstrapDataPromise;constructor(e,r,s){this._publicToken=e,this._networkClient=r,this._dataLayer=s,this._bootstrapDataPromise=this._networkClient.fetchSDK({url:`/projects/bootstrap/${this._publicToken}`,method:"GET"}).then(Go.mapBootstrapData).then(n=>(this._dataLayer.setItem(ji,JSON.stringify(n)),n)).catch(n=>(ct.error(n),ta()))}static mapBootstrapData(e){const r=e.password_config!==null?{ludsComplexity:e.password_config.luds_complexity,ludsMinimumCount:e.password_config.luds_minimum_count}:null;return{projectName:e.project_name,displayWatermark:!e.disable_sdk_watermark,captchaSettings:e.captcha_settings,cnameDomain:e.cname_domain,emailDomains:e.email_domains,pkceRequiredForEmailMagicLinks:e.pkce_required_for_email_magic_links,pkceRequiredForPasswordResets:e.pkce_required_for_password_resets,pkceRequiredForOAuth:e.pkce_required_for_oauth,pkceRequiredForSso:e.pkce_required_for_sso,slugPattern:e.slug_pattern,createOrganizationEnabled:e.create_organization_enabled,passwordConfig:r,runDFPProtectedAuth:e.dfp_protected_auth_enabled??!1,dfpProtectedAuthMode:e.dfp_protected_auth_mode,rbacPolicy:e.rbac_policy??null,siweRequiredForCryptoWallets:e.siwe_required_for_crypto_wallets,vertical:e.vertical}}getSync(){const e=this._dataLayer.getItem(ji);if(e===null)return ta();try{return JSON.parse(e)}catch{return ta()}}getAsync(){return this._bootstrapDataPromise}},js={};async function Qa(t,e){return js[t]!==void 0||(js[t]=Rf(t,e)),js[t]}function Rf(t,e){return new Promise((r,s)=>{const n=Mf(t);if(n&&n.dataset.loaded==="true")try{r(e())}catch(i){return s(new Error(`${t} already loaded, but module was not found in global scope: ${i}`))}const a=Of(t);a.addEventListener("load",()=>{a.dataset.loaded="true";try{r(e())}catch(i){s(new Error(`${t} was loaded, but module was not found in global scope: ${i}`))}}),a.addEventListener("error",i=>{s(new Error(`${t} could not be loaded: ${i}`))})})}var Tf=t=>document.querySelectorAll(`script[src="${t}"]`);function Mf(t){const e=Tf(t);if(e[0])return e[0]}function Of(t){const e=document.createElement("script");return e.setAttribute("src",t),e.setAttribute("async","true"),e.setAttribute("defer","true"),document.head.appendChild(e),e}var Ff=t=>Qa(`https://www.google.com/recaptcha/enterprise.js?render=${t}`,()=>window.grecaptcha.enterprise),Df=class{bootstrapPromise;state;constructor(t){this.bootstrapPromise=t,this.state=t.then(async e=>e.captchaSettings.enabled?{configured:!0,captchaClient:await Ff(e.captchaSettings.siteKey),siteKey:e.captchaSettings.siteKey}:{configured:!1})}executeRecaptcha=async()=>{const{captchaClient:t,configured:e,siteKey:r}=await this.state;if(e)return await new Promise(s=>t.ready(s)),t.execute(r,{action:"LOGIN"})}};var Lf="https://telemetry.stytch.com",Nf="https://elements.stytch.com",jf="https://accounts.google.com/gsi",$f=`${jf}/client`,Yo="It looks like you're creating multiple copies of the Stytch client. This behavior is unsupported, and unintended side effects may occur. Make sure you are creating the Stytch client at the global level, and not inside a component's render function.",Vf=class Xo extends Error{details;constructor(e,r){super(e+`
3`+r),this.message=e+`
4`+r,this.name="SDKAPIUnreachableError",this.details=r,Object.setPrototypeOf(this,Xo.prototype)}},Bf=class extends Error{constructor(t,e){super(),this.name="StytchSDKUsageError",this.message=`Invalid call to ${t}
5`+e}},Uf=class extends Error{constructor(t){super(),this.name="StytchSDKSchemaError";const e=t.body?.map(r=>`${r.dataPath}: ${r.message}`).join(`
6`);this.message=`[400] Request does not match expected schema
7${e}`}},zf=class extends Error{error_type;error_message;error_url;request_id;status_code;error_details;constructor(t){super(),this.name="StytchSDKAPIError";const{status_code:e,error_type:r,error_message:s,error_url:n,request_id:a,error_details:i}=t;this.error_type=r,this.error_message=s,this.error_url=n,this.request_id=a,this.status_code=e,this.error_details=i,this.message=`[${e}] ${r}
8${s}
9See ${n} for more information.
10`+(a?`request_id: ${a}
11`:"")+(this.error_details?`Details: 
12`+JSON.stringify(this.error_details)+`
13`:"")}}
13,_a=["unauthorized_credentials","user_unauthenticated","invalid_secret_authentication","session_not_found"],yn=class extends Error{constructor(t,e){super(e),this.name=t}},Ur=class Qo extends yn{constructor(e){super("StytchAPIUnreachableError",e),Object.setPrototypeOf(this,Qo.prototype)}},Jo=class extends yn{constructor(t){const e=t.body?.map(r=>`${r.dataPath}: ${r.message}`).join(`
14`);super("StytchAPISchemaError",`Request does not match expected schema
15${e}`)}},Ja=class en extends yn{error_type;error_message;error_url;request_id;status_code;error_details;constructor(e){const{status_code:r,error_type:s,error_message:n,error_url:a,request_id:i,error_details:o}=e;super("StytchAPIError",`[${r}] ${s}
16${n}
17See ${a} for more information.
18`+(i?`request_id: ${i}
19`:"")+(o?`Details: 
20`+JSON.stringify(o)+`
21`:"")),this.error_type=s,this.error_message=n,this.error_url=a,this.request_id=i,this.status_code=r,this.error_details=o}static from(e){if(e instanceof en)return e;if(e&&typeof e=="object"){const s=e;if(typeof s.status_code=="number"&&typeof s.error_type=="string"&&typeof s.error_message=="string"&&typeof s.error_url=="string")return new en({status_code:s.status_code,error_type:s.error_type,error_message:s.error_message,error_url:s.error_url,request_id:typeof s.request_id=="string"?s.request_id:void 0,error_details:typeof s.error_details=="object"?s.error_details:void 0})}const r=e instanceof Error?e.message:"Unknown error: "+String(e);return new en({status_code:400,error_type:"unknown_error",error_message:r,error_url:"",request_id:void 0,error_details:void 0})}},Zo=class extends yn{options;constructor(t,e,r){super(t,e),this.options=r}},dC=class extends Zo{constructor(){super("NoCurrentSessionError","There is no session currently available. Make sure the user is authenticated with a valid session.")}},fC=class extends Zo{constructor(t){super("IDPOAuthFlowMissingParamError",t)}},qf=class At{static inflate(e,r){const s=new e(r);return Object.assign(s,r),Object.setPrototypeOf(s,e.prototype),s}static unmarshall(e){if("name"in e)switch(e.name){case"SDKAPIUnreachableError":return At.inflate(Vf,e);case"StytchSDKSchemaError":return At.inflate(Uf,e);case"StytchAPIUnreachableError":return At.inflate(Ur,e);case"StytchAPISchemaError":return At.inflate(Jo,e);case"StytchSDKAPIError":return At.inflate(zf,e);case"StytchAPIError":return At.inflate(Ja,e);case"TypeError":return At.inflate(TypeError,e);case"SyntaxError":return At.inflate(SyntaxError,e);case"ReferenceError":return At.inflate(ReferenceError,e);case"RangeError":return At.inflate(RangeError,e);case"EvalError":return At.inflate(EvalError,e);case"URIError":return At.inflate(URIError,e)}return At.inflate(Error,e)}},Wf=class{iframeURL;frame;constructor(t){this.iframeURL=t,this.createIframe()}createIframe(){let t=document.querySelector(`[src~="${this.iframeURL}"]`);if(t?ct.warn(Yo):(t=document.createElement("iframe"),t.src=this.iframeURL,t.style.position="absolute",t.style.width="0",t.style.height="0",t.style.border="0",t.role="none",document.body.appendChild(t)),t.dataset.loaded==="true"){this.frame=Promise.resolve(t);return}this.frame=new Promise(e=>{t.addEventListener("load",()=>{t.dataset.loaded="true",e(t)},{once:!0})})}async call(t,e){const r=await this.frame,s=new MessageChannel;return new Promise((n,a)=>{s.port1.onmessage=o=>{const l=o.data;s.port1.close(),l.success?n(l.payload):a(qf.unmarshall(l.error))};const i={method:t,args:e};r.contentWindow?.postMessage(i,this.iframeURL,[s.port2])})}},Hf=class{iframeURL;_frameClient;constructor(t){this.iframeURL=t}get frameClient(){return this._frameClient=this._frameClient??new Wf(this.iframeURL),this._frameClient}call(t,e){return this.frameClient.call(t,[e])}oneTapStart=t=>this.call("oneTapStart",t);oneTapSubmit=t=>this.call("oneTapSubmit",t);parsedPhoneNumber=t=>this.call("parsedPhoneNumber",t);getExamplePhoneNumber=t=>this.call("getExamplePhoneNumber",t)},$s,Kf=new Uint8Array(16);function Gf(){if(!$s&&($s=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!$s))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $s(Kf)}var Yf=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Xf(t){return typeof t=="string"&&Yf.test(t)}var ut=[];for(var ra=0;ra<256;++ra)ut.push((ra+256).toString(16).substr(1));function Qf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(ut[t[e+0]]+ut[t[e+1]]+ut[t[e+2]]+ut[t[e+3]]+"-"+ut[t[e+4]]+ut[t[e+5]]+"-"+ut[t[e+6]]+ut[t[e+7]]+"-"+ut[t[e+8]]+ut[t[e+9]]+"-"+ut[t[e+10]]+ut[t[e+11]]+ut[t[e+12]]+ut[t[e+13]]+ut[t[e+14]]+ut[t[e+15]]).toLowerCase();
21if(!Xf(r))throw TypeError("Stringified UUID is invalid");return r}function Za(t,e,r){t=t||{};var s=t.random||(t.rng||Gf)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Qf(s)}var bn=t=>t.includes("public-token-test"),Jf=()=>`event-id-${Za()}`,Zf=()=>`app-session-id-${Za()}`,ep=()=>`persistent-id-${Za()}`,tp=class{maxBatchSize;logEventURL;batch;constructor(t){this.maxBatchSize=t.maxBatchSize,this.logEventURL=t.logEventURL,setInterval(this.flush.bind(this),t.intervalDurationMs),this.batch=[]}logEvent(t,e){this.batch.push({telemetry:t,event:e}),this.batch.length>=this.maxBatchSize&&this.flush()}async flush(){if(!this.batch.length)return;const t=this.batch;this.batch=[];try{await fetch(this.logEventURL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}}},rp=(function(t){return t.RequiredCaptcha="CAPTCHA required",t})({}),el=class extends Error{type;constructor(t){super(t),this.type=t}};async function sp({method:t,finalURL:e,basicAuthHeader:r,xSDKClientHeader:s,xSDKParentHostHeader:n,body:a,retryCallback:i}){let o={method:t,finalURL:e,basicAuthHeader:r,xSDKClientHeader:s,xSDKParentHostHeader:n,body:a};try{return await Sa(o)}catch(l){if(l instanceof el)return o=await i(l,o),await Sa(o);throw l}}async function Sa({method:t,finalURL:e,basicAuthHeader:r,xSDKClientHeader:s,xSDKParentHostHeader:n,body:a}){const i={Authorization:r,"Content-Type":"application/json","X-SDK-Client":s};n&&(i["X-SDK-Parent-Host"]=n);const o={method:t,headers:i,body:a&&JSON.stringify(a),credentials:"include"};let l;try{l=await fetch(e,o)}catch(u){throw u.message==="Failed to fetch"?new Ur("Unable to contact our servers."):u}if(l.status<=299)try{return(await l.json()).data}catch{throw new Ur("Invalid JSON response from our servers.")}if(l.status!==200&&l.headers.get("content-type")?.includes("application/json")){let u;try{u=await l.json()}catch{throw new Ur("Invalid or no response from server")}throw"body"in u||"params"in u||"query"in u?new Jo(u):new Ja(u)}let c;try{c=await l.text()}catch{throw new Ur("Invalid response from our servers.")}throw c.includes("Captcha required")?new el("CAPTCHA required"):new Ur("Invalid response from our servers.")}async function np({method:t,finalURL:e,basicAuthHeader:r,xSDKClientHeader:s,xSDKParentHostHeader:n,body:a}){const i={...a||{},__Authorization:r,"__X-SDK-Client":s};n&&(i["__X-SDK-Parent-Host"]=n);const o=Object.entries(i).map(([c,u])=>{const d=document.createElement("input");return d.type="hidden",d.name=c,d.value=u,d}),l=document.createElement("form");l.method=t,l.action=e,l.append(...o),document.body.appendChild(l),l.submit()}var ap=class{_publicToken;_subscriptionDataLayer;additionalTelemetryDataFn;eventLogger;baseURL;constructor(t,e,r,s,n){this._publicToken=t,this._subscriptionDataLayer=e,this.additionalTelemetryDataFn=n,this.baseURL=r,bn(t)&&(this.baseURL=s),this.eventLogger=new tp({maxBatchSize:15,intervalDurationMs:800,logEventURL:this.buildSDKUrl("/events")})}updateSessionToken=()=>null;logEvent({name:t,details:e,error:r={}}){this.eventLogger.logEvent(this.createTelemetryBlob(),{public_token:this._publicToken,event_name:t,details:e,error_code:r.error_code,error_description:r.error_description,http_status_code:r.http_status_code})}createTelemetryBlob(){return{event_id:Jf(),app_session_id:Zf(),persistent_id:ep(),client_sent_at:new Date().toISOString(),timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,...this.additionalTelemetryDataFn(),app:{identifier:window.location.hostname},sdk:{identifier:"Stytch.js Javascript SDK",version:"@stytch/[email protected]"}}}async fetchSDK({url:t,body:e,method:r}){const s=this._subscriptionDataLayer.readSessionCookie().session_token,n="Basic "+window.btoa(this._publicToken+":"+(s||this._publicToken)),a=window.btoa(JSON.stringify(this.createTelemetryBlob())),i=window.location.origin;return Sa({basicAuthHeader:n,body:e,finalURL:this.buildSDKUrl(t),method:r,xSDKClientHeader:a,xSDKParentHostHeader:i})}async submitFormSDK({url:t,body:e,method:r}){const s=this._subscriptionDataLayer.readSessionCookie().session_token,n="Basic "+window.btoa(this._publicToken+":"+(s||this._publicToken)),a=window.btoa(JSON.stringify(this.createTelemetryBlob())),i=window.location.origin;return np({basicAuthHeader:n,body:e,finalURL:this.buildSDKUrl(t),method:r,xSDKClientHeader:a,xSDKParentHostHeader:i})}async retriableFetchSDK({url:t,body:e,method:r,retryCallback:s}){const n=this._subscriptionDataLayer.readSessionCookie().session_token,a="Basic "+window.btoa(this._publicToken+":"+(n||this._publicToken)),i=window.btoa(JSON.stringify(this.createTelemetryBlob())),o=window.location.origin;return sp({basicAuthHeader:a,body:e,finalURL:this.buildSDKUrl(t),method:r,xSDKClientHeader:i,xSDKParentHostHeader:o,retryCallback:s})}buildSDKUrl(t){return`${this.baseURL}
21/sdk/v1${t}`}},ip="PKCE_VERIFIER";function op(t){let e=t.toString(16);return e.length===1&&(e="0"+e),e}function lp(t){return btoa(String.fromCharCode.call(null,...new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Vs=class tl{_dataLayer;namespace;constructor(e,r){this._dataLayer=e,this.namespace=r}key(){return`${ip}:${this.namespace}`}async startPKCETransaction(){const e=await tl.createProofkeyPair();return this._dataLayer.setItem(this.key(),JSON.stringify(e)),e}getPKPair(){const e=this._dataLayer.getItem(this.key());if(e!==null)try{return JSON.parse(e)}catch{ct.warn("Found malformed Proof Key pair in localstorage.");return}}clearPKPair(){return this._dataLayer.removeItem(this.key())}static async createProofkeyPair(){const e=new Uint32Array(16);window.crypto.getRandomValues(e);const r=Array.from(e).map(op).join("");return{code_challenge:lp(await window.crypto.subtle.digest("SHA-256",new TextEncoder().encode(r))),code_verifier:r}}};function Bs(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var s in r)s!=="__proto__"&&(t[s]=r[s])}return t}var cp={read:function(t){return t[0]==='"'&&(t=t.slice(1,-1)),t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function wa(t,e){function r(n,a,i){if(!(typeof document>"u")){i=Bs({},e,i),typeof i.expires=="number"&&(i.expires=new Date(Date.now()+i.expires*864e5)),i.expires&&(i.expires=i.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var l in i)i[l]&&(o+="; "+l,i[l]!==!0&&(o+="="+i[l].split(";")[0]));return document.cookie=n+"="+t.write(a,n)+o}}function s(n){if(!(typeof document>"u"||arguments.length&&!n)){for(var a=document.cookie?document.cookie.split("; "):[],i={},o=0;o<a.length;o++){var l=a[o].split("="),c=l.slice(1).join("=");try{var u=decodeURIComponent(l[0]);if(u in i||(i[u]=t.read(c,u)),n===u)break}catch{}}return n?i[n]:i}}return Object.create({set:r,get:s,remove:function(n,a){r(n,"",Bs({},a,{expires:-1}))},withAttributes:function(n){return wa(this.converter,Bs({},this.attributes,n))},withConverter:function(n){return wa(Bs({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(e)},converter:{value:Object.freeze(t)}})}var or=wa(cp,{path:"/"}),pC=/^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,mC=(t,e=500)=>{let r;return(...s)=>{clearTimeout(r),r=window.setTimeout(()=>t(...s),e)}},up=()=>!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)),Us=t=>(document.cookie?document.cookie.split("; "):[]).filter(e=>{const[r]=e.split("=");return t===r}).length>1,hC=()=>{},dp="stytch_sdk_state_",tn=(t,e)=>`${dp}${t}${e?`::${e}`:""}`;function rl(t){return t==null?{getItem(){return null},removeItem(){},setItem(){}}:{getItem(e,r){const s=tn(e,r);try{return t.getItem(s)}catch{return null}},setItem(e,r,s){const n=tn(e,r);try{s&&t.setItem(n,s)}catch{}},removeItem(e,r){const s=tn(e,r);try{t.removeItem(s)}catch{}}}}var fp=rl(globalThis.localStorage),pp=rl(globalThis.sessionStorage);function $i(t,e){return{getItem(r){return t.getItem(e,r)},setItem(r,s){t.setItem(e,r,s)},removeItem(r){t.removeItem(e,r)}}}var mp="stytch_session",hp="stytch_session_jwt",gp="stytch_intermediate_session_token",Vi="seen_domains",vp=class ds{publicToken;state;_opaqueTokenCookieName=null;_jwtCookieName=null;_cookiePath=null;_domain=null;_cookieAvailableToSubdomains=!1;_istCookieName=null;subscriptions;_localStorage;browserSessionStorage;constructor(e,r){this.publicToken=e,this.state=null,this.subscriptions={},this._localStorage=$i(fp,e),this.browserSessionStorage=$i(pp,e),r?.cookieOptions&&(this._opaqueTokenCookieName=r.cookieOptions.opaqueTokenCookieName||null,this._jwtCookieName=r.cookieOptions.jwtCookieName||null,this._cookiePath=r.cookieOptions.path||null,this._domain=r.cookieOptions.domain||null,this._cookieAvailableToSubdomains=r.cookieOptions.availableToSubdomains||!1,this._istCookieName=r.cookieOptions.istCookieName||null);const s=this._localStorage.getItem("");
21if(!s)return;let n;try{n=JSON.parse(s)}catch{this.syncToLocalStorage();return}this.state=n}get opaqueTokenCookieName(){return this._opaqueTokenCookieName??mp}get jwtCookieName(){return this._jwtCookieName??hp}get istCookieName(){return this._istCookieName??gp}readSessionCookie(){return{session_token:or.get(this.opaqueTokenCookieName),session_jwt:or.get(this.jwtCookieName)}}readIntermediateSessionTokenCookie(){return or.get(this.istCookieName)}writeSessionCookie(e){const{state:r,session_token:s,session_jwt:n}=e,a=ds.generateCookieOpts({expiresAt:r?.session?.expires_at??"",availableToSubdomains:this._cookieAvailableToSubdomains,path:this._cookiePath,domain:this._domain});a.domain&&this.addSeenDomain(a.domain),or.set(this.opaqueTokenCookieName,s,a),or.set(this.jwtCookieName,n,a);const i=ds.generateCookieOpts({expiresAt:r?.session?.expires_at??"",availableToSubdomains:!this._cookieAvailableToSubdomains,path:this._cookiePath,domain:this._domain});i.domain&&this.addSeenDomain(i.domain),Us(this.jwtCookieName)&&or.remove(this.jwtCookieName,i),Us(this.opaqueTokenCookieName)&&or.remove(this.opaqueTokenCookieName,i),Us(this.jwtCookieName)&&ct.warn("Could not remove extraneous JWT cookie. This might happen if the cookie has been set using multiple `path` settings, and may produce unwanted behavior."),Us(this.opaqueTokenCookieName)&&ct.warn("Could not remove extraneous opaque token cookie.")}writeIntermediateSessionTokenCookie(e){const r=new Date(Date.now()+6e5),s=ds.generateCookieOpts({expiresAt:r.toString(),availableToSubdomains:this._cookieAvailableToSubdomains,path:this._cookiePath,domain:this._domain});or.set(this.istCookieName,e,s)}removeSessionCookie(){this.removeCookies([this.opaqueTokenCookieName,this.jwtCookieName])}removeISTCookie(){this.removeCookies([this.istCookieName])}
21removeCookies(e){const r=this.getSeenDomains(),s=[this._domain,null,...r],n=[...new Set(s)];[!0,!1].forEach(a=>{[this._cookiePath,null].forEach(i=>{n.forEach(o=>{const l=ds.generateCookieOpts({expiresAt:new Date(0).toString(),availableToSubdomains:a,path:i,domain:o});e.forEach(c=>{or.remove(c,l)})})})})}syncToLocalStorage(){this._localStorage.setItem("",JSON.stringify(this.state))}getItem(e){return this._localStorage.getItem(e)}setItem(e,r){this._localStorage.setItem(e,r)}removeItem(e){this._localStorage.removeItem(e)}getSeenDomains(){const e=this.getItem(Vi);if(!e)return[];try{const r=JSON.parse(e);return Array.isArray(r)?r:[]}catch{return[]}}addSeenDomain(e){if(!e)return;const r=this.getSeenDomains();r.includes(e)||(r.push(e),this.setItem(Vi,JSON.stringify(r)))}static generateCookieOpts({path:e,domain:r,availableToSubdomains:s,expiresAt:n}){const a={expires:new Date(n),sameSite:"lax"};return e&&(a.path=e),up()?a.secure=!1:(s&&(a.domain=r||window.location.host),a.secure=!0),a}},yp=class extends vp{},sa=Symbol.for("__stytch_b2b_DataLayer"),bp=()=>{const t=window;return t[sa]||(t[sa]={}),t[sa]},_p=(t,e)=>{const r=bp();return r[t]||(r[t]=new yp(t,e)),r[t]},Sp=(t,e)=>{const r=Math.random().toString(36).slice(-10);return t[r]=e,()=>delete t[r]},Bi=(t,e)=>{Object.values(t).forEach(r=>r(e))},Ui=ou({KEYS_TO_EXCLUDE:["last_accessed_at"]}),wp=class{_publicToken;_datalayer;fromCache=!0;constructor(t,e,{usingCustomApiEndpoint:r}){if(this._publicToken=t,this._datalayer=e,window.addEventListener("storage",this._listen),!r){const{session_token:s}=this._datalayer.readSessionCookie();if(!s){this.destroySession();return}}}_listen=t=>{if(t.key!==tn(this._publicToken,""))return;const e=t.newValue===null||t.newValue==="null"?null:JSON.parse(t.newValue);this.updateState(e,!0)};getTokens(){const{session_token:t,session_jwt:e}=this._datalayer.readSessionCookie();return typeof t!="string"||typeof e!="string"?null:{session_token:t,session_jwt:e}}getIntermediateSessionToken(){return this._datalayer.readIntermediateSessionTokenCookie()||null}destroyState(){this.updateStateAndTokens({state:null,session_token:null,session_jwt:null,intermediate_session_token:null})}destroySession(){this._datalayer.removeSessionCookie(),this.updateState(null)}_updateStateAndTokensInternal(t,e){const r=this._datalayer.state,s=t.state===null?null:{...this._datalayer.state,...t.state};this._datalayer.state=s;const n=this.getFromCache();if(this.setCacheRefreshed(),n||!Ui(r,s)){let a;s==null||e.fromCache?a=s:a={...s,sessionDurationMinutes:e.sessionDurationMinutes},Bi(this._datalayer.subscriptions,a)}}updateStateAndTokens(t,e={fromCache:!1}){t.state?(typeof t.session_token=="string"?this._datalayer.writeSessionCookie(t):this._datalayer.removeSessionCookie(),this._datalayer.removeISTCookie()):t.intermediate_session_token?(typeof t.intermediate_session_token=="string"?this._datalayer.writeIntermediateSessionTokenCookie(t.intermediate_session_token):this._datalayer.removeISTCookie(),this._datalayer.removeSessionCookie()):(this._datalayer.removeSessionCookie(),this._datalayer.removeISTCookie()),this._updateStateAndTokensInternal(t,e),this._datalayer.syncToLocalStorage()}updateState(t,e=!1){const r=this._datalayer.state,s=t===null?null:{...this._datalayer.state,...t};this._datalayer.state=s;const n=this.getFromCache();this.setCacheRefreshed();const a=!Ui(r,s);(n||a)&&(Bi(this._datalayer.subscriptions,s),a&&!e&&this._datalayer.syncToLocalStorage())}updateTokens(t){const{session_token:e,session_jwt:r}=t,s={...this._datalayer.readSessionCookie(),session_token:e,session_jwt:r};typeof e=="string"||typeof r=="string"?(this._datalayer.writeSessionCookie(s),this._datalayer.removeISTCookie()):this._datalayer.removeSessionCookie()}subscribeToState(t){return Sp(this._datalayer.subscriptions,t)}getState(){return this._datalayer.state}destroy(){window.removeEventListener("storage",this._listen)}syncFromDeviceStorage(){return null}getFromCache(){return this.fromCache}setCacheRefreshed(){this.fromCache=!1}},xp=class extends wp{updateMember=t=>this.updateState({member:t});getMember=()=>this.getState()?.member??null;updateOrganization=t=>this.updateState({organization:t});getOrganization=()=>this.getState()?.organization??null;getSession=()=>this.getState()?.session??null;updateSession=(t,e)=>{if("member_session"in t&&t.member_session){const r=t.session_token&&t.session_jwt?{session_token:t.session_token,session_jwt:t.session_jwt}:{session_token:!0,session_jwt:!0};this.updateStateAndTokens({state:{session:t.member_session,member:t.member,organization:t.organization},...r,intermediate_session_token:null},{fromCache:!1,sessionDurationMinutes:e?.sessionDurationMinutes})}
21else this.updateStateAndTokens({state:null,session_token:null,session_jwt:null,intermediate_session_token:t.intermediate_session_token||!0},{fromCache:!1,sessionDurationMinutes:e?.sessionDurationMinutes})};withUpdateSession=t=>async e=>{const r=await t(e);return this.updateSession(r,{sessionDurationMinutes:e?.session_duration_minutes}),r}},_n=t=>{try{return`https://${new URL(t).hostname}`}catch{}try{return`https://${new URL(`https://${t}`).hostname}`}catch{}},Cp=t=>{const e=t?.dfppaUrl??t?.endpointOptions?.dfppaDomain;if(e){const r=_n(e);if(r)return r;{const s=t?.dfppaUrl?"dfppaUrl":"dfppaDomain";ct.warn(`Unable to use custom DFPPA domain \`${e}\`. ${s} should be a valid domain.`)}}return t?.endpoints?.dfpBackendURL??Lf},Ap=t=>{const e=t?.dfpCdnUrl??t?.endpointOptions?.dfpCdnDomain;if(e){const r=_n(e);if(r)return r;{const s=t?.dfpCdnUrl?"dfpCdnUrl":"dfpCdnDomain";ct.warn(`Unable to use custom DFP CDN domain \`${e}\`. ${s} should be a valid domain.`)}}return Nf},kp=t=>{const e=t?.customBaseUrl??t?.endpointOptions?.apiDomain;if(e){const r=_n(e);if(r)return r;{const s=t?.customBaseUrl?"customBaseUrl":"apiDomain";ct.warn(`Unable to use custom API domain \`${e}\`. ${s} should be a valid domain.`)}}return t?.endpoints?.liveAPIURL??"https://api.stytch.com"},Ip=t=>{const e=t?.customBaseUrl??t?.endpointOptions?.testApiDomain;if(e){const r=_n(e);if(r)return r;{const s=t?.customBaseUrl?"customBaseUrl":"testApiDomain";ct.warn(`Unable to use custom API domain \`${e}\`. ${s} should be a valid domain.`)}}return t?.endpoints?.testAPIURL??"https://test.stytch.com"},Pp=(t,e={})=>{const{cookieOptions:r,keepSessionAlive:s}=e;return{cookieOptions:r,keepSessionAlive:s,endpoints:{testAPIURL:Ip(e),liveAPIURL:kp(e),dfpBackendURL:Cp(e),dfpCdnURL:Ap(e),clientsideServicesIframeURL:e?.endpoints?.clientsideServicesIframeURL??"https://js.stytch.com/clientside-services/index.html"}}},Ep=(t,e={})=>{const{customBaseUrl:r,endpointOptions:s}=e;return bn(t)?!!(r||s?.testApiDomain):!!(r||s?.apiDomain)};function Rp(t,e){return t.includes(e)}var Tp=()=>{const t=Op(window.location.toString());window.history.replaceState(null,document.title,t)},Mp=t=>{const e=Object.keys(t),r=(n=window.location.href)=>{const a=new URL(n),i=a.searchParams.get("stytch_token_type"),o=a.searchParams.get("token");return!o||!i?null:Rp(e,i)?{handled:!0,token:o,tokenType:i}:{handled:!1,token:o,tokenType:i}};return{authenticateByUrl:async({clearParams:n,...a},i=window.location.href)=>{const o=n??i===window.location.href,l=r(i);if(l==null)return null;if(!l.handled)return l;const{token:c,tokenType:u}=l,d=t[u];return o&&Tp(),{handled:!0,tokenType:u,data:await d(c,a)}},parseAuthenticateUrl:r}};function Op(t){const e=new URL(t),r=e.searchParams;return r.delete("token"),r.delete("stytch_token_type"),e}var xa=Symbol.for("stytch__internal_b2b"),Fp=(t,e)=>{Object.assign(t,{[xa]:e})},gC=t=>{const e=t;if(!e[xa])throw Error("Internals not found!");return e[xa]},vC={Discovery:"Discovery",Organization:"Organization",PasswordReset:"PasswordReset"},yC={ResetPassword:"reset_password"},Yt={Google:"google",Microsoft:"microsoft",HubSpot:"hubspot",Slack:"slack",GitHub:"github"},bC={smsOtp:"smsOtp",totp:"totp"},Dp=class{_networkClient;_subscriptionService;_pkceManager;_dynamicConfig;_config;dfpProtectedAuth;authenticate;discovery;google;microsoft;hubspot;slack;github;constructor(e,r,s,n,a,i){this._networkClient=e,this._subscriptionService=r,this._pkceManager=s,this._dynamicConfig=n,this._config=a,this.dfpProtectedAuth=i,this.authenticate=this._subscriptionService.withUpdateSession(async o=>{const l=await this._pkceManager.getPKPair();l||ct.warn(`No code verifier found in local storage for OAuth flow.
22Consider using stytch.oauth.$provider.start() to add PKCE to your OAuth flows for added security.
23See https://stytch.com/docs/oauth#guides_pkce for more information.`);const{dfp_telemetry_id:c,captcha_token:u}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),d=await this._networkClient.retriableFetchSDK({url:"/b2b/oauth/authenticate",method:"POST",body:{pkce_code_verifier:l?.code_verifier,dfp_telemetry_id:c,captcha_token:u,intermediate_session_token:await this._subscriptionService.getIntermediateSessionToken()||void 0,...o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});return this._pkceManager.clearPKPair(),d}),this.discovery={authenticate:this._subscriptionService.withUpdateSession(async o=>{const l=await this._pkceManager.getPKPair(),{dfp_telemetry_id:c,captcha_token:u}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),d={pkce_code_verifier:l?.code_verifier,dfp_telemetry_id:c,captcha_token:u,...o},h=await this._networkClient.retriableFetchSDK({url:"/b2b/oauth/discovery/authenticate",body:d,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});return this._pkceManager.clearPKPair(),h})},this.google={start:this.startOAuthFlow(Yt.Google),discovery:{start:this.startDiscoveryOAuthFlow(Yt.Google)}},this.microsoft={start:this.startOAuthFlow(Yt.Microsoft),discovery:{start:this.startDiscoveryOAuthFlow(Yt.Microsoft)}},this.hubspot={start:this.startOAuthFlow(Yt.HubSpot),discovery:{start:this.startDiscoveryOAuthFlow(Yt.HubSpot)}},this.slack={start:this.startOAuthFlow(Yt.Slack),discovery:{start:this.startDiscoveryOAuthFlow(Yt.Slack)}},this.github={start:this.startOAuthFlow(Yt.GitHub),discovery:{start:this.startDiscoveryOAuthFlow(Yt.GitHub)}}}async getBaseApiUrl(){const{cnameDomain:e}=await this._dynamicConfig;return e?`https://${e}`:bn(this._config.publicToken)?this._config.testAPIURL:this._config.liveAPIURL}startOAuthFlow(e){return async r=>{const{organization_id:s,organization_slug:n,login_redirect_url:a,signup_redirect_url:i,custom_scopes:o,provider_params:l}=r,{pkceRequiredForOAuth:c}=await this._dynamicConfig,u=await this.getBaseApiUrl(),d=new URL(`${u}/v1/b2b/public/oauth/${e}/start`);if(d.searchParams.set("public_token",this._config.publicToken),s&&s!=""&&d.searchParams.set("organization_id",s),n&&n!=""&&d.searchParams.set("slug",n),o&&d.searchParams.set("custom_scopes",o.join(" ")),l)for(const h in l)d.searchParams.set("provider_"+h,l[h]
23);if(c){const h=await this._pkceManager.startPKCETransaction();d.searchParams.set("pkce_code_challenge",h.code_challenge)}else this._pkceManager.clearPKPair();a&&d.searchParams.set("login_redirect_url",a),i&&d.searchParams.set("signup_redirect_url",i),this.navigate(d)}}startDiscoveryOAuthFlow(e){return async r=>{const{discovery_redirect_url:s,custom_scopes:n,provider_params:a}=r,{pkceRequiredForOAuth:i}=await this._dynamicConfig,o=await this.getBaseApiUrl(),l=new URL(`${o}/v1/b2b/public/oauth/${e}/discovery/start`);if(l.searchParams.set("public_token",this._config.publicToken),n&&l.searchParams.set("custom_scopes",n.join(" ")),a)for(const c in a)l.searchParams.set("provider_"+c,a[c]);if(i){const c=await this._pkceManager.startPKCETransaction();l.searchParams.set("pkce_code_challenge",c.code_challenge)}else this._pkceManager.clearPKPair();s&&l.searchParams.set("discovery_redirect_url",s),this.navigate(l)}}navigate(e){window.location.href=e.toString()}},Lp=t=>Qa(`${t}/telemetry.js`,()=>window.GetTelemetryID),Np=class{bootstrapPromise;state;constructor(t,e,r,s,n=()=>Promise.resolve(void 0)){this.bootstrapPromise=s,this.state=s.then(async a=>a.runDFPProtectedAuth?(await Lp(r),{publicToken:t,dfpBackendURL:e,enabled:!0,mode:a.dfpProtectedAuthMode||"OBSERVATION",loaded:!0,executeRecaptcha:n}):{publicToken:t,dfpBackendURL:e,enabled:!1,loaded:!1,executeRecaptcha:n})}isEnabled=async()=>this.state.then(t=>t.enabled);getTelemetryID=async()=>{const{publicToken:t,enabled:e,dfpBackendURL:r}=await this.state;if(e)return await window.GetTelemetryID(t,`${r}/submit`)};getDFPTelemetryIDAndCaptcha=async()=>{const{enabled:t,executeRecaptcha:e,mode:r}=await this.state;let s,n;return t||(n=await e()),r==="DECISIONING"?s=await this.getTelemetryID():r==="OBSERVATION"&&(s=await this.getTelemetryID(),n=await e()),{dfp_telemetry_id:s,captcha_token:n}};retryWithCaptchaAndDFP=async(t,e)=>{const{enabled:r,executeRecaptcha:s}=await this.state;if(t.type===rp.RequiredCaptcha&&r)return e.body&&(e.body.dfp_telemetry_id=await this.getTelemetryID(),e.body.captcha_token=await s()),e;throw new Error("Unable to query captcha and/or dfp telemetry ID")}},sl=()=>({isEnabled:async()=>!1,getTelemetryID:async()=>{},getDFPTelemetryIDAndCaptcha:async()=>({dfp_telemetry_id:void 0,captcha_token:void 0}),retryWithCaptchaAndDFP:async()=>{throw new Error("DFP protected auth is disabled")}}),jp=Promise.resolve({pkceRequiredForEmailMagicLinks:!1}),$p=class{_networkClient;_subscriptionService;_pkceManager;_passwordResetPKCEManager;_config;dfpProtectedAuth;email;authenticate;discovery;constructor(t,e,r,s,n=jp,a=sl()){this._networkClient=t,this._subscriptionService=e,this._pkceManager=r,this._passwordResetPKCEManager=s,this._config=n,this.dfpProtectedAuth=a,this.email={invite:async i=>this._networkClient.fetchSDK({url:"/b2b/magic_links/email/invite",body:i,method:"POST"}),loginOrSignup:async i=>{const o=await this.getCodeChallenge(),l={...i,pkce_code_challenge:o};return this._networkClient.fetchSDK({url:"/b2b/magic_links/email/login_or_signup",body:l,method:"POST"})},discovery:{send:async i=>{const{dfp_telemetry_id:o,captcha_token:l}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),c=await this.getCodeChallenge(),u={...i,pkce_code_challenge:c,dfp_telemetry_id:o,captcha_token:l};return this._networkClient.retriableFetchSDK({url:"/b2b/magic_links/email/discovery/send",body:u,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})}}},this.authenticate=this._subscriptionService.withUpdateSession(async i=>{const o=await this._passwordResetPKCEManager.getPKPair();let l=null;if(o?.code_verifier)try{l=await this.handlePKCEForAuthenticate(this._passwordResetPKCEManager,i)}catch(c){if(c.message.includes("pkce"))console.log("Authenticate with passwords pkce namespace failed. Falling back to authenticate with magic_links namespace.");else throw c}return l||(l=await this.handlePKCEForAuthenticate(this._pkceManager,i)),l}),this.discovery={authenticate:this._subscriptionService.withUpdateSession(async i=>{const o=await this._pkceManager.getPKPair(),{dfp_telemetry_id:l,captcha_token:c}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),u={pkce_code_verifier:o?.code_verifier,dfp_telemetry_id:l,captcha_token:c,...i},d=await this._networkClient.retriableFetchSDK({url:"/b2b/magic_links/discovery/authenticate",body:u,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});return this._pkceManager.clearPKPair(),d})}}
23async getCodeChallenge(){const{pkceRequiredForEmailMagicLinks:t}=await this._config;if(!t)return;let e=await this._pkceManager.getPKPair();return e||(e=await this._pkceManager.startPKCETransaction()),e.code_challenge}async handlePKCEForAuthenticate(t,e){const r=await t.getPKPair(),{dfp_telemetry_id:s,captcha_token:n}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),a={pkce_code_verifier:r?.code_verifier,dfp_telemetry_id:s,captcha_token:n,intermediate_session_token:await this._subscriptionService.getIntermediateSessionToken()||void 0,...e},i=await this._networkClient.retriableFetchSDK({url:"/b2b/magic_links/authenticate",body:a,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});return t.clearPKPair(),i}},Vp=Promise.resolve({pkceRequiredForPasswordResets:!1}),Bp=class{_networkClient;_subscriptionService;_pkceManager;_config;dfpProtectedAuth;authenticate;discovery;resetByEmail;resetByExistingPassword;resetBySession;constructor(t,e,r,s=Vp,n){this._networkClient=t,this._subscriptionService=e,this._pkceManager=r,this._config=s,this.dfpProtectedAuth=n,this.authenticate=this._subscriptionService.withUpdateSession(async a=>{const i=(await this._pkceManager.getPKPair())?.code_verifier,{dfp_telemetry_id:o,captcha_token:l}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/passwords/authenticate",method:"POST",body:{organization_id:a.organization_id,email_address:a.email_address,password:a.password,session_duration_minutes:a.session_duration_minutes,locale:a.locale,captcha_token:l,dfp_telemetry_id:o,code_verifier:i,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})}),this.discovery={resetByEmailStart:async a=>{const i=await this.getCodeChallenge(),{dfp_telemetry_id:o,captcha_token:l}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/passwords/discovery/reset/start",method:"POST",body:{email_address:a.email_address,discovery_redirect_url:a.discovery_redirect_url,reset_password_redirect_url:a.reset_password_redirect_url,reset_password_expiration_minutes:a.reset_password_expiration_minutes,reset_password_template_id:a.reset_password_template_id,verify_email_template_id:a.verify_email_template_id,locale:a.locale,pkce_code_challenge:i,captcha_token:l,dfp_telemetry_id:o},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})},resetByEmail:this._subscriptionService.withUpdateSession(async a=>{const{dfp_telemetry_id:i,captcha_token:o}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),l=(await this._pkceManager.getPKPair())?.code_verifier,c=await this._networkClient.retriableFetchSDK({url:"/b2b/passwords/discovery/reset",method:"POST",body:{password_reset_token:a.password_reset_token,password:a.password,captcha_token:o,dfp_telemetry_id:i,pkce_code_verifier:l,intermediate_session_token:await this._subscriptionService.getIntermediateSessionToken()||void 0},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});return this._pkceManager.clearPKPair(),c}),authenticate:this._subscriptionService.withUpdateSession(async a=>{const i=(await this._pkceManager.getPKPair())?.code_verifier,{dfp_telemetry_id:o,captcha_token:l}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/passwords/discovery/authenticate",method:"POST",body:{email_address:a.email_address,password:a.password,captcha_token:l,dfp_telemetry_id:o,code_verifier:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})})},this.resetByEmail=this._subscriptionService.withUpdateSession(async a=>{const{dfp_telemetry_id:i,captcha_token:o}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),l=(await this._pkceManager.getPKPair())?.code_verifier,c=await this._networkClient.retriableFetchSDK({url:"/b2b/passwords/email/reset",method:"POST",body:{password_reset_token:a.password_reset_token,password:a.password,session_duration_minutes:a.session_duration_minutes,locale:a.locale,captcha_token:o,dfp_telemetry_id:i,code_verifier:l,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});return this._pkceManager.clearPKPair(),c}),this.resetByExistingPassword=this._subscriptionService.withUpdateSession(async a=>{const{dfp_telemetry_id:i,captcha_token:o}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/passwords/existing_password/reset",method:"POST",body:{organization_id:a.organization_id,email_address:a.email_address,existing_password:a.existing_password,new_password:a.new_password,locale:a.locale,session_duration_minutes:a.session_duration_minutes,c
23aptcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})}),this.resetBySession=this._subscriptionService.withUpdateSession(async a=>{const{dfp_telemetry_id:i,captcha_token:o}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/passwords/session/reset",method:"POST",body:{password:a.password,captcha_token:o,dfp_telemetry_id:i},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})})}async getCodeChallenge(){const{pkceRequiredForPasswordResets:t}=await this._config;if(!t)return;let e=await this._pkceManager.getPKPair();return e||(e=await this._pkceManager.startPKCETransaction()),e.code_challenge}async resetByEmailStart(t){const e=await this.getCodeChallenge(),{dfp_telemetry_id:r,captcha_token:s}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/passwords/email/reset/start",method:"POST",body:{organization_id:t.organization_id,email_address:t.email_address,login_redirect_url:t.login_redirect_url,reset_password_redirect_url:t.reset_password_redirect_url,reset_password_expiration_minutes:t.reset_password_expiration_minutes,reset_password_template_id:t.reset_password_template_id,verify_email_template_id:t.verify_email_template_id,locale:t.locale,code_challenge:e,captcha_token:s,dfp_telemetry_id:r},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})}async strengthCheck(t){return this._networkClient.fetchSDK({url:"/b2b/passwords/strength_check",method:"POST",body:{email_address:t.email_address,password:t.password}})}},Wr={embedded:"embedded",floating:"floating",embeddedOnly:"embeddedOnly",floatingOrEmbedded:"floatingOrEmbedded",forceLegacyEmbedded:"forceLegacyEmbedded"},SC=(function(t){return t.MagicLinkLoginOrCreateEvent="MAGIC_LINK_LOGIN_OR_CREATE",t.OTPsLoginOrCreateEvent="OTP_LOGIN_OR_CREATE",t.OTPsAuthenticate="OTP_AUTHENTICATE",t.CryptoWalletAuthenticateStart="CRYPTO_WALLET_AUTHENTICATE_START",t.CryptoWalletAuthenticate="CRYPTO_WALLET_AUTHENTICATE",t.PasswordCreate="PASSWORD_CREATE",t.PasswordAuthenticate="PASSWORD_AUTHENTICATE",t.PasswordResetByEmailStart="PASSWORD_RESET_BY_EMAIL_START",t.PasswordResetByEmail="PASSWORD_RESET_BY_EMAIL",t.PasskeyRegister="PASSKEY_REGISTER",t.PasskeyAuthenticate="PASSKEY_AUTHENTICATE",t.PasskeySkip="PASSKEY_SKIP",t.PasskeyDone="PASSKEY_DONE",t.AuthenticateFlowComplete="AUTHENTICATE_FLOW_COMPLETE",t.OAuthAuthorizeFlowStart="OAUTH_AUTHORIZE_FLOW_START",t.OAuthAuthorizeFlowComplete="OAUTH_AUTHORIZE_FLOW_COMPLETE",t.OAuthAuthorizeFlowConsentDenied="OAUTH_AUTHORIZE_FLOW_CONSENT_DENIED",t.B2BMagicLinkEmailLoginOrSignup="B2B_MAGIC_LINK_EMAIL_LOGIN_OR_SIGNUP",t.B2BMagicLinkAuthenticate="B2B_MAGIC_LINK_AUTHENTICATE",t.B2BMagicLinkEmailDiscoverySend="B2B_MAGIC_LINK_EMAIL_DISCOVERY_SEND",t.B2BMagicLinkDiscoveryAuthenticate="B2B_MAGIC_LINK_DISCOVERY_AUTHENTICATE",t.B2BSSOStart="B2B_SSO_START",t.B2BSSOAuthenticate="B2B_SSO_AUTHENTICATE",t.B2BSSODiscoverConnections="B2B_SSO_DISCOVER_CONNECTIONS",t.B2BOAuthAuthenticate="B2B_OAUTH_AUTHENTICATE",t.B2BOAuthDiscoveryAuthenticate="B2B_OAUTH_DISCOVERY_AUTHENTICATE",t.B2BDiscoveryOrganizationsCreate="B2B_DISCOVERY_ORGANIZATIONS_CREATE",t.B2BDiscoveryIntermediateSessionExchange="B2B_DISCOVERY_INTERMEDIATE_SESSION_EXCHANGE",t.B2BPasswordAuthenticate="B2B_PASSWORD_AUTHENTICATE",t.B2BPasswordDiscoveryAuthenticate="B2B_PASSWORD_DISCOVERY_AUTHENTICATE",t.B2BPasswordResetByEmailStart="B2B_PASSWORD_RESET_BY_EMAIL_START",t.B2BPasswordResetByEmail="B2B_PASSWORD_RESET_BY_EMAIL",t.B2BPasswordResetBySession="B2B_PASSWORD_RESET_BY_SESSION",t.B2BSMSOTPSend="B2B_SMS_OTP_SEND",t.B2BSMSOTPAuthenticate="B2B_SMS_OTP_AUTHENTICATE",t.B2BTOTPCreate="B2B_TOTP_CREATE",t.B2BTOTPAuthenticate="B2B_TOTP_AUTHENTICATE",t.B2BRecoveryCodesRecover="B2B_RECOVERY_CODES_RECOVER",t.B2BPasswordDiscoveryResetStart="B2B_PASSWORD_DISCOVERY_RESET_BY_EMAIL_START",t.B2BDiscoveryPasswordReset="B2B_PASSWORD_DISCOVERY_RESET_BY_EMAIL",t.B2BImpersonationAuthenticate="B2B_IMPERSONATION_AUTHENTICATE",t.B2BOTPsEmailAuthenticate="B2B_OTPS_EMAIL_AUTHENTICATE",t.B2BOTPsEmailDiscoveryAuthenticate="B2B_OTPS_EMAIL_DISCOVERY_AUTHENTICATE",t.B2BOTPsEmailDiscoverySend="B2B_OTPS_EMAIL_DISCOVERY_SEND",t.B2BOTPsEmailLoginOrSignup="B2B_OTPS_EMAIL_LOGIN_OR_SIGNUP",t.B2BOrganizationsGetBySlug="B2B_ORGANIZATIONS_GET_BY_SLUG",t})({}),Up=class extends Dp{_oneTap;constructor(t,e,r,s,n,a=sl(),i){super(t,e,r,s,n,a),this._oneTap=i}startOneTapDiscovery=async t=>{const e=await this._oneTap.createOneTapClient();if(!e.success)throw new Error(`One Tap could not load: ${e.reason}`);const{client:r}=e,s=this._oneTap.createOnDiscoverySuccessHandler({discoveryRedirectUrl:t.discovery_redirect_url,onSuccess:this._oneTap.redirectOnSuccess});return r.render({style:{position:Wr.floating},callback:s,cancelOnTapOutside:t.cancel_on_tap_outside})};startOneTap=async t=>{if(!t.organization_id)throw new Bf("stytch.oauth.googleOneTap.start","organization_id is a required argument");const e=await this._oneTap.createOneTapClient();if(!e.success)throw new Error(`One Tap could not load: ${e.reason}`);const{client:r}=e,s=this._oneTap.createOnSuccessHandler({organizationId:t.organization_id,signupRedirectUrl:t.signup_redirect_url,loginRedirectUrl:t.login_redirect_url,onSuccess:this._oneTap.redirectOnSuccess});return r.render({style:{position:Wr.floating},callback:s,cancelOnTapOutside:t.cancel_on_tap_outside})};googleOneTap={discovery:{start:this.startOneTapDiscovery},start:this.startOneTap}},zp=typeof window<"u"&&"IdentityCredential"in window,nl=t=>t===Wr.forceLegacyEmbedded?"force":t===Wr.embeddedOnly||t===Wr.embedded||t===Wr.floatingOrEmbedded,qp=t=>{const e=nl(t);return e==="force"||e&&!zp},Wp=class{_googleClient;_clientId;constructor(t,e){this._googleClient=t,this._clientId=e}cancel(){this._googleClient.cancel()}async render({callback:t,onOneTapCancelled:e,style:r,cancelOnTapOutside:s=!0}
23){const n=nl(r.position),a=qp(r.position),i={client_id:this._clientId,callback:t,auto_select:!1,context:"use",itp_support:!0,use_fedcm_for_prompt:n!=="force",cancel_on_tap_outside:s};return a&&(i.prompt_parent_id="google-parent-prompt",i.cancel_on_tap_outside=!1),this._googleClient.initialize(i),new Promise(o=>{this._googleClient.prompt(l=>{if(l.isSkippedMoment()){const c=l.getSkippedReason?.()??"unknown_reason";return c==="user_cancel"&&e?.(),o({success:!1,reason:c})}if(!l.isNotDisplayed&&a||l.isNotDisplayed?.())return o({success:!1,reason:l.getNotDisplayedReason?.()??"unknown_reason"});if(!l.isDismissedMoment())return this.styleFrame(a),o({success:!0})})})}styleFrame(t){t&&Array.from(document.getElementsByTagName("iframe")).forEach(e=>{e.src.includes("https://accounts.google.com/gsi")&&(e.style.width="100%")})}},Hp=()=>Qa($f,()=>window.google.accounts.id),Kp=Promise.resolve({pkceRequiredForOAuth:!1}),Gp=class{_networkClient;_pkceManager;_config;googleClientID;constructor(t,e,r=Kp){this._networkClient=t,this._pkceManager=e,this._config=r}
23async fetchGoogleStart(){if(this.googleClientID)return this.googleClientID;const t=await this._networkClient.fetchSDK({url:"/b2b/oauth/google/onetap/start",method:"GET"});return this.googleClientID=t.google_client_id,this.googleClientID}async submitGoogleOneTapTokenDiscovery({credential:t,discoveryRedirectUrl:e}){let r;const{pkceRequiredForOAuth:s}=await this._config;return s?r=(await this._pkceManager.startPKCETransaction()).code_challenge:this._pkceManager.clearPKPair(),await this._networkClient.fetchSDK({url:"/b2b/oauth/google/onetap/discovery/submit",method:"POST",body:{id_token:t,discovery_redirect_url:e,pkce_code_challenge:r}})}async submitGoogleOneTapToken({credential:t,organizationId:e,signupRedirectUrl:r,loginRedirectUrl:s}){let n;const{pkceRequiredForOAuth:a}=await this._config;return a?n=(await this._pkceManager.startPKCETransaction()).code_challenge:this._pkceManager.clearPKPair(),await this._networkClient.fetchSDK({url:"/b2b/oauth/google/onetap/submit",method:"POST",body:{id_token:t,organization_id:e,signup_redirect_url:r,login_redirect_url:s,pkce_code_challenge:n}})}async createOneTapClient(){let t;try{t=await this.fetchGoogleStart()}catch(e){return{success:!1,reason:Ja.from(e).error_type}}return t===""?{success:!1,reason:"oauth_config_not_found"}:{success:!0,client:new Wp(await Hp(),t)}}createOnDiscoverySuccessHandler=({discoveryRedirectUrl:t,onSuccess:e,onError:r})=>async s=>{const{credential:n}=s;let a=this.submitGoogleOneTapTokenDiscovery({credential:n,discoveryRedirectUrl:t}).then(i=>e(i.redirect_url));r&&(a=a.catch(i=>r(i))),await a};createOnSuccessHandler=({organizationId:t,signupRedirectUrl:e,loginRedirectUrl:r,onSuccess:s,onError:n})=>async a=>{const{credential:i}=a;let o=this.submitGoogleOneTapToken({credential:i,organizationId:t,signupRedirectUrl:e,loginRedirectUrl:r}).then(l=>s(l.redirect_url));n&&(o=o.catch(l=>n(l))),await o};redirectOnSuccess=t=>{window.location.href=t}},na=`
24You can find your public token at https://stytch.com/dashboard/api-keys.`,Yp=t=>{typeof t!="string"?ct.warn(`Public token is malformed. Expected a string, got ${typeof t}.${na}`):t===""?ct.warn(`Public token is malformed. Expected "public-token-...", got an empty string.${na}`):t.startsWith("public-token-")||ct.warn(`Public token is malformed. Expected "public-token-...", got ${t}.${na}`)},Xp=()=>{if(typeof window>"u")throw new Error("`new StytchB2BClient()` is not supported in server environments. If using @stytch/react or @stytch/nextjs, use `createStytchB2BClient()` instead.")},Qp=class{_subscriptionService;emptyState;constructor(t,e){this._subscriptionService=t,this.emptyState=e}onStateChange=t=>this._subscriptionService.subscribeToState(e=>{t(e??this.emptyState)})},Jp=class{_networkClient;_apiNetworkClient;_subscriptionService;constructor(t,e,r){this._networkClient=t,this._apiNetworkClient=e,this._subscriptionService=r}get=async()=>{const t=await this._networkClient.fetchSDK({url:"/b2b/organizations/me",method:"GET"});return this._subscriptionService.updateOrganization(t.organization),t.organization};getSync=()=>this._subscriptionService.getOrganization();getInfo=()=>({organization:this.getSync(),fromCache:this._subscriptionService.getFromCache()});onChange=t=>this._subscriptionService.subscribeToState(e=>t(e?.organization??null));update=async t=>{const e=await this._networkClient.fetchSDK({url:"/b2b/organizations/me",method:"PUT",body:t});return this._subscriptionService.updateOrganization(e.organization),e};delete=async()=>{const t=await this._networkClient.fetchSDK({url:"/b2b/organizations/me",method:"DELETE"});return this._subscriptionService.destroyState(),t};getBySlug=async t=>this._networkClient.fetchSDK({url:"/b2b/organizations/search",method:"POST",body:t});getConnectedApps=async()=>this._networkClient.fetchSDK({url:"/b2b/organizations/connected_apps",method:"GET"});getConnectedApp=async t=>this._networkClient.fetchSDK({url:`/b2b/organizations/connected_apps/${t.connected_app_id}`,method:"GET"});members={create:async t=>this._networkClient.fetchSDK({url:"/b2b/organizations/members",method:"POST",body:t}),search:async t=>this._networkClient.fetchSDK({url:"/b2b/organizations/me/members/search",method:"POST",body:t}),update:async t=>{const e=await this._networkClient.fetchSDK({url:`/b2b/organizations/members/${t.member_id}`,method:"PUT",body:t});return this.updateMemberIfSelf(e),e},deletePassword:async t=>{const e=await this._networkClient.fetchSDK({url:`/b2b/organizations/members/passwords/${t}`,method:"DELETE"});return this.updateMemberIfSelf(e),e},deleteMFAPhoneNumber:async t=>{const e=await this._networkClient.fetchSDK({url:`/b2b/organizations/members/mfa_phone_numbers/${t}`,method:"DELETE"});return this.updateMemberIfSelf(e),e},deleteMFATOTP:async t=>{const e=await this._networkClient.fetchSDK({url:`/b2b/organizations/members/totp/${t}`,method:"DELETE"});return this.updateMemberIfSelf(e),e},delete:async t=>{const e=await this._networkClient.fetchSDK({url:`/b2b/organizations/members/${t}`,method:"DELETE"});return t===this._subscriptionService.getMember()?.member_id&&this._subscriptionService.destroyState(),e},reactivate:async t=>this._networkClient.fetchSDK({url:`/b2b/organizations/members/${t}/reactivate`,method:"PUT"}),unlinkRetiredEmail:async t=>{const{member_id:e,...r}=t,s=await this._apiNetworkClient.fetchSDK({url:`/b2b/organizations/members/${e}/unlink_retired_email`,method:"POST",body:r});return this.updateMemberIfSelf(s),s},startEmailUpdate:async t=>{const{member_id:e,...r}=t,s=await this._apiNetworkClient.fetchSDK({url:`/b2b/organizations/members/${e}/start_email_update`,method:"POST",body:r});return this.updateMemberIfSelf(s),s},getConnectedApps:async t=>this._networkClient.fetchSDK({url:`b2b/organizations/members/${t.member_id}/connected_apps`,method:"GET"}),revokeConnectedApp:async t=>this._networkClient.fetchSDK({url:`/b2b/organizations/members/${t.member_id}/connected_apps/${t.connected_app_id}/revoke`,method:"POST"})};updateMemberIfSelf=t=>{t.member_id===this._subscriptionService.getMember()?.member_id&&this._subscriptionService.updateMember(t.member)}},Zp=class{_networkClient;_subscriptionService;organizations;intermediateSessions;constructor(t,e){this._networkClient=t,this._subscriptionService=e,this.organizations={list:async()=>this._networkClient.fetchSDK({url:"/b2b/discovery/organizations",body:{intermediate_session_token:await this._subscriptionService.getIntermediateSessionToken()||void 0},method:"POST"}),create:this._subscriptionService.withUpdateSession(async r=>{const s={...r,intermediate_session_token:await this._subscriptionService.getIntermediateSessionToken()||void 0};return this._networkClient.fetchSDK({url:"/b2b/discovery/organizations/create",body:s,method:"POST"})})},this.intermediateSessions={exchange:this._subscriptionService.withUpdateSession(async r=>{const s={...r,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0};return this._networkClient.fetchSDK({url:"/b2b/discovery/intermediate_sessions/exchange",body:s,method:"POST"})})}}},em=class{_networkClient;constructor(t){this._networkClient=t}oauthAuthorizeStart=async t=>this._networkClient.fetchSDK({url:"/idp/b2b/oauth/authorize/start",method:"POST",body:t});oauthAuthorizeSubmit=async t=>this._networkClient.fetchSDK({url:"/idp/b2b/oauth/authorize/submit",method:"POST",body:t});oauthLogoutStart=async t=>this._networkClient.fetchSDK({url:"/b2b/oauth/logout/start",method:"POST",body:t})},tm=class{_networkClient;_subscriptionService;dfpProtectedAuth;authenticate;constructor(t,e,r){this._networkClient=t,this._subscriptionService=e,this.dfpProtectedAuth=r,this.authenticate=this._subscriptionService.withUpdateSession(async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/impersonation/authenticate",body:{...s,dfp_telemetry_id:n,captcha_token:a},method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})})}},rm=class{_networkClient;_subscriptionService;dfpProtectedAuth;sms;email;constructor(t,e,r){this._networkClient=t,this._subscriptionService=e,this.dfpProtectedAuth=r,this.sms={send:async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/otps/sms/send",body:{...s,dfp_telemetry_id:n,captcha_token:a,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0},method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})},authenticate:this._subscriptionService.withUpdateSession(async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),i={...s,dfp_telemetry_id:n,captcha_token:a,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0};return this._networkClient.retriableFetchSDK({url:"/b2b/otps/sms/authenticate",body:i,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})})},this.email={loginOrSignup:async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/otps/email/login_or_signup",body:{...s,dfp_telemetry_id:n,captcha_token:a},method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})},authenticate:this._subscriptionService.withUpdateSession(async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/otps/email/authenticate",body:{...s,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0,dfp_telemetry_id:n,captcha_token:a},method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})}),discovery:{send:async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),i={...s,dfp_telemetry_id:n,captcha_token:a};return this._networkClient.retriableFetchSDK({url:"/b2b/otps/email/discovery/send",body:i,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})},authenticate:this._subscriptionService.withUpdateSession(async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),i={dfp_telemetry_id:n,captcha_token:a,...s};return this._networkClient.retriableFetchSDK({url:"/b2b/otps/email/discovery/authenticate",body:i,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})})}}}};var aa=class Ca{roles;resources;rolesByID;constructor(e,r){this.roles=e,this.resources=r,this.rolesByID={},e.forEach(s=>this.rolesByID[s.role_id]=s)}static fromJSON(e){return new Ca(e.roles,e.resources)}mergeWithCustomRoles(e){const r=[...this.roles,...e];return new Ca(r,this.resources)}callerIsAuthorized(e,r,s){return!!e.map(n=>this.rolesByID[n]).filter(n=>n).flatMap(n=>n.permissions).filter(n=>n.resource_id===r).find(n=>n.actions.includes(s)||n.actions.includes("*"))}allPermissionsForCaller(e){const r=Object.create(null);
24return this.resources.forEach(s=>{r[s.resource_id]={},s.actions.forEach(n=>{r[s.resource_id][n]=this.callerIsAuthorized(e,s.resource_id,n)})}),r}},sm=class{_subscriptionService;cachedPolicy;policyPromise;constructor(t,e,r){this._subscriptionService=r,this.cachedPolicy=t.rbacPolicy?aa.fromJSON(t.rbacPolicy):null,this.policyPromise=e.then(s=>s.rbacPolicy?(this.cachedPolicy=aa.fromJSON(s.rbacPolicy),this.cachedPolicy):(ct.error("Unable to retrieve RBAC policy from servers. Assuming caller has no permissions."),new aa([],[])))}async getEffectivePolicy(){const t=await this.policyPromise,e=this._subscriptionService.getOrganization();return e?.custom_roles?.length?t.mergeWithCustomRoles(e.custom_roles):t}getEffectivePolicySync(){if(!this.cachedPolicy)return null;const t=this._subscriptionService.getOrganization();return t?.custom_roles?.length?this.cachedPolicy.mergeWithCustomRoles(t.custom_roles):this.cachedPolicy}allPermissions(){return this.getEffectivePolicy().then(t=>t.allPermissionsForCaller(this.roleIds()))}isAuthorizedSync=(t,e)=>!!this.getEffectivePolicySync()?.callerIsAuthorized(this.roleIds(),t,e);isAuthorized=(t,e)=>this.getEffectivePolicy().then(r=>r.callerIsAuthorized(this.roleIds(),t,e));roleIds(){const t=this._subscriptionService.getSession();return t?t.roles??[]:[]}},nm=class{_networkClient;_subscriptionService;dfpProtectedAuth;recover;constructor(t,e,r){this._networkClient=t,this._subscriptionService=e,this.dfpProtectedAuth=r,this.recover=this._subscriptionService.withUpdateSession(async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),i={...s,dfp_telemetry_id:n,captcha_token:a,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0};return this._networkClient.retriableFetchSDK({url:"/b2b/recovery_codes/recover",body:i,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})})}async rotate(){const{dfp_telemetry_id:t,captcha_token:e}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha();return this._networkClient.retriableFetchSDK({url:"/b2b/recovery_codes/rotate",body:{dfp_telemetry_id:t,captcha_token:e},method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})}async get(){return this._networkClient.fetchSDK({url:"/b2b/recovery_codes",method:"GET"})}},am=class{_networkClient;_subscriptionService;constructor(t,e){this._networkClient=t,this._subscriptionService=e}async createConnection(t){return await this._networkClient.fetchSDK({url:"/b2b/scim",method:"POST",body:t})}async updateConnection(t){return await this._networkClient.fetchSDK({url:`/b2b/scim/${t.connection_id}`,method:"PUT",body:t})}async deleteConnection(t){return await this._networkClient.fetchSDK({url:`/b2b/scim/${t}`,method:"DELETE"})}async getConnection(){return await this._networkClient.fetchSDK({url:"/b2b/scim",method:"GET"})}async getConnectionGroups(t){return await this._networkClient.fetchSDK({url:"/b2b/scim/groups",method:"POST",body:t})}async rotateStart(t){return await this._networkClient.fetchSDK({url:"/b2b/scim/rotate/start",method:"POST",body:{connection_id:t}})}async rotateComplete(t){return await this._networkClient.fetchSDK({url:"/b2b/scim/rotate/complete",method:"POST",body:{connection_id:t}})}async rotateCancel(t){return await this._networkClient.fetchSDK({url:"/b2b/scim/rotate/cancel",method:"POST",body:{connection_id:t}})}},zi=class{_networkClient;_apiNetworkClient;_subscriptionService;constructor(t,e,r){this._networkClient=t,this._apiNetworkClient=e,this._subscriptionService=r}get=async()=>{const t=await this._networkClient.fetchSDK({url:"/b2b/organizations/members/me",method:"GET"});return this._subscriptionService.updateMember(t.member),t.member};getSync=()=>this._subscriptionService.getMember();getInfo=()=>({member:this.getSync(),fromCache:this._subscriptionService.getFromCache()});onChange=t=>this._subscriptionService.subscribeToState(e=>t(e?.member??null));update=async t=>{const e=await this._networkClient.fetchSDK({url:"/b2b/organizations/members/update",body:t,method:"PUT"});return this._subscriptionService.updateMember(e.member),e};deleteMFAPhoneNumber=async()=>{const t=await this._networkClient.fetchSDK({url:"/b2b/organizations/members/deletePhoneNumber",method:"DELETE"});return this._subscriptionService.updateMember(t.member),t};deleteMFATOTP=async()=>{const t=await this._networkClient.fetchSDK({url:"/b2b/organizations/members/deleteTOTP",method:"DELETE"});return this._subscriptionService.updateMember(t.member),t};deletePassword=async t=>{const e=await this._networkClient.fetchSDK({url:`/b2b/organizations/members/passwords/${t}`,method:"DELETE"});return this._subscriptionService.updateMember(e.member),e};unlinkRetiredEmail=async t=>{const e=await this._apiNetworkClient.fetchSDK({url:"/b2b/organizations/members/unlink_retired_email",method:"POST",body:t});return this._subscriptionService.updateMember(e.member),e};startEmailUpdate=async t=>{const e=await this._apiNetworkClient.fetchSDK({url:"/b2b/organizations/members/start_email_update",method:"POST",body:t});return this._subscriptionService.updateMember(e.member),e};getConnectedApps=async()=>this._networkClient.fetchSDK({url:"/b2b/organizations/members/connected_apps",method:"GET"});revokeConnectedApp=async t=>this._networkClient.fetchSDK({url:`/b2b/organizations/members/connected_apps/${t.connected_app_id}/revoke`,method:"POST"})},im=class{_networkClient;_subscriptionService;getSync=()=>this._subscriptionService.getSession();getInfo=()=>({session:this.getSync(),fromCache:this._subscriptionService.getFromCache()});onChange=t=>this._subscriptionService.subscribeToState(e=>t(e?.session??null));revoke=async t=>{try{const e=await this._networkClient.fetchSDK({url:"/b2b/sessions/revoke",method:"POST"});return this._subscriptionService.destroyState(),e}catch(e){throw t?.forceClear?this._subscriptionService.destroyState():_a.includes(e.error_type)&&this._subscriptionService.destroyState(),e}};revokeForMember=async t=>await this._networkClient.fetchSDK({url:`/b2b/sessions/revoke/${t.member_id}`,method:"POST"});_authenticate=async t=>{const e=this._subscriptionService.getSession(),r=()=>e?.member_session_id!==this._subscriptionService.getSession()?.member_session_id;try{const s={session_duration_minutes:t?.session_duration_minutes},n=await this._networkClient.fetchSDK({url:"/b2b/sessions/authenticate",body:s,method:"POST"});return r()?this._authenticate(t):n}
24catch(s){if(r())return this._authenticate(t);throw _a.includes(s.error_type)&&this._subscriptionService.destroySession(),s}};authenticate;exchange;exchangeAccessToken;attest;constructor(t,e){this._networkClient=t,this._subscriptionService=e,this.authenticate=this._subscriptionService.withUpdateSession(this._authenticate),this.exchange=this._subscriptionService.withUpdateSession(async r=>this._networkClient.fetchSDK({url:"/b2b/sessions/exchange",body:r,method:"POST"})),this.exchangeAccessToken=this._subscriptionService.withUpdateSession(async r=>this._networkClient.fetchSDK({url:"/b2b/sessions/exchange_access_token",body:r,method:"POST"})),this.attest=this._subscriptionService.withUpdateSession(async r=>this._networkClient.fetchSDK({url:"/b2b/sessions/attest",body:r,method:"POST"}))}getTokens(){return this._subscriptionService.getTokens()}updateSession(t){this._subscriptionService.updateTokens(t)}},om=class{_networkClient;_subscriptionService;_pkceManager;_dynamicConfig;_config;dfpProtectedAuth;authenticate;constructor(t,e,r,s,n,a){this._networkClient=t,this._subscriptionService=e,this._pkceManager=r,this._dynamicConfig=s,this._config=n,this.dfpProtectedAuth=a,this.authenticate=this._subscriptionService.withUpdateSession(async i=>{const o=await this._pkceManager.getPKPair();o||ct.warn(`No code verifier found in local storage for SSO flow.
25Consider using stytch.sso.start() to add PKCE to your SSO flows for added security.
26See https://stytch.com/docs/oauth#guides_pkce for more information.`);const{dfp_telemetry_id:l,captcha_token:c}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),u=await this._networkClient.retriableFetchSDK({url:"/b2b/sso/authenticate",method:"POST",body:{pkce_code_verifier:o?.code_verifier,...i,dfp_telemetry_id:l,captcha_token:c,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0},retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});return this._pkceManager.clearPKPair(),u})}async getBaseApiUrl(){return bn(this._config.publicToken)?this._config.testAPIURL:this._config.liveAPIURL}async start({connection_id:t,login_redirect_url:e,signup_redirect_url:r}){const{pkceRequiredForSso:s}=await this._dynamicConfig,n=await this.getBaseApiUrl(),a=new URL(`${n}/v1/public/sso/start`);if(a.searchParams.set("public_token",this._config.publicToken),a.searchParams.set("connection_id",t),s){const i=await this._pkceManager.startPKCETransaction();a.searchParams.set("pkce_code_challenge",i.code_challenge)}else this._pkceManager.clearPKPair();e&&a.searchParams.set("login_redirect_url",e),r&&a.searchParams.set("signup_redirect_url",r),this.navigate(a)}navigate(t){window.location.href=t.toString()}async getConnections(){return await this._networkClient.fetchSDK({url:"/b2b/sso",method:"GET"})}async discoverConnections(t){return await this._networkClient.fetchSDK({url:`/b2b/sso/discovery/connections?email_address=${encodeURIComponent(t)}`,method:"GET"})}async deleteConnection(t){return this._networkClient.fetchSDK({url:`/b2b/sso/${t}`,method:"DELETE"})}saml={createConnection:async t=>await this._networkClient.fetchSDK({url:"/b2b/sso/saml",method:"POST",body:t}),updateConnection:async t=>await this._networkClient.fetchSDK({url:`/b2b/sso/saml/${t.connection_id}`,method:"PUT",body:t}),updateConnectionByURL:async t=>await this._networkClient.fetchSDK({url:`/b2b/sso/saml/${t.connection_id}/url`,method:"PUT",body:t}),deleteVerificationCertificate:async t=>await this._networkClient.fetchSDK({url:`/b2b/sso/saml/${t.connection_id}/verification_certificates/${t.certificate_id}`,method:"DELETE"}),deleteEncryptionPrivateKey:async t=>await this._networkClient.fetchSDK({url:`/b2b/sso/saml/${t.connection_id}/encryption_private_key/${t.private_key_id}`,method:"DELETE"})};oidc={createConnection:async t=>await this._networkClient.fetchSDK({url:"/b2b/sso/oidc",method:"POST",body:t}),updateConnection:async t=>await this._networkClient.fetchSDK({url:`/b2b/sso/oidc/${t.connection_id}`,method:"PUT",body:t})};external={createConnection:async t=>await this._networkClient.fetchSDK({url:"/b2b/sso/external",method:"POST",body:t}),updateConnection:async t=>await this._networkClient.fetchSDK({url:`/b2b/sso/external/${t.connection_id}`,method:"PUT",body:t})}},lm=class{_networkClient;_subscriptionService;dfpProtectedAuth;authenticate;constructor(t,e,r){this._networkClient=t,this._subscriptionService=e,this.dfpProtectedAuth=r,this.authenticate=this._subscriptionService.withUpdateSession(async s=>{const{dfp_telemetry_id:n,captcha_token:a}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),i={...s,dfp_telemetry_id:n,captcha_token:a,intermediate_session_token:this._subscriptionService.getIntermediateSessionToken()||void 0};return this._networkClient.retriableFetchSDK({url:"/b2b/totp/authenticate",body:i,method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP})})}async create(t){const{dfp_telemetry_id:e,captcha_token:r}=await this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha(),s=await this._networkClient.retriableFetchSDK({url:"/b2b/totp",body:{...t,dfp_telemetry_id:e,captcha_token:r,intermediate_session_token:await this._subscriptionService.getIntermediateSessionToken()||void 0},method:"POST",retryCallback:this.dfpProtectedAuth.retryWithCaptchaAndDFP});return s.member_id===this._subscriptionService.getMember()?.member_id&&this._subscriptionService.updateMember(s.member),s}},cm=t=>!!t?.session,um=class{hasWarned=!1;registry=new Map;register(t,e){const r=this.registry.get(t);r&&r!==e&&(this.hasWarned||(ct.warn(Yo),this.hasWarned=!0),r.cancelBackgroun
26dRefresh()),this.registry.set(t,e)}unregister(t,e){const r=this.registry.get(t);r&&r===e&&this.registry.delete(t)}},dm=class zr{_subscriptionService;_headlessSessionClient;_publicToken;_options;static REFRESH_INTERVAL_MS=18e4;timeout=null;lastAuthenticationSessionDuration;static registry=new um;register(){zr.registry.register(this._publicToken,this)}unregister(){zr.registry.unregister(this._publicToken,this)}constructor(e,r,s,n){this._subscriptionService=e,this._headlessSessionClient=r,this._publicToken=s,this._options=n,this._subscriptionService.subscribeToState(this._onDataChange)}performBackgroundRefresh(){this._reauthenticateWithBackoff().then(()=>{this.scheduleBackgroundRefresh()}).catch(e=>{ct.warn("Session background refresh failed. Signalling to app that user is logged out.",{error:e}),this._subscriptionService.destroySession()})}scheduleBackgroundRefresh(){this.cancelBackgroundRefresh(),this.register(),this.timeout=setTimeout(()=>{this.performBackgroundRefresh()},zr.REFRESH_INTERVAL_MS)}cancelBackgroundRefresh(){this.timeout!==null&&(this.unregister(),clearTimeout(this.timeout),this.timeout=null)}_onDataChange=e=>{e!=null&&e.sessionDurationMinutes&&(this.lastAuthenticationSessionDuration=e.sessionDurationMinutes),cm(e)?this.scheduleBackgroun
26dRefresh():this.cancelBackgroundRefresh()};_reauthenticateWithBackoff=async()=>{let e=0;for(;;)try{const r={session_duration_minutes:this._options.keepSessionAlive?this.lastAuthenticationSessionDuration:void 0};return await this._headlessSessionClient.authenticate(r)}catch(r){if(zr.isUnrecoverableError(r))return Promise.reject(r);e++,await new Promise(s=>setTimeout(s,zr.timeoutForAttempt(e)))}};static timeoutForAttempt(e){return e=Math.min(e,7),Math.floor(Math.random()*350)-175+2e3*2**e}static isUnrecoverableError(e){return _a.includes(e.error_type)}};var fm=class{_networkClient;dfpProtectedAuth;constructor(t,e){this._networkClient=t,this.dfpProtectedAuth=e}searchUser(t){return this.dfpProtectedAuth.getDFPTelemetryIDAndCaptcha().then(({dfp_telemetry_id:e,captcha_token:r})=>this._networkClient.fetchSDK({url:"/users/search",method:"POST",body:{email:t,dfp_telemetry_id:e,captcha_token:r}}))}searchMember(t,e){return this._networkClient.fetchSDK({url:"/b2b/organizations/members/search",method:"POST",body:{email_address:t,organization_id:e}})}},pm=class{_subscriptionService;_sessionManager;_networkClient;_dataLayer;_stateChangeClient;magicLinks;session;member;self;organization;oauth;sso;discovery;passwords;otps;totp;recoveryCodes;rbac;scim;impersonation;idp;onStateChange;parseAuthenticateUrl;authenticateByUrl;constructor(t,e){Xp(),Yp(t);const r=t??"",s=Pp(this.constructor.name,e),n=Ep(r,e);this._dataLayer=_p(r,s),this._subscriptionService=new xp(r,this._dataLayer,{usingCustomApiEndpoint:n}),this._stateChangeClient=new Qp(this._subscriptionService,{}),this.onStateChange=(...S)=>this._stateChangeClient.onStateChange(...S);const a=()=>({stytch_member_id:this._dataLayer.state?.member?.member_id,stytch_member_session_id:this._dataLayer.state?.session?.member_session_id}),i=new Vs(this._dataLayer,"passwords"),o=new ap(r,this._dataLayer,s.endpoints.liveAPIURL,s.endpoints.testAPIURL,a);this._networkClient=o;const l=new Ef(r,o,this._dataLayer),c=new Df(l.getAsync()),u=new Np(r,s.endpoints.dfpBacken
26dURL,s.endpoints.dfpCdnURL,l.getAsync(),c.executeRecaptcha),d=new Hf(s.endpoints.clientsideServicesIframeURL),h=new Vs(this._dataLayer,"oauth"),p=new Gp(o,h,l.getAsync());this.organization=new Jp(o,o,this._subscriptionService),this.member=new zi(o,o,this._subscriptionService),this.self=new zi(o,o,this._subscriptionService),this.session=new im(o,this._subscriptionService),this.magicLinks=new $p(o,this._subscriptionService,new Vs(this._dataLayer,"magic_links"),i,l.getAsync(),u),this.oauth=new Up(o,this._subscriptionService,h,l.getAsync(),{publicToken:r,testAPIURL:s.endpoints.testAPIURL,liveAPIURL:s.endpoints.liveAPIURL},u,p),this.sso=new om(o,this._subscriptionService,new Vs(this._dataLayer,"sso"),l.getAsync(),{publicToken:r,testAPIURL:s.endpoints.testAPIURL,liveAPIURL:s.endpoints.liveAPIURL},u),this.discovery=new Zp(o,this._subscriptionService),this.passwords=new Bp(o,this._subscriptionService,i,l.getAsync(),u),this.otps=new rm(o,this._subscriptionService,u),this.totp=new lm(o,this._subscriptionService,u),this.recoveryCodes=new nm(o,this._subscriptionService,u),this.rbac=new sm(l.getSync(),l.getAsync(),this._subscriptionService),this.scim=new am(this._networkClient,this._subscriptionService),this.impersonation=new tm(this._networkClient,this._subscriptionService,u),this.idp=new em(o),this._sessionManager=new dm(this._subscriptionService,this.session,r,{keepSessionAlive:s.keepSessionAlive});const m=new fm(o,u);(n||this._dataLayer.readSessionCookie().session_token)&&this._sessionManager.performBackgroundRefresh();const{authenticateByUrl:g,parseAuthenticateUrl:v}=Mp({discovery:S=>this.magicLinks.discovery.authenticate({discovery_magic_links_token:S}),discovery_oauth:S=>this.oauth.discovery.authenticate({discovery_oauth_token:S}),oauth:(S,y)=>this.oauth.authenticate({oauth_token:S,...y}),sso:(S,y)=>this.sso.authenticate({sso_token:S,...y}),multi_tenant_magic_links:(S,y)=>this.magicLinks.authenticate({magic_links_token:S,...y}),multi_tenant_impersonation:S=>this.impersonation.authenticate({impersonation_token:S})});this.authenticateByUrl=g,this.parseAuthenticateUrl=v,o.logEvent({name:"b2b_sdk_instance_instantiated",details:{event_callback_registered:!1,error_callback_registered:!1,success_callback_registered:!1}}),l.getAsync().then(S=>{S.vertical==="CONSUMER"&&ct.error("This application is using a Stytch client for B2B projects, but the public token is for a Stytch Consumer project. Use a Consumer Stytch client instead, or verify that the public token is correct.")});const _={bootstrap:l,clientsideServices:d,publicToken:r,searchManager:m,dataLayer:this._dataLayer,networkClient:o,oneTap:p};Fp(this,_)}},al=lu(pm),mm=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],il=qt("arrow-left",mm),hm=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],qi=qt("arrow-right",hm),gm=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],ol=qt("building-2",gm),vm=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],ym=qt("calendar-days",vm),bm=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ll=qt("circle-alert",bm),_m=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Sm=qt("eye-off",_m),wm=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],xm=qt("eye",wm),Cm=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Am=qt("refresh-cw",Cm),km=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],cl=qt("rotate-cw",km),Im=[["path",{d:"M12 18.338a2.1 2.1 0 0 0-.987.244L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16l2.309-4.679A.53.53 0 0 1 12 2",key:"2ksp49"}]],Pm=qt("star-half",Im),Em=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ei=qt("star",Em),Rm=()=>{const t=(0,V.c)(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,f.jsx)("div",{className:"flex h-full w-full items-center justify-center py-16",children:(0,f.jsx)(fn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e},Wi=class Aa extends _u{static is(e){return e instanceof Aa}static hasTag(e,r){return Aa.is(e)&&e._tag===r}static isOfType(e){return r=>r instanceof e}static match(e,r){const s=r[e._tag];if(!s)throw new Error(`No handler for error tag: ${e._tag}`);return s(e)}static matchPartial(e,r,s){const n=r[e._tag];return n?n(e):s(e)}};function ul(t){if("expected"in t&&t.expected!==void 0)return String(t.expected);if("values"in t&&Array.isArray(t.values))return t.values.map(String).join(" | ");if("options"in t&&Array.isArray(t.options))return t.options.map(String).join(" | ");if(t.code==="invalid_union"&&"unionErrors"in t){const e=t.unionErrors.flatMap(r=>r.issues).map(r=>
26ul(r)).filter(Boolean);if(e.length>0)return e.join(" | ")}}var Tm=class ka extends Wi{_tag="RequestValidationError";fieldErrors;requestPath;static is(e){return Wi.hasTag(e,"RequestValidationError")}constructor(e){const r=e.fieldErrors.length,s=e.fieldErrors.map(n=>n.field).join(", ");super(`Request validation failed: ${r} error(s) in fields: ${s}`,{cause:e.cause}),this.fieldErrors=e.fieldErrors,this.requestPath=e.requestPath}static fromZodError(e,r){const s=e.issues.map(n=>({field:n.path.join("."),message:n.message,code:n.code,received:"received"in n?n.received:void 0,expected:ul(n)}));return new ka({fieldErrors:s,requestPath:r,cause:e})}static fromMessage(e,r,s){const n=Array.isArray(r)?r.join("."):r;return new ka({fieldErrors:[{field:n,message:e,code:"custom"}],requestPath:s})}},yr={authenticate:"/authenticate",passwordReset:"/password-reset",oauthAuthorize:"/oauth/authorize",dashboard:"/dashboard",success:"/success",wildCard:"*",default:"/"},Mm={dashboard:"dashboard",onboarding:"onboarding",orders:"orders",grids:"grids",handbook:"handbook",bee:"bee",settings:"settings",dataSources:"data-sources",signUp:"sign-up",ads:"ads",campaigns:"campaigns",mediaAssets:"media-assets",landingPages:"landing-pages",postcards:"postcards",debug:"debug"},Om={account:"account",connections:"connections",billing:"billing"},Fm=new Set(Object.values(Mm)),Dm=new Set([yr.authenticate,yr.passwordReset,yr.oauthAuthorize,yr.dashboard,yr.success,yr.default]),Lm=new Set(Object.values(yr).map(t=>t.replace(/^\//,"").split(/[/:]/)[0]).filter(t=>t!==""&&t!=="*")),ti=500,ri=200,Nm=500;function jm(t){if(Dm.has(t))return!0;const e=t.match(/^\/([a-zA-Z0-9-]+)\/([a-zA-Z0-9-]+)(?:\/([a-zA-Z0-9-]+))?$/);if(e){const[,,s,n]=e;return Fm.has(s)?n?s!=="settings"?!1:Object.values(Om).includes(n):!0:!1}const r=t.match(/^\/([a-zA-Z0-9-]+)$/);if(r){const s=r[1];return!Lm.has(s)}return!1}var $m=Re({customInstructions:oe().max(ti).optional().describe('Optional instructions like "focus on emergency services" or "emphasize family-friendly"')}),Vm=Re({changePrompt:oe().min(1).max(ti).describe('Description of changes to make, e.g., "change the headline to Welcome Home" or "make the CTA button blue"'),assetType:Qe(["landing_page","postcard"]).optional().describe("Asset type to modify (default: inferred from current screen context)"),side:Qe(["front","back","both"]).optional().describe("For postcards: which side(s) to apply changes to (default: current active side)")}),Bm=Re({}),Um=Re({path:oe().min(1).max(ri).refine(jm,{message:"Path must be a valid app route (e.g., /landing-pages, /contacts, /workspace/{id})"}).describe('The path to navigate to, e.g., "/landing-pages" or "/contacts"')}),zm=Re({}),qm=Re({assetIds:oe().max(Nm).optional().describe("Comma-separated list of asset IDs to regenerate. Leave empty to regenerate all ads.")}),Wm=Re({}),Hm=Re({name:oe().min(1).max(ri).describe("Name for the campaign"),platform:Qe(["google_ads","meta"]).describe("Advertising platform"),budget:mt().positive().max(1e6).optional().describe("Daily budget in dollars")}),Km=Re({campaignId:mt().int().positive().describe("The campaign ID to update"),status:Qe(["active","paused"]).optional().describe("New status"),budget:mt().positive().max(1e6).optional().describe("New daily budget")}),Gm=Re({focus:Qe(["conversion","seo","messaging","design","all"]).optional().describe("What aspect to focus the analysis on: conversion optimization, SEO, messaging clarity, design improvements, or all aspects")}),Ym=Re({focus:Qe(["headlines","descriptions","cta","keywords","all"]).optional().describe("What aspect to focus the analysis on: headlines, descriptions, call-to-action, keyword relevance, or all aspects")}),Xm=Re({size:Qe(["4x6","6x11"]).describe("Postcard size: 4x6 (standard) or 6x11 (jumbo for maximum impact)"),orientation:Qe(["horizontal","vertical"]).describe("Postcard orientation: horizontal (landscape) or vertical (portrait)"),customInstructions:oe().max(ti).optional().describe('Optional instructions like "focus on spring promotion" or "emphasize discount"'),promotionalOffer:oe().max(ri).optional().describe('Promotional offer text, e.g., "20% off first service"'),headline:oe().max(100).optional().describe("Custom headline for the postcard")}),Qm=Re({}),Jm=Re({focus:Qe(["messaging","design","offer","print-readiness","all"]).optional().describe("What aspect to focus on: messaging clarity, design impact, offer effectiveness, print-readiness, or all aspects")}),dl=["LOGO","QR_CODE","IMAGE_1","IMAGE_2","IMAGE_3","IMAGE_4"],Zm=Re({slot:Qe(dl).describe("Which image slot to change: LOGO, QR_CODE, or IMAGE_1 through IMAGE_4 for content images")}),eh=Re({redirectType:Qe(["website","landing_page"]).describe("Where the QR code should redirect: website (default) or a landing page"),landingPageId:mt().optional().describe("ID of the landing page to redirect to (required when redirectType is landing_page)")}),fl=["marginTop","marginBottom","marginLeft","marginRight","paddingTop","paddingBottom","paddingLeft","paddingRight","fontSize","fontWeight","lineHeight","color","textAlign","width","maxWidth","backgroundColor","borderRadius","position","zIndex","transform"],th=Re({elementId:oe().describe("The element's data-hg-id value (e.g., 'headline-main', 'cta-primary')"),property:Qe(fl).describe("The CSS property to set (e.g., fontSize, marginTop, backgroundColor)"),value:oe().describe("The CSS value to apply (e.g., '42px', '24px', '#2563eb')"),side:Qe(["front","back"]).optional().describe("For postcards: which side to apply to (default: current active side)")}),rh=Re({elementId:oe().optional().describe("Element ID to reset (omit to reset ALL style overrides)"),side:Qe(["front","back","both"]).optional().describe("For postcards: which side(s) to reset (default: both)")}),sh=Re({text:oe().describe("The text content to add"),targetElementId:oe().optional().describe("Element ID to insert near (optional)"),position:Qe(["before","after","inside"]).optional().describe("Where to insert relative to target (default: after)"),side:Qe(["front","back"]).optional().describe("For postcards: which side to add to")}),nh=Re({text:oe().describe("The button text"),targetElementId:oe().optional().describe("Element ID to insert near (optional)"),position:Qe(["before","after","inside"]).optional().describe("Where to insert relative to target (default: after)"),side:Qe(["front","back"]).optional().describe("For postcards: which side to add to")}),ah=Re({targetElementId:oe().optional().describe("Element ID to insert near (optional)"),position:Qe(["before","after","inside"]).optional().describe("Where to insert relative to target (default: after)"),side:Qe(["front","back"]).optional().describe("For postcards: which side to add to")}),ih=Re({elementId:oe().describe("The element ID to remove"),side:Qe(["front","back"]).optional().describe("For postcards: which side to remove from")}),oh=Re({pageId:mt().optional().describe("The ID of the landing page to publish. If not provided, user will be asked to select one.")}),lh=Re({instructions:oe().trim().min(1).max(2e3)}),ch=Re({actionId:oe().trim().min(1).max(120)}),uh=Re({descriptorId:oe().trim().min(1).max(120)}),pl={generateLandingPage:$m,applyDesignChanges:Vm,switchTemplate:Bm,navigateTo:Um,generateAds:zm,regenerateAds:qm,approveAllAds:Wm,createCampaign:Hm,updateCampaign:Km,analyzeLandingPage:Gm,analyzeAds:Ym,generatePostcard:Xm,switchPostcardStyle:Qm,analyzePostcard:Jm,changePostcardImage:Zm,updatePostcardRedirect:eh,publishLandingPage:oh,reviseHtmlMediaArtifact:lh,recoverHtmlMediaOperation:ch,renderHtmlMediaOutput:uh,setElementStyle:th,resetElementStyle:rh,addText:sh,addButton:nh,addContainer:ah,removeElement:ih},dh={generateLandingPage:{label:"Generate Landing Page",description:"Generate a new AI-powered landing page by applying workspace branding to the best-fit template. Use when the user asks to create, generate, or make a new landing page.",examplePrompts:["Generate a landing page","Create a landing page for emergency services","Make me a new landing page for family dentistry"],causesLoading:!0,category:"content"},applyDesignChanges:{label:"Apply Design Changes",description:"Apply AI-powered changes to the current design (landing page or postc
26ard). Use when the user asks to change, modify, update, or edit something.",examplePrompts:['Change the headline to "Welcome Home"',"Make the button bigger","Update the colors to blue","Change the headline on the front","Make the offer text bigger"],causesLoading:!0,category:"content"},switchTemplate:{label:"Try Different Template",description:"Generate a completely different design while keeping the same content. Use when the user wants to see a different look or try another template.",examplePrompts:["Try a different template","Show me another design","Switch to a different style"],causesLoading:!0,category:"content"},navigateTo:{label:"Navigate",description:"Navigate to a different page in the app. Use when the user asks to go to or open a specific page.",examplePrompts:["Go to landing pages","Open orders","Take me to settings"],causesLoading:!1,category:"navigation"},generateAds:{label:"Generate Ads",description:"Generate new AI-powered ad copy based on workspace data. Creates headlines, descriptions, and call-to-action text optimized for Google Ads.",examplePrompts:["Generate ads","Create ad copy","Make me some ads"],causesLoading:!0,category:"content"},regenerateAds:{label:"Regenerate Ads",description:"Regenerate ad copy for specific assets or all assets in the current generation. Use when the user wants new variations of their ads.",examplePrompts:["Regenerate these ads","Create new ad variations","Try different ad copy"],causesLoading:!0,category:"content"},approveAllAds:{label:"Approve All Ads",description:"Approve all ad assets in the current generation for use in campaigns. Use when the user is happy with the ads and wants to use them.",examplePrompts:["Approve all ads","I like these ads","These ads look good"],causesLoading:!1,requiresConfirmation:!0,category:"content"},createCampaign:{label:"Create Campaign",description:"Create a new advertising campaign. Use when the user wants to start a new ad campaign.",examplePrompts:["Create a Google Ads campaign","Start a new campaign","Set up ads"],causesLoading:!0,requiresConfirmation:!0,category:"campaign"},updateCampaign:{label:"Update Campaign",description:"Update settings for an existing campaign. Use when the user wants to change campaign status or budget.",examplePrompts:["Pause the campaign","Increase the budget","Resume ads"],causesLoading:!1,requiresConfirmation:!0,category:"campaign"},analyzeLandingPage:{label:"Analyze Landing Page",description:"Analyze the current landing page and provide detailed optimization suggestions for better performance. Use when the user asks to analyze, review, improve, or optimize their landing page.",examplePrompts:["Analyze this landing page","How can I improve this page?","Review my landing page for conversions","What would make this page perform better?"],causesLoading:!1,category:"content"},analyzeAds:{label:"Analyze Ads",description:"Analyze the current ad copy and provide optimization suggestions for better click-through rates and conversions. Use when the user asks to analyze, review, improve, or optimize their ads.",examplePrompts:["Analyze these ads","How can I improve my ad copy?","Review my ads for better performance","What would make these ads more effective?"],causesLoading:!1,category:"content"},generatePostcard:{label:"Generate Postcard",description:"Generate a new AI-powered postcard design by applying workspace branding to a print-ready template. Use when the user asks to create, generate, or make a new postcard.",examplePrompts:["Generate a postcard","Create a 6x11 postcard","Design a postcard for my spring promotion"],causesLoading:!0,category:"content"},switchPostcardStyle:{label:"Try Different Postcard Template",description:"Try a different postcard template while keeping the same content. Use when the user wants to see another layout or direction.",examplePrompts:["Try a different template","Show me another postcard design","Use a different layout"],causesLoading:!0,category:"content"},analyzePostcard:{label:"Analyze Postcard",description:"Analyze the current postcard design and provide optimization suggestions for better direct mail performance. Use when the user asks to analyze, review, improve, or optimize their postcard.",examplePrompts:["Analyze this postcard","How can I improve this design?","Is this postcard print-ready?","Review my postcard for effectiveness"],causesLoading:!1,category:"content"},changePostcardImage:{label:"Change Postcard Image",description:"Change an image on the postcard such as the logo, QR code, or content images. Use when the user wants to replace, swap, or update an image on their postcard.",examplePrompts:["Change the logo","Replace the main image","Update the QR code","Swap the photo on the front"],causesLoading:!1,category:"content"},updatePostcardRedirect:{label:"Update QR Code Redirect",description:"Update where the QR code on the postcard redirects to. Can redirect to the business website or a specific landing page. Use when the user wants to change the QR code destination.",examplePrompts:["Change the QR code to point to my landing page","Update the redirect URL","Link the QR code to my website","Set QR code to landing page"],causesLoading:!1,requiresConfirmation:!0,category:"content"},publishLandingPage:{label:"Publish Landing Page",description:"Publish a landing page to make it publicly accessible. Use when the user wants to publish, go live, or make their landing page available.",examplePrompts:["Publish my landing page","Make this page live","I want to publish a landing page","How do I publish my landing page?"],causesLoading:!1,requiresConfirmation:!0,category:"content"},reviseHtmlMediaArtifact:{label:"Revise Design",description:"Apply an AI revision to the current HTML Media artifact through its canonical revision workflow.",examplePrompts:["Revise this design","Update the current design copy"],causesLoading:!0,category:"content"},recoverHtmlMediaOperation:{label:"Recover Generation",description:"Run one recovery action currently offered by the active HTML Media generation operation.",examplePrompts:["Retry the failed generation","Recover this design generation"],causesLoading:!0,category:"content"},renderHtmlMediaOutput:{label:"Render Output",description:"Queue one supported rendered output for the current canonical HTML Media revision.",examplePrompts:["Render this design","Create the downloadable image"],causesLoading:!0,category:"content"},setElementStyle:{label:"Set Element Style",description:"Set a specific CSS 
26style property on an element for pixel-perfect control. Use when the user wants to adjust spacing, font size, colors, or other visual properties of a specific element.",examplePrompts:["Set the headline font size to 42px","Add 24px margin to the top","Change the button background to blue","Make the headline bigger"],causesLoading:!1,category:"content"},resetElementStyle:{label:"Reset Element Style",description:"Reset style overrides for an element or all elements back to their original state. Use when the user wants to undo style changes.",examplePrompts:["Reset the headline style","Undo all my style changes","Restore original styles","Clear style overrides"],causesLoading:!1,category:"content"},addText:{label:"Add Text",description:"Add a new text element to the design. Use when the user wants to add text, a heading, or a paragraph.",examplePrompts:["Add a new heading","Insert text after the hero","Add a paragraph about our services"],causesLoading:!0,category:"content"},addButton:{label:"Add Button",description:"Add a new button element to the design. Use when the user wants to add a call-to-action button.",examplePrompts:["Add a call-to-action button","Insert a contact button","Add a button that says Get Started"],causesLoading:!0,category:"content"},addContainer:{label:"Add Container",description:"Add a new container/section element to the design. Use when the user wants to add a new section or wrapper.",examplePrompts:["Add a new section","Insert a container for testimonials","Add a wrapper div"],causesLoading:!0,category:"content"},removeElement:{label:"Remove Element",description:"Remove an element from the design. Use when the user wants to delete or remove a specific element.",examplePrompts:["Remove the footer","Delete the hero section","Remove that button","Get rid of the sidebar"],causesLoading:!0,requiresConfirmation:!0,category:"content"}},fh={generateLandingPage:[{name:"customInstructions",type:"string",description:'Optional instructions like "focus on emergency services" or "emphasize family-friendly"',required:!1}],applyDesignChanges:[{name:"changePrompt",type:"string",description:'Description of changes to make, e.g., "change the headline to Welcome Home" or "make the CTA button blue"',required:!0},{name:"assetType",type:"enum",description:"Asset type to modify (default: inferred from current screen)",required:!1,enumValues:["landing_page","postcard"]},{name:"side",type:"enum",description:"For postcards: which side(s) to apply changes to (default: current active side)",required:!1,enumValues:["front","back","both"]}],switchTemplate:[],navigateTo:[{name:"path",type:"string",description:'The path to navigate to, e.g., "/landing-pages" or "/contacts"',required:!0}],generateAds:[],regenerateAds:[{name:"assetIds",type:"string",description:"Comma-separated list of asset IDs to regenerate. Leave empty to regenerate all ads.",required:!1}],approveAllAds:[],createCampaign:[{name:"name",type:"string",description:"Name for the campaign",required:!0},{name:"platform",type:"enum",description:"Advertising platform",required:!0,enumValues:["google_ads","meta"]},{name:"budget",type:"number",description:"Daily budget in dollars",required:!1}],updateCampaign:[{name:"campaignId",type:"number",description:"The campaign ID to update",required:!0},{name:"status",type:"enum",description:"New status",required:!1,enumValues:["active","paused"]},{name:"budget",type:"number",description:"New daily budget",required:!1}],analyzeLandingPage:[{name:"focus",type:"enum",description:"What aspect to focus the analysis on: conversion optimization, SEO, messaging clarity, design improvements, or all aspects",required:!1,enumValues:["conversion","seo","messaging","design","all"]}],analyzeAds:[{name:"focus",type:"enum",description:"What aspect to focus the analysis on: headlines, descriptions, call-to-action, keyword relevance, or all aspects",required:!1,enumValues:["headlines","descriptions","cta","keywords","all"]}],generatePostcard:[{name:"size",type:"enum",description:"Postcard size: 4x6 (standard) or 6x11 (jumbo for maximum impact)",required:!0,enumValues:["4x6","6x11"]},{name:"orientation",type:"enum",description:"Postcard orientation: horizontal (landscape) or vertical (portrait)",required:!0,enumValues:["horizontal","vertical"]}
26,{name:"customInstructions",type:"string",description:'Optional instructions like "focus on spring promotion" or "emphasize discount"',required:!1},{name:"promotionalOffer",type:"string",description:'Promotional offer text, e.g., "20% off first service"',required:!1},{name:"headline",type:"string",description:"Custom headline for the postcard",required:!1}],switchPostcardStyle:[],analyzePostcard:[{name:"focus",type:"enum",description:"What aspect to focus on: messaging clarity, design impact, offer effectiveness, print-readiness, or all aspects",required:!1,enumValues:["messaging","design","offer","print-readiness","all"]}],changePostcardImage:[{name:"slot",type:"enum",description:"Which image slot to change: LOGO, QR_CODE, or IMAGE_1 through IMAGE_4 for content images",required:!0,enumValues:[...dl]}],updatePostcardRedirect:[{name:"redirectType",type:"enum",description:"Where the QR code should redirect: website (default) or a landing page",required:!0,enumValues:["website","landing_page"]},{name:"landingPageId",type:"number",description:"ID of the landing page to redirect to (required when redirectType is landing_page)",required:!1}],publishLandingPage:[{name:"pageId",type:"number",description:"The ID of the landing page to publish. If not provided, user will be asked to select one.",required:!1}],reviseHtmlMediaArtifact:[{name:"instructions",type:"string",description:"The requested change to the current HTML Media artifact.",required:!0}],recoverHtmlMediaOperation:[{name:"actionId",type:"string",description:"An action ID explicitly offered by the current operation.",required:!0}],renderHtmlMediaOutput:[{name:"descriptorId",type:"string",description:"A rendered-output descriptor exposed by the current artifact profile.",required:!0}],setElementStyle:[{name:"elementId",type:"string",description:"The element's data-hg-id value (e.g., 'headline-main', 'cta-primary')",required:!0},{name:"property",type:"enum",description:"The CSS property to set (e.g., fontSize, marginTop, backgroundColor)",required:!0,enumValues:[...fl]},{name:"value",type:"string",description:"The CSS value to apply (e.g., '42px', '24px', '#2563eb')",required:!0},{name:"side",type:"enum",description:"For postcards: which side to apply to (default: current active side)",required:!1,enumValues:["front","back"]}],resetElementStyle:[{name:"elementId",type:"string",description:"Element ID to reset (omit to reset ALL style overrides)",required:!1},{name:"side",type:"enum",description:"For postcards: which side(s) to reset (default: both)",required:!1,enumValues:["front","back","both"]}],addText:[{name:"text",type:"string",description:"The text content to add",required:!0},{name:"targetElementId",type:"string",description:"Element ID to insert near (optional)",required:!1},{name:"position",type:"enum",description:"Where to insert relative to target (default: after)",required:!1,enumValues:["before","after","inside"]},{name:"side",type:"enum",description:"For postcards: which side to add to",required:!1,enumValues:["front","back"]}],addButton:[{name:"text",type:"string",description:"The button text",required:!0},{name:"targetElementId",type:"string",description:"Element ID to insert near (optional)",required:!1},{name:"position",type:"enum",description:"Where to insert relative to target (default: after)",required:!1,enumValues:["before","after","inside"]},{name:"side",type:"enum",description:"For postcards: which side to add to",required:!1,enumValues:["front","back"]}],addContainer:[{name:"targetElementId",type:"string",description:"Element ID to insert near (optional)",required:!1},{name:"position",type:"enum",description:"Where to insert relative to target (default: after)",required:!1,enumValues:["before","after","inside"]},{name:"side",type:"enum",description:"For postcards: which side to add to",required:!1,enumValues:["front","back"]}],removeElement:[{name:"elementId",type:"string",description:"The element ID to remove",required:!0},{name:"side",type:"enum",description:"For postcards: which side to remove from",required:!1,enumValues:["front","back"]}]};function ph(t){return fh[t]}function mh(t,e){const r=pl[t].safeParse(e);return r.success?{success:!0,data:r.data}:{success:!1,error:Tm.fromZodError(r.error)}}function hh(t){return t in pl}function gh(t){return Array.isArray(t)&&"raw"in t&&Array.isArray(t.raw)}function vh(t,e){let r=t[0];for(let s=0;s<e.length;s++){const n=e[s],a=typeof n=="object"&&n!==null?JSON.stringify(n):String(n);r+=a+t[s+1]}return r}function si(t,e){e?`${t}${e}
26`:`${t}`;const r=s=>(n,...a)=>{if(gh(n)){const i=n;{const o=vh(i,a),l={};a.forEach((u,d)=>{typeof u=="object"&&u!==null?Object.assign(l,u):l[`value${d}`]=u});const c={message:o,component:t,...e&&{instanceId:e},...l,timestamp:new Date().toISOString()};console[s](JSON.stringify(c))}}else{const i=n,o=a[0]??{};{const l={message:i,component:t,...e&&{instanceId:e},...o,timestamp:new Date().toISOString()};console[s](JSON.stringify(l))}}};return{debug:r("debug"),log:r("log"),info:r("info"),warn:r("warn"),error:r("error")}}var Hi=si("useUndoManager");function yh(t){const e=(0,V.c)(19);let r;e[0]!==t?(r=t===void 0?{}:t,e[0]=t,e[1]=r):r=e[1];const{maxHistory:s}=r,n=s===void 0?20:s;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[2]=a):a=e[2];const i=(0,b.useRef)(a);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[3]=o):o=e[3];const l=(0,b.useRef)(o),c=(0,b.useRef)(null),[u,d]=(0,b.useState)(null);let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{const R=i.current,I=l.current,E=R.length>0,M=I.length>0;if(E||M){const F=R[R.length-1];d({canUndo:E,canRedo:M,undoCount:R.length,redoCount:I.length,label:F?.label})}else d(null)},e[4]=h):h=e[4];const p=h;let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=R=>{d(R)},e[5]=m):m=e[5];const g=m;let v;e[6]===Symbol.for("react.memo_cache_sentinel")?(v=R=>{c.current=R},e[6]=v):v=e[6];const _=v;let S;e[7]!==n?(S=R=>{const I={...R,id:`undo-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,timestamp:Date.now()};i.current=[...i.current,I].slice(-n),l.current=[],p()},e[7]=n,e[8]=S):S=e[8];const y=S;let w;e[9]!==n?(w=async()=>{const R=i.current;if(R.length===0||!c.current)return;const I=R[R.length-1];i.current=R.slice(0,-1);try{await c.current(I),l.current=[...l.current,I].slice(-n)}catch(E){const M=E;i.current=[...i.current,I],Hi.error("Undo failed",{error:M instanceof Error?M.message:String(M),entryId:I.id,pageId:I.pageId})}p()},e[9]=n,e[10]=w):w=e[10];const C=w;let x;e[11]!==n?(x=async()=>{const R=l.current;if(R.length===0||!c.current)return;const I=R[R.length-1];l.current=R.slice(0,-1);try{await c.current(I),i.current=[...i.current,I].slice(-n)}catch(E){const M=E;l.current=[...l.current,I],Hi.error("Redo failed",{error:M instanceof Error?M.message:String(M),entryId:I.id,pageId:I.pageId})}p()},e[11]=n,e[12]=x):x=e[12];const k=x;let A;e[13]===Symbol.for("react.memo_cache_sentinel")?(A=R=>{R!==void 0?(i.current=i.current.filter(I=>I.pageId!==R),l.current=l.current.filter(I=>I.pageId!==R)):(i.current=[],l.current=[]),p()},e[13]=A):A=e[13];const P=A;let T;return e[14]!==k||e[15]!==C||e[16]!==y||e[17]!==u?(T={undoState:u,setUndoState:g,registerUndoHandler:_,pushUndoState:y,performUndo:C,performRedo:k,clearUndoHistory:P},e[14]=k,e[15]=C,e[16]=y,e[17]=u,e[18]=T):T=e[18],T}var bh=["bold","unbold","italic","unitalic","underline","ununderline","fontFamily","fontSize","color","replaceImage","textContent","marginTop","marginBottom","marginLeft","marginRight","paddingTop","paddingBottom","paddingLeft","paddingRight","width","maxWidth","borderRadius","borderColor","borderWidth","backgroundColor","textAlign","zIndex","transform"],_h=Re({type:Qe(bh),elementPath:oe().min(1,{error:"Element path is required"}),value:oe().optional(),alt:oe().optional(),fontFace:Au.optional()});function Sh(t){const e=_h.safeParse(t);return e.success?{success:!0,data:e.data}:{success:!1,error:e.error.issues.map(r=>`${r.path.length>0?r.path.join("."):"value"}: ${r.message}`).join(", ")}}var ni=(0,b.createContext)(null),zs=si("BeeScreenContext");function wh(t){const e=(0,V.c)(46),{children:r}=t,[s,n]=(0,b.useState)(null),[a,i]=(0,b.useState)(null),[o,l]=(0,b.useState)(null),[c,u]=(0,b.useState)(!1),[d,h]=(0,b.useState)(!1);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={maxHistory:20},e[0]=p):p=e[0];const m=yh(p);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=new Set,e[1]=g):g=e[1];const v=(0,b.useRef)(g);let _;e[2]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[2]=_):_=e[2];const S=(0,b.useRef)(_),y=(0,b.useRef)(s),w=(0,b.useRef)(null),C=(0,b.useRef)(null),x=(0,b.useRef)(null);let k,A;e[3]!==s?(k=()=>{y.current=s},A=[s],e[3]=s,e[4]=k,e[5]=A):(k=e[4],A=e[5]),(0,b.useLayoutEffect)(k,A);let P,T;e[6]!==a?(P=()=>{x.current=a},T=[a],e[6]=a,e[7]=P,e[8]=T):(P=e[7],T=e[8]),(0,b.useEffect)(P,T);let R,I;e[9]===Symbol.for("react.memo_cache_sentinel")?(R=()=>{const ae=v.current,ne=S.current;return()=>{ae.clear(),ne.clear(),w.current=null}},I=[],e[9]=R,e[10]=I):(R=e[9],I=e[10]),(0,b.useEffect)(R,I);let E;e[11]===Symbol.for("react.memo_cache_sentinel")?(E=ae=>{v.current.forEach(ne=>{try{ne(ae)}catch(re){const ze=re;zs.error("Context listener threw error",{error:ze instanceof Error?ze.message:String(ze)})}})},e[11]=E):E=e[11];const M=E;let F;e[12]===Symbol.for("react.memo_cache_sentinel")?(F=ae=>{const ne={...ae,capturedAt:new Date().toISOString()};n(ne),M(ne)},e[12]=F):F=e[12];const $=F;let O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=ae=>{i(ae)},e[13]=O):O=e[13];const D=O;let j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{n(null),i(null),l(null),M(null)},e[14]=j):j=e[14];const U=j;let q;e[15]===Symbol.for("react.memo_cache_sentinel")?(q=ae=>
26{n(ne=>{if(!ne)return ne;const re={...ne,selection:ae,capturedAt:new Date().toISOString()};return M(re),re})},e[15]=q):q=e[15];const z=q;let K;e[16]===Symbol.for("react.memo_cache_sentinel")?(K=ae=>{n(ne=>{if(!ne)return ne;const re={...ne,filters:ae,capturedAt:new Date().toISOString()};return M(re),re})},e[16]=K):K=e[16];const N=K;let B;e[17]===Symbol.for("react.memo_cache_sentinel")?(B=ae=>{n(ne=>{if(!ne)return ne;const re={...ne,data:{...ne.data,...ae},capturedAt:new Date().toISOString()};return M(re),re})},e[17]=B):B=e[17];const ee=B;let he;e[18]===Symbol.for("react.memo_cache_sentinel")?(he=ae=>(v.current.add(ae),()=>{v.current.delete(ae)}),e[18]=he):he=e[18];const pe=he;let ge;e[19]===Symbol.for("react.memo_cache_sentinel")?(ge=ae=>(S.current.add(ae),()=>{S.current.delete(ae)}),e[19]=ge):ge=e[19];const Fe=ge;let de;e[20]===Symbol.for("react.memo_cache_sentinel")?(de=ae=>{S.current.forEach(ne=>{try{ne(ae)}catch(re){const ze=re;zs.error("Workflow listener threw error",{error:ze instanceof Error?ze.message:String(ze),workflowType:ae.workflowType})}})},e[20]=de):de=e[20];const Le=de;let Me;e[21]===Symbol.for("react.memo_cache_sentinel")?(Me=async(ae,ne)=>{if(ae==="navigateTo"){const ze=ne.path;if(!ze)return{success:!1,message:"No path provided for navigation",state:"error"};const We=w.current;if(!We)return{success:!1,message:"Navigation not available (no handler registered)",state:"error"};try{return await We(ze),{success:!0,message:`Navigated to ${ze}`,state:"complete"}}catch(Te){const He=Te;return{success:!1,message:He instanceof Error?He.message:"Navigation failed",state:"error"}}}const re=x.current?.[ae];if(!re)return{success:!1,message:`No handler registered for action: ${ae}`,state:"error"};try{return await re(ne)}catch(ze){const We=ze;return{success:!1,message:We instanceof Error?We.message:"Action failed",state:"error"}}},e[21]=Me):Me=e[21];const Ie=Me;let ke;e[22]===Symbol.for("react.memo_cache_sentinel")?(ke=ae=>(w.current=ae,()=>{w.current=null}),e[22]=ke):ke=e[22];const Pe=ke;let me;e[23]===Symbol.for("react.memo_cache_sentinel")?(me=ae=>{l(ae),ae&&u(!1);const ne=y.current;ne&&M({...ne,capturedAt:new Date().toISOString()})},e[23]=me):me=e[23];const Se=me;let ie;e[24]===Symbol.for("react.memo_cache_sentinel")?(ie=ae=>{u(ae)},e[24]=ie):ie=e[24];const le=ie;let we;e[25]===Symbol.for("react.memo_cache_sentinel")?(we=ae=>{h(ae)},e[25]=we):we=e[25];const De=we,{undoState:se,setUndoState:W,registerUndoHandler:L,pushUndoState:te,performUndo:G,performRedo:xe,clearUndoHistory:Ue}=m;let je;e[26]===Symbol.for("react.memo_cache_sentinel")?(je=ae=>{C.current=ae},e[26]=je):je=e[26];const Ce=je;let J;e[27]===Symbol.for("react.memo_cache_sentinel")?(J=async ae=>{const ne=Sh(ae);if(!ne.success)return zs.error("Direct edit validation failed",{validationError:ne.error,editType:ae.type,elementPath:ae.elementPath}),{success:!1,error:`Invalid parameters: ${ne.error}`};const re=C.current;if(!re)return{success:!1,error:"No direct edit handler registered"};try{return await re(ne.data)}catch(ze){const We=ze;return zs.error("Direct edit failed",{error:We instanceof Error?We.message:String(We),editType:ne.data.type,elementPath:ne.data.elementPath}),{success:!1,error:We instanceof Error?We.message:"Direct edit failed"}}},e[27]=J):J=e[27];const Oe=J,et=(0,b.useRef)(null);let tt;e[28]===Symbol.for("react.memo_cache_sentinel")?(tt=ae=>(et.current=ae,()=>{et.current=null}),e[28]=tt):tt=e[28];const rt=tt;let st;e[29]===Symbol.for("react.memo_cache_sentinel")?(st=async(ae,ne)=>{if(!hh(ae))return{success:!1,message:`Unknown action type: ${ae}`,state:"error"};const re=et.current;if(!re)return{success:!1,message:"No actions registered for current screen",state:"error"};const ze=re.handlers.get(ae);if(!ze)return{success:!1,message:`Action ${ae} is not available on this screen`,state:"error"};const We=mh(ae,ne);if(!We.success)return{success:!1,message:`Invalid parameters: ${We.error.message}`,state:"error"};try{return await ze(We.data)}catch(Te){const He=Te;return{success:!1,message:He instanceof Error?He.message:"Action failed",state:"error"}}},e[29]=st):st=e[29];const _e=st;let Ve;
26e[30]!==a||e[31]!==Ue||e[32]!==d||e[33]!==c||e[34]!==xe||e[35]!==G||e[36]!==te||e[37]!==L||e[38]!==s||e[39]!==o||e[40]!==W||e[41]!==se?(Ve={screenContext:s,actionHandlers:a,selectedElement:o,isSelectingElement:c,isEditingText:d,undoState:se,setScreenContext:$,setActionHandlers:D,clearScreenContext:U,setSelection:z,setFilters:N,setData:ee,setSelectedElement:Se,setIsSelectingElement:le,setIsEditingText:De,setUndoState:W,registerUndoHandler:L,pushUndoState:te,performUndo:G,performRedo:xe,clearUndoHistory:Ue,registerDirectEditHandler:Ce,applyDirectEdit:Oe,onContextChange:pe,executeAction:Ie,notifyWorkflowComplete:Le,onWorkflowComplete:Fe,registerNavigationHandler:Pe,executeTypedAction:_e,registerTypedActionHandlers:rt},e[30]=a,e[31]=Ue,e[32]=d,e[33]=c,e[34]=xe,e[35]=G,e[36]=te,e[37]=L,e[38]=s,e[39]=o,e[40]=W,e[41]=se,e[42]=Ve):Ve=e[42];const Ke=Ve;let Je;return e[43]!==r||e[44]!==Ke?(Je=(0,f.jsx)(ni.Provider,{value:Ke,children:r}),e[43]=r,e[44]=Ke,e[45]=Je):Je=e[45],Je}function ml(){const t=(0,b.useContext)(ni);if(!t)throw new Error("useBeeScreenContext must be used within a BeeScreenContextProvider");return t}function wC(){return(0,b.useContext)(ni)}var xh=H(((t,e)=>{function r(){this.__data__=[],this.size=0}e.exports=r})),hl=H(((t,e)=>{function r(s,n){return s===n||s!==s&&n!==n}e.exports=r})),Sn=H(((t,e)=>{var r=hl();function s(n,a){for(var i=n.length;i--;)if(r(n[i][0],a))return i;return-1}e.exports=s})),Ch=H(((t,e)=>{var r=Sn(),s=Array.prototype.splice;function n(a){var i=this.__data__,o=r(i,a);return o<0?!1:(o==i.length-1?i.pop():s.call(i,o,1),--this.size,!0)}e.exports=n})),Ah=H(((t,e)=>{var r=Sn();function s(n){var a=this.__data__,i=r(a,n);return i<0?void 0:a[i][1]}e.exports=s})),kh=H(((t,e)=>{var r=Sn();function s(n){return r(this.__data__,n)>-1}e.exports=s})),Ih=H(((t,e)=>{var r=Sn();function s(n,a){var i=this.__data__,o=r(i,n);return o<0?(++this.size,i.push([n,a])):i[o][1]=a,this}e.exports=s})),wn=H(((t,e)=>{var r=xh(),s=Ch(),n=Ah(),a=kh(),i=Ih();function o(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var d=l[c];this.set(d[0],d[1])}}o.prototype.clear=r,o.prototype.delete=s,o.prototype.get=n,o.prototype.has=a,o.prototype.set=i,e.exports=o})),Ph=H(((t,e)=>{var r=wn();function s(){this.__data__=new r,this.size=0}e.exports=s})),Eh=H(((t,e)=>{function r(s){var n=this.__data__,a=n.delete(s);return this.size=n.size,a}e.exports=r})),Rh=H(((t,e)=>{function r(s){return this.__data__.get(s)}e.exports=r})),Th=H(((t,e)=>{function r(s){return this.__data__.has(s)}e.exports=r})),gl=H(((t,e)=>{var r=typeof global=="object"&&global&&global.Object===Object&&global;e.exports=r})),dr=H(((t,e)=>{var r=gl(),s=typeof self=="object"&&self&&self.Object===Object&&self,n=r||s||Function("return this")();e.exports=n})),ai=H(((t,e)=>{var r=dr().Symbol;e.exports=r})),Mh=H(((t,e)=>{var r=ai(),s=Object.prototype,n=s.hasOwnProperty,a=s.toString,i=r?r.toStringTag:void 0;function o(l){var c=n.call(l,i),u=l[i];try{l[i]=void 0;var d=!0}catch{}var h=a.call(l);return d&&(c?l[i]=u:delete l[i]),h}e.exports=o})),Oh=H(((t,e)=>{var r=Object.prototype.toString;function s(n){return r.call(n)}e.exports=s})),xn=H(((t,e)=>{var r=ai(),s=Mh(),n=Oh(),a="[object Null]",i="[object Undefined]",o=r?r.toStringTag:void 0;function l(c){return c==null?c===void 0?i:a:o&&o in Object(c)?s(c):n(c)}e.exports=l})),vl=H(((t,e)=>{function r(s){var n=typeof s;return s!=null&&(n=="object"||n=="function")}e.exports=r})),yl=H(((t,e)=>{var r=xn(),s=vl(),n="[object AsyncFunction]",a="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function l(c){if(!s(c))return!1;var u=r(c);return u==a||u==i||u==n||u==o}e.exports=l})),Fh=H(((t,e)=>{var r=dr()["__core-js_shared__"];e.exports=r})),Dh=H(((t,e)=>{var r=Fh(),s=(function(){var a=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function n(a){return!!s&&s in a}e.exports=n})),bl=H(((t,e)=>{var r=Function.prototype.toString;function s(n){if(n!=null){try{return r.call(n)}catch{}try{return n+""}catch{}}return""}e.exports=s})),Lh=H(((t,e)=>{var r=yl(),s=Dh(),n=vl(),a=bl(),i=/[\\^$.*+?()[\]{}|]/g,o=/^\[object .+?Constructor\]$/,l=Function.prototype,c=Object.prototype,u=l.toString,d=c.hasOwnProperty,h=RegExp("^"+u.call(d).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function p(m){return!n(m)||s(m)?!1:(r(m)?h:o).test(a(m))}e.exports=p})),Nh=H(((t,e)=>{function r(s,n){return s?.[n]}e.exports=r})),es=H(((t,e)=>{var r=Lh(),s=Nh();function n(a,i){var o=s(a,i);return r(o)?o:void 0}e.exports=n})),ii=H(((t,e)=>{var r=es()(dr(),"Map");e.exports=r})),Cn=H(((t,e)=>{var r=es()(Object,"create");e.exports=r})),jh=H(((t,e)=>{var r=Cn();function s(){this.__data__=r?r(null):{},this.size=0}e.exports=s})),$h=H(((t,e)=>{function r(s){var n=this.has(s)&&delete this.__data__[s];return this.size-=n?1:0,n}e.exports=r})),Vh=H(((t,e)=>{var r=Cn(),s="__lodash_hash_undefined__",n=Object.prototype.hasOwnProperty;function a(i){var o=this.__data__;if(r){var l=o[i];return l===s?void 0:l}return n.call(o,i)?o[i]:void 0}e.exports=a})),Bh=H(((t,e)=>{var r=Cn(),s=Object.prototype.hasOwnProperty;function n(a){var i=this.__data__;return r?i[a]!==void 0:s.call(i,a)}e.exports=n})),Uh=H(((t,e)=>{var r=Cn(),s="__lodash_hash_undefined__";function n(a,i){var o=this.__data__;return this.size+=this.has(a)?0:1,o[a]=r&&i===void 0?s:i,this}e.exports=n})),zh=H(((t,e)=>{var r=jh(),s=$h(),n=Vh(),a=Bh(),i=Uh();function o(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var d=l[c];this.set(d[0],d[1])}}o.prototype.clear=r,o.prototype.delete=s,o.prototype.get=n,o.prototype.has=a,o.prototype.set=i,e.exports=o})),qh=H(((t,e)=>{var r=zh(),s=wn(),n=ii();function a(){this.size=0,this.__data__={hash:new r,map:new(n||s),string:new r}}e.exports=a})),Wh=H(((t,e)=>{function r(s){var n=typeof s;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?s!=="__proto__":s===null}e.exports=r})),An=H(((t,e)=>{var r=Wh();function s(n,a){var i=n.__data__;
vendor: 4,204 bytes, line 26
26return r(a)?i[typeof a=="string"?"string":"hash"]:i.map}e.exports=s})),Hh=H(((t,e)=>{var r=An();function s(n){var a=r(this,n).delete(n);return this.size-=a?1:0,a}e.exports=s})),Kh=H(((t,e)=>{var r=An();function s(n){return r(this,n).get(n)}e.exports=s})),Gh=H(((t,e)=>{var r=An();function s(n){return r(this,n).has(n)}e.exports=s})),Yh=H(((t,e)=>{var r=An();function s(n,a){var i=r(this,n),o=i.size;return i.set(n,a),this.size+=i.size==o?0:1,this}e.exports=s})),_l=H(((t,e)=>{var r=qh(),s=Hh(),n=Kh(),a=Gh(),i=Yh();function o(l){var c=-1,u=l==null?0:l.length;for(this.clear();++c<u;){var d=l[c];this.set(d[0],d[1])}}o.prototype.clear=r,o.prototype.delete=s,o.prototype.get=n,o.prototype.has=a,o.prototype.set=i,e.exports=o})),Xh=H(((t,e)=>{var r=wn(),s=ii(),n=_l(),a=200;function i(o,l){var c=this.__data__;if(c instanceof r){var u=c.__data__;if(!s||u.length<a-1)return u.push([o,l]),this.size=++c.size,this;c=this.__data__=new n(u)}return c.set(o,l),this.size=c.size,this}e.exports=i})),Qh=H(((t,e)=>{var r=wn(),s=Ph(),n=Eh(),a=Rh(),i=Th(),o=Xh();function l(c){var u=this.__data__=new r(c);this.size=u.size}l.prototype.clear=s,l.prototype.delete=n,l.prototype.get=a,l.prototype.has=i,l.prototype.set=o,e.exports=l})),Jh=H(((t,e)=>{var r="__lodash_hash_undefined__";function s(n){return this.__data__.set(n,r),this}e.exports=s})),Zh=H(((t,e)=>{function r(s){return this.__data__.has(s)}e.exports=r})),eg=H(((t,e)=>{var r=_l(),s=Jh(),n=Zh();function a(i){var o=-1,l=i==null?0:i.length;for(this.__data__=new r;++o<l;)this.add(i[o])}a.prototype.add=a.prototype.push=s,a.prototype.has=n,e.exports=a})),tg=H(((t,e)=>{function r(s,n){for(var a=-1,i=s==null?0:s.length;++a<i;)if(n(s[a],a,s))return!0;return!1}e.exports=r})),rg=H(((t,e)=>{function r(s,n){return s.has(n)}e.exports=r})),Sl=H(((t,e)=>{var r=eg(),s=tg(),n=rg(),a=1,i=2;function o(l,c,u,d,h,p){var m=u&a,g=l.length,v=c.length;if(g!=v&&!(m&&v>g))return!1;var _=p.get(l),S=p.get(c);if(_&&S)return _==c&&S==l;var y=-1,w=!0,C=u&i?new r:void 0;for(p.set(l,c),p.set(c,l);++y<g;){var x=l[y],k=c[y];if(d)var A=m?d(k,x,y,c,l,p):d(x,k,y,l,c,p);if(A!==void 0){if(A)continue;w=!1;break}if(C){if(!s(c,function(P,T){if(!n(C,T)&&(x===P||h(x,P,u,d,p)))return C.push(T)})){w=!1;break}}else if(!(x===k||h(x,k,u,d,p))){w=!1;break}}return p.delete(l),p.delete(c),w}e.exports=o})),sg=H(((t,e)=>{var r=dr().Uint8Array;e.exports=r})),ng=H(((t,e)=>{function r(s){var n=-1,a=Array(s.size);return s.forEach(function(i,o){a[++n]=[o,i]}),a}e.exports=r})),ag=H(((t,e)=>{function r(s){var n=-1,a=Array(s.size);return s.forEach(function(i){a[++n]=i}),a}e.exports=r})),ig=H(((t,e)=>{var r=ai(),s=sg(),n=hl(),a=Sl(),i=ng(),o=ag(),l=1,c=2,u="[object Boolean]",d="[object Date]",h="[object Error]",p="[object Map]",m="[object Number]",g="[object RegExp]",v="[object Set]",_="[object String]",S="[object Symbol]",y="[object ArrayBuffer]",w="[object DataView]",C=r?r.prototype:void 0,x=C?C.valueOf:void 0;function k(A,P,T,R,I,E,M){switch(T){case w:if(A.byteLength!=P.byteLength||A.byteOffset!=P.byteOffset)return!1;A=A.buffer,P=P.buffer;case y:return!(A.byteLength!=P.byteLength||!E(new s(A),new s(P)));case u:case d:case m:return n(+A,+P);case h:return A.name==P.name&&A.message==P.message;case g:case _:return A==P+"";case p:var F=i;case v:var $=R&l;if(F||(F=o),A.size!=P.size&&!$)return!1;var O=M.get(A);if(O)return O==P;R|=c,M.set(A,P);var D=a(F(A),F(P),R,I,E,M);return M.delete(A),D;case S:if(x)return x.call(A)==x.call(P)}return!1}e.exports=k})),og=H(((t,e)=>{function r(s,n){for(var a=-1,i=n.length,o=s.length;++a<i;)s[o+a]=n[a];return s}e.exports=r})),oi=H(((t,e)=>{var r=Array.isArray;e.exports=r})),lg=H(((t,e)=>{var r=og(),s=oi();function n(a,i,o){var l=i(a);return s(a)?l:r(l,o(a))}e.exports=n})),cg=H(((t,e)=>{function r(s,n){for(var a=-1,i=s==null?0:s.length,o=0,l=[];++a<i;){var c=s[a];n(c,a,s)&&(l[o++]=c)}return l}e.exports=r})),ug=H(((t,e)=>{function r(){return[]}e.exports=r})),dg=H(((t,e)=>{var r=cg(),s=ug(),n=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(o){return o==null?[]:(o=Object(o),r(a(o),function(l){return n.call(o,l)}))}:s;e.exports=i})),fg=H(((t,e)=>{function r(s,n){for(var a=-1,i=Array(s);++a<s;)i[a]=n(a);return i}
26e.exports=r})),kn=H(((t,e)=>{function r(s){return s!=null&&typeof s=="object"}e.exports=r})),pg=H(((t,e)=>{var r=xn(),s=kn(),n="[object Arguments]";function a(i){return s(i)&&r(i)==n}e.exports=a})),mg=H(((t,e)=>{var r=pg(),s=kn(),n=Object.prototype,a=n.hasOwnProperty,i=n.propertyIsEnumerable,o=r((function(){return arguments})())?r:function(l){return s(l)&&a.call(l,"callee")&&!i.call(l,"callee")};e.exports=o})),hg=H(((t,e)=>{function r(){return!1}e.exports=r})),wl=H(((t,e)=>{var r=dr(),s=hg(),n=typeof t=="object"&&t&&!t.nodeType&&t,a=n&&typeof e=="object"&&e&&!e.nodeType&&e,i=a&&a.exports===n?r.Buffer:void 0,o=(i?i.isBuffer:void 0)||s;e.exports=o})),gg=H(((t,e)=>{var r=9007199254740991,s=/^(?:0|[1-9]\d*)$/;function n(a,i){var o=typeof a;return i=i??r,!!i&&(o=="number"||o!="symbol"&&s.test(a))&&a>-1&&a%1==0&&a<i}e.exports=n})),xl=H(((t,e)=>{var r=9007199254740991;function s(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=r}e.exports=s})),vg=H(((t,e)=>{var r=xn(),s=xl(),n=kn(),a="[object Arguments]",i="[object Array]",o="[object Boolean]",l="[object Date]",c="[object Error]",u="[object Function]",d="[object Map]",h="[object Number]",p="[object Object]",m="[object RegExp]",g="[object Set]",v="[object String]",_="[object WeakMap]",S="[object ArrayBuffer]",y="[object DataView]",w="[object Float32Array]",C="[object Float64Array]",x="[object Int8Array]",k="[object Int16Array]",A="[object Int32Array]",P="[object Uint8Array]",T="[object Uint8ClampedArray]",R="[object Uint16Array]",I="[object Uint32Array]",E={};E[w]=E[C]=E[x]=E[k]=E[A]=E[P]=E[T]=E[R]=E[I]=!0,E[a]=E[i]=E[S]=E[o]=E[y]=E[l]=E[c]=E[u]=E[d]=E[h]=E[p]=E[m]=E[g]=E[v]=E[_]=!1;function M(F){return n(F)&&s(F.length)&&!!E[r(F)]}e.exports=M})),yg=H(((t,e)=>{function r(s){return function(n){return s(n)}}e.exports=r})),bg=H(((t,e)=>{var r=gl(),s=typeof t=="object"&&t&&!t.nodeType&&t,n=s&&typeof e=="object"&&e&&!e.nodeType&&e,a=n&&n.exports===s&&r.process,i=(function(){try{var o=n&&n.require&&n.require("util").types;return o||a&&a.binding&&a.binding("util")}catch{}})();e.exports=i})),Cl=H(((t,e)=>{var r=vg(),s=yg(),n=bg(),a=n&&n.isTypedArray,i=a?s(a):r;e.exports=i})),_g=H(((t,e)=>{var r=fg(),s=mg(),n=oi(),a=wl(),i=gg(),o=Cl(),l=Object.prototype.hasOwnProperty;function c(u,d){var h=n(u),p=!h&&s(u),m=!h&&!p&&a(u),g=!h&&!p&&!m&&o(u),v=h||p||m||g,_=v?r(u.length,String):[],S=_.length;for(var y in u)(d||l.call(u,y))&&!(v&&(y=="length"||m&&(y=="offset"||y=="parent")||g&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,S)))&&_.push(y);return _}e.exports=c})),Sg=H(((t,e)=>{var r=Object.prototype;function s(n){var a=n&&n.constructor;return n===(typeof a=="function"&&a.prototype||r)}e.exports=s})),wg=H(((t,e)=>{function r(s,n){return function(a){return s(n(a))}}e.exports=r})),xg=H(((t,e)=>{var r=wg()(Object.keys,Object);e.exports=r})),Cg=H(((t,e)=>{var r=Sg(),s=xg(),n=Object.prototype.hasOwnProperty;function a(i){if(!r(i))return s(i);var o=[];for(var l in Object(i))n.call(i,l)&&l!="constructor"&&o.push(l);return o}e.exports=a})),Ag=H(((t,e)=>{var r=yl(),s=xl();function n(a){return a!=null&&s(a.length)&&!r(a)}
26e.exports=n})),kg=H(((t,e)=>{var r=_g(),s=Cg(),n=Ag();function a(i){return n(i)?r(i):s(i)}e.exports=a})),Ig=H(((t,e)=>{var r=lg(),s=dg(),n=kg();function a(i){return r(i,n,s)}e.exports=a})),Pg=H(((t,e)=>{var r=Ig(),s=1,n=Object.prototype.hasOwnProperty;function a(i,o,l,c,u,d){var h=l&s,p=r(i),m=p.length;if(m!=r(o).length&&!h)return!1;for(var g=m;g--;){var v=p[g];if(!(h?v in o:n.call(o,v)))return!1}var _=d.get(i),S=d.get(o);if(_&&S)return _==o&&S==i;var y=!0;d.set(i,o),d.set(o,i);for(var w=h;++g<m;){v=p[g];var C=i[v],x=o[v];if(c)var k=h?c(x,C,v,o,i,d):c(C,x,v,i,o,d);if(!(k===void 0?C===x||u(C,x,l,c,d):k)){y=!1;break}w||(w=v=="constructor")}if(y&&!w){var A=i.constructor,P=o.constructor;A!=P&&"constructor"in i&&"constructor"in o&&!(typeof A=="function"&&A instanceof A&&typeof P=="function"&&P instanceof P)&&(y=!1)}return d.delete(i),d.delete(o),y}e.exports=a})),Eg=H(((t,e)=>{var r=es()(dr(),"DataView");e.exports=r})),Rg=H(((t,e)=>{var r=es()(dr(),"Promise");e.exports=r})),Tg=H(((t,e)=>{var r=es()(dr(),"Set");e.exports=r})),Mg=H(((t,e)=>{var r=es()(dr(),"WeakMap");e.exports=r})),Og=H(((t,e)=>{var r=Eg(),s=ii(),n=Rg(),a=Tg(),i=Mg(),o=xn(),l=bl(),c="[object Map]",u="[object Object]",d="[object Promise]",h="[object Set]",p="[object WeakMap]",m="[object DataView]",g=l(r),v=l(s),_=l(n),S=l(a),y=l(i),w=o;(r&&w(new r(new ArrayBuffer(1)))!=m||s&&w(new s)!=c||n&&w(n.resolve())!=d||a&&w(new a)!=h||i&&w(new i)!=p)&&(w=function(C){var x=o(C),k=x==u?C.constructor:void 0,A=k?l(k):"";if(A)switch(A){case g:return m;case v:return c;case _:return d;case S:return h;case y:return p}return x}),e.exports=w})),Fg=H(((t,e)=>{var r=Qh(),s=Sl(),n=ig(),a=Pg(),i=Og(),o=oi(),l=wl(),c=Cl(),u=1,d="[object Arguments]",h="[object Array]",p="[object Object]",m=Object.prototype.hasOwnProperty;function g(v,_,S,y,w,C){var x=o(v),k=o(_),A=x?h:i(v),P=k?h:i(_);A=A==d?p:A,P=P==d?p:P;var T=A==p,R=P==p,I=A==P;if(I&&l(v)){if(!l(_))return!1;x=!0,T=!1}if(I&&!T)return C||(C=new r),x||c(v)?s(v,_,S,y,w,C):n(v,_,A,S,y,w,C);if(!(S&u)){var E=T&&m.call(v,"__wrapped__"),M=R&&m.call(_,"__wrapped__");
26if(E||M){var F=E?v.value():v,$=M?_.value():_;return C||(C=new r),w(F,$,S,y,C)}}return I?(C||(C=new r),a(v,_,S,y,w,C)):!1}e.exports=g})),Dg=H(((t,e)=>{var r=Fg(),s=kn();function n(a,i,o,l,c){return a===i?!0:a==null||i==null||!s(a)&&!s(i)?a!==a&&i!==i:r(a,i,o,l,n,c)}e.exports=n})),Lg=H(((t,e)=>{var r=Dg();function s(n,a){return r(n,a)}e.exports=s})),Ng=za(Lg(),1);si("useScreenActions");function xC(t,e=[]){const{setScreenContext:r,setActionHandlers:s,registerTypedActionHandlers:n,clearScreenContext:a}=ml(),i=(0,b.useRef)(r),o=(0,b.useRef)(s),l=(0,b.useRef)(n),c=(0,b.useRef)(a);(0,b.useEffect)(()=>{i.current=r,o.current=s,l.current=n,c.current=a},[r,s,n,a]);const u=(0,b.useMemo)(()=>Object.entries(t.actions).filter(([,y])=>y?.enabled).map(([y])=>y),[t.actions]),d=(0,b.useMemo)(()=>{const y=new Map;for(const[w,C]of Object.entries(t.actions))C?.enabled&&C.handler&&y.set(w,C.handler);return y},[t.actions]);(0,b.useEffect)(()=>{const y={availableActions:u,handlers:d};return l.current(y)},[u,d]);const h=(0,b.useMemo)(()=>u.map(y=>{const w=dh[y],C=ph(y).map(x=>({name:x.name,type:x.type,description:x.description,required:x.required,enumValues:x.enumValues}));return{id:y,label:w.label,description:w.description,parameters:C,causesLoading:w.causesLoading,requiresConfirmation:w.requiresConfirmation}}),[u]),p=(0,b.useMemo)(()=>{const y={};for(const[w,C]of d)y[w]=C;return y},[d]),m=(0,b.useMemo)(()=>t.recommendations?.map(y=>({actionId:y.actionType,label:y.label,prompt:y.prompt,priority:y.priority})),[t.recommendations]),g=(0,b.useMemo)(()=>({page:t.context.page,title:t.context.title,data:t.context.data,selection:t.context.selection,filters:t.context.filters,availableActions:u,recommendations:t.recommendations}),[t.context.page,t.context.title,t.context.data,t.context.selection,t.context.filters,u,t.recommendations,e]),v=(0,b.useRef)(null);(0,b.useEffect)(()=>{if((0,Ng.default)(v.current,g))return;v.current=g;const y={...t.context,actions:h,recommendations:m};i.current(y)},[g,t.context,h,m]);const _=(0,b.useMemo)(()=>u.sort().join(","),[u]),S=(0,b.useRef)(p);(0,b.useEffect)(()=>{S.current=p},[p]),(0,b.useEffect)(()=>{o.current(S.current)},[_]),(0,b.useEffect)(()=>()=>{c.current()},[])}function jg(t,e){const r=new URL(t,"https://honeygrid.local");let s=r.pathname;if(r.pathname.startsWith("/")&&!r.pathname.startsWith("//")){const n=e.split("/").filter(Boolean);n.length>0&&(s=`/${n[0]}${r.pathname}`)}return{to:s,search:()=>Object.fromEntries(r.searchParams.entries())}}function $g(){const t=(0,V.c)(5),{registerNavigationHandler:e}=ml(),r=_o(),s=eu();let n,a;return t[0]!==s.pathname||t[1]!==r||t[2]!==e?(n=()=>e(async o=>{const l=jg(o,s.pathname);await r(l)}),a=[s.pathname,r,e],t[0]=s.pathname,t[1]=r,t[2]=e,t[3]=n,t[4]=a):(n=t[3],a=t[4]),(0,b.useEffect)(n,a),null}var Vg="/assets/NoCampaignData-CbiTILAF.png",Bg={id:"current",isComingSoonDialogOpen:!1,isCreateWorkspaceDialogOpen:!1,isWorkspaceSelectorOpen:!1,isInviteUsersDialogOpen:!1,isSyncToGoogleDialogOpen:!1,isProfileButtonShown:!0,mapViewState:null,mapViewBounds:null},fr=bs({...Io({id:"ui",getKey:t=>t.id,initialData:[Bg]}),startSync:!0});function Ug(){const{data:t}=wr(zg);return t?.[0]?.isCreateWorkspaceDialogOpen??!1}function zg(t){return t.from({u:fr})}function CC(){const{data:t}=wr(qg);return t?.[0]?.isWorkspaceSelectorOpen??!1}function qg(t){return t.from({u:fr})}function AC(){const{data:t}=wr(Wg);return t?.[0]?.isInviteUsersDialogOpen??!1}function Wg(t){return t.from({u:fr})}function kC(){const{data:t}=wr(Hg);return t?.[0]?.isSyncToGoogleDialogOpen??!1}function Hg(t){return t.from({u:fr})}function Kg(){const{data:t}=wr(Gg);return t?.[0]?.mapViewBounds??null}function Gg(t){return t.from({u:fr})}function Yg(t){fr.update("current",e=>{e.isCreateWorkspaceDialogOpen=t})}function Xg(t){fr.update("current",e=>{e.isWorkspaceSelectorOpen=t})}function IC(t){fr.update("current",e=>{e.isInviteUsersDialogOpen=t})}function PC(t){fr.update("current",e=>{e.isSyncToGoogleDialogOpen=t})}var Qg=t=>{const e=(0,V.c)(11);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("h-6 w-6",r),e[3]=r,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,f.jsx)("g",{filter:"url
26(#filter0_ddd_1011_44612)",children:(0,f.jsx)("path",{d:"M13.853 20.578c-0.722 1.249 -2.526 1.249 -3.248 0l-2.537 -4.395c-0.722 -1.249 0.18 -2.813 1.624 -2.813h5.075c1.444 0 2.345 1.563 1.624 2.813l-2.537 4.395Z",fill:"white"})}),e[5]=a):a=e[5];let i,o;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,f.jsx)("defs",{children:(0,f.jsxs)("filter",{id:"filter0_ddd_1011_44612",x:"0.0195312",y:"0.828125",width:"47.7734",height:"46.8594",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[(0,f.jsx)("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),(0,f.jsx)("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),(0,f.jsx)("feOffset",{dy:"1"}),(0,f.jsx)("feGaussianBlur",{stdDeviation:"9"}),(0,f.jsx)("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0"}),(0,f.jsx)("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_1011_44612"}),(0,f.jsx)("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),(0,f.jsx)("feOffset",{dy:"6"}),(0,f.jsx)("feGaussianBlur",{stdDeviation:"5"}),(0,f.jsx)("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.14 0"}),(0,f.jsx)("feBlend",{mode:"normal",in2:"effect1_dropShadow_1011_44612",result:"effect2_dropShadow_1011_44612"}),(0,f.jsx)("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),(0,f.jsx)("feMorphology",{radius:"1",operator:"erode",in:"SourceAlpha",result:"effect3_dropShadow_1011_44612"}),(0,f.jsx)("feOffset",{dy:"3"}),(0,f.jsx)("feGaussianBlur",{stdDeviation:"2.5"}),(0,f.jsx)("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"}),(0,f.jsx)("feBlend",{mode:"normal",in2:"effect2_dropShadow_1011_44612",result:"effect3_dropShadow_1011_44612"}),(0,f.jsx)("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect3_dropShadow_1011_44612",result:"shape"})]})}),o=(0,f.jsx)("circle",{cx:"12.05",cy:"11",r:"6",fill:"currentColor",stroke:"white",strokeWidth:"3"}),e[6]=i,e[7]=o):(i=e[6],o=e[7]);let l;return e[8]!==s||e[9]!==n?(l=(0,f.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",className:n,"aria-label":"HoneygridMarker",...s,children:[a,i,o]}),e[8]=s,e[9]=n,e[10]=l):l=e[10],l},Jg=t=>{const e=(0,V.c)(28),{children:r,coordinates:s,openPopup:n,enableHover:a}=t,i=n===void 0?!1:n,o=a===void 0?!0:a;let l;e[0]!==i?(l={openPopup:i,popupOpen:i},e[0]=i,e[1]=l):l=e[1];const[c,u]=(0,b.useState)(l);c.openPopup!==i&&u({openPopup:i,popupOpen:i});const d=c.openPopup===i?c.popupOpen:i;let h;e[2]!==i?(h=T=>u({openPopup:i,popupOpen:T}),e[2]=i,e[3]=h):h=e[3];const p=h,m=(0,b.useRef)(null);let g,v;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>()=>{m.current&&clearTimeout(m.current)},v=[],e[4]=g,e[5]=v):(g=e[4],v=e[5]),(0,b.useEffect)(g,v);let _;e[6]!==o||e[7]!==p?(_=()=>{o&&(m.current&&(clearTimeout(m.current),m.current=null),p(!0))},e[6]=o,e[7]=p,e[8]=_):_=e[8];const S=_;let y;e[9]!==o||e[10]!==p?(y=()=>{o&&(m.current=setTimeout(()=>{p(!1)},100))},e[9]=o,e[10]=p,e[11]=y):y=e[11];const w=y;let C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=(0,f.jsx)(Qg,{fontSize:"large",color:"primary"}),e[12]=C):C=e[12];let x;e[13]!==S||e[14]!==w?(x=(0,f.jsx)("div",{onMouseEnter:S,onMouseLeave:w,children:C}),e[13]=S,e[14]=w,e[15]=x):x=e[15];let k;e[16]!==s||e[17]!==x?(k=(0,f.jsx)(su,{...s,children:x}),e[16]=s,e[17]=x,e[18]=k):k=e[18];let A;e[19]!==r||e[20]!==s||e[21]!==S||e[22]!==w||e[23]!==d?(A=d?(0,f.jsx)(nu,{...s,anchor:"bottom",style:{padding:0,borderRadius:"25px"},closeButton:!1,maxWidth:"300px",closeOnClick:!1,offset:20,children:(0,f.jsx)("div",{onMouseEnter:S,onMouseLeave:w,children:r})}):null,e[19]=r,e[20]=s,e[21]=S,e[22]=w,e[23]=d,e[24]=A):A=e[24];let P;return e[25]!==k||e[26]!==A?(P=(0,f.jsxs)(f.Fragment,{children:[k,A]}),e[25]=k,e[26]=A,e[27]=P):P=e[27],P},Al=(t,e=400)=>{if(!t)return;const r=new URLSearchParams({maxwidth:e.toString()});return Jr(`/google-places/photos/${encodeURIComponent(t)}?${r.toString()}`)},kl=(t,e=400)=>{if(!t?.authorAttributions?.length)return Al(t?.name,e)},Zg=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}),ev=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),tv=new Intl.NumberFormat("en-US",{maximumFractionDigits:1}),EC=t=>{if(!t)return"";const[e,r]=t.split(" ");return r?`${e.at(0)}${r.at(0)}`.toUpperCase():`${e.slice(0,2)}`.toUpperCase()},RC=t=>
26typeof t!="number"||isNaN(t)?"Invalid Input":t.toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}),TC=(t,e,r)=>r==="currency"||e===Yn.Income||e===Yn.HomeValues?Zg.format(t):r==="percentage"||e===Yn.CustomerMarketShare?ev.format(t):tv.format(t),li={"extra-large":{heading:"text-4xl font-bold font-telegraf mb-4",subheading:"text-xl text-muted-foreground font-telegraf",body:"text-xl font-telegraf",sectionHeading:"text-2xl font-semibold font-telegraf mb-4",sectionSubheading:"text-lg text-muted-foreground font-telegraf",sectionBody:"text-lg font-telegraf"},large:{heading:"text-3xl font-semibold font-telegraf mb-4",subheading:"text-lg text-muted-foreground font-telegraf",body:"text-lg font-telegraf",sectionHeading:"text-xl font-semibold font-telegraf mb-3",sectionSubheading:"text-base text-muted-foreground font-telegraf",sectionBody:"text-base font-telegraf"},medium:{heading:"text-[22px] font-semibold font-telegraf mb-3",subheading:"text-base text-muted-foreground font-telegraf",body:"text-base font-telegraf",sectionHeading:"text-[20px] font-semibold font-telegraf mb-3",sectionSubheading:"text-base text-muted-foreground font-telegraf",sectionBody:"text-base font-telegraf"},small:{heading:"text-lg font-medium font-telegraf mb-2",subheading:"text-sm text-muted-foreground font-telegraf",body:"text-sm font-telegraf",sectionHeading:"text-base font-medium font-telegraf mb-2",sectionSubheading:"text-sm text-muted-foreground font-telegraf",sectionBody:"text-sm font-telegraf"},"extra-small":{heading:"text-base font-medium font-telegraf mb-2",subheading:"text-xs text-muted-foreground font-telegraf",body:"text-xs font-telegraf",sectionHeading:"text-sm font-medium font-telegraf mb-2",sectionSubheading:"text-xs text-muted-foreground font-telegraf",sectionBody:"text-xs font-telegraf"}};function rv(t){const e=(0,V.c)(13),{children:r,className:s,size:n,as:a,subheading:i}=t,o=n===void 0?"medium":n,l=a===void 0?"h1":a,c=li[o];let u;e[0]!==s?(u=Z("space-y-2",s),e[0]=s,e[1]=u):u=e[1];let d;e[2]!==l||e[3]!==r||e[4]!==c.heading?(d=(0,f.jsx)(l,{className:c.heading,children:r}),e[2]=l,e[3]=r,e[4]=c.heading,e[5]=d):d=e[5];let h;e[6]!==c.subheading||e[7]!==i?(h=i&&(0,f.jsx)("p",{className:c.subheading,children:i}),e[6]=c.subheading,e[7]=i,e[8]=h):h=e[8];let p;return e[9]!==u||e[10]!==d||e[11]!==h?(p=(0,f.jsxs)("div",{className:u,children:[d,h]}),e[9]=u,e[10]=d,e[11]=h,e[12]=p):p=e[12],p}function ci(t){const e=(0,V.c)(13),{children:r,className:s,size:n,as:a,subheading:i}=t,o=n===void 0?"medium":n,l=a===void 0?"h2":a,c=li[o];let u;e[0]!==s?(u=Z("space-y-2",s),e[0]=s,e[1]=u):u=e[1];let d;e[2]!==l||e[3]!==r||e[4]!==c.sectionHeading?(d=(0,f.jsx)(l,{className:c.sectionHeading,children:r}),e[2]=l,e[3]=r,e[4]=c.sectionHeading,e[5]=d):d=e[5];let h;e[6]!==c.sectionSubheading||e[7]!==i?(h=i&&(0,f.jsx)("p",{className:c.sectionSubheading,children:i}),e[6]=c.sectionSubheading,e[7]=i,e[8]=h):h=e[8];let p;return e[9]!==u||e[10]!==d||e[11]!==h?(p=(0,f.jsxs)("div",{className:u,children:[d,h]}),e[9]=u,e[10]=d,e[11]=h,e[12]=p):p=e[12],p}function In(t){const e=(0,V.c)(7),{children:r,className:s,size:n,as:a}=t,i=n===void 0?"medium":n,o=a===void 0?"p":a,l=li[i];let c;e[0]!==s||e[1]!==l.body?(c=Z(l.body,s),e[0]=s,e[1]=l.body,e[2]=c):c=e[2];let u;return e[3]!==o||e[4]!==r||e[5]!==c?(u=(0,f.jsx)(o,{className:c,children:r}),e[3]=o,e[4]=r,e[5]=c,e[6]=u):u=e[6],u}function MC(t){const e=(0,V.c)(5),{children:r,className:s,size:n,subheading:a}=t,i=n===void 0?"extra-large":n;let o;return e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==a?(o=(0,f.jsx)(rv,{as:"h1",size:i,className:s,subheading:a,children:r}),e[0]=r,e[1]=s,e[2]=i,e[3]=a,e[4]=o):o=e[4],o}function OC(t){const e=(0,V.c)(5),{children:r,className:s,size:n,subheading:a}=t,i=n===void 0?"extra-large":n;let o;return e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==a?(o=(0,f.jsx)(ci,{as:"h2",size:i,className:s,subheading:a,children:r}),e[0]=r,e[1]=s,e[2]=i,e[3]=a,e[4]=o):o=e[4],o}function FC(t){const e=(0,V.c)(5),{children:r,className:s,size:n,subheading:a}=t,i=n===void 0?"medium":n;let o;return e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==a?(o=(0,f.jsx)(ci,{as:"h3",size:i,className:s,subheading:a,children:r}),e[0]=r,e[1]=s,e[2]=i,e[3]=a,e[4]=o):o=e[4],o}
26function DC(t){const e=(0,V.c)(5),{children:r,className:s,size:n,subheading:a}=t,i=n===void 0?"small":n;let o;return e[0]!==r||e[1]!==s||e[2]!==i||e[3]!==a?(o=(0,f.jsx)(ci,{as:"h4",size:i,className:s,subheading:a,children:r}),e[0]=r,e[1]=s,e[2]=i,e[3]=a,e[4]=o):o=e[4],o}function LC(t){const e=(0,V.c)(4),{children:r,className:s,as:n}=t,a=n===void 0?"p":n;let i;return e[0]!==a||e[1]!==r||e[2]!==s?(i=(0,f.jsx)(In,{as:a,size:"extra-small",className:s,children:r}),e[0]=a,e[1]=r,e[2]=s,e[3]=i):i=e[3],i}function NC(t){const e=(0,V.c)(3),{children:r,className:s}=t;let n;return e[0]!==r||e[1]!==s?(n=(0,f.jsx)(In,{as:"p",size:"large",className:s,children:r}),e[0]=r,e[1]=s,e[2]=n):n=e[2],n}function sv(t){const e=(0,V.c)(3),{address:r,phone:s}=t;let n;return e[0]!==r||e[1]!==s?(n=(0,f.jsxs)(In,{size:"small",className:"text-muted-foreground",children:[s," ",r]}),e[0]=r,e[1]=s,e[2]=n):n=e[2],n}var Il=(0,b.createContext)(null),nv=()=>{const t=(0,b.useContext)(Il);if(!t)throw new Error("useRating must be used within a Rating component");return t},av=({index:t,size:e=20,className:r,icon:s=(0,f.jsx)(ei,{})})=>{const{value:n,readOnly:a,hoverValue:i,focusedStar:o,handleValueChange:l,handleKeyDown:c,setHoverValue:u,setFocusedStar:d}=nv(),h=t??0,p=h<(i??o??n??0);let m=-1;a||(m=n===h+1?0:-1);const g=(0,b.useCallback)(C=>{l(C,h+1)},[l,h]),v=(0,b.useCallback)(()=>{a||u(h+1)},[a,u,h]),_=(0,b.useCallback)(()=>{d(h+1)},[d,h]),S=(0,b.useCallback)(()=>{d(null)},[d]),y=h+1,w=y===1?"1 star":`${y} stars`;return(0,f.jsx)("button",{"aria-label":w,className:Z("rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","p-0.5",a&&"cursor-default",r),disabled:a,onBlur:S,onClick:g,onFocus:_,onKeyDown:c,onMouseEnter:v,tabIndex:m,type:"button",children:(0,b.cloneElement)(s,{size:e,className:Z("transition-colors duration-200",p&&"fill-current",!a&&"cursor-pointer"),"aria-hidden":"true"})})},iv=t=>{const e=(0,V.c)(45);let r,s,n,a,i,o,l,c;e[0]!==t?({value:a,onValueChange:n,defaultValue:l,onChange:i,readOnly:c,className:s,children:r,...o}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=i,e[6]=o,e[7]=l,e[8]=c):(r=e[1],s=e[2],n=e[3],a=e[4],i=e[5],o=e[6],l=e[7],c=e[8]);const u=l===void 0?0:l,d=c===void 0?!1:c,[h,p]=(0,b.useState)(null),[m,g]=(0,b.useState)(null),v=(0,b.useRef)(null);let _;e[9]!==n||e[10]!==a||e[11]!==u?(_={defaultProp:u,prop:a,onChange:n},e[9]=n,e[10]=a,e[11]=u,e[12]=_):_=e[12];const[S,y]=Gu(_);let w;e[13]!==i||e[14]!==y||e[15]!==d?(w=(D,j)=>{d||(i?.(D,j),y?.(j))},e[13]=i,e[14]=y,e[15]=d,e[16]=w):w=e[16];const C=w;let x;e[17]!==r||e[18]!==m||e[19]!==C||e[20]!==d||e[21]!==S?(x=D=>{if(d)return;const j=b.Children.count(r);let U=m!==null?m:S??0;e:switch(D.key){case"ArrowRight":D.shiftKey||D.metaKey?U=j:U=Math.min(j,U+1);break e;case"ArrowLeft":D.shiftKey||D.metaKey?U=1:U=Math.max(1,U-1);break e;default:return}D.preventDefault(),g(U),C(D,U)},e[17]=r,e[18]=m,e[19]=C,e[20]=d,e[21]=S,e[22]=x):x=e[22];const k=x;let A,P;e[23]!==m?(A=()=>{m!==null&&v.current&&v.current.querySelectorAll("button")[m-1]?.focus()},P=[m],e[23]=m,e[24]=A,e[25]=P):(A=e[24],P=e[25]),(0,b.useEffect)(A,P);const T=S??0;let R;e[26]!==m||e[27]!==k||e[28]!==C||e[29]!==h||e[30]!==d||e[31]!==T?(R={value:T,readOnly:d,hoverValue:h,focusedStar:m,handleValueChange:C,handleKeyDown:k,setHoverValue:p,setFocusedStar:g},e[26]=m,e[27]=k,e[28]=C,e[29]=h,e[30]=d,e[31]=T,e[32]=R):R=e[32];const I=R;let E;e[33]!==s?(E=Z("inline-flex items-center gap-0.5",s),e[33]=s,e[34]=E):E=e[34];let M;e[35]===Symbol.for("react.memo_cache_sentinel")?(M=()=>p(null),e[35]=M):M=e[35];let F;e[36]!==r?(F=b.Children.map(r,ov),e[36]=r,e[37]=F):F=e[37];let $;e[38]!==o||e[39]!==E||e[40]!==F?($=(0,f.jsx)("div",{"aria-label":"Rating",className:E,onMouseLeave:M,ref:v,role:"radiogroup",tabIndex:0,...o,children:F}),e[38]=o,e[39]=E,e[40]=F,e[41]=$):$=e[41];let O;return e[42]!==I||e[43]!==$?(O=(0,f.jsx)(Il.Provider,{value:I,children:$}),e[42]=I,e[43]=$,e[44]=O):O=e[44],O};function ov(t,e){return t?(0,b.cloneElement)(t,{index:e}):null}var lv={small:16,medium:20,large:24};function cv(t){const e=(0,V.c)(17),{rating:r,totalRatings:s,size:n,className:a}=t,i=lv[n===void 0?"medium":n];let o;e[0]!==a?(o=Z("flex items-start gap-1",a),e[0]=a,e[1]=o):o=e[1];const l=r??0;let c;e[2]!==l?(c=(0,f.jsx)("span",{className:"text-sm text-muted-foreground",children:l}),e[2]=l,e[3]=c):c=e[3];const u=r??0;let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=Array.from({length:5}),e[4]=d):d=e[4];let h;e[5]!==i?(h=d.map((v,_)=>(0,f.jsx)(av,{className:"text-yellow-500",size:i},_)),e[5]=i,e[6]=h):h=e[6];let p;e[7]!==u||e[8]!==h?(p=(0,f.jsx)(iv,{value:u,readOnly:!0,children:h}),e[7]=u,e[8]=h,e[9]=p):p=e[9];let m;e[10]!==s?(m=s!==void 0&&(0,f.jsxs)("span",{"data-testid":"total-rating",className:"text-sm text-muted-foreground",children:["(",s,")"]}),e[10]=s,e[11]=m):m=e[11];let g;return e[12]!==o||e[13]!==c||e[14]!==p||e[15]!==m?(g=(0,f.jsxs)("div",{className:o,children:[c,p,m]}),e[12]=o,e[13]=c,e[14]=p,e[15]=m,e[16]=g):g=e[16],g}function Pn(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("bg-card text-card-foreground flex flex-col gap-6 rounded-lg border border-muted-foreground
26/20 py-6 shadow-sm",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"card",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function Pl(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"card-header",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function uv(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("leading-none font-semibold",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"card-title",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function dv(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("text-muted-foreground text-sm",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"card-description",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function jC(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("col-start-2 row-span-2 row-start-1 self-start justify-self-end",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"card-action",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function El(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("px-6",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"card-content",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function $C(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("flex items-center px-6 [.border-t]:pt-6",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"card-footer",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}var fv=t=>{const e=(0,V.c)(32),{latitude:r,longitude:s,location:n,enableHover:a}=t,i=a===void 0?!0:a,o=n.photos?.[0]?.photo_reference;let l;e[0]!==o?(l=Al(o),e[0]=o,e[1]=l):l=e[1];const c=l;let u;e[2]!==r||e[3]!==s?(u={latitude:r,longitude:s},e[2]=r,e[3]=s,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==n.name?(d=c&&(0,f.jsx)("div",{className:"h-[140px] w-full bg-cover bg-center",style:{backgroundImage:`url(${c})`},role:"img","aria-label":n.name}),e[5]=c,e[6]=n.name,e[7]=d):d=e[7];let h;e[8]!==n.name?(h=(0,f.jsx)("h3",{className:"text-lg font-semibold leading-none tracking-tight",children:n.name}),e[8]=n.name,e[9]=h):h=e[9];let p;e[10]!==n.rating||e[11]!==n.user_ratings_total?(p=(0,f.jsx)(cv,{size:"small",rating:n.rating,totalRatings:n.user_ratings_total}),e[10]=n.rating,e[11]=n.user_ratings_total,e[12]=p):p=e[12];let m;e[13]!==h||e[14]!==p?(m=(0,f.jsxs)(Pl,{children:[h,p]}),e[13]=h,e[14]=p,e[15]=m):m=e[15];let g;e[16]!==n.formatted_address||e[17]!==n.formatted_phone_number?(g=(0,f.jsx)(sv,{phone:n.formatted_phone_number,address:n.formatted_address}),e[16]=n.formatted_address,e[17]=n.formatted_phone_number,e[18]=g):g=e[18];let v;e[19]!==n.opening_hours?(v=n.opening_hours&&(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:n.opening_hours.open_now?"Open":"Closed"}),e[19]=n.opening_hours,e[20]=v):v=e[20];let _;e[21]!==g||e[22]!==v?(_=(0,f.jsxs)(El,{children:[g,v]}),e[21]=g,e[22]=v,e[23]=_):_=e[23];let S;e[24]!==_||e[25]!==d||e[26]!==m?(S=(0,f.jsxs)(Pn,{className:"w-[300px] pt-0 overflow-hidden",children:[d,m,_]}),e[24]=_,e[25]=d,e[26]=m,e[27]=S):S=e[27];let y;return e[28]!==i||e[29]!==S||e[30]!==u?(y=(0,f.jsx)(Jg,{coordinates:u,enableHover:i,children:S}),e[28]=i,e[29]=S,e[30]=u,e[31]=y):y=e[31],y},pv=new Map;function mv(){pv.clear()}function hv(t){return bs(Mo({id:`locations:${t}`,queryKey:["locations",t],queryFn:async()=>Oo(`workspaces/${t}/locations`),queryClient:_r,getKey:e=>e.uuid,staleTime:0,gcTime:3e5}))}var Ia=new Map;
26function gv(t){const e=Ia.get(t);if(e)return e;const r=hv(t);return Ia.set(t,r),r}function vv(){Ia.clear()}function VC(t){const e=(0,V.c)(14),{workspaceId:r}=t;let s;e[0]!==r?(s=r?gv(r):void 0,e[0]=r,e[1]=s):s=e[1];const n=s;let a,i;e[2]!==n?(a=d=>n?d.from({loc:n}):void 0,i=[n],e[2]=n,e[3]=a,e[4]=i):(a=e[3],i=e[4]);const o=wr(a,i),l=o.data;let c;e[5]!==n?.utils?(c=()=>n?.utils.refetch()??Promise.resolve(),e[5]=n?.utils,e[6]=c):c=e[6];let u;return e[7]!==n||e[8]!==o.isError||e[9]!==o.isLoading||e[10]!==o.isReady||e[11]!==l||e[12]!==c?(u={data:l,isLoading:o.isLoading,isReady:o.isReady,isError:o.isError,isPending:o.isLoading,error:null,refetch:c,collection:n},e[7]=n,e[8]=o.isError,e[9]=o.isLoading,e[10]=o.isReady,e[11]=l,e[12]=c,e[13]=u):u=e[13],u}function yv(t){return bs(Mo({id:`orders:${t}`,queryKey:["orders",t],queryFn:async()=>(await Oo(`workspaces/${t}/orders`)).orders,queryClient:_r,getKey:e=>e.id,staleTime:3e4,onInsert:async({transaction:e})=>{const r=e.mutations[0].modified;await Js(`workspaces/${t}/orders`,{method:"POST",body:r}),ht.success("Order created successfully")},onUpdate:async({transaction:e})=>{const r=e.mutations[0].modified;e.mutations[0].changes.stage!==void 0&&await Js(`workspaces/${t}/orders/${r.id}/stage`,{method:"PATCH",body:{stage:r.stage,lossReason:r.loss_reason}})},onDelete:async({transaction:e})=>{const r=e.mutations[0].key;await Js(`workspaces/${t}/orders/${r}`,{method:"DELETE"})}}))}var Pa=new Map;function bv(t){const e=Pa.get(t);if(e)return e;const r=yv(t);return Pa.set(t,r),r}function _v(){Pa.clear()}function ui(){const t=(0,V.c)(2),{organization:e}=qa(),r=e?.organization_id;let s;return t[0]!==r?(s=r?bv(r):void 0,t[0]=r,t[1]=s):s=t[1],s}function BC(){const t=(0,V.c)(9),e=ui();let r,s;t[0]!==e?(r=o=>e?o.from({o:e}):void 0,s=[e],t[0]=e,t[1]=r,t[2]=s):(r=t[1],s=t[2]);const n=wr(r,s),a=n.data;let i;return t[3]!==e||t[4]!==n.isError||t[5]!==n.isLoading||t[6]!==n.isReady||t[7]!==a?(i={data:a,isLoading:n.isLoading,isReady:n.isReady,isError:n.isError,collection:e},t[3]=e,t[4]=n.isError,t[5]=n.isLoading,t[6]=n.isReady,t[7]=a,t[8]=i):i=t[8],i}function UC(t){const e=(0,V.c)(9);let r;e[0]!==t?(r=t===void 0?{}:t,e[0]=t,e[1]=r):r=e[1];const s=r,{organization:n}=qa(),a=ui(),[i,o]=(0,b.useState)(!1),l=s.showToasts??!0,c=n?.organization_id;let u;e[2]!==a||e[3]!==l||e[4]!==c?(u=async h=>{if(!a||!c)throw new Error("No workspace");o(!0);try{const p=await Js(`workspaces/${c}/orders`,{method:"POST",body:h});return await a.utils.refetch(),l&&ht.success("Order created successfully"),o(!1),p}catch(p){const m=p;throw o(!1),m}},e[2]=a,e[3]=l,e[4]=c,e[5]=u):u=e[5];let d;return e[6]!==i||e[7]!==u?(d={mutateAsync:u,isPending:i},e[6]=i,e[7]=u,e[8]=d):d=e[8],d}function zC(){const t=(0,V.c)(5),e=ui(),[r,s]=(0,b.useState)(!1);let n;t[0]!==e?(n=async i=>{if(!e)throw new Error("No workspace");s(!0);try{const o=e.update(i.orderId,l=>{l.stage=i.newStatus,l.updated_at=new Date().toISOString(),i.lossReason&&(l.loss_reason=i.lossReason)});return await o.isPersisted.promise,s(!1),o}catch(o){const l=o;throw ht.error("Failed to update order status"),s(!1),l}},t[0]=e,t[1]=n):n=t[1];let a;return t[2]!==r||t[3]!==n?(a={mutateAsync:n,isPending:r},t[2]=r,t[3]=n,t[4]=a):a=t[4],a}var Sv={id:"current",user:null,isLoginDialogOpen:!1},ps=bs({...Io({id:"auth",getKey:t=>t.id,initialData:[Sv]}),startSync:!0}),Ki=!1;ps.subscribeChanges(()=>{const t=ps.state.get("current");t?.user&&(Ki=!0),t&&t.user===null&&Ki&&(dd(),_v(),fd(),Iu(),vv(),mv(),cd())});var hs={id:"current",theme:"light",colorIndex:0},Kr=bs({...ku({id:"theme-preferences",storageKey:"honeygrid-theme",getKey:t=>t.id}),startSync:!0});function wv(t){Kr.state.has("current")?Kr.update("current",e=>{Object.assign(e,t)}):Kr.insert({...hs,...t})}Kr.subscribeChanges(()=>{const t=Kr.state.get("current")?.theme??hs.theme,e=document.documentElement;t==="dark"?e.classList.add("dark"):e.classList.remove("dark")});var Gi=!1;ps&&ps.subscribeChanges(()=>{const t=ps.state.get("current");t?.user&&(Gi=!0),t&&t.user===null&&Gi&&wv({theme:hs.theme,colorIndex:hs.colorIndex})});function xv(){const{data:t}=wr(Cv);return t?.[0]?.theme??hs.theme}function Cv(t){return t.from({t:Kr})}var Av=(function(t){return t.Light="light",t.Dark="dark",t})({}),Yi={latitude:37.7577,longitude:-122.4376,zoom:8,pitch:0,bearing:0,padding:{top:170,bottom:0,left:0,right:0}},kv=t=>{const e=(0,V.c)(20),{children:r,viewState:s,onMapMoved:n}=t,a=(0,b.useRef)(null),i=xv(),o=ld();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{a.current?.resize()},e[0]=l):l=e[0];const c=l;let u;e[1]!==o?(u=A=>{od([...o||[],A])},e[1]=o,e[2]=u):u=e[2];const d=u;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{const A=a.current;A&&A.getBounds()},e[3]=h):h=e[3];const p=h,m=s||Yi,g=s?.padding||Yi.padding;let v;e[4]!==m||e[5]!==g?(v={...m,padding:g},e[4]=m,e[5]=g,e[6]=v):v=e[6];const _=v,S=i===Av.Dark?"bg-[#242424]":"bg-background";let y;e[7]!==S?(y=Z("h-full w-full",S),e[7]=S,e[8]=y):y=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w={width:"100%",height:"100%"},e[9]=w):w=e[9];let C;e[10]!==d?(C=A=>d(A.features?.[0]?.id),e[10]=d,e[11]=C):C=e[11];let x;e[12]!==r||e[13]!==_||e[14]!==n||e[15]!==C?(x=(0,f.jsx)(tu,{ref:a,..._,onMove:n,style:w,mapStyle:"mapbox://styles/mapbox/streets-v11",onMoveEnd:p,onClick:C,onResize:c,mapboxAccessToken:"pk.eyJ1IjoiaG9uZXlncmlkIiwiYSI6ImNsanJtdTRzeTBmeHczc284dHluYmZ1MHQifQ.944OFlWpSrPl8xZnJ6BIxQ",children:r}),e[12]=r,e[13]=_,e[14]=n,e[15]=C,e[16]=x):x=e[16];let k;return e[17]!==x||e[18]!==y?(k=(0,f.jsx)("div",{className:y,children:x}),e[17]=x,e[18]=y,e[19]=k):k=e[19],k},Iv=new Set(["dentist","dental_clinic"]);function di(t){return t?.some(e=>Iv.has(e))===!0}var Pv=Qr("group relative flex w-full items-start gap-3 rounded-lg border bg-card text-left text-card-foreground shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:border-ring has-[[data-slot=checkbox]:focus-visible]:border-ring has-[[data-slot=checkbox]:focus-visible]:ring-[3px] has-[[data-slot=checkbox]:focus-visible]:ring-ring/50",{variants:{density:{comfortable:"p-4 gap-4",compact:"p-3 gap-3"},selected:{true:"border-primary bg-primary/5 dark:bg-primary/10",fal
26se:"border-input"},disabled:{true:"cursor-not-allowed opacity-60",false:"cursor-pointer hover:bg-muted/50"}},defaultVariants:{density:"comfortable",selected:!1,disabled:!1}}),Ev=Qr("font-medium leading-tight",{variants:{density:{comfortable:"text-sm",compact:"text-sm"}},defaultVariants:{density:"comfortable"}}),Rv=Qr("text-muted-foreground leading-snug",{variants:{density:{comfortable:"text-sm",compact:"text-xs"}},defaultVariants:{density:"comfortable"}}),Tv=Qr("text-muted-foreground",{variants:{density:{comfortable:"text-xs",compact:"text-xs"}},defaultVariants:{density:"comfortable"}});function Mv(t){const e=(0,V.c)(16),{mode:r,selected:s,disabled:n,labelledBy:a,describedBy:i,onToggle:o}=t;if(r==="multiple"){let p;e[0]!==o?(p=g=>o?.(g===!0),e[0]=o,e[1]=p):p=e[1];let m;return e[2]!==i||e[3]!==n||e[4]!==a||e[5]!==s||e[6]!==p?(m=(0,f.jsx)(Co,{checked:s,disabled:n,"aria-labelledby":a,"aria-describedby":i,onClick:Ov,onCheckedChange:p}),e[2]=i,e[3]=n,e[4]=a,e[5]=s,e[6]=p,e[7]=m):m=e[7],m}const l=s?"border-primary":"border-input bg-background",c=n&&"opacity-60";let u;e[8]!==l||e[9]!==c?(u=Z("flex size-4 shrink-0 items-center justify-center rounded-full border shadow-xs transition-colors",l,c),e[8]=l,e[9]=c,e[10]=u):u=e[10];let d;e[11]!==s?(d=s&&(0,f.jsx)("span",{className:"size-2 rounded-full bg-primary"}),e[11]=s,e[12]=d):d=e[12];let h;return e[13]!==u||e[14]!==d?(h=(0,f.jsx)("span",{"aria-hidden":"true","data-slot":"selectable-row-card-radio",className:u,children:d}),e[13]=u,e[14]=d,e[15]=h):h=e[15],h}function Ov(t){return t.stopPropagation()}function Fv(t){return t.flatMap(([e,r])=>e?[r]:[]).join(" ")||void 0}function Dv(t,e,r){return{role:t==="multiple"?void 0:t==="action"?"button":"radio",ariaDisabled:r||void 0,tabIndex:t==="multiple"?void 0:r?-1:0,state:t==="action"?void 0:e?"checked":"unchecked"}}function Lv(t){const e=(0,V.c)(72),{title:r,subtitle:s,leading:n,meta:a,trailing:i,disabled:o,density:l,className:c}=t,u=o===void 0?!1:o,d=l===void 0?"comfortable":l,h=t.selectionMode==="action"?!1:t.selected,p=(0,b.useId)(),m=(0,b.useId)(),g=(0,b.useId)(),v=(0,b.useId)(),_=s!=null,S=a!=null,y=i!=null;let w;e[0]!==S||e[1]!==_||e[2]!==y||e[3]!==g||e[4]!==m||e[5]!==v?(w=Fv([[_,m],[S,g],[y,v]]),e[0]=S,e[1]=_,e[2]=y,e[3]=g,e[4]=m,e[5]=v,e[6]=w):w=e[6];const C=w,x=t.selectionMode==="multiple";let k;e[7]!==u||e[8]!==t.selectionMode||e[9]!==h?(k=Dv(t.selectionMode,h,u),e[7]=u,e[8]=t.selectionMode,e[9]=h,e[10]=k):k=e[10];const A=k;let P;e[11]!==u||e[12]!==t||e[13]!==h?(P=()=>{if(!u){if(t.selectionMode==="multiple"){t.onToggle(!h);return}(t.selectionMode==="action"||!h)&&t.onSelect()}},e[11]=u,e[12]=t,e[13]=h,e[14]=P):P=e[14];const T=P;let R;e[15]!==T?(R=()=>{T()},e[15]=T,e[16]=R):R=e[16];const I=R;let E;e[17]!==T||e[18]!==u?(E=de=>{u||(de.key===" "||de.key==="Enter"||de.key==="Spacebar")&&(de.preventDefault(),T())},e[17]=T,e[18]=u,e[19]=E):E=e[19];const M=E,F=A.role,$=t.selectionMode==="single"?h:void 0,O=A.ariaDisabled,D=A.tabIndex,j=A.state,U=x?void 0:M;let q;e[20]!==c||e[21]!==d||e[22]!==u||e[23]!==h?(q=Z(Pv({density:d,selected:h,disabled:u}),c),e[20]=c,e[21]=d,e[22]=u,e[23]=h,e[24]=q):q=e[24];let z;e[25]!==C||e[26]!==u||e[27]!==t.onToggle||e[28]!==t.selectionMode||e[29]!==h||e[30]!==p?(z=t.selectionMode!=="action"&&(0,f.jsx)(Mv,{mode:t.selectionMode,selected:h,disabled:u,labelledBy:p,describedBy:C,onToggle:t.selectionMode==="multiple"?t.onToggle:void 0}),e[25]=C,e[26]=u,e[27]=t.onToggle,e[28]=t.selectionMode,e[29]=h,e[30]=p,e[31]=z):z=e[31];let K;e[32]!==n?(K=n&&(0,f.jsx)("div",{"data-slot":"selectable-row-card-leading",className:"flex shrink-0 items-center",children:n}),e[32]=n,e[33]=K):K=e[33];let N;e[34]!==d?(N=Z(Ev({density:d}),"min-w-0 break-words"),e[34]=d,e[35]=N):N=e[35];let B;e[36]!==N||e[37]!==r||e[38]!==p?(B=(0,f.jsx)("div",{id:p,className:N,children:r}),e[36]=N,e[37]=r,e[38]=p,e[39]=B):B=e[39];let ee;e[40]!==d||e[41]!==_||e[42]!==s||e[43]!==m?(ee=_&&(0,f.jsx)("div",{id:m,"data-slot":"selectable-row-card-subtitle",className:Z(Rv({density:d}),"min-w-0 break-words"),children:s}),e[40]=d,e[41]=_,e[42]=s,e[43]=m,e[44]=ee):ee=e[44];let he;e[45]!==d||e[46]!==S||e[47]!==a||e[48]!==g?(he=S&&(0,f.jsx)("div",{id:g,"data-slot":"selectable-row-card-meta",className:Z(Tv({density:d}),"min-w-0 break-words"),children:a}),e[45]=d,e[46]=S,e[47]=a,e[48]=g,e[49]=he):he=e[49];let pe;e[50]!==B||e[51]!==ee||e[52]!==he?(pe=(0,f.jsxs)("div",{"data-slot":"selectable-row-card-content",className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[B,ee,he]}),e[50]=B,e[51]=ee,e[52]=he,e[53]=pe):pe=e[53];let ge;e[54]!==y||e[55]!==i||e[56]!==v?(ge=y&&(0,f.jsx)("div",{id:v,"data-slot":"selectable-row-card-trailing",className:"flex shrink-0 items-center gap-2",children:i}),e[54]=y,e[55]=i,e[56]=v,e[57]=ge):ge=e[57];let Fe;return e[58]!==d||e[59]!==I||e[60]!==A.ariaDisabled||e[61]!==A.role||e[62]!==A.state||e[63]!==A.tabIndex||e[64]!==U||e[65]!==q||e[66]!==z||e[67]!==K||e[68]!==pe||e[69]!==ge||e[70]!==$?(Fe=(0,f.jsxs)("div",{role:F,"aria-checked":$,"aria-disabled":O,tabIndex:D,"data-slot":"selectable-row-card","data-state":j,"data-density":d,onClick:I,onKeyDown:U,className:q,children:[z,K,pe,ge]}),e[58]=d,e[59]=I,e[60]=A.ariaDisabled,e[61]=A.role,e[62]=A.state,e[63]=A.tabIndex,e[64]=U,e[65]=q,e[66]=z,e[67]=K,e[68]=pe,e[69]=ge,e[70]=$,e[71]=Fe):Fe=e[71],Fe}function xt(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("bg-muted animate-pulse rounded-md",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"skeleton",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}var Nv=new Set(["administrative_area_level_1","administrative_area_level_2","administrative_area_level_3","administrative_area_level_4","administrative_area_level_5","administrative_area_level_6","administrative_area_level_7","archipelago","colloquial_area","continent","country","floor","geocode","intersection","landmark","locality","natural_feature","neighborhood","plus_code","post_box","postal_code","postal_code_prefix","postal_code_suffix","postal_town","political","premise","room","route","school_district","street_address","street_number","sublocality","sublocality_level_1","sublocality_level_2","sublocality_level_3","sublocality_level_4","sublocality_level_5","subpremise","town_square"]);function jv(t){return!t.types?.length||t.types.some(e=>!Nv.has(e))}function $v(t){const e=t?.[0];
26return e?e.split("_").filter(Boolean).map(r=>`${r[0]?.toUpperCase()??""}${r.slice(1)}`).join(" "):"Business"}function Vv(t){return typeof t!="number"?null:new Intl.NumberFormat("en-US").format(t)}function Bv(t){return kl(t.photos?.[0],320)}function Uv(t){const e=(0,V.c)(9),{business:r}=t;let s;e[0]!==r?(s=Bv(r),e[0]=r,e[1]=s):s=e[1];const n=s,a=r.displayName?.text??"Business",[i,o]=(0,b.useState)(!1);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,f.jsx)(ol,{className:"size-8","aria-hidden":"true"}),e[2]=l):l=e[2];let c;e[3]!==a||e[4]!==i||e[5]!==n?(c=n&&!i?(0,f.jsx)("img",{src:n,alt:`${a} business`,className:"absolute inset-0 size-full object-cover",loading:"lazy",onError:()=>o(!0)}):null,e[3]=a,e[4]=i,e[5]=n,e[6]=c):c=e[6];let u;return e[7]!==c?(u=(0,f.jsxs)("div",{className:"relative flex size-20 items-center justify-center overflow-hidden rounded-lg bg-muted text-muted-foreground sm:size-24",children:[l,c]}),e[7]=c,e[8]=u):u=e[8],u}function zv(t){const e=(0,V.c)(37),{business:r,onSelect:s}=t,n=r.displayName?.text??"Unnamed business";let a;e[0]!==r.userRatingCount?(a=Vv(r.userRatingCount),e[0]=r.userRatingCount,e[1]=a):a=e[1];const i=a;let o;e[2]!==r.types?(o=$v(r.types),e[2]=r.types,e[3]=o):o=e[3];const l=o;let c;e[4]!==r?(c=(0,f.jsx)(Uv,{business:r}),e[4]=r,e[5]=c):c=e[5];let u;e[6]!==n?(u=(0,f.jsx)("span",{className:"text-base font-semibold",children:n}),e[6]=n,e[7]=u):u=e[7];let d;e[8]!==r.rating||e[9]!==i?(d=typeof r.rating=="number"?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{className:"font-medium text-foreground",children:r.rating}),(0,f.jsx)(ei,{className:"size-4 fill-warning text-warning","aria-hidden":"true"}),i?(0,f.jsxs)("span",{children:["(",i,")"]}):null,(0,f.jsx)("span",{"aria-hidden":"true",children:"·"})]}):null,e[8]=r.rating,e[9]=i,e[10]=d):d=e[10];let h;e[11]!==l?(h=(0,f.jsx)("span",{children:l}),e[11]=l,e[12]=h):h=e[12];let p;e[13]!==d||e[14]!==h?(p=(0,f.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-sm",children:[d,h]}),e[13]=d,e[14]=h,e[15]=p):p=e[15];let m;e[16]!==r.formattedAddress?(m=r.formattedAddress?(0,f.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,f.jsx)(pn,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),(0,f.jsx)("span",{children:r.formattedAddress})]}):null,e[16]=r.formattedAddress,e[17]=m):m=e[17];let g;e[18]!==p||e[19]!==m?(g=(0,f.jsxs)("div",{className:"mt-1 space-y-1.5",children:[p,m]}),e[18]=p,e[19]=m,e[20]=g):g=e[20];let v;e[21]!==r.nationalPhoneNumber?(v=r.nationalPhoneNumber?(0,f.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,f.jsx)(Ga,{className:"size-3.5","aria-hidden":"true"}),r.nationalPhoneNumber]}):null,e[21]=r.nationalPhoneNumber,e[22]=v):v=e[22];let _;e[23]!==r.websiteUri?(_=r.websiteUri?(0,f.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[(0,f.jsx)(Ka,{className:"size-3.5 shrink-0","aria-hidden":"true"}),(0,f.jsx)("span",{className:"max-w-56 truncate",children:r.websiteUri})]}):null,e[23]=r.websiteUri,e[24]=_):_=e[24];let S;e[25]!==r.regularOpeningHours?(S=typeof r.regularOpeningHours?.openNow=="boolean"?(0,f.jsx)("span",{className:r.regularOpeningHours.openNow?"font-medium text-success-700 dark:text-success-400":"font-medium text-muted-foreground",children:r.regularOpeningHours.openNow?"Open now":"Closed"}):null,e[25]=r.regularOpeningHours,e[26]=S):S=e[26];let y;e[27]!==v||e[28]!==_||e[29]!==S?(y=(0,f.jsxs)("div",{className:"mt-1.5 flex flex-wrap gap-x-4 gap-y-1",children:[v,_,S]}),e[27]=v,e[28]=_,e[29]=S,e[30]=y):y=e[30];let w;return e[31]!==s||e[32]!==y||e[33]!==c||e[34]!==u||e[35]!==g?(w=(0,f.jsx)(Lv,{selectionMode:"action",onSelect:s,density:"comfortable",className:"items-center [&_[data-slot=selectable-row-card-radio]]:hidden",leading:c,title:u,subtitle:g,meta:y}),e[31]=s,e[32]=y,e[33]=c,e[34]=u,e[35]=g,e[36]=w):w=e[36],w}function qv(t){const e=(0,V.c)(3),{dentalOnly:r}=t,s=r?"Searching dental practices":"Searching businesses";let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Array.from({length:4}).map(Wv),e[0]=n):n=e[0];let a;return e[1]!==s?(a=(0,f.jsx)("div",{className:"space-y-3","aria-label":s,"aria-live":"polite",children:n}),e[1]=s,e[2]=a):a=e[2],a}function Wv(t,e){return(0,f.jsxs)("div",{className:"flex items-center gap-4 roun
26ded-lg border border-input p-4",children:[(0,f.jsx)(xt,{className:"size-24 shrink-0 rounded-lg"}),(0,f.jsxs)("div",{className:"flex-1 space-y-3",children:[(0,f.jsx)(xt,{className:"h-5 w-2/3"}),(0,f.jsx)(xt,{className:"h-4 w-1/3"}),(0,f.jsx)(xt,{className:"h-4 w-full"}),(0,f.jsx)(xt,{className:"h-4 w-1/2"})]})]},e)}function Hv(t,e,r){return{resultKind:t?"dental practices":"businesses",title:t?"Choose your dental practice":"Choose your business",summary:r?`${r.length} ${r.length===1?"result":"results"} shown for “${e}”`:`Results matching “${e}”`,errorTitle:t?"Practice search failed":"Business search failed",emptyGuidance:t?"Try the practice name with a city or state.":"Try a broader business name or location.",listLabel:t?"Matching dental practices":"Matching businesses"}}function Kv(t){const e=(0,V.c)(45),{keyword:r,state:s,onBack:n,onRetry:a,onSelect:i,dentalOnly:o,hasMore:l,isLoadingMore:c,loadMoreError:u,onLoadMore:d}=t,h=o===void 0?!1:o,p=l===void 0?!1:l,m=c===void 0?!1:c;let g,v,_,S,y,w,C,x;if(e[0]!==h||e[1]!==r||e[2]!==n||e[3]!==a||e[4]!==i||e[5]!==s.businesses||e[6]!==s.status){const R=s.status==="success"?s.businesses.filter($=>h?di($.types):jv($)):void 0,I=Hv(h,r,R);g="flex min-h-0 flex-1 flex-col overflow-hidden px-6 py-5";let E;e[15]===Symbol.for("react.memo_cache_sentinel")?(E=(0,f.jsx)(il,{className:"size-4 stroke-[1.75]"}),e[15]=E):E=e[15];let M;e[16]!==n?(M=(0,f.jsx)(dt,{type:"button",variant:"ghost",size:"icon",className:"size-8 text-foreground hover:bg-transparent hover:text-foreground","aria-label":"Back to search",onClick:n,children:E}),e[16]=n,e[17]=M):M=e[17];const F=(0,f.jsxs)("div",{className:"grid grid-cols-[2rem_minmax(0,1fr)] items-center gap-x-2",children:[M,(0,f.jsx)("h2",{className:"font-heading text-xl font-bold",children:I.title}),(0,f.jsx)("p",{className:"col-start-2 mt-1 text-sm text-muted-foreground",children:I.summary})]});e[18]!==F?(v=(0,f.jsx)("div",{className:"shrink-0",children:F}),e[18]=F,e[19]=v):v=e[19],_="business-search-results-list",S="mt-5 min-h-0 flex-1 overscroll-contain overflow-y-auto pr-2",e[20]!==h||e[21]!==s.status?(y=s.status==="loading"?(0,f.jsx)(qv,{dentalOnly:h}):null,e[20]=h,e[21]=s.status,e[22]=y):y=e[22],w=s.status==="error"?(0,f.jsxs)("div",{className:"flex min-h-52 flex-col items-center justify-center rounded-lg border border-dashed p-6 text-center",role:"alert",children:[(0,f.jsx)("h3",{className:"font-semibold",children:I.errorTitle}),(0,f.jsxs)("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:["We couldn't load matching ",I.resultKind,". Try again."]}),(0,f.jsxs)(dt,{type:"button",variant:"outline",size:"sm",className:"mt-4",onClick:a,children:[(0,f.jsx)(cl,{}),"Retry search"]})]}):null,C=s.status==="success"&&R?.length===0?(0,f.jsxs)("div",{className:"flex min-h-52 flex-col items-center justify-center rounded-lg border border-dashed p-6 text-center",children:[(0,f.jsx)(ol,{className:"size-9 text-muted-foreground","aria-hidden":"true"}),(0,f.jsxs)("h3",{className:"mt-3 font-semibold",children:["No matching ",I.resultKind]}),(0,f.jsx)("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:I.emptyGuidance})]}):null,x=s.status==="success"&&R&&R.length>0?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("ul",{className:"space-y-3","aria-label":I.listLabel,children:R.map($=>{const O=$.id;return O?(0,f.jsx)("li",{children:(0,f.jsx)(zv,{business:$,onSelect:()=>i(O)})},O):null})}),(0,f.jsxs)("div",{className:"mt-4 flex items-center justify-end gap-1.5 text-xs font-medium text-muted-foreground",children:[(0,f.jsx)("img",{src:"/brands/google-maps.svg",alt:"Google Maps",className:"size-5"}),(0,f.jsx)("span",{"aria-hidden":"true",children:"Google Maps"})]})]}):null,e[0]=h,e[1]=r,e[2]=n,e[3]=a,e[4]=i,e[5]=s.businesses,e[6]=s.status,e[7]=g,e[8]=v,e[9]=_,e[10]=S,e[11]=y,e[12]=w,e[13]=C,e[14]=x}else g=e[7],v=e[8],_=e[9],S=e[10],y=e[11],w=e[12],C=e[13],x=e[14];let k;e[23]!==u||e[24]!==s.status?(k=s.status==="success"&&u?(0,f.jsx)("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:"More results couldn't be loaded. Your current results are preserved. Retry below."}):null,e[23]=u,e[24]=s.status,e[25]=k):k=e[25];let A;e[26]!==p||e[27]!==m||e[28]!==u||e[29]!==d||e[30]!==s.status?(A=s.status==="success"&&p&&d?(0,f.jsx)(dt,{type:"button",variant:"outline",className:"mt-4 whitespace-nowrap",disabled:m,onClick:d,children:m?"Loading results...":u?"Retry more results":"Load more results"}):null,e[26]=p,e[27]=m,e[28]=u,e[29]=d,e[30]=s.status,e[31]=A):A=e[31];let P;e[32]!==k||e[33]!==A||e[34]!==_||e[35]!==S||e[36]!==y||e[37]!==w||e[38]!==C||e[39]!==x?(P=(0,f.jsxs)("div",{"data-testid":_,className:S,children:[y,w,C,x,k,A]}),e[32]=k,e[33]=A,e[34]=_,e[35]=S,e[36]=y,e[37]=w,e[38]=C,e[39]=x,e[40]=P):P=e[40];let T;return e[41]!==g||e[42]!==v||e[43]!==P?(T=(0,f.jsxs)("section",{className:g,children:[v,P]}),e[41]=g,e[42]=v,e[43]=P,e[44]=T):T=e[44],T}var ue=(function(t){return t[t.None=0]="None",t[t.Mutable=1]="Mutable",t[t.Watching=2]="Watching",t[t.RecursedCheck=4]="RecursedCheck",t[t.Recursed=8]="Recursed",t[t.Dirty=16]="Dirty",t[t.Pending=32]="Pending",t})({});function Gv({update:t,notify:e,unwatched:r}){return{link:s,unlink:n,propagate:a,checkDirty:i,shallowPropagate:o};function s(c,u,d){const h=u.depsTail;if(h!==void 0&&h.dep===c)return;const p=h!==void 0?h.nextDep:u.deps;if(p!==void 0&&p.dep===c){p.version=d,u.depsTail=p;return}const m=c.subsTail;
26if(m!==void 0&&m.version===d&&m.sub===u)return;const g=u.depsTail=c.subsTail={version:d,dep:c,sub:u,prevDep:h,nextDep:p,prevSub:m,nextSub:void 0};p!==void 0&&(p.prevDep=g),h!==void 0?h.nextDep=g:u.deps=g,m!==void 0?m.nextSub=g:c.subs=g}function n(c,u=c.sub){const d=c.dep,h=c.prevDep,p=c.nextDep,m=c.nextSub,g=c.prevSub;return p!==void 0?p.prevDep=h:u.depsTail=h,h!==void 0?h.nextDep=p:u.deps=p,m!==void 0?m.prevSub=g:d.subsTail=g,g!==void 0?g.nextSub=m:(d.subs=m)===void 0&&r(d),p}function a(c){let u=c.nextSub,d;e:do{const h=c.sub;let p=h.flags;if(p&(ue.RecursedCheck|ue.Recursed|ue.Dirty|ue.Pending)?p&(ue.RecursedCheck|ue.Recursed)?p&ue.RecursedCheck?!(p&(ue.Dirty|ue.Pending))&&l(c,h)?(h.flags=p|(ue.Recursed|ue.Pending),p&=ue.Mutable):p=ue.None:h.flags=p&~ue.Recursed|ue.Pending:p=ue.None:h.flags=p|ue.Pending,p&ue.Watching&&e(h),p&ue.Mutable){const m=h.subs;if(m!==void 0){const g=(c=m).nextSub;g!==void 0&&(d={value:u,prev:d},u=g);continue}}if((c=u)!==void 0){u=c.nextSub;continue}for(;d!==void 0;)if(c=d.value,d=d.prev,c!==void 0){u=c.nextSub;continue e}break}while(!0)}function i(c,u){let d,h=0,p=!1;e:do{const m=c.dep,g=m.flags;if(u.flags&ue.Dirty)p=!0;else if((g&(ue.Mutable|ue.Dirty))===(ue.Mutable|ue.Dirty)){if(t(m)){const v=m.subs;v.nextSub!==void 0&&o(v),p=!0}}else if((g&(ue.Mutable|ue.Pending))===(ue.Mutable|ue.Pending)){(c.nextSub!==void 0||c.prevSub!==void 0)&&(d={value:c,prev:d}),c=m.deps,u=m,++h;continue}if(!p){const v=c.nextDep;if(v!==void 0){c=v;continue}}for(;h--;){const v=u.subs,_=v.nextSub!==void 0;if(_?(c=d.value,d=d.prev):c=v,p){if(t(u)){_&&o(v),u=c.sub;continue}p=!1}else u.flags&=~ue.Pending;u=c.sub;const S=c.nextDep;if(S!==void 0){c=S;continue e}}return p}while(!0)}function o(c){do{const u=c.sub,d=u.flags;(d&(ue.Pending|ue.Dirty))===ue.Pending&&(u.flags=d|ue.Dirty,(d&(ue.Watching|ue.RecursedCheck))===ue.Watching&&e(u))}while((c=c.nextSub)!==void 0)}function l(c,u){let d=u.depsTail;for(;d!==void 0;){if(d===c)return!0;d=d.prevDep}return!1}}function fi(t,e,r){const s=typeof t=="object",n=s?t:void 0;return{next:(s?t.next:t)?.bind(n),error:(s?t.error:e)?.bind(n),complete:(s?t.complete:r)?.bind(n)}}var Ea=[],rn=0,{link:Xi,unlink:Yv,propagate:Xv,checkDirty:Rl,shallowPropagate:Qi}=Gv({update(t){return t._update()},notify(t){Ea[Ra++]=t,t.flags&=~ue.Watching},unwatched(t){t.depsTail!==void 0&&(t.depsTail=void 0,t.flags=ue.Mutable|ue.Dirty,ln(t))}}),qs=0,Ra=0,Zt,Ta=0;function pt(t){try{++Ta,t()}finally{--Ta||Tl()}}function ln(t){const e=t.depsTail;let r=e!==void 0?e.nextDep:t.deps;for(;r!==void 0;)r=Yv(r,t)}function Tl(){if(!(Ta>0)){for(;qs<Ra;){const t=Ea[qs];Ea[qs++]=void 0,t.notify()}qs=0,Ra=0}}function Ml(t,e){const r=typeof t=="function",s=t,n={_snapshot:r?void 0:t,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:r?ue.None:ue.Mutable,get(){return Zt!==void 0&&Xi(n,Zt,rn),n._snapshot},subscribe(a){const i=fi(a),o={current:!1},l=Qv(()=>{n.get(),o.current?i.next?.(n._snapshot):o.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(a){const i=Zt,o=e?.compare??Object.is;if(r)Zt=n,++rn,n.depsTail=void 0;else if(a===void 0)return!1;r&&(n.flags=ue.Mutable|ue.RecursedCheck);try{const l=n._snapshot,c=typeof a=="function"?a(l):a===void 0&&r?s(l):a;return l===void 0||!o(l,c)?(n._snapshot=c,!0):!1}finally{Zt=i,r&&(n.flags&=~ue.RecursedCheck),ln(n)}}};return r?(n.flags=ue.Mutable|ue.Dirty,n.get=function(){const a=n.flags;if(a&ue.Dirty||a&ue.Pending&&Rl(n.deps,n)){if(n._update()){const i=n.subs;i!==void 0&&Qi(i)}}else a&ue.Pending&&(n.flags=a&~ue.Pending);return Zt!==void 0&&Xi(n,Zt,rn),n._snapshot}):n.set=function(a){if(n._update(a)){const i=n.subs;i!==void 0&&(Xv(i),Qi(i),Tl())}},n}function Qv(t){const e=()=>{const s=Zt;Zt=r,++rn,r.depsTail=void 0,r.flags=ue.Watching|ue.RecursedCheck;try{return t()}finally{Zt=s,r.flags&=~ue.RecursedCheck,ln(r)}},r={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ue.Watching|ue.RecursedCheck,notify(){const s=this.flags;s&ue.Dirty||s&ue.Pending&&Rl(this.deps,this)?e():this.flags=ue.Watching},stop(){this.flags=ue.None,this.depsTail=void 0,ln(this)}};return e(),r}var Ji=class{constructor(t,e){this.atom=Ml(t),this.get=this.get.bind(this),this.setState=this.setState.bind(this),this.subscribe=this.subscribe.bind(this),e&&(this.actions=e(this))}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(fi(t))}},Jv=class{constructor(t){this.atom=Ml(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(fi(t))}};function Er(t,e){return typeof t=="function"?new Jv(t):e?new Ji(t,e):new Ji(t)}var Zv=Kc();function ey(t,e){return t===e}function ty(t,e=s=>s,r){const s=r?.compare??ey,n=(0,b.useCallback)(i=>{const{unsubscribe:o}=t.subscribe(i);return o},[t]),a=(0,b.useCallback)(()=>t.get(),[t]);return(0,Zv.useSyncExternalStoreWithSelector)(n,a,a,e,s)}var Ge=(t,e=s=>s,r)=>ty(t,e,{compare:r}),ry=["dentist","dental_clinic"];function sy(t){if(!t?.length)return{status:"unknown"};if(t.some(r=>ry.includes(r)))return{status:"dental"};const e=md([...t]);return e?{status:"non_dental",detectedIndustry:e}:{status:"unknown"}}function ny(t){return t.replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase())}var ay={compact:"space-y-4",normal:"space-y-6"};function iy(t){const e=t?.[0];
26return e?e.split("_").filter(Boolean).map(r=>`${r[0]?.toUpperCase()??""}${r.slice(1)}`).join(" "):"Business"}function oy(t){return typeof t!="number"?null:new Intl.NumberFormat("en-US").format(t)}function Ol(t){try{return new URL(t).hostname.replace(/^www\./,"")}catch{return t}}function ly(t){const e=(0,V.c)(3),{rating:r}=t,s=Math.round(r*2)/2;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Array.from({length:5}),e[0]=n):n=e[0];let a;return e[1]!==s?(a=(0,f.jsx)("span",{className:"inline-flex items-center gap-0.5","aria-hidden":"true",children:n.map((i,o)=>{const l=o+1,c=s>=l,u=!c&&s>=l-.5;return(0,f.jsx)(u?Pm:ei,{className:Z("h-4 w-4 text-warning",(c||u)&&"fill-warning",!c&&!u&&"text-muted-foreground/40")},l)})}),e[1]=s,e[2]=a):a=e[2],a}function Rr(t){const e=(0,V.c)(10),{icon:r,children:s,className:n}=t;let a;e[0]!==n?(a=Z("grid grid-cols-[1.25rem_1fr] gap-3 text-sm",n),e[0]=n,e[1]=a):a=e[1];let i;e[2]!==r?(i=(0,f.jsx)(r,{className:"mt-0.5 h-5 w-5 text-primary","aria-hidden":"true"}),e[2]=r,e[3]=i):i=e[3];let o;e[4]!==s?(o=(0,f.jsx)("div",{className:"min-w-0 leading-6",children:s}),e[4]=s,e[5]=o):o=e[5];let l;return e[6]!==a||e[7]!==i||e[8]!==o?(l=(0,f.jsxs)("div",{className:a,children:[i,o]}),e[6]=a,e[7]=i,e[8]=o,e[9]=l):l=e[9],l}function Fl(t){const e=(0,V.c)(20),{location:r,compact:s}=t,n=s===void 0?!1:s,a=r?.types;let i;e[0]!==a?(i=iy(a),e[0]=a,e[1]=i):i=e[1];const o=i,l=r?.ratingsTotal;let c;e[2]!==l?(c=oy(l),e[2]=l,e[3]=c):c=e[3];const u=c,d=n?"text-xl":"text-2xl";let h;e[4]!==d?(h=Z("font-semibold leading-tight text-foreground",d),e[4]=d,e[5]=h):h=e[5];const p=r?.name;let m;e[6]!==h||e[7]!==p?(m=(0,f.jsx)("h2",{className:h,children:p}),e[6]=h,e[7]=p,e[8]=m):m=e[8];let g;e[9]!==u||e[10]!==r?(g=r?.rating?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("span",{className:"font-medium text-foreground",children:r.rating}),(0,f.jsx)(ly,{rating:r.rating}),u?(0,f.jsxs)("span",{children:["(",u,")"]}):null,(0,f.jsx)("span",{"aria-hidden":"true",children:"·"})]}):null,e[9]=u,e[10]=r,e[11]=g):g=e[11];let v;e[12]!==o?(v=(0,f.jsx)("span",{children:o}),e[12]=o,e[13]=v):v=e[13];let _;e[14]!==g||e[15]!==v?(_=(0,f.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[g,v]}),e[14]=g,e[15]=v,e[16]=_):_=e[16];let S;return e[17]!==_||e[18]!==m?(S=(0,f.jsxs)("div",{className:"space-y-1.5",children:[m,_]}
26),e[17]=_,e[18]=m,e[19]=S):S=e[19],S}function cy(t){const e=(0,V.c)(10),{location:r,isLoading:s,caption:n}=t,[a,i]=(0,b.useState)(!1);let o;e[0]!==a||e[1]!==s||e[2]!==r?(o=s?(0,f.jsx)(xt,{className:"aspect-[4/3] w-full rounded-lg"}):(0,f.jsx)("div",{className:"flex aspect-[4/3] items-center justify-center overflow-hidden rounded-lg bg-muted",children:r?.photoUrl&&!a?(0,f.jsx)("img",{src:r.photoUrl,alt:r.name,className:"h-full w-full object-cover",onError:()=>i(!0)}):(0,f.jsxs)("div",{className:"flex flex-col items-center gap-2 p-4 text-sm text-muted-foreground",children:[(0,f.jsx)(yu,{className:"size-6","aria-hidden":"true"}),(0,f.jsx)("span",{children:"Photo unavailable"})]})}),e[0]=a,e[1]=s,e[2]=r,e[3]=o):o=e[3];let l;e[4]!==n||e[5]!==s?(l=!s&&n&&(0,f.jsx)("figcaption",{className:"mt-2 text-xs text-muted-foreground",children:n}),e[4]=n,e[5]=s,e[6]=l):l=e[6];let c;return e[7]!==o||e[8]!==l?(c=(0,f.jsxs)("figure",{className:"min-w-0 py-4 pl-4 sm:py-5 sm:pl-5",children:[o,l]}),e[7]=o,e[8]=l,e[9]=c):c=e[9],c}function uy(t){const e=(0,V.c)(24),{location:r,isLoading:s,showSummaryPhoto:n,photoCaption:a,supplementalContent:i,className:o}=t;let l;e[0]!==o?(l=Z("gap-0 overflow-hidden py-0 shadow-sm",o),e[0]=o,e[1]=l):l=e[1];const c=n&&"grid grid-cols-[minmax(0,32%)_minmax(0,1fr)]";let u;e[2]!==c?(u=Z(c),e[2]=c,e[3]=u):u=e[3];let d;e[4]!==s||e[5]!==r||e[6]!==a||e[7]!==n?(d=n&&(0,f.jsx)(cy,{location:r,isLoading:s,caption:a},r?.photoUrl),e[4]=s,e[5]=r,e[6]=a,e[7]=n,e[8]=d):d=e[8];let h;e[9]!==s||e[10]!==r||e[11]!==n?(h=(0,f.jsx)("div",{className:"min-w-0 p-4 sm:p-5",children:s?(0,f.jsxs)("div",{className:"space-y-3",children:[(0,f.jsx)(xt,{className:"h-5 w-52 max-w-full"}),(0,f.jsx)(xt,{className:"h-4 w-80 max-w-full"}),(0,f.jsx)(xt,{className:"h-4 w-64 max-w-full"})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Fl,{location:r,compact:!0}),(0,f.jsxs)("div",{className:"mt-3 grid gap-x-5 gap-y-1.5 sm:grid-cols-2",children:[r?.address?(0,f.jsx)(Rr,{icon:pn,className:"sm:col-span-2",children:r.address}):null,r?.phone?(0,f.jsx)(Rr,{icon:Ga,className:n?"sm:col-span-2":void 0,children:r.phone}):null,r?.website?(0,f.jsx)(Rr,{icon:Ka,className:"sm:col-span-2",children:(0,f.jsx)("a",{href:r.website,target:"_blank",rel:"noopener noreferrer",className:"block truncate text-primary hover:underline",children:Ol(r.website)})}):null]})]})}),e[9]=s,e[10]=r,e[11]=n,e[12]=h):h=e[12];let p;e[13]!==u||e[14]!==d||e[15]!==h?(p=(0,f.jsxs)("div",{className:u,children:[d,h]}),e[13]=u,e[14]=d,e[15]=h,e[16]=p):p=e[16];let m;e[17]!==s||e[18]!==i?(m=!s&&i?(0,f.jsx)("div",{"data-slot":"location-details-card-supplemental",className:"border-t p-4 sm:p-5",children:i}):null,e[17]=s,e[18]=i,e[19]=m):m=e[19];let g;return e[20]!==l||e[21]!==p||e[22]!==m?(g=(0,f.jsxs)(Pn,{className:l,children:[p,m]}),e[20]=l,e[21]=p,e[22]=m,e[23]=g):g=e[23],g}function dy(t){return Z(ay[t??"normal"],t==="compact"?"p-4":"p-5")}var Dl=t=>{const e=(0,V.c)(28),{location:r,isLoading:s,spacing:n,variant:a,showSummaryPhoto:i,photoCaption:o,supplementalContent:l,className:c}=t,u=n===void 0?"normal":n,d=a===void 0?"default":a,h=i===void 0?!1:i;if(d==="summary"){let C;return e[0]!==c||e[1]!==s||e[2]!==r||e[3]!==o||e[4]!==h||e[5]!==l?(C=(0,f.jsx)(uy,{location:r,isLoading:s,showSummaryPhoto:h,photoCaption:o,supplementalContent:l,className:c}),e[0]=c,e[1]=s,e[2]=r,e[3]=o,e[4]=h,e[5]=l,e[6]=C):C=e[6],C}let p;e[7]!==c?(p=Z("gap-0 overflow-hidden py-0 shadow-none",c),e[7]=c,e[8]=p):p=e[8];let m;e[9]!==s||e[10]!==r?(m=!s&&r?.photoUrl?(0,f.jsx)("img",{src:r.photoUrl,alt:r.name,className:"h-full w-full object-cover",loading:"lazy"}):null,e[9]=s,e[10]=r,e[11]=m):m=e[11];let g;e[12]!==m?(g=(0,f.jsx)("div",{"data-slot":"location-details-card-media",className:"aspect-[16/9] w-full overflow-hidden bg-muted",children:m}),e[12]=m,e[13]=g):g=e[13];let v;e[14]!==u?(v=dy(u),e[14]=u,e[15]=v):v=e[15];let _,S;e[16]!==s||e[17]!==r?(_=s?(0,f.jsxs)("div",{className:"space-y-3",children:[(0,f.jsx)(xt,{className:"h-8 w-3/4"}),(0,f.jsx)(xt,{className:"h-5 w-44"})]}):(0,f.jsx)(Fl,{location:r}),S=s?(0,f.jsxs)("div",{className:"space-y-4",children:[(0,f.jsx)(xt,{className:"h-5 w-full"}),(0,f.jsx)(xt,{className:"h-5 w-3/4"}),(0,f.jsx)(xt,{className:"h-5 w-2/3"})]}):(0,f.jsxs)("div",{className:"space-y-4",children:[r?.address?(0,f.jsx)(Rr,{icon:pn,children:r.address}):null,typeof r?.openNow=="boolean"?(0,f.jsx)(Rr,{icon:vu,children:(0,f.jsx)("span",{className:Z("font-medium",r.openNow?"text-emerald-700":"text-muted-foreground"),children:r.openNow?"Open now":"Closed"})}
26):null,r?.phone?(0,f.jsx)(Rr,{icon:Ga,children:r.phone}):null,r?.website?(0,f.jsx)(Rr,{icon:Ka,children:(0,f.jsx)("a",{href:r.website,target:"_blank",rel:"noopener noreferrer",className:"truncate text-primary hover:underline",children:Ol(r.website)})}):null]}),e[16]=s,e[17]=r,e[18]=_,e[19]=S):(_=e[18],S=e[19]);let y;e[20]!==v||e[21]!==_||e[22]!==S?(y=(0,f.jsxs)("div",{"data-slot":"location-details-card-content",className:v,children:[_,S]}),e[20]=v,e[21]=_,e[22]=S,e[23]=y):y=e[23];let w;return e[24]!==y||e[25]!==p||e[26]!==g?(w=(0,f.jsxs)(Pn,{className:p,children:[g,y]}),e[24]=y,e[25]=p,e[26]=g,e[27]=w):w=e[27],w},fy=class{constructor(t,e){this.fn=t,this.options=e,this.lastExecutionTime=0,this.isPending=!1,this.maybeExecute=(...r)=>{const s=Date.now()-this.lastExecutionTime;if(this.options.leading&&s>=this.options.wait)this.execute(...r);else if(this.lastArgs=r,!this.timeoutId&&this.options.trailing){const n=this.options.wait-s;this.isPending=!0,this.timeoutId=setTimeout(()=>{this.lastArgs!==void 0&&this.execute(...this.lastArgs)},n)}},this.execute=(...r)=>{this.fn(...r),this.options.onExecute?.(r,this),this.lastExecutionTime=Date.now(),this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.flush=()=>{this.isPending&&this.lastArgs&&this.execute(...this.lastArgs)},this.cancel=()=>{this.clearTimeout(),this.lastArgs=void 0,this.isPending=!1},this.clearTimeout=()=>{this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=void 0)},this.options.leading===void 0&&this.options.trailing===void 0&&(this.options.leading=!0,this.options.trailing=!0)}};function py(t,e){return new fy(t,e).maybeExecute}var my=class{#a=!0;#t;#e;#d;#r;#o;#s;#l;#f=0;#m=5;#i=!1;#c=!1;#n=null;#p=()=>{this.debugLog("Connected to event bus"),this.#o=!0,this.#i=!1,this.debugLog("Emitting queued events",this.#r),this.#r.forEach(t=>this.emitEventToBus(t)),this.#r=[],this.stopConnectLoop(),this.#e().removeEventListener("tanstack-connect-success",this.#p)};#u=()=>{if(this.#f<this.#m){this.#f++,this.dispatchCustomEvent("tanstack-connect",{});return}this.#e().removeEventListener("tanstack-connect",this.#u),this.#c=!0,this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()};#h=()=>{this.#i||(this.#i=!0,this.#e().addEventListener("tanstack-connect-success",this.#p),this.#u())};constructor({pluginId:t,debug:e=!1,enabled:r=!0,reconnectEveryMs:s=300}){this.#t=t,this.#a=r,this.#e=this.getGlobalTarget,this.#d=e,this.debugLog(" Initializing event subscription for plugin",this.#t),this.#r=[],this.#o=!1,this.#c=!1,this.#s=null,this.#l=s}startConnectLoop(){this.#s!==null||this.#o||(this.debugLog(`Starting connect loop (every ${this.#l}ms)`),this.#s=setInterval(this.#u,this.#l))}stopConnectLoop(){this.#i=!1,this.#s!==null&&(clearInterval(this.#s),this.#s=null,this.#r=[],this.debugLog("Stopped connect loop"))}debugLog(...t){this.#d&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...t)}getGlobalTarget(){if(typeof globalThis<"u"&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<"u"&&typeof window.addEventListener<"u")return this.debugLog("Using window as event target"),window;const t=typeof EventTarget<"u"?new EventTarget:void 0;return typeof t>"u"||typeof t.addEventListener>"u"?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),t)}getPluginId(){return this.#t}dispatchCustomEventShim(t,e){try{const r=new Event(t,{detail:e});this.#e().dispatchEvent(r)}catch{this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(t,e){try{this.#e().dispatchEvent(new CustomEvent(t,{detail:e}))}catch{this.dispatchCustomEventShim(t,e)}}emitEventToBus(t){this.debugLog("Emitting event to client bus",t),this.dispatchCustomEvent("tanstack-dispatch-event",t)}createEventPayload(t,e){return{type:`${this.#t}:${t}`,payload:e,pluginId:this.#t}}emit(t,e){if(!this.#a){this.debugLog("Event bus client is disabled, not emitting event",t,e);return}if(this.#n&&(this.debugLog("Emitting event to internal event target",t,e),this.#n.dispatchEvent(new CustomEvent(`${this.#t}:${t}`,{detail:this.createEventPayload(t,e)}))),this.#c){this.debugLog("Previously failed to connect, not emitting to bus");return}if(!this.#o){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#r.push(this.createEventPayload(t,e)),typeof CustomEvent<"u"&&!this.#i&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(t,e))}on(t,e,r){const s=r?.withEventTarget??!1,n=`${this.#t}:${t}`;if(s&&(this.#n||(this.#n=new EventTarget),this.#n.addEventListener(n,i=>{e(i.detail)})),!this.#a)return this.debugLog("Event bus client is disabled, not registering event",n),()=>{};const a=i=>{this.debugLog("Received event from bus",i.detail),e(i.detail)};return this.#e().addEventListener(n,a),this.debugLog("Registered event to bus",n),()=>{s&&this.#n?.removeEventListener(n,a),this.#e().removeEventListener(n,a)}}onAll(t){if(!this.#a)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=r=>{const s=r.detail;t(s)};return this.#e().addEventListener("tanstack-devtools-global",e),()=>this.#e().removeEventListener("tanstack-devtools-global",e)}onAllPluginEvents(t){if(!this.#a)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};const e=r=>{const s=r.detail;this.#t&&s.pluginId!==this.#t||t(s)};return this.#e().addEventListener("tanstack-devtools-global",e),()=>this.#e().removeEventListener("tanstack-devtools-global",e)}},hy=class extends my{constructor(){super({pluginId:"form-devtools",reconnectEveryMs:1e3})}},Ft=new hy;function ts(t,e){return typeof t=="function"?t(e):t}function Hr(t,e){return En(e).reduce((r,s)=>{if(r===null)return null;if(typeof r<"u")return r[s]},t)}function is(t,e,r){const s=En(e);function n(a){if(!s.length)return ts(r,a);const i=s.shift();if(typeof i=="string"||typeof i=="number"&&!Array.isArray(a))return typeof a=="object"?(a===null&&(a={}),{...a,[i]:n(a[i])}):{[i]:n()};if(Array.isArray(a)&&typeof i=="number"){const o=a.slice(0,i);return[...o.length?o:new Array(i),n(a[i]),...a.slice(i+1)]}return[...new Array(i),n()]}return n(t)}function gy(t,e){const r=En(e);
26function s(n){if(!n)return;if(r.length===1){const i=r[0];if(Array.isArray(n)&&typeof i=="number")return n.filter((c,u)=>u!==i);const{[i]:o,...l}=n;return l}const a=r.shift();if((typeof a=="string"||typeof a=="number"&&!Array.isArray(n))&&typeof n=="object")return{...n,[a]:s(n[a])};if(typeof a=="number"&&Array.isArray(n)){if(a>=n.length)return n;const i=n.slice(0,a);return[...i.length?i:new Array(a),s(n[a]),...n.slice(a+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return s(t)}var Zi=46,ia=91,oa=93,eo=48,vy=57;function En(t){if(Array.isArray(t))return[...t];if(typeof t!="string")throw new Error("Path must be a string.");const e=t.length,r=[];let s=e>0&&t.charCodeAt(0)===ia?1:0,n=!0,a=-1;for(let i=s;i<=e;i++){const o=i<e?t.charCodeAt(i):-1;if(i===e||o===Zi||o===ia||o===oa){const l=i-s;if(l>0){const c=n&&(l===1||t.charCodeAt(s)!==eo),u=t.slice(s,i);if(c){const d=parseInt(u,10);l<=15||String(d)===u?r.push(d):r.push(u)}else r.push(u)}else a!==oa&&!(a===-1&&o===oa)&&!(a===o&&(o===Zi||o===ia))&&r.push("");s=i+1,n=!0}else(o<eo||o>vy)&&(n=!1);a=o}return r.length||r.push(""),r}function to(t,e){return t.length===0?e:e.length===0?t:e.startsWith("[")||e.startsWith(".")?t+e:`${t}.${e}`}function yy(t){return!(Array.isArray(t)&&t.length===0)}function gs(t,e){const r=s=>s.validators.filter(Boolean).map(n=>({cause:n.cause,validate:n.fn}));return e.validationLogic({form:e.form,group:e.group,validators:e.validators,event:{type:t,fieldName:e.fieldName,async:!1},runValidation:r})}function vs(t,e){const{asyncDebounceMs:r}=e,{onBlurAsyncDebounceMs:s,onChangeAsyncDebounceMs:n,onDynamicAsyncDebounceMs:a}=e.validators||{},i=r??0,o=l=>l.validators.filter(Boolean).map(c=>{const u=c?.cause||t;let d=i;switch(u){case"change":d=n??i;break;case"blur":d=s??i;break;case"dynamic":d=a??i;break;case"submit":d=0}return t==="submit"&&(d=0),{cause:u,validate:c.fn,debounceMs:d}});return e.validationLogic({form:e.form,group:e.group,validators:e.validators,event:{type:t,fieldName:e.fieldName,async:!0},runValidation:o})}var sn=t=>!!t&&typeof t=="object"&&"fields"in t;function cr(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[n,a]of t)if(!e.has(n)||!Object.is(a,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length||r.length===0&&!Array.isArray(t)&&!Array.isArray(e)&&(Object.getPrototypeOf(t)!==Object.prototype||Object.getPrototypeOf(e)!==Object.prototype))return!1;for(const n of r)if(!s.includes(n)||!cr(t[n],e[n]))return!1;return!0}var Ma=({newFormValidatorError:t,isPreviousErrorFromFormValidator:e,previousErrorValue:r})=>t?{newErrorValue:t,newSource:"form"}:e?{newErrorValue:void 0,newSource:void 0}:r?{newErrorValue:r,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},cn=({formLevelError:t,fieldLevelError:e})=>e?{newErrorValue:e,newSource:"field"}:t?{newErrorValue:t,newSource:"form"}:{newErrorValue:void 0,newSource:void 0};function St(t,e){return t==null?e:{...t,...e}}var Tr=256,nn=[],Ws;for(;Tr--;)nn[Tr]=(Tr+256).toString(16).substring(1);function Ll(){let t=0,e,r="";if(!Ws||Tr+16>256){for(Ws=new Array(256),t=256;t--;)Ws[t]=256*Math.random()|0;t=0,Tr=0}for(;t<16;t++)e=Ws[Tr+t],t===6?r+=nn[e&15|64]:t===8?r+=nn[e&63|128]:r+=nn[e],t&1&&t>1&&t<11&&(r+="-");return Tr++,r}var by=py(t=>Ft.emit("form-state",{id:t.formId,state:t.store.state}),{wait:300});function fs(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)){const r=[];for(let s=0;s<t.length;s++)r[s]=fs(t[s]);return r}if(t instanceof Map){const r=new Map;return t.forEach((s,n)=>{r.set(n,fs(s))}),r}if(t instanceof Set){const r=new Set;return t.forEach(s=>{r.add(fs(s))}),r}const e={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=fs(t[r]));return e}function Mr(t,e){return e===t||e.startsWith(`${t}.`)||e.startsWith(`${t}[`)}var tr=t=>{if(!t.validators)return t.runValidation({validators:[],form:t.form});const e=t.event.async,r=e?void 0:{fn:t.validators.onMount,cause:"mount"},s={fn:e?t.validators.onChangeAsync:t.validators.onChange,cause:"change"},n={fn:e?t.validators.onBlurAsync:t.validators.onBlur,cause:"blur"},a={fn:e?t.validators.onSubmitAsync:t.validators.onSubmit,cause:"submit"},i=e?void 0:{fn:()=>{},cause:"server"};switch(t.event.type){case"mount":return t.runValidation({validators:[r],form:t.form});case"submit":return t.runValidation({validators:[s,n,a,i],form:t.form});
26case"server":return t.runValidation({validators:[],form:t.form});case"blur":return t.runValidation({validators:[n,i],form:t.form});case"change":return t.runValidation({validators:[s,i],form:t.form});default:throw new Error(`Unknown validation event type: ${t.event.type}`)}};function _y(t,e){const r=new Map;for(const s of t){const n=s.path??[];let a=e,i="";for(let o=0;o<n.length;o++){const l=n[o];if(l===void 0)continue;const c=typeof l=="object"?l.key:l,u=Number(c);Array.isArray(a)&&!Number.isNaN(u)?i+=`[${u}]`:i+=(o>0?".":"")+String(c),typeof a=="object"&&a!==null?a=a[c]:a=void 0}r.set(i,(r.get(i)??[]).concat(s))}return Object.fromEntries(r)}var ro=(t,e)=>{const r=_y(t,e);return{form:r,fields:r}},Or={validate({value:t,validationSource:e},r){const s=r["~standard"].validate(t);if(s instanceof Promise)throw new Error("async function passed to sync validator");if(s.issues)return e==="field"?s.issues:ro(s.issues,t)},async validateAsync({value:t,validationSource:e},r){const s=await r["~standard"].validate(t);if(s.issues)return e==="field"?s.issues:ro(s.issues,t)}},pi=t=>!!t&&"~standard"in t,Rt={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{},_arrayVersion:0};function vr(t){function e(d){const h=t.getFieldMeta(d)??Rt;t.setFieldMeta(d,{...h,_arrayVersion:(h._arrayVersion||0)+1})}function r(d,h,p){e(d);const m=o(d,h,"move",p),g=Math.min(h,p),v=Math.max(h,p);for(let S=g;S<=v;S++)m.push(i(d,S));const _=Object.keys(t.fieldInfo).reduce((S,y)=>(y.startsWith(i(d,h))&&S.set(y,t.getFieldMeta(y)),S),new Map);c(m,h<p?"up":"down"),Object.keys(t.fieldInfo).filter(S=>S.startsWith(i(d,p))).forEach(S=>{const y=S.replace(i(d,p),i(d,h)),w=_.get(y);w&&t.setFieldMeta(S,w)})}function s(d,h){e(d),c(o(d,h,"remove"),"up")}function n(d,h,p){e(d),o(d,h,"swap",p).forEach(m=>{if(!m.toString().startsWith(i(d,h)))return;const g=m.toString().replace(i(d,h),i(d,p)),[v,_]=[t.getFieldMeta(m),t.getFieldMeta(g)];v&&t.setFieldMeta(g,v),_&&t.setFieldMeta(m,_)})}function a(d,h){e(d);const p=o(d,h,"insert");c(p,"down"),p.forEach(m=>{m.toString().startsWith(i(d,h))&&t.setFieldMeta(m,u())})}function i(d,h){return`${d}[${h}]`}function o(d,h,p,m){const g=[i(d,h)];switch(p){case"swap":g.push(i(d,m));break;case"move":{const[v,_]=[Math.min(h,m),Math.max(h,m)];for(let S=v;S<=_;S++)g.push(i(d,S));break}default:{const v=t.getFieldValue(d),_=Array.isArray(v)?v.length:0;for(let S=h+1;S<_;S++)g.push(i(d,S));break}}return Object.keys(t.fieldInfo).filter(v=>g.some(_=>v.startsWith(_)))}function l(d,h){return d.replace(/\[(\d+)\]/,(p,m)=>{const g=parseInt(m,10);return`[${h==="up"?g+1:Math.max(0,g-1)}]`})}function c(d,h){(h==="up"?d:[...d].reverse()).forEach(p=>{const m=l(p.toString(),h),g=t.getFieldMeta(m);g?t.setFieldMeta(p,g):t.setFieldMeta(p,u())})}const u=()=>Rt;return{bumpArrayVersion:e,handleArrayMove:r,handleArrayRemove:s,handleArraySwap:n,handleArrayInsert:a}}function la(t){return{values:t.values??{},errorMap:t.errorMap??{},fieldMetaBase:t.fieldMetaBase??{},formGroupStateBase:t.formGroupStateBase??{},isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1,validationMetaMap:t.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}var so=class{constructor(t){this.options={},this.fieldInfo={},this.formGroupApis=new Set,this.mount=()=>{const n=this.store.subscribe(()=>{by(this)}),a=Ft.on("request-form-state",u=>{u.payload.id===this._formId&&Ft.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}),i=Ft.on("request-form-reset",u=>{u.payload.id===this._formId&&this.reset()}),o=Ft.on("request-form-force-submit",u=>{u.payload.id===this._formId&&(this._devtoolsSubmissionOverride=!0,this.handleSubmit(),this._devtoolsSubmissionOverride=!1)}),l=()=>{o(),i(),a(),n.unsubscribe(),Ft.emit("form-unmounted",{id:this._formId})};this.options.listeners?.onMount?.({formApi:this});const{onMount:c}=this.options.validators||{};return Ft.emit("form-api",{id:this._formId,state:this.store.state,options:this.options}
26),c&&this.validateSync("mount"),l},this.update=n=>{if(!n)return;const a=this.options;this.options=n;const i=n.defaultValues&&!cr(n.defaultValues,a.defaultValues)&&!this.state.isTouched,o=!cr(n.defaultState,a.defaultState)&&!this.state.isTouched;if(!(!i&&!o)){if(pt(()=>{this.baseStore.setState(()=>la(Object.assign({},this.state,o?n.defaultState:{},i?{values:n.defaultValues}:{})))}),i){const l=vr(this);for(const c of Object.keys(this.fieldInfo))Array.isArray(this.getFieldValue(c))&&l.bumpArrayVersion(c)}Ft.emit("form-api",{id:this._formId,state:this.store.state,options:this.options})}},this.reset=(n,a)=>{const{fieldMeta:i}=this.state,o=this.resetFieldMeta(i);n&&!a?.keepDefaultValues&&(this.options={...this.options,defaultValues:n}),this.baseStore.setState(()=>{let l=n??this.options.defaultValues??this.options.defaultState?.values;return n||Object.values(this.fieldInfo).forEach(c=>{c.instance&&c.instance.options.defaultValue!==void 0&&(l=is(l,c.instance.name,c.instance.options.defaultValue))}),la({...this.options.defaultState,values:l,fieldMetaBase:o})})},this.validateAllFields=async n=>{const a=[];return pt(()=>{Object.values(this.fieldInfo).forEach(i=>{if(!i.instance)return;const o=i.instance;a.push(Promise.resolve().then(()=>o.validate(n,{skipFormValidation:!0,skipGroupValidation:!0}))),i.instance.store.state.meta.isTouched||i.instance.setMeta(l=>({...l,isTouched:!0}))})}),(await Promise.all(a)).flat()},this.validateArrayFieldsStartingFrom=async(n,a,i)=>{const o=this.getFieldValue(n),l=Array.isArray(o)?Math.max(o.length-1,0):null,c=[`${n}[${a}]`];for(let h=a+1;h<=(l??0);h++)c.push(`${n}[${h}]`);const u=Object.keys(this.fieldInfo).filter(h=>c.some(p=>h.startsWith(p))),d=[];return pt(()=>{u.forEach(h=>{d.push(Promise.resolve().then(()=>this.validateField(h,i)))})}),(await Promise.all(d)).flat()},this.validateField=(n,a)=>{const i=this.fieldInfo[n]?.instance;if(!i){const{hasErrored:o}=this.validateSync(a);return o&&!this.options.asyncAlways?this.getFieldMeta(n)?.errors??[]:this.validateAsync(a).then(()=>this.getFieldMeta(n)?.errors??[])}return i.store.state.meta.isTouched||i.setMeta(o=>({...o,isTouched:!0})),i.validate(a)},this.validateSync=(n,a)=>{const i=gs(n,{...this.options,form:this,group:a?.group,validationLogic:this.options.validationLogic||tr});let o=!1;const l={};return pt(()=>{for(const d of i){if(!d.validate)continue;const{formError:h,fieldErrors:p}=an(this.runValidator({validate:d.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"})),m=os(d.cause);let g=new Set([...Object.keys(this.state.fieldMeta),...Object.keys(p||{})]);a?.filterFieldNames&&(g=new Set([...g].filter(a.filterFieldNames)));for(const v of g){if(this.baseStore.state.fieldMetaBase[v]===void 0&&!p?.[v])continue;const{errorMap:_,errorSourceMap:S}=this.getFieldMeta(v)??Rt,y=p?.[v],{newErrorValue:w,newSource:C}=Ma({newFormValidatorError:y,isPreviousErrorFromFormValidator:S?.[m]==="form",previousErrorValue:_?.[m]});C==="form"&&(l[v]={...l[v],[m]:y}),_?.[m]!==w&&this.setFieldMeta(v,(x=Rt)=>({...x,errorMap:{...x.errorMap,[m]:w},errorSourceMap:{...x.errorSourceMap,[m]:C}}))}a?.dontUpdateFormErrorMap||this.state.errorMap?.[m]!==h&&this.baseStore.setState(v=>({...v,errorMap:{...v.errorMap,[m]:h}})),(h||p)&&(o=!0)}if(a?.dontUpdateFormErrorMap)return;const c=os("submit");this.state.errorMap?.[c]&&n!=="submit"&&!o&&this.baseStore.setState(d=>({...d,errorMap:{...d.errorMap,[c]:void 0}}));const u=os("server");this.state.errorMap?.[u]&&n!=="server"&&!o&&this.baseStore.setState(d=>({...d,errorMap:{...d.errorMap,[u]:void 0}}))}),{hasErrored:o,fieldsErrorMap:l}},this.validateAsync=async(n,a)=>{const i=vs(n,{...this.options,form:this,group:a?.group,validationLogic:this.options.validationLogic||tr});this.state.isFormValidating||this.baseStore.setState(d=>({...d,isFormValidating:!0}));const o=[];let l;for(const d of i){if(!d.validate)continue;const h=os(d.cause);this.state.validationMetaMap[h]?.lastAbortController.abort();const p=new AbortController;this.state.validationMetaMap[h]={lastAbortController:p},o.push(new Promise(async m=>{let g;
26try{g=await new Promise((w,C)=>{setTimeout(async()=>{if(p.signal.aborted)return w(void 0);try{w(await this.runValidator({validate:d.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:p.signal},type:"validateAsync"}))}catch(x){C(x)}},d.debounceMs)})}catch(w){g=w}const{formError:v,fieldErrors:_}=an(g);_&&(l=l?{...l,..._}:_);const S=os(d.cause);let y=Object.keys(this.state.fieldMeta);a?.filterFieldNames&&(y=y.filter(a.filterFieldNames));for(const w of y){if(this.baseStore.state.fieldMetaBase[w]===void 0)continue;const C=this.getFieldMeta(w);if(!C)continue;const{errorMap:x,errorSourceMap:k}=C,A=l?.[w],{newErrorValue:P,newSource:T}=Ma({newFormValidatorError:A,isPreviousErrorFromFormValidator:k?.[S]==="form",previousErrorValue:x?.[S]});x?.[S]!==P&&this.setFieldMeta(w,R=>({...R,errorMap:{...R.errorMap,[S]:P},errorSourceMap:{...R.errorSourceMap,[S]:T}}))}a?.dontUpdateFormErrorMap||this.baseStore.setState(w=>({...w,errorMap:{...w.errorMap,[S]:v}})),m(l?{fieldErrors:l,errorMapKey:S}:void 0)}))}let c=[];const u={};if(o.length){c=await Promise.all(o);for(const d of c)if(d?.fieldErrors){const{errorMapKey:h}=d;for(const[p,m]of Object.entries(d.fieldErrors))u[p]={...u[p]||{},[h]:m}}}return this.baseStore.setState(d=>({...d,isFormValidating:!1})),u},this.validate=(n,a)=>{const{hasErrored:i,fieldsErrorMap:o}=this.validateSync(n,a);return i&&!this.options.asyncAlways?o:this.validateAsync(n,a)},this._handleSubmit=async n=>{this.baseStore.setState(o=>({...o,isSubmitted:!1,submissionAttempts:o.submissionAttempts+1,isSubmitSuccessful:!1})),pt(()=>{Object.values(this.fieldInfo).forEach(o=>{o.instance&&(o.instance.store.state.meta.isTouched||o.instance.setMeta(l=>({...l,isTouched:!0})))})});const a=n??this.options.onSubmitMeta;if(!this.state.canSubmit&&!this._devtoolsSubmissionOverride){this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:a});return}this.baseStore.setState(o=>({...o,isSubmitting:!0}));const i=()=>{this.baseStore.setState(o=>({...o,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){i(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:a}),Ft.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validateAllFields",errors:Object.values(this.state.fieldMeta).map(o=>o.errors).flat()});return}if(await this.validate("submit"),!this.state.isValid){i(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:a}),Ft.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"validate",errors:this.state.errors});return}pt(()=>{Object.values(this.fieldInfo).forEach(o=>{o.instance?.triggerOnSubmitListener()})}),this.options.listeners?.onSubmit?.({formApi:this,meta:a});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:a}),pt(()=>{this.baseStore.setState(o=>({...o,isSubmitted:!0,isSubmitSuccessful:!0})),Ft.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!0}),i()})}catch(o){throw this.baseStore.setState(l=>({...l,isSubmitSuccessful:!1})),Ft.emit("form-submission",{id:this._formId,submissionAttempt:this.state.submissionAttempts,successful:!1,stage:"inflight",onError:o}),i(),o}},this.getFieldValue=n=>Hr(this.state.values,n),this.getFieldMeta=n=>this.state.fieldMeta[n],this.getFormGroupMeta=n=>this.formGroupMetaDerived.state[n],this.getFieldInfo=n=>this.fieldInfo[n]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(n,a)=>{this.baseStore.setState(i=>({...i,fieldMetaBase:{...i.fieldMetaBase,[n]:ts(a,i.fieldMetaBase[n])}}))},this.resetFieldMeta=n=>Object.keys(n).reduce((a,i)=>{const o=i;return a[o]=Rt,a},{}),this.setFieldValue=(n,a,i)=>{const o=i?.dontUpdateMeta??!1,l=i?.dontRunListeners??!1,c=i?.dontValidate??!1;pt(()=>{o||this.setFieldMeta(n,u=>({...u,isTouched:!0,isDirty:!0,errorMap:{...u?.errorMap,onMount:void 0}})),this.baseStore.setState(u=>({...u,values:is(u.values,n,a)}))}),l||this.getFieldInfo(n).instance?.triggerOnChangeListener(),c||this.validateField(n,"change")},this.deleteField=n=>{const a=[...Object.keys(this.fieldInfo).filter(i=>{const o=n.toString();return i!==o&&i.startsWith(o)}),n];this.baseStore.setState(i=>{const o={...i};return a.forEach(l=>{o.values=gy(o.values,l),delete this.fieldInfo[l],delete o.fieldMetaBase[l]}),o})},this.pushFieldValue=(n,a,i)=>{this.setFieldValue(n,o=>[...Array.isArray(o)?o:[],a],i),vr(this).bumpArrayVersion(n)},this.insertFieldValue=async(n,a,i,o)=>{this.setFieldValue(n,c=>[...c.slice(0,a),i,...c.slice(a)],St(o,{dontValidate:!0}));const l=o?.dontValidate??!1;l||await this.validateField(n,"change"),vr(this).handleArrayInsert(n,a),l||await this.validateArrayFieldsStartingFrom(n,a,"change")},this.replaceFieldValue=async(n,a,i,o)=>{this.setFieldValue(n,l=>l.map((c,u)=>u===a?i:c),St(o,{dontValidate:!0})),vr(this).bumpArrayVersion(n),(o?.dontValidate??!1)||(await this.validateField(n,"change"),await this.validateArrayFieldsStartingFrom(n,a,"change"))},this.removeFieldValue=async(n,a,i)=>{const o=this.getFieldValue(n),l=Array.isArray(o)?Math.max(o.length-1,0):null;if(this.setFieldValue(n,c=>c.filter((u,d)=>d!==a),St(i,{dontValidate:!0})),vr(this).handleArrayRemove(n,a),l!==null){const c=`${n}[${l}]`;this.deleteField(c)}(i?.dontValidate??!1)||(await this.validateField(n,"change"),await this.validateArrayFieldsStartingFrom(n,a,"change"))},this.swapFieldValues=(n,a,i,o)=>{this.setFieldValue(n,l=>{const c=l[a],u=l[i];return is(is(l,`${a}`,u),`${i}`,c)},St(o,{dontValidate:!0})),vr(this).handleArraySwap(n,a,i),(o?.dontValidate??!1)||(this.validateField(n,"change"),this.validateField(`${n}[${a}]`,"change"),this.validateField(`${n}[${i}]`,"change"))},this.moveFieldValues=(n,a,i,o)=>{this.setFieldValue(n,l=>{const c=[...l];return c.splice(i,0,c.splice(a,1)[0]),c},St(o,{dontValidate:!0})),vr(this).handleArrayMove(n,a,i),(o?.dontValidate??!1)||(this.validateField(n,"change"),this.validateField(`${n}[${a}]`,"change"),this.validateField(`${n}[${i}]`,"change"))},this.clearFieldValues=(n,a)=>{const i=this.getFieldValue(n),o=Array.isArray(i)?Math.max(i.length-1,0):null;if(this.setFieldValue(n,[],St(a,{dontValidate:!0})),vr(this).bumpArrayVersion(n),o!==null)for(let l=0;l<=o;l++){const c=`${n}[${l}]`;this.deleteField(c)}(a?.dontValidate??!1)||this.validateField(n,"change")},this.resetField=n=>{this.baseStore.setState(a=>{const i=this.getFieldInfo(n).instance?.options.defaultValue,o=Hr(this.options.defaultValues,n),l=i??o;return{...a,fieldMetaBase:{...a.fieldMetaBase,[n]:Rt},values:l!==void 0?is(a.values,n,l):a.values}})},this.setErrorMap=n=>{pt(()=>
26{Object.entries(n).forEach(([a,i])=>{const o=a;if(sn(i)){const{formError:l,fieldErrors:c}=an(i);for(const u of Object.keys(this.fieldInfo))this.getFieldMeta(u)&&this.setFieldMeta(u,d=>({...d,errorMap:{...d.errorMap,[o]:c?.[u]},errorSourceMap:{...d.errorSourceMap,[o]:"form"}}));this.baseStore.setState(u=>({...u,errorMap:{...u.errorMap,[o]:l}}))}else this.baseStore.setState(l=>({...l,errorMap:{...l.errorMap,[o]:i}}))})})},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((n,[a,i])=>(Object.keys(i).length&&i.errors.length&&(n[a]={errors:i.errors,errorMap:i.errorMap}),n),{})}),this.parseValuesWithSchema=n=>Or.validate({value:this.state.values,validationSource:"form"},n),this.parseValuesWithSchemaAsync=n=>Or.validateAsync({value:this.state.values,validationSource:"form"},n),this.timeoutIds={validations:{},listeners:{},formListeners:{}},this._formId=t?.formId??Ll(),this._devtoolsSubmissionOverride=!1;let e=la({...t?.defaultState,values:t?.defaultValues??t?.defaultState?.values});if(t?.transform){e=t.transform({state:e}).state;for(const n of Object.keys(e.errorMap)){const a=e.errorMap[n];if(!(a===void 0||!sn(a)))for(const i of Object.keys(a.fields)){const o=a.fields[i];if(o===void 0)continue;const l=e.fieldMetaBase[i];e.fieldMetaBase[i]={isTouched:!1,isValidating:!1,isBlurred:!1,isDirty:!1,_arrayVersion:0,...l??{},errorSourceMap:{...l?.errorSourceMap??{},onChange:"form"},errorMap:{...l?.errorMap??{},[n]:o}}}}}this.baseStore=Er(e);let r;this.fieldMetaDerived=Er(n=>{const a=this.baseStore.get();let i=0;const o={};for(const l of Object.keys(a.fieldMetaBase)){const c=a.fieldMetaBase[l],u=r?.fieldMetaBase[l],d=n?.[l],h=Hr(a.values,l);let p=d?.errors;if(!u||c.errorMap!==u.errorMap){p=Object.values(c.errorMap??{}).filter(S=>S!==void 0);const _=this.getFieldInfo(l)?.instance;(!_||!_.options.disableErrorFlat)&&(p=p.flat(1))}const m=!yy(p),g=!c.isDirty,v=cr(h,this.getFieldInfo(l)?.instance?.options.defaultValue??Hr(this.options.defaultValues,l));if(d&&d.isPristine===g&&d.isValid===m&&d.isDefaultValue===v&&d.errors===p&&c===u){o[l]=d,i++;continue}o[l]={...c,errors:p??[],isPristine:g,isValid:m,isDefaultValue:v}}return Object.keys(a.fieldMetaBase).length?n&&i===Object.keys(a.fieldMetaBase).length?n:(r=this.baseStore.get(),o):o}),this.formGroupMetaDerived=Er(n=>{const a=this.baseStore.get(),i=this.fieldMetaDerived.get(),o={};for(const l of this.formGroupApis){const c=l.name,u=a.formGroupStateBase[c]??{isSubmitted:!1,isSubmitting:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1},d=i[c];let h=!1,p=!0,m=!1,g=!1,v=!0,_=!1;for(const M in i){if(M===c||!Mr(c,M))continue;const F=i[M];F&&(F.isValidating&&(h=!0),F.isValid||(p=!1),F.isTouched&&(m=!0),F.isBlurred&&(g=!0),F.isDefaultValue||(v=!1),F.isDirty&&(_=!0))}const S=!_,y=!!h||u.isValidating,w=d?.errorMap??{},C=d?.errorSourceMap??{},x=!!(w.onMount||Object.entries(i).some(([M,F])=>F&&M!==c&&Mr(c,M)&&F.errorMap.onMount)),k=n?.[c];let A=k?.errors??[];(!k||k.__srcErrorMap!==w)&&(A=Object.values(w).reduce((M,F)=>{if(F===void 0)return M;if(F&&typeof F=="object"&&"fields"in F){const $=F.group;return $!==void 0&&M.push($),M}return M.push(F),M},[]));const P=A.length===0,T=p&&P,R=l.options.canSubmitWhenInvalid??!1,I=u.submissionAttempts===0&&!m&&!x||!y&&!u.isSubmitting&&T||R;if(k&&k.errorMap===w&&k.errorSourceMap===C&&k.errors===A&&k.isFieldsValidating===h&&k.isFieldsValid===p&&k.isGroupValid===P&&k.isValid===T&&k.canSubmit===I&&k.isTouched===m&&k.isBlurred===g&&k.isPristine===S&&k.isDefaultValue===v&&k.isDirty===_&&k.isValidating===y&&k.isSubmitting===u.isSubmitting&&k.isSubmitted===u.isSubmitted&&k.submissionAttempts===u.submissionAttempts&&k.isSubmitSuccessful===u.isSubmitSuccessful){o[c]=k;continue}const E={...u,errorMap:w,errorSourceMap:C,_arrayVersion:d?._arrayVersion??0,isTouched:m,isBlurred:g,isDirty:_,isPristine:S,isDefaultValue:v,isValid:T,errors:A,isValidating:y,isFieldsValidating:h,isFieldsValid:p,isGroupValid:P,canSubmit:I};Object.defineProperty(E,"__srcErrorMap",{value:w,enumerable:!1,configurable:!0}),o[c]=E}return o}
26);let s;this.store=Er(n=>{const a=this.baseStore.get(),i=this.fieldMetaDerived.get(),o=Object.values(i).filter(Boolean),l=o.some(P=>P.isValidating),c=o.every(P=>P.isValid),u=o.some(P=>P.isTouched),d=o.some(P=>P.isBlurred),h=o.every(P=>P.isDefaultValue),p=u&&a.errorMap?.onMount,m=o.some(P=>P.isDirty),g=!m,v=!!(a.errorMap?.onMount||o.some(P=>P?.errorMap?.onMount)),_=!!l;let S=n?.errors??[];(!s||a.errorMap!==s.errorMap)&&(S=Object.values(a.errorMap).reduce((P,T)=>T===void 0?P:T&&sn(T)?(P.push(T.form),P):(P.push(T),P),[]));const y=S.length===0,w=c&&y,C=this.options.canSubmitWhenInvalid??!1,x=a.submissionAttempts===0&&!u&&!v||!_&&!a.isSubmitting&&w||C;let k=a.errorMap;if(p&&(S=S.filter(P=>P!==a.errorMap.onMount),k=Object.assign(k,{onMount:void 0})),n&&s&&n.errorMap===k&&n.fieldMeta===this.fieldMetaDerived.state&&n.errors===S&&n.isFieldsValidating===l&&n.isFieldsValid===c&&n.isFormValid===y&&n.isValid===w&&n.canSubmit===x&&n.isTouched===u&&n.isBlurred===d&&n.isPristine===g&&n.isDefaultValue===h&&n.isDirty===m&&cr(s,a))return n;const A={...a,errorMap:k,fieldMeta:this.fieldMetaDerived.state,errors:S,isFieldsValidating:l,isFieldsValid:c,isFormValid:y,isValid:w,canSubmit:x,isTouched:u,isBlurred:d,isPristine:g,isDefaultValue:h,isDirty:m};return s=this.baseStore.get(),A}),this.handleSubmit=this.handleSubmit.bind(this),this.update(t||{})}get state(){return this.store.state}get formId(){return this._formId}runValidator(t){return pi(t.validate)?Or[t.type](t.value,t.validate):t.validate(t.value)}handleSubmit(t){return this._handleSubmit(t)}};function an(t){return t?sn(t)?{formError:an(t.form).formError,fieldErrors:t.fields}:{formError:t}:{formError:void 0}}function os(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}var Oa=class Nl{constructor(e){this.options={},this.mount=()=>{this.options.defaultValue!==void 0&&!this.getMeta().isTouched&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const r=this.getInfo();r.instance=this,this.update(this.options);const{onMount:s}=this.options.validators||{};if(s){const n=this.runValidator({validate:s,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});n&&this.setMeta(a=>({...a,errorMap:{...a?.errorMap,onMount:n},errorSourceMap:{...a?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),()=>{for(const[a,i]of Object.entries(this.timeoutIds.validations))i&&(clearTimeout(i),this.timeoutIds.validations[a]=null);for(const[a,i]of Object.entries(this.timeoutIds.listeners))i&&(clearTimeout(i),this.timeoutIds.listeners[a]=null);for(const[a,i]of Object.entries(this.timeoutIds.formListeners))i&&(clearTimeout(i),this.timeoutIds.formListeners[a]=null);const n=this.form.fieldInfo[this.name];if(n&&n.instance===this){for(const[a,i]of Object.entries(n.validationMetaMap))i?.lastAbortController.abort(),n.validationMetaMap[a]=void 0;this.form.baseStore.setState(a=>({...a,fieldMetaBase:{...a.fieldMetaBase,[this.name]:{...Rt,isTouched:a.fieldMetaBase[this.name]?.isTouched??Rt.isTouched,isBlurred:a.fieldMetaBase[this.name]?.isBlurred??Rt.isBlurred,isDirty:a.fieldMetaBase[this.name]?.isDirty??Rt.isDirty}}})),n.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,fieldApi:this}),this.form.options.listeners?.onFieldUnmount?.({formApi:this.form,fieldApi:this})}}},this.update=r=>{if(this.options=r,this.name=r.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const s=this.form.getFieldValue(this.name);cr(s,r.defaultValue)||this.form.setFieldValue(this.name,r.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(r,s)=>{this.form.setFieldValue(this.name,r,St(s,{dontRunListeners:!0,dontValidate:!0})),s?.dontRunListeners||this.triggerOnChangeListener(),s?.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=r=>this.form.setFieldMeta(this.name,r),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(r,s)=>{this.form.pushFieldValue(this.name,r,St(s,{dontRunListeners:!0})),s?.dontRunListeners||this.triggerOnChangeListener()},this.insertValue=(r,s,n)=>{this.form.insertFieldValue(this.name,r,s,St(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.replaceValue=(r,s,n)=>{this.form.replaceFieldValue(this.name,r,s,St(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.removeValue=(r,s)=>{this.form.removeFieldValue(this.name,r,St(s,{dontRunListeners:!0})),s?.dontRunListeners||this.triggerOnChangeListener()},this.swapValues=(r,s,n)=>{this.form.swapFieldValues(this.name,r,s,St(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.moveValue=(r,s,n)=>{this.form.moveFieldValues(this.name,r,s,St(n,{dontRunListeners:!0})),n?.dontRunListeners||this.triggerOnChangeListener()},this.clearValues=r=>{this.form.clearFieldValues(this.name,St(r,{dontRunListeners:!0}
26)),r?.dontRunListeners||this.triggerOnChangeListener()},this.getLinkedFields=r=>{const s=Object.values(this.form.fieldInfo),n=[];for(const a of s){if(!a.instance||!(a.instance instanceof Nl))continue;const{onChangeListenTo:i,onBlurListenTo:o}=a.instance.options.validators||{};r==="change"&&i?.includes(this.name)&&n.push(a.instance),r==="blur"&&o?.includes(this.name)&&n.push(a.instance)}return n},this.validateSync=(r,s)=>{const n=gs(r,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||tr}),a=this.getLinkedFields(r).reduce((l,c)=>{const u=gs(r,{...c.options,form:c.form,fieldName:c.name,validationLogic:c.form.options.validationLogic||tr});return u.forEach(d=>{d.field=c}),l.concat(u)},[]);let i=!1;pt(()=>{const l=(c,u)=>{const d=ls(u.cause),h=u.validate?no(c.runValidator({validate:u.validate,value:{value:c.store.state.value,validationSource:"field",fieldApi:c},type:"validate"})):void 0,p=s[d],{newErrorValue:m,newSource:g}=cn({formLevelError:p,fieldLevelError:h});c.state.meta.errorMap?.[d]!==m&&c.setMeta(v=>({...v,errorMap:{...v.errorMap,[d]:m},errorSourceMap:{...v.errorSourceMap,[d]:g}})),m&&(i=!0)};for(const c of n)l(this,c);for(const c of a)c.validate&&l(c.field,c)});const o=ls("submit");return this.state.meta.errorMap?.[o]&&r!=="submit"&&!i&&this.setMeta(l=>({...l,errorMap:{...l.errorMap,[o]:void 0},errorSourceMap:{...l.errorSourceMap,[o]:void 0}})),{hasErrored:i}},this.validateAsync=async(r,s)=>{const n=vs(r,{...this.options,form:this.form,fieldName:this.name,validationLogic:this.form.options.validationLogic||tr}),a=await s,i=this.getLinkedFields(r),o=i.reduce((p,m)=>{const g=vs(r,{...m.options,form:m.form,fieldName:m.name,validationLogic:m.form.options.validationLogic||tr});return g.forEach(v=>{v.field=m}),p.concat(g)},[]),l=[],c=[],u=n.some(p=>p.validate)||o.some(p=>p.validate);if(u){this.state.meta.isValidating||this.setMeta(p=>({...p,isValidating:!0}));for(const p of i)p.setMeta(m=>({...m,isValidating:!0}))}const d=(p,m,g)=>{const v=ls(m.cause),_=p.getInfo();_.validationMetaMap[v]?.lastAbortController.abort();const S=new AbortController;_.validationMetaMap[v]={lastAbortController:S},g.push(new Promise(async y=>{let w;try{w=await new Promise((P,T)=>{p.timeoutIds.validations[m.cause]&&clearTimeout(p.timeoutIds.validations[m.cause]),p.timeoutIds.validations[m.cause]=setTimeout(async()=>{if(S.signal.aborted)return P(void 0);try{P(await this.runValidator({validate:m.validate,value:{value:p.store.state.value,fieldApi:p,signal:S.signal,validationSource:"field"},type:"validateAsync"}))}catch(R){T(R)}},m.debounceMs)})}catch(P){w=P}if(S.signal.aborted)return y(void 0);const C=no(w),x=a[p.name]?.[v],{newErrorValue:k,newSource:A}=cn({formLevelError:x,fieldLevelError:C});if(p.getInfo().instance!==p)return y(void 0);p.setMeta(P=>({...P,errorMap:{...P?.errorMap,[v]:k},errorSourceMap:{...P.errorSourceMap,[v]:A}})),y(k)}))};for(const p of n)p.validate&&d(this,p,l);for(const p of o)p.validate&&d(p.field,p,c);let h=[];if((l.length||c.length)&&(h=await Promise.all(l),await Promise.all(c)),u){this.setMeta(p=>({...p,isValidating:!1}));for(const p of i)p.setMeta(m=>({...m,isValidating:!1}))}return h.filter(Boolean)},this.validate=(r,s)=>{if(!this.state.meta.isTouched)return[];const n=s?.skipGroupValidation?[]:Array.from(this.form.formGroupApis).filter(d=>this.name.startsWith(d.name));let a=(s?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(r)).fieldsErrorMap[this.name]??{};if(!s?.skipFormValidation)for(const d of n){if(d.state.meta.submissionAttempts===0)continue;const{fieldsErrorMap:h}=this.form.validateSync(r,{group:d,dontUpdateFormErrorMap:!0,filterFieldNames:p=>Mr(d.name,p)});a={...a,...h[this.name]??{}}}const{hasErrored:i}=this.validateSync(r,a),o=new WeakMap;for(const d of n){const{hasErrored:h}=d.validateSync(r,{},{skipRelatedFieldValidation:!0});o.set(d,h)}if(i&&!this.options.asyncAlways){this.getInfo().validationMetaMap[ls(r)]?.lastAbortController.abort();const d=[];for(const h of n)h.getInfo().validationMetaMap[ls(r)]?.lastAbortController.abort(),d.push(h.state.meta.errors);return[...this.state.meta.errors,...d.flat()]}const l=s?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(r),c=this.validateAsync(r,l),u=[];
26for(const d of n)o.get(d)&&!d.options.asyncAlways||u.push(d.validateAsync(r,l,{skipRelatedFieldValidation:!0}));return u.length===0?c:Promise.all([c,...u]).then(d=>d.flat())},this.handleChange=r=>{this.setValue(r)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(r=>({...r,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(r=>({...r,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.setErrorMap=r=>{this.setMeta(s=>({...s,errorMap:{...s.errorMap,...r}}))},this.parseValueWithSchema=r=>Or.validate({value:this.state.value,validationSource:"field"},r),this.parseValueWithSchemaAsync=r=>Or.validateAsync({value:this.state.value,validationSource:"field"},r),this.triggerOnBlurListener=()=>{const r=this.form.options.listeners?.onBlurDebounceMs;r&&r>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},r)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});const s=this.options.listeners?.onBlurDebounceMs;s&&s>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},s)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},this.triggerOnChangeListener=()=>{const r=this.form.options.listeners?.onChangeDebounceMs;r&&r>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},r)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});const s=this.options.listeners?.onChangeDebounceMs;s&&s>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},s)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this});for(const n of this.form.formGroupApis)Mr(n.name,this.name)&&n.triggerOnChangeListener()},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,fieldApi:this})},this.form=e.form,this.name=e.name,this.options=e,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=Er(r=>{this.form.store.get();const s=this.form.getFieldMeta(this.name)??{...Rt,...e.defaultMeta};let n=this.form.getFieldValue(this.name);return!s.isTouched&&n===void 0&&this.options.defaultValue!==void 0&&!cr(n,this.options.defaultValue)&&(n=this.options.defaultValue),r&&r.value===n&&r.meta===s?r:{value:n,meta:s}})}get state(){return this.store.state}runValidator(e){return pi(e.validate)?Or[e.type](e.value,e.validate):e.validate(e.value)}};function no(t){if(t)return t}function ls(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}function ca(t){return{isSubmitted:t.isSubmitted??!1,isSubmitting:t.isSubmitting??!1,isValidating:t.isValidating??!1,submissionAttempts:t.submissionAttempts??0,isSubmitSuccessful:t.isSubmitSuccessful??!1}}function Sy(t){return{...Rt,...t,errors:[],isPristine:!0,isValid:!0,isDefaultValue:!0,isFieldsValidating:!1,isFieldsValid:!0,isGroupValid:!0,canSubmit:!0,isSubmitting:!1,isSubmitted:!1,isValidating:!1,submissionAttempts:0,isSubmitSuccessful:!1}}var ao=class Fa{constructor(e){this.options={},this.setFormGroupState=r=>{this.form.baseStore.setState(s=>{const n=s.formGroupStateBase[this.name]??ca({});return{...s,formGroupStateBase:{...s.formGroupStateBase,[this.name]:r(n)}}})},this._lastDistributedFieldNames={},this.update=r=>{if(this.options=r,this.name=r.name,!this.state.meta.isTouched&&this.options.defaultValue!==void 0){const s=this.form.getFieldValue(this.name);cr(s,r.defaultValue)||this.form.setFieldValue(this.name,r.defaultValue,{dontUpdateMeta:!0,dontValidate:!0,dontRunListeners:!0})}this.form.getFieldMeta(this.name)||this.form.setFieldMeta(this.name,{...Rt,...this.options.defaultMeta})},this.mount=()=>{this.update(this.options),this.form.formGroupApis.add(this),this.fieldInfo.instance=this,this.form.baseStore.setState(s=>({...s,formGroupStateBase:{...s.formGroupStateBase,[this.name]:s.formGroupStateBase[this.name]??ca({...this.options.defaultState})}}));const{onMount:r}=this.options.validators||{};if(r){const s=this.runValidator({validate:r,value:{value:this.state.value,groupApi:this,validationSource:"form"},type:"validate"});let n=s,a;da(s)&&(n=s.group,a=s.fields);const i=ua(n);i&&this.setMeta(o=>({...o,errorMap:{...o.errorMap,onMount:i},errorSourceMap:{...o.errorSourceMap,onMount:"field"}})),this.distributeFieldErrors("onMount",a)}return this.options.listeners?.onMount?.({value:this.state.value,groupApi:this}),()=>{for(const[s,n]of Object.entries(this.timeoutIds.validations))n&&(clearTimeout(n),this.timeoutIds.validations[s]=null);for(const[s,n]of Object.entries(this.timeoutIds.listeners))n&&(clearTimeout(n),this.timeoutIds.listeners[s]=null);for(const[s,n]of Object.entries(this.timeoutIds.formListeners))n&&(clearTimeout(n),this.timeoutIds.formListeners[s]=null);if(this.fieldInfo.instance===this){for(const[s,n]of Object.entries(this.fieldInfo.validationMetaMap))n?.lastAbortController.abort(),this.fieldInfo.validationMetaMap[s]=void 0;this.form.formGroupApis.delete(this),this.form.baseStore.setState(s=>({...s,formGroupStateBase:{...s.formGroupStateBase,[this.name]:ca({})}})),this.fieldInfo.instance=null,this.options.listeners?.onUnmount?.({value:this.state.value,groupApi:this})}}},this.setValue=(r,s)=>{this.form.setFieldValue(this.name,r,St(s,{dontRunListeners:!0,dontValidate:!0})),s?.dontRunListeners||this.triggerOnChangeListener(),s?.dontValidate||this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=r=>this.form.setFieldMeta(this.name,r),this.getInfo=()=>this.fieldInfo,this.getRelatedFields=()=>{const r=Object.values(this.form.fieldInfo),s=[];for(const n of r)n.instance&&n.instance instanceof Oa&&n.instance.name.startsWith(this.name)&&s.push(n.instance);return s},this.getRelatedFieldMetasDerived=()=>{const r=Object.entries(this.form.fieldMetaDerived.state),s=[];for(const[n,a]of r)n!==this.name&&Mr(this.name,n)&&s.push({...a,name:n});return s},this.buildChildFieldName=r=>r===""?this.name:r.startsWith("[")?`${this.name}${r}`:`${this.name}.${r}`,this.distributeFieldErrors=(r,s)=>{const n=this._lastDistributedFieldNames[r]??new Set,a=new Set;if(s)for(const[l,c]of Object.entries(s))c==null||c===!1||a.add(this.buildChildFieldName(l));const i=new Set([...n,...a]);let o=!1;for(const l of i){const c=l.startsWith(this.name+"[")?l.slice(this.name.length):l.slice(this.name.length+1),u=s?.[c],d=this.form.getFieldMeta(l);if(!d&&!u)continue;const h=d?.errorMap[r],p=d?.errorSourceMap[r]==="form",{newErrorValue:m,newSource:g}=Ma({newFormValidatorError:u,isPreviousErrorFromFormValidator:p,previousErrorValue:h});m&&(o=!0),!(h===m&&d?.errorSourceMap[r]===g)&&this.form.setFieldMeta(l,v=>({...v,errorMap:{...v.errorMap,[r]:m},errorSourceMap:{...v.errorSourceMap,[r]:g}}
26))}return this._lastDistributedFieldNames[r]=a,o},this.validateSync=(r,s,n={})=>{const a=gs(r,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||tr}),i=(n.skipRelatedFieldValidation?[]:this.getRelatedFields()).reduce((c,u)=>{const d=gs(r,{...u.options,form:u.form,validationLogic:u.form.options.validationLogic||tr});return d.forEach(h=>{h.field=u}),c.concat(d)},[]);let o=!1;pt(()=>{const c=(u,d)=>{const h=Hs(d.cause),p=u===this;let m;d.validate&&(m=u.runValidator({validate:d.validate,value:{value:u.store.state.value,validationSource:p?"form":"field",...u instanceof Fa?{groupApi:u}:{fieldApi:u}},type:"validate"}));let g=m,v;p&&da(m)&&(g=m.group,v=m.fields);const _=ua(g),S=s[h],{newErrorValue:y,newSource:w}=cn({formLevelError:S,fieldLevelError:_});u.state.meta.errorMap?.[h]!==y&&u.setMeta(C=>({...C,errorMap:{...C.errorMap,[h]:y},errorSourceMap:{...C.errorSourceMap,[h]:w}})),y&&(o=!0),p&&this.distributeFieldErrors(h,v)&&(o=!0)};for(const u of a)c(this,u);for(const u of i)u.validate&&c(u.field,u)});const l=Hs("submit");return this.state.meta.errorMap?.[l]&&r!=="submit"&&!o&&this.setMeta(c=>({...c,errorMap:{...c.errorMap,[l]:void 0},errorSourceMap:{...c.errorSourceMap,[l]:void 0}})),{hasErrored:o}},this.validateAsync=async(r,s,n={})=>{const a=vs(r,{...this.options,form:this.form,group:this,validationLogic:this.options.validationLogic||this.form.options.validationLogic||tr}),i=await s,o=n.skipRelatedFieldValidation?[]:this.getRelatedFields(),l=o.reduce((m,g)=>{const v=vs(r,{...g.options,form:g.form,validationLogic:g.form.options.validationLogic||tr});return v.forEach(_=>{_.field=g}),m.concat(v)},[]),c=[],u=[],d=a.some(m=>m.validate)||l.some(m=>m.validate);if(d){this.state.meta.isValidating||this.setMeta(m=>({...m,isValidating:!0}));for(const m of o)m.setMeta(g=>({...g,isValidating:!0}))}const h=(m,g,v)=>{const _=Hs(g.cause),S=m.getInfo();S.validationMetaMap[_]?.lastAbortController.abort();const y=new AbortController;S.validationMetaMap[_]={lastAbortController:y};const w=m===this;v.push(new Promise(async C=>{let x;try{x=await new Promise((E,M)=>{m.timeoutIds.validations[g.cause]&&clearTimeout(m.timeoutIds.validations[g.cause]),m.timeoutIds.validations[g.cause]=setTimeout(async()=>{if(y.signal.aborted)return E(void 0);try{E(await this.runValidator({validate:g.validate,value:{value:m.store.state.value,signal:y.signal,validationSource:w?"form":"field",...m instanceof Fa?{groupApi:m}:{fieldApi:m}},type:"validateAsync"}))}catch(F){M(F)}},g.debounceMs)})}catch(E){x=E}if(y.signal.aborted)return C(void 0);let k=x,A;w&&da(x)&&(k=x.group,A=x.fields);const P=ua(k),T=i[m.name]?.[_],{newErrorValue:R,newSource:I}=cn({formLevelError:T,fieldLevelError:P});if(m.getInfo().instance!==m)return C(void 0);m.setMeta(E=>({...E,errorMap:{...E?.errorMap,[_]:R},errorSourceMap:{...E.errorSourceMap,[_]:I}})),w&&this.distributeFieldErrors(_,A),C(R)}))};for(const m of a)m.validate&&h(this,m,c);for(const m of l)m.validate&&h(m.field,m,u);let p=[];if((c.length||u.length)&&(p=await Promise.all(c),await Promise.all(u)),d){this.setMeta(m=>({...m,isValidating:!1}));for(const m of o)m.setMeta(g=>({...g,isValidating:!1}))}return p.filter(Boolean)},this.validateAllFields=async r=>{const s=[];return pt(()=>{Object.values(this.getRelatedFields()).forEach(n=>{s.push(Promise.resolve().then(()=>n.validate(r,{skipFormValidation:!0,skipGroupValidation:!0}))),n.store.state.meta.isTouched||n.setMeta(a=>({...a,isTouched:!0}))})}),(await Promise.all(s)).flat()},this.validateArrayFieldsStartingFrom=(r,s,n)=>this.form.validateArrayFieldsStartingFrom(r,s,n),this.validateField=(r,s)=>this.form.validateField(r,s),this.getFieldValue=r=>this.form.getFieldValue(r),this.getFieldMeta=r=>this.form.getFieldMeta(r),this.setFieldMeta=(r,s)=>this.form.setFieldMeta(r,s),this.setFieldValue=(r,s)=>this.form.setFieldValue(r,s),this.deleteField=r=>this.form.deleteField(r),this.pushFieldValue=(r,s)=>this.form.pushFieldValue(r,s),this.insertFieldValue=(r,s,n)=>this.form.insertFieldValue(r,s,n),this.replaceFieldValue=(r,s,n)=>this.form.replaceFieldValue(r,s,n),this.swapFieldValues=(r,s,n)=>this.form.swapFieldValues(r,s,n),this.moveFieldValues=(r,s,n)=>this.form.moveFieldValues(r,s,n),this.clearFieldValues=r=>this.form.clearFieldValues(r),this.resetField=r=>this.form.resetField(r),this.removeFieldValue=(r,s)=>this.form.removeFieldValue(r,s),this.areRelatedFieldsValid=()=>Object.values(this.getRelatedFields()).every(r=>r.state.meta.isValid),this.validate=(r,s)=>{const{fieldsErrorMap:n}=s?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(r,{dontUpdateFormErrorMap:!0,filterFieldNames:o=>Mr(this.name,o)}),{hasErrored:a}=this.validateSync(r,n[this.name]??{},{skipRelatedFieldValidation:s?.skipRelatedFieldValidation});if(a&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[Hs(r)]?.lastAbortController.abort(),this.state.meta.errors;const i=s?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(r,{dontUpdateFormErrorMap:!0,filterFieldNames:o=>Mr(this.name,o)});return this.validateAsync(r,i,{skipRelatedFieldValidation:s?.skipRelatedFieldValidation})},this.triggerOnChangeListener=()=>{const r=this.form.options.listeners?.onChangeGroupDebounceMs;r&&r>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this})},r)):this.form.options.listeners?.onChangeGroup?.({formApi:this.form,groupApi:this});const s=this.options.listeners?.onChangeDebounceMs;s&&s>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})}
26,s)):this.options.listeners?.onChange?.({value:this.state.value,groupApi:this})},this.triggerOnSubmitListener=()=>{this.options.listeners?.onSubmit?.({value:this.state.value,groupApi:this})},this._handleSubmit=async r=>{this.setFormGroupState(a=>({...a,isSubmitted:!1,submissionAttempts:a.submissionAttempts+1,isSubmitSuccessful:!1})),pt(()=>{Object.values(this.getRelatedFields()).forEach(a=>{a.state.meta.isTouched||a.setMeta(i=>({...i,isTouched:!0}))})});const s=r??this.options.onSubmitMeta;this.setFormGroupState(a=>({...a,isSubmitting:!0}));const n=()=>{this.setFormGroupState(a=>({...a,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.areRelatedFieldsValid()){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:s});return}if(await this.validate("submit",{skipRelatedFieldValidation:!0}),!this.areRelatedFieldsValid()||!this.state.meta.isValid){n(),this.options.onGroupSubmitInvalid?.({value:this.state.value,groupApi:this,meta:s});return}pt(()=>{Object.values(this.getRelatedFields()).forEach(a=>{a.options.listeners?.onGroupSubmit?.({value:a.state.value,fieldApi:a})})}),this.options.listeners?.onSubmit?.({groupApi:this,value:this.state.value});try{await this.options.onGroupSubmit?.({value:this.state.value,groupApi:this,meta:s}),pt(()=>{this.setFormGroupState(a=>({...a,isSubmitted:!0,isSubmitSuccessful:!0})),n()})}catch(a){throw this.setFormGroupState(i=>({...i,isSubmitSuccessful:!1})),n(),a}},this.form=e.form,this.name=e.name,this.options=e,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.fieldInfo={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.store=Er(r=>{this.form.formGroupMetaDerived.get(),this.form.baseStore.get();const s=this.form.getFormGroupMeta(this.name)??Sy(e.defaultMeta);let n=this.form.getFieldValue(this.name);return!s.isTouched&&n===void 0&&this.options.defaultValue!==void 0&&!cr(n,this.options.defaultValue)&&(n=this.options.defaultValue),r&&r.value===n&&r.meta===s?r:{value:n,meta:s}}),this.handleSubmit=this.handleSubmit.bind(this)}get state(){return this.store.state}runValidator(e){if(pi(e.validate)){const r=Or[e.type](e.value,e.validate);return e.type==="validate"?io(r):r.then(io)}return e.validate(e.value)}handleSubmit(e){return this._handleSubmit(e)}};function ua(t){if(t)return t}function da(t){return!!t&&typeof t=="object"&&"fields"in t}function io(t){if(!t||typeof t!="object"||!("form"in t)&&!("fields"in t))return t;const{form:e,fields:r,...s}=t;return{...s,group:e,fields:r}}function Hs(t){switch(t){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";default:return"onChange"}}var oo=class jl{constructor(e){if(this.getFormFieldName=r=>{if(typeof this.fieldsMap=="string")return to(this.fieldsMap,r);const s=En(r)[0];if(typeof s!="string")return"";const n=r.slice(s.length),a=this.fieldsMap[s];return to(a,n)},this.getFormFieldOptions=r=>{const s={...r},n=s.validators;if(s.name=this.getFormFieldName(r.name),n&&(n.onChangeListenTo||n.onBlurListenTo)){const a={...n},i=o=>{if(o)return o.map(l=>this.getFormFieldName(l))};a.onChangeListenTo=i(n.onChangeListenTo),a.onBlurListenTo=i(n.onBlurListenTo),s.validators=a}return s},this.mount=()=>()=>{},this.validateArrayFieldsStartingFrom=async(r,s,n)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(r),s,n),this.validateField=(r,s)=>this.form.validateField(this.getFormFieldName(r),s),this.getFieldValue=r=>this.form.getFieldValue(this.getFormFieldName(r)),this.getFieldMeta=r=>this.form.getFieldMeta(this.getFormFieldName(r)),this.setFieldMeta=(r,s)=>this.form.setFieldMeta(this.getFormFieldName(r),s),this.setFieldValue=(r,s,n)=>this.form.setFieldValue(this.getFormFieldName(r),s,n),this.deleteField=r=>this.form.deleteField(this.getFormFieldName(r)),this.pushFieldValue=(r,s,n)=>this.form.pushFieldValue(this.getFormFieldName(r),s,n),this.insertFieldValue=async(r,s,n,a)=>this.form.insertFieldValue(this.getFormFieldName(r),s,n,a),this.replaceFieldValue=async(r,s,n,a)=>this.form.replaceFieldValue(this.getFormFieldName(r),s,n,a),this.removeFieldValue=async(r,s,n)=>this.form.removeFieldValue(this.getFormFieldName(r),s,n),this.swapFieldValues=(r,s,n,a)=>this.form.swapFieldValues(this.getFormFieldName(r),s,n,a),this.moveFieldValues=(r,s,n,a)=>this.form.moveFieldValues(this.getFormFieldName(r),s,n,a),this.clearFieldValues=(r,s)=>this.form.clearFieldValues(this.getFormFieldName(r),s),this.resetField=r=>this.form.resetField(this.getFormFieldName(r)),this.validateAllFields=r=>this.form.validateAllFields(r),e.form instanceof jl){const r=e.form;if(this.form=r.form,typeof e.fields=="string")this.fieldsMap=r.getFormFieldName(e.fields);else{const s={...e.fields};for(const n in s)s[n]=r.getFormFieldName(s[n]);this.fieldsMap=s}}else this.form=e.form,this.fieldsMap=e.fields;this.store=Er(()=>{const r=this.form.store.get();let s;if(typeof this.fieldsMap=="string")s=Hr(r.values,this.fieldsMap);else{s={};const n=this.fieldsMap;for(const a in n)s[a]=Hr(r.values,n[a])}return{values:s}})}get state(){return this.store.state}async handleSubmit(e){return this.form.handleSubmit(e)}};function wy(t,e){if(!e)return;const r=Object.assign({},t,{state:fs(t.state)});e(r),r.fieldInfo!==t.fieldInfo&&(t.fieldInfo=r.fieldInfo),r.options!==t.options&&(t.options=r.options);const s=Object.keys({values:null,validationMetaMap:null,fieldMetaBase:null,formGroupStateBase:null,isSubmitting:null,isSubmitted:null,isValidating:null,submissionAttempts:null,isSubmitSuccessful:null,_force_re_eval:null}).reduce((n,a)=>
26(t.state[a]!==r.state[a]&&(n[a]=r.state[a]),n),{});return pt(()=>{Object.keys(s).length&&t.baseStore.setState(n=>({...n,...s})),r.state.errorMap!==t.state.errorMap&&t.setErrorMap(r.state.errorMap)}),r}var ur=typeof window<"u"?b.useLayoutEffect:b.useEffect;function xy(t){const[e,r]=(0,b.useState)(()=>({form:t.form,name:t.name})),[s,n]=(0,b.useState)(()=>new Oa({...t}));(e.form!==t.form||e.name!==t.name)&&(n(new Oa({...t})),r({form:t.form,name:t.name}));const a=Ge(s.store,t.mode==="array"?p=>p.meta._arrayVersion||0:p=>p.value),i=Ge(s.store,p=>p.meta.isTouched),o=Ge(s.store,p=>p.meta.isBlurred),l=Ge(s.store,p=>p.meta.isDirty),c=Ge(s.store,p=>p.meta.errorMap),u=Ge(s.store,p=>p.meta.errorSourceMap),d=Ge(s.store,p=>p.meta.isValidating),h=(0,b.useMemo)(()=>({...s,get state(){return{value:t.mode==="array"?s.state.value:a,get meta(){return{...s.state.meta,isTouched:i,isBlurred:o,isDirty:l,errorMap:c,errorSourceMap:u,isValidating:d}}}}}),[s,t.mode,a,i,o,l,c,u,d]);return ur(s.mount,[s]),ur(()=>{s.update(t)}),h}var Cy=(({children:t,...e})=>{const r=xy(e),s=(0,b.useMemo)(()=>ts(t,r),[t,r]);return(0,f.jsx)(f.Fragment,{children:s})});function Ay(){return(0,b.useState)(()=>Ll())[0]}var ky=b,Iy="19.2.7".split(".")[0]==="17"?Ay:ky.useId;function Py(t){const[e,r]=(0,b.useState)(()=>({form:t.form,name:t.name})),[s,n]=(0,b.useState)(()=>new ao({...t}));(e.form!==t.form||e.name!==t.name)&&(n(new ao({...t})),r({form:t.form,name:t.name}));const a=Ge(s.store,x=>x.value),i=Ge(s.store,x=>x.meta.isTouched),o=Ge(s.store,x=>x.meta.isBlurred),l=Ge(s.store,x=>x.meta.isDirty),c=Ge(s.store,x=>x.meta.errorMap),u=Ge(s.store,x=>x.meta.errorSourceMap),d=Ge(s.store,x=>x.meta.isValidating),h=Ge(s.store,x=>x.meta.isSubmitting),p=Ge(s.store,x=>x.meta.isSubmitted),m=Ge(s.store,x=>x.meta.submissionAttempts),g=Ge(s.store,x=>x.meta.isSubmitSuccessful),v=Ge(s.store,x=>x.meta.canSubmit),_=Ge(s.store,x=>x.meta.isValid),S=Ge(s.store,x=>x.meta.isFieldsValid),y=Ge(s.store,x=>x.meta.isFieldsValidating),w=Ge(s.store,x=>x.meta.isGroupValid),C=(0,b.useMemo)(()=>({...s,handleSubmit:((...x)=>s._handleSubmit(...x)),get state(){return{...s.state,value:a,get meta(){return{...s.state.meta,isTouched:i,isBlurred:o,isDirty:l,errorMap:c,errorSourceMap:u,isValidating:d,isSubmitting:h,isSubmitted:p,submissionAttempts:m,isSubmitSuccessful:g,canSubmit:v,isValid:_,isFieldsValid:S,isFieldsValidating:y,isGroupValid:w}}}}}),[s,a,i,o,l,c,u,d,h,p,m,g,v,_,S,y,w]);return ur(s.mount,[s]),ur(()=>{s.update(t)}),C}var Ey=(({children:t,...e})=>{const r=Py(e),s=(0,b.useMemo)(()=>ts(t,r),[t,r]);return(0,f.jsx)(f.Fragment,{children:s})});function Ry({form:t,selector:e=s=>s,children:r}){const s=Ge(t.store,e);return(0,f.jsx)(f.Fragment,{children:ts(r,s)})}function Ty(t){const e=Iy(),[r,s]=(0,b.useState)(t?.formId),[n,a]=(0,b.useState)(()=>new so({...t,formId:t?.formId??e}));if(r!==t?.formId){const l=t?.formId??e;a(new so({...t,formId:l})),s(l)}const i=(0,b.useMemo)(()=>{const l={...n,handleSubmit:((...c)=>n._handleSubmit(...c)),get formId(){return n._formId},get state(){return n.store.state}};return l.Field=function(u){return(0,f.jsx)(Cy,{...u,form:n})},l.FormGroup=function(u){return(0,f.jsx)(Ey,{...u,form:n})},l.Subscribe=function(u){return(0,f.jsx)(Ry,{form:n,selector:u.selector,children:u.children})},l},[n]);ur(n.mount,[]),ur(()=>{n.update(t)});const o=(0,b.useRef)(!1);return ur(()=>{o.current&&t?.transform&&wy(n,t.transform)},[n,t?.transform]),ur(()=>{o.current=!0}),i}function My({lens:t,selector:e=s=>s,children:r}){const s=Ge(t.store,e);return(0,f.jsx)(f.Fragment,{children:ts(r,s)})}function Oy(t){const[e]=(0,b.useState)(()=>{const r=new oo(t),s=t.form instanceof oo?t.form.form:t.form,n=r;return n.AppForm=function(i){return(0,f.jsx)(s.AppForm,{...i})},n.AppField=function(i){return(0,f.jsx)(s.AppField,{...e.getFormFieldOptions(i)})},n.Field=function(i){return(0,f.jsx)(s.Field,{...e.getFormFieldOptions(i)})},n.Subscribe=function(i){return(0,f.jsx)(My,{lens:e,selector:i.selector,children:i.children})},Object.assign(n,{...t.formComponents})});return ur(e.mount,[e]),e}var lo=(0,b.createContext)(null),$l=(0,b.createContext)(null);function Vl(){const t=(0,b.useContext)($l);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}function Fy(){function t(){const e=(0,b.useContext)(lo);if(!e)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return e}return{fieldContext:lo,useFieldContext:t,useFormContext:Vl,formContext:$l}}function Bl({fieldComponents:t,fieldContext:e,formContext:r,formComponents:s}){function n(c){const u=Ty(c),d=(0,b.useMemo)(()=>({children:p})=>(0,f.jsx)(r.Provider,{value:u,children:p}),[u]),h=(0,b.useMemo)(()=>(({children:m,...g})=>(0,f.jsx)(u.Field,{...g,children:v=>(0,f.jsx)(e.Provider,{value:v,children:m(Object.assign(v,t))})})),[u]);return(0,b.useMemo)(()=>Object.assign(u,{AppField:h,AppForm:d,...s}),[u,h,d])}function a({render:c,props:u}){return function(h){return c({...u,...h})}}function i({render:c,props:u,defaultValues:d}){return function(p){const m=(0,b.useMemo)(()=>({form:p.form,fields:p.fields,defaultValues:d,formComponents:s}),[p.form,p.fields]),g=Oy(m);return c({...u,...p,group:g})}}function o(c){return Vl()}function l(c){return Bl({fieldContext:e,formContext:r,fieldComponents:{...t,...c.fieldComponents},formComponents:{...s,...c.formComponents}})}return{useAppForm:n,withForm:a,withFieldGroup:i,useTypedAppFormContext:o,extendForm:l}}function mi(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)(Hu,{"data-slot":"label",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function qC(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("flex flex-col gap-6","has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("fieldset",{"data-slot":"field-set",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function WC(t){const e=(0,V.c)(10);let r,s,n;e[0]!==t?({className:r,variant:n,...s}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n):(r=e[1],s=e[2],n=e[3]);const a=n===void 0?"legend":n;let i;e[4]!==r?(i=Z("mb-3 font-medium","data-[variant=legend]:text-base","data-[variant=label]:text-sm",r),e[4]=r,e[5]=i):i=e[5];let o;return e[6]!==s||e[7]!==i||e[8]!==a?(o=(0,f.jsx)("legend",{"data-slot":"field-legend","data-variant":a,className:i,...s}),e[6]=s,e[7]=i,e[8]=a,e[9]=o):o=e[9],o}function HC(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("div",{"data-slot":"field-group",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}var Dy=Qr("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["flex-row items-center","[&>[data-slot=field-label]]:flex-auto","[&>[data-slot=input-control]]:flex-[1_1_20rem] [&>[data-slot=select-trigger]]:flex-[1_1_20rem] [&>[data-slot=textarea]]:flex-[1_1_20rem]","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto","@md/field-group:[&>[data-slot=field-label]]:flex-auto","@md/field-group:[&>[data-slot=input-control]]:flex-[1_1_20rem] @md/field-group:[&>[data-slot=select-trigger]]:flex-[1_1_20rem] @md/field-group:[&>[data-slot=textarea]]:flex-[1_1_20rem]","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function Ss(t){const e=(0,V.c)(11);let r,s,n;e[0]!==t?({className:r,orientation:n,...s}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n):(r=e[1],s=e[2],n=e[3]);const a=n===void 0?"vertical":n;let i;e[4]!==r||e[5]!==a?(i=Z(Dy({orientation:a}),r),e[4]=r,e[5]=a,e[6]=i):i=e[6];let o;return e[7]!==a||e[8]!==s||e[9]!==i?(o=(0,f.jsx)("div",{role:"group","data-slot":"field","data-orientation":a,className:i,...s}),e[7]=a,e[8]=s,e[9]=i,e[10]=o):o=e[10],o}function ws(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4","has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",r),e[3]=r,e[4]=n):n=e[4];let a;
26return e[5]!==s||e[6]!==n?(a=(0,f.jsx)(mi,{"data-slot":"field-label",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function xs(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("p",{"data-slot":"field-description",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function rs(t){const e=(0,V.c)(15);let r,s,n,a;e[0]!==t?({className:s,children:r,errors:n,...a}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a):(r=e[1],s=e[2],n=e[3],a=e[4]);let i;e:{if(r){i=r;break e}if(!n){i=null;break e}if(n?.length===1&&n[0]?.message){i=n[0].message;break e}let u;e[5]!==n?(u=n.map(Ly),e[5]=n,e[6]=u):u=e[6];let d;e[7]!==u?(d=(0,f.jsx)("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:u}),e[7]=u,e[8]=d):d=e[8],i=d}const o=i;if(!o)return null;let l;e[9]!==s?(l=Z("text-destructive text-sm font-normal",s),e[9]=s,e[10]=l):l=e[10];let c;return e[11]!==o||e[12]!==a||e[13]!==l?(c=(0,f.jsx)("div",{role:"alert","data-slot":"field-error",className:l,...a,children:o}),e[11]=o,e[12]=a,e[13]=l,e[14]=c):c=e[14],c}function Ly(t,e){return t?.message&&(0,f.jsx)("li",{children:t.message},e)}var{fieldContext:Ny,formContext:jy,useFieldContext:Cs,useFormContext:Ul}=Fy();function $y(t){const e=(0,V.c)(5),{className:r}=t,s=Ul();let n;e[0]!==r?(n=i=>{if(!i||i.length===0)return null;const o=i.map(Vy).filter(Boolean);return o.length===0?null:(0,f.jsx)(rs,{className:r,children:o.join(". ")})},e[0]=r,e[1]=n):n=e[1];let a;return e[2]!==s.Subscribe||e[3]!==n?(a=(0,f.jsx)(s.Subscribe,{selector:By,children:n}),e[2]=s.Subscribe,e[3]=n,e[4]=a):a=e[4],a}function Vy(t){return typeof t=="string"?t:""}function By(t){return t.errors}function Uy(t){const e=(0,V.c)(13);let r,s,n,a;e[0]!==t?({label:a,children:r,disabled:s,...n}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a):(r=e[1],s=e[2],n=e[3],a=e[4]);const i=a===void 0?"Submit":a,o=Ul();let l;e[5]!==r||e[6]!==s||e[7]!==i||e[8]!==n?(l=u=>(0,f.jsxs)(dt,{type:"submit",disabled:u||s,...n,children:[u&&(0,f.jsx)(on,{className:"mr-2"}),r??i]}),e[5]=r,e[6]=s,e[7]=i,e[8]=n,e[9]=l):l=e[9];let c;return e[10]!==o.Subscribe||e[11]!==l?(c=(0,f.jsx)(o.Subscribe,{selector:zy,children:l}),e[10]=o.Subscribe,e[11]=l,e[12]=c):c=e[12],c}function zy(t){return t.isSubmitting}function As(t){return t?typeof t=="string"?t:typeof t=="object"&&"message"in t&&typeof t.message=="string"?t.message:"":""}function qy(t){const e=(0,V.c)(33),{label:r,description:s,disabled:n,className:a}=t,i=Cs(),o=(0,b.useId)(),l=`${o}-error`,c=`${o}-desc`,u=i.state.meta.errors,d=u.length>0,h=i.state.meta.isTouched,p=s?c:null,m=d&&h?l:null;let g;e[0]!==p||e[1]!==m?(g=[p,m].filter(Boolean),e[0]=p,e[1]=m,e[2]=g):g=e[2];const v=g.join(" "),_=d&&h?!0:void 0;let S;e[3]!==i?(S=R=>i.handleChange(R===!0),e[3]=i,e[4]=S):S=e[4];const y=d&&h?!0:void 0,w=v||void 0;let C;e[5]!==n||e[6]!==i.handleBlur||e[7]!==i.state.value||e[8]!==o||e[9]!==S||e[10]!==y||e[11]!==w?(C=(0,f.jsx)(Co,{id:o,checked:i.state.value,onCheckedChange:S,onBlur:i.handleBlur,disabled:n,"aria-invalid":y,"aria-describedby":w}),e[5]=n,e[6]=i.handleBlur,e[7]=i.state.value,e[8]=o,e[9]=S,e[10]=y,e[11]=w,e[12]=C):C=e[12];let x;e[13]!==o||e[14]!==r?(x=(0,f.jsx)(ws,{htmlFor:o,children:r}),e[13]=o,e[14]=r,e[15]=x):x=e[15];let k;e[16]!==c||e[17]!==s?(k=s&&(0,f.jsx)(xs,{id:c,children:s}),e[16]=c,e[17]=s,e[18]=k):k=e[18];let A;e[19]!==l||e[20]!==u||e[21]!==d||e[22]!==h?(A=d&&h&&(0,f.jsx)(rs,{id:l,children:u.map(As).join(", ")}),e[19]=l,e[20]=u,e[21]=d,e[22]=h,e[23]=A):A=e[23];let P;e[24]!==k||e[25]!==A||e[26]!==x?(P=(0,f.jsxs)("div",{className:"flex flex-col gap-1",children:[x,k,A]}),e[24]=k,e[25]=A,e[26]=x,e[27]=P):P=e[27];let T;return e[28]!==a||e[29]!==P||e[30]!==_||e[31]!==C?(T=(0,f.jsxs)(Ss,{orientation:"horizontal",className:a,"data-invalid":_,children:[C,P]}),e[28]=a,e[29]=P,e[30]=_,e[31]=C,e[32]=T):T=e[32],T}function Wy(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("grid gap-3",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)(Yu,{"data-slot":"radio-group",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function Hy(t){const e=(0,V.c)(9);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),e[3]=r,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,f.jsx)(rd,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:(0,f.jsx)(gu,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})}),e[5]=a):a=e[5];let i;return e[6]!==s||e[7]!==n?(i=(0,f.jsx)(td,{"data-slot":"radio-group-item",className:n,...s,children:a}),e[6]=s,e[7]=n,e[8]=i):i=e[8],i}
26function Ky(t){const e=(0,V.c)(38),{label:r,description:s,options:n,disabled:a,required:i,className:o}=t,l=Cs(),c=(0,b.useId)(),u=`${c}-error`,d=`${c}-desc`,h=l.state.meta.errors,p=h.length>0,m=l.state.meta.isTouched,g=s?d:null,v=p&&m?u:null;let _;e[0]!==g||e[1]!==v?(_=[g,v].filter(Boolean),e[0]=g,e[1]=v,e[2]=_):_=e[2];const S=_.join(" "),y=p&&m?!0:void 0;let w;e[3]!==i?(w=i&&(0,f.jsx)("span",{className:"text-destructive",children:"*"}),e[3]=i,e[4]=w):w=e[4];let C;e[5]!==r||e[6]!==w?(C=(0,f.jsxs)(ws,{children:[r,w]}),e[5]=r,e[6]=w,e[7]=C):C=e[7];const x=l.state.value;let k;e[8]!==l?(k=$=>l.handleChange($),e[8]=l,e[9]=k):k=e[9];const A=S||void 0,P=p&&m?!0:void 0,T=l.handleBlur;let R;if(e[10]!==c||e[11]!==n){let $;e[13]!==c?($=O=>{const D=`${c}-${O.value}`;return(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[(0,f.jsx)(Hy,{value:O.value,id:D}),(0,f.jsx)(mi,{htmlFor:D,className:"font-normal",children:O.label})]},O.value)},e[13]=c,e[14]=$):$=e[14],R=n.map($),e[10]=c,e[11]=n,e[12]=R}else R=e[12];let I;e[15]!==a||e[16]!==l.handleBlur||e[17]!==l.state.value||e[18]!==P||e[19]!==R||e[20]!==k||e[21]!==A?(I=(0,f.jsx)(Wy,{value:x,onValueChange:k,disabled:a,"aria-describedby":A,"aria-invalid":P,onBlur:T,children:R}),e[15]=a,e[16]=l.handleBlur,e[17]=l.state.value,e[18]=P,e[19]=R,e[20]=k,e[21]=A,e[22]=I):I=e[22];let E;e[23]!==d||e[24]!==s?(E=s&&(0,f.jsx)(xs,{id:d,children:s}),e[23]=d,e[24]=s,e[25]=E):E=e[25];let M;e[26]!==u||e[27]!==h||e[28]!==p||e[29]!==m?(M=p&&m&&(0,f.jsx)(rs,{id:u,children:h.map(As).join(", ")}),e[26]=u,e[27]=h,e[28]=p,e[29]=m,e[30]=M):M=e[30];let F;return e[31]!==o||e[32]!==I||e[33]!==E||e[34]!==M||e[35]!==y||e[36]!==C?(F=(0,f.jsxs)(Ss,{className:o,"data-invalid":y,children:[C,I,E,M]}),e[31]=o,e[32]=I,e[33]=E,e[34]=M,e[35]=y,e[36]=C,e[37]=F):F=e[37],F}var Gy="focus:bg-primary/10 focus:text-primary data-[highlighted]:bg-primary/10 data-[highlighted]:text-primary [&_svg:not([class*='text-'])]:text-muted-foreground/70 focus:[&_svg:not([class*='text-'])]:text-primary data-[highlighted]:[&_svg:not([class*='text-'])]:text-primary",Yy="rounded-[calc(var(--radius-md)-4px)]",Xy="border-muted-foreground/20";function Qy(t){const e=(0,V.c)(4);let r;e[0]!==t?({...r}=t,e[0]=t,e[1]=r):r=e[1];let s;return e[2]!==r?(s=(0,f.jsx)(Qu,{"data-slot":"select",...r}),e[2]=r,e[3]=s):s=e[3],s}function Jy(t){const e=(0,V.c)(4);let r;e[0]!==t?({...r}=t,e[0]=t,e[1]=r):r=e[1];let s;return e[2]!==r?(s=(0,f.jsx)(Bu,{"data-slot":"select-value",...r}),e[2]=r,e[3]=s):s=e[3],s}function Zy(t){const e=(0,V.c)(13);let r,s,n,a;e[0]!==t?({className:s,size:a,children:r,...n}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a):(r=e[1],s=e[2],n=e[3],a=e[4]);const i=a===void 0?"default":a;let o;e[5]!==s?(o=Z("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground hover:bg-primary/10 hover:text-primary hover:[&_svg:not([class*='text-'])]:text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-primary/20 flex min-w-0 w-full items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:truncate [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",s),e[5]=s,e[6]=o):o=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=(0,f.jsx)(Wu,{asChild:!0,children:(0,f.jsx)(xo,{className:"size-4 opacity-50"})}),e[7]=l):l=e[7];let c;return e[8]!==r||e[9]!==n||e[10]!==i||e[11]!==o?(c=(0,f.jsxs)(nd,{"data-slot":"select-trigger","data-size":i,className:o,...n,children:[r,l]}),e[8]=r,e[9]=n,e[10]=i,e[11]=o,e[12]=c):c=e[12],c}function eb(t){const e=(0,V.c)(22);let r,s,n,a,i;e[0]!==t?({className:s,children:r,position:a,align:i,...n}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=i):(r=e[1],s=e[2],n=e[3],a=e[4],i=e[5]);const o=a===void 0?"popper":a,l=i===void 0?"center":i,c=o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1";let u;e[6]!==s||e[7]!==c?(u=Z(Xy,"bg-popover text-popover-foreground 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]:sli
26de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",c,s),e[6]=s,e[7]=c,e[8]=u):u=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=(0,f.jsx)(rb,{}),e[9]=d):d=e[9];const h=o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1";let p;e[10]!==h?(p=Z("p-1",h),e[10]=h,e[11]=p):p=e[11];let m;e[12]!==r||e[13]!==p?(m=(0,f.jsx)(Fu,{className:p,children:r}),e[12]=r,e[13]=p,e[14]=m):m=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=(0,f.jsx)(sb,{}),e[15]=g):g=e[15];let v;return e[16]!==l||e[17]!==o||e[18]!==n||e[19]!==u||e[20]!==m?(v=(0,f.jsx)(ad,{children:(0,f.jsxs)(Xu,{"data-slot":"select-content",className:u,position:o,align:l,...n,children:[d,m,g]})}),e[16]=l,e[17]=o,e[18]=n,e[19]=u,e[20]=m,e[21]=v):v=e[21],v}function tb(t){const e=(0,V.c)(13);let r,s,n;e[0]!==t?({className:s,children:r,...n}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n):(r=e[1],s=e[2],n=e[3]);let a;e[4]!==s?(a=Z(Gy,Yy,"relative flex w-full cursor-default items-center gap-2 py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",s),e[4]=s,e[5]=a):a=e[5];let i;e[6]===Symbol.for("react.memo_cache_sentinel")?(i=(0,f.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,f.jsx)(id,{children:(0,f.jsx)(pu,{className:"size-4"})})}),e[6]=i):i=e[6];let o;e[7]!==r?(o=(0,f.jsx)(Ku,{children:r}),e[7]=r,e[8]=o):o=e[8];let l;return e[9]!==n||e[10]!==a||e[11]!==o?(l=(0,f.jsxs)(sd,{"data-slot":"select-item",className:a,...n,children:[i,o]}),e[9]=n,e[10]=a,e[11]=o,e[12]=l):l=e[12],l}function rb(t){const e=(0,V.c)(9);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("flex cursor-default items-center justify-center py-1",r),e[3]=r,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,f.jsx)(mu,{className:"size-4"}),e[5]=a):a=e[5];let i;return e[6]!==s||e[7]!==n?(i=(0,f.jsx)(Mu,{"data-slot":"select-scroll-up-button",className:n,...s,children:a}),e[6]=s,e[7]=n,e[8]=i):i=e[8],i}function sb(t){const e=(0,V.c)(9);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("flex cursor-default items-center justify-center py-1",r),e[3]=r,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,f.jsx)(xo,{className:"size-4"}),e[5]=a):a=e[5];let i;return e[6]!==s||e[7]!==n?(i=(0,f.jsx)(Vu,{"data-slot":"select-scroll-down-button",className:n,...s,children:a}),e[6]=s,e[7]=n,e[8]=i):i=e[8],i}function nb(t){const e=(0,V.c)(44),{label:r,description:s,placeholder:n,options:a,disabled:i,required:o,className:l}=t,c=Cs(),u=(0,b.useId)(),d=`${u}-error`,h=`${u}-desc`,p=c.state.meta.errors,m=p.length>0,g=c.state.meta.isTouched,v=s?h:null,_=m&&g?d:null;let S;
26e[0]!==v||e[1]!==_?(S=[v,_].filter(Boolean),e[0]=v,e[1]=_,e[2]=S):S=e[2];const y=S.join(" "),w=m&&g?!0:void 0;let C;e[3]!==o?(C=o&&(0,f.jsx)("span",{className:"text-destructive",children:"*"}),e[3]=o,e[4]=C):C=e[4];let x;e[5]!==u||e[6]!==r||e[7]!==C?(x=(0,f.jsxs)(ws,{htmlFor:u,children:[r,C]}),e[5]=u,e[6]=r,e[7]=C,e[8]=x):x=e[8];const k=c.state.value;let A;e[9]!==c?(A=j=>c.handleChange(j),e[9]=c,e[10]=A):A=e[10];const P=m&&g?!0:void 0,T=y||void 0;let R;e[11]!==n?(R=(0,f.jsx)(Jy,{placeholder:n}),e[11]=n,e[12]=R):R=e[12];let I;e[13]!==c.handleBlur||e[14]!==u||e[15]!==T||e[16]!==R||e[17]!==P?(I=(0,f.jsx)(Zy,{id:u,"aria-invalid":P,"aria-describedby":T,onBlur:c.handleBlur,children:R}),e[13]=c.handleBlur,e[14]=u,e[15]=T,e[16]=R,e[17]=P,e[18]=I):I=e[18];let E;e[19]!==a?(E=a.map(ab),e[19]=a,e[20]=E):E=e[20];let M;e[21]!==E?(M=(0,f.jsx)(eb,{children:E}),e[21]=E,e[22]=M):M=e[22];let F;e[23]!==i||e[24]!==c.state.value||e[25]!==I||e[26]!==M||e[27]!==A?(F=(0,f.jsxs)(Qy,{value:k,onValueChange:A,disabled:i,children:[I,M]}),e[23]=i,e[24]=c.state.value,e[25]=I,e[26]=M,e[27]=A,e[28]=F):F=e[28];let $;e[29]!==h||e[30]!==s?($=s&&(0,f.jsx)(xs,{id:h,children:s}),e[29]=h,e[30]=s,e[31]=$):$=e[31];let O;e[32]!==d||e[33]!==p||e[34]!==m||e[35]!==g?(O=m&&g&&(0,f.jsx)(rs,{id:d,children:p.map(As).join(", ")}),e[32]=d,e[33]=p,e[34]=m,e[35]=g,e[36]=O):O=e[36];let D;return e[37]!==l||e[38]!==F||e[39]!==$||e[40]!==O||e[41]!==w||e[42]!==x?(D=(0,f.jsxs)(Ss,{className:l,"data-invalid":w,children:[x,F,$,O]}),e[37]=l,e[38]=F,e[39]=$,e[40]=O,e[41]=w,e[42]=x,e[43]=D):D=e[43],D}function ab(t){return(0,f.jsx)(tb,{value:t.value,children:t.label},t.value)}function ib(t){const e=(0,V.c)(44),{label:r,description:s,placeholder:n,t
26ype:a,autoComplete:i,disabled:o,required:l,className:c}=t,u=a===void 0?"text":a,d=Cs(),h=(0,b.useId)(),p=`${h}-error`,m=`${h}-desc`,[g,v]=(0,b.useState)(!1),_=d.state.meta.errors,S=_.length>0,y=d.state.meta.isTouched,w=S&&y,C=s?m:null,x=w?p:null;let k;e[0]!==C||e[1]!==x?(k=[C,x].filter(Boolean),e[0]=C,e[1]=x,e[2]=k):k=e[2];const A=k.join(" "),P=u==="password"&&g?"text":u,T=w?!0:void 0;let R;e[3]!==l?(R=l&&(0,f.jsx)("span",{className:"text-destructive","aria-hidden":"true",children:"*"}),e[3]=l,e[4]=R):R=e[4];let I;e[5]!==h||e[6]!==r||e[7]!==R?(I=(0,f.jsxs)(ws,{htmlFor:h,children:[r,R]}),e[5]=h,e[6]=r,e[7]=R,e[8]=I):I=e[8];let E;e[9]!==d?(E=N=>d.handleChange(N.target.value),e[9]=d,e[10]=E):E=e[10];const M=l||void 0,F=w?!0:void 0,$=A||void 0,O=u==="password"?"pr-10":void 0;let D;e[11]!==i||e[12]!==o||e[13]!==d.handleBlur||e[14]!==d.state.value||e[15]!==h||e[16]!==P||e[17]!==n||e[18]!==F||e[19]!==$||e[20]!==O||e[21]!==E||e[22]!==M?(D=(0,f.jsx)(No,{id:h,type:P,value:d.state.value,onChange:E,onBlur:d.handleBlur,placeholder:n,autoComplete:i,disabled:o,"aria-required":M,"aria-invalid":F,"aria-describedby":$,className:O}),e[11]=i,e[12]=o,e[13]=d.handleBlur,e[14]=d.state.value,e[15]=h,e[16]=P,e[17]=n,e[18]=F,e[19]=$,e[20]=O,e[21]=E,e[22]=M,e[23]=D):D=e[23];let j;e[24]!==g||e[25]!==u?(j=u==="password"&&(0,f.jsx)("button",{type:"button",tabIndex:-1,onClick:()=>v(ob),className:"text-muted-foreground hover:text-foreground absolute right-3 top-1/2 -translate-y-1/2","aria-label":g?"Hide password":"Show password",children:g?(0,f.jsx)(Sm,{className:"size-4"}):(0,f.jsx)(xm,{className:"size-4"})}),e[24]=g,e[25]=u,e[26]=j):j=e[26];let U;e[27]!==D||e[28]!==j?(U=(0,f.jsxs)("div",{className:"relative",children:[D,j]}),e[27]=D,e[28]=j,e[29]=U):U=e[29];let q;e[30]!==m||e[31]!==s?(q=s&&(0,f.jsx)(xs,{id:m,children:s}),e[30]=m,e[31]=s,e[32]=q):q=e[32];let z;e[33]!==p||e[34]!==_||e[35]!==w?(z=w&&(0,f.jsx)(rs,{id:p,children:_.map(As).join(", ")}),e[33]=p,e[34]=_,e[35]=w,e[36]=z):z=e[36];let K;return e[37]!==c||e[38]!==U||e[39]!==q||e[40]!==z||e[41]!==T||e[42]!==I?(K=(0,f.jsxs)(Ss,{className:c,"data-invalid":T,children:[I,U,q,z]}),e[37]=c,e[38]=U,e[39]=q,e[40]=z,e[41]=T,e[42]=I,e[43]=K):K=e[43],K}function ob(t){return!t}function lb(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)("textarea",{"data-slot":"textarea",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function cb(t){const e=(0,V.c)(36),{label:r,description:s,placeholder:n,rows:a,disabled:i,required:o,className:l}=t,c=Cs(),u=(0,b.useId)(),d=`${u}-error`,h=`${u}-desc`,p=c.state.meta.errors,m=p.length>0,g=c.state.meta.isTouched,v=s?h:null,_=m&&g?d:null;let S;
26e[0]!==v||e[1]!==_?(S=[v,_].filter(Boolean),e[0]=v,e[1]=_,e[2]=S):S=e[2];const y=S.join(" "),w=m&&g?!0:void 0;let C;e[3]!==o?(C=o&&(0,f.jsx)("span",{className:"text-destructive",children:"*"}),e[3]=o,e[4]=C):C=e[4];let x;e[5]!==u||e[6]!==r||e[7]!==C?(x=(0,f.jsxs)(ws,{htmlFor:u,children:[r,C]}),e[5]=u,e[6]=r,e[7]=C,e[8]=x):x=e[8];let k;e[9]!==c?(k=M=>c.handleChange(M.target.value),e[9]=c,e[10]=k):k=e[10];const A=m&&g?!0:void 0,P=y||void 0;let T;e[11]!==i||e[12]!==c.handleBlur||e[13]!==c.state.value||e[14]!==u||e[15]!==n||e[16]!==a||e[17]!==k||e[18]!==A||e[19]!==P?(T=(0,f.jsx)(lb,{id:u,value:c.state.value,onChange:k,onBlur:c.handleBlur,placeholder:n,rows:a,disabled:i,"aria-invalid":A,"aria-describedby":P}),e[11]=i,e[12]=c.handleBlur,e[13]=c.state.value,e[14]=u,e[15]=n,e[16]=a,e[17]=k,e[18]=A,e[19]=P,e[20]=T):T=e[20];let R;e[21]!==h||e[22]!==s?(R=s&&(0,f.jsx)(xs,{id:h,children:s}),e[21]=h,e[22]=s,e[23]=R):R=e[23];let I;e[24]!==d||e[25]!==p||e[26]!==m||e[27]!==g?(I=m&&g&&(0,f.jsx)(rs,{id:d,children:p.map(As).join(", ")}),e[24]=d,e[25]=p,e[26]=m,e[27]=g,e[28]=I):I=e[28];let E;return e[29]!==l||e[30]!==T||e[31]!==R||e[32]!==I||e[33]!==w||e[34]!==x?(E=(0,f.jsxs)(Ss,{className:l,"data-invalid":w,children:[x,T,R,I]}),e[29]=l,e[30]=T,e[31]=R,e[32]=I,e[33]=w,e[34]=x,e[35]=E):E=e[35],E}var{useAppForm:zl,withForm:KC,withFieldGroup:GC}=Bl({fieldComponents:{TextField:ib,SelectField:nb,CheckboxField:qy,TextareaField:cb,RadioGroupField:Ky},formComponents:{SubmitButton:Uy,FormError:$y},fieldContext:Ny,formContext:jy}),ub=Qr("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-destructive-foreground [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-primary/10 [a&]:hover:text-primary",success:"border-transparent bg-success-100 text-success-700 dark:bg-success-950 dark:text-success-400",warning:"border-transparent bg-warning-100 text-warning-900 dark:bg-warning-950 dark:text-warning-400",info:"border-transparent bg-info-100 text-info-700 dark:bg-info-950 dark:text-info-400","destructive-soft":"border-transparent bg-destructive-100 text-destructive-700 dark:bg-destructive-950 dark:text-destructive-400"}},defaultVariants:{variant:"default"}});function db(t){const e=(0,V.c)(12);let r,s,n,a;e[0]!==t?({className:r,variant:a,asChild:n,...s}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a):(r=e[1],s=e[2],n=e[3],a=e[4]);const i=n!==void 0&&n?ed:"span";let o;e[5]!==r||e[6]!==a?(o=Z(ub({variant:a}),r),e[5]=r,e[6]=a,e[7]=o):o=e[7];let l;return e[8]!==i||e[9]!==s||e[10]!==o?(l=(0,f.jsx)(i,{"data-slot":"badge",className:o,...s}),e[8]=i,e[9]=s,e[10]=o,e[11]=l):l=e[11],l}var fb=Re({name:oe().trim().min(1,{error:"Enter your full name"}).max(200),email:Ao({error:"Enter a valid work email"}).max(320),phone:oe().trim().max(50),consentToContact:hn().refine(Boolean,{error:"Confirm that HoneyGrid may contact you about this request"}),website:oe().max(200)});function fa(t){const e=(0,V.c)(7),{business:r,detectedIndustry:s}=t;let n;e[0]!==r?(n=(0,f.jsx)(Dl,{location:r,spacing:"compact"}),e[0]=r,e[1]=n):n=e[1];let a;e[2]!==s?(a=s&&(0,f.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,f.jsx)("span",{className:"text-muted-foreground",children:"Detected industry"}),(0,f.jsx)(db,{variant:"secondary",children:ny(s)})]}),e[2]=s,e[3]=a):a=e[3];let i;return e[4]!==n||e[5]!==a?(i=(0,f.jsxs)("div",{className:"space-y-3",children:[n,a]}),e[4]=n,e[5]=a,e[6]=i):i=e[6],i}function pb({business:t,detectedIndustry:e,onSubmitInterest:r,onOpenSchedulingLink:s,onBackToConfirmation:n,onPendingChange:a}){const[i,o]=(0,b.useState)(!1),[l,c]=(0,b.useState)(0),u=(0,b.useRef)(0),d=zl({defaultValues:{name:"",email:"",ph
26one:"",consentToContact:!1,website:""},validators:{onSubmit:fb},onSubmit:async({value:p})=>{const m=u.current+1;u.current=m;try{const g=await r({...p,phone:p.phone||void 0,consentToContact:!0,businessName:t.name,placeId:t.placeId,detectedIndustry:e,googlePlaceTypes:t.types});if(m!==u.current)return;o(!0),s(g.schedulingUrl)}catch{if(m!==u.current)return;o(!1),ht.error("Contact details could not be submitted",{description:"Your information remains in the form. Check the connection, then try again."})}}}),h=Ge(d.store,p=>p.isSubmitting)||i;return(0,b.useEffect)(()=>(a?.(h),()=>a?.(!1)),[h,a]),(0,b.useEffect)(()=>()=>{u.current+=1},[]),(0,f.jsxs)("form",{onSubmit:p=>{p.preventDefault(),c(m=>m+1),d.handleSubmit()},className:"space-y-4",noValidate:!0,children:[(0,f.jsxs)("div",{className:"space-y-1",children:[(0,f.jsx)("h3",{className:"text-base font-semibold",children:"Tell us how to reach you"}),(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:"We’ll use these details to contact you about HoneyGrid for your industry."})]}),(0,f.jsx)(d.AppField,{name:"name",children:p=>(0,f.jsx)(p.TextField,{label:"Full name",placeholder:"Jane Smith",autoComplete:"name",disabled:h,required:!0,className:Z("[&_[data-slot=field-error]]:text-xs",p.state.meta.errors.length>0&&p.state.meta.isTouched&&"field-invalid-shake")},l)}),(0,f.jsx)(d.AppField,{name:"email",children:p=>(0,f.jsx)(p.TextField,{label:"Work email",type:"email",placeholder:"[email protected]",autoComplete:"email",disabled:h,required:!0,className:Z("[&_[data-slot=field-error]]:text-xs",p.state.meta.errors.length>0&&p.state.meta.isTouched&&"field-invalid-shake")},l)}),(0,f.jsx)(d.AppField,{name:"phone",children:p=>(0,f.jsx)(p.TextField,{label:"Phone",type:"tel",placeholder:"(555) 123-4567",autoComplete:"tel",disabled:h})}),(0,f.jsx)(d.AppField,{name:"consentToContact",children:p=>(0,f.jsx)(p.CheckboxField,{label:"I agree that HoneyGrid may contact me by email or phone about this request.",disabled:h})}),(0,f.jsx)(d.AppField,{name:"website",children:p=>(0,f.jsx)("input",{type:"text",name:"website",value:p.state.value,onChange:m=>p.handleChange(m.target.value),autoComplete:"off",tabIndex:-1,"aria-hidden":"true",className:"absolute -left-[10000px] h-px w-px overflow-hidden"})}),i?(0,f.jsxs)("div",{className:"flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[(0,f.jsx)(on,{role:"presentation","aria-hidden":"true"}),"Thanks—opening scheduling…"]}):(0,f.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[n&&(0,f.jsx)(dt,{type:"button",variant:"ghost",onClick:n,disabled:h,children:"Back"}),(0,f.jsx)(d.AppForm,{children:(0,f.jsxs)(d.SubmitButton,{className:"min-h-11","aria-label":"Submit and schedule a call",children:[(0,f.jsx)(ym,{}),"Submit and schedule a call"]})})]})]})}function mb(t){const e=(0,V.c)(87),{business:r,eligibility:s,mapPreview:n,isCreating:a,showDentalTitle:i,renderDialogTitle:o,onCreateWorkspace:l,onSubmitInterest:c,onOpenSchedulingLink:u,onPendingChange:d}=t,h=a===void 0?!1:a,p=i===void 0?!0:i,[m,g]=(0,b.useState)("unanswered"),v=(0,b.useRef)(null);let _;e[0]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{const M=window.requestAnimationFrame(()=>v.current?.focus());return()=>window.cancelAnimationFrame(M)},e[0]=_):_=e[0];let S;e[1]!==s.status||e[2]!==m?(S=[s.status,m],e[1]=s.status,e[2]=m,e[3]=S):S=e[3],(0,b.useEffect)(_,S);let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=()=>{g("unanswered")},e[4]=y):y=e[4];let w;if(e[5]!==r.placeId?(w=[r.placeId],e[5]=r.placeId,e[6]=w):w=e[6],(0,b.useEffect)(y,w),s.status==="dental"){let M;e[7]!==o?(M=o?.("Create new workspace"),e[7]=o,e[8]=M):M=e[8];let F;e[9]!==p?(F=p&&(0,f.jsx)("h2",{ref:v,tabIndex:-1,className:"text-xl font-semibold focus:outline-none",children:"Create new workspace"}),e[9]=p,e[10]=F):F=e[10];let $;e[11]===Symbol.for("react.memo_cache_sentinel")?($=(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:"Review your dental practice before continuing to onboarding."}),e[11]=$):$=e[11];let O;e[12]!==F?(O=(0,f.jsxs)("div",{className:"space-y-1",children:[F,$]}),e[12]=F,e[13]=O):O=e[13];let D;e[14]!==r?(D=(0,f.jsx)(fa,{business:r}),e[14]=r,e[15]=D):D=e[15];let j;e[16]!==O||e[17]!==D?(j=(0,f.jsxs)("div",{className:"relative z-10 min-h-0 space-y-4 overflow-y-auto pr-1",children:[O,D]}),e[16]=O,e[17]=D,e[18]=j):j=e[18];let U;e[19]!==n?(U=(0,f.jsx)("div",{className:"order-first min-h-[250px] md:order-none md:h-full md:min-h-0",children:n}),e[19]=n,e[20]=U):U=e[20];let q;e[21]!==j||e[22]!==U?(q=(0,f.jsxs)("div",{className:"relative grid min-h-0 flex-1 grid-cols-1 items-stretch gap-6 overflow-visible px-6 py-4 md:grid-cols-[2fr_3fr] md:gap-8",children:[j,U]}),e[21]=j,e[22]=U,e[23]=q):q=e[23];let z;e[24]!==l?(z=()=>l(),e[24]=l,e[25]=z):z=e[25];let K;
26e[26]!==h?(K=h?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(on,{"aria-hidden":"true"}),"Creating…"]}):(0,f.jsxs)(f.Fragment,{children:["Create workspace",(0,f.jsx)(qi,{})]}),e[26]=h,e[27]=K):K=e[27];let N;e[28]!==h||e[29]!==z||e[30]!==K?(N=(0,f.jsx)("div",{className:"flex shrink-0 justify-end border-t px-6 py-4",children:(0,f.jsx)(dt,{onClick:z,disabled:h,children:K})}),e[28]=h,e[29]=z,e[30]=K,e[31]=N):N=e[31];let B;return e[32]!==q||e[33]!==N||e[34]!==M?(B=(0,f.jsxs)(f.Fragment,{children:[M,q,N]}),e[32]=q,e[33]=N,e[34]=M,e[35]=B):B=e[35],B}if(s.status==="unknown"&&m==="unanswered"){let M;e[36]!==o?(M=o?.("Confirm your business industry"),e[36]=o,e[37]=M):M=e[37];let F;e[38]!==r?(F=(0,f.jsx)(fa,{business:r}),e[38]=r,e[39]=F):F=e[39];let $;e[40]===Symbol.for("react.memo_cache_sentinel")?($=(0,f.jsx)("h2",{ref:v,tabIndex:-1,className:"text-xl font-semibold focus:outline-none",children:"Is this a dental practice?"}),e[40]=$):$=e[40];let O;e[41]!==r.name?(O=(0,f.jsxs)("div",{className:"space-y-2",children:[$,(0,f.jsxs)("p",{className:"text-sm text-muted-foreground",children:["We couldn’t confidently identify the industry for ",r.name,". HoneyGrid onboarding is currently available for dental practices."]})]}),e[41]=r.name,e[42]=O):O=e[42];let D;e[43]!==l?(D=()=>l({dentalSelfAttestation:!0}),e[43]=l,e[44]=D):D=e[44];let j;e[45]!==h?(j=h?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(on,{"aria-hidden":"true"}),"Creating…"]}):(0,f.jsxs)(f.Fragment,{children:["Yes, this is a dental practice",(0,f.jsx)(qi,{})]}),e[45]=h,e[46]=j):j=e[46];let U;e[47]!==h||e[48]!==D||e[49]!==j?(U=(0,f.jsx)(dt,{className:"min-h-11 justify-between",onClick:D,disabled:h,children:j}),e[47]=h,e[48]=D,e[49]=j,e[50]=U):U=e[50];let q;e[51]===Symbol.for("react.memo_cache_sentinel")?(q=()=>g("non_dental"),e[51]=q):q=e[51];let z;e[52]!==h?(z=(0,f.jsx)(dt,{className:"min-h-11 justify-start",variant:"outline",onClick:q,disabled:h,children:"No, my business is in another industry"}),e[52]=h,e[53]=z):z=e[53];let K;e[54]!==U||e[55]!==z?(K=(0,f.jsxs)("div",{className:"grid gap-3",children:[U,z]}),e[54]=U,e[55]=z,e[56]=K):K=e[56];let N;e[57]!==O||e[58]!==K?(N=(0,f.jsxs)("div",{className:"space-y-5",children:[O,K]}),e[57]=O,e[58]=K,e[59]=N):N=e[59];let B;e[60]!==N||e[61]!==F?(B=(0,f.jsxs)("div",{className:"grid min-h-0 flex-1 content-start grid-cols-1 gap-6 overflow-y-auto px-6 py-4 md:grid-cols-[2fr_3fr] md:items-center md:gap-8",children:[F,N]}),e[60]=N,e[61]=F,e[62]=B):B=e[62];let ee;return e[63]!==B||e[64]!==M?(ee=(0,f.jsxs)(f.Fragment,{children:[M,B]}),e[63]=B,e[64]=M,e[65]=ee):ee=e[65],ee}const C=s.status==="non_dental"?s.detectedIndustry:null;let x;e[66]!==o?(x=o?.("Request HoneyGrid for your industry"),e[66]=o,e[67]=x):x=e[67];const k=C??void 0;let A;e[68]!==r||e[69]!==k?(A=(0,f.jsx)(fa,{business:r,detectedIndustry:k}),e[68]=r,e[69]=k,e[70]=A):A=e[70];let P;e[71]===Symbol.for("react.memo_cache_sentinel")?(P=(0,f.jsxs)("div",{className:"space-y-2",children:[(0,f.jsx)("h2",{ref:v,tabIndex:-1,className:"text-xl font-semibold focus:outline-none",children:"HoneyGrid is coming soon for your industry"}),(0,f.jsx)("p",{className:"text-sm text-muted-foreground",children:"We’re currently onboarding dental practices. Share your details and we’ll take you to a quick call with our team."})]}),e[71]=P):P=e[71];let T;e[72]!==s.status?(T=s.status==="unknown"?()=>g("unanswered"):void 0,e[72]=s.status,e[73]=T):T=e[73];let R;e[74]!==r||e[75]!==C||e[76]!==u||e[77]!==d||e[78]!==c||e[79]!==T?(R=(0,f.jsxs)("div",{className:"space-y-5",children:[P,(0,f.jsx)(pb,{business:r,detectedIndustry:C,onSubmitInterest:c,onOpenSchedulingLink:u,onPendingChange:d,onBackToConfirmation:T})]}),e[74]=r,e[75]=C,e[76]=u,e[77]=d,e[78]=c,e[79]=T,e[80]=R):R=e[80];let I;e[81]!==R||e[82]!==A?(I=(0,f.jsxs)("div",{className:"grid min-h-0 flex-1 grid-cols-1 gap-6 overflow-y-auto px-6 py-6 md:grid-cols-[2fr_3fr] md:gap-8",children:[A,R]}),e[81]=R,e[82]=A,e[83]=I):I=e[83];let E;return e[84]!==I||e[85]!==x?(E=(0,f.jsxs)(f.Fragment,{children:[x,I]}),e[84]=I,e[85]=x,e[86]=E):E=e[86],E}function hb(t,e){return t&&e?.trim().toLowerCase()!=="false"}var ql=hb(!1,void 0),at="local-test-place:",Xt="https://images.pexels.com/photos/5452201/pexels-photo-5452201.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",Qt="https://images.pexels.com/photos/3845988/pexels-photo-3845988.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",gb="https://d3t5ai5vcxyqte.cloudfront.net/media/aaycfdpyomgb.png?updated_at=2023-05-05T07:11:35.417Z",Wl=[{placeId:`${at}precious-smiles-carlisle`,label:"Precious Smiles Children & Family Dentistry - Carlisle",description:"820 Belvedere St, Carlisle, PA",ph
26otoUrl:"https://images.pexels.com/photos/3845806/pexels-photo-3845806.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}precious-smiles-carlisle`,name:"places/local-test-place-precious-smiles-carlisle",displayName:{text:"Precious Smiles Children & Family Dentistry - Carlisle"},types:["dentist","health"],nationalPhoneNumber:"(717) 243-0300",formattedAddress:"820 Belvedere St, Carlisle, PA 17013, USA",location:{latitude:40.1887,longitude:-77.1896},rating:4.8,userRatingCount:112,websiteUri:"https://www.precioussmilespa.com/",regularOpeningHours:{openNow:!0}},onboarding:{scenarioLabel:"Complete multi-channel profile",scenarioDescription:"Rich website, family-focused offer, and an uploaded address list.",specialties:["general","cosmetic"],goal:"customers",channels:["google","meta","postcards"],forwardingEmail:"[email protected]",monthlyBudget:2e3,dailyBudget:67,honeygridFeeRate:.2,paymentProcessingRate:.035,specialInstructions:"Feature the new-patient exam and a calm, family-friendly tone.",addressListStatus:"uploaded",brand:{displayFont:"Fraunces",bodyFont:"Source Sans 3",primaryColor:"#164E63",accentColor:"#F59E0B",logoUrl:gb,supportingImages:[{id:"team",label:"Team photo",url:Xt,alt:"Precious Smiles care team"},{id:"treatment",label:"Service photo",url:Qt,alt:"Family dentistry treatment room"}]}}},{placeId:`${at}carlisle-family-dentistry`,label:"Carlisle Family Dentistry",description:"343 York Rd, Carlisle, PA",photoUrl:"https://images.pexels.com/photos/3845806/pexels-photo-3845806.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}carlisle-family-dentistry`,name:"places/local-test-place-carlisle-family-dentistry",displayName:{text:"Carlisle Family Dentistry"},types:["dentist","health"],nationalPhoneNumber:"(717) 249-7777",formattedAddress:"343 York Rd, Carlisle, PA 17013, USA",location:{latitude:40.2013,longitude:-77.1765},rating:4.7,userRatingCount:86,websiteUri:"https://example.com/carlisle-family-dentistry",regularOpeningHours:{openNow:!0}},onboarding:{scenarioLabel:"Balanced lead generation",scenarioDescription:"Two channels, standard budget, and practical family-dentistry copy.",specialties:["general"],goal:"customers",channels:["google","postcards"],forwardingEmail:"[email protected]",monthlyBudget:2400,dailyBudget:80,honeygridFeeRate:.2,paymentProcessingRate:.035,specialInstructions:"Mention same-week hygiene appointments when availability permits.",addressListStatus:"kolla",brand:{displayFont:"Manrope",bodyFont:"Inter",primaryColor:"#0F766E",accentColor:"#F59E0B",supportingImages:[{id:"team",label:"Team photo",url:Xt,alt:"Carlisle Family dental team"},{id:"treatment",label:"Hygiene visit",url:Qt,alt:"Family dentistry hygiene appointment"}]}}},{placeId:`${at}keystone-pediatric-dental`,label:"Keystone Pediatric Dental",description:"2 Jennifer Ct, Carlisle, PA",photoUrl:"https://images.pexels.com/photos/3845625/pexels-photo-3845625.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}keystone-pediatric-dental`,name:"places/local-test-place-keystone-pediatric-dental",displayName:{text:"Keystone Pediatric Dental"},types:["dentist","health"],nationalPhoneNumber:"(717) 243-5437",formattedAddress:"2 Jennifer Ct, Carlisle, PA 17015, USA",location:{latitude:40.1812,longitude:-77.2162},rating:4.9,userRatingCount:74,websiteUri:"https://example.com/keystone-pediatric-dental",regularOpeningHours:{openNow:!1}},onboarding:{scenarioLabel:"Brand awareness",scenarioDescription:"Pediatric visual language, social-first channels, and playful typography.",specialties:["general"],goal:"awareness",channels:["meta","postcards"],forwardingEmail:"[email protected]",monthlyBudget:1800,dailyBudget:60,honeygridFeeRate:.2,paymentProcessingRate:.035,specialInstructions:"Use reassuring language for parents; avoid clinical imagery.",addressListStatus:"uploaded",brand:{displayFont:"Nunito",bodyFont:"Inter",primaryColor:"#7C3AED",accentColor:"#F59E0B",supportingImages:[{id:"team",label:"Care team",url:Xt,alt:"Keystone Pediatric care team"},{id:"treatment",label:"Child-friendly care",url:Qt,alt:"Child-friendly dental care room"}]}}},{placeId:`${at}
26cumberland-valley-dental-care`,label:"Cumberland Valley Dental Care",description:"49 Brookside Ave, Carlisle, PA",photoUrl:"https://images.pexels.com/photos/3807517/pexels-photo-3807517.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}cumberland-valley-dental-care`,name:"places/local-test-place-cumberland-valley-dental-care",displayName:{text:"Cumberland Valley Dental Care"},types:["dentist","health"],nationalPhoneNumber:"(717) 258-9000",formattedAddress:"49 Brookside Ave, Carlisle, PA 17013, USA",location:{latitude:40.1991,longitude:-77.1972},rating:4.6,userRatingCount:58,websiteUri:"https://example.com/cumberland-valley-dental-care",regularOpeningHours:{openNow:!0}},onboarding:{scenarioLabel:"Low-budget warning",scenarioDescription:"A deliberately constrained budget for testing recommendations.",specialties:["general","emergency"],goal:"customers",channels:["google"],forwardingEmail:"[email protected]",monthlyBudget:600,dailyBudget:20,honeygridFeeRate:.2,paymentProcessingRate:.035,addressListStatus:"not_provided",brand:{displayFont:"Manrope",bodyFont:"Inter",primaryColor:"#0F766E",accentColor:"#F59E0B",supportingImages:[{id:"team",label:"Team photo",url:Xt,alt:"Cumberland Valley care team"},{id:"treatment",label:"Treatment room",url:Qt,alt:"Cumberland Valley treatment room"}]}}},{placeId:`${at}belvedere-family-dental`,label:"Belvedere Family Dental",description:"915 Walnut Bottom Rd, Carlisle, PA",photoUrl:"https://images.pexels.com/photos/3779712/pexels-photo-3779712.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}belvedere-family-dental`,name:"places/local-test-place-belvedere-family-dental",displayName:{text:"Belvedere Family Dental"},types:["dentist","health"],nationalPhoneNumber:"(717) 701-8500",formattedAddress:"915 Walnut Bottom Rd, Carlisle, PA 17015, USA",location:{latitude:40.1849,longitude:-77.2064},rating:4.5,userRatingCount:43,websiteUri:"https://example.com/belvedere-family-dental",regularOpeningHours:{openNow:!0}},onboarding:{scenarioLabel:"Direct-mail focus",scenarioDescription:"Postcard-only campaign with Kolla supplying the market list.",specialties:["general","cosmetic"],goal:"reengage",channels:["postcards"],forwardingEmail:"[email protected]",monthlyBudget:1500,dailyBudget:50,honeygridFeeRate:.2,paymentProcessingRate:.035,specialInstructions:"Promote overdue hygiene visits without using fear-based language.",addressListStatus:"kolla",brand:{displayFont:"Manrope",bodyFont:"Inter",primaryColor:"#1D4ED8",accentColor:"#F59E0B",supportingImages:[{id:"team",label:"Team photo",url:Xt,alt:"Belvedere Family dental team"},{id:"treatment",label:"Patient care",url:Qt,alt:"Belvedere Family patient care"}]}}},{placeId:`${at}greater-carlisle-dental-center`,label:"Greater Carlisle Dental Center for Restorative and Implant Dentistry",description:"100 Noble Blvd, Carlisle, PA",photoUrl:"https://images.pexels.com/photos/3881449/pexels-photo-3881449.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}greater-carlisle-dental-center`,name:"places/local-test-place-greater-carlisle-dental-center",displayName:{text:"Greater Carlisle Dental Center for Restorative and Implant Dentistry"},types:["dentist","health"],nationalPhoneNumber:"(717) 555-0142",formattedAddress:"100 Noble Blvd, Carlisle, PA 17013, USA",location:{latitude:40.2108,longitude:-77.1779},rating:4.9,userRatingCount:1247,websiteUri:"https://example.com/greater-carlisle-dental-center",regularOpeningHours:{openNow:!0}},onboarding:{scenarioLabel:"High-budget implant campaign",scenarioDescription:"Long business name, premium services, and budget for two campaigns.",specialties:["implants","cosmetic"],goal:"customers",channels:["google","meta"],forwardingEmail:"[email protected]",monthlyBudget:9e3,dailyBudget:100,honeygridFeeRate:.2,paymentProcessingRate:.035,specialInstructions:"Separate implant consultations from full-mouth restoration messaging.",addressListStatus:"uploaded",brand:{displayFont:"Cormorant Garamond",bodyFont:"Lato",primaryColor:"#292524",accentColor:"#CA8A04",supportingImages:[{id:"team",label:"Clinical team",url:Xt,alt:"Greater Carlisle implant team"},{id:"treatment",label:"Implant care",url:Qt,alt:"Greater Carlisle implant treatment room"}]}}},{placeId:`${at}market-street-dental-studio`,label:"Market Street Dental Studio",description:"16 W High St, Carlisle, PA",ph
26otoUrl:"https://images.pexels.com/photos/3779705/pexels-photo-3779705.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}market-street-dental-studio`,name:"places/local-test-place-market-street-dental-studio",displayName:{text:"Market Street Dental Studio"},types:["cosmetic_dentist","dentist"],nationalPhoneNumber:"(717) 555-0188",formattedAddress:"16 W High St, Carlisle, PA 17013, USA",location:{latitude:40.201,longitude:-77.1905},rating:4.4,userRatingCount:9,websiteUri:"https://example.com/market-street-dental-studio",regularOpeningHours:{openNow:!1}},onboarding:{scenarioLabel:"Cosmetic launch",scenarioDescription:"Low review volume, editorial typography, and image-led social creative.",specialties:["cosmetic"],goal:"awareness",channels:["meta","google"],forwardingEmail:"[email protected]",monthlyBudget:3500,dailyBudget:100,honeygridFeeRate:.2,paymentProcessingRate:.035,specialInstructions:"Lead with veneer consultations and natural-looking results.",addressListStatus:"not_provided",brand:{displayFont:"DM Serif Display",bodyFont:"DM Sans",primaryColor:"#831843",accentColor:"#F9A8D4",supportingImages:[{id:"team",label:"Studio team",url:Xt,alt:"Market Street studio team"},{id:"treatment",label:"Cosmetic care",url:Qt,alt:"Market Street cosmetic care"}]}}},{placeId:`${at}northside-emergency-dental`,label:"Northside Emergency Dental",description:"1500 Harrisburg Pike, Carlisle, PA",photoUrl:"https://images.pexels.com/photos/3845983/pexels-photo-3845983.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}northside-emergency-dental`,name:"places/local-test-place-northside-emergency-dental",displayName:{text:"Northside Emergency Dental"},types:["emergency_dental_service","dentist"],nationalPhoneNumber:"(717) 555-0199",formattedAddress:"1500 Harrisburg Pike, Carlisle, PA 17015, USA",location:{latitude:40.2326,longitude:-77.1494},rating:4.2,userRatingCount:318,websiteUri:"https://example.com/northside-emergency-dental",regularOpeningHours:{openNow:!0}},onboarding:{scenarioLabel:"Emergency conversion",scenarioDescription:"Urgent search intent, after-hours calls, and concise mobile-first copy.",specialties:["emergency"],goal:"customers",channels:["google"],forwardingEmail:"[email protected]",monthlyBudget:4200,dailyBudget:100,honeygridFeeRate:.2,paymentProcessingRate:.035,specialInstructions:"State actual opening hours. Never promise immediate treatment.",addressListStatus:"not_provided",brand:{displayFont:"Roboto Slab",bodyFont:"Roboto",primaryColor:"#991B1B",accentColor:"#F97316",supportingImages:[{id:"team",label:"Emergency team",url:Xt,alt:"Northside emergency team"},{id:"treatment",label:"Emergency care",url:Qt,alt:"Northside emergency treatment room"}]}}},{placeId:`${at}smile-lab-dental`,label:"Smile Lab Dental",description:"950 Walnut Bottom Rd, Carlisle, PA",photoUrl:"https://images.pexels.com/photos/3845988/pexels-photo-3845988.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}smile-lab-dental`,name:"places/local-test-place-smile-lab-dental",displayName:{text:"Smile Lab Dental"},types:["dentist"],formattedAddress:"950 Walnut Bottom Rd, Carlisle, PA 17015, USA",location:{latitude:40.1828,longitude:-77.2041},websiteUri:"https://example.com/smile-lab-dental",regularOpeningHours:{openNow:!1}},onboarding:{scenarioLabel:"Incomplete contact data",scenarioDescription:"No discovered phone or reviews, useful for missing-data states.",specialties:["general","cosmetic"],goal:"awareness",channels:["meta"],forwardingPhone:"",forwardingEmail:"[email protected]",monthlyBudget:1200,dailyBudget:40,honeygridFeeRate:.2,paymentProcessingRate:.035,addressListStatus:"not_provided",brand:{displayFont:"Space Grotesk",bodyFont:"Inter",primaryColor:"#0369A1",accentColor:"#22D3EE",supportingImages:[{id:"team",label:"Team placeholder",url:Xt,alt:"Smile Lab team placeholder"},{id:"treatment",label:"Service photo",url:Qt,alt:"Smile Lab service photo"}]}}},{placeId:`${at}west-shore-family-dental`,label:"West Shore Family Dental - Carlisle",description:"260 E Pomfret St, Carlisle, PA",ph
26otoUrl:"https://images.pexels.com/photos/3764014/pexels-photo-3764014.jpeg?auto=compress&cs=tinysrgb&w=1200&h=800&fit=crop",place:{id:`${at}west-shore-family-dental`,name:"places/local-test-place-west-shore-family-dental",displayName:{text:"West Shore Family Dental - Carlisle"},types:["dentist","health"],nationalPhoneNumber:"(717) 555-0116",formattedAddress:"260 E Pomfret St, Carlisle, PA 17013, USA",location:{latitude:40.1983,longitude:-77.184},rating:5,userRatingCount:1,regularOpeningHours:{openNow:!0}},onboarding:{scenarioLabel:"Missing website",scenarioDescription:"No source website, minimal reviews, and postcard-first acquisition.",specialties:["general"],goal:"customers",channels:["postcards","google"],forwardingEmail:"[email protected]",monthlyBudget:2e3,dailyBudget:67,honeygridFeeRate:.2,paymentProcessingRate:.035,specialInstructions:"Use only verified business details until a website is provided.",addressListStatus:"uploaded",brand:{displayFont:"Libre Baskerville",bodyFont:"Source Sans 3",primaryColor:"#1E3A8A",accentColor:"#FBBF24",supportingImages:[{id:"team",label:"Team photo",url:Xt,alt:"West Shore dental team"},{id:"treatment",label:"Family care",url:Qt,alt:"West Shore family dental care"}]}}}];function vb(t,{allowSamples:e=ql}={}){if(!e)return[];const r=t.trim().toLowerCase();return r?Wl.filter(s=>`${s.label} ${s.description}`.toLowerCase().includes(r)).map(s=>({value:s.placeId,label:s.label,description:s.description})):[]}function yb(t,{allowSamples:e=ql}={}){if(!e)return[];const r=t.trim().toLowerCase();return r?Wl.filter(s=>`${s.label} ${s.description}`.toLowerCase().includes(r)).map(s=>s.place):[]}function YC(t){const e=b.useRef(null),r=b.useRef(t);return b.useLayoutEffect(()=>{r.current=t}),b.useEffect(()=>{const s=n=>{const a=e.current;a&&!a.contains(n.target)&&r.current(n)};return document.addEventListener("mousedown",s),document.addEventListener("touchstart",s),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("touchstart",s)}},[]),e}function bb(t,e){const[r,s]=b.useState(t);return b.useEffect(()=>{const n=setTimeout(()=>{s(t)},e);return()=>{clearTimeout(n)}},[t,e]),r}var _b=t=>{const e=new Set;return t.filter(r=>!r.id||e.has(r.id)?!1:(e.add(r.id),!0))};async function Sb(t,e,r,s){const n=await fetch(Jr("/google-places/autocomplete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:t,sessionToken:e,scope:r}),signal:s});if(!n.ok)throw new Error("Practice suggestions could not be loaded");return((await n.json()).suggestions??[]).flatMap(({placePrediction:a})=>a&&(!r||di(a.types))?[{description:a.text?.text??"",place_id:a.placeId,types:a.types,structured_formatting:{main_text:a.structuredFormat?.mainText?.text??a.text?.text??"",secondary_text:a.structuredFormat?.secondaryText?.text??""}}]:[])}function wb(t,e){return e?vb(t,{allowSamples:!0}).map(r=>({description:`${r.label}, ${r.description}`,place_id:r.value,structured_formatting:{main_text:r.label,secondary_text:r.description}})):[]}function xb(t,e,r,s,n){return!e||!r.trim()||!n?t:[{place_id:"search",description:s,structured_formatting:{main_text:"",secondary_text:""}},...t]}function Cb(t){return{isLoading:!t.localOnly&&t.localCount===0&&!!t.query.trim()&&(!t.isQuerySettled||t.isFetching),error:!t.localOnly&&t.isQuerySettled?t.error:null}}var Hl=(t,e,r)=>{const s=(0,V.c)(54),n=t===void 0?!1:t,a=e===void 0?"":e,{localOnly:i,includeLocalFixtures:o,searchScope:l}=r===void 0?{}:r,c=i===void 0?!1:i,u=o===void 0?!1:o,[d,h]=(0,b.useState)(Ab),[p,m]=(0,b.useState)(a),g=bb(p,300),v=Kg(),_=(0,b.useRef)(0);let S;s[0]===Symbol.for("react.memo_cache_sentinel")?(S=[],s[0]=S):S=s[0];const[y,w]=(0,b.useState)(S),[C,x]=(0,b.useState)(),[k,A]=(0,b.useState)(),[P,T]=(0,b.useState)(null),[R,I]=(0,b.useState)(null),E=ys({queryKey:["place-autocomplete",g,d,l,c],queryFn:ie=>{const{signal:le}=ie;return Sb(g,d,l,le)},enabled:!!g.trim()&&!c,staleTime:3e5}),M=p===g,F=wb(p,c||u),$=!c&&M?E.data??[]:[],O=[...F,...$],D=xb(O,n,p,g,M),j=Cb({localOnly:c,localCount:F.length,query:p,isQuerySettled:M,isFetching:E.isFetching,error:E.error});let U;s[1]!==c?(U=async ie=>{if(c)return{places:yb(ie.query,{allowSamples:!0})};const le=await fetch(Jr("/google-places/search"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:ie.query,bounds:ie.bounds,pageToken:ie.pageToken,scope:ie.scope})});if(!le.ok)throw new Error("Practice search could not be loaded");return le.json()},s[1]=c,s[2]=U):U=s[2];let q;s[3]!==I||s[4]!==x||s[5]!==w||s[6]!==T||s[7]!==h?(q=(ie,le)=>{if(le.generation!==_.current)return;const we=(ie.places??[]).filter(De=>!le.scope||di(De.types));w(De=>_b(le.append?[...De,...we]:we)),x(ie.nextPageToken),le.append?I(null):(T(null),h(crypto.randomUUID()))},s[3]=I,s[4]=x,s[5]=w,s[6]=T,s[7]=h,s[8]=q):q=s[8];let z;s[9]!==I||s[10]!==T?(z=(ie,le)=>{le.generation===_.current&&(le.append?I(ie):T(ie))},s[9]=I,s[10]=T,s[11]=z):z=s[11];let K;s[12]!==U||s[13]!==q||s[14]!==z?(K={mutationFn:U,onSuccess:q,onError:z},s[12]=U,s[13]=q,s[14]=z,s[15]=K):K=s[15];const N=rr(K);let B;s[16]!==N||s[17]!==A||s[18]!==I||s[19]!==x||s[20]!==w||s[21]!==T?(B=()=>{_.current=_.current+1,N.reset(),w([]),x(void 0),A(void 0),T(null),I(null)},s[16]=N,s[17]=A,s[18]=I,s[19]=x,s[20]=w,s[21]=T,s[22]=B):B=s[22];const ee=B;let he;s[23]!==ee||s[24]!==N||s[25]!==p||s[26]!==l||s[27]!==A||s[28]!==v?(he=ie=>
26{const le=(ie===void 0?p:ie).trim();if(!le)return;ee();const we={query:le,bounds:!l&&v?{north:v.northEast.lat,south:v.southWest.lat,east:v.northEast.lng,west:v.southWest.lng}:void 0,scope:l,generation:_.current};A(we),N.mutate({...we,append:!1})},s[23]=ee,s[24]=N,s[25]=p,s[26]=l,s[27]=A,s[28]=v,s[29]=he):he=s[29];const pe=he;let ge;s[30]!==k||s[31]!==N||s[32]!==C||s[33]!==I?(ge=()=>{!k||!C||N.isPending||(I(null),N.mutate({...k,pageToken:C,append:!0}))},s[30]=k,s[31]=N,s[32]=C,s[33]=I,s[34]=ge):ge=s[34];const Fe=ge,de=j.isLoading,Le=j.error,Me=O.length>0,Ie=N.isPending&&!N.variables?.append,ke=!!C,Pe=N.isPending&&!!N.variables?.append;let me;s[35]!==m?(me=()=>m(""),s[35]=m,s[36]=me):me=s[36];let Se;return s[37]!==ee||s[38]!==pe||s[39]!==R||s[40]!==Fe||s[41]!==D||s[42]!==j.error||s[43]!==j.isLoading||s[44]!==p||s[45]!==y||s[46]!==P||s[47]!==m||s[48]!==Me||s[49]!==Ie||s[50]!==ke||s[51]!==Pe||s[52]!==me?(Se={query:p,setQuery:m,placePredictions:D,isPredictionsLoading:de,predictionsError:Le,hasSearched:Me,handleSearch:pe,queryResults:y,isSearching:Ie,searchError:P,hasMoreResults:ke,isLoadingMore:Pe,loadMoreError:R,loadMoreResults:Fe,clearSearchResults:ee,clearPlacePredictions:me},s[37]=ee,s[38]=pe,s[39]=R,s[40]=Fe,s[41]=D,s[42]=j.error,s[43]=j.isLoading,s[44]=p,s[45]=y,s[46]=P,s[47]=m,s[48]=Me,s[49]=Ie,s[50]=ke,s[51]=Pe,s[52]=me,s[53]=Se):Se=s[53],Se};function Ab(){return crypto.randomUUID()}function Kl(t){const{open:e=!1,onOpenChange:r,elements:s={}}=t,n=hd(),a=Wo()!=null,i=ms(()=>new qd({open:e,transitionStatus:void 0,onOpenChange:r,referenceElement:s.reference??null,floatingElement:s.floating??null,triggerElements:new af,floatingId:n,syncOnly:!1,nested:a})).current;return $e(()=>{const o={open:e,floatingId:n};s.reference!==void 0&&(o.referenceElement=s.reference,o.domReferenceElement=Br(s.reference)?s.reference:null),s.floating!==void 0&&(o.floatingElement=s.floating),i.update(o)},[e,n,s.reference,s.floating,i]),i.context.onOpenChange=r,i.context.nested=a,i}function kb(t={}){const{nodeId:e,externalTree:r}=t,s=Kl(t),n=t.rootContext||s,a=n.useState("referenceElement"),i=n.useState("floatingElement"),o=n.useState("domReferenceElement"),l=n.useState("open"),c=n.useState("floatingId"),[u,d]=b.useState(null),[h,p]=b.useState(void 0),[m,g]=b.useState(void 0),v=b.useRef(null),_=Bo(r),S=b.useMemo(()=>({reference:a,floating:i,domReference:o}),[a,i,o]),y=ju({...t,elements:{...S,...u&&{reference:u}}}),w=Br(h)?h:null,C=m===void 0?n.state.floatingElement:m;n.useSyncedValue("referenceElement",h??null),n.useSyncedValue("domReferenceElement",h===void 0?o:w),n.useSyncedValue("floatingElement",C);const x=b.useCallback(I=>{const E=Br(I)?{getBoundingClientRect:()=>I.getBoundingClientRect(),getClientRects:()=>I.getClientRects(),contextElement:I}:I;d(E),y.refs.setReference(E)},[y.refs]),k=b.useCallback(I=>{(Br(I)||I===null)&&(v.current=I,p(I)),(Br(y.refs.reference.current)||y.refs.reference.current===null||I!==null&&!Br(I))&&y.refs.setReference(I)},[y.refs,p]),A=b.useCallback(I=>{g(I),y.refs.setFloating(I)},[y.refs]),P=b.useMemo(()=>({...y.refs,setReference:k,setFloating:A,setPositionReference:x,domReference:v}),[y.refs,k,A,x]),T=b.useMemo(()=>({...y.elements,domReference:o}),[y.elements,o]),R=b.useMemo(()=>({...y,dataRef:n.context.dataRef,open:l,onOpenChange:n.setOpen,events:n.context.events,floatingId:c,refs:P,elements:T,nodeId:e,rootStore:n}),[y,P,T,e,n,l,c]);return $e(()=>{o&&(v.current=o)},[o]),$e(()=>{n.context.dataRef.current.floatingContext=R;const I=_?.nodesRef.current.find(E=>E.id===e);I&&(I.context=R)}),b.useMemo(()=>({...y,context:R,refs:P,elements:T,rootStore:n}),[y,P,T,R,n])}var Ib="Escape";function Rn(t,e,r){switch(t){case"vertical":return e;case"horizontal":return r;default:return e||r}}function Ks(t,e){return Rn(e,t==="ArrowUp"||t==="ArrowDown",t==="ArrowLeft"||t==="ArrowRight")}function pa(t,e,r){return Rn(e,t==="ArrowDown",r?t==="ArrowLeft":t==="ArrowRight")||t==="Enter"||t===" "||t===""}function Pb(t,e,r){return Rn(e,r?t===Uo:t===qo,t===Ed)}function Eb(t,e,r,s){const n=r?t===qo:t===Uo,a=t===Jd;return e==="both"||e==="horizontal"&&s?t===Ib:Rn(e,n,a)}function Rb(t,e){const{listRef:r,activeIndex:s,onNavigate:n=()=>{},enabled:a=!0,selectedIndex:i=null,allowEscape:o=!1,loopFocus:l=!1,nested:c=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:h="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:g=void 0,orientation:v="vertical",parentOrientation:_,id:S,resetOnPointerLeave:y=!0,externalTree:w,grid:C}=e,x=C!=null,k="rootStore"in t?t.rootStore:t,A=k.useState("open"),P=k.useState("floatingElement"),T=k.useState("domReferenceElement"),R=k.context.dataRef,I=Ud(P),E=Vd(T),M=er(I),F=Wo(),$=Bo(w),O=b.useRef(h),D=b.useRef(i??-1),j=b.useRef(null),U=b.useRef(!0),q=qe(W=>{n(D.current===-1?null:D.current,W)}),z=b.useRef(!!P),K=b.useRef(A),N=b.useRef(!1),B=b.useRef(!1),ee=b.useRef(null),he=er(g),pe=er(A),ge=er(i),Fe=er(y),de=Fi(),Le=Fi(),Me=qe(()=>{function W(G){d?$?.events.emit("virtualfocus",G):ee.current=Yd(G,{sync:N.current,preventScroll:!0})}const L=r.current[D.current],te=B.current;L&&W(L),(N.current?G=>G():G=>de.request(G))(()=>{const G=r.current[D.current]||L;G&&(L||W(G),ie&&(te||!U.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"}))})});$e(()=>{R.current.orientation=v},[R,v]),$e(()=>{a&&(A&&P?(D.current=i??-1,O.current&&i!=null&&(B.current=!0,q())):z.current&&(D.current=-1,q()))},[a,A,P,i,q]),$e(()=>{if(a){if(!A){N.current=!1;return}if(P)if(s==null){if(N.current=!1,ge.current!=null)return;if(z.current&&(D.current=-1,Me()),(!K.current||!z.current)&&O.current&&(j.current!=null||O.current===!0&&j.current==null)){let W=0;const L=()=>{r.current[0]==null?(W<2&&(W?te=>Le.request(te):queueMicrotask)(L),W+=1):(D.current=j.current==null||pa(j.current,v,u)||c?Jn(r):Di(r),j.current=null,q())};L()}}else ba(r.current,s)||(D.current=s,Me(),B.current=!1)}},[a,A,P,s,ge,c,r,v,u,q,Me,Le]),$e(()=>{if(!a||P||!$||d||!z.current)return;const W=$.nodesRef.current,L=W.find(xe=>xe.id===F)?.context?.elements.floating,te=Xn(Yr(T??L??null)),G=W.
26some(xe=>xe.context&&gt(xe.context.elements.floating,te));L&&!G&&U.current&&L.focus({preventScroll:!0})},[a,P,T,$,F,d]),$e(()=>{K.current=A,z.current=!!P}),$e(()=>{A||(j.current=null,O.current=h)},[A,h]);const Ie=s!=null,ke=qe(W=>{if(!pe.current)return;const L=r.current.indexOf(W.currentTarget);L!==-1&&(D.current!==L||s!==L)&&(D.current=L,q(W))}),Pe=qe(()=>_??$?.nodesRef.current.find(W=>W.id===F)?.context?.dataRef?.current.orientation),me=qe(()=>Jn(r,he.current)),Se=qe(W=>{if(U.current=!1,N.current=!0,W.which===229||!pe.current&&W.currentTarget===M.current)return;if(c&&Eb(W.key,v,u,x)){Ks(W.key,Pe())||kt(W),k.setOpen(!1,Ye(ya,W.nativeEvent)),Ri(T)&&(d?$?.events.emit("virtualfocus",T):T.focus());return}const L=D.current,te=Jn(r,g),G=Di(r,g);if(E||(W.key==="Home"&&(kt(W),D.current=te,q(W)),W.key==="End"&&(kt(W),D.current=G,q(W))),C!=null){const xe=C(W,D.current,r,v,l,u,g,te,G);if(xe!=null&&(D.current=xe,q(W)),v==="both")return}if(Ks(W.key,v)){if(kt(W),A&&!d&&Xn(W.currentTarget.ownerDocument)===W.currentTarget){D.current=pa(W.key,v,u)?te:G,q(W);return}pa(W.key,v,u)?l?L>=G?o&&L!==r.current.length?D.current=-1:(N.current=!1,D.current=te):D.current=Ls(r.current,{startingIndex:L,disabledIndices:g}):D.current=Math.min(G,Ls(r.current,{startingIndex:L,disabledIndices:g})):l?L<=te?o&&L!==-1?D.current=r.current.length:(N.current=!1,D.current=G):D.current=Ls(r.current,{startingIndex:L,decrement:!0,disabledIndices:g}):D.current=Math.max(te,Ls(r.current,{startingIndex:L,decrement:!0,disabledIndices:g})),ba(r.current,D.current)&&(D.current=-1),q(W)}}),ie=b.useMemo(()=>({onFocus(W){N.current=!0,ke(W)},onClick:({currentTarget:W})=>W.focus({preventScroll:!0}),onMouseMove(W){N.current=!0,B.current=!1,p&&ke(W)},onPointerLeave(W){if(!pe.current||!U.current||W.pointerType==="touch")return;N.current=!0;const L=W.relatedTarget;if(!(!p||r.current.includes(L))&&Fe.current&&(ee.current?.(),ee.current=null,D.current=-1,q(W),!d)){const te=M.current,G=Xn(Yr(te));te&&gt(te,G)&&te.focus({preventScroll:!0})}}}),[ke,pe,M,p,r,q,Fe,d]),le=b.useMemo(()=>d&&A&&Ie&&{"aria-activedescendant":`${S}-${s}`},[d,A,Ie,S,s]),we=b.useMemo(()=>({"aria-orientation":v==="both"?void 0:v,...E?{}:le,onKeyDown(W){if(W.key==="Tab"&&W.shiftKey&&A&&!d){const L=Gr(W.nativeEvent);if(L&&!gt(M.current,L))return;kt(W),k.setOpen(!1,Ye(Ad,W.nativeEvent)),Ri(T)&&T.focus();return}Se(W)},onPointerMove(){U.current=!0}}),[le,Se,M,v,E,k,A,d,T]),De=b.useMemo(()=>{function W(G){k.setOpen(!0,Ye(ya,G.nativeEvent,G.currentTarget))}function L(G){h==="auto"&&Nd(G.nativeEvent)&&(O.current=!d)}function te(G){O.current=h,h==="auto"&&Bd(G.nativeEvent)&&(O.current=!0)}return{onKeyDown(G){const xe=k.select("open");U.current=!1;const Ue=G.key.startsWith("Arrow"),je=Pb(G.key,Pe(),u),Ce=Ks(G.key,v),J=(c?je:Ce)||G.key==="Enter"||G.key.trim()==="";if(d&&xe)return Se(G);if(!(!xe&&!m&&Ue)){if(J){const Oe=Ks(G.key,Pe());j.current=c&&Oe?null:G.key}if(c){je&&(kt(G),xe?(D.current=me(),q(G)):W(G));return}Ce&&(ge.current!=null&&(D.current=ge.current),kt(G),!xe&&m?W(G):Se(G),xe&&q(G))}},onFocus(G){k.select("open")&&!d&&(D.current=-1,q(G))},onPointerDown:te,onPointerEnter:te,onMouseDown:L,onClick:L}},[Se,h,me,c,q,k,m,v,Pe,u,ge,d]),se=b.useMemo(()=>({...le,...De}),[le,De]);return b.useMemo(()=>a?{reference:se,floating:we,item:ie,trigger:De}:{},[a,se,we,De,ie])}function Tb(t,e){const{listRef:r,elementsRef:s,activeIndex:n,onMatch:a,disabledIndices:i,onTyping:o,enabled:l=!0,resetMs:c=750,selectedIndex:u=null}=e,d="rootStore"in t?t.rootStore:t,h=d.useState("open"),p=Fr(),m=b.useRef(""),g=b.useRef(u??n??-1),v=b.useRef(null),_=qe(w=>{function C(I){const E=s?.current[I];return!E||Fd(E)}function x(I){return C(I)?i==null||!tf(us,I,i):!1}function k(I,E,M=0){if(I.length===0)return-1;const F=(M%I.length+I.length)%I.length,$=E.toLowerCase();for(let O=0;O<I.length;O+=1){const D=(F+O)%I.length;if(!(!I[D]?.toLowerCase().startsWith($)||!x(D)))return D}return-1}const A=r.current;if(m.current.length>0&&w.key===" "&&(kt(w),o?.(!0)),m.current.length>0&&m.current[0]!==" "&&k(A,m.current)===-1&&w.key!==" "&&o?.(!1),A==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;h&&w.key!==" "&&(kt(w),o?.(!0));const P=m.current==="";P&&(g.current=u??n??-1),A.every((I,E)=>I&&x(E)?I[0]?.toLowerCase()!==I[1]?.toLowerCase():!0)&&m.current===w.key&&(m.current="",g.current=v.current),m.current+=w.key,p.start(c,()=>{m.current="",g.current=v.current,o?.(!1)});const T=((P?u??n??-1:g.current)??0)+1,R=k(A,m.current,T);
26R!==-1?(a?.(R),v.current=R):w.key!==" "&&(m.current="",o?.(!1))}),S=qe(w=>{const C=w.relatedTarget,x=d.select("domReferenceElement"),k=d.select("floatingElement");gt(x,C)||gt(k,C)||(p.clear(),m.current="",g.current=v.current,o?.(!1))});$e(()=>{!h&&u!==null||(p.clear(),v.current=null,m.current!==""&&(m.current=""))},[h,u,p]),$e(()=>{h&&m.current===""&&(g.current=u??n??-1)},[h,u,n]);const y=b.useMemo(()=>({onKeyDown:_,onBlur:S}),[_,S]);return b.useMemo(()=>l?{reference:y,floating:y}:{},[l,y])}function Mb(t,e,r,s,n,a,i,o,l,c=2){const u=Dd(r.current,{event:t,orientation:s,loopFocus:n,rtl:a,cols:c,disabledIndices:i,minIndex:o,maxIndex:l,prevIndex:e>l?o:e,stopEvent:!0});return ba(r.current,u)?void 0:u}var Gl=b.createContext(void 0),Yl=b.createContext(void 0),Xl=b.createContext(void 0),Ql=b.createContext(!1),Jl=b.createContext("");function Nt(){const t=b.useContext(Gl);if(!t)throw new Error(Lr(22));return t}function Tn(){const t=b.useContext(Yl);if(!t)throw new Error(Lr(23));return t}function xr(){const t=b.useContext(Xl);if(!t)throw new Error(Lr(24));return t}function hi(){return b.useContext(Jl)}function Ob(){return b.useContext(Ql)}var Fb=(t,e)=>Object.is(t,e);function Sr(t,e,r){return t==null||e==null?Object.is(t,e):r(t,e)}function Db(t,e,r){return!t||t.length===0?!1:t.some(s=>s===void 0?!1:Sr(e,s,r))}function Da(t,e,r){return!t||t.length===0?-1:t.findIndex(s=>s===void 0?!1:Sr(s,e,r))}function Lb(t,e,r){return t.filter(s=>!Sr(e,s,r))}function La(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function Zl(t){return t!=null&&t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"items"in t[0]}function Nb(t){if(!Array.isArray(t))return t!=null&&"null"in t;const e=t;if(Zl(e)){for(const r of e)for(const s of r.items)if(s&&s.value==null&&s.label!=null)return!0;return!1}for(const r of e)if(r&&r.value==null&&r.label!=null)return!0;return!1}function wt(t,e){if(e&&t!=null)return e(t)??"";if(t&&typeof t=="object"){if("label"in t&&t.label!=null)return String(t.label);if("value"in t)return String(t.value)}return La(t)}function cs(t,e){return e&&t!=null?e(t)??"":t&&typeof t=="object"&&"value"in t&&"label"in t?La(t.value):La(t)}var X={id:Ee(t=>t.id),labelId:Ee(t=>t.labelId),items:Ee(t=>t.items),selectedValue:Ee(t=>t.selectedValue),hasSelectionChips:Ee(t=>{const e=t.selectedValue;return Array.isArray(e)&&e.length>0}),hasSelectedValue:Ee(t=>{const{selectedValue:e,selectionMode:r}=t;return e==null?!1:r==="multiple"&&Array.isArray(e)?e.length>0:!0}),hasNullItemLabel:Ee((t,e)=>e?Nb(t.items):!1),open:Ee(t=>t.open),mounted:Ee(t=>t.mounted),forceMounted:Ee(t=>t.forceMounted),inline:Ee(t=>t.inline),activeIndex:Ee(t=>t.activeIndex),selectedIndex:Ee(t=>t.selectedIndex),isActive:Ee((t,e)=>t.activeIndex===e),isSelected:Ee((t,e)=>{const r=t.isItemEqualToValue,s=t.selectedValue;return Array.isArray(s)?s.some(n=>Sr(e,n,r)):Sr(e,s,r)}),transitionStatus:Ee(t=>t.transitionStatus),popupProps:Ee(t=>t.popupProps),inputProps:Ee(t=>t.inputProps),triggerProps:Ee(t=>t.triggerProps),itemProps:Ee(t=>t.itemProps),positionerElement:Ee(t=>t.positionerElement),listElement:Ee(t=>t.listElement),popupId:Ee(t=>t.popupId),triggerElement:Ee(t=>t.triggerElement),inputElement:Ee(t=>t.inputElement),inputGroupElement:Ee(t=>t.inputGroupElement),popupSide:Ee(t=>t.popupSide),openMethod:Ee(t=>t.openMethod),inputInsidePopup:Ee(t=>t.inputInsidePopup),inputOwnsFormValue:Ee(t=>t.inputOwnsFormValue),selectionMode:Ee(t=>t.selectionMode),name:Ee(t=>t.name),form:Ee(t=>t.form),disabled:Ee(t=>t.disabled),readOnly:Ee(t=>t.readOnly),required:Ee(t=>t.required),grid:Ee(t=>t.grid),virtualized:Ee(t=>t.virtualized),itemToStringLabel:Ee(t=>t.itemToStringLabel),isItemEqualToValue:Ee(t=>t.isItemEqualToValue),modal:Ee(t=>t.modal),autoHighlight:Ee(t=>t.autoHighlight),submitOnItemClick:Ee(t=>t.submitOnItemClick)};function ec(t){return t==null?void 0:`${t}-popup`}function jb(t,e){return(r,s)=>{if(r==null)return!1;const n=wt(r,e);return t.contains(n,s)}}function $b(t,e,r){return(s,n)=>{if(s==null)return!1;if(!n)return!0;const a=wt(s,e),i=r!=null?wt(r,e):"";return i&&t.contains(i,n)&&i.length===n.length?!0:t.contains(a,n)}}function tc(t){return Array.isArray(t)?t.map(e=>tc(e)).join(","):t==null?"":String(t)}var co=new Map;function Vb(t={}){const e={usage:"search",sensitivity:"base",ignorePunctuation:!0,...t},r=`${tc(t.locale)}|${JSON.stringify(e)}`,s=co.get(r);if(s)return s;const n=new Intl.Collator(t.locale,e),a={contains(i,o,l){if(!o)return!0;const c=wt(i,l);for(let u=0;u<=c.length-o.length;u+=1)if(n.compare(c.slice(u,u+o.length),o)===0)return!0;return!1},startsWith(i,o,l){if(!o)return!0;const c=wt(i,l);return n.compare(c.slice(0,o.length),o)===0},endsWith(i,o,l){if(!o)return!0;const c=wt(i,l),u=o.length;return c.length>=u&&n.compare(c.slice(c.length-u),o)===0}};return co.set(r,a),a}var rc=Vb;function Bb(t,e,r=(s,n)=>s===n){return t.length===e.length&&t.every((s,n)=>r(s,e[n]))}var sc=Symbol("none"),Ir={value:sc,index:-1},Ub=b.createContext(void 0);function ks(){return b.useContext(Ub)?.direction??"ltr"}function zb(t){const{id:e,onOpenChangeComplete:r,defaultSelectedValue:s=null,selectedValue:n,onSelectedValueChange:a,defaultInputValue:i,inputValue:o,open:l,defaultOpen:c=!1,selectionMode:u="none",onItemHighlighted:d,name:h,form:p,disabled:m=!1,readOnly:g=!1,required:v=!1,inputRef:_,grid:S=!1,items:y,filteredItems:w,filter:C,openOnInputClick:x=!0,autoHighlight:k=!1,keepHighlight:A=!1,highlightItemOnHover:P=!0,loopFocus:T=!0,itemToStringLabel:R,itemToStringValue:I,isItemEqualToValue:E=Fb,virtualized:M=!1,inl
26ine:F=!1,fillInputOnItemPress:$=!0,modal:O=!1,limit:D=-1,autoComplete:j="list",formAutoComplete:U,locale:q,submitOnItemClick:z=!1}=t,{clearErrors:K}=bd(),{setDirty:N,validityData:B,setFilled:ee,name:he,disabled:pe,setTouched:ge,setFocused:Fe,validationMode:de,validation:Le}=gn(),Me=ks(),Ie=Lo({id:e}),ke=rc({locale:q}),[Pe,me]=b.useState(!1),[Se,ie]=b.useState(null),le=b.useRef([]),we=b.useRef([]),De=b.useRef(null),se=b.useRef(null),W=b.useRef(null),L=b.useRef(null),te=b.useRef(null),G=b.useRef(!0),xe=b.useRef(!1),Ue=b.useRef(null),je=b.useRef(null),Ce=b.useRef(null),J=b.useRef(Ir),Oe=b.useRef(null),et=b.useRef([]),tt=b.useRef([]),rt=pe||m,st=he??h,_e=u==="multiple",Ve=u==="single",Ke=o!==void 0||i!==void 0,Je=y!==void 0,ae=w!==void 0;let ne;k==="always"?ne="always":ne=k?"input-change":!1;const[re,ze]=Qn({controlled:n,default:_e?s??us:s,name:"Combobox",state:"selectedValue"}),We=b.useMemo(()=>C===null?()=>!0:C!==void 0?C:Ve&&!Pe?$b(ke,R,re):jb(ke,R),[C,Ve,re,Pe,ke,R]),Te=ms(()=>Ke?i??"":Ve?wt(re,R):"").current,[He,Ct]=Qn({controlled:o,default:Te,name:"Combobox",state:"inputValue"}),[Xe,nr]=Qn({controlled:l,default:c,name:"Combobox",state:"open"}),ot=Zl(y),nt=Se??(He===""?"":String(He).trim()),Wt=Ve?wt(re,R):"",Ht=Ve&&!Pe&&nt!==""&&Wt!==""&&Wt.length===nt.length&&ke.contains(Wt,nt),jt=Ht?"":nt,$t=Je&&ae&&Ht,vt=b.useMemo(()=>y?ot?y.flatMap(Q=>Q.items):y:us,[y,ot]),ar=b.useMemo(()=>{if(w&&!$t)return w;if(!y)return us;if(ot){const ce=y,Ne=[];let Ze=0;for(const lt of ce){if(D>-1&&Ze>=D)break;const _t=jt===""?lt.items:lt.items.filter($r=>We($r,jt,R));if(_t.length===0)continue;const Mt=D>-1?D-Ze:1/0,Gt=_t.slice(0,Mt);if(Gt.length>0){const $r={...lt,items:Gt};Ne.push($r),Ze+=Gt.length}}return Ne}if(jt==="")return D>-1?vt.slice(0,D):vt;const Q=[];for(const ce of vt){if(D>-1&&Q.length>=D)break;We(ce,jt,R)&&Q.push(ce)}return Q},[w,$t,y,ot,jt,D,We,R,vt]),yt=b.useMemo(()=>ot?ar.flatMap(Q=>Q.items):ar,[ar,ot]),Ae=ms(()=>new Rd({id:Ie,labelId:void 0,selectedValue:re,open:Xe,filter:We,query:nt,items:y,selectionMode:u,listRef:le,labelsRef:we,popupRef:De,emptyRef:te,inputRef:se,startDismissRef:W,endDismissRef:L,keyboardActiveRef:G,chipsContainerRef:Ue,clearRef:je,valuesRef:et,allValuesRef:tt,selectionEventRef:Ce,name:st,form:p,disabled:rt,readOnly:g,required:v,grid:S,isGrouped:ot,virtualized:M,openOnInputClick:x,itemToStringLabel:R,isItemEqualToValue:E,modal:O,autoHighlight:ne,submitOnItemClick:z,hasInputValue:Ke,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:F,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},itemProps:va,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u==="none",onOpenChangeComplete:r||ir,setOpen:ir,setInputValue:ir,setSelectedValue:ir,setIndices:ir,onItemHighlighted:ir,handleSelection:ir,forceMount:ir,requestSubmit:ir})).current,Et=u==="none"?He:re,pr=b.useMemo(()=>u==="none"?Et:Array.isArray(re)?re.map(Q=>cs(Q,I)):cs(re,I),[Et,I,u,re]),Ar=qe(d),Kt=qe(r),mr=Y(Ae,X.activeIndex),hr=Y(Ae,X.selectedIndex),Vt=Y(Ae,X.positionerElement),kr=Y(Ae,X.listElement),Be=Y(Ae,X.triggerElement),ft=Y(Ae,X.inputElement),gr=Y(Ae,X.inputGroupElement),bt=Y(Ae,X.inline),Tt=Y(Ae,X.inputInsidePopup),jn=Y(Ae,X.inputOwnsFormValue),Tc=er(Be),{mounted:xi,setMounted:Mc,transitionStatus:$n}=jo(Xe),{openMethod:Ci,triggerProps:Vn}=Hd(Xe),Oc=qe(()=>pr);yd(Tt?Tc:se,Ie,Et,Oc,!rt,h);const Rs=qe(()=>{y?we.current=yt.map(Q=>wt(Q,R)):Ae.set("forceMounted",!0)}),Fc=b.useRef(re);$e(()=>{re!==Fc.current&&Rs()},[Rs,re]);const Bt=qe(Q=>{Ae.update(Q);const ce=Q.type||"none";if(Q.activeIndex!==void 0)if(Q.activeIndex===null)J.current!==Ir&&(J.current=Ir,Ar(void 0,as(ce,void 0,{index:-1})));else{const Ne=et.current[Q.activeIndex];J.current={value:Ne,index:Q.activeIndex},Ar(Ne,as(ce,void 0,{index:Q.activeIndex}))}}),Ut=qe((Q,ce)=>{if(xe.current=ce.reason===lr,t.onInputValueChange?.(Q,ce),!ce.isCanceled){if(ce.reason==="input-change"){const Ne=ce.event,Ze=Ne.inputType;if(Ne.type==="compositionend"||Ze!=null&&Ze!==""&&Ze!=="insertReplacementText"){const lt=Q.trim()!=="";lt&&me(!0),Oe.current={hasQuery:lt},lt&&ne&&Ae.state.activeIndex==null&&Ae.set("activeIndex",0)}}Ct(Q)}}),ns=qe((Q,ce)=>{if(Xe!==Q&&(ce.reason==="escape-key"&&Je&&yt.length===0&&!Ae.state.emptyRef.current&&ce.allowPropagation(),t.onOpenChange?.(Q,ce),!ce.isCanceled&&(Q&&_e&&Tt&&!bt&&Se!==null&&(me(!1),ie(null),He!==""&&Ut("",Ye(lr,ce.event))),!Q&&Pe&&(Ve?(bt||ie(nt),nt===""&&me(!1)):_e&&(bt||ie(nt),Tt&&Bt({activeIndex:null}),(!Tt||bt)&&Ut("",Ye(lr,ce.event)))),nr(Q),!Q&&Tt&&(ce.reason==="focus-out"||ce.reason==="outside-press")&&(ge(!0),Fe(!1),de==="onBlur")))){const Ne=u==="none"?He:re;Le.commit(Ne)}}),Ts=qe((Q,ce)=>{a?.(Q,ce),!ce.isCanceled&&(ze(Q),(u==="none"&&De.current&&$||Ve&&!Ae.state.inputInsidePopup)&&Ut(wt(Q,R),Ye(ce.reason,ce.event)),Ve&&Q!=null&&ce.reason!=="input-change"&&Pe&&!bt&&ie(nt))}),Dc=qe((Q,ce)=>{let Ne=ce;if(Ne===void 0){if(mr===null)return;Ne=et.current[mr]}const Ze=Gr(Q),lt=Ce.current??Q;Ce.current=null;const _t=Ye(xd,lt),Mt=Ze?.closest("a")?.getAttribute("href");if(Mt){Mt.startsWith("#")&&ns(!1,_t);return}if(_e){const Gt=Array.isArray(re)?re:[],$r=Db(Gt,Ne,Ae.state.isItemEqualToValue)?Lb(Gt,Ne,Ae.state.isItemEqualToValue):[...Gt,Ne];if(Ts($r,_t),_t.isCanceled||!(se.current&&se.current.value.trim()!==""))return;Ae.state.inputInsidePopup?Ut("",Ye(lr,_t.event)):ns(!1,_t)}else{if(Ts(Ne,_t),_t.isCanceled)return;ns(!1,_t)}}),Bn=qe(()=>{if(!Ae.state.submitOnItemClick)return;const Q=Le.inputRef.current?.form??Ae.state.inputElement?.form;Q&&typeof Q.requestSubmit=="function"&&Q.requestSubmit()}),Un=qe(()=>{if(Mc(!1),Kt?.(!1),me(!1),ie(null),Bt(u==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),_e&&se.current&&se.current.value!==""&&!xe.current&&Ut("",Ye(lr)),Ve)if(Ae.state.inputInsidePopup)se.current&&se.current.value!==""&&Ut("",Ye(lr));else{const Q=wt(re,R);se.current&&se.current.value!==Q&&Ut(Q,Ye(Q===""?lr:Jt))}}),Lc=b.useMemo(()=>bt&&Vt?{current:Vt.closest('[role="dialog"]')}:De,[bt,Vt]);Xa({enabled:!t.actionsRef,open:Xe,ref:Lc,onComplete(){Xe||Un()}}),b.useImperativeHandle(t.actionsRef,()=>({unmount:Un}),[Un]),$e(function(){if(Xe||u==="none")return;const ce=y?vt:tt.current;if(_e){const Ne=Array.isArray(re)?re:[],Ze=Ne[Ne.length-1],lt=Da(ce,Ze,E);Bt({selectedIndex:lt===-1?null:lt})}else{const Ne=Da(ce,re,E);Bt({selectedIndex:Ne===-1?null:Ne})}},[Xe,re,y,u,vt,_e,E,Bt]),$e(()=>{y&&(et.current=yt,le.current.length=yt.length)},[y,yt]),$e(()=>{const Q=Oe.current;if(Q&&(Q.hasQuery?ne&&Ae.set("activeIndex",0):ne==="always"&&Ae.set("activeIndex",0),Oe.current=null),!Xe&&!bt)return;const ce=Je||ae?yt:et.current,Ne=Ae.state.activeIndex;if(Ne==null){if(ne==="always"&&ce.length>0){Ae.set("activeIndex",0);return}J.current!==Ir&&(J.current=Ir,Ae.state.onItemHighlighted(void 0,as(Jt,void 0,{index:-1})));return}if(Ne>=ce.length){J.current!==Ir&&(J.current=Ir,Ae.state.onItemHighlighted(void 0,as(Jt,void 0,{index:-1}))),Ae.set("activeIndex",null);return}const Ze=ce[Ne],lt=J.current.value,_t=lt!==sc&&Sr(Ze,lt,Ae.state.isItemEqualToValue);(J.current.index!==Ne||!_t)&&(J.current={value:Ze,index:Ne},Ae.state.onItemHighlighted(Ze,as(Jt,void 0,{index:Ne})))},[mr,ne,ae,Je,yt,bt,Xe,Ae]),$e(()=>{if(u==="none"){ee(String(He)!=="");return}ee(_e?Array.isArray(re)&&re.length>0:re!=null)},[ee,u,He,re,_e]),b.useEffect(()=>{Je&&ne&&yt.length===0&&Bt({activeIndex:null})},[Je,ne,yt.length,Bt]);function Nc(Q){const ce=B.initialValue;return Array.isArray(Q)&&Array.isArray(ce)?!Bb(Q,ce,(Ne,Ze)=>Sr(Ne,Ze,E)):Q!==ce}Ns(nt,()=>{!Xe||nt===""||nt===String(Te)||me(!0)}),Ns(re,()=>{if(u!=="none"&&(K(st),N(Nc(re)),Le.change(re),Ve&&!Ke&&!Tt)){const Q=wt(re,R);He!==Q&&Ut(Q,Ye(Jt))}}),Ns(He,()=>{u==="none"&&(K(st),N(He!==B.initialValue),Le.change(He))}),Ns(y,()=>{if(!Ve||Ke||Tt||Pe)return;const Q=wt(re,R);He!==Q&&Ut(Q,Ye(Jt))});
26const Ms=Kl({open:bt?!0:Xe,onOpenChange:ns,elements:{reference:Tt?Be:ft,floating:Vt}});let zn,qn;bt||(zn=S?"grid":"listbox",qn=Xe?"true":"false");const Os=b.useMemo(()=>{const Q=ft?.tagName==="INPUT",ce=ft==null||Q,Ne=ce||Xe,Ze=ce?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ne&&(Ze.role="combobox",Ze["aria-expanded"]=qn,Ze["aria-haspopup"]=zn,Ze["aria-controls"]=Xe?kr?.id:void 0,Ze["aria-autocomplete"]=j),{reference:Ze,floating:{role:"presentation"}}},[ft,Xe,qn,zn,kr?.id,j]),Ai=Vo(Ms,{enabled:!g&&!rt&&x,event:"mousedown-only",toggle:!1,touchOpenDelay:Tt?0:100,reason:kd}),Fs=of(Ms,{enabled:!g&&!rt&&!bt,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:bt?!0:void 0,outsidePress(Q){const ce=Gr(Q);return!gt(Be,ce)&&!gt(je.current,ce)&&!gt(Ue.current,ce)&&!gt(gr,ce)}}),jr=Rb(Ms,{enabled:!g&&!rt,id:Ie,listRef:le,activeIndex:mr,selectedIndex:hr,virtual:!0,loopFocus:T,allowEscape:T&&!ne,focusItemOnOpen:Pe||u==="none"&&!ne?!1:"auto",focusItemOnHover:P,resetOnPointerLeave:!A,orientation:S?"horizontal":void 0,rtl:Me==="rtl",disabledIndices:us,grid:S?Mb:void 0,onNavigate(Q,ce){!ce&&!Xe||$n==="ending"||Bt(ce?{activeIndex:Q,type:G.current?"keyboard":"pointer"}:{activeIndex:Q})}}),Wn=b.useMemo(()=>Pi(jr.reference,{onKeyDown(Q){S&&Ae.state.activeIndex==null&&(Q.key==="ArrowLeft"||Q.key==="ArrowRight")&&Q.preventBaseUIHandler()}},Fs.reference,Ai.reference,Os.reference),[jr.reference,Fs.reference,Ai.reference,Os.reference,S,Ae]),Hn=b.useMemo(()=>Pi(lf,jr.floating,Fs.floating,Os.floating),[jr.floating,Fs.floating,Os.floating]),Kn=b.useMemo(()=>{const Q=jr.item;return Q?{...Q,onFocus:void 0}:va},[jr.item]);Ld(()=>{Ae.update({inline:F,popupProps:Hn,inputProps:Wn,triggerProps:Vn,itemProps:Kn,setOpen:ns,setInputValue:Ut,setSelectedValue:Ts,setIndices:Bt,onItemHighlighted:Ar,handleSelection:Dc,forceMount:Rs,requestSubmit:Bn})}),$e(()=>{Ae.update({id:Ie,selectedValue:re,open:Xe,mounted:xi,transitionStatus:$n,items:y,inline:F,popupProps:Hn,inputProps:Wn,triggerProps:Vn,openMethod:Ci,itemProps:Kn,selectionMode:u,name:st,form:p,disabled:rt,readOnly:g,required:v,grid:S,isGrouped:ot,virtualized:M,onOpenChangeComplete:Kt,openOnInputClick:x,itemToStringLabel:R,modal:O,autoHighlight:ne,isItemEqualToValue:E,submitOnItemClick:z,hasInputValue:Ke,requestSubmit:Bn,inputOwnsFormValue:u==="none"&&(F||!Ae.state.inputInsidePopup)})},[Ae,Ie,re,Xe,xi,$n,y,Hn,Wn,Kn,Ci,Vn,u,st,rt,g,v,Le,S,ot,M,Kt,x,R,O,E,z,Ke,F,Bn,ne,p]);const jc=wo(_,Le.inputRef),$c=b.useMemo(()=>({query:nt,hasItems:Je,filteredItems:ar,flatFilteredItems:yt}),[nt,Je,ar,yt]),Vc=b.useMemo(()=>Array.isArray(Et)?"":cs(Et,I),[Et,I]),Bc=_e&&Array.isArray(re)&&re.length>0,Gn=_e||u==="none"&&jn?void 0:st,Uc=b.useMemo(()=>!_e||!Array.isArray(re)||!st?null:re.map(Q=>{const ce=cs(Q,I);return(0,f.jsx)("input",{type:"hidden",form:p,name:st,value:ce,disabled:rt},ce)}),[_e,re,p,st,I,rt]),zc=(0,f.jsxs)(b.Fragment,{children:[t.children,(0,f.jsx)("input",{...Le.getValidationProps(rt,{onFocus(){if(Tt){Be?.focus();return}(se.current||Be)?.focus()},onChange(Q){if(Q.nativeEvent.defaultPrevented||rt||g)return;const ce=Q.currentTarget.value,Ne=ce.toLowerCase(),Ze=Ye(Jt,Q.nativeEvent),lt=()=>et.current.findIndex(Mt=>cs(Mt,I).toLowerCase()===Ne||wt(Mt,R).toLowerCase()===Ne);function _t(){if(_e)return;if(u==="none"){Ut(ce,Ze);return}let Mt=lt();Mt===-1&&(Mt=et.current.findIndex(($r,qc)=>{const ki=we.current[qc];return ki!=null&&ki.toLowerCase()===Ne}));const Gt=Mt===-1?void 0:et.current[Mt];Gt!=null&&Ts?.(Gt,Ze)}Ve&&(Rs(),y&&lt()===-1&&Ae.set("forceMounted",!0)),queueMicrotask(_t)}}),id:Ie&&Gn==null?`${Ie}-hidden-input`:void 0,form:p,name:Gn,autoComplete:U,disabled:rt,required:v&&!Bc,readOnly:g,value:Vc,ref:jc,style:Gn?$o:jd,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Uc]});return(0,f.jsx)(Gl.Provider,{value:Ae,children:(0,f.jsx)(Yl.Provider,{value:Ms,children:(0,f.jsx)(Ql.Provider,{value:Je,children:(0,f.jsx)(Xl.Provider,{value:$c,children:(0,f.jsx)(Jl.Provider,{value:He,children:zc})})})})})}function qb(t){const{openOnInputClick:e=!1,value:r,defaultValue:s,onValueChange:n,mode:a="list",itemToStringValue:i,...o}=t,l=a==="inline"||a==="both",c=a==="inline"||a==="none",u=r!==void 0,[d,h]=b.useState(s??""),[p,m]=b.useState("");b.useEffect(()=>{u&&m("")},[r,u]);let g;l&&p!==""?g=p:u?g=r??"":g=d;const v=rc(),_=b.useMemo(()=>o.filter!==void 0?o.filter:v.contains,[o.filter,v]),S=String(u?r:d).trim(),y=b.useMemo(()=>a!=="both"?c?null:_:_===null?null:(x,k,A)=>_(x,S,A),[_,a,S,c]);function w(x,k){m(""),u||h(x),n?.(x,k)}function C(x,k){t.onItemHighlighted?.(x,k),k.reason!=="pointer"&&(l?x==null?m(""):m(wt(x,i)):m(""))}return(0,f.jsx)(zb,{...o,itemToStringLabel:i,openOnInputClick:e,selectionMode:"none",fillInputOnItemPress:!0,filter:y,autoComplete:a,inputValue:g,defaultInputValue:s,onInputValueChange:w,onItemHighlighted:C})}var nc={...ef,...vd,popupSide:t=>t?{"data-popup-side":t}:null,listEmpty:t=>t?{"data-list-empty":""}:null};function Wb(t){const e=t.getBoundingClientRect(),r=To(t);if(rf)return e;const s=r.getComputedStyle(t,"::before"),n=r.getComputedStyle(t,"::after");if(!(s.content!=="none"||n.content!=="none"))return e;const a=parseFloat(s.width)||0,i=parseFloat(s.height)||0,o=parseFloat(n.width)||0,l=parseFloat(n.height)||0,c=Math.max(e.width,a,o),u=Math.max(e.height,i,l),d=c-e.width,h=u-e.height;return{left:e.left-d/2,right:e.right+d/2,top:e.top-h/2,bottom:e.bottom+h/2}}function ac(t,e){return t??e}var Gs=2,Hb=b.forwardRef(function(e,r){const{render:s,className:n,nativeButton:a=!0,disabled:i=!1,id:o,style:l,...c}
26=e,{state:u,disabled:d,setTouched:h,setFocused:p,validationMode:m,validation:g}=gn(),{labelId:v}=Do(),_=Nt(),{filteredItems:S}=xr(),y=Y(_,X.selectionMode),w=Y(_,X.disabled),C=Y(_,X.readOnly),x=Y(_,X.required),k=Y(_,X.mounted),A=Y(_,X.popupSide),P=Y(_,X.positionerElement),T=Y(_,X.listElement),R=Y(_,X.popupId),I=Y(_,X.triggerProps),E=Y(_,X.triggerElement),M=Y(_,X.inputInsidePopup),F=Y(_,X.id),$=Y(_,X.labelId),O=Y(_,X.open),D=Y(_,X.selectedValue),j=Y(_,X.activeIndex),U=Y(_,X.selectedIndex),q=Y(_,X.hasSelectedValue),z=Tn(),K=hi(),N=Fr(),B=d||w||i,ee=S.length===0,he=k&&P?A:null;Lo({id:M?o:void 0});const pe=M?o??F:o,ge=ac(v,$);let Fe;O&&M?Fe=R??ec(F):O&&(Fe=T?.id);const de=b.useRef("");function Le(le){de.current=le.pointerType}const Me=z.useState("domReferenceElement");b.useEffect(()=>{M&&E&&E!==Me&&z.set("domReferenceElement",E)},[E,Me,z,M]);const{reference:Ie}=Tb(z,{enabled:!O&&!C&&!w&&y==="single",listRef:_.state.labelsRef,activeIndex:j,selectedIndex:U,onMatch(le){const we=_.state.valuesRef.current[le];we!==void 0&&_.state.setSelectedValue(we,Ye("none"))}}),{reference:ke}=Vo(z,{enabled:!C&&!w,event:"mousedown"}),{buttonRef:Pe,getButtonProps:me}=vn({native:a,disabled:B}),Se={...u,open:O,disabled:B,popupSide:he,listEmpty:ee,placeholder:y==="none"?!1:!q},ie=qe(le=>{_.set("triggerElement",le)});return It("button",e,{ref:[r,Pe,ie],state:Se,props:[I,ke,Ie,{id:pe,tabIndex:M?0:-1,role:M?"combobox":void 0,"aria-expanded":O?"true":"false","aria-haspopup":M?"dialog":"listbox","aria-controls":Fe,"aria-required":M&&x||void 0,"aria-labelledby":ge,onPointerDown:Le,onPointerEnter:Le,onFocus(){p(!0),!(B||C)&&N.start(0,_.state.forceMount)},onBlur(le){if(!gt(P,le.relatedTarget)&&(h(!0),p(!1),m==="onBlur")){const we=y==="none"?K:D;g.commit(we)}},onMouseDown(le){if(B||C||(M||z.set("domReferenceElement",le.currentTarget),_.state.forceMount(),de.current!=="touch"&&(_.state.inputRef.current?.focus(),M||le.preventDefault()),O))return;const we=Yr(le.currentTarget);function De(se){if(!E)return;const W=Gr(se),L=_.state.positionerElement,te=_.state.listElement;if(gt(E,W)||gt(L,W)||gt(te,W)||W===E)return;const G=Wb(E),xe=se.clientX>=G.left-Gs&&se.clientX<=G.right+Gs,Ue=se.clientY>=G.top-Gs&&se.clientY<=G.bottom+Gs;xe&&Ue||_.state.setOpen(!1,Ye("cancel-open",se))}M&&we.addEventListener("mouseup",De,{once:!0})},onKeyDown(le){B||C||(le.key==="ArrowDown"||le.key==="ArrowUp")&&(kt(le),_.state.setOpen(!0,Ye(ya,le.nativeEvent)),_.state.inputRef.current?.focus())}},g?g.getValidationProps(B,c):c,me],stateAttributesMapping:nc})}),Kb=Hb,Gb=b.createContext(void 0);function Yb(){return b.useContext(Gb)}var ic=b.createContext(void 0);function gi(t){const e=b.useContext(ic);if(e===void 0&&!t)throw new Error(Lr(21));return e}var oc=b.forwardRef(function(e,r){const s=Nt(),{buttonRef:n,getButtonProps:a}=vn({native:!1}),i=wo(r,n);function o(c){s.state.setOpen(!1,Ye(Cd,c.nativeEvent,c.currentTarget))}const l=a({onClick:o});return(0,f.jsx)("span",{ref:i,...l,"aria-label":"Dismiss",tabIndex:void 0,style:$o})}),Xb=b.forwardRef(function(e,r){const{render:s,className:n,disabled:a=!1,id:i,style:o,...l}=e,{state:c,disabled:u,setTouched:d,setFocused:h,validationMode:p,validation:m}=gn(),{labelId:g}=Do(),v=Yb(),S=!!gi(!0),y=Nt(),{filteredItems:w}=xr(),C=hi(),x=ks(),k=Y(y,X.required),A=Y(y,X.disabled),P=Y(y,X.readOnly),T=Y(y,X.name),R=Y(y,X.form),I=Y(y,X.selectionMode),E=Y(y,X.autoHighlight),M=Y(y,X.inputProps),F=Y(y,X.triggerProps),$=Y(y,X.open),O=Y(y,X.mounted),D=Y(y,X.selectedValue),j=Y(y,X.popupSide),U=Y(y,X.positionerElement),q=Y(y,X.id),z=Y(y,X.inline),K=Y(y,X.modal),N=!!E,B=O&&U?j:null,ee=u||A||a,he=w.length===0,pe=S||z,ge=!pe||K,Fe=Fo(i??(pe?void 0:q)),de=ac(g,void 0),Le=S?Sd:c,[Me,Ie]=b.useState(null),ke=b.useRef(!1),Pe=b.useRef(null),me=b.useRef(!1),Se=I==="none"&&!S,ie=qe(L=>{const te=S||y.state.inline;te&&!y.state.hasInputValue&&y.state.setInputValue("",Ye(Jt)),y.update({inputElement:L,inputInsidePopup:te,inputOwnsFormValue:Se})}),le=S||!m?l:m.getValidationProps(ee,l),we={...Le,open:$,disabled:ee,readOnly:P,popupSide:B,listEmpty:he};function De(L){if(!v)return;let te;const{highlightedChipIndex:G}=v,xe=v.chipsRef.current.length,Ue=x==="rtl",je=Ue?"ArrowRight":"ArrowLeft",Ce=Ue?"ArrowLeft":"ArrowRight";if(G!==void 0){if(L.key===je)L.preventDefault(),G>0?te=G-1:te=void 0;else if(L.key===Ce)L.preventDefault(),G<xe-1?te=G+1:te=void 0;else if(L.key==="Backspace"||L.key==="Delete"){L.preventDefault();const J=G>=D.length-1?D.length-2:G;te=J>=0?J:void 0,y.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return te}return L.key===je&&(L.currentTarget.selectionStart??0)===0&&D.length>0?(L.preventDefault(),te=xe>0?xe-1:void 0):L.key==="Backspace"&&L.currentTarget.value===""&&D.length>0&&(y.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),L.preventDefault()),te}const se=It("input",e,{state:we,ref:[r,y.state.inputRef,ie],props:[M,F,{type:"text",value:e.value??Me??C,"aria-readonly":P||void 0,"aria-required":k||void 0,"aria-labelledby":de,disabled:ee,readOnly:P,required:I==="none"?k:void 0,form:R,...Se&&T&&{name:T},id:Fe,onFocus(){if(h(!0),!z||!me.current)return;me.current=!1;const L=Pe.current;L==null||!Object.hasOwn(y.state.valuesRef.current,L)||y.state.setIndices({activeIndex:L})},onBlur(){d(!0),h(!1);const L=y.state.activeIndex;if(z&&L!==null&&E!=="always"&&(Pe.current=L,me.current=!0,y.state.setIndices({activeIndex:null})),p==="onBlur"){const te=I==="none"?C:D;m.commit(te)}},onCompositionStart(L){Gd||(ke.current=!0,Ie(L.currentTarget.value))},onCompositionEnd(L){ke.current=!1;const te=L.currentTarget.value;Ie(null),y.state.setInputValue(te,Ye(Ds,L.nativeEvent))},onChange(L){const te=L.nativeEvent.inputType,G=!te||te==="insertReplacementText",xe=ke.current||!G;if(ke.current){const Oe=L.currentTarget.value;
26Ie(Oe),Oe===""&&!y.state.openOnInputClick&&!y.state.inputInsidePopup&&y.state.setOpen(!1,Ye(lr,L.nativeEvent));const et=Oe.trim(),tt=N&&et!=="";!P&&!ee&&et&&xe&&(y.state.setOpen(!0,Ye(Ds,L.nativeEvent)),N||y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})),$&&y.state.activeIndex!==null&&!tt&&y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"});return}const Ue=Ye(Ds,L.nativeEvent);if(y.state.setInputValue(L.currentTarget.value,Ue),Ue.isCanceled)return;const je=L.currentTarget.value==="",Ce=Ye(lr,L.nativeEvent);je&&!y.state.inputInsidePopup&&(I==="single"&&y.state.setSelectedValue(null,Ce),y.state.openOnInputClick||y.state.setOpen(!1,Ce));const J=L.currentTarget.value.trim();!P&&!ee&&J&&xe&&(y.state.setOpen(!0,Ye(Ds,L.nativeEvent)),N||y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})),$&&y.state.activeIndex!==null&&!N&&y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(L){if(ee||P||L.ctrlKey||L.shiftKey||L.altKey||L.metaKey)return;y.state.keyboardActiveRef.current=!0;const te=L.currentTarget,G=te.scrollWidth-te.clientWidth,xe=x==="rtl";if(L.key==="Home"){kt(L);const Ce=Oi&&xe?te.value.length:0;te.setSelectionRange(Ce,Ce),te.scrollLeft=0;return}if(L.key==="End"){kt(L);const Ce=Oi&&xe?0:te.value.length;te.setSelectionRange(Ce,Ce),te.scrollLeft=xe?-G:G;return}if(!O&&L.key==="Escape"){const Ce=I==="multiple"&&Array.isArray(D)?D.length===0:D===null,J=Ye(wd,L.nativeEvent),Oe=I==="multiple"?[]:null;y.state.setInputValue("",J),y.state.setSelectedValue(Oe,J),!Ce&&!y.state.inline&&!J.isPropagationAllowed&&L.stopPropagation();return}if(v&&L.key==="Backspace"&&te.value===""&&v.highlightedChipIndex===void 0&&Array.isArray(D)&&D.length>0){const Ce=v.chipsRef.current.length,J=Ce>0?Ce-1:D.length-1,Oe=D.filter((et,tt)=>tt!==J);y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"}),y.state.setSelectedValue(Oe,Ye(Jt,L.nativeEvent));return}const Ue=v?.highlightedChipIndex!==void 0,je=De(L);if(v?.setHighlightedChipIndex(je),je!==void 0?v?.chipsRef.current[je]?.focus():Ue&&y.state.inputRef.current?.focus(),L.which!==229&&L.key==="Enter"&&$){const Ce=y.state.activeIndex,J=L.nativeEvent;if(Ce===null){if(z)return;y.state.setOpen(!1,Ye(Jt,J));return}kt(L);const Oe=y.state.listRef.current[Ce];Oe&&(y.state.selectionEventRef.current=J,Oe.click(),y.state.selectionEventRef.current=null)}},onPointerMove(){y.state.keyboardActiveRef.current=!1},onPointerDown(){y.state.keyboardActiveRef.current=!1}},le],stateAttributesMapping:nc}),W=S?(0,f.jsx)(gd.Provider,{value:_d,children:se}):se;return(0,f.jsxs)(b.Fragment,{children:[$&&ge&&(0,f.jsx)(oc,{ref:y.state.startDismissRef}),W]})}),Qb={...Ho,...Qd},Jb=b.forwardRef(function(e,r){const{render:s,className:n,disabled:a=!1,nativeButton:i=!0,keepMounted:o=!1,style:l,...c}=e,{disabled:u}=gn(),d=Nt(),h=Y(d,X.selectionMode),p=Y(d,X.disabled),m=Y(d,X.readOnly),g=Y(d,X.open),v=Y(d,X.selectedValue),_=Y(d,X.hasSelectionChips),S=hi();let y=!1;h==="none"?y=S!=="":h==="single"?y=v!=null:y=_;const w=u||p||a,{buttonRef:C,getButtonProps:x}=vn({native:i,disabled:w}),{mounted:k,transitionStatus:A,setMounted:P}=jo(y),T={disabled:w,visible:y,open:g,transitionStatus:A};Xa({open:y,ref:d.state.clearRef,onComplete(){y||P(!1)}});const R=It("button",e,{state:T,ref:[r,C,d.state.clearRef],props:[{tabIndex:-1,children:"x",onMouseDown(I){I.preventDefault()},onClick(I){if(w||m)return;const E=d.state.keyboardActiveRef;d.state.setInputValue("",Ye(Mi,I.nativeEvent)),h!=="none"?(d.state.setSelectedValue(Array.isArray(v)?[]:null,Ye(Mi,I.nativeEvent)),d.state.setIndices({activeIndex:null,selectedIndex:null,type:E.current?"keyboard":"pointer"})):d.state.setIndices({activeIndex:null,type:E.current?"keyboard":"pointer"}),d.state.inputRef.current?.focus()}},c,x],stateAttributesMapping:Qb});return o||k?R:null}),Zb=b.createContext(null);function e0(){return b.useContext(Zb)}function t0(t){const{children:e}=t,{filteredItems:r}=xr(),s=e0(),n=s?s.items:r;return n?(0,f.jsx)(b.Fragment,{children:n.map(e)}):null}var lc=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function r0(){return b.useContext(lc)}function s0(t){const{children:e,elementsRef:r,labelsRef:s,onMapChange:n}=t,a=qe(n),i=b.useRef(0),o=ms(a0).current,l=ms(n0).current,[c,u]=b.useState(0),d=b.useRef(c),h=qe((_,S)=>{l.set(_,S??null),d.current+=1,u(d.current)}),p=qe(_=>{l.delete(_),d.current+=1,u(d.current)}),m=b.useMemo(()=>{const _=new Map;return Array.from(l.keys()).filter(S=>
26S.isConnected).sort(i0).forEach((S,y)=>{const w=l.get(S)??{};_.set(S,{...w,index:y})}),_},[l,c]);$e(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const _=new MutationObserver(S=>{const y=new Set,w=C=>y.has(C)?y.delete(C):y.add(C);S.forEach(C=>{C.removedNodes.forEach(w),C.addedNodes.forEach(w)}),y.size===0&&(d.current+=1,u(d.current))});return m.forEach((S,y)=>{y.parentElement&&_.observe(y.parentElement,{childList:!0})}),()=>{_.disconnect()}},[m]),$e(()=>{d.current===c&&(r.current.length!==m.size&&(r.current.length=m.size),s&&s.current.length!==m.size&&(s.current.length=m.size),i.current=m.size),a(m)},[a,m,r,s,c]),$e(()=>()=>{r.current=[]},[r]),$e(()=>()=>{s&&(s.current=[])},[s]);const g=qe(_=>(o.add(_),()=>{o.delete(_)}));$e(()=>{o.forEach(_=>_(m))},[o,m]);const v=b.useMemo(()=>({register:h,unregister:p,subscribeMapChange:g,elementsRef:r,labelsRef:s,nextIndexRef:i}),[h,p,g,r,s,i]);return(0,f.jsx)(lc.Provider,{value:v,children:e})}function n0(){return new Map}function a0(){return new Set}function i0(t,e){const r=t.compareDocumentPosition(e);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}var o0=b.forwardRef(function(e,r){var s;const{render:n,className:a,style:i,children:o,...l}=e,c=Nt(),u=Tn(),d=!!gi(!0),{filteredItems:h,hasItems:p}=xr(),m=Y(c,X.selectionMode),g=Y(c,X.grid),v=Y(c,X.popupProps),_=Y(c,X.virtualized),S=Y(c,X.forceMounted),y=m==="multiple",w=h.length===0,C=qe(I=>{c.set("positionerElement",I)}),x=qe(I=>{c.set("listElement",I)}),k=b.useMemo(()=>typeof o=="function"?s||(s=(0,f.jsx)(t0,{children:o})):o,[o]),A={empty:w},P=u.useState("floatingId"),T=It("div",e,{state:A,ref:[r,x,d?null:C],props:[v,{children:k,tabIndex:-1,id:P,role:g?"grid":"listbox","aria-multiselectable":y?"true":void 0,onKeyDown(I){if(!(c.state.disabled||c.state.readOnly)&&I.key==="Enter"){const E=c.state.activeIndex;if(E==null)return;kt(I);const M=I.nativeEvent,F=c.state.listRef.current[E];F&&(c.state.selectionEventRef.current=M,F.click(),c.state.selectionEventRef.current=null)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},l]});if(_)return T;const R=p&&!S?void 0:c.state.labelsRef;return(0,f.jsx)(s0,{elementsRef:c.state.listRef,labelsRef:R,children:T})}),l0="⁠";function c0(t){const e=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);let r=null;for(;e.nextNode();){const s=e.currentNode;s.nodeValue!==""&&(r=s)}return r}function cc(){const t=Fr(),e=b.useRef(null);return b.useEffect(()=>{if(zd)return;const r=e.current;if(r==null)return;const s=c0(r);if(s==null)return;const n=s.nodeValue??"",a=`${n}${l0}`;return s.nodeValue=a,t.start(200,()=>{s.nodeValue===a&&(s.nodeValue=n)}),()=>{t.clear(),s.nodeValue===a&&(s.nodeValue=n)}},[e,t]),e}var u0=b.forwardRef(function(e,r){const{render:s,className:n,style:a,children:i,...o}=e,l=cc();return It("div",e,{ref:[r,l],props:[{children:i,role:"status","aria-live":"polite","aria-atomic":!0},o]})}),uc=b.createContext(void 0);function d0(){const t=b.useContext(uc);if(t===void 0)throw new Error(Lr(20));return t}var f0=b.forwardRef(function(e,r){const{keepMounted:s=!1,...n}=e,a=Nt(),i=Y(a,X.mounted),o=Y(a,X.forceMounted);return i||s||o?(0,f.jsx)(uc.Provider,{value:s,children:(0,f.jsx)(Od,{ref:r,...n})}):null}),p0=t=>({name:"arrow",options:t,async fn(e){const{x:r,y:s,placement:n,rects:a,platform:i,elements:o,middlewareData:l}=e,{element:c,padding:u=0,offsetParent:d="real"}=Lu(t,e)||{};if(c==null)return{};const h=qu(u),p={x:r,y:s},m=zu(n),g=Uu(m),v=await i.getDimensions(c),_=m==="y",S=_?"top":"left",y=_?"bottom":"right",w=_?"clientHeight":"clientWidth",C=a.reference[g]+a.reference[m]-p[m]-a.floating[g],x=p[m]-a.reference[m],k=d==="real"?await i.getOffsetParent?.(c):o.floating;let A=o.floating[w]||a.floating[g];(!A||!await i.isElement?.(k))&&(A=o.floating[w]||a.floating[g]);const P=C/2-x/2,T=A/2-v[g]/2-1,R=Math.min(h[S],T),I=Math.min(h[y],T),E=R,M=A-v[g]-I,F=A/2-v[g]/2+P,$=Du(E,F,M),O=!l.arrow&&Ya(n)!=null&&F!==$&&a.reference[g]/2-(F<E?R:I)-v[g]/2<0,D=O?F<E?F-E:F-M:0;return{[m]:p[m]+D,data:{[m]:$,centerOffset:F-$-D,...O&&{alignmentOffset:D}},reset:O}}}),m0=(t,e)=>({...p0(t),options:[t,e]}
26),h0=$u().fn,g0={name:"hide",async fn(t){const{width:e,height:r,x:s,y:n}=t.rects.reference,a=e===0&&r===0&&s===0&&n===0;return{data:{referenceHidden:(await h0(t)).data?.referenceHidden||a}}}},v0={sideX:"left",sideY:"top"};function dc(t,e,r){const s=t==="inline-start"||t==="inline-end";return{top:"top",right:s?r?"inline-start":"inline-end":"right",bottom:"bottom",left:s?r?"inline-end":"inline-start":"left"}[e]}function uo(t,e,r){const{rects:s,placement:n}=t;return{side:dc(e,Qs(n),r),align:Ya(n)||"center",anchor:{width:s.reference.width,height:s.reference.height},positioner:{width:s.floating.width,height:s.floating.height}}}function y0(t){const{anchor:e,positionMethod:r="absolute",side:s="bottom",sideOffset:n=0,align:a="center",alignOffset:i=0,collisionBoundary:o,collisionPadding:l=5,sticky:c=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:h,keepMounted:p=!1,floatingRootContext:m,mounted:g,collisionAvoidance:v,shiftCrossAxis:_=!1,nodeId:S,adaptiveOrigin:y,lazyFlip:w=!1,externalTree:C}=t,[x,k]=b.useState(null);!g&&x!==null&&k(null);const A=v.side||"flip",P=v.align||"flip",T=v.fallbackAxisSide||"end",R=typeof e=="function"?e:void 0,I=qe(R),E=R?I:e,M=er(e),F=er(g),$=ks()==="rtl",O=x||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":$?"left":"right","inline-start":$?"right":"left"}[s],D=a==="center"?O:`${O}-${a}`;let j=l;const U=1,q=s==="bottom"?U:0,z=s==="top"?U:0,K=s==="right"?U:0,N=s==="left"?U:0;typeof j=="number"?j={top:j+q,right:j+N,bottom:j+z,left:j+K}:j&&(j={top:(j.top||0)+q,right:(j.right||0)+N,bottom:(j.bottom||0)+z,left:(j.left||0)+K});const B={boundary:o==="clipping-ancestors"?"clippingAncestors":o,padding:j},ee=b.useRef(null),he=er(n),pe=er(i),ge=typeof n!="function"?n:0,Fe=typeof i!="function"?i:0,de=[];h&&de.push(h),de.push(Tu(_e=>{const Ve=uo(_e,s,$),Ke=typeof he.current=="function"?he.current(Ve):he.current,Je=typeof pe.current=="function"?pe.current(Ve):pe.current;return{mainAxis:Ke,crossAxis:Je,alignmentAxis:Je}},[ge,Fe,$,s]));const Le=P==="none"&&A!=="shift",Me=!Le&&(c||_||A==="shift"),Ie=A==="none"?null:Ou({...B,padding:{top:j.top+U,right:j.right+U,bottom:j.bottom+U,left:j.left+U},mainAxis:!_&&A==="flip",crossAxis:P==="flip"?"alignment":!1,fallbackAxisSideDirection:T}),ke=Le?null:Ju(_e=>{const Ve=Yr(_e.elements.floating).documentElement;return{...B,rootBoundary:_?{x:0,y:0,width:Ve.clientWidth,height:Ve.clientHeight}:void 0,mainAxis:P!=="none",crossAxis:Me,limiter:c||_?void 0:Zu(Ke=>{if(!ee.current)return{};const{width:Je,height:ae}=ee.current.getBoundingClientRect(),ne=Ei(Qs(Ke.placement)),re=ne==="y"?Je:ae,ze=ne==="y"?j.left+j.right:j.top+j.bottom;return{offset:re/2+ze/2}})}},[B,c,_,j,P]);A==="shift"||P==="shift"||a==="center"?de.push(ke,Ie):de.push(Ie,ke),de.push(Nu({...B,apply({elements:{floating:_e},availableWidth:Ve,availableHeight:Ke,rects:Je}){if(!F.current)return;const ae=_e.style;ae.setProperty("--available-width",`${Ve}px`),ae.setProperty("--available-height",`${Ke}px`);const ne=To(_e).devicePixelRatio||1,{x:re,y:ze,width:We,height:Te}=Je.reference,He=(Math.round((re+We)*ne)-Math.round(re*ne))/ne,Ct=(Math.round((ze+Te)*ne)-Math.round(ze*ne))/ne;ae.setProperty("--anchor-width",`${He}px`),ae.setProperty("--anchor-height",`${Ct}px`)}}),m0(_e=>({element:ee.current||Yr(_e.elements.floating).createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(_e){const{elements:Ve,middlewareData:Ke,placement:Je,rects:ae,y:ne}=_e,re=Qs(Je),ze=Ei(re),We=ee.current,Te=Ke.arrow?.x||0,He=Ke.arrow?.y||0,
26Ct=We?.clientWidth||0,Xe=We?.clientHeight||0,nr=Te+Ct/2,ot=He+Xe/2,nt=Math.abs(Ke.shift?.y||0),Wt=ae.reference.height/2,Ht=typeof n=="function"?n(uo(_e,s,$)):n,jt=nt>Ht,$t={top:`${nr}px calc(100% + ${Ht}px)`,bottom:`${nr}px ${-Ht}px`,left:`calc(100% + ${Ht}px) ${ot}px`,right:`${-Ht}px ${ot}px`}[re],vt=`${nr}px ${ae.reference.y+Wt-ne}px`;return Ve.floating.style.setProperty("--transform-origin",Me&&ze==="y"&&jt?vt:$t),{}}},g0,y),$e(()=>{!g&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,m]);const Pe=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<"u",layoutShift:!d&&typeof IntersectionObserver<"u"}),[d]),{refs:me,elements:Se,x:ie,y:le,middlewareData:we,update:De,placement:se,context:W,isPositioned:L,floatingStyles:te}=kb({rootContext:m,open:p?g:void 0,placement:D,middleware:de,strategy:r,whileElementsMounted:p?void 0:(..._e)=>Ti(..._e,Pe),nodeId:S,externalTree:C}),{sideX:G,sideY:xe}=we.adaptiveOrigin||v0,Ue=L?r:"fixed",je=b.useMemo(()=>{const _e=y?{position:Ue,[G]:ie,[xe]:le}:{position:Ue,...te};return L||(_e.opacity=0),_e},[y,Ue,G,ie,xe,le,te,L]),Ce=b.useRef(null);$e(()=>{if(!g)return;const _e=M.current,Ve=typeof _e=="function"?_e():_e,Ke=(fo(Ve)?Ve.current:Ve)||null;Ke!==Ce.current&&(me.setPositionReference(Ke),Ce.current=Ke)},[g,me,E,M]),b.useEffect(()=>{if(!g)return;const _e=M.current;typeof _e!="function"&&fo(_e)&&_e.current!==Ce.current&&(me.setPositionReference(_e.current),Ce.current=_e.current)},[g,me,E,M]),b.useEffect(()=>{if(p&&g&&Se.reference&&Se.floating)return Ti(Se.reference,Se.floating,De,Pe)},[p,g,Se,De,Pe]);const J=Qs(se),Oe=dc(s,J,$),et=Ya(se)||"center",tt=!!we.hide?.referenceHidden;$e(()=>{w&&g&&L&&k(J)},[w,g,L,J]);const rt=b.useMemo(()=>({position:"absolute",top:we.arrow?.y,left:we.arrow?.x}),[we.arrow]),st=we.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:je,arrowStyles:rt,arrowRef:ee,arrowUncentered:st,side:Oe,align:et,physicalSide:J,anchorHidden:tt,refs:me,context:W,isPositioned:L,update:De}),[je,rt,ee,st,Oe,et,J,tt,me,W,L,De])}function fo(t){return t!=null&&"current"in t}function fc(t){return t==="starting"?Md:va}function b0(t,e,{styles:r,transitionStatus:s,props:n,refs:a,hidden:i,inert:o=!1}){const l={...r};return o&&(l.pointerEvents="none"),It("div",t,{state:e,ref:a,props:[{role:"presentation",hidden:i,style:l},fc(s),n],stateAttributesMapping:zo})}var _0=20;function S0(t,e,r,s){const[n,a]=b.useState(!1);$e(()=>{if(!t||!e||r==null){a(!1);return}const i=Yr(r).documentElement.clientWidth,o=r.offsetWidth;a(i>0&&o>0&&o>=i-_0)},[t,e,r]),Xd(t&&(!e||n),s)}var w0=b.forwardRef(function(e,r){const{render:s,className:n,anchor:a,positionMethod:i="absolute",side:o="bottom",align:l="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:d="clipping-ancestors",collisionPadding:h=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:g=!1,collisionAvoidance:v=$d,style:_,...S}=e,y=Nt(),{filteredItems:w}=xr(),C=Tn(),x=d0(),k=Y(y,X.modal),A=Y(y,X.open),P=Y(y,X.mounted),T=Y(y,X.openMethod),R=Y(y,X.positionerElement),I=Y(y,X.triggerElement),E=Y(y,X.inputElement),M=Y(y,X.inputGroupElement),F=Y(y,X.inputInsidePopup),$=Y(y,X.transitionStatus),O=w.length===0,D=y0({anchor:a??(F?I:M??E),floatingRootContext:C,positionMethod:i,mounted:P,side:o,sideOffset:c,align:l,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:h,sticky:m,disableAnchorTracking:g,keepMounted:x,collisionAvoidance:v,lazyFlip:!0});S0(A&&k,T==="touch",R,I);const j={open:A,side:D.side,align:D.align,anchorHidden:D.anchorHidden,empty:O};$e(()=>{y.set("popupSide",D.side)},[y,D.side]);const U=qe(z=>{y.set("positionerElement",z)}),q=b0(e,j,{styles:D.positionerStyles,transitionStatus:$,props:S,refs:[r,U],hidden:!P,inert:!A});return(0,f.jsxs)(ic.Provider,{value:D,children:[P&&k&&(0,f.jsx)(nf,{inert:Wd(!A),cutout:M??E??I}),q]})}),x0={...zo,...Ho},C0=b.forwardRef(function(e,r){const{render:s,className:n,style:a,initialFocus:i,finalFocus:o,...l}=e,c=Nt(),u=gi(),d=Tn(),{filteredItems:h}=xr(),p=Y(c,X.mounted),m=Y(c,X.open),g=Y(c,X.openMethod),v=Y(c,X.transitionStatus),_=Y(c,X.inputInsidePopup),S=Y(c,X.inputElement),y=Y(c,X.modal),w=Y(c,X.id),C=h.length===0,x=l.id??(_?ec(w):void 0);$e(()=>(c.set("popupId",c.state.popupRef.current?.id||x),()=>{c.set("popupId",void 0)}),[c,x]),Xa({open:m,ref:c.state.popupRef,onComplete(){m&&c.state.onOpenChangeComplete(!0)}});const k={open:m,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:v,empty:C},A=It("div",e,{state:k,ref:[r,c.state.popupRef],props:[{id:x,role:_?"dialog":"presentation",tabIndex:-1,onFocus(I){const E=Gr(I.nativeEvent);g!=="touch"&&(gt(c.state.listElement,E)||E===I.currentTarget)&&c.state.inputRef.current?.focus()}},fc(v),l],stateAttributesMapping:x0}),P=i===void 0?_?I=>I==="touch"?c.state.popupRef.current:S:!1:i;let T;o!=null?T=o:T=_?void 0:!1;const R=!_||y;return(0,f.jsx)(Td,{context:d,disabled:!p,modal:R,openInteractionType:g,initialFocus:P,returnFocus:T,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,f.jsxs)(b.Fragment,{children:[A,R&&(0,f.jsx)(oc,{ref:c.state.endDismissRef})]})})}),pc=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function A0(t={}){const{label:e,metadata:r,textRef:s,indexGuessBehavior:n,index:a}=t,{register:i,unregister:o,subscribeMapChange:l,elementsRef:c,labelsRef:u,nextIndexRef:d}=r0(),h=b.useRef(-1),[p,m]=b.useState(a??(n===pc.GuessFromOrder?()=>{if(h.current===-1){const _=d.current;d.current+=1,h.current=_}return h.current}:-1)),g=b.useRef(null),v=b.useCallback(_=>{if(g.current=_,p!==-1&&_!==null&&(c.current[p]=_,u)){const S=e!==void 0;u.current[p]=S?e:s?.current?.textContent??_.textContent}},[p,c,u,e,s]);return $e(()=>{if(a!=null)return;const _=g.current;if(_)return i(_,r),()=>{o(_)}},[a,i,o,r]),$e(()=>{if(a==null)return l(_=>{const S=g.current?_.get(g.current)?.index:null;S!=null&&m(S)})},[a,l,m]),{ref:v,index:p}}var k0=b.createContext(void 0),I0=b.createContext(!1);function P0(){return b.useContext(I0)}var E0=za(Wc(),1);function mc(t){const{componentProps:e,forwardedRef:r,virtualized:s,indexFromFilter:n}
26=t,{render:a,className:i,style:o,value:l=null,index:c,disabled:u=!1,nativeButton:d=!1,...h}=e,p=b.useRef(!1),m=b.useRef(null),g=A0({index:c,textRef:m,indexGuessBehavior:pc.GuessFromOrder}),v=Nt(),_=P0(),S=Ob(),y=Y(v,X.open),w=Y(v,X.selectionMode),C=Y(v,X.readOnly),x=Y(v,X.isItemEqualToValue),k=w!=="none",A=c??(s?n??-1:g.index),P=g.index!==-1,T=Y(v,X.id),R=Y(v,X.isActive,A),I=Y(v,X.isSelected,l),E=Y(v,X.itemProps),M=b.useRef(null),F=T!=null&&P?`${T}-${A}`:void 0,$=I&&k;$e(()=>{if(!(P&&(s||c!=null)))return;const N=v.state.listRef.current;return N[A]=M.current,()=>{delete N[A]}},[P,s,A,c,v]),$e(()=>{if(!P||S)return;const N=v.state.valuesRef.current;return N[A]=l,w!=="none"&&v.state.allValuesRef.current.push(l),()=>{delete N[A]}},[P,S,A,l,v,w]),$e(()=>{if(!y){p.current=!1;return}if(!P||S)return;const N=v.state.selectedValue,B=Array.isArray(N)?N[N.length-1]:N;Sr(l,B,x)&&v.set("selectedIndex",A)},[P,S,y,v,A,l,x]);const{getButtonProps:O,buttonRef:D}=vn({disabled:u,focusableWhenDisabled:!0,native:d,composite:!0}),j={disabled:u,selected:$,highlighted:R};function U(N){function B(){v.state.handleSelection(N,l)}v.state.submitOnItemClick?(E0.flushSync(B),v.state.requestSubmit()):B()}const q={id:F,role:_?"gridcell":"option","aria-selected":k?$:void 0,tabIndex:void 0,onPointerDownCapture(N){p.current=!0,N.preventDefault()},onMouseDown(N){N.preventDefault()},onClick(N){u||C||U(N.nativeEvent)},onMouseUp(N){const B=p.current;p.current=!1,!(u||C||N.button!==0||B||!R)&&U(N.nativeEvent)}},z=It("div",e,{ref:[D,r,g.ref,M],state:j,props:[E,q,h,O]}),K=b.useMemo(()=>({selected:$,textRef:m}),[$,m]);return(0,f.jsx)(k0.Provider,{value:K,children:z})}function R0(t){const{componentProps:e,forwardedRef:r}=t,s=Nt(),n=Y(s,X.isItemEqualToValue),{flatFilteredItems:a}=xr(),i=Da(a,e.value??null,n);return(0,f.jsx)(mc,{componentProps:e,forwardedRef:r,virtualized:!0,indexFromFilter:i})}var T0=b.memo(b.forwardRef(function(e,r){const s=Nt(),n=Y(s,X.virtualized);return n&&e.index==null?(0,f.jsx)(R0,{componentProps:e,forwardedRef:r}):(0,f.jsx)(mc,{componentProps:e,forwardedRef:r,virtualized:n,indexFromFilter:void 0})})),M0=T0,O0=b.forwardRef(function(e,r){const{render:s,className:n,style:a,children:i,...o}=e,{filteredItems:l}=xr(),c=Nt(),u=cc(),d=l.length===0?i:null;return It("div",e,{ref:[r,c.state.emptyRef,u],props:[{children:d,role:"status","aria-live":"polite","aria-atomic":!0},o]})}),hc=b.createContext(void 0);function Mn(){const t=b.useContext(hc);if(t===void 0)throw new Error(Lr(53));return t}var un=(function(t){return t.scrollAreaCornerHeight="--scroll-area-corner-height",t.scrollAreaCornerWidth="--scroll-area-corner-width",t})({});function Dt(t,e,r){if(!t)return 0;const s=getComputedStyle(t),n=r==="x"?"Inline":"Block";return r==="x"&&e==="margin"?parseFloat(s[`${e}InlineStart`])*2:parseFloat(s[`${e}${n}Start`])+parseFloat(s[`${e}${n}End`])}var F0=(function(t){return t.orientation="data-orientation",t.hovering="data-hovering",t.scrolling="data-scrolling",t.hasOverflowX="data-has-overflow-x",t.hasOverflowY="data-has-overflow-y",t.overflowXStart="data-overflow-x-start",t.overflowXEnd="data-overflow-x-end",t.overflowYStart="data-overflow-y-start",t.overflowYEnd="data-overflow-y-end",t})({}),Ys="base-ui-disable-scrollbar",gc={className:Ys,getElement(t){return(0,f.jsx)("style",{nonce:t,href:Ys,precedence:"base-ui:low",children:`.${Ys}{scrollbar-width:none}.${Ys}::-webkit-scrollbar{display:none}`})}},Vr=(function(t){return t.scrolling="data-scrolling",t.hasOverflowX="data-has-overflow-x",t.hasOverflowY="data-has-overflow-y",t.overflowXStart="data-overflow-x-start",t.overflowXEnd="data-overflow-x-end",t.overflowYStart="data-overflow-y-start",t.overflowYEnd="data-overflow-y-end",t})({}),vi={hasOverflowX:t=>t?{[Vr.hasOverflowX]:""}:null,hasOverflowY:t=>t?{[Vr.hasOverflowY]:""}:null,overflowXStart:t=>t?{[Vr.overflowXStart]:""}:null,overflowXEnd:t=>t?{[Vr.overflowXEnd]:""}:null,overflowYStart:t=>t?{[Vr.overflowYStart]:""}:null,overflowYEnd:t=>t?{[Vr.overflowYEnd]:""}:null,cornerHidden:()=>null},D0=b.createContext(void 0),L0={disableStyleElements:!1};function N0(){return b.useContext(D0)??L0}var j0={x:0,y:0},po={width:0,height:0},$0={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},V0={x:!0,y:!0,corner:!0},B0=b.forwardRef(function(e,r){const{render:s,className:n,overflowEdgeThreshold:a,style:i,...o}=e,{xStart:l,xEnd:c,yStart:u,yEnd:d}=U0(a),h=Fo(),p=Fr(),m=Fr(),{nonce:g,disableStyleElements:v}=N0(),[_,S]=b.useState(!1),[y,w]=b.useState(!1),[C,x]=b.useState(!1),[k,A]=b.useState(!1),[P,T]=b.useState(!1),[R,I]=b.useState(po),[E,M]=b.useState(po),[F,$]=b.useState($0),[O,D]=b.useState(V0),j=b.useRef(null),U=b.useRef(null),q=b.useRef(null),z=b.useRef(null),K=b.useRef(null),N=b.useRef(null),B=b.useRef(null),ee=b.useRef(!1),he=b.useRef(0),pe=b.useRef(0),ge=b.useRef(0),Fe=b.useRef(0),de=b.useRef("vertical"),Le=b.useRef(j0),Me=qe(se=>{const W=se.x-Le.current.x,L=se.y-Le.current.y;Le.current=se,L!==0&&(x(!0),p.start(500,()=>{x(!1)})),W!==0&&(w(!0),m.start(500,()=>{w(!1)}))}
26),Ie=qe(se=>{se.button===0&&(ee.current=!0,he.current=se.clientY,pe.current=se.clientX,de.current=se.currentTarget.getAttribute(F0.orientation),U.current&&(ge.current=U.current.scrollTop,Fe.current=U.current.scrollLeft),K.current&&de.current==="vertical"&&K.current.setPointerCapture(se.pointerId),N.current&&de.current==="horizontal"&&N.current.setPointerCapture(se.pointerId))}),ke=qe(se=>{if(!ee.current)return;const W=se.clientY-he.current,L=se.clientX-pe.current;if(U.current){const te=U.current.scrollHeight,G=U.current.clientHeight,xe=U.current.scrollWidth,Ue=U.current.clientWidth;if(K.current&&q.current&&de.current==="vertical"){const je=Dt(q.current,"padding","y"),Ce=Dt(K.current,"margin","y"),J=K.current.offsetHeight,Oe=W/(q.current.offsetHeight-J-je-Ce);U.current.scrollTop=ge.current+Oe*(te-G),se.preventDefault(),x(!0),p.start(500,()=>{x(!1)})}if(N.current&&z.current&&de.current==="horizontal"){const je=Dt(z.current,"padding","x"),Ce=Dt(N.current,"margin","x"),J=N.current.offsetWidth,Oe=L/(z.current.offsetWidth-J-je-Ce);U.current.scrollLeft=Fe.current+Oe*(xe-Ue),se.preventDefault(),w(!0),m.start(500,()=>{w(!1)})}}}),Pe=qe(se=>{ee.current=!1,K.current&&de.current==="vertical"&&K.current.hasPointerCapture(se.pointerId)&&K.current.releasePointerCapture(se.pointerId),N.current&&de.current==="horizontal"&&N.current.hasPointerCapture(se.pointerId)&&N.current.releasePointerCapture(se.pointerId)});function me(se){A(se.pointerType==="touch")}function Se(se){if(me(se),se.pointerType!=="touch"){const W=gt(j.current,se.target);S(W)}}const ie=b.useMemo(()=>({scrolling:y||C,hasOverflowX:!O.x,hasOverflowY:!O.y,overflowXStart:F.xStart,overflowXEnd:F.xEnd,overflowYStart:F.yStart,overflowYEnd:F.yEnd,cornerHidden:O.corner}),[y,C,O.x,O.y,O.corner,F]),le={role:"presentation",onPointerEnter:Se,onPointerMove:Se,onPointerDown:me,onPointerLeave(){S(!1)},style:{position:"relative",[un.scrollAreaCornerHeight]:`${R.height}px`,[un.scrollAreaCornerWidth]:`${R.width}px`}},we=It("div",e,{state:ie,ref:[r,j],props:[le,o],stateAttributesMapping:vi}),De=b.useMemo(()=>({handlePointerDown:Ie,handlePointerMove:ke,handlePointerUp:Pe,handleScroll:Me,cornerSize:R,setCornerSize:I,thumbSize:E,setThumbSize:M,hasMeasuredScrollbar:P,setHasMeasuredScrollbar:T,touchModality:k,cornerRef:B,scrollingX:y,setScrollingX:w,scrollingY:C,setScrollingY:x,hovering:_,setHovering:S,viewportRef:U,rootRef:j,scrollbarYRef:q,scrollbarXRef:z,thumbYRef:K,thumbXRef:N,rootId:h,hiddenState:O,setHiddenState:D,overflowEdges:F,setOverflowEdges:$,viewportState:ie,overflowEdgeThreshold:{xStart:l,xEnd:c,yStart:u,yEnd:d}}),[Ie,ke,Pe,Me,R,E,P,k,y,w,C,x,_,S,h,O,F,ie,l,c,u,d]);return(0,f.jsxs)(hc.Provider,{value:De,children:[!v&&gc.getElement(g),we]})});function U0(t){if(typeof t=="number"){const e=Math.max(0,t);return{xStart:e,xEnd:e,yStart:e,yEnd:e}}return{xStart:Math.max(0,t?.xStart||0),xEnd:Math.max(0,t?.xEnd||0),yStart:Math.max(0,t?.yStart||0),yEnd:Math.max(0,t?.yEnd||0)}}var z0=b.createContext(void 0);function qr(t,e=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,r))}var br=(function(t){return t.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",t.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",t.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",t.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",t})({});function mo(t,e){if(e<=0)return 0;const r=qr(t,0,e),s=r,n=e-r,a=s<=1,i=n<=1;return a&&i?s<=n?0:e:a?0:i?e:r}var ho=!1;function q0(){ho||Id||(typeof CSS<"u"&&"registerProperty"in CSS&&[br.scrollAreaOverflowXStart,br.scrollAreaOverflowXEnd,br.scrollAreaOverflowYStart,br.scrollAreaOverflowYEnd].forEac
26h(t=>{try{CSS.registerProperty({name:t,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),ho=!0)}var W0=b.forwardRef(function(e,r){const{render:s,className:n,style:a,...i}=e,{viewportRef:o,scrollbarYRef:l,scrollbarXRef:c,thumbYRef:u,thumbXRef:d,cornerRef:h,cornerSize:p,setCornerSize:m,setThumbSize:g,rootId:v,setHiddenState:_,hiddenState:S,setHasMeasuredScrollbar:y,handleScroll:w,setHovering:C,setOverflowEdges:x,overflowEdges:k,overflowEdgeThreshold:A,scrollingX:P,scrollingY:T}=Mn(),R=ks(),I=b.useRef(!0),E=b.useRef([NaN,NaN,NaN,NaN]),M=Fr(),F=Fr(),$=qe(()=>{const z=o.current,K=l.current,N=c.current,B=u.current,ee=d.current,he=h.current;if(!z)return;const pe=z.scrollHeight,ge=z.scrollWidth,Fe=z.clientHeight,de=z.clientWidth,Le=z.scrollTop,Me=z.scrollLeft,Ie=E.current,ke=Number.isNaN(Ie[0]);if(Ie[0]=Fe,Ie[1]=pe,Ie[2]=de,Ie[3]=ge,ke&&y(!0),pe===0||ge===0)return;const Pe=H0(z),me=Pe.y,Se=Pe.x,ie=de/ge,le=Fe/pe,we=Math.max(0,ge-de),De=Math.max(0,pe-Fe);let se=0,W=0;if(!Se){let Te=0;R==="rtl"?Te=qr(-Me,0,we):Te=qr(Me,0,we),se=mo(Te,we),W=we-se}const L=me?0:qr(Le,0,De),te=me?0:mo(L,De),G=me?0:De-te,xe=Se?0:de,Ue=me?0:Fe;let je=0,Ce=0;!Se&&!me&&(je=K?.offsetWidth||0,Ce=N?.offsetHeight||0);const J=p.width===0&&p.height===0,Oe=J?je:0,et=J?Ce:0,tt=Dt(N,"padding","x"),rt=Dt(K,"padding","y"),st=Dt(ee,"margin","x"),_e=Dt(B,"margin","y"),Ve=xe-tt-st,Ke=Ue-rt-_e,Je=N?Math.min(N.offsetWidth-Oe,Ve):Ve,ae=K?Math.min(K.offsetHeight-et,Ke):Ke,ne=Math.max(16,Je*ie),re=Math.max(16,ae*le);if(g(Te=>Te.height===re&&Te.width===ne?Te:{width:ne,height:re}),K&&B){const Te=K.offsetHeight-re-rt-_e,He=pe-Fe,Ct=He===0?0:Le/He,Xe=Math.min(Te,Math.max(0,Ct*Te));B.style.transform=`translate3d(0,${Xe}px,0)`}if(N&&ee){const Te=N.offsetWidth-ne-tt-st,He=ge-de,Ct=He===0?0:Me/He,Xe=R==="rtl"?qr(Ct*Te,-Te,0):qr(Ct*Te,0,Te);ee.style.transform=`translate3d(${Xe}px,0,0)`}const ze=[[br.scrollAreaOverflowXStart,se],[br.scrollAreaOverflowXEnd,W],[br.scrollAreaOverflowYStart,te],[br.scrollAreaOverflowYEnd,G]];for(const[Te,He]of ze)z.style.setProperty(Te,`${He}px`);he&&(Se||me?m({width:0,height:0}):!Se&&!me&&m({width:je,height:Ce})),_(Te=>K0(Te,Pe));const We={xStart:!Se&&se>A.xStart,xEnd:!Se&&W>A.xEnd,yStart:!me&&te>A.yStart,yEnd:!me&&G>A.yEnd};x(Te=>Te.xStart===We.xStart&&Te.xEnd===We.xEnd&&Te.yStart===We.yStart&&Te.yEnd===We.yEnd?Te:We)});$e(()=>{o.current&&q0()},[o]),$e(()=>{queueMicrotask($)},[$,S,R,A.xStart,A.xEnd,A.yStart,A.yEnd]),$e(()=>{o.current?.matches(":hover")&&C(!0)},[o,C]),$e(()=>{const z=o.current;if(typeof ResizeObserver>"u"||!z)return;let K=!1;const N=new ResizeObserver(()=>{if(!K){K=!0;const B=E.current;if(B[0]===z.clientHeight&&B[1]===z.scrollHeight&&B[2]===z.clientWidth&&B[3]===z.scrollWidth)return}$()});return N.observe(z),F.start(0,()=>{const B=z.getAnimations({subtree:!0});B.length!==0&&Promise.allSettled(B.map(ee=>ee.finished)).then($).catch(()=>{})}),()=>{N.disconnect(),F.clear()}},[$,o,F]);function O(){I.current=!1}const D={role:"presentation",...v&&{"data-id":`${v}-viewport`},tabIndex:S.x&&S.y?-1:0,className:gc.className,style:{overflow:"scroll"},onScroll(){o.current&&($(),I.current||w({x:o.current.scrollLeft,y:o.current.scrollTop}),M.start(100,()=>{I.current=!0}))},onWheel:O,onTouchMove:O,onPointerMove:O,onPointerEnter:O,onKeyDown:O},j=b.useMemo(()=>({scrolling:P||T,hasOverflowX:!S.x,hasOverflowY:!S.y,overflowXStart:k.xStart,overflowXEnd:k.xEnd,overflowYStart:k.yStart,overflowYEnd:k.yEnd,cornerHidden:S.corner}),[P,T,S.x,S.y,S.corner,k]),U=It("div",e,{ref:[r,o],state:j,props:[D,i],stateAttributesMapping:vi}),q=b.useMemo(()=>({computeThumbPosition:$}),[$]);return(0,f.jsx)(z0.Provider,{value:q,children:U})});function H0(t){const e=t.clientHeight>=t.scrollHeight,r=t.clientWidth>=t.scrollWidth;return{y:e,x:r,corner:e||r}}function K0(t,e){return t.y===e.y&&t.x===e.x&&t.corner===e.corner?t:e}var vc=b.createContext(void 0);function G0(){const t=b.useContext(vc);if(t===void 0)throw new Error(Lr(54));return t}var dn=(function(t){return t.scrollAreaThumbHeight="--scroll-area-thumb-height",t.scrollAreaThumbWidth="--scroll-area-thumb-width",t})({}),Y0=b.forwardRef(function(e,r){const{render:s,className:n,orientation:a="vertical",keepMounted:i=!1,style:o,...l}=e,{hovering:c,scrollingX:u,scrollingY:d,hiddenState:h,overflowEdges:p,scrollbarYRef:m,scrollbarXRef:g,viewportRef:v,thumbYRef:_,thumbXRef:S,handlePointerDown:y,handlePointerUp:w,handleScroll:C,rootId:x,thumbSize:k,hasMeasuredScrollbar:A}=Mn(),P={hovering:c,scrolling:{horizontal:u,vertical:d}[a],orientation:a,hasOverflowX:!h.x,hasOverflowY:!h.y,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:h.corner},T=ks(),R=!A&&!i,I=a==="vertical"?h.y:h.x,E=i||!I;b.useEffect(()=>{if(!E)return;const O=v.current,D=a==="vertical"?m.current:g.current;if(!D)return;function j(U){if(!O||!D||U.ctrlKey)return;const q=a==="horizontal",z=q?"scrollLeft":"scrollTop",K=q?U.deltaX:U.deltaY;if(K===0)return;const N=q?O.scrollWidth-O.clientWidth:O.scrollHeight-O.clientHeight,B=q&&T==="rtl"?-N:0,ee=q&&T==="rtl"?0:N,he=O[z];he<=B&&K<0||he>=ee&&K>0||(U.preventDefault(),O[z]=Math.min(ee,Math.max(B,he+K)),C({x:O.scrollLeft,y:O.scrollTop}))}return Pd(D,"wheel",j,{passive:!1})},[T,C,a,g,m,E,v]);const M={...x&&{"data-id":`${x}-scrollbar`},onPointerDown(O){if(O.button!==0)return;const D=Gr(O.nativeEvent),j=a==="vertical"?_.current:S.current;if(!(j&&gt(j,D))&&v.current){if(_.current&&m.current&&a==="vertical"){const U=Dt(_.current,"margin","y"),q=Dt(m.current,"padding","y"),z=_.current.offsetHeight,K=m.current.getBoundingClientRect(),N=O.clientY-K.top-z/2-q+U/2,B=v.current.scrollHeight,ee=v.current.clientHeight,he=N/(m.current.offsetHeight-z-q-U)*(B-ee);v.current.scrollTop=he}if(S.current&&g.current&&a==="horizontal"){const U=Dt(S.current,"margin","x"),q=Dt(g.current,"padding","x"),z=S.current.offsetWidth,K=g.current.getBoundingClientRect(),N=O.clientX-K.left-z/2-q+U/2,B=v.current.scrollWidth,ee=v.current.clientWidth,he=N/(g.current.offsetWidth-z-q-U);let pe;T==="rtl"?(pe=(1-he)*(B-ee),v.current.scrollLeft<=0&&(pe=-pe)):pe=he*(B-ee),v.current.scrollLeft=pe}C({x:v.current.scrollLeft,y:v.current.scrollTop}),y(O)}},onPointerUp:w,onPointerCancel:w,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",visibility:R?"hidden":void 0,...a==="vertical"&&{top:0,bottom:`var(${un.scrollAreaCornerHeight})`,insetInlineEnd:0,[dn.scrollAreaThumbHeight]:`${k.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${un.scrollAreaCornerWidth})`,bottom:0,[dn.scrollAreaThumbWidth]:`${k.width}px`}}},F=It("div",e,{ref:[r,a==="vertical"?m:g],state:P,props:[M,l],stateAttributesMapping:vi}),$=b.useMemo(()=>({orientation:a}
26),[a]);return E?(0,f.jsx)(vc.Provider,{value:$,children:F}):null}),X0=b.forwardRef(function(e,r){const{render:s,className:n,style:a,...i}=e,{thumbYRef:o,thumbXRef:l,handlePointerDown:c,handlePointerMove:u,handlePointerUp:d,setScrollingX:h,setScrollingY:p,scrollingX:m,scrollingY:g,hasMeasuredScrollbar:v}=Mn(),{orientation:_}=G0(),S={scrolling:_==="horizontal"?m:g,orientation:_};function y(w){_==="vertical"&&p(!1),_==="horizontal"&&h(!1),d(w)}return It("div",e,{ref:[r,_==="vertical"?o:l],state:S,props:[{onPointerDown:c,onPointerMove:u,onPointerUp:y,onPointerCancel:y,style:{visibility:v?void 0:"hidden",..._==="vertical"&&{height:`var(${dn.scrollAreaThumbHeight})`},..._==="horizontal"&&{width:`var(${dn.scrollAreaThumbWidth})`}}},i]})}),Q0=b.forwardRef(function(e,r){const{render:s,className:n,style:a,...i}=e,{cornerRef:o,cornerSize:l,hiddenState:c}=Mn(),u=It("div",e,{ref:[r,o],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:l.width,height:l.height}},i]});return c.corner?null:u});function J0(t){const e=(0,V.c)(17);let r,s,n,a;e[0]!==t?({className:s,children:r,orientation:n,...a}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a):(r=e[1],s=e[2],n=e[3],a=e[4]);let i;e[5]!==s?(i=Z("size-full overscroll-contain rounded-[inherit] border-primary/20 transition-[box-shadow] outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",s),e[5]=s,e[6]=i):i=e[6];let o;e[7]!==r||e[8]!==i?(o=(0,f.jsx)(W0,{"data-slot":"scroll-area-viewport",className:i,children:r}),e[7]=r,e[8]=i,e[9]=o):o=e[9];let l;e[10]!==n?(l=n==="both"?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(ma,{orientation:"vertical"}),(0,f.jsx)(ma,{orientation:"horizontal"})]}):(0,f.jsx)(ma,{orientation:n}),e[10]=n,e[11]=l):l=e[11];let c;e[12]===Symbol.for("react.memo_cache_sentinel")?(c=(0,f.jsx)(Q0,{"data-slot":"scroll-area-corner",className:"bg-primary/20"}),e[12]=c):c=e[12];let u;return e[13]!==a||e[14]!==o||e[15]!==l?(u=(0,f.jsxs)(B0,{className:"min-h-0 min-w-0",...a,children:[o,l,c]}),e[13]=a,e[14]=o,e[15]=l,e[16]=u):u=e[16],u}function ma(t){const e=(0,V.c)(11);let r,s,n;e[0]!==t?({className:r,orientation:n,...s}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n):(r=e[1],s=e[2],n=e[3]);const a=n===void 0?"vertical":n;let i;e[4]!==r?(i=Z("m-0.5 flex opacity-0 transition-opacity delay-300 data-hovering:opacity-100 data-hovering:delay-0 data-hovering:duration-100 data-scrolling:opacity-100 data-scrolling:delay-0 data-scrolling:duration-100 data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:flex-col data-[orientation=vertical]:w-1.5",r),e[4]=r,e[5]=i):i=e[5];let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=(0,f.jsx)(X0,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-primary/30"}),e[6]=o):o=e[6];let l;return e[7]!==a||e[8]!==s||e[9]!==i?(l=(0,f.jsx)(Y0,{"data-slot":"scroll-area-scrollbar",orientation:a,className:i,...s,children:o}),e[7]=a,e[8]=s,e[9]=i,e[10]=l):l=e[10],l}var Z0=qb,e_="border-muted-foreground/20",t_="rounded-[calc(var(--radius-lg)-4px)]",r_="group-hover/autocomplete-input:border-primary/30 group-hover/autocomplete-input:bg-primary/10 dark:group-hover/autocomplete-input:bg-primary/20",Na="text-muted-foreground group-hover/autocomplete-input:text-primary hover:text-primary";function s_(t){const e=(0,V.c)(29);let r,s,n,a,i,o,l;e[0]!==t?({className:r,showTrigger:o,showClear:l,startAdornment:i,containerRef:s,size:a,...n}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=i,e[6]=o,e[7]=l):(r=e[1],s=e[2],n=e[3],a=e[4],i=e[5],o=e[6],l=e[7]);const c=o===void 0?!1:o,u=l===void 0?!1:l,d=a??"default",h=d==="sm"?"has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-6.5":"has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-7";let p;e[8]!==r||e[9]!==h?(p=Z(r_,h,r),e[8]=r,e[9]=h,e[10]=p):p=e[10];let m;e[11]!==d||e[12]!==i?(m=(0,f.jsx)(No,{size:d,startAdornment:i}),e[11]=d,e[12]=i,e[13]=m):m=e[13];let g;e[14]!==n||e[15]!==p||e[16]!==m?(g=(0,f.jsx)(Xb,{"data-slot":"autocomplete-input",className:p,render:m,...n}),e[14]=n,e[15]=p,e[16]=m,e[17]=g):g=e[17];let v;e[18]!==c||e[19]!==d?(v=c&&(0,f.jsx)(c_,{className:Z(Na,"absolute top-1/2 inline-flex size-7 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-72 transition-[color,background-color,box-shadow,opacity] outline-none hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",d==="sm"?"end-0":"end-0.5"),children:(0,f.jsx)(hu,{})}),e[18]=c,e[19]=d,e[20]=v):v=e[20];let _;e[21]!==u||e[22]!==d?(_=u&&(0,f.jsx)(o_,{className:Z(Na,"absolute top-1/2 inline-flex size-7 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-72 transition-[color,background-color,box-shadow,opacity] outline-none hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",d==="sm"?"end-0":"end-0.5"),children:(0,f.jsx)(mn,{})}),e[21]=u,e[22]=d,e[23]=_):_=e[23];let S;return e[24]!==s||e[25]!==g||e[26]!==v||e[27]!==_?(S=(0,f.jsxs)("div",{ref:s,className:"group/autocomplete-input relative w-full",children:[g,v,_]}),e[24]=s,e[25]=g,e[26]=v,e[27]=_,e[28]=S):S=e[28],S}function n_(t){const e=(0,V.c)(19);let r,s,n,a,i,o;e[0]!==t?({className:n,children:s,anchor:r,sideOffset:i,side:o,...a}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=i,e[6]=o):(r=e[1],s=e[2],n=e[3],a=e[4],i=e[5],o=e[6]);const l=i===void 0?4:i,c=o===void 0?"bottom":o;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=Z(e_,"relative flex max-h-full origin-(--transform-origin) rounded-lg border bg-popover bg-clip-padding transition-[scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-lg has-data-starting-style:scale-98 has-data-starting-style:opacity-0 dark:bg-clip-border"),e[7]=u):u=e[7];let d;e[8]!==n?(d=Z("flex max-h-[min(var(--available-height),23rem)] w-(--anchor-width) max-w-(--available-width) flex-col",n),e[8]=n,e[9]=d):d=e[9];let h;e[10]!==s||e[11]!==a||e[12]!==d?(h=(0,f.jsx)("span",{className:u,children:(0,f.jsx)(C0,{"data-slot":"autocomplete-popup",className:d,...a,children:s})}),e[10]=s,e[11]=a,e[12]=d,e[13]=h):h=e[13];let p;return e[14]!==r||e[15]!==c||e[16]!==l||e[17]!==h?(p=(0,f.jsx)(f0,{children:(0,f.jsx)(w0,{"data-slot":"autocomplete-positioner",className:"z-50 select-none",anchor:r,sideOffset:l,side:c,children:h})}),e[14]=r,e[15]=c,e[16]=l,e[17]=h,e[18]=p):p=e[18],p}function a_(t){const e=(0,V.c)(10);let r,s,n;e[0]!==t?({className:s,children:r,...n}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n):(r=e[1],s=e[2],n=e[3]);let a;e[4]!==s?(a=Z(t_,"flex cursor-default items-center px-2 py-1 text-base outline-none select-none data-disabled:pointer-events-none data-disabled:opacity-64 data-highlighted:bg-primary/10 data-highlighted:text-primary sm:text-sm",s),e[4]=s,e[5]=a):a=e[5];let i;return e[6]!==r||e[7]!==n||e[8]!==a?(i=(0,f.jsx)(M0,{"data-slot":"autocomplete-item",className:a,...n,children:r}),e[6]=r,e[7]=n,e[8]=a,e[9]=i):i=e[9],i}function XC(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("text-center text-sm text-muted-foreground not-empty:p-2",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)(O0,{className:n,"data-slot":"autocomplete-empty",...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function i_(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("not-empty:scroll-py-1 not-empty:px-1 not-empty:py-1 
26in-data-has-overflow-y:pe-3",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)(J0,{className:"flex-1",children:(0,f.jsx)(o0,{"data-slot":"autocomplete-list",className:n,...s})}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function o_(t){const e=(0,V.c)(9);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z(Na,"absolute end-0.5 top-1/2 inline-flex size-7 shrink-0 -translate-y-1/2 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-72 transition-[color,background-color,box-shadow,opacity] outline-none hover:opacity-100 pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r),e[3]=r,e[4]=n):n=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=(0,f.jsx)(mn,{}),e[5]=a):a=e[5];let i;return e[6]!==s||e[7]!==n?(i=(0,f.jsx)(Jb,{"data-slot":"autocomplete-clear",className:n,...s,children:a}),e[6]=s,e[7]=n,e[8]=i):i=e[8],i}function l_(t){const e=(0,V.c)(8);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;e[3]!==r?(n=Z("px-3 py-2 text-xs font-medium text-muted-foreground empty:m-0 empty:p-0",r),e[3]=r,e[4]=n):n=e[4];let a;return e[5]!==s||e[6]!==n?(a=(0,f.jsx)(u0,{"data-slot":"autocomplete-status",className:n,...s}),e[5]=s,e[6]=n,e[7]=a):a=e[7],a}function c_(t){const e=(0,V.c)(6);let r,s;e[0]!==t?({className:r,...s}=t,e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);let n;return e[3]!==r||e[4]!==s?(n=(0,f.jsx)(Kb,{"data-slot":"autocomplete-trigger",className:r,...s}),e[3]=r,e[4]=s,e[5]=n):n=e[5],n}function u_(t){const e=(0,V.c)(21);let r,s,n,a,i;e[0]!==t?({isLoading:s,onClear:n,value:i,className:r,...a}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=i):(r=e[1],s=e[2],n=e[3],a=e[4],i=e[5]);const o=n&&i&&String(i).length>0;let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=(0,f.jsx)(Zn,{align:"inline-start",children:(0,f.jsx)(bu,{})}),e[6]=l):l=e[6];let c;e[7]!==a||e[8]!==i?(c=(0,f.jsx)(cf,{type:"search",value:i,...a}),e[7]=a,e[8]=i,e[9]=c):c=e[9];let u;e[10]!==s||e[11]!==o?(u=s&&!o&&(0,f.jsx)(Zn,{align:"inline-end",children:(0,f.jsx)(fn,{className:"animate-spin"})}),e[10]=s,e[11]=o,e[12]=u):u=e[12];let d;e[13]!==n||e[14]!==o?(d=o&&(0,f.jsx)(Zn,{align:"inline-end",children:(0,f.jsx)(uf,{size:"icon-xs",onClick:n,"aria-label":"Clear search",children:(0,f.jsx)(mn,{})})}),e[13]=n,e[14]=o,e[15]=d):d=e[15];let h;return e[16]!==r||e[17]!==c||e[18]!==u||e[19]!==d?(h=(0,f.jsxs)(df,{className:r,children:[l,c,u,d]}),e[16]=r,e[17]=c,e[18]=u,e[19]=d,e[20]=h):h=e[20],h}function d_(t,e,r,s){const n=e?[]:t;return{available:n,visible:r?n.slice(0,s?5:4):n}}function f_({isLoading:t,isDentalSearch:e,hasError:r,resultCount:s}){return t?e?"Searching for dental practices.":"Searching for businesses.":r?"Suggestions could not be loaded. Submit your search to try full results.":s===0?e?"No matching dental practices. Try adding a city or state.":"No businesses found.":`${s} ${e?"suggested dental practice":"business result"}${s===1?"":"s"} available.`}function p_(t){const e=(0,V.c)(19),{itemLabel:r,query:s}=t;let n,a,i,o,l,c;if(e[0]!==r||e[1]!==s){c=Symbol.for("react.early_return_sentinel");e:{if(a=s.trim().toLowerCase(),n=a?r.toLowerCase().indexOf(a):-1,n===-1){c=r;break e}l=r.slice(0,n),i="font-bold",o=r.slice(n,n+a.length)}e[0]=r,e[1]=s,e[2]=n,e[3]=a,e[4]=i,e[5]=o,e[6]=l,e[7]=c}else n=e[2],a=e[3],i=e[4],o=e[5],l=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;e[8]!==i||e[9]!==o?(u=(0,f.jsx)("span",{className:i,children:o}),e[8]=i,e[9]=o,e[10]=u):u=e[10];let d;e[11]!==r||e[12]!==n||e[13]!==a.length?(d=r.slice(n+a.length),e[11]=r,e[12]=n,e[13]=a.length,e[14]=d):d=e[14];let h;return e[15]!==l||e[16]!==u||e[17]!==d?(h=(0,f.jsxs)(f.Fragment,{children:[l,u,d]}),e[15]=l,e[16]=u,e[17]=d,e[18]=h):h=e[18],h}function m_(t){const e=(0,V.c)(27),{anchor:r,isLoading:s,statusMessage:n,isDentalSearch:a,error:i,currentResults:o,visibleResults:l,onPick:c,onSearch:u,onShowMore:d,query:h,placement:p,localOnly:m}=t,g=s||void 0;let v;e[0]!==n?(v=(0,f.jsx)(l_,{className:"sr-only",children:n}),e[0]=n,e[1]=v):v=e[1];let _;e[2]!==o||e[3]!==i||e[4]!==a||e[5]!==s||e[6]!==c||e[7]!==u||e[8]!==h||e[9]!==l?(_=(0,f.jsx)(i_,{children:s?(0,f.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-3 text-sm text-muted-foreground",children:[(0,f.jsx)("span",{children:a?"Searching dental practices...":"Searching..."}),(0,f.jsx)(fn,{className:"size-4 animate-spin","aria-hidden":!0})]}):i?(0,f.jsxs)("div",{role:"alert",className:"px-3 py-3 text-sm text-destructive",children:["Suggestions couldn't be loaded."," ",u?"Submit your search to try full results.":"Edit the search to try again."]}):o.length===0?(0,f.jsx)("div",{className:"px-3 py-3 text-sm text-muted-foreground",children:a?"No matching dental practices. Try adding a city or state.":"No businesses found."}):(0,f.jsxs)(f.Fragment,{children:[a?(0,f.jsx)("div",{className:"px-3 pb-1 pt-2 text-xs font-medium text-muted-foreground",children:"Suggested dental practices"}):null,l.map(C=>(0,f.jsxs)(a_,{value:C,className:"gap-3 px-3 py-2",onClick:()=>c(C),children:[(0,f.jsx)(pn,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,f.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,f.jsx)("span",{className:"block truncate text-sm",children:(0,f.jsx)(p_,{itemLabel:C.label,query:h})}),C.description?(0,f.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:C.description}):null]})]},C.value))]})}),e[2]=o,e[3]=i,e[4]=a,e[5]=s,e[6]=c,e[7]=u,e[8]=h,e[9]=l,e[10]=_):_=e[10];let S;e[11]!==o||e[12]!==a||e[13]!==u||e[14]!==d||e[15]!==h?(S=u?(0,f.jsx)("button",{type:"button",className:"flex w-full items-center justify-center border-t px-3 py-2.5 text-sm font-semibold text-primary transition-colors hover:bg-primary/10 focus-visible:bg-primary/10 focus-visible:outline-none",onMouseDown:h_,onClick:d,children:(0,f.jsxs)("span",{className:"truncate",children:[a?o.length>
260?"View search results":"Search dental practices":"View more results"," for ","“",h.trim(),"”"]})}):null,e[11]=o,e[12]=a,e[13]=u,e[14]=d,e[15]=h,e[16]=S):S=e[16];let y;e[17]!==m?(y=m?null:(0,f.jsxs)("div",{className:"flex items-center justify-end gap-1.5 border-t px-3 py-1.5 text-xs font-medium text-muted-foreground",children:[(0,f.jsx)("img",{src:"/brands/google-maps.svg",alt:"Google Maps",className:"size-5"}),(0,f.jsx)("span",{"aria-hidden":"true",children:"Google Maps"})]}),e[17]=m,e[18]=y):y=e[18];let w;return e[19]!==r||e[20]!==p||e[21]!==g||e[22]!==v||e[23]!==_||e[24]!==S||e[25]!==y?(w=(0,f.jsxs)(n_,{anchor:r,"aria-busy":g,side:p,children:[v,_,S,y]}),e[19]=r,e[20]=p,e[21]=g,e[22]=v,e[23]=_,e[24]=S,e[25]=y,e[26]=w):w=e[26],w}function h_(t){return t.preventDefault()}function g_(t){const e=(0,V.c)(101),{onSelect:r,disabled:s,label:n,placeholder:a,onClear:i,suggestionsPlacement:o,initialValue:l,onSearch:c,autoFocus:u,includeLocalFixtures:d,localOnly:h,searchScope:p}=t,m=s===void 0?!1:s,g=n===void 0?"Search for a business":n,v=o===void 0?"bottom":o,_=l===void 0?"":l,S=u===void 0?!1:u,y=d===void 0?!1:d,w=h===void 0?!1:h,C=(0,b.useId)(),x=(0,b.useRef)(null),[k,A]=(0,b.useState)(!1),[P,T]=(0,b.useState)(!1);let R;e[0]!==y||e[1]!==w||e[2]!==p?(R={includeLocalFixtures:y,localOnly:w,searchScope:p},e[0]=y,e[1]=w,e[2]=p,e[3]=R):R=e[3];const{query:I,setQuery:E,placePredictions:M,isPredictionsLoading:F,predictionsError:$}=Hl(!1,_,R),[O,D]=(0,b.useState)(I);let j,U;e[4]!==I?(U=()=>D(I),j=[I],e[4]=I,e[5]=j,e[6]=U):(j=e[5],U=e[6]),(0,b.useEffect)(U,j);let q,z,K,N,B,ee,he,pe,ge,Fe,de;if(e[7]!==m||e[8]!==P||e[9]!==O||e[10]!==F||e[11]!==k||e[12]!==i||e[13]!==c||e[14]!==r||e[15]!==M||e[16]!==$||e[17]!==p||e[18]!==E){const De=M.map(y_);({available:q,visible:de}=d_(De,F,!!c,!!p)),pe=p==="workspace-dental-us";let se;e[30]!==m||e[31]!==O||e[32]!==k?(se=!m&&k&&O.trim().length>0,e[30]=m,e[31]=O,e[32]=k,e[33]=se):se=e[33],ge=se;let W;e[34]!==c?(W=J=>{c&&c(J)},e[34]=c,e[35]=W):W=e[35];const L=W;let te;e[36]!==i||e[37]!==E?(te=J=>{D(J),E(J),T(!1),A(J.trim().length>0),J===""&&i?.()},e[36]=i,e[37]=E,e[38]=te):te=e[38],he=te;let G;e[39]!==r||e[40]!==E?(G=J=>{D(J.label),E(J.label),A(!1),T(!1),r?.(J.value)},e[39]=r,e[40]=E,e[41]=G):G=e[41],B=G;let xe;e[42]!==i||e[43]!==E?(xe=()=>{D(""),E(""),A(!1),T(!1),i?.()},e[42]=i,e[43]=E,e[44]=xe):xe=e[44],z=xe;let Ue;e[45]!==O||e[46]!==c||e[47]!==L?(Ue=()=>{const J=O.trim();!J||!c||(A(!1),L(J))},e[45]=O,e[46]=c,e[47]=L,e[48]=Ue):Ue=e[48],ee=Ue;let je;e[49]!==ge?(je=J=>{if(J.key==="Escape"&&ge){J.preventDefault(),J.stopPropagation(),A(!1),T(!1);return}(J.key==="ArrowDown"||J.key==="ArrowUp")&&T(!0)}
26,e[49]=ge,e[50]=je):je=e[50],K=je;let Ce;e[51]!==P||e[52]!==O||e[53]!==c||e[54]!==L?(Ce=J=>{if(J.key!=="Enter"||J.nativeEvent.isComposing||P)return;const Oe=O.trim();!Oe||!c||(J.preventDefault(),J.stopPropagation(),A(!1),L(Oe))},e[51]=P,e[52]=O,e[53]=c,e[54]=L,e[55]=Ce):Ce=e[55],N=Ce,Fe=f_({isLoading:F,isDentalSearch:pe,hasError:!!$,resultCount:de.length}),e[7]=m,e[8]=P,e[9]=O,e[10]=F,e[11]=k,e[12]=i,e[13]=c,e[14]=r,e[15]=M,e[16]=$,e[17]=p,e[18]=E,e[19]=q,e[20]=z,e[21]=K,e[22]=N,e[23]=B,e[24]=ee,e[25]=he,e[26]=pe,e[27]=ge,e[28]=Fe,e[29]=de}else q=e[19],z=e[20],K=e[21],N=e[22],B=e[23],ee=e[24],he=e[25],pe=e[26],ge=e[27],Fe=e[28],de=e[29];const Le=Fe;let Me;e[56]!==C||e[57]!==g?(Me=g&&(0,f.jsx)(mi,{htmlFor:C,children:g}),e[56]=C,e[57]=g,e[58]=Me):Me=e[58];let Ie;e[59]!==O?(Ie=De=>{A(De&&O.trim().length>0),De||T(!1)},e[59]=O,e[60]=Ie):Ie=e[60];const ke=g||a||"Search for a business";let Pe;e[61]!==z||e[62]!==F||e[63]!==ke?(Pe=(0,f.jsx)(u_,{isLoading:F,onClear:z,"aria-label":ke}),e[61]=z,e[62]=F,e[63]=ke,e[64]=Pe):Pe=e[64];let me;e[65]!==O?(me=()=>{O.trim()&&A(!0)},e[65]=O,e[66]=me):me=e[66];let Se;e[67]!==S||e[68]!==K||e[69]!==N||e[70]!==C||e[71]!==a||e[72]!==Pe||e[73]!==me?(Se=(0,f.jsx)(s_,{id:C,containerRef:x,render:Pe,placeholder:a,autoFocus:S,onFocus:me,onKeyDownCapture:N,onKeyDown:K}),e[67]=S,e[68]=K,e[69]=N,e[70]=C,e[71]=a,e[72]=Pe,e[73]=me,e[74]=Se):Se=e[74];let ie;e[75]!==q||e[76]!==B||e[77]!==ee||e[78]!==O||e[79]!==pe||e[80]!==F||e[81]!==w||e[82]!==c||e[83]!==$||e[84]!==ge||e[85]!==Le||e[86]!==v||e[87]!==de?(ie=ge?(0,f.jsx)(m_,{anchor:x,isLoading:F,statusMessage:Le,isDentalSearch:pe,error:$,currentResults:q,visibleResults:de,onPick:B,onSearch:c,onShowMore:ee,query:O,placement:v,localOnly:w}):null,e[75]=q,e[76]=B,e[77]=ee,e[78]=O,e[79]=pe,e[80]=F,e[81]=w,e[82]=c,e[83]=$,e[84]=ge,e[85]=Le,e[86]=v,e[87]=de,e[88]=ie):ie=e[88];let le;e[89]!==m||e[90]!==he||e[91]!==O||e[92]!==ge||e[93]!==Ie||e[94]!==Se||e[95]!==ie||e[96]!==de?(le=(0,f.jsxs)(Z0,{items:de,value:O,onValueChange:he,itemToStringValue:v_,filter:null,mode:"none",open:ge,onOpenChange:Ie,autoHighlight:"always",keepHighlight:!0,disabled:m,children:[Se,ie]}),e[89]=m,e[90]=he,e[91]=O,e[92]=ge,e[93]=Ie,e[94]=Se,e[95]=ie,e[96]=de,e[97]=le):le=e[97];let we;return e[98]!==Me||e[99]!==le?(we=(0,f.jsxs)("div",{className:"space-y-2",children:[Me,le]}),e[98]=Me,e[99]=le,e[100]=we):we=e[100],we}function v_(t){return t.label}function y_(t){return{value:t.place_id,label:t.structured_formatting.main_text,description:t.structured_formatting.secondary_text,itemToString:b_}}function b_(t){return t.label}var __=["placeDetails"],S_=t=>{const e=(0,V.c)(7);let r,s;e[0]!==t?(r=[...__,t],s=async()=>{const i=await fetch(Jr(`/google-places/places/${t}/details`));if(!i.ok)throw new Error("Failed to fetch place details");return await i.json()},e[0]=t,e[1]=r,e[2]=s):(r=e[1],s=e[2]);const n=!!t&&t!=="add";let a;return e[3]!==r||e[4]!==s||e[5]!==n?(a={queryKey:r,queryFn:s,enabled:n},e[3]=r,e[4]=s,e[5]=n,e[6]=a):a=e[6],ys(a)};function w_(){const t=(0,V.c)(6),{session:e}=Wa();let r;t[0]!==e?.authentication_factors?(r=e?.authentication_factors?.find(x_),t[0]=e?.authentication_factors,t[1]=r):r=t[1];const s=r,n=!!s,a=s?.impersonated_factor?.impersonator_email_address,i=e?.expires_at;let o;return t[2]!==n||t[3]!==a||t[4]!==i?(o={isImpersonated:n,impersonatorEmail:a,sessionExpiresAt:i},t[2]=n,t[3]=a,t[4]=i,t[5]=o):o=t[5],o}function x_(t){return t.type==="impersonated"}function C_(){const t=(0,V.c)(8),{isImpersonated:e}=w_(),{isChoosingOrg:r,selectOrg:s,switchWorkspace:n,isSwitchingWorkspace:a,isExchangingIST:i}=Eo();let o;t[0]!==r||t[1]!==e||t[2]!==s||t[3]!==n?(o=d=>{if(e)throw new Error("Cannot switch workspaces during an impersonated session");r?s(d.organization_id,d.organization_slug):n(d.organization_id,d.organization_slug)},t[0]=r,t[1]=e,t[2]=s,t[3]=n,t[4]=o):o=t[4];const l=o,c=a||i;let u;return t[5]!==l||t[6]!==c?(u={switchOrganization:l,isSwitching:c},t[5]=l,t[6]=c,t[7]=u):u=t[7],u}var On=()=>["stytch-workspaces"],A_=()=>{const t=(0,V.c)(8),e=Lt(),r=Pt(),{switchOrganization:s}=C_();let n;t[0]!==r||t[1]!==s?(n=async o=>{const{placeId:l,name:c,manualLocationData:u,dentalSelfAttestation:d}
26=o,h=await r(u?"workspaces/manual":"workspaces",{method:"POST",body:u?{name:c,manualLocationData:u}:{placeId:l,name:c,dentalSelfAttestation:d}});return await s(h),h},t[0]=r,t[1]=s,t[2]=n):n=t[2];let a;t[3]!==e?(a=()=>{e.invalidateQueries({queryKey:On()})},t[3]=e,t[4]=a):a=t[4];let i;return t[5]!==n||t[6]!==a?(i={mutationFn:n,onSuccess:a},t[5]=n,t[6]=a,t[7]=i):i=t[7],rr(i)},k_=Re({name:oe().min(1),address:oe().min(1),latitude:mt(),longitude:mt(),phone:oe().optional(),website:oe().url().optional(),types:ko(oe()).optional()}),I_=Re({placeId:oe().min(1),name:oe().min(1,{error:"name is required"}),organizationId:oe().optional(),dentalSelfAttestation:hn().optional(),eligibilityProof:oe().min(1).optional()}),QC=I_.pick({placeId:!0,dentalSelfAttestation:!0}),P_=Re({eligibilityProof:oe().min(1)}),JC=Re({name:oe().min(1,{error:"name is required"}),organizationId:oe().optional(),manualLocationData:k_}),ZC=Re({auto_update:hn()}),E_=Qe(["active","archived"]),yc=Qe(["owner","editor","viewer"]),R_=Re({id:mt(),uuid:oe(),account_id:oe(),background_image:oe().nullable(),created_at:oe().datetime(),name:oe(),status:E_,campaign_count:mt(),connection_count:mt(),grid_count:mt(),landing_page_count:mt(),location_count:mt()}),eA=R_.omit({id:!0,uuid:!0,created_at:!0}).partial(),T_=Re({id:mt(),uuid:oe(),workspace_id:mt(),user_id:oe().optional(),email:oe(),role:yc,invitation_status:Qe(["pending","accepted"]).default("pending"),created_at:oe().datetime()}),tA=T_.omit({id:!0,uuid:!0,created_at:!0}),rA=Re({email:oe(),role:yc}),sA=Re({platform:Qe(["google","facebook"]),refresh_token:oe(),access_token:oe()}),M_=()=>{const t=(0,V.c)(8),e=Lt(),r=So(),s=Pt();let n;t[0]!==s||t[1]!==r?(n=async o=>{const{placeId:l,name:c,dentalSelfAttestation:u}=o,d=Ro();if(!d)throw new Error("No authenticated discovery session");const h=await fetch(Jr("/api/workspace-industry-eligibility"),{method:"POST",headers:{Authorization:`Bearer ${d}`,"Content-Type":"application/json"},body:JSON.stringify({placeId:l,dentalSelfAttestation:u})}),p=await h.json().catch(O_);if(!h.ok)throw{status:h.status,data:p};const m=P_.safeParse(p);if(!m.success)throw new Error("Workspace eligibility check returned an invalid response");const g=await r.discovery.organizations.create({organization_name:c,session_duration_minutes:Ru}),v={placeId:l,name:c,organizationId:g.organization.organization_id,dentalSelfAttestation:u,eligibilityProof:m.data.eligibilityProof};return await s("workspaces",{method:"POST",body:v}),g.organization},t[0]=s,t[1]=r,t[2]=n):n=t[2];let a;t[3]!==e?(a=()=>{e.invalidateQueries({queryKey:On()})},t[3]=e,t[4]=a):a=t[4];let i;return t[5]!==n||t[6]!==a?(i={mutationFn:n,onSuccess:a},t[5]=n,t[6]=a,t[7]=i):i=t[7],rr(i)};function O_(){}var F_=t=>[...On(),t],D_=()=>{const t=(0,V.c)(7),e=Lt(),r=Pt();let s;t[0]!==r?(s=i=>r(`workspaces/${i.id}`,{method:"PATCH",body:i}),t[0]=r,t[1]=s):s=t[1];let n;t[2]!==e?(n=(i,o)=>{e.invalidateQueries({queryKey:On()}),e.invalidateQueries({queryKey:F_(o.uuid)})},t[2]=e,t[3]=n):n=t[3];let a;return t[4]!==s||t[5]!==n?(a={mutationFn:s,onSuccess:n},t[4]=s,t[5]=n,t[6]=a):a=t[6],rr(a)};function L_(t){const e=t.replace(/\D/g,"").slice(0,10),r=e.slice(0,3),s=e.slice(3,6),n=e.slice(6,10);return e.length>6?`(${r}) ${s}-${n}`:e.length>3?`(${r}) ${s}`:e.length>0?`(${r}`:""}function nA(t){return t.startsWith("+1")?L_(t.slice(2)):t}function N_(t){return`+1${t.replace(/\D/g,"")}`}function aA(t){return/^(\(\d{3}\) \d{3}-\d{4})$/.test(t)||t===""}var yi=(0,b.createContext)(null);function j_(t){const e=(0,V.c)(3),{onDismissAttempt:r,children:s}=t;let n;return e[0]!==s||e[1]!==r?(n=(0,f.jsx)(yi.Provider,{value:r,children:s}),e[0]=s,e[1]=r,e[2]=n):n=e[2],n}function iA(){return(0,b.useContext)(yi)!==null}function oA(){return(0,b.useContext)(yi)}function $_({open:t,onOpenChange:e,dismissal:r,children:s,...n}){const[a,i]=(0,b.useState)(!1),[o,l]=(0,b.useState)(!1);(0,b.useEffect)(()=>{t||(i(!1),l(!1))},[t]);const c=()=>{if(r.status!=="pending"){if(r.status==="dirty"){i(!0);return}e(!1)}},u=v=>{if(v){e(!0);return}c()},d=()=>{r.status==="dirty"&&(r.onDiscard?.(),i(!1),e(!1))},h=async()=>
26{if(!(r.status!=="dirty"||!r.onSave)){l(!0);try{await r.onSave(),i(!1),e(!1)}finally{l(!1)}}},p=v=>{!v&&o||i(v)},m=r.status==="dirty"?r:void 0,g=!!m?.onSave;return(0,f.jsx)(j_,{onDismissAttempt:c,children:(0,f.jsxs)(sf,{open:t,onOpenChange:u,disablePointerDismissal:r.status==="pending",...n,children:[s,(0,f.jsx)(yf,{open:a,onOpenChange:p,children:(0,f.jsxs)(pf,{children:[(0,f.jsxs)(vf,{children:[(0,f.jsx)(mf,{children:m?.title}),(0,f.jsx)(ff,{children:m?.description})]}),(0,f.jsxs)(hf,{children:[(0,f.jsx)(gf,{disabled:o,children:m?.keepEditingLabel??"Keep editing"}),(0,f.jsx)(dt,{variant:"destructive",onClick:d,disabled:o,children:m?.discardLabel??"Discard changes"}),g&&(0,f.jsx)(dt,{onClick:h,disabled:m?.canSave===!1||o,"aria-busy":o||void 0,children:o?m?.savingLabel??"Saving changes…":m?.saveLabel??"Save changes"})]})]})})]})})}function V_(t){const e=(0,V.c)(12);let r;e:{if(t){const s=t.displayName?.text;let n;e[0]!==t.regularOpeningHours?(n=t.regularOpeningHours?{open_now:t.regularOpeningHours.openNow}:void 0,e[0]=t.regularOpeningHours,e[1]=n):n=e[1];let a;e[2]!==t.photos?(a=t.photos?.map(B_),e[2]=t.photos,e[3]=a):a=e[3];let i;e[4]!==t.formattedAddress||e[5]!==t.nationalPhoneNumber||e[6]!==t.rating||e[7]!==t.userRatingCount||e[8]!==s||e[9]!==n||e[10]!==a?(i={name:s,rating:t.rating,user_ratings_total:t.userRatingCount,formatted_phone_number:t.nationalPhoneNumber,formatted_address:t.formattedAddress,opening_hours:n,photos:a},e[4]=t.formattedAddress,e[5]=t.nationalPhoneNumber,e[6]=t.rating,e[7]=t.userRatingCount,e[8]=s,e[9]=n,e[10]=a,e[11]=i):i=e[11],r=i;break e}r=void 0}return r}function B_(t){return{photo_reference:t.name}}function ha(t){const e=(0,V.c)(13),{locationData:r,markerLocation:s,isLoading:n}=t;if(n){let c;return e[0]===Symbol.for("react.memo_cache_sentinel")?(c=(0,f.jsx)(xt,{className:"h-64 w-full rounded-lg"}),e[0]=c):c=e[0],c}if(!r||!s){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=(0,f.jsx)("div",{className:"flex h-full w-full items-center justify-center rounded-lg p-4",children:(0,f.jsx)("img",{src:Vg,alt:"Search for business",className:"h-auto w-2/5 max-w-52 object-contain"})}),e[1]=c):c=e[1],c}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a={top:0,bottom:0,left:0,right:0},e[2]=a):a=e[2];let i;e[3]!==r.latitude||e[4]!==r.longitude?(i={latitude:r.latitude,longitude:r.longitude,zoom:14,pitch:0,bearing:0,padding:a},e[3]=r.latitude,e[4]=r.longitude,e[5]=i):i=e[5];let o;e[6]!==r.latitude||e[7]!==r.longitude||e[8]!==s?(o=(0,f.jsx)(fv,{latitude:r.latitude,longitude:r.longitude,location:s,enableHover:!1}),e[6]=r.latitude,e[7]=r.longitude,e[8]=s,e[9]=o):o=e[9];let l;return e[10]!==i||e[11]!==o?(l=(0,f.jsx)("div",{className:"w-full h-full rounded-lg overflow-hidden",children:(0,f.jsx)(kv,{viewState:i,children:o})}),e[10]=i,e[11]=o,e[12]=l):l=e[12],l}var Ot={name:"New Workspace",address:"123 Main St, Los Angeles, CA 90012",latitude:"34.0522",longitude:"-118.2437",phone:"",website:""};function U_(t){return t?{name:t.displayName?.text??"",address:t.formattedAddress??"",types:t.types,phone:t.nationalPhoneNumber,rating:t.rating,ratingsTotal:t.userRatingCount,website:t.websiteUri,openNow:t.regularOpeningHours?.openNow,photoUrl:kl(t.photos?.[0],900),latitude:t.location?.latitude??0,longitude:t.location?.longitude??0}:null}var z_=t=>{const e=(0,V.c)(77),{afterClose:r,workspace:s,onSubmitIndustryInterest:n,onOpenSchedulingLink:a}=t,i=_o(),o=Ug(),{session:l}=Wa(),{workspaces:c}=Ha(),u=Ko(c),[d,h]=(0,b.useState)(!1),[p,m]=(0,b.useState)(""),[g,v]=(0,b.useState)(null),_=s?void 0:"workspace-dental-us";let S;e[0]!==_?(S={searchScope:_},e[0]=_,e[1]=S):S=e[1];const{handleSearch:y,queryResults:w,isSearching:C,searchError:x,clearSearchResults:k,hasMoreResults:A,isLoadingMore:P,loadMoreError:T,loadMoreResults:R}=Hl(!1,"",S),{mutateAsync:I,isPending:E}=A_(),{mutateAsync:M,isPending:F}=M_(),{mutateAsync:$,isPending:O}=D_(),D=E||F,j=D||O,[U,q]=(0,b.useState)(!1);let z;e[2]===Symbol.for("react.memo_cache_sentinel")?(z=Be=>{q(Be)},e[2]=z):z=e[2];const K=z;let N;e[3]===Symbol.for("react.memo_cache_sentinel")?(N={defaultValues:{selectedPlaceId:"",manualName:Ot.name,manualAddress:Ot.address,manualLatitude:Ot.latitude,manualLongitude:Ot.longitude,manualPhone:Ot.phone,manualWebsite:Ot.website}},e[3]=N):N=e[3];const B=zl(N),ee=Ge(B.store,q_),he=Ge(B.store,W_),pe=Ge(B.store,H_),ge=Ge(B.store,K_),Fe=Ge(B.store,G_),de=Ge(B.store,Y_);let Le;e[4]!==de||e[5]!==p||e[6]!==g?(Le=de||p.trim().length>0||g!==null,e[4]=de,e[5]=p,e[6]=g,e[7]=Le):Le=e[7];const Me=Le,{data:Ie,isFetching:ke,isError:Pe,refetch:me}=S_(ee),Se=Pe&&!Ie,ie=U_(Ie),le=sy(ie?.types),we=!s&&!d&&!!ie&&!Se,De=V_(Ie);let se;e[8]!==B?(se=()=>B.setFieldValue("selectedPlaceId",""),e[8]=B,e[9]=se):se=e[9];const W=se;let L;if(e[10]!==w){const Be=new Set;L=w.filter(ft=>!ft.id||Be.has(ft.id)?!1:(Be.add(ft.id),!0)),e[10]=w,e[11]=L}else L=e[11];const te=L,G=parseFloat(ge),xe=parseFloat(Fe),Ue=d&&!isNaN(G)&&!isNaN(xe),je=d||!!ie||ke,Ce=!!(ie&&De)||ke||Se,J=g!==null,Oe=!d&&!Ce&&!J;let et;e[12]!==r||e[13]!==k||e[14]!==B?(et=()=>{Yg(!1),B.reset(),h(!1),m(""),v(null),k(),r?.()},e[12]=r,e[13]=k,e[14]=B,e[15]=et):et=e[15];const tt=et;let rt;e[16]!==W||e[17]!==y?(rt=Be=>
26{const ft=Be.trim();ft&&(W(),m(ft),v(ft),y(ft))},e[16]=W,e[17]=y,e[18]=rt):rt=e[18];const st=rt;let _e;e[19]!==k?(_e=()=>{v(null),k()},e[19]=k,e[20]=_e):_e=e[20];const Ve=_e;let Ke;e[21]!==k||e[22]!==W||e[23]!==B?(Ke=()=>{W(),h(!1),v(null),k(),B.setFieldValue("manualName",Ot.name),B.setFieldValue("manualAddress",Ot.address),B.setFieldValue("manualLatitude",Ot.latitude),B.setFieldValue("manualLongitude",Ot.longitude),B.setFieldValue("manualPhone",Ot.phone),B.setFieldValue("manualWebsite",Ot.website)},e[21]=k,e[22]=W,e[23]=B,e[24]=Ke):Ke=e[24];const Je=Ke;let ae;e[25]!==k||e[26]!==B?(ae=Be=>{B.setFieldValue("selectedPlaceId",Be),v(null),k()},e[25]=k,e[26]=B,e[27]=ae):ae=e[27];const ne=ae,re=async Be=>{const{dentalSelfAttestation:ft}=Be===void 0?{}:Be;if(d){if(!he||!pe||!Ue)return;const gr=B.getFieldValue("manualPhone"),bt=B.getFieldValue("manualWebsite"),Tt={name:he,manualLocationData:{name:he,address:pe,latitude:G,longitude:xe,phone:gr?N_(gr):void 0,website:bt||void 0}},jn=await I(Tt);tt(),i({to:"/$workspaceSlug/approvals",params:{workspaceSlug:jn.organization_slug}});return}if(!(!ee||!ie))if(s)await $({uuid:s.uuid,name:ie.name}),tt(),Xg(!0);else if(l){const gr=await I({placeId:ee,name:ie.name,dentalSelfAttestation:ft});tt(),i({to:"/$workspaceSlug/approvals",params:{workspaceSlug:gr.organization_slug}})}else{const gr=await M({placeId:ee,name:ie.name,dentalSelfAttestation:ft});tt(),i({to:"/$workspaceSlug/approvals",params:{workspaceSlug:gr.organization_slug}})}};let ze;e[28]!==n?(ze=async Be=>{if(!n)throw new Error("Industry interest submission is not configured");return n(Be)},e[28]=n,e[29]=ze):ze=e[29];const We=ze;let Te;e[30]!==a?(Te=Be=>{if(a){a(Be);return}window.location.assign(Be)},e[30]=a,e[31]=Te):Te=e[31];const He=Te,Ct=j||ke,Xe=s?"Search for your business":"Search for your dental practice",nr=s?void 0:"workspace-dental-us";let ot;e[32]!==W||e[33]!==ne||e[34]!==st||e[35]!==p||e[36]!==Oe||e[37]!==Ct||e[38]!==Xe||e[39]!==nr?(ot=(0,f.jsx)(g_,{onSelect:ne,disabled:Ct,label:"",placeholder:Xe,searchScope:nr,onClear:W,suggestionsPlacement:"bottom",initialValue:p,onSearch:st,autoFocus:Oe}),e[32]=W,e[33]=ne,e[34]=st,e[35]=p,e[36]=Oe,e[37]=Ct,e[38]=Xe,e[39]=nr,e[40]=ot):ot=e[40];let nt;e[41]!==u?(nt=u&&(0,f.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Can't find your business?"," ",(0,f.jsx)("button",{type:"button",onClick:()=>h(!0),className:"text-primary hover:underline",children:"Create manually"})]}),e[41]=u,e[42]=nt):nt=e[42];let Wt;e[43]!==ot||e[44]!==nt?(Wt=(0,f.jsxs)(f.Fragment,{children:[ot,nt]}),e[43]=ot,e[44]=nt,e[45]=Wt):Wt=e[45];const Ht=Wt,jt=$_;let $t;e[46]!==tt?($t=Be=>!Be&&tt(),e[46]=tt,e[47]=$t):$t=e[47];let vt;e[48]!==Me||e[49]!==U||e[50]!==j?(vt=j||U?{status:"pending"}:Me?{status:"dirty",title:"Discard workspace setup?",description:"Workspace setup details will be lost. You can enter them again before creating the workspace."}:{status:"clean"},e[48]=Me,e[49]=U,e[50]=j,e[51]=vt):vt=e[51];const ar=Zd,yt=!Oe&&"sm:!overflow-hidden";let Ae;e[52]!==yt?(Ae=Z("overscroll-none",yt),e[52]=yt,e[53]=Ae):Ae=e[53];let Et;e[54]!==J||e[55]!==Oe?(Et=Z("flex flex-col gap-0 p-0 transition-[width,min-height,scale,opacity,translate] duration-[350ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none sm:max-h-[min(900px,90vh)]",Oe?"sm:min-h-[460px] sm:w-[min(540px,90vw)] sm:min-w-[min(540px,90vw)] sm:max-w-[min(540px,90vw)]":Z("sm:w-[min(800px,90vw)] sm:min-w-[min(800px,90vw)] sm:max-w-[min(800px,90vw)]",J?"h-[100dvh] !overflow-hidden sm:h-[560px] sm:min-h-0 sm:max-h-[90vh]":"sm:h-[640px] sm:min-h-0")),e[54]=J,e[55]=Oe,e[56]=Et):Et=e[56];let pr;e[57]!==J||e[58]!==s?(pr=J?(0,f.jsx)(Zs,{className:"sr-only",children:s?"Choose your business":"Choose your dental practice"}):null,e[57]=J,e[58]=s,e[59]=pr):pr=e[59];const Ar=J?"absolute inset-0 overflow-hidden":Oe?"overflow-visible":"overflow-y-auto";let Kt;e[60]!==Ar?(Kt=Z("flex min-h-0 flex-1 flex-col",Ar),e[60]=Ar,e[61]=Kt):Kt=e[61];const mr=J?(0,f.jsx)(Kv,{dentalOnly:!s,hasMore:A,isLoadingMore:P,loadMoreError:T,onLoadMore:R,keyword:g??p,state:C?{status:"loading"}:x&&te.length===0?{status:"error",error:x}:{status:"success",businesses:te},onBack:Ve,onRetry:()=>y(g??p),onSelect:ne}):Oe?(0,f.jsxs)("div",{className:"flex -translate-y-6 flex-1 flex-col items-center justify-center px-6 py-6",children:[(0,f.jsx)("div",{className:"flex min-h-52 w-full items-center justify-center",children:(0,f.jsx)(ha,{locationData:ie,markerL
26ocation:De,isLoading:ke})}),(0,f.jsx)(Li,{className:"mt-2 items-center text-center sm:text-center",children:(0,f.jsxs)(Zs,{className:"font-bold",children:[s?"Update":"Create new"," workspace"]})}),(0,f.jsx)("div",{className:"mt-6 w-full max-w-md space-y-4 text-left",children:Ht})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(Li,{className:"shrink-0 flex-row items-center gap-2 px-6 pt-6",children:[(0,f.jsx)(dt,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-foreground hover:bg-transparent hover:text-foreground","aria-label":"Back to search",onClick:Je,disabled:j||U,children:(0,f.jsx)(il,{className:"size-4 stroke-[1.75]"})}),!we&&(0,f.jsxs)(Zs,{className:"font-bold",children:[s?"Update":"Create new"," workspace"]})]}),we&&ie?(0,f.jsx)(mb,{business:{...ie,placeId:ee,types:ie.types??[]},eligibility:le,mapPreview:(0,f.jsx)(ha,{locationData:ie,markerLocation:De,isLoading:ke}),isCreating:j,renderDialogTitle:X_,onCreateWorkspace:re,onSubmitInterest:We,onOpenSchedulingLink:He,onPendingChange:K}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)("div",{className:"relative grid min-h-0 flex-1 grid-cols-1 items-stretch gap-6 overflow-visible px-6 py-4 md:grid-cols-[2fr_3fr] md:gap-8",children:[(0,f.jsx)("div",{className:"relative z-10 min-h-0 space-y-4 overflow-y-auto pr-1",children:d?(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)("div",{className:"space-y-3",children:[(0,f.jsx)(B.AppField,{name:"manualName",children:Be=>(0,f.jsx)(Be.TextField,{label:"Business Name *",placeholder:"Acme Plumbing Co.",disabled:j})}),(0,f.jsx)(B.AppField,{name:"manualAddress",children:Be=>(0,f.jsx)(Be.TextField,{label:"Address *",placeholder:"123 Main St, City, State",disabled:j})}),(0,f.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,f.jsx)(B.AppField,{name:"manualLatitude",children:Be=>(0,f.jsx)(Be.TextField,{label:"Latitude *",placeholder:"34.0522",disabled:j})}),(0,f.jsx)(B.AppField,{name:"manualLongitude",children:Be=>(0,f.jsx)(Be.TextField,{label:"Longitude *",placeholder:"-118.2437",disabled:j})})]}),(0,f.jsx)(B.AppField,{name:"manualPhone",children:Be=>(0,f.jsx)(Be.TextField,{label:"Phone",placeholder:"(555) 123-4567",disabled:j,type:"tel"})}),(0,f.jsx)(B.AppField,{name:"manualWebsite",children:Be=>(0,f.jsx)(Be.TextField,{label:"Website",placeholder:"https://example.com",disabled:j,type:"url"})})]})}):Se?(0,f.jsxs)("div",{className:"rounded-lg border border-destructive/40 bg-destructive/5 p-4",role:"alert",children:[(0,f.jsx)("p",{className:"font-medium",children:"Business details couldn't be loaded."}),(0,f.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Your selection is preserved. Try loading the details again."}),(0,f.jsxs)(dt,{type:"button",variant:"outline",size:"sm",className:"mt-3",onClick:()=>{me()},children:[(0,f.jsx)(cl,{}),"Retry details"]})]}):(ie||ke)&&(0,f.jsx)(Dl,{location:ie,isLoading:ke,spacing:"compact"})}),(0,f.jsx)("div",{className:"order-first min-h-[250px] md:order-none md:min-h-0 md:h-full",children:(0,f.jsx)(ha,{locationData:ie,markerLocation:De,isLoading:ke})})]}),je&&(0,f.jsx)(Kd,{className:"mx-0 mt-0 mb-0 shrink-0 rounded-none px-6 py-4 sm:mx-0 sm:mt-0 sm:mb-0 sm:rounded-b-xl",children:(0,f.jsx)(dt,{onClick:()=>re(),disabled:d?!he||!pe||!Ue||j:!ee||!ie||ke||j,children:D?"Creating...":d?"Create Workspace (Manual)":s?"Update Workspace":"Create Workspace"})})]})]});let hr;e[62]!==Kt||e[63]!==mr?(hr=(0,f.jsx)("div",{className:Kt,children:mr}),e[62]=Kt,e[63]=mr,e[64]=hr):hr=e[64];let Vt;e[65]!==ar||e[66]!==Ae||e[67]!==Et||e[68]!==pr||e[69]!==hr?(Vt=(0,f.jsxs)(ar,{viewportClassName:Ae,className:Et,children:[pr,hr]}),e[65]=ar,e[66]=Ae,e[67]=Et,e[68]=pr,e[69]=hr,e[70]=Vt):Vt=e[70];let kr;return e[71]!==jt||e[72]!==o||e[73]!==$t||e[74]!==vt||e[75]!==Vt?(kr=(0,f.jsx)(jt,{open:o,onOpenChange:$t,dismissal:vt,children:Vt}),e[71]=jt,e[72]=o,e[73]=$t,e[74]=vt,e[75]=Vt,e[76]=kr):kr=e[76],kr};function q_(t){return t.values.selectedPlaceId}function W_(t){return t.values.manualName}function H_(t){return t.values.manualAddress}function K_(t){return t.values.manualLatitude}function G_(t){return t.values.manualLongitude}function Y_(t){return t.isDirty}function X_(t){return(0,f.jsx)(Zs,{className:"sr-only",children:t})}var Q_=t=>`The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(t)}) will be ignored.`,J_=t=>`The google.maps.importLibrary() function is already defined, and @googlemaps/js-api-loader will use the existing function instead of overwriting it. The options passed to setOptions (${JSON.stringify(t)}) will be ignored.`,Z_=(t,e)=>`Failed to create Trusted Types policy "${t}": ${e instanceof Error?e.message:String(e)}.
27
28If your Content Security Policy uses "require-trusted-types-for 'script'", allow this policy with "trusted-types ${t} google-maps-api-loader google-maps-api#html lit-html". The "google-maps-api-loader", "lit-html", and "google-maps-api#html" policies are required for full Maps JavaScript API execution. Falling back to a string script URL.`,go="@googlemaps/js-api-loader",vo={createScriptURL:t=>t},Pr;function eS(){if(Pr)return Pr;const t=globalThis.trustedTypes;if(!t)return Pr=vo,Pr;try{Pr=t.createPolicy(go,{createScriptURL:e=>e})}catch(e){Z_(go,e),Pr=vo}return Pr}function tS(t,e){t.src=eS().createScriptURL(e)}var rS=t=>{var e,r,s,n="The Google Maps JavaScript API",a="google",i="importLibrary",o="__ib__",l=document,c=window,u=c[a]||(c[a]={}),d=u.maps||(u.maps={}),h=new Set,p=new URLSearchParams,m=()=>e||(e=new Promise(async(g,v)=>{await(r=l.createElement("script")),p.set("libraries",[...h]+"");for(s in t)p.set(s.replace(/[A-Z]/g,_=>"_"+_[0].toLowerCase()),t[s]);p.set("callback",a+".maps.__ib__"),tS(r,"https://maps.googleapis.com/ma
28ps/api/js?"+p),d[o]=g,r.onerror=()=>e=v(Error(n+" could not load.")),r.nonce=l.querySelector("script[nonce]")?.nonce||"",l.head.append(r)}));d[i]?console.warn(n+" only loads once. Ignoring:",t):d[i]=(g,...v)=>h.add(g)&&m().then(()=>d[i](g,...v))},ja=!1;function sS(t){if(ja){Q_(t);return}t.apiKey&&(t.key||(t.key=t.apiKey)),aS(t),ja=!0}async function nS(t){if(!window?.google?.maps?.importLibrary)throw new Error("google.maps.importLibrary is not installed.");return await google.maps.importLibrary(t)}function aS(t){const e=!!window.google?.maps?.importLibrary;e&&J_(t),e||rS(t)}sS({key:"AIzaSyCHfBq5w7prKn13yrS3XZEnbQVu4HUPGuo",v:"beta"});var iS=t=>{const e=(0,V.c)(5),{children:r}=t,[s,n]=(0,b.useState)(!1);let a,i;if(e[0]!==s?(a=()=>{s||nS("places").then(()=>{n(!0)})},i=[s],e[0]=s,e[1]=a,e[2]=i):(a=e[1],i=e[2]),(0,b.useEffect)(a,i),!s)return null;let o;return e[3]!==r?(o=(0,f.jsx)(f.Fragment,{children:r}),e[3]=r,e[4]=o):o=e[4],o},lA=Re({name:oe().trim().min(1).max(200),email:Ao().max(320),phone:oe().trim().max(50).optional(),businessName:oe().trim().min(1).max(200),placeId:oe().trim().min(1).max(255),detectedIndustry:oe().trim().min(1).max(100).nullable(),googlePlaceTypes:ko(oe().trim().min(1).max(100)).max(50),consentToContact:Su(!0),website:oe().max(200).optional()}).strict(),oS=Re({schedulingUrl:wu().startsWith("https://")}),lS=(t,e,r,s,n,a,i,o)=>{let l=document.documentElement,c=["light","dark"];function u(p){(Array.isArray(t)?t:[t]).forEach(m=>{let g=m==="class",v=g&&a?n.map(_=>a[_]||_):n;g?(l.classList.remove(...v),l.classList.add(a&&a[p]?a[p]:p)):l.setAttribute(m,p)}),d(p)}function d(p){o&&c.includes(p)&&(l.style.colorScheme=p)}function h(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(s)u(s);else try{let p=localStorage.getItem(e)||r;u(i&&p==="system"?h():p)}catch{}},cS=b.createContext(void 0),uS={setTheme:t=>{},themes:[]},dS=()=>{var t;return(t=b.useContext(cS))!=null?t:uS},cA=b.memo(({forcedTheme:t,storageKey:e,attribute:r,enableSystem:s,enableColorScheme:n,defaultTheme:a,value:i,themes:o,nonce:l,scriptProps:c})=>{let u=JSON.stringify([r,e,a,t,o,i,s,n]).slice(1,-1);return b.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?l:"",dangerouslySetInnerHTML:{__html:`(${lS.toString()})(${u})`}})}),Xs={success:"!border-success-200 !bg-success-100 !text-success-700 dark:!border-success-200/20 dark:!bg-success-950 dark:!text-success-400 [&:has([data-button])_[data-icon]]:!text-success-700 [&:has([data-button])_[data-title]]:!text-success-700 dark:[&:has([data-button])_[data-icon]]:!text-success-400 dark:[&:has([data-button])_[data-title]]:!text-success-400",error:"!border-destructive-200 !bg-destructive-100 !text-destructive-700 dark:!border-destructive-200/20 dark:!bg-destructive-950 dark:!text-destructive-400 [&:has([data-button])_[data-icon]]:!text-destructive-700 [&:has([data-button])_[data-title]]:!text-destructive-700 dark:[&:has([data-button])_[data-icon]]:!text-destructive-400 dark:[&:has([data-button])_[data-title]]:!text-destructive-400",warning:"!border-warning-200 !bg-warning-100 !text-warning-700 dark:!border-warning-200/20 dark:!bg-warning-950 dark:!text-warning-400 [&:has([data-button])_[data-icon]]:!text-warning-700 [&:has([data-button])_[data-title]]:!text-warning-700 dark:[&:has([data-button])_[data-icon]]:!text-warning-400 dark:[&:has([data-button])_[data-title]]:!text-warning-400",info:"!border-info-200 !bg-info-100 !text-info-700 dark:!border-info-200/20 dark:!bg-info-950 dark:!text-info-400 [&:has([data-button])_[data-icon]]:!text-info-700 [&:has([data-button])_[data-title]]:!text-info-700 dark:[&:has([data-button])_[data-icon]]:!text-info-400 dark:[&:has([data-button])_[data-title]]:!text-info-400"},fS="!top-2 !right-2 !left-auto !size-7 !transform-none !rounded-md !border !border-transparent !bg-transparent !text-current !opacity-72 !transition-[color,background-color,border-color,opacity] hover:![border-color:color-mix(in_oklab,currentColor_30%,transparent)] hover:![background-color:color-mix(in_oklab,currentColor_10%,transparent)] hover:!text-current hover:!opacity-100 focus-visible:!outline-none focus-visible:!ring-2 focus-visible:!ring-muted-foreground
28/20",pS="!text-primary [&.sonner-loader]:!text-primary [&_.sonner-loading-bar]:!bg-primary [&_svg]:!text-primary",mS=Z(fu({size:"sm"}),"!h-8 !rounded-md !bg-primary !px-3 !text-sm !font-medium !text-primary-foreground !shadow-xs hover:!bg-primary/90 focus-visible:!ring-[3px] focus-visible:!ring-ring/50"),hS="has-[[data-button]]:!border-border/40 has-[[data-button]]:!bg-background has-[[data-button]]:!text-foreground has-[[data-button]]:[&_[data-description]]:!text-muted-foreground",gS=t=>{const e=(0,V.c)(64);let r,s,n,a,i,o,l,c;e[0]!==t?({className:r,closeButton:i,icons:s,position:o,richColors:l,style:a,toastOptions:c,...n}=t,e[0]=t,e[1]=r,e[2]=s,e[3]=n,e[4]=a,e[5]=i,e[6]=o,e[7]=l,e[8]=c):(r=e[1],s=e[2],n=e[3],a=e[4],i=e[5],o=e[6],l=e[7],c=e[8]);const u=i===void 0?!0:i,d=o===void 0?"bottom-right":o,h=l===void 0?!0:l,{theme:p}=dS(),m=p===void 0?"system":p;let g;e[9]!==c?.classNames?(g=c?.classNames??{},e[9]=c?.classNames,e[10]=g):g=e[10];const v=g,_=d==="left-center"?"top-left":d==="right-center"?"top-right":d,S=d==="left-center"?"[&[data-x-position=left][data-y-position=top]]:!top-[calc(50%_-_var(--front-toast-height,0px)_/_2)] [&[data-x-position=left][data-y-position=top]]:!bottom-auto":d==="right-center"?"[&[data-x-position=right][data-y-position=top]]:!top-[calc(50%_-_var(--front-toast-height,0px)_/_2)] [&[data-x-position=right][data-y-position=top]]:!bottom-auto":void 0,y=m;let w;e[11]!==r||e[12]!==S?(w=Z("toaster group",S,r),e[11]=r,e[12]=S,e[13]=w):w=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=(0,f.jsx)(mn,{className:"size-4","aria-hidden":"true"}),e[14]=C):C=e[14];let x;e[15]!==s?(x={close:C,...s},e[15]=s,e[16]=x):x=e[16];let k;e[17]!==a?(k={"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"color-mix(in oklab, var(--muted-foreground) 20%, transparent)","--success-bg":"var(--success-100)","--success-border":"var(--success-200)","--success-text":"var(--success-700)","--error-bg":"var(--destructive-100)","--error-border":"var(--destructive-200)","--error-text":"var(--destructive-700)","--warning-bg":"var(--warning-100)","--warning-border":"var(--warning-200)","--warning-text":"var(--warning-700)","--info-bg":"var(--info-100)","--info-border":"var(--info-200)","--info-text":"var(--info-700)",...a},e[17]=a,e[18]=k):k=e[18];const A=k;let P;e[19]!==v.toast?(P=Z("font-telegraf !pe-10 has-[[data-button]]:!w-[min(30rem,calc(100vw-2rem))] has-[[data-button]]:!pe-14",hS,v.toast),e[19]=v.toast,e[20]=P):P=e[20];let T;e[21]!==v.actionButton?(T=Z(mS,v.actionButton),e[21]=v.actionButton,e[22]=T):T=e[22];let R;e[23]!==v.closeButton?(R=Z(fS,v.closeButton),e[23]=v.closeButton,e[24]=R):R=e[24];let I;e[25]!==v.content?(I=Z("min-w-0 flex-1",v.content),e[25]=v.content,e[26]=I):I=e[26];let E;e[27]!==v.icon?(E=Z("!mt-0.5 !self-start",v.icon),e[27]=v.icon,e[28]=E):E=e[28];let M;e[29]!==v.loader?(M=Z(pS,v.loader),e[29]=v.loader,e[30]=M):M=e[30];let F;e[31]!==v.success?(F=Z(Xs.success,v.success),e[31]=v.success,e[32]=F):F=e[32];let $;e[33]!==v.error?($=Z(Xs.error,v.error),e[33]=v.error,e[34]=$):$=e[34];let O;e[35]!==v.warning?(O=Z(Xs.warning,v.warning),e[35]=v.warning,e[36]=O):O=e[36];let D;e[37]!==v.info?(D=Z(Xs.info,v.info),e[37]=v.info,e[38]=D):D=e[38];let j;e[39]!==v||e[40]!==P||e[41]!==T||e[42]!==R||e[43]!==I||e[44]!==E||e[45]!==M||e[46]!==F||e[47]!==$||e[48]!==O||e[49]!==D?(j={...v,toast:P,actionButton:T,closeButton:R,content:I,icon:E,loader:M,success:F,error:$,warning:O,info:D},e[39]=v,e[40]=P,e[41]=T,e[42]=R,e[43]=I,e[44]=E,e[45]=M,e[46]=F,e[47]=$,e[48]=O,e[49]=D,e[50]=j):j=e[50];let U;e[51]!==j||e[52]!==c?(U={...c,classNames:j},e[51]=j,e[52]=c,e[53]=U):U=e[53];let q;return e[54]!==u||e[55]!==n||e[56]!==h||e[57]!==_||e[58]!==A||e[59]!==U||e[60]!==y||e[61]!==w||e[62]!==x?(q=(0,f.jsx)(ud,{theme:y,className:w,closeButton:u,icons:x,position:_,richColors:h,style:A,toastOptions:U,...n}),e[54]=u,e[55]=n,e[56]=h,e[57]=_,e[58]=A,e[59]=U,e[60]=y,e[61]=w,e[62]=x,e[63]=q):q=e[63],q};function vS(t){if(t instanceof Error)return t.message||t.name||"Error";if(typeof t=="string")return t;if(t==null)return"Unknown error (thrown value was undefined or null)";try{return JSON.stringify(t)}catch{return String(t)}}function yS(t){const e=(0,V.c)(14),{error:r,reset:s}=t;let n;e[0]!==r?(n=vS(r),e[0]=r,e[1]=n):n=e[1];const a=n;console.error("[RootErrorComponent] Uncaught route error:",r);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,f.jsxs)(Pl,{children:[(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[(0,f.jsx)(ll,{className:"text-destructive h-5 w-5"}),(0,f.jsx)(uv,{children:"Something went wrong"})]}),(0,f.jsx)(dv,{children:"An unexpected error occurred. You can try again or reload the page."})]}),e[2]=i):i=e[2];let o;e[3]!==a?(o=!1,e[3]=a,e[4]=o):o=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=(0,f.jsx)(Am,{className:"mr-1.5 h-4 w-4"}),e[5]=l):l=e[5];let c;e[6]!==s?(c=(0,f.jsxs)(dt,{onClick:s,variant:"default",children:[l,"Try Again"]}),e[6]=s,e[7]=c):c=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,f.jsx)(dt,{onClick:bS,variant:"outline",children:"Reload Page"}),e[8]=u):u=e[8];let d;e[9]!==c?(d=(0,f.jsxs)("div",{className:"flex gap-2",children:[c,u]}
28),e[9]=c,e[10]=d):d=e[10];let h;return e[11]!==o||e[12]!==d?(h=(0,f.jsx)("div",{className:"flex min-h-screen items-center justify-center px-4 py-6",children:(0,f.jsxs)(Pn,{className:"border-destructive max-w-md",children:[i,(0,f.jsxs)(El,{className:"space-y-4",children:[o,d]})]})}),e[11]=o,e[12]=d,e[13]=h):h=e[13],h}function bS(){return window.location.reload()}var Nr=Xc()({component:_S,errorComponent:yS});function _S(){const t=(0,V.c)(9),e=Pt();let r;t[0]!==e?(r=async c=>{if(await Eu())return e("industry-interest",{method:"POST",body:c});const u=Ro();if(!u)throw new Error("No authenticated discovery session");const d=await fetch(Jr("/api/industry-interest"),{method:"POST",headers:{Authorization:`Bearer ${u}`,"Content-Type":"application/json"},body:JSON.stringify(c)}),h=await d.json().catch(SS);if(!d.ok)throw new Error("Industry interest submission failed");const p=oS.safeParse(h);if(!p.success)throw new Error("Industry interest submission returned an invalid response");return p.data},t[0]=e,t[1]=r):r=t[1];const s=r;let n;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,f.jsx)($g,{}),t[2]=n):n=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=(0,f.jsx)(Yc,{}),t[3]=a):a=t[3];let i;t[4]!==s?(i=(0,f.jsx)(z_,{onSubmitIndustryInterest:s}),t[4]=s,t[5]=i):i=t[5];let o;t[6]===Symbol.for("react.memo_cache_sentinel")?(o=(0,f.jsx)(gS,{}),t[6]=o):o=t[6];let l;return t[7]!==i?(l=(0,f.jsx)(iS,{children:(0,f.jsxs)(wh,{children:[n,(0,f.jsxs)("div",{className:"h-full",children:[a,i,o]})]})}),t[7]=i,t[8]=l):l=t[8],l}function SS(){}be();var wS=()=>ye(()=>import("./_-CA6uVo2t.js"),__vite__mapDeps([0,1,2,3,4])),xS=fe("/$")({beforeLoad:({context:t})=>{if(!t.auth?.isAllowed)throw Dr({to:"/authenticate",search:{}})},component:ve(wS,"component")});be();var CS=()=>ye(()=>import("./_authenticated-CyIoY9hQ.js"),__vite__mapDeps([5,1,2,3,4])),AS=fe("/_authenticated")({beforeLoad:({context:t})=>{if(!t.auth?.isAllowed)throw Dr({to:"/authenticate",search:{}})},component:ve(CS,"component")});be();var kS=()=>ye(()=>import("./authenticate-4xCUBq7z.js"),__vite__mapDeps([6,2,1,3,4,7,8,9,10,11,12,13,14,15,16,17,18])),IS=fe("/authenticate")({validateSearch:Re({token:oe().optional().catch(void 0),stytch_token_type:oe().optional().catch(void 0),slug:oe().optional().catch(void 0)}),component:ve(kS,"component")});be();var PS=()=>ye(()=>import("./password-reset-8NyrV7Mz.js"),__vite__mapDeps([19,2,1,3,4,8,20,14,13,15,11,10,21,22,23,24,25,12,16,17,18])),ES=fe("/password-reset")({validateSearch:Re({token:oe().optional().catch(void 0)}),component:ve(PS,"component")});be();var RS=()=>ye(()=>import("./success-B4BCD7DD.js"),__vite__mapDeps([26,2,1,3,4])),TS=fe("/success")({component:ve(RS,"component")}),MS=fe("/_authenticated/")({beforeLoad:()=>{throw Dr({to:"/dashboard"})}});be();var OS=()=>ye(()=>import("./_workspaceSlug-C1vUMuGh.js").then(t=>t.t),__vite__mapDeps([27,2,1,3,4,28,8,29,30,20,14,13,15,31,32,33,11,34,35,36,37,38,10,39,40,41,42,43,22,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,23,24,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,16,17,86,87,88,89,90,91,92,93])),FS=fe("/_authenticated/$workspaceSlug")({validateSearch:Re({sandbox:hn().optional().catch(void 0),parentWs:oe().optional().catch(void 0),draftV:mt().int().optional().catch(void 0)}),component:ve(OS,"component")});be();var DS=()=>ye(()=>import("./dashboard-gxgCLmsW.js"),__vite__mapDeps([94,1,2,3,4,29,8,28,30,20,14,13,15,89,10,11,85,22,86,79,87,88,90,91,38,39,76,46,92,93,12,16,17,18])),LS=fe("/_authenticated/dashboard")({component:ve(DS,"component")});be();var NS=()=>ye(()=>import("./authorize-DJfxANA4.js"),__vite__mapDeps([95,2,1,3,4,28,8,7,9,29,30,12,13,14,15,16,17,18])),jS=fe("/oauth/authorize")({component:ve(NS,"component")}),zt=(t,e)=>["optimization-plans",t,e],bi=(t,e)=>["optimization-plans",t,"detail",e];function $S(t,e){return!t?.domain||t.domain===e.domain}var Fn=(t,e)=>["optimization-plan-apply-workflow",t,e],bc=new Set(["queued","running","waiting","waitingForPause"]),_c=3e5,VS={applying:"Bee recorded your decision. Automatic changes are still being applied.",applied:"Bee recorded your decision. Automatic changes were already applied.",partially_applied:"Bee recorded your decision. Some automatic changes were applied; review the recorded outcome.",failed:"Bee recorded your decision. Automatic changes could not be applied. Review the recorded outcome."},_i=(t,e)=>`honeygrid:optimization-apply:${t}:${e}`;function Is(t,e,r,s){t.setQueryData(Fn(e,r),s);try{globalThis.localStorage?.setItem(_i(e,r),JSON.stringify(s))}catch{}}function BS(t,e,r,s,n){const a={workflowId:n,startedAt:Date.now()};Is(t,e,s.uuid,a);const i={...s,status:"applying"};t.setQueryData(zt(e,r),o=>o?.map(l=>l.uuid===s.uuid?i:l)),t.setQueryData(bi(e,s.uuid),i)}function US(t,e){let r;try{r=globalThis.localStorage?.getItem(_i(t,e))}catch{return}if(r)try{const s=JSON.parse(r);return typeof s.workflowId=="string"&&typeof s.startedAt=="number"?{workflowId:s.workflowId,startedAt:s.startedAt,...s.paused===!0?{paused:!0}:void 0,...s.terminal===!0?{terminal:!0}:void 0}:void 0}catch{return{workflowId:r,startedAt:0}}}function zS(t,e){return e&&(!t||e.startedAt>t.startedAt)?e:t??e}function qS(t){return typeof t.workflowId=="string"&&t.workflowId.length>0}function Sc(t,e,r,s){const n=t.getQueryData(e);if(!(!n||n===r))return n.terminal?s:{...s,status:n.paused?"approved":"applying"}}function WS(t,e,r,s){ht.warning("Automatic-change tracking expired",{id:`optimization-apply-tracking-expired:${e}:${r.uuid}`,description:"HoneyGrid can no longer confirm whether the automatic changes finished. Review the recommendation’s re
28corded status before taking further action."}),Is(t,e,r.uuid,{...s,terminal:!0})}function HS(t,e){const{queryClient:r,key:s,pending:n,plan:a,workspaceId:i}=t,o=!e||e.workflow.status==="unknown";if(n.paused&&o){const c=r.getQueryData(s);return c&&c!==n&&!c.paused?c.terminal?a:{...a,status:"applying"}:(r.setQueryData(s,n),{...a,status:"approved"})}if(e?.workflow.status!=="paused")return;const l=Sc(r,s,n,a);return l||(Is(r,i,a.uuid,{...n,paused:!0}),ht.warning("Automatic changes paused",{id:`optimization-apply-paused:${i}:${a.uuid}`,description:a.domain==="search_terms"?"Select Apply to resume the automatic changes.":"No resume action is available for this recommendation. Review its recorded status before taking further action."}),{...a,status:"approved"})}function KS(t,e,r){if(!["approved","applying"].includes(r.status))return;const{queryClient:s,key:n,pending:a,plan:i,workspaceId:o}=t,l=!e||e.workflow.status==="unknown",c=e&&["complete","errored","terminated"].includes(e.workflow.status);if(!l&&!c)return;const u=Sc(s,n,a,r);return u||(l?(WS(s,o,i,a),r):(ht.warning("Automatic changes could not be confirmed",{id:`optimization-apply-outcome-unavailable:${o}:${i.uuid}`,description:"The apply workflow ended, but HoneyGrid could not confirm whether changes were applied. Review the recommendation’s recorded status before taking further action."}),Is(s,o,i.uuid,{...a,terminal:!0}),r))}async function GS(t){const{apiFetch:e,queryClient:r,workspaceId:s,plan:n,key:a,pending:i}=t;if(n.status!=="approved"&&n.status!=="applying")return{plan:n,retainTracking:!1};const o=await e(`workspaces/${s}/optimization-workflows/status/${encodeURIComponent(i.workflowId)}`).catch(()=>null);if(o&&bc.has(o.workflow.status))return Is(r,s,n.uuid,{workflowId:i.workflowId,startedAt:Date.now()}),{plan:{...n,status:"applying"},retainTracking:!0};const l=HS(t,o);if(l)return{plan:l,retainTracking:!0};if((!o||o.workflow.status==="unknown")&&Date.now()-i.startedAt<_c)return r.setQueryData(a,i),{plan:{...n,status:"applying"},retainTracking:!0};let c=n;if(o){const d=await e(`workspaces/${s}/optimization-plans/${encodeURIComponent(n.uuid)}`).catch(()=>null);if(!d)return{plan:{...n,status:"applying"},retainTracking:!0};c=d.plan}const u=KS(t,o,c);return u?{plan:u,retainTracking:!0}:{plan:c,retainTracking:!1}}async function $a(t,e,r,s){const n=Fn(r,s.uuid),a=e.getQueryData(n),i=zS(a,US(r,s.uuid));if(!i)return s.status==="applying"&&e.setQueryData(n,{startedAt:Date.now()}),s;if(i!==a&&e.setQueryData(n,i),i.terminal&&["approved","applying"].includes(s.status))return s;if(!qS(i))return Date.now()-i.startedAt<_c||(ht.warning("Automatic-change tracking expired",{id:`optimization-apply-tracking-expired:${r}:${s.uuid}`,description:"HoneyGrid can no longer confirm whether the automatic changes finished. Review the recommendation’s recorded status before taking further action."}),e.setQueryData(n,{...i,terminal:!0})),s;const o=await GS({apiFetch:t,queryClient:e,workspaceId:r,plan:s,key:n,pending:i});if(o.retainTracking)return o.plan;e.removeQueries({queryKey:n,exact:!0});try{globalThis.localStorage?.removeItem(_i(r,s.uuid))}catch{}return o.plan}var yo=["pending_review","draft"],YS=(t,e,r=!1)=>{const s=new URLSearchParams;return t.campaignUuid&&s.set("campaignUuid",t.campaignUuid),t.status&&s.set("status",t.status),t.domain&&s.set("domain",t.domain),s.set("limit",t.campaignUuid||r?"100":"50"),e!==void 0&&s.set("offset",String(e)),s.toString()};function sr(){const t=(0,V.c)(5),{organization:e}=qa(),{workspaces:r}=Ha();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={strict:!1},t[0]=s):s=t[0];const{workspaceSlug:n}=ru(s);if(n?.startsWith("sandbox_"))return n;let a;return t[1]!==e?.organization_id||t[2]!==n||t[3]!==r?(a=r.find(i=>i.organization_slug===n)?.organization_id??e?.organization_id,t[1]=e?.organization_id,t[2]=n,t[3]=r,t[4]=a):a=t[4],a}function XS(t){const e=new Map;for(const r of t)for(const s of r)e.set(s.uuid,s);return[...e.values()]}function wc(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t)):void 0}var xc=(t,e)=>["optimization-plan-reversal-workflows",t,e],Va=(t,e)=>`honeygrid:optimization-reversals:${t}:${e}`;function QS(t,e){try{const r=globalThis.localStorage?.getItem(Va(t,e));if(!r)return{};const s=JSON.parse(r);return Object.fromEntries(Object.entries(s).filter(n=>typeof n[1].itemId=="string"&&typeof n[1].reversalId=="string"&&typeof n[1].workflowId=="string"&&typeof n[1].requestedAt=="string").map(([n,a])=>[n,{...a,...typeof a.terminalObservedAt=="number"?{terminalObservedAt:a.terminalObservedAt}:void 0}]))}catch{return{}}}function Cc(t,e,r,s){const n=xc(e,r);t.setQueryData(n,s);try{Object.keys(s).length===0?globalThis.localStorage?.removeItem(Va(e,r)):globalThis.localStorage?.setItem(Va(e,r),JSON.stringify(s))}catch{}}function Si(t,e,r){const s=xc(e,r),n=t.getQueryData(s);if(n)return n;const a=QS(e,r);return t.setQueryData(s,a),a}var JS=1e4,ZS=3e5;function Ac(t){return Object.fromEntries(t.items.flatMap(e=>{const r=(e.guardrail_results??[]).flatMap(s=>{const n=wc(s);return n?.guardrail==="manual_reversal"&&n.status==="requested"&&n.inverseType!=="no_change"&&n.inverseType!=="reconcile_exclusion_ver
28sion"&&typeof n.reversalId=="string"&&typeof n.requestedAt=="string"?[{at:n.requestedAt,pending:{itemId:e.uuid,reversalId:n.reversalId,workflowId:n.reversalId,requestedAt:n.requestedAt}}]:n?.guardrail==="manual_reversal_attempt"&&n.status==="started"&&typeof n.reversalId=="string"&&typeof n.workflowId=="string"&&typeof n.startedAt=="string"?[{at:n.startedAt,pending:{itemId:e.uuid,reversalId:n.reversalId,workflowId:n.workflowId,requestedAt:n.startedAt}}]:n?.guardrail==="manual_reversal_result"&&(n.status==="succeeded"||n.status==="failed")&&typeof n.completedAt=="string"?[{at:n.completedAt,pending:null}]:[]}).sort((s,n)=>n.at.localeCompare(s.at))[0];return r?.pending?[[e.uuid,r.pending]]:[]}))}async function Ba(t,e,r,s){const n=Si(e,r,s.uuid),a={...Ac(s),...n},i=await Promise.all(Object.entries(a).map(async([l,c])=>{const u=s.items.find(p=>p.uuid===l);if(!u||(u.guardrail_results??[]).some(p=>{const m=wc(p);return m?.guardrail==="manual_reversal_result"&&m.reversalId===c.reversalId&&typeof m.completedAt=="string"&&m.completedAt>=c.requestedAt}))return null;const d=await t(`workspaces/${r}/optimization-workflows/status/${encodeURIComponent(c.workflowId)}`).catch(()=>null);if(d&&bc.has(d.workflow.status))return[l,{...c,terminalObservedAt:void 0}];if(!d||d.workflow.status==="unknown")return Date.now()-Date.parse(c.requestedAt)<ZS?[l,c]:null;const h=c.terminalObservedAt??Date.now();return Date.now()-h<JS?[l,{...c,terminalObservedAt:h}]:null})),o=Object.fromEntries(i.filter(l=>l!==null));return JSON.stringify(o)!==JSON.stringify(n)&&Cc(e,r,s.uuid,o),s}function kc(t,e,r){return Object.keys(Si(t,e,r)).length>0}function Ic(t){return Object.keys(Ac(t)).length>0}function uA(t,e){const r=(0,V.c)(24);let s;r[0]!==e?(s=e===void 0?{}:e,r[0]=e,r[1]=s):s=r[1];const n=s,a=Pt(),i=Lt(),o=sr();let l;r[2]!==t||r[3]!==n.paginate||r[4]!==o?(l=n.paginate?[...zt(o,t),"all-pages"]:zt(o,t),r[2]=t,r[3]=n.paginate,r[4]=o,r[5]=l):l=r[5];let c;r[6]!==a||r[7]!==t||r[8]!==n.paginate||r[9]!==i||r[10]!==o?(c=async()=>{const m=async S=>{const y=[];let w=!1;for(;!w;){const C=YS(S,S.campaignUuid||n.paginate?y.length:void 0,n.paginate),x=await a(`workspaces/${o}/optimization-plans?${C}`);y.push(...x.plans),w=!S.campaignUuid&&!n.paginate||x.plans.length<100}return y};if(t.status||n.paginate)return await Promise.all((await m(t)).map(S=>$a(a,i,o,S).then(y=>Ba(a,i,o,y))));const[g,v,_]=await Promise.all([m({...t,status:yo[0]}),m({...t,status:yo[1]}),m(t)]);return await Promise.all(XS([g,v,_]).map(S=>$a(a,i,o,S).then(y=>Ba(a,i,o,y))))},r[6]=a,r[7]=t,r[8]=n.paginate,r[9]=i,r[10]=o,r[11]=c):c=r[11];const u=!!o&&n.enabled!==!1;let d;r[12]!==t||r[13]!==o?(d=(m,g)=>g?.queryKey[1]===o&&g?.queryKey[2]?.campaignUuid===t.campaignUuid&&$S(g?.queryKey[2],t)?m:void 0,r[12]=t,r[13]=o,r[14]=d):d=r[14];let h;r[15]!==i||r[16]!==o?(h=m=>m.state.data?.some(g=>{const v=i.getQueryData(Fn(o,g.uuid));return g.status==="applying"&&!v?.paused&&!v?.terminal||kc(i,o,g.uuid)||Ic(g)})?2e3:!1,r[15]=i,r[16]=o,r[17]=h):h=r[17];let p;return r[18]!==l||r[19]!==c||r[20]!==u||r[21]!==d||r[22]!==h?(p={queryKey:l,queryFn:c,enabled:u,placeholderData:d,refetchInterval:h},r[18]=l,r[19]=c,r[20]=u,r[21]=d,r[22]=h,r[23]=p):p=r[23],ys(p)}function dA(t){const e=(0,V.c)(19),r=Pt(),s=Lt(),n=sr();let a,i,o;if(e[0]!==t||e[1]!==n){const h=pd.safeParse(t);o=h.success?h.data:void 0,i=ys,a=bi(n,o),e[0]=t,e[1]=n,e[2]=a,e[3]=i,e[4]=o}else a=e[2],i=e[3],o=e[4];let l;e[5]!==r||e[6]!==s||e[7]!==o||e[8]!==n?(l=async()=>{if(!n||!o)throw new Error("A workspace and valid optimization plan id are required");const h=await r(`workspaces/${n}/optimization-plans/${encodeURIComponent(o)}`),p=await $a(r,s,n,h.plan);return await Ba(r,s,n,p)},e[5]=r,e[6]=s,e[7]=o,e[8]=n,e[9]=l):l=e[9];const c=!!n&&!!o;let u;e[10]!==s||e[11]!==o||e[12]!==n?(u=h=>{const p=s.getQueryData(Fn(n,o));return h.state.data&&(h.state.data.status==="applying"&&!p?.paused&&!p?.terminal||kc(s,n,h.state.data.uuid)||Ic(h.state.data))?2e3:!1},e[10]=s,e[11]=o,e[12]=n,e[13]=u):u=e[13];let d;return e[14]!==a||e[15]!==l||e[16]!==c||e[17]!==u?(d={queryKey:a,queryFn:l,enabled:c,throwOnError:!1,refetchInterval:u},e[14]=a,e[15]=l,e[16]=c,e[17]=u,e[18]=d):d=e[18],i(d)}
28function fA(){const t=(0,V.c)(9),e=Pt(),r=sr();let s;t[0]!==r?(s=["optimization-plans",r,"summary"],t[0]=r,t[1]=s):s=t[1];let n;t[2]!==e||t[3]!==r?(n=async()=>(await e(`workspaces/${r}/optimization-plans/summary`)).summary,t[2]=e,t[3]=r,t[4]=n):n=t[4];const a=!!r;let i;return t[5]!==s||t[6]!==n||t[7]!==a?(i={queryKey:s,queryFn:n,enabled:a},t[5]=s,t[6]=n,t[7]=a,t[8]=i):i=t[8],ys(i)}function pA(t){const e=(0,V.c)(19),r=Pt(),s=Lt(),n=sr(),a=_s(n);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={suppressGlobalErrorToast:!0},e[0]=i):i=e[0];let o;e[1]!==t||e[2]!==n?(o=()=>({workspaceId:n,filters:{...t}}),e[1]=t,e[2]=n,e[3]=o):o=e[3];let l;e[4]!==r||e[5]!==a||e[6]!==n?(l=async h=>{const{planId:p,decision:m,expectedReviewVersion:g}=h;return await r(`workspaces/${n}/optimization-plans/${p}/${m}`,{method:"POST",body:a(p,g,m)})},e[4]=r,e[5]=a,e[6]=n,e[7]=l):l=e[7];let c;e[8]!==s?(c=async(h,p,m)=>{const{plan:g,applyWorkflowId:v}=h,{decision:_}=p;v&&BS(s,m.workspaceId,m.filters,g,v),_==="reject"?ht.success("Recommendation rejected",{description:"Bee recorded your decision. No changes will be applied from this recommendation."}):(g.status==="failed"?ht.error:g.status==="partially_applied"?ht.warning:ht.success)(g.status==="failed"?"Recommendation approved; automatic changes failed":"Recommendation approved",{description:v?"Bee started applying this optimization. Review its progress here.":VS[g.status]??"Bee recorded your decision. No automatic changes were started."}),Promise.allSettled([s.invalidateQueries({queryKey:zt(m.workspaceId,m.filters)}),s.invalidateQueries({queryKey:["optimization-plans",m.workspaceId]})])},e[8]=s,e[9]=c):c=e[9];let u;e[10]!==t||e[11]!==s||e[12]!==n?(u=(h,p,m)=>{const g=m?.workspaceId??n,v=m?.filters??t;p.suppressErrorToast||ht.error("Plan review could not be confirmed",{description:"Refresh the plan and review its current status before retrying."}),Promise.allSettled([s.invalidateQueries({queryKey:zt(g,v)}),s.invalidateQueries({queryKey:["optimization-plans",g]})])},e[10]=t,e[11]=s,e[12]=n,e[13]=u):u=e[13];let d;return e[14]!==o||e[15]!==l||e[16]!==c||e[17]!==u?(d={meta:i,onMutate:o,mutationFn:l,onSuccess:c,onError:u},e[14]=o,e[15]=l,e[16]=c,e[17]=u,e[18]=d):d=e[18],rr(d)}function mA(t,e){const r=(0,V.c)(14),s=e===void 0?!1:e,n=Pt(),a=Lt(),i=sr(),o=_s(i);let l;r[0]!==s?(l={suppressGlobalErrorToast:s},r[0]=s,r[1]=l):l=r[1];let c;r[2]!==n||r[3]!==o||r[4]!==i?(c=async h=>{const{planId:p,itemId:m,decision:g,expectedReviewVersion:v}=h;if(g.decision==="prepare"){await n(`workspaces/${i}/approvals/recommendations/${m}/prepare`,{method:"POST",body:{expectedReviewVersion:v,editedState:g.editedState}});return}return(await n(`workspaces/${i}/optimization-plans/${p}/items/${m}/review`,{method:"POST",body:{...g,...o(`${p}:${m}`,v,g)}})).plan},r[2]=n,r[3]=o,r[4]=i,r[5]=c):c=r[5];let u;r[6]!==t||r[7]!==a||r[8]!==i?(u=async()=>{await a.invalidateQueries({queryKey:zt(i,t)}),await a.invalidateQueries({queryKey:["optimization-plans",i]}),await a.invalidateQueries({queryKey:["brand-competitor-config",i]})},r[6]=t,r[7]=a,r[8]=i,r[9]=u):u=r[9];let d;return r[10]!==l||r[11]!==c||r[12]!==u?(d={meta:l,mutationFn:c,onSuccess:u},r[10]=l,r[11]=c,r[12]=u,r[13]=d):d=r[13],rr(d)}function hA(t){const e=(0,V.c)(13),r=Pt(),s=Lt(),n=sr(),a=_s(n);let i;e[0]!==r||e[1]!==a||e[2]!==n?(i=async u=>{const{planId:d,itemId:h,decision:p,reason:m,expectedReviewVersion:g}=u;return(await r(`workspaces/${n}/optimization-plans/${encodeURIComponent(d)}/items/${encodeURIComponent(h)}/review`,{method:"POST",body:{decision:p,...m&&{reason:m},...a(`${d}:${h}`,g,{decision:p,reason:m})}})).plan},e[0]=r,e[1]=a,e[2]=n,e[3]=i):i=e[3];let o,l;e[4]!==t||e[5]!==s||e[6]!==n?(o=async()=>{await s.invalidateQueries({queryKey:zt(n,t)}),await s.invalidateQueries({queryKey:["optimization-plans",n]})},l=async()=>{await s.invalidateQueries({queryKey:zt(n,t)}),await s.invalidateQueries({queryKey:["optimization-plans",n]}),ht.error("Search-term review could not be confirmed",{description:"Refresh the plan and review its current status before retrying this item."})},e[4]=t,e[5]=s,e[6]=n,e[7]=o,e[8]=l):(o=e[7],l=e[8]);let c;return e[9]!==i||e[10]!==o||e[11]!==l?(c={mutationFn:i,onSuccess:o,onError:l},e[9]=i,e[10]=o,e[11]=l,e[12]=c):c=e[12],rr(c)}function gA(t){const e=(0,V.c)(16),r=Pt(),s=Lt(),n=sr(),a=_s(n);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={suppressGlobalErrorToast:!0},e[0]=i):i=e[0];let o;e[1]!==t||e[2]!==n?(o=()=>({workspaceId:n,filters:{...t}}),e[1]=t,e[2]=n,e[3]=o):o=e[3];let l;e[4]!==r||e[5]!==a||e[6]!==n?(l=async d=>{const{planId:h,itemId:p,expectedReviewVersion:m,...g}=d;
28return await r(`workspaces/${n}/optimization-plans/${encodeURIComponent(h)}/items/${encodeURIComponent(p)}/override`,{method:"POST",body:{...g,...a(`${h}:${p}:edit`,m,g)}})},e[4]=r,e[5]=a,e[6]=n,e[7]=l):l=e[7];let c;e[8]!==t||e[9]!==s||e[10]!==n?(c=(d,h,p,m)=>{const g=m?.workspaceId??n,v=m?.filters??t;Promise.allSettled([s.invalidateQueries({queryKey:zt(g,v)}),s.invalidateQueries({queryKey:["optimization-plans",g]})])},e[8]=t,e[9]=s,e[10]=n,e[11]=c):c=e[11];let u;return e[12]!==o||e[13]!==l||e[14]!==c?(u={meta:i,onMutate:o,mutationFn:l,onSettled:c},e[12]=o,e[13]=l,e[14]=c,e[15]=u):u=e[15],rr(u)}function vA(t){const e=(0,V.c)(16),r=Pt(),s=Lt(),n=sr();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={suppressGlobalErrorToast:!0},e[0]=a):a=e[0];let i;e[1]!==t||e[2]!==n?(i=()=>({workspaceId:n,filters:{...t}}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let o;e[4]!==r||e[5]!==n?(o=async d=>{const{planId:h,itemId:p,expectedRevision:m}=d;return await r(`workspaces/${n}/optimization-plans/${encodeURIComponent(h)}/items/${encodeURIComponent(p)}/reverse`,{method:"POST",body:{expectedRevision:m}})},e[4]=r,e[5]=n,e[6]=o):o=e[6];let l,c;e[7]!==s||e[8]!==n?(l=(d,h,p)=>{if(!d.workflowPending||!d.workflowId||!d.workflowRequestedAt)return;const m=p?.workspaceId??n,g=Si(s,m,h.planId);Cc(s,m,h.planId,{...g,[h.itemId]:{itemId:h.itemId,reversalId:d.reversalId,workflowId:d.workflowId,requestedAt:d.workflowRequestedAt}})},c=async(d,h,p,m)=>{const g=m?.workspaceId??n;await Promise.allSettled([s.invalidateQueries({queryKey:["optimization-plans",g]}),s.invalidateQueries({queryKey:bi(g,p.planId)})])},e[7]=s,e[8]=n,e[9]=l,e[10]=c):(l=e[9],c=e[10]);let u;return e[11]!==i||e[12]!==o||e[13]!==l||e[14]!==c?(u={meta:a,onMutate:i,mutationFn:o,onSuccess:l,onSettled:c},e[11]=i,e[12]=o,e[13]=l,e[14]=c,e[15]=u):u=e[15],rr(u)}function yA(t){const e=(0,V.c)(13),r=Pt(),s=Lt(),n=sr(),a=_s(n);let i;e[0]!==r||e[1]!==a||e[2]!==n?(i=async u=>{const{planId:d,decisions:h}=u;let p=null;for(let m=0;m<h.length;m=m+250){const g=h.slice(m,m+250).map(v=>{const{expectedReviewVersion:_,...S}=v;return{...S,...a(`${d}:${S.itemId}`,_,S)}});p=(await r(`workspaces/${n}/optimization-plans/${encodeURIComponent(d)}/items/review`,{method:"POST",body:{decisions:g}})).plan}if(!p)throw new TypeError("Bulk review requires at least one decision");return p},e[0]=r,e[1]=a,e[2]=n,e[3]=i):i=e[3];let o,l;e[4]!==t||e[5]!==s||e[6]!==n?(o=async()=>{await s.invalidateQueries({queryKey:zt(n,t)}),await s.invalidateQueries({queryKey:["optimization-plans",n]})},l=async()=>{await s.invalidateQueries({queryKey:zt(n,t)}),await s.invalidateQueries({queryKey:["optimization-plans",n]}),ht.error("Bulk search-term review could not be confirmed",{description:"Refresh the plan and review its current status before retrying."})},e[4]=t,e[5]=s,e[6]=n,e[7]=o,e[8]=l):(o=e[7],l=e[8]);let c;return e[9]!==i||e[10]!==o||e[11]!==l?(c={mutationFn:i,onSuccess:o,onError:l},e[9]=i,e[10]=o,e[11]=l,e[12]=c):c=e[12],rr(c)}var Pc=fe("/_authenticated/$workspaceSlug/")({component:e1});function e1(){const t=(0,V.c)(11),{workspaceSlug:e}=Pc.useParams(),r=bf(sr());if(r.data?.hasPending===!0&&!r.isError){let o;return t[0]!==e?(o=(0,f.jsx)(Ii,{to:"/$workspaceSlug/approvals",params:{workspaceSlug:e},replace:!0}),t[0]=e,t[1]=o):o=t[1],o}if(r.data?.hasPending===!1&&!r.isError){let o;return t[2]!==e?(o=(0,f.jsx)(Ii,{to:"/$workspaceSlug/dashboard",params:{workspaceSlug:e},replace:!0}),t[2]=e,t[3]=o):o=t[3],o}const s=r.isError||r.data?.hasPending===null?"Pending approvals could not be checked. Retry to choose the workspace starting page.":"Checking pending approvals.";let n;t[4]!==s?(n=(0,f.jsx)(In,{children:s}),t[4]=s,t[5]=n):n=t[5];let a;t[6]!==r?(a=(r.isError||r.data?.hasPending===null)&&(0,f.jsx)(dt,{onClick:()=>{r.refetch()},children:"Retry approvals"}),t[6]=r,t[7]=a):a=t[7];let i;return t[8]!==n||t[9]!==a?(i=(0,f.jsxs)("div",{className:"space-y-3 p-6",children:[n,a]}),t[8]=n,t[9]=a,t[10]=i):i=t[10],i}be();var t1=()=>ye(()=>import("./ads-CyIoY9hQ.js"),__vite__mapDeps([96,1,2,3,4])),r1=fe("/_authenticated/$workspaceSlug/ads")({component:ve(t1,"component")});be();var s1=()=>ye(()=>import("./approvals-n3MoGJTn.js"),__vite__mapDeps([97,2,1,3,4,28,8,30,20,14,13,15,98,99,100,101,102,103,104,11,68,63,64,66,38,10,39,72,105,70,106,73,107,74,108,109,41,32,110,89,90,111,112,113,114,115,48,59,22,23,24,60,76,46,116,45,
28117,78,118,79,119,120,35,121,122,123,124,88,125,126,127,128,129,87,130,131,56,53,57,58,132,133,134,135,136,137,138,54,67,69,71,139,21,62,65,140,44,77,80,83,141,142,47,85,93,92,143,144,145,146,147,148,149,150,151,152,153,61,75,154,155,156,157,158,159])),n1=_f.partial().extend({view:Qe(["pending","history"]).optional(),approvalId:oe().min(1).max(500).optional()}),a1=fe("/_authenticated/$workspaceSlug/approvals")({validateSearch:n1,component:ve(s1,"component")});be();var i1=()=>ye(()=>import("./bee-CXDVv09d.js").then(t=>t.t),__vite__mapDeps([160,2,1,3,4,28,8,30,20,14,13,15,161,162,163,127,164,165,31,32,33,11,34,78,118,166,167,129,101,168,88,41,169,110,170,154,171,89,111,51,114,172,82,52,91,115,67,68,63,64,69,70,71,72,61,22,44,76,46,116,45,121,90,75,92,173,139,77,79,80,174,48,175,123,176,177,87,38,10,39,59,23,24,60,178,179,50,55,56,53,57,58,81,155,180,181,182])),o1=fe("/_authenticated/$workspaceSlug/bee")({component:ve(i1,"component")});be();var l1=()=>ye(()=>import("./campaigns-DL8xHy6N.js"),__vite__mapDeps([183,2,1,3,4,184,20,14,13,15,120,98,78,35,89,121,90,22,40,136,185,138,139,44,146,186,187])),c1=fe("/_authenticated/$workspaceSlug/campaigns")({component:ve(l1,"component")});be();var u1=()=>ye(()=>import("./dashboard-DiFHjXhp.js"),__vite__mapDeps([188,1,2,3,4,28,8,30,20,14,13,15,189,120,98,78,35,89,121,90,22,190,40,170,163,169,154,171,191,192,193,194,11,63,64,38,10,39,74,147,195,196,101,48,77,79,80,182,197,18])),d1=fe("/_authenticated/$workspaceSlug/dashboard")({component:ve(u1,"component")});be();var f1=()=>ye(()=>import("./debug-DPLyI1lp.js"),__vite__mapDeps([198,2,1,3,4,28,8,30,20,14,13,15,98,199,119,189,177,87,102,103,163,88,169,126,127,112,136,193,91,48,38,10,11,39,21,22,23,24,145,200,100,201,182,157,118,202,203,204,59,60,148])),p1=fe("/_authenticated/$workspaceSlug/debug")({component:ve(f1,"component")});be();var m1=()=>ye(()=>import("./grids-Cmh7N59-.js"),__vite__mapDeps([205,2,1,3,4,28,8,20,14,13,15,118,206,207,204,208,30,165,98,209,78,35,80,120,89,121,90,22,101,124,125,43,11,44,45,46,47,48,210,68,63,64,108,72,105,66,70,106,73,211,137,172,53,212,54,131,56,38,10,39,57,58,213,21,23,24,59,60,214,154,171,215,77,79,34,145,146,133,216,217,218,134,219,174,182,220,221,143,9,222])),h1=fe("/_authenticated/$workspaceSlug/grids")({validateSearch:Re({gridId:oe().optional().catch(void 0),view:Qe(["map","table","cards"]).optional().catch(void 0)}),component:ve(m1,"component")});be();var g1=()=>ye(()=>import("./handbook-Bn-MJdmi.js"),__vite__mapDeps([223,2,1,3,4,29,8,28,30,10,11,182,20,14,13,15])),v1=fe("/_authenticated/$workspaceSlug/handbook")({component:ve(g1,"component")});be();var y1=()=>ye(()=>import("./inbox-C7Nl8mdL.js"),__vite__mapDeps([224,2,1,3,4,28,8,30,20,14,13,15,98,199,78,118,206,177,120,35,89,121,90,22,225,165,85,122,175,204,226,163,40,41,227,169,201,218,170,154,171,127,111,136,192,193,228,38,10,11,39,55,56,53,57,58,44,76,46,75,45,173,139,214,215,77,79,80,180,83,54,229,93,92,147,182])),b1=fe("/_authenticated/$workspaceSlug/inbox")({component:ve(y1,"component")});be();var _1=()=>ye(()=>import("./landing-pages-CyIoY9hQ.js"),__vite__mapDeps([230,1,2,3,4])),S1=fe("/_authenticated/$workspaceSlug/landing-pages")({component:ve(_1,"component")});be();var w1=()=>ye(()=>import("./media-assets-BrtZFUVd.js"),__vite__mapDeps([231,2,1,3,4,28,8,30,29,20,14,13,15,232,120,98,78,35,89,121,90,22,175,226,163,44,146,119,167,233,101,87,123,203,103,227,125,126,153,134,234,235,172,82,236,76,46,45,16,237,219,11,39,38,10,21,23,24,59,48,60,73,63,66,116,77,79,80,238,34,47,239,147,240,65,148,200,100,102,88,201,149,182,159,202,204,241,106])),x1=fe("/_authenticated/$workspaceSlug/media-assets")({component:ve(w1,"component")});be();var C1=()=>ye(()=>import("./orders-m9hI_EEE.js"),__vite__mapDeps([242,2,1,3,4,28,8,30,20,14,13,15,98,243,78,35,177,120,89,121,90,22,244,101,124,163,41,170,169,154,171,127,191,137,52,48,11,64,38,10,39,21,23,24,215,77,79,80,47,85,93,92,145,146,182,245,59,60,246,247,248])),A1=fe("/_authenticated/$workspaceSlug/orders")({component:ve(C1,"component")});be();var k1=()=>ye(()=>import("./postcards-CyIoY9hQ.js"),__vite__mapDeps([249,1,2,3,4])),I1=fe("/_authenticated/$workspaceSlug/postcards")({component:ve(k1,"component")});be();var P1=()=>ye(()=>import("./practice-information-qtTs_GUH.js"),__vite__mapDeps([250,2,1,3,4,28,8,30,20,14,13,15,232,120,98,78,35,89,121,90,22,175,226,163,44,146,118,79,11,38,10,39,21,23,24,73,63,66,240,65,148,149,159,241,106])),E1=fe("/_authenticated/$workspaceSlug/practice-information")({component:ve(P1,"component")});be();var R1=()=>ye(()=>import("./settings-CyIoY9hQ.js"),__vite__mapDeps([251,1,2,3,4])),T1=fe("/_authenticated/$workspaceSlug/settings")({component:ve(R1,"component")});be();var M1=()=>ye(()=>import("./sign-up-CrLGznYD.js"),__vite__mapDeps([252,2,1,3,4,20,14,13,15,21,22,23,24,59,48,60,182,245,246,247,253])),O1=fe("/_authenticated/$workspaceSlug/sign-up")({component:ve(M1,"component")});be();var F1=()=>ye(()=>import("./local-codex.pair-Cp4NjSfR.js"),__vite__mapDeps([254,2,1,3,4,20,14,13,15,119,255,11,63,65,66,130,51,38,10,39,147])),D1=fe("/_authenticated/local-codex/pair")({component:ve(F1,"component")});be();var L1=()=>ye(()=>import("./ads.index-DaBFFI4e.js"),__vite__mapDeps([256,1,2,3,4,257,28,8,30,20,14,13,15,99,100,101,102,103,104,11,68,63,64,66,38,10,39,72,105,70,106,73,107,74,108,109,41,32,110,89,90,111,112,113,114,115,48,59,22,23,24,60,76,46,116,45,
28117,258,29,165,209,232,120,98,78,35,121,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,129,261,225,85,207,123,255,204,124,130,262,88,40,125,218,49,153,170,169,154,171,179,134,234,51,135,136,192,172,82,236,16,237,219,138,53,212,54,58,139,21,61,92,77,174,155,83,263,141,132,93,264,189,144,265,145,266,147,246,240,148,200,201,149,267,151,150,268,195,269,270,57,196,271,33,143,239,182])),N1=fe("/_authenticated/$workspaceSlug/ads/")({component:ve(L1,"component")});be();var j1=()=>ye(()=>import("./ads._artifactSlug-B4-e96vw.js"),__vite__mapDeps([272,1,2,3,4,257,28,8,30,20,14,13,15,99,100,101,102,103,104,11,68,63,64,66,38,10,39,72,105,70,106,73,107,74,108,109,41,32,110,89,90,111,112,113,114,115,48,59,22,23,24,60,76,46,116,45,117,258,29,165,209,232,120,98,78,35,121,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,129,261,225,85,207,123,255,204,124,130,262,88,40,125,218,49,153,170,169,154,171,179,134,234,51,135,136,192,172,82,236,16,237,219,138,53,212,54,58,139,21,61,92,77,174,155,83,263,141,132,93,264,189,144,265,145,266,147,246,240,148,200,201,149,267,151,150,268,195,269,270,57,196,271,33,143,239,182])),$1=fe("/_authenticated/$workspaceSlug/ads/$artifactSlug")({validateSearch:Zr,component:ve(j1,"component")}),V1=fe("/_authenticated/$workspaceSlug/ads/approvals")({beforeLoad:({params:t})=>{throw Dr({to:"/$workspaceSlug/approvals",params:t,replace:!0})}});be();var B1=()=>ye(()=>import("./ads.new-TTKUl4dc.js"),__vite__mapDeps([273,1,2,3,4,257,28,8,30,20,14,13,15,99,100,101,102,103,104,11,68,63,64,66,38,10,39,72,105,70,106,73,107,74,108,109,41,32,110,89,90,111,112,113,114,115,48,59,22,23,24,60,76,46,116,45,117,258,29,165,209,232,120,98,78,35,121,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,129,261,225,85,207,123,255,204,124,130,262,88,40,125,218,49,153,170,169,154,171,179,134,234,51,135,136,192,172,82,236,16,237,219,138,53,212,54,58,139,21,61,92,77,174,155,83,263,141,132,93,264,189,144,265,145,266,147,246,240,148,200,201,149,267,151,150,268,195,269,270,57,196,271,33,143,239,182])),U1=fe("/_authenticated/$workspaceSlug/ads/new")({validateSearch:Zr,component:ve(B1,"component")});be();var z1=()=>ye(()=>import("./ads.recommendations-DcBdndrT.js"),__vite__mapDeps([274,2,1,3,4,28,8,30,20,14,13,15,31,32,33,11,34,232,120,98,78,35,89,121,90,22,175,226,163,44,146,100,259,79,119,167,190,110,50,113,38,10,39,61,75,76,46,45,275,164,165,161,162,127,118,166,129,101,168,88,41,169,170,154,171,111,51,114,172,82,52,91,115,67,68,63,64,69,70,71,72,116,92,173,139,77,80,174,48,62,56,65,66,53,57,58,73,74,83,54,84,276,132,155,47,93,143,147,220])),q1=fe("/_authenticated/$workspaceSlug/ads/recommendations")({component:ve(z1,"component")});be();var W1=()=>ye(()=>import("./bee_.recommendations-CHezk2jE.js"),__vite__mapDeps([277,2,1,3,4,30,20,14,13,15,31,32,33,11,34,162,163,127,78,119,166,40,125,22,42,153,89,134,135,136,185,82,53,212,38,10,39,57,58,67,68,63,64,69,70,71,72,139,21,23,24,61,62,56,65,66,73,74,140,75,76,46,45,92,154,275,28,8,164,165,161,118,167,129,101,168,88,41,169,110,170,171,111,51,114,172,52,91,115,44,116,121,90,173,77,79,80,174,48,83,54,84,276,132,155,47,93,117,143,145,146,266,150,151,267,268,195,269,270,182,152,59,60,147,156,157,186,184,120,98,35,138,221])),H1=Cu(oe(),xu()),K1=fe("/_authenticated/$workspaceSlug/bee_/recommendations")({validateSearch:H1,component:ve(W1,"component")});be();var G1=()=>ye(()=>import("./campaigns.index-BlHmGdP-.js"),__vite__mapDeps([278,2,1,3,4,20,14,13,15,98,119,189,279,40,170,163,169,154,171,90,50,138,38,10,11,39,33,44,22,76,46,116,121,77,78,79,80,93,92,264,144,145,267,28,8,30,151,150,268,195,269,270,53,57,182,186,89,184,120,35,136,185,139,146,280,68,63,64,74,108,72,107,281,282,283,265])),Y1=fe("/_authenticated/$workspaceSlug/campaigns/")({component:ve(G1,"component")});be();var X1=()=>ye(()=>import("./campaigns._campaignUuid-BVESYM-m.js"),__vite__mapDeps([284,2,1,3,4,28,8,30,20,14,13,15,243,78,118,79,189,120,98,35,89,121,90,22,261,244,285,101,87,190,286,38,10,11,39,287,151,279,88,170,163,169,154,171,179,192,172,193,82,91,48,228,68,63,64,270,53,57,21,23,24,59,60,288,61,72,44,214,215,77,80,238,34,155,76,46,45,263,141,117,143,264,144,147,109,150,268,195,269,271,281,74,282,197,216,283,265])
28),Q1=fe("/_authenticated/$workspaceSlug/campaigns/$campaignUuid")({component:ve(X1,"component")}),J1=fe("/_authenticated/$workspaceSlug/campaigns/approvals")({beforeLoad:({params:t})=>{throw Dr({to:"/$workspaceSlug/approvals",params:t,replace:!0})}});be();var Z1=()=>ye(()=>import("./campaigns.brand-aliases-BgrR260v.js"),__vite__mapDeps([289,2,1,3,4,28,8,30,29,20,14,13,15,120,98,78,35,89,121,90,22,101,136,38,10,11,39,21,23,24,59,48,60,71,68,63,64,70,44,92,77,79,80,132,93,145,147,182,187])),ew=fe("/_authenticated/$workspaceSlug/campaigns/brand-aliases")({component:ve(Z1,"component")});be();var tw=()=>ye(()=>import("./campaigns.competitors-jMeF0-Iz.js"),__vite__mapDeps([290,2,1,3,4,28,8,30,29,20,14,13,15,161,119,120,98,78,35,89,121,90,22,101,135,185,48,11,68,63,64,38,10,39,21,23,24,59,60,92,77,79,80,132,93,145,147,182,156,187,291])),rw=fe("/_authenticated/$workspaceSlug/campaigns/competitors")({component:ve(tw,"component")});be();var sw=()=>ye(()=>import("./campaigns.import-Bp822a3r.js"),__vite__mapDeps([292,2,1,3,4,28,8,30,20,14,13,15,78,39,38,10,11,270,53,57,76,46,116,45,264,189,163,144,265,147,151,195,182,133,217,293,21,22,23,24,263])),nw=fe("/_authenticated/$workspaceSlug/campaigns/import")({component:ve(sw,"component")});be();var aw=()=>ye(()=>import("./campaigns.new-BAeb30Q6.js"),__vite__mapDeps([294,2,1,3,4,28,8,20,14,13,15,244,190,130,89,90,48,228,11,68,63,64,39,38,10,270,30,53,57,21,22,23,24,288,264,189,163,144,147,182,133,280,74,108,72,107,281,282,287,151,216])),iw=fe("/_authenticated/$workspaceSlug/campaigns/new")({component:ve(aw,"component")});be();var ow=()=>ye(()=>import("./data-sources.index-DwUDXnnb.js"),__vite__mapDeps([295,2,1,3,4,28,8,20,14,13,15,296,30,78,259,79,36,119,166,177,285,175,297,88,125,22,234,172,82,138,91,11,63,131,56,38,10,39,53,57,58,21,23,24,59,48,60,61,92,77,80,155,76,46,45,143,145,147,158,133,245,246,89,182])),lw=fe("/_authenticated/$workspaceSlug/data-sources/")({component:ve(ow,"component")});be();var cw=()=>ye(()=>import("./grids.index-CMW4cduK.js"),__vite__mapDeps([298,2,1,3,4,28,8,20,14,13,15,299,30,98,78,259,79,167,120,35,89,121,90,22,261,244,190,297,262,88,208,165,209,80,101,124,125,43,11,44,45,46,47,48,210,68,63,64,108,72,105,66,70,106,73,211,137,172,53,212,54,131,56,38,10,39,57,58,213,21,23,24,59,60,214,154,171,215,77,34,145,146,133,216,217,40,170,163,169,234,235,192,82,300,91,270,139,61,69,76,116,92,174,276,93,264,189,144,147,269,151,196,271,282,283,265])),uw=fe("/_authenticated/$workspaceSlug/grids/")({component:ve(cw,"component")});be();var dw=()=>ye(()=>import("./grids._uuid-DBGf-fwe.js"),__vite__mapDeps([301,299,2,1,3,4,28,8,30,20,14,13,15,98,78,259,79,167,120,35,89,121,90,22,261,244,190,297,262,88,208,165,209,80,101,124,125,43,11,44,45,46,47,48,210,68,63,64,108,72,105,66,70,106,73,211,137,172,53,212,54,131,56,38,10,39,57,58,213,21,23,24,59,60,214,154,171,215,77,34,145,146,133,216,217,40,170,163,169,234,235,192,82,300,91,270,139,61,69,76,116,92,174,276,93,264,189,144,147,269,151,196,271,282,283,265])),fw=fe("/_authenticated/$workspaceSlug/grids/$uuid")({component:ve(dw,"component")});be();var pw=()=>ye(()=>import("./grids.add-DBGf-fwe.js"),__vite__mapDeps([302,299,2,1,3,4,28,8,30,20,14,13,15,98,78,259,79,167,120,35,89,121,90,22,261,244,190,297,262,88,208,165,209,80,101,124,125,43,11,44,45,46,47,48,210,68,63,64,108,72,105,66,70,106,73,211,137,172,53,212,54,131,56,38,10,39,57,58,213,21,23,24,59,60,214,154,171,215,77,34,145,146,133,216,217,40,170,163,169,234,235,192,82,300,91,270,139,61,69,76,116,92,174,276,93,264,189,144,147,269,151,196,271,282,283,265])),mw=fe("/_authenticated/$workspaceSlug/grids/add")({component:ve(pw,"component")});be();var hw=()=>ye(()=>import("./landing-pages.index-DO4VZHt4.js"),__vite__mapDeps([303,1,2,3,4,304,28,8,258,30,29,20,14,13,15,165,209,232,120,98,78,35,89,121,90,22,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,11,63,66,38,10,39,129,261,225,85,101,207,123,103,255,204,124,130,262,88,40,104,68,64,72,105,70,106,73,107,74,108,109,41,125,110,218,49,153,170,169,154,171,179,134,234,111,51,135,113,136,114,192,172,82,236,76,46,45,16,237,219,138,48,53,212,54,58,139,21,23,24,59,60,61,116,92,77,174,155,83,263,141,132,93,117,264,189,144,265,145,266,147,246,240,148,200,100,102,201,149,267,151,150,268,195,269,270,57,196,271,305,182])),gw=fe("/_authenticated/$workspaceSlug/landing-pages/")({component:ve(hw,"component")});be();var vw=()=>ye(()=>import("./landing-pages._artifactSlug-Dg2aYGIs.js"),__vite__mapDeps([306,1,2,3,4,182,20,14,13,15,304,28,8,258,30,29,165,209,232,120,98,78,35,89,121,90,22,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,11,63,66,38,10,39,129,261,225,85,101,207,123,103,255,204,124,130,262,88,40,104,68,64,72,105,70,106,73,107,74,108,109,41,125,110,218,49,153,170,169,154,171,179,134,234,111,51,135,113,136,114,192,172,82,236,76,46,45,16,237,219,138,48,53,212,54,58,139,21,23,24,59,60,61,116,92,77,174,155,83,263,141,132,93,117,264,189,144,265,145,266,147,246,240,148,200,100,102,201,149,267,151,150,268,195,269,270,57,196,271])),yw=fe("/_authenticated/$workspaceSlug/landing-pages/$artifactSlug")({validateSearch:Zr,component:ve(vw,"component")});be();var bw=()=>ye(()=>import("./landing-pages.new-BnZVQQHH.js"),__vite__mapDeps([307,1,2,3,4,182,20,14,13,15,304,28,8,258,30,29,165,209,232,120,98,78,35,89,121,90,22,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,11,63,66,38,10,39,129,261,225,85,101,207,123,103,255,204,124,130,262,88,40,104,68,64,72,105,70,106,73,107,74,108,109,41,125,110,218,49,153,170,169,154,171,179,134,234,111,51,135,113,136,114,192,172,82,236,76,46,45,16,237,219,138,48,53,212,54,58,139,21,23,24,59,60,61,116,92,77,174,155,83,263,141,132,93,117,264,189,144,265,145,266,147,246,240,148,200,100,102,201,149,267,151,150,268,195,269,270,57,196,271])),_w=fe("/_authenticated/$workspaceSlug/landing-pages/new")({validateSearch:Zr,component:ve(bw,"component")});be();var Sw=()=>ye(()=>import("./postcards.index-CGLkseY_.js"),__vite__mapDeps([308,1,2,3,4,305,182,20,14,13,15,309,28,8,258,30,29,165,209,232,120,98,78,35,89,121,90,22,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,11,63,66,38,10,39,129,261,225,85,101,207,123,103,255,204,124,130,262,88,40,104,68,64,72,105,70,106,73,107,74,108,109,41,125,110,218,49,153,170,169,154,171,179,134,234,111,51,135,113,136,114,192,172,82,236,76,46,45,16,237,219,138,48,53,212,54,58,139,21,23,24,59,60,61,116,92,77,174,155,83,263,141,132,93,117,264,189,144,265,145,266,147,246,240,148,200,100,102,201,149,267,151,150,268,195,269,270,57,196,271])),ww=fe("/_authenticated/$workspaceSlug/postcards/")({component:ve(Sw,"component")});be();var xw=()=>ye(()=>import("./postcards._artifactSlug-xwWBB-OD.js"),__vite__mapDeps([310,1,2,3,4,182,20,14,13,15,309,28,8,258,30,29,165,209,232,120,98,78,35,89,121,90,22,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,11,63,66,38,10,39,129,261,225,85,101,207,123,103,255,204,124,130,262,88,40,104,68,64,72,105,70,106,73,107,74,108,109,41,125,110,218,49,153,170,169,154,171,179,134,234,111,51,135,113,136,114,192,172,82,236,76,46,45,16,237,219,138,48,53,212,54,58,139,21,23,24,59,60,61,116,92,77,174,155,83,263,141,132,93,117,264,189,144,265,145,266,147,246,240,148,200,100,102,201,149,267,151,150,268,195,269,270,57,196,271])),Cw=fe("/_authenticated/$workspaceSlug/postcards/$artifactSlug")({validateSearch:Zr,component:ve(xw,"component")});be();var Aw=()=>ye(()=>import("./postcards.new-BPPcZAjH.js"),__vite__mapDeps([311,1,2,3,4,182,20,14,13,15,309,28,8,258,30,29,165,209,232,120,98,78,35,89,121,90,22,175,226,163,44,146,162,127,199,118,259,79,119,80,167,260,65,11,63,66,38,10,39,129,261,225,85,101,207,123,103,255,204,124,130,262,88,40,104,68,64,72,105,70,106,73,107,74,108,109,41,125,110,218,49,153,170,169,154,171,179,134,234,111,51,135,113,136,114,192,172,82,236,76,46,45,16,237,219,138,48,53,212,54,58,139,21,23,24,59,60,61,116,92,77,174,155,83,263,141,132,93,117,264,189,144,265,145,266,147,246,240,148,200,100,102,201,149,267,151,150,268,195,269,270,57,196,271])),kw=fe("/_authenticated/$workspaceSlug/postcards/new")({validateSearch:Zr,component:ve(Aw,"component")}
28),ga={"brand-aliases":"brand-aliases","workspace-brand-aliases":"brand-aliases","known-competitors":"competitors","workspace-known-competitors":"competitors"};function bo(t){return t?.replace(/^#/,"").replace(/^\/|\/$/g,"")}function Iw({entity:t,hash:e}){const r=bo(e);if(r&&ga[r])return ga[r];const s=bo(t);return s?ga[s]:void 0}function Ec({workspaceSlug:t,...e}){const r=Iw(e);if(r==="brand-aliases")return{to:"/$workspaceSlug/campaigns/brand-aliases",params:{workspaceSlug:t},replace:!0};if(r==="competitors")return{to:"/$workspaceSlug/campaigns/competitors",params:{workspaceSlug:t},replace:!0}}be();var Pw=()=>ye(()=>import("./settings.index-DVu-JH10.js"),__vite__mapDeps([312,1,2,3,4,313,8,28,30,29,20,14,13,15,78,79,35,119,189,167,260,65,11,63,66,38,10,39,37,233,101,87,296,259,36,166,177,285,175,297,88,125,22,234,172,82,138,91,131,56,53,57,58,21,23,24,59,48,60,61,92,77,80,155,76,46,45,143,145,147,158,133,245,246,102,286,287,151,124,168,279,163,227,153,170,169,154,171,127,128,129,130,110,132,89,90,210,68,64,108,72,105,70,106,73,211,137,193,300,194,314,67,69,71,44,121,263,141,85,93,117,144,146,271,186,221,197,291,217,293,264,265,195,247,248,25,253,182])),Ew=fe("/_authenticated/$workspaceSlug/settings/")({beforeLoad:({location:t,params:e})=>{const r=Ec({workspaceSlug:e.workspaceSlug,hash:t.hash});if(r)throw Dr(r)},component:ve(Pw,"component")});be();var Rw=()=>ye(()=>import("./settings._entity-B5nZoCGl.js"),__vite__mapDeps([315,1,2,3,4,313,8,28,30,29,20,14,13,15,78,79,35,119,189,167,260,65,11,63,66,38,10,39,37,233,101,87,296,259,36,166,177,285,175,297,88,125,22,234,172,82,138,91,131,56,53,57,58,21,23,24,59,48,60,61,92,77,80,155,76,46,45,143,145,147,158,133,245,246,102,286,287,151,124,168,279,163,227,153,170,169,154,171,127,128,129,130,110,132,89,90,210,68,64,108,72,105,70,106,73,211,137,193,300,194,314,67,69,71,44,121,263,141,85,93,117,144,146,271,186,221,197,291,217,293,264,265,195,247,248,25,253,182])),Tw=fe("/_authenticated/$workspaceSlug/settings/$entity")({beforeLoad:({location:t,params:e})=>{const r=Ec({workspaceSlug:e.workspaceSlug,entity:e.entity,hash:t.hash});if(r)throw Dr(r)},component:ve(Rw,"component")});be();var Mw=()=>ye(()=>import("./landing-pages._pageId.analytics-DsPtOnar.js"),__vite__mapDeps([316,2,1,3,4,28,8,30,20,14,13,15,199,177,102,110,176,87,170,163,169,154,171,38,10,11,39,59,48,22,23,24,60,178,218,179,113,193,91,68,63,64,66,72,155,76,46,45,145,105,70,106,73,196,101,77,78,79,80,182,211])),Ow=fe("/_authenticated/$workspaceSlug/landing-pages/$pageId/analytics")({component:ve(Mw,"component")});be();var Fw=()=>ye(()=>import("./settings._entity.index-CGU2SlkR.js"),[]),Dw=fe("/_authenticated/$workspaceSlug/settings/$entity/")({component:ve(Fw,"component")});be();var Lw=()=>ye(()=>import("./settings._entity._recordId-CGU2SlkR.js"),[]),Nw=fe("/_authenticated/$workspaceSlug/settings/$entity/$recordId")({component:ve(Lw,"component")});be();var jw=()=>ye(()=>import("./settings._entity.add-CGU2SlkR.js"),[]),$w=fe("/_authenticated/$workspaceSlug/settings/$entity/add")({component:ve(jw,"component")}),Vw=xS.update({id:"/$",path:"/$",getParentRoute:()=>Nr}),Ps=AS.update({id:"/_authenticated",getParentRoute:()=>Nr}),Bw=IS.update({id:"/authenticate",path:"/authenticate",getParentRoute:()=>Nr}),Uw=ES.update({id:"/password-reset",path:"/password-reset",getParentRoute:()=>Nr}),zw=TS.update({id:"/success",path:"/success",getParentRoute:()=>Nr}),qw=MS.update({id:"/",path:"/",getParentRoute:()=>Ps}),it=FS.update({id:"/$workspaceSlug",path:"/$workspaceSlug",getParentRoute:()=>Ps}),Ww=LS.update({id:"/dashboard",path:"/dashboard",getParentRoute:()=>Ps}),Hw=jS.update({id:"/oauth/authorize",path:"/oauth/authorize",getParentRoute:()=>Nr}),Kw=Pc.update({id:"/",path:"/",getParentRoute:()=>it}),ss=r1.update({id:"/ads",path:"/ads",getParentRoute:()=>it}),Gw=a1.update({id:"/approvals",path:"/approvals",getParentRoute:()=>it}),Yw=o1.update({id:"/bee",path:"/bee",getParentRoute:()=>it}),Cr=c1.update({id:"/campaigns",path:"/campaigns",getParentRoute:()=>it}),Xw=d1.update({id:"/dashboard",path:"/dashboard",getParentRoute:()=>it}),Qw=p1.update({id:"/debug",path:"/debug",getParentRoute:()=>it}
28),Dn=h1.update({id:"/grids",path:"/grids",getParentRoute:()=>it}),Jw=v1.update({id:"/handbook",path:"/handbook",getParentRoute:()=>it}),Zw=b1.update({id:"/inbox",path:"/inbox",getParentRoute:()=>it}),Es=S1.update({id:"/landing-pages",path:"/landing-pages",getParentRoute:()=>it}),ex=x1.update({id:"/media-assets",path:"/media-assets",getParentRoute:()=>it}),tx=A1.update({id:"/orders",path:"/orders",getParentRoute:()=>it}),Ln=I1.update({id:"/postcards",path:"/postcards",getParentRoute:()=>it}),rx=E1.update({id:"/practice-information",path:"/practice-information",getParentRoute:()=>it}),wi=T1.update({id:"/settings",path:"/settings",getParentRoute:()=>it}),sx=O1.update({id:"/sign-up",path:"/sign-up",getParentRoute:()=>it}),nx=D1.update({id:"/local-codex/pair",path:"/local-codex/pair",getParentRoute:()=>Ps}),ax=N1.update({id:"/",path:"/",getParentRoute:()=>ss}),ix=$1.update({id:"/$artifactSlug",path:"/$artifactSlug",getParentRoute:()=>ss}),ox=V1.update({id:"/approvals",path:"/approvals",getParentRoute:()=>ss}),lx=U1.update({id:"/new",path:"/new",getParentRoute:()=>ss}),cx=q1.update({id:"/recommendations",path:"/recommendations",getParentRoute:()=>ss}),ux=K1.update({id:"/bee_/recommendations",path:"/bee/recommendations",getParentRoute:()=>it}),dx=Y1.update({id:"/",path:"/",getParentRoute:()=>Cr}),fx=Q1.update({id:"/$campaignUuid",path:"/$campaignUuid",getParentRoute:()=>Cr}),px=J1.update({id:"/approvals",path:"/approvals",getParentRoute:()=>Cr}),mx=ew.update({id:"/brand-aliases",path:"/brand-aliases",getParentRoute:()=>Cr}),hx=rw.update({id:"/competitors",path:"/competitors",getParentRoute:()=>Cr}),gx=nw.update({id:"/import",path:"/import",getParentRoute:()=>Cr}),vx=iw.update({id:"/new",path:"/new",getParentRoute:()=>Cr}),yx=lw.update({id:"/data-sources/",path:"/data-sources/",getParentRoute:()=>it}),bx=uw.update({id:"/",path:"/",getParentRoute:()=>Dn}),_x=fw.update({id:"/$uuid",path:"/$uuid",getParentRoute:()=>Dn}),Sx=mw.update({id:"/add",path:"/add",getParentRoute:()=>Dn}),wx=gw.update({id:"/",path:"/",getParentRoute:()=>Es}),xx=yw.update({id:"/$artifactSlug",path:"/$artifactSlug",getParentRoute:()=>Es}),Cx=_w.update({id:"/new",path:"/new",getParentRoute:()=>Es}),Ax=ww.update({id:"/",path:"/",getParentRoute:()=>Ln}),kx=Cw.update({id:"/$artifactSlug",path:"/$artifactSlug",getParentRoute:()=>Ln}),Ix=kw.update({id:"/new",path:"/new",getParentRoute:()=>Ln}),Px=Ew.update({id:"/",path:"/",getParentRoute:()=>wi}),Nn=Tw.update({id:"/$entity",path:"/$entity",getParentRoute:()=>wi}),Ex=Ow.update({id:"/$pageId/analytics",path:"/$pageId/analytics",getParentRoute:()=>Es}),Rx=Dw.update({id:"/",path:"/",getParentRoute:()=>Nn}),Tx=Nw.update({id:"/$recordId",path:"/$recordId",getParentRoute:()=>Nn}),Mx=$w.update({id:"/add",path:"/add",getParentRoute:()=>Nn}),Ox={AuthenticatedWorkspaceSlugAdsArtifactSlugRoute:ix,AuthenticatedWorkspaceSlugAdsApprovalsRoute:ox,AuthenticatedWorkspaceSlugAdsNewRoute:lx,AuthenticatedWorkspaceSlugAdsRecommendationsRoute:cx,AuthenticatedWorkspaceSlugAdsIndexRoute:ax},Fx=ss._addFileChildren(Ox),Dx={AuthenticatedWorkspaceSlugCampaignsCampaignUuidRoute:fx,AuthenticatedWorkspaceSlugCampaignsApprovalsRoute:px,AuthenticatedWorkspaceSlugCampaignsBrandAliasesRoute:mx,AuthenticatedWorkspaceSlugCampaignsCompetitorsRoute:hx,AuthenticatedWorkspaceSlugCampaignsImportRoute:gx,AuthenticatedWorkspaceSlugCampaignsNewRoute:vx,AuthenticatedWorkspaceSlugCampaignsIndexRoute:dx},Lx=Cr._addFileChildren(Dx),Nx={AuthenticatedWorkspaceSlugGridsUuidRoute:_x,AuthenticatedWorkspaceSlugGridsAddRoute:Sx,AuthenticatedWorkspaceSlugGridsIndexRoute:bx},jx=Dn._addFileChildren(Nx),$x={AuthenticatedWorkspaceSlugLandingPagesArtifactSlugRoute:xx,AuthenticatedWorkspaceSlugLandingPagesNewRoute:Cx,AuthenticatedWorkspaceSlugLandingPagesIndexRoute:wx,AuthenticatedWorkspaceSlugLandingPagesPageIdAnalyticsRoute:Ex},Vx=Es._addFileChildren($x),Bx={AuthenticatedWorkspaceSlugPostcardsArtifactSlugRoute:kx,AuthenticatedWorkspaceSlugPostcardsNewRoute:Ix,AuthenticatedWorkspaceSlugPostcardsIndexRoute:Ax},Ux=Ln._addFileChildren(Bx),zx={AuthenticatedWorkspaceSlugSettingsEntityRecordIdRoute:Tx,AuthenticatedWorkspaceSlugSettingsEntityAddRoute:Mx,AuthenticatedWorkspaceSlugSettingsEntityIndexRoute:Rx},qx={AuthenticatedWorkspaceSlugSettingsEntityRoute:Nn._addFileChildren(zx),AuthenticatedWorkspaceSlugSettingsIndexRoute:Px},Wx={AuthenticatedWorkspaceSlugAdsRoute:Fx,AuthenticatedWorkspaceSlugApprovalsRoute:Gw,AuthenticatedWorkspaceSlugBeeRoute:Yw,AuthenticatedWorkspaceSlugCampaignsRoute:Lx,AuthenticatedWorkspaceSlugDashboardRoute:Xw,AuthenticatedWorkspaceSlugDebugRoute:Qw,AuthenticatedWorkspaceSlugGridsRoute:jx,AuthenticatedWorkspaceSlugHandbookRoute:Jw,AuthenticatedWorkspaceSlugInboxRoute:Zw,AuthenticatedWorkspaceSlugLandingPagesRoute:Vx,AuthenticatedWorkspaceSlugMediaAssetsRoute:ex,AuthenticatedWorkspaceSlugOrdersRoute:tx,AuthenticatedWorkspaceSlugPostcardsRoute:Ux,AuthenticatedWorkspaceSlugPracticeInformationRoute:rx,AuthenticatedWorkspaceSlugSettingsRoute:wi._addFileChildren(qx),AuthenticatedWorkspaceSlugSignUpRoute:sx,AuthenticatedWorkspaceSlugIndexRoute:Kw,AuthenticatedWorkspaceSlugBeeRecommendationsRoute:ux,AuthenticatedWorkspaceSlugDataSourcesIndexRoute:yx},Hx={AuthenticatedWorkspaceSlugRoute:it._addFileChildren(Wx),AuthenticatedDashboardRoute:Ww,AuthenticatedIndexRoute:qw,AuthenticatedLocalCodexPairRoute:nx},Kx={SplatRoute:Vw,AuthenticatedRoute:Ps._addFileChildren(Hx),AuthenticateRoute:Bw,PasswordResetRoute:Uw,SuccessRoute:zw,OauthAuthorizeRoute:Hw},Gx=Nr._addFileChildren(Kx)._addFileTypes(),Xr=Zc({routeTree:Gx,context:{auth:void 0,queryClient:void 0},defaultPreload:"intent",defaultPreloadDelay:50,defaultPreloadStaleTime:0,defaultPendingComponent:Rm,defaultPendingMs:150,defaultPendingMinMs:300,defaultStructuralSharing:!0}),Ua="oauth_return_to";function bA(){localStorage.setItem(Ua,window.location.href)}function Yx(){const t=localStorage.getItem(Ua);return t?(localStorage.removeItem(Ua),window.location.href=t,!0):!1}var Xx=t=>{const e=(0,V.c)(9),{children:r}
28=t,s=So();let n;e[0]!==s?(n={magicLinks:{discovery:{authenticate:async d=>{await s.magicLinks.discovery.authenticate(d)}},authenticate:d=>s.magicLinks.authenticate(d)},oauth:{discovery:{authenticate:async d=>{await s.oauth.discovery.authenticate(d)}}},impersonation:{authenticate:d=>s.impersonation.authenticate(d)},discovery:{organizations:{list:()=>s.discovery.organizations.list()},intermediateSessions:{exchange:async d=>{await s.discovery.intermediateSessions.exchange(d)}}},session:{exchange:async d=>{await s.session.exchange(d)},revoke:async d=>{await s.session.revoke(d)},updateSession:d=>s.session.updateSession(d),authenticate:async d=>{await s.session.authenticate(d)}}},e[0]=s,e[1]=n):n=e[1];const a=n;let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=Pu.provide({actions:{navigateToDashboard:Jx,navigateToExchangedWorkspace:Zx,navigateToAuthenticate:e2,invalidateAllQueries:t2,removeAllQueries:r2,showSuccessToast:s2,markWorkspaceDeleted:n2}}),e[2]=i):i=e[2];const o=i;let l;e[3]!==a?(l={input:{stytchClient:a}},e[3]=a,e[4]=l):l=e[4];let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c=(0,f.jsx)(Qx,{}),e[5]=c):c=e[5];let u;return e[6]!==r||e[7]!==l?(u=(0,f.jsxs)(Po.Provider,{logic:o,options:l,children:[c,r]}),e[6]=r,e[7]=l,e[8]=u):u=e[8],u};function Qx(){const t=(0,V.c)(5),e=Po.useActorRef(),{session:r,fromCache:s}=Wa();let n,a;return t[0]!==e||t[1]!==s||t[2]!==r?(n=()=>{r&&!s?e.send({type:"SESSION_CONFIRMED"}):r&&s?e.send({type:"SESSION_FROM_CACHE"}):!r&&!s&&e.send({type:"SESSION_LOST"})},a=[r,s,e],t[0]=e,t[1]=s,t[2]=r,t[3]=n,t[4]=a):(n=t[3],a=t[4]),(0,b.useEffect)(n,a),null}function Jx(){Xr.history.replace("/dashboard")}function Zx(t){const{context:e}=t;e.exchangedSlug&&(Yx()||Xr.history.replace(`/${e.exchangedSlug}`))}function e2(){Xr.history.replace("/authenticate")}function t2(){_r.invalidateQueries()}function r2(){_r.removeQueries()}function s2(t,e){ht.success(e.message)}function n2(t){const{context:e}=t;
28e.deletingWorkspaceId&&du(e.deletingWorkspaceId)}var a2=t=>{const e=(0,V.c)(11),{error:r,onRetry:s,isRetrying:n}=t;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,f.jsx)(ll,{className:"h-10 w-10 text-destructive"}),e[0]=a):a=e[0];let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,f.jsx)("h1",{className:"text-lg font-semibold",children:"Unable to load your workspaces"}),e[1]=i):i=e[1];const o=r.message||"The Stytch workspace list could not be fetched. Check your connection and try again.";let l;e[2]!==o?(l=(0,f.jsxs)("div",{className:"space-y-1",children:[i,(0,f.jsx)("p",{className:"max-w-md text-sm text-muted-foreground",children:o})]}),e[2]=o,e[3]=l):l=e[3];const c=n?"Retrying...":"Retry";let u;e[4]!==n||e[5]!==s||e[6]!==c?(u=(0,f.jsx)(dt,{onClick:s,disabled:n,children:c}),e[4]=n,e[5]=s,e[6]=c,e[7]=u):u=e[7];let d;return e[8]!==l||e[9]!==u?(d=(0,f.jsxs)("div",{className:"flex h-screen flex-col items-center justify-center gap-4 px-6 text-center",children:[a,l,u]}),e[8]=l,e[9]=u,e[10]=d):d=e[10],d},i2=t=>{const e=(0,V.c)(2),{children:r}=t,s=Pt();_r.setDefaultOptions({queries:{..._r.getDefaultOptions().queries,queryFn:a=>{const{queryKey:i}=a;return s(i.join("/"))}}});let n;return e[0]!==r?(n=(0,f.jsx)(uu,{client:_r,children:r}),e[0]=r,e[1]=n):n=e[1],n},Rc="public-token-live-b3c0ce04-f9c7-4e75-a697-afa22044f5af",o2="https://excited-botany-3858.customers.stytch.com",l2=al(Rc),c2=al(Rc,{customBaseUrl:o2}),u2=()=>{const t=(0,V.c)(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={router:Xr,select:p2},t[0]=e):e=t[0];const r=Jc(e)?c2:l2;let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,f.jsx)(Xx,{children:(0,f.jsx)(i2,{children:(0,f.jsx)(d2,{})})}),t[1]=s):s=t[1];let n;return t[2]!==r?(n=(0,f.jsx)(cu,{stytch:r,children:s}),t[2]=r,t[3]=n):n=t[3],n};function d2(){const t=(0,V.c)(11),{isLoading:e,isAuthenticated:r,isAllowed:s}=Eo(),{workspaces:n,isLoading:a,error:i}=Ha(),o=Lt(),[l,c]=(0,b.useState)(!1),u=Ko(n),d=r&&u,h=n.length>0;if(r&&i&&!h){let m;t[0]!==o?(m=async()=>{c(!0),await o.invalidateQueries({queryKey:["stytch-workspaces"]}).catch(_=>{throw c(!1),_}),c(!1)},t[0]=o,t[1]=m):m=t[1];const g=m;let v;return t[2]!==l||t[3]!==g||t[4]!==i?(v=(0,f.jsx)(a2,{error:i,onRetry:g,isRetrying:l}),t[2]=l,t[3]=g,t[4]=i,t[5]=v):v=t[5],v}if(e||r&&a){let m;return t[6]===Symbol.for("react.memo_cache_sentinel")?(m=(0,f.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,f.jsx)(fn,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),t[6]=m):m=t[6],m}let p;return t[7]!==s||t[8]!==r||t[9]!==d?(p=(0,f.jsx)(f2,{isAuthenticated:r,isAllowed:s,isInternalUser:d}),t[7]=s,t[8]=r,t[9]=d,t[10]=p):p=t[10],p}function f2(t){const e=(0,V.c)(9),{isAuthenticated:r,isAllowed:s,isInternalUser:n}=t,a=(0,b.useRef)(null);let i,o;e[0]!==s||e[1]!==r||e[2]!==n?(i=()=>{const c={isAuthenticated:r,isAllowed:s,isInternalUser:n},u=a.current;a.current=c,u!==null&&(u.isAuthenticated!==c.isAuthenticated||u.isAllowed!==c.isAllowed||u.isInternalUser!==c.isInternalUser)&&Xr.invalidate()},o=[r,s,n],e[0]=s,e[1]=r,e[2]=n,e[3]=i,e[4]=o):(i=e[3],o=e[4]),(0,b.useEffect)(i,o);let l;return e[5]!==s||e[6]!==r||e[7]!==n?(l=(0,f.jsx)(au,{router:Xr,context:{auth:{isAuthenticated:r,isAllowed:s,isInternalUser:n},queryClient:_r}}),e[5]=s,e[6]=r,e[7]=n,e[8]=l):l=e[8],l}function p2(t){return t.location.pathname===yr.oauthAuthorize}(0,kf.createRoot)(document.getElementById("root")).render((0,f.jsxs)(b.StrictMode,{children:[(0,f.jsx)(u2,{}),(0,f.jsx)(If,{})]}));export{eb as $,PC as $t,N_ as A,mC as An,Pn as At,s_ as B,OC as Bt,gS as C,bC as Cn,xv as Ct,iA as D,Tp as Dn,gv as Dt,oA as E,gC as En,zC as Et,S_ as F,Zo as Fn,Pl as Ft,J0 as G,ci as Gt,i_ as H,DC as Ht,g_ as I,ct as In,uv as It,ql as J,TC as Jt,YC as K,EC as Kt,u_ as L,Ko as Ln,In as Lt,On as M,fC as Mn,El as Mt,C_ as N,dC as Nn,dv as Nt,nA as O,fp as On,VC as Ot,w_ as P,Ja as Pn,$C as Pt,Qy as Q,IC as Qt,Z0 as R,wf as Rn,LC as Rt,FS as S,vC as Sn,Av as St,j_ as T,yC as Tn,BC as Tt,n_ as U,rv as Ut,a_ as V,FC as Vt,l_ as W,NC as Wt,zl as X,Jg as Xt,db as Y,Al as Yt,lb as Z,Yg as Zt,mA as _,ol as _n,ty as _t,_w as a,ml as an,As as at,yA as b,Wr as bn,Lv as bt,U1 as c,si as cn,rs as ct,a1 as d,cl as dn,WC as dt,Xg as en,tb as et,dA as f,Am as fn,qC as ft,vA as g,ym as gn,Ge as gt,gA as h,ll as hn,Dl as ht,Cw as i,xC as in,Hy as it,aA as j,hC as jn,jC as jt,L_ as k,pC as kn,fv as kt,$1 as l,yr as ln,HC as lt,uA as m,Sm as mn,my as mt,bA as n,kC as nn,Jy as nt,yw as o,wC as on,Ss as ot,fA as p,xm as pn,mi as pt,bb as q,RC as qt,kw as r,CC as rn,Wy as rt,K1 as s,wh as sn,xs as st,Yx as t,AC as tn,Zy as tt,h1 as u,ei as un,ws as ut,pA as v,qi as vn,Ji as vt,$_ as w,Yt as wn,UC as wt,sr as x,SC as xn,kv as xt,hA as y,il as yn,xt as yt,XC as z,Cf as zn,MC as zt};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.