PageSourceSearch

https://snew.ai/assets/StyleCoversAdminPage-DM4YqxEC.js

js snew.ai collected 2026-10-05 15:08:47 UTC 9,543 bytes, 1 lines download raw bytes

1import{r as s,j as r}from"./index-L9AYrVUw.js";import{g5 as q,l as A,c as B,u as T}from"./PlanAccessModal-P_W2GThH.js";import{B as E}from"./button-Bt8F5TkE.js";import{c as z}from"./locale-Cctu0V3Y.js";import{S as R,a as C}from"./types-YVLQw7aQ.js";import{b as F}from"./catalog-CkHlpXUG.js";import{t as y,c as Q,j as H,a as J}from"./overrides-DxGb-X-q.js";import{D as K}from"./index-BTeEDdlr.js";import{r as W}from"./runTemplateShot-DXBX0_Iy.js";import{u as X}from"./generationHistory-D4RTxXIf.js";import"./productFunnel-DiJFcMU2.js";import"./resolveCasting-1-rDPxyF.js";import"./eligibility-B5UjMwH6.js";import"./scoring-Oj4SgCwH.js";import"./visualDirection-6RyRmTlC.js";import"./productHeight-D88Bzh8q.js";import"./qaSignal-BzonQWWb.js";import"./shadow-1gm38VU4.js";import"./brandDnaToCampaignDna-Dm6109r0.js";import"./snewDefault-bcI9V4vY.js";import"./privateMedia-B7Po080i.js";import"./KnowledgeBasePage-DJT9Fkps.js";import"./FloatingTopMenu-CIhwk2RR.js";import"./SnewLogo-Cg53XTnQ.js";import"./ArrowsClockwise.es-CX8V1pij.js";import"./ChatCircle.es-ys8V5LKI.js";import"./FloppyDisk.es-DCGe340Q.js";import"./Globe.es-5iBT42E4.js";import"./Image.es-BLTC_PgL.js";import"./MagicWand.es-CAihBnXI.js";import"./Package.es-CyLjTX4J.js";import"./Palette.es-Dd5ZEM4v.js";import"./Target.es-Ds7XP-fd.js";import"./WarningCircle.es-CHfqKWRY.js";import"./hydrateStoreContext-CnRDd9GD.js";import"./store-CVXWfzEM.js";import"./generationAdapter-BXonAKVC.js";import"./jobRuntime-D9imWnJq.js";import"./aspectRatios-DDqw6bsx.js";import"./historyKey-GcKgTVWl.js";import"./sceneCovers-B-dE7_Ce.js";const Y={vestuario:"fas",beleza:"bea",perfumaria:"fra","alimento-bebida":"fnb",casa:"hom",joia:"jwl",oculos:"eye",eletronico:"ele",pet:"pet",kids:"kid",suplemento:"sup",esporte:"spt"};function Z(){const a=[];for(const n of K){const i=Y[String(n.vertical)]??null;for(const d of n.products)d.imageUrl&&a.push({id:d.id,name:d.name,imageUrl:d.imageUrl,segment:i})}return a}function U(a){return F().filter(n=>a&&!n.strongSegments.includes(a)||y(n.id)?!1:!Q(n.id).hidden)}async function ee(a,n){try{const i=await W({slug:"placeholder",batchId:`ph-${Date.now().toString(36)}`,cardId:a.id,styleId:a.id,productImageUrl:n.imageUrl,productName:n.name,casting:"auto",format:"4:5"});if(!(i!=null&&i.imageUrl))throw new Error("o orquestrador não devolveu imagem");const d=await X(`taxonomy/${a.id}/placeholder`,i.imageUrl),c=d==null?void 0:d.url;if(!c)throw new Error("não consegui subir a capa para o storage");return await H(a.id,{thumbnailUrl:c,productImageUrl:n.imageUrl,review:!0,reviewNote:`capa provisória — produto emprestado (${n.name}). Refazer com o produto da vertical.`}),{styleId:a.id,ok:!0,coverUrl:c}}catch(i){return{styleId:a.id,ok:!1,error:i.message}}}function re(a,n,i){if(q(a.id))return null;const d=a.strongSegments[0],c=d?n[d]:void 0;if(c){const p=i.find(f=>f.id===c);if(p)return p}return d?i.find(p=>p.segment===d)??null:null}function ze(){const[a,n]=s.useState(!1),[i,d]=s.useState(0);s.useEffect(()=>(A().catch(()=>{}).finally(()=>n(!0)),B(()=>d(e=>e+1))),[]);const[c,p]=s.useState(null),[f,$]=s.useState(30),[k,G]=s.useState({}),[I,V]=s.useState({}),[P,_]=s.useState({}),h=s.useCallback((e,t)=>{_(o=>({...o,[e.id]:{entry:e,state:"fila",...o[e.id],...t}}))},[]),[j,M]=s.useState(!1),N=s.useRef(!1),x=s.useMemo(()=>Z(),[]),m=s.useMemo(()=>a?U(c):[],[a,c,i]),w=s.useMemo(()=>{const e={};return U().forEach(t=>{const o=t.strongSegments[0]??"—";e[o]=(e[o]??0)+1}),e},[a,i]),v=s.useCallback(e=>{const t=I[e.id];return t?x.find(o=>o.id===t)??null:re(e,k,x)},[I,k,x]),b=s.useMemo(()=>m.filter(e=>!!v(e)),[m,v]),S=m.length-b.length,O=s.useCallback(async e=>{const t=v(e);if(!t)return h(e,{state:"pulado",motivo:"sem packshot para esta vertical"}),!1;h(e,{state:"gerando",motivo:void 0});const o=await ee(e,t);return h(e,{state:o.ok?"ok":"erro",motivo:o.error,coverUrl:o.coverUrl}),o.ok},[h,v]),D=async()=>{const e=b.slice(0,f);if(e.length===0){T.error(S>0?"nenhum destes tem produto para emprestar — aponte um produto na vertical":"nada a gerar com esse filtro");return}N.current=!1,M(!0),e.forEach(t=>h(t,{state:"fila",motivo:void 0}));for(const t of e){if(N.current)break;await O(t)}M(!1),T.success(N.current?"lote interrompido":"lote concluído")},g=e=>Object.values(P).filter(t=>t.state===e).length;return r.jsxs("div",{className:"mx-auto max-w-[1100px] px-6 py-10",children:[r.jsx("h1",{className:"text-[26px] font-medium tracking-[-0.02em] text-foreground",children:"Capas faltantes"}),r.jsx("p",{className:"mt-2 max-w-[720px] text-sm text-muted-foreground",children:"Gera capa provisória para os estilos que ainda não têm nenhuma. O estilo é o real — o briefing passa pelo mesmo orquestrador da geração de verdade; o produto é emprestado de uma loja demo. Toda capa entra na fila de revisão com a nota já escrita."}),r.jsxs("section",{className:"mt-8 rounded-snew-lg border border-border p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("label",{className:"text-[12px] text-muted-foreground",children:["Vertical",r.jsxs("select",{value:c??"",onChange:e=>p(e.target.value||null),className:"ml-2 h-8 rounded-snew-md border border-border bg-background px-2 text-[13px] text-foreground",children:[r.jsxs("option",{value:"",children:["todas (",U().length,")"]}),R.filter(e=>(w[e]??0)>0).map(e=>r.jsxs("option",{value:e,children:[C[e]," (",w[e],")"]},e))]})]}),r.jsxs("label",{className:"text-[12px] text-muted-foreground",children:["Quantas",r.jsx("input",{type:"number",min:1,max:200,value:f,onChange:e=>
1$(Math.max(1,Number(e.target.value)||1)),className:"ml-2 h-8 w-20 rounded-snew-md border border-border bg-background px-2 text-[13px] text-foreground"})]}),r.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[m.length," sem capa · ",b.length," com produto",S>0&&r.jsxs("span",{className:"text-amber-700",children:[" ","· ",S," sem packshot na vertical"]})]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[j&&r.jsx(E,{variant:"outline",className:"rounded-full",onClick:()=>{N.current=!0},children:"Interromper"}),r.jsx(E,{className:"rounded-full",disabled:j||b.length===0,onClick:()=>void D(),children:j?"Gerando…":`Gerar ${Math.min(f,b.length)} capas`})]})]}),r.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2 border-t border-border pt-4 lg:grid-cols-3",children:R.filter(e=>(w[e]??0)>0).map(e=>{const t=x.filter(l=>l.segment===e),o=k[e]??"";return r.jsxs("label",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[r.jsx("span",{className:"w-[120px] shrink-0",children:C[e]}),r.jsxs("select",{value:o,onChange:l=>G(u=>({...u,[e]:l.target.value})),className:"h-8 min-w-0 flex-1 rounded-snew-md border border-border bg-background px-2 text-[12px] text-foreground",children:[r.jsx("option",{value:"",children:t.length?`automático (${t[0].name})`:"sem packshot — pula"}),x.map(l=>r.jsx("option",{value:l.id,children:l.name},l.id))]})]},e)})})]}),r.jsxs("section",{className:"mt-8",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-4 text-[13px]",children:[r.jsxs("span",{className:"font-medium text-foreground",children:[m.length," sem capa"]}),g("ok")>0&&r.jsxs("span",{className:"text-emerald-700",children:[g("ok")," geradas agora"]}),g("erro")>0&&r.jsxs("span",{className:"text-destructive",children:[g("erro")," com erro"]}),g("pulado")>0&&r.jsxs("span",{className:"text-muted-foreground",children:[g("pulado")," pulados"]})]}),r.jsxs("div",{className:"flex flex-col divide-y divide-border rounded-snew-lg border border-border",children:[m.map(e=>{const t=P[e.id],o=t==null?void 0:t.state,l=v(e);return r.jsxs("div",{className:"flex items-center gap-3 p-3",children:[r.jsx("div",{className:"h-12 w-12 shrink-0 overflow-hidden rounded-snew-md border border-border bg-white",children:(t==null?void 0:t.coverUrl)&&r.jsx("img",{src:t.coverUrl,alt:"",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate text-[13px] text-foreground",children:J(e)}),r.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:[e.id,e.strongSegments[0]?` · ${C[e.strongSegments[0]]??e.strongSegments[0]}`:" · sem vertical declarada",t!=null&&t.motivo?` · ${t.motivo}`:"",!(t!=null&&t.motivo)&&l?` · empresta ${l.name}`:""]})]}),o&&o!=="fila"&&r.jsx("span",{className:z("shrink-0 rounded-full px-2 py-0.5 text-[11px]",o==="ok"&&"bg-emerald-500/15 text-emerald-700",o==="erro"&&"bg-destructive/15 text-destructive",o==="gerando"&&"bg-amber-500/15 text-amber-700",o==="pulado"&&"bg-muted text-muted-foreground"),children:o==="gerando"?"gerando…":o==="ok"?"pronta":o==="erro"?"erro":"pulado"}),!l&&r.jsxs("select",{value:"",onChange:u=>V(L=>({...L,[e.id]:u.target.value})),className:"h-8 max-w-[190px] shrink-0 rounded-snew-md border border-border bg-background px-2 text-[12px] text-foreground",title:"escolha um produto para emprestar a este preset",children:[r.jsx("option",{value:"",children:"escolher produto…"}),x.map(u=>r.jsx("option",{value:u.id,children:u.name},u.id))]}),r.jsx(E,{variant:"outline",className:"h-8 shrink-0 rounded-full px-3 text-[12px]",disabled:!l||j||o==="gerando",title:l?`gerar com ${l.name}`:"escolha um produto ao lado para liberar a geração",onClick:()=>void O(e),children:o==="ok"?"gerar de novo":"gerar"})]},e.id)}),m.length===0&&r.jsx("div",{className:"p-6 text-center text-[13px] text-muted-foreground",children:"nenhuma capa faltando neste filtro."})]})]})]})}export{ze 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.