1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="69900f85-e083-4482-a237-c66966501503",e._sentryDebugIdIdentifier="sentry-dbid-69900f85-e083-4482-a237-c66966501503")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[361],{40361:function(e,n,l){var t,a,s,r,i=l(57437),o=l(12381),c=l(51817),d=l(33245),u=l(93947),m=l(95805),f=l(25887),p=l(33145),x=l(62170),g=l(16461),h=l(2265),b=l(38079),w=l(93340),P=l(34691),S=l(4182),v=l(14438),N=l(99376),R=l(15291),j=l(74291),E=l(30021),A=l(96246),y=l(18849),I=l(59242);(t=s||(s={})).REMOVE="REMOVE",t.KEEP="KEEP",(a=r||(r={})).KB="KB",a.SEAT="SEAT",a.SUMMARY="SUMMARY";let k=e=>{var n,l,t,a,r;let{open:k,onOpenChange:T,newBasePlanBillingCycle:C,newKbsAddons:O,newSeatsAddons:B,dialogTitle:F="Upgrade Your Plan",summaryCTA:M="Upgrade",summaryTitle:U,summaryDescription:_,successToast:K,currentPlan:D,proPlanDeal:L}=e,Y=w.SubscriptionPlan.PRO,{workspaceId:G}=(0,g.c)(),{data:z}=x.hi.kb.getAllKBs.useQuery({workspaceId:G},{enabled:!!G}),{data:V}=x.hi.workspace.getUsers.useQuery({workspaceId:G},{enabled:!!G}),{data:W}=x.hi.workspace.get.useQuery({workspaceId:G},{enabled:!!G}),{mutateAsync:H}=x.hi.workspace.removeUser.useMutation(),{mutateAsync:Q}=x.hi.kb.deleteKb.useMutation(),{mutateAsync:Z}=x.hi.billing.updateSubscription.useMutation(),{mutateAsync:$}=x.hi.billing.buySubscription.useMutation(),{mutateAsync:q}=x.hi.billing.createCheckoutForOverduePayment.useMutation(),[X,J]=(0,h.useState)("SUMMARY"),[ee,en]=(0,h.useState)({}),[el,et]=(0,h.useState)({}),[ea,es]=(0,h.useState)(!1),[er,ei]=(0,h.useState)(!1),[eo,ec]=(0,h.useState)(!1),ed=(0,N.useRouter)(),eu=x.hi.useContext();(0,h.useEffect)(()=>{if(z&&z.length>0&&!ea){es(!0);let e={};z.forEach(n=>{e[n.id]="KEEP"}),en(e)}},[z,ea]),(0,h.useEffect)(()=>{if(W&&V&&V.length>0&&!er){ei(!0);let e={};e[W.ownerId]="KEEP",V.forEach(n=>{n.role!==w.WorkspaceRole.OWNER&&(e[n.id]="KEEP")}),et(e)}},[V,er,W]),(0,h.useEffect)(()=>{es(!1),ei(!1)},[k]);let em={planBillingCycle:C,seatsAddon:B,kbsAddon:O},ef={...L.config,price:L.price[em.planBillingCycle],kbsPurchased:em.kbsAddon,seatsPurchased:em.seatsAddon,seatsUsed:null!==(n=null==D?void 0:D.seatsUsed)&&void 0!==n?n:0,kbsUsed:null!==(l=null==D?void 0:D.kbsUsed)&&void 0!==l?l:0,articlesUsed:null!==(t=null==D?void 0:D.articlesUsed)&&void 0!==t?t:0,basePlanRenewalOn:null,seatsLimit:(0,b._I)(L.config.seatsIncludedInPlan)+em.seatsAddon,seatsIncludedInPlan:(0,b._I)(L.config.seatsIncludedInPlan),kbsLimit:(0,b._I)(L.config.kbsIncludedInPlan)+em.kbsAddon,kbsIncludedInPlan:(0,b._I)(L.config.kbsIncludedInPlan),articlesLimit:(0,b._I)(L.config.articlesIncludedInPlan),articlesIncludedInPlan:(0,b._I)(L.config.articlesIncludedInPlan),addonsPrice:L.addonsPrice,addonsDetails:L.addonsDetails,proTrialEndsOn:null,proTrialActive:!1,proTrialAvailable:!1,proTrialExpired:!1,proTrialCreditsGranted:0,proTrialCreditsRemaining:0,planCycleAnchor:null!==(a=null==D?void 0:D.planCycleAnchor)&&void 0!==a?a:null,isOverdue:!1,isBlocked:!1,cancelsAt:null,expiredDueToUnpaid:!1,showWatermark:!0,planBillingCycle:em.planBillingCycle,stripeSubscriptionId:null},ep=ef.seatsUsed>ef.seatsLimit,ex=ef.kbsUsed>ef.kbsLimit;(0,h.useEffect)(()=>{ex?J("KB"):ep?J("SEAT"):J("SUMMARY")},[ep,ex]);let eg=(0,N.usePathname)(),eh={plan:Y,planBillingCycle:C,seatsAddon:Math.max(ep?Object.values(el).filter(e=>"KEEP"===e).length-ef.seatsIncludedInPlan:em.seatsAddon,0),kbsAddon:Math.max(ex?Object.values(ee).filter(e=>"KEEP"===e).length-ef.kbsIncludedInPlan:em.kbsAddon,0)},eb=ep?ef.seatsUsed-ef.seatsLimit:0,ew=ex?ef.kbsUsed-ef.kbsLimit:0,eP=()=>{"SUMMARY"===X?ep?J("SEAT"):ex?J("KB"):eo||T(!1):"SEAT"===X&&ex?J("KB"):eo||T(!1)},eS=()=>{"KB"===X?ep?J("SEAT"):J("SUMMARY"):"SEAT"===X&&J("SUMMARY")},ev=!(0,b.Lf)(D.stripeSubscriptionId),eN=eh.plan===w.SubscriptionPlan.FREE&&0===eh.kbsAddon,eR=ev&&!eN,ej=eh.planBillingCycle===w.BillingCycle.YEARLY&&(eh.seatsAddon>0||eh.kbsAddon>0),eE=eN?!ev:eh.plan!==D.plan||eh.planBillingCycle!==D.planBillingCycle||eh.seatsAddon!==D.seatsPurchased||eh.kbsAddon!==D.kbsPurchased,eA=async()=>{await eu.billing.getPlanBenefitsAndLimits.invalidate(),eu.billing.getUpcomingInvoiceDetails.invalidate(),eu.workspace.getUsers.invalidate(),eu.kb.getAllKBs.invalidate(),eu.kb.getKBTreeById.invalidate()},{workspaceAccess:ey,isLoading:eI}=(0,I.R)({}),{role:ek,noAccess:eT}
1=ey,eC=!!eI||null!==ek&&!eT&&[w.WorkspaceRole.ADMIN,w.WorkspaceRole.OWNER].includes(ek),eO=async()=>{if(!eC){v.Am.error("You do not have permission to change the subscription plan.");return}ec(!0);try{if(ep&&Object.values(el).filter(e=>"REMOVE"===e).length>0)for(let e of Object.keys(el).filter(e=>"REMOVE"===el[e]))await H({workspaceId:G,workspaceUserId:e});if(ex&&Object.values(ee).filter(e=>"REMOVE"===e).length>0)for(let e of Object.keys(ee).filter(e=>"REMOVE"===ee[e]))await Q({kbId:e});if(eR){await $({workspaceId:G,plan:eh.plan,billingCycle:eh.planBillingCycle,seatsAddon:eh.seatsAddon,kbsAddon:eh.kbsAddon,cancelUrl:null!=eg?eg:"/billing/overview"},{onSuccess:e=>{if(e.checkoutUrl)eA(),ed.push(e.checkoutUrl);else{let e=async()=>{await eA(),ed.replace("/billing/overview?subscription_purchase=success")};setTimeout(()=>{e()},5e3)}},onError:e=>{ec(!1),v.Am.error("Failed to upgrade to ".concat(b.tn[eh.plan]," (").concat(eh.planBillingCycle.toLowerCase(),") plan")),console.error("Error upgrading subscription:",e)}});return}if(eE&&await Z({workspaceId:G,plan:eh.plan,billingCycle:eh.planBillingCycle,seatsAddon:eh.seatsAddon,kbsAddon:eh.kbsAddon}),!eN&&D.isOverdue){let{checkoutUrl:e}=await q({workspaceId:G,cancelUrl:null!=eg?eg:"/billing/overview"});eA(),ed.push(e);return}K&&v.Am.success(K);let e=async()=>{await eA(),eN?ed.replace(K?"/billing/overview":"/billing/overview?subscription_update=success_cancelling"):ed.replace(K?"/billing/overview":"/billing/overview?subscription_update=success")};setTimeout(()=>{e()},5e3)}catch(e){ec(!1),v.Am.error("Something went wrong. Please try again later or contact support."),console.error("Error updating plan:",e)}};return(0,i.jsx)(j.Vq,{open:k,onOpenChange:e=>{eo?T(!0):T(e)},children:(0,i.jsxs)(j.cZ,{className:"flex w-full max-w-[640px] flex-col gap-0 rounded-lg bg-background p-0",hideClose:eo,children:[(0,i.jsx)(j.fK,{className:"m-0 hidden h-0 w-0 overflow-hidden"}),(0,i.jsx)("div",{className:"relative m-0 flex h-[50px] w-full items-center border-b p-4",children:(0,i.jsx)("p",{className:"text-left text-lg font-semibold",children:F})}),(0,i.jsxs)("div",{className:"relative flex w-full flex-col ".concat(eo?"pointer-events-none":""),children:[(0,i.jsxs)("div",{className:"relative flex w-full flex-col gap-4 p-4",children:[(ex||ep)&&(0,i.jsx)(E.aG,{children:(0,i.jsxs)(E.Jb,{className:"gap-0 space-x-0",children:[ex&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(E.gN,{children:(0,i.jsx)(E.At,{asChild:!0,children:(0,i.jsx)(o.z,{size:"sm",variant:"KB"===X?"secondary":"ghost",onClick:()=>J("KB"),className:"h-auto py-1 text-sm font-normal disabled:text-muted-foreground disabled:opacity-100 ".concat("KB"===X?"px-3":"px-2"),children:"Knowledge Bases"})})}),(0,i.jsx)(E.bg,{})]}),ep&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(E.gN,{children:(0,i.jsx)(E.At,{asChild:!0,children:(0,i.jsx)(o.z,{size:"sm",variant:"SEAT"===X?"secondary":"ghost",onClick:()=>J("SEAT"),className:"h-auto py-1 text-sm font-normal disabled:text-muted-foreground disabled:opacity-100 ".concat("SEAT"===X?"px-3":"px-2"),children:"Seats"})})}),(0,i.jsx)(E.bg,{})]}),(0,i.jsx)(E.gN,{children:(0,i.jsx)(E.At,{asChild:!0,children:(0,i.jsx)(o.z,{size:"sm",variant:"SUMMARY"===X?"secondary":"ghost",onClick:()=>J("SUMMARY"),className:"h-auto py-1 text-sm font-normal disabled:text-muted-foreground disabled:opacity-100 ".concat("SUMMARY"===X?"px-3":"px-2"),children:"Summary"})})})]})}),ex&&"KB"===X&&(0,i.jsxs)("div",{className:"flex w-full flex-col items-start gap-4",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-0.5",children:[(0,i.jsx)("p",{className:"w-full text-sm font-medium",children:"You've exceeded your Knowledge Base limit."}),(0,i.jsxs)("p",{className:"w-full text-sm text-muted-foreground",children:["Either keep by purchasing more KBs, or remove"," ",ew," to fit your plan."]})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col rounded-lg border",children:[(0,i.jsx)("div",{className:"flex h-10 w-full items-center border-b p-2 pl-4",children:(0,i.jsx)("p",{className:"w-full text-sm font-normal text-muted-foreground",children:"Select KBs to Keep or Remove"})}),(0,i.jsx)(y.X,{className:"flex max-h-80 w-full flex-col overflow-y-auto",children:(null!=z?z:[]).map((e,n)=>{var l;return(0,i.jsxs)("div",{className:"flex h-[52px] w-full items-center justify-between gap-2 p-2 pl-3 ".concat(n>0?"border-t":""),children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"relative aspect-square size-7 overflow-hidden rounded bg-gradient-to-br object-cover",children:(0,i.jsx)(p.default,{src:null!==(l=e.faviconUrl)&&void 0!==l?l:P.B.squareIcon,alt:"Avatar",fill:!0,className:"object-cover"})}),(0,i.jsx)("div",{className:"text-sm font-medium",children:e.title})]}),(0,i.jsxs)(R.Ph,{value:ee[e.id],onValueChange:n=>{en(l=>({...l,[e.id]:n}
1))},children:[(0,i.jsx)(R.i4,{className:"w-32 bg-background",id:"rows-per-page",children:(0,i.jsx)(R.ki,{})}),(0,i.jsx)(R.Bw,{side:"bottom",children:Object.values(s).map(e=>(0,i.jsx)(R.Ql,{value:e,children:(0,S.fm)(e)},e))})]})]},e.id)})})]}),(0,i.jsxs)("div",{className:"flex w-full items-center gap-2 rounded-md bg-muted px-3 py-2 text-foreground",children:[(0,i.jsx)(d.Z,{className:"size-4"}),(0,i.jsxs)("p",{className:"text-xs",children:["Your current plan selection allows"," ",ef.kbsLimit," Knowledge Bases."]})]})]}),ep&&"SEAT"===X&&(0,i.jsxs)("div",{className:"flex w-full flex-col items-start gap-4",children:[(0,i.jsxs)("div",{className:"flex w-full flex-col gap-0.5",children:[(0,i.jsx)("p",{className:"w-full text-sm font-medium",children:"You've exceeded your seat limit."}),(0,i.jsxs)("p",{className:"w-full text-sm text-muted-foreground",children:["Either keep by purchasing more seats, or remove"," ",eb," to fit your plan."]})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col rounded-lg border",children:[(0,i.jsx)("div",{className:"flex h-10 w-full items-center border-b p-2 pl-4",children:(0,i.jsx)("p",{className:"w-full text-sm font-normal text-muted-foreground",children:"Select Members to Keep or Remove"})}),(0,i.jsxs)(y.X,{className:"flex max-h-80 w-full flex-col overflow-y-auto",children:[W&&(0,i.jsx)("div",{className:"flex h-[52px] w-full items-center justify-between gap-2 p-2 pl-3",children:(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"relative aspect-square size-9 overflow-hidden rounded-full bg-muted bg-gradient-to-br object-cover",children:(0,i.jsxs)(A.qE,{className:"size-9",children:[(0,i.jsx)(A.F$,{src:null!==(r=W.owner.image)&&void 0!==r?r:void 0}),(0,i.jsx)(A.Q5,{children:W.owner.name?W.owner.name.substring(0,2).toUpperCase():W.owner.email.substring(0,2).toUpperCase()})]})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-sm font-medium",children:W.owner.name}),(0,i.jsxs)("div",{className:"text-xs text-muted-foreground",children:[W.owner.email," (Owner)"]})]})]})}),(null!=V?V:[]).map(e=>{var n;return(0,i.jsxs)("div",{className:"flex h-[52px] w-full items-center justify-between gap-2 border-t p-2 pl-3",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("div",{className:"relative aspect-square size-9 overflow-hidden rounded-full bg-muted bg-gradient-to-br object-cover",children:(0,i.jsxs)(A.qE,{className:"size-9",children:[(0,i.jsx)(A.F$,{src:null!==(n=e.user.image)&&void 0!==n?n:void 0}),(0,i.jsx)(A.Q5,{children:e.user.name?e.user.name.substring(0,2).toUpperCase():e.user.email.substring(0,2).toUpperCase()})]})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"text-sm font-medium",children:e.user.name}),(0,i.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.user.email," (",(0,S.fm)(e.role),")"]})]})]}),(0,i.jsxs)(R.Ph,{value:el[e.id],onValueChange:n=>{et(l=>({...l,[e.id]:n}))},children:[(0,i.jsx)(R.i4,{className:"w-32 bg-background",id:"rows-per-page",children:(0,i.jsx)(R.ki,{})}),(0,i.jsx)(R.Bw,{side:"bottom",children:Object.values(s).map(e=>(0,i.jsx)(R.Ql,{value:e,children:(0,S.fm)(e)},e))})]})]},e.id)})]})]}),(0,i.jsxs)("div",{className:"flex w-full items-center gap-2 rounded-md bg-muted px-3 py-2 text-foreground",children:[(0,i.jsx)(d.Z,{className:"size-4"}),(0,i.jsxs)("p",{className:"text-xs",children:["Your current plan selection allows"," ",ef.seatsLimit," Seats."]})]})]}),"SUMMARY"===X&&(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[U&&(0,i.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,i.jsx)("p",{className:"text-sm font-medium",children:U}),_&&(0,i.jsx)("p",{className:"text-sm text-muted-foreground",children:_})]}),(0,i.jsxs)("div",{className:"flex w-full flex-col gap-3",children:[(0,i.jsxs)("div",{className:"flex h-12 w-full justify-between gap-3",children:[(0,i.jsxs)("div",{className:"flex h-full gap-3",children:[(0,i.jsx)("div",{className:"flex size-12 min-w-12 items-center justify-center rounded-lg border text-foreground",children:(0,i.jsx)(u.Z,{className:"size-6"})}),(0,i.jsxs)("div",{className:"flex w-full flex-col items-start gap-0.5",children:[(0,i.jsxs)("p",{className:"text-sm font-medium",children:[b.tn[eh.plan]," ","Plan"]}),(0,i.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Qty 1, Prorated, then billed"," ",eh.planBillingCycle.toLowerCase()]})]})]}),(0,i.jsx)("div",{className:"flex h-full w-32 min-w-32 flex-col items-start justify-start",children:(0,i.jsxs)("p",{className:"text-sm font-medium text-foreground",children:["$",L.price[eh.planBillingCycle]," ","/"," ",eh.planBillingCycle.toLowerCase().replace("ly","")]})})]}),eh.seatsAddon>0&&(0,i.jsxs)("div",{className:"flex h-12 w-full justify-between gap-3",children:[(0,i.jsxs)("div",{className:"flex h-full gap-3",children:[(0,i.jsx)("div",{className:"flex size-12 min-w-12 items-center justify-center rounded-lg border text-foreground",children:(0,i.jsx)(m.Z,{className:"size-6"})}),(0,i.jsxs)("div",{className:"flex w-full flex-col items-start gap-0.5",children:[(0,i.jsx)("p",{className:"text-sm font-medium",children:"Seat Addon"}),(0,i.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Qty"," ",eh.seatsAddon,", Prorated, then billed monthly"]})]})]}),(0,i.jsx)("div",{className:"flex h-full w-32 min-w-32 flex-col items-start justify-start",children:(0,i.jsxs)("p",{className:"text-sm font-medium text-foreground",children:["$",L.addonsPrice[b.m.SEAT]," / month"]})})]}),eh.kbsAddon>0&&(0,i.jsxs)("div",{className:"flex h-12 w-full justify-between gap-3",children:[(0,i.jsxs)("div",{className:"flex h-full gap-3",children:[(0,i.jsx)("div",{className:"flex size-12 min-w-12 items-center justify-center rounded-lg border text-foreground",children:(0,i.jsx)(f.Z,{className:"size-6"})}),(0,i.jsxs)("div",{className:"flex w-full flex-col items-start gap-0.5",children:[(0,i.jsx)("p",{className:"text-sm font-medium",children:"Knowledge Base Addon"}),(0,i.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Qty"," ",eh.kbsAddon,", Prorated, then billed monthly"]})]})]}),(0,i.jsx)("div",{className:"flex h-full w-32 min-w-32 flex-col items-start justify-start",children:(0,i.jsxs)("p",{className:"text-sm font-medium text-foreground",children:["$",L.addonsPrice[b.m.KB]," / month"]})})]}),(0,i.jsx)("div",{className:"h-1 w-full border-t"}),(0,i.jsxs)("div",{className:"flex items-start justify-between",children:[(0,i.jsx)("p",{className:"text-sm font-medium",children:"Subtotal"}),(0,i.jsx)("div",{className:"flex w-32 min-w-32 flex-col items-start justify-start gap-0.5",children:eh.planBillingCycle===w.Billing
1Cycle.YEARLY?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("p",{className:"text-sm font-medium",children:["$",L.price[eh.planBillingCycle]," ","/ year"]}),(eh.kbsAddon>0||eh.seatsAddon>0)&&(0,i.jsxs)("p",{className:"text-sm font-medium",children:["$",L.addonsPrice[b.m.SEAT]*eh.seatsAddon+L.addonsPrice[b.m.KB]*eh.kbsAddon," ","/ month"]})]}):(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("p",{className:"text-sm font-medium",children:["$",L.price[eh.planBillingCycle]+L.addonsPrice[b.m.SEAT]*eh.seatsAddon+L.addonsPrice[b.m.KB]*eh.kbsAddon," ","/ month"]})})})]})]}),eR&&!ej&&(0,i.jsxs)("div",{className:"flex items-center gap-2 bg-muted px-3 py-2 text-foreground",children:[(0,i.jsx)(d.Z,{className:"size-4"}),(0,i.jsx)("p",{className:"text-xs",children:"You can apply coupon code in the next step if any."})]})]})]}),(0,i.jsxs)("div",{className:"flex h-[68px] w-full items-center justify-end gap-2 border-t p-4",children:[(0,i.jsx)(o.z,{variant:"secondary",disabled:eo,onClick:()=>{eP()},className:"min-w-24 px-4 py-2",children:"Back"}),(0,i.jsxs)(o.z,{disabled:eo,onClick:()=>{"SUMMARY"===X?eO():eS()},className:"min-w-24 px-4 py-2",children:[eo&&(0,i.jsx)(c.Z,{className:"animate-spin"}),"SUMMARY"===X?M:"Next"]})]})]})]})})};n.Z=e=>{let{workspaceId:n,setWorkspaceId:l}=(0,g.c)(),{data:t}=x.hi.workspace.getAll.useQuery(),{data:a}=x.hi.billing.getPlanBenefitsAndLimits.useQuery({workspaceId:n},{enabled:!!n&&!!n.length}),{data:s}=x.hi.billing.getProPlanDeal.useQuery({workspaceId:n},{enabled:!!n&&!!n.length}),r=(0,N.useSearchParams)(),o=null==r?void 0:r.get("workspaceId"),u=(0,N.useRouter)();return((0,h.useEffect)(()=>{o&&o.length&&o!==n&&(null==t?void 0:t.some(e=>e.id===o))&&(l(o),u.replace("/billing/overview",{scroll:!1}))},[n,o,t]),a&&s)?a&&!a.allowPlanChange?(0,i.jsx)(j.Vq,{open:e.open,onOpenChange:e.onOpenChange,children:(0,i.jsxs)(j.cZ,{className:"w-full max-w-[480px] rounded-lg bg-background",children:[(0,i.jsx)(j.fK,{className:"relative",children:(0,i.jsx)(j.$N,{className:"text-left text-lg font-semibold",children:e.dialogTitle})}),(0,i.jsxs)("div",{className:"relative flex min-h-[250px] w-full flex-col items-center justify-center gap-10 px-4 py-[96px]",children:[(0,i.jsx)(d.Z,{}),(0,i.jsx)("p",{className:"text-center",children:"Your current plan does not support plan changes."})]})]})}):(0,i.jsx)(k,{...e,currentPlan:a,proPlanDeal:s}):(0,i.jsx)(j.Vq,{open:e.open,onOpenChange:e.onOpenChange,children:(0,i.jsxs)(j.cZ,{className:"w-full max-w-[480px] rounded-lg bg-background",children:[(0,i.jsx)(j.fK,{className:"relative",children:(0,i.jsx)(j.$N,{className:"text-left text-lg font-semibold",children:e.dialogTitle})}),(0,i.jsx)("div",{className:"relative flex min-h-[250px] w-full flex-col items-center justify-center gap-10 px-[148px] py-[96px]",children:(0,i.jsx)(c.Z,{className:"size-6 animate-spin"})})]})})}},96246:function(e,n,l){l.d(n,{F$:function(){return i},Q5:function(){return o},qE:function(){return r}});var t=l(57437),a=l(27954);l(2265);var s=l(93448);function r(e){let{className:n,size:l="default",...r}=e;return(0,t.jsx)(a.fC,{"data-slot":"avatar","data-size":l,className:(0,s.cn)("group/avatar relative flex size-8 shrink-0 select-none rounded-full after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",n),...r})}function i(e){let{className:n,...l}=e;return(0,t.jsx)(a.Ee,{"data-slot":"avatar-image",className:(0,s.cn)("aspect-square size-full rounded-full object-cover",n),...l})}function o(e){let{className:n,...l}=e;return(0,t.jsx)(a.NY,{"data-slot":"avatar-fallback",className:(0,s.cn)("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",n),...l})}},30021:function(e,n,l){l.d(n,{AG:function(){return f},At:function(){return m},D5:function(){return x},Jb:function(){return d},aG:function(){return c},bg:function(){return p},gN:function(){return u}});var t=l(57437),a=l(2265),s=l(10407),r=l(67782),i=l(93448),o=l(27648);let c=a.forwardRef((e,n)=>{let{...l}=e;return(0,t.jsx)("div",{ref:n,"aria-label":"breadcrumb",...l})});c.displayName="Breadcrumb";
1let d=a.forwardRef((e,n)=>{let{className:l,...a}=e;return(0,t.jsx)("div",{ref:n,className:(0,i.cn)("flex flex-wrap items-center gap-1 break-all text-sm text-muted-foreground",l),...a})});d.displayName="BreadcrumbList";let u=a.forwardRef((e,n)=>{let{className:l,...a}=e;return(0,t.jsx)("div",{ref:n,className:(0,i.cn)("inline-flex items-center gap-1.5",l),...a})});u.displayName="BreadcrumbItem";let m=a.forwardRef((e,n)=>{let{className:l,...a}=e,s=null==a?void 0:a.href;return(0,t.jsx)(o.default,{href:null!=s?s:"#",ref:n,className:(0,i.cn)("transition-colors hover:text-foreground break-all",l),...a})});m.displayName="BreadcrumbLink";let f=a.forwardRef((e,n)=>{let{className:l,...a}=e;return(0,t.jsx)("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:(0,i.cn)("font-normal text-foreground break-all",l),...a})});f.displayName="BreadcrumbPage";let p=e=>{let{children:n,className:l,...a}=e;return(0,t.jsx)("div",{role:"presentation","aria-hidden":"true",className:(0,i.cn)("[&>svg]:h-3.5 [&>svg]:w-3.5",l),...a,children:null!=n?n:(0,t.jsx)(s.Z,{})})};p.displayName="BreadcrumbSeparator";let x=e=>{let{className:n,...l}=e;return(0,t.jsxs)("span",{role:"presentation","aria-hidden":"true",className:(0,i.cn)("flex h-9 w-9 items-center justify-center",n),...l,children:[(0,t.jsx)(r.Z,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"sr-only",children:"More"})]})};x.displayName="BreadcrumbElipssis"},15291:function(e,n,l){l.d(n,{Bw:function(){return p},DI:function(){return c},Ph:function(){return o},Ql:function(){return x},U$:function(){return g},i4:function(){return u},ki:function(){return d}});var t=l(57437),a=l(2265),s=l(20653),r=l(74797),i=l(93448);let o=r.fC,c=r.ZA,d=r.B4,u=a.forwardRef((e,n)=>{let{className:l,rightIcon:a,children:o,...c}=e;return(0,t.jsxs)(r.xz,{ref:n,className:(0,i.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",l),...c,children:[o,(0,t.jsx)(r.JO,{asChild:!0,children:a||(0,t.jsx)(s.v4q,{className:"h-4 w-4 transition-all data-[state=open]:rotate-180"})})]})});u.displayName=r.xz.displayName;let m=a.forwardRef((e,n)=>{let{className:l,...a}=e;return(0,t.jsx)(r.u_,{ref:n,className:(0,i.cn)("flex cursor-default items-center justify-center py-1",l),...a,children:(0,t.jsx)(s.g8U,{})})});m.displayName=r.u_.displayName;let f=a.forwardRef((e,n)=>{let{className:l,...a}=e;return(0,t.jsx)(r.$G,{ref:n,className:(0,i.cn)("flex cursor-default items-center justify-center py-1",l),...a,children:(0,t.jsx)(s.v4q,{})})});f.displayName=r.$G.displayName;let p=a.forwardRef((e,n)=>{let{className:l,children:a,position:s="popper",...o}=e;return(0,t.jsx)(r.h_,{children:(0,t.jsxs)(r.VY,{ref:n,className:(0,i.cn)("relative z-[9999999] 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"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",l),position:s,...o,children:[(0,t.jsx)(m,{}),(0,t.jsx)(r.l_,{className:(0,i.cn)("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,t.jsx)(f,{})]})})});p.displayName=r.VY.displayName,a.forwardRef((e,n)=>{let{className:l,...a}=e;return(0,t.jsx)(r.__,{ref:n,className:(0,i.cn)("px-2 py-1.5 text-sm font-semibold",l),...a})}).displayName=r.__.displayName;let x=a.forwardRef((e,n)=>{let{className:l,children:a,...o}=e;return(0,t.jsxs)(r.ck,{ref:n,className:(0,i.cn)("relative flex w-full cursor-pointer select-none items-center rounded-md py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",l),...o,children:[(0,t.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(r.wU,{children:(0,t.jsx)(s.nQG,{className:"h-4 w-4"})})}),(0,t.jsx)(r.eT,{children:a})]})});x.displayName=r.ck.displayName;
1let g=a.forwardRef((e,n)=>{let{className:l,...a}=e;return(0,t.jsx)(r.Z0,{ref:n,className:(0,i.cn)("-mx-1 my-1 h-px bg-muted",l),...a})});g.displayName=r.Z0.displayName},18849:function(e,n,l){l.d(n,{X:function(){return s}});var t=l(57437);l(2265);var a=l(93448);let s=e=>{let{children:n,className:l,style:s}=e;return(0,t.jsx)("div",{style:s,className:(0,a.cn)("simple-scrollarea",l),children:n})}},16461:function(e,n,l){l.d(n,{WorkspaceProvider:function(){return d},c:function(){return u}});var t=l(57437),a=l(62170),s=l(96990),r=l(80605),i=l(2265);let o=(0,i.createContext)(void 0),c="lastWorkspaceId",d=e=>{let{children:n}=e,{status:l}=(0,r.useSession)(),d="authenticated"===l,[u,m]=(0,i.useState)(""),[f,p]=(0,i.useState)(!1),[x,g]=(0,i.useState)(null),{data:h}=a.hi.workspace.getAll.useQuery(void 0,{enabled:d}),[b,w]=(0,i.useState)(void 0),[P,S]=(0,i.useState)(void 0),{data:v,isLoading:N}=a.hi.kb.getKBTreeById.useQuery({kbId:x},{enabled:!!x&&!!(null==h?void 0:h.some(e=>e.id===u))}),{data:R,isLoading:j}=a.hi.workspace.getUnlistedCollectionsAndArticles.useQuery({workspaceId:u},{enabled:!!(null==h?void 0:h.some(e=>e.id===u))}),E=a.hi.useContext(),{mutate:A}=a.hi.workspace.updateLastActiveAt.useMutation();(0,i.useEffect)(()=>{try{let e=localStorage.getItem(c);m(null!=e?e:"");let n=(0,s.Cd)();g(n),p(!0)}catch(e){console.error("Failed to load from localStorage:",e)}},[]),(0,i.useEffect)(()=>{if(f&&h&&h.length>0){let e=!!u&&u.length>0,n=h.some(e=>e.id===u);n&&e||(m(h[0].id),e&&!n&&(g(null),(0,s.vd)()))}},[h,f,u]),(0,i.useEffect)(()=>{E.workspace.getAll.invalidate()},[l]);let y=i.useCallback(e=>{g(n=>n===e?n:(e&&(0,s.fd)(e),e))},[]);return(0,i.useEffect)(()=>{u&&d&&A({workspaceId:u})},[u,d]),(0,i.useEffect)(()=>{v&&w(v),x||w(void 0)},[x,v]),(0,i.useEffect)(()=>{u?S(R):S(void 0)},[u,R]),(0,t.jsx)(o.Provider,{value:{workspaceId:u.length>0?u:null,setWorkspaceId:e=>{e!==u&&(g(null),w(void 0)),m(e);try{e?localStorage.setItem(c,e):localStorage.removeItem(c)}catch(e){console.error("Failed to save workspace ID to localStorage:",e)}},workspaces:h,activeKbId:x,setActiveKbId:y,activeKbTreeData:b,setActiveKbTreeData:w,unlistedTreeData:P,setUnlistedTreeData:S,activeKbTreeDataLoading:N,unlistedTreeDataLoading:j},children:n})},u=()=>{let e=(0,i.useContext)(o);if(void 0===e)throw Error("useWorkspace must be used within a WorkspaceProvider");return e}},38079:function(e,n,l){l.d(n,{BX:function(){return m},Lf:function(){return h},Vf:function(){return g},XH:function(){return r},_9:function(){return x},_I:function(){return u},gH:function(){return d},gI:function(){return p},m:function(){return a},nV:function(){return f},t2:function(){return b},tn:function(){return i},uz:function(){return o}});var t,a,s=l(93340);let r=2;s.SubscriptionPlan.FREE,s.BillingCycle.MONTHLY,s.SubscriptionPlan.FREE,s.BillingCycle.MONTHLY,s.BillingCycle.MONTHLY,s.SubscriptionPlan.FREE,s.SubscriptionPlan.STARTUP,s.SubscriptionPlan.GROWTH,s.SubscriptionPlan.PRO,s.SubscriptionPlan.GROOVE_UNTRANSFERRED,s.SubscriptionPlan.GROOVE_TRANSFERRED,s.SubscriptionPlan.APPSUMO,s.BillingCycle.YEARLY,s.SubscriptionPlan.FREE,s.SubscriptionPlan.STARTUP,s.SubscriptionPlan.GROWTH,s.SubscriptionPlan.PRO,s.SubscriptionPlan.GROOVE_UNTRANSFERRED,s.SubscriptionPlan.GROOVE_TRANSFERRED,s.SubscriptionPlan.APPSUMO,s.SubscriptionPlan.FREE,s.BillingCycle.MONTHLY,s.BillingCycle.YEARLY,s.SubscriptionPlan.STARTUP,s.Billing
1Cycle.MONTHLY,s.BillingCycle.YEARLY,s.SubscriptionPlan.GROWTH,s.BillingCycle.MONTHLY,s.BillingCycle.YEARLY,s.SubscriptionPlan.PRO,s.BillingCycle.MONTHLY,s.BillingCycle.YEARLY,s.SubscriptionPlan.GROOVE_UNTRANSFERRED,s.BillingCycle.MONTHLY,s.BillingCycle.YEARLY,s.SubscriptionPlan.GROOVE_TRANSFERRED,s.BillingCycle.MONTHLY,s.BillingCycle.YEARLY,s.SubscriptionPlan.APPSUMO,s.BillingCycle.MONTHLY,s.BillingCycle.YEARLY;let i={[s.SubscriptionPlan.FREE]:"Free",[s.SubscriptionPlan.STARTUP]:"Legacy",[s.SubscriptionPlan.GROWTH]:"Legacy",[s.SubscriptionPlan.PRO]:"Pro",[s.SubscriptionPlan.GROOVE_UNTRANSFERRED]:"Legacy",[s.SubscriptionPlan.GROOVE_TRANSFERRED]:"Legacy",[s.SubscriptionPlan.APPSUMO]:"AppSumo"};(t=a||(a={})).SEAT="SEAT",t.KB="KB",t.CREDIT_50="CREDIT_50";let o={SEAT:"Seats",KB:"Knowledge Base",CREDIT_50:"Credit Bundle"};s.SubscriptionPlan.FREE,s.SubscriptionPlan.STARTUP,s.SubscriptionPlan.GROWTH,s.SubscriptionPlan.PRO,s.SubscriptionPlan.GROOVE_UNTRANSFERRED,s.SubscriptionPlan.GROOVE_TRANSFERRED,s.SubscriptionPlan.APPSUMO;let c={[s.SubscriptionPlan.FREE]:{SEAT:-1,KB:-1,CREDIT_50:-1},[s.SubscriptionPlan.STARTUP]:{SEAT:20,KB:20,CREDIT_50:20},[s.SubscriptionPlan.GROWTH]:{SEAT:10,KB:20,CREDIT_50:10},[s.SubscriptionPlan.PRO]:{SEAT:10,KB:20,CREDIT_50:10},[s.SubscriptionPlan.GROOVE_UNTRANSFERRED]:{SEAT:-1,KB:-1,CREDIT_50:-1},[s.SubscriptionPlan.GROOVE_TRANSFERRED]:{SEAT:-1,KB:-1,CREDIT_50:-1},[s.SubscriptionPlan.APPSUMO]:{SEAT:-1,KB:-1,CREDIT_50:10}};s.SubscriptionPlan.FREE,s.SubscriptionPlan.STARTUP,s.SubscriptionPlan.GROWTH,s.SubscriptionPlan.PRO,s.SubscriptionPlan.GROOVE_UNTRANSFERRED,s.SubscriptionPlan.GROOVE_TRANSFERRED,s.SubscriptionPlan.APPSUMO;let d={[s.SubscriptionPlan.FREE]:{plan:s.SubscriptionPlan.FREE,seatsIncludedInPlan:-1,kbsIncludedInPlan:1,articlesIncludedInPlan:30,monthlyCredits:0,showWatermark:!0,allowCreditRecharge:!1,allowKBAddon:!1,allowSeatAddon:!1,customDomainFeature:!1,knowledgeGapFeature:!1,multilingualFeature:!1,importFeature:!1,allowPlanChange:!0},[s.SubscriptionPlan.STARTUP]:{plan:s.SubscriptionPlan.STARTUP,seatsIncludedInPlan:2,kbsIncludedInPlan:2,articlesIncludedInPlan:-1,monthlyCredits:100,showWatermark:!1,allowCreditRecharge:!0,allowKBAddon:!0,allowSeatAddon:!0,customDomainFeature:!0,knowledgeGapFeature:!0,multilingualFeature:!0,importFeature:!0,allowPlanChange:!0},[s.SubscriptionPlan.GROWTH]:{plan:s.SubscriptionPlan.GROWTH,seatsIncludedInPlan:5,kbsIncludedInPlan:2,articlesIncludedInPlan:-1,monthlyCredits:250,showWatermark:!1,allowCreditRecharge:!0,allowKBAddon:!0,allowSeatAddon:!0,customDomainFeature:!0,knowledgeGapFeature:!0,multilingualFeature:!0,importFeature:!0,allowPlanChange:!0},[s.SubscriptionPlan.PRO]:{plan:s.SubscriptionPlan.PRO,seatsIncludedInPlan:5,kbsIncludedInPlan:1,articlesIncludedInPlan:-1,monthlyCredits:250,showWatermark:!1,allowCreditRecharge:!0,allowKBAddon:!0,allowSeatAddon:!0,customDomainFeature:!0,knowledgeGapFeature:!0,multilingualFeature:!0,importFeature:!0,allowPlanChange:!0},[s.SubscriptionPlan.GROOVE_UNTRANSFERRED]:{plan:s.SubscriptionPlan.GROOVE_UNTRANSFERRED,seatsIncludedInPlan:5,kbsIncludedInPlan:1,articlesIncludedInPlan:-1,monthlyCredits:0,showWatermark:!1,allowCreditRecharge:!1,allowKBAddon:!1,allowSeatAddon:!1,customDomainFeature:!0,knowledgeGapFeature:!1,multilingualFeature:!1,importFeature:!1,allowPlanChange:!0},[s.SubscriptionPlan.GROOVE_TRANSFERRED]:{plan:s.SubscriptionPlan.GROOVE_TRANSFERRED,seatsIncludedInPlan:5,kbsIncludedInPlan:1,articlesIncludedInPlan:-1,monthlyCredits:0,showWatermark:!1,allowCreditRecharge:!1,allowKBAddon:!1,allowSeatAddon:!1,customDomainFeature:!0,knowledgeGapFeature:!1,multilingualFeature:!1,importFeature:!1,allowPlanChange:!0},[s.SubscriptionPlan.APPSUMO]:{plan:s.SubscriptionPlan.APPSUMO,seatsIncludedInPlan:5,kbsIncludedInPlan:1,articlesIncludedInPlan:-1,monthlyCredits:0,showWatermark:!1,allowCreditRecharge:!0,allowKBAddon:!1,allowSeatAddon:!1,customDomainFeature:!0,knowledgeGapFeature:!1,multilingualFeature:!1,importFeature:!1,allowPlanChange:!1}};s.SubscriptionPlan.FREE,s.BillingCycle.MONTHLY;let u=e=>-1===e?Number.MAX_SAFE_INTEGER:e,m=e=>{var n;return -1===e?"Unlimited":e>=Number.MAX_SAFE_INTEGER-5e3?"Unlimited":null===(n=null!=e?e:0)||void 0===n?void 0:n.toString()},f=e=>{let{config:n,addonsPrice:l}=e;return[{feature:"".concat(m(n.kbsIncludedInPlan)," knowledge base").concat(n.kbsIncludedInPlan>1||-1===n.kbsIncludedInPlan?"s":""),on:!0},{feature:"".concat(m(n.articlesIncludedInPlan)," article").concat(n.articlesIncludedInPlan>1||-1===n.articlesIncludedInPlan?"s":""),on:!0},{feature:"".concat(m(n.seatsIncludedInPlan)," team member").concat(n.seatsIncludedInPlan>1||-1===n.seatsIncludedInPlan?"s":""),on:!0},...n.monthlyCredits>0&&n.allowCreditRecharge?[{feature:"AI Recorder",on:!0}]:[],...n.knowledgeGapFeature?[{feature:"Knowledge Gap Finder",on:!0}]:[],...n.multilingualFeature?[{feature:"Multilingual knowledge base",on:!0}]:[],...n.monthlyCredits>0?[{feature:"".concat(n.monthlyCredits," AI credits per month"),on:!0}]:[],...n.customDomainFeature?[{feature:"Host on custom domain",on:!0}]:[{feature:"Can't add custom domain",on:!1}
1],...n.showWatermark?[{feature:'"Powered by InstantDocs" badge',on:!1}]:[{feature:"Remove InstantDocs branding",on:!0}],...n.importFeature?[{feature:"API & integrations",on:!0}]:[],...n.allowCreditRecharge?[{feature:"Additional credits: $".concat(l.CREDIT_50," per 50-pack"),on:!0}]:[],...n.allowKBAddon?[{feature:"Additional knowledge base: $".concat(l.KB,"/KB/month"),on:!0}]:[],...n.allowSeatAddon?[{feature:"Additional seats: $".concat(l.SEAT,"/seat/month"),on:!0}]:[]].sort((e,n)=>e.on&&!n.on?-1:!e.on&&n.on?1:0)},p={[s.SubscriptionPlan.FREE]:f({config:d[s.SubscriptionPlan.FREE],addonsPrice:c[s.SubscriptionPlan.FREE]}),[s.SubscriptionPlan.STARTUP]:f({config:d[s.SubscriptionPlan.STARTUP],addonsPrice:c[s.SubscriptionPlan.STARTUP]}),[s.SubscriptionPlan.GROWTH]:f({config:d[s.SubscriptionPlan.GROWTH],addonsPrice:c[s.SubscriptionPlan.GROWTH]}),[s.SubscriptionPlan.PRO]:f({config:d[s.SubscriptionPlan.PRO],addonsPrice:c[s.SubscriptionPlan.PRO]}),[s.SubscriptionPlan.GROOVE_UNTRANSFERRED]:[],[s.SubscriptionPlan.GROOVE_TRANSFERRED]:[],[s.SubscriptionPlan.APPSUMO]:[]},x=["Everything in Pro","SSO & advanced security","White-label","SLA & uptime guarantees","Migration + onboarding services","Dedicated account manager","Custom AI credit allowances"],g=7,h=e=>!!(e&&e.startsWith("sub_")),b={customDomainFeature:!0,knowledgeGapFeature:!0,multilingualFeature:!0,importFeature:!0}},34691:function(e,n,l){l.d(n,{B:function(){return r}});var t=l(67491),a=l(2556),s=l(51083);let r={color:a.VZ.orange,squareIcon:"".concat(t.O.NEXT_PUBLIC_S3_DOMAIN).concat(s.bF)}},51083:function(e,n,l){l.d(n,{Np:function(){return r},Y1:function(){return t},bF:function(){return a},tm:function(){return s}});let t="/logo_ipsum_square.png",a="/logo_ipsum_square_dark.png",s="/logo_ipsum.png",r="/logo_ipsum_dark.png"},96990:function(e,n,l){l.d(n,{Cd:function(){return r},Ic:function(){return a},fd:function(){return s},vd:function(){return i}});var t=l(64339);let a="lastOpenedKb";function s(e){e!==t.S&&window.localStorage.setItem(a,e)}function r(){return window.localStorage.getItem(a)}function i(){window.localStorage.removeItem(a)}},64339:function(e,n,l){l.d(n,{S:function(){return t}});let t="UNLISTED_KB"},4182:function(e,n,l){function t(e){let n=Math.floor(e/1e3);return"".concat(s(Math.floor(n%3600/60)),":").concat(s(n%60),".").concat(Math.floor(e%1e3/100))}function a(e){let n=Math.floor(e/1e3);return"".concat(s(Math.floor(n%3600/60)),":").concat(s(n%60))}function s(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,l=e+"";for(;l.length<n;)l="0"+l;return l}l.d(n,{$V:function(){return t},Mp:function(){return c},Qu:function(){return a},fm:function(){return o},jv:function(){return d},mr:function(){return r},pw:function(){return u},sw:function(){return f},vM:function(){return i},y7:function(){return m}});let r=e=>{let n=String(Math.floor(e/60)).padStart(2,"0"),l=String(Math.floor(e%60)).padStart(2,"0");return"".concat(n,":").concat(l)};function i(e){if(e<60)return"".concat(Math.round(e),"s");let n=Math.floor(e/60),l=Math.round(e%60);return 0===l?"".concat(n,"m"):"".concat(n,"m ").concat(l,"s")}function o(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function c(e){let n=Math.abs(e);if(0===n)return"PT0S";let l=Math.floor(n/1e3%60),t=Math.floor(n/6e4%60),a=Math.floor(n/36e5),s="PT";return a>0&&(s+=a+"H"),t>0&&(s+=t+"M"),l>0&&(s+=l+"S"),"PT"===s?"PT0S":s}let d=e=>{try{return new URL(e),!0}catch(e){return!1}},u=e=>new Intl.NumberFormat().format(e);function m(e){let n=Math.floor(e/1e3);if(n<60)return"".concat(n," sec");let l=Math.floor(n/60),t=n%60;return 0===t?"".concat(l," min"):"".concat(l,":").concat(t.toString().padStart(2,"0")," min")}let f=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,l=Math.pow(10,n);return Math.round(e*l)/l}},59242:function(e,n,l){l.d(n,{I:function(){return r},R:function(){return s}});var t=l(16461),a=l(62170);let s=e=>{let{kbId:n}=e,{workspaceId:l}=(0,t.c)(),{data:s,isLoading:r}=a.hi.workspace.getRoleAndAccess.useQuery({workspaceId:l,kbId:n},{enabled:!!l});return!s||r?{workspaceAccess:{role:null,noAccess:!0},kbAccess:{access:null,noAccess:!0},isLoading:!l||r}:{...s,isLoading:!l||r}},r=e=>{let{kbId:n,workspaceId:l}=e,{data:t,isLoading:s}=a.hi.workspace.getRoleAndAccess.useQuery({workspaceId:l,kbId:n},{enabled:!!l});return!t||s?{workspaceAccess:{role:null,noAccess:!0},kbAccess:{access:null,noAccess:!0},isLoading:!l||s}:{...t,isLoading:!l||s}}}}]);
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.