PageSourceSearch

https://fourevamedia.com/_next/static/chunks/app/(main)/layout-72d…?dpl=dpl_DtPCZbPoZGXvTayFeF2JHvMH65Zh

js fourevamedia.com collected 2026-10-02 05:06:29 UTC 270,263 bytes, 59 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3473,12076,15925,19717,24516,43273,60228,71446,71734,82929,84889,86821,90879,92939],{9785:(e,t,n)=>{"use strict";n.d(t,{C_:()=>i,XP:()=>a,vw:()=>o});let r="ga_utm_data";function a(){if(localStorage.getItem(r))return;let e=new URLSearchParams(window.location.search),t={};for(let n of["utm_source","utm_medium","utm_campaign","utm_term","utm_content"]){let r=e.get(n);r&&(t[n]=r.toLowerCase())}let n=e.get("fbclid")||void 0,a=e.get("gclid")||void 0,i=e.get("msclkid")||void 0,o=document.cookie.match(/(?:^|;\s*)_fbp=([^;]+)/),s=o?decodeURIComponent(o[1]):void 0,l=document.referrer||null,c=Object.keys(t).length>0,d=l&&!l.includes(window.location.hostname);if(!c&&!d&&!(n||a||i))return;!t.utm_source&&n&&(t.utm_source="meta",t.utm_medium=t.utm_medium||"paid"),!t.utm_source&&a&&(t.utm_source="google",t.utm_medium=t.utm_medium||"paid"),!t.utm_source&&i&&(t.utm_source="bing",t.utm_medium=t.utm_medium||"paid");let u={utm:t,referrer:d?l:null,landingPage:window.location.pathname+window.location.search,capturedAt:new Date().toISOString(),...n?{fbclid:n}:{},...a?{gclid:a}:{},...i?{msclkid:i}:{},...s?{fbp:s}:{}};try{localStorage.setItem(r,JSON.stringify(u))}catch{}try{let e=window.location.hostname,t="";(e.endsWith(".coachful.co")||"coachful.co"===e)&&(t="; domain=.coachful.co");let n=encodeURIComponent(JSON.stringify(u)),a="https:"===window.location.protocol?"; Secure":"";document.cookie=`${r}=${n}; path=/; max-age=7776000${t}${a}; SameSite=Lax`}catch{}}function i(){try{let e=localStorage.getItem(r);if(e)return JSON.parse(e)}catch{}try{let e=document.cookie.match(RegExp("(?:^|;\\s*)"+r+"=([^;]+)"));if(e){let t=JSON.parse(decodeURIComponent(e[1]));try{localStorage.setItem(r,JSON.stringify(t))}catch{}return t}}catch{}return null}function o(){try{localStorage.removeItem(r)}catch{}try{let e=window.location.hostname,t=e.endsWith(".coachful.co")||"coachful.co"===e?"; domain=.coachful.co":"";document.cookie=`${r}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT${t}`}catch{}}},24516:(e,t,n)=>{"use strict";n.d(t,{U6:()=>f,im:()=>g,nd:()=>b});var r=n(212115),a=n(531998);let i=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"true"===e.getAttribute("contenteditable")||"textbox"===e.getAttribute("role")},o=!1,s=0,l="[data-vaul-drawer], [data-keyboard-safe-sheet]",c='[data-keyboard-aware-fullscreen]:not([data-keyboard-ignore="true"])';function d(e){document.documentElement.style.setProperty("--kb-height",`${e}px`),document.querySelectorAll(l).forEach(t=>{"true"===t.dataset.keyboardIgnore?t.removeAttribute("data-kb-shift"):e>0?t.setAttribute("data-kb-shift","true"):t.removeAttribute("data-kb-shift")})}function u(e){document.documentElement.style.setProperty("--kb-pan",`${e}px`)}function h(e){e?document.documentElement.setAttribute("data-kb-open","true"):document.documentElement.removeAttribute("data-kb-open")}function m(e){document.querySelectorAll(`${l}, ${c}`).forEach(t=>{"true"===t.dataset.keyboardIgnore||(e>0?(t.style.setProperty("bottom",`${e}px`,"important"),t.style.setProperty("max-height",`calc(100dvh - ${e}px)`,"important")):(t.style.removeProperty("bottom"),t.style.removeProperty("max-height")))})}function f(){let[e,t]=(0,r.useState)({isOpen:!1,offsetHeight:0,useBottomOffset:!1}),a=(0,r.useRef)(0);return(0,r.useEffect)(()=>{if(!("ontouchstart"in window||navigator.maxTouchPoints>0))return;s+=1,function(){if(o)return;o=!0;let e=document.createElement("style");e.textContent=`
2    html { --kb-height: 0px; --kb-pan: 0px; }
3    [data-vaul-drawer][data-kb-shift="true"]:not([data-keyboard-ignore="true"]), [data-keyboard-safe-sheet][data-kb-shift="true"]:not([data-keyboard-ignore="true"]) {
4      translate: 0 calc(-1 * (var(--kb-height) - var(--kb-pan, 0px))) !important;
5      max-height: calc(100dvh - var(--kb-height)) !important;
6    }
7    ${c} {
8      top: var(--kb-pan, 0px) !important;
9      bottom: calc(var(--kb-height, 0px) - var(--kb-pan, 0px)) !important;
10    }
11    /* min-height: 100dvh on some flow roots would force them back under the keyboard */
12    html[data-kb-open] ${c} {
13      min-height: 0 !important;
14    }
15  `,document.head.appendChild(e)}();let e=[],r=[],l=null,f=null,p=null,g=!1,b=!1,w=window.Capacitor,v=w?.isNativePlatform?.()??!1,y=w?.getPlatform?.()??"web",C=v,S=()=>{l&&(clearInterval(l),l=null),f&&(clearTimeout(f),f=null)},k=()=>
15{let e=window.visualViewport;u(g&&e?Math.min(Math.max(Math.round(e.offsetTop),0),a.current):0)},x=()=>{p&&(clearInterval(p),p=null)},I=()=>{x();let e=0;k(),p=setInterval(()=>{k(),++e>=20&&x()},50)},P=(e,n)=>{e!==a.current&&(a.current=e,(g=n&&e>0)?I():(x(),u(0)),d(n?e:0),h(e>0),t({isOpen:e>0,offsetHeight:e,useBottomOffset:n}))},_=()=>{a.current=0,g=!1,x(),u(0),d(0),m(0),h(!1),t({isOpen:!1,offsetHeight:0,useBottomOffset:!1})},E=e=>{e.then(e=>{b?e.remove().catch(()=>void 0):r.push(e)}).catch(()=>void 0)},A=()=>{if(g&&k(),C)return;let e=window.visualViewport;if(!e)return;let t=Math.round(window.innerHeight-(e.offsetTop+e.height));t>10&&i(document.activeElement)?m(t):t<=10&&m(0)},$=e=>{if(g&&i(e.target)&&I(),C||!i(e.target))return;S();let t=!1,n=0;l=setInterval(()=>{let e=window.visualViewport;if(e){let n=Math.round(window.innerHeight-e.height);if(n>50){t=!0,clearInterval(l),l=null,P(n,!1);return}}++n>=8&&(clearInterval(l),l=null,!t&&!window.visualViewport&&i(document.activeElement)&&P(300,!0))},100)},M=()=>{C||(S(),f=setTimeout(()=>{i(document.activeElement)||_()},200))};document.addEventListener("focusin",$),document.addEventListener("focusout",M);let j=window.visualViewport;if(j&&(j.addEventListener("resize",A),j.addEventListener("scroll",A)),e.push(()=>{document.removeEventListener("focusin",$),document.removeEventListener("focusout",M),j&&(j.removeEventListener("resize",A),j.removeEventListener("scroll",A)),S(),x()}),v){let e="ios"===y;n.e(59695).then(n.bind(n,459695)).then(({Keyboard:t})=>{!b&&(E(t.addListener("keyboardWillShow",t=>{S(),P(t.keyboardHeight,e)})),E(t.addListener("keyboardWillHide",()=>{_()})),0===a.current&&i(document.activeElement)&&P(300,e))}).catch(()=>{C=!1})}return()=>{b=!0,e.forEach(e=>e()),r.splice(0).forEach(e=>{e.remove().catch(()=>void 0)}),0===(s=Math.max(0,s-1))&&(u(0),d(0),m(0),h(!1))}},[]),e}let p=`${a._K}, ${a.wn}`;function g(e){if(e.defaultPrevented)return;let t=e.target,n=document.activeElement;if(!(t instanceof Element)||!(n instanceof HTMLElement)||!i(n)||n.contains(t)||t.closest('input, textarea, select, button, a, label, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="button"], [role="combobox"], [role="option"], [role="checkbox"], [role="radio"], [role="switch"], [role="slider"], [role="spinbutton"], [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="tab"], [data-keyboard-keep-open]'))return;let r=t.closest(p);if(r&&!r.contains(n))return;let a=window.getSelection();(!a||a.isCollapsed)&&n.blur()}function b(){let e=f();return(0,r.useEffect)(()=>{let e=e=>{let t=e.target;t instanceof Element&&t.closest("[data-keyboard-aware-fullscreen]")&&g(e)};return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[]),(0,r.useEffect)(()=>{if(!e.isOpen)return;let t=window.setTimeout(()=>{let e=document.activeElement;e instanceof HTMLElement&&i(e)&&e.closest("[data-keyboard-aware-fullscreen]")&&e.scrollIntoView({block:"center",behavior:"smooth"})},120);return()=>window.clearTimeout(t)},[e.isOpen]),e}},40436:(e,t,n)=>{"use strict";n.d(t,{OfferSheetController:()=>o});var r=n(695155),a=n(212115),i=n(829412);function o(){let[e,t]=(0,a.useState)(null),[o,s]=(0,a.useState)(!1),[l,c]=(0,a.useState)("bundle_lite"),[d,u]=(0,a.useState)(void 0);return((0,a.useEffect)(()=>{let r=r=>{let a=r.detail;a&&(a.handled=!0,c("bundle"===a.offer?"bundle":"bundle_lite"),u("string"==typeof a.eventId?a.eventId:void 0),s(!0),e||Promise.all([n.e(97463),n.e(11397)]).then(n.bind(n,520359)).then(e=>{t(()=>e.CoachfulOfferSheet)}))};return window.addEventListener(i.h,r),()=>window.removeEventListener(i.h,r)},[e]),o&&e)?(0,r.jsx)(e,{isOpen:o,onClose:()=>s(!1),offer:l,eventId:d},l):null}},57217:(e,t,n)=>{"use strict";n.d(t,{S:()=>o});var r=n(944855),a=n(142692),i=n(931481);function o({enabled:e=!0}={}){let{currentMembership:t,organizationId:n,isLoading:s}=(0,a.Z5)(),l=!!(e&&n&&t),{data:c,error:d,isLoading:u}=(0,r.Ay)(l?["/api/member/access",n,t?.id]:null,async()=>{let e=await fetch("/api/member/access");if(!e.ok)throw Error("Failed to load member access");return e.json()},{revalidateOnFocus:!1,dedupingInterval:3e4}),h=t?.orgRole==="member",m=h?c?.permissions:i.t4;return{access:c??null,permissions:m??null,isLoading:s||l&&u,error:d instanceof Error?d.message:null,can:e=>!h||m?.[e]===!0}}},58682:(e,t,n)=>{"use strict";n.d(t,{StoryViewsProvider:()=>h,V:()=>m});var r=n(695155),a=n(212115),i=n(792939),o=n(32087),s=n(685136),l=n(442302);let c="ga_story_views_v2",d="ga:story-viewed",u=(0,a.createContext)(null);function h({children:e}){let{user:t}=(0,i.useAppUser)(),{isDemoMode:n}=(0,o._)(),[m,f]=(0,a.useState)(!1),p=(0,a.useRef)(!1),[,g]=(0,a.useState)(0),b=(0,a.useMemo)(()=>n?s.W0.id:t?.id,[n,t?.id]),w=(0,a.useCallback)(()=>{try{let e=localStorage.getItem(c);return e?JSON.parse(e):{}}catch{return{}}},[]),v=(0,a.useCallback)(e=>{try{localStorage.setItem(c,JSON.stringify(e)),g(e=>e+1)}catch(e){console.error("Failed to save story views:",e)}},[]),y=(0,a.useCallback)((e,t)=>!!e&&!(0,l.Rk)(t,e),[]),C=(0,a.useCallback)((e,t)=>!!b&&!!e&&y(w()[`${b}:${e}`],t),[b,w,y]),S=(0,a.useCallback)((e,t)=>{if(!b||!e)return;let r=w();r[`${b}:${e}`]=t,v(r),window.dispatchEvent(new CustomEvent(d,{detail:{storyUserId:e,contentData:t}})),n||fetch("/api/story-views",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyOwnerId:e,contentData:t})}).catch(e=>console.error("Failed to sync story view to server:",e))},[b,n,w,v]),k=(0,a.useCallback)(async e=>{if(b&&!n&&0!==e.length&&!p.current){p.current=!0;try{let t=await fetch(`/api/story-views?storyOwnerIds=${e.join(",")}`);
15if(!t.ok)return;let n=(await t.json()).views,r=w(),a=!1;for(let[e,t]of Object.entries(n))if(t){let n=`${b}:${e}`;r[n]||(r[n]=t,a=!0)}a&&v(r),f(!0)}catch{}}},[b,n,w,v]);(0,a.useEffect)(()=>{let e=e=>{e.key===c&&g(e=>e+1)},t=()=>{g(e=>e+1)};return window.addEventListener("storage",e),window.addEventListener(d,t),()=>{window.removeEventListener("storage",e),window.removeEventListener(d,t)}},[]);let x=(0,a.useMemo)(()=>({hasViewedStory:C,markStoryAsViewed:S,fetchServerViews:k,hasFetchedServer:m}),[C,S,k,m]);return(0,r.jsx)(u.Provider,{value:x,children:e})}function m(){let e=(0,a.useContext)(u);if(!e)throw Error("useStoryViews must be used within a StoryViewsProvider");return e}},74950:(e,t,n)=>{"use strict";n.d(t,{NativeInteractionLockRecovery:()=>a});var r=n(212115);function a(){return(0,r.useEffect)(()=>{let e;if(e=window.Capacitor,!(e?.isNativePlatform?.()||navigator.userAgent.includes("CoachfulNativeApp"))&&"true"!==document.documentElement.dataset.nativeApp)return;let t=null,n=()=>{t=null,"none"!==document.body.style.pointerEvents||document.querySelector('[role="dialog"][data-state="open"], [data-vaul-drawer][data-state="open"], [data-vaul-overlay][data-state="open"]')||document.body.style.removeProperty("pointer-events")},r=()=>{null!==t&&clearTimeout(t),t=setTimeout(n,600)},a=new MutationObserver(r);return a.observe(document.body,{attributes:!0,attributeFilter:["style"],childList:!0}),window.addEventListener("pageshow",r),window.addEventListener("popstate",r),r(),()=>{a.disconnect(),window.removeEventListener("pageshow",r),window.removeEventListener("popstate",r),null!==t&&window.clearTimeout(t)}},[]),null}},88520:(e,t,n)=>{"use strict";n.d(t,{BN:()=>s,H6:()=>l,gk:()=>o,p3:()=>i});var r=n(212115);let a=new Set;function i(){for(let e of a){let t=e();if(t)return t}return null}function o(e,t){return"string"!=typeof e&&e?e.title:t}function s(e){return e?"string"==typeof e?e:e.message:""}function l(e){let t=(0,r.useRef)(e);t.current=e,(0,r.useEffect)(()=>{let e=()=>t.current();return a.add(e),()=>{a.delete(e)}},[])}},99523:(e,t,n)=>{"use strict";n.d(t,{C:()=>r});let r="coachful:chat-native-foreground"},103238:(e,t,n)=>{"use strict";n.d(t,{Nc:()=>m,Oq:()=>u,zd:()=>h});let r=1,a=!1,i=null,o=null,s=[];function l(e){return+("user-visible"!==e)}async function c(){if(null!==i&&(window.cancelIdleCallback?.(i),i=null),null!==o&&(window.clearTimeout(o),o=null),a)return;let e=function(){for(s.sort((e,t)=>l(e.priority)-l(t.priority)||e.deadline-t.deadline||e.id-t.id);s.length>0;){let e=s.shift();if(e&&!e.cancelled)return e}}();if(e){a=!0;try{await e.work()}catch{}finally{a=!1,d()}}}function d(){if(a||null!==i||null!==o||0===s.length)return;let e=s.filter(e=>!e.cancelled);if(0===e.length)return;let t=Math.max(0,Math.min(2e3,Math.min(...e.map(e=>e.deadline))-Date.now())),n=window;"function"==typeof n.requestIdleCallback?i=n.requestIdleCallback(()=>{c()},{timeout:t}):o=window.setTimeout(()=>{c()},Math.min(500,t))}function u(e,t={}){let n={id:r++,priority:t.priority||"background",deadline:Date.now()+(t.timeoutMs??5e3),cancelled:!1,work:e};return s.push(n),d(),()=>{n.cancelled=!0,d()}}function h(e){if("/chat"===e||"/community"===e||"/feed"===e||"/my-coach"===e||e.startsWith("/call/")||e.startsWith("/room/"))return!0;if("/"!==e&&"/workspace/coach"!==e)return!1;let t=new URLSearchParams(window.location.search);return t.has("chat")||"messages"===t.get("workspaceSurface")||"community"===t.get("workspaceSurface")||t.has("chatChannelId")||"community"===t.get("home")}function m(e){return"/program"===e||"/squad"===e||e.startsWith("/program/")||e.startsWith("/discover/programs")}},125610:(e,t,n)=>{"use strict";n.d(t,{ChatSheetProvider:()=>I,R:()=>P});var r=n(695155),a=n(212115),i=n(573321),o=n(903473),s=n(337206),l=n(450910),c=n(40562),d=n(442763),u=n(562840),h=n(526746),m=n(394537),f=n(24516);let p=null,g=null;function b(){return g||(g=Promise.all([n.e(60844),n.e(52664),n.e(60234),n.e(94758),n.e(42890),n.e(85662),n.e(13854),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(79054),n.e(68484),n.e(16304),n.e(40777),n.e(44923),n.e(87005),n.e(97463),n.e(78638),n.e(81901),n.e(21170),n.e(61766),n.e(50931),n.e(38720),n.e(52383),n.e(31332),n.e(69822),n.e(41419),n.e(96798),n.e(28276),n.e(67760),n.e(70093),n.e(20606),n.e(55073),n.e(59271),n.e(29111),n.e(64072),n.e(7517),n.e(1397),n.e(11847),n.e(40912),n.e(69871),n.e(73576),n.e(24919),n.e(36689),n.e(87028),n.e(8587),n.e(72723)]).then(n.bind(n,333480)).then(e=>(p=e.ChatSheetContent,e.ChatSheetContent)).catch(e=>{throw g=null,e})),g}let w=(0,s.default)(b,{ssr:!1,loading:()=>(0,r.jsx)(h.k,{})});function v({isOpen:e,onClose:t,initialChannelId:n,initialThreadId:i,initialMessageId:o,openRequestKe
15y:s,initialDraftText:g,resolvingConversation:b,conversationError:y,onRetryConversation:C}){let S=(0,m.U)("(min-width: 768px)"),k=(0,f.U6)(),x=(0,l.c)("chat"),I=(0,a.useRef)(null),[P]=(0,a.useState)(()=>p??w),[_,E]=(0,a.useState)(!1),[A,$]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{if(e)return void E(!0);$(!1);let t=setTimeout(()=>E(!1),300);return()=>clearTimeout(t)},[e]),(0,a.useEffect)(()=>{if(!e||S)return;let t=0,n=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("resize"))})});return()=>{window.cancelAnimationFrame(n),t&&window.cancelAnimationFrame(t)}},[S,e,k.isOpen,k.offsetHeight]),!e&&!_)return null;let M=b||y?(0,r.jsx)(h.k,{error:y,onRetry:C}):(0,r.jsx)(P,{isOpen:e,onClose:t,initialChannelId:n,initialThreadId:i,initialMessageId:o,openRequestKey:s,initialDraftText:g,onThreadClosingChange:$}),j=`chat-sheet-drawer flex flex-col overflow-clip bg-[#faf8f6] font-albert dark:bg-[#05070b] ${A?"chat-thread-closing":""}`,T=k.isOpen&&k.useBottomOffset&&k.offsetHeight>0,N=T?`calc(100dvh - ${k.offsetHeight}px - max(env(safe-area-inset-top, 0px), 47px))`:void 0,q=N?{bottom:`calc(${k.offsetHeight}px - var(--kb-pan, 0px))`,height:N,maxHeight:N,translate:"none"}:void 0;return S?(0,r.jsx)(d.lG,{open:e,onOpenChange:e=>!e&&t(),children:(0,r.jsx)(d.Cf,{ref:I,accessibleTitle:x("messages"),hideCloseButton:!0,onEscapeKeyDown:e=>{I.current?.querySelector('[data-chat-reordering="true"]')&&e.preventDefault()},onOpenAutoFocus:e=>{e.preventDefault(),I.current?.focus({preventScroll:!0})},className:`${j} h-[min(82dvh,780px)] max-h-[82dvh] w-[min(92vw,760px)] max-w-[760px] gap-0 rounded-[28px] p-0 pt-5`,children:(0,r.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-clip rounded-b-[28px]",children:M})})}):(0,r.jsx)(u._s,{open:e,onOpenChange:e=>!e&&t(),shouldScaleBackground:!1,children:(0,r.jsxs)(u.zj,{ref:I,scrollMode:"contained",className:`${j} mx-auto h-[85dvh] max-h-[85dvh] max-w-[500px]`,"data-keyboard-ignore":T?"true":void 0,style:q,onEscapeKeyDown:e=>{document.querySelector('[data-chat-reordering="true"]')&&e.preventDefault()},children:[(0,r.jsx)(c.s6,{children:(0,r.jsx)(u.gk,{children:x("messages")})}),M]})})}var y=n(695981),C=n(771734),S=n(32087);let k=(0,a.createContext)({isOpen:!1,initialChannelId:null,openChatSheet:()=>{},openDirectChat:()=>{},prewarmChatSheet:()=>{},closeChatSheet:()=>{}});function x(){let{openChatSheet:e}=P(),t=(0,i.useRouter)(),n=(0,i.usePathname)(),r=(0,i.useSearchParams)().toString();return(0,a.useEffect)(()=>{let a=new URLSearchParams(r),i=a.get("chatChannelId")||a.get("channelId")||a.get("chat");if(!i)return;e("1"===i||"true"===i?void 0:i,{threadId:a.get("chatThreadId")?.trim()||void 0,messageId:a.get("chatMessageId")?.trim()||void 0}),a.delete("chatChannelId"),a.delete("channelId"),a.delete("chat"),a.delete("chatThreadId"),a.delete("chatMessageId");let o=a.toString(),s=`${n}${o?`?${o}`:""}`;(0,C.DF)(s,{replace:!0,scroll:!1})||t.replace(s,{scroll:!1})},[e,n,t,r]),null}function I({children:e}){let{connectNow:t}=(0,o.b)(),{isDemoMode:i,openSignupModal:s}=(0,S._)(),[l,c]=(0,a.useState)(!1),[d,u]=(0,a.useState)(null),[h,m]=(0,a.useState)(null),[f,p]=(0,a.useState)(null),[g,w]=(0,a.useState)(0),[C,P]=(0,a.useState)(),[_,E]=(0,a.useState)(!1),[A,$]=(0,a.useState)(!1),M=(0,a.useRef)(0),j=(0,a.useRef)(null),T=(0,a.useRef)(null),N=(0,a.useCallback)(()=>{(0,y.Z)()&&(t(),b().catch(()=>void 0))},[t]),q=(0,a.useCallback)((e,n)=>{M.current+=1,j.current=null,E(!1),$(!1),P(void 0),t(),b().catch(()=>void 0),T.current&&(clearTimeout(T.current),T.current=null),u(e||null),m(n?.threadId?.trim()||null),p(n?.messageId?.trim()||null),w(e=>e+1),c(!0)},[t]),D=(0,a.useCallback)((e,t)=>{if(i)return void s();if(q(t?.channelId),P(t?.draftText),j.current={userId:e,options:t},t?.channelId)return;let r=M.current;E(!0),(async()=>{try{let{openOrCreateDirectChat:t}=await n.e(45141).then(n.bind(n,345141)),a=await t(e);if(!a)throw Error("Missing conversation channel");if(M.current!==r)return;u(a)}catch(e){if(M.current!==r)return;console.error("[ChatSheet] Failed to resolve direct conversation:",e),$(!0)}finally{M.current===r&&E(!1)}})()},[i,q,s]),U=(0,a.useCallback)(()=>{let e=j.current;e&&D(e.userId,e.options)},[D]),R=(0,a.useCallback)(()=>{M.current+=1,T.current&&clearTimeout(T.current),c(!1),T.current=setTimeout(()=>{u(null),m(null),p(null),T.current=null},300)},[]);return(0,a.useEffect)(()=>()=>
15{M.current+=1,T.current&&clearTimeout(T.current)},[]),(0,r.jsxs)(k.Provider,{value:{isOpen:l,initialChannelId:d,openChatSheet:q,openDirectChat:D,prewarmChatSheet:N,closeChatSheet:R},children:[e,(0,r.jsx)(a.Suspense,{fallback:null,children:(0,r.jsx)(x,{})}),g>0&&(0,r.jsx)(v,{isOpen:l,onClose:R,initialChannelId:d,initialThreadId:h,initialMessageId:f,openRequestKey:g,initialDraftText:C,resolvingConversation:_,conversationError:A,onRetryConversation:U})]})}function P(){let e=(0,a.useContext)(k);if(!e)throw Error("useChatSheet must be used within a ChatSheetProvider");return e}},131021:(e,t,n)=>{"use strict";n.d(t,{Ad:()=>l,UL:()=>s,nB:()=>h});var r=n(212115);let a=new Set,i=new Set;function o(){for(let e of i)e()}function s(e){return a.add(e),o(),()=>{var t;return t=e,void(a.delete(t)&&o())}}function l(e){for(let t of a)if(t!==e)return!0;return!1}function c(e){return i.add(e),()=>i.delete(e)}let d=()=>a.size,u=()=>0;function h(e){return(0,r.useSyncExternalStore)(c,d,u),l(e)}},138265:(e,t,n)=>{"use strict";n.d(t,{LayoutModeSync:()=>o});var r=n(212115),a=n(573321),i=n(961703);function o(){let e=(0,a.usePathname)(),t=(0,a.useSearchParams)();return(0,r.useLayoutEffect)(()=>{if(document.querySelector(".marketplace-root, .tenant-website, .link-page-root")){document.documentElement.setAttribute("data-layout","fullscreen"),document.body.setAttribute("data-layout","fullscreen");return}let n=window.location.hostname,r="/profile"===e&&"true"===t.get("edit")&&"true"===t.get("fromOnboarding"),a="/"===e&&("coachful.co"===n||"www.coachful.co"===n)||!!e&&(0,i.tY)(e)||r,o=(0,i.TY)(e),s=a?"fullscreen":o?"collapsed-sidebar":"with-sidebar";document.documentElement.setAttribute("data-layout",s),document.body.setAttribute("data-layout",s)},[e,t]),null}},140980:(e,t,n)=>{"use strict";n.d(t,{cn:()=>i,j3:()=>s,km:()=>d,l:()=>h,le:()=>u,mr:()=>c,oB:()=>l,r2:()=>m});var r=n(829722),a=n(800622);function i(...e){return(0,a.QP)((0,r.$)(e))}function o(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?null:t}function s(e){return o(e?.startDateTime)}function l(e){let t=o(e?.endDateTime);if(t)return t;let n=s(e);if(!n)return null;let r=e?.durationMinutes??e?.duration;return new Date(n.getTime()+60*("number"==typeof r&&r>0?r:60)*1e3)}function c(e,t=new Date){if(e?.meetingProvider==="phone")return!1;let n=s(e),r=l(e);return!!n&&!!r&&t>=new Date(e?.callLinkVisibility==="one_hour_before"?n.getTime()-36e5:0)&&t<r}function d(e,t=new Date){if(c(e,t))return e;let n={...e};return delete n.meetingLink,delete n.meetingUrl,delete n.zoomLink,n}function u(e,t=new Date){let n=l(e);return!!(n&&n>t)}function h(e,t){return e&&e!==t?`/profile/${e}`:"/profile"}function m(e){let t=l(e);return!!(t&&t<new Date)}},142692:(e,t,n)=>{"use strict";n.d(t,{Hw:()=>c,OrganizationProvider:()=>s,Z5:()=>l});var r=n(695155),a=n(212115),i=n(792939);let o=(0,a.createContext)(null);function s({children:e,initialOrganizationId:t,initialOrgRole:n}){let{isLoaded:l,isSignedIn:c,userId:d}=(0,i.useAppAuth)(),{firebaseUser:u}=(0,i.useFirebaseAuthUser)(),h=u?.uid||null,m=l&&c&&d?`${d}:${t||"no-org"}`:"signed-out",f=t&&n?{id:"ssr-pending",organizationId:t,orgRole:n,tier:"free",track:null,squadId:null,premiumSquadId:null,isActive:!0,joinedAt:"",permissionOverrides:void 0}:null,p=t&&n?[{id:t,name:"",isPrimary:!1,membership:{id:"ssr-pending",orgRole:n,tier:"free",track:null,joinedAt:"",permissionOverrides:void 0}}]:[],[g,b]=(0,a.useState)(f),[w,v]=(0,a.useState)(p),[y,C]=(0,a.useState)(t||null),S=(0,a.useRef)(t&&n&&d?`${d}:${t}`:null),k=(0,a.useRef)(m),[x,I]=(0,a.useState)(S.current||("signed-out"===m?"signed-out":null)),[P,_]=(0,a.useState)("signed-out"!==m&&S.current!==m),[E,A]=(0,a.useState)(null),$=(0,a.useRef)(u),M=!!f,j=M?P:P||"signed-out"!==m&&x!==m,T=!!t||!!n;(0,a.useEffect)(()=>{k.current=m},[m]),(0,a.useEffect)(()=>{$.current=u},[u]);let N=(0,a.useCallback)(async()=>{let e=k.current,n=()=>k.current!==e;if(l){if(!c||!d){b(null),v([]),C(null),I("signed-out"),_(!1);return}if(!T){let e=()=>document.cookie.split(";").some(e=>e.trim().startsWith("__session_hint="));if(!e()&&!h&&!$.current){let t=0;for(;t<5e3&&!e()&&!h&&!$.current;)if(await new Promise(e=>setTimeout(e,200)),t+=200,n())return}}try{M||_(!0),A(null);let e={},r=$.current;if(r)try{let t=await r.getIdToken();e.Authorization=`Bearer ${t}`}catch{}let a=await fetch("/api/user/organizations",{headers:e});if(!a.ok)throw Error("Failed to fetch organizations");
15if(n())return;let i=await a.json();if(n())return;let o=i.hiddenOrganizationIds||[];if(t&&o.includes(t)&&1){let e=i.organizations.find(e=>e.isPrimary&&e.tenantUrl);if(e?.tenantUrl)return void window.location.replace(`${e.tenantUrl}${window.location.pathname}${window.location.search}${window.location.hash}`)}let s=i.disabledOrganizations||[];if(t&&s.some(e=>e.id===t)&&!window.location.pathname.startsWith("/access-denied"))return void window.location.replace("/access-denied");v(i.organizations.map(e=>({id:e.id,name:e.name,isPrimary:e.isPrimary,platformAccessMode:e.platformAccessMode,membership:e.membership?{id:e.membership.id,orgRole:e.membership.orgRole,tier:e.membership.tier,track:e.membership.track,joinedAt:e.membership.joinedAt,permissionOverrides:e.membership.permissionOverrides}:void 0})));let l=t?i.organizations.find(e=>e.id===t):i.organizations.find(e=>e.isPrimary);if(l&&l.membership){if(n())return;C(l.id),b({id:l.membership.id,organizationId:l.id,orgRole:l.membership.orgRole,tier:l.membership.tier,track:l.membership.track,squadId:null,premiumSquadId:null,isActive:!0,joinedAt:l.membership.joinedAt,permissionOverrides:l.membership.permissionOverrides})}else{if(n())return;C(t||null),b(null)}}catch(e){if(n())return;console.error("[ORG_CONTEXT] Error fetching membership:",e),A(e instanceof Error?e.message:"Failed to load organization data")}finally{if(n())return;I(e),_(!1)}}},[T,M,l,c,d,t,h]);(0,a.useEffect)(()=>{N()},[N]);let q=(0,a.useCallback)(async()=>{await N()},[N]),D=(0,a.useCallback)(async e=>{try{let t={"Content-Type":"application/json"};if($.current)try{t.Authorization=`Bearer ${await $.current.getIdToken()}`}catch{}if(!(await fetch("/api/user/organizations/switch",{method:"POST",headers:t,body:JSON.stringify({organizationId:e})})).ok)throw Error("Failed to switch organization");return await N(),!0}catch(e){return console.error("[ORG_CONTEXT] Error switching org:",e),!1}},[N]),U=g?.orgRole==="super_coach",R=g?.orgRole==="coach"||g?.orgRole==="super_coach",L=g?.orgRole==="virtual_assistant",O=(0,a.useCallback)(()=>U,[U]),B=(0,a.useCallback)(()=>R,[R]),W=(0,a.useCallback)(()=>L,[L]),F=(0,a.useCallback)(e=>{if(!g)return!1;if(!e)return!0;let t=["free","standard","premium"];return t.indexOf(g.tier)>=t.indexOf(e)},[g]),V=(0,a.useMemo)(()=>({currentMembership:g,organizations:w,organizationId:y,isLoading:j,error:E,refreshMembership:q,switchOrganization:D,isSuperCoach:O,isCoach:B,isVirtualAssistant:W,hasAccess:F}),[g,w,y,j,E,q,D,O,B,W,F]);return(0,r.jsx)(o.Provider,{value:V,children:e})}function l(){let e=(0,a.useContext)(o);if(!e)throw Error("useOrganization must be used within an OrganizationProvider");return e}function c(){return(0,a.useContext)(o)}},153416:(e,t,n)=>{"use strict";n.d(t,{AuthHintProvider:()=>o,V:()=>s});var r=n(695155),a=n(212115);let i=(0,a.createContext)({isAuthenticatedHint:!1});function o({children:e,isAuthenticated:t}){return(0,r.jsx)(i.Provider,{value:{isAuthenticatedHint:t},children:e})}function s(){return(0,a.useContext)(i)}},163241:(e,t,n)=>{"use strict";n.d(t,{A8:()=>u,Ge:()=>l,_2:()=>h,sH:()=>d});var r=n(570912),a=n(543273);let i={my_coaching:(0,a.Dq)(),plan:"/my-plan",journey:"/profile",profile:"/profile",goals:"/goal",habits:"/habits",checkIns:"/check-ins",worksheets:"/worksheets",visionBoard:"/vision-board"},o=["/admin","/api","/coach","/dashboard","/editor","/workspace"];function s(e){let t=e.toLowerCase();return"coachful.co"===t||t.endsWith(".coachful.co")}function l(e){if(!/^https?:\/\//i.test(e))return!1;try{let t=new URL(e);return t.origin!==window.location.origin&&!s(t.hostname)}catch{return!1}}function c(e){let t=e;for(let e=0;e<3;e+=1)try{let e=decodeURIComponent(t);if(e===t)break;t=e}catch{return!0}t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/");try{t=new URL(t,"https://client-menu.local").pathname}catch{return!0}return t=t.toLowerCase(),o.some(e=>t===e||t.startsWith(`${e}/`))}function d(e){let t=e.trim();if(!t||t.length>2048)return null;if(/^\/(?!\/)/.test(t)&&!t.includes("\\")){let e=new URL(t,"https://client-menu.local");if(c(e.pathname))return null;let n=`${e.pathname}${e.search}${e.hash}`;return n.length<=2048?n:null}try{let e=new URL(t),n=e.toString();if("https:"===e.protocol&&e.hostname&&!e.username&&!e.password&&!(s(e.hostname)&&c(e.pathname))&&n.length<=2048)return n}catch{}return null}function u(e){if("custom_link"===e.resourceType)return d(e.resourceId);if("program"===e.resourceType)return`/program?programId=${encodeURIComponent(e.resourceId)}`;if("client_page"===e.resourceType){var t;return(t=e.resourceId,Object.prototype.hasOwnProperty.call(i,t))?i[e.resourceId]:null}return"questionnaire"===e.resourceType?`/q/${encodeURIComponent(e.resourceId)}`:(0,r.i1)(e.resourceType,e.resourceId)}function h(e,t,n,r=!1){return"program"===e.key&&r?e:"program"!==e.key||n?t:{...e,path:(0,a.Dq)("programs")}}},178403:(e,t,n)=>{"use strict";n.d(t,{StaleAssetRecoveryListener:()=>i});var r=n(212115),a=n(346567);function i(){return(0,r.useEffect)(()=>(0,a.DD)(),[]),null}},189117:(e,t,n)=>{"use strict";n.d(t,{A3:()=>l,Io:()=>a,JU:()=>r,QR:()=>c,bi:()=>o,wi:()=>i});let r="announcements",a="social-corner",i="share-wins",o="coachful-platform-direct",s={announcements:r,social:a,wins:i};function l(e){if(!e)return null;for(let[t,n]of Object.entries(s))if(e.startsWith(`${n}-`))return t;return null}function c(e,t){let n=e?.text?.trim();if(n)return n.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/(^|\s)_([^_]+)_(?=\s|$|[.,!?:;])/g,"$1$2");let r=e?.attachments||[];
15if(0!==r.length)return r.some(e=>"image"===e.type||e.mime_type?.startsWith("image/"))?t.sentAnImage:t.sentAnAttachment}},189239:(e,t,n)=>{"use strict";n.d(t,{$:()=>o});var r=n(695155),a=n(212115),i=n(140980);let o=a.forwardRef(({className:e,variant:t="default",size:n="default",...a},o)=>{let s=!!(a.style?.backgroundColor||a.style?.background||a.style?.color);return(0,r.jsx)("button",{className:(0,i.cn)("inline-flex items-center justify-center rounded-xl font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-accent dark:focus-visible:ring-brand-accent focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none","default"===t&&!s&&"bg-brand-accent text-on-accent hover:bg-brand-accent/90 shadow","default"===t&&s&&"shadow","outline"===t&&"border border-earth-200 dark:border-[#262b35] hover:bg-earth-50 dark:hover:bg-[#262b35] dark:text-[#f5f5f8]","ghost"===t&&"hover:bg-earth-100 dark:hover:bg-[#262b35] dark:text-[#f5f5f8]","destructive"===t&&"bg-red-600 text-white hover:bg-red-700 dark:bg-red-600 dark:hover:bg-red-700 shadow","default"===n&&"h-11 px-8 py-2","sm"===n&&"h-9 px-4 text-sm","lg"===n&&"h-12 px-10 text-lg","icon"===n&&"h-10 w-10 p-0",e),ref:o,...a})});o.displayName="Button"},229381:(e,t,n)=>{"use strict";n.d(t,{J8:()=>p,Om:()=>m,RA:()=>f,fc:()=>c,gw:()=>i,kl:()=>l,qH:()=>a,wu:()=>u,xS:()=>r});let r=25,a=7;function i(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString(void 0,{month:"long",day:"numeric"})}let o={publish_website:{eyebrow:"Your website is ready",title:"Choose a plan to publish",description:"Keep editing and previewing for free. Choose a plan when you are ready for visitors to see it."},publish_funnel:{eyebrow:"Your funnel is ready",title:"Choose a plan to go live",description:"Keep building and testing every step. Choose a plan when you are ready to collect real responses."},publish_program:{eyebrow:"Your program is ready",title:"Choose a plan to publish",description:"Keep shaping the client experience. Choose a plan when you are ready to make it public."},publish_journey:{eyebrow:"Your journey is ready",title:"Choose a plan to publish",description:"Keep building the journey. Choose a plan when you are ready to make it active for clients."},publish_content:{eyebrow:"Your content is ready",title:"Choose a plan to publish",description:"Keep drafting and previewing. Choose a plan when you are ready to publish or schedule it."},accept_payment:{eyebrow:"Your checkout is ready",title:"Choose a plan to accept payments",description:"You can connect and configure Stripe in Preview Mode. Activate your platform before collecting a real payment."},send_campaign:{eyebrow:"Your campaign is ready",title:"Choose a plan to send",description:"Keep writing, designing, and previewing. Choose a plan when you are ready to reach your audience."},activate_automation:{eyebrow:"Your automation is ready",title:"Choose a plan to turn it on",description:"Keep building and testing the workflow. Choose a plan before it starts acting on live contacts."},book_onboarding:{eyebrow:"Your onboarding session is ready",title:"Choose a plan before you book",description:"Pick your plan and add a card first, then reserve a one-on-one onboarding time with the Coachful team."},buy_credits:{eyebrow:"You are making progress",title:"Choose a plan for more credits",description:"Preview Mode includes one shared, one-time allowance of 25 credits. Your plan adds a larger monthly allowance across Coachful."},use_ai_credits:{eyebrow:"You used your Preview credits",title:"Choose a plan to keep creating",description:"Your work is saved. Choose a plan to refill your credits and continue using Coachful AI."}},s={title:"Choose a plan to go live",description:"Build, invite clients and connect Stripe for free. Publishing, payments and campaigns unlock with your plan.",cta:"Choose a plan"},l={title:"Your trial has ended",description:"Everything you built is saved. Choose a plan to keep building, publish and take payments.",cta:"Choose a plan"}
15,c={eyebrow:"Trial ended",title:"Choose a plan to keep going",description:"Everything you have built stays. Your plan starts the day you add a card."},d={publish_website:{title:"Publish your website",description:"Keep editing and previewing for free. Choose a plan when you are ready for visitors to see it.",cta:"Choose a plan to publish"},publish_funnel:{title:"Take your funnels live",description:"Build and test every step for free. Choose a plan when you are ready to collect real responses.",cta:"Choose a plan to go live"},publish_program:{title:"Publish your programs",description:"Shape the client experience for free. Choose a plan when you are ready to make it public.",cta:"Choose a plan to publish"},publish_journey:{title:"Publish your client journey",description:"Keep building the journey for free. Choose a plan when you are ready to make it active for clients.",cta:"Choose a plan to publish"},publish_content:{title:"Publish your content",description:"Draft, schedule and preview for free. Choose a plan when you are ready to publish.",cta:"Choose a plan to publish"},accept_payment:{title:"Start accepting payments",description:"Connect and configure Stripe for free. Choose a plan before collecting a real payment.",cta:"Choose a plan"},send_campaign:{title:"Send your first campaign",description:"Write, design and preview for free. Choose a plan when you are ready to reach your audience.",cta:"Choose a plan to send"},activate_automation:{title:"Turn on your automations",description:"Build and test every workflow for free. Choose a plan before it acts on live contacts.",cta:"Choose a plan to turn on"}};function u(e){return e&&d[e]||s}let h={eyebrow:"Go live",title:"Choose your plan",description:"Everything you have built stays. Nothing is charged until your trial ends."};function m(e){return e?o[e]:h}function f(e){return!!e&&"object"==typeof e&&"preview_first_month_50_v1"===e.version&&50===e.percentOff&&"string"==typeof e.startedAt&&"string"==typeof e.expiresAt&&Number.isFinite(Date.parse(e.expiresAt))&&"boolean"==typeof e.active&&"boolean"==typeof e.redeemed}function p(e){return!!e&&"object"==typeof e&&"PREVIEW_PLAN_REQUIRED"===e.code&&"string"==typeof e.action&&e.action in o}},237514:(e,t,n)=>{"use strict";n.d(t,{AuthRedirectGuard:()=>f});var r=n(212115),a=n(573321),i=n(901427),o=n(677096),s=n(792939),l=n(32087),c=n(784961),d=n(837511);let u=!1;function h(e){try{return new URL(e,window.location.href).origin===window.location.origin}catch{return!1}}function m(e){return e instanceof TypeError}function f({layoutMode:e}){let{isLoaded:t,isSignedIn:n}=(0,s.useAppAuth)(),{isDemoMode:p}=(0,l._)(),g=(0,a.usePathname)(),b=(0,r.useRef)(!1),w=(0,r.useRef)(!1),[v,y]=(0,r.useState)(!1),C=(0,r.useCallback)(()=>{if(!b.current){let e;b.current=!0,window.__coachful_signing_out=!0,e=(0,d.JK)()?"mobile":"sign-in",window.location.replace(`/api/auth/sign-out?redirect=${e}`)}},[]);return(0,r.useEffect)(()=>{!function(){if(u)return;u=!0;let e=window.fetch.bind(window);window.fetch=async function(t,n){var r;let a,i="string"==typeof t?t:t instanceof URL?t.toString():t instanceof Request?t.url:"",o=h(i)&&("GET"===(r=n?.method?n.method.toUpperCase():t instanceof Request?t.method.toUpperCase():"GET")||"HEAD"===r||"OPTIONS"===r);try{a=await e(t,n)}catch(r){if(m(r)&&o){await new Promise(e=>window.setTimeout(e,500));try{a=await e(t,n)}catch(e){throw m(e)&&window.dispatchEvent(new CustomEvent("coachful:network-failure",{detail:{url:i}})),e}}else if(m(r)&&h(i))throw window.dispatchEvent(new CustomEvent("coachful:network-failure",{detail:{url:i}})),r;else throw r}return 401!==a.status||i.includes("/api/auth/")||window.dispatchEvent(new CustomEvent("auth:session-expired",{detail:{url:i}})),a}}()},[]),(0,r.useEffect)(()=>{let t=()=>{if(b.current||p||(0,c.m)(g)||"fullscreen"===e)return;let t=window.location.hostname;"coachful.co"!==t&&"www.coachful.co"!==t&&(console.warn("[AuthGuard] 401 detected — forcing sign-out redirect"),C())};return window.addEventListener("auth:session-expired",t),()=>window.removeEventListener("auth:session-expired",t)},[p,g,e,C]),(0,r.useEffect)(()=>{let e=setTimeout(()=>y(!0),2500);return()=>clearTimeout(e)},[]),(0,r.useEffect)(()=>
15{if(b.current||p)return;let r=setTimeout(()=>{if(b.current||!t||n)return;let r=window.location.hostname;"coachful.co"===r||"www.coachful.co"===r||(0,c.m)(g)||"fullscreen"!==e&&(console.warn("[AuthGuard] Hard timeout — forcing sign-out redirect"),C())},15e3);return()=>clearTimeout(r)},[t,n,p,g,e,C]),(0,r.useEffect)(()=>{if(b.current||!v||!t||n||p||(0,c.m)(g)||"fullscreen"===e)return;let r=window.location.hostname;if("coachful.co"===r||"www.coachful.co"===r)return;if(!document.cookie.includes("__session_hint="))return void C();if(w.current)return;w.current=!0;let a=new AbortController,s=setTimeout(()=>a.abort(),5e3);fetch("/api/auth/session-check",{signal:a.signal}).then(e=>e.json()).then(async e=>{if(!b.current)if(e.valid){if(e.customToken&&o.auth)try{await (0,i.p)(o.auth,e.customToken)}catch(e){console.warn("[AuthGuard] Custom token sign-in failed:",e)}w.current=!1}else C()}).catch(()=>{b.current||C()}).finally(()=>clearTimeout(s))},[v,t,n,p,g,e,C]),null}},240371:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GATracker:()=>s,trackEvent:()=>l,trackFunnelEvent:()=>c});var r=n(695155),a=n(212115),i=n(565596),o=n(573321);function s(){let[e,t]=(0,a.useState)(null),[n,s]=(0,a.useState)(!1),[l,c]=(0,a.useState)(null),d=(0,o.usePathname)(),u=(0,o.useSearchParams)();return((0,a.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/org/ga-config");if(e.ok){let n=await e.json();n.configured&&n.measurementId&&(t(n.measurementId),n.measurementId)}else console.warn("[GA_TRACKER] GA config fetch failed:",e.status)}catch(e){console.error("[GA_TRACKER] Failed to fetch GA config:",e),c("Failed to fetch config")}})()},[]),(0,a.useEffect)(()=>{if(!e||!n)return;let t=d+(u.toString()?`?${u.toString()}`:"");window.gtag&&window.gtag("config",e,{page_path:t})},[d,u,e,n]),e)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.default,{src:`https://www.googletagmanager.com/gtag/js?id=${e}`,strategy:"afterInteractive",onLoad:()=>{s(!0)},onError:e=>{console.error("[GA_TRACKER] Script failed to load:",e),c("Script failed to load")}}),(0,r.jsx)(i.default,{id:"ga-config",strategy:"afterInteractive",dangerouslySetInnerHTML:{__html:`
16            window.dataLayer = window.dataLayer || [];
17            function gtag(){dataLayer.push(arguments);}
18            gtag('js', new Date());
19            gtag('config', '${e}', {
20              page_path: window.location.pathname,
21            });
22            
23          `}})]}):null}function l(e,t){window.gtag&&window.gtag("event",e,t)}function c(e,t,n){let r=`funnel_${t}`,a={funnel_id:e};n?.stepId&&(a.step_id=n.stepId),n?.stepIndex!==void 0&&(a.step_index=n.stepIndex),n?.amount!==void 0&&(a.value=n.amount,a.currency="USD"),l(r,a)}},256708:(e,t,n)=>{"use strict";function r(e,t){let n=e.findIndex(e=>e.id===t.id);if(n<0)return[...e,t];let r=[...e];return r[n]={...r[n],...t},r}n.d(t,{T:()=>r})},286062:(e,t,n)=>{"use strict";n.d(t,{FJ:()=>o,Ip:()=>a,JP:()=>d,Yn:()=>s,cu:()=>u,q$:()=>l,tV:()=>i,vR:()=>c,xe:()=>f});var r=n(524164);let a=()=>Promise.all([n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(18409),n.e(77805),n.e(9683),n.e(7188),n.e(44855),n.e(60788),n.e(58220),n.e(67760),n.e(24516),n.e(39902),n.e(526),n.e(77031)]).then(n.bind(n,624920)).then(e=>e.ContentResearchView),i=()=>Promise.all([n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(18409),n.e(77805),n.e(9683),n.e(7188),n.e(44855),n.e(60788),n.e(50088),n.e(38751),n.e(67760),n.e(24516),n.e(56264),n.e(95387),n.e(13764),n.e(49898)]).then(n.bind(n,234889)).then(e=>e.AdsResearchView),o=()=>Promise.all([n.e(28960),n.e(67984),n.e(45399),n.e(75139),n.e(18409),n.e(49304),n.e(77805),n.e(97873),n.e(49389),n.e(9683),n.e(7188),n.e(44855),n.e(60788),n.e(72240),n.e(61108),n.e(81901),n.e(48888),n.e(71751),n.e(59982),n.e(33216),n.e(9233),n.e(92939),n.e(24516),n.e(43273),n.e(15925),n.e(7517),n.e(60228),n.e(71734),n.e(35859),n.e(56924)]).then(n.bind(n,169668)).then(e=>e.IntelSearchView),s=()=>Promise.all([n.e(28960),n.e(67984),n.e(18409),n.e(49304),n.e(77805),n.e(97873),n.e(49389),n.e(7188),n.e(44855),n.e(60788),n.e(72240),n.e(48888),n.e(93780),n.e(59982),n.e(33216),n.e(9233),n.e(92939),n.e(24516),n.e(43273),n.e(15925),n.e(60228),n.e(71734),n.e(68773),n.e(7610)]).then(n.bind(n,107610)).then(e=>e.IntelHome),l=()=>Promise.all([n.e(28960),n.e(67984),n.e(45399),n.e(6415),n.e(75139),n.e(18409),n.e(49304),n.e(77805),n.e(97873),n.e(49389),n.e(7188),n.e(44855),n.e(60788),n.e(72240),n.e(50088),n.e(48888),n.e(93780),n.e(59982),n.e(33216),n.e(67760),n.e(9233),n.e(92939),n.e(24516),n.e(43273),n.e(15925),n.e(60228),n.e(71734),n.e(56264),n.e(95387),n.e(68773),n.e(12119),n.e(19278)]).then(n.bind(n,112119)).then(e=>e.WatchlistView),c=()=>Promise.all([n.e(28960),n.e(67984),n.e(45399),n.e(6415),n.e(75139),n.e(18409),n.e(49304),n.e(77805),n.e(97873),n.e(49389),n.e(7188),n.e(44855),n.e(60788),n.e(72240),n.e(50088),n.e(48888),n.e(12816),n.e(59982),n.e(33216),n.e(67760),n.e(9233),n.e(92939),n.e(24516),n.e(43273),n.e(15925),n.e(60228),n.e(71734),n.e(56264),n.e(95387),n.e(67806)]).then(n.bind(n,788681)).then(e=>e.CreatorReport),d=()=>Promise.all([n.e(28960),n.e(67984),n.e(38437),n.e(45399),n.e(6415),n.e(75139),n.e(18409),n.e(49304),n.e(77805),n.e(97873),n.e(49389),n.e(9683),n.e(7188),n.e(44855),n.e(60788),n.e(72240),n.e(61108),n.e(50088),n.e(48888),n.e(79013),n.e(59982),n.e(33216),n.e(67760),n.e(9233),n.e(92939),n.e(24516),n.e(43273),n.e(15925),n.e(60228),n.e(56264),n.e(13764),n.e(53158)]).then(n.bind(n,59657)).then(e=>e.CreateView),u=()=>Promise.all([n.e(28960),n.e(67984),n.e(45399),n.e(75139),n.e(18409),n.e(49304),n.e(77805),n.e(97873),n.e(49389),n.e(9683),n.e(7188),n.e(44855),n.e(60788),n.e(72240),n.e(79054),n.e(61108),n.e(45527),n.e(82289),n.e(59982),n.e(33216),n.e(9233),n.e(92939),n.e(24516),n.e(43273),n.e(15925),n.e(60228),n.e(80630),n.e(71734),n.e(18815),n.e(57751),n.e(10010)]).then(n.bind(n,438221)).then(e=>e.PublishingView),h={home:s,content:a,ads:i,search:o,watchlist:l,report:c,create:d,publishing:u},m=new Set;function f(e){let t=e.split(/[?#]/)[0],n=(0,r.ac)(t)?.split("?")[0]??t,a=(0,r.Bk)(n);!a||m.has(a.view)||(m.add(a.view),h[a.view]().catch(()=>{m.delete(a.view)}))}}
23,286123:(e,t,n)=>{"use strict";n.d(t,{PageTransition:()=>f});var r=n(695155),a=n(573321),i=n(212115),o=n(745399),s=n(961703),l=n(153416),c=n(620645),d=n(615925),u=n(524164),h=n(960228),m=n(830561);function f({children:e,layoutMode:t}){let n=(0,a.usePathname)(),p=(0,a.useSearchParams)(),{isAuthenticatedHint:g}=(0,l.V)(),{isCoachView:b}=(0,h.an)(),w=(0,i.useRef)(n),v=n!==w.current,y="/"===n&&p?.get("preview")==="true",C=("coachful.co"===window.location.hostname||"www.coachful.co"===window.location.hostname)&&"/"===n,S=!v&&"fullscreen"===t&&!("/"===n&&g&&!y),k=y||S||!!n&&(0,s.tY)(n)||n?.startsWith("/access-denied")||C,x="/"===n,I="/my-coach"===n||n.startsWith("/my-coach/")||"/program"===n||"/sessions"===n,P="/career"===n||n.startsWith("/career/"),_="/fitness"===n||n.startsWith("/fitness/"),E=k||x||I||P||_||"/chat"===n||"/community"===n||"/feed"===n||n?.startsWith("/feed/")||"/get-coach"===n||"/coach"===n||(0,d.P9)(n)||(0,u.Z9)(n)||n?.startsWith("/discover/libraries/")||"/discover/vision-boards"===n,A=E?"":"/discover"===n?"max-w-7xl mx-auto sm:px-4 sm:pt-6 lg:p-10":"max-w-7xl mx-auto p-4 sm:p-6 lg:p-10",$=E?"px-4 pt-5 sm:px-10 sm:pt-8":"/discover"===n?"px-4 pt-4 sm:px-0 sm:pt-0":void 0,M=(0,r.jsx)(c.Cl,{embedded:!0,className:E?void 0:"mb-6",frameClassName:$}),j=(0,s.TY)(n);(0,i.useLayoutEffect)(()=>{let e=document.querySelector(".tenant-website, .marketplace-root, .link-page-root"),t=k||e?"fullscreen":j?"collapsed-sidebar":"with-sidebar";document.body.getAttribute("data-layout")!==t&&document.body.setAttribute("data-layout",t),document.documentElement.getAttribute("data-layout")!==t&&document.documentElement.setAttribute("data-layout",t)},[n,k,j]);let T=k||x||I||P||_||"/chat"===n||"/community"===n||"/feed"===n||n?.startsWith("/feed/")||"/coach"===n||(0,d.P9)(n)||(0,u.Z9)(n)||"/website"===n||n.startsWith("/onboarding")||n?.startsWith("/join")||n.startsWith("/sign-in")||n.startsWith("/checkin")||n.startsWith("/call/")||C,N=(0,i.useRef)(n),q=n===N.current,D=!b&&!k&&(!T||x||I||P||"/chat"===n||"/community"===n||"/feed"===n||n.startsWith("/feed/")),U=(0,m.G)(n,{enabled:D&&!x});return k?(0,r.jsx)(r.Fragment,{children:e}):T||!b?(0,r.jsxs)("div",{ref:U,"data-app-page-content":!0,className:`min-h-dvh relative ${A}`,children:[M,e]}):(0,r.jsxs)(o.P.div,{"data-app-page-content":!0,initial:q?{opacity:.6}:{opacity:0,y:20*!E},animate:{opacity:1,y:0},transition:{duration:.25,ease:[.25,.1,.25,1]},className:`min-h-dvh relative ${A}`,children:[M,e]},n)}},290626:(e,t,n)=>{"use strict";n.r(t),n.d(t,{PricingAssignmentPreviewProvider:()=>f,PricingExperimentProvider:()=>u,buildPricingExperimentEventId:()=>b,useOptionalPricingExperiment:()=>g,usePricingExperiment:()=>p});var r=n(695155),a=n(212115),i=n(573321),o=n(486821),s=n(9785);let l=(0,a.createContext)(null);function c(){return"u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}function d(e){let t=(0,o.ys)(e);try{window.localStorage.setItem(o.lJ,t)}catch{}let n=window.location.hostname.toLowerCase(),r="coachful.co"===n||n.endsWith(".coachful.co")?"; Domain=.coachful.co":"";document.cookie=`${o.gR}=${t}; Path=/; Max-Age=${o.l1}; SameSite=Lax; Secure${r}`}function u({children:e,initialAssignment:t,authoritativeInitialAssignment:n=!1,trackAnonymousLanding:m=!0}){let f=(0,i.usePathname)(),[p,g]=(0,a.useState)(()=>(function(e,t=!1){if(t&&e)return d(e),e;let n=function(){let e=null;try{for(let t=0;t<window.localStorage.length;t+=1){let n,r=window.localStorage.key(t);if(!r||!r.includes("setup")&&!r.includes("launch"))continue;let a=window.localStorage.getItem(r);if(!a)continue;try{n=JSON.parse(a)}catch{continue}let i=Number(n.t),s="string"==typeof n.data?.sessionId?n.data.sessionId:"";if(!Number.isFinite(i)||Date.now()-i>3456e7||!/^[A-Za-z0-9_-]{8,128}$/.test(s))continue;let l=(0,o.oH)(n.data?.pricingAssignment)?n.data?.pricingAssignment:void 0;(!e||i>e.timestampMs)&&(e={timestampMs:i,visitorId:s,assignment:l})}}catch{return null}return e}(),r=(0,o.Tu)(function(e){if("u"<typeof document)return null;let t=`${e}=`;for(let e of document.cookie.split(";")){let n=e.trim();if(n.startsWith(t))return n.slice(t.length)}return null}(o.gR)),a=function(){try{return(0,o.Tu)(window.localStorage.getItem(o.lJ))}catch{return null}}(),i=function(){if("/setup"===window.location.pathname)return new URLSearchParams(window.location.search).has("eu")?"eu_lite":void 0}();if("eu_lite"===i){let t=[n?.assignment,r,a,e].find(e=>e?.routePricingVariant==="eu_lite")??(0,o.h0)(c(),void 0,i);return d(t),t}if("honored"===new URLSearchParams(window.location.search).get("pricing_offer")&&e&&8900>=(0,o.hO)(e)){let t=[n?.assignment,a].filter(e=>!!e).filter(e=>8900>
23=(0,o.hO)(e)).sort((e,t)=>Date.parse(e.assignedAt)-Date.parse(t.assignedAt))[0]??e;return d(t),t}if(n?.assignment)return d(n.assignment),n.assignment;let s=[r,a,e].filter(e=>!!e).sort((e,t)=>{let n=Date.parse(e.assignedAt),r=Date.parse(t.assignedAt);return(Number.isFinite(n)?n:Number.MAX_SAFE_INTEGER)-(Number.isFinite(r)?r:Number.MAX_SAFE_INTEGER)})[0]??null;if(n&&(!s||s.pricingVersion>=7)){let e=(0,o.Mv)({visitorId:n.visitorId,pricingVersion:(0,o.KJ)(n.timestampMs),evidenceTimestampMs:n.timestampMs});return d(e),e}if(s)return d(s),s;let l=(0,o.h0)(n?.visitorId||c());return d(l),l})(t,n)),[w,v]=(0,a.useState)(!!t),[y,C]=(0,a.useState)(!!(n&&t)),S=n&&t?t:p;(0,a.useEffect)(()=>{w||v(!0),y||C(!0)},[w,y]),(0,a.useEffect)(()=>{n&&t&&g(e=>e.visitorId===t.visitorId&&e.pricingVersion===t.pricingVersion?e:(d(t),t))},[n,t]),(0,a.useEffect)(()=>{d(S),n&&t||fetch("/api/public/pricing-experiment/assignment",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assignment:S,path:window.location.pathname,referrer:document.referrer||void 0}),keepalive:!0}).then(e=>e.ok?e.json():null).then(e=>{!(0,o.oH)(e?.assignment)||n&&t||g(t=>t.visitorId===e.assignment.visitorId&&t.pricingVersion===e.assignment.pricingVersion?t:(d(e.assignment),e.assignment))}).catch(()=>{})},[S,n,t]),(0,a.useEffect)(()=>{if(!m||!("/"===f||"/marketing-home"===f||"/get-started"===f||"/scheduling-software"===f||"/coaching-crm"===f||"/coaching-payment-software"===f||"/coaching-contracts"===f||"/group-coaching-software"===f||"/coach-website-builder"===f||"/sell-digital-products"===f||"/coaching-software"===f||"/coachful-alternatives"===f||"/ai-coaching-assistant"===f||f.endsWith("-alternative")||f.startsWith("/for-")||"/solutions"===f||f.startsWith("/solutions/")||["/setup","/go","/launch","/client-model","/create","/grow","/sign-up","/signup","/sell","/premium","/passive","/expertise","/first-client","/all-in-one","/launch-today","/client-app","/authority","/creators"].some(e=>f===e||f.startsWith(`${e}/`))))return;let e=`${f}:${S.visitorId}`;try{fetch("/api/public/pricing-experiment/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event:"landing_viewed",eventId:b(S,"landing_viewed",e),assignment:S,path:f,metadata:function(){let e=(0,s.C_)(),t=new URLSearchParams(window.location.search),n={};for(let e of["fbclid","gclid","msclkid","utm_source","utm_medium","utm_campaign","utm_content","utm_term"]){let r=t.get(e);r&&(n[e]=r.slice(0,500))}for(let[t,r]of Object.entries(e?.utm||{}))n[t]||"string"!=typeof r||(n[t]=r.slice(0,500));!n.fbclid&&e?.fbclid&&(n.fbclid=e.fbclid.slice(0,500)),!n.gclid&&e?.gclid&&(n.gclid=e.gclid.slice(0,500)),!n.msclkid&&e?.msclkid&&(n.msclkid=e.msclkid.slice(0,500)),e?.fbp&&(n.fbp=e.fbp.slice(0,500));let r=e?.referrer||document.referrer;return r&&(n.referrer=r.slice(0,1e3)),e?.landingPage&&(n.firstLandingPage=e.landingPage.slice(0,1e3)),e?.capturedAt&&(n.attributionCapturedAt=e.capturedAt),n}()}),keepalive:!0}).catch(()=>{})}catch{}},[S,f,m]);let k=(0,a.useCallback)(e=>{try{fetch("/api/public/pricing-experiment/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,assignment:S,path:window.location.pathname}),keepalive:!0}).catch(()=>{})}catch{}},[S]),x=(0,a.useMemo)(()=>h(S,y,k),[S,y,k]);return(0,r.jsx)(l.Provider,{value:x,children:w?e:null})}function h(e,t,n){return{assignment:e,pricingResolved:t,growthBandId:(0,o.LA)(e),proBandId:(0,o.zm)(e),enterpriseBandId:(0,o.FZ)(e),practiceBandId:(0,o.Vw)(e),studioBandId:(0,o.sW)(e),growthMonthlyCents:(0,o.hO)(e),onboardingProMonthlyCents:(0,o.xW)(e.pricingVersion),publicProMonthlyCents:(0,o.zp)(e.pricingVersion),enterpriseMonthlyCents:(0,o.W0)(e.pricingVersion),practiceMonthlyCents:(0,o.cC)(e.pricingVersion),studioMonthlyCents:(0,o.Nm)(e.pricingVersion),trackPricingEvent:n}}let m=()=>{};function f({assignment:e,children:t}){let n=(0,a.useMemo)(()=>h(e,!0,m),[e]);return(0,r.jsx)(l.Provider,{value:n,children:t})}function p(){let e=(0,a.useContext)(l);if(!e)throw Error("usePricingExperiment must be used within PricingExperimentProvider");return e}function g(){return(0,a.useContext)(l)}function b(e,t,n){return[o.lb,e.visitorId,t,n].join(":")}}
23,304402:(e,t,n)=>{"use strict";n.d(t,{ClientToaster:()=>i});var r=n(695155);let a=(0,n(337206).default)(()=>n.e(66609).then(n.bind(n,466609)).then(e=>e.Toaster),{loadableGenerated:{webpack:()=>[null]},ssr:!1});function i(){return(0,r.jsx)(a,{position:"bottom-center",gap:10,offset:24,toastOptions:{duration:4200,classNames:{toast:"font-albert rounded-2xl border !border-[#e1ddd8]/80 dark:!border-[#262b35]/80 !bg-white/95 dark:!bg-[#171b22]/95 !text-[#1a1a1a] dark:!text-[#f5f5f8] shadow-[0_18px_60px_rgba(26,26,26,0.14)] backdrop-blur-xl",title:"text-sm font-semibold tracking-normal",description:"!text-xs !text-[#6f6a64] dark:!text-[#a8adb8]",actionButton:"rounded-xl !bg-brand-accent !text-white font-medium",cancelButton:"rounded-xl !bg-[#f3f1ef] dark:!bg-[#262b35] !text-[#1a1a1a] dark:!text-[#f5f5f8] font-medium",success:"!border-brand-accent/25",error:"!border-red-300/70 dark:!border-red-500/40",info:"!border-blue-300/70 dark:!border-blue-500/40"}}})}},305142:(e,t,n)=>{"use strict";function r(e){return"number"==typeof e&&Number.isFinite(e)?Math.max(0,Math.floor(e)):null}function a(e){let t=e.getClient?.()??e.client;return t?.userID??t?.user?.id}function i(e){if(!e||"object"!=typeof e)return 0;if("function"==typeof e.muteStatus)try{if(e.muteStatus()?.muted)return 0}catch{}if("function"==typeof e.countUnread)try{return r(e.countUnread())??0}catch{return 0}let t=r(e.unreadCount)??r(e.unread_count)??r(e.state?.unreadCount);if(null!==t)return t;let n=a(e),i=n?e.state?.read?.[n]:void 0;return r(i?.unread_messages)??r(i?.unreadMessageCount)??0}function o(e){if(!e||"object"!=typeof e)return 0;let t=null;if("function"==typeof e.countUnreadMentions)try{t=r(e.countUnreadMentions())}catch{}let n=a(e);if(!n)return 0;let o=e.state?.latestMessages??e.state?.messages;if(!Array.isArray(o)||0===o.length)return t??0;let s=e.state?.read?.[n]?.last_read;if(!s&&0===i(e))return t??0;let l=s?new Date(s).getTime():0,c=0;for(let e of o){if(e.user?.id===n||(e.created_at?new Date(e.created_at).getTime():0)<=l)continue;let r=e.mentioned_users?.some(e=>e?.id===n),a=e.mentioned_channel||e.coachful_mention_everyone;(null===t?r||a:a&&!r)&&(c+=1)}return(t??0)+c}function s(e){return{unread:i(e),mentions:o(e)}}n.d(t,{Xv:()=>s,Yp:()=>i,v4:()=>o})},309192:(e,t,n)=>{"use strict";n.d(t,{Q:()=>o,S:()=>s});var r=n(695155),a=n(682482),i=n(94514);function o({checked:e,onChange:t,id:n,disabled:s,className:l="",ariaLabel:c,indeterminate:d,as:u="button"}){let h=e||d,m=`w-5 h-5 rounded-md border-2 flex items-center justify-center flex-shrink-0
24    transition-all duration-200
25    ${h?"border-brand-accent bg-brand-accent":"border-[#d1cdc8] dark:border-[#3a4150] bg-white dark:bg-[#171b22] hover:border-brand-accent dark:hover:border-brand-accent/50"}
26    ${s?"opacity-50 cursor-not-allowed":"cursor-pointer"}
27    ${l}
28  `,f=d?(0,r.jsx)(a.A,{className:"w-3.5 h-3.5 text-brand-accent-foreground",strokeWidth:3}):e?(0,r.jsx)(i.A,{className:"w-3.5 h-3.5 text-brand-accent-foreground",strokeWidth:3}):null;return"span"===u?(0,r.jsx)("span",{id:n,"aria-hidden":"true",className:m,children:f}):(0,r.jsx)("button",{type:"button",id:n,role:"checkbox","aria-checked":d?"mixed":e,"aria-label":c,disabled:s,onClick:()=>!s&&t?.(!e),onKeyDown:n=>{(" "===n.key||"Enter"===n.key)&&!n.repeat&&(n.preventDefault(),s||t?.(!e))},className:m,children:f})}function s({checked:e,onChange:t,name:n,id:a,disabled:i,className:o=""}){return(0,r.jsx)("button",{type:"button",id:a,role:"radio","aria-checked":e,disabled:i,onClick:()=>!i&&t(!0),className:`w-5 h-5 rounded-full border-2 flex items-center justify-center flex-shrink-0
29        transition-all duration-200
30        ${e?"border-brand-accent bg-brand-accent":"border-[#d1cdc8] dark:border-[#3a4150] bg-white dark:bg-[#171b22] hover:border-brand-accent dark:hover:border-brand-accent/50"}
31        ${i?"opacity-50 cursor-not-allowed":"cursor-pointer"}
32        ${o}
33      `,children:e&&(0,r.jsx)("div",{className:"w-2 h-2 rounded-full bg-white"})})}},330537:(e,t,n)=>{"use strict";n.d(t,{ConditionalNativeAppBridges:()=>i});var r=n(695155);let a=(0,n(337206).default)(()=>n.e(48606).then(n.bind(n,548606)).then(e=>e.NativeAppBridges),{loadableGenerated:{webpack:()=>[548606]},ssr:!0});function i({enabled:e}){return e?(0,r.jsx)(a,{}):null}}
33,373348:(e,t,n)=>{"use strict";function r(){return null}n.d(t,{FirestoreErrorGuard:()=>r}),n(677096)},375714:(e,t,n)=>{"use strict";n.d(t,{UtmCapture:()=>i});var r=n(212115),a=n(9785);function i(){return(0,r.useEffect)(()=>{(0,a.XP)()},[]),null}},378240:(e,t,n)=>{"use strict";n.d(t,{SharedFunnelPopupController:()=>h});var r=n(695155),a=n(212115),i=n(573321),o=n(337206),s=n(697396),l=n(781992);let c=(0,o.default)(()=>n.e(2083).then(n.bind(n,902083)).then(e=>e.WebsiteFunnelPopup),{loadableGenerated:{webpack:()=>[902083]},loading:()=>null}),d=["/book","/f","/join"],u=["/website"];function h({branding:e,organizationName:t,organizationId:n}){let o=(0,i.usePathname)(),m=(0,i.useSearchParams)().get("funnel"),f=(0,a.useMemo)(()=>m?.trim()||"",[m]),[p,g]=(0,a.useState)(null),[b,w]=(0,a.useState)(null),[v,y]=(0,a.useState)(null),[C,S]=(0,a.useState)(!1),[k]=(0,a.useState)(()=>"u">typeof document&&("true"===document.documentElement.dataset.tenantWebsite||document.body?.dataset.tenantWebsite==="true"));(0,a.useEffect)(()=>{let e=e=>{let t=e.detail,n=t?.funnelId;"string"!=typeof n||!n.trim()||n.includes("/")||(t.handled=!0,(0,s.tr)(n.trim()),S(!0),g(n.trim()),w(t.runtimeContext||null))};return window.addEventListener(l.Y,e),()=>window.removeEventListener(l.Y,e)},[]),(0,a.useEffect)(()=>{if(!f||o&&d.some(e=>o===e||o.startsWith(`${e}/`))){g(null),w(null),f||y(null);return}if(v===f||o&&u.some(e=>o===e||o.startsWith(`${e}/`))||k||"u">typeof document&&("true"===document.documentElement.dataset.tenantWebsite||document.body?.dataset.tenantWebsite==="true")){g(null),w(null);return}let e=!1,t=new AbortController;return S(!0),(async()=>{try{let r=new URLSearchParams({slug:f});n&&r.set("organizationId",n);let a=await fetch(`/api/funnel/resolve-root-slug?${r.toString()}`,{signal:t.signal}),i=await a.json().catch(()=>({}));if(e)return;w(null),g(a.ok&&i.exists&&i.funnelId?i.funnelId:null)}catch(t){e||t instanceof DOMException&&"AbortError"===t.name||(g(null),w(null))}})(),()=>{e=!0,t.abort()}},[v,n,o,f]);let x=(0,a.useCallback)(e=>{e||(y(f||null),g(null),w(null))},[f]);return C?(0,r.jsx)(c,{funnelId:p,onOpenChange:x,branding:e?{logoUrl:e.logoUrl||void 0,logoUrlDark:e.logoUrlDark||void 0,horizontalLogoUrl:e.horizontalLogoUrl||void 0,horizontalLogoUrlDark:e.horizontalLogoUrlDark||void 0,logoSource:e.logoSource,appTitle:e.appTitle||t,primaryColor:e.primaryColor||e.colors?.accentLight||void 0,colors:e.colors}:null,organizationName:t,runtimeContext:b}):null}},382929:(e,t,n)=>{"use strict";function r(){if("u"<typeof document)return"en";let e=document.cookie.match(/(?:^|;\s*)ga_demo_locale=([^;]*)/);return e?.[1]||"en"}n.r(t),n.d(t,{getDemoLocale:()=>r})},394537:(e,t,n)=>{"use strict";n.d(t,{U:()=>o,o:()=>i});var r=n(212115);let a=(0,r.createContext)(void 0);function i({targetWindow:e,children:t}){return(0,r.createElement)(a.Provider,{value:e},t)}function o(e){let t=(0,r.useContext)(a),n=void 0===t?window:t,i=(0,r.useCallback)(t=>{if(!n||"function"!=typeof n.matchMedia)return()=>{};let r=n.matchMedia(e);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)},[e,n]),o=(0,r.useCallback)(()=>!!n&&"function"==typeof n.matchMedia&&n.matchMedia(e).matches,[e,n]),s=(0,r.useCallback)(()=>!1,[]);return(0,r.useSyncExternalStore)(i,o,s)}},399710:(e,t,n)=>{"use strict";function r(e){let t=(e||"").trim(),n=t.match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i),r=null,a=null,i=null;if(n){let e=n[1],t=3===e.length?e.split("").map(e=>e+e).join(""):e;r=parseInt(t.slice(0,2),16),a=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16)}else{let e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);e&&(r=Number(e[1]),a=Number(e[2]),i=Number(e[3]))}return null===r||null===a||null===i||[r,a,i].some(Number.isNaN)?"#ffffff":(.299*r+.587*a+.114*i)/255>.55?"#1a1a1a":"#ffffff"}function a(e,t){return e?.textColor?e.textColor:e?.bgColor?r(e.bgColor):t}n.d(t,{B:()=>r,b:()=>a})},413848:(e,t,n)=>{"use strict";n.d(t,{XG:()=>c,Xu:()=>o,tR:()=>l,wv:()=>s});var r=n(615925),a=n(543273);let i=r.tO;function o(e,t){let n=e.trim();if(n.startsWith("corner-"))return i;let r=new URLSearchParams({chatChannelId:n}),a=t?.threadId?.trim(),o=t?.messageId?.trim();
33return a&&r.set("chatThreadId",a),o&&r.set("chatMessageId",o),`/?${r.toString()}`}function s(e){try{let t=new URL(e,"https://coachful.local"),n=t.searchParams.get("chatChannelId")||("/chat"===t.pathname?t.searchParams.get("channel"):null),r=n?.trim();if(!r||r.startsWith("corner-"))return null;let a=t.searchParams.get("chatThreadId")?.trim()||void 0,i=t.searchParams.get("chatMessageId")?.trim()||void 0;return{channelId:r,threadId:a,messageId:i}}catch{return null}}function l(e){if(function(e){try{let t=new URL(e,"https://coachful.local");if("/coach"===t.pathname&&"corner"===t.searchParams.get("tab")){let e=t.searchParams.get("cornerChannelId");return e?.startsWith("corner-")?e:"corner-general"}let n=t.searchParams.get("cornerChannelId");if(n?.startsWith("corner-"))return n;if("community"===t.searchParams.get("home")&&(t.searchParams.has("cornerPostId")||t.searchParams.has("cornerReplyId")||"channels"===t.searchParams.get("communityView")))return"corner-general";let r=t.searchParams.get("chatChannelId")||("/chat"===t.pathname?t.searchParams.get("channel"):null);return r?.startsWith("corner-")?r:null}catch{return null}}(e))return i;let t=s(e);if(t)return o(t.channelId,t);try{let t=new URL(e,"https://coachful.local");if("/chat"===t.pathname)return"/?chat=1";if(("/coach"===t.pathname||"/"===t.pathname)&&"community"===t.searchParams.get("home"))return i}catch{}if("/coach/clients"===e||"/coach/assistant"===e)return"/coach";if("/tasks"===e)return"/";let n=e.match(/^\/checkin\/(morning|evening)\/start(\?.*)?$/);if(n)return`/checkin/flow/${n[1]}${n[2]||""}`;let r=e.match(/^\/checkin\/weekly\/(?:checkin|evaluate|went-well|obstacles|next-week|focus)(\?.*)?$/);if(r)return`/checkin/flow/weekly${r[1]||""}`;let a=e.match(/^\/habits\/([^/?]+)(\?.*)?$/);if(a)return`/habits/${a[1]}/progress${a[2]||""}`;let l=e.replace(/^\/discover\/(article|course|library|video|download|link|book)\//,"/discover/$1s/"),c=l.match(/^\/coach\/programs\/([^/?]+)(\?.*)?$/);if(c){let[,e,t]=c,n=t?`&${t.slice(1)}`:"";l=`/coach?tab=programs&programId=${e}${n}`}let d=l.match(/^\/programs\/([^/?]+)(\?.*)?$/);if(d){let[,e,t]=d,n=t?`&${t.slice(1)}`:"";l=`/program?programId=${e}${n}`}return l}function c(e){var t,n,i,s;if("call_summary_fill_week"===e.type&&e.metadata?.programId&&e.metadata.clientUserId&&void 0!==e.metadata.weekNumber){let t=new URLSearchParams({tab:"programs",programId:e.metadata.programId,clientId:e.metadata.clientUserId,weekNumber:String(e.metadata.weekNumber)});return e.metadata.cohortId&&t.set("cohortId",e.metadata.cohortId),`/coach?${t.toString()}`}if("video_review_published"===e.type&&e.metadata?.reviewId)return`${(0,a.Dq)("programs")}&reviewId=${encodeURIComponent(e.metadata.reviewId)}`;if("program_day_ready"===e.type&&e.metadata?.programId)return e.actionRoute&&"/"!==e.actionRoute?l(e.actionRoute):(0,a.eQ)(e.metadata.programId);if("form_submission_received"===e.type&&e.metadata?.submissionKind==="weekly_reflection"&&e.metadata.clientUserId){let a;return t=e.metadata.clientUserId,n=e.metadata.responseId,a={clientId:t,clientSection:"wellbeing",reflectionType:"weekly"},n&&(a.reflectionId=n),(0,r.Z5)("clients",a)}let c=e.metadata?.questionnaireId,d=e.metadata?.responseId;if("form_submission_received"===e.type&&"string"==typeof c&&c.trim()&&"string"==typeof d&&d.trim())return i=c.trim(),s=d.trim(),(0,r.Z5)("discover",{resourceType:"questionnaire",resourceId:i,questionnaireView:"responses",questionnaireResponseId:s});if("client_input_submitted"===e.type&&e.metadata?.programId&&e.metadata?.clientUserId){let t=new URLSearchParams({tab:"programs",programId:e.metadata.programId,clientId:e.metadata.clientUserId});return void 0!==e.metadata.weekNumber&&t.set("weekNumber",String(e.metadata.weekNumber)),e.metadata.inputStage&&t.set("inputStage",e.metadata.inputStage),e.metadata.inputId&&t.set("inputId",e.metadata.inputId),e.metadata.cohortId&&t.set("cohortId",e.metadata.cohortId),`/coach?${t.toString()}`}let u=e.metadata?.chatChannelId;if("string"==typeof u&&u.trim())return o(u,{threadId:e.metadata?.parentMessageId,messageId:e.metadata?.messageId});let h=e.actionRoute||e.actionUrl;return h?l(h):void 0}},434518:(e,t,n)=>{"use strict";n.d(t,{SentryUserBinder:()=>o});var r=n(212115),a=n(621123),i=n(792939);function o({organizationId:e,organizationSlug:t}){let{user:n,isLoaded:s}=(0,i.useAppUser)();return(0,r.useEffect)(()=>
33{if(s){if(!n)return void a.gV(null);a.gV({id:n.id,email:n.primaryEmailAddress?.emailAddress,username:n.fullName??void 0})}},[s,n]),(0,r.useEffect)(()=>{e&&a.NA("orgId",e),t&&a.NA("orgSlug",t)},[e,t]),null}},442302:(e,t,n)=>{"use strict";n.d(t,{Rk:()=>d,ay:()=>m,eU:()=>f,ke:()=>p,p:()=>h});var r=n(212115),a=n(792939),i=n(32087),o=n(685136);let s="ga_story_views_v2",l="ga_story_slides_viewed",c="ga:story-viewed";function d(e,t){let n=e.activeGoalCount??0,r=t.activeGoalCount??0;return e.taskCount>t.taskCount||e.userPostCount>t.userPostCount||n>r||n===r&&n>0&&e.goalSignature!==(t.goalSignature||"")||e.hasDayClosed&&!t.hasDayClosed||e.hasWeekClosed&&!t.hasWeekClosed||e.hasTasksToday&&!t.hasTasksToday}function u(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));t.setUTCDate(t.getUTCDate()+4-(t.getUTCDay()||7));let n=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-n.getTime())/864e5+1)/7)}function h(){let{user:e}=(0,a.useAppUser)(),{isDemoMode:t}=(0,i._)(),n=(0,r.useMemo)(()=>t?o.W0.id:e?.id,[t,e?.id]),h=(0,r.useCallback)(()=>{try{let e=localStorage.getItem(s);return e?JSON.parse(e):{}}catch{return{}}},[]),m=(0,r.useCallback)(e=>{try{localStorage.setItem(s,JSON.stringify(e))}catch(e){console.error("Failed to save story views:",e)}},[]),f=(0,r.useCallback)((e,r)=>{if(!n||!e)return;let a=h();a[`${n}:${e}`]=r,m(a),window.dispatchEvent(new CustomEvent(c,{detail:{storyUserId:e,contentData:r}})),t||fetch("/api/story-views",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storyOwnerId:e,contentData:r})}).catch(e=>console.error("Failed to sync story view to server:",e))},[n,t,h,m]),p=(0,r.useCallback)((e,t)=>{if(!n||!e)return!1;let r=h()[`${n}:${e}`];return!!r&&!d(t,r)},[n,h]),g=(0,r.useCallback)(()=>{localStorage.removeItem(s),localStorage.removeItem(l)},[]),b=(0,r.useCallback)(()=>{try{let e=localStorage.getItem(l);return e?JSON.parse(e):{}}catch{return{}}},[]),w=(0,r.useCallback)(e=>{try{localStorage.setItem(l,JSON.stringify(e))}catch(e){console.error("Failed to save slide views:",e)}},[]),v=(0,r.useCallback)((e,t)=>{if(!n||!e||!t)return;let r=b(),a=`${n}:${e}`;r[a]||(r[a]={});let i={viewedAt:Date.now()};"goal"===t&&(i.weekNumber=u(new Date)),r[a][t]=i,w(r),window.dispatchEvent(new CustomEvent("ga:slide-viewed",{detail:{storyOwnerId:e,slideId:t}}))},[n,b,w]),y=(0,r.useCallback)((e,t)=>{if(!n||!e||!t)return!1;let r=b(),a=`${n}:${e}`,i=r[a]?.[t];if(!i)return!1;if("goal"===t&&void 0!==i.weekNumber){let e=u(new Date);return i.weekNumber===e}return!0},[n,b]),C=(0,r.useCallback)((e,t)=>{if(!n||!e||0===t.length)return 0;for(let n=0;n<t.length;n++)if(!y(e,t[n].id))return n;return 0},[n,y]),S=(0,r.useCallback)((e,t)=>!!n&&!!e&&0!==t.length&&t.every(t=>y(e,t.id)),[n,y]);return{markStoryAsViewed:f,hasViewedStory:p,clearAllViews:g,markSlideAsViewed:v,isSlideViewed:y,getFirstUnviewedSlideIndex:C,areAllSlidesViewed:S,clearSlideViewsForUser:(0,r.useCallback)(e=>{if(!n||!e)return;let t=b(),r=`${n}:${e}`;delete t[r],w(t)},[n,b,w])}}function m(e,t,n=0,r=!1,a=0,i=0,o=""){return`${e}:${t}:${n}:${r}:${a}:${i}:${o}`}function f(e,t,n=0,r=!1,a=0,i=0,o=""){return{hash:m(e,t,n,r,a,i,o),hasTasksToday:e,hasDayClosed:t,taskCount:n,hasWeekClosed:r,userPostCount:a,activeGoalCount:i,goalSignature:o}}function p(e,t){let{user:n}=(0,a.useAppUser)(),{isDemoMode:l}=(0,i._)(),u=(0,r.useMemo)(()=>l?o.W0.id:n?.id,[l,n?.id]),[h,m]=(0,r.useState)(!1),f="string"==typeof t?null:t||null;return(0,r.useEffect)(()=>{if(!u||!e||!t)return void m(!1);let n=()=>{try{let n=localStorage.getItem(s);if(!n)return void m(!1);let r=JSON.parse(n)[`${u}:${e}`];m((e=>{if(!e)return!1;if(f)return!d(f,e);{let n="string"==typeof t?t:t.hash;return e.hash===n}})(r))}catch{m(!1)}};n();let r=t=>{t.detail.storyUserId===e&&m(!0)},a=e=>{e.key===s&&n()};return window.addEventListener(c,r),window.addEventListener("storage",a),()=>{window.removeEventListener(c,r),window.removeEventListener("storage",a)}},[u,e,t,f]),h}},442763:(e,t,n)=>{"use strict";n.d(t,{Cf:()=>p,Es:()=>b,FE:()=>w,HM:()=>h,L3:()=>v,c7:()=>g,lG:()=>d,rr:()=>y});var r=n(695155),a=n(212115),i=n(189270),o=n(529483),s=n(833210),l=n(140980),c=n(531998);let d=o.bL;o.l9;let u=o.ZL,h=o.bm;function m(e){return"function"==typeof e?.closest?e:"function"==typeof e?.parentElement?.closest?e.parentElement:null}
33let f=a.forwardRef(({className:e,zIndex:t="z-[10000]",style:n,...a},i)=>(0,r.jsx)(o.hJ,{ref:i,className:(0,l.cn)("fixed inset-0 bg-black/45 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-200",t,e),style:{transform:"translateZ(0)",backfaceVisibility:"hidden",willChange:"transform",...n},...a}));f.displayName=o.hJ.displayName;let p=a.forwardRef(({className:e,children:t,hideCloseButton:n,closeLabel:d="Close",hideOverlay:h,zIndex:p="z-[10000]",overlayStyle:g,overlayProps:b,accessibleTitle:w,onPointerDownOutside:v,onInteractOutside:y,style:C,...S},k)=>{let x=(0,i.useAppearanceScope)(),{style:I,...P}=b||{},_=void 0!==S["data-media-library-layer"]||void 0!==S["data-pexels-stock-layer"],E=void 0!==S["data-calendar-event-attendees-layer"],A=_?c.QC:c._K,$=!function e(t){return a.Children.toArray(t).some(t=>{if(!a.isValidElement(t))return!1;let n=t.type;return n===o.hE||"object"==typeof n&&n.displayName===o.hE.displayName||e(t.props.children)})}(t);return(0,r.jsxs)(u,{children:[!h&&(0,r.jsx)(f,{zIndex:p,style:{...g,...I},...P}),(0,r.jsxs)(o.UC,{"data-funnel-theme":x,ref:k,className:(0,l.cn)("fixed left-[50%] top-[50%] grid max-h-[calc(100dvh-2rem)] w-full max-w-2xl translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto overscroll-contain border border-[#e1ddd8] dark:border-[#262b35] bg-white dark:bg-[#171b22] p-6 shadow-2xl shadow-black/10 dark:shadow-black/40 duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-2xl outline-none [backface-visibility:hidden]",p,x,e),onPointerDownOutside:e=>{let t=m(e.detail.originalEvent.target),n=E&&!!t?.closest("[data-calendar-event-attendees-layer]");t?.closest(A)&&!n?e.preventDefault():v?.(e)},onInteractOutside:e=>{let t=m(e.detail.originalEvent.target),n=E&&!!t?.closest("[data-calendar-event-attendees-layer]");t?.closest(A)&&!n?e.preventDefault():y?.(e)},"aria-describedby":S["aria-describedby"]??void 0,style:{backdropFilter:"none",WebkitBackdropFilter:"none",backfaceVisibility:"hidden",...C},...S,children:[$&&(0,r.jsx)(o.hE,{className:"sr-only",children:w||S["aria-label"]||"Dialog"}),t,!n&&(0,r.jsxs)(o.bm,{className:"absolute right-3 top-3 grid h-7 w-7 place-items-center rounded-full text-[#8c8c8c] transition-colors hover:bg-[#f5f3f0] hover:text-[#1a1a1a] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-brand-accent disabled:pointer-events-none dark:text-[#7f8694] dark:hover:bg-[#262b35] dark:hover:text-[#f5f5f8]",children:[(0,r.jsx)(s.A,{className:"h-4 w-4",strokeWidth:1.75}),(0,r.jsx)("span",{className:"sr-only",children:d})]})]})]})});p.displayName=o.UC.displayName;let g=({className:e,...t})=>(0,r.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-2 text-center sm:text-left pb-4 border-b border-[#e1ddd8]/50 dark:border-[#262b35]/50",e),...t});g.displayName="DialogHeader";let b=({className:e,...t})=>(0,r.jsx)("div",{className:(0,l.cn)("relative flex flex-col gap-2 px-6 pt-4 pb-6 border-t border-[#b8b3ad] dark:border-[#4a5060]","before:absolute before:inset-x-0 before:bottom-full before:h-8 before:bg-gradient-to-t before:from-white before:to-transparent before:dark:from-[#171b22] before:pointer-events-none",e),...t});b.displayName="DialogFooter";let w=({className:e,...t})=>(0,r.jsx)("div",{className:(0,l.cn)("flex-1 min-h-0 overflow-y-auto overscroll-contain pb-8",e),...t});w.displayName="DialogScrollArea";let v=a.forwardRef(({className:e,...t},n)=>(0,r.jsx)(o.hE,{ref:n,className:(0,l.cn)("text-lg font-semibold text-text-primary dark:text-[#f5f5f8]",e),...t}));v.displayName=o.hE.displayName;let y=a.forwardRef(({className:e,...t},n)=>(0,r.jsx)(o.VY,{ref:n,className:(0,l.cn)("text-sm text-muted-foreground dark:text-[#b2b6c2]",e),...t}));y.displayName=o.VY.displayName},449497:(e,t,n)=>{"use strict";n.d(t,{AppResponsivenessTelemetry:()=>l,AppStartupTelemetry:()=>s}),n(695155);var r=n(212115);function a(){return navigator.userAgent.includes("CoachfulNativeApp")||"true"===document.documentElement.dataset.nativeApp}function i(e){return Number.isFinite(e)?Math.max(0,Math.round(e)):void 0}function o(e){let t=new Blob([e],{type:"application/json"});navigator.sendBeacon?.("/api/mobile/startup-metrics",t)||fetch("/api/mobile/startup-metrics",{method:"POST",credentials:"include",keepalive:!0,headers:{"Content-Type":"application/json"},body:e}).catch(()=>{})}function s({surface:e}){return(0,r.useEffect)(()=>{let t,n,r=a();if("native"===e&&!r||"web"===e&&r||Math.random()>("native"===e?.25:.1))return;let s=performance.getEntriesByType("navigation")[0],l=`coachful-${e}-startup:${Math.round(performance.timeOrigin)}`;if("sent"===window.sessionStorage.getItem(l))return;let c="native"===e?window.__COACHFUL_NATIVE_LAUNCH_STARTED_AT__:void 0,d="number"==typeof c?Math.max(0,performance.timeOrigin-c):0;if("native"===e&&d>6e4)return;let u=performance.now(),h=0,m=0,f=!1;for(let e of performance.getEntriesByType("paint"))"first-contentful-paint"===e.name&&(t=e.startTime);let p=[],g=(e,t)=>{try{let n=new PerformanceObserver(t);n.observe({type:e,buffered:!0}),p.push(n)}catch{}};g("paint",e=>{for(let n of e.getEntries())"first-contentful-paint"===n.name&&(t=n.startTime)}),g("largest-contentful-paint",e=>{let t=e.getEntries(),r=t[t.length-1];r&&(n=r.startTime)}),g("longtask",e=>{for(let t of e.getEntries())h+=1,m+=t.duration});let b=()=>{if(f)return;
33f=!0,p.forEach(e=>e.disconnect()),window.sessionStorage.setItem(l,"sent");let r=performance.getEntriesByType("resource");o(JSON.stringify({metricType:"startup",route:window.location.pathname,surface:e,platform:"web"===e?"web":navigator.userAgent.includes("Android")?"android":"ios",nativeClockAvailable:"number"==typeof c,redirectCount:s?.redirectCount||0,nativeToResponseStartMs:i(s?d+s.responseStart:void 0),nativeToFirstContentfulPaintMs:i(void 0===t?void 0:d+t),nativeToLargestContentfulPaintMs:i(void 0===n?void 0:d+n),nativeToShellHydratedMs:i(d+u),domInteractiveMs:i(s?d+s.domInteractive:void 0),loadCompleteMs:i(s?.loadEventEnd?d+s.loadEventEnd:void 0),longTaskCount:h,longTaskDurationMs:i(m),resourceCount:r.length,transferBytes:r.reduce((e,t)=>e+(t.transferSize||0),0)}))},w=window.setTimeout(b,12e3),v=()=>b();return window.addEventListener("pagehide",v,{once:!0}),()=>{window.clearTimeout(w),window.removeEventListener("pagehide",v),b()}},[e]),null}function l(){return(0,r.useEffect)(()=>{let e=a();if(Math.random()>(e?.25:.05))return;let t=0,n=0,r=0,s=e=>{e<200||(t+=1,n+=e,r=Math.max(r,e))},l=()=>{0!==t&&(o(JSON.stringify({metricType:"responsiveness",surface:e?"native":"web",platform:e?navigator.userAgent.includes("Android")?"android":"ios":"web",route:window.location.pathname,longTaskCount:t,longTaskDurationMs:i(n),maxLongTaskMs:i(r)})),t=0,n=0,r=0)},c=null,d=!1;try{(c=new PerformanceObserver(e=>{for(let t of e.getEntries())s(t.duration)})).observe({type:"longtask",buffered:!0}),d=!0}catch{}let u=performance.now()+1e3,h=d?null:window.setInterval(()=>{let e=performance.now();s(e-u),u=e+1e3},1e3),m=window.setInterval(l,6e4),f=()=>l();return window.addEventListener("pagehide",f),()=>{c?.disconnect(),null!==h&&window.clearInterval(h),window.clearInterval(m),window.removeEventListener("pagehide",f),l()}},[]),null}},468648:(e,t,n)=>{"use strict";n.d(t,{P:()=>o,_:()=>i});var r=n(677096),a=n(837511);async function i(e){let t,{targetPath:i,hostOverride:o}="string"==typeof e?{targetPath:e}:e;if(!i||"string"!=typeof i)return void console.warn("[mobile-browser] openInMobileSafari called with empty targetPath");let s=o||window.location.host,l="http:"===window.location.protocol?"http:":"https:";if(!(0,a.JK)()){window.location.href=`${l}//${s}${i}`;return}let c=r.auth?.currentUser;if(c)try{let e=await c.getIdToken(),n=await fetch("/api/auth/create-native-transfer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:e,targetHostname:new URL(`${l}//${s}`).hostname})});if(!n.ok)throw Error(`transfer create failed: ${n.status}`);let{key:r}=await n.json(),a=new URL(`${l}//${s}/api/auth/sync-redirect`);a.searchParams.set("key",r),a.searchParams.set("target",i),t=a.toString()}catch(e){console.error("[mobile-browser] session handoff failed, falling back:",e),t=`${l}//${s}${i}`}else{let e=encodeURIComponent(i);t=`${l}//${s}/api/auth/create-transfer?target=${e}`}try{let{Browser:e}=await n.e(9176).then(n.bind(n,109176));await e.open({url:t,presentationStyle:"popover"})}catch(e){console.error("[mobile-browser] Browser.open failed:",e),window.location.href=t}}async function o(e){if(e){if((0,a.JK)())try{let{Browser:t}=await n.e(9176).then(n.bind(n,109176));await t.open({url:e,presentationStyle:"popover"});return}catch(e){console.error("[mobile-browser] openExternalUrl Browser.open failed, falling back:",e)}window.open(e,"_blank","noopener,noreferrer")}}},477916:(e,t,n)=>{"use strict";n.d(t,{D:()=>r,L:()=>a});let r="coachful:habit-proof";function a(e){e.proofCheckIn&&window.dispatchEvent(new CustomEvent(r,{detail:e.proofCheckIn}))}},486821:(e,t,n)=>{"use strict";n.d(t,{FZ:()=>U,In:()=>T,KJ:()=>_,LA:()=>N,Mv:()=>A,Nm:()=>S,Tl:()=>I,Tu:()=>j,Vw:()=>R,W0:()=>y,WY:()=>k,ZQ:()=>b,cC:()=>C,eh:()=>P,gR:()=>i,h0:()=>E,hO:()=>q,l1:()=>s,lJ:()=>o,lb:()=>a,oH:()=>$,sW:()=>L,xW:()=>w,xk:()=>x,ys:()=>M,zm:()=>D,zp:()=>v});var r=n(88239);n(741463);let a="acquisition_pricing_2026_08_v1",i="coachful_acquisition_pricing_v1",o="coachful_acquisition_pricing_v1",s=3456e4,l=100,c=0,d=0;[l,c,d].join("/");let u={arm:"control",weight:l,pricingVersion:30,growthBandId:"band_solo_v30",proBandId:"band_pro_v30",studioBandId:"band_studio_v30",enterpriseBandI
33d:"band_agency_v30",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:94800,publicProAnnualCents:94800},h={arm:"test_1",weight:c,pricingVersion:15,growthBandId:"band_growth_v15",proBandId:"band_pro_v15",growthMonthlyCents:7900,onboardingProMonthlyCents:9900,publicProMonthlyCents:12900},m={arm:"test_2",weight:d,pricingVersion:11,growthBandId:"band_growth_v11",proBandId:"band_pro_v11",growthMonthlyCents:9700,onboardingProMonthlyCents:12700,publicProMonthlyCents:14700,growthAnnualCents:97e3,onboardingProAnnualCents:127e3,publicProAnnualCents:147e3},f=new Map([{arm:"control",weight:0,pricingVersion:29,growthBandId:"band_solo_v29",proBandId:"band_pro_v29",studioBandId:"band_studio_v29",enterpriseBandId:"band_agency_v29",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:94800,publicProAnnualCents:94800},u,h,m,{arm:"control",weight:0,pricingVersion:28,growthBandId:"band_solo_v28",proBandId:"band_pro_v28",studioBandId:"band_studio_v28",enterpriseBandId:"band_agency_v28",growthMonthlyCents:4900,onboardingProMonthlyCents:7900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:78e3,publicProAnnualCents:94800},{arm:"control",weight:0,pricingVersion:27,growthBandId:"band_solo_v27",proBandId:"band_pro_v27",studioBandId:"band_studio_v27",enterpriseBandId:"band_agency_v27",growthMonthlyCents:4900,onboardingProMonthlyCents:7900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:78e3,publicProAnnualCents:94800},{arm:"control",weight:0,pricingVersion:26,growthBandId:"band_solo_v26",proBandId:"band_pro_v26",studioBandId:"band_studio_v26",enterpriseBandId:"band_agency_v26",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:94800,publicProAnnualCents:94800},{arm:"control",weight:0,pricingVersion:25,growthBandId:"band_solo_v25",proBandId:"band_pro_v25",studioBandId:"band_studio_v25",enterpriseBandId:"band_agency_v25",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:94800,publicProAnnualCents:94800},{arm:"control",weight:0,pricingVersion:24,growthBandId:"band_solo_v24",proBandId:"band_pro_v24",studioBandId:"band_studio_v24",enterpriseBandId:"band_agency_v24",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:94800,publicProAnnualCents:94800},{arm:"control",weight:0,pricingVersion:23,growthBandId:"band_solo_v23",proBandId:"band_pro_v23",studioBandId:"band_studio_v23",enterpriseBandId:"band_agency_v23",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:94800,publicProAnnualCents:94800},{arm:"control",weight:0,pricingVersion:22,growthBandId:"band_solo_v22",proBandId:"band_pro_v22",studioBandId:"band_studio_v22",enterpriseBandId:"band_agency_v22",growthMonthlyCents:4900,onboardingProMonthlyCents:7900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:78e3,publicProAnnualCents:94800},{arm:"control",weight:0,pricingVersion:21,growthBandId:"band_solo_v21",proBandId:"band_pro_v21",studioBandId:"band_studio_v21",enterpriseBandId:"band_agency_v21",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:46800,onboardingProAnnualCents:94800,publicProAnnualCents:94800},{arm:"control",weight:0,pricingVersion:20,growthBandId:"band_solo_v20",proBandId:"band_pro_v20",studioBandId:"band_studio_v20",enterpriseBandI
33d:"band_agency_v20",growthMonthlyCents:4900,onboardingProMonthlyCents:7900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:47e3,onboardingProAnnualCents:79e3,publicProAnnualCents:95e3},{arm:"control",weight:0,pricingVersion:19,growthBandId:"band_solo_v19",proBandId:"band_pro_v19",studioBandId:"band_studio_v19",enterpriseBandId:"band_agency_v19",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:9900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:47e3,onboardingProAnnualCents:95e3,publicProAnnualCents:95e3},{arm:"control",weight:0,pricingVersion:18,growthBandId:"band_solo_v18",practiceBandId:"band_practice_v18",proBandId:"band_pro_v18",studioBandId:"band_studio_v18",enterpriseBandId:"band_agency_v18",growthMonthlyCents:4900,practiceMonthlyCents:9900,onboardingProMonthlyCents:9900,publicProMonthlyCents:14900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:47e3,onboardingProAnnualCents:143e3,publicProAnnualCents:143e3},{arm:"control",weight:0,pricingVersion:17,growthBandId:"band_solo_v17",practiceBandId:"band_practice_v17",proBandId:"band_pro_v17",studioBandId:"band_studio_v17",enterpriseBandId:"band_agency_v17",growthMonthlyCents:4900,practiceMonthlyCents:9900,onboardingProMonthlyCents:9900,publicProMonthlyCents:14900,studioMonthlyCents:19900,enterpriseMonthlyCents:29900,growthAnnualCents:47e3,onboardingProAnnualCents:143e3,publicProAnnualCents:143e3},{arm:"control",weight:0,pricingVersion:16,growthBandId:"band_launch_v16",proBandId:"band_pro_v16",enterpriseBandId:"band_enterprise_v16",growthMonthlyCents:4900,onboardingProMonthlyCents:9900,publicProMonthlyCents:14900,enterpriseMonthlyCents:29900},{arm:"control",weight:0,pricingVersion:14,growthBandId:"band_growth_v14",proBandId:"band_pro_v14",growthMonthlyCents:4900,onboardingProMonthlyCents:7900,publicProMonthlyCents:9900},{arm:"test_1",weight:0,pricingVersion:12,growthBandId:"band_growth_v12",proBandId:"band_pro_v12",growthMonthlyCents:12900,onboardingProMonthlyCents:14900,publicProMonthlyCents:19900,growthAnnualCents:129e3,onboardingProAnnualCents:149e3,publicProAnnualCents:199e3},{arm:"control",weight:0,pricingVersion:13,growthBandId:"band_growth_v13",proBandId:"band_pro_v13",growthMonthlyCents:4900,onboardingProMonthlyCents:7900,publicProMonthlyCents:9900},{arm:"control",weight:0,pricingVersion:7,growthBandId:"band_growth_v7",proBandId:"band_pro_v7",growthMonthlyCents:6900,onboardingProMonthlyCents:8900,publicProMonthlyCents:9900},{arm:"test_1",weight:0,pricingVersion:8,growthBandId:"band_growth_v8",proBandId:"band_pro_v8",growthMonthlyCents:8900,onboardingProMonthlyCents:11900,publicProMonthlyCents:12900},{arm:"test_2",weight:0,pricingVersion:9,growthBandId:"band_growth_v9",proBandId:"band_pro_v9",growthMonthlyCents:14900,onboardingProMonthlyCents:17900,publicProMonthlyCents:19900},{arm:"test_2",weight:0,pricingVersion:10,growthBandId:"band_growth_v10",proBandId:"band_pro_v10",growthMonthlyCents:14900,onboardingProMonthlyCents:16900,publicProMonthlyCents:19900}].map(e=>[e.pricingVersion,e])),p={4:"legacy_v4",5:"legacy_v5",6:"legacy_v6"},g={v5StartedAt:Date.parse("2026-07-23T00:00:00+02:00"),v6StartedAt:Date.parse("2026-07-28T23:55:43+02:00"),v5RestoredAt:Date.parse("2026-07-30T18:59:11+02:00")};function b(e){return f.get(e)?.arm??p[e]??null}function w(e){let t=f.get(e);return t?t.onboardingProMonthlyCents:6===e?11900:5===e?8900:(0,r.LB)(e)?9900*(4===e):0}function v(e){let t=f.get(e);return t?t.publicProMonthlyCents:6===e?12900:9900*(5===e||4===e)}function y(e){return f.get(e)?.enterpriseMonthlyCents??0}function C(e){return f.get(e)?.practiceMonthlyCents??0}function S(e){return f.get(e)?.studioMonthlyCents??0}function k(e){let t=f.get(e);return t?t.growthMonthlyCents:6===e?8900:5===e?6900:4900*(4===e)}function x(e){return f.get(e)?.onboardingProAnnualCents??0}function I(e){return f.get(e)?.publicProAnnualCents??0}function P(e,t,n){let r=`$${t/100}`,a=e.replace(/\{\{growth_monthly\}\}/g,r).replace(/\$69\/mo\b/g,`${r}/mo`).replace(/\$69\/month\b/g,`${r}/month`).replace(/\$69(?=\/|$)/g,`$${t/100}`).replace(/€69(?=\/|$)/g,`€${t/100}`);return Number.isFinite(n)?a.replace(/\{\{public_pro_monthly\}\}/g,`$${Number(n)/100}`):a}function _(e){return e<g.v5StartedAt?4:e<g.v6StartedAt?5:e<g.v5RestoredAt?6:5}function E(e,t=new Date().toISOString(),n){let r=function(e){let t=0x811c9dc5,n=`${a}:${e}`;for(let e=0;e<n.length;e+=1)t^=n.charCodeAt(e),t=Math.imul(t,0x1000193);let r=(t>>>0)%100,i=l;return r<i?u:r<i+c?h:m}(e);return{schemaVersion:1,experimentId:a,visitorId:e,arm:r.arm,pricingVersion:r.pricingVersion,...n?{routePricingVariant:n}:{},assignedAt:t}}function A(e){let t=p[e.pricingVersion];if(!t)throw Error("Unsupported historical pricing generation");return{schemaVersion:1,experimentId:a,visitorId:e.visitorId,arm:t,pricingVersion:e.pricingVersion,assignedAt:new Date(e.evidenceTimestampMs).toISOString(),legacyEvidenceAt:new Date(e.evidenceTimestampMs).toISOString()}}function $(e){return!!e&&"object"==typeof e&&1===e.schemaVersion&&e.experimentId===a&&"string"==typeof e.visitorId&&!!/^[A-Za-z0-9_-]{8,128}$/.test(e.visitorId)&&"string"==typeof e.arm&&!!(0,r.h5)(e.pricingVersion)&&(void 0===e.routePricingVariant||"eu_lite"===e.routePricingVariant&&(28===e.pricingVersion||30===e.pricingVersion))&&"string"==typeof e.assignedAt&&b(e.pricingVersion)===e.arm}function M(e){return encodeURIComponent(JSON.stringify(e))}function j(e){if(!e)return null;try{let t=JSON.parse(decodeURIComponent(e));return $(t)?t:null}catch{return null}}function T(){if("u"<typeof document)return null;let e=`${i}=`,t=j(document.cookie.split(";").map(e=>e.trim()).find(t=>t.startsWith(e))?.slice(e.length));if(t)return t;try{return j(window.localStorage.getItem(o))}catch{return null}}function N(e){if("eu_lite"===e.routePricingVariant){let t=(0,r.jL)(e.pricingVersion);if(t)return t}return(0,r.iS)(e.pricingVersion)}function q(e){let t=(0,r.Nj)(N(e));return t?.priceMonthly??k(e.pricingVersion)}function D(e){return(0,r.LB)(e.pricingVersion)}function U(e){return(0,r.Bh)(e.pricingVersion)}function R(e){return(0,r.Jw)(e.pricingVersion)}function L(e){return(0,r._q)(e.pricingVersion)}},512445:(e,t,n)=>{"use strict";n.d(t,{CreditPurchaseProvider:()=>c,a:()=>d});var r=n(695155),a=n(212115),i=n(337206),o=n(590879);let s=(0,i.default)(()=>Promise.all([n.e(97463),n.e(38266)]).then(n.bind(n,692840)).then(e=>({default:e.CreditPurchaseModal})),{loadableGenerated:{webpack:()=>[692840]},ssr:!1}),l=(0,a.createContext)({openCreditPurchase:()=>{}});function c({children:e}){let[t,n]=(0,a.useState)(!1),[i,d]=(0,a.useState)(!1),u=(0,o.i)(),h=(0,a.useCallback)(()=>{u?.access?.requiresPlan?u.requestPlan("buy_credits"):(d(!0),n(!0))},[u]);return(0,r.jsxs)(l.Provider,{value:{openCreditPurchase:h},children:[e,i&&(0,r.jsx)(s,{open:t,onOpenChange:n})]})}function d(){return(0,a.useContext)(l)}}
33,519864:(e,t,n)=>{"use strict";function r(e){return"admin"===e||"super_admin"===e}function a(e){return"super_admin"===e}function i(e){return"editor"===e||"super_admin"===e}function o(e,t,n){return!!a(e)||"admin"===e&&"super_admin"!==t&&"super_admin"!==n}function s(e,t){return!!a(e)||"admin"===e&&"super_admin"!==t}function l(e,t){return"coach"===e||"admin"===e||"super_admin"===e||"super_coach"===t||"coach"===t||"virtual_assistant"===t}function c(e,t){return"coach"===e||r(e)||g(t)}function d(e){return a(e)?["user","editor","coach","admin","super_admin"]:"admin"===e?["user","editor","coach","admin"]:[]}function u(e){return({user:"User",editor:"Editor",coach:"Coach",admin:"Admin",super_admin:"Super Admin"})[e]||e}function h(e){return({user:"bg-gray-100 text-gray-700",editor:"bg-teal-100 text-teal-700",coach:"bg-blue-100 text-blue-700",admin:"bg-purple-100 text-purple-700",super_admin:"bg-red-100 text-red-700"})[e]||"bg-gray-100 text-gray-700"}function m(e){return({none:"No Coaching",active:"Active",canceled:"Canceled",past_due:"Past Due",stopped:"Stopped"})[e]||e}function f(e){return({none:"bg-slate-100 text-slate-600",active:"bg-emerald-100 text-emerald-700",canceled:"bg-red-100 text-red-600",past_due:"bg-orange-100 text-orange-700",stopped:"bg-gray-100 text-gray-600"})[e]||"bg-slate-100 text-slate-600"}function p(e){return"super_coach"===e}function g(e){return"super_coach"===e||"coach"===e}function b(e){return"super_coach"===e||"coach"===e||"virtual_assistant"===e}function w(){return["coach","virtual_assistant","member"]}function v(){return["super_coach","coach","virtual_assistant","member"]}function y(e){return e&&({super_coach:"Superadmin",coach:"Coach",virtual_assistant:"VA",member:"Member"})[e]||"Member"}function C(e){return e&&({super_coach:"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",coach:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",virtual_assistant:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",member:"bg-gray-100 text-gray-700 dark:bg-[#2a2f3a] dark:text-gray-300"})[e]||"bg-gray-100 text-gray-700 dark:bg-[#2a2f3a] dark:text-gray-300"}n.d(t,{BS:()=>C,No:()=>l,Pj:()=>h,Q0:()=>p,RT:()=>d,_P:()=>m,bl:()=>w,dg:()=>s,jm:()=>a,kX:()=>o,pQ:()=>u,qc:()=>r,rD:()=>b,s2:()=>c,tY:()=>g,vH:()=>f,vI:()=>y,xA:()=>i,xV:()=>v})},522692:(e,t,n)=>{"use strict";n.d(t,{ProductActivityTracker:()=>y});var r=n(212115),a=n(573321),i=n(792939),o=n(142692),s=n(32087),l=n(805069),c=n(615925);let d={clients:"Clients",prospects:"Prospects",intakes:"Intakes",webinars:"Webinars",team:"Team","ai-coach":"AI Coach",offers:"Offers",bundles:"Bundles",squads:"Communities",programs:"Programs","client-journey":"Client Journey",referrals:"Referrals",analytics:"Analytics",diagnostics:"Diagnostics",discounts:"Discounts & Loyalty",discover:"Resources","upgrade-forms":"Upgrade Forms","coaching-forms":"Coaching Forms",funnels:"Funnels",ecosystem:"Ecosystem",website:"Pages",links:"Link in bio",checkins:"Coaching Flows",onboarding:"Onboarding",channels:"Chats",scheduling:"Sessions",integrations:"Integrations",customize:"Customize",plan:"Plan & Billing",support:"Support",invoices:"Payments",corner:"Coach Corner","growth-lab":"Growth Lab","client-lab":"Client Lab","vision-board":"Vision Board",addons:"Power-ups","get-clients":"Get Clients",content:"Content Planner",ads:"Paid Ads",email:"Emails",notifications:"Notifications",library:"Media Library","my-data":"My Data",agreements:"Agreements",whatsapp:"WhatsApp",guide:"Guide",automations:"Automations"},u={websiteSubTab:{editor:"Website editor",pages:"All pages",blog:"Blog",submissions:"Submissions",newsletter:"Newsletter"},clientsSubTab:{clients:"Clients",prospects:"Prospects",intakes:"Intakes",team:"Team"},schedulingSubTab:{calendar:"Calendar",availability:"Availability","session-types":"Session types"},analyticsSubTab:{overview:"Overview",business:"Business",leads:"Leads",clients:"Clients",programs:"Programs",retention:"Retention"},growthSubTab:{overview:"Overview",diagnostics:"Diagnostics","client-lab":"Client Lab",seo:"SEO"},discoverSubTab:{library:"Library",programs:"Programs",content:"Content"},invoicesSubTab:{overview:"Overview",payments:"Payments",subscriptions:"Subscriptions",settings:"Settings"},customizeSubtab:{branding:"Branding",navigation:"Navigation",roles:"Roles",recognition:"Recognition"},automationsView:{automations:"Automations",templates:"Templates",activity:"Activity"}},h=["tab","view","websiteSubTab","clientsSubTab","schedulingSubTab","analyticsSubTab","growthSubTab","discoverSubTab","invoicesSubTab","customizeSubtab","flowSection","automationsView"],m={clientId:"client",programId:"program",cohortId:"cohort",journeyId:"journey",funnelId:"funnel",webinarId:"webinar",courseId:"course",questionnaireId:"questionnaire",flowId:"coaching flow"},f=["/admin","/api","/sign-in","/sign-up","/signup","/sso-callback","/marketing","/lander","/find-a-coac
33h","/get-coach","/marketplace","/website-audit","/refund-policy","/subscription-policy","/website","/privacy","/terms","/blog","/tools","/collective","/unfixated"];function p(e){return!e.startsWith("/test-")&&!f.some(t=>e===t||e.startsWith(`${t}/`))}function g(e,t){let n=e.startsWith("/")?e.slice(0,260):"/";if(!t)return n;let r=new URLSearchParams;for(let e of h){let n=t.get(e);n&&/^[a-zA-Z0-9_-]{1,48}$/.test(n)&&r.set(e,n)}if(!r.has("view")){for(let[e,n]of Object.entries(m))if(t.get(e)){r.set("view",n.replace(/\s+/g,"-"));break}}let a=r.toString();return a?`${n}?${a}`:n}function b(e){let t=e;try{t=decodeURIComponent(e)}catch{}return t.replace(/[-_]+/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function w(e,t){if("/coach"===e||(0,c.P9)(e)){let n=t?.get("tab")||"",r=n?d[n]||b(n):(0,c.TQ)(e)?b((0,c.TQ)(e)):"Coach dashboard";for(let[e,n]of Object.entries(u)){let a=t?.get(e);if(a&&n[a]){r=`${r} \xb7 ${n[a]}`;break}}let a=t?.get("view")?.replace(/-/g," ")||"";if(!a){for(let[e,n]of Object.entries(m))if(t?.get(e)){a=n;break}}return a?`${r} \xb7 ${b(a)} detail`:r}let n={"/":"Home","/dashboard":"Member dashboard","/setup":"Setup","/launch":"Launch","/account":"Account","/profile":"Profile","/my-coaching":"My Coaching"};if(n[e])return n[e];let r=e.split("/").filter(Boolean);if(0===r.length)return"Home";let a=r.filter(e=>e.length<24&&!/^[a-f0-9-]{20,}$/i.test(e));return a.length>0?a.map(b).join(" · "):"App page"}function v(e){return e.replace(/https?:\/\/\S+/gi,"[link]").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi,"[email]").replace(/\b[a-f0-9]{8}-[a-f0-9-]{27,}\b/gi,"[item]").replace(/\b[A-Za-z0-9_-]{36,}\b/g,"[item]").replace(/\s+/g," ").trim().slice(0,120)}function y(){let e=(0,a.usePathname)(),t=(0,a.useSearchParams)().toString(),{userId:n,isLoaded:c,isSignedIn:d,firebaseUser:u}=(0,i.useAppAuth)(),{isDemoSite:h}=(0,s._)(),m=(0,o.Hw)(),f=m?.organizationId||null,b=(0,r.useMemo)(()=>{let n=new URLSearchParams(t);return{path:g(e,n),label:w(e,n),trackable:p(e)}},[e,t]),y=b.path,C=b.label,S=b.trackable,k=(0,r.useRef)([]),x=(0,r.useRef)(null),I=(0,r.useRef)(null),P=(0,r.useRef)(""),_=(0,r.useRef)(null),E=(0,r.useRef)(!1),A=(0,r.useRef)(f),$=(0,r.useRef)(null),M=(0,r.useRef)(null),j=(0,r.useCallback)((e=!1)=>{null!==x.current&&(window.clearTimeout(x.current),x.current=null);let t=k.current.splice(0);for(let n=0;n<t.length;n+=20)!function(e,t,n,r){if(0===e.length)return;let a=JSON.stringify({events:e,organizationId:t});r&&"function"==typeof navigator.sendBeacon&&navigator.sendBeacon("/api/activity/track",new Blob([a],{type:"application/json"}))||fetch("/api/activity/track",{method:"POST",credentials:"include",keepalive:!0,headers:{"Content-Type":"application/json",...n?{Authorization:`Bearer ${n}`}:{}},body:a}).catch(()=>{})}(t.slice(n,n+20),A.current,$.current,e)},[]),T=(0,r.useCallback)(()=>{null===x.current&&(x.current=window.setTimeout(()=>{x.current=null;let e=()=>j();"requestIdleCallback"in window?window.requestIdleCallback(e,{timeout:2e3}):e()},12e3))},[j]),N=(0,r.useCallback)(e=>{if(E.current){if(_.current&&"page_duration"!==e.eventType){let t=(0,l.yu)(_.current,!0);t!==P.current&&"session_start"!==e.eventType&&k.current.push({eventType:"session_start",sessionId:t,occurredAt:Date.now(),path:e.path,pageLabel:e.pageLabel}),P.current=t}k.current.push({...e,sessionId:P.current,occurredAt:Date.now()}),k.current.length>80&&k.current.splice(0,k.current.length-80),k.current.length>=20?j():T()}},[j,T]),q=(0,r.useCallback)(()=>{let e=I.current;if(!e)return;I.current=null;let t=Math.min(72e5,Math.max(0,e.visibleDurationMs+(null===e.visibleStartedAt?0:Date.now()-e.visibleStartedAt)));t<500||N({eventType:"page_duration",path:e.path,pageLabel:e.label,durationMs:t})},[N]);return(0,r.useEffect)(()=>{A.current=f},[f]),(0,r.useEffect)(()=>{let e=!1;return $.current=null,u&&u.getIdToken().then(t=>{e||($.current=t)}).catch(()=>{}),()=>{e=!0}},[u]),(0,r.useEffect)(()=>{let e=!h&&c&&d&&!!n;if(E.current=e,!e){I.current=null,k.current=[],P.current="",_.current=null,$.current=null;return}_.current!==n&&(k.current=[],_.current=n,P.current=(0,l.yu)(n,!0));try{let e=`coachful:product-activity-started:${P.current}`;S&&"true"!==window.sessionStorage.getItem(e)&&(window.sessionStorage.setItem(e,"true"),N({eventType:"session_start",path:y,pageLabel:C}))}catch{}},[C,y,S,N,h,c,d,n]),(0,r.useEffect)(()=>
33{if(!h&&c&&d&&n&&(q(),S))return I.current={path:y,label:C,visibleStartedAt:"visible"===document.visibilityState?Date.now():null,visibleDurationMs:0},N({eventType:"page_view",path:y,pageLabel:C}),()=>q()},[C,y,S,q,N,h,c,d,n]),(0,r.useEffect)(()=>{if(h||!c||!d||!n)return;let e=0,t=t=>{if(!t.isTrusted||"visible"!==document.visibilityState||!p(window.location.pathname))return;let r=Date.now();r-e<15e3||(e=r,(0,l.yu)(n,!0))},r=e=>{var t;let n,r;if(!E.current||!p(window.location.pathname))return;let a=e.target;if(!(a instanceof Element)||a.closest('[data-message-id],.str-chat__message-list,.str-chat__message-list-scroll,[contenteditable="true"],.ProseMirror'))return;let i=a.closest('[data-product-activity],a[href],button,[role="button"],[role="menuitem"],[role="option"],[role="tab"],[role="link"],input[type="submit"],input[type="button"],input[type="checkbox"],input[type="radio"],[tabindex]:not([tabindex="-1"]),summary');if(!i||i.closest("[data-product-activity-ignore]")||i.hasAttribute("disabled")||"true"===i.getAttribute("aria-disabled"))return;let o=i instanceof HTMLAnchorElement?function(e){if(e)try{let t=new URL(e,window.location.href);if(t.origin===window.location.origin)return g(t.pathname,t.searchParams);if("mailto:"===t.protocol||"tel:"===t.protocol)return t.protocol.slice(0,-1);return`External \xb7 ${t.hostname}`.slice(0,160)}catch{return}}(i.href):void 0,s=function(e,t){let n=e.dataset.productActivity||e.getAttribute("data-analytics-label")||e.getAttribute("aria-label")||e.getAttribute("title");if(n)return v(n);if(e instanceof HTMLInputElement){let t=e.labels?.[0]?.textContent||e.name||e.id;if(t)return v(t)}let r=v(e.innerText||e.textContent||"");return r||(t?`Open ${t}`:"")}(i,o);if(!s)return;let l="tab"===(n=i.getAttribute("role"))||"menuitem"===n||"option"===n||"switch"===n?n:i instanceof HTMLAnchorElement?"link":i instanceof HTMLInputElement?i.type||"input":i instanceof HTMLButtonElement?"button":"SUMMARY"===i.tagName?"disclosure":n||i.tagName.toLowerCase(),c=`${window.location.pathname}|${l}|${s}|${o||""}`,d=Date.now();if(M.current&&M.current.signature===c&&d-M.current.at<450)return;M.current={signature:c,at:d};let u=new URLSearchParams(window.location.search);N({eventType:"action",path:g(window.location.pathname,u),pageLabel:w(window.location.pathname,u),actionLabel:s,actionKind:(t=!!o,r=s.toLowerCase(),t||"link"===l?"navigate":/\b(create|add|new|start|build)\b/.test(r)?"create":/\b(edit|customize|manage|configure|settings?)\b/.test(r)?"edit":/\b(save|publish|update|submit|confirm|complete|send|schedule|continue|done)\b/.test(r)?"save":/\b(delete|remove|archive|disconnect|cancel)\b/.test(r)?"delete":/\b(share|invite|copy|export)\b/.test(r)?"share":/\b(upload|import|attach)\b/.test(r)?"upload":/\b(search|find)\b/.test(r)?"search":/\b(filter|sort|all|active|draft)\b/.test(r)?"filter":"checkbox"===l||"switch"===l?"toggle":/\b(open|view|preview|show|details?)\b/.test(r)?"view":"interact"),targetKind:l,destination:o})},a=e=>{if(e.submitter||!E.current||!p(window.location.pathname))return;let t=e.target;if(!(t instanceof HTMLFormElement)||t.closest("[data-product-activity-ignore]"))return;let n=t.dataset.productActivity||t.getAttribute("aria-label")||t.getAttribute("name")||t.id||"Form",r=new URLSearchParams(window.location.search);N({eventType:"action",path:g(window.location.pathname,r),pageLabel:w(window.location.pathname,r),actionLabel:`Submitted ${v(n)}`,actionKind:"save",targetKind:"form"})},i=()=>{let e=I.current;if("hidden"===document.visibilityState)e&&null!==e.visibleStartedAt&&(e.visibleDurationMs+=Date.now()-e.visibleStartedAt,e.visibleStartedAt=null),j(!0);else if(e&&null===e.visibleStartedAt){e.visibleStartedAt=Date.now();let t=P.current;(0,l.yu)(n,!0)!==t&&N({eventType:"page_view",path:e.path,pageLabel:e.label})}},o=()=>{q(),j(!0)};return document.addEventListener("click",r,!0),document.addEventListener("keydown",t,!0),document.addEventListener("scroll",t,{capture:!0,passive:!0}),document.addEventListener("submit",a,!0),document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",o),()=>{document.removeEventListener("click",r,!0),document.removeEventListener("keydown",t,!0),document.removeEventListener("scroll",t,!0),document.removeEventListener("submit",a,!0),document.removeEventListener("visibilitychange",i
33),window.removeEventListener("pagehide",o),j(!0)}},[q,N,j,h,c,d,n]),null}},524164:(e,t,n)=>{"use strict";n.d(t,{Bk:()=>d,Bz:()=>c,Dq:()=>l,Kx:()=>s,Z9:()=>i,ac:()=>u,gm:()=>o,hS:()=>r});let r="/workspace/intelligence",a="/dashboard";function i(e){return e===r||e.startsWith(`${r}/`)}function o(e){return i(e)?`${a}${e.slice(r.length)}`:e}function s(e,t){return!i(t)||!/^\/dashboard(?:[/?#]|$)/.test(e)||/^\/dashboard\/(?:reactivate|saas|sass)(?:[/?#]|$)/.test(e)?e:`${r}${e.slice(a.length)}`}let l=[{id:"home",href:"/dashboard",icon:"chart-square",group:null,tour:void 0},{id:"content",href:"/dashboard/research/content",icon:"gallery-minimalistic",group:"research",tour:"nav-content"},{id:"ads",href:"/dashboard/research/ads",icon:"volume-loud",group:"research",tour:"nav-ads"},{id:"watchlist",href:"/dashboard/watchlist",icon:"star",group:"research",tour:"nav-tracking"},{id:"create",href:"/dashboard/create",icon:"clapperboard-edit",group:"create",tour:"nav-create"},{id:"publishing",href:"/dashboard/publishing",icon:"plain",group:"create",tour:"nav-publish"}];function c(e){let t=o(e);return"/dashboard/search"===t?"search":t.startsWith("/dashboard/tracking/")?"watchlist":l.find(e=>e.href===t)?.id??"home"}function d(e){let t=o(e),n=l.find(e=>e.href===t);if(n)return{view:n.id};if("/dashboard/search"===t)return{view:"search"};let r=t.match(/^\/dashboard\/tracking\/([^/]+)$/);if(r)try{return{view:"report",creatorId:decodeURIComponent(r[1])}}catch{}return null}function u(e){let t=o(e);return"/dashboard/research"===t?`${r}/research/content`:"/dashboard/tracking"===t?`${r}/watchlist`:"/dashboard/favorites"===t?`${r}/watchlist?tab=saved`:null}},526746:(e,t,n)=>{"use strict";n.d(t,{k:()=>u,t:()=>d});var r=n(695155),a=n(450910),i=n(833210),o=n(307810),s=n(692564),l=n(125610),c=n(793881);function d(){let e=(0,a.c)("common");return(0,r.jsx)("div",{role:"status","aria-label":e("loading"),className:"space-y-6 px-5 py-6 motion-safe:animate-pulse",children:Array.from({length:5},(e,t)=>(0,r.jsxs)("div",{"aria-hidden":"true",className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"h-12 w-12 shrink-0 rounded-full bg-[#e1ddd8]/45 dark:bg-white/10"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-3.5 w-1/3 rounded bg-[#e1ddd8]/50 dark:bg-white/10"}),(0,r.jsx)("div",{className:"h-3 w-2/3 rounded bg-[#e1ddd8]/30 dark:bg-white/5"})]})]},t))})}function u({error:e=!1,onRetry:t}={}){let{closeChatSheet:n}=(0,l.R)(),h=(0,a.c)("chat"),m=(0,a.c)("common");return(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col","aria-busy":!e,children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-center justify-between px-5 pb-3",children:[(0,r.jsx)("h2",{className:"font-albert text-[20px] font-semibold tracking-[-0.5px] text-text-primary",children:h("messages")}),(0,r.jsx)("button",{type:"button",onClick:n,"aria-label":m("close"),className:"hidden rounded-full p-1.5 transition-colors hover:bg-[#f3f1ef] md:block dark:hover:bg-[#272d38]",children:(0,r.jsx)(i.A,{className:"h-5 w-5 text-text-secondary"})})]}),!e&&(0,r.jsx)("div",{className:"shrink-0 px-5 pb-3",children:(0,r.jsx)("div",{className:"flex gap-1.5 rounded-[32px] bg-[#f3f1ef] p-1.5 dark:bg-[#11141b]",children:c.a.tabs.map((e,t)=>{let n=0===t,a="main"===e?o.A:s.A;return(0,r.jsxs)("div",{className:`flex flex-1 items-center justify-center gap-1.5 rounded-[24px] px-3 py-1.5 ${n?"bg-white shadow-sm dark:bg-[#171b22]":""}`,children:[(0,r.jsx)(a,{"aria-hidden":"true",className:`h-4 w-4 ${n?"text-text-primary":"text-text-muted"}`}),(0,r.jsx)("span",{className:`text-[14px] font-semibold ${n?"text-text-primary":"text-text-muted"}`,children:h(e)})]},e)})})}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden rounded-t-[28px] bg-white dark:bg-[#05070b]",children:e?(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-4 px-6 text-center",children:[(0,r.jsx)("p",{role:"alert",className:"font-albert text-sm text-text-primary",children:h("clientChatOpenError")}),(0,r.jsx)("button",{type:"button",onClick:t,className:"rounded-full bg-brand-accent px-5 py-2.5 font-albert text-sm font-semibold text-white transition-opacity hover:opacity-90",children:m("retry")})]}):(0,r.jsx)(d,{})})]})}}
33,531998:(e,t,n)=>{"use strict";n.d(t,{QC:()=>a,_K:()=>i,wn:()=>o});let r=["[data-date-picker-layer]","[data-date-picker-popover]","[data-time-picker-popover]","[data-color-picker-popover]","[data-audio-player-popover]","[data-broadcast-popover]","[data-session-picker-popover]","[data-hover-tap-popover]","[data-phone-country-popover]","[data-icon-picker-popover]","[data-website-image-picker-layer]","[data-badge-marker-popover]","[data-select-content]","[data-dropdown-menu-content]","[data-mention-dropdown]","[data-editor-link-popover]","[data-editor-toolbar-menu]","[data-library-comments-popover]","[data-freeform-insert-menu]","[data-funnel-action-menu]","[data-reminder-content-picker]","[data-questionnaire-target-picker]","[data-social-proof-picker]","[data-section-design-popover]","[data-intake-config-select-popover]","[data-agreement-config-popover]","[data-intake-config-actions-menu]","[data-intake-config-editor-layer]","[data-intake-config-delete-layer]","[data-chat-message-action-menu]","[data-chat-attachment-menu]","[data-image-lightbox]","[data-feed-comment-action-menu]","[data-reaction-emoji-picker]","[data-emoji-picker-layer]","[data-gif-picker-layer]","[data-story-player-layer]","[data-video-review-toolbar-popover]","[data-calendar-event-detail-layer]","[data-calendar-event-attendees-layer]","[data-category-selector-popover]","[data-client-selector-popover]","[data-coach-selector-popover]","[data-resource-visibility-layer]","[data-link-share-layer]","[data-import-website-layer]","[data-barcode-scanner-layer]"],a=r.join(", "),i=[...r,"[data-media-library-layer]","[data-pexels-stock-layer]"].join(", "),o="[data-radix-popper-content-wrapper]"},541118:(e,t,n)=>{Promise.resolve().then(n.bind(n,491930)),Promise.resolve().then(n.t.bind(n,341765,23)),Promise.resolve().then(n.t.bind(n,312201,23)),Promise.resolve().then(n.t.bind(n,714480,23)),Promise.resolve().then(n.t.bind(n,391404,23)),Promise.resolve().then(n.t.bind(n,232283,23)),Promise.resolve().then(n.t.bind(n,103966,23)),Promise.resolve().then(n.t.bind(n,141261,23)),Promise.resolve().then(n.t.bind(n,827508,23)),Promise.resolve().then(n.t.bind(n,58795,23)),Promise.resolve().then(n.t.bind(n,366184,23)),Promise.resolve().then(n.t.bind(n,451743,23)),Promise.resolve().then(n.t.bind(n,353255,23)),Promise.resolve().then(n.bind(n,240371)),Promise.resolve().then(n.bind(n,522692)),Promise.resolve().then(n.bind(n,237514)),Promise.resolve().then(n.bind(n,608707)),Promise.resolve().then(n.bind(n,746357)),Promise.resolve().then(n.bind(n,993415)),Promise.resolve().then(n.bind(n,878025)),Promise.resolve().then(n.bind(n,953943)),Promise.resolve().then(n.bind(n,925583)),Promise.resolve().then(n.bind(n,373348)),Promise.resolve().then(n.bind(n,378240)),Promise.resolve().then(n.bind(n,637574)),Promise.resolve().then(n.bind(n,929421)),Promise.resolve().then(n.bind(n,869690)),Promise.resolve().then(n.bind(n,897267)),Promise.resolve().then(n.bind(n,138265)),Promise.resolve().then(n.bind(n,286123)),Promise.resolve().then(n.bind(n,178403)),Promise.resolve().then(n.bind(n,330537)),Promise.resolve().then(n.bind(n,449497)),Promise.resolve().then(n.bind(n,74950)),Promise.resolve().then(n.bind(n,958838)),Promise.resolve().then(n.bind(n,704756)),Promise.resolve().then(n.bind(n,40436)),Promise.resolve().then(n.bind(n,434518)),Promise.resolve().then(n.bind(n,375714)),Promise.resolve().then(n.bind(n,304402)),Promise.resolve().then(n.bind(n,915671)),Promise.resolve().then(n.bind(n,153416)),Promise.resolve().then(n.bind(n,609233)),Promise.resolve().then(n.bind(n,929111)),Promise.resolve().then(n.bind(n,768730)),Promise.resolve().then(n.bind(n,125610)),Promise.resolve().then(n.bind(n,775889)),Promise.resolve().then(n.bind(n,590879)),Promise.resolve().then(n.bind(n,943650)),Promise.resolve().then(n.bind(n,512445)),Promise.resolve().then(n.bind(n,32087)),Promise.resolve().then(n.bind(n,142692)),Promise.resolve().then(n.bind(n,290626)),Promise.resolve().then(n.bind(n,997389)),Promise.resolve().then(n.bind(n,58682)),Promise.resolve().then(n.bind(n,903473)),Promise.resolve().then(n.bind(n,616208)),Promise.resolve().then(n.bind(n,189270)),Promise.resolve().then(n.bind(n,925633)),Promise.resolve().then(n.bind(n,960228)),Promise.resolve().then(n.bind(n,792939)),Promise.resolve().then(n.bind(n,878365))},543273:(e,t,n)=>{"use strict";n.d(t,{Bn:()=>y,Dq:()=>h,K4:()=>v,N9:()=>c,Nr:()=>g,T3:()=>f,W0:()=>b,ag:()=>a,eQ:()=>m,n8:()=>o,ns:()=>i,oh:()=>w,rQ:()=>d,vI:()=>C,xq:()=>u,xz:()=>S});var r=n(910792);n(570912);let a="/my-coach",i="/api/my-coaching",o="/discover?view=my-content";function s(e){return encodeURIComponent(e)}function l(e){return r.HI.includes(e)}function c(e){if("string"!=typeof e)return r.A9;let t=e.trim().toLowerCase();return r.Tq.includes(t)?t:r.A9}function d(e){return"string"==typeof e&&"past"===e.trim().toLowerCase()?"past":"upcoming"}function u(e){if("string"!=typeof e)return null;let t=e.trim().toLowerCase();return l(t)?t:null}function h(e){return"fitness"===e?"/fitness":`${a}?tab=${e??r.A9}`}function m(e,t){let n=new URLSearchParams({tab:"programs",programId:e});return t&&n.set("enrollmentId",t),`${a}?${n}`}function f(e){if(!/^\/program\/?(?:[?#]|$)/.test(e))return e;let t=new URL(e,"https://my-coaching.local"),n=new URLSearchParams({tab:"programs"});
33return t.searchParams.forEach((e,t)=>{"tab"!==t&&"programTab"!==t&&n.append(t,e)}),("squad"===t.searchParams.get("tab")||"squad"===t.searchParams.get("programTab"))&&n.set("programTab","squad"),`${a}?${n}${t.hash}`}let p=["home","training","studio","nutrition","progress"];function g(e){var t;if(!/^\/my-coach\/?(?:[?#]|$)/.test(e))return e;let n=new URL(e,"https://my-coaching.local");if("fitness"!==n.searchParams.get("tab"))return e;let r=(t=n.searchParams.get("fitnessView"),p.includes(t)?t:"home");return n.searchParams.delete("tab"),n.searchParams.delete("fitnessView"),`/fitness${"home"===r?"":`/${r}`}${n.searchParams.size?`?${n.searchParams}`:""}${n.hash}`}let b={summary:"summary",notes:"notes",recording:"recording",prep:"prep"};function w(e,t){let n=`${a}/sessions/${s(e)}`;return t?`${n}#${b[t]}`:n}function v(e){return`${a}?tab=sessions&scope=${e}`}function y(e){let t=`${a}?tab=documents`;if(!e)return t;let n=l(e)?e:(0,r.Cq)(e);return`${t}&group=${n}`}function C(e){return`${w(e)}?respond=1`}let S={overview:()=>`${i}/overview`,overviewDetails:()=>`${i}/overview?view=details`,overviewProgress:()=>`${i}/overview?view=progress`,overviewHistory:()=>`${i}/overview?view=history`,overviewContent:()=>`${i}/overview?view=content`,sessions:(e,t={})=>`${i}/sessions?scope=${e}&limit=${t.limit??20}${t.cursor?`&cursor=${s(t.cursor)}`:""}`,session:e=>`${i}/sessions/${s(e)}`,prep:e=>`${i}/sessions/${s(e)}/prep`,progress:()=>`${i}/progress`,notesBrief:()=>`${i}/notes-brief`,summary:()=>`${i}/summary`,documents:(e={})=>`${i}/documents?limit=${e.limit??30}${e.kinds?.length?`&kind=${e.kinds.join(",")}`:""}${e.q?`&q=${s(e.q)}`:""}${e.cursor?`&cursor=${s(e.cursor)}`:""}`,isMyCoachingKey:e=>"string"==typeof e&&e.includes(`${i}/`)}},562840:(e,t,n)=>{"use strict";n.d(t,{BE:()=>k,I6:()=>_,Uz:()=>m,_s:()=>u,cp:()=>p,gk:()=>P,oF:()=>I,tb:()=>x,zj:()=>S});var r=n(695155),a=n(212115),i=n(189270),o=n(460788),s=n(140980),l=n(24516),c=n(531998);let d=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"true"===e.getAttribute("contenteditable")||"textbox"===e.getAttribute("role")},u=({shouldScaleBackground:e=!1,repositionInputs:t=!1,nested:n=!1,onOpenChange:a,...i})=>{let s=n?o._s.NestedRoot:o._s.Root;return(0,r.jsxs)(s,{shouldScaleBackground:e,repositionInputs:t,onOpenChange:e=>{!e&&d()||a?.(e)},...i,children:[i.children,n&&(0,r.jsx)(h,{open:i.open})]})};function h({open:e}){let t=a.useRef(null),n=a.useRef(!!e);return a.useEffect(()=>{n.current&&!e&&t.current?.click(),n.current=!!e},[e]),(0,r.jsx)(o._s.Close,{ref:t,tabIndex:-1,"aria-hidden":!0,className:"hidden"})}u.displayName="Drawer";let m=o._s.Trigger,f=o._s.Portal,p=o._s.Close,g=[],b=new Set,w=()=>b.forEach(e=>e()),v=c._K;function y(e){return"function"==typeof e?.closest?e:"function"==typeof e?.parentElement?.closest?e.parentElement:null}let C=a.forwardRef(({className:e,zIndex:t="z-[10000]",style:n,...a},i)=>(0,r.jsx)(o._s.Overlay,{ref:i,className:(0,s.cn)("fixed inset-0 bg-black/45 backdrop-blur-sm",t,e),style:{transform:"translateZ(0)",backfaceVisibility:"hidden",willChange:"transform",...n},...a}));C.displayName=o._s.Overlay.displayName;let S=a.forwardRef(({className:e,children:t,hideHandle:n,zIndex:u="z-[10000]",overlayStyle:h,overlayProps:m,scrollMode:p="content",accessibleTitle:S,style:k,onPointerDownOutside:x,onInteractOutside:I,...P},_)=>{let E=(0,i.useAppearanceScope)();(0,l.U6)();let{style:A,...$}=m||{},M=void 0!==P["data-media-library-layer"]||void 0!==P["data-pexels-stock-layer"],j=void 0!==P["data-calendar-event-attendees-layer"],T=M?c.QC:v,N=!function e(t){return a.Children.toArray(t).some(t=>{if(!a.isValidElement(t))return!1;let n=t.type;return n===o._s.Title||"object"==typeof n&&n.displayName===o._s.Title.displayName||e(t.props.children)})}(t),q=a.useId(),{isStacked:D,isTopDrawer:U}=function(e){let[,t]=a.useReducer(e=>e+1,0);return a.useEffect(()=>(b.add(t),()=>{b.delete(t)}),[]),a.useEffect(()=>(g=[...g,e],w(),()=>{g=g.filter(t=>t!==e),w()}),[e]),{isStacked:g.length>1,isTopDrawer:g[g.length-1]===e}}(q),R=e=>{let t=e?.closest("[data-drawer-instance]");return!!t&&t.getAttribute("data-drawer-instance")!==q};return(0,r.jsxs)(f,{children:[(0,r.jsx)(C,{zIndex:u,style:{...h,...A},"data-drawer-instance":q,...$}),(0,r.jsxs)(o._s.Content,{"data-funnel-theme":E,ref:_,className:(0,s.cn)("fixed inset-x-0 bottom-0 mt-24 flex h-auto max-h-[calc(100dvh-1rem)] flex-col overflow-hidden overscroll-none rounded-t-[24px] border border-[#e1ddd8] dark:border-[#262b35] bg-white dark:bg-[#171b22] outline-none",u,E,e),"data-drawer-instance":q,"data-drawer-scroll-boundary":"",style:D&&U?{backdropFilter:"none",WebkitBackdropFilter:"none",backfaceVisibility:"hidden",pointerEvents:"auto",...k}:{backdropFilter:"none",WebkitBackdropFilter:"none",backfaceVisibility:"hidden",...k},onPointerDownOutside:e=>{let t=y(e.detail.originalEvent.target),n=j&&!!t?.closest("[data-calendar-event-attendees-layer]");t?.closest(T)&&!n||R(t)?e.preventDefault():x?.(e)},onInteractOutside:e=>{let t=y(e.detail.originalEvent.target),n=j&&!!t?.closest("[data-calendar-event-attendees-layer]");t?.closest(T)&&!n||R(t)?e.preventDefault():I?.(e)},...P,children:[N&&(0,r.jsx)(o._s.Title,{className:"sr-only",children:S||P["aria-label"]||"Bottom sheet"}),!n&&(0,r.jsx)(o._s.Handle,{preventCycle:!0,"data-vaul-drawer-handle":"",className:"shrink-0 cursor-grab select-none active:cursor-grabbing",style:{width:"100%",height:44,margin:0,background:"transparent",opacity:1,touchAction:"none"},onPointerDownCapture:()=>{let e=document.activeElement;d()&&e instanceof HTMLElement&&e.blur()},children:(0,r.jsx)("span",{className:"pointer-events-none absolute left-1/2 top-1/2 h-1 w-10 -translate-x-1/2 -translate-y-1/2 roun
33ded-full bg-[#d1ccc6] dark:bg-[#3a4150]"})}),(0,r.jsx)("div",{className:(0,s.cn)("flex min-h-0 flex-1 touch-pan-y flex-col overscroll-none","contained"===p?"overflow-clip":"overflow-y-auto"),"data-drawer-scroll-mode":p,"data-drawer-scroll-viewport":"","data-vaul-no-drag":"",children:t})]})]})});S.displayName="DrawerContent";let k=({className:e,...t})=>(0,r.jsx)("div",{className:(0,s.cn)("grid gap-1.5 p-4 text-center sm:text-left",e),...t});k.displayName="DrawerHeader";let x=({className:e,...t})=>(0,r.jsx)("div",{className:(0,s.cn)("relative flex-shrink-0 flex flex-col gap-2 px-4 pt-4 pb-safe-drawer-footer border-t border-[#b8b3ad] dark:border-[#4a5060]","before:absolute before:inset-x-0 before:bottom-full before:h-8 before:bg-gradient-to-t before:from-white before:to-transparent before:dark:from-[#171b22] before:pointer-events-none",e),...t});x.displayName="DrawerFooter";let I=({className:e,...t})=>(0,r.jsx)("div",{className:(0,s.cn)("flex-1 min-h-0 overflow-y-auto overscroll-none pb-8",e),...t});I.displayName="DrawerScrollArea";let P=a.forwardRef(({className:e,...t},n)=>(0,r.jsx)(o._s.Title,{ref:n,className:(0,s.cn)("text-lg font-semibold leading-none tracking-tight text-text-primary dark:text-[#f5f5f8]",e),...t}));P.displayName=o._s.Title.displayName;let _=a.forwardRef(({className:e,...t},n)=>(0,r.jsx)(o._s.Description,{ref:n,className:(0,s.cn)("text-sm text-text-secondary dark:text-[#b2b6c2]",e),...t}));_.displayName=o._s.Description.displayName},570912:(e,t,n)=>{"use strict";n.d(t,{NV:()=>s,PA:()=>a,i1:()=>l,t9:()=>i});let r={article:"articles",course:"courses",library:"libraries",vision_board:"vision-boards",event:"events",download:"downloads",link:"links",video:"videos",book:"books",podcast:"podcasts",audio:"audio",session:"sessions",ai_tool:"ai-tools"};function a(e,t){if("program"===e)return`/discover/programs/${t}`;if("webinar"===e)return`/webinars/${t}`;let n=r[e];return n?`/discover/${n}/${t}`:null}function i(e){return null!==a(e,"x")}let o=new Set(["article","course","download","link","video","book","ai_tool"]);function s(e,t,n){return"event"===e?`/discover/events/${t}`:"webinar"===e?`/webinars/${t}`:"podcast"===e?`/discover/podcasts/${t}`:"program"===e?`/discover/programs/${t}`:"library"===e?`/discover/libraries/${n?.slug||t}`:"questionnaire"===e?`/q/${n?.slug||t}`:n?.isPaid?a(e,t):o.has(e)?n?.slug?`/r/${n.slug}`:`/r/${e}/${t}`:a(e,t)}function l(e,t){return a(e,t)}},579288:(e,t,n)=>{"use strict";n.d(t,{RM:()=>r,WP:()=>i,jZ:()=>o,ul:()=>a});let r=new Set(["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE","IS","LI","NO","GB","CH"]);function a(e){return!!e&&r.has(e.toUpperCase())}let i="coachful_consent",o=15552e3},590879:(e,t,n)=>{"use strict";n.d(t,{CoachPreviewAccessProvider:()=>m,G:()=>f,i:()=>p});var r=n(695155),a=n(337206),i=n(944855),o=n(212115),s=n(142692),l=n(960228),c=n(229381);let d=(0,a.default)(()=>Promise.all([n.e(45399),n.e(9683),n.e(7188),n.e(60788),n.e(97463),n.e(99846),n.e(10913),n.e(88239),n.e(24516),n.e(92202),n.e(53929),n.e(26925)]).then(n.bind(n,216496)).then(e=>e.CoachPreviewPlanSheet),{loadableGenerated:{webpack:()=>[216496]},ssr:!1}),u=(0,o.createContext)(null);async function h(e){let t=await fetch(e);if(!t.ok)throw Error("Unable to load Preview Mode");return t.json()}function m({children:e,overrideAccess:t,demoMode:n=!1}){let{currentMembership:a,organizations:f}=(0,s.Z5)(),{isCoachView:p}=(0,l.an)(),g=a?.organizationId,[b,w]=(0,o.useState)(!1),v=f.find(e=>e.id===g)?.platformAccessMode;(0,o.useEffect)(()=>{},[t]);let[y]=(0,o.useState)(()=>{let e="coachful:preview-sandbox-offer-started";try{let t=Number(window.sessionStorage.getItem(e));if(Number.isFinite(t)&&t>0)return t;let n=Date.now();return window.sessionStorage.setItem(e,String(n)),n}catch{return Date.now()}}),C=(0,o.useMemo)(()=>b?{mode:"preview",isPreviewMode:!0,planActivated:!1,requiresPlan:!0,previewEndsAt:new Date(y+24*c.qH*36e5).toISOString(),previewExpired:!1,previewCredits:{included:c.xS,used:0,remaining:c.xS},activationOffer:{version:"preview_first_month_50_v1",percentOff:50,startedAt:new Date(y).toISOString(),expiresAt:new Date(y+864e5).toISOString(),active:!0,redeemed:!1},onboarding:null,sandbox:!0}:null,[b,y]),S=!t&&!b&&p&&!!g&&"preview"===v,{data:k,isLoading:x,mutate:I}=(0,i.Ay)(S?"/api/coach/platform-access":null,h,{revalidateOnFocus:!0,refreshInterval:3e4*!!S,dedupingInterval:15e3}),P=t||C||"preview"===v&&k||null,[_,E]=(0,o.useState)(null),[A,$]=(0,o.useState)(!1);(0,o.useEffect)(()=>{_&&$(!0)},[_]),(0,o.useEffect)(()=>
33{if(!P?.requiresPlan)return;let e=new URLSearchParams(window.location.search);if("true"!==e.get("choosePlan"))return;E(e=>e??{action:null}),e.delete("choosePlan");let t=e.toString();window.history.replaceState(window.history.state,"",`${window.location.pathname}${t?`?${t}`:""}${window.location.hash}`)},[P?.requiresPlan]),(0,o.useEffect)(()=>{if(!P?.requiresPlan||!P.previewExpired)return;let e="coachful:preview-expired-prompted";try{if("1"===window.sessionStorage.getItem(e))return;window.sessionStorage.setItem(e,"1")}catch{}E(e=>e??{action:null})},[P?.requiresPlan,P?.previewExpired]),(0,o.useEffect)(()=>{if(!P?.requiresPlan)return;let e=window.fetch,t=async(...t)=>{let n=null;if(b&&("string"==typeof t[0]||t[0]instanceof URL?new URL(String(t[0]),window.location.href):new URL(t[0].url,window.location.href)).origin===window.location.origin){let e=t[0]instanceof Request?t[0].headers:void 0,r=new Headers(t[1]?.headers||e);r.set("x-coachful-preview-sandbox","1"),n={...t[1],headers:r}}let r=n?await e(t[0],n):await e(...t);return 402===r.status&&r.clone().json().then(e=>{if((0,c.J8)(e))return void E(t=>t??{action:e.action});if(e&&"object"==typeof e){let t=String(e.error||"").toLowerCase(),n=String(e.code||"").toUpperCase();(t.includes("insufficient credit")||t.includes("preview credit limit")||"INSUFFICIENT_CREDITS"===n)&&E(e=>e??{action:"use_ai_credits"})}}).catch(()=>void 0),r};return window.fetch=t,()=>{window.fetch===t&&(window.fetch=e)}},[P?.requiresPlan,b]);let M=(0,o.useCallback)((e,t)=>{E({action:e??null,onActivated:t?.onActivated})},[]),j=(0,o.useCallback)((e,t)=>!P?.requiresPlan||(E({action:e,onActivated:t?.onActivated}),!1),[P?.requiresPlan]),T=(0,o.useCallback)(async e=>{if(E(null),e){if(b){try{window.sessionStorage.removeItem("coachful:preview-sandbox")}catch{}w(!1);return}t||await I(),await _?.onActivated?.()}},[I,t,_,b]),N=(0,o.useMemo)(()=>({access:P,isLoading:!!(!t&&S&&x),requestPlan:M,guardAction:j,refresh:async()=>I()}),[P,x,I,t,M,j,S]);return(0,r.jsxs)(u.Provider,{value:N,children:[e,A&&(0,r.jsx)(d,{open:!!_,action:_?.action??null,hasFollowUp:!!_?.onActivated,sandbox:!!P?.sandbox||n,requiresPlan:P?.requiresPlan??!0,previewExpired:!!P?.previewExpired,previewEndsAt:P?.previewEndsAt??null,activationOffer:P?.activationOffer??null,onClose:T})]})}function f(){let e=(0,o.useContext)(u);if(!e)throw Error("useCoachPreviewAccess must be used within CoachPreviewAccessProvider");return e}function p(){return(0,o.useContext)(u)}},608707:(e,t,n)=>{"use strict";n.d(t,{MemberRouteGuard:()=>u});var r=n(695155),a=n(212115),i=n(573321),o=n(506296),s=n(142692),l=n(57217),c=n(543273);let d=[{prefixes:["/program","/worksheets"],permission:"programs"},{prefixes:["/feed","/squad"],permission:"community"},{prefixes:["/discover","/articles","/r/"],permission:"resources"},{prefixes:["/chat","/my-coach"],permission:"chat"},{prefixes:["/my-plan"],permission:"tasks"},{prefixes:["/goal"],permission:"goals"},{prefixes:["/habits"],permission:"habits"},{prefixes:["/check-ins","/checkin/","/morning","/evening"],permission:"checkIns"},{prefixes:["/guided-","/identity","/vision-board","/journey"],permission:"journeys"},{prefixes:["/room/","/call/","/intake-call/"],permission:"scheduling"}];function u({children:e}){let t=(0,i.usePathname)(),n=function(e,t){if("/"===e)return"home";if(e===c.ag){let e=(0,c.N9)(t.get("tab"));if("programs"===e)return"programs";if("plan"===e)return"tasks";if("fitness"===e)return null}return d.find(({prefixes:t})=>t.some(t=>t.endsWith("/")||t.endsWith("-")?e.startsWith(t):e===t||e.startsWith(`${t}/`)))?.permission||null}(t,(0,i.useSearchParams)()),h=(0,i.useRouter)(),{currentMembership:m}=(0,s.Z5)(),{permissions:f,isLoading:p}=(0,l.S)({enabled:null!==n}),g=m?.orgRole==="member",b=!!(g&&n&&f&&!f[n]);return((0,a.useEffect)(()=>{if(!b||!f)return;let e=t===c.ag&&"chat"===n&&f.programs?(0,c.Dq)("programs"):f.home?"/":f.community?"/feed":f.resources?"/discover":f.programs?(0,c.Dq)("programs"):f.chat?"/chat":"/profile";h.replace(e)},[b,t,n,f,h]),g&&n&&(p||!f||b))?(0,r.jsx)("div",{className:"flex min-h-[40vh] items-center justify-center",children:(0,r.jsx)(o.A,{className:"h-5 w-5 animate-spin text-text-secondary"})}):e}},615925:(e,t,n)=>{"use strict";n.d(t,{Ce:()=>u,K0:()=>S,LF:()=>o,P9:()=>m,TQ:()=>C,VC:()=>l,Vm:()=>i,WQ:()=>s,Z5:()=>g,_N:()=>h,i_:()=>f,nW:()=>d,tO:()=>c,zg:()=>p});var r=n(922817),a=n(543273);let i={coach:"/workspace/coach",create:"/workspace/create",sell:"/workspace/sell",manage:"/workspace/manage"};function o(e,t){if(e!==i.sell)return null;let n=t.get("section");return"website"===n||"blog"===n||"submissions"===n?"website":"offers"===n||"funnels"===n?n:null}function s(e){let t=e.get("websiteSubTab");if("pages"===t||"editor"===t||"blog"===t||"submissions"===t||"newsletter"===t)return t;let n=e.get("section");return"blog"===n||"submissions"===n?n:"marketing"===n?"newsletter":"pages"}let l="coach-corner",c=`/community?channel=${l}`,d="coachful-corner-draft";function u(e){if(e.get("tab")||e.get("resourceId"))return null;let t=e.get("workspaceSurface");return"messages"===t||"community"===t?t:null}function h(e,t=i.coach){if(!e.startsWith("/")||e.startsWith("//"))return e;let n=new URL(e,"https://workspace.local");return"/chat"!==n.pathname&&"/community"!==n.pathname&&"/feed"!==n.pathname?S(e):(n.searchParams.delete("communityView"),n.searchParams.set("workspaceSurface","/chat"===n.pathname?"messages":"community"),`${"/"===t?"/":i.coach}?${n.searchParams}${n.hash}`)}function m(e){return Object.values(i).some(t=>e===t||e.startsWith(`${t}/`))}
33function f(e){return"/coach"===e||m(e)}function p(e,t){return t?.get("resourceType")&&t.get("resourceId")?"create":"email"===e&&t?.get("emailView")&&"inbox"!==t.get("emailView")?"sell":"notifications"===e&&t?.get("channel")==="messages"||"growth-lab"===e&&t?.get("growthSubTab")==="client-lab"?"coach":"website"===e&&(0,r.H0)(t?.get("websiteSubTab"))?"sell":r.dX[e]??"coach"}function g(e,t={}){let n=new URLSearchParams({tab:e,...t});return S(`/coach?${n.toString()}`)}let b={courseId:"course",libraryId:"library",articleId:"article",videoId:"video",audioId:"audio",podcastId:"podcast",questionnaireId:"questionnaire",downloadId:"download",bookId:"book",linkId:"link",aiToolId:"ai_tool",board:"vision_board",eventId:"event",webinarId:"webinar"};function w(e){if(!e.get("resourceId")){let t=Object.entries(b).find(([t])=>e.has(t));t&&(e.set("resourceType",t[1]),e.set("resourceId",e.get(t[0])))}return e.get("resourceType")&&e.get("resourceId")?e.set("tab","discover"):(e.delete("tab"),e.set("collection","resources")),`${i.create}${e.size?`?${e.toString()}`:""}`}function v(e){let t=e.get("tab"),n="programs"===t?"programs":"client-journey"===t||"checkins"===t||"onboarding"===t?"flows":null;return!n||["programId","journeyId","flowId","newProgram","newJourney","newFlow","create"].some(t=>e.has(t))?null:(e.delete("tab"),e.set("collection",n),"client-journey"===t&&e.set("group","journeys"),`${i.create}?${e.toString()}`)}function y(e){"clients"===e.get("tab")&&e.has("userId")&&(e.get("clientId")||e.set("clientId",e.get("userId")),e.delete("userId"))}function C(e){return Object.entries(i).find(([,t])=>e===t||e.startsWith(`${t}/`))?.[0]??null}function S(e){if(!e.startsWith("/")||e.startsWith("//"))return e;let t=(0,a.T3)(e);if(t!==e)return t;let n=new URL(e,"https://workspace.local"),o=n.searchParams,s=C(n.pathname);if(s){if(n.pathname===i.create){if("fitness"===o.get("collection")&&!o.get("tab"))return o.delete("collection"),o.set("tab","fitness"),`${n.pathname}?${o.toString()}${n.hash}`;if("onboarding"===o.get("tab"))return o.set("tab","checkins"),o.has("flowSection")||o.set("flowSection","onboarding"),S(`${n.pathname}?${o.toString()}${n.hash}`);if("discover"===o.get("tab")&&["bundles","webinars"].includes(o.get("discoverSubTab")||""))return S(`/coach?${o.toString()}${n.hash}`);let e=v(o);if(e)return`${e}${n.hash}`;if("discover"===o.get("tab"))return`${w(o)}${n.hash}`}if(n.pathname===i[s]&&"clients"===o.get("tab")&&o.has("userId"))return y(o),`${n.pathname}?${o.toString()}${n.hash}`;if(n.pathname===i.sell&&!o.get("tab")){let e=o.get("section");if("website"===e||"blog"===e||"submissions"===e)return o.delete("section"),o.set("tab","website"),o.has("websiteSubTab")||o.set("websiteSubTab","website"===e?"pages":e),`${i[p("website",o)]}?${o.toString()}${n.hash}`}let t=o.get("tab");if(n.pathname===i.coach&&("fitness"===t||"career"===t||"executive"===t))return`${i.create}?${o.toString()}${n.hash}`;if(n.pathname!==i[s]||!["invoices","growth-lab","diagnostics","client-lab","website"].includes(t??""))return e;if("website"===t&&o.has("section")){let e=o.get("section");o.delete("section"),o.has("websiteSubTab")||"blog"!==e&&"submissions"!==e||o.set("websiteSubTab",e)}("diagnostics"===t||"client-lab"===t)&&(o.set("growthSubTab",t),t="growth-lab",o.set("tab",t));let r=i[p(t,o)];return`${r}?${o.toString()}${n.hash}`}if("/coach"!==n.pathname)return e;let l=o.get("tab")||(o.has("programId")?"programs":o.has("funnelId")?"funnels":o.has("journeyId")?"client-journey":o.has("flowId")?"checkins":o.has("squadId")?"squads":o.has("webinarId")?"webinars":"clients");if("corner"===l)return c;"pipeline"===l&&(l="prospects"),"onboarding"===l&&(l="checkins",o.has("flowSection")||o.set("flowSection","onboarding")),("diagnostics"===l||"client-lab"===l)&&(o.set("growthSubTab",l),l="growth-lab"),"whatsapp"===l&&(o.set("channel","whatsapp"),l="notifications"),"notifications"===l&&o.has("emailView")&&(l="email");let d={pipeline:"prospects",intakes:"intakes","ai-coach":"ai-coach",coaches:"team"};if("clients"===l&&d[o.get("clientsSubTab")||""]&&(l=d[o.get("clientsSubTab")]),"discover"===l&&["bundles","webinars"].includes(o.get("discoverSubTab")||"")&&(l=o.get("discoverSubTab")),l in r.dX||(l="clients"),o.set("tab",l),y(o),"discover"===l)return`${w(o)}${n.hash}`;let u=v(o);return u?`${u}${n.hash}`:`${i[p(l,o)]}?${o.toString()}${n.hash}`}},616208:(e,t,n)=>{"use strict";n.d(t,{StreamVideoProvider:()=>w,Zq:()=>f,g7:()=>v,getGlobalStreamVideoClient:()=>y,mS:()=>b,mg:()=>g});var r=n(695155);n(991872);var a=n(212115),i=n(792939),o=n(837511),s=n(103238);let l=(0,a.createContext)({videoClient:null,isConnecting:!1,isConnected:!1,error:null,activeCall:null,setActiveCall:()=>{},incomingCallData:null,setIncomingCallData:()=>{},markCallRejected:()=>{},connectNow:()=>{}}),c=null,d=null,u=null,h=0,m=null;function f(){return m}let p=new Map;function g(e){p.set(e,Date.now())}function b(e){let t=p.get(e);return p.delete(e),t}function w({children:e}){let{user:t,isLoaded:f}=(0,i.useAppUser)(),[p,g]=(0,a.useState)(c),[b,v]=(0,a.useState)(!1),[y,C]=(0,a.useState)(!!c),[S,k]=(0,a.useState)(null),[x,I]=(0,a.useState)(null),[P,_]=(0,a.useState)(null),E=(0,a.useRef)(null),A=(0,a.useRef)(null),$=(0,a.useRef)(null),M=(0,a.useRef)(null),j=(0,a.useRef)(null),T=(0,a.useRef)(null),N=(0,a.useRef)(new Set);A.current=P;let q=(0,a.useCallback)(e=>{I(e),e||(E.current=null)},[]),D=(0,a.useCallback)(()=>
33{_(null),E.current=null,M.current&&(clearTimeout(M.current),M.current=null),$.current?.(),$.current=null},[]),U=(0,a.useCallback)(e=>{N.current.add(e),D()},[D]),R=(0,a.useCallback)(()=>{Promise.resolve().then(n.bind(n,377805)).then(({Capacitor:e})=>{e.isNativePlatform()&&"ios"===e.getPlatform()&&n.e(96499).then(n.bind(n,796499)).then(({default:e})=>{e.endCall().catch(()=>{})})})},[]),L=(0,a.useCallback)(async(e,t)=>{if(c&&u===e)return c;if(d&&u===e)return d;let r=++h,a=c;return c=null,m=null,u=e,d=(async()=>{try{a&&await a.disconnectUser().catch(e=>{console.error("[StreamVideoContext] Failed to disconnect previous user:",e)});let[{StreamVideoClient:i},o]=await Promise.all([Promise.all([n.e(13854),n.e(35867),n.e(40530),n.e(9683),n.e(61766),n.e(50931),n.e(31332),n.e(66576),n.e(51714)]).then(n.bind(n,160677)),fetch("/api/stream-video-token")]);if(!o.ok)throw Error("Failed to fetch Stream Video token");let s=await o.json();if(!s.token||!s.apiKey)return r===h&&(d=null,u=null),null;let l=new i({apiKey:s.apiKey,user:{id:e,name:`${t.firstName||""} ${t.lastName||""}`.trim()||"User",image:t.imageUrl},token:s.token});if(r!==h||u!==e)return await l.disconnectUser().catch(()=>{}),null;return c=l,m={apiKey:s.apiKey,token:s.token,userId:e},l}catch(e){throw console.error("[StreamVideoContext] Connection error:",e),r===h&&(c=null,m=null,d=null,u=null),e}})()},[]),O=(0,a.useCallback)(()=>{if(j.current?.(),j.current=null,!f||!t)return;if(T.current?.(),T.current=null,c&&u===t.id){g(c),C(!0);return}u&&u!==t.id&&(g(null),C(!1),I(null),D());let e=!1,n=()=>{e=!0,T.current===n&&(T.current=null)};return T.current=n,v(!0),k(null),L(t.id,{firstName:t.firstName,lastName:t.lastName,imageUrl:t.imageUrl}).then(n=>{!e&&n&&u===t.id&&(g(n),C(!0))}).catch(t=>{e||(k(t instanceof Error?t.message:"Connection failed"),C(!1))}).finally(()=>{e||v(!1),T.current===n&&(T.current=null)}),n},[D,L,f,t]),B=(0,a.useCallback)(()=>{O()},[O]);(0,a.useEffect)(()=>{if(f){if(!t){j.current?.(),j.current=null,T.current?.(),h+=1;let e=c;c=null,m=null,d=null,u=null,e?.disconnectUser().catch(console.error),g(null),C(!1),v(!1),I(null),D();return}return(0,o.JK)()||(0,s.zd)(window.location.pathname)?O():(j.current=(0,s.Oq)(async()=>{O(),await d?.catch(()=>void 0)},{priority:"user-visible",timeoutMs:750}),()=>{j.current?.(),j.current=null,T.current?.()})}},[D,f,O,t]);let W=(0,a.useRef)(null);return W.current=x,(0,a.useEffect)(()=>{if(!p)return;console.log("[StreamVideo] Setting up incoming call listeners");let e=null,t=null,r=!1,a=!1,i=e=>{_(e),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{console.log("[StreamVideo] Auto-dismissing incoming call after 60s timeout"),D()},6e4)};Promise.resolve().then(n.bind(n,377805)).then(({Capacitor:o})=>{o.isNativePlatform()&&"ios"===o.getPlatform()&&n.e(96499).then(n.bind(n,796499)).then(({default:o})=>{o.addListener("foregroundIncomingCall",e=>{!e.callId||W.current||N.current.has(e.callId)||E.current!==e.callId&&(E.current=e.callId,console.log("[StreamVideo] Foreground native VoIP call routed to in-app UI:",e.callId),i({callId:e.callId,callType:e.callType||"default",callerName:e.callerName||"Someone",isVideo:!0===e.hasVideo,isSquadCall:!1}))}).then(i=>{let s=()=>{o.setWebCallUiReady({ready:!1}).catch(()=>{}),i.remove().catch(()=>{})};r?s():(a=!0,o.setWebCallUiReady({ready:!0}).catch(e=>{console.error("[StreamVideo] Failed to mark native web call UI ready:",e)}),n.e(25333).then(n.bind(n,325333)).then(({App:e})=>e.addListener("appStateChange",({isActive:e})=>{o.setWebCallUiReady({ready:e}).catch(()=>{})})).then(e=>{r?e.remove().catch(()=>{}):t=()=>{e.remove().catch(()=>{})}}).catch(()=>{}),e=s)}).catch(e=>{console.error("[StreamVideo] Failed to attach foreground native VoIP listener:",e)})})});let o=p.state.calls$.subscribe(e=>{let t=e.find(e=>e.ringing&&!1===e.isCreatedByMe);if(!t||W.current||E.current===t.id||N.current.has(t.id))!t&&(A.current||E.current)&&(console.log("[StreamVideo] Ringing call disappeared from calls$, clearing incoming call UI/CallKit"),D(),Promise.resolve().then(n.bind(n,377805)).then(({Capacitor:e})=>{if(!e.isNativePlatform()||"ios"!==e.getPlatform()){if(!e.isNativePlatform())return void R();R()}}));else{let e,r,a,o;
33E.current=t.id,console.log("[StreamVideo] Ringing call detected via calls$:",t.id);let s=t.state.custom||{},l=t.state.createdBy,c=l?.name||l?.id||"Someone",d=l?.image,u=!0===s.isVideoCall,h=!0===s.isSquadChannel,m=s.channelName,f=s.channelImage,p={callId:t.id,callType:t.type,callerName:c,callerImage:d,isVideo:u,isSquadCall:h,channelName:m,channelImage:f};$.current?.(),e=e=>()=>{console.log(`[StreamVideo] Ringing call dismissed: ${e}`),D(),R()},r=t.on("call.ended",e("call.ended")),a=t.on("call.rejected",e("call.rejected")),o=t.on("call.session_ended",e("call.session_ended")),$.current=()=>{r(),a(),o()},Promise.resolve().then(n.bind(n,377805)).then(({Capacitor:e})=>{if(e.isNativePlatform()&&"ios"===e.getPlatform()){n.e(96499).then(n.bind(n,796499)).then(({default:e})=>{e.reportIncomingCall({callCid:`${p.callType}:${p.callId}`,callerName:p.callerName,hasVideo:p.isVideo}).catch(e=>{console.warn("[StreamVideo] Failed to mirror foreground ring to CallKit:",e)})}).catch(()=>{}),i(p);return}i(p)})}}),s=p.on("call.ring",e=>{console.log("[StreamVideo] call.ring event received:",e?.call?.id)});return()=>{o?.unsubscribe(),s?.(),r=!0,a&&n.e(96499).then(n.bind(n,796499)).then(({default:e})=>{e.setWebCallUiReady({ready:!1}).catch(()=>{})}).catch(()=>{}),t?.(),e?.(),$.current?.(),$.current=null,M.current&&(clearTimeout(M.current),M.current=null)}},[p,D,R]),(0,a.useEffect)(()=>{if(!x)return;let e=null,t=()=>{e&&(clearTimeout(e),e=null)},n=e=>{console.log("[StreamVideoContext] Clearing activeCall:",e),t(),I(null),E.current=null},r=()=>n("call.ended/session_ended"),a=x.on("call.ended",r),i=x.on("call.session_ended",r),o=x.state.callingState$.subscribe(r=>{"left"===r||"idle"===r?n(`callingState=${r}`):"joining"===r||"reconnecting"===r?e||(e=setTimeout(()=>n("stuck-joining-timeout"),3e4)):"joined"===r&&t()});return()=>{a?.(),i?.(),o?.unsubscribe(),t()}},[x]),(0,r.jsx)(l.Provider,{value:{videoClient:p,isConnecting:b,isConnected:y,error:S,activeCall:x,setActiveCall:q,incomingCallData:P,setIncomingCallData:_,markCallRejected:U,connectNow:B},children:e})}function v(){let e=(0,a.useContext)(l);if(void 0===e)throw Error("useStreamVideoClient must be used within a StreamVideoProvider");return e}function y(){return c}},620645:(e,t,n)=>{"use strict";n.d(t,{Cl:()=>g,Qm:()=>p});var r=n(695155),a=n(212115),i=n(517620),o=n(22164),s=n(833210),l=n(573321),c=n(609233),d=n(960228),u=n(498906),h=n(140980),m=n(399710),f=n(133216);function p({config:e,onDismiss:t,preview:n=!1,className:a}){var l;let c=(l=e.backgroundColor,(0,m.B)(l)),d=/^https?:\/\//i.test(e.ctaUrl),u=e.ctaEnabled&&e.ctaLabel.trim()&&e.ctaUrl.trim();return(0,r.jsxs)("div",{className:(0,h.cn)("relative isolate overflow-hidden rounded-2xl border border-black/[0.06] px-4 py-3 shadow-[0_10px_30px_rgba(25,20,15,0.08)] sm:px-5",a),style:{backgroundColor:e.backgroundColor,color:c},role:n?void 0:"region","aria-label":n?void 0:"Announcement",children:[(0,r.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-16 h-40 w-40 rounded-full blur-2xl",style:{backgroundColor:c,opacity:.1}}),(0,r.jsxs)("div",{className:"relative flex items-center gap-3 font-albert",children:[(0,r.jsx)("div",{className:"hidden h-9 w-9 shrink-0 items-center justify-center rounded-xl sm:flex",
33style:{backgroundColor:c,color:e.backgroundColor},children:(0,r.jsx)(i.A,{className:"h-[18px] w-[18px]",strokeWidth:2.2})}),(0,r.jsx)("p",{className:"min-w-0 flex-1 text-sm font-medium leading-5 sm:text-[15px]",children:e.message||f.YE.message}),u?n?(0,r.jsx)("span",{className:"max-w-[120px] shrink-0 truncate rounded-xl px-3.5 py-2 text-xs font-semibold sm:max-w-[220px] sm:text-sm",style:{backgroundColor:c,color:e.backgroundColor},children:e.ctaLabel}):(0,r.jsxs)("a",{href:e.ctaUrl,target:d?"_blank":void 0,rel:d?"noopener noreferrer":void 0,className:"inline-flex max-w-[120px] shrink-0 items-center gap-1.5 truncate rounded-xl px-3.5 py-2 text-xs font-semibold transition-transform hover:scale-[1.02] active:scale-[0.98] sm:max-w-[220px] sm:text-sm",style:{backgroundColor:c,color:e.backgroundColor},children:[e.ctaLabel,d&&(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"})]}):null,e.dismissible&&(0,r.jsx)("button",{type:"button",onClick:n?void 0:t,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg transition-colors hover:bg-black/10","aria-label":"Dismiss announcement",tabIndex:n?-1:void 0,children:(0,r.jsx)(s.A,{className:"h-4 w-4"})})]})]})}function g({page:e,programId:t,embedded:n=!1,programOnly:i=!1,className:o,frameClassName:s}){let h=(0,l.usePathname)(),m=(0,l.useSearchParams)(),{effectiveBranding:b}=(0,c.useBranding)(),{isClientView:w,isLoading:v}=(0,d.an)(),y=(0,a.useMemo)(()=>({...f.YE,backgroundColor:b.colors.accentLight,...b.clientAnnouncementBar}),[b.clientAnnouncementBar,b.colors.accentLight]),C=e??("/"===h?"home":"/feed"===h||h.startsWith("/feed/")?"feed":"/program"===h||h.startsWith("/program/")?"programs":"/discover"===h||h.startsWith("/discover/")?"discover":null),S=t??m.get("programId"),k=`coachful-announcement-dismissed:${b.organizationId}:${y.updatedAt||y.message}`,[x,I]=(0,a.useState)({key:"",dismissed:!1});(0,a.useEffect)(()=>{I({key:k,dismissed:"true"===(0,u.bi)(k)})},[k]);let P=m.get("programId");if(v||x.key!==k||!w||["/coach","/admin","/onboarding","/sign-in","/signup","/auth","/call","/chat","/intake-call","/select-org","/subscription-blocked","/access-denied"].some(e=>h===e||h.startsWith(`${e}/`))||!y.enabled||!y.message.trim()||x.dismissed||i&&P||!function(e,t,n,r=!1){return r?"selected"===e.targetMode&&!!n&&!e.pages.includes("programs")&&e.programIds.includes(n):"all"===e.targetMode||!!(t&&e.pages.includes(t)||n&&"programs"===t&&e.programIds.includes(n))}(y,C,S,i))return null;let _=()=>{(0,u.FX)(k,"true"),I({key:k,dismissed:!0})};if(n){let e=(0,r.jsx)(p,{config:y,onDismiss:_,className:o});return s?(0,r.jsx)("div",{className:s,children:e}):e}return(0,r.jsx)("div",{className:"mx-auto w-full max-w-7xl px-4 pt-3 sm:px-6 lg:px-10",children:(0,r.jsx)(p,{config:y,onDismiss:_,className:o})})}},637574:(e,t,n)=>{"use strict";n.d(t,{CookieConsentBanner:()=>l});var r=n(695155),a=n(212115),i=n(579288);function o(e){let t="https:"===window.location.protocol?"; Secure":"";document.cookie=`${i.WP}=${e}; path=/; max-age=${i.jZ}; SameSite=Lax${t}`}function s(e){let t=window;"function"==typeof t.gtag&&t.gtag("consent","update",{ad_storage:e?"granted":"denied",ad_user_data:e?"granted":"denied",ad_personalization:e?"granted":"denied",analytics_storage:e?"granted":"denied"});try{t.uetq=t.uetq||[],t.uetq.push?.("consent","update",{ad_storage:e?"granted":"denied"})}catch{}window.dispatchEvent(new CustomEvent("coachful:consent",{detail:{granted:e}}))}function l({shouldShow:e,copy:t,privacyHref:n}){let[i,c]=(0,a.useState)(e);if((0,a.useEffect)(()=>{c(e&&window.self===window.top)},[e]),!i)return null;let d="{privacyPolicy}",u=t.cookie_message.indexOf(d),h=-1===u?t.cookie_message:t.cookie_message.slice(0,u),m=-1===u?"":t.cookie_message.slice(u+d.length);return(0,r.jsx)("div",{role:"dialog","aria-live":"polite","aria-label":t.cookie_title,className:"fixed bottom-4 left-4 right-4 z-[10000] mx-auto max-w-2xl rounded-2xl border border-[#e1ddd8]/60 bg-white/95 p-5 font-albert text-sm text-[#0a0a0a] shadow-2xl backdrop-blur-xl dark:border-[#262b35]/60 dark:bg-[#171b22]/95 dark:text-white sm:p-6",children:(0,r.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"font-albert font-semibold",children:t.cookie_title}),(0,r.jsxs)("p",{className:"mt-1 font-albert text-[13px] leading-relaxed text-[#0a0a0a]/70 dark:text-white/70",children:[h,-1!==u&&(n?(0,r.jsx)("a",{href:n,className:"font-albert underline decoration-dotted underline-offset-2 hover:text-brand-accent",children:t.cookie_privacy_link}):t.cookie_privacy_link),m]})]}),(0,r.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{o("rejected"),s(!1),c(!1)},className:"rounded-xl border border-[#e1ddd8] bg-white px-4 py-2 font-albert font-medium text-[#0a0a0a] transition-colors hover:bg-[#faf8f6] dark:border-[#262b35] dark:bg-[#171b22] dark:text-white dark:hover:bg-[#1f242e]",children:t.cookie_reject}),(0,r.jsx)("button",{type:"button",onClick:()=>{o("accepted"),s(!0),c(!1)},className:"rounded-xl bg-brand-accent px-4 py-2 font-albert font-medium text-brand-accent-foreground transition-colors hover:opacity-90",children:t.cookie_accept})]})]})})}},695981:(e,t,n)=>{"use strict";n.d(t,{U:()=>u,Z:()=>d});var r=n(615925),a=n(524164),i=n(286062);let o={clients:()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(40798),n.e(15184),n.e(57490),n.e(88239),n.e(84134),n.e(13936),n.e(70093),n.e(8649),n.e(20606),n.e(55073),n.e(59271),n.e(43067),n.e(69311),n.e(50353),n.e(88738),n.e(96018),n.e(55127),n.e(49373)]).then(n.bind(n,531142)),programs:()=>Promise.all([n.e(75004),n.e(60277),n.e(78413),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(66609),n.e(31712),n.e(44923),n.e(50716),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(78638),n.e(40798),n.e(47173),n.e(3515),n.e(74711),n.e(67760),n.e(74862),n.e(16740),n.e(88239),n.e(70093),n.e(20606),n.e(55073),n.e(59271),n.e(43067),n.e(69311),n.e(29111),n.e(57093),n.e(64072),n.e(80630),n.e(16660),n.e(73576),n.e(73220),n.e(85086),n.e(18672),n.e(84711),n.e(81481),n.e(27361),n.e(59050),n.e(23090)]).then(n.bind(n,395791)),scheduling:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(66609),n.e(11847),n.e(83276),n.e(7784),n.e(31726)]).then(n.bind(n,307784)),availability:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(47173),n.e(50123),n.e(84134),n.e(42091),n.e(2
331551),n.e(63970),n.e(30879)]).then(n.bind(n,337290)),library:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(28838),n.e(80630),n.e(57220),n.e(59987),n.e(81879)]).then(n.bind(n,159987)),brain:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(44923),n.e(23226),n.e(11596),n.e(11496),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(80630),n.e(96277),n.e(36802),n.e(5867),n.e(32927),n.e(97666),n.e(6902)]).then(n.bind(n,588487)),fitness:()=>Promise.all([n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(61108),n.e(90923),n.e(64149),n.e(16498),n.e(67760),n.e(74862),n.e(16740),n.e(84134),n.e(4603),n.e(90879),n.e(61560),n.e(34224),n.e(96568),n.e(84745),n.e(61817),n.e(42278),n.e(98256),n.e(50887),n.e(53765),n.e(49222)]).then(n.bind(n,980697)),executive:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(61108),n.e(84134),n.e(90746),n.e(29208),n.e(17586)]).then(n.bind(n,629208)),career:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(61108),n.e(53843),n.e(84134),n.e(90746),n.e(28403),n.e(740),n.e(54137)]).then(n.bind(n,330352)),"client-journey":()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(93862),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(66609),n.e(31712),n.e(44923),n.e(50716),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(40798),n.e(68776),n.e(29365),n.e(88918),n.e(86111),n.e(39102),n.e(67760),n.e(74862),n.e(16740),n.e(88239),n.e(40106),n.e(70093),n.e(20606),n.e(55073),n.e(59271),n.e(19282),n.e(43067),n.e(69311),n.e(50353),n.e(92428),n.e(29111),n.e(80630),n.e(85277),n.e(90176),n.e(32355),n.e(57220),n.e(54383),n.e(25627),n.e(86716),n.e(76923),n.e(24646),n.e(92318),n.e(7802),n.e(55506),n.e(50619),n.e(78378),n.e(48509),n.e(3238),n.e(42087),n.e(96848),n.e(71646),n.e(58552),n.e(97156),n.e(39023),n.e(22720),n.e(83911),n.e(12837),n.e(54650),n.e(85435),n.e(45685),n.e(89882),n.e(74433)]).then(n.bind(n,660051)),checkins:()=>Promise.all([n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(66609),n.e(44923),n.e(82208),n.e(41584),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(19377),n.e(50510),n.e(31385),n.e(17054),n.e(90879),n.e(81723),n.e(70093),n.e(20606),n.e(55073),n.e(92428),n.e(4003),n.e(80630),n.e(18454),n.e(54383),n.e(56660),n.e(25627),n.e(57695),n.e(1333),n.e(510),n.e(14182),n.e(11875),n.e(82456),n.e(35262),n.e(4553),n.e(14730)]).then(n.bind(n,467414)),products:()=>Promise.all([n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(75441),n.e(67760),n.e(74862),n.e(16740),n.e(4603),n.e(90879),n.e(80630),n.e(8837),n.e(45201)]).then(n.bind(n,330819)),orders:()=>Promise.all([n.e(45399),n.e(44855),n.e(66609),n.e(80630),n.e(68311),n.e(2513)]).then(n.bind(n,968311)),offers:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(33909),n.e(67760),n.e(74862),n.e(16740),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(92341),n.e(80630),n.e(49348),n.e(16706),n.e(99668),n.e(15173)]).then(n.bind(n,971501)),funnels:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(75972),n.e(90879),n.e(20606),n.e(59271),n.e(80630),n.e(18672),n.e(91621),n.e(48714)]).then(n.bind(n,942090)),website:()=>Promise.all([n.e(37973),n.e(45399),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(99838),n.e(64414),n.e(13936),n.e(17054),n.e(90879),n.e(80630),n.e(73227),n.e(43095),n.e(17295)]).then(n.bind(n,152376)),customize:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(44923),n.e(81901),n.e(68776),n.e(17872),n.e(4498),n.e(86983),n.e(88239),n.e(97019),n.e(13936),n.e(90879),n.e(818),n.e(7517),n.e(80630),n.e(57220),n.e(18272),n.e(78536),n.e(35887),n.e(3323
330),n.e(12621),n.e(95961)]).then(n.bind(n,912621)),"ai-coach":()=>Promise.all([n.e(38437),n.e(45399),n.e(66609),n.e(20606),n.e(59271),n.e(29111),n.e(3473),n.e(84889),n.e(35901),n.e(43080)]).then(n.bind(n,277946)),analytics:()=>Promise.all([n.e(37973),n.e(52664),n.e(60844),n.e(75004),n.e(60277),n.e(59910),n.e(60234),n.e(94758),n.e(42890),n.e(85662),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(66609),n.e(31712),n.e(44923),n.e(50716),n.e(99838),n.e(23226),n.e(15244),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(81901),n.e(61766),n.e(68776),n.e(50931),n.e(38720),n.e(15184),n.e(48637),n.e(47173),n.e(69822),n.e(8354),n.e(82208),n.e(1503),n.e(67760),n.e(74862),n.e(16740),n.e(88239),n.e(19377),n.e(27305),n.e(27376),n.e(64414),n.e(71149),n.e(30593),n.e(50510),n.e(31385),n.e(65781),n.e(51653),n.e(17054),n.e(68183),n.e(81723),n.e(40106),n.e(70093),n.e(20606),n.e(77975),n.e(55073),n.e(59271),n.e(19282),n.e(43067),n.e(69311),n.e(86261),n.e(40174),n.e(60675),n.e(50353),n.e(58924),n.e(92428),n.e(4130),n.e(55325),n.e(50173),n.e(29111),n.e(57093),n.e(64072),n.e(33739),n.e(4003),n.e(7517),n.e(1988),n.e(80630),n.e(85277),n.e(73227),n.e(1397),n.e(11847),n.e(56992),n.e(40912),n.e(69871),n.e(16660),n.e(79305),n.e(52561),n.e(24047),n.e(86504),n.e(88738),n.e(5971),n.e(73576),n.e(57220),n.e(18454),n.e(24919),n.e(51686),n.e(54383),n.e(83276),n.e(73220),n.e(84072),n.e(70324),n.e(56660),n.e(25627),n.e(18272),n.e(57695),n.e(68172),n.e(12471),n.e(96018),n.e(78536),n.e(75636),n.e(85333),n.e(17588),n.e(1333),n.e(7784),n.e(61632),n.e(510),n.e(26897),n.e(33230),n.e(35002),n.e(32263),n.e(46493),n.e(42091),n.e(10802),n.e(14182),n.e(69201),n.e(80230),n.e(74500),n.e(58859),n.e(35565),n.e(10240),n.e(18672),n.e(25877),n.e(20147),n.e(21551),n.e(11875),n.e(82456),n.e(98098),n.e(22752),n.e(84711),n.e(78378),n.e(52344),n.e(39734),n.e(92202),n.e(63970),n.e(39063),n.e(91549),n.e(26451),n.e(35262),n.e(6691),n.e(67755),n.e(31433),n.e(2347),n.e(12621),n.e(67299),n.e(14336),n.e(4553),n.e(26363),n.e(77959),n.e(71729),n.e(94609),n.e(63506),n.e(86453),n.e(95482),n.e(18730),n.e(38697),n.e(7043),n.e(33763),n.e(64394),n.e(55258),n.e(51685),n.e(57939)]).then(n.bind(n,398520)),team:()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(40798),n.e(15184),n.e(57490),n.e(88239),n.e(84134),n.e(13936),n.e(70093),n.e(8649),n.e(20606),n.e(55073),n.e(59271),n.e(43067),n.e(69311),n.e(50353),n.e(88738),n.e(96018),n.e(55127),n.e(22230),n.e(96803)]).then(n.bind(n,255412)),projects:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(94400),n.e(84134),n.e(86504),n.e(85006),n.e(64431),n.e(83942)]).then(n.bind(n,871910)),automations:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(88569),n.e(33926),n.e(84134),n.e(49572),n.e(95464),n.e(22720),n.e(88099),n.e(90742),n.e(79724),n.e(66721)]).then(n.bind(n,756608)),email:()=>Promise.all([n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(29356),n.e(68776),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(90879),n.e(49572),n.e(45892),n.e(24646),n.e(50619),n.e(78173)]).then(n.bind(n,250619)),notifications:()=>Promise.all([n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(28637),n.e(84134),n.e(90879),n.e(88346),n.e(5335)]).then(n.bind(n,513501)),support:()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(80630),n.e(94609),n.e(12358)]).then(n.bind(n,894609)),agreements:()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(40798),n.e(88652),n.e(84134),n.e(13936),n.e(43067),n.e(69311),n.e(80630),n.e(65161),n.e(16795),n.e(54),n.e(12448)]).then(n.bind(n,751972))},s={article:()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(92094),n.e(97789),n.e(39841)]).then(n.bind(n,497789)),course:()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(40777),n.e(31712),n.e(50716),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(40106),n.e(19282),n.e(8527
337),n.e(75063),n.e(92094),n.e(10227),n.e(57302)]).then(n.bind(n,714705)),library:()=>Promise.all([n.e(37973),n.e(60234),n.e(94758),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(23226),n.e(36193),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(96277),n.e(36802),n.e(5867),n.e(84647),n.e(69682)]).then(n.bind(n,207028)),video:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(41538),n.e(95984),n.e(86716),n.e(92318),n.e(55506),n.e(52635)]).then(n.bind(n,655506)),audio:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(95984),n.e(72017),n.e(72858)]).then(n.bind(n,972017)),podcast:()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(40777),n.e(66609),n.e(31712),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(4603),n.e(13936),n.e(90879),n.e(49348),n.e(75063),n.e(49572),n.e(32840),n.e(79913)]).then(n.bind(n,451821)),download:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(41538),n.e(95984),n.e(76923),n.e(35622)]).then(n.bind(n,476923)),book:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(41538),n.e(95984),n.e(96848),n.e(74541)]).then(n.bind(n,796848)),link:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(41538),n.e(95984),n.e(7802),n.e(58306)]).then(n.bind(n,507802)),ai_tool:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(40777),n.e(66609),n.e(31712),n.e(50716),n.e(23226),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(40106),n.e(818),n.e(8649),n.e(92341),n.e(19282),n.e(85277),n.e(48509),n.e(12853)]).then(n.bind(n,648509)),questionnaire:()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(31712),n.e(50716),n.e(99838),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(78638),n.e(77197),n.e(67760),n.e(74862),n.e(16740),n.e(19377),n.e(27305),n.e(27376),n.e(64414),n.e(71149),n.e(30593),n.e(65781),n.e(19282),n.e(57093),n.e(75063),n.e(26870),n.e(2177)]).then(n.bind(n,420739)),vision_board:()=>Promise.all([n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(4603),n.e(90879),n.e(75636),n.e(58859),n.e(26813)]).then(n.bind(n,358859)),event:()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(66609),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(90879),n.e(818),n.e(70093),n.e(19282),n.e(16932),n.e(18176)]).then(n.bind(n,116932)),webinar:()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(23226),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(84134),n.e(4603),n.e(19377),n.e(27305),n.e(13936),n.e(90879),n.e(818),n.e(60675),n.e(13030),n.e(59696),n.e(16245),n.e(25314),n.e(37750),n.e(80838),n.e(2048)]).then(n.bind(n,682757))},l=new Map;function c(e,t){l.has(e)||l.set(e,t().catch(()=>{l.delete(e)}))}function d(){if("u"<typeof navigator)return!1;let e=navigator.connection;return navigator.onLine&&!e?.saveData&&!["slow-2g","2g"].includes(e?.effectiveType||"")}function u(e){if(!d())return;let t=new URL((0,r.K0)(e),window.location.origin);if(t.origin!==window.location.origin)return;if((0,a.Z9)(t.pathname)){c("intelligence-workspace",()=>Promise.all([n.e(45399),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(81901),n.e(48888),n.e(26650),n.e(7517),n.e(35887),n.e(95387),n.e(39902),n.e(81096),n.e(10459)]).then(n.bind(n,65089))),(0,i.xe)(t.pathname);return}
33if("/my-coach"===t.pathname){c("my-coaching",()=>Promise.all([n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(66609),n.e(97463),n.e(78638),n.e(52383),n.e(65995),n.e(70669),n.e(66327),n.e(84134),n.e(87130),n.e(61560),n.e(11847),n.e(69871),n.e(34224),n.e(40144),n.e(73035),n.e(22733),n.e(62167),n.e(20060),n.e(80889)]).then(n.bind(n,508207))),t.searchParams.get("programId")&&c("client-program",()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(60234),n.e(94758),n.e(78413),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(66609),n.e(23226),n.e(87005),n.e(29356),n.e(97463),n.e(40678),n.e(67872),n.e(78638),n.e(40798),n.e(21170),n.e(3515),n.e(29871),n.e(67760),n.e(74862),n.e(16740),n.e(70093),n.e(20606),n.e(59271),n.e(29111),n.e(64072),n.e(1397),n.e(11847),n.e(40912),n.e(69871),n.e(16660),n.e(68172),n.e(12471),n.e(21057),n.e(96193),n.e(55040),n.e(85086),n.e(40124),n.e(88802),n.e(90141),n.e(81481),n.e(59341),n.e(77724),n.e(6851),n.e(19748),n.e(68675),n.e(69701),n.e(56331)]).then(n.bind(n,469701)));return}let l=(0,r.TQ)(t.pathname),u=(0,r.Ce)(t.searchParams);if("/chat"===t.pathname||"messages"===u){c("chat-page",()=>Promise.all([n.e(66609),n.e(20606),n.e(59271),n.e(29111),n.e(3473),n.e(84889),n.e(11087)]).then(n.bind(n,26998))),c("chat",()=>Promise.all([n.e(60844),n.e(52664),n.e(60234),n.e(94758),n.e(42890),n.e(85662),n.e(13854),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(66609),n.e(44923),n.e(23226),n.e(87005),n.e(78638),n.e(81901),n.e(21170),n.e(61766),n.e(50931),n.e(38720),n.e(31332),n.e(69822),n.e(41419),n.e(3005),n.e(67760),n.e(20606),n.e(59271),n.e(29111),n.e(7517),n.e(1397),n.e(40912),n.e(24919),n.e(36689),n.e(87028),n.e(8587),n.e(37322),n.e(32794)]).then(n.bind(n,337322)));return}if("/community"===t.pathname||"/feed"===t.pathname||"community"===u){c("community",()=>Promise.all([n.e(38437),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(81901),n.e(4498),n.e(65995),n.e(97019),n.e(818),n.e(7517),n.e(3473),n.e(25169),n.e(62485),n.e(29164),n.e(13519)]).then(n.bind(n,329164))),t.searchParams.has("space")||c("community-feed",()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(60234),n.e(94758),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(40798),n.e(81901),n.e(21170),n.e(4498),n.e(254),n.e(76056),n.e(67760),n.e(97019),n.e(84134),n.e(20606),n.e(59271),n.e(7517),n.e(1397),n.e(40912),n.e(12471),n.e(40124),n.e(25169),n.e(62485),n.e(3378),n.e(8217)]).then(n.bind(n,887721)));return}if(!l)return;if(t.pathname===r.Vm.coach&&!t.searchParams.get("tab")&&!t.searchParams.get("resourceId")&&"test-client"!==t.searchParams.get("view")){c("home",()=>Promise.all([n.e(42731),n.e(45399),n.e(75139),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(81901),n.e(17872),n.e(86983),n.e(8409),n.e(90879),n.e(7517),n.e(57220),n.e(18272),n.e(78536),n.e(35887),n.e(17588),n.e(33230),n.e(39902),n.e(34570),n.e(45396),n.e(54846)]).then(n.bind(n,754846))),c("coach-home",()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(66609),n.e(31712),n.e(44923),n.e(50716),n.e(13855),n.e(97463),n.e(78638),n.e(52383),n.e(15184),n.e(48637),n.e(47173),n.e(8354),n.e(50123),n.e(67760),n.e(84134),n.e(70093),n.e(20606),n.e(55073),n.e(59271),n.e(29111),n.e(57093),n.e(64072),n.e(11847),n.e(69871),n.e(86504),n.e(73576),n.e(51686),n.e(83276),n.e(18272),n.e(68172),n.e(96018),n.e(85333),n.e(17588),n.e(7784),n.e(46493),n.e(42091),n.e(69201),n.e(74500),n.e(35565),n.e(21551),n.e(98098),n.e(22752),n.e(52344),n.e(39734),n.e(63970),n.e(39063),n.e(26451),n.e(41067)]).then(n.bind(n,559973)));return}c("workspace-app",()=>Promise.all([n.e(45399),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(81901),n.e(17872),n.e(86983),n.e(8409),n.e(76119),n.e(90879),n.e(7517),n.e(57220),n.e(18272),n.e(78536),n.e(35887),n.e(17588),n.e(3323
330),n.e(34570),n.e(35673)]).then(n.bind(n,435673)));let h=t.searchParams.get("resourceType"),m=t.searchParams.get("tab")||(0,r.LF)(t.pathname,t.searchParams);if(h&&t.searchParams.has("resourceId"))c("resource-editor",()=>Promise.all([n.e(37973),n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(23226),n.e(87005),n.e(29356),n.e(40678),n.e(67872),n.e(40798),n.e(8285),n.e(67760),n.e(74862),n.e(16740),n.e(88239),n.e(97019),n.e(84134),n.e(4603),n.e(13936),n.e(70093),n.e(55073),n.e(19282),n.e(43067),n.e(69311),n.e(50353),n.e(92428),n.e(90176),n.e(32355),n.e(95068),n.e(79823),n.e(67999)]).then(n.bind(n,964232))),s[h]&&c(`resource:${h}`,s[h]);else if("checkins"===m&&t.searchParams.get("flowId")){c("flow-editor",()=>Promise.all([n.e(45399),n.e(44855),n.e(73439)]).then(n.bind(n,413280)));let e=t.searchParams.get("flowSection")||"checkins";c(`flow-builder:${e}`,()=>Promise.all([n.e(45399),n.e(44855),n.e(73439)]).then(n.bind(n,413280)).then(t=>t.preloadCoachFlowEditor(e)))}else if("funnels"===m)c("tool:funnels",o.funnels),t.searchParams.get("funnelId")&&c("funnel-steps",()=>Promise.all([n.e(45399),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(50510),n.e(31385),n.e(20606),n.e(59271),n.e(99594),n.e(31759),n.e(88942),n.e(78666)]).then(n.bind(n,688942)));else if(m){if(c("tool-renderer",()=>Promise.all([n.e(45399),n.e(75139),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(17872),n.e(86983),n.e(50123),n.e(42871),n.e(88239),n.e(90879),n.e(80630),n.e(57220),n.e(18272),n.e(78536),n.e(33230),n.e(63970),n.e(55258),n.e(30786),n.e(51284)]).then(n.bind(n,430786))),"website"===m&&"submissions"===(0,r.WQ)(t.searchParams))return void c("tool:submissions",()=>Promise.all([n.e(45399),n.e(49844),n.e(14944)]).then(n.bind(n,549844)));if("email"===m&&(!t.searchParams.get("emailView")||"inbox"===t.searchParams.get("emailView")))return void c("tool:email-inbox",()=>Promise.all([n.e(75004),n.e(60277),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(29356),n.e(68776),n.e(16719),n.e(67760),n.e(74862),n.e(16740),n.e(97019),n.e(4603),n.e(90879),n.e(49572),n.e(24646),n.e(67940),n.e(79298)]).then(n.bind(n,456598)));let e="scheduling"===m&&"availability"===t.searchParams.get("schedulingSubTab")?"availability":m||"customize";o[e]&&c(`tool:${e}`,o[e])}else"create"===l?c("create",()=>Promise.all([n.e(38437),n.e(45399),n.e(75139),n.e(9683),n.e(44855),n.e(61108),n.e(66609),n.e(44923),n.e(75190),n.e(80630),n.e(3473),n.e(19717),n.e(35887),n.e(18815),n.e(32927),n.e(97560),n.e(33518),n.e(11619),n.e(37836)]).then(n.bind(n,912476))):"sell"===l?c("sell",()=>Promise.all([n.e(67831),n.e(38437),n.e(42695),n.e(75139),n.e(9683),n.e(44855),n.e(17872),n.e(88239),n.e(78536),n.e(35887),n.e(97560),n.e(33369),n.e(1586),n.e(57683)]).then(n.bind(n,838399))):"manage"===l?c("manage",()=>Promise.all([n.e(67831),n.e(38437),n.e(45399),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(68484),n.e(16304),n.e(97463),n.e(17872),n.e(52383),n.e(43666),n.e(32485),n.e(88239),n.e(87130),n.e(11847),n.e(69871),n.e(78536),n.e(35887),n.e(35002),n.e(97560),n.e(27),n.e(33369),n.e(39942),n.e(33154)]).then(n.bind(n,445368))):(c("home",()=>Promise.all([n.e(42731),n.e(45399),n.e(75139),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(66609),n.e(81901),n.e(17872),n.e(86983),n.e(8409),n.e(90879),n.e(7517),n.e(57220),n.e(18272),n.e(78536),n.e(35887),n.e(17588),n.e(33230),n.e(39902),n.e(34570),n.e(45396),n.e(54846)]).then(n.bind(n,754846))),c("coach-home",()=>Promise.all([n.e(37973),n.e(38437),n.e(45399),n.e(6415),n.e(42695),n.e(75139),n.e(91579),n.e(9683),n.e(44855),n.e(79054),n.e(61108),n.e(68484),n.e(16304),n.e(40777),n.e(66609),n.e(31712),n.e(44923),n.e(50716),n.e(13855),n.e(97463),n.e(78638),n.e(52383),n.e(15184),n.e(48637),n.e(47173),n.e(8354),n.e(50123),n.e(67760),n.e(84134),n.e(70093),n.e(20606),n.e(55073),n.e(59271),n.e(29111),n.e(57093),n.e(64072),n.e(11847),n.e(69871),n.e(86504),n.e(73576),n.e(51686),n.e(83276),n.e(18272),n.e(68172),n.e(96018),n.e(85333),n.e(17588),n.e(7784),n.e(46493),n.e(42091),n.e(69201),n.e(74500),n.e(35565),n.e(2
331551),n.e(98098),n.e(22752),n.e(52344),n.e(39734),n.e(63970),n.e(39063),n.e(26451),n.e(41067)]).then(n.bind(n,559973))))}},697396:(e,t,n)=>{"use strict";n.d(t,{GR:()=>o,Oo:()=>i,tr:()=>s});var r=n(998918);let a=new Map;function i(e){let t=a.get(e);return!t||t.expiresAt<=Date.now()||void 0===t.value?null:t.value}function o(e){let t=a.get(e);if(t&&t.expiresAt>Date.now())return t.request;let n=fetch(`/api/funnel/${encodeURIComponent(e)}`,{signal:(0,r.Y)(2e4)}).then(async t=>{let r=await t.json().catch(()=>({}));if(!t.ok)throw Error(r?.error||"Failed to load funnel");let i=a.get(e);return i?.request===n&&(i.value=r),r}).catch(t=>{throw a.get(e)?.request===n&&a.delete(e),t});return a.set(e,{expiresAt:Date.now()+3e4,request:n}),n}function s(e){o(e).then(e=>{e.steps?.some(e=>"payment"===e.type&&!0!==e.archived)&&n.e(97305).then(n.bind(n,697305)).then(({warmFunnelStripe:e})=>{e()})}).catch(()=>{})}},704756:(e,t,n)=>{"use strict";n.d(t,{NetworkResumeGuard:()=>s});var r=n(212115);let a=!1;async function i(){let e=new AbortController,t=window.setTimeout(()=>e.abort(),2e3);try{return(await fetch("/api/health",{method:"HEAD",cache:"no-store",signal:e.signal})).ok}catch{return!1}finally{window.clearTimeout(t)}}async function o(){if(a||!navigator.onLine)return;a=!0;let e=await i();a=!1,e&&window.dispatchEvent(new CustomEvent("coachful:network-recovered"))}function s(){return(0,r.useEffect)(()=>{let e=()=>{window.setTimeout(()=>{o()},150)},t=()=>{o()};return window.addEventListener("online",e),window.addEventListener("coachful:network-failure",t),()=>{window.removeEventListener("online",e),window.removeEventListener("coachful:network-failure",t)}},[]),null}},746357:(e,t,n)=>{"use strict";n.d(t,{ChatUnreadProvider:()=>u,r:()=>h});var r=n(695155),a=n(212115),i=n(929111),o=n(903473),s=n(886871),l=n(305142);let c={totalUnread:0,mainUnread:0,directUnread:0,totalMentions:0},d=(0,a.createContext)({totalUnread:0,mainUnread:0,directUnread:0,totalMentions:0,isConnected:!1,refresh:()=>{}});function u({children:e}){let t=function(){let{client:e,isConnected:t}=(0,o.b)(),n=(0,i.E)(),[r,d]=(0,a.useState)(0);(0,a.useEffect)(()=>{if(!e||!t||n)return;let r=e=>{let t=e.channel_id||e.channel?.id||e.cid?.split(":")[1]||null;t&&t.startsWith("corner-")||d(e=>e+1)};return e.on("message.new",r),e.on("message.read",r),e.on("notification.message_new",r),e.on("notification.mark_read",r),e.on("channel.visible",r),e.on("channel.updated",r),()=>{e.off("message.new",r),e.off("message.read",r),e.off("notification.message_new",r),e.off("notification.mark_read",r),e.off("channel.visible",r),e.off("channel.updated",r)}},[e,t,n]);let u=(0,a.useMemo)(()=>{if(n)return n.channels.reduce((e,t)=>{if(t.id.startsWith("corner-"))return e;let n=Math.max(0,t.unread||0);return e.totalMentions+=Math.max(0,t.mentions||0),0===n||(e.totalUnread+=n,(0,s.S5)(t)?e.directUnread+=n:e.mainUnread+=n),e},{...c});if(!e?.user)return c;let t={...c};for(let n of Object.values(e.activeChannels)){let e=n.id;if(e?.startsWith("corner-"))continue;let{unread:r,mentions:a}=(0,l.Xv)(n);t.totalMentions+=a,0!==r&&((t.totalUnread+=r,e&&(e.startsWith("org-")||e.startsWith("squad-")||e.startsWith("ai-coach-")||e.includes("-announcements")||e.includes("-social")||e.includes("-wins")))?t.mainUnread+=r:t.directUnread+=r)}return t},[n,e,r]),h=(0,a.useCallback)(()=>{n?n.refresh():d(e=>e+1)},[n]);return{...u,isConnected:t,refresh:h}}();return(0,r.jsx)(d.Provider,{value:t,children:e})}function h(){return(0,a.useContext)(d)}},768730:(e,t,n)=>{"use strict";n.d(t,{ChatPreferencesProvider:()=>b,p:()=>w});var r=n(695155),a=n(212115),i=n(792939),o=n(677096),s=n(13931);function l(e,t){if(e.size!==t.size)return!1;for(let[n,r]of t){let t=e.get(n);if(!t||t.channelType!==r.channelType||t.isPinned!==r.isPinned||t.isArchived!==r.isArchived||t.isDeleted!==r.isDeleted||t.pinnedAt!==r.pinnedAt||t.unpinnedAt!==r.unpinnedAt||t.archivedAt!==r.archivedAt||t.deletedAt!==r.deletedAt||t.updatedAt!==r.updatedAt)return!1}return!0}var c=n(103238);let d="chat_preferences_v2_",u="chat_preferences_v1_";function h(e,t){try{let n={version:2,timestamp:Date.now(),userId:e,data:Array.from(t.entries())};localStorage.setItem(`${d}${e}`,JSON.stringify(n)),localStorage.removeItem(`${u}${e}`)}catch(e){console.warn("[ChatPreferencesContext] Failed to save cache:",e)}}let m={preferences:new Map,isLoading:!1,error:null,archivedChannelIds:new Set,pinCh
33annel:async()=>{},unpinChannel:async()=>{},archiveChannel:async()=>{},unarchiveChannel:async()=>{},deleteChannel:async()=>{},undeleteChannel:async()=>{},getPreference:()=>void 0,canPin:()=>!0,canArchive:()=>!0,canDelete:()=>!1},f=(0,a.createContext)(m);async function p(e,t,n){let r=await fetch("/api/user/chat-preferences",{method:"POST",cache:"no-store",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({channelId:e,channelType:t,action:n})});if(!r.ok)throw Error((await r.json().catch(()=>({}))).error||"Failed to update chat preference");let a=await r.json();if(!a.preference)throw Error("Chat preference update returned no state");return a.preference}async function g(){let e=await fetch("/api/user/chat-preferences",{cache:"no-store",credentials:"same-origin"});if(!e.ok)throw Error((await e.json().catch(()=>({}))).error||"Failed to fetch chat preferences");let t=await e.json(),n=new Map;for(let e of t.preferences||[])n.set(e.channelId,e);return n}function b({children:e}){let{userId:t,isLoaded:n}=(0,i.useAppAuth)(),[m,w]=(0,a.useState)(()=>new Map),[v,y]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),k=(0,a.useRef)(null),x=(0,a.useRef)(0),I=(0,a.useRef)(new Map),P=(0,a.useRef)(new Map),_=(0,a.useRef)(new Map),E=(0,a.useRef)(new Map),A=(0,a.useCallback)(e=>{t&&k.current===t&&w(n=>{if(k.current!==t)return n;let r=new Map(e);for(let[t,n]of P.current){let a=e.get(t),i=a?.updatedAt?Date.parse(a.updatedAt):-1/0,o=Date.parse(n.updatedAt);!a||i<o?r.set(t,n):P.current.delete(t)}_.current=new Map(r);let a=function(e,t,n){let r=new Map(e);for(let e of n){let n=t.get(e);n&&r.set(e,n)}return l(t,r)?t:r}(r,n,new Set(I.current.keys()));return h(t,a),a})},[t]);(0,a.useEffect)(()=>{if(!n)return;let e=k.current,r=e!==t;if(r&&(e&&function(e){try{localStorage.removeItem(`${d}${e}`),localStorage.removeItem(`${u}${e}`)}catch(e){console.warn("[ChatPreferencesContext] Failed to clear cache:",e)}}(e),k.current=t,I.current.clear(),P.current.clear(),_.current.clear(),E.current.clear()),!t){w(new Map),y(!1),S(null);return}let a=!1;r&&w(function(e){try{let t=localStorage.getItem(`${d}${e}`);if(!t)return null;let n=JSON.parse(t);if(2!==n.version||n.userId!==e||Date.now()-n.timestamp>864e5)return null;return new Map(n.data)}catch{return null}}(t)??new Map),y(!0),S(null);let i=async()=>{await g().then(e=>{a||k.current!==t||A(e)}).catch(e=>{a||k.current!==t||(console.error("[ChatPreferencesContext] Startup hydration failed:",e),S(e instanceof Error?e:Error("Failed to fetch chat preferences")))}).finally(()=>{a||k.current!==t||y(!1)})},o=null;return(0,c.zd)(window.location.pathname)?i():o=(0,c.Oq)(i,{priority:"user-visible",timeoutMs:2e3}),()=>{a=!0,o?.()}},[A,n,t]),(0,a.useEffect)(()=>{if(!n||!t)return;if(!o.db||!o.auth)return void console.warn("[ChatPreferencesContext] Firebase not initialized");let e=o.auth,r=!0,a=!1,i=null,l=null,d=null,u=0,h=()=>{d&&clearTimeout(d),d=null},m=()=>{i?.(),i=null,a=!1},f=()=>{if(a||i||!o.db||!r||e.currentUser?.uid!==t)return;a=!0;let n=(0,s.rJ)(o.db,"users",t,"chat_preferences");i=(0,s.aQ)(n,n=>{if(!r||e.currentUser?.uid!==t||n.metadata.fromCache)return;u=0;let a=new Map;n.docs.forEach(e=>{a.set(e.id,{channelId:e.id,...e.data()})}),A(a),S(null)},n=>{if(r){if(m(),e.currentUser?.uid===t&&u<3&&(d=setTimeout(()=>{d=null,f()},2e3*2**u++)),n.message?.includes("INTERNAL ASSERTION FAILED"))return void console.debug("[ChatPreferencesContext] Firestore internal state error (safe to ignore):",n.message);if("permission-denied"===n.code){console.debug("[ChatPreferencesContext] Realtime preferences unavailable; refreshing from API."),g().then(e=>{r&&A(e)}).catch(e=>{r&&(console.error("[ChatPreferencesContext] API fallback failed:",e),S(e instanceof Error?e:Error("Failed to fetch chat preferences")))}),S(null);return}console.error("[ChatPreferencesContext] Firestore error:",n),S(n)}})},p=()=>{r&&!l&&(l=e.onIdTokenChanged(e=>{if(r){if(h(),u=0,e?.uid!==t)return void m();f()}}))},b=null;return(0,c.zd)(window.location.pathname)?p():b=(0,c.Oq)(p,{priority:"background",timeoutMs:4e3}),()=>{r=!1,b?.(),l?.(),h(),m()}},[A,t,n]);let $=(0,a.useMemo)(()=>{let e=new Set;return m.forEach((t,n)=>{t.isArchived&&!t.isDeleted&&e.add(n)}),e},[m]),M=(0,a.useCallback)(e=>!0,[]),j=(0,a.useCallback)(e=>"org"!==e,[]),T=(0,a.useCallback)(e=>
33"dm"===e,[]),N=(0,a.useCallback)(e=>m.get(e),[m]),q=(0,a.useCallback)((e,n,r)=>{let a=++x.current;return I.current.set(e,a),w(a=>{let i=new Map(a),o=a.get(e),s=new Date().toISOString();return i.set(e,{channelId:e,channelType:n,isPinned:!1,isArchived:!1,isDeleted:!1,updatedAt:s,...o,...r}),t&&h(t,i),i}),a},[t]),D=(0,a.useCallback)(async(e,n,r,a)=>{let i=q(e,n,a),o=(E.current.get(e)||Promise.resolve()).catch(()=>void 0).then(()=>{if(!t||k.current!==t)throw Error("Chat preference session changed");return p(e,n,r)}),s=o.then(()=>void 0,()=>void 0);E.current.set(e,s);try{let n=await o;if(k.current!==t||(_.current.set(e,n),P.current.set(e,n),I.current.get(e)!==i))return;I.current.delete(e),w(r=>{let a=new Map(r);return a.set(e,n),t&&h(t,a),l(r,a)?r:a}),S(null)}catch(n){if(I.current.get(e)===i){I.current.delete(e);try{let e=await g();A(e)}catch(n){console.error("[ChatPreferencesContext] Failed to reconcile mutation rollback:",n),w(n=>{if(I.current.has(e))return n;let r=new Map(n),a=_.current.get(e);return a?r.set(e,a):r.delete(e),t&&h(t,r),l(n,r)?n:r})}S(n instanceof Error?n:Error("Failed to update chat preference"))}throw n}finally{E.current.get(e)===s&&E.current.delete(e)}},[A,q,t]),U=(0,a.useCallback)((e,t)=>D(e,t,"pin",{isPinned:!0,pinnedAt:new Date().toISOString()}),[D]),R=(0,a.useCallback)((e,t)=>D(e,t,"unpin",{isPinned:!1,unpinnedAt:new Date().toISOString()}),[D]),L=(0,a.useCallback)((e,t)=>D(e,t,"archive",{isArchived:!0,archivedAt:new Date().toISOString()}),[D]),O=(0,a.useCallback)((e,t)=>D(e,t,"unarchive",{isArchived:!1}),[D]),B=(0,a.useCallback)(async(e,n)=>{if("dm"!==n)return void console.warn("[ChatPreferences] Cannot delete - not a DM:",{channelId:e,channelType:n});console.log("[ChatPreferences] Deleting channel via API:",{channelId:e,channelType:n});try{let n=await fetch("/api/chat/delete-channel",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({channelId:e})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||"Failed to delete channel")}I.current.delete(e),P.current.delete(e),w(n=>{if(!n.has(e))return n;let r=new Map(n);return r.delete(e),t&&h(t,r),r}),console.log("[ChatPreferences] Channel deleted successfully:",e)}catch(e){throw console.error("[ChatPreferences] Failed to delete channel:",e),e}},[t]),W=(0,a.useCallback)((e,t)=>D(e,t,"undelete",{isDeleted:!1}),[D]),F=(0,a.useMemo)(()=>({preferences:m,isLoading:v,error:C,archivedChannelIds:$,pinChannel:U,unpinChannel:R,archiveChannel:L,unarchiveChannel:O,deleteChannel:B,undeleteChannel:W,getPreference:N,canPin:M,canArchive:j,canDelete:T}),[m,v,C,$,U,R,L,O,B,W,N,M,j,T]);return(0,r.jsx)(f.Provider,{value:F,children:e})}function w(){return(0,a.useContext)(f)}},771734:(e,t,n)=>{"use strict";n.d(t,{D7:()=>v,DF:()=>I,Hv:()=>_,Po:()=>P,Vb:()=>w,Vc:()=>C,ZP:()=>S,sg:()=>k});var r=n(695155),a=n(212115),i=n(573321),o=n(960228),s=n(450910),l=n(394537),c=n(88520),d=n(442763),u=n(562840),h=n(615925),m=n(189239),f=n(695981),p=n(524164),g=n(163241),b=n(468648);let w="coachful:workspace-navigate",v="coachful:workspace-tools",y=(0,a.createContext)(null);function C({children:e}){let t=(0,i.usePathname)(),n=(0,o.wI)()?.isCoachView??!1,{navigate:s,prefetch:l,guard:c}=P(),d=(0,a.useCallback)((e,t)=>s((0,h._N)(e,window.location.pathname),t),[s]),u=(0,a.useCallback)(e=>l((0,h._N)(e,window.location.pathname)),[l]),m=(0,a.useMemo)(()=>({navigate:d,prefetch:u}),[d,u]);return(0,r.jsxs)(y.Provider,{value:"/"!==t||n?m:null,children:[e,c]})}function S(){return(0,a.useContext)(y)}function k(){let e=S(),t=(0,i.useRouter)(),n=(0,a.useCallback)((n,r)=>{if(e)return e.navigate(n,r);let a=(0,h.K0)(n);return t.push(a),r?.(),!0},[t,e]),r=(0,a.useCallback)(n=>{e?e.prefetch(n):(0,f.Z)()&&t.prefetch((0,h.K0)(n))},[t,e]);return(0,a.useMemo)(()=>({navigate:n,prefetch:r}),[n,r])}function x(e){let t=e=>"/"===e||(0,p.Z9)(e)||Object.values(h.Vm).some(t=>t===e);return e.origin===window.location.origin&&!e.hash&&t(window.location.pathname)&&t(e.pathname)&&!!document.querySelector("[data-workspace-router]")}function I(e,t={}){let n=new URL(e,window.location.origin),r="/"===n.pathname&&((0,h.Ce)(n.searchParams)||(0,h.Ce)(new URLSearchParams(window.location.search)));if(!(n.origin===window.location.origin&&n.pathname===window.location.pathname&&((0,h.P9)(n.pathname)||r)&&!n.hash)&&!x(n))return!1;let a=n.pathname!==window.location.pathname;return n.href!==window.location.href&&(t.replace?window.history.replaceState(null,"",e):window.history.pushState(null,"",e)),a&&!1!==t.scroll&&window.scrollTo({top:0,behavior:"instant"}),!0}function P(){let e=(0,i.useRouter)(),t=(0,s.c)("workspaceShell"),n=(0,l.U)("(min-width: 768px)"),[o,p]=(0,a.useState)(null),v=(0,a.useCallback)(t=>{if(!(0,f.Z)())return;let n=(0,h.K0)(t);if(!n.startsWith("/")||n.startsWith("//"))return;(0,f.U)(n);let r=new URL(n,window.location.origin),a="/"===r.pathname&&((0,h.Ce)(r.searchParams)||(0,h.Ce)(new URLSearchParams(window.location.search)));x(r)||r.pathname===window.location.pathname&&((0,h.P9)(r.pathname)||a)||e.prefetch(n)},[e]),y=(0,a.useCallback)((t,n)=>{let r=(0,h.K0)(t);if((0,g.Ge)(r))return(0,b.P)(r),n?.(),!0;let a=(0,c.p3)();if(a)return p(a),!1;
33(0,f.U)(r);let i={href:r,handled:!1,onNavigate:n};return window.dispatchEvent(new CustomEvent(w,{detail:i})),i.handled||(/^https?:\/\//.test(r)?window.location.assign(r):I(r)||e.push(r,{scroll:!1}),n?.()),!i.deferred},[e]),C=()=>p(null);return{navigate:y,prefetch:v,guard:n?(0,r.jsx)(d.lG,{open:!!o,onOpenChange:e=>{e||C()},children:(0,r.jsxs)(d.Cf,{className:"max-w-md font-albert",children:[(0,r.jsxs)(d.c7,{children:[(0,r.jsx)(d.L3,{children:(0,c.gk)(o,t("workInProgress"))}),(0,r.jsx)(d.rr,{children:(0,c.BN)(o)})]}),(0,r.jsx)(d.Es,{children:(0,r.jsx)(m.$,{onClick:C,children:t("stayHere")})})]})}):(0,r.jsx)(u._s,{open:!!o,onOpenChange:e=>{e||C()},children:(0,r.jsxs)(u.zj,{className:"font-albert",children:[(0,r.jsxs)(u.BE,{children:[(0,r.jsx)(u.gk,{children:(0,c.gk)(o,t("workInProgress"))}),(0,r.jsx)(u.I6,{children:(0,c.BN)(o)})]}),(0,r.jsx)(u.tb,{children:(0,r.jsx)(m.$,{onClick:C,children:t("stayHere")})})]})})}}function _(e){window.dispatchEvent(new CustomEvent(v,{detail:e}))}},775889:(e,t,n)=>{"use strict";n.d(t,{CoachingProvider:()=>f,r:()=>p});var r=n(695155),a=n(212115),i=n(573321),o=n(792939),s=n(32087),l=n(561834),c=n(103238);let d="ga-coaching-cache-v1";function u(e){try{let t=localStorage.getItem(d);if(!t)return null;let n=JSON.parse(t);if(2!==n.version||n.userId!==e||Date.now()-n.timestamp>36e5)return null;return n}catch{return null}}let h=(0,a.createContext)(void 0),m={hasActiveProgramSessionEnrollment:!1,hasActiveIndividualEnrollment:!1,coachingChatChannelId:null,coachInfo:null,promoIsEnabled:!1,promoDestinationUrl:null,promoImageUrl:null,fetchedForUserId:null};function f({children:e}){let{user:t,isLoaded:n}=(0,o.useAppUser)(),p=(0,i.usePathname)(),{isDemoMode:g}=(0,s._)(),b=(0,a.useRef)(!1),w=(0,a.useRef)(null);w.current=g?"demo-user":t?.id??null;let[v,y]=(0,a.useState)(m.hasActiveProgramSessionEnrollment),[C,S]=(0,a.useState)(m.hasActiveIndividualEnrollment),[k,x]=(0,a.useState)(m.coachingChatChannelId),[I,P]=(0,a.useState)(m.coachInfo),[_,E]=(0,a.useState)(m.promoIsEnabled),[A,$]=(0,a.useState)(m.promoDestinationUrl),[M,j]=(0,a.useState)(m.promoImageUrl),[T,N]=(0,a.useState)(!m.fetchedForUserId),[q,D]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(b.current||!t?.id)return;let e=u(t.id);e&&!m.fetchedForUserId&&(y(e.hasActiveProgramSessionEnrollment??e.hasActiveIndividualEnrollment??!1),S(e.hasActiveIndividualEnrollment??!1),x(e.coachingChatChannelId??null),P(e.coachInfo??null),E(e.promoIsEnabled??!1),$(e.promoDestinationUrl??null),j(e.promoImageUrl??null),m.hasActiveProgramSessionEnrollment=e.hasActiveProgramSessionEnrollment??e.hasActiveIndividualEnrollment??!1,m.hasActiveIndividualEnrollment=e.hasActiveIndividualEnrollment??!1,m.coachingChatChannelId=e.coachingChatChannelId??null,m.coachInfo=e.coachInfo??null,m.promoIsEnabled=e.promoIsEnabled??!1,m.promoDestinationUrl=e.promoDestinationUrl??null,m.promoImageUrl=e.promoImageUrl??null,N(!1)),b.current=!0},[t?.id]);let U=(0,a.useRef)(0),R=(0,a.useRef)(null),L=(0,a.useRef)(null),O=(0,a.useCallback)((e,t)=>{if(U.current>=3)return;R.current&&clearTimeout(R.current);let n=2e3*Math.pow(2,U.current);U.current+=1,R.current=setTimeout(()=>{L.current?.(e,t)},n)},[]);(0,a.useEffect)(()=>()=>{R.current&&clearTimeout(R.current)},[]);let B=(0,a.useCallback)(async(e,t=!1)=>{if(w.current===e)try{if(N(!0),D(null),t){let t={hasActiveProgramSessionEnrollment:!0,hasActiveIndividualEnrollment:!0,coachingChatChannelId:"demo-coaching-channel",coachInfo:{name:"Demo Coach",imageUrl:(0,l.$i)({id:"demo-coach",name:"Demo Coach"})},promoIsEnabled:!1,promoDestinationUrl:null,promoImageUrl:null};m={...t,fetchedForUserId:e},y(t.hasActiveProgramSessionEnrollment),S(t.hasActiveIndividualEnrollment),x(t.coachingChatChannelId),P(t.coachInfo),E(t.promoIsEnabled),$(t.promoDestinationUrl),j(t.promoImageUrl),N(!1);return}let n=await fetch("/api/user/org-coaching-promo");if(w.current!==e)return;if(!n.ok){if(m.coachingChatChannelId||u(e)?.coachingChatChannelId){N(!1),O(e,t);return}y(!1),S(!1),x(null),P(null),E(!1),$(null),j(null),N(!1),O(e,t);return}let r=await n.json();if(w.current!==e)return;if(r.authPending){N(!1),O(e,t);return}let a={hasActiveProgramSessionEnrollment:r.hasActiveProgramSessionEnrollment??r.hasActiveIndividualEnrollment??!1,hasActiveIndividualEnrollment:r.hasActiveIndividualEnrollment||!1,coachingChatChannelId:r.coachingChatChannelId||null,coachInfo:r.coachInfo||null,promoIsEnabled:r.isEnabled||!1,promoDestinationUrl:r.destinationUrl||null,promoImageUrl:r.promo?.imageUrl||null};m={...a,fetchedForUserId:e},y(a.hasActiveProgramSessionEnrollment),S(a.hasActiveIndividualEnrollment),x(a.coachingChatChannelId),P(a.coachInfo),E(a.promoIsEnabled),$(a.promoDestinationUrl),j(a.promoImageUrl),N(!1);try{let t={version:2,timestamp:Date.now(),userId:e,...a};localStorage.setItem(d,JSON.stringify(t))}catch(e){console.warn("[CoachingContext] Failed to save cache to localStorage:",e)}U.current=0}catch(n){if(w.current!==e)return;console.error("Error fetching coaching data:",n),D(n instanceof Error?n.message:"Failed to fetch coaching data"),N(!1),O(e,t)}},[O]);(0,a.useEffect)(()=>{L.current=B},[B]);let W=(0,a.useCallback)(async()=>{(t?.id||g)&&await B(t?.id||"demo-user",g)},[t?.id,g,B]);return(0,a.useEffect)(()=>
33{if(!g&&!n)return;if(!t&&!g){m={hasActiveProgramSessionEnrollment:!1,hasActiveIndividualEnrollment:!1,coachingChatChannelId:null,coachInfo:null,promoIsEnabled:!1,promoDestinationUrl:null,promoImageUrl:null,fetchedForUserId:null},y(!1),S(!1),x(null),P(null),E(!1),$(null),j(null),N(!1);return}let e=t?.id||"demo-user";if(m.fetchedForUserId===e){y(m.hasActiveProgramSessionEnrollment),S(m.hasActiveIndividualEnrollment),x(m.coachingChatChannelId),P(m.coachInfo),E(m.promoIsEnabled),$(m.promoDestinationUrl),j(m.promoImageUrl),N(!1);return}return g||(0,c.zd)(p)?void B(e,g):(0,c.Oq)(()=>B(e,g),{priority:"user-visible",timeoutMs:3e3})},[t?.id,n,g,B,p]),(0,r.jsx)(h.Provider,{value:{hasActiveProgramSessionEnrollment:v,hasActiveIndividualEnrollment:C,coachingChatChannelId:k,coachInfo:I,promoIsEnabled:_,promoDestinationUrl:A,promoImageUrl:M,hasCoachingChat:!!k,isLoading:T,error:q,refetch:W},children:e})}function p(){let e=(0,a.useContext)(h);if(void 0===e)throw Error("useCoachingContext must be used within a CoachingProvider");return e}},781992:(e,t,n)=>{"use strict";n.d(t,{Y:()=>r,b:()=>a});let r="coachful:open-popup-funnel";function a(e,t,n){if(!e)return;let a={funnelId:e,runtimeContext:n};window.dispatchEvent(new CustomEvent(r,{detail:a})),!a.handled&&t&&window.open(t,"_blank","noopener,noreferrer")}},784961:(e,t,n)=>{"use strict";n.d(t,{m:()=>i,j:()=>o});let r=["/discover/events","/discover/sessions","/discover/ai-tools","/discover/articles","/discover/books","/discover/courses","/discover/downloads","/discover/libraries","/discover/links","/discover/podcasts","/discover/videos"];function a(e){return!!e&&r.some(t=>e.startsWith(t))}function i(e){return!!e&&(e.startsWith("/sign-in")||e.startsWith("/sign-up")||e.startsWith("/signup")||e.startsWith("/website")||e.startsWith("/onboarding")||e.startsWith("/start")||e.startsWith("/checkin")||e.startsWith("/join")||e.startsWith("/f/")||e.startsWith("/invite")||e.startsWith("/team-invite")||e.startsWith("/program-application")||"/invoice"===e||e.startsWith("/invoice/")||e.startsWith("/book")||a(e)||e.startsWith("/sign/")||e.startsWith("/intake-call")||e.startsWith("/call/")||e.startsWith("/blog")||e.startsWith("/tools")||e.startsWith("/unfixated")||e.startsWith("/docs")||e.startsWith("/marketplace")||e.startsWith("/find-a-coac
33h")||e.startsWith("/lander")||e.startsWith("/marketing")||e.startsWith("/support")||e.startsWith("/mobile")||e.startsWith("/terms")||e.startsWith("/privacy")||e.startsWith("/refund-policy")||e.startsWith("/coach/onboarding")||e.startsWith("/coach/welcome")||e.startsWith("/coach/complete-signup")||e.startsWith("/auth/")||e.startsWith("/q/")||e.startsWith("/assessment/")||e.startsWith("/r/")||"/access-denied"===e||"/tenant-not-found"===e||"/upgrade-premium/form"===e||"/get-coach/form"===e)}function o(e,t){return t&&a(e)}},792939:(e,t,n)=>{"use strict";n.r(t),n.d(t,{AuthProvider:()=>h,useAppAuth:()=>m,useAppUser:()=>f,useFirebaseAuthUser:()=>g,useSignOut:()=>p});var r=n(695155),a=n(212115),i=n(934770),o=n(13931),s=n(677096),l=n(837511),c=n(561834),d=n(119378);let u=(0,a.createContext)({userId:null,isSignedIn:!1,isLoaded:!1,firebaseUser:null,user:null,sessionClaims:null,signOut:async()=>{}});function h({children:e,initialClaims:t}){let l=t?.userId||null,[m,f]=(0,a.useState)(null),[p,g]=(0,a.useState)(!!t),[w,v]=(0,a.useState)(!1),[y,C]=(0,a.useState)(()=>{if(!t?.firstName)return null;let e=t.firstName,n=t.lastName||"",r=t.fullName||[e,n].filter(Boolean).join(" ")||e;return{id:t.userId,firstName:e,lastName:n,fullName:r,imageUrl:t.imageUrl||"",email:t.email||"",emailAddresses:t.email?[{emailAddress:t.email}]:[],primaryEmailAddress:t.email?{emailAddress:t.email}:null,publicMetadata:{role:t.role,primaryOrganizationId:t.primaryOrganizationId,organizationId:t.primaryOrganizationId,orgRole:t.orgRoles?Object.values(t.orgRoles)[0]:void 0,billingStatus:t.billingStatus,billingPeriodEnd:t.billingPeriodEnd,coachingStatus:t.coachingStatus,coachingPlan:t.coachingPlan,coachingPeriodEnd:t.coachingPeriodEnd},createdAt:"",updatedAt:""}}),S=(0,a.useRef)(null),k=(0,a.useRef)(null),x=(0,a.useRef)(!0);(0,a.useEffect)(()=>{if(!s.auth){g(!0),v(!0);return}let e=null,r=!0,a=!1,o=(0,i.z)(s.auth,i=>{e&&(clearTimeout(e),e=null),i?(f(i),C(e=>e?.imageUrl?e:b(i)),v(!0),g(!0)):r&&t?e=setTimeout(async()=>{if(!a){a=!0;try{let e=await fetch("/api/auth/session-check"),t=await e.json();if(t.valid&&t.customToken&&s.auth){let{signInWithCustomToken:e}=await n.e(59997).then(n.bind(n,859997));await e(s.auth,t.customToken);return}}catch{}f(null),C(null),v(!0),g(!0)}},2e3):(f(null),C(null),v(!0),g(!0)),r=!1});return()=>{o(),e&&clearTimeout(e)}},[]);let[I,P]=(0,a.useState)(l);(0,a.useEffect)(()=>{if(!s.db||!m)return void(l&&!w?P(e=>e||l):P(null));let e=!1,t=(0,o.H9)(s.db,"users",m.uid);return(0,o.x7)(t).then(t=>{if(!e)if(t.exists()){let e=t.data();e._isMappingDoc&&e.clerkId?P(e.clerkId):P(m.uid)}else P(m.uid)}).catch(()=>{e||P(m.uid)}),()=>{e=!0}},[w,m,l]),(0,a.useEffect)(()=>{if(!m||!s.db||!I)return;x.current=!0;let e=["role","primaryOrganizationId","organizationId","orgRole","billingStatus","coachingStatus","coachingPlan","tier"],t=(0,o.H9)(s.db,"users",I),n=(0,o.aQ)(t,t=>{if(t.exists()){var n,r,a;let i,o,s,l,u,h=t.data();if(h._isMappingDoc)return;let f=(n=m,r=h,a=I,i=r.email||n.email||"",o=(0,d.np)(n.displayName||""),s=r.firstName||o.firstName,l=r.lastName||o.lastName,u=r.name||r.fullName||(0,d.ob)(s,l),{id:a||n.uid,firstName:s,lastName:l,fullName:u,imageUrl:(0,c.St)({id:a||n.uid,firstName:s,lastName:l,name:u,email:i,avatarUrl:r.avatarUrl,imageUrl:r.imageUrl,photoURL:n.photoURL,avatar:r.avatar}),email:i,emailAddresses:[{emailAddress:i}],primaryEmailAddress:i?{emailAddress:i}:null,publicMetadata:{role:r.role,primaryOrganizationId:r.primaryOrganizationId,organizationId:r.organizationId,orgRole:r.orgRole,tier:r.tier,billingStatus:r.billingStatus,billingPeriodEnd:r.billingPeriodEnd,coaching:r.coaching,coachingStatus:r.coachingStatus,coachingPlan:r.coachingPlan,coachingPeriodEnd:r.coachingPeriodEnd,coachId:r.coachId},createdAt:r.createdAt||"",updatedAt:r.updatedAt||""});C(e=>e&&JSON.stringify(e)===JSON.stringify(f)?e:f);let p={};for(let t of e)p[t]=h[t];x.current?(S.current=p,x.current=!1):S.current?e.some(e=>p[e]!==S.current[e])&&(S.current=p,k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{fetch("/api/auth/refresh-claims",{method:"POST"}).catch(()=>{})},500)):S.current=p}else C(b(m))},e=>{console.error("[AuthProvider] Firestore user listener error:",e),C(b(m))});return()=>
33{n(),k.current&&clearTimeout(k.current)}},[m,I]),(0,a.useEffect)(()=>{if(!m||!w)return;let e="__session_refreshed_at",t=async()=>{if((()=>{try{if(!document.cookie.includes("__session_hint="))return!1;let t=localStorage.getItem(e);if(!t)return!0;return Date.now()-parseInt(t,10)>=828e5}catch{return!1}})())try{let t=await m.getIdToken();(await fetch("/api/auth/refresh-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idToken:t})})).ok&&localStorage.setItem(e,String(Date.now()))}catch{}},n=setTimeout(t,5e3),r=setInterval(t,36e5),a=()=>{m.getIdToken().catch(()=>{}),t()};return window.addEventListener("coachful:network-recovered",a),()=>{clearTimeout(n),clearInterval(r),window.removeEventListener("coachful:network-recovered",a)}},[m,w]);let _=(0,a.useCallback)(async()=>{try{await fetch("/api/auth/sign-out",{method:"POST"})}catch(e){console.warn("[AuthProvider] Server sign-out failed (continuing):",e)}try{let e=new BroadcastChannel("auth_signout");e.postMessage("signout"),e.close()}catch{}if(Promise.all([n.e(77805),n.e(10958)]).then(n.bind(n,710958)).then(({clearOrgContext:e})=>{e()}).catch(()=>{}),s.auth)try{await (0,i.D)(s.auth)}catch(e){console.warn("[AuthProvider] Firebase signOut failed:",e)}f(null),P(null),C(null)},[]);(0,a.useEffect)(()=>{let e;try{(e=new BroadcastChannel("auth_signout")).onmessage=()=>{f(null),P(null),C(null),s.auth&&(0,i.D)(s.auth).catch(()=>{})}}catch{}return()=>{try{e?.close()}catch{}}},[]);let E=(0,a.useMemo)(()=>t?{publicMetadata:{role:t.role,primaryOrganizationId:t.primaryOrganizationId,organizationId:t.primaryOrganizationId,billingStatus:t.billingStatus,billingPeriodEnd:t.billingPeriodEnd,coachingStatus:t.coachingStatus,coachingPlan:t.coachingPlan,coachingPeriodEnd:t.coachingPeriodEnd}}:null,[t]),A=(0,a.useMemo)(()=>y?{publicMetadata:y.publicMetadata}:w?null:E,[w,E,y]),$=!!t&&!w,M=(0,a.useMemo)(()=>({userId:I||($?l:null)||m?.uid||null,isSignedIn:!!$||!!m,isLoaded:p,firebaseUser:m,user:y,sessionClaims:A,signOut:_}),[I,m,$,p,l,A,_,y]);return(0,r.jsx)(u.Provider,{value:M,children:e})}function m(){let e=(0,a.useContext)(u);return{userId:e.userId,isSignedIn:e.isSignedIn,isLoaded:e.isLoaded,firebaseUser:e.firebaseUser,sessionClaims:e.sessionClaims}}function f(){let e=(0,a.useContext)(u);return{user:e.user,isLoaded:e.isLoaded,isSignedIn:e.isSignedIn}}function p(){let e=(0,a.useContext)(u),t=(0,a.useCallback)(async()=>{let{clearCachedOrg:e}=await n.e(16962).then(n.bind(n,716962));e();let t=(0,l.JK)();if(t)try{localStorage.removeItem("coachful_native_app")}catch{}if(window.__coachful_signing_out=!0,t)try{let{deactivateDeviceToken:e}=await Promise.all([n.e(77805),n.e(43273),n.e(15925),n.e(74432),n.e(44421)]).then(n.bind(n,274432));await Promise.race([e(),new Promise(e=>setTimeout(e,1500))])}catch{}Promise.all([n.e(77805),n.e(10958)]).then(n.bind(n,710958)).then(({clearOrgContext:e})=>{e()}).catch(()=>{}),t?window.location.replace("/api/auth/sign-out?redirect=mobile"):window.location.replace("/api/auth/sign-out?redirect=sign-in")},[]);return{signOut:e.signOut,signOutAndRedirect:t}}function g(){let e=(0,a.useContext)(u);return{firebaseUser:e.firebaseUser,loading:!e.isLoaded,isAuthenticated:e.isSignedIn}}function b(e){let t=e.email||"",n=e.displayName||"",{firstName:r,lastName:a}=(0,d.np)(n);return{id:e.uid,firstName:r||"",lastName:a||"",fullName:n,imageUrl:(0,c.St)({id:e.uid,firstName:r||"",lastName:a||"",name:n,email:t,photoURL:e.photoURL}),email:t,emailAddresses:[{emailAddress:t}],primaryEmailAddress:t?{emailAddress:t}:null,publicMetadata:{},createdAt:"",updatedAt:""}}},793881:(e,t,n)=>{"use strict";n.d(t,{BG:()=>o,UF:()=>d,YX:()=>c,Zk:()=>s,a:()=>a,jz:()=>l});var r=n(911449);let a={tabs:["direct","main"],main:[],direct:[],directReorderedAt:null};function i(e){return Array.isArray(e)&&2===e.length&&e.includes("main")&&e.includes("direct")}function o(e){let t=e&&"object"==typeof e?e:{},n="string"==typeof t.directReorderedAt&&Number.isFinite(Date.parse(t.directReorderedAt))?t.directReorderedAt:null;return{tabs:i(t.tabs)?t.tabs:a.tabs,main:(0,r.Bw)(t.main),direct:(0,r.Bw)(t.direct),directReorderedAt:n}}function s(e,t,n){let r=e.indexOf(t),a=e.indexOf(n);return(r<0?e.length:r)-(a<0?e.length:a)}function l(e,t,n){let r=t.lastMessageTime?.getTime()??0,a=n.lastMessageTime?.getTime()??0,i=(Number.isFinite(a)?a:0)-(Number.isFinite(r)?r:0)||(t.key<n.key?-1:+(t.key>n.key)),o=Date.parse(e.directReorderedAt??"");if(!Number.isFinite(o))return i;let l=Number.isFinite(r)&&r>o;return l!==(Number.isFinite(a)&&a>o)?l?-1:1:l?i:s(e.direct,t.key,n.key)||i}function c(e){return e.startsWith("ai-coach-")?"ai_coach":e}function d(e,t,n,a=new Date().toISOString()){if("tabs"===t)return i(n)?{...e,tabs:n}:e;let o={...e,[t]:(0,r.gn)(e[t],n)};return"direct"===t?{...o,directReorderedAt:a}:o}},805069:(e,t,n)=>{"use strict";n.d(t,{LK:()=>r,WF:()=>o,yu:()=>s});let r="coachful:product-session-changed",a=new Map,i=new Map;function o(e,t){return i.get(e)===t}function s(e,t=!1){if(!e)return"";let n=`coachful:product-visit:${e}`,o=a.get(e);try{let t=JSON.parse(window.localStorage.getItem(n)||"null");t&&"string"==typeof t.id&&/^[a-zA-Z0-9-]{1,80}$/.test(t.id)&&"number"==typeof t.lastActivityAt&&Number.isFinite(t.lastActivityAt)&&(o=t,i.set(e,t.id))}catch{}let l=Date.now(),c=a.get(e)?.id,d=o&&l-o.lastActivityAt>=18e5;if(!o||t&&d?o={id:"function"==typeof window.crypto?.randomUUID?window.crypto.randomUUID():`${l}-${Math.random().toString(36).slice(2)}`,lastActivityAt:l}:t&&(o={...o,lastActivityAt:l}),a.set(e,o),t)try{window.localStorage.setItem(n,JSON.stringify(o)),i.set(e,o.id)}catch{i.delete(e)}return c!==o.id&&window.dispatchEvent(new Event(r)),o.id}}
33,829412:(e,t,n)=>{"use strict";n.d(t,{g:()=>a,h:()=>r});let r="coachful:open-offer-sheet";function a(e="bundle_lite",t){window.dispatchEvent(new CustomEvent(r,{detail:{offer:e,eventId:t}}))}},830561:(e,t,n)=>{"use strict";n.d(t,{G:()=>a});var r=n(212115);function a(e,{enabled:t=!0,animateOnMount:n=!1}={}){let i=(0,r.useRef)(null),o=(0,r.useRef)(e);return(0,r.useLayoutEffect)(()=>{let r=n||o.current!==e;if(o.current=e,!t||!r||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let a=i.current?.animate?.([{opacity:.72},{opacity:1}],{duration:160,easing:"cubic-bezier(0.22, 1, 0.36, 1)"});return()=>a?.cancel()},[n,e,t]),i}},837511:(e,t,n)=>{"use strict";function r(){try{let e=window.Capacitor;if(e?.isNativePlatform?.())return!0;return"u">typeof navigator&&navigator.userAgent.includes("CoachfulNativeApp")}catch{return!1}}n.d(t,{JK:()=>r,bd:()=>i});let a=/CoachfulBranded\/([\w.-]+)/;function i(){return null!==function(){if("u"<typeof navigator)return null;try{let e=navigator.userAgent.match(a);return e?.[1]??null}catch{return null}}()}},859228:(e,t,n)=>{"use strict";n.d(t,{Id:()=>o,bT:()=>i,uI:()=>a});let r=/^(?:\(\d+\)\s*)+/;function a(e){return e.replace(r,"")}function i(e,t){let n=a(t);return e>0?`(${e}) ${n}`:n}function o(e,t){}},869690:(e,t,n)=>{"use strict";n.d(t,{ConditionalMain:()=>u});var r=n(695155),a=n(212115),i=n(573321),o=n(784961),s=n(153416),l=n(792939),c=n(32087),d=n(961703);function u({children:e,layoutMode:t}){let n=(0,i.usePathname)(),h=(0,i.useSearchParams)(),[m,f]=(0,a.useState)(!1),p=(0,a.useRef)(!1),{isAuthenticatedHint:g}=(0,s.V)(),{isSignedIn:b,isLoaded:w}=(0,l.useAppAuth)(),{isDemoSite:v}=(0,c._)(),y=(0,a.useRef)(n),C=n!==y.current,S="/"===n&&h?.get("preview")==="true";(0,a.useEffect)(()=>{if(!p.current){p.current=!0;return}window.scrollTo({top:0,behavior:"auto"})},[n]),(0,a.useEffect)(()=>{let e=window.location.hostname;f(("coachful.co"===e||"www.coachful.co"===e)&&"/"===n)},[n]);let k=!C&&"fullscreen"===t&&!("/"===n&&g&&!S),x=(0,o.j)(n,(w?b:g)||v);return(0,o.m)(n)&&!x||(0,d.tY)(n)||m||S||k?(0,r.jsx)(r.Fragment,{children:e}):(0,r.jsx)("main",{className:"main-content-safe",children:e})}},878025:(e,t,n)=>{"use strict";n.d(t,{IncomingCallHandler:()=>d});var r=n(695155),a=n(337206),i=n(212115),o=n(792939),s=n(153416),l=n(616208);let c=(0,a.default)(()=>Promise.all([n.e(13854),n.e(61766),n.e(31332),n.e(48757),n.e(87416)]).then(n.bind(n,187416)).then(e=>e.IncomingCallSurface),{loadableGenerated:{webpack:()=>[187416]},ssr:!0});function d(){let{isSignedIn:e}=(0,o.useAppAuth)(),{isAuthenticatedHint:t}=(0,s.V)(),{incomingCallData:n,activeCall:a}=(0,l.g7)(),d=(0,i.useRef)(!1);return(e||t||n||a)&&(d.current=!0),d.current?(0,r.jsx)(c,{}):null}},884889:(e,t,n)=>{"use strict";n.d(t,{C:()=>a});var r=n(997389);function a(){return(0,r.z)()}},897267:(e,t,n)=>{"use strict";n.d(t,{ConditionalSidebar:()=>f});var r=n(695155),a=n(573321),i=n(212115),o=n(337206),s=n(153416),l=n(792939),c=n(32087),d=n(784961),u=n(961703);let h=(0,o.default)(()=>Promise.all([n.e(22126),n.e(75139),n.e(9683),n.e(61108),n.e(81901),n.e(4498),n.e(35524),n.e(97019),n.e(818),n.e(7517),n.e(35887),n.e(88099),n.e(33763),n.e(28087)]).then(n.bind(n,478623)).then(e=>e.Sidebar),{loadableGenerated:{webpack:()=>[478623]},ssr:!0});class m extends i.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("[SidebarErrorBoundary] Sidebar rendering error:",e,t)}render(){return this.state.hasError?(console.error("[SidebarErrorBoundary] Error caught:",this.state.error?.message),null):this.props.children}}function f({layoutMode:e}){let t=(0,a.usePathname)(),n=(0,a.useSearchParams)(),{isAuthenticatedHint:o}=(0,s.V)(),{isSignedIn:p,isLoaded:g}=(0,l.useAppAuth)(),{isDemoSite:b}=(0,c._)(),w=(0,i.useRef)(t),v=t!==w.current,y="/profile"===t&&n?.get("edit")==="true"&&n?.get("fromOnboarding")==="true",C=("coachful.co"===window.location.hostname||"www.coachful.co"===window.location.hostname)&&"/"===t,S="/"===t&&n?.get("preview")==="true",k=!v&&"fullscreen"===e&&!("/"===t&&o&&!S),x=S||k||(0,u.tY)(t)||t?.startsWith("/onboarding")||t?.startsWith("/start")||t?.startsWith("/checkin")||t?.startsWith("/join")||t?.startsWith("/sign-in")||t?.startsWith("/coach/onboarding")||t?.startsWith("/coach/welcome")||t?.startsWith("/website")||t?.startsWith("/blog")||"/upgrade-premium/form"===t||"/get-coach/form"===t||t?.startsWith("/invite")||t?.startsWith("/refund-policy")||t?.startsWith("/terms")||t?.startsWith("/privacy")||t?.startsWith("/ai-policy")||t?.startsWith("/support")||t?.startsWith("/find-a-coac
33h")||t?.startsWith("/marketplace")||t?.startsWith("/room/")||y,I=g?p:o,P=(0,d.j)(t,I||b);return(0,d.m)(t)&&!P||C||x||!I&&!b?null:(0,r.jsx)(m,{children:(0,r.jsx)(h,{layoutMode:e})})}},901427:(e,t,n)=>{"use strict";n.d(t,{p:()=>r.a5});var r=n(934770)},903473:(e,t,n)=>{"use strict";n.d(t,{StreamChatProvider:()=>S,b:()=>k});var r=n(695155),a=n(450910),i=n(466609),o=n(413848),s=n(212115),l=n(792939),c=n(837511),d=n(103238),u=n(99523);let h=(0,s.createContext)({client:null,isConnecting:!1,isConnected:!1,error:null,connectNow:async()=>{}}),m=null,f=null,p=null,g=null,b="coachful-stream-token:v2:";function w(e){try{window.sessionStorage.removeItem(`${b}${e}`)}catch{}}async function v(e){w(e);let t=m;if(m=null,p=null,f=null,t?.user?.id===e||t?.userID===e)try{await t.disconnectUser()}catch{}}function y(e){if(e?.wsFallback?.isHealthy())return!0;let t=e?.wsConnection;return!!(t?.isHealthy&&(!t.lastEvent||Date.now()-t.lastEvent.getTime()<6e4))}function C(e){return!!(m?.user?.id===e&&p===e&&y(m))}function S({children:e}){let{user:t,isLoaded:k}=(0,l.useAppUser)(),[x,I]=(0,s.useState)(m),[P,_]=(0,s.useState)(!1),[E,A]=(0,s.useState)(!!(m?.user&&y(m))),[$,M]=(0,s.use
33State)(null),j=(0,s.useRef)(!1),T=(0,s.useRef)(!1),N=(0,s.useRef)(async()=>{}),q=(0,s.useRef)(t?.id);q.current=t?.id;let D=(0,s.useRef)(!0),U=(0,s.useRef)(null),R=(0,s.useRef)(null),L=(0,s.useRef)(null);(0,s.useEffect)(()=>(D.current=!0,()=>{D.current=!1,T.current=!1}),[]);let O=(0,s.useCallback)(async(e,t)=>{let r=`${t.firstName||""} ${t.lastName||""}`.trim()||"User",a=t.imageUrl;if(C(e)&&m){let t=m.user;if(!t)return m;if(t.name!==r||t.image!==a){console.log("[StreamChatContext] Profile changed, updating Stream user...",{oldName:t.name,newName:r,oldImage:t.image?.substring(0,50),newImage:a?.substring(0,50)});try{await m.upsertUser({id:e,name:r,image:a}),await m.partialUpdateUser({id:e,set:{name:r,image:a}}),console.log("[StreamChatContext] Profile updated successfully")}catch(e){console.error("[StreamChatContext] Failed to update profile:",e)}}return m}return f&&p===e?f:(p=e,f=(async()=>{try{let t="6txru2rm6dy2";if(!t)throw Error("Stream API key not found");let i=()=>fetch("/api/stream-token").then(async t=>{if(!t.ok)throw Error("Failed to fetch Stream token");let n=await t.json();if("revoked"===n.streamAccess)return await v(e),D.current&&q.current===e&&(I(null),A(!1),M(null)),null;if(!n.token)return null;let r=n.token;try{window.sessionStorage.setItem(`${b}${e}`,JSON.stringify({token:r,cachedAt:Date.now()}))}catch{}return{token:r,fromCache:!1}}),o=()=>{let t=function(e){try{let t=window.sessionStorage.getItem(`${b}${e}`);if(!t)return null;let n=JSON.parse(t);if("string"!=typeof n.token||"number"!=typeof n.cachedAt||Date.now()-n.cachedAt>864e5)return window.sessionStorage.removeItem(`${b}${e}`),null;return n.token}catch{return null}}(e);if(!t)return i();let n=i();return n.catch(()=>null),Promise.resolve({token:t,fromCache:!0,refreshPromise:n})},s=m?.user?.id===e&&m.userID===e?null:o();s&&s.catch(()=>null);let{StreamChat:l}=await Promise.all([n.e(42890),n.e(87005),n.e(61766),n.e(5474)]).then(n.bind(n,137587)),c=l.getInstance(t);c.user&&c.user.id!==e&&(w(c.user.id),await c.disconnectUser());let d=c.user?.id===e&&c.userID===e,u=d&&y(c);if(d&&!u){let e;c.wsConnection?.isHealthy&&await c.closeConnection(1e3),await c.openConnection();let t=!1,n=c.recoverState().then(()=>{t=!0}).catch(e=>{console.warn("[StreamChatContext] Channel recovery deferred:",e)});if(await Promise.race([n,new Promise(t=>{e=setTimeout(t,1500)})]),e&&clearTimeout(e),!y(c))throw Error("Stream connection did not recover");t||c.dispatchEvent({type:"connection.recovered"})}else if(d){let t=c.user;if(t&&(t.name!==r||t.image!==a)){console.log("[StreamChatContext] Updating user profile in Stream...");try{await c.upsertUser({id:e,name:r,image:a})}catch(e){console.error("[StreamChatContext] Failed to update profile (non-blocking):",e)}}}else{if(c.user||c.userID)try{await c.disconnectUser()}catch{}let t=await (s??o());if(!t)return f=null,p=null,null;let{token:n}=t,i={id:e,name:r,image:a};try{await c.connectUser(i,n)}catch(o){let n,r;if(!t.fromCache||(n="object"==typeof o&&null!==o&&"code"in o?Number(o.code):NaN,r=o instanceof Error?o.message.toLowerCase():String(o||"").toLowerCase(),!([40,41,42].includes(n)||r.includes("token")||r.includes("jwt"))))throw o;w(e);let a=await t.refreshPromise;if(!a)throw o;await c.connectUser(i,a.token)}fetch("/api/chat/join-global-channels",{method:"POST"}).catch(()=>{})}return m=c,f=null,c}catch(t){throw console.error("[StreamChatContext] Connection error:",t),(m?.user?.id!==e||m.userID!==e)&&(m=null,p=null),f=null,t}})())},[]),B=(0,s.useCallback)(async()=>{if(!D.current||!t||q.current!==t.id)return;if(j.current){T.current=!0,f&&await f.catch(()=>null);return}let e=g;if(e){if(await e,g===e&&(g=null),!D.current||q.current!==t.id)return;if(j.current){T.current=!0,f&&await f.catch(()=>null);return}}if(C(t.id)&&m){I(m),A(!0);return}if(U.current&&(clearTimeout(U.current),U.current=null),L.current?.(),L.current=null,null!==R.current){let e=window;e.cancelIdleCallback?.(R.current),R.current=null}let n=m?.user?.id===t.id&&m.userID===t.id;return j.current=!0,n||_(!0),M(null),O(t.id,{firstName:t.firstName,lastName:t.lastName,imageUrl:t.imageUrl}).then(e=>{D.current&&e&&q.current===t.id&&(I(e),A(!0))}).catch(e=>{D.current&&q.current===t.id&&(n?console.warn("[StreamChatContext] Backgroun
33d reconnect deferred:",e):(M(e instanceof Error?e.message:"Connection failed"),A(!1)))}).finally(()=>{D.current&&!n&&_(!1),j.current=!1,T.current&&(T.current=!1,D.current&&"hidden"!==document.visibilityState&&N.current())})},[t,O]);N.current=B;let W=(0,s.useCallback)(()=>B(),[B]);(0,s.useEffect)(()=>{if(!x||!t)return;let e=()=>{x.user?.id===t.id&&(m=x,p=t.id,I(x),A(!0),M(null))},n=t=>{t.online&&e()};return x.on("connection.changed",n),x.on("connection.recovered",e),()=>{x.off("connection.changed",n),x.off("connection.recovered",e)}},[x,t]),(0,s.useEffect)(()=>{let e,r=!1,a=(0,c.JK)(),i=null,o=null,s=()=>{o&&(clearTimeout(o),o=null)},l=(e=!1)=>!r&&(e||"hidden"!==document.visibilityState)&&t?B():Promise.resolve(),d=()=>{if(o=null,r||!a&&"hidden"!==document.visibilityState)return;let e=m;!g&&e?.user&&e.user.id===t?.id&&(g=e.closeConnection(1e3).catch(e=>{console.debug("[StreamChatContext] Background socket close skipped:",e)}))},h=()=>{(s(),a)?d():o=setTimeout(d,6e4)},f=(e=!1)=>{let t=g;return t?t.finally(()=>{g===t&&(g=null)}).then(()=>l(e)):l(e)},p=()=>{s(),f()},b=()=>{f()},w=()=>{"hidden"!==document.visibilityState||a&&!0===i?"visible"!==document.visibilityState||a&&!1===i||p():h()};return window.addEventListener("coachful:network-recovered",b),window.addEventListener("online",b),window.addEventListener("focus",p),window.addEventListener("pageshow",p),document.addEventListener("visibilitychange",w),"hidden"===document.visibilityState&&h(),a&&Promise.all([n.e(77805),n.e(47714)]).then(n.bind(n,325333)).then(({App:e})=>e.addListener("appStateChange",({isActive:e})=>{if(i=e,e){let e;s(),e=!!(!g&&t&&C(t.id)),f(!0).then(()=>{e&&!r&&t&&C(t.id)&&window.dispatchEvent(new Event(u.C))}).catch(e=>{console.warn("[StreamChatContext] Native foreground reconnect deferred:",e)})}else h()})).then(t=>{r?t.remove():e=()=>{t.remove()}}).catch(()=>{}),()=>{r=!0,s(),window.removeEventListener("coachful:network-recovered",b),window.removeEventListener("online",b),window.removeEventListener("focus",p),window.removeEventListener("pageshow",p),document.removeEventListener("visibilitychange",w),e?.()}},[t,B]),(0,s.useEffect)(()=>{if(!k)return;if(!t){try{let e=[];for(let t=0;t<window.sessionStorage.length;t+=1){let n=window.sessionStorage.key(t);n?.startsWith(b)&&e.push(n)}e.forEach(e=>window.sessionStorage.removeItem(e))}catch{}m&&(m.user?.id&&w(m.user.id),m.disconnectUser().catch(console.error),m=null,f=null,p=null),I(null),A(!1);return}if(j.current){T.current=!0;return}if(C(t.id)&&m){I(m),A(!0);return}let e=(0,c.JK)()||(0,d.zd)(window.location.pathname);return L.current=(0,d.Oq)(B,{priority:e?"user-visible":"background",timeoutMs:e?750:4e3}),()=>{if(L.current?.(),L.current=null,U.current&&(clearTimeout(U.current),U.current=null),null!==R.current){let e=window;e.cancelIdleCallback?.(R.current),R.current=null}}},[t,k,B]),(0,s.useEffect)(()=>()=>{},[]);let F=(0,s.useMemo)(()=>({client:x,isConnecting:P,isConnected:E,error:$,connectNow:W}),[x,P,E,$,W]),V=(0,a.c)("cohortTools");return(0,s.useEffect)(()=>{if(!x)return;let e=x.on("notification.reminder_due",e=>{let t=e.reminder;t&&t.user_id===x.userID&&(0,i.toast)(V("reminderDue"),{description:t.message?.text,duration:15e3,action:{label:V("openMessage"),onClick:()=>{window.location.assign((0,o.Xu)(t.channel_cid.split(":").slice(1).join(":"),{messageId:t.message_id,threadId:t.message?.parent_id}))}}})});return()=>e.unsubscribe()},[x,V]),(0,r.jsx)(h.Provider,{value:F,children:e})}function k(){let e=(0,s.useContext)(h);if(void 0===e)throw Error("useStreamChatClient must be used within a StreamChatProvider");return e}window.addEventListener("unhandledrejection",e=>{let t=e.reason?.message||String(e.reason||"");(t.includes("GetOrCreateChannel")||t.includes("ReadChannel")||t.includes("not allowed to perform action"))&&(e.preventDefault(),console.debug("[StreamChat] Suppressed permission error:",t))})},910792:(e,t,n)=>{"use strict";n.d(t,{A9:()=>a,Bw:()=>l,Cq:()=>s,HI:()=>i,Tq:()=>r,wY:()=>o});let r=["overview","programs","fitness","sessions","progress","documents","plan"],a="overview",i=["pre_session_worksheet","worksheets_forms","session_file","coach_file","content","agreements_b
33illing"],o={pre_session_worksheet:["pre_session_worksheet"],worksheets_forms:["worksheet","form"],session_file:["session_file"],coach_file:["coach_file"],content:["content"],agreements_billing:["agreement","invoice"]};function s(e){switch(e){case"worksheet":case"form":return"worksheets_forms";case"agreement":case"invoice":return"agreements_billing";default:return e}}let l={pre_session_worksheet:0,worksheet:0,form:0,session_file:0,coach_file:0,agreement:0,invoice:0,content:0}},911449:(e,t,n)=>{"use strict";n.d(t,{Bw:()=>s,EW:()=>r,Wk:()=>l,Wp:()=>o,gn:()=>c,kj:()=>a});let r="ai_coach",a="promo",i={aiCoach:0,squad:1,orphanSquad:2,feedChat:3,orgChannel:4,promo:5};function o(e){if(!Array.isArray(e)||e.length>500)return null;let t=new Set;for(let n of e){if("string"!=typeof n)return null;let e=n.trim();if(!e||e.length>128)return null;t.add(e)}return[...t]}function s(e){return o(e)??[]}function l(e){let t=new Map((e??[]).map((e,t)=>[e,t])),n=e?.length??0;return(e,r)=>{let a=t.get(e);return void 0===a?n+i[r]:a}}function c(e,t){let n=new Set(t),r=[];e.forEach((e,t)=>{n.has(e)&&r.push(t)});let a=[...e],i=t.filter(e=>n.has(e));r.forEach((e,t)=>{t<i.length&&(a[e]=i[t])});let o=new Set(a);for(let e of i)o.has(e)||(a.push(e),o.add(e));return a.slice(0,500)}},915671:(e,t,n)=>{"use strict";n.d(t,{AssistantProvider:()=>h,w:()=>m});var r=n(695155),a=n(212115),i=n(337206),o=n(32087),s=n(256708),l=n(930372);let c=(0,i.default)(()=>Promise.all([n.e(38437),n.e(42695),n.e(75139),n.e(9683),n.e(61108),n.e(40777),n.e(78638),n.e(57030),n.e(90879),n.e(60712),n.e(60415)]).then(n.bind(n,81142)).then(e=>({default:e.AssistantPanel})),{loadableGenerated:{webpack:()=>[81142]},ssr:!1}),d=(0,a.createContext)({isOpen:!1,openAssistant:async()=>{},closeAssistant:()=>{},messages:[],pendingActions:[],isLoading:!1,statusMessage:null,conversationId:null,conversations:[],proactiveNudge:null,initialSetupCreditProtected:!1,sendMessage:async()=>{},confirmAction:async()=>{},rejectAction:async()=>{},startNewConversation:()=>{},resetMichelle:async()=>{},loadConversation:async()=>{},fetchConversations:async()=>{},checkProactiveNudge:async()=>{},dismissProactiveNudge:async()=>{}}),u=[{id:"demo_1",role:"user",content:"Who needs my attention this week?",timestamp:new Date(Date.now()-72e5).toISOString()},{id:"demo_2",role:"assistant",content:`You've got 3 clients that could use a check-in:
34
35- **Sarah Chen** hasn't logged in for 5 days and missed her last two habit check-ins. She was on a great streak before that.
36- **Marcus Rivera** finished Week 4 of Focus Mastery yesterday but hasn't started Week 5 yet. Might need a nudge.
37- **Jamie Park** has a call with you tomorrow but hasn't filled out their pre-session form.
38
39Want me to send nudges to any of them?`,timestamp:new Date(Date.now()-72e5+5e3).toISOString()},{id:"demo_3",role:"user",content:"Send a nudge to Sarah and Marcus",timestamp:new Date(Date.now()-54e5).toISOString()},{id:"demo_4",role:"assistant",content:`Done! I sent personalized nudges to both:
40
41- **Sarah** got a gentle "we miss you" message referencing her 14-day streak
42- **Marcus** got a congrats on finishing Week 4 with an encouragement to dive into Week 5
43
44Anything else?`,timestamp:new Date(Date.now()-54e5+4e3).toISOString()},{id:"demo_5",role:"user",content:"How is my revenue looking this month?",timestamp:new Date(Date.now()-36e5).toISOString()},{id:"demo_6",role:"assistant",content:`You're at **$4,280** so far this month, which is 68% of your $6,300 goal. Here's the breakdown:
45
46- **Focus Mastery Program** - $2,400 (8 enrollments at $299)
47- **1:1 Coaching** - $1,500 (3 clients)
48- **Morning Momentum** - $380 (4 enrollments at $95)
49
50You're on track to beat last month's $5,100. Nice momentum!`,timestamp:new Date(Date.now()-36e5+5e3).toISOString()},{id:"demo_7",role:"user",content:"Create a blog post about building morning routines",timestamp:new Date(Date.now()-18e5).toISOString()},{id:"demo_8",role:"assistant",content:`I wrote a blog post called **"The 5-Minute Morning Routine That Actually Sticks"**. It covers why most routines fail, a simple framework for building one that lasts, and 3 quick wins your clients can start tomorrow.
51
52It's saved as a draft in your blog. Want me to publish it now or would you like to review it first?`,timestamp:new Date(Date.now()-18e5+6e3).toISOString()},{id:"demo_9",role:"user",content:"Publish it!",timestamp:new Date(Date.now()-15e5).toISOString()},{id:"demo_10",role:"assistant",content:"Nice, that's live now! Your clients will see it in their feed. Here's what I'd suggest next: want me to create a funnel that drives traffic to your Morning Momentum program from this post?",timestamp:new Date(Date.now()-15e5+3e3).toISOString()},{id:"demo_11",role:"user",content:"Yeah do it",timestamp:new Date(Date.now()-12e5).toISOString()},{id:"demo_12",role:"assistant",content:`All set! I created a 3-step funnel called **"Morning Momentum Funnel"**:
53
541. **Landing page** with the blog post as the hook
552. **Opt-in page** offering a free "5-Day Morning Challenge" PDF
563. **Sales page** for your Morning Momentum program at $95
57
58The funnel is live and linked from your blog post. You can customize the pages anytime from your Funnels tab.`,timestamp:new Date(Date.now()-12e5+5e3).toISOString()}];function h({children:e}){let{isDemoMode:t}=(0,o._)(),[n,i]=(0,a.useState)(!1),[m,f]=(0,a.useState)([]),[p,g]=(0,a.useState)([]),b=(0,a.useRef)([]);b.current=p;let[w,v]=(0,a.useState)(!1),[y,C]=(0,a.useState)(null),[S,k]=(0,a.useState)(null),[x,I]=(0,a.useState)([]),[P,_]=(0,a.useState)(null),[E,A]=(0,a.useState)(!1),$=(0,a.useRef)(null),M=(0,a.useRef)(null),j=(0,a.useRef)(!1),T=(0,a.useRef)(null),N=(0,a.useRef)(null),q=(0,a.useRef)(null),D=(0,a.useCallback)(e=>{M.current=e,k(e)},[]),U=(0,a.useCallback)(e=>{N.current=e,e&&(q.current=e.conversationId),_(e)},[]),R=(0,a.useCallback)(async()=>{let e=N.current;U(null),e&&M.current===e.conversationId&&f(t=>(0,s.T)(t,e.message));try{await fetch("/api/coach/assistant/proactive",{method:"PATCH"})}catch(e){}},[U]),L=(0,a.useCallback)(async function e(){if(!t){T.current&&(clearTimeout(T.current),T.current=null);try{var n;let t=await fetch("/api/coach/assistant/proactive",{cache:"no-store"});if(!t.ok)return;let r=await t.json(),a=(n=r.assistantMessage)&&"object"==typeof n&&"string"==typeof n.id&&("assistant"===n.role||"user"===n.role)&&"string"==typeof n.content&&"string"==typeof n.timestamp?r.assistantMessage:"string"!=typeof r.message||"string"!=typeof r.messageId?null:{
58id:r.messageId,role:"assistant",content:r.message,timestamp:"string"==typeof r.messageTimestamp?r.messageTimestamp:new Date().toISOString()};!0===r.unread&&"string"==typeof r.conversationId&&a&&(j.current&&M.current===r.conversationId?(f(e=>(0,s.T)(e,a)),R()):U({conversationId:r.conversationId,message:a,preview:"string"==typeof r.preview?r.preview:a.content}));let i=Number(r.retryAfterMs);Number.isFinite(i)&&i>0&&(T.current=setTimeout(()=>void e(),Math.min(i,36e5)))}catch(e){}}},[R,t,U]);(0,a.useEffect)(()=>()=>{T.current&&clearTimeout(T.current)},[]);let O=(0,a.useCallback)(async()=>{if(j.current=!0,i(!0),t){f(u),A(!1),D("demo");return}if(w)return;v(!0);let e=!1;try{let t=await fetch("/api/coach/assistant",{cache:"no-store"});if(t.ok){let n=(await t.json()).conversations||[];I(n);let r=N.current,a=r?.conversationId||q.current,i=M.current?n.find(e=>e.id===M.current):null,o=a||i?.id||n[0]?.id;if(o){D(o);try{let t=await fetch(`/api/coach/assistant/${o}`,{cache:"no-store"});if(t.ok){let n=await t.json();f(n.messages||[]),g((n.pendingActions||[]).filter(e=>"pending"===e.status)),A(n.initialSetup?.platformFunded===!0&&Number(n.initialSetup?.guidedModelTurnsRemaining)>0),o===a&&(q.current=null),e=o===r?.conversationId}}catch(e){}}else f([]),g([]),A(!1),D(null)}}catch(e){}finally{v(!1)}e&&R()},[R,t,w,D]),B=(0,a.useCallback)(()=>{j.current=!1,i(!1)},[]),W=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/coach/assistant");if(e.ok){let t=await e.json();I(t.conversations||[])}}catch(e){}},[]),F=(0,a.useCallback)(async(e,t)=>{let n=e.body?.getReader();if(!n)return;let r=new TextDecoder,a="",i="",o="";try{for(;;){if(t?.aborted)return void await n.cancel();let{done:e,value:s}=await n.read();if(e)break;let c=(a+=r.decode(s,{stream:!0})).split(`
59`);for(let e of(a=c.pop()||"",c))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));switch(t.type){case"status":C(t.message);break;case"text_delta":if(C(null),!(i+=t.text).trim())break;o||(o=`msg_${Date.now()}_stream`),f(e=>{let t=[...e],n=t.findIndex(e=>e.id===o);return n>=0?t[n]={...t[n],content:i}:t.push({id:o,role:"assistant",content:i,timestamp:new Date().toISOString()}),t});break;case"tool_call":C("Michelle is checking your Coachful data…"),i&&(i="",o="");break;case"tool_result":window.dispatchEvent(new CustomEvent(l.EM,{detail:{toolName:t.toolName,success:t.success}})),C("Michelle is putting this together…"),i="",o="";break;case"confirmation_request":C(null),g(e=>[...e,...t.actions]),i="",o="";break;case"actions_invalidated":{let e=new Set(t.actionIds);g(t=>t.filter(t=>!e.has(t.id)));break}case"done":C(null);break;case"error":C(null),"action_failed"===t.code&&g(e=>e.map(e=>"confirmed"===e.status?{...e,status:"pending"}:e)),f(e=>[...e,{id:`msg_${Date.now()}_error`,role:"assistant",content:t.message,timestamp:new Date().toISOString(),errorCode:t.code}])}}catch(e){}}}finally{n.releaseLock()}},[]),V=(0,a.useCallback)(async(e,n,r)=>{if(!e.trim()&&!n?.length||w||t)return;$.current?.abort(),$.current=new AbortController,r?.initialSetupConsultation&&(q.current=null,U(null));let a={id:`msg_${Date.now()}_user`,role:"user",content:e,imageUrls:n?.length?n:void 0,timestamp:new Date().toISOString()};f(e=>[...e,a]),C("Michelle is getting your workspace ready…"),v(!0);try{let t=await fetch("/api/coach/assistant",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:M.current,message:e,imageUrls:n?.length?n:void 0,...r?.initialSetupConsultation?{initialSetupConsultation:!0}:{},...r?.brainContext?{brainContext:r.brainContext}:{}}),signal:$.current.signal}),a=t.headers.get("X-Conversation-Id");if(A("1"===t.headers.get("X-Initial-Setup-Credit-Protected")),a&&a!==M.current&&(D(a),W()),!t.ok){let e=await t.json().catch(()=>({error:"I couldn't finish that response. Your message is safe — tap Retry.",code:"assistant_unavailable"}));f(t=>[...t,{id:`msg_${Date.now()}_error`,role:"assistant",content:e.error||"I couldn't finish that response. Your message is safe — tap Retry.",timestamp:new Date().toISOString(),errorCode:e.code||"assistant_unavailable"}]);return}await F(t,$.current?.signal)}catch(e){"AbortError"!==e.name&&f(e=>[...e,{id:`msg_${Date.now()}_error`,role:"assistant",content:"Connection lost. Try sending your message again.",timestamp:new Date().toISOString(),errorCode:"connection_lost"}])}finally{C(null),v(!1)}},[t,w,F,D,U,W]),z=(0,a.useCallback)(async e=>{C("Michelle is applying that change…"),v(!0),$.current?.abort(),$.current=ne
59w AbortController;let t=b.current.find(t=>t.id===e)?.toolName;g(t=>t.map(t=>t.id===e?{...t,status:"confirmed"}:t));try{let n=await fetch("/api/coach/assistant",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:M.current,message:"",confirmedActions:[e]}),signal:$.current.signal});if(A("1"===n.headers.get("X-Initial-Setup-Credit-Protected")),n.ok)await F(n,$.current?.signal),window.dispatchEvent(new CustomEvent(l.EM,{detail:{toolName:t,success:!0,confirmed:!0}})),g(t=>t.filter(t=>t.id!==e));else{let t=await n.json().catch(()=>({error:"Something went wrong"}));console.error("[Assistant] Confirm action failed:",n.status,t),g(t=>t.map(t=>t.id===e?{...t,status:"pending"}:t));let r=401===n.status?"Your session may have expired. Try refreshing the page.":"That didn't go through. You can try confirming again.";f(e=>[...e,{id:`msg_${Date.now()}_error`,role:"assistant",content:r,timestamp:new Date().toISOString()}])}}catch(t){if("AbortError"===t.name)return;g(t=>t.map(t=>t.id===e?{...t,status:"pending"}:t)),f(e=>[...e,{id:`msg_${Date.now()}_error`,role:"assistant",content:"Failed to execute that action. Try again.",timestamp:new Date().toISOString()}])}finally{C(null),v(!1)}},[F]),H=(0,a.useCallback)(async e=>{let n=p.find(t=>t.id===e);if(g(t=>t.filter(t=>t.id!==e)),f(e=>[...e,{id:`msg_${Date.now()}_rejected`,role:"assistant",content:"Got it, I won't do that. Anything else?",timestamp:new Date().toISOString()}]),!t&&M.current)try{let t=await fetch("/api/coach/assistant",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversationId:M.current,message:"",rejectedActions:[e]})});if(!t.ok)throw Error("Reject action failed");let n=await t.json();g((n.pendingActions||[]).filter(e=>"pending"===e.status))}catch(e){n&&g(e=>e.some(e=>e.id===n.id)?e:[...e,n]),f(e=>[...e,{id:`msg_${Date.now()}_reject_error`,role:"assistant",content:"I couldn't save that skip. Try again.",timestamp:new Date().toISOString()}])}},[t,p]),J=(0,a.useCallback)(()=>{$.current?.abort(),q.current=null,f([]),g([]),C(null),A(!1),D(null),v(!1)},[D]),K=(0,a.useCallback)(async()=>{if(w)throw Error("Michelle is still responding");if(!(await fetch("/api/coach/assistant/reset",{method:"POST"})).ok)throw Error("Failed to reset Michelle");
59$.current?.abort(),q.current=null,U(null),I([]),J()},[w,J,U]),G=(0,a.useCallback)(async e=>{$.current?.abort(),q.current=null,D(e),f([]),g([]),C(null),v(!0);try{let t=await fetch(`/api/coach/assistant/${e}`);if(t.ok){let e=await t.json();f(e.messages||[]),g((e.pendingActions||[]).filter(e=>"pending"===e.status)),A(e.initialSetup?.platformFunded===!0&&Number(e.initialSetup?.guidedModelTurnsRemaining)>0)}}catch(e){}finally{v(!1)}},[D]);return(0,r.jsxs)(d.Provider,{value:{isOpen:n,openAssistant:O,closeAssistant:B,messages:m,pendingActions:p,isLoading:w,statusMessage:y,conversationId:S,conversations:x,proactiveNudge:P,initialSetupCreditProtected:E,sendMessage:V,confirmAction:z,rejectAction:H,startNewConversation:J,resetMichelle:K,loadConversation:G,fetchConversations:W,checkProactiveNudge:L,dismissProactiveNudge:R},children:[e,(0,r.jsx)(c,{})]})}function m(){let e=(0,a.useContext)(d);if(!e)throw Error("useAssistant must be used within an AssistantProvider");return e}},922817:(e,t,n)=>{"use strict";n.d(t,{EE:()=>s,H0:()=>a,OC:()=>l,dX:()=>i});let r=["blog","submissions","newsletter"];function a(e){return!!e&&r.includes(e)}let i={brain:"create",clients:"coach",prospects:"sell",intakes:"sell",webinars:"sell",team:"manage",projects:"manage","ai-coach":"manage",offers:"sell",products:"sell",orders:"sell",bundles:"sell",squads:"coach",programs:"create","client-journey":"create",referrals:"sell",analytics:"manage",diagnostics:"sell",discounts:"sell",discover:"create","upgrade-forms":"sell","coaching-forms":"sell",funnels:"sell",ecosystem:"sell",website:"create",links:"sell",checkins:"create",onboarding:"create",channels:"coach",scheduling:"coach",integrations:"manage",customize:"manage",plan:"manage",support:"manage",invoices:"manage",invoicing:"sell",corner:"manage","growth-lab":"sell","client-lab":"coach","vision-board":"coach",addons:"create",fitness:"create",career:"create",executive:"create","get-clients":"manage",content:"sell",ads:"sell",email:"coach",notifications:"sell",library:"create","my-data":"manage",whatsapp:"sell",guide:"manage",automations:"manage",agreements:"manage"},o=(e,t,n,r,a,i,o,s)=>({id:e,workspace:t,section:n,href:r,icon:a,labelKey:`destinations.${e}`,...i?{tab:i}:{},...o?{hidden:o}:{},...s?{searchable:s}:{}}),s=[o("dashboard","coach","daily","/","layout-dashboard"),o("clients","coach","daily","/coach?tab=clients","users","clients"),o("scheduling","coach","daily","/coach?tab=scheduling","calendar-days","scheduling"),o("messages","coach","communication","/chat","messages-square","channels"),o("community","coach","communication","/community","users-round","channels"),o("scheduledMessages","coach","communication","/coach?tab=notifications&channel=messages","send","notifications"),o("emailInbox","coach","communication","/coach?tab=email&emailView=inbox","inbox","email"),o("channels","coach","communication","/coach?tab=channels","message-square","channels"),o("clientLab","coach","daily","/coach?tab=growth-lab&growthSubTab=client-lab","heart-pulse","client-lab"),o("visionBoard","coach","daily","/coach?tab=vision-board","images","vision-board"),o("addons","create","library","/coach?tab=addons","puzzle","addons"),o("resources","create","library","/coach?tab=discover","folder-open","discover"),o("programs","create","library","/coach?tab=programs","book-open","programs"),o("journeys","create","library","/coach?tab=client-journey","route","client-journey",!0,!0),o("flows","create","library","/coach?tab=checkins","list-checks","checkins"),o("brain","create","knowledge","/coach?tab=brain","brain","brain"),o("media","create","knowledge","/coach?tab=library","image","library"),o("fitness","create","powerups","/coach?tab=fitness","dumbbell","fitness"),o("career","create","powerups","/coach?tab=career","briefcase","career"),o("executive","create","powerups","/coach?tab=executive","compass","executive"),o("offers","sell","sales","/coach?tab=offers","tag","offers"),o("products","sell","sales","/coach?tab=products","package","products"),o("invoicing","sell","sales","/coach?tab=invoicing","receipt","invoicing"),o("orders","sell","sales","/coach?tab=orders","clipboard-list","orders",!0,!0),o("bundles","sell","sales","/coach?tab=bundles","package","bundles"),o("prospects","sell","sales","/coach?tab=prospects","contact-round","prospects"),o("intakes","sell","sales","/coach?tab=intakes","clipboard-list","intakes"),o("webinars","sell","sales","/coach?tab=webinars","video","webinars"),o("discover","sell","publishing","/discover","store","discover"),o("website","create","publishing","/coach?tab=website","panels-top-left","website"),o("links","sell","publishing","/coach?tab=links","link","links"),o("funnels","sell","publishing","/coach?tab=funnels","filter","funnels"),o("content","sell","marketing","/coach?tab=content","calendar-range","content"),o("ads","sell","marketing","/coach?tab=ads","megaphone","ads"),o("emailMarketing","sell","marketing","/workspace/sell?tab=email&emailView=inbox","mail","email"),o("notifications","sell","marketing","/coach?tab=notifications&channel=push","bell","notifications"),o("growthLab","sell","marketing","/coach?tab=growth-lab","chart
59-no-axes-combined","growth-lab"),o("referrals","sell","marketing","/coach?tab=referrals","gift","referrals"),o("discounts","sell","marketing","/coach?tab=discounts","badge-percent","discounts"),o("customize","manage","experience","/coach?tab=customize","palette","customize"),o("integrations","manage","account","/coach?tab=integrations","plug","integrations"),o("aiCoach","manage","experience","/coach?tab=ai-coach","bot","ai-coach"),o("team","manage","experience","/coach?tab=team","users-round","team"),o("projects","manage","business","/coach?tab=projects","clipboard-list","projects"),o("analytics","manage","business","/coach?tab=analytics","chart-column","analytics"),o("payments","manage","business","/coach?tab=invoices","credit-card","invoices"),o("automations","manage","business","/coach?tab=automations","zap","automations"),o("agreements","manage","experience","/coach?tab=agreements","file-signature","agreements"),o("plan","manage","account","/coach?tab=plan","wallet","plan"),o("myData","manage","account","/coach?tab=my-data","database","my-data"),o("guide","manage","help","/coach?tab=guide","book-open","guide"),o("support","manage","help","/coach?tab=support","circle-help","support"),o("coachCorner","manage","help","/community?channel=coach-corner","messages-square","corner",!0),o("getClients","manage","help","/coach?tab=get-clients","graduation-cap","get-clients",!0),o("upgradeForms","sell","sales","/coach?tab=upgrade-forms","clipboard-list","upgrade-forms",!0),o("coachingForms","sell","sales","/coach?tab=coaching-forms","clipboard-list","coaching-forms",!0),o("diagnostics","sell","marketing","/coach?tab=growth-lab&growthSubTab=diagnostics","activity","diagnostics",!0),o("whatsapp","sell","marketing","/coach?tab=notifications&channel=whatsapp","message-circle","notifications",!0),o("sms","sell","marketing","/coach?tab=notifications&channel=sms","smartphone","notifications",!0),o("squads","coach","communication","/coach?tab=squads","users-round","squads",!0),o("onboarding","create","library","/coach?tab=checkins","list-checks","checkins",!0),o("ecosystem","sell","marketing","/coach?tab=ecosystem","network","ecosystem",!0),o("intelligence","sell","marketing","/workspace/intelligence","scan-search","content",!0)];function l(e,t){if("/coach"===e){let e=t.get("tab"),n=t.get("clientsSubTab");if((!e||"clients"===e)&&n){if("pipeline"===n||"intakes"===n)return"sell";if("ai-coach"===n||"coaches"===n)return"manage"}if("pipeline"===e)return"sell";if("client-lab"===e||"growth-lab"===e&&"client-lab"===t.get("growthSubTab"))return"coach";if("discover"===e&&["bundles","webinars"].includes(t.get("discoverSubTab")??"")||"website"===e&&a(t.get("websiteSubTab")))return"sell";if("email"===e||"notifications"===e){let n=t.get("emailView");if("inbox"===n)return"coach";if("lists"===n||"broadcasts"===n||"sequences"===n||"templates"===n)return"sell";if("email"===e)return"coach";let r=t.get("channel");return r&&"messages"!==r?"sell":"coach"}return e&&Object.prototype.hasOwnProperty.call(i,e)?i[e]:t.get("programId")||t.get("journeyId")||t.get("flowId")?"create":t.get("funnelId")||t.get("webinarId")?"sell":"coach"}return"/"===e&&"community"===t.get("home")?"manage":"/coach/fitness"===e||e.startsWith("/coach/fitness/")||"/coach/career"===e||e.startsWith("/coach/career/")?"create":"/coach/ecosystem"===e?"sell":e.startsWith("/coach/")?"manage":"/discover"===e||e.startsWith("/discover/")||"/dashboard"===e||e.startsWith("/dashboard/")?"sell":"/profile"===e||e.startsWith("/profile/")||"/admin"===e||e.startsWith("/admin/")?"manage":"coach"}},925583:(e,t,n)=>{"use strict";n.d(t,{DeferredTimezoneSync:()=>o});var r=n(695155),a=n(212115),i=n(103238);function o(){let[e,t]=(0,a.useState)(null);return(0,a.useEffect)(()=>(0,i.Oq)(async()=>{let e=await n.e(36938).then(n.bind(n,636938));t(()=>e.TimezoneSync)},{priority:"background",timeoutMs:8e3}),[]),e?(0,r.jsx)(e,{}):null}}
59,925633:(e,t,n)=>{"use strict";n.d(t,{UpgradePopupProvider:()=>u,_:()=>h});var r=n(695155),a=n(212115),i=n(337206),o=n(792939),s=n(153416),l=n(32087);let c=(0,i.default)(()=>Promise.all([n.e(38437),n.e(9683),n.e(79054),n.e(68484),n.e(16304),n.e(18093),n.e(87130),n.e(47734),n.e(96708)]).then(n.bind(n,675203)).then(e=>({default:e.UpgradePopup})),{loadableGenerated:{webpack:()=>[675203]},ssr:!1}),d=(0,a.createContext)({isOpen:!1,targetTier:null,openUpgradePopup:()=>{},closeUpgradePopup:()=>{}});function u({children:e}){let{isSignedIn:t}=(0,o.useAppAuth)(),{isAuthenticatedHint:n}=(0,s.V)(),{isDemoSite:i}=(0,l._)(),[h,m]=(0,a.useState)(!1),[f,p]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null),w=(0,a.useCallback)(e=>{p(!0),b(e||"pro"),m(!0)},[]),v=(0,a.useCallback)(()=>{m(!1),setTimeout(()=>{b(null)},300)},[]);return(0,r.jsxs)(d.Provider,{value:{isOpen:h,targetTier:g,openUpgradePopup:w,closeUpgradePopup:v},children:[e,(t||n||i||f)&&(0,r.jsx)(c,{isOpen:h,onClose:v,targetTier:g||"pro"})]})}function h(){let e=(0,a.useContext)(d);if(!e)throw Error("useUpgradePopup must be used within an UpgradePopupProvider");return e}},929421:(e,t,n)=>{"use strict";n.d(t,{HabitProofPrompt:()=>p});var r=n(695155),a=n(212115),i=n(450910),o=n(792939),s=n(142692),l=n(394537),c=n(442763),d=n(562840),u=n(189239),h=n(309192);function m({onSubmit:e,onSkip:t,Footer:n="div",ScrollArea:o="div"}){let s=(0,i.c)("habits.proof"),[l,c]=(0,a.useState)(""),[d,f]=(0,a.useState)(null),[p,g]=(0,a.useState)(!1),[b,w]=(0,a.useState)(!1),[v,y]=(0,a.useState)(!1),C=async()=>{if(!b&&(l.trim()||d)){w(!0),y(!1);try{await e({reflection:l,photo:d,shared:p})}catch{y(!0)}finally{w(!1)}}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(o,{className:"min-h-0 flex-[0_1_auto] space-y-4 overflow-y-auto px-6 pb-5 font-albert",children:[(0,r.jsx)("p",{className:"text-sm text-text-secondary",children:s("optional")}),(0,r.jsxs)("label",{className:"block space-y-2 text-sm font-medium",children:[(0,r.jsx)("span",{children:s("reflection")}),(0,r.jsx)("textarea",{value:l,onChange:e=>c(e.target.value),maxLength:500,rows:3,disabled:b,className:"w-full resize-none rounded-xl border border-[#e1ddd8] bg-transparent p-3 focus:border-brand-accent focus:outline-none transition-colors dark:border-[#262b35]"})]}),(0,r.jsxs)("label",{className:"block space-y-2 text-sm font-medium",children:[(0,r.jsx)("span",{children:s("photo")}),(0,r.jsx)("input",{type:"file",accept:"image/jpeg,image/png,image/webp",disabled:b,className:"block w-full text-sm file:mr-3 file:rounded-xl file:border-0 file:bg-[#f3f1ef] file:px-3 file:py-2 file:font-albert file:text-sm file:text-[#1a1a1a] dark:file:bg-[#262b35] dark:file:text-[#f5f5f8]",onChange:e=>{let t=e.target.files?.[0]||null;t&&(!["image/jpeg","image/png","image/webp"].includes(t.type)||t.size>5242880)?(y(!0),f(null),e.target.value=""):(f(t),y(!1))}})]}),(0,r.jsxs)("label",{className:"flex items-start gap-3 text-sm",children:[(0,r.jsx)(h.Q,{checked:p,disabled:b,onChange:g,className:"mt-1",ariaLabel:s("share")}),(0,r.jsx)("span",{children:s("share")})]}),v&&(0,r.jsx)("p",{role:"alert",className:"text-sm text-red-600",children:s("error")})]}),(0,r.jsxs)(n,{className:"flex shrink-0 justify-end gap-2 px-6 py-4 font-albert",children:[(0,r.jsx)(u.$,{"data-proof-skip":!0,variant:"ghost",size:"sm",onClick:t,children:s("skip")}),(0,r.jsx)(u.$,{"data-proof-save":!0,size:"sm",disabled:b||!l.trim()&&!d,onClick:()=>void C(),children:s(b?"saving":"save")})]})]})}var f=n(477916);function p(){let{userId:e}=(0,o.useAppAuth)(),{organizationId:t}=(0,s.Z5)(),[n,u]=(0,a.useState)(null),h=(0,l.U)("(min-width: 768px)"),p=(0,i.c)("habits.proof");if((0,a.useEffect)(()=>{let n;u(null);let r=r=>{let a=r.detail;a?.userId===e&&a?.organizationId===t&&(clearTimeout(n),n=setTimeout(()=>u(a),450))};return window.addEventListener(f.D,r),()=>{clearTimeout(n),window.removeEventListener(f.D,r)}},[e,t]),!n||n.userId!==e||n.organizationId!==t)return null;let g=()=>u(null),b=async e=>{let t=new FormData;if(t.set("date",n.date),t.set("reflection",e.reflection),t.set("shared",String(e.shared)),e.photo&&t.set("photo",e.photo),!(await fetch(`/api/habits/${encodeURIComponent(n.habitId)}/proof`,{method:"POST",body:t})).ok)throw Error("habitProofError");u(e=>e===n?null:e),window.dispatchEvent(new Event("coachful:habit-proof-saved"))},w=h?c.c7:d.BE,v=h?c.L3:d.gk,y=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w,{className:"shrink-0 px-6 pt-5 pb-3 font-albert",children:[(0,r.jsx)(v,{children:p("title")}),(0,r.jsx)("p",{className:"truncate text-sm text-text-secondary",dir:"auto",children:n.name})]}),(0,r.jsx)(m,{onSubmit:b,onSkip:g,Footer:h?c.Es:d.tb,ScrollArea:h?c.FE:d.oF},`${n.habitId}:${n.date}`)]});return h?(0,r.jsx)(c.lG,{open:!0,onOpenChange:e=>!e&&g(),children:(0,r.jsx)(c.Cf,{"aria-describedby":void 0,className:"flex h-auto max-h-[85dvh] max-w-md flex-col gap-0 motion-reduce:animate-none overflow-hidden rounded-2xl bg-white/80 p-0 font-albert backdrop-blur-xl dark:bg-[#171b22]/80",children:y})}):(0,r.jsx)(d._s,{open:!0,onOpenChange:e=>!e&&g(),children:(0,r.jsx)(d.zj,{"aria-describedby":void 0,scrollMode:"contained",className:"flex h-auto max-h-[90dvh] flex-col motion-reduce:transition-none font-albert [&>[data-drawer-scroll-viewport]]:flex-[0_1_auto]",children:y})})}}
59,930372:(e,t,n)=>{"use strict";n.d(t,{EM:()=>a,PX:()=>i,VJ:()=>r,cz:()=>l,dC:()=>s});let r="coachful:website-page-changed-elsewhere",a="coachful:assistant-tool-finished";function i(e){return!e||!/^(list|get|search|inspect|preview)_/.test(e)&&/website|section_preset/.test(e)}let o=new Map;function s(e,t){let n=e?.id||t;n&&e&&o.set(n,"string"==typeof e.contentRevision?e.contentRevision:null)}async function l(e,t){let n=await fetch(`/api/coach/org-website/pages/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,...o.has(e)?{baseContentRevision:o.get(e)??null}:{}})});try{let t=await n.clone().json();n.ok?o.has(e)&&"string"==typeof t?.page?.contentRevision&&o.set(e,t.page.contentRevision):409===n.status&&t?.code==="PAGE_CHANGED_BY_ASSISTANT"&&function(e={}){window.dispatchEvent(new CustomEvent(r,{detail:e}))}({pageId:e,saveRefused:!0})}catch{}return n}},931481:(e,t,n)=>{"use strict";n.d(t,{Iz:()=>i,Oo:()=>s,Tw:()=>c,lO:()=>u,t4:()=>o});let r="follower",a="client",i=["home","dynamicCards","tasks","goals","habits","checkIns","programs","resources","contentEngagement","community","communityEngagement","chat","scheduling","journeys","achievements","aiCoac
59h"],o=Object.freeze({home:!0,dynamicCards:!0,tasks:!0,goals:!0,habits:!0,checkIns:!0,programs:!0,resources:!0,contentEngagement:!0,community:!0,communityEngagement:!0,chat:!0,scheduling:!0,journeys:!0,achievements:!0,aiCoach:!0}),s=Object.freeze({home:!0,dynamicCards:!1,tasks:!1,goals:!1,habits:!1,checkIns:!1,programs:!1,resources:!0,contentEngagement:!0,community:!0,communityEngagement:!0,chat:!1,scheduling:!1,journeys:!1,achievements:!1,aiCoach:!1}),l=[{id:r,name:"Follower",description:"Can follow, read, react, and comment without receiving coaching tools.",capacityType:"audience",system:!0,permissions:s},{id:a,name:"Client",description:"Full client workspace, coaching delivery, and community access.",capacityType:"client",system:!0,permissions:o}],c={home:{label:"Home",description:"See the member homepage and any sections allowed below."},dynamicCards:{label:"Dynamic cards",description:"See personalized prompts, status, goal, journey, and recommendation cards."},tasks:{label:"Daily focus & tasks",description:"Create, complete, reorder, and review daily or backlog tasks."},goals:{label:"Goals",description:"Create goals, milestones, reflections, progress, and accomplishments."},habits:{label:"Habits",description:"Create habits, record completions, and view streaks or progress."},checkIns:{label:"Check-ins",description:"Complete daily, weekly, Program, and coach-created assessments."},programs:{label:"Programs",description:"Open enrolled Programs, lessons, assignments, progress, and Program communities."},resources:{label:"Articles & resources",description:"Browse and open accessible articles, courses, libraries, videos, downloads, and tools."},contentEngagement:{label:"Article engagement",description:"Like and comment on coach-authored articles and other supported resources."},community:{label:"Community",description:"Read the main feed and communities they have joined."},communityEngagement:{label:"Post & engage",description:"Create posts and stories, comment, react, bookmark, vote, and report."},chat:{label:"Direct & group chat",description:"Use real-time chat outside the public community feed."},scheduling:{label:"Sessions & scheduling",description:"See sessions, request or book calls, and join live coaching rooms."},journeys:{label:"Journeys & vision boards",description:"Use guided journeys, identity work, vision boards, and related progress."},achievements:{label:"Progress, rewards & leaderboards",description:"See alignment, streaks, achievements, loyalty, and leaderboard features."},aiCoach:{label:"AI coach",description:"Use client-facing AI coaching and personalized guidance."}};function d(e,t){let n=e&&"object"==typeof e?e:{};return i.reduce((e,r)=>(e[r]="boolean"==typeof n[r]?n[r]:t[r],e),{})}function u(e){let t=Array.isArray(e)?e:[],n=t.find(e=>e.id===r),i=t.find(e=>e.id===a),c=t.filter(e=>e.id!==r&&e.id!==a);return[{...l[0],...n||{},id:r,name:"Follower",capacityType:"audience",system:!0,permissions:d(n?.permissions,s)},{...l[1],...i||{},id:a,name:"Client",capacityType:"client",system:!0,permissions:d(i?.permissions,o)},...function(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let i of e.slice(0,30)){if(!i||"object"!=typeof i)continue;let e="string"==typeof i.id?i.id.trim().toLowerCase().replace(/[^a-z0-9_-]/g,"").slice(0,80):"",l="string"==typeof i.name?i.name.trim().slice(0,60):"",c=e===r,u=e===a,h=c?"audience":u?"client":"audience"===i.capacityType?"audience":"client";!e||!l||t.has(e)||(t.add(e),n.push({id:e,name:c?"Follower":u?"Client":l,description:"string"==typeof i.description?i.description.trim().slice(0,180):"",capacityType:h,system:c||u||void 0,permissions:d(i.permissions,"audience"===h?s:o)}))}return n}(c)]}},953943:(e,t,n)=>{"use strict";n.d(t,{AssistantFab:()=>y});var r=n(695155),a=n(615925),i=n(212115),o=n(5772),s=n(833210),l=n(915671),c=n(125610),d=n(142692),u=n(960228),h=n(784961),m=n(573321),f=n(394537),p=n(980642),g=n(745399),b=n(450910),w=n(103238),v=n(131021);function y(){let e=(0,b.c)("coach.assistantFab"),{isOpen:t,openAssistant:n,proactiveNudge:y,checkProactiveNudge:C,dismissProactiveNudge:S}=(0,l.w)(),{isOpen:k}=(0,c.R)(),{isVirtualAssistant:x}=(0,d.Z5)(),{isCoachView:I}=(0,u.an)(),P=(0,m.usePathname)(),_=(0,f.U)("(min-width: 1024px)"),E=(0,m.useSearchParams)(),A=(P?.startsWith("/coach")||(0,a.P9)(P))&&!(0,h.m)(P),$="/"===P&&I,M="/"===P||P===a.Vm.coach?(0,a.Ce)(E):null,j="/coach"===P&&"corner"===E.get("tab")||"community"===M&&E.get("channel")===a.VC,T=x(),N=($||A)&&!T&&!(k||"messages"===M||j),q=(0,v.nB)();return((0,i.useEffect)(()=>
59{if(N)return(0,w.Oq)(C,{priority:"background",timeoutMs:6e3})},[C,N]),N)?(0,r.jsx)(p.N,{children:!t&&(0,r.jsxs)(g.P.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},className:`fixed z-[55] ${_?"bottom-6 right-6 w-14 h-14":"right-5 w-11 h-11"}`,style:_?void 0:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 76px)"},children:[y&&!q&&(0,r.jsxs)(g.P.div,{initial:{opacity:0,y:8,scale:.98},animate:{opacity:1,y:0,scale:1},className:"absolute bottom-full right-0 mb-3 w-[300px] max-w-[calc(100vw-40px)] rounded-2xl border border-[#e1ddd8]/80 bg-white/95 p-4 pr-10 text-left font-albert shadow-[0_18px_45px_rgba(37,38,29,0.18)] backdrop-blur-xl dark:border-white/10 dark:bg-[#1d222b]/95",children:[(0,r.jsxs)("button",{type:"button",onClick:n,className:"block w-full text-left",children:[(0,r.jsx)("span",{className:"text-[12px] font-semibold text-brand-accent",children:"Michelle · New message"}),(0,r.jsx)("p",{className:"mt-1.5 text-[13px] leading-[1.45] text-[#5f5a55] dark:text-[#b2b6c2]",children:y.preview})]}),(0,r.jsx)("button",{type:"button",onClick:()=>void S(),"aria-label":"Dismiss Michelle message",className:"absolute right-2.5 top-2.5 inline-flex h-7 w-7 items-center justify-center rounded-full text-[#a7a39e] transition-colors hover:bg-[#f3f1ef] hover:text-[#1a1a1a] dark:text-[#7d8190] dark:hover:bg-[#262b35] dark:hover:text-white",children:(0,r.jsx)(s.A,{className:"h-4 w-4"})}),(0,r.jsx)("span",{className:"pointer-events-none absolute -bottom-1.5 right-5 h-3 w-3 rotate-45 border-b border-r border-[#e1ddd8]/80 bg-white dark:border-white/10 dark:bg-[#1d222b]"})]}),(0,r.jsxs)(g.P.button,{whileHover:{scale:1.05},whileTap:{scale:.95},onClick:n,className:"w-full h-full rounded-full shadow-lg hover:shadow-xl border border-amber-200/60 dark:border-amber-700/40","aria-label":e("openMichelle"),children:[(0,r.jsx)("div",{className:"w-full h-full rounded-full overflow-hidden",children:(0,r.jsx)(o.default,{src:"https://firebasestorage.googleapis.com/v0/b/gawebdev2-3191a.firebasestorage.app/o/images%2Fcourtney-cook-TSZo17r3m0s-unsplash.jpg?alt=media&token=20487d95-e9d5-4593-b541-e4db1cfe0c98",alt:e("michelle"),width:_?56:44,height:_?56:44,className:"w-full h-full object-cover scale-[1.1]",unoptimized:!0})}),y&&(0,r.jsx)("span",{className:"absolute -right-0.5 -top-0.5 h-3.5 w-3.5 rounded-full border-2 border-white bg-brand-accent shadow-sm dark:border-[#11151c]"})]})]})}):null}},958838:(e,t,n)=>{"use strict";n.d(t,{NativeKeyboardInit:()=>s});var r=n(212115),a=n(377805),i=n(189270),o=n(24516);function s(){(0,o.U6)();let{theme:e}=(0,i.useTheme)();return(0,r.useEffect)(()=>{if(!a.Capacitor.isNativePlatform()||"ios"!==a.Capacitor.getPlatform())return;let e=!1;return n.e(59695).then(n.bind(n,459695)).then(({Keyboard:t})=>{if(!e)return t.setAccessoryBarVisible({isVisible:!1})}).catch(()=>void 0),document.addEventListener("click",o.im),()=>{e=!0,document.removeEventListener("click",o.im)}},[]),(0,r.useEffect)(()=>{if(!a.Capacitor.isNativePlatform()||"ios"!==a.Capacitor.getPlatform())return;let t=!1;return n.e(59695).then(n.bind(n,459695)).then(({Keyboard:n,KeyboardStyle:r})=>{if(!t)return n.setStyle({style:"dark"===e?r.Dark:r.Light})}).catch(()=>void 0),()=>{t=!0}},[e]),null}},960228:(e,t,n)=>{"use strict";n.d(t,{ViewModeProvider:()=>p,wI:()=>b,Ax:()=>w,an:()=>g});var r=n(695155),a=n(212115),i=n(792939),o=n(32087),s=n(142692),l=n(609233),c=n(498906),d=n(519864);let u="ga-view-mode";function h(e){return"coach"===e||"client"===e?e:null}let m=(0,a.createContext)(void 0);function f(e){if("u"<typeof document)return;let t="https:"===window.location.protocol?"; Secure":"";if(e){document.cookie=`${u}=${e}; Path=/; Max-Age=31536000; SameSite=Lax${t}`;return}document.cookie=`${u}=; Path=/; Max-Age=0; SameSite=Lax${t}`}function p({children:e,initialViewMode:t=null}){let{isLoaded:n,userId:g,sessionClaims:b}=(0,i.useAppAuth)(),{isDemoSite:w}=(0,o._)(),{currentMembership:v,isLoading:y}=(0,s.Z5)(),{effectiveBranding:C}=(0,l.useBranding)(),S=C?.organizationId==="default",k=(0,a.useMemo)(()=>S||!C?.organizationId||"default"===C.organizationId?null:C.organizationId,[S,C?.organizationId]),x=b?.publicMetadata?.role,I=v?.orgRole,P=(0,a.useMemo)(()=>!!w||(0,d.No)(x,I),[w,x,I]),_=(0,a.useMemo)(()=>w?"demo":`${g??"signed-out"}:${k??"tenantless"}`,[w,g,k]),E=!w&&(!n||!!g&&(y||!b)),[A,$]=(0,a.useState)(()=>({key:_,canAccess:P})),M=P||E&&A.key===_&&A.canAccess;(0,a.useEffect)(()=>{(P||!E)&&$({key:_,canAccess:P})},[_,E,P]);let j=(0,a.useMemo)(()=>w?"demo":`${g??"signed-out"}:${k??"tenantless"}:${M?"coach":"client"}`,[w,g,k,M]),[T,N]=(0,a.useState)(()=>"client"===t?"client":"coach"===t&&M||M?"coach":"client"),[q,D]=(0,a.useState)(null),U=(0,a.useRef)(null),[R,L]=(0,a.useState)(0),O
59=(0,a.useRef)(0),B=(0,a.useRef)(null),W=(0,a.useCallback)(e=>{if("coach"===e&&!M)return;let t=++O.current;B.current={id:t,contextKey:_,mode:e,startedAt:{}},L(t)},[_,M]),F=(0,a.useCallback)((e,t="dashboard")=>{let n=B.current;return n&&n.contextKey===_&&n.mode===e?n.startedAt[t]??=performance.now():null},[_]);(0,a.useEffect)(()=>{B.current?.contextKey!==_&&(B.current=null)},[_]),(0,a.useEffect)(()=>{if(!w&&(!n||y)||q===j)return;D(j);let e=null===q?t??h((0,c.bi)(u)):h((0,c.bi)(u)),r=U.current?.contextKey===_?U.current.mode:e;"coach"===r||"client"===r?"coach"!==r||M?(N(r),(0,c.FX)(u,r),f(r)):(N("client"),g&&((0,c.Pw)(u),f(null))):N(M?"coach":"client")},[n,y,M,w,_,j,q,t,g]);let V=(0,a.useCallback)(e=>{("coach"!==e||M)&&(U.current={contextKey:_,mode:e},N(e),(0,c.FX)(u,e),f(e))},[_,M]),z=(0,a.useCallback)(()=>{V("coach"===T?"client":"coach")},[T,V]),H="coach"===T&&M,J=!H,K=!w&&!n||!w&&!!g&&y,G=(0,a.useMemo)(()=>({viewMode:M?T:"client",setViewMode:V,toggleViewMode:z,requestViewSwitchAnimation:W,viewSwitchAnimationId:R,getViewSwitchAnimationStart:F,canAccessCoachView:M,isCoachView:H,isClientView:J,isLoading:K}),[T,V,z,W,R,F,M,H,J,K]);return(0,r.jsx)(m.Provider,{value:G,children:e})}function g(){let e=(0,a.useContext)(m);if(void 0===e)throw Error("useViewMode must be used within a ViewModeProvider");return e}function b(){return(0,a.useContext)(m)??null}function w(){let{isCoachView:e,isLoading:t,canAccessCoachView:n}=g();return{shouldRedirect:!t&&e,isLoading:t,canAccessCoachView:n}}},961703:(e,t,n)=>{"use strict";n.d(t,{TY:()=>s,tY:()=>o});var r=n(524164);let a=["/blog","/book","/checkin","/coach/onboarding","/coach/welcome","/docs","/f/","/find-a-coac
59h","/intake-call","/invite","/invoice","/join","/lander","/marketing","/marketplace","/mobile","/onboarding","/oauth/","/privacy","/program-invite","/q/","/assessment/","/r/","/room/","/refund-policy","/sign-in","/start","/subscription-policy","/support","/terms","/team-invite","/tools","/unfixated","/website"],i=["/get-coach/form","/test-unfixated","/upgrade-premium/form"];function o(e){return!!i.includes(e)||a.some(t=>e.startsWith(t))}function s(e){return"/coach"===e||(0,r.Z9)(e)||"/admin"===e||e.startsWith("/admin/")||"/chat"===e||e.startsWith("/chat/")||e.startsWith("/discover/libraries/")||"/discover/vision-boards"===e}},991872:(e,t,n)=>{"use strict";"u">typeof navigator&&!navigator.mediaDevices&&(navigator.mediaDevices={getUserMedia:()=>Promise.reject(Error("mediaDevices not available in this WebView")),enumerateDevices:()=>Promise.resolve([]),addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1})},993415:(e,t,n)=>{"use strict";n.d(t,{ChatUnreadTitleSync:()=>o});var r=n(212115),a=n(746357),i=n(859228);function o(){let{totalUnread:e}=(0,a.r)(),t=(0,r.useRef)(e),n=(0,r.useCallback)(()=>{let e=(0,i.bT)(t.current,document.title);document.title!==e&&(document.title=e)},[]);return(0,r.useEffect)(()=>{t.current=e,n()},[n,e]),(0,r.useEffect)(()=>{let e=new MutationObserver(n);return e.observe(document.head,{childList:!0,characterData:!0,subtree:!0}),n(),()=>{e.disconnect(),document.title=(0,i.uI)(document.title)}},[n]),null}},997389:(e,t,n)=>{"use strict";n.d(t,{SquadProvider:()=>y,z:()=>C});var r=n(695155),a=n(212115),i=n(792939),o=n(573321),s=n(32087),l=n(859271),c=n(198225),d=n(382929),u=n(561834),h=n(103238);let m="ga-squad-cache-v2";class f extends Error{constructor(){super("Squad request timed out"),this.name="SquadRequestTimeoutError"}}async function p(e){let t=new AbortController,n=window.setTimeout(()=>t.abort(),1e4);try{return await fetch(e,{signal:t.signal})}catch(e){if(t.signal.aborted)throw new f;throw e}finally{window.clearTimeout(n)}}function g(e){try{let t=localStorage.getItem(m);if(!t)return null;let n=JSON.parse(t);if(2!==n.version||n.userId!==e||Date.now()-n.timestamp>864e5)return null;return n}catch{return null}}function b(e,t){try{let n={version:2,timestamp:Date.now(),userId:e,...t};localStorage.setItem(m,JSON.stringify(n))}catch(e){console.warn("[SquadContext] Failed to save cache to localStorage:",e)}}let w=(0,a.createContext)(void 0),v={squads:[],membersBySquad:{},statsBySquad:{},discoverySquads:[],activeSquadId:null,activeStandaloneSquadId:null,fetchedForUserId:null,statsLoadedForSquads:new Set,contributionDaysLoadedBySquad:{},hasMoreContributionsBySquad:{}};function y({children:e}){let{user:t,isLoaded:n}=(0,i.useAppUser)(),m=(0,o.usePathname)(),{isDemoMode:C}=(0,s._)(),S=(0,a.useRef)(!1),k=(0,a.useRef)(null);k.current=C?"demo-user":t?.id??null;let[x,I]=(0,a.useState)(v.squads),[P,_]=(0,a.useState)(v.membersBySquad),[E,A]=(0,a.useState)(v.statsBySquad),[$,M]=(0,a.useState)(v.discoverySquads),[j,T]=(0,a.useState)(v.activeSquadId),[N,q]=(0,a.useState)(v.activeStandaloneSquadId),[D,U]=(0,a.useState)(!v.fetchedForUserId),[R,L]=(0,a.useState)(!1),[O,B]=(0,a.useState)(!1),[W,F]=(0,a.useState)(!0),[V,z]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(S.current||!t?.id)return;let e=g(t.id);e&&!v.fetchedForUserId&&(I(e.squads??[]),_(e.membersBySquad??{}),T(e.activeSquadId??null),v.squads=e.squads??[],v.membersBySquad=e.membersBySquad??{},v.activeSquadId=e.activeSquadId??null,U(!1)),S.current=!0},[t?.id]);let H=x.find(e=>e.id===j)||null,J=j&&P[j]||[],K=j&&E[j]||null,G=x.filter(e=>!e.programId),Y=G.length>0,Z=G.length>1,X=G.find(e=>e.id===N)?N:G[0]?.id||null,Q=G.find(e=>e.id===X)||null,ee=x.find(e=>e.hasCoach)||null,et=x.find(e=>!e.hasCoach)||null,en=x.length>1,er=!!ee,ea=!!et,ei=er&&ea,eo=(0,a.useCallback)(e=>{T(e),v.activeSquadId=e,F(v.hasMoreContributionsBySquad[e]??!0)},[]),es=(0,a.useCallback)(e=>{q(e),v.activeStandaloneSquadId=e},[]),el=(0,a.useCallback)(async(e,t=!1)=>{if(k.current===e)try{if(U(!0),z(null),t){let t=(0,c.getDemoStrings)((0,d.getDemoLocale)()),n=(0,l.generateDemoSquadsWithStats)(t).map((e,t)=>({id:e.id,name:e.name,slug:e.slug,description:e.description,avatarUrl:e.avatarUrl||(0,u.$i)({id:e.id,name:e.name}),organizationId:"demo-org",createdBy:"demo-coach-user",coachId:"demo-coach-user",hasCoach:!0,programId:e.programId,visibility:"private",type:"manual",createdAt:e.createdAt,updatedAt:e.updatedAt,inviteCode:"DEMO123",streak:5+3*t+Math.floor(10*Math.random()),avgAlignment:65+5*t+Math.floor(15*Math.random())})),r={};for(let e of n){let n=(0,l.generateDemoSquadMembers)(t,e.id,8);r[e.id]=n.map(t=>({odId:t.odataId,odUserId:t.odataUserId,odSquadId:t.odataSquadId,odOrgId:"demo-org",odName:`demo-org_${t.odataUserId}_${t.odataSquadId}`,odCreatedAt:t.joinedAt,odUpdatedAt:t.joinedAt,odHidden:!1,id:t.odataUserId,odataUserId:t.odataUserId,odataSquadId:t.odataSquadId,squadId:e.id,userId:t.odataUserId,createdAt:t.joinedAt,updatedAt:t.joinedAt,email:t.email,firstName:t.firstName,lastName:t.lastName,imageUrl:t.imageUrl,roleInSquad:"admin"===t.role?"coach":"member",joinedAt:t.joinedAt,alignment:{score:t.alignment?.score??75,status:"aligned",checkIns:[],updatedAt:new Date().toISOString()},alignmentScore:t.alignment?.score??75,streak:t.streak??4}))}let a={};for(let e of n)a[e.id]={avgAlignment:e.avgAlignment??75,alignmentChange:Math.floor(10*Math.random())-3,topPercentile:10+Math.floor(20*Math.random()),contributionHistory:function(){let e=[],t=new Date;for(let n=29;n>=0;n--){let r=new Date(t);r.setDate(r.getDate()-n),e.push({date:r.toISOString().split("T")[0],completionRate:40+Math.floor(55*Math.random())})}return e}()};let i=n[0]?.id||null,o=n.filter(e=>!e.programId),s=o[0]?.id||null;v={squads:n,membersBySquad:r,statsBySquad:a,discoverySquads:[],activeSquadId:i,activeStandaloneSquadId:s,fetchedForUserId:e,statsLoadedForSquads:new Set(n.map(e=>e.id)),contributionDaysLoadedBySquad:Object.fromEntries(n.map(e=>[e.id,30])),hasMoreContributionsBySquad:Object.fromEntries(n.map(e=>[e.id,!1]))},I(n),_(r),A(a),M([]),T(i),q(s),U(!1);return}let n=await p("/api/squad/me?includeStats=false&includeDiscovery=false");if(!n.ok)throw Error("Failed to fetch squad");let r=await n.json();if(k.current!==e)return;let a=r.squads?.map(e=>
59e.squad).filter(Boolean)||[],i={},o=r.discoverySquads||[];if(r.squads)for(let e of r.squads)e.squad?.id&&(i[e.squad.id]=e.members||[]);0===a.length&&(r.premiumSquad&&(a.push(r.premiumSquad),i[r.premiumSquad.id]=r.premiumMembers||[]),r.standardSquad&&(a.push(r.standardSquad),i[r.standardSquad.id]=r.standardMembers||[]));let s=null,m=a.find(e=>e.hasCoach);m?s=m.id:a.length>0&&(s=a[0].id);let f=a.filter(e=>!e.programId),g=f[0]?.id||null;v={squads:a,membersBySquad:i,statsBySquad:{},discoverySquads:o,activeSquadId:s,activeStandaloneSquadId:g,fetchedForUserId:e,statsLoadedForSquads:new Set,contributionDaysLoadedBySquad:{},hasMoreContributionsBySquad:{}},I(a),_(i),M(o),T(s),q(g),U(!1),b(e,{squads:a,membersBySquad:i,activeSquadId:s}),(0,h.Oq)(async()=>{try{if(k.current!==e)return;let t=a.length>0?"/api/squad/me?includeStats=true&includeDiscovery=true":"/api/squad/me?includeStats=false&includeDiscovery=true",n=await p(t);if(n.ok){let t=await n.json();if(k.current!==e)return;if(M(t.discoverySquads||[]),v.discoverySquads=t.discoverySquads||[],a.length>0){let n=t.squads?.map(e=>e.squad).filter(Boolean)||a,r={},i={};if(t.squads)for(let e of t.squads)e.squad?.id&&(r[e.squad.id]=e.members||[],i[e.squad.id]=e.stats||null);0===Object.keys(r).length&&(t.premiumSquad&&(r[t.premiumSquad.id]=t.premiumMembers||[],i[t.premiumSquad.id]=t.premiumStats||null),t.standardSquad&&(r[t.standardSquad.id]=t.standardMembers||[],i[t.standardSquad.id]=t.standardStats||null)),v.squads=n,v.membersBySquad=r,v.
59statsBySquad=i,I(n),_(r),A(i),b(e,{squads:n,membersBySquad:r,activeSquadId:s})}}}catch(e){console.warn("[SquadContext] Deferred squad enrichment failed:",e)}},{priority:"background",timeoutMs:8e3})}catch(r){if(k.current!==e)return;let t=r instanceof f;t?console.warn("[SquadContext] Squad request timed out; using cached data when available"):console.error("Error fetching squad:",r),z(t?null:r instanceof Error?r.message:"Failed to fetch squad");let n=g(e);if(n){let t=n.squads??[],r=n.membersBySquad??{},a=n.activeSquadId??null,i=t.find(e=>!e.programId)?.id||null;v.squads=t,v.membersBySquad=r,v.statsBySquad={},v.discoverySquads=[],v.activeSquadId=a,v.activeStandaloneSquadId=i,v.fetchedForUserId=e,v.statsLoadedForSquads=new Set,v.contributionDaysLoadedBySquad={},v.hasMoreContributionsBySquad={},I(t),_(r),A({}),M([]),T(a),q(i),F(!0),U(!1);return}v={squads:[],membersBySquad:{},statsBySquad:{},discoverySquads:[],activeSquadId:null,activeStandaloneSquadId:null,fetchedForUserId:e,statsLoadedForSquads:new Set,contributionDaysLoadedBySquad:{},hasMoreContributionsBySquad:{}},I([]),_({}),A({}),M([]),T(null),q(null),U(!1)}},[]),ec=(0,a.useCallback)(async()=>{if(j&&!v.statsLoadedForSquads.has(j)&&!R)try{L(!0);let e=x.find(e=>e.id===j),t=e?.hasCoach?"premium":"standard",n=await fetch(`/api/squad/stats?type=${t}`);if(!n.ok)throw Error("Failed to fetch stats");let r=await n.json(),a=E[j],i=a?{...a,topPercentile:r.topPercentile,contributionHistory:r.contributionHistory}:{avgAlignment:0,alignmentChange:0,topPercentile:r.topPercentile,contributionHistory:r.contributionHistory};v.statsBySquad[j]=i,v.statsLoadedForSquads.add(j),v.contributionDaysLoadedBySquad[j]=r.contributionHistory.length,v.hasMoreContributionsBySquad[j]=r.hasMore,A(e=>({...e,[j]:i})),F(r.hasMore)}catch(e){console.error("Error fetching stats tab data:",e)}finally{L(!1)}},[j,x,E,R]),ed=(0,a.useCallback)(async()=>{if(!j||O||!W)return;let e=E[j];if(e)try{B(!0);let t=v.contributionDaysLoadedBySquad[j]||0,n=x.find(e=>e.id===j),r=n?.hasCoach?"premium":"standard",a=await fetch(`/api/squad/stats?type=${r}&offset=${t}&limit=30`);if(!a.ok)throw Error("Failed to load more contributions");let i=await a.json(),o={...e,contributionHistory:[...e.contributionHistory,...i.contributionHistory]};v.statsBySquad[j]=o,v.contributionDaysLoadedBySquad[j]=t+i.contributionHistory.length,v.hasMoreContributionsBySquad[j]=i.hasMore,A(e=>({...e,[j]:o})),F(i.hasMore)}catch(e){console.error("Error loading more contributions:",e)}finally{B(!1)}},[j,x,E,O,W]),eu=(0,a.useCallback)(async()=>{(t?.id||C)&&(v.statsLoadedForSquads=new Set,v.contributionDaysLoadedBySquad={},v.hasMoreContributionsBySquad={},F(!0),await el(t?.id||"demo-user",C))},[t?.id,C,el]);(0,a.useEffect)(()=>{if(!C&&!n)return;if(!t&&!C){v={squads:[],membersBySquad:{},statsBySquad:{},discoverySquads:[],activeSquadId:null,activeStandaloneSquadId:null,fetchedForUserId:null,statsLoadedForSquads:new Set,contributionDaysLoadedBySquad:{},hasMoreContributionsBySquad:{}},I([]),_({}),A({}),M([]),T(null),q(null),U(!1),F(!0);return}let e=t?.id||"demo-user";if(v.fetchedForUserId===e){I(v.squads),_(v.membersBySquad),A(v.statsBySquad),M(v.discoverySquads),T(v.activeSquadId),q(v.activeStandaloneSquadId),U(!1),v.activeSquadId&&F(v.hasMoreContributionsBySquad[v.activeSquadId]??!0);return}return C||(0,h.Nc)(m)?void el(e,C):(0,h.Oq)(()=>el(e,C),{priority:"user-visible",timeoutMs:2500})},[t?.id,n,C,el,m]);let eh=(0,a.useMemo)(()=>({squad:H,members:J,stats:K,squads:x,membersBySquad:P,statsBySquad:E,standaloneSquads:G,activeStandaloneSquad:Q,activeStandaloneSquadId:X,setActiveStandaloneSquadId:es,hasStandaloneSquad:Y,hasMultipleStandaloneSquads:Z,discoverySquads:$,premiumSquad:ee,premiumMembers:ee&&P[ee.id]||[],premiumStats:ee&&E[ee.id]||null,standardSquad:et,standardMembers:et&&P[et.id]||[],standardStats:et&&E[et.id]||null,activeSquadId:j,setActiveSquadId:eo,hasMultipleSquads:en,hasCoachedSquad:er,hasPeerSquad:ea,hasBothSquads:ei,hasPremiumSquad:er,hasStandardSquad:ea,isLoading:D,isLoadingStats:R,isLoadingMoreContributions:O,hasMoreContributions:W,error:V,refetch:eu,fetchStatsTabData:ec,loadM
59oreContributions:ed}),[x,P,E,$,j,N,D,R,O,W,V,es,eo,eu,ec,ed]);return(0,r.jsx)(w.Provider,{value:eh,children:e})}function C(){let e=(0,a.useContext)(w);if(void 0===e)throw Error("useSquadContext must be used within a SquadProvider");return e}},998918:(e,t,n)=>{"use strict";function r(e){return"u">typeof AbortSignal&&"timeout"in AbortSignal?AbortSignal.timeout(e):void 0}n.d(t,{Y:()=>r})}},e=>{e.O(0,[71624,73334,62574,28960,67984,33418,38437,45399,18409,49304,77805,97873,49389,7188,44855,60788,72240,66609,254,64610,59982,33216,9233,88239,20606,59271,29111,31382,28441,26890,77358],()=>e(e.s=541118)),_N_E=e.O()}]);

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.