1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,5525,e=>{"use strict";var t=e.i(356438),a=e.i(807324),r=e.i(143708),n=e.i(922860),s=e.i(190231),i=e.i(629423);let l=a.forwardRef(({className:e,...a},r)=>(0,t.jsx)("div",{className:"relative w-full overflow-auto",children:(0,t.jsx)("table",{ref:r,className:(0,i.cn)("w-full caption-bottom text-sm",e),...a})}));l.displayName="Table";let o=a.forwardRef(({className:e,...a},r)=>(0,t.jsx)("thead",{ref:r,className:(0,i.cn)("[&_tr]:border-b",e),...a}));o.displayName="TableHeader";let c=a.forwardRef(({className:e,...a},r)=>(0,t.jsx)("tbody",{ref:r,className:(0,i.cn)("[&_tr:last-child]:border-0",e),...a}));c.displayName="TableBody",a.forwardRef(({className:e,...a},r)=>(0,t.jsx)("tfoot",{ref:r,className:(0,i.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...a})).displayName="TableFooter";let d=a.forwardRef(({className:e,...a},r)=>(0,t.jsx)("tr",{ref:r,className:(0,i.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...a}));d.displayName="TableRow";let u=a.forwardRef(({className:e,...a},r)=>(0,t.jsx)("th",{ref:r,className:(0,i.cn)("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a}));u.displayName="TableHead";let p=a.forwardRef(({className:e,...a},r)=>(0,t.jsx)("td",{ref:r,className:(0,i.cn)("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...a}));p.displayName="TableCell",a.forwardRef(({className:e,...a},r)=>(0,t.jsx)("caption",{ref:r,className:(0,i.cn)("mt-4 text-sm text-muted-foreground",e),...a})).displayName="TableCaption";var m=e.i(419952);let x=({paymentsData:e})=>{let[r,n]=(0,a.useState)(!1);return(0,t.jsxs)("div",{className:"rounded-2xl border border-border bg-card py-2 px-4 mt-4",children:[(0,t.jsxs)("div",{className:"flex gap-2 justify-between items-center",children:[(0,t.jsx)("span",{children:"View your top-up history"}),(0,t.jsx)(m.Button,{onClick:()=>n(!r),variant:"link",className:"underline",children:r?"Hide":"Show"})]}),r&&e.length>0&&(0,t.jsx)("div",{className:"mt-4 overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-left table-auto border-collapse",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"border-b border-border",children:[(0,t.jsx)("th",{className:"px-4 py-2",children:"Purchased At"}),(0,t.jsx)("th",{className:"px-4 py-2",children:"Amount"}),(0,t.jsx)("th",{className:"px-4 py-2",children:"Currency"}),(0,t.jsx)("th",{className:"px-4 py-2",children:"Invoice"})]})}),(0,t.jsx)("tbody",{children:e.map(e=>(0,t.jsxs)("tr",{className:"border-b border-border/50 hover:bg-accent",children:[(0,t.jsx)("td",{className:"px-4 py-2",children:e.purchasedAt.toLocaleString()}),(0,t.jsx)("td",{className:"px-4 py-2",children:e.amount/100}),(0,t.jsx)("td",{className:"px-4 py-2",children:e.currency}),(0,t.jsx)("td",{className:"px-4 py-2",children:e.invoiceUrl?(0,t.jsx)("a",{href:e.invoiceUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:underline",children:"View Invoice"}):"-"})]},e.invoice_id))})]})}),r&&0===e.length&&(0,t.jsx)("p",{className:"text-muted-foreground text-center",children:"No payments yet"})]})};e.i(797149);var h=e.i(472998),f=e.i(472812),b=e.i(746971);let v=(0,b.default)("calendar-check",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);var w=e.i(583957),g=e.i(882508),y=e.i(592853),N=e.i(935403);let k=(0,b.default)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]);var j=e.i(804436),E=e.i(570627);let R=(0,b.default)("user-plus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);var S=e.i(836403),_=e.i(966152),C=e.i(123039);function T({icon:e,iconTone:a="violet",name:n,sub:s,reward:l,state:o,action:c,checking:d,doneLabel:u="Shared",variant:p="row",frozen:x=!1,soon:h=!1,working:f=!1,actionAlwaysLive:b=!1}){let v,w,g=void 0!==d,y=!g&&"doneToday"===o.kind,N=!g&&"exhausted"===o.kind,
1k=x||y||N,j=x||h||(y||N)&&!b;return(0,t.jsxs)("div",{className:(0,i.cn)("flex items-center gap-[11px] transition-colors sm:gap-[14px]","row"===p&&"px-[13px] py-[9px] sm:px-4 sm:py-[11px]","row"===p&&!x&&"hover:bg-[var(--eb-row-hover)]","plate"===p&&"rounded-[14px] border border-[var(--eb-border)] bg-[var(--eb-card)] px-[13px] py-2 sm:px-4 sm:py-[9px]","plate"===p&&!x&&!N&&"hover:border-[var(--eb-violet-edge)]",N&&"opacity-60"),children:[(0,t.jsx)("span",{className:(0,i.cn)("inline-flex size-8 shrink-0 items-center justify-center rounded-[9px] border border-[var(--eb-button-border)] bg-transparent sm:size-[34px]",k&&"text-[var(--eb-dimmest)]",!k&&"violet"===a&&"text-[var(--eb-violet)]",!k&&"text"===a&&"text-[var(--eb-text)]",!k&&"muted"===a&&"text-[var(--eb-muted)]"),children:e}),(n||s||g)&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-px",children:[n&&(0,t.jsx)("span",{className:"truncate text-[15px] font-semibold",children:n}),(s||g)&&(0,t.jsx)("span",{className:"truncate text-xs text-[var(--eb-muted)] sm:text-[13px]",children:g?"Checkingâ¦":s})]}),(0,t.jsx)("div",{className:"flex-1"}),c?.reward===void 0&&(0,t.jsxs)("span",{className:(0,i.cn)("mr-1 inline-flex items-center gap-px text-base font-semibold tabular-nums sm:mr-1.5",k?"text-[var(--eb-muted)]":"text-[var(--eb-violet)]"),children:[(0,t.jsx)(r.Zap,{className:"size-[14px] fill-current","aria-hidden":"true"}),l]}),j||!c?(0,t.jsxs)("span",{className:(0,i.cn)("inline-flex h-8 items-center gap-[7px] rounded-[9px] bg-[var(--eb-done)] px-3 text-sm text-[var(--eb-muted)] sm:h-[34px] sm:px-[18px]",c?.reward!==void 0&&"w-[88px] justify-center gap-1.5 px-0 sm:w-[96px] sm:px-0"),children:[(y||N)&&(0,t.jsx)(_.Check,{className:"size-4 shrink-0","aria-hidden":"true",strokeWidth:2.5}),N?"Done":y?u:h?"Soon":c?.label||"Paused"]}):(0,t.jsx)(m.Button,{type:"button",onClick:f||g?void 0:c.onClick,"aria-label":c.ariaLabel,"aria-busy":f||g||void 0,className:(0,i.cn)("relative rounded-[9px] px-4 text-sm font-medium shadow-none after:absolute after:left-0 after:top-1/2 after:h-10 after:w-full after:-translate-y-1/2 after:content-[''] sm:px-[22px]","h-8 sm:h-[34px]",void 0!==c.reward&&"w-[88px] justify-center gap-1.5 px-0 sm:w-[96px] sm:px-0",c.primary?"bg-[var(--eb-violet-fill)] text-[var(--eb-on-violet)] hover:bg-[var(--eb-violet-fill-hover)]":"border border-[var(--eb-button-border)] bg-transparent text-[var(--eb-text)] hover:border-[var(--eb-violet-edge)] hover:bg-[var(--eb-violet-tint)]"),children:g?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C.Loader2,{className:"energy-spin size-4","aria-hidden":"true"}),(0,t.jsx)("span",{className:"font-semibold tabular-nums",children:(w=Math.floor((v=Math.max(0,Math.floor(d.elapsedSeconds)))/60),`${w}:${String(v%60).padStart(2,"0")}`)})]}):void 0!==c.reward?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-px font-semibold tabular-nums",children:[(0,t.jsx)(r.Zap,{className:(0,i.cn)("size-[14px] fill-current",!c.primary&&"text-[var(--eb-violet)]"),"aria-hidden":"true"}),l]}),f?(0,t.jsx)(C.Loader2,{className:"energy-spin size-4","aria-hidden":"true"}):c.icon]}):(0,t.jsxs)(t.Fragment,{children:[f?(0,t.jsx)(C.Loader2,{className:"energy-spin size-4","aria-hidden":"true"}):c.icon,c.label]})})]})}var L=e.i(19138),A=e.i(534153),I=e.i(188289),P=e.i(165592);let $=(0,P.createServerReference)("0007ea6d7f9e3fb8ead1cc1575f1ef98f4e308adde",P.callServer,void 0,P.findSourceMapURL,"listShareableWorks");var M=e.i(534463);let O=M.FEATURES.find(e=>"nano-banana"===e.id)?.href??"/chat";function D(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function U({open:e,confirmLabel:r,onOpenChange:n,onConfirm:s}){let[i,l]=(0,a.useState)(null),[o,c]=(0,a.useState)(!1),[d,u]=(0,a.useState)(null),p=(0,a.useRef)(!0),x=(0,a.useRef)(!1);(0,a.useEffect)(()=>(p.current=!0,()=>{p.current=!1}),[]),(0,a.useEffect)(()=>{e&&!x.current&&(x.current=!0,c(!0),(async()=>{try{let e=await $();p.current&&l(e)}catch{p.current&&l([])}finally{p.current&&c(!1)}})())},[e]);let f=(0,a.useCallback)(()=>{d&&(n(!1),s(d))},[d,s,n]),b=i?function(e,t){let a=[];for(let r of e){let e=function(e,t){let a=new Date(e);if(Number.isNaN(a.getTime()))return"Earlier";let r=Math.round((D(t)-D(a))/864e5);return r<=0?"Today":1===r?"Yesterday":a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(r.createdAt,t),n=a[a.length-1];n&&n.label===e?n.works.push(r):a.push({label:e,works:[r]})}return a}(i,new Date):[];return(0,t.jsx)(I.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(I.DialogContent,{className:"energy-board max-h-[92dvh] gap-3 bg-[var(--eb-card)] text-[var(--eb-text)] md:max-w-xl",children:[(0,t.jsxs)(I.DialogHeader,{children:[(0,t.jsx)(I.DialogTitle,{children:"Choose what to share"}),(0,t.jsx)(I.DialogDescription,{className:"text-[var(--eb-muted)]",children:"Sharing gives this work its own public page."})]}),o&&null===i?(0,t.jsxs)("div",{className:"flex items-center gap-2 py-6 text-sm text-[var(--eb-muted)]",children:[(0,t.jsx)(C.Loader2,{className:"size-4 animate-spin text-[var(--eb-violet)]","aria-hidden":"true"}),"Loading your work"]}):0===b.length?(0,t.jsxs)("p",{className:"py-6 text-sm text-[var(--eb-muted)]",children:["Nothing finished yet."," ",(0,t.jsx)(h.default,{href:O,className:"font-medium text-[var(--eb-violet)] underline",children:"Make something first"}),"."]}):(0,t.jsx)("div",{className:"-mx-1 flex max-h-[52dvh] flex-col gap-3 overflow-y-auto px-1",children:b.map(e=>(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[0.3px] text-[var(--eb-dimmest)]",children:e.label}),(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:e.works.map(e=>(0,t.jsx)(F,{work:e,selected:d===e.id,onSelect:()=>u(e.id)},e.id))})]},e.label))}),b.length>0&&(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(m.Button,{type:"button",disabled:null===d,onClick:f,className:"h-9 rounded-[10px] bg-[var(--eb-violet)] px-[22px] text-sm font-medium text-[var(--eb-on-violet)] shadow-none hover:bg-[var(--eb-violet-hover)] disabled:opacity-50",children:r})})]})})}function F({work:e,selected:a,onSelect:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,"aria-pressed":a,"aria-label":e.name,className:(0,i.cn)("relative aspect-square overflow-hidden rounded-[11px] border bg-[var(--eb-done)] transition-colors",a?"border-[var(--eb-violet)] ring-2 ring-[var(--eb-violet)]":"border-[var(--eb-border)] hover:border-[var(--eb-violet-edge)]"),children:["image"===e.media&&(0,t.jsx)("img",{src:e.url,alt:"",className:"size-full object-cover"}),"video"===e.media&&(0,t.jsx)("video",{src:e.url,muted:!0,playsInl
1ine:!0,preload:"metadata",className:"size-full object-cover"}),"audio"===e.media&&(0,t.jsxs)("span",{className:"flex size-full flex-col items-center justify-center gap-1 px-2 text-[var(--eb-muted)]",children:[(0,t.jsx)(A.AudioLines,{className:"size-5","aria-hidden":"true"}),(0,t.jsx)("span",{className:"line-clamp-2 text-[11px]",children:e.name})]})]})}function G(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}let Y=(0,P.createServerReference)("00df837e38345bd570726ace92d58f25fb4675f226",P.callServer,void 0,P.findSourceMapURL,"canVerifyXPosts"),z=(0,P.createServerReference)("00f2c9cbf27e98fc5764b0a4b2fd4f427ef31f5831",P.callServer,void 0,P.findSourceMapURL,"creditXConnectEnergy"),B=(0,P.createServerReference)("00c72253c9333ef706c1b80dbf04b59e3f2ecfec1a",P.callServer,void 0,P.findSourceMapURL,"isXConnected"),W=(0,P.createServerReference)("00de1ad6894d9c03c3fdcad513cb9afe239e0a8cfe",P.callServer,void 0,P.findSourceMapURL,"creditXPostIfFound"),V=(0,P.createServerReference)("009de07acc47cfee9f878ccd6cdba961b506507e9d",P.callServer,void 0,P.findSourceMapURL,"canUseFacebookPostTest"),H=(0,P.createServerReference)("407040c9a09391761ac19483cdb077fbad2869090a",P.callServer,void 0,P.findSourceMapURL,"checkFacebookPost"),q="v23.0";function X({appId:e,postUrl:r}){let n=function(e){let[t,r]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{if("https:"===window.location.protocol){if(window.FB)return void r(!0);if(window.fbAsyncInit=()=>{window.FB?.init({appId:e,version:q,cookie:!1,xfbml:!1}),r(!0)},!document.getElementById("facebook-jssdk")){let e=document.createElement("script");e.id="facebook-jssdk",e.src="https://connect.facebook.net/en_US/sdk.js",e.async=!0,e.defer=!0,e.crossOrigin="anonymous",document.body.appendChild(e)}}},[e]),t}(e),[s,i]=(0,a.useState)(null),l=null!==s,[o,c]=(0,a.useState)(!1),[d,u]=(0,a.useState)([]),p=(0,a.useCallback)(async e=>{if(s){c(!0);try{for(let t=1;t<=e;t+=1){u([`Checking, attempt ${t} of ${e}`]);let a=await H(s);if(!a.ok||a.found||t===e)return void u(!a.ok?[`Error: ${a.reason}`,...a.detail?[a.detail]:[]]:!a.found?[`Not found. Posts scanned in the last 24 hours: ${a.scanned}`]:["Found",`Post: ${a.postId}`,`Created: ${a.createdTime}`,`Privacy: ${a.privacy??"unknown"}`,`Link: ${a.linkedUrl}`,`Invite code in link: ${a.hasRef?"yes":"no"}`,`Via our app: ${a.viaOurApp?"yes":"no"}`,...a.permalink?[`Permalink: ${a.permalink}`]:[]]);await new Promise(e=>window.setTimeout(e,5e3))}}finally{c(!1)}}},[s]),x=(0,a.useCallback)(()=>{let t=`${window.location.origin}/`,a=new URL(`https://www.facebook.com/${q}/dialog/oauth`);a.searchParams.set("client_id",e),a.searchParams.set("redirect_uri",t),a.searchParams.set("response_type","token"),a.searchParams.set("scope","user_posts"),a.searchParams.set("auth_type","rerequest"),a.searchParams.set("display","popup");let r=window.open(a.toString(),"fb-login","width=600,height=700");if(!r)return void u(["Pop-up blocked"]);let n=window.setInterval(()=>{let e;if(r.closed)return void window.clearInterval(n);try{e=r.location.href}catch{return}if(!e.startsWith(t))return;window.clearInterval(n),r.close();let a=new URL(e),s=new URLSearchParams(a.hash.slice(1)),l=s.get("access_token");i(l),u([l?"Connected":`Not connected: ${a.searchParams.get("error_description")??s.get("error_description")??"no token"}`])},300)},[e]),h=(0,a.useCallback)(()=>{window.FB?.ui({method:"share",href:r,display:"popup"},()=>{p(4)})},[p,r]),[f,b]=(0,a.useState)(!1);return(0,a.useEffect)(()=>b("https:"!==window.location.protocol),[]),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-[14px] border border-dashed border-[var(--eb-border)] bg-[var(--eb-card)] px-4 py-4",children:[(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Facebook post check (test)"}),f&&(0,t.jsx)("span",{className:"text-xs text-[var(--eb-muted)]",children:"Open this page over https"}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(m.Button,{type:"button",variant:"outline",disabled:!n||o,onClick:x,children:l?"Reconnect":"Connect Facebook"}),(0,t.jsx)(m.Button,{type:"button",variant:"outline",disabled:!n||o||!l,onClick:h,children:"Share post"}),(0,t.jsx)(m.Button,{type:"button",variant:"outline",disabled:!n||o||!l,onClick:()=>void p(1),children:"Check now"})]}),d.length>0&&(0,t.jsx)("pre",{className:"whitespace-pre-wrap break-all text-xs text-[var(--eb-muted)]",children:d.join("\n")})]})}function Q(e){let[r,n]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=!0;return V().then(t=>{e&&n(t)}
1).catch(()=>{}),()=>{e=!1}},[]),r?(0,t.jsx)(X,{...e}):null}let Z=(0,P.createServerReference)("00d4491d30fea0c6a1c871011f3fa54d900951fa51",P.callServer,void 0,P.findSourceMapURL,"canUseThreadsPostTest"),K=(0,P.createServerReference)("0061d43b20bd9421d1113f6e92d05bb6b7ddfabd16",P.callServer,void 0,P.findSourceMapURL,"checkThreadsPost");function J({appId:e,postUrl:r}){let[n,s]=(0,a.useState)(!1),[i,l]=(0,a.useState)(!1),[o,c]=(0,a.useState)([]),d=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=e=>{if(e.origin!==window.location.origin)return;let t=e.data;t?.type==="threads-login"&&d.current&&t.state===d.current&&(d.current=null,s(!!t.ok),c([t.ok?"Connected":`Not connected: ${t.error??"no token"}`]))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]);let u=(0,a.useCallback)(()=>{let t=crypto.randomUUID();d.current=t;let a=new URL("https://threads.net/oauth/authorize");a.searchParams.set("client_id",e),a.searchParams.set("redirect_uri",`${window.location.origin}/api/threads/callback`),a.searchParams.set("scope","threads_basic"),a.searchParams.set("response_type","code"),a.searchParams.set("state",t),window.open(a.toString(),"threads-login","width=600,height=750")||c(["Pop-up blocked"])},[e]),p=(0,a.useCallback)(async e=>{if(n){l(!0);try{for(let t=1;t<=e;t+=1){c([`Checking, attempt ${t} of ${e}`]);let a=await K();if(!a.ok||a.found||t===e)return void c(!a.ok?[`Error: ${a.reason}`,...a.detail?[a.detail]:[]]:!a.found?[`Not found. Posts scanned in the last 24 hours: ${a.scanned}`]:["Found",`Post: ${a.postId}`,`Created: ${a.createdTime}`,`Type: ${a.mediaType??"unknown"}`,`Link: ${a.linkedUrl}`,`Invite code in link: ${a.hasRef?"yes":"no"}`,`Text: ${a.text??"none"}`,`Link preview URL: ${a.attachmentUrl??"none"}`,...a.permalink?[`Permalink: ${a.permalink}`]:[]]);await new Promise(e=>window.setTimeout(e,1e4))}}finally{l(!1)}}},[n]),x=(0,a.useCallback)(()=>{let e=window.open(`https://www.threads.net/intent/post?text=${encodeURIComponent(r)}`,"threads-share","width=600,height=750");if(!e)return void c(["Pop-up blocked"]);c(["Waiting for the Threads window to close"]);let t=window.setInterval(()=>{e.closed&&(window.clearInterval(t),p(6))},500)},[p,r]);return(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-[14px] border border-dashed border-[var(--eb-border)] bg-[var(--eb-card)] px-4 py-4",children:[(0,t.jsx)("span",{className:"text-sm font-semibold",children:"Threads post check (test)"}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(m.Button,{type:"button",variant:"outline",disabled:i,onClick:u,children:n?"Reconnect":"Connect Threads"}),(0,t.jsx)(m.Button,{type:"button",variant:"outline",disabled:i||!n,onClick:x,children:"Share post"}),(0,t.jsx)(m.Button,{type:"button",variant:"outline",disabled:i||!n,onClick:()=>void p(1),children:"Check now"})]}),o.length>0&&(0,t.jsx)("pre",{className:"whitespace-pre-wrap break-all text-xs text-[var(--eb-muted)]",children:o.join("\n")})]})}function ee(e){let[r,n]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=!0;return Z().then(t=>{e&&n(t)}).catch(()=>{}),()=>{e=!1}},[]),r?(0,t.jsx)(J,{...e}):null}var et=e.i(91023),ea=e.i(869074);let er=(0,P.createServerReference)("00d4d0a3c88bb3fb39f61b4f3ad5480b06d261b440",P.callServer,void 0,P.findSourceMapURL,"claimDailyEnergy"),en=(0,P.createServerReference)("40d63bf4129fe655563dc947104abddca189a463a8",P.callServer,void 0,P.findSourceMapURL,"creditFollowEnergy"),es=(0,P.createServerReference)("4022f766564b79d8a626d56bf5dcb0321f8ab93844",P.callServer,void 0,P.findSourceMapURL,"creditPostEnergy");var ei=e.i(392050),el=e.i(96350),eo=e.i(609283),ec=e.i(421524);function ed(e){return eo.ENERGY_SHARE_FILE_PLATFORMS.includes(e)}let eu={kind:"available"},ep=[5],em="1088010524198233",ex="2129840737608383",eh=M.FEATURES.find(e=>"nano-banana"===e.id)?.href??"/chat",ef={kind:"doneToday"},eb="Allow pop-ups for this site, then share again.",ev={post:"Share post",share:"Share artwork"};function ew(){return{balance:0,dailyLeft:0,resetsInSeconds:0,frozen:!1,daily:{reward:eo.ENERGY_DAILY_CLAIM,state:eu},invite:{reward:eo.ENERGY_INVITE_REWARD,left:"",link:"",code:"",state:eu},groups:[{id:"post",reward:eo.ENERGY_POST_REWARD,left:"",rows:eo.ENERGY_SHARE_PLATFORMS.map(e=>({platform:e,reward:eo.ENERGY_POST_REWARD,state:eu}))},{id:"share",reward:eo.ENERGY_SHARE_REWARD,left:"",rows:[...eo.ENERGY_SHARE_PLATFORMS.map(e=>({platform:e,reward:eo.ENERGY_SHARE_REWARD,state:eu})),...eo.ENERGY_SHARE_FILE_PLATFORMS.map(e=>({platform:e,reward:eo.ENERGY_SHARE_REWARD,state:eu})),{platform:"copy",reward:eo.ENERGY_SHARE_REWARD,state:eu}]}],follow:eo.ENERGY_FOLLOW_PLATFORMS.map(e=>({platform:e,reward:eo.ENERGY_FOLLOW_REWARD,state:eu})),creator:{links:eo.ENERGY_CREATOR_PLATFORMS.map(e=>({platform:e,url:""})),hasWork:!1},ledger:[]}}function eg(e){return[...e].sort((e,t)=>
1Number("available"!==e.state.kind)-Number("available"!==t.state.kind))}function ey({label:e,sub:a,right:r}){return(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4 pt-1",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("h2",{className:"text-[17px] font-semibold",children:e}),a&&(0,t.jsx)("p",{className:"text-[13px] text-[var(--eb-muted)]",children:a})]}),r]})}function eN({board:e,onBalanceChange:r}){var n;let s,i,l,o,c,d,u=(0,f.useRouter)(),p=null===e,x=(0,a.useMemo)(ew,[]),b=e??x,[w,_]=(0,a.useState)(!1),[C,A]=(0,a.useState)([]),I=(0,a.useRef)(new Set),[P,$]=(0,a.useState)([]),M=(0,a.useCallback)(async(e,t)=>{if(!I.current.has(e)){I.current.add(e),$(t=>[...t,e]);try{await t()}finally{I.current.delete(e),$(t=>t.filter(t=>t!==e))}}},[]),O=function(e){let[t,r]=(0,a.useState)(e);return(0,a.useEffect)(()=>{if(r(e),e<=0)return;let t=window.setInterval(()=>{r(e=>e<=1?0:e-1)},1e3);return()=>window.clearInterval(t)},[e]),t}(p?0:b.resetsInSeconds),D=(0,a.useRef)(!1);(0,a.useEffect)(()=>{b.resetsInSeconds>0&&(D.current=!1)},[b.resetsInSeconds]),(0,a.useEffect)(()=>{p||O>0||D.current||(D.current=!0,u.refresh())},[p,O,u]),(0,a.useEffect)(()=>{if(p)return;let e=()=>{"visible"===document.visibilityState&&u.refresh()};return window.addEventListener("focus",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[p,u]);let F=(0,a.useCallback)(()=>{u.push("/login")},[u]),V=(0,a.useCallback)(e=>e.ok?(r?.(e.balance),!0):(e.message&&S.toast.error(e.message),!1),[r]),H=(0,a.useCallback)(()=>M("daily",async()=>{V(await er())&&_(!0)}),[M,V]),q=(0,a.useCallback)(async()=>{try{await navigator.clipboard.writeText(b.invite.link),S.toast.success("Invite link copied",{description:"The energy lands when your friend creates an account."})}catch{S.toast.error("Could not copy the link")}},[b.invite.link]),X=(0,a.useCallback)(async(e,t)=>{try{await navigator.clipboard.writeText(t),S.toast.success(`${L.PLATFORM_NAME[e]} link copied`,{description:"Put it under your video. The energy lands when somebody signs up through it."})}catch{S.toast.error("Could not copy the link",{description:t})}},[]),Z=(0,a.useCallback)(e=>{let t=eo.ENERGY_FOLLOW_URLS[e];if(t)return M(`follow:${e}`,async()=>{window.open(t,"_blank","noopener,noreferrer"),V(await en(e))&&A(t=>[...t,e])})},[M,V]),K=b.invite.code?`?r=${encodeURIComponent(b.invite.code)}`:"",J=`${ea.PUBLIC_SITE_ORIGIN}/${K}`,ec=(0,a.useCallback)(e=>`${ea.PUBLIC_SITE_ORIGIN}/g/${e}${K}`,[K]),eN=(0,a.useCallback)(e=>`/g/${e}/file`,[]),[ek,ej]=(0,a.useState)(null),[eE,eR]=(0,a.useState)([]),[e_,eC]=(0,a.useState)({}),[eT,eL]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=!0;return Y().then(t=>{e&&eL(t)}).catch(()=>{}),()=>{e=!1}},[]);let eA=(n="c1NNNVEzU3pobi01OVlQSWEwYkE6MTpjaQ",s=(0,a.useRef)(null),i=(0,a.useRef)(null),l=(0,a.useRef)(!0),(0,a.useEffect)(()=>(l.current=!0,()=>{l.current=!1}),[]),(0,a.useEffect)(()=>{let e=e=>{if(e.origin!==window.location.origin)return;let t=e.data;t?.type!=="x-login"||s.current&&t.state===s.current&&(s.current=null,i.current?.(!!t.ok),i.current=null)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]),{connect:(0,a.useCallback)(async()=>{if(!n)return!1;let e=window.open("about:blank","x-login","width=600,height=750");if(!e)return!1;let t=crypto.randomUUID().replace(/-/g,"");s.current=t;let a=G(crypto.getRandomValues(new Uint8Array(32)));document.cookie=`x_pkce=${t}.${a}; Path=/api/x/callback; Max-Age=600; Secure; SameSite=Lax`;let r=new Promise(e=>{i.current=e,window.setTimeout(()=>{s.current===t&&(s.current=null,i.current=null,e(!1))},18e4)}),l=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(a)),o=new URL("https://x.com/i/oauth2/authorize");return o.searchParams.set("response_type","code"),o.searchParams.set("client_id",n),o.searchParams.set("redirect_uri",`${window.location.origin}/api/x/callback`),o.searchParams.set("scope","tweet.read users.read"),o.searchParams.set("state",t),o.searchParams.set("co
1de_challenge",G(new Uint8Array(l))),o.searchParams.set("code_challenge_method","S256"),e.closed||(e.location.href=o.toString()),r},[n])}),[eI,eP]=(0,a.useState)(!1),[e$,eM]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=!0;return B().then(t=>{e&&eP(t)}).catch(()=>{}),()=>{e=!1}},[]);let eO=(e,t)=>eT&&"post"===e&&"x"===t&&!eI,eD=(e,t)=>eT&&"post"===e&&"x"===t&&eI&&e$,eU=(0,a.useRef)(new Set);(0,a.useEffect)(()=>()=>{for(let e of eU.current)e();eU.current.clear()},[]);let eF=(0,a.useCallback)(async(e,t)=>{eU.current.add(e);try{return await t}finally{eU.current.delete(e)}},[]),eG=(0,a.useCallback)(e=>new Promise(t=>{let a=(0,eo.energyPostCheckSeconds)(),r=0,n=0;eC(t=>({...t,[e]:r}));let s=()=>{window.clearInterval(n),eU.current.delete(i),eC(t=>({...t,[e]:void 0}))},i=()=>{s(),t(!1)};n=window.setInterval(()=>{(r+=1)<a?eC(t=>({...t,[e]:r})):(s(),t(!0))},1e3),eU.current.add(i)}),[]),eY=(0,a.useCallback)(e=>new Promise(t=>{let a=0,r=0,n=!1;eC(t=>({...t,[e]:a}));let s=()=>{window.clearInterval(r),eU.current.delete(i),eC(t=>({...t,[e]:void 0}))},i=()=>{s(),t(null)};r=window.setInterval(()=>{a+=1,eC(t=>({...t,[e]:a})),ep.includes(a)&&!n&&(n=!0,W().then(e=>{if(n=!1,e.ok||!e.retry){s(),t(e);return}a>=ep[ep.length-1]&&(s(),t(e))},()=>{n=!1}))},1e3),eU.current.add(i)}),[]),ez=(0,a.useCallback)(e=>{let t,a=`post:${e}`;if(I.current.has(a))return;try{t=(0,et.openSharePopup)()}catch{S.toast.error(eb);return}t.goTo(e,J);let n=eT&&eI;return M(a,async()=>{if(await eF(t.cancel,t.closed)){if(n){let e=await eY(a);if(!e)return;e.reconnect&&eP(!1),eM(!!e.retry),e.ok?(r?.(e.balance),eR(e=>[...e,a])):e.message&&S.toast.error(e.message);return}await eG(a)&&V(await es(e))&&eR(e=>[...e,a])}})},[r,eG,J,M,V,eF,eT,eY,eI]),eB=(0,a.useCallback)(()=>M("post:x",async()=>{let e=await W();e.reconnect&&eP(!1),eM(!!e.retry),e.ok?(r?.(e.balance),eR(e=>[...e,"post:x"])):e.message&&S.toast.error(e.message)}),[r,M]),eW=(0,a.useCallback)(()=>M("connect:x",async()=>{await eA.connect()?(eP(!0),V(await z())):S.toast.error(eb)}),[M,V,eA]),eV=(0,a.useCallback)(e=>{ej(e)},[]),eH=(0,a.useCallback)(e=>{if(!ek)return;let t=`share:${ek}`;if(I.current.has(t))return;let a=ed(ek)&&(0,et.canHandOverFiles)(),r=null;if("copy"!==ek&&!a)try{r=(0,et.openSharePopup)({wide:ed(ek)})}catch{S.toast.error(eb);return}return M(t,async()=>{let n=await (0,el.publishWork)(e);if(!n){r?.close(),S.toast.error("Could not share that work.");return}let s=ec(n.shareId);if("copy"===ek)try{await navigator.clipboard.writeText(s),S.toast.success("Link copied")}catch{S.toast.error("Could not copy the link",{description:s})}else if(ed(ek)){let e=eN(n.shareId);if(a){let t=await (0,et.handOverFile)(e,"n33-work");if("cancelled"===t)return;if("failed"===t)return void S.toast.error("Could not hand that work to the app.")}else(0,et.downloadWorkFile)(e),r?.goToUrl(eo.ENERGY_SHARE_UPLOAD_URLS[ek]),S.toast.success("Your work was downloaded",{description:"Drag it into the upload page that just opened."})}else if(r?.goTo(ek,s),r&&!await eF(r.cancel,r.closed))return;V(await (0,ei.creditShareEnergy)(n.shareId,ek))&&eR(e=>[...e,t])})},[ek,M,V,eF,eN,ec]),eq=b.frozen,eX=w?{kind:"doneToday"}:b.daily.state,eQ=(0,a.useMemo)(()=>eg(b.follow.map(e=>C.includes(e.platform)?{...e,state:{kind:"exhausted"}}:e)).map(e=>({row:e,soon:void 0===eo.ENERGY_FOLLOW_URLS[e.platform]})),[b.follow,C]),eZ=e=>p?{...e,onClick:F}:e;return(0,t.jsxs)("div",{className:"flex flex-col gap-3 text-[var(--eb-text)]",children:[p&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-[14px] border border-[var(--eb-violet-border)] bg-[var(--eb-card)] px-4 py-4",children:[(0,t.jsx)("span",{className:"text-[15px] font-semibold sm:text-[17px]",children:"Sign in to start earning"}),(0,t.jsx)(m.Button,{type:"button",onClick:F,className:"h-[38px] shrink-0 rounded-[10px] bg-[var(--eb-violet-fill)] px-[22px] text-sm font-medium text-[var(--eb-on-violet)] shadow-none hover:bg-[var(--eb-violet-fill-hover)]",children:"Sign in"})]}),eq&&(0,t.jsx)("p",{className:"text-[13px] text-[var(--eb-muted)]",children:"Earning is paused on this account."}),(0,t.jsx)(ey,{label:"Today",right:p?void 0:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{"aria-hidden":"true",className:"inline-flex items-center gap-[5px] text-xs tabular-nums text-[var(--eb-violet)] sm:text-[13px]",children:[(0,t.jsx)(g.Clock,{className:"size-[13px] sm:size-[14px]"}),`Resets in ${(c=Math.floor((o=Math.max(0,Math.floor(O)))/3600),d=Math.floor(o%3600/60),`${c}:${String(d).padStart(2,"0")}
1:${String(o%60).padStart(2,"0")}`)}`]}),(0,t.jsx)("span",{className:"sr-only",children:"Resets at midnight"})]})}),(0,t.jsxs)("div",{className:"overflow-hidden rounded-[14px] border border-[var(--eb-border)] bg-[var(--eb-card)]",children:[(0,t.jsx)(T,{icon:(0,t.jsx)(v,{className:"size-[17px] sm:size-[18px]"}),name:"Daily claim",reward:b.daily.reward,state:eX,doneLabel:"Claimed",frozen:eq,working:P.includes("daily"),action:eZ({label:"",reward:b.daily.reward,icon:(0,t.jsx)(y.Gift,{className:"size-4","aria-hidden":"true"}),ariaLabel:`Claim ${b.daily.reward} energy`,primary:!0,onClick:H})}),(0,t.jsx)(T,{icon:(0,t.jsx)(R,{className:"size-[17px] sm:size-[18px]"}),name:"Invite a friend",sub:b.invite.left||void 0,reward:b.invite.reward,state:b.invite.state,frozen:eq,actionAlwaysLive:!0,action:eZ({label:"",reward:b.invite.reward,icon:(0,t.jsx)(N.Link2,{className:"size-4","aria-hidden":"true"}),ariaLabel:`Copy your invite link, earn ${b.invite.reward} energy`,primary:!0,onClick:q})}),b.groups.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between px-[13px] pb-0.5 pt-3 sm:px-4 sm:pb-[3px] sm:pt-[13px]",children:[(0,t.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[0.3px] text-[var(--eb-dimmest)] sm:text-xs",children:ev[e.id]}),e.left&&(0,t.jsx)("span",{className:"text-xs text-[var(--eb-dimmest)]",children:e.left})]}),eg(e.rows).map(a=>{let r=`${e.id}:${a.platform}`,n=e_[r];return(0,t.jsx)(T,{icon:(0,t.jsx)(L.PlatformLogo,{platform:a.platform}),iconTone:"copy"===a.platform?"muted":"text",name:"copy"===a.platform?"Copy link":L.PLATFORM_NAME[a.platform],sub:eO(e.id,a.platform)?"Let us see your post":eD(e.id,a.platform)?"We cannot see it yet":"post"===e.id?"Recommend us":"copy"===a.platform?"Copy a link":"Share your work",reward:a.reward,state:eE.includes(r)?ef:a.state,frozen:eq,working:P.includes(r)||eO(e.id,a.platform)&&P.includes("connect:x"),checking:void 0===n?void 0:{elapsedSeconds:n},action:eZ(eD(e.id,a.platform)?{label:"",reward:a.reward,icon:(0,t.jsx)(j.RotateCw,{className:"size-4","aria-hidden":"true"}),ariaLabel:`Look for your X post again, earn ${a.reward} energy`,primary:!0,onClick:eB}:eO(e.id,a.platform)?{label:"",reward:eo.ENERGY_CONNECT_REWARD,icon:(0,t.jsx)(k,{className:"size-4","aria-hidden":"true"}),ariaLabel:`Connect X so we can see your post, earn ${eo.ENERGY_CONNECT_REWARD} energy`,primary:!0,onClick:eW}:"post"===e.id?{label:"",reward:a.reward,icon:(0,t.jsx)(E.Share2,{className:"size-4","aria-hidden":"true"}),ariaLabel:`Share a post on ${L.PLATFORM_NAME[a.platform]}, earn ${a.reward} energy`,primary:!0,onClick:()=>ez(a.platform)}:{label:"",reward:a.reward,icon:"copy"===a.platform?(0,t.jsx)(N.Link2,{className:"size-4","aria-hidden":"true"}):(0,t.jsx)(E.Share2,{className:"size-4","aria-hidden":"true"}),ariaLabel:"copy"===a.platform?`Copy a link to your work, earn ${a.reward} energy`:`Share your work on ${L.PLATFORM_NAME[a.platform]}, earn ${a.reward} energy`,onClick:()=>eV(a.platform)})},r)})]},e.id))]}),(0,t.jsx)(ey,{label:"Your link under a video",sub:`Anyone who signs up through it pays you ${eo.ENERGY_INVITE_REWARD}. Clicks alone pay nothing.`}),(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[!p&&!b.creator.hasWork&&(0,t.jsxs)("p",{className:"rounded-[14px] border border-[var(--eb-border)] bg-[var(--eb-card)] px-[13px] py-3 text-sm text-[var(--eb-muted)] sm:px-4",children:["Nothing finished yet."," ",(0,t.jsx)(h.default,{href:eh,className:"font-medium text-[var(--eb-violet)] underline",children:"Make something first"}),"."]}),b.creator.links.map(({platform:e,url:a})=>(0,t.jsx)(T,{variant:"plate",icon:(0,t.jsx)(L.PlatformLogo,{platform:e}),iconTone:"text",name:L.PLATFORM_NAME[e],sub:"Put this link under your video",reward:eo.ENERGY_INVITE_REWARD,state:eu,frozen:eq,working:P.includes(`creator:${e}`),action:eZ({label:"",reward:eo.ENERGY_INVITE_REWARD,icon:(0,t.jsx)(N.Link2,{className:"size-4","aria-hidden":"true"}),ariaLabel:`Copy your ${L.PLATFORM_NAME[e]} link`,onClick:()=>X(e,a)})},`creator:${e}`))]}),(0,t.jsx)(ey,{label:"Follow us"}),(0,t.jsx)("div",{className:"flex flex-col gap-2",children:eQ.map(({row:e,soon:a})=>(0,t.jsx)(T,{variant:"plate",icon:(0,t.jsx)(L.PlatformLogo,{platform:e.platform}),iconTone:"text",reward:e.reward,state:e.state,frozen:eq,soon:a,working:P.includes(`follow:${e.platform}`),action:a?void 0:eZ({label:"Follow",ariaLabel:`Follow us on ${L.PLATFORM_NAME[e.platform]}`,onClick:()=>Z(e.platform)})},`follow:${e.platform}`))}),(0,t.jsx)(eS,{}),!p&&em&&(0,t.jsx)(Q,{appId:em,postUrl:J}),!p&&ex&&(0,t.jsx)(ee,{appId:ex,postUrl:J}),!p&&(0,t.jsx)(U,{open:null!==ek,confirmLabel:"copy"===ek?"Copy link":"Share",onOpenChange:e=>{e||ej(null)},onConfirm:eH})]})}function ek(e,t){return void 0===t?null:{label:e,value:String(t),strong:!0}}function ej(e){return eo.ENERGY_PRICE_BY_MODEL[e]}function eE(e,t){let a=t.filter(e=>null!==e);return 0===a.length?null:{heading:e,lines:a}}function eR(){let e=Object.values(eo.ENERGY_PRICE_BY_EFFORT).filter(e=>e>0),t=Math.max(...e),a=Math.min(...e);return[eE("Chat, per answer",[{label:"Free models",value:"free, always",strong:!1},ek("Deeper answers",ej(ec.N33_CLAUDE_SONNET_MODEL_ID)),ek("Stronger",ej(ec.N33_CLAUDE_OPUS_MODEL_ID)),ek("The most capable",ej(ec.N33_CLAUDE_FABLE_MODEL_ID)),{label:"Thinking deeper",value:`adds ${a} to ${t}`,strong:!1},ek("A picture inside a chat",eo.ENERGY_PRICE_CHAT_IMAGE)]),eE("Studio, per generation",[ek("Voice",eo.ENERGY_PRICE_BY_GENERATION.TTS),ek("Picture",eo.ENERGY_PRICE_BY_GENERATION.BOT_IMAGE),ek("Talking avatar",eo.ENERGY_PRICE_BY_GENERATION.AVATAR_VIDEO),ek("Video from a picture",eo.ENERGY_PRICE_BY_GENERATION.IMAGE_TO_VIDEO),ek("Dubbing",eo.ENERGY_PRICE_BY_GENERATION.DUBBING),ek("Video",eo.ENERGY_PRICE_BY_GENERATION.BOT_VIDEO)])].filter(e=>null!==e)}function eS(){let e=(0,a.useMemo)(eR,[]);return(0,t.jsxs)("details",{className:"group mt-1 rounded-[14px] border border-[var(--eb-border)] bg-[var(--eb-card)] px-[14px] py-3 sm:px-4 sm:py-[14px]",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center justify-between text-sm font-semibold sm:text-[15px]",children:["Prices",(0,t.jsx)(w.ChevronDown,{className:"size-4 text-[var(--eb-dimmest)] transition-transform group-open:rotate-180 sm:size-[17px]","aria-hidden":"true"})]}),(0,t.jsx)("div",{className:"mt-2.5 grid grid-cols-1 gap-y-4 sm:mt-3 sm:grid-cols-2",children:e.map((a,r)=>
1(0,t.jsx)("div",{className:(0,i.cn)("min-w-0",0===r&&e.length>1&&"sm:pr-6",r>0&&"sm:border-l sm:border-[var(--eb-divider)] sm:pl-6"),children:(0,t.jsxs)("table",{className:"w-full border-collapse text-xs sm:text-[13px]",children:[(0,t.jsx)("caption",{className:"pb-1 pr-3 text-left text-[11px] font-semibold uppercase tracking-[0.3px] text-[var(--eb-dimmest)]",children:a.heading}),(0,t.jsx)("tbody",{children:a.lines.map((e,r)=>(0,t.jsxs)("tr",{className:r===a.lines.length-1?void 0:"border-b border-[var(--eb-divider)]",children:[(0,t.jsx)("th",{scope:"row",className:"py-[5px] pr-3 text-left font-normal",children:e.label}),(0,t.jsx)("td",{className:e.strong?"whitespace-nowrap py-[5px] text-right font-semibold tabular-nums text-[var(--eb-violet)]":"whitespace-nowrap py-[5px] text-right tabular-nums text-[var(--eb-muted)]",children:e.value})]},e.label))})]})},a.heading))})]})}let e_={invite:"Invited a friend",welcome:"Welcome",purchase:"Bought energy",staff:"Granted",refund:"Refund",share:"Shared a work","share-visit":"Someone opened your work",connect:"Connected an account",daily:"Daily claim",follow:"Followed us",video:"Watched a video",review:"Left a review",post:"Posted about N33",quiz:"Quiz"},eC={chat:"Chat","chat-image":"Image in chat",CHAT_IMAGE:"Image in chat",IMAGE_TO_VIDEO:"Animated a picture",AVATAR_VIDEO:"Avatar video",DUBBING:"Translated a video",TTS:"Voiceover",BOT_IMAGE:"Image",BOT_VIDEO:"Video",staff:"Taken back"};function eT({board:e,payments:n}){let[i,p]=(0,a.useState)(e?.balance??0);(0,a.useEffect)(()=>{e&&p(e.balance)},[e]);let m=(0,a.useCallback)(e=>p(e),[]),h=function(e){let[t,r]=(0,a.useState)(e),n=(0,a.useRef)(e);return(0,a.useEffect)(()=>{n.current=t},[t]),(0,a.useEffect)(()=>{let t=n.current;if(t===e)return;if("function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches){n.current=e,r(e);return}let a=0,s=performance.now(),i=l=>{let o=Math.min(1,(l-s)/360),c=Math.round(t+(e-t)*o);n.current=c,r(c),o<1&&(a=requestAnimationFrame(i))};return a=requestAnimationFrame(i),()=>cancelAnimationFrame(a)},[e]),t}(i);return(0,t.jsxs)("div",{className:"energy-board flex flex-col gap-3 rounded-[14px] bg-[var(--eb-page)] p-3 text-[var(--eb-text)] sm:p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3.5",children:[(0,t.jsx)("h1",{className:"m-0 text-2xl font-semibold tracking-[-0.01em]",children:"Energy"}),(0,t.jsx)("div",{className:"flex-1"}),e&&(0,t.jsx)("div",{className:"inline-flex h-[38px] items-center rounded-full border border-[var(--eb-violet-border)] bg-[var(--eb-violet-tint)] px-4",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-[17px] font-semibold text-[var(--eb-violet)]",children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"tabular-nums",children:h}),(0,t.jsx)(r.Zap,{className:"size-[17px] fill-current","aria-hidden":"true"})]})})]}),(0,t.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:e?`${i} energy`:""}),null===e?(0,t.jsx)(eN,{board:null}):(0,t.jsxs)(s.Tabs,{defaultValue:"earn",className:"flex flex-col gap-3",children:[(0,t.jsxs)(s.TabsList,{className:"grid h-auto w-full grid-cols-2 gap-2 bg-transparent p-0 sm:inline-flex sm:w-auto",children:[(0,t.jsx)(eL,{value:"earn",children:"Earn"}),(0,t.jsx)(eL,{value:"history",children:"History"})]}),(0,t.jsx)(s.TabsContent,{value:"earn",className:"mt-0",children:(0,t.jsx)(eN,{board:e,onBalanceChange:m})}),(0,t.jsxs)(s.TabsContent,{value:"history",className:"mt-0 flex flex-col gap-3",children:[0===e.ledger.length?(0,t.jsx)("p",{className:"text-sm text-[var(--eb-muted)]",children:"Nothing yet."}):(0,t.jsx)("div",{className:"overflow-hidden rounded-[14px] border border-[var(--eb-border)] bg-[var(--eb-card)]",children:(0,t.jsxs)(l,{children:[(0,t.jsx)(o,{children:(0,t.jsxs)(d,{children:[(0,t.jsx)(u,{children:"When"}),(0,t.jsx)(u,{children:"What"}),(0,t.jsx)(u,{className:"text-right",children:"Energy"}),(0,t.jsx)(u,{className:"text-right",children:"Balance"})]})}),(0,t.jsx)(c,{children:e.ledger.map(e=>(0,t.jsx)(eA,{row:e},e.id))})]})}),(0,t.jsx)(x,{paymentsData:n})]})]})]})}function eL({value:e,children:a}){return(0,t.jsx)(s.TabsTrigger,{value:e,className:"h-[38px] rounded-[10px] border border-[var(--eb-border)] bg-transparent px-5 text-sm font-medium text-[var(--eb-muted)] shadow-none data-[state=active]:border-[var(--eb-violet-edge)] data-[state=active]:bg-[var(--eb-card)] data-[state=active]:font-semibold data-[state=active]:text-[var(--eb-violet-strong)] data-[state=active]:shadow-none sm:h-9",children:a})}function eA({row:e}){let a=new Date(e.at);return(0,t.jsxs)(d,{children:[(0,t.jsx)(p,{className:"whitespace-nowrap text-[var(--eb-muted)]",children:a.toLocaleDateString(void 0,{month:"short",day:"numeric"})}),(0,t.jsxs)(p,{children:[function(e){if("credit"===e.kind)return e.source?e_[e.source]:"Added";if("chat"===e.sink){let t="string"==typeof e.meta.modelId?e.meta.modelId:null,a="string"==typeof e.meta.effort?e.meta.effort:null,r=t?ec.availableModelTypesForWeb.find(e=>e.id===t)?.name??"Chat":"Chat";return a&&"low"!==a?`${r}, ${a} thinking`:r}return e.sink?eC[e.sink]:"Spent"}(e),"credit"===e.kind&&"staff"===e.source&&(0,t.jsx)(n.Badge,{variant:"outline",className:"ml-2",children:"bonus"})]}),(0,t.jsx)(p,{className:"text-right tabular-nums",children:"credit"===e.kind?`+${e.amount}`:`-${e.amount}`}),(0,t.jsx)(p,{className:"text-right tabular-nums text-[var(--eb-muted)]",children:e.balanceAfter})]})}e.s(["default",()=>eT],5525)}]);
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.