1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[56005],{7236:(e,i,t)=>{let l;t.d(i,{U:()=>_});var n=t(49354),r=t(79016);function _(){return l||((0,r.k)("browser client created"),l=(0,n.createBrowserClient)("https://abnshduykbpeojewhlzh.supabase.co","sb_publishable_9LkMVf_fSOy_sqgoZEegmw_nsz6yWfu")),l}},14890:(e,i,t)=>{function l(e,i){t.e(8229).then(t.bind(t,32535)).then(t=>{let l=t.default;if(l.__loaded)try{l.capture(e,i??void 0,{send_instantly:!0})}catch{}}).catch(()=>{})}async function n(e,i){try{let{default:l}=await t.e(8229).then(t.bind(t,32535));if(!l.__loaded)return;l.capture(e,i??void 0,{transport:"sendBeacon",send_instantly:!0})}catch{}}t.d(i,{j:()=>n,x:()=>l})},30086:(e,i,t)=>{t.d(i,{SessionProvider:()=>E,w:()=>c});var l=t(95155),n=t(12115),r=t(73321),_=t(7236),o=t(79016),a=t(62296);let u=(0,n.createContext)(null);function d(e){return e?.id??null}function s(e){return null!==e&&("/onboarding"===e||e.startsWith("/onboarding/"))}function E({children:e,initialUser:i,initialProfile:t,initialEmail:c}){let m=void 0!==i,[f,p]=(0,n.useState)(i??null),[I,S]=(0,n.useState)(t??null),[C,D]=(0,n.useState)(c??i?.email??null),[P,N]=(0,n.useState)(!m),[v,A]=(0,n.useState)(()=>!!i),T=(0,n.useRef)(!!i),b=(0,n.useRef)(null),O=(0,n.useRef)(t?.id??i?.id??null),g=(0,n.useRef)(d(i??null)),L=(0,n.useCallback)(async e=>{let i=(0,_.U)();(0,o.k)("getUser called",{from:"SessionProvider.load",initial:e});let{data:{user:t}}=await i.auth.getUser();if(!t){O.current=null,g.current=null,p(null),D(null),S(null),N(!1),(0,o.k)("session state updated",{from:"SessionProvider.load",userId:null});return}let l=t.id,n=O.current;(e||null!==n&&n!==l||null===n)&&N(!0),g.current=l,p(t),D(t.email??null),n!==l&&(O.current=null,S(null));let{data:r}=await i.rpc("get_own_profile").maybeSingle(),a=r??null;O.current=a?.id??l,S(a),N(!1),(0,o.k)("session state updated",{from:"SessionProvider.load",userId:t.id,hasProfile:!!a})},[]);(0,n.useEffect)(()=>{m||L(!0)},[L,m]);let w=(0,n.useCallback)(async()=>{b.current||(b.current=L(!1).finally(()=>{b.current=null})),await b.current},[L]),R=(0,r.usePathname)(),h=(0,n.useRef)(R);(0,n.useEffect)(()=>{let e=h.current;h.current=R,s(e)&&!s(R)&&w()},[R,w]);let k=(0,n.useCallback)((e,i)=>{let t=d(e);if(g.current===t)return!1;if(g.current=t,p(e),e)if(D(i?.email??e.email??null),i&&"profileSeed"in i){let e=i.profileSeed??null;S(e),O.current=e?.id??null}else O.current=null,S(null);else D(null),S(null),O.current=null,N(!1);return!0},[]),U=i?.id??null;(0,n.useEffect)(()=>{let e=i??null;k(e,{email:c??e?.email??null,profileSeed:t??null})&&d(e)&&w()},[U,k,w]),(0,n.useEffect)(()=>(0,a.AH)(()=>{w()}),[w]),(0,n.useEffect)(()=>{let e=(0,_.U)();(0,o.k)("auth subscription mounted",{from:"SessionProvider"});let{data:i}=e.auth.onAuthStateChange((e,i)=>{if((0,o.k)("onAuthStateChange event",{event:e,from:"SessionProvider"}),"TOKEN_REFRESHED"!==e){if("INITIAL_SESSION"===e||"SIGNED_IN"===e){T.current||(T.current=!0,A(!0));let e=i?.user??null;k(e)&&d(e)&&w();return}w()}});return()=>{(0,o.k)("auth subscription unmounted",{from:"SessionProvider"}),i.subscription.unsubscribe()}},[w,k]);let y=!P&&(null===C||null!==I),B=f?"member":m?v?"visitor":"unknown":P?"unknown":"visitor",G=(0,n.useMemo)(()=>({user:f,profile:I,email:C,loading:P,authGate:B,shellReady:y,refreshProfile:w}),[f,I,C,P,B,y,w]);return(0,l.jsx)(u.Provider,{value:G,children:e})}function c(){let e=(0,n.useContext)(u);if(!e)throw Error("useSession must be used within SessionProvider");return e}},54850:(e,i,t)=>{t.d(i,{C:()=>r});var l=t(96616),n=t(21123);function r(e,i,t){let r=i instanceof Error?i:Error(String(i));l.v4(i=>{if(i.setTag("dilimo.domain",e),t)for(let[e,l]of Object.entries(t))i.setExtra(e,l);n.Cp(r)})}},56005:(e,i,t)=>{t.d(i,{BillingProvider:()=>I,d:()=>S});var l=t(95155),n=t(12115),r=t(30086),_=t(62680),o=t(14890);function a(e){if("u"<typeof document)return;let i=window.location?.protocol==="https:"?"; Secure":"",t="dilimo_demo_billing_override";if(null==e){document.cookie=`${t}=; Path=/; Max-Age=0; SameSite=Lax${i}`;return}document.cookie=`${t}=${encodeURIComponent(e)}; Path=/; Max-Age=31536000; SameSite=Lax${i}`}function u(e){if("string"!=typeof e)return null;let i=e.trim().toLowerCase();return"free"===i||"trial"===i||"pro"===i?i:null}function d(e){return"pro"===e?2:+("trial"===e)}t(87358);function s(e){let i=e.now??new Date;if(e.proGrantUntilDate){let t=new Date(`${e.proGrantUntilDate}T23:59:59.999Z`);if(!Number.isNaN(t.getTime())&&i<=t)return"pro"}let t=String(e.subscriptionStatus??"").trim().toLowerCase();if("active"===t||"past_due"===t)return"pro";if("trialing"===t)return"trial";if(e.trialEndsAt){let t=new Date(e.trialEndsAt);if(!Number.isNaN(t.getTime()))return i<t?"trial":"free"}return"trial"===e.billingPlan?"trial":"free"}var E=t(54850),c=t(7236),m=t(87358);let f=(0,n.createContext)(null);function p(e){return"free"===e||"trial"===e||"pro"===e?e:null}function I({children:e}){let{loading:i,profile:t}
1=(0,r.w)(),[S,C]=(0,n.useState)(null),[D,P]=(0,n.useState)(null),[N,v]=(0,n.useState)(null),[A,T]=(0,n.useState)(!1),[b,O]=(0,n.useState)(null),[g,L]=(0,n.useState)(null),[w,R]=(0,n.useState)(null),[h,k]=(0,n.useState)(!1),[U,y]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),[M,F]=(0,n.useState)(null),[W,V]=(0,n.useState)(null),[H,K]=(0,n.useState)(null),[x,j]=(0,n.useState)(!1),$=String(m.env.NEXT_PUBLIC_DEMO_MODE??""),Y=$.trim().toLowerCase(),X="1"===Y||"true"===Y,[q,Q]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!X)return;let e=function(){try{let e=window.localStorage.getItem("dilimo.devBillingOverride");if("free"===e||"trial"===e||"pro"===e)return e;return null}catch{return null}}();Q(e),a(e)},[X]);let z=(0,n.useCallback)(e=>{if(X){Q(e);try{e?window.localStorage.setItem("dilimo.devBillingOverride",e):window.localStorage.removeItem("dilimo.devBillingOverride")}catch{}a(e)}},[X]);(0,n.useEffect)(()=>{i&&y(!1)},[i]);let Z=(0,n.useCallback)(e=>{let i;if(i=e.proGrantUntilDate,"free"===e.effectivePlan&&null==e.adminPlanOverride&&null==e.billingPlan&&null==e.trialEndsAt&&null==e.trialStartedAt&&null==e.stripeCustomerId&&(null==e.subscriptionStatus||""===e.subscriptionStatus)&&(null==i||""===i))return!1;C(e.stripeCustomerId??null),P(e.subscriptionStatus??null),v(e.billingInterval??null),T(!!e.stripeIsPro),O(e.currentPeriodEnd??null),L(e.trialStartedAt??null),R(e.trialEndsAt??null),V(p(e.billingPlan));let t=p(e.adminPlanOverride);t&&G(t),F(p(e.effectivePlan));let l=e.proGrantUntilDate;return K("string"==typeof l&&l.trim()?l.trim().slice(0,10):null),j(!0===e.activeOrPartner),!0},[]),J=(0,n.useCallback)(async()=>{try{let e=(0,c.U)(),i="function"==typeof e.rpc?e.rpc("get_my_admin_plan_override"):Promise.resolve({data:null,error:{message:"rpc unavailable"}}),[t,l]=await Promise.all([fetch("/api/billing/status",{credentials:"include"}),i]),n=await t.json();Z(n),l.error||G(function(e){if(null==e)return null;if("object"==typeof e&&!Array.isArray(e))return u(e.override_plan);let i=(Array.isArray(e)?e:[])[0];return u(i?.override_plan)}(l.data))}catch{}finally{y(!0)}},[Z]);(0,n.useEffect)(()=>{if(i)return;let e=window.setTimeout(()=>{J()},0);return()=>window.clearTimeout(e)},[J,i]);let ee=(0,n.useCallback)(()=>{J()},[J]),ei=(0,n.useMemo)(()=>s({subscriptionStatus:t?.stripe_subscription_status??null,trialEndsAt:t?.trial_ends_at??null,billingPlan:p(t?.billing_plan),proGrantUntilDate:t?.pro_grant_until_date??null}),[t]),et=(0,n.useMemo)(()=>s({subscriptionStatus:D??t?.stripe_subscription_status??null,trialEndsAt:w??t?.trial_ends_at??null,billingPlan:W??p(t?.billing_plan),proGrantUntilDate:H??t?.pro_grant_until_date??null}),[D,w,W,H,t?.stripe_subscription_status,t?.trial_ends_at,t?.billing_plan,t?.pro_grant_until_date]),el=(0,n.useMemo)(()=>(function(e){var i,t,l,n;if("free"===e.adminPlanOverride||"trial"===e.adminPlanOverride||"pro"===e.adminPlanOverride)return e.adminPlanOverride;if(e.activeOrPartner)return"pro";if(e.demoEnabled&&e.demoOverride)return e.demoOverride;let r=e.apiDerivedPlan;return e.effectivePlanFromServer&&(i=r,r=d(t=e.effectivePlanFromServer)>d(i)?t:i),l=r,d(n=e.sessionDerivedPlan)>d(l)?n:l})({adminPlanOverride:B,activeOrPartner:x,demoOverride:q,demoEnabled:X,effectivePlanFromServer:M,sessionDerivedPlan:ei,apiDerivedPlan:et}),[X,q,B,x,M,ei,et]),en=(0,n.useMemo)(()=>"trial"===el,[el]),er=(0,n.useCallback)(async e=>{(0,o.x)(_.u.BILLING_UPGRADE_CTA_CLICKED,{interval:e}),k(!0);try{let i=await fetch("/api/stripe/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({interval:e})}),t=await i.json();if(!i.ok||!t.url)return void(0,E.C)("billing",Error("stripe_checkout_client_failed"),{httpStatus:i.status});window.location.assign(t.url)}catch(e){(0,E.C)("billing",e,{step:"checkout_fetch"})}finally{k(!1)}},[]),e_=(0,n.useMemo)(()=>({stripeCustomerId:S,subscriptionStatus:D,billingInterval:N,stripeIsPro:A,currentPeriodEnd:b,trialStartedAt:g,trialEndsAt:w,trialIsActive:en,effectiveAccountPlan:el,resolvedFromBillingOnly:el,realBillingPlan:et,effectivePlanFromServer:M,profileBillingPlan:W,adminPlanOverride:B,devBillingOverride:q,setDevBillingOverride:z,isDevBillingOverrideEnabled:X,demoModeRaw:$,refreshBilling:J,markTrialStarted:ee,startStripeCheckout:er,checkoutLoading:h,billingResolved:U}),[S,D,N,A,b,g,w,en,el,et,M,W,B,q,z,X,$,J,ee,er,h,U]);return(0,l.jsx)(f.Provider,{value:e_,children:e})}function S(){let e=(0,n.useContext)(f);if(!e)throw Error("useBilling must be used within BillingProvider");return e}},62296:(e,i,t)=>{t.d(i,{AH:()=>r,ru:()=>n});let l="dilimo:profile-updated";function n(e){let i=e??{reason:"unknown",at:new Date().toISOString()};window.dispatchEvent(new CustomEvent(l,{detail:i}))}function r(e){let i=i=>{e(i.detail)};return window.addEventListener(l,i),()=>window.removeEventListener(l,i)}},62680:(e,i,t)=>{t.d(i,{u:()=>l});let l={AUTH_SIGNED_UP:"dilimo_auth_signed_up",PROFILE_ONBOARDING_COMPLETED:"dilimo_profile_onboarding_completed",POST_CREATED:"dilimo_post_created",AI_PROFILE_CREATED:"dilimo_ai_profile_created",SEARCH_PROFILE_SUBMIT_ATTEMPTED:"dilimo_search_profile_submit_attempted",SEARCH_PROFILE_SUBMIT_FAILED:"dilimo_search_profile_submit_failed",SEARCH_PROFILE_SUBMIT_SUCCEEDED:"dilimo_search_profile_submit_succeeded",AI_PROFILE_ACTIVATED:"dilimo_ai_profile_activated",CONTENT_IMPORT_FACEBOOK_PREPARED:"dilimo_content_import_facebook_prepared",MESSAGE_SENT:"dilimo_message_sent",BILLING_UPGRADE_SCREEN_VIEWED:"dilimo_billing_upgrade_screen_viewed",BILLING_UPGRADE_CTA_CLICKED:"dilimo_billing_upgrade_cta_clicked",BILLING_PRO_CHECKOUT_SUCCESS:"dilimo_billing_pro_checkout_success",BILLING_CHECKOUT_CANCEL_VIEWED:"dilimo_billing_checkout_cancel_viewed",PUBLIC_HOMEPAGE_VIEWED:"dilimo_public_homepage_viewed",PUBLIC_LISTING_VIEWED:"dilimo_public_listing_viewed",PUBLIC_LISTINGS_FEED_VIEWED:"dilimo_public_listings_feed_viewed",PUBLIC_PROFILE_VIEWED:"dilimo_public_profile_viewed",PUBLIC_CTA_CLICKED:"dilimo_public_cta_clicked",PUBLIC_NAV_DROPDOWN_OPENED:"dilimo_public_nav_dropdown_opened",PUBLIC_NAV_LINK_CLICKED:"dilimo_public_nav_link_clicked",PUBLIC_PERSONA_BAR_CLICKED:"dilimo_public_persona_bar_clicked",PWA_INSTALL_ENTRY_SHOWN:"dilimo_pwa_install_entry_shown",PWA_INSTALL_ENTRY_CLICKED:"dilimo_pwa_install_entry_clicked",PWA_INSTALL_RESULT:"dilimo_pwa_install_result",BETA_CANDIDATE_FORM_VIEWED:"dilimo_beta_candidate_form_viewed",BETA_CANDIDATE_SUBMITTED:"dilimo_beta_candidate_submitted",BETA_CONFIRMATION_OPENED:"dilimo_beta_confirmation_opened",CONNEXION_PAGE_VIEWED:"dilimo_connexion_page_viewed",CONNEXION_EMAIL_SENT_VIEWED:"dilimo_connexion_email_sent_viewed",SIGNUP_PAGE_VIEWED:"dilimo_signup_page_viewed",SIGNUP_COMPLETED:"dilimo_signup_completed",SIGNUP_FAILED:"dilimo_signup_failed",ONBOARDING_STEP_VIEWED:"dilimo_onboarding_step_viewed",ONBOARDING_IDENTITY_STEP:"dilimo_onboarding_identity_step",SHARE_BUTTON_CLICKED:"dilimo_share_button_clicked",SHARE_FACEBOOK_OPENED:"dilimo_share_facebook_opened",SHARE_LINKEDIN_OPENED:"dilimo_share_linkedin_opened",SHARE_LINK_COPIED:"dilimo_share_link_copied",SHARE_INBOUND_VISIT:"dilimo_share_inbound_visit",FEED_VIEWED:"dilimo_feed_viewed",FEED_FILTERS_SHEET_OPENED:"dilimo_feed_filters_sheet_opened",FEED_FILTER_CHANGED:"dilimo_feed_filter_changed",LISTING_DETAIL_VIEWED:"dilimo_listing_detail_viewed",LISTING_CONTACT_REQUESTED:"dilimo_listing_contact_requested",NDA_SIGNED:"dilimo_nda_signed",DEAL_CREATED:"dilimo_deal_created",EXT
1ENSION_CLIPPER_USED:"dilimo_extension_clipper_used",FIRST_POST_PUBLISHED:"dilimo_first_post_published",FIRST_MESSAGE_SENT:"dilimo_first_message_sent",FIRST_DEAL_OPENED:"dilimo_first_deal_opened",WELCOME_INTENT_CHOSEN:"dilimo_welcome_intent_chosen",PARTNER_DIRECTORY_VIEWED:"dilimo_partner_directory_viewed",PARTNER_RAIL_CLICKED:"partner_rail_clicked",DIRECTORY_VIEWED:"dilimo_directory_viewed",DIRECTORY_MESSAGE_CLICKED:"dilimo_directory_message_clicked",NETWORK_REQUEST_SENT:"dilimo_network_request_sent",NETWORK_REQUEST_ACCEPTED:"dilimo_network_request_accepted",CONVERSATION_OPENED:"dilimo_conversation_opened",MESSAGE_SEND_FAILED:"dilimo_message_send_failed",REALTIME_EVENT_RECEIVED:"dilimo_realtime_event_received"}},79016:(e,i,t)=>{t.d(i,{k:()=>n});let l="1"===t(87358).env.NEXT_PUBLIC_DILIMO_DEBUG_AUTH;function n(e,i){l&&"u">typeof console&&"function"==typeof console.info&&console.info(`[auth-debug] ${e}`,i&&Object.keys(i).length?i:"")}}}]);
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.