1import{a6 as Ct,a3 as Mt,bk as Tt,a1 as Ot,V as l,cp as P,bN as Dt,bA as K,bx as _t,ai as m,W as e,bC as le,_ as Ae,ag as S,b3 as At,a0 as $t,ae as de,bB as Et,bU as Rt,af as Vt,at as Ft,cu as Lt,cF as Ut,Y as Wt,bf as $e,aq as Ee,cG as Bt,cH as Re,bo as zt,cI as Jt}from"./index-D5xBnUoa.js";import{u as qt}from"./usePageTitle-CaWsmQy7.js";import{u as Ve}from"./index-5y6Vd-26.js";import{S as Fe}from"./Spinner-CvuQeJ7k.js";import{R as Ht,S as Gt,C as Kt,a as Xt,L as Yt,T as Zt,b as Qt,c as es}from"./CreatorGuide-CwjZCycp.js";import{A as ts}from"./arrow-left-Dv8Si2r8.js";import{C as ss}from"./clock-Be1iOXal.js";import{U as Le}from"./upload-Cmf2gbfn.js";import{H as X}from"./help-circle-CByzmAuq.js";import{P as rs}from"./plus-OUKV9Ah6.js";import{C as as}from"./chevron-up-CR9R9osX.js";import{C as is}from"./chevron-down-KnOQ12uc.js";import"./index-XCoeLZ6u.js";import"./videoGuidance-DKuVqYcu.js";import"./trash-2-CdEgD3kK.js";import"./alert-triangle-FwlSpOFt.js";import"./lock-BmevhJS3.js";import"./palette-C-hX3cBe.js";import"./check-circle-2-CR14_cjs.js";import"./x-circle-CvZwrqVY.js";const os=[".jpeg",".jpg",".png",".webp"],Ue=10,ce=1600,ns=["porn","xxx","nude","naked","sex","nsfw","adult","pedophile","child abuse","rape","rapist","molest","terrorist","terrorism","bomb","weapon","gun","kill","nazi","hitler","racist","nigger","faggot","cocaine","heroin","meth","drug dealer"],Z="studio_create_draft",ls="promptFactory",Y="prefill",ds=()=>new Promise(p=>{const u=indexedDB.open(ls,1);u.onerror=()=>p(null),u.onupgradeneeded=b=>{const k=b.target.result;k.objectStoreNames.contains(Y)||k.createObjectStore(Y)},u.onsuccess=()=>{const b=u.result;try{const k=b.transaction(Y,"readwrite"),v=k.objectStore(Y),f=v.get("current");f.onsuccess=()=>{const y=f.result;v.delete("current"),k.oncomplete=()=>{b.close(),p(y||null)}},f.onerror=()=>{b.close(),p(null)}}catch{b.close(),p(null)}}}),cs=()=>{try{const p=localStorage.getItem(Z);if(p){const u=JSON.parse(p);return{title:u.title||"",description:u.description||"",creatorTips:u.creatorTips||"",masterPrompt:u.masterPrompt||"",coverImage:null,coverPreview:u.coverPreview||null,compatibleProducts:u.compatibleProducts||[],productSlots:u.productSlots||[{id:"1",label:"Product",variableName:"product_1",isOptional:!1,allowExclude:!1,defaultImage:null,defaultImagePreview:null}],creatorCommission:u.creatorCommission??P.DEFAULT_COMMISSION,modelId:u.modelId||null,mediaType:u.mediaType==="video"?"video":"image",videoDurationS:u.videoDurationS||6,defaultVideoModelId:u.defaultVideoModelId||"",coverVideo:null,coverVideoPreview:null,coverVideoShape:null}}}catch{}return null},ms=p=>{try{const u={title:p.title,description:p.description,creatorTips:p.creatorTips,masterPrompt:p.masterPrompt,coverPreview:null,compatibleProducts:p.compatibleProducts,productSlots:p.productSlots.map(b=>({...b,defaultImage:null,defaultImagePreview:null})),creatorCommission:p.creatorCommission,modelId:p.modelId,mediaType:p.mediaType||"image",videoDurationS:p.videoDurationS||6,defaultVideoModelId:p.defaultVideoModelId||"",savedAt:Date.now()};localStorage.setItem(Z,JSON.stringify(u))}catch{try{localStorage.removeItem(Z)}catch{}}},me=()=>{localStorage.removeItem(Z)},he=(p,u)=>{try{const b=p.split(","),k=b[0].match(/:(.*?);/)[1],v=atob(b[1]);let f=v.length;const y=new Uint8Array(f);for(;f--;)y[f]=v.charCodeAt(f);return new File([y],u,{type:k})}catch{return null}},hs=({w:p,h:u})=>{const b=[[16,9],[9,16],[1,1],[4,3],[3,4],[21,9]],k=p/u,v=b.reduce((f,y)=>Math.abs(f[0]/f[1]-k)<Math.abs(y[0]/y[1]-k)?f:y);return`${v[0]}:${v[1]}`},We="px-4 py-4 m-0 border-0 font-mono text-sm leading-relaxed whitespace-pre-wrap break-words",Es=()=>{var De;qt("Create Style");const p=Ct(),{invalidateEntity:u}=Mt(),[b]=Tt(),{user:k,isAdmin:v}=Ot(),[f,y]=l.useState(!1),[R,O]=l.useState(!1),[ps,xs]=l.useState("basics"),[Be,pe]=l.useState(!1),[J,ze]=l.useState([]),[D,xe]=l.useState(null),[us,ue]=l.useState(!1),[r,V]=l.useState(()=>{const t=cs();return t||{title:"",description:"",creatorTips:"",masterPrompt:"",coverImage:null,coverPreview:null,compatibleProducts:[],productSlots:[{id:"1",label:"Product",variableName:"product_1",isOptional:!1,allowExclude:!1,mode:"strict",defaultImage:null,defaultImagePreview:null}],creatorCommission:P.DEFAULT_COMMISSION,modelId:null,castModelsMode:"none",backgroundColour:!1,mediaType:"image",videoDurationS:6,defaultVideoModelId:"",coverVideo:null,coverVideoPreview:null}}),n=r.mediaType==="video",[F,Je]=l.useState([]),[Q,q]=l.useState(""),[L,ge]=l.useState([]),[_,be]=l.useState("text"),[qe,fe]=l.useState({masterPrompt:!1,slots:!1}),[He,Ge]=l.useState([]),[Ke,A]=l.useState(!1),[we,Xe]=l.useState([]),[U,H]=l.useState(!1),[W,ee]=l.useState(0),M=l.useRef(null),[C,te]=l.useState(!1),[g,se]=l.useState(""),[re,Ye]=l.useState(0),[$,B]=l.useState(0),T=l.useRef(null),[ae,ke]=l.useState(null),[ve,Ze]=l.useState([]);l.useEffect(()=>{!n||ae||Dt.getConfig().then(t=>{ke((t==null?void 0:t.resolutions)||[]),Ze((t==null?void 0:t.mannequins)||[])}).catch(()=>ke([]))},[n,ae]);const ie=Math.min(r.creatorCommission,P.MAX_COMMISSION_VIDEO),Qe=n?Object.fromEntries((ae||[]).map(t=>[t.id,t.creditsPerSecond*(r.videoDurationS||6)+ie])):{"1K":K["1K"]+r.creatorCommission,"2K":K["2K"]+r.creatorCommission,"4K":K["4K"]+r.creatorCommission};l.useEffect(()=>{const t=s=>{R&&(s.preventDefault(),s.returnValue="")};return window.addEventListener("beforeunload",t),()=>window.removeEventListener("beforeunload",t)},[R]),l.useEffect(()=>{if(!v)return;(async()=>{ue(!0);try{const s=await $e.getCreators();s.success&&ze(s.creators)}catch{}ue(!1)})()},[v]),l.useEffect(()=>{et()},[r.masterPrompt,r.productSlots,_]),l.useEffect(()=>{(async()=>{const{data:s}=await Ee.getPopularTags(15);s&&Ge(s.map(a=>a.name))})()},[]),l.useEffect(()=>{_t.getModels().then(t=>Je(t.models||[])).catch(()=>{})},[]),l.useEffect(()=>{(()=>{let s=!1;const a={};if(r.coverPreview&&!r.coverImage&&r.coverPreview.startsWith("data:")){const o=he(r.coverPreview,"cover.jpg");o&&(a.coverImage=o,s=!0)}const i=r.productSlots.map((o,c)=>{if(o.defaultImagePreview&&!o.defaultImage&&o.defaultImagePreview.startsWith("data:")){const h=he(o.defaultImagePreview,`default_${c}.jpg`);if(h)return s=!0,{...o,defaultImage:h}}return o}
1);s&&(V(o=>({...o,...a,productSlots:i})),m.success("Draft restored! Your progress has been saved."))})()},[]),l.useEffect(()=>{const t=b.get("prefill");if(!t)return;const s=a=>{if(!a)return;const i={mediaType:"image",coverVideo:null,coverVideoPreview:null,coverVideoShape:null};if(a.prompt&&(i.masterPrompt=a.prompt),a.coverImage){const o=he(a.coverImage,"cover.jpg");o&&(i.coverImage=o,i.coverPreview=a.coverImage)}a.title&&(i.title=a.title),a.description&&(i.description=a.description),a.creatorTips&&(i.creatorTips=a.creatorTips),a.modelId&&(i.modelId=a.modelId),a.products&&Array.isArray(a.products)&&a.products.length>0&&(i.productSlots=a.products.map((o,c)=>({id:String(c+1),label:o,variableName:`product_${c+1}`,productType:"",isOptional:!1,allowExclude:!1,mode:"strict",defaultImage:null,defaultImagePreview:null}))),V(o=>({...o,...i})),O(!0),m.success("Pre-filled from Prompt Factory")};if(t==="indexeddb")ds().then(s).catch(a=>{});else if(t==="localStorage")try{const a=localStorage.getItem("promptFactory_prefill");if(a){const i=JSON.parse(a);localStorage.removeItem("promptFactory_prefill"),s(i)}}catch{}else try{const a=JSON.parse(decodeURIComponent(t));s(a)}catch{}},[b]);const et=()=>{const t=[],s=r.masterPrompt.toLowerCase();if(!r.masterPrompt.trim()){ge([]);return}if(_==="json")try{JSON.parse(r.masterPrompt)}catch(a){const i=a.message.match(/position (\d+)/);if(i){const o=parseInt(i[1]),h=r.masterPrompt.substring(0,o).split(` 2`).length;t.push(`Invalid JSON at line ${h}: ${a.message}`)}else t.push(`Invalid JSON: ${a.message}`)}for(const a of r.productSlots){const i=a.variableName.toLowerCase();!(n||s.includes(`[${i}]`)||s.includes(`{{${i}}}`))&&!a.isOptional&&t.push(`Variable [${a.variableName}] not found in prompt`),a.isOptional&&!a.defaultImage&&!a.defaultImagePreview&&t.push(`Optional slot "${a.label}" requires a default image`)}ge(t)},d=t=>{V(s=>({...s,...t})),O(!0)};l.useEffect(()=>{R&&ms(r)},[r,R]);const je=t=>new Promise(s=>{const a=new FileReader;a.onloadend=()=>s(a.result),a.readAsDataURL(t)}),tt=l.useCallback(async t=>{const s=t[0];if(!s)return;const a=new Image;a.src=URL.createObjectURL(s),await new Promise(c=>{a.onload=c});const i=Math.max(a.naturalWidth,a.naturalHeight);if(URL.revokeObjectURL(a.src),i<ce){m.error(`Cover image too small (${a.naturalWidth}Ã${a.naturalHeight}). Minimum ${ce}px on the longest side.`,{duration:5e3});return}const o=await je(s);d({coverImage:s,coverPreview:o})},[]),st=l.useCallback(t=>{var c,h;const s=t[0];if(!s)return;const{errors:a,file:i}=s,o=(c=a[0])==null?void 0:c.code;if(o==="file-invalid-type"){const w=((h=i.name.split(".").pop())==null?void 0:h.toLowerCase())||"unknown";m.error(`Format ".${w}" not allowed for cover image. Use PNG, JPG, or WebP.`,{duration:4e3})}else if(o==="file-too-large"){const w=(i.size/1024/1024).toFixed(1);m.error(`Cover image too large (${w}MB). Maximum is ${Ue}MB.`,{duration:4e3})}else m.error("Invalid file. Please use PNG, JPG, or WebP under 10MB.")},[]),rt=l.useCallback(t=>{const s=t[0];if(!s)return;const a=URL.createObjectURL(s),i=document.createElement("video");i.preload="metadata",i.onloadedmetadata=()=>{const o=Math.round(i.duration||0),c=i.videoWidth&&i.videoHeight?{w:i.videoWidth,h:i.videoHeight}:null;V(h=>{const w=o>=4&&o<=15;return w&&o!==(h.videoDurationS||6)?m.success(`Length set to ${o} s, read from your video`):!w&&o>0&&m(`This clip is ${o} s â outside 4-15 s, the length stays at ${h.videoDurationS||6} s`,{icon:"â ï¸"}),{...h,coverVideo:s,coverVideoPreview:a,coverVideoShape:c,videoDurationS:w?o:h.videoDurationS}}),O(!0)},i.onerror=()=>{V(o=>({...o,coverVideo:s,coverVideoPreview:a})),O(!0)},i.src=a},[]),{getRootProps:at,getInputProps:it,isDragActive:ot}=Ve({onDrop:rt,onDropRejected:()=>m.error("Use an MP4, MOV or WebM video under 60MB."),accept:{"video/mp4":[".mp4",".m4v"],"video/quicktime":[".mov"],"video/webm":[".webm"]},maxSize:60*1024*1024,multiple:!1}),{getRootProps:nt,getInputProps:lt,isDragActive:dt}=Ve({onDrop:tt,onDropRejected:st,accept:{"image/*":os},maxSize:Ue*1024*1024,multiple:!1}),ct=()=>{if(r.productSlots.length>=6)return m.error("Maximum 6 product slots");const t=r.productSlots.length+1;d({productSlots:[...r.productSlots,{id:Date.now().toString(),label:`Product ${t}`,variableName:`product_${t}`,isOptional:!1,allowExclude:!1,mode:"strict",defaultImage:null,defaultImagePreview:null}]})},mt=(t,s,a)=>{const i=[...r.productSlots];i[t]={...i[t],[s]:a},s==="isOptional"&&!a&&(i[t].defaultImage=null,i[t].defaultImagePreview=null),d({productSlots:i})},ht=async(t,s)=>{const a=s[0];if(!a)return;const i=await je(a),o=[...r.productSlots];o[t]={...o[t],defaultImage:a,defaultImagePreview:i},d({productSlots:o})},pt=t=>{const s=[...r.productSlots];s[t].defaultImagePreview&&URL.revokeObjectURL(s[t].defaultImagePreview),s[t].defaultImage=null,s[t].defaultImagePreview=null,d({productSlots:s})},xt=t=>{if(r.productSlots.length<=1)return m.error("At least one slot required");d({productSlots:r.productSlots.filter((s,a)=>a!==t)})},ut=t=>{const s=t.map((a,i)=>({...a,variableName:`product_${i+1}`}));d({productSlots:s})},gt=t=>t.toLowerCase().trim().replace(/\s+/g," "),E=5,oe=(t=Q)=>{const s=gt(t);if(!s)return;if(r.compatibleProducts.length>=E){m.error(`Maximum ${E} tags allowed`),q(""),A(!1);return}if(ns.some(o=>s.includes(o.toLowerCase()))){m.error("This tag contains inappropriate content"),q(""),A(!1);return}r.compatibleProducts.some(o=>o.toLowerCase()===s)||d({compatibleProducts:[...r.compatibleProducts,s]}),q(""),A(!1)},bt=async t=>{if(q(t),t.length>=2){const{data:s}=await Ee.getExistingTags(t,8);Xe(s||[]),A(!0)}else A(!1)},Ne=t=>{d({compatibleProducts:r.compatibleProducts.filter(s=>s!==t)})},ye=()=>{R&&window.confirm("You have unsaved changes. Click OK to discard draft, Cancel to keep it saved.")&&me(),p("/studio")},Se=v&&D&&D!==(k==null?void 0:k.id),Pe=async(t=!1)=>{var s,a,i;if(fe({masterPrompt:!0,slots:!0}),!r.title.trim())return m.error("Title is required");if(!r.masterPrompt.trim())return m.error("Master prompt is required");if(n?!r.coverVideo:!r.coverImage)return m.error(n?"Cover video is required":"Cover image is required");if(L.length>0)return m.error("Fix all errors before publishing");if(r.creatorCommission<0)return m.error("Commission cannot be negative");if(n&&r.creatorCommission>P.MAX_COMMISSION_VIDEO)return m.error(`Video commission is capped at ${P.MAX_COMMISSION_VIDEO} credits`);if(n&&t)return m.error("A video recipe cannot be scheduled yet â publish it directly.");for(const o of r.productSlots)if(o.isOptional&&!o.defaultImage)return m.error(`Optional slot "${o.label}" requires a default image`);if(t&&!D)return m.error("Select a creator to assign this recipe to");y(!0);try{if(t&&v){let o,c=null;if(n){const x=await Bt(r.coverVideo);c=x.coverVideoUrl,o=x.coverImageUrl}else o=await Re(r.coverImage,"cover");const h=[];for(let x=0;x<r.productSlots.length;x++){const N=r.productSlots[x],_e={label:N.label,variable_name:N.variableName,...n?{product_type:N.productType||null}:{},category_hint:N.categoryHint||"",is_optional:n?!1:N.isOptional,allow_exclude:N.allowExclude??!1,mode:N.mode||"strict"};N.isOptional&&N.defaultImage&&(_e.default_image=await Re(N.defaultImage,"default")),h.push(_e)}const w=await $e.createScheduledRecipe({creator_id:D,title:r.title.trim(),description:r.description.trim(),creator_tips:r.creatorTips.trim(),master_prompt:r.masterPrompt.trim(),cover_image:o,creator_commission:r.creatorCommission,tags:r.compatibleProducts.map(x=>({name:x,type:"secondary"})),compatibility:r.compatibleProducts,product_slots:h,cast_models_mode:r.castModelsMode||"none",background_colour:r.backgroundColour===!0,media_type:n?"video":"image",...n?{cover_video:c,video_duration_s:r.videoDurationS||6}:{}});if(!w.success)throw new Error(w.error||"Failed to create scheduled recipe");me(),O(!1),m.success("Recipe saved as paused! Go to Prompt Factory â
2 Scheduled to publish."),p("/admin/prompt-factory")}else{const o=new FormData;o.append("title",r.title.trim()),o.append("description",r.description.trim()),o.append("creatorTips",r.creatorTips.trim()),o.append("masterPrompt",r.masterPrompt.trim()),o.append("mediaType",n?"video":"image"),n?(o.append("coverVideo",r.coverVideo),o.append("videoDurationS",String(r.videoDurationS||6)),o.append("defaultVideoModelId",r.defaultVideoModelId||"")):o.append("coverImage",r.coverImage),o.append("creatorCommission",r.creatorCommission),r.modelId&&o.append("modelId",r.modelId),o.append("castModelsMode",r.castModelsMode||"none"),o.append("backgroundColour",r.backgroundColour?"true":"false"),o.append("tags",JSON.stringify(r.compatibleProducts.map(x=>({name:x,type:"secondary"})))),o.append("compatibility",JSON.stringify(r.compatibleProducts));const c=r.productSlots.map((x,N)=>({label:x.label,variable_name:x.variableName,...n?{product_type:x.productType||null}:{},category_hint:x.categoryHint,is_optional:n?!1:x.isOptional,allow_exclude:x.allowExclude??!1,mode:x.mode||"strict",_hasDefaultImage:x.isOptional&&!!x.defaultImage}));o.append("productSlots",JSON.stringify(c)),r.productSlots.forEach((x,N)=>{x.isOptional&&x.defaultImage&&o.append(`defaultImage_${N}`,x.defaultImage)});const h=await zt.create(o);me(),O(!1);const w=((s=h==null?void 0:h.data)==null?void 0:s.id)||((i=(a=h==null?void 0:h.data)==null?void 0:a.recipe)==null?void 0:i.id);if(w){try{await Jt.syncEntity("recipe",w)}catch{}u("recipe",w,{delayMs:0,refetch:!1}).catch(()=>{})}h.data.autoApproved?m.success("Style published!"):m.success("Style submitted for review! It will be visible once approved.",{duration:5e3}),p("/studio")}}catch(o){m.error(o.message||"Failed to create")}finally{y(!1)}},ne=(()=>{const t=r.castModelsMode||"none";return t==="none"?[]:t==="all"?ve:ve.filter(s=>s.gender===t)})(),z=ne.find(t=>t.id===r.defaultVideoModelId)||null,j=(()=>{if(!n)return[];const t=(r.castModelsMode||"none")!=="none",s=[];return t&&s.push({token:"@Image1",label:z?z.name:"The model",hint:z?"this recipeâs model":"studio picks",variableName:null}),(r.productSlots||[]).forEach((a,i)=>{s.push({token:`@Image${(t?2:1)+i}`,label:a.label||a.variableName,hint:"uploaded by the customer",variableName:a.variableName})}),s})(),Ie=["#ff7ab0","#6ea8ff","#f0a850","#4ade80","#c084fc","#5ee0d0","#ffd166","#ff8a8a"],G=t=>Ie[t%Ie.length],Ce=(()=>{if(!n)return{used:[],unknown:[],unused:[]};const t=r.masterPrompt||"",s=new Set;for(const i of t.matchAll(/@Image\s?(\d+)/gi))s.add(Number(i[1]));const a=new Set(j.map(i=>Number(i.token.replace(/\D/g,""))));return{used:[...s].sort((i,o)=>i-o),unknown:[...s].filter(i=>!a.has(i)).sort((i,o)=>i-o),unused:j.filter(i=>!s.has(Number(i.token.replace(/\D/g,""))))}})(),ft=t=>{const s=document.getElementById("masterPrompt");if(!s)return;const a=s.selectionStart,i=r.masterPrompt;d({masterPrompt:`${i.substring(0,a)}${t}${i.substring(s.selectionEnd)}`}),setTimeout(()=>{s.focus(),s.setSelectionRange(a+t.length,a+t.length)},0)},wt=t=>{const s=document.getElementById("masterPrompt");if(s){const a=s.selectionStart,i=r.masterPrompt,o=`${i.substring(0,a)}[${t}]${i.substring(s.selectionEnd)}`;d({masterPrompt:o}),setTimeout(()=>{s.focus(),s.setSelectionRange(a+t.length+2,a+t.length+2)},0)}},kt=t=>{if(["ArrowDown","ArrowUp","Enter","Escape"].includes(t.key))return;const a=t.target.selectionStart,i=r.masterPrompt.substring(0,a);i.endsWith("@")||i.endsWith("[")?U||(H(!0),ee(0)):U&&H(!1)},vt=t=>{U&&(t.key==="Escape"?(t.preventDefault(),H(!1)):t.key==="ArrowDown"?(t.preventDefault(),ee(s=>{const a=n?j:r.productSlots;return s<a.length-1?s+1:0})):t.key==="ArrowUp"?(t.preventDefault(),ee(s=>{const a=n?j:r.productSlots;return s>0?s-1:a.length-1})):t.key==="Enter"&&U&&(t.preventDefault(),Me((n?j:r.productSlots)[W])))},Me=t=>{const s=M.current;if(!s)return;const a=s.selectionStart,i=r.masterPrompt,o=i.substring(0,a-1),c=i.substring(a),h=n&&t.token?t.token:`[${t.variableName}]`,w=o+h+c;d({masterPrompt:w}),H(!1),setTimeout(()=>{s.focus();const x=o.length+h.length;s.setSelectionRange(x,x)},0)},jt=()=>{try{const t=JSON.parse(r.masterPrompt);d({masterPrompt:JSON.stringify(t,null,2)}),m.success("JSON formatted")}catch{m.error("Invalid JSON - cannot format")}},Nt=()=>{let t=r.masterPrompt;t=t.replace(/\r\n/g,` 3`);let s=t.split(` 4`);s=s.map(c=>c.trim());let a=[],i=[];for(const c of s)c===""?i.length>0&&(a.push(i.join(" ")),i=[]):c.match(/^(Style|Lighting|Backgroun
4d|Composition|Mood|Camera|Setting|Scene|Subject|Color|Texture|Atmosphere|Details|Focus|Angle):/i)?(i.length>0&&(a.push(i.join(" ")),i=[]),a.push(c)):i.push(c);i.length>0&&a.push(i.join(" "));const o=a.join(` 5 6`);d({masterPrompt:o}),m.success("Text formatted")},Te=t=>{if(!t||!t.trim())return null;const s=t.trim().replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`\\b${s}\\b`,"gi")},I=t=>{const s=Te(t);if(!s||!r.masterPrompt)return[];const a=[];let i;for(;(i=s.exec(r.masterPrompt))!==null;)a.push({index:i.index,length:i[0].length,text:i[0]});return a},Oe=()=>{const t=I(g);if(t.length===0)return;const s=r.productSlots[re];if(!s)return;const a=Math.min($,t.length-1),i=t[a];if(!i)return;const o=r.masterPrompt.slice(0,i.index),c=r.masterPrompt.slice(i.index+i.length);d({masterPrompt:o+`[${s.variableName}]`+c});const h=I(g);h.length===0?(se(""),te(!1),m.success("All done")):B(Math.min($,h.length-1))},yt=()=>{const t=I(g);t.length!==0&&B(($+1)%t.length)},St=()=>{const t=I(g);t.length!==0&&B(($-1+t.length)%t.length)},Pt=()=>{const t=I(g);if(t.length===0){m.error(`"${g}" not found`);return}const s=r.productSlots[re];if(!s)return;const a=Te(g),i=r.masterPrompt.replace(a,`[${s.variableName}]`);d({masterPrompt:i}),m.success(`Replaced ${t.length} occurrence${t.length>1?"s":""}`),se(""),B(0),te(!1)},It=()=>{T.current&&M.current&&(T.current.scrollTop=M.current.scrollTop)};return l.useEffect(()=>{const t=M.current,s=T.current;if(!t||!s)return;const a=window.getComputedStyle(t);["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","wordSpacing","lineHeight","paddingTop","paddingRight","paddingBottom","paddingLeft","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","boxSizing","tabSize","whiteSpace","overflowWrap","wordBreak"].forEach(o=>{s.style[o]=a[o]}),s.style.width=t.clientWidth+"px";const i=new ResizeObserver(()=>{M.current&&T.current&&(T.current.style.width=M.current.clientWidth+"px")});return i.observe(t),()=>i.disconnect()},[C,g]),e.jsxs("div",{className:"min-h-screen bg-sidebar dark:bg-[#0d0e12] overflow-x-hidden",children:[e.jsx("header",{className:"sticky top-0 z-20 bg-white/80 dark:bg-[#0d0e12]/80 backdrop-blur-xl border-b border-line dark:border-white/10",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:ye,className:"p-2 hover:bg-sidebar dark:hover:bg-white/10 rounded-lg transition-colors flex-shrink-0",children:e.jsx(ts,{className:"w-5 h-5 text-ink/65 dark:text-white"})}),e.jsx("h1",{className:"text-lg sm:text-xl font-semibold text-ink dark:text-white truncate",children:"Create New Style"})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[v&&J.length>0&&e.jsxs("div",{className:"hidden sm:flex items-center gap-1.5",children:[e.jsx(le,{className:"w-3.5 h-3.5 text-ink/45"}),e.jsxs("select",{value:D||"",onChange:t=>xe(t.target.value||null),className:"text-xs bg-sidebar dark:bg-white/10 border border-line dark:border-white/10 rounded-lg px-2 py-2 text-ink/75 dark:text-white max-w-[160px] truncate",children:[e.jsx("option",{value:"",children:"My account"}),J.map(t=>e.jsxs("option",{value:t.id,children:[t.display_name," (@",t.username,")"]},t.id))]})]}),e.jsx("button",{onClick:ye,className:"hidden sm:block px-4 py-2.5 text-sm font-medium text-ink/65 dark:text-white hover:bg-sidebar dark:hover:bg-white/10 rounded-lg transition-colors",children:"Cancel"}),Se&&e.jsxs("button",{onClick:()=>Pe(!0),disabled:f||L.length>0,className:"px-4 sm:px-6 py-2.5 bg-amber-600 hover:bg-amber-700 text-white text-sm font-medium rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-all flex items-center gap-2 whitespace-nowrap shadow-sm",children:[f?e.jsx(Fe,{size:"sm",color:"white"}):e.jsx(ss,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Save as Paused"}),e.jsx("span",{className:"sm:hidden",children:"Paused"})]}),!Se&&e.jsxs("button",{onClick:()=>Pe(!1),disabled:f||L.length>0,className:"px-4 sm:px-6 py-2.5 bg-sage hover:bg-sage-hover text-white text-sm font-medium rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-all flex items-center gap-2 whitespace-nowrap shadow-sm shadow-accent/25",children:[f?e.jsx(Fe,{size:"sm",color:"white"}):e.jsx(Ae,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Publish Style"}),e.jsx("span",{className:"sm:hidden",children:"Publish"})]})]})]})}),v&&J.length>0&&e.jsx("div",{className:"sm:hidden px-4 py-2 bg-sidebar dark:bg-white/5 border-b border-line dark:border-white/10",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"w-3.5 h-3.5 text-ink/45 flex-shrink-0"}),e.jsxs("select",{value:D||"",onChange:t=>xe(t.target.value||null),className:"flex-1 text-xs bg-white dark:bg-white/10 border border-line dark:border-white/10 rounded-lg px-2 py-1.5 text-ink/75 dark:text-white",children:[e.jsx("option",{value:"",children:"My account"}),J.map(t=>e.jsxs("option",{value:t.id,children:[t.display_name," (@",t.username,")"]},t.id))]})]})}),e.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 py-6 sm:py-8",children:e.jsxs("div",{className:"grid lg:grid-cols-3 gap-4 sm:gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(S.div,{initial:{opacity:0,y:20}
6,animate:{opacity:1,y:0},className:"bg-white dark:bg-white/5 rounded-[6px] border border-line dark:border-white/10 p-4 sm:p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 mb-4 sm:mb-5",children:[e.jsx("div",{className:"w-8 h-8 sm:w-9 sm:h-9 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center flex-shrink-0",children:e.jsx(At,{className:"w-4 h-4 text-ink/65 dark:text-white"})}),e.jsx("h2",{className:"font-semibold text-ink dark:text-white text-sm",children:"Basic Info"})]}),e.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-ink/75 dark:text-white mb-1.5",children:"This style makes"}),e.jsx("div",{className:"flex gap-2",children:[{id:"image",label:"Images"},{id:"video",label:"Videos"}].map(t=>e.jsx("button",{type:"button",onClick:()=>d({mediaType:t.id}),className:`flex-1 py-2.5 rounded-lg border text-sm font-medium transition-colors ${(r.mediaType||"image")===t.id?"bg-sage-pill border-sage text-sage-deep dark:bg-white/10 dark:border-white dark:text-white":"bg-sidebar border-line text-ink/60 hover:border-ink/30 dark:bg-white/5 dark:border-white/10 dark:text-white/60"}`,children:t.label},t.id))}),n&&e.jsx("p",{className:"text-xs text-ink/55 dark:text-white/50 mt-1.5",children:"Seedance 2.5. Users pick the picture, the format, the quality and a model; you set the length. The prompt cites references as @Image1 (the model, when the style uses one), @Image2 (the product)â¦"})]}),n&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-ink/75 dark:text-white mb-1.5",children:"Video length"}),e.jsx("select",{value:r.videoDurationS||6,onChange:t=>d({videoDurationS:parseInt(t.target.value,10)}),className:"w-full px-3 py-2 bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-lg text-sm text-ink dark:text-white focus:outline-none focus:ring-2 focus:ring-slate-900/10 dark:focus:ring-white/10 transition-all",children:[4,5,6,7,8,9,10,11,12,13,14,15].map(t=>e.jsxs("option",{value:t,children:[t," seconds"]},t))}),e.jsx("p",{className:"text-xs text-ink/55 dark:text-white/50 mt-1.5",children:"Fixed for this style â users do not choose it. 4-6 s works best for a product take."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-ink/75 dark:text-white mb-1.5",children:"Title"}),e.jsx("input",{type:"text",value:r.title,onChange:t=>d({title:t.target.value}),className:"w-full px-3 py-2 bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-lg text-sm text-ink dark:text-white placeholder-slate-400 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-slate-900/10 dark:focus:ring-white/10 focus:border-line dark:focus:border-white/20 transition-all",placeholder:"Urban Photography",maxLength:100})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-ink/75 dark:text-white mb-1.5",children:"Description"}),e.jsx("textarea",{value:r.description,onChange:t=>d({description:t.target.value}),className:"w-full px-3 py-2 bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-lg text-sm text-ink dark:text-white placeholder-slate-400 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-slate-900/10 dark:focus:ring-white/10 focus:border-line dark:focus:border-white/20 transition-all resize-none",rows:3,placeholder:"A modern photography style...",maxLength:500}),e.jsxs("p",{className:"text-xs text-ink/45 dark:text-white/40 mt-1.5 text-right",children:[r.description.length,"/500"]})]})]})]}),e.jsxs(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.05},className:"bg-white dark:bg-white/5 rounded-[6px] border border-line dark:border-white/10 p-4 sm:p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 mb-4 sm:mb-5",children:[e.jsx("div",{className:"w-8 h-8 sm:w-9 sm:h-9 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center flex-shrink-0",children:e.jsx($t,{className:"w-4 h-4 text-ink/65 dark:text-white"})}),e.jsx("h2",{className:"font-semibold text-ink dark:text-white text-sm",children:n?"Cover Video":"Cover Image"})]}
6),n?e.jsxs("div",{...at(),className:`relative border-2 border-dashed rounded-[6px] cursor-pointer transition-all overflow-hidden ${ot?"border-sage dark:border-sage/60 bg-sage-pill dark:bg-white/10":r.coverVideoPreview?"border-transparent":"border-line dark:border-white/20 hover:border-ink/40 dark:hover:border-white/30 bg-sidebar dark:bg-white/5"}`,style:{minHeight:r.coverVideoPreview?"auto":"220px"},children:[e.jsx("input",{...it()}),r.coverVideoPreview?e.jsxs("div",{className:"relative mx-auto w-fit",children:[e.jsx("video",{src:r.coverVideoPreview,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,className:"block max-h-[380px] w-auto max-w-full rounded-[6px]"}),e.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex justify-between items-center gap-2",children:[e.jsxs("span",{className:"text-white text-xs font-medium drop-shadow truncate",children:[r.coverVideoShape?`${hs(r.coverVideoShape)} · ${r.videoDurationS||6}s · `:"","Click to change"]}),e.jsx("button",{onClick:t=>{t.stopPropagation(),d({coverVideo:null,coverVideoPreview:null})},className:"p-1.5 bg-white/20 hover:bg-white/30 rounded-lg backdrop-blur-sm transition-colors",children:e.jsx(de,{className:"w-3.5 h-3.5 text-white"})})]})]}):e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-6",children:[e.jsx("div",{className:"w-12 h-12 bg-mist dark:bg-white/10 rounded-[6px] flex items-center justify-center mb-3",children:e.jsx(Le,{className:"w-6 h-6 text-ink/45 dark:text-white/40"})}),e.jsx("p",{className:"text-ink/65 dark:text-white font-medium text-sm mb-1",children:"Drop a video made with this style"}),e.jsx("p",{className:"text-xs text-ink/45 dark:text-white/40",children:"or click to browse"}),e.jsx("p",{className:"text-[10px] text-ink/45 dark:text-white/40 mt-2",children:"MP4, MOV, WebM up to 60MB â we keep a 6 s loop and its poster"})]})]}):e.jsxs("div",{...nt(),className:`relative border-2 border-dashed rounded-[6px] cursor-pointer transition-all overflow-hidden ${dt?"border-sage dark:border-sage/60 bg-sage-pill dark:bg-white/10":r.coverPreview?"border-transparent":"border-line dark:border-white/20 hover:border-ink/40 dark:hover:border-white/30 bg-sidebar dark:bg-white/5"}`,style:{minHeight:r.coverPreview?"auto":"220px"},children:[e.jsx("input",{...lt()}),r.coverPreview?e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:r.coverPreview,alt:"Cover",className:"w-full h-auto max-h-[320px] object-contain rounded-[6px]"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 to-transparent opacity-0 hover:opacity-100 transition-opacity rounded-[6px]",children:e.jsxs("div",{className:"absolute bottom-3 left-3 right-3 flex justify-between items-center",children:[e.jsx("span",{className:"text-white text-xs font-medium",children:"Click to change"}),e.jsx("button",{onClick:t=>{t.stopPropagation(),d({coverImage:null,coverPreview:null})},className:"p-1.5 bg-white/20 hover:bg-white/30 rounded-lg backdrop-blur-sm transition-colors",children:e.jsx(de,{className:"w-3.5 h-3.5 text-white"})})]})})]}):e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-6",children:[e.jsx("div",{className:"w-12 h-12 bg-mist dark:bg-white/10 rounded-[6px] flex items-center justify-center mb-3",children:e.jsx(Le,{className:"w-6 h-6 text-ink/45 dark:text-white/40"})}),e.jsx("p",{className:"text-ink/65 dark:text-white font-medium text-sm mb-1",children:"Drop your cover image here"}),e.jsx("p",{className:"text-xs text-ink/45 dark:text-white/40",children:"or click to browse"}),e.jsxs("p",{className:"text-[10px] text-ink/45 dark:text-white/40 mt-2",children:["PNG, JPG, WebP up to 10MB â min ",ce,"px"]})]})]})]}),n&&e.jsxs(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.05},className:"bg-white dark:bg-white/5 rounded-[6px] border border-line dark:border-white/10 p-4 sm:p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 sm:w-9 sm:h-9 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center flex-shrink-0",children:e.jsx(le,{className:"w-4 h-4 text-ink/65 dark:text-white"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-base sm:text-lg font-serif text-ink dark:text-white",children:"The person in the video"}),e.jsx("p",{className:"text-[11px] sm:text-xs text-ink/55 dark:text-white/60 hidden sm:block",children:"Decides what @Image1 is"})]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[{id:"none",label:"No one",hint:"product only"},{id:"female",label:"A woman",hint:""},{id:"male",label:"A man",hint:""},{id:"all",label:"Any model",hint:"the customer picks"}].map(t=>{const s=(r.castModelsMode||"none")===t.id;return e.jsxs("button",{type:"button",onClick:()=>d({castModelsMode:t.id,defaultVideoModelId:""}),className:`px-3 py-3 rounded-[8px] border text-left transition-colors ${s?"bg-sage-pill border-sage text-sage-deep dark:bg-white/10 dark:border-white dark:text-white":"bg-card border-line text-ink/70 hover:border-ink/30 dark:bg-white/5 dark:border-white/10 dark:text-white/70"}`,children:[e.jsx("span",{className:"block text-sm font-medium",children:t.label}),t.hint&&e.jsx("span",{className:"block text-[11px] opacity-60 mt-0.5",children:t.hint})]},t.id)})}),(r.castModelsMode||"none")!=="none"&&e.jsxs("div",{className:"mt-4",children:[e.jsxs("p",{className:"text-sm font-medium text-ink/75 dark:text-white mb-2",children:["Which one â sent as ",e.jsx("span",{className:"font-mono",children:"@Image1"})]}),ne.length===0?e.jsx("p",{className:"text-xs text-ink/45 dark:text-white/40",children:"No model available for this choice yet."}):e.jsxs("div",{className:"flex gap-2.5 overflow-x-auto pb-1",children:[e.jsxs("button",{type:"button",onClick:()=>d({defaultVideoModelId:""}),className:`flex-none w-[104px] rounded-[8px] border overflow-hidden text-center transition-colors ${r.defaultVideoModelId?"border-line bg-card hover:border-ink/30 dark:bg-white/5 dark:border-white/10":"border-sage bg-sage-pill dark:bg-white/10 dark:border-white"}`,children:[e.jsx("span",{className:"flex items-center justify-center h-[124px] text-[11px] text-ink/45 dark:text-white/40 px-2",children:"Studio's pick"}),e.jsx("span",{className:"block py-1.5 text-[11px] text-ink/60 dark:text-white/55 border-t border-line dark:border-white/10",children:"Automatic"})]}),ne.map(t=>{const s=r.defaultVideoModelId===t.id;return e.jsxs("button",{type:"button",onClick:()=>d({defaultVideoModelId:t.id}),className:`flex-none w-[104px] rounded-[8px] border overflow-hidden text-center transition-colors ${s?"border-sage bg-sage-pill dark:bg-white/10 dark:border-white":"border-line bg-card hover:border-ink/30 dark:bg-white/5 dark:border-white/10"}`,children:[e.jsx("span",{className:"block h-[124px] bg-sidebar dark:bg-white/5",children:e.jsx("img",{src:t.image,alt:t.name,className:"w-full h-full object-cover object-top",loading:"lazy"})}),e.jsx("span",{className:`block py-1.5 text-[11px] border-t border-line dark:border-white/10 ${s?"text-sage-deep dark:text-white":"text-ink/60 dark:text-white/55"}`,children:t.name})]},t.id)})]}),e.jsx("p",{className:"text-xs text-ink/55 dark:text-white/50 mt-2",children:z?`${z.n
6ame}'s picture is what goes out as @Image1. The customer can still pick another on the video page.`:"Without a choice, the studio sends the first available model."})]}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:j.length===0?e.jsx("span",{className:"text-xs text-ink/45 dark:text-white/40",children:"Add a product slot to see the references."}):j.map((t,s)=>e.jsxs("span",{className:"inline-flex items-center gap-2 px-2.5 py-1 rounded-[4px] bg-sidebar dark:bg-white/10 text-xs",children:[e.jsx("span",{className:"font-mono font-medium",style:{color:G(s)},children:t.token}),e.jsx("span",{className:"text-ink/60 dark:text-white/55",children:t.label})]},t.token))}),e.jsx("p",{className:"text-xs text-ink/55 dark:text-white/50 mt-3",children:"There is always a model unless you pick « no one »: the customer chooses one, or the studio picks."})]}),e.jsxs(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"bg-white dark:bg-white/5 rounded-[6px] border border-line dark:border-white/10 p-4 sm:p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 sm:mb-6 gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 sm:w-9 sm:h-9 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center flex-shrink-0",children:e.jsx(Et,{className:"w-4 h-4 text-ink/65 dark:text-white"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h2",{className:"text-sm font-semibold text-ink dark:text-white",children:"Product Slots"}),e.jsxs("div",{className:"relative group",children:[e.jsx(X,{className:"w-3.5 h-3.5 text-ink/45 dark:text-white/40 cursor-help flex-shrink-0"}),e.jsxs("div",{className:"absolute left-0 sm:left-full sm:ml-2 top-full sm:top-1/2 mt-1 sm:mt-0 sm:-translate-y-1/2 w-56 sm:w-64 p-3 bg-ink dark:bg-white text-white dark:text-slate-900 text-xs rounded-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50 shadow-xl",children:[e.jsx("p",{className:"font-medium mb-1",children:"What are Product Slots?"}),e.jsx("p",{className:"text-white/80 dark:text-slate-600",children:"Placeholders where users upload their product images. Each slot becomes a variable you can use in your prompt like [product_1]."})]})]})]}),e.jsx("p",{className:"text-[11px] sm:text-xs text-ink/55 dark:text-white/60 hidden sm:block",children:n?"The pictures the customer uploads":"Define product placeholders"})]})]}),r.productSlots.length<6&&e.jsxs("button",{onClick:ct,className:"px-2.5 py-1.5 sm:px-4 sm:py-2 bg-sidebar dark:bg-white/10 hover:bg-mist dark:hover:bg-white/20 text-ink/75 dark:text-white text-[11px] sm:text-sm font-medium rounded-lg transition-colors flex items-center gap-1 sm:gap-2 flex-shrink-0",children:[e.jsx(rs,{className:"w-3 h-3 sm:w-4 sm:h-4"})," ",e.jsx("span",{className:"hidden xs:inline",children:"Add"})," Slot"]})]}),e.jsx(Ht.Group,{axis:"y",values:r.productSlots,onReorder:ut,className:"space-y-4",children:r.productSlots.map((t,s)=>e.jsx(Gt,{slot:t,index:s,onUpdate:mt,onRemove:xt,onDefaultImageDrop:ht,onRemoveDefaultImage:pt,canRemove:r.productSlots.length>1,isVideo:n},t.id))}),e.jsxs("div",{className:"mt-6 pt-6 border-t border-line dark:border-white/10",children:[e.jsx("p",{className:"text-xs font-medium text-ink/55 dark:text-white/50 uppercase tracking-wide mb-3",children:"Click to insert variable into prompt"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:n?j.map((t,s)=>e.jsx("button",{onClick:()=>ft(t.token),title:t.label,className:"px-4 py-2 bg-ink dark:bg-white rounded-lg text-sm font-mono transition-colors",style:{color:G(s)},children:t.token},t.token)):r.productSlots.map(t=>e.jsxs("button",{onClick:()=>wt(t.variableName),className:"px-4 py-2 bg-ink dark:bg-white text-white dark:text-slate-900 rounded-lg text-sm font-mono hover:bg-ink dark:hover:bg-white/90 transition-colors",children:["[",t.variableName,"]"]},t.variableName))})]})]}),e.jsxs(S.div,{initial:{opacity:0,y:20}
6,animate:{opacity:1,y:0},transition:{delay:.15},className:"bg-white dark:bg-white/5 rounded-[6px] border border-line dark:border-white/10 p-4 sm:p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 mb-4 sm:mb-6",children:[e.jsx("div",{className:"w-8 h-8 sm:w-9 sm:h-9 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center flex-shrink-0",children:e.jsx(Kt,{className:"w-4 h-4 text-ink/65 dark:text-white"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h2",{className:"text-sm font-semibold text-ink dark:text-white",children:"Master Prompt"}),e.jsxs("div",{className:"relative group",children:[e.jsx(X,{className:"w-3.5 h-3.5 text-ink/45 dark:text-white/40 cursor-help flex-shrink-0"}),e.jsxs("div",{className:"absolute left-0 sm:left-full sm:ml-2 top-full sm:top-1/2 mt-1 sm:mt-0 sm:-translate-y-1/2 w-56 sm:w-72 p-3 bg-ink dark:bg-white text-white dark:text-slate-900 text-xs rounded-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50 shadow-xl",children:[e.jsx("p",{className:"font-medium mb-1",children:"How to write a good prompt?"}),e.jsx("p",{className:"text-white/80 dark:text-slate-600 mb-2",children:"Describe the scene, lighting, style and composition. Use [product_1] to reference products."}),e.jsx("p",{className:"text-white/60 dark:text-slate-500 text-[10px]",children:"Type @ or [ to insert variables"})]})]})]}),e.jsx("p",{className:"text-[11px] sm:text-xs text-ink/55 dark:text-white/60 hidden sm:block",children:n?"Instructions for the video, addressed to @Image1, @Image2â¦":"AI instructions for generating images"})]})]}),e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>be("text"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${_==="text"?"bg-ink dark:bg-white text-white dark:text-slate-900":"bg-sidebar dark:bg-white/10 text-ink/65 dark:text-white/60 hover:bg-mist dark:hover:bg-white/20"}`,children:"Text"}),e.jsx("button",{onClick:()=>be("json"),className:`px-3 py-1.5 text-sm font-medium rounded-lg transition-colors ${_==="json"?"bg-ink dark:bg-white text-white dark:text-slate-900":"bg-sidebar dark:bg-white/10 text-ink/65 dark:text-white/60 hover:bg-mist dark:hover:bg-white/20"}`,children:"JSON"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>te(!C),className:`px-3 py-1.5 text-xs font-medium rounded-lg transition-colors flex items-center gap-1.5 ${C?"bg-ink dark:bg-white text-white dark:text-slate-900":"text-ink/65 dark:text-white/60 hover:text-ink dark:hover:text-white hover:bg-sidebar dark:hover:bg-white/10"}`,children:[e.jsx(Xt,{className:"w-3.5 h-3.5"}),"Replace"]}),e.jsxs("button",{onClick:_==="json"?jt:Nt,className:"px-3 py-1.5 text-xs font-medium text-ink/65 dark:text-white/60 hover:text-ink dark:hover:text-white hover:bg-sidebar dark:hover:bg-white/10 rounded-lg transition-colors flex items-center gap-1.5",children:[e.jsx(Rt,{className:"w-3.5 h-3.5"}),"Format"]})]})]}),e.jsx(Vt,{children:C&&e.jsx(S.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"mb-4 overflow-hidden",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2 p-3 bg-sidebar dark:bg-white/5 rounded-lg",children:[e.jsx("input",{type:"text",value:g,onChange:t=>{se(t.target.value),B(0)},placeholder:"Whole word to find...",className:"flex-1 min-w-[100px] px-2.5 py-1.5 bg-white dark:bg-white/10 border border-line dark:border-white/10 rounded-lg text-xs text-ink dark:text-white placeholder-slate-400 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-slate-900/10 dark:focus:ring-white/20",onKeyDown:t=>t.key==="Enter"&&Oe()}),g.trim()&&(()=>{const t=I(g);return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded ${t.length>0?"bg-amber-500/20 text-amber-500 dark:text-amber-400":"bg-red-500/20 text-red-500 dark:text-red-400"}`,children:t.length>0?`${$+1}/${t.length}`:"0 found"}),t.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:St,className:"p-0.5 hover:bg-mist dark:hover:bg-white/10 rounded",title:"Previous",children:e.jsx(as,{className:"w-3.5 h-3.5 text-ink/55 dark:text-white/50"})}),e.jsx("button",{onClick:yt,className:"p-0.5 hover:bg-mist dark:hover:bg-white/10 rounded",title:"Next",children:e.jsx(is,{className:"w-3.5 h-3.5 text-ink/55 dark:text-white/50"})})]})]})})(),e.jsx("span",{className:"text-ink/45 dark:text-white/40 text-xs",children:"â"}),e.jsx("select",{value:re,onChange:t=>Ye(Number(t.target.value)),className:"px-2.5 py-1.5 bg-white dark:bg-white/10 border border-line dark:border-white/10 rounded-lg text-xs text-ink dark:text-white focus:outline-none focus:ring-2 focus:ring-slate-900/10 dark:focus:ring-white/20",children:r.productSlots.map((t,s)=>e.jsx("option",{value:s,children:t.label},t.id))}),e.jsxs("button",{onClick:Oe,disabled:I(g).length===0,className:"px-3 py-1.5 bg-ink dark:bg-white text-white dark:text-slate-900 text-xs font-medium rounded-lg hover:bg-ink dark:hover:bg-white/90 transition-colors whitespace-nowrap disabled:opacity-40",title:"Replace this match",children:[e.jsx(Ft,{className:"w-3.5 h-3.5 inline -mt-0.5 mr-1"}),"Replace"]}),e.jsx("button",{onClick:Pt,disabled:I(g).length===0,className:"px-2.5 py-1.5 text-xs font-medium text-ink/65 dark:text-white/60 hover:bg-mist dark:hover:bg-white/10 rounded-lg transition-colors whitespace-nowrap disabled:opacity-40",title:"Replace all matches",children:"All"})]})})}),qe.masterPrompt&&L.length>0&&e.jsx(S.div,{initial:{opacity:0,height:0}
6,animate:{opacity:1,height:"auto"},className:"mb-4 p-4 bg-amber-50 dark:bg-amber-500/10 border border-amber-200 dark:border-amber-500/20 rounded-lg",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Lt,{className:"w-5 h-5 text-amber-600 dark:text-amber-400 mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-amber-900 dark:text-amber-300",children:"Please fix the following:"}),e.jsx("ul",{className:"text-sm text-amber-700 dark:text-amber-400/80 mt-2 space-y-1",children:L.map((t,s)=>e.jsxs("li",{children:["⢠",t]},s))})]})]})}),e.jsxs("div",{className:"relative flex bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-lg overflow-hidden focus-within:ring-2 focus-within:ring-slate-900/10 dark:focus-within:ring-white/10 focus-within:border-line dark:focus-within:border-white/20 transition-all",children:[_==="json"&&e.jsx("div",{className:"flex-shrink-0 py-4 pl-3 pr-2 bg-sidebar dark:bg-white/5 border-r border-line dark:border-white/10 select-none",children:e.jsx("div",{className:"font-mono text-xs text-ink/45 dark:text-white/30 text-right leading-relaxed",children:(r.masterPrompt||" ").split(` 7`).map((t,s)=>e.jsx("div",{children:s+1},s))})}),e.jsxs("div",{className:"relative flex-1",children:[C&&g.trim()&&(()=>{const t=I(g);if(t.length===0)return null;const s=[];let a=0;return t.forEach((i,o)=>{i.index>a&&s.push(e.jsx("span",{children:r.masterPrompt.slice(a,i.index)},`t${o}`)),s.push(e.jsx("mark",{className:o===$?"bg-amber-400 dark:bg-amber-500 text-transparent rounded-sm":"bg-amber-200 dark:bg-amber-500/40 text-transparent rounded-sm",children:r.masterPrompt.slice(i.index,i.index+i.length)},`m${o}`)),a=i.index+i.length}),a<r.masterPrompt.length&&s.push(e.jsx("span",{children:r.masterPrompt.slice(a)},"end")),e.jsx("div",{ref:T,"aria-hidden":"true",className:"absolute inset-0 text-transparent pointer-events-none whitespace-pre-wrap break-words",style:{zIndex:0,overflow:"hidden"},children:s})})(),n&&!(C&&g.trim())&&(()=>{const t=r.masterPrompt||"",s=new Map(j.map((o,c)=>[Number(o.token.replace(/\D/g,"")),c])),a=[];let i=0;for(const o of t.matchAll(/@Image\s?\d+/gi)){const c=Number(o[0].replace(/\D/g,""));o.index>i&&a.push(e.jsx("span",{children:t.slice(i,o.index)},`t${i}`)),a.push(e.jsx("span",{style:s.has(c)?{color:G(s.get(c))}:{textDecoration:"underline wavy",textDecorationColor:"var(--danger)",textUnderlineOffset:"3px"},children:o[0]},`r${o.index}`)),i=o.index+o[0].length}return a.push(e.jsxs("span",{children:[t.slice(i),` 8`]},"end")),e.jsx("div",{ref:T,"aria-hidden":"true",className:`${We} absolute inset-0 overflow-hidden pointer-events-none text-ink dark:text-white`,children:a})})(),e.jsx("textarea",{ref:M,id:"masterPrompt",value:r.masterPrompt,onChange:t=>d({masterPrompt:t.target.value}),onBlur:()=>fe(t=>({...t,masterPrompt:!0})),onKeyUp:kt,onKeyDown:vt,onScroll:It,className:`${We} w-full bg-transparent placeholder-slate-400 dark:placeholder-white/40 focus:outline-none resize-none ${n&&!(C&&g.trim())?"text-transparent caret-ink dark:caret-white":"text-ink dark:text-white"}`,style:{minHeight:"300px",position:"relative",zIndex:1,background:C&&g.trim()&&I(g).length>0?"transparent":void 0},placeholder:`Professional product photography featuring [product_1]. 9 10The scene is set in a minimalist studio with soft, diffused lighting. The product is the hero of the image, positioned centrally with careful attention to angles and shadows. 11 12Style: High-end commercial photography 13Lighting: Soft studio lights with subtle rim lighting 14Background: Clean, gradient white to light gray 15Composition: Product-focused, rule of thirds`})]}),U&&e.jsx("div",{className:"absolute z-50 bg-white dark:bg-slate-800 border border-line dark:border-white/10 rounded-lg shadow-lg py-1 min-w-[180px] bottom-4 left-4",children:(n?j:r.productSlots).map((t,s)=>e.jsxs("button",{onClick:()=>Me(t),className:`w-full px-3 py-2 text-left text-sm flex items-center gap-2 transition-colors ${s===W?"bg-ink dark:bg-white text-white dark:text-slate-900":"hover:bg-sidebar dark:hover:bg-white/10"}`,children:[e.jsx("span",{className:`font-mono text-xs ${s===W?"text-white/70 dark:text-slate-500":"text-ink/45"}`,children:n?t.token:`[${t.variableName}]`}),e.jsx("span",{className:s===W?"text-white dark:text-slate-900":"text-ink/75 dark:text-white",children:t.label}),n&&t.hint&&e.jsx("span",{className:`ml-auto text-[10px] ${s===W?"text-white/60 dark:text-slate-500":"text-ink/40 dark:text-white/40"}`,children:t.hint})]},t.token||t.id))})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs text-ink/45 dark:text-white/40",children:[e.jsx("span",{children:n?`Type @ to insert a reference. ${j.map(t=>t.token).join(", ")||"Add a product slot first"}`:"Type @ or [ to insert variables. Use [product_1], [product_2], etc."}),e.jsxs("span",{children:[r.masterPrompt.length," characters"]})]}),n&&(r.masterPrompt||"").trim()&&e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[j.map(t=>{const s=Number(t.token.replace(/\D/g,"")),a=Ce.used.includes(s);return e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-1 rounded-[4px] text-[11px] ${a?"bg-sidebar dark:bg-white/10":"bg-sidebar/60 dark:bg-white/5"}`,children:[e.jsx("span",{className:"font-mono",style:{color:G(j.indexOf(t)),opacity:a?1:.45},children:t.token}),e.jsx("span",{className:a?"text-ink/70 dark:text-white/70":"text-ink/40 dark:text-white/35",children:t.label}),!a&&e.jsx("span",{className:"text-ink/40 dark:text-white/35",children:"· never mentioned"})]},t.token)}),Ce.unknown.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-1 rounded-[4px] text-[11px] bg-sidebar dark:bg-white/10 text-ink/60 dark:text-white/55",children:[e.jsxs("span",{className:"font-mono",style:{textDecoration:"underline wavy",textDecorationColor:"var(--danger)",textUnderlineOffset:"3px"},children:["@Image",t]}),"does not exist â this recipe sends ",j.length," reference",j.length>
151?"s":""]},t))]})]}),!n&&e.jsxs(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.18},className:"bg-white dark:bg-white/5 rounded-[6px] border border-line dark:border-white/10 p-4 sm:p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 mb-4 sm:mb-5",children:[e.jsx("div",{className:"w-8 h-8 sm:w-9 sm:h-9 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center flex-shrink-0",children:e.jsx(Yt,{className:"w-4 h-4 text-ink/65 dark:text-white"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h2",{className:"text-sm font-semibold text-ink dark:text-white",children:"Creator Tips"}),e.jsx("span",{className:"font-normal text-ink/45 dark:text-white/40 text-xs hidden sm:inline",children:"(optional)"}),e.jsxs("div",{className:"relative group",children:[e.jsx(X,{className:"w-3.5 h-3.5 text-ink/45 dark:text-white/40 cursor-help flex-shrink-0"}),e.jsxs("div",{className:"absolute left-0 sm:left-full sm:ml-2 top-full sm:top-1/2 mt-1 sm:mt-0 sm:-translate-y-1/2 w-56 sm:w-64 p-3 bg-ink dark:bg-white text-white dark:text-slate-900 text-xs rounded-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50 shadow-xl",children:[e.jsx("p",{className:"font-medium mb-1",children:"What are Creator Tips?"}),e.jsx("p",{className:"text-white/80 dark:text-slate-600",children:'Tips for best results. E.g., "Works best with jewelry".'})]})]})]}),e.jsx("p",{className:"text-[11px] sm:text-xs text-ink/55 dark:text-white/60 hidden sm:block",children:"Share advice with users"})]})]}),e.jsx("textarea",{value:r.creatorTips,onChange:t=>d({creatorTips:t.target.value}),className:"w-full px-3 py-2 bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-lg text-sm text-ink dark:text-white placeholder-slate-400 dark:placeholder-white/40 focus:outline-none focus:ring-2 focus:ring-slate-900/10 dark:focus:ring-white/10 focus:border-line dark:focus:border-white/20 transition-all resize-none",rows:2,placeholder:"e.g., Works best with small accessories...",maxLength:200}),e.jsxs("p",{className:"text-[10px] sm:text-xs text-ink/45 dark:text-white/40 mt-1.5 flex justify-between",children:[e.jsx("span",{className:"hidden sm:inline",children:"Displayed to users"}),e.jsxs("span",{children:[r.creatorTips.length,"/200"]})]})]}),e.jsxs(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"bg-white dark:bg-white/5 rounded-[6px] border border-line dark:border-white/10 p-4 sm:p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 mb-4 sm:mb-6",children:[e.jsx("div",{className:"w-8 h-8 sm:w-9 sm:h-9 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center flex-shrink-0",children:e.jsx(Zt,{className:"w-4 h-4 text-ink/65 dark:text-white"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("h2",{className:"text-sm font-semibold text-ink dark:text-white",children:"Compatible Products"}),e.jsxs("div",{className:"relative group",children:[e.jsx(X,{className:"w-3.5 h-3.5 text-ink/45 dark:text-white/40 cursor-help flex-shrink-0"}),e.jsxs("div",{className:"absolute left-0 sm:left-full sm:ml-2 top-full sm:top-1/2 mt-1 sm:mt-0 sm:-translate-y-1/2 w-56 sm:w-64 p-3 bg-ink dark:bg-white text-white dark:text-slate-900 text-xs rounded-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50 shadow-xl",children:[e.jsx("p",{className:"font-medium mb-1",children:"Why add tags?"}),e.jsx("p",{className:"text-white/80 dark:text-slate-600",children:"Tags help users discover your style."})]})]})]}),e.jsx("p",{className:"text-[11px] sm:text-xs text-ink/55 dark:text-white/60 hidden sm:block",children:"Help users find your style"})]})]}),e.jsxs("div",{className:"relative mb-3 sm:mb-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3 py-2 min-h-[44px] sm:min-h-[48px] bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-lg focus-within:ring-2 focus-within:ring-slate-900/10 dark:focus-within:ring-white/10 focus-within:border-line dark:focus-within:border-white/20 transition-all",children:[r.compatibleProducts.map(t=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-ink dark:bg-white text-white dark:text-slate-900 rounded-md text-xs",children:[t,e.jsx("button",{onClick:()=>Ne(t),className:"hover:text-red-300 dark:hover:text-red-500 transition-colors",children:e.jsx(de,{className:"w-3 h-3"})})]},t)),e.jsx("input",{type:"text",value:Q,onChange:t=>bt(t.target.value),onKeyPress:t=>{t.key==="Enter"&&(t.preventDefault(),oe())},onKeyDown:t=>{t.key==="Backspace"&&!Q&&r.compatibleProducts.length>0&&Ne(r.compatibleProducts[r.compatibleProducts.length-1])},onBlur:()=>setTimeout(()=>A(!1),200),disabled:r.compatibleProducts.length>=E,className:"flex-1 min-w-[80px] sm:min-w-[120px] bg-transparent border-none outline-none text-sm text-ink dark:text-white placeholder-slate-400 dark:placeholder-white/40 py-1 disabled:cursor-not-allowed",placeholder:r.compatibleProducts.length>=E?`Max ${E} tags`:r.compatibleProducts.length===0?"Add tag...":"Add..."})]}),Ke&&we.length>0&&e.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-white dark:bg-slate-800 border border-line dark:border-white/10 rounded-lg shadow-xl z-50 max-h-48 overflow-y-auto",children:we.map(t=>e.jsx("button",{onClick:()=>oe(t),className:"w-full px-3 py-2 text-left text-sm hover:bg-sidebar dark:hover:bg-white/10 text-ink/75 dark:text-white",children:t},t))})]}),r.compatibleProducts.length<E&&e.jsx("div",{className:"flex flex-wrap gap-2",children:He.filter(t=>!r.compatibleProducts.includes(t.toLowerCase())).slice(0,15).map(t=>e.jsxs("button",{onClick:()=>oe(t),className:"px-3 py-1.5 bg-sidebar dark:bg-white/10 hover:bg-mist dark:hover:bg-white/20 text-ink/65 dark:text-white rounded-lg text-sm transition-colors",children:["+ ",t]},t))})]})]}),e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"sticky top-24 space-y-6",children:[e.jsxs(S.div,{initial:{opacity:0,y:20}
15,animate:{opacity:1,y:0},transition:{delay:.1},className:"bg-white dark:bg-[#0d0e12] rounded-[6px] border border-line dark:border-white/10 p-6 shadow-sm z-10",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"w-10 h-10 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center",children:e.jsx(Ut,{className:"w-5 h-5 text-ink/75 dark:text-white"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold text-ink dark:text-white",children:"Pricing"}),e.jsx("p",{className:"text-sm text-ink/55 dark:text-white/60",children:"Set your commission"})]})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-ink/55 dark:text-white/50 uppercase tracking-wide mb-2",children:"Your Commission"}),e.jsxs("div",{className:"relative",children:[e.jsx(Wt,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-ink/45 dark:text-white/40"}),e.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",value:r.creatorCommission===0?"":r.creatorCommission,onChange:t=>{const s=t.target.value;if(s==="")d({creatorCommission:0});else{const a=parseInt(s,10);isNaN(a)||d({creatorCommission:Math.min(Math.max(P.MIN_COMMISSION,a),n?P.MAX_COMMISSION_VIDEO:P.MAX_COMMISSION)})}},onBlur:t=>{t.target.value===""&&d({creatorCommission:0})},placeholder:"0",className:"w-full pl-9 pr-16 py-3 bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-lg text-ink dark:text-white focus:outline-none focus:ring-2 focus:ring-slate-900/10 dark:focus:ring-white/10 focus:border-line dark:focus:border-white/20 transition-all"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-ink/55 dark:text-white/60",children:"credits"})]}),e.jsx("p",{className:"text-xs text-ink/55 dark:text-white/60 mt-2",children:n?`You earn this for each video (up to ${P.MAX_COMMISSION_VIDEO} credits on a video style)`:"You earn this for each generation"})]}),e.jsxs("div",{className:"pt-4 border-t border-line dark:border-white/10",children:[e.jsx("p",{className:"text-xs font-medium text-ink/55 dark:text-white/50 uppercase tracking-wide mb-3",children:"Final User Prices"}),e.jsx("div",{className:"space-y-3",children:Object.entries(Qe).map(([t,s])=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-sidebar dark:bg-white/5 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-ink dark:text-white",children:t}),e.jsxs("span",{className:"text-xs text-ink/45 dark:text-white/40 ml-2",children:["base: ",n?s-ie:K[t]]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("span",{className:"font-semibold text-ink dark:text-white",children:[s," cr"]}),e.jsxs("p",{className:"text-xs text-ink/45 dark:text-white/40",children:["$",(s/100).toFixed(2)]})]})]},t))})]}),e.jsx("div",{className:"p-4 bg-sidebar dark:bg-white/10 rounded-lg",children:e.jsxs("p",{className:"text-sm text-ink dark:text-white",children:[e.jsx("strong",{children:"Your earnings:"})," $",((n?ie:r.creatorCommission)*(100-P.PLATFORM_CUT_PERCENT)/100/100).toFixed(2)," per ",n?"video":"image",e.jsxs("span",{className:"text-ink/55 dark:text-white/50",children:[" (after ",P.PLATFORM_CUT_PERCENT,"% platform fee)"]})]})})]})]}),F.length>1&&!n&&e.jsxs(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.15},className:"bg-white dark:bg-[#0d0e12] rounded-[6px] border border-line dark:border-white/10 p-6 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 bg-sidebar dark:bg-white/10 rounded-[6px] flex items-center justify-center",children:e.jsx(Ae,{className:"w-5 h-5 text-ink/75 dark:text-white"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-semibold text-ink dark:text-white",children:"AI Model"}),e.jsx("p",{className:"text-sm text-ink/55 dark:text-white/60",children:"Choose generation engine"})]})]}),e.jsx("select",{value:r.modelId||((De=F.find(t=>t.isDefault))==null?void 0:De.id)||"",onChange:t=>d({modelId:t.target.value||null}),className:"w-full px-3 py-3 bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-lg text-ink dark:text-white text-sm focus:outline-none focus:ring-2 focus:ring-slate-900/10 dark:focus:ring-white/10 focus:border-line dark:focus:border-white/20 transition-all",children:F.map(t=>e.jsxs("option",{value:t.id,children:[t.name,t.isDefault?" (default)":""]},t.id))}),(()=>{var a;const t=r.modelId||((a=F.find(i=>i.isDefault))==null?void 0:a.id),s=F.find(i=>i.id===t);return s!=null&&s.description?e.jsx("p",{className:"text-xs text-ink/55 dark:text-white/50 mt-2",children:s.description}):null})()]}),!n&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"block font-mono text-[11px] uppercase tracking-wide text-ink/50 dark:text-white/50 mb-1.5",children:"AI models on Generate"}),e.jsxs("select",{value:r.castModelsMode||"none",onChange:t=>d({castModelsMode:t.target.value}),className:"w-full bg-card dark:bg-white/5 border border-line dark:border-white/10 px-3 py-2 text-sm text-ink dark:text-white focus:outline-none focus:border-sage",children:[e.jsx("option",{value:"none",children:"None â no model selector"}),e.jsx("option",{value:"female",children:"Female models"}),e.jsx("option",{value:"male",children:"Male models"}),e.jsx("option",{value:"all",children:"All models"})]}),e.jsx("p",{className:"text-xs text-ink/55 dark:text-white/50 mt-1.5",children:"Lets users swap the recipe's model for one of our AI virtual models."})]}),!n&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"block font-mono text-[11px] uppercase tracking-wide text-ink/50 dark:text-white/50 mb-1.5",children:"Backgroun
15d colour picker on Generate"}),e.jsxs("select",{value:r.backgroundColour?"on":"off",onChange:t=>d({backgroundColour:t.target.value==="on"}),className:"w-full bg-card dark:bg-white/5 border border-line dark:border-white/10 px-3 py-2 text-sm text-ink dark:text-white focus:outline-none focus:border-sage",children:[e.jsx("option",{value:"off",children:"Off â no color picker"}),e.jsx("option",{value:"on",children:"On â subscribers can repaint the backdrop"})]}),e.jsx("p",{className:"text-xs text-ink/55 dark:text-white/50 mt-1.5",children:"Lets subscribers repaint the backdrop. Only for plain-backdrop recipes â lighting and shadows are preserved."})]})]})})]})}),e.jsx(Qt,{onClick:()=>pe(!0)}),e.jsx(es,{isOpen:Be,onClose:()=>pe(!1)})]})};export{Es 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.