1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{3588:(e,t,r)=>{"use strict";r.d(t,{x:()=>o});var s=r(95155),a=r(78770),n=r(3998),i=r(86948);function o(e){let{error:t,reset:r}=e;return(0,s.jsx)("div",{className:"flex min-h-[400px] items-center justify-center p-4",children:(0,s.jsx)(i.Zp,{className:"w-full max-w-md",children:(0,s.jsxs)(i.Wu,{className:"flex flex-col items-center gap-4 pt-6",children:[(0,s.jsx)(a.A,{className:"h-12 w-12 text-destructive"}),(0,s.jsxs)("div",{className:"text-center space-y-2",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:"Something went wrong"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:t.message||"An unexpected error occurred."})]}),(0,s.jsx)(n.$,{onClick:r,children:"Try again"})]})})})}},3998:(e,t,r)=>{"use strict";r.d(t,{$:()=>d,r:()=>l});var s=r(95155),a=r(12115),n=r(32467),i=r(83101),o=r(64269);let l=(0,i.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90","destructive-outline":"bg-destructive/10 text-secondary-foreground hover:bg-destructive/20",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=a.forwardRef((e,t)=>{let{className:r,variant:a,size:i,asChild:d=!1,...c}=e,u=d?n.DX:"button";return(0,s.jsx)(u,{className:(0,o.cn)(l({variant:a,size:i,className:r})),ref:t,...c})});d.displayName="Button"},7141:(e,t,r)=>{"use strict";r.d(t,{Providers:()=>k});var s=r(95155),a=r(67801),n=r(21223),i=r(12115),o=r(51834),l=r(11186),d=r(3998),c=r(65142),u=r(72251),h=r(53489),m=r(6713),x=r(32373),p=r(81288),f=r(92033);let g=[{value:"24h",label:"24 hours"},{value:"7d",label:"7 days"},{value:"30d",label:"30 days"}];function v(e){let{open:t,onOpenChange:r,recordingBlob:a,onDownload:n,planId:v}=e,[j,b]=(0,i.useState)("choose"),[y,w]=(0,i.useState)("24h"),[N,k]=(0,i.useState)("share"),[C,A]=(0,i.useState)(""),[E,S]=(0,i.useState)(!1),[R,P]=(0,i.useState)(""),[L,T]=(0,i.useState)(""),[F,O]=(0,i.useState)(""),[$,z]=(0,i.useState)(""),[D,I]=(0,i.useState)(!1),[M,U]=(0,i.useState)(!1),[V,Y]=(0,i.useState)(!1),_=()=>{n(),Y(!0)},B=()=>{k("presentation"),w("30d"),b("expiration")},J=async(e,t,r)=>{if(!v)throw Error("No plan associated with this recording");let s=await fetch("/api/fastcalc/plans/".concat(v,"/video"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({slug:e,url:t,expiresAt:r})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).message||"Failed to attach video to plan")},q=async()=>{if(a){b("uploading"),z("");try{var e;let t=await fetch("/api/recordings/upload",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({action:"initiate-upload",fileSize:a.size})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||"Failed to initiate upload (status ".concat(t.status,")"))}let{filePath:r,uploadUrl:s}=await t.json(),n=await fetch(s,{method:"PUT",headers:{"Content-Type":"video/webm"},body:a});if(!n.ok)throw Error("Failed to upload recording (status ".concat(n.status,")"));let i=await fetch("/api/recordings/upload",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({action:"complete-upload",filePath:r,expiration:y,videoTitle:C.trim()})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.error||"Failed to complete upload")}let o=await i.json();if(P(o.url),T(o.expiresAt),O(null!=(e=o.slug)?e:""),"presentation"===N&&v&&o.slug){b("attaching");try{await J(o.slug,o.url,o.expiresAt),U(!0),b("attached")}catch(e){z(e instanceof Error?e.message:"Failed to attach to plan"),b("error")}}else b("success")}catch(e){z(e instanceof Error?e.message:"Upload failed"),b("error")}}},Z=async()=>
1{if(!v||!F){k("presentation"),B();return}b("attaching");try{await J(F,R,L),U(!0),b("attached")}catch(e){z(e instanceof Error?e.message:"Failed to attach to plan"),b("error")}},G=async()=>{try{await navigator.clipboard.writeText(R),I(!0),setTimeout(()=>I(!1),2e3)}catch(t){let e=document.createElement("textarea");e.value=R,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e),I(!0),setTimeout(()=>I(!1),2e3)}},W=e=>new Date(e).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"});return(0,s.jsx)(o.lG,{open:t,onOpenChange:e=>{e||(b("choose"),w("24h"),k("share"),A(""),S(!1),P(""),T(""),O(""),z(""),I(!1),Y(!1),U(!1)),r(e)},children:(0,s.jsxs)(o.Cf,{className:"sm:max-w-md bg-white",children:["choose"===j&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.c7,{children:[(0,s.jsx)(o.L3,{children:"Your recording is ready!"}),(0,s.jsx)(o.rr,{children:"Choose how you'd like to save or share your recording. You can use both options."})]}),(0,s.jsxs)("div",{className:"grid gap-4 py-4 ".concat(v?"grid-cols-3":"grid-cols-2"),children:[(0,s.jsxs)(d.$,{variant:"outline",className:"h-24 flex-col gap-2 ".concat(V?"border-green-500 bg-green-50":""),onClick:_,children:[V?(0,s.jsx)(u.A,{className:"h-6 w-6 text-green-500"}):(0,s.jsx)(h.A,{className:"h-6 w-6"}),V?"Downloaded":"Download"]}),(0,s.jsxs)(d.$,{variant:"outline",className:"h-24 flex-col gap-2 ".concat(R?"border-green-500 bg-green-50":""),onClick:()=>{k("share"),w("24h"),b("expiration")},children:[R?(0,s.jsx)(u.A,{className:"h-6 w-6 text-green-500"}):(0,s.jsx)(m.A,{className:"h-6 w-6"}),R?"Link Created":"Share Link"]}),v&&(0,s.jsxs)(d.$,{variant:"outline",className:"h-24 flex-col gap-2 text-center whitespace-normal leading-tight ".concat(M?"border-green-500 bg-green-50":""),onClick:R&&F?Z:B,children:[M?(0,s.jsx)(u.A,{className:"h-6 w-6 text-green-500"}):(0,s.jsx)(x.A,{className:"h-6 w-6"}),(0,s.jsx)("span",{className:"text-xs",children:M?"Added to Presentation":"Add to Client Presentation"})]})]}),R&&(0,s.jsxs)("div",{className:"flex gap-2 mb-2",children:[(0,s.jsx)("input",{type:"text",readOnly:!0,value:R,className:"flex-1 px-3 py-2 text-sm border rounded-md bg-muted truncate"}),(0,s.jsx)(d.$,{variant:"outline",size:"icon",onClick:G,className:"shrink-0",children:D?(0,s.jsx)(u.A,{className:"h-4 w-4 text-green-500"}):(0,s.jsx)(p.A,{className:"h-4 w-4"})})]})]}),"expiration"===j&&(()=>{let e=0===C.trim().length,t=E&&e;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.c7,{children:[(0,s.jsx)(o.L3,{children:"Share Recording"}),(0,s.jsx)(o.rr,{children:"Name your recording and choose how long the link should remain active."})]}),(0,s.jsxs)("div",{className:"py-4 space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"video-title",className:"text-sm font-medium mb-2 block",children:["Video Title ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)(c.p,{id:"video-title",value:C,onChange:e=>A(e.target.value),onBlur:()=>S(!0),placeholder:"e.g. Smith family â purchase plan walkthrough",maxLength:200,"aria-invalid":t,"aria-describedby":"video-title-help"}),(0,s.jsx)("p",{id:"video-title-help",className:"text-xs text-muted-foreground mt-1",children:"Helps you identify which recording was viewed in email notifications."}),t&&(0,s.jsx)("p",{className:"text-xs text-red-500 mt-1",children:"Video title is required."})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Link expires in:"}),(0,s.jsxs)(l.l6,{value:y,onValueChange:w,children:[(0,s.jsx)(l.bq,{children:(0,s.jsx)(l.yv,{})}),(0,s.jsx)(l.gC,{children:g.map(e=>(0,s.jsx)(l.eb,{value:e.value,children:e.label},e.value))})]})]})]}),(0,s.jsxs)(o.Es,{className:"gap-2 sm:gap-0",children:[(0,s.jsx)(d.$,{variant:"ghost",onClick:()=>b("choose"),children:"Back"}),(0,s.jsx)(d.$,{onClick:()=>{if(e)return void S(!0);q()},disabled:e,children:"Generate Link"})]})]})})(),"uploading"===j&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.c7,{children:[(0,s.jsx)(o.L3,{children:"Uploading..."}),(0,s.jsx)(o.rr,{children:"Please wait while your recording is being uploaded."})]}),(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(f.A,{className:"h-8 w-8 animate-spin text-muted-foreground"})})]}),"success"===j&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.c7,{children:[(0,s.jsxs)(o.L3,{className:"flex items-center gap-2",children:[(0,s.jsx)(u.A,{className:"h-5 w-5 text-green-500"}),"Ready to share!"]}),(0,s.jsx)(o.rr,{children:"Copy the link below to share your recording."})]}),(0,s.jsxs)("div",{className:"py-4 space-y-4",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",readOnly:!0,value:R,className:"flex-1 px-3 py-2 text-sm border rounded-md bg-muted truncate"}),(0,s.jsx)(d.$,{variant:"outline",size:"icon",onClick:G,className:"shrink-0",children:D?(0,s.jsx)(u.A,{className:"h-4 w-4 text-green-500"}):(0,s.jsx)(p.A,{className:"h-4 w-4"})})]}),(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Link expires: ",W(L)]})]}),(0,s.jsxs)(o.Es,{className:"gap-2 sm:gap-0",children:[(0,s.jsxs)(d.$,{variant:"outline",onClick:_,children:[(0,s.jsx)(h.A,{className:"mr-2 h-4 w-4"}),V?"Downloaded":"Also Download"]}),(0,s.jsx)(d.$,{onClick:()=>b("choose"),children:"Back to Options"})]})]}),"attaching"===j&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.c7,{children:[(0,s.jsx)(o.L3,{children:"Attaching to presentation..."}),(0,s.jsx)(o.rr,{children:"Linking your recording to the plan so it shows up for the client."})]}),(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(f.A,{className:"h-8 w-8 animate-spin text-muted-foreground"})})]}),"attached"===j&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.c7,{children:[(0,s.jsxs)(o.L3,{className:"flex items-center gap-2",children:[(0,s.jsx)(u.A,{className:"h-5 w-5 text-green-500"}),"Added to client presentation"]}),(0,s.jsx)(o.rr,{children:"Your recording now appears as a Video tab when the client opens this plan's share link."})]}),(0,s.jsxs)("div",{className:"py-4 space-y-3",children:[(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Link expires: ",W(L)]}),R&&(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{type:"text",readOnly:!0,value:R,className:"flex-1 px-3 py-2 text-sm border rounded-md bg-muted truncate"}),(0,s.jsx)(d.$,{variant:"outline",size:"icon",onClick:G,className:"shrink-0",children:D?(0,s.jsx)(u.A,{className:"h-4 w-4 text-green-500"}):(0,s.jsx)(p.A,{className:"h-4 w-4"})})]})]}),(0,s.jsxs)(o.Es,{className:"gap-2 sm:gap-0",children:[(0,s.jsxs)(d.$,{variant:"outline",onClick:_,children:[(0,s.jsx)(h.A,{className:"mr-2 h-4 w-4"}),V?"Downloaded":"Also Download"]}),(0,s.jsx)(d.$,{onClick:()=>b("choose"),children:"Back to Options"})]})]}),"error"===j&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(o.c7,{children:[(0,s.jsx)(o.L3,{className:"text-destructive",children:"Upload Failed"}),(0,s.jsx)(o.rr,{children:$})]}),(0,s.jsxs)(o.Es,{className:"gap-2 sm:gap-0",children:[(0,s.jsx)(d.$,{variant:"ghost",onClick:()=>b("choose"),children:"Back"}),(0,s.jsx)(d.$,{onClick:q,children:"Try Again"})]})]})]})})}var j=r(67600);function b(){let{isRecording:e,isCountingDown:t,countdown:r,recordingBlob:a,showShareModal:i,planId:o,stopRecording:l,downloadRecording:c,setShowShareModal:u}=(0,n.h)();return(0,s.jsxs)(s.Fragment,{children:[t&&(0,s.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,s.jsx)("div",{className:"text-9xl font-bold text-white",children:r})}),e&&(0,s.jsx)("div",{className:"fixed inset-0 z-[65] pointer-events-none border-4 border-red-900 rounded-sm"}),e&&(0,s.jsxs)("div",{className:"fixed bottom-4 left-1/2 transform -translate-x-1/2 z-[70] bg-background/95 backdrop-blur border rounded-full px-4 py-2 shadow-lg flex items-center gap-3",children:[(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"w-3 h-3 bg-red-500 rounded-full animate-pulse"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:"Recording"})]}),(0,s.jsxs)(d.$,{variant:"destructive",size:"sm",onClick:()=>l(!0),children:[(0,s.jsx)(j.A,{className:"mr-2 h-4 w-4"}),"Stop"]})]}),(0,s.jsx)(v,{open:i,onOpenChange:u,recordingBlob:a,onDownload:c,planId:o})]})}var y=r(3588);class w extends i.Component{static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("ErrorBoundary caught:",{message:e.message,stack:e.stack,componentStack:t.componentStack})}render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:(0,s.jsx)(y.x,{error:this.state.error,reset:this.handleReset}):this.props.children}constructor(...e){super(...e),this.state={hasError:!1,error:null},this.handleReset=()=>{this.setState({hasError:!1,error:null})}}}var N=r(96199);function k(e){let{children:t}=e;return(0,s.jsx)(w,{children:(0,s.jsx)(N.CP,{children:(0,s.jsx)(a.O,{children:(0,s.jsxs)(n.V,{children:[t,(0,s.jsx)(b,{})]})})})})}},11186:(e,t,r)=>{"use strict";r.d(t,{bq:()=>h,eb:()=>f,gC:()=>p,l6:()=>c,mi:()=>g,yv:()=>u});var s=r(95155),a=r(12115),n=r(65663),i=r(59007),o=r(42614),l=r(72251),d=r(64269);let c=n.bL;n.YJ;let u=n.WT,h=a.forwardRef((e,t)=>
1{let{className:r,children:a,...o}=e;return(0,s.jsxs)(n.l9,{ref:t,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",r),...o,children:[a,(0,s.jsx)(n.In,{asChild:!0,children:(0,s.jsx)(i.A,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=n.l9.displayName;let m=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.PP,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",r),...a,children:(0,s.jsx)(o.A,{className:"h-4 w-4"})})});m.displayName=n.PP.displayName;let x=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.wn,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",r),...a,children:(0,s.jsx)(i.A,{className:"h-4 w-4"})})});x.displayName=n.wn.displayName;let p=a.forwardRef((e,t)=>{let{className:r,children:a,position:i="popper",...o}=e;return(0,s.jsx)(n.ZL,{children:(0,s.jsxs)(n.UC,{ref:t,className:(0,d.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",r),position:i,...o,children:[(0,s.jsx)(m,{}),(0,s.jsx)(n.LM,{className:(0,d.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,s.jsx)(x,{})]})})});p.displayName=n.UC.displayName,a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.JU,{ref:t,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",r),...a})}).displayName=n.JU.displayName;let f=a.forwardRef((e,t)=>{let{className:r,children:a,...i}=e;return(0,s.jsxs)(n.q7,{ref:t,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...i,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.VF,{children:(0,s.jsx)(l.A,{className:"h-4 w-4"})})}),(0,s.jsx)(n.p4,{children:a})]})});f.displayName=n.q7.displayName;let g=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.wv,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",r),...a})});g.displayName=n.wv.displayName},13673:()=>{},16330:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,13673,23)),Promise.resolve().then(r.bind(r,7141)),Promise.resolve().then(r.bind(r,18516))},18516:(e,t,r)=>{"use strict";r.d(t,{Toaster:()=>g});var s=r(95155),a=r(15894),n=r(12115),i=r(65476),o=r(83101),l=r(26615),d=r(64269);let c=i.Kq,u=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(i.LM,{ref:t,className:(0,d.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:top-0 sm:right-0 sm:bottom-auto sm:flex-col md:max-w-[420px]",r),...a})});u.displayName=i.LM.displayName;let h=(0,o.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-top-full",{variants:{variant:{default:"border bg-white text-foreground",destructive:"destructive group border-red-600 bg-red-600 text-white",success:"success group border-green-600 bg-green-600 text-white"}},defaultVariants:{variant:"default"}}),m=n.forwardRef((e,t)=>
1{let{className:r,variant:a,...n}=e;return(0,s.jsx)(i.bL,{ref:t,className:(0,d.cn)(h({variant:a}),r),...n})});m.displayName=i.bL.displayName,n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(i.rc,{ref:t,className:(0,d.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",r),...a})}).displayName=i.rc.displayName;let x=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(i.bm,{ref:t,className:(0,d.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-100 group-[.destructive]:hover:text-white group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 group-[.success]:text-green-100 group-[.success]:hover:text-white group-[.success]:focus:ring-green-400 group-[.success]:focus:ring-offset-green-600",r),"toast-close":"",...a,children:(0,s.jsx)(l.A,{className:"h-4 w-4"})})});x.displayName=i.bm.displayName;let p=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(i.hE,{ref:t,className:(0,d.cn)("text-sm font-semibold",r),...a})});p.displayName=i.hE.displayName;let f=n.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(i.VY,{ref:t,className:(0,d.cn)("text-sm opacity-90",r),...a})});function g(){let{toasts:e}=(0,a.dj)();return(0,s.jsxs)(c,{children:[e.map(function(e){let{id:t,title:r,description:a,action:n,...i}=e;return(0,s.jsxs)(m,{...i,children:[(0,s.jsxs)("div",{className:"grid gap-1",children:[r&&(0,s.jsx)(p,{children:r}),a&&(0,s.jsx)(f,{children:a})]}),n,(0,s.jsx)(x,{})]},t)}),(0,s.jsx)(u,{})]})}f.displayName=i.VY.displayName},64269:(e,t,r)=>{"use strict";r.d(t,{cn:()=>n});var s=r(2821),a=r(75889);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.QP)((0,s.$)(t))}},65142:(e,t,r)=>{"use strict";r.d(t,{p:()=>i});var s=r(95155),a=r(12115),n=r(64269);let i=a.forwardRef((e,t)=>{let{className:r,type:a,...i}=e;return(0,s.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",r),ref:t,...i})});i.displayName="Input"},67801:(e,t,r)=>{"use strict";r.d(t,{O:()=>l,Z:()=>d});var s=r(95155),a=r(12115),n=r(96199),i=r(20063);let o=(0,a.createContext)(void 0);function l(e){let{children:t}=e,r=function(){let[e,t]=(0,a.useState)(null),[r,s]=(0,a.useState)(!0),[o,l]=(0,a.useState)(null),d=(0,i.useRouter)(),c=(0,a.useRef)(null),u=(0,a.useCallback)(async()=>{var e;null==(e=c.current)||e.abort();let r=new AbortController;c.current=r;try{let e=await fetch("/api/auth/user",{credentials:"include",signal:r.signal});if(r.signal.aborted)return;if(e.ok){let s=await e.json();if(r.signal.aborted)return;t(s)}else if(401===e.status)t(null);else throw Error("Failed to fetch user")}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;console.error("Error fetching user:",e),t(null),l(e instanceof Error?e.message:"Unknown error")}finally{r.signal.aborted||s(!1)}},[]);(0,a.useEffect)(()=>(u(),()=>{var e;return null==(e=c.current)?void 0:e.abort()}),[u]);let h=(0,a.useCallback)(e=>{window.location.href=e?"/login?ref=".concat(e):"/login"},[]),m=(0,a.useCallback)(async()=>{await (0,n.CI)({callbackUrl:"/login"})},[]),x=(0,a.useCallback)(()=>{s(!0),u()},[u]),p=(0,a.useCallback)(async()=>{try{await fetch("/api/admin/impersonate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({userId:null})}),await u(),d.push("/admin")}catch(e){console.error("Error stopping impersonation:",e)}},[u,d]);return(0,a.useMemo)(()=>{var t;return{user:e,isLoading:r,isAuthenticated:!!e,error:o,login:h,logout:m,refetch:x,isAdmin:(null==e?void 0:e.role)==="ADMIN",isPrimary:(null==e?void 0:e.role)==="PRIMARY",isPartner:(null==e?void 0:e.role)==="PARTNER",isClient:(null==e?void 0:e.role)==="CLIENT",canInvite:(null==e?void 0:e.role)==="ADMIN"||(null==e?void 0:e.role)==="PRIMARY"||(null==e?void 0:e.role)==="PARTNER",canInvitePartners:(null==e?void 0:e.role)==="ADMIN"||(null==e?void 0:e.role)==="PRIMARY",isImpersonating:null!=(t=null==e?void 0:e.isImpersonating)&&t,stopImpersonating:p}},[e,r,o,h,m,x,p])}();return(0,s.jsx)(o.Provider,{value:r,children:t})}function d(){let e=(0,a.useContext)(o);if(void 0===e)throw Error("useAuthContext must be used within an AuthProvider");return e}}},e=>{e.O(0,[2978,4909,9625,8580,5252,6727,9079,5663,7311,5589,8441,1255,7358],()=>e(e.s=16330)),_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.