PageSourceSearch

https://aiclubstudio.com/assets/ThreeD-DRObJJF8.js

js aiclubstudio.com collected 2026-09-24 14:38:05 UTC 15,460 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ThreeDViewer-DAli64Xj.js","assets/index-CI6avYI6.js","assets/index-DeQpBK1w.css"])))=>i.map(i=>d[i]);
2import{c9 as d,cp as te,cP as ce,bT as t,cH as Ne,cw as De,bG as se,cq as re,aY as S,x as C,am as ae,aV as _e,bd as ke,cr as we,cs as ie,ba as ne,bc as Se}from"./index-CI6avYI6.js";import{u as Ce}from"./useQuery-D5L_x_gu.js";import{i as P,c as L,T as Ae,a as Ee,u as le}from"./ThreeDDownloads-SRtV4f70.js";import{P as Te}from"./PlaygroundNav-C2z4n-PJ.js";import{A as $e}from"./AppMobileNav-Cid_jPln.js";import{N as Fe}from"./NoPlanGate-CCNj-RqO.js";import{I as A}from"./input-c2KtIZde.js";import{T as oe}from"./textarea-IX93-vF_.js";import{B as q}from"./graduation-cap-DnTgXwF6.js";import{R as Re}from"./rotate-ccw-DaRVmOC9.js";import"./pencil-BWcptimW.js";import"./downloadMedia-Dg5VgXG3.js";import"./logo-Dd8UVa9P.js";import"./LanguageSwitcher-Cr5a2Gri.js";import"./dropdown-menu-Bjjy4zf9.js";import"./index-BcJPsVME.js";import"./globe-DkHoVhqA.js";import"./UserMenu-BxMPUou1.js";import"./socialStore-Bxm2RAqo.js";import"./shield-DwxFSf8w.js";import"./clock-D3F-Mnix.js";import"./plus-BBFzmmnQ.js";import"./spendableCredits-CX4QOaJk.js";import"./credit-card-BqY6ud1w.js";import"./coins-H2WIqHPe.js";import"./shopping-cart-CEwcEKk2.js";import"./wallet-zjUNLzfN.js";import"./SocialClubLogo-DLChgcn1.js";import"./music-OmZErj2x.js";import"./frame-CZ3Jjrzo.js";import"./sheet-DX3EzlTs.js";function Ie(s){const b=d.useRef(0);return Ce({queryKey:["three-d-history",s],enabled:!!s,refetchInterval:12e3,queryFn:async()=>{const[h,D]=await Promise.all([te.from("generations").select("id,model,prompt,created_at,media_url,reference_images,metadata").eq("user_id",s).eq("media_type","3d").eq("hidden_from_history",!1).order("created_at",{ascending:!1}).limit(60),te.from("generations").select("id,model,prompt,created_at,media_url,reference_images,metadata").eq("user_id",s).eq("media_type","3d").in("metadata->>status",["submitting","processing","saving"]).order("created_at").limit(50)]);if(h.error||D.error)throw new Error("HISTORY_FAILED");const _=[...new Map([...h.data||[],...D.data||[]].map(i=>[i.id,i])).values()],c=_.filter(i=>{var o;return["submitting","processing","saving"].includes((o=i.metadata)==null?void 0:o.status)}),y=Array.from({length:Math.min(4,c.length)},(i,o)=>c[(b.current+o)%c.length]);return b.current=c.length?(b.current+y.length)%c.length:0,(await Promise.allSettled(y.map(i=>P({action:"poll",generationId:i.id})))).forEach(i=>{if(i.status==="fulfilled"&&i.value.generation){const o=i.value.generation,k=_.findIndex(j=>j.id===o.id);k>=0&&(_[k]=o)}}),_.sort((i,o)=>o.created_at.localeCompare(i.created_at))}})}function Le({urls:s}){const{t:b}=ce();return s!=null&&s.length?t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-sm font-medium",children:b("threeD.referencesUsed")}),t.jsx("div",{className:"flex flex-wrap gap-2",children:[...new Set(s)].map((h,D)=>t.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",children:t.jsx("img",{src:h,alt:`${b("threeD.referencesUsed")} ${D+1}`,loading:"lazy",className:"h-20 w-20 rounded-lg border border-border bg-secondary object-contain"})},h))})]}):null}const qe=d.lazy(()=>Se(()=>import("./ThreeDViewer-DAli64Xj.js"),__vite__mapDeps([0,1,2]))),M="h-11 w-full rounded-md border border-input bg-background px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";function xt(){var X,J;const{t:s}=ce(),b=Ne(),{user:h,hasActivePlan:D,refreshProfile:_}=De(),c=Ie(h==null?void 0:h.id),[y,V]=d.useState("hunyuan31-text"),i=se(y),[o,k]=d.useState(()=>re(i)),[j,w]=d.useState(null),[H,de]=d.useState(""),[O,me]=d.useState(""),[B,he]=d.useState(""),[m,U]=d.useState(!1),[x,E]=d.useState(null),[z,g]=d.useState(""),[ue,Y]=d.useState(null),v=d.useRef(0),$=d.useRef(!1),F=c.data||[],n=F.find(e=>e.id===ue)??F[0],G=(X=n==null?void 0:n.metadata.outputs)==null?void 0:X.find(e=>e.format==="glb"),pe=[...new Map(S.map(e=>[e.family,e])).values()].sort((e,a)=>e.label.localeCompare(a.label,void 0,{numeric:!0})),xe=S.filter(e=>e.family===i.family),ge=i.fields.filter(e=>e.required),W=i.fields.filter(e=>!e.required),N=(e,a)=>{v.current++,k(r=>({...r,[e]:a,...e==="model_type"&&a==="smart-topology"?{target_polycount:Math.min(Number(r.target_polycount??3e4),15e3)}
2:{}})),w(null),g("")},K=e=>{v.current++,V(e),k(re(se(e))),w(null),g("")},fe=e=>{const a=S.find(r=>r.family===e&&r.mode===i.mode)??S.find(r=>r.family===e);a&&K(a.id)},R=e=>{const a=e instanceof Error?e.message.split(":")[0]:"SERVICE_UNAVAILABLE";return s(`threeD.errors.${a}`,{defaultValue:s("threeD.errors.SERVICE_UNAVAILABLE")})},be=async(e,a)=>{const r=v.current;E(e),g("");try{const u=await le(a,i);r===v.current&&N(e,u)}catch(u){g(R(u))}finally{E(null)}},ye=async(e,a)=>{const r=Array.isArray(o[e.key])?o[e.key]:[];if(r.length+a.length>(e.max??4)){g(s("threeD.errors.TOO_MANY_IMAGES"));return}const u=v.current;E(e.key),g("");try{const f=[...r];for(const T of a)f.push(await le(T,i));u===v.current&&N(e.key,f)}catch(f){g(R(f))}finally{E(null)}},je=async()=>{var a;if($.current||!D||x)return;$.current=!0,U(!0),g("");const e=v.current;try{const r=ke(y,o);if(j===null){const u=await P({action:"estimate",model:y,inputs:r});e===v.current&&w(u.credits)}else{const u=await P({action:"submit",title:H,description:O,model:y,inputs:r,maxCredits:j,clientRequestId:crypto.randomUUID()});Y(((a=u.generation)==null?void 0:a.id)??null),w(null),await c.refetch(),_()}}catch(r){g(R(r)),w(null),c.refetch()}finally{$.current=!1,U(!1)}},Q=e=>{var T,Z,ee;const a=`three-d-field-${e.key}`,r=o[e.key]??e.default;if(!we(e.key,o))return null;const f=s(`threeD.fields.${e.key}`);return t.jsxs("div",{className:"space-y-2",children:[e.type!=="boolean"&&t.jsxs("label",{htmlFor:a,className:"text-sm font-medium",children:[f,e.required?" *":""]}),e.type==="text"&&t.jsxs(t.Fragment,{children:[t.jsx(oe,{id:a,value:String(r??""),onChange:l=>N(e.key,l.target.value),maxLength:e.max,required:e.required,rows:e.key==="prompt"?5:2,disabled:m,className:"resize-y"}),e.max&&t.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[Array.from(String(r||"")).length," / ",e.max]})]}),e.type==="select"&&t.jsx("select",{id:a,className:M,value:String(r),onChange:l=>N(e.key,l.target.value),disabled:m,children:(T=e.options)==null?void 0:T.map(l=>t.jsx("option",{value:l,children:s(`threeD.options.${l}`,l)},l))}),e.type==="number"&&t.jsxs(t.Fragment,{children:[t.jsx(A,{id:a,type:"number",step:e.step??1,min:e.min,max:ie(e,o),value:Number(r),onChange:l=>N(e.key,Number(l.target.value)),disabled:m}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[(Z=e.min)==null?void 0:Z.toLocaleString()," – ",((ee=ie(e,o))==null?void 0:ee.toLocaleString())??"∞"]})]}),e.type==="boolean"&&t.jsxs("label",{htmlFor:a,className:"flex min-h-11 items-center justify-between gap-3 text-sm cursor-pointer",children:[t.jsx("span",{children:f}),t.jsx("input",{id:a,type:"checkbox",className:"h-5 w-5 accent-primary",checked:!!r,onChange:l=>N(e.key,l.target.checked),disabled:m})]}),e.type==="image"&&t.jsxs(t.Fragment,{children:[t.jsx(A,{id:a,type:"file",accept:i.family.startsWith("meshy")?"image/png,image/jpeg":"image/png,image/jpeg,image/webp",disabled:m||!!x,onChange:l=>{var I;const p=(I=l.target.files)==null?void 0:I[0];p&&be(e.key,p),l.target.value=""}}
2),x===e.key&&t.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:s("threeD.uploading")}),typeof r=="string"&&r&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("img",{src:r,alt:f,className:"h-20 w-20 rounded-lg object-contain bg-secondary"}),t.jsx(C,{type:"button",variant:"ghost",size:"icon","aria-label":s("threeD.removeReference"),onClick:()=>N(e.key,""),disabled:m,children:t.jsx(ne,{className:"h-4 w-4"})})]})]}),e.type==="images"&&t.jsxs(t.Fragment,{children:[t.jsx(A,{id:a,type:"file",multiple:!0,accept:"image/png,image/jpeg",disabled:m||!!x,onChange:l=>{const p=Array.from(l.target.files??[]);p.length&&ye(e,p),l.target.value=""}}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("threeD.multiImageHint")}),x===e.key&&t.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:s("threeD.uploading")}),t.jsx("div",{className:"flex flex-wrap gap-2",children:(Array.isArray(r)?r:[]).map((l,p)=>t.jsxs("div",{className:"flex items-center",children:[t.jsx("img",{src:l,alt:`${f} ${p+1}`,className:"h-16 w-16 rounded-lg object-contain bg-secondary"}),t.jsx(C,{type:"button",variant:"ghost",size:"icon","aria-label":`${s("threeD.removeReference")} ${p+1}`,disabled:m||!!x,onClick:()=>N(e.key,r.filter((I,ve)=>ve!==p)),children:t.jsx(ne,{className:"h-4 w-4"})})]},`${l}-${p}`))})]})]},e.key)};return t.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[t.jsx($e,{active:"3d"}),t.jsx(Te,{active:"3d"}),t.jsx(Fe,{}),t.jsxs("main",{className:"mx-auto grid max-w-[1800px] gap-4 p-3 pb-24 md:grid-cols-[360px_minmax(0,1fr)] md:p-5 md:pb-5",children:[t.jsxs("section",{"aria-labelledby":"three-d-title",className:"rounded-2xl border border-border bg-card p-5 space-y-5",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(q,{className:"h-5 w-5 text-primary"}),t.jsx("h1",{id:"three-d-title",className:"text-xl font-semibold",children:s("threeD.title")})]}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:s("threeD.description")})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:"three-d-family",className:"text-sm font-medium",children:s("threeD.model")}),t.jsx("select",{id:"three-d-family",value:i.family,className:M,disabled:m||!!x,onChange:e=>fe(e.target.value),children:pe.map(e=>t.jsx("option",{value:e.family,children:e.label},e.family))})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:"three-d-mode",className:"text-sm font-medium",children:s("threeD.mode")}),t.jsx("select",{id:"three-d-mode",value:y,className:M,disabled:m||!!x,onChange:e=>K(e.target.value),children:xe.map(e=>t.jsx("option",{value:e.id,children:s(`threeD.modes.${e.mode}`)},e.id))})]}),t.jsxs("fieldset",{className:"space-y-3 rounded-xl border border-border p-3",disabled:m,children:[t.jsx("legend",{className:"px-1 text-sm font-medium",children:s("threeD.objectDetails")}),t.jsx("label",{htmlFor:"three-d-asset-title",className:"block text-sm",children:s("threeD.assetTitle")}),t.jsx(A,{id:"three-d-asset-title",value:H,onChange:e=>de(e.target.value),maxLength:160}),t.jsx("label",{htmlFor:"three-d-asset-description",className:"block text-sm",children:s("threeD.assetDescription")}),t.jsx(oe,{id:"three-d-asset-description",value:O,onChange:e=>me(e.target.value),maxLength:2e3,rows:2}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("threeD.detailsHint")})]}),ge.map(Q),i.fields.some(e=>e.type==="image"||e.type==="images")&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("threeD.imageLimits"),i.family==="hunyuan31"?" · 128–5000 px":""]}),W.length>0&&t.jsxs("details",{className:"rounded-xl border border-border p-3",children:[t.jsx("summary",{className:"cursor-pointer text-sm font-medium",children:s("threeD.settings")}),t.jsx("div",{className:"mt-4 space-y-4",children:W.map(Q)})]}),z&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:z}),j!==null&&t.jsx("p",{className:"text-sm",role:"status",children:s("threeD.estimate",{count:j})}),t.jsxs(C,{className:"w-full min-h-11",disabled:m||!!x||!D,onClick:()=>void je(),children:[m?t.jsx(ae,{className:"mr-2 h-4 w-4 animate-spin"}):t.jsx(_e,{className:"mr-2 h-4 w-4"}),m?s("threeD.working"):j===null?s("threeD.quote"):s("threeD.generate",{count:j})]})]}),t.jsxs("section",{className:"min-w-0 space-y-4","aria-label":s("threeD.result"),children:[t.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border bg-card",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border p-4",children:[t.jsx("h2",{className:"font-semibold",children:s("threeD.result")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("threeD.orbit")})]}),t.jsx("div",{className:"h-[420px] md:h-[560px] bg-[radial-gradient(ellipse_at_center,hsl(var(--secondary)),hsl(var(--background)))]",children:G?t.jsx(d.Suspense,{fallback:t.jsx("div",{className:"grid h-full place-items-center",children:t.jsx(ae,{className:"h-8 w-8 animate-spin"})}
2),children:t.jsx(qe,{url:G.url,title:n?L(n):s("threeD.result")})}):t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 p-8 text-center",children:[t.jsx(q,{className:"h-16 w-16 text-primary/60",strokeWidth:1}),t.jsx("h3",{className:"text-lg font-medium",children:n?s(`threeD.status.${n.metadata.status}`,s("threeD.status.processing")):s("threeD.empty")}),t.jsx("p",{className:"max-w-md text-sm text-muted-foreground",children:(n==null?void 0:n.metadata.status)==="submitting"?s("threeD.recovering"):s("threeD.emptyDescription")})]})}),n&&t.jsxs("div",{className:"space-y-3 border-t border-border p-4",children:[t.jsx(Ae,{generation:n,onSaved:()=>{c.refetch()}},n.id),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[s(`threeD.status.${n.metadata.status}`,s("threeD.status.processing")),n.metadata.credits!==void 0?` · ${s("threeD.estimate",{count:n.metadata.credits})}`:""]}),t.jsx(Ee,{generation:n}),t.jsx(Le,{urls:n.reference_images}),((J=n.metadata.outputs)==null?void 0:J.some(e=>e.temporary))&&t.jsx("p",{className:"text-sm text-amber-400",children:s("threeD.temporary")})]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"font-semibold",children:s("threeD.history")}),t.jsxs(C,{variant:"ghost",disabled:c.isFetching,"aria-busy":c.isFetching,onClick:()=>void c.refetch(),children:[t.jsx(Re,{className:`mr-2 h-4 w-4 ${c.isFetching?"animate-spin":""}`}),s("threeD.refresh")]})]}),c.isError&&t.jsx("p",{role:"alert",className:"text-sm text-destructive",children:s("threeD.errors.HISTORY_FAILED")}),t.jsx(A,{"aria-label":s("threeD.searchObjects"),placeholder:s("threeD.searchObjects"),value:B,onChange:e=>he(e.target.value)}),t.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:F.filter(e=>`${L(e)} ${e.metadata.description||""} ${e.prompt||""} ${e.model}`.toLocaleLowerCase().includes(B.trim().toLocaleLowerCase())).map(e=>{var a;return t.jsxs("button",{onClick:()=>Y(e.id),className:`rounded-xl border p-4 text-left transition-colors hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${(n==null?void 0:n.id)===e.id?"border-primary bg-primary/5":"border-border bg-card"}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(q,{className:"h-4 w-4 text-primary"}),t.jsx("span",{className:"text-sm font-medium",children:L(e)})]}),t.jsx("p",{className:"my-2 line-clamp-2 text-sm text-muted-foreground",children:e.metadata.description||e.prompt||((a=S.find(r=>r.id===e.model))==null?void 0:a.label)||e.model}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:[s(`threeD.status.${e.metadata.status}`,s("threeD.status.processing"))," · ",new Date(e.created_at).toLocaleDateString()]})]},e.id)})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("threeD.historyHint")}),t.jsx(C,{variant:"link",onClick:()=>b("/playground/image"),children:s("threeD.createReference")})]})]})]})}export{xt as default};

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.