PageSourceSearch

https://www.studioe.ai/assets/DirectorsStudio-Cx96_sxF.js

js studioe.ai collected 2026-10-05 14:28:56 UTC 46,625 bytes, 66 lines download raw bytes

1import{j as e}from"./jsx-runtime-CqrCmrYQ.js";import{r as o,a as He,b as qe}from"./vendor-react-DWiRq_5Q.js";import{s as X,r as ke}from"./secureTransport-BT8gXiVx.js";import{toast as P}from"./react-toastify.esm-dODcvvAN.js";import{u as De}from"./AuthContext-D_aQViLm.js";import{u as ze}from"./AuthModalContext-Dn1r-5W7.js";import{u as We}from"./DirectorsStudioContext-BeKvK9sq.js";import{m as Ye,p as Xe,f as Je,s as Qe}from"./uploadPrep-LCedjOzL.js";import{g as Ve}from"./subscription-BI2A8kyt.js";import{d as Ce,a as F,r as Se,F as xe}from"./featureTokens-CK05Y9US.js";import{a as re,h as Ze,as as et,c as tt,e as st,p as at,Z as rt,U as Ae,H as ot,S as nt}from"./index-COyPRzeT.js";import{b as J}from"./index-MSypKfEb.js";import{P as Ee}from"./index-DpHmcKyI.js";import{i as Ie}from"./index-B0_jBWuf.js";import{T as it}from"./TokenCostPill-DyxFPAvf.js";import{S as se}from"./ScrollReveal-Dknkigl8.js";import{P as lt}from"./ProjectPickerModal-BRVkD5Og.js";import{a as ct,A as dt}from"./aspectRatios-BcXvHWfU.js";import"./vendor-redux-BFhIuSuA.js";import"./errorReporter-D_obZs0p.js";import"./metaPixel-Dqi1DP_N.js";import"./tryOnCdnAssets-B97xlmHA.js";import"./DropdownMenu-Jz4QorZx.js";const ae=[{id:"logo",label:"Logo / Graphic",icon:"🎨"},{id:"color",label:"Color / Fabric",icon:"🧵"},{id:"fit",label:"Fit / Silhouette",icon:"👔"},{id:"lighting",label:"Lighting / Mood",icon:"💡"},{id:"pose",label:"Pose / Styling",icon:"🕴️"},{id:"skin",label:"Skin Detail",icon:"✨"},{id:"background",label:"Background",icon:"🏞️"},{id:"accessories",label:"Accessories",icon:"⌚"},{id:"object",label:"Add Object / Prop",icon:"🐕"}],Pe=[{id:"face",label:"Model face & identity"},{id:"background",label:"Background"},{id:"lighting",label:"Lighting & shadows"},{id:"pose",label:"Pose"},{id:"proportions",label:"Body proportions"},{id:"garment_folds",label:"Garment folds & drape"},{id:"skin_tone",label:"Skin tone & texture"},{id:"camera",label:"Camera angle & framing"}],ht=Object.fromEntries(Pe.map(d=>[d.id,d.label])),mt={logo:"Upload a picture of the logo or graphic you want on the garment.",color:"Upload a photo that shows the fabric or colour you want.",fit:"Upload a photo that shows the fit or shape you're going for.",lighting:"Upload a photo whose lighting or mood you want to copy.",pose:"Upload a photo of the pose you want the model to match.",skin:"No extra photo needed — the AI enhances skin on your starting photo.",background:"Upload a photo of the background or setting you want.",accessories:"Upload a photo of the accessory you want to add or match.",object:"Upload a photo of the object you want added (e.g. a dog, a car, a bag)."};function ut({category:d,description:i,locks:x,image2Desc:c,image3Desc:f}){const m=ae.find(l=>l.id===d),g=(m==null?void 0:m.label)||d,s=[];if(s.push("PRIMARY ACTION"),s.push(`Change: ${g}`),i&&s.push(i.trim()),s.push(""),d!=="skin"){if(s.push("MATCH FROM IMAGE 2 (Reference)"),c)s.push(c.trim());else{const l={logo:`• Exact placement
2• Correct proportions
3• Accurate scale
4• Correct orientation (no mirroring unless visible in reference)`,color:`• Color tone and saturation
5• Fabric grain and weave
6• Surface reflectivity
7• Thickness and weight behavior`,fit:`• Overall looseness/tightness
8• Sleeve width
9• Torso taper
10• Shoulder drop`,lighting:`• Color temperature
11• Contrast level
12• Shadow softness
13• Highlight intensity
14• Overall mood`,pose:`• Stance and body positioning
15• Arm and hand placement
16• Head tilt and angle
17• Weight distribution`,background:`• Scene composition
18• Colour palette
19• Depth of field
20• Environmental lighting`,accessories:`• Accessory scale and placement
21• Material and colour
22• Lighting integration`,object:`• Correct scale relative to model
23• Realistic lighting integration
24• Accurate shadow direction
25• Proper ground contact`};s.push(l[d]||"• Match reference details exactly")}s.push("")}return s.push("LOCK FROM IMAGE 1 (Base Image)"),x.length>0?x.forEach(l=>{s.push(`• ${ht[l]||l}`)}):s.push(`• Model identity
26• Facial structure
27• Body proportions
28• Pose
29• Camera angle
30• Background
31• Lighting
32• Skin tone
33• Garment folds`),s.push(""),s.push("PHYSICAL REALISM RULES"),s.push("All changes must obey:"),s.push(`• Gravity
34• Shadow direction
35• Material behavior
36• Natural fabric drape
37• Correct scale`),s.push(""),s.push("DO NOT ALLOW"),s.push(`• Logo warping
38• Texture stretching
39• Face distortion
40• Body reshaping`),x.includes("lighting")||s.push("• Lighting shift (unless requested)"),x.includes("background")||s.push("• Background alteration (unless requested)"),f&&(s.push(""),s.push("IMAGE 3 — Secondary Refinement"),s.push(f.trim())),s.join(`
41`)}const pe=4;function xt({open:d,onClose:i,onUsePrompt:x}){var L,D;const[c,f]=o.useState(null),[m,g]=o.useState(""),[s,l]=o.useState(["face","background","lighting","pose"]),[C,_]=o.useState(""),[T,v]=o.useState(""),[p,S]=o.useState(1),[B,y]=o.useState(!1),$=o.useMemo(()=>ut({category:c,description:m,locks:s,image2Desc:C,image3Desc:T}),[c,m,s,C,T]),A=n=>l(R=>R.includes(n)?R.filter(H=>H!==n):[...R,n]),G=()=>{S(1),f(null),g(""),l(["face","background","lighting","pose"]),_(""),v(""),y(!1)},w=()=>{i(),setTimeout(G,250)},K=p===1?!!c:!0;return d?He.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
42        @keyframes phFadeIn { from { opacity: 0 } to { opacity: 1 } }
43        @keyframes phScaleIn { from { opacity: 0; transform: scale(.96) } to { opacity: 1; transform: scale(1) } }
44      `}),e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm p-2 sm:p-4",style:{animation:"phFadeIn .2s ease-out"},onClick:w,children:e.jsxs("div",{className:"w-full max-w-2xl mx-2 sm:mx-4 max-h-[95vh] sm:max-h-[85vh] bg-[#16181A] border border-[#27272A] rounded-xl shadow-2xl flex flex-col",style:{animation:"phScaleIn .25s ease-out"},onClick:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-3.5 sm:px-5 py-3 sm:py-4 border-b border-[#27272A] shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-gradient-to-br from-[#326CB4]/30 to-[#4A8AD6]/20 flex items-center justify-center",children:e.jsx(J,{className:"w-4.5 h-4.5 text-[#4A8AD6]"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold text-white tracking-wide",children:"Prompt Helper"}),e.jsxs("p",{className:"text-[11px] text-gray-500",children:["Step ",p," of ",pe]})]})]}),e.jsx("button",{onClick:w,className:"p-1.5 rounded-full text-gray-500 hover:text-red-400 hover:bg-white/5 transition-colors",children:e.jsx(re,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"h-1 bg-[#1e2024] shrink-0",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-[#326CB4] to-[#4A8AD6] transition-all duration-500 ease-out rounded-r-full",style:{width:`${p/pe*100}%`}})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-3.5 sm:p-5 space-y-4 sm:space-y-5",children:[p===1&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold text-sm mb-1",children:"Pick what you want to change"}),e.jsx("p",{className:"text-gray-500 text-xs mb-4",children:"Tap a category below, then tell us what you'd like to do in a few words."}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:ae.map(n=>e.jsxs("button",{onClick:()=>f(n.id),className:`flex flex-col items-center gap-1.5 px-3 py-3 rounded-lg border text-center transition-all ${c===n.id?"border-[#326CB4] bg-[#326CB4]/10 text-white":"border-[#27272A] bg-[#1a1c1e] text-gray-400 hover:border-[#27272A]/80 hover:bg-[#1e2124]"}`,children:[e.jsx("span",{className:"text-lg",children:n.icon}),e.jsx("span",{className:"text-[11px] font-medium leading-tight",children:n.label})]},n.id))})]}),c&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-gray-400 mb-1.5 block",children:"Describe what you'd like to happen"}),e.jsx("textarea",{value:m,onChange:n=>g(n.target.value),placeholder:c==="logo"?"e.g. Swap the chest logo for the one in my 2nd image":c==="color"?"e.g. Change the shirt to the fabric shown in my 2nd image":c==="fit"?"e.g. Make the fit looser and baggier like my 2nd image":c==="object"?"e.g. Put a golden retriever next to the model":"Tell us in plain words what should change…",rows:3,className:"w-full bg-[#111315] border border-[#27272A] rounded-lg px-3 py-2.5 text-sm text-white placeholder:text-gray-600 resize-none outline-none focus:border-[#326CB4]/50 transition-colors"})]})]}),p===2&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold text-sm mb-1",children:"What should stay the same?"}),e.jsxs("p",{className:"text-gray-500 text-xs mb-4",children:["Check everything you"," ",e.jsx("span",{className:"text-gray-300 font-medium",children:"don't"})," ","want the AI to touch. If it's checked, it won't be changed."]}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Pe.map(n=>e.jsxs("button",{onClick:()=>A(n.id),className:`flex items-center gap-2.5 px-3.5 py-2.5 rounded-lg border text-left transition-all ${s.includes(n.id
44)?"border-[#326CB4] bg-[#326CB4]/10 text-white":"border-[#27272A] bg-[#1a1c1e] text-gray-400 hover:border-[#27272A]/80 hover:bg-[#1e2124]"}`,children:[e.jsx("span",{className:`w-4 h-4 rounded border flex-shrink-0 flex items-center justify-center text-[10px] transition-colors ${s.includes(n.id)?"bg-[#326CB4] border-[#326CB4] text-white":"border-[#3a3a3e] bg-transparent"}`,children:s.includes(n.id)&&"✓"}),e.jsx("span",{className:"text-xs font-medium",children:n.label})]},n.id))})]})}),p===3&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold text-sm mb-1",children:"Tell the AI what each image is for"}),e.jsx("p",{className:"text-gray-500 text-xs mb-4",children:"You can attach up to 3 images in the prompt bar. Here's how the AI will use each one. Add a short note so it knows what to look at."})]}),e.jsxs("div",{className:"rounded-lg border border-[#27272A] bg-[#1a1c1e] p-3.5 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded bg-[#326CB4]/20 flex items-center justify-center text-[10px] font-bold text-[#4A8AD6]",children:"1"}),e.jsx("span",{className:"text-xs font-semibold text-white",children:"Your Starting Photo"}),e.jsx("span",{className:"text-[10px] text-emerald-400/70 font-medium",children:"Required"})]}),e.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed pl-7",children:"This is the photo you want to edit. The AI will keep everything here the same unless you tell it to change something."})]}),c!=="skin"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-lg border border-[#27272A] bg-[#1a1c1e] p-3.5 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded bg-[#326CB4]/20 flex items-center justify-center text-[10px] font-bold text-[#4A8AD6]",children:"2"}),e.jsx("span",{className:"text-xs font-semibold text-white",children:"Your Reference Photo"}),e.jsx("span",{className:"text-[10px] text-[#4A8AD6]/70 font-medium",children:"Recommended"})]}),e.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed pl-7",children:mt[c]||"Upload a photo that shows the AI what you want."}),e.jsx("textarea",{value:C,onChange:n=>_(n.target.value),placeholder:"e.g. Only copy the shirt shape and sleeve length from this photo",rows:2,className:"w-full bg-[#111315] border border-[#27272A] rounded-lg px-3 py-2 text-xs text-white placeholder:text-gray-600 resize-none outline-none focus:border-[#326CB4]/50 transition-colors"})]}),e.jsxs("div",{className:"rounded-lg border border-[#27272A] bg-[#1a1c1e] p-3.5 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded bg-white/5 flex items-center justify-center text-[10px] font-bold text-gray-500",children:"3"}),e.jsx("span",{className:"text-xs font-semibold text-gray-400",children:"Extra Reference"}),e.jsx("span",{className:"text-[10px] text-gray-600",children:"Optional"})]}),e.jsx("p",{className:"text-[11px] text-gray-500 leading-relaxed pl-7",children:"Only add this if you need a second reference for something else — like matching lighting from one photo and colour from another."}),e.jsx("textarea",{value:T,onChange:n=>v(n.target.value),placeholder:"e.g. This 3rd photo is just for the lighting — only match the colour tone",rows:2,className:"w-full bg-[#111315] border border-[#27272A] rounded-lg px-3 py-2 text-xs text-white placeholder:text-gray-600 resize-none outline-none focus:border-[#326CB4]/50 transition-colors"})]})]}),c==="skin"&&e.jsx("div",{className:"rounded-lg border border-[#27272A] bg-emerald-500/5 p-3.5",children:e.jsxs("p",{className:"text-[11px] text-emerald-400/80 leading-relaxed",children:[e.jsx("span",{className:"font-semibold",children:"You don't need a 2nd image for this."})," ","The AI will enhance the skin directly on your starting photo."]})})]}),p===4&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-white font-semibold text-sm mb-1",children:"Your prompt is ready! 🎉"}),e.jsxs("p",{className:"text-gray-500 text-xs mb-4",children:["Copy it, or hit"," ",e.jsx("span",{className:"text-gray-300 font-medium",children:'"Use This Prompt"'})," ","to paste it straight into the prompt bar. Then attach your images in order — photo 1 first, photo 2 second, etc."]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"bg-[#111315] border border-[#27272A] rounded-lg px-4 py-3.5 text-xs text-gray-300 leading-relaxed whitespace-pre-wrap max-h-[40vh] overflow-y-auto font-mono",children:$}),e.jsx("button",{onClick:()=>{navigator.clipboard.writeText($),y(!0),setTimeout(()=>y(!1),2e3)},className:"absolute top-2.5 right-2.5 flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-white/5 hover:bg-white/10 text-gray-400 hover:text-white text-[11px] font-medium transition-colors",children:B?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"w-3 h-3 text-emerald-400"}),e.jsx("span",{className:"text-emerald-400",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(et,{className:"w-3 h-3"}),"Copy"]})})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[c&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md bg-[#326CB4]/10 border border-[#326CB4]/20 text-[10px] font-medium text-[#4A8AD6]",children:[(L=ae.find(n=>n.id===c))==null?void 0:L.icon," ",(D=ae.find(n=>n.id===c))==null?void 0:D.label]}),s.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md bg-white/5 border border-white/[0.06] text-[10px] font-medium text-gray-400",children:["🔒 ",s.length," locked"]})]})]})]}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row items-stretch sm:items-center justify-between gap-2 px-3.5 sm:px-5 py-3 sm:py-4 border-t border-[#27272A] shrink-0",children:[p>1?e.jsxs("button",{onClick:()=>S(n=>n-1),className:"flex items-center justify-center gap-1.5 px-5 py-2.5 sm:py-3 rounded-full text-gray-400 hover:text-white hover:bg-white/5 text-xs font-medium transition-colors",children:[e.jsx(tt,{className:"w-3.5 h-3.5"}),"Back"]}):e.jsx("div",{className:"hidden sm:block"}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2",children:[p===4&&e.jsxs("button",{onClick:()=>{x($),w()},className:"flex items-center justify-center gap-1.5 px-5 py-2.5 sm:py-3 rounded-full bg-gradient-to-r from-[#326CB4] to-[#4A8AD6] text-white text-xs font-bold transition-all hover:shadow-lg hover:shadow-[#326CB4]/20",children:[e.jsx(J,{className:"w-3.5 h-3.5"}),"Use This Prompt"]}),p<pe&&e.jsxs("button",{onClick:()=>S(n=>n+1),disabled:!K,className:"flex items-center justify-center gap-1.5 px-5 py-2.5 sm:py-3 rounded-full bg-white/[0.06] hover:bg-white/[0.10] text-white text-xs font-bold transition-colors disabled:opacity-30 disabled:cursor-not-allowed",children:[p===3?"Build Prompt":"Next",e.jsx(st,{className:"w-3.5 h-3.5"})]}),p===4&&e.jsx("button",{onClick:G,className:"flex items-center justify-center px-5 py-2.5 sm:py-3 rounded-full text-gray-500 hover:text-white hover:bg-white/5 text-xs font-medium transition-colors",children:"Start Over"})]})]})]})})]}),document.body):null}const pt="https://api.studioe.ai";function gt({onAgreed:d}){const{setUser:i,user:x}=De(),[c,f]=o.useState(!1),[m,g]=o.useState(!1),s=async()=>
44{if(!(!c||m)){g(!0);try{const l=await X(`${pt}/api/directors-studio/agree`,{},{method:"POST"});if(!(l!=null&&l.ok))throw new Error((l==null?void 0:l.error)||"Failed to save agreement");x&&i({...x,directorsStudioAgreed:!0}),d==null||d()}catch(l){P.error((l==null?void 0:l.message)||"Something went wrong. Please try again.")}finally{g(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:`
45        @keyframes dsDisclaimerFadeIn { from { opacity: 0 } to { opacity: 1 } }
46        @keyframes dsDisclaimerScaleIn { from { transform: scale(.92); opacity: 0 } to { transform: scale(1); opacity: 1 } }
47      `}),e.jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/70 backdrop-blur-sm p-4",style:{animation:"dsDisclaimerFadeIn 180ms ease-out"},children:e.jsxs("div",{className:"w-full max-w-xl bg-[#16181A] border border-[#252629] rounded-xl shadow-2xl overflow-hidden",style:{animation:"dsDisclaimerScaleIn 180ms cubic-bezier(.25,.8,.25,1)"},children:[e.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-[#252629]",children:[e.jsx("div",{className:"flex items-center justify-center w-9 h-9 rounded-full bg-[#326CB4]/15",children:e.jsx(J,{className:"w-5 h-5 text-[#4A8AD6]"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-white",children:"Director's Studio — Usage Agreement"}),e.jsx("p",{className:"text-[11px] text-gray-500 mt-0.5",children:"Please review and accept before continuing."})]})]}),e.jsxs("div",{className:"px-5 py-4 space-y-4 max-h-[50vh] overflow-y-auto",children:[e.jsx("p",{className:"text-[13px] text-gray-300 leading-relaxed",children:"Director's Studio provides advanced manual control and customization capabilities. This section should be used only to refine or enhance generated content (e.g., adding products or correcting face/clothing details). It must not be used to replicate real individuals, proprietary backgrounds, or protected intellectual property."}),e.jsxs("p",{className:"text-[13px] text-gray-300 leading-relaxed",children:[e.jsx("strong",{className:"text-white",children:"Prohibited content:"})," You may not generate or modify images of celebrities, public figures, influencers, politicians, athletes, or any recognizable individuals without their documented consent. You may not generate images of minors or any content that violates applicable laws."]}),e.jsx("p",{className:"text-[13px] text-gray-300 leading-relaxed",children:"I confirm I have the necessary rights to all referenced content and accept full responsibility for my prompts and outputs. Studioe.ai acts solely as a technical connector to third-party AI tools and assumes no liability for misuse."}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none group pt-1",children:[e.jsx("input",{type:"checkbox",checked:c,onChange:l=>f(l.target.checked),className:"mt-0.5 w-4 h-4 rounded border-gray-600 bg-[#27272A] text-[#326CB4] focus:ring-[#326CB4]/30 focus:ring-offset-0 cursor-pointer"}),e.jsx("span",{className:"text-sm text-gray-200 leading-snug",children:"I agree to these terms"})]})]}),e.jsx("div",{className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-[#252629]",children:e.jsx("button",{type:"button",onClick:s,disabled:!c||m,className:"px-5 py-2.5 rounded-full text-sm font-medium text-white bg-[#326CB4] hover:bg-[#3D7BC5] active:bg-[#2A5A9A] disabled:opacity-40 disabled:cursor-not-allowed transition",children:m?"Saving…":"Continue"})})]})})]})}const Y="https://api.studioe.ai",ft=[{value:"1K",label:"1K – Standard Quality"},{value:"2K",label:"2K – High Definition"},{value:"4K",label:"4K – DSLR Print Quality"}],M=[1,2,3,4],bt=["Warming up the studio…","Preparing your canvas…","Queuing your vision…"],yt=["Painting pixels with precision…","Sculpting light and shadow…","Refining every detail…","Bringing your vision to life…","Composing the final scene…","Almost there…"],wt=["Fix minor imperfections instantly","Adjust crop, pose, lighting, or expression","Fine-tune garment drape and fit","Correct small logo or texture shifts","Add or remove subtle details","Maintain locked fabric and print integrity","Bu
47ilt for brands that obsess over detail"],Te={"1K":F.DIRECTORS_STUDIO_1K,"2K":F.DIRECTORS_STUDIO_2K,"4K":F.DIRECTORS_STUDIO_4K};function jt(d,i){const x=xe[Te[d]]||xe[F.DIRECTORS_STUDIO_1K],c=(i-1)*xe[F.DIRECTORS_STUDIO_EXTRA_IMAGE];return x+c}function Wt(){const d=qe(),{user:i,setCreditBalance:x}=De(),{openAuthModal:c}=ze(),f=Ve(i),{jobs:m,setJobs:g,addJob:s,updateJob:l,removeJob:C,generatedImages:_,addGeneratedImages:T,heroCollapsed:v,setHeroCollapsed:p,aspectRatio:S,setAspectRatio:B,resolution:y,setResolution:$,numImages:A,setNumImages:G}=We(),[w,K]=o.useState(""),L=o.useRef(null),[D,n]=o.useState([]),R=o.useRef(null),[H,Q]=o.useState(null),ge=o.useRef(null),[_e,oe]=o.useState(!1),U=o.useRef(0),[fe,V]=o.useState(!1),[be,Z]=o.useState(!1),[Be,ye]=o.useState(!1),[Oe,ne]=o.useState(!1),ie=o.useRef(null),le=o.useRef(null);o.useEffect(()=>{const t=r=>{ie.current&&!ie.current.contains(r.target)&&V(!1),le.current&&!le.current.contains(r.target)&&Z(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]),o.useEffect(()=>{const t=L.current;t&&(t.style.height="auto",t.style.height=Math.min(t.scrollHeight,200)+"px")},[w]);const we=o.useCallback(async t=>{const r=[];for(const N of Array.from(t).slice(0,12))try{let b=await Ye(N,Y);b=await Xe(b);const ee=await Je(b);r.push({file:b,preview:ee})}catch(b){Qe(b,"Something went wrong while preparing your image.")}r.length&&n(N=>[...N,...r].slice(0,12))},[]),Fe=o.useCallback(t=>{n(r=>r.filter((N,b)=>b!==t))},[]),Le=o.useCallback(t=>{t&&(n(r=>r.length>=12?(P.info("Maximum 12 images attached.",{toastId:"attach-max"}),r):r.some(N=>N.preview===t)?(P.info("This image is already attached.",{toastId:"attach-dup"}),r):[...r,{file:null,preview:t,isUrl:!0}]),ne(!1))},[]);async function Re(t){var N;const r=await X(`${Y}/api/upload`,{file:t},{method:"POST"});return((N=r==null?void 0:r.upload)==null?void 0:N.secure_url)||null}const ce=o.useCallback(async()=>{var ve;if(!w.trim()){P.info("Please describe what you want to create or edit.");return}if(!i){P.info("Please sign in to use Director's Studio."),c("signup",{mode:"signup"});return}const t=String((i==null?void 0:i.subscriptionTier)||"").toLowerCase(),r=i==null?void 0:i.subscriptionStatus;if(!((r==="active"||r==="active-cancelled"||r==="paused"||r==="past_due")&&t==="elite")){ke({reason:"plan",message:"Director's Studio is an Elite-only feature. Upgrade to unlock it."});return}const b=Te[y];let ee=0,q=[];try{const a=await Ce(b,{count:1,beforeBalance:i==null?void 0:i.creditBalance,user:i});if(typeof(a==null?void 0:a.creditBalance)=="number"&&x(a.creditBalance),a!=null&&a.debited&&(ee+=a.debited,q.push({key:b,amount:a.debited})),A>1){const h=await Ce(F.DIRECTORS_STUDIO_EXTRA_IMAGE,{count:A-1,beforeBalance:(a==null?void 0:a.creditBalance)??(i==null?void 0:i.creditBalance),user:i});typeof(h==null?void 0:h.creditBalance)=="number"&&x(h.creditBalance),h!=null&&h.debited&&(ee+=h.debited,q.push({key:F.DIRECTORS_STUDIO_EXTRA_IMAGE,amount:h.debited}))}}catch(a){(a==null?void 0:a.code)==="INSUFFICIENT_TOKENS"?ke({reason:"credits"}):(a==null?void 0:a.code)==="ELITE_REQUIRED"||/elite/i.test((a==null?void 0:a.message)||"")?P.info("This feature is for Elite members. Upgrade to unlock it.",{autoClose:6e3}):(a==null?void 0:a.code)!=="SERVER_OFFLINE"&&P.error("Credit deduction failed. Please try again.");for(const h of q)await Se(h.key,h.amount).then(j=>{(j==null?void 0:j.creditBalance)!=null&&x(j.creditBalance)});return}const de=w.trim(),z=[...D];v||p(!0);const E=`job-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,Me={id:E,status:"uploading",queuePosition:null,urls:null,error:null,startedAt:Date.now(),prompt:de,messageIdx:0,progress:0};s(Me),K(""),n([]);try{let a=[];if(z.length>0)for(let u=0;u<z.length;u++){const k=z[u];if(k.isUrl){a.push(k.preview);continue}const te=await Re(k.preview).catch(Ke=>{const Ne=new Error(`Couldn't upload attached image ${u+1} of ${z.length}. Please check your connection and try again.`);throw Ne.cause=Ke,Ne});if(!te)throw new Error(`Couldn't upload attached image ${u+1} of ${z.length}. Please try again.`);a.push(te)}l(E,{status:"submitting",progress:8});const h=await X(`${Y}/api/directors-studio/generate`,{prompt:de,imageUrls:a,aspectRatio:S,resolution:y,numImages:A},{method:"POST"});if(!(h!=null&&h.ok)||!(h!=null&&h.requestId))throw new Error((h==null?void 0:h.error)||"Failed to submit generation");const{requestId:j,modelId:he}=h;l(E,{status:"queued",requestId:j,modelId:he,progress:12});let me=!1,W=0;const $e=180;let ue=null;for(;!me&&W<$e;){await new Promise(u=>setTimeout(u,1e3)),W++;try{const u=await X(`${Y}/api/directors-studio/status`,{requestId:j,modelId:he},{method:"POST"});if((u==null?void 0:u.status)==="COMPLETED")me=!0,l(E,{status:"fetching",progress:90});else if((u==null?void 0:u.status)==="IN_QUEUE"){const k=Math.min(25,12+W*.5);l(E,{status:"queued",queuePosition:u.queuePosition,progress:Math.round(k)})}else if((u==null?void 0:u.status)==="IN_PROGRESS"){ue===null&&(ue=W);const k=W-ue,te=Math.min(88,25+63*(1-Math.exp(-k/30)));l(E,{status:"processing",queuePosition:null,progress:Math.round(te)})}}catch{}g(u=>u.map(k=>k.id===E?{...k,messageIdx:(k.messageIdx+1)%6}:k))}if(!me)throw new Error("Generation timed out");const I=await X(`${Y}/api/directors-studio/result`,{requestId:j,modelId:he},{method:"POST"});if(!(I!=null&&I.ok)||!((ve=I==null?void 0:I.urls)!=null&&ve.length))throw new Error((I==null?void 0:I.error)||"No images returned");const Ge=I.urls.map(u=>({url:u,prompt:de,timestamp:Date.now()}));T(Ge),C(E),setTimeout(()=>{var u;(u=ge.current)==null||u.scrollIntoView({behavior:"smooth"})},100)}catch(a){if(console.error("Generation error:",a),l(E,{status:"error",error:(a==null?void 0:a.message)||"Generation failed",progress:0}),(a==null?void 0:a.code)!=="SERVER_OFFLINE"&&P.error((a==null?void 0:a.message)||"Generation failed. Please try again."),(a==null?void 0:a.code)!=="SERVER_OFFLINE"&&q.length>0)for(const h of q)await Se(h.key,h.amount).then(j=>
47{(j==null?void 0:j.creditBalance)!=null&&x(j.creditBalance)});setTimeout(()=>{C(E)},5e3)}},[w,D,S,y,A,v,i,x,s,l,C,T,g]),je=o.useCallback(async t=>{try{const N=await(await fetch(t)).blob(),b=document.createElement("a");b.href=URL.createObjectURL(N),b.download=`directors-studio-${Date.now()}.png`,b.click(),URL.revokeObjectURL(b.href)}catch{P.error("Download failed")}},[]),Ue=o.useCallback(t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),ce())},[ce]),O=m.some(t=>t.status==="uploading"||t.status==="submitting"||t.status==="queued"||t.status==="processing"||t.status==="fetching");return e.jsxs("div",{className:"min-h-screen text-white relative",children:[e.jsxs("div",{className:"absolute inset-0 pointer-events-none overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gray-900"}),e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(900px_circle_at_15%_10%,rgba(160,200,230,0.20),transparent_55%),radial-gradient(900px_circle_at_85%_20%,rgba(180,200,220,0.14),transparent_55%),radial-gradient(1000px_circle_at_50%_90%,rgba(160,190,210,0.10),transparent_60%)]"}),e.jsx("div",{className:"absolute inset-0 opacity-[0.10] [background-image:linear-gradient(to_right,rgba(255,255,255,0.12)_1px,transparent_1px),linear-gradient(to_bottom,rgba(255,255,255,0.12)_1px,transparent_1px)] [background-size:88px_88px]"}),e.jsx("div",{className:"absolute -top-24 left-1/2 -translate-x-[72%] h-[520px] w-[520px] rounded-full bg-gradient-to-br from-[#A0C4E0]/18 to-transparent blur-3xl animate-[heroFloatA_18s_ease-in-out_infinite]"}),e.jsx("div",{className:"absolute top-6 left-1/2 translate-x-[18%] h-[560px] w-[560px] rounded-full bg-gradient-to-br from-[#B0C4D8]/16 to-transparent blur-3xl animate-[heroFloatB_22s_ease-in-out_infinite]"})]}),e.jsx("style",{children:`
48        @keyframes heroFloatA {
49          0%,100% { transform: translateX(-72%) translate3d(0,0,0) scale(1); }
50          50% { transform: translateX(-72%) translate3d(120px, 40px, 0) scale(1.05); }
51        }
52        @keyframes heroFloatB {
53          0%,100% { transform: translateX(18%) translate3d(0,0,0) scale(1); }
54          50% { transform: translateX(18%) translate3d(-140px, 60px, 0) scale(1.06); }
55        }
56      `}),e.jsxs("div",{className:"relative max-w-5xl mx-auto px-4 pt-24 pb-52 sm:pb-36",children:[e.jsx(se,{children:e.jsx("div",{className:`transition-all duration-700 overflow-hidden ${v?"max-h-0 opacity-0 mb-0":"max-h-[800px] opacity-100 mb-8 sm:mb-12"}`,children:e.jsxs("div",{className:"text-center space-y-4 sm:space-y-6 py-8 sm:py-12",children:[e.jsx("div",{className:"flex justify-center",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"w-16 h-16 sm:w-20 sm:h-20 rounded-2xl bg-gradient-to-br from-[#326CB4]/20 to-[#326CB4]/10 border border-[#326CB4]/30 flex items-center justify-center",children:e.jsx(J,{className:"w-8 h-8 sm:w-10 sm:h-10 text-[#4A8AD6]"})}),e.jsx("div",{className:"absolute -top-1 -right-1 w-6 h-6 rounded-full bg-gradient-to-br from-[#4A8AD6] to-[#326CB4] flex items-center justify-center",children:e.jsx(Ee,{className:"w-3.5 h-3.5 text-white"})})]})}),e.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[e.jsx("h1",{className:"text-3xl sm:text-5xl font-black tracking-tight text-white uppercase",children:"Director's Studio"}),e.jsxs("p",{className:"text-gray-400 text-sm sm:text-lg max-w-xl mx-auto",children:["When precision matters, you take control.",e.jsx("br",{}),e.jsx("span",{className:"text-gray-500",children:"Refine, correct, and perfect your image without starting over."})]})]}),e.jsx("div",{className:"flex flex-wrap justify-center gap-1.5 sm:gap-2 max-w-2xl mx-auto pt-1 sm:pt-2",children:wt.map((t,r)=>e.jsxs("span",{className:"inline-flex items-center gap-1 sm:gap-1.5 px-2 sm:px-3 py-1 sm:py-1.5 rounded-full bg-white/[0.04] border border-white/[0.06] text-[11px] sm:text-[12px] text-gray-400",children:[e.jsx("span",{className:"w-1 h-1 rounded-full bg-[#4A8AD6]/70"}),t]},r))}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-600 italic pt-2 sm:pt-4",children:"The world is yours to control."})]})})}),v&&e.jsx(se,{children:e.jsx("div",{className:"flex items-center justify-between mb-6",children:e.jsxs("button",{onClick:()=>p(!1),className:"flex items-center gap-2 text-sm text-gray-500 hover:text-gray-300 transition-colors",children:[e.jsx(J,{className:"w-5 h-5 text-[#4A8AD6]"}),e.jsx("span",{className:"font-bold text-white uppercase tracking-wide",children:"Director's Studio"}),e.jsx(at,{className:"w-4 h-4"})]})})}),(_.length>0||m.length>0)&&e.jsx(se,{children:e.jsxs("div",{className:"space-y-4 mb-8",children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-3",children:[_.map((t,r)=>e.jsx(se,{delayMs:r*60,children:e.jsxs("div",{className:"group relative rounded-xl overflow-hidden bg-[#111] border border-white/[0.06]",children:[e.jsxs("div",{className:"relative aspect-square overflow-hidden",children:[e.jsx("img",{src:t.url,alt:t.prompt,className:"w-full h-full object-cover cursor-pointer transition-transform duration-300 group-hover:scale-105",onClick:()=>Q(t.url),loading:"lazy"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-trans
56parent to-transparent opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none"}),e.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:()=>Q(t.url),className:"p-1.5 rounded-lg bg-black/60 backdrop-blur-sm text-white/80 hover:text-white transition-colors",title:"Preview",children:e.jsx(rt,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>je(t.url),className:"p-1.5 rounded-lg bg-black/60 backdrop-blur-sm text-white/80 hover:text-white transition-colors",title:"Download",children:e.jsx(Ae,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"px-2.5 py-2 border-t border-white/[0.04]",children:e.jsx("p",{className:"text-[11px] text-gray-500 line-clamp-2 leading-relaxed",children:t.prompt})})]})},`${t.url}-${r}`)),m.map(t=>e.jsx(Nt,{job:t},t.id))]}),e.jsx("div",{ref:ge})]})}),e.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-40 bg-gradient-to-t from-gray-900 via-gray-900 to-transparent pt-4 pb-4 sm:pt-6 sm:pb-8 px-3 sm:px-4",children:e.jsxs("div",{className:"max-w-5xl mx-auto relative",onDragEnter:t=>{t.preventDefault(),t.stopPropagation(),U.current++,U.current===1&&oe(!0)},onDragOver:t=>{t.preventDefault(),t.stopPropagation()},onDragLeave:t=>{t.preventDefault(),t.stopPropagation(),U.current--,U.current<=0&&(U.current=0,oe(!1))},onDrop:t=>{var r;t.preventDefault(),t.stopPropagation(),U.current=0,oe(!1),(r=t.dataTransfer.files)!=null&&r.length&&we(t.dataTransfer.files)},children:[D.length>0&&e.jsx("div",{className:"flex gap-2 mb-3 px-1 overflow-x-auto pb-1",children:D.map((t,r)=>e.jsxs("div",{className:"relative flex-shrink-0 w-16 h-16 rounded-lg overflow-hidden border border-white/10 group",children:[e.jsx("img",{src:t.preview,alt:"",className:"w-full h-full object-cover"}),e.jsx("button",{onClick:()=>Fe(r),className:"absolute top-0.5 right-0.5 w-5 h-5 rounded-full bg-black/70 flex items-center justify-center text-white/70 hover:text-white opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(re,{className:"w-3 h-3"})})]},r))}),e.jsxs("div",{className:`rounded-2xl bg-[#1a1a1e] shadow-2xl shadow-black/50 transition-colors duration-200 ${_e?"border-2 border-[#326CB4] shadow-[0_0_20px_rgba(50,108,180,0.3)]":"border-2 border-white/[0.08]"}`,children:[e.jsxs("div",{className:"flex items-end gap-2 sm:gap-3 px-3 sm:px-4 pt-2.5 sm:pt-3 pb-1.5 sm:pb-2",children:[e.jsx("button",{onClick:()=>{var t;return(t=R.current)==null?void 0:t.click()},disabled:O||D.length>=12,className:"flex-shrink-0 p-2 rounded-lg text-gray-500 hover:text-white hover:bg-white/5 transition-all disabled:opacity-30",title:"Upload image",children:e.jsx(ot,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>ne(!0),disabled:O||D.length>=12,className:"flex-shrink-0 p-2 rounded-lg text-gray-500 hover:text-white hover:bg-white/5 transition-all disabled:opacity-30",title:"Choose from projects",children:e.jsx(nt,{className:"w-5 h-5"})}),e.jsx("input",{ref:R,type:"file",accept:"image/png, image/jpeg, image/webp, image/heic, image/heif, .heic, .heif",multiple:!0,className:"hidden",onChange:t=>{var r;(r=t.target.files)!=null&&r.length&&we(t.target.files),t.target.value=""}}),e.jsx("textarea",{ref:L,value:w,onChange:t=>{t.target.value.length<=1e3&&K(t.target.value)},maxLength:1e3,onKeyDown:Ue,placeholder:"Describe the scene you imagine",rows:1,className:"flex-1 bg-transparent text-white text-sm placeholder:text-gray-600 resize-none outline-none leading-relaxed max-h-[200px] py-1"}),w.length>800&&e.jsxs("span",{className:`flex-shrink-0 text-[10px] font-medium self-end pb-1 ${w.length>=1e3?"text-red-400":"text-gray-500"}`,children:[w.length,"/1000"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 pb-2.5 sm:pb-3 pt-1 flex-wrap",children:[e.jsxs("div",{ref:ie,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>{V(t=>!t),Z(!1)},disabled:O,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-white/[0.04] hover:bg-white/[0.08] text-[12px] text-gray-400 font-medium transition-colors disabled:opacity-50",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-gray-500",children:e.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"1.5",stroke:"currentColor",strokeWidth:"1.5"})}),e.jsx("span",{children:ct(S)}),e.jsx(Ie,{className:`w-3 h-3 transition-transform ${fe?"rotate-180":""}`})]}),fe&&e.jsx(vt,{options:dt,selectedValue:S,onSelect:t=>{B(t),V(!1)}})]}),e.jsxs("div",{ref:le,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>{Z(t=>!t),V(!1)},disabled:O,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-white/[0.04] hover:bg-white/[0.08] text-[12px] text-gray-400 font-medium transition-colors disabled:opacity-50",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-gray-500",children:e.jsx("path",{d:"M4 12L8 4l4 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{children:y}),e.jsx(Ie,{className:`w-3 h-3 transition-transform ${be?"rotate-180":""}`})]}),be&&e.jsx("div",{className:"absolute bottom-full mb-1 left-0 z-50 min-w-[180px] bg-[#1C1E20] border border-[#27272A] rounded-lg shadow-xl overflow-hidden",children:ft.map(t=>e.jsx("button",{type:"button",onClick:()=>{$(t.value),Z(!1)},className:`w-full px-3 py-2 text-left text-sm transition-colors ${y===t.value?"bg-blue-600 text-white":"text-gray-300 hover:bg-[#252525]"}`,children:t.label},t.value))})]}),e.jsxs("div",{className:"flex items-center gap-1 px-1.5 py-1 rounded-full bg-white/[0.04]",children:[e.jsx("button",{onClick:()=>G(t=>Math.max(1,t-1)),disabled:A<=1||O,className:"w-6 h-6 rounded flex items-center justify-center text-gray-500 hover:text-white hover:bg-white/5 disabled:opacity-30 text-sm transition-colors",children:"−"}),e.jsxs("span",{className:"text-[12px] font-medium text-gray-400 min-w-[24px] text-center",children:[A,"/",M[M.length-1]]}),e.jsx("button",{onClick:()=>G(t=>Math.min(M[M.length-1],t+1)),disabled:A>=M[M.length-1]||O,className:"w-6 h-6 rounded flex items-center justify-center text-gray-500 hover:text-white hover:bg-white/5 disabled:opacity-30 text-sm transition-colors",children:"+"})]}),e.jsxs("button",{type:"button",onClick:()=>ye(!0),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full bg-white/[0.04] hover:bg-white/[0.08] text-[12px] text-gray-400 font-medium transition-colors",title:"Prompt Helper",children:[e.jsx("span",{className:"text-[13px]",children:"🎬"}),e.jsx("span",{className:"hidden sm:inline",children:"Prompt Helper"})]}),e.jsx("div",{className:"flex-1"}),f?e.jsxs("button",{onClick:()=>d(f.ctaHref),className:`flex items-center gap-2 px-3.5 sm:px-5 py-2 sm:py-2.5 rounded-full text-xs sm:text-sm font-bold border transition-colors ${f.kind==="past_due"?"bg-red-600/15 border-red-500/30 text-red-300 hover:bg-red-600/25":"bg-amber-600/20 border-amber-500/30 text-amber-300 hover:bg-amber-600/30"}`,children:[e.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H10m-4-6V8a6 6 0 1112 0v3"})}),f.label]}):e.jsxs("button",{onClick:ce,disabled:O||!w.trim(),className:"group relative flex items-center gap-1.5 sm:gap-2 px-3.5 sm:px-5 py-2 sm:py-2.5 rounded-full text-white text-xs sm:text-sm font-bold transition-all disabled:opacity-40 disabled:cursor-not-allowed overflow-hidden shadow-lg shadow-[#326CB4]/20",children:[e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-[#326CB4] via-[#3D7BC5] to-[#4A8AD6]"}),e.jsx("span",{className:"absolute inset-0 bg-gradient-to-r from-[#4A8AD6] via-[#5599E7] to-[#326CB4] opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),e.jsxs("span",{className:"relative z-10 flex items-center gap-2",children:["Generate",e.jsx(Ee,{className:"w-4 h-4"}),(i==null?void 0:i.role)!=="admin"&&e.jsx(it,{cost:jt(y,A)})]})]})]})]})]})})]}),e.jsx(xt,{open:Be,onClose:()=>ye(!1),onUsePrompt:t=>{K(t),setTimeout(()=>{var r;return(r=L.current)==null?void 0:r.focus()},50)}}),e.jsx(lt,{open:Oe,onClose:()=>
56ne(!1),onSelect:Le,title:"Choose from Projects",query:{unlocked:!0,imageSelected:!0}}),H&&e.jsxs("div",{className:"fixed inset-0 z-50 bg-black/90 backdrop-blur-sm flex items-center justify-center p-4",onClick:()=>Q(null),children:[e.jsx("button",{onClick:()=>Q(null),className:"absolute top-4 right-4 p-2 rounded-full bg-white/10 hover:bg-white/20 text-white transition-colors",children:e.jsx(re,{className:"w-6 h-6"})}),e.jsx("img",{src:H,alt:"Preview",className:"max-w-full max-h-[85vh] object-contain rounded-lg",onClick:t=>t.stopPropagation()}),e.jsxs("button",{onClick:t=>{t.stopPropagation(),je(H)},className:"absolute bottom-6 right-6 flex items-center gap-2 px-4 py-2 rounded-xl bg-white/10 hover:bg-white/20 text-white text-sm font-medium transition-colors",children:[e.jsx(Ae,{className:"w-4 h-4"}),"Download"]})]}),i&&!i.directorsStudioAgreed&&e.jsx(gt,{onAgreed:()=>{}})]})}function vt({options:d,selectedValue:i,onSelect:x}){const c=o.useRef(null),[f,m]=o.useState(!1),g=o.useCallback(()=>{const s=c.current;s&&m(s.scrollHeight-s.scrollTop-s.clientHeight>2)},[]);return o.useEffect(()=>{const s=c.current;if(s)return s.scrollTop=0,g(),s.addEventListener("scroll",g,{passive:!0}),()=>s.removeEventListener("scroll",g)},[g]),e.jsxs("div",{className:"absolute bottom-full mb-1 left-0 z-50 min-w-[180px] bg-[#1C1E20] border border-[#27272A] rounded-lg shadow-xl overflow-hidden",children:[e.jsx("div",{ref:c,className:"max-h-[260px] overflow-y-auto scrollbar-thin",children:d.map(s=>e.jsxs("button",{type:"button",onClick:()=>x(s.value),className:`w-full px-3 py-2 text-left text-sm transition-colors flex items-center gap-2 ${i===s.value?"bg-blue-600 text-white":"text-gray-300 hover:bg-[#252525]"}`,children:[s.icon&&e.jsx("span",{className:"flex-shrink-0 flex items-center justify-center w-5 h-5",children:s.icon}),s.label]},s.value))}),e.jsx("div",{className:`absolute bottom-0 left-0 right-0 flex justify-center pb-1.5 pt-4 bg-gradient-to-t from-[#1C1E20] via-[#1C1E20]/80 to-transparent pointer-events-none transition-opacity duration-200 ${f?"opacity-100":"opacity-0"}`,children:e.jsx("svg",{className:"w-3.5 h-3.5 text-gray-500",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{d:"M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.08 1.04l-4.25 4.25a.75.75 0 01-1.06 0L5.25 8.27a.75.75 0 01-.02-1.06z"})})})]})}function Nt({job:d}){const[i,x]=o.useState(1),[c,f]=o.useState(0);o.useEffect(()=>{const B=setInterval(()=>{x(y=>y%3+1)},500);return()=>clearInterval(B)},[]),o.useEffect(()=>{const B=setInterval(()=>{f(y=>y+1)},3e3);return()=>clearInterval(B)},[]);const m=d.status==="queued",g=d.status==="processing"||d.status==="fetching",s=d.status==="error",l=d.status==="uploading"||d.status==="submitting",C=m?bt:yt,_=C[c%C.length],T=".".repeat(i),v=d.progress||0,p=s?"from-red-500 to-red-400":m?"from-blue-500 to-blue-400":"from-[#326CB4] to-[#4A8AD6]",S=s?"shadow-red-500/40":m?"shadow-blue-500/40":"shadow-[#326CB4]/40";return e.jsxs("div",{className:"relative rounded-xl overflow-hidden bg-[#111] border border-white/[0.06] aspect-square flex flex-col",children:[e.jsxs("div",{className:"flex-1 flex items-center justify-center relative",children:[e.jsxs("div",{className:"absolute inset-0",children:[e.jsx("div",{className:"absolute inset-0 opacity-30",style:{background:s?"radial-gradient(circle at center, #ef444440 0%, transparent 70%)":m?"radial-gradient(circle at center, #3b82f640 0%, transparent 70%)":"radial-gradient(circle at center, #326CB440 0%, transparent 70%)",animation:"pulse 2s ease-in-out infinite"}}),!s&&e.jsx("div",{className:"absolute inset-0 opacity-[0.03]",style:{backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 2px, white 2px, white 3px)"}}),(g||l)&&e.jsx("div",{className:"absolute left-0 right-0 h-[2px] opacity-40",style:{background:"linear-gradient(90deg, transparent 0%, #326CB4 50%, transparent 100%)",animation:"sweepDown 2s ease-in-out infinite"}})]}),e.jsx("div",{className:"relative z-10 text-center px-4 space-y-3",children:s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-10 h-10 mx-auto rounded-full bg-red-500/20 flex items-center justify-center",children:e.jsx(re,{className:"w-5 h-5 text-red-400"})}),e.jsx("p",{className:"text-xs text-red-400 font-medium",children:d.error})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative w-14 h-14 mx-auto",children:[e.jsxs("svg",{className:"w-14 h-14 -rotate-90",viewBox:"0 0 56 56",children:[e.jsx("circle",{cx:"28",cy:"28",r:"24",fill:"none",stroke:m?"rgba(59,130,246,0.15)":"rgba(50,108,180,0.15)",strokeWidth:"3"}),e.jsx("circle",{cx:"28",cy:"28",r:"24",fill:"none",stroke:m?"#60a5fa":"#4A8AD6",
56strokeWidth:"3",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*24}`,strokeDashoffset:`${2*Math.PI*24*(1-v/100)}`,style:{transition:"stroke-dashoffset 0.8s ease-out"}})]}),e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[11px] font-bold text-gray-300",children:[v,"%"]})]}),m&&d.queuePosition!=null&&e.jsx("div",{className:"flex items-center justify-center gap-2",children:e.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-blue-500/20 text-[11px] font-semibold text-blue-300",children:["Position ",d.queuePosition+1]})}),e.jsxs("p",{className:"text-[12px] text-gray-400 font-medium animate-pulse",children:[l?"Uploading images":_,T]})]})})]}),!s&&e.jsxs("div",{className:"relative h-1.5 bg-white/[0.04] overflow-hidden",children:[e.jsx("div",{className:`absolute inset-y-0 left-0 bg-gradient-to-r ${p} shadow-sm ${S}`,style:{width:`${v}%`,transition:"width 0.8s ease-out"}}),e.jsx("div",{className:"absolute inset-y-0 left-0 overflow-hidden",style:{width:`${v}%`,transition:"width 0.8s ease-out"},children:e.jsx("div",{className:"absolute inset-0 opacity-40",style:{background:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"shimmer 1.8s ease-in-out infinite"}})})]}),e.jsx("style",{children:`
57        @keyframes sweepDown {
58          0% { top: 0%; }
59          50% { top: 100%; }
60          100% { top: 0%; }
61        }
62        @keyframes shimmer {
63          0% { background-position: 200% 0; }
64          100% { background-position: -200% 0; }
65        }
66      `})]})}export{Wt 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.