PageSourceSearch

https://www.etecplus.ai/_next/static/chunks/8113-1726b2b2e086aedc.js

js etecplus.ai collected 2026-10-05 14:25:34 UTC 17,382 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8113],{1777:(e,s,t)=>{t.d(s,{U:()=>c});var a=t(95155),n=t(51900),r=t(36999),l=t(92972),i=t(40980),d=t(8946);let o=[{value:"light",label:"Light",Icon:n.A},{value:"dark",label:"Dark",Icon:r.A},{value:"system",label:"System",Icon:l.A}];function c({className:e}){let{theme:s,setTheme:t}=(0,d.D)();return(0,a.jsx)("div",{role:"radiogroup","aria-label":"Colour theme",className:(0,i.cn)("flex items-center gap-0.5 rounded-full border bg-card p-0.5",e),children:o.map(({value:e,label:n,Icon:r})=>(0,a.jsx)("button",{type:"button",role:"radio","aria-checked":s===e,"aria-label":n,title:n,onClick:()=>t(e),className:(0,i.cn)("flex h-6 w-6 items-center justify-center rounded-full transition-colors",s===e?"bg-secondary text-foreground":"text-muted-foreground hover:text-foreground"),children:(0,a.jsx)(r,{className:"h-3.5 w-3.5"})},e))})}},3478:(e,s,t)=>{t.d(s,{h:()=>y});var a=t(95155),n=t(12115),r=t(98500),l=t.n(r),i=t(71275),d=t(41585),o=t(6296),c=t(21628),u=t(66609),m=t(27529),x=t(52492),p=t(13364),h=t(40980),f=t(36698),g=t(89239),j=t(72264);let b=[500,1e3,2e3,5e3,1e4];function N(e){let s=Math.abs(e);return s>=1e9?`${(e/1e9).toLocaleString("en-AU",{maximumFractionDigits:1})}B`:s>=1e6?`${(e/1e6).toLocaleString("en-AU",{maximumFractionDigits:1})}M`:s>=1e3?`${Math.floor(e/1e3).toLocaleString("en-AU")}K`:e.toLocaleString("en-AU")}function w(e){return`A$${(e/100).toLocaleString("en-AU",{minimumFractionDigits:e%100?2:0,maximumFractionDigits:2})}`}function y({workspaceId:e,className:s}){let{current:t}=(0,f.h)(),r=e??t?.id??null,v=!!e||t?.role==="admin",[k,C]=(0,n.useState)(null),[A,S]=(0,n.useState)(null),[$,I]=(0,n.useState)(!1),D=(0,n.useRef)(0),_=(0,n.useCallback)(async()=>{if(!r||!v)return;let e=++D.current;try{let s=await (0,m.nr)(`/api/billing/credit?workspace=${r}`);e===D.current&&C(s)}catch{}},[r,v]);if((0,n.useEffect)(()=>{C(null),_()},[_]),(0,n.useEffect)(()=>{let e=()=>void _();window.addEventListener("focus",e);let s=(0,x.X)(e),t=setInterval(()=>{"visible"===document.visibilityState&&e()},6e4);return()=>{window.removeEventListener("focus",e),s(),clearInterval(t)}},[_]),!v||!r||!k)return null;let T=k.topup?b.filter(e=>e>=k.topup.minAudCents&&e<=k.topup.maxAudCents):[],M=T.length?T:k.topup?[k.topup.minAudCents,k.topup.maxAudCents]:[],O=null!=A&&M.includes(A)?A:M.find(e=>2e3===e)??M[0]??null,L=null!=O&&k.topup?(0,p.X7)(O,k.topup.creditsPerAudCent):0,E=k.owedCredits>0||!!k.pausedAt,U=k.autoTopup?.enabled?k.autoTopup.thresholdCredits:1e6,z=k.reserveCredits??0,B=1e4*Math.round((k.agentsHeldCredits??0)/1e4),F=k.balanceCredits+B,J=!E&&null!=k.flowDue&&k.balanceCredits<z+k.flowDue.credits,R=!E&&(k.balanceCredits<Math.max(U,z+(k.agentMinCredits??0))||J),G=E?"bg-destructive":R?"bg-status-warning":"bg-status-good";async function Q(){if(null!=O&&r){I(!0);try{let{url:e}=await (0,m.nr)("/api/billing/topup-checkout",{method:"POST",body:JSON.stringify({workspace_id:r,amountAudCents:O})});window.location.href=e}catch(e){u.oR.error(e.message),I(!1)}}}let X=k.autoTopup?k.autoTopup.failed&&!k.autoTopup.enabled?"Auto top-up needs attention":k.autoTopup.enabled?`Auto top-up on \xb7 ${w(k.autoTopup.amountAudCents)}`:"Auto top-up off":"Auto top-up off";return(0,a.jsxs)(j.rI,{onOpenChange:e=>e&&void _(),children:[(0,a.jsx)(j.ty,{asChild:!0,children:(0,a.jsxs)(g.$,{variant:"outline",size:"sm","aria-label":`Your credit: ${(0,p.Ql)(F)} credits${E?", agents paused":R?", running low":""}`,className:(0,h.cn)("h-9 gap-1.5 px-2.5 tabular-nums lg:h-8",E&&"border-destructive/50 text-destructive hover:text-destructive",R&&"border-warning/50",s),children:[(0,a.jsx)(i.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-xs font-semibold",children:N(F)}),(0,a.jsx)("span",{className:"hidden text-xs font-normal text-muted-foreground sm:inline",children:"credits"}),(E||R)&&(0,a.jsx)("span",{"aria-hidden":!0,className:(0,h.cn)("h-1.5 w-1.5 rounded-full",E?"bg-destructive":"bg-warning")})]})}),(0,a.jsxs)(j.SQ,{className:"w-[min(20rem,calc(100vw-1.5rem))] p-0",align:"end",side:"bottom",children:[(0,a.jsxs)("div",{className:"space-y-1 px-4 pb-3 pt-4",children:[(0,a.jsx)(j.lp,{className:"p-0 text-xs font-medium text-muted-foreground",children:"Your credit"}),(0,a.jsxs)("p",{className:"text-2xl font-semibold tabular-nums tracking-tight",children:[(0,p.Ql)(F)," ",(0,a.jsx)("span",{className:"text-sm font-normal text-muted-foreground",children:"credits"})]}),F>0&&(0,a.jsxs)("div",{className:"space-y-1.5 pt-2",children:[(0,a.jsxs)("div",{className:"flex h-1.5 gap-0.5 overflow-hidden rounded-full bg-muted",children:[k.balanceCredits>0&&(0,a.jsx)("span",{className:(0,h.cn)("h-full rounded-full",G),style:{width:`${k.balanceCredits/F*100}%`}}),B>0&&(0,a.jsx)("span",{className:"h-full rounded-full bg-chart-1",style:{width:`${B/F*100}%`}})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{"aria-hidden":!0,
1className:(0,h.cn)("h-2 w-2 rounded-full",G)}),"Available ",(0,a.jsx)("span",{className:"font-medium tabular-nums text-foreground",children:N(k.balanceCredits)})]}),B>0&&(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{"aria-hidden":!0,className:"h-2 w-2 rounded-full bg-chart-1"}),"On your agents ",(0,a.jsx)("span",{className:"font-medium tabular-nums text-foreground",children:N(B)})]})]})]})]}),E&&(0,a.jsxs)("div",{className:"mx-3 mb-3 flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2.5 text-xs leading-relaxed",children:[(0,a.jsx)(d.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive"}),(0,a.jsxs)("p",{children:[(0,a.jsx)("span",{className:"font-medium",children:k.pausedAt?"Agents paused.":"Compute owed."})," ",k.owedCredits>0?`${N(k.owedCredits)} owed. `:"","Top up to ",k.pausedAt?"resume":"clear it","."]})]}),R&&(0,a.jsxs)("p",{className:"mx-3 mb-3 rounded-md border border-warning/40 bg-warning/10 p-2.5 text-xs leading-relaxed",children:[(0,a.jsx)("span",{className:"font-medium",children:"Running low."})," ",J&&k.flowDue?`Flow+ renewal (${N(k.flowDue.credits)}) due ${new Date(k.flowDue.dueAt).toLocaleDateString("en-AU",{day:"numeric",month:"short"})}.`:k.autoTopup?.enabled?"Auto top-up will refill it.":"Top up to keep agents running."]}),M.length>0&&null!=O&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j.mB,{className:"my-0"}),(0,a.jsxs)("div",{className:"space-y-2.5 px-3 py-3",children:[(0,a.jsx)("p",{className:"px-1 text-xs font-medium",children:"Add credit"}),(0,a.jsx)("div",{className:(0,h.cn)("grid gap-1.5",M.length>=5?"grid-cols-5":"grid-cols-4"),children:M.map(e=>(0,a.jsx)(j._2,{onSelect:s=>{s.preventDefault(),S(e)},"aria-label":`${w(e)}${e===O?", selected":""}`,className:(0,h.cn)("h-9 cursor-pointer justify-center rounded-md border px-0 text-[13px] font-medium tabular-nums",e===O?"border-foreground bg-foreground text-background focus:bg-foreground
1/90 focus:text-background":"bg-background"),children:w(e)},e))}),(0,a.jsxs)(j._2,{disabled:$,onSelect:e=>{e.preventDefault(),Q()},className:"h-9 cursor-pointer justify-center gap-2 rounded-md bg-primary text-sm font-medium text-primary-foreground focus:bg-primary/90 focus:text-primary-foreground",children:[$?(0,a.jsx)(o.A,{className:"h-4 w-4 animate-spin"}):null,$?"Opening checkout…":`Buy ${w(O)} \xb7 ${N(L)} credits`]})]})]}),(0,a.jsx)(j.mB,{className:"my-0"}),(0,a.jsx)("div",{className:"p-1.5",children:(0,a.jsx)(j._2,{asChild:!0,className:"cursor-pointer justify-between gap-3 px-2.5 py-2",children:(0,a.jsxs)(l(),{href:"/dashboard/settings/billing",children:[(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block text-sm",children:"More billing options"}),(0,a.jsx)("span",{className:(0,h.cn)("block truncate text-xs text-muted-foreground",k.autoTopup?.failed&&!k.autoTopup.enabled&&"text-destructive"),children:X})]}),(0,a.jsx)(c.A,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]})})})]})]})}},28713:(e,s,t)=>{t.d(s,{U:()=>n});var a=t(93734);function n(){return(0,a.createBrowserClient)("https://zathjeurxmitlqiyzgdu.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InphdGhqZXVyeG1pdGxxaXl6Z2R1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODM5ODMxMzQsImV4cCI6MjA5OTU1OTEzNH0.PFA-mEZ8HnSYa6HVk30I6UTGV-f1Wa9W4o0z4jMow6Y")}},33807:(e,s,t)=>{t.d(s,{J:()=>i});var a=t(95155),n=t(12115),r=t(28136),l=t(40980);let i=n.forwardRef(({className:e,...s},t)=>(0,a.jsx)(r.b,{ref:t,className:(0,l.cn)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...s}));i.displayName=r.b.displayName},95896:(e,s,t)=>{t.d(s,{r:()=>h});var a=t(95155),n=t(98500),r=t.n(n),l=t(71988),i=t(61767),d=t(40980),o=t(48405),c=t(89239),u=t(72264),m=t(15929),x=t(68128);function p({n:e,onRead:s}){let t=!e.read_at,n=(0,a.jsxs)("div",{className:"flex w-full items-start gap-2",children:[(0,x.z)(e.kind)?(0,a.jsx)(x.H,{kind:e.kind,className:(0,d.cn)(!t&&"opacity-50")}):(0,a.jsx)("span",{"aria-hidden":!0,className:(0,d.cn)("mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full",t?m.cp.has(e.kind)?"bg-destructive":"bg-brand-ink":"bg-transparent")}),(0,a.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,a.jsx)("span",{className:(0,d.cn)("truncate text-xs",t?"font-medium text-foreground":"text-muted-foreground"),children:e.title}),e.body&&(0,a.jsx)("span",{className:"line-clamp-2 text-[11px] text-muted-foreground",children:e.body}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let s=Math.round((Date.now()-new Date(e).getTime())/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let t=Math.round(s/60);return t<24?`${t}h ago`:`${Math.round(t/24)}d ago`}(e.created_at)})]})]});return(0,a.jsx)(u._2,{asChild:!!e.href,onClick:s,className:"items-start py-2",children:e.href?(0,a.jsx)(r(),{href:e.href,children:n}):n})}function h({className:e}){let{items:s,unreadCount:t,markRead:n,markAllRead:r,osPermission:m,requestOsPermission:x}=(0,o.E$)(),f=t>0;return(0,a.jsxs)(u.rI,{children:[(0,a.jsx)(u.ty,{asChild:!0,children:(0,a.jsxs)(c.$,{variant:"ghost",size:"icon","aria-label":f?`Notifications (${t} unread)`:"Notifications",className:(0,d.cn)("relative",e),children:[f?(0,a.jsx)(l.A,{className:"h-4 w-4"}):(0,a.jsx)(i.A,{className:"h-4 w-4"}),f&&(0,a.jsx)("span",{className:"absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-brand px-1 text-[10px] font-semibold tabular-nums text-brand-foreground motion-safe:animate-badge-pop",children:t>9?"9+":t})]})}),(0,a.jsxs)(u.SQ,{className:"w-80",align:"end",side:"bottom",children:[(0,a.jsxs)(u.lp,{className:"flex items-center justify-between font-normal",children:[(0,a.jsx)("span",{className:"text-xs font-medium",children:"Notifications"}),f&&(0,a.jsx)("button",{type:"button",onClick:r,className:"text-[11px] text-muted-foreground transition-colors hover:text-foreground",children:"Mark all read"})]}),(0,a.jsx)(u.mB,{}),0===s.length?(0,a.jsx)("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"You're all caught up."}):(0,a.jsx)("div",{className:"max-h-80 overflow-y-auto",children:s.map(e=>(0,a.jsx)(p,{n:e,onRead:()=>n([e.id])},e.id))}),"default"===m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.mB,{}),(0,a.jsxs)(u._2,{onSelect:e=>{e.preventDefault(),x()},children:[(0,a.jsx)(i.A,{className:"h-4 w-4"}),"Enable desktop notifications"]})]}),"denied"===m&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.mB,{}),(0,a.jsx)("p",{className:"px-2 py-1.5 text-[10px] text-muted-foreground",children:"Desktop notifications are blocked in your browser settings."})]})]})]})}},98030:(e,s,t)=>{t.d(s,{j:()=>S});var a=t(95155),n=t(12115),r=t(73321),l=t(51900),i=t(36999),d=t(92972),o=t(56563),c=t(94514),u=t(51914),m=t(79372),x=t(4903),p=t(44478),h=t(41313),f=t(66609),g=t(28713),j=t(36698),b=t(8946),N=t(27529),w=t(89239),y=t(60529),v=t(33807),k=t(72264),C=t(42763);let A=[{value:"light",label:"Light",Icon:l.A},{value:"dark",label:"Dark",Icon:i.A},{value:"system",label:"System",Icon:d.A}];function S(){let e=(0,r.useRouter)(),{workspaces:s,current:t,setCurrentId:l,refresh:i,userEmail:d,isSuperAdmin:S,isPartner:$,fullName:I,avatarUrl:D,initials:_}=(0,j.h)(),{theme:T,setTheme:M}
1=(0,b.D)(),[O,L]=(0,n.useState)(!1),[E,U]=(0,n.useState)(""),[z,B]=(0,n.useState)(!1);async function F(){await (0,g.U)().auth.signOut(),window.location.href="/login"}async function J(){if(E.trim()){B(!0);try{let{workspace:s}=await (0,N.nr)("/api/workspaces",{method:"POST",body:JSON.stringify({name:E.trim()})});await i(),l(s.id),U(""),L(!1),e.push("/dashboard"),f.oR.success("Workspace created")}catch(e){f.oR.error(e.message)}finally{B(!1)}}}let R=(e="h-7 w-7")=>D?(0,a.jsx)("img",{src:D,alt:I||d,className:`${e} shrink-0 rounded-md object-cover border border-border`}):(0,a.jsx)("span",{className:`flex ${e} shrink-0 items-center justify-center rounded-md bg-primary/10 text-xs font-semibold text-primary border border-primary/20`,children:_});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(k.rI,{children:[(0,a.jsx)(k.ty,{asChild:!0,children:(0,a.jsxs)(w.$,{variant:"ghost",className:"h-auto w-full justify-between px-2 py-2 font-normal",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[R(),(0,a.jsxs)("span",{className:"flex min-w-0 flex-col text-left",children:[(0,a.jsx)("span",{className:"truncate text-sm font-medium",children:I||d}),(0,a.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:t?.name??"Select workspace"})]})]}),(0,a.jsx)(o.A,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),(0,a.jsxs)(k.SQ,{className:"w-56",align:"start",side:"top",children:[(0,a.jsxs)(k.lp,{className:"flex items-center gap-2 font-normal",children:[R(),(0,a.jsxs)("div",{className:"flex flex-col min-w-0 truncate",children:[I&&(0,a.jsx)("span",{className:"truncate font-medium text-xs text-foreground",children:I}),(0,a.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:d})]})]}),(0,a.jsx)(k.mB,{}),(0,a.jsx)(k.lp,{className:"text-xs font-medium text-muted-foreground",children:"Workspaces"}),s.map(s=>(0,a.jsxs)(k._2,{onClick:()=>{var a;(a=s.id)!==t?.id&&(l(a),e.push("/dashboard"))},children:[(0,a.jsx)("span",{className:"flex-1 truncate",children:s.name}),s.id===t?.id&&(0,a.jsx)(c.A,{className:"h-4 w-4"})]},s.id)),(0,a.jsxs)(k._2,{onClick:()=>L(!0),children:[(0,a.jsx)(u.A,{className:"h-4 w-4"}),"New workspace"]}),t?.role==="admin"&&(0,a.jsxs)(k._2,{onClick:()=>e.push("/dashboard/settings/billing"),children:[(0,a.jsx)(m.A,{className:"h-4 w-4"}),"Billing & subscription"]}),$&&(0,a.jsxs)(k._2,{onClick:()=>e.push("/partner/dashboard"),children:[(0,a.jsx)(x.A,{className:"h-4 w-4"}),"Partner portal"]}),S&&(0,a.jsxs)(k._2,{onClick:()=>e.push("/admin"),children:[(0,a.jsx)(p.A,{className:"h-4 w-4"}),"Admin console"]}),(0,a.jsx)(k.mB,{}),(0,a.jsx)(k.lp,{className:"text-xs font-medium text-muted-foreground",children:"Appearance"}),A.map(({value:e,label:s,Icon:t})=>(0,a.jsxs)(k._2,{onSelect:s=>{s.preventDefault(),M(e)},children:[(0,a.jsx)(t,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"flex-1",children:s}),T===e&&(0,a.jsx)(c.A,{className:"h-4 w-4"})]},e)),(0,a.jsx)(k.mB,{}),(0,a.jsxs)(k._2,{onClick:F,className:"text-destructive focus:text-destructive",children:[(0,a.jsx)(h.A,{className:"h-4 w-4"}),"Log out"]})]})]}),(0,a.jsx)(C.lG,{open:O,onOpenChange:L,children:(0,a.jsxs)(C.Cf,{children:[(0,a.jsxs)(C.c7,{children:[(0,a.jsx)(C.L3,{children:"New workspace"}),(0,a.jsx)(C.rr,{children:"Workspaces keep agents and members separate."})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(v.J,{htmlFor:"ws-name",children:"Name"}),(0,a.jsx)(y.p,{id:"ws-name",value:E,onChange:e=>U(e.target.value),placeholder:"Acme Production",onKeyDown:e=>"Enter"===e.key&&J()})]}),(0,a.jsxs)(C.Es,{children:[(0,a.jsx)(w.$,{variant:"outline",onClick:()=>L(!1),disabled:z,children:"Cancel"}),(0,a.jsx)(w.$,{onClick:J,disabled:z||!E.trim(),children:z?"Creating...":"Create"})]})]})})]})}},99412:(e,s,t)=>{t.d(s,{CG:()=>o,cj:()=>d,h:()=>m});var a=t(95155),n=t(12115),r=t(43146),l=t(33210),i=t(40980);let d=r.bL,o=r.l9,c=r.ZL;r.bm;let u=n.forwardRef(({className:e,...s},t)=>(0,a.jsx)(r.hJ,{ref:t,className:(0,i.cn)("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...s}));u.displayName=r.hJ.displayName;let m=n.forwardRef(({className:e,children:s,title:t,...n},d)=>(0,a.jsxs)(c,{children:[(0,a.jsx)(u,{}),(0,a.jsxs)(r.UC,{ref:d,className:(0,i.cn)("fixed inset-y-0 left-0 z-50 flex h-full w-72 max-w-[85vw] flex-col border-r bg-card shadow-lg outline-none duration-200 data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",e),...n,children:[(0,a.jsx)(r.hE,{className:"sr-only",children:t}),s,(0,a.jsxs)(r.bm,{className:"absolute right-3 top-3 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring disabled:pointer-events-none",children:[(0,a.jsx)(l.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));m.displayName=r.UC.displayName}}]);

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.