PageSourceSearch

https://pika.style/_next/static/chunks/1198.86f34425591073ed.js

js pika.style collected 2026-09-25 18:40:21 UTC 27,778 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1198],{1198:(e,a,s)=>{s.r(a),s.d(a,{TEAM_SECTIONS:()=>$,default:()=>W});var t=s(75038),r=s(76430),i=s(92376),l=s(45609),n=s.n(l),c=s(58742),d=s(71623),o=s(17260),m=s(31246),x=s(41075),p=s(29396),h=s(75154),j=s(15212),u=s(29293),v=s(99741),g=s(46724),y=s(13464),b=s(73753),f=s(83390),N=s(18070),k=s(75242),w=s(79998),C=s(72651);let $=[{key:"projects",title:"Projects",icon:o.A},{key:"people",title:"People",icon:m.A}],S=(e,a)=>`/user/settings/team/${e}${a?`?team=${a}`:""}`,A=e=>N.EE.amountUsd[e],P=(e,a)=>"monthly"===a?`$${e*A("monthly")}/month`:`$${e*A("annually")}/year`,E=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),I=e=>"owner"===e?"Owner":N.Uj.find(a=>a.value===e)?.title||e,R=({children:e,tone:a="gray"})=>(0,t.jsx)("span",{className:(0,d.A)("text-xs px-2 py-[2px] rounded-full whitespace-nowrap","green"===a&&"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300","amber"===a&&"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300","pink"===a&&"bg-pink-100 text-pink-700 dark:bg-pink-900/40 dark:text-pink-300","gray"===a&&"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300"),children:e}),O=({person:e})=>(0,t.jsx)("span",{className:"w-8 h-8 shrink-0 rounded-full bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-sm font-semibold uppercase dark:text-white",children:(e.name||e.email||"?").trim()[0]}),F=({person:e,self:a})=>(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("div",{className:"font-medium truncate dark:text-white text-sm",children:[e.name||e.email,a?(0,t.jsx)("span",{className:"opacity-50 font-normal",children:" (you)"}):null]}),e.name?(0,t.jsx)("div",{className:"text-xs opacity-60 truncate",children:e.email}):null]}),T=({avatar:e,name:a,children:s})=>(0,t.jsxs)("div",{className:"flex items-center gap-3 py-2.5",children:[(0,t.jsx)(O,{person:e}),(0,t.jsx)("div",{className:"flex-1 min-w-0",children:a}),(0,t.jsx)("div",{className:"shrink-0 flex justify-end",children:s})]}),_={pink:"bg-pink-50 text-pink-700 dark:bg-pink-900/30 dark:text-pink-300",gray:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",amber:"bg-amber-50 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300"},z="inline-flex items-center gap-1.5 h-7 px-3 rounded-full text-xs font-medium whitespace-nowrap",L=({label:e,tone:a="gray",items:s})=>s?.length?(0,t.jsx)(f.ms,{align:"end",items:s,trigger:(0,t.jsxs)("button",{type:"button",className:(0,d.A)(z,_[a],"pr-2.5 hover:brightness-95 dark:hover:brightness-125"),children:[e,(0,t.jsx)(x.A,{size:11,className:"opacity-60"})]})}):(0,t.jsx)("span",{className:(0,d.A)(z,_[a]),children:e}),D=(e,a)=>({title:(0,t.jsx)("span",{className:"text-red-600 dark:text-red-400",children:e}),onClick:a}),M=({note:e})=>(0,t.jsxs)("div",{"aria-busy":"true","aria-label":e||"Loading your team",children:[(0,t.jsxs)("div",{className:"p-4 sm:p-6 pb-4 flex flex-col gap-3",children:[(0,t.jsx)(f.EA,{className:"h-7 w-48"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(f.EA,{className:"h-5 w-14 rounded-full"}),(0,t.jsx)(f.EA,{className:"h-5 w-14 rounded-full"})]}),e?(0,t.jsx)("p",{className:"text-sm opacity-70",children:e}):null]}),(0,t.jsxs)("div",{className:"mx-4 sm:mx-6 mb-2 rounded-xl border dark:border-gray-800 p-4 flex flex-col gap-2",children:[(0,t.jsx)(f.EA,{className:"h-4 w-40"}),(0,t.jsx)(f.EA,{className:"h-[6px] w-56 rounded-full"})]}),(0,t.jsxs)("div",{className:"flex gap-4 px-4 sm:px-6 pt-5 pb-2 border-b dark:border-gray-800",children:[(0,t.jsx)(f.EA,{className:"h-5 w-20"}),(0,t.jsx)(f.EA,{className:"h-5 w-16"})]}),(0,t.jsx)("div",{className:"p-4 sm:p-6 pt-4 flex flex-col gap-3",children:[0,1].map(e=>(0,t.jsxs)("div",{className:"border rounded-xl dark:border-gray-800 p-4 flex flex-col gap-3",children:[(0,t.jsx)(f.EA,{className:"h-5 w-32"}),[0,1].map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(f.EA,{className:"w-8 h-8 rounded-full"}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col gap-1.5",children:[(0,t.jsx)(f.EA,{className:"h-3.5 w-36"}),(0,t.jsx)(f.EA,{className:"h-3 w-48"})]}
1),(0,t.jsx)(f.EA,{className:"h-5 w-14 rounded-full"})]},e))]},e))})]}),U=({onCancel:e})=>{let[a,s]=(0,r.useState)(""),[i,l]=(0,r.useState)(N.EE.minSeats),[n,d]=(0,r.useState)("annually"),[o,m]=(0,r.useState)(!1),x=async e=>{e.preventDefault(),m(!0);try{(0,w.sx)("team_checkout_started",{seats:i,interval:n});let{url:e}=await k.F.checkout({name:a,seats:Number(i),interval:n,clientReferenceId:(0,C.Ii)()});window.location.assign(e)}catch(e){c.oR.error(e.message),m(!1)}};return(0,t.jsxs)("form",{onSubmit:x,className:"p-4 sm:p-6 flex flex-col gap-4 max-w-lg",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-lg font-semibold dark:text-white",children:"Create a team"}),(0,t.jsx)("p",{className:"text-sm opacity-70 mt-1",children:"Pro for everyone, organised in projects: add people to each project with a role, and share presets there."})]}),(0,t.jsx)(f.pd,{label:"Team name",value:a,maxLength:80,placeholder:"e.g Acme marketing",onChange:e=>s(e.target.value)}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"flex mb-px text-sm font-semibold dark:text-white",children:"Seats (including you)"}),(0,t.jsx)(Y,{value:Number(i),min:N.EE.minSeats,onChange:l})]}),(0,t.jsx)(f.l6,{label:"Billing",value:n,onChange:e=>d(e.target.value),options:[{value:"annually",title:`Yearly \xb7 $${A("annually")} per seat (2 months free)`},{value:"monthly",title:`Monthly \xb7 $${A("monthly")} per seat`}]}),(0,t.jsxs)("p",{className:"text-sm",children:[(0,t.jsx)("span",{className:"font-semibold",children:P(Number(i),n)}),(0,t.jsx)("span",{className:"opacity-60",children:" \xb7 you take one seat. Next, create a project and add people to it."})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(f.$n,{variant:"primary",type:"submit",disabled:o||!a.trim(),children:o?"Opening checkout...":"Continue to payment →"}),e?(0,t.jsx)(f.$n,{variant:"secondary",type:"button",onClick:e,children:"Cancel"}):null]})]})},Y=({value:e,min:a,onChange:s})=>(0,t.jsxs)("div",{className:"inline-flex self-start items-center border rounded-lg dark:border-gray-700 overflow-hidden",children:[(0,t.jsx)("button",{type:"button",className:"px-3 py-2 disabled:opacity-30",disabled:e<=a,onClick:()=>s(Math.max(a,e-1)),"aria-label":"Fewer seats",children:(0,t.jsx)(p.A,{size:14})}),(0,t.jsx)("span",{className:"px-4 font-semibold tabular-nums dark:text-white",children:e}),(0,t.jsx)("button",{type:"button",className:"px-3 py-2 disabled:opacity-30",disabled:e>=N.EE.maxSeats,onClick:()=>s(Math.min(N.EE.maxSeats,e+1)),"aria-label":"More seats",children:(0,t.jsx)(h.A,{size:14})})]}),q=({data:e,teams:a,teamId:s,section:l,onCreate:n,act:c})=>{let d,[o,m]=(0,r.useState)(!1),[p,h]=(0,r.useState)(e.team?.name||""),{membership:v}=e,g=(0,i.useRouter)(),y=[...a.map(e=>({title:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[String(e.id)===String(s)?(0,t.jsx)(j.A,{size:14}):(0,t.jsx)("span",{className:"w-[14px]"}),e.name]}),onClick:()=>g.push(S(l,e.id))})),...(0,N.iJ)()?[{title:"div",as:"divider"},{title:"+ New team",onClick:n}]:[]];return(0,t.jsxs)("div",{className:"p-4 sm:p-6 pb-4 flex flex-col gap-2",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 flex-wrap",children:o?(0,t.jsxs)("form",{className:"flex items-center gap-2",onSubmit:async e=>{e.preventDefault(),await c(()=>k.F.rename(s,p),"Team renamed")&&m(!1)},children:[(0,t.jsx)(f.pd,{value:p,maxLength:80,autoFocus:!0,onChange:e=>h(e.target.value)}),(0,t.jsx)(f.$n,{variant:"secondary",type:"submit",children:"Save"}),(0,t.jsx)(f.$n,{variant:"secondary",type:"button",onClick:()=>m(!1),children:"Cancel"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.ms,{align:"start",items:y,trigger:(0,t.jsxs)("button",{className:"flex items-center gap-1 text-2xl font-semibold dark:text-white",children:[e.team?.name,(0,t.jsx)(x.A,{size:16,className:"opacity-50"})]})}),v.isOwner?(0,t.jsx)("button",{className:"opacity-50 hover:opacity-100",title:"Rename team",onClick:()=>m(!0),children:(0,t.jsx)(u.A,{size:16})}):null]})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[v.isOwner?(0,t.jsx)(R,{tone:"pink",children:"Owner"}):null,v.active?(0,t.jsx)(R,{tone:"green",children:"Active"}):(0,t.jsx)(R,{tone:"amber",children:"Inactive"}),v.isOwner?null:(0,t.jsxs)("span",{className:"opacity-60",children:["You're in ",(d=v.projects.length,`${d} project${1===d?"":"s"}`)," here"]})]}),v.active?null:(0,t.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"This team's subscription has ended: shared presets are read-only and nobody gets Pro through it."})]})},H=({data:e,teamId:a,act:s,onSeatsChanged:i})=>{let{membership:l,billing:n}=e,[d,o]=(0,r.useState)(!1),[m,x]=(0,r.useState)(n?.seats||l.seatsPaid),p="month"===n?.interval?"monthly":"annually",h=l.seatsUsed,j=l.seatsPaid;return(0,t.jsxs)("div",{className:"mx-4 sm:mx-6 mb-2 rounded-xl border dark:border-gray-800 p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[l.active?(0,t.jsxs)("div",{className:"min-w-[220px]",children:[(0,t.jsxs)("div",{className:"text-sm dark:text-white",children:[(0,t.jsxs)("span",{className:"font-semibold",children:[h," of ",j," seats used"]}),n?(0,t.jsxs)("span",{className:"opacity-60",children:[" \xb7 ",P(j,p)]}):null]}),(0,t.jsx)("div",{className:"h-[6px] rounded-full bg-gray-100 dark:bg-gray-800 mt-2 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-linear-to-r from-red-400 to-pink-600",style:{width:`${Math.min(100,h/Math.max(j,1)*100)}%`}})}),n?.renewsAt?(0,t.jsxs)("div",{className:"text-xs opacity-60 mt-2",children:["Renews ",E(n.renewsAt)]}):null,n?.endsAt?(0,t.jsxs)("div",{className:"text-xs opacity-60 mt-2",children:["Ends ",E(n.endsAt)]}):null]}):(0,t.jsxs)("div",{className:"min-w-[220px]",children:[(0,t.jsx)("div",{className:"text-sm font-semibold dark:text-white",children:"Subscription ended"}),(0,t.jsx)("div",{className:"text-xs opacity-60 mt-1",children:"Projects and shared presets stay readable. Invoices are in billing."})]}),l.isOwner?(0,t.jsxs)("div",{className:"flex gap-2",children:[l.active?(0,t.jsx)(f.$n,{variant:"secondary",onClick:()=>{x(j),o(!d)},children:"Manage seats"}):null,(0,t.jsx)(f.$n,{variant:"secondary",onClick:async()=>{try{let{url:e}=await k.F.billingPortal(a);window.location.assign(e)}catch(e){c.oR.error(e.message)}},children:"Billing and invoices"})]}):null]}),d?(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t dark:border-gray-800 flex flex-col gap-3",children:[(0,t.jsx)(Y,{value:Number(m),min:Math.max(N.EE.minSeats,h),onChange:x}),(0,t.jsx)("p",{className:"text-sm opacity-80",children:Number(m)===j?`You have ${j} seats. ${h} are in use (people, and new people you've invited).`:Number(m)>j?`Adding ${m-j} seat${m-j>1?"s":""}: charged now for the rest of this period, then ${P(m,p)}.`:`Removing ${j-m} seat${j-m>1?"s":""}: ${P(m,p)} from the next bill. No refund for this period.`}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(f.$n,{variant:"primary",disabled:Number(m)===j,onClick:async()=>{let e=Number(m);if(await s(()=>k.F.changeSeats(a,e),"Seats updated")){o(!1);for(let a=0;a<8;a++){await new Promise(e=>setTimeout(e,1500));let a=await i();if(a?.billing?.seats===e)break}}},children:"Confirm"}),(0,t.jsx)(f.$n,{variant:"secondary",onClick:()=>o(!1),children:"Cancel"})]})]}):null]})},J=({project:e,data:a,teamId:s,act:i,onDone:l})=>{let[n,d]=(0,r.useState)(""),[o,m]=(0,r.useState)("member"),[x,p]=(0,r.useState)(null),{membership:h}=a,j=h.seatsUsed>=h.seatsPaid,u=new Set(e.people.map(e=>e.memberId)),v=a.members.filter(e=>"owner"!==e.role&&!u.has(e.id)),g=async a=>{a.preventDefault();
1let t=n.trim(),r=await i(()=>k.F.invite(s,{email:t,role:o,projectId:e.id}),a=>a.added?`Added to ${e.name}`:a.emailSent?`Invite sent to ${t}`:"Invite created, copy the link below");if(!r){j&&(0,w.sx)("seat_limit_hit",{},{teamId:s});return}d(""),r.link&&!r.emailSent?p(r.link):l()};return(0,t.jsxs)("div",{className:"mt-3 p-3 rounded-xl bg-gray-50 dark:bg-gray-900/60",children:[(0,t.jsxs)("form",{onSubmit:g,className:"flex flex-col md:flex-row gap-2 md:items-end",children:[(0,t.jsx)(f.pd,{label:"Email",type:"email",value:n,autoFocus:!0,placeholder:"[email protected]",list:`candidates-${e.id}`,onChange:e=>d(e.target.value)}),(0,t.jsx)("datalist",{id:`candidates-${e.id}`,children:v.map(e=>(0,t.jsx)("option",{value:e.email,children:e.name||e.email},e.id))}),(0,t.jsx)("div",{className:"md:w-36 shrink-0",children:(0,t.jsx)(f.l6,{label:"Role",value:o,onChange:e=>m(e.target.value),options:N.Uj.map(e=>({value:e.value,title:e.title}))})}),(0,t.jsxs)("div",{className:"flex gap-2 md:mb-1 shrink-0",children:[(0,t.jsx)(f.$n,{variant:"primary",type:"submit",disabled:!n.trim(),children:"Add"}),(0,t.jsx)(f.$n,{variant:"secondary",type:"button",onClick:l,children:"Cancel"})]})]}),(0,t.jsxs)("p",{className:"text-xs opacity-60 mt-2",children:[N.Uj.map(e=>`${e.title}s: ${e.description.toLowerCase()}.`).join(" ")," ",j?`All ${h.seatsPaid} seats are in use: you can add people already in the team, but someone new needs a free seat${h.isOwner?" (add one above)":" (ask the owner)"}.`:"People already in the team don't use another seat."]}),x?(0,t.jsxs)("div",{className:"text-sm mt-2",children:["The email couldn't be sent."," ",(0,t.jsx)("button",{className:"underline",onClick:()=>{navigator.clipboard.writeText(x),c.oR.success("Link copied")},children:"Copy the invite link"})," ","and share it; they sign in with the invited email."]}):null]})},B=({project:e,data:a,teamId:s,session:i,act:l})=>{let{membership:n}=a,c=(0,N.eq)(e.role)&&n.active,[d,m]=(0,r.useState)(!1),[x,p]=(0,r.useState)(!1),[h,u]=(0,r.useState)(e.name),y=Object.fromEntries(a.members.map(e=>[e.id,e])),b=a.members.find(e=>"owner"===e.role),w=e.people.map(e=>({...y[e.memberId],projectRole:e.role})).filter(e=>e.id).sort((e,a)=>e.projectRole===a.projectRole?0:"admin"===e.projectRole?-1:1),C=a.invites.filter(a=>String(a.project_id)===String(e.id));return(0,t.jsxs)("div",{className:"border rounded-xl dark:border-gray-800",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 px-4 pt-4",children:[x?(0,t.jsxs)("form",{className:"flex items-center gap-2",onSubmit:async a=>{a.preventDefault(),await l(()=>k.F.updateProject(s,e.id,{name:h}),"Project renamed")&&p(!1)},children:[(0,t.jsx)(f.pd,{value:h,maxLength:80,autoFocus:!0,onChange:e=>u(e.target.value)}),(0,t.jsx)(f.$n,{variant:"secondary",type:"submit",children:"Save"}),(0,t.jsx)(f.$n,{variant:"secondary",type:"button",onClick:()=>p(!1),children:"Cancel"})]}):(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,t.jsx)(o.A,{size:18,className:"opacity-60 shrink-0"}),(0,t.jsx)("span",{className:"font-semibold truncate dark:text-white",children:e.name}),n.isOwner?null:(0,t.jsxs)(R,{tone:"admin"===e.role?"pink":"gray",children:["You: ",I(e.role)]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[c&&!d?(0,t.jsxs)(f.$n,{variant:"secondary",onClick:()=>m(!0),children:[(0,t.jsx)(v.A,{size:16,className:"mr-1"})," Add people"]}):null,n.isOwner&&n.active&&!x?(0,t.jsx)(f.ms,{align:"end",items:[{title:"Rename",onClick:()=>p(!0)},{title:"Archive",onClick:()=>l(()=>k.F.updateProject(s,e.id,{archived:!0}),"Project archived")}],trigger:(0,t.jsx)("button",{className:"p-2 -mr-2 opacity-60 hover:opacity-100","aria-label":"Project options",children:(0,t.jsx)(g.A,{size:18,weight:"bold"})})}):null]})]}),(0,t.jsxs)("div",{className:"px-4 pb-4",children:[d?(0,t.jsx)(J,{project:e,data:a,teamId:s,act:l,onDone:()=>m(!1)}):null,(0,t.jsxs)("div",{className:"mt-3 divide-y dark:divide-gray-800",children:[b?(0,t.jsx)(T,{avatar:b,name:(0,t.jsx)(F,{person:b,self:b.user_id===i?.id}),children:(0,t.jsx)(L,{label:"Owner",tone:"pink"})}):null,w.map(a=>{let r=a.user_id===i?.id;return(0,t.jsx)(T,{avatar:a,name:(0,t.jsx)(F,{person:a,self:r}),children:(0,t.jsx)(L,{label:I(a.projectRole),tone:"admin"===a.projectRole?"pink":"gray",items:c&&!r?[...N.Uj.map(r=>({title:(0,t.jsxs)("span",{className:"flex items-start gap-2 py-0.5",children:[r.value===a.projectRole?(0,t.jsx)(j.A,{size:14,className:"mt-0.5"}):(0,t.jsx)("span",{className:"w-[14px]"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"block",children:r.title}),(0,t.jsx)("span",{className:"block text-xs opacity-60",children:r.description})]})]}),onClick:()=>r.value!==a.projectRole&&l(()=>k.F.setProjectRole(s,e.id,a.id,r.value),`${a.name||a.email} is now ${r.title.toLowerCase()}`)})),{title:"div",as:"divider"},D(`Remove from ${e.name}`,()=>l(()=>k.F.removeFromProject(s,e.id,a.id),`Removed from ${e.name}`))]:r?[D(`Leave ${e.name}`,()=>l(()=>k.F.removeFromProject(s,e.id,a.id),`You left ${e.name}`))]:null})},a.id)}),C.map(e=>(0,t.jsx)(T,{avatar:{email:e.email},name:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"text-sm truncate dark:text-white",children:e.email}),(0,t.jsxs)("div",{className:"text-xs opacity-60 truncate",children:["Invited as ",I(e.role).toLowerCase()]})]}),children:(0,t.jsx)(L,{label:"Pending",tone:"amber",items:c?[{title:`Invited as ${I(e.role).toLowerCase()} \xb7 link valid until ${E(e.expires_at)}`,disabled:!0,className:"text-xs opacity-60"},{title:"div",as:"divider"},D("Revoke invite",()=>l(()=>k.F.revokeInvite(s,e.id),"Invite revoked"))]:null})},`i${e.id}`))]}),w.length||C.length||!c||d?null:(0,t.jsx)("p",{className:"text-sm opacity-60 mt-2",children:"Nobody else yet. Add people to share this project's presets with them."})]})]})},G=({teamId:e,act:a,first:s,onDone:i})=>{let[l,n]=(0,r.useState)(""),[c,o]=(0,r.useState)(!1);return(0,t.jsxs)("form",{className:(0,d.A)("flex flex-col md:flex-row gap-2 md:items-end",!s&&"p-3 rounded-xl bg-gray-50 dark:bg-gray-900/60 mb-4"),onSubmit:async s=>{s.preventDefault(),o(!0);let t=await a(()=>k.F.createProject(e,l),`${l.trim()} created`);o(!1),t&&(n(""),i?.())},children:[(0,t.jsx)(f.pd,{label:"Project name",value:l,maxLength:80,autoFocus:!0,placeholder:"e.g. Product launch",onChange:e=>n(e.target.value)}),(0,t.jsxs)("div",{className:"flex gap-2 md:mb-1 shrink-0",children:[(0,t.jsx)(f.$n,{variant:"primary",type:"submit",disabled:!l.trim()||c,children:c?"Creating...":"Create project"}),i&&!s?(0,t.jsx)(f.$n,{variant:"secondary",type:"button",onClick:i,children:"Cancel"}):null]})]})},K=({data:e,teamId:a,session:s,act:i})=>{let{membership:l}=e,[n,c]=(0,r.useState)(!1),[d,o]=(0,r.useState)(!1),m=e.projects.filter(e=>!e.archived_at),x=l.isOwner?e.projects.filter(e=>e.archived_at):[],p=l.isOwner&&l.active;return!m.length&&p?(0,t.jsxs)("div",{className:"p-4 sm:p-6 pt-4",children:[(0,t.jsxs)("div",{className:"rounded-2xl border border-dashed dark:border-gray-700 p-4 sm:p-6 flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(y.A,{size:28,className:"text-pink-500 shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold dark:text-white",children:"Create your first project"}),(0,t.jsx)("p",{className:"text-sm opacity-70 mt-1 max-w-lg",children:"A project is a client, a product or a campaign. Add people to it and save presets there for them to use. Someone can be in several projects, with a different role in each, and still takes one seat."})]})]}),(0,t.jsx)(G,{teamId:a,act:i,first:!0})]}),x.length?(0,t.jsx)(Q,{projects:x,teamId:a,act:i,open:d,setOpen:o}):null]}):(0,t.jsxs)("div",{className:"p-4 sm:p-6 pt-4",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 mb-3",children:[(0,t.jsx)("p",{className:"text-sm opacity-70",children:l.isOwner?"People see only the projects they're in, and presets saved there. You see every project.":"The projects you're in, and who else is 
1in them."}),p&&!n?(0,t.jsxs)(f.$n,{variant:"secondary",className:"self-start sm:self-auto whitespace-nowrap shrink-0",onClick:()=>c(!0),children:[(0,t.jsx)(h.A,{size:14,className:"mr-1"})," New project"]}):null]}),n?(0,t.jsx)(G,{teamId:a,act:i,onDone:()=>c(!1)}):null,(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[m.map(r=>(0,t.jsx)(B,{project:r,data:e,teamId:a,session:s,act:i},r.id)),m.length?null:(0,t.jsx)("p",{className:"text-sm opacity-60",children:"You're not in any projects in this team yet."})]}),x.length?(0,t.jsx)(Q,{projects:x,teamId:a,act:i,open:d,setOpen:o}):null]})},Q=({projects:e,teamId:a,act:s,open:r,setOpen:i})=>(0,t.jsxs)("div",{className:"mt-5",children:[(0,t.jsxs)("button",{className:"text-sm opacity-60 hover:opacity-100 flex items-center gap-1",onClick:()=>i(!r),children:[r?(0,t.jsx)(x.A,{size:12}):(0,t.jsx)(b.A,{size:12})," Archived (",e.length,")"]}),r?(0,t.jsx)("div",{className:"mt-2 divide-y dark:divide-gray-800 border-y dark:border-gray-800",children:e.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between py-2 text-sm",children:[(0,t.jsx)("span",{className:"opacity-70",children:e.name}),(0,t.jsx)("button",{className:"underline opacity-60 hover:opacity-100",onClick:()=>s(()=>k.F.updateProject(a,e.id,{archived:!1}),"Project restored"),children:"Restore"})]},e.id))}):null]}),V=({data:e,teamId:a,session:s,act:r})=>{let{membership:i}=e,l=Object.fromEntries(e.projects.map(e=>[e.id,e.name])),n=e.projects.filter(e=>!e.archived_at),c=Object.values(e.invites.reduce((e,a)=>((e[a.email]||={email:a.email,invites:[]}).invites.push(a),e),{}));return(0,t.jsxs)("div",{className:"p-4 sm:p-6 pt-4",children:[(0,t.jsx)("p",{className:"text-sm opacity-70 mb-3",children:i.isOwner?`Each person uses one seat, however many projects they're in. New people you've invited hold a seat until they join. ${i.seatsUsed} of ${i.seatsPaid} seats used.`:"You see the people in your projects, and the team's owner."}),(0,t.jsxs)("div",{className:"divide-y dark:divide-gray-800 border-y dark:border-gray-800",children:[e.members.map(e=>{let c=e.user_id===s?.id,d="owner"===e.role,o=n.filter(a=>!e.projects.some(e=>e.id===a.id)),m=[...i.isOwner&&!d&&i.active?o.map(s=>({title:`Add to ${s.name}`,onClick:()=>r(()=>k.F.setProjectRole(a,s.id,e.id,"member"),`Added to ${s.name}`)})):[],...i.isOwner&&!d?[...o.length&&i.active?[{title:"div",as:"divider"}]:[],{title:"Remove from team",className:"text-red-600",onClick:()=>r(()=>k.F.removeMember(a,e.id),"Removed from the team, their seat is free")}]:[]];return(0,t.jsxs)("div",{className:"flex items-center gap-3 py-3",children:[(0,t.jsx)(O,{person:e}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)(F,{person:e,self:c}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:d?(0,t.jsx)(R,{tone:"pink",children:"Owner \xb7 every project"}):e.projects.length?e.projects.map(e=>(0,t.jsxs)(R,{tone:"admin"===e.role?"pink":"gray",children:[l[e.id]||"Project"," \xb7 ",I(e.role)]},e.id)):(0,t.jsx)("span",{className:"text-xs opacity-60",children:"No projects"})})]}),c&&!d?(0,t.jsx)(f.$n,{variant:"secondary",onClick:()=>r(()=>k.F.removeMember(a,e.id),"You left the team"),children:"Leave team"}):null,m.length?(0,t.jsx)(f.ms,{align:"end",items:m,trigger:(0,t.jsx)("button",{className:"p-2 opacity-60 hover:opacity-100","aria-label":"Options",children:(0,t.jsx)(g.A,{size:18,weight:"bold"})})}):null]},e.id)}),c.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 py-3",children:[(0,t.jsx)(O,{person:e}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm truncate dark:text-white",children:e.email}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1 mt-1",children:e.invites.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsxs)(R,{tone:"amber",children:[l[e.project_id]||"Project"," \xb7 ",I(e.role)]}),(0,t.jsx)("button",{className:"text-xs opacity-50 hover:opacity-100",title:"Revoke this invite",onClick:()=>r(()=>k.F.revokeInvite(a,e.id),"Invite revoked"),children:"✕"})]},e.id))})]}),(0,t.jsx)(R,{tone:"amber",children:"Pending"})]},e.email))]})]})},W=({ctx:e,section:a})=>{let s=(0,i.useRouter)(),{c_Session:l,c_Teams:o,c_Entitlements:m,c_RefreshEntitlements:x}=e,[p,h]=(0,r.useState)(null),[j,u]=(0,r.useState)(!1),v="people"===a||"members"===a?"people":"projects",g=s.query.team,y=g&&o.some(e=>String(e.id)===String(g))?String(g):o[0]?.id&&String(o[0].id),b="success"===s.query.checkout&&s.query.key?s.query.key:null;(0,r.useEffect)(()=>
1{if(!b||!l?.id)return;let e=setInterval(async()=>{let{teamId:a}=await k.F.byCheckout(b).catch(()=>({}));a&&(clearInterval(e),await x(),(0,w.sx)("team_created",{},{teamId:a}),s.replace(S("projects",a)))},2e3);return()=>clearInterval(e)},[b,l?.id]),(0,r.useEffect)(()=>{"canceled"===s.query.checkout&&(0,c.oR)("Checkout canceled, no charge was made")},[s.query.checkout]),(0,r.useEffect)(()=>{if(!y)return;let e=!1;return k.F.get(y).then(a=>!e&&h(a)).catch(e=>c.oR.error(e.message)),()=>{e=!0}},[y]);let f=async()=>{let[,e]=await Promise.allSettled([x(),k.F.get(y)]);return"fulfilled"===e.status?(h(e.value),e.value):(h(null),s.replace(S(v)),null)},C=async(e,a)=>{try{let s=await e();return await f(),a&&c.oR.success("function"==typeof a?a(s):a),s||!0}catch(e){return c.oR.error(e.message),!1}};if(void 0===m)return(0,t.jsx)(M,{});if(b)return(0,t.jsx)(M,{note:"Payment received, setting up your team..."});if(!o.length||j)return(0,N.iJ)()?(0,t.jsx)(U,{onCancel:o.length?()=>u(!1):null}):(0,t.jsx)("p",{className:"p-6 opacity-70",children:"Teams are coming soon."});if(!p||String(p.team?.id)!==String(y))return(0,t.jsx)(M,{});let A={projects:p.projects.filter(e=>!e.archived_at).length,people:p.members.length};return(0,t.jsxs)("div",{children:[(0,t.jsx)(q,{data:p,teams:o,teamId:y,section:v,onCreate:()=>u(!0),act:C}),p.membership.isOwner?(0,t.jsx)(H,{data:p,teamId:y,act:C,onSeatsChanged:f}):null,(0,t.jsx)("nav",{className:"flex gap-1 px-4 sm:px-6 pt-4 border-b dark:border-gray-800","aria-label":"Team",children:$.map(e=>{let a=e.icon,s=e.key===v;return(0,t.jsxs)(n(),{href:S(e.key,y),className:(0,d.A)("flex items-center gap-2 px-3 py-2 text-sm -mb-px border-b-2",s?"border-pink-500 dark:text-white":"border-transparent opacity-60 hover:opacity-100"),children:[(0,t.jsx)(a,{size:16})," ",e.title,(0,t.jsx)("span",{className:"text-xs opacity-60 tabular-nums",children:A[e.key]})]},e.key)})}),"people"===v?(0,t.jsx)(V,{data:p,teamId:y,session:l,act:C}):(0,t.jsx)(K,{data:p,teamId:y,session:l,act:C})]})}},75242:(e,a,s)=>{s.d(a,{F:()=>i});let t=async(e,a="GET",s)=>{let t=await fetch(e,{method:a,headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0}),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error||"Something went wrong with your team");return r},r=(e,a="")=>`/api/teams/${e}${a}`,i={checkout:({name:e,seats:a,interval:s,clientReferenceId:r})=>t("/api/teams/checkout","POST",{name:e,seats:a,interval:s,clientReferenceId:r}),join:e=>t("/api/teams/join","POST",{token:e}),previewInvite:e=>t(`/api/teams/join?token=${encodeURIComponent(e)}`),byCheckout:e=>t(`/api/teams/checkout?key=${encodeURIComponent(e)}`),get:e=>t(r(e)),rename:(e,a)=>t(r(e),"PATCH",{name:a}),invite:(e,{email:a,role:s,projectId:i})=>t(r(e,"/invites"),"POST",{email:a,role:s,projectId:i}),revokeInvite:(e,a)=>t(r(e,"/invites"),"DELETE",{inviteId:a}),removeMember:(e,a)=>t(r(e,"/members"),"DELETE",{memberId:a}),createProject:(e,a)=>t(r(e,"/projects"),"POST",{name:a}),updateProject:(e,a,s)=>t(r(e,"/projects"),"PATCH",{projectId:a,...s}),setProjectRole:(e,a,s,i)=>t(r(e,"/projects"),"PUT",{projectId:a,memberId:s,role:i}),removeFromProject:(e,a,s)=>t(r(e,"/projects"),"DELETE",{projectId:a,memberId:s}),changeSeats:(e,a)=>t(r(e,"/billing"),"PATCH",{seats:a}),billingPortal:e=>t(r(e,"/billing"),"POST")}}}]);

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.