1import{r as c,j as e,R as p,b as Va,u as jt,a as kt,c as Ga,p as Za}from"./index-L9AYrVUw.js";import{D as fa,a as ba,b as xa,c as ya,s as Qa,d as Ya,e as Jt,f as Ka,F as Ja}from"./FloatingTopMenu-CIhwk2RR.js";import{S as Ct,a as Xa}from"./locale-Cctu0V3Y.js";import{e as eo,b as to}from"./resolveCasting-1-rDPxyF.js";import{H as ao}from"./HomeStartWith-C1uKmC3C.js";import{p as va,H as se,R as me,S as je,e as oo,n as Bt,u as L,b as ro,d as Sa,f as no,h as io,i as so,j as lo,k as co,C as Y,m as uo,P as po,T as Le,a as mo,q as go}from"./PlanAccessModal-P_W2GThH.js";import{S as $e}from"./skeleton-CthpmC5T.js";import{S as yt,r as ho,P as fo}from"./ProductCmoProposal-DUJv8Qz-.js";import{p as Ae,c as Qe}from"./productBoardIntent-BZb8CQGl.js";import{m as bo}from"./ArrowsClockwise.es-CX8V1pij.js";import{n as wa}from"./Plus.es-BeVefyFz.js";import{T as Xt}from"./thumbnail-card-ZiWJf1m1.js";import{s as xo}from"./ArrowUp.es-sg_sCqx1.js";import{i as yo}from"./EnvelopeSimple.es-Dcd-S8aY.js";import{s as Rt}from"./productFunnel-DiJFcMU2.js";import{P as Aa}from"./pill-dropdown-menu-CmrSXir-.js";import{A as at,a as et}from"./aspectRatios-DDqw6bsx.js";import{n as vo}from"./Package.es-CyLjTX4J.js";import{l as ea}from"./UploadSimple.es-BDJIa312.js";import{S as So}from"./SearchInput-h5gAN-Be.js";import{F as wo}from"./FirstTimeExploreShowcase-CUxewfVe.js";import{Q as Ao}from"./QuickActionBriefModal-BmWFgbnv.js";import{P as jo}from"./overImage-BfLII5AZ.js";import{P as ta,a as ko,l as Co,b as Bo}from"./ProductPickerModal-DZV-fDl_.js";import{N as Ro,B as Eo}from"./BoardCard-Vj24tRtg.js";import{c as Ye,r as aa,l as oa}from"./loadRecommendationContext-eK4jCmh4.js";import{T as Io,a as Do,b as Fo}from"./tabs-CmDZA0dx.js";import{S as To,a as Lo}from"./sheet-CL9mA1Sp.js";import{loadStoreContext as Po}from"./KnowledgeBasePage-DJT9Fkps.js";import{u as zo}from"./useRecentBoards-Drv6qcH_.js";import{H as ja,r as Mo,d as $o,a as No}from"./history-CQXQpNXw.js";import{b as vt}from"./worksMode-DPF33FWh.js";import{d as tt,c as Oo,s as _o}from"./durableRepository-CrJ1KOcD.js";import"./generationAdapter-BXonAKVC.js";import{G as ra}from"./generationHistory-D4RTxXIf.js";import{f as qo,s as na}from"./firstAsset-DWUwvZpm.js";import{m as Ho}from"./materializeFirstImagesBoard-VB_VZLQM.js";import{P as Wo}from"./PricingSection-DIgqIFiP.js";import{l as Uo}from"./copy-D4zGkB4a.js";import"./SnewLogo-Cg53XTnQ.js";import"./eligibility-B5UjMwH6.js";import"./overrides-DxGb-X-q.js";import"./types-YVLQw7aQ.js";import"./scoring-Oj4SgCwH.js";import"./visualDirection-6RyRmTlC.js";import"./productHeight-D88Bzh8q.js";import"./qaSignal-BzonQWWb.js";import"./shadow-1gm38VU4.js";import"./quickActions-Bt6kGa-B.js";import"./snewDefault-bcI9V4vY.js";import"./privateMedia-B7Po080i.js";import"./christmasCreativeDirections-Ceo-u5n5.js";import"./recipes-CtHnj9D9.js";import"./antiStock-CfefI4TX.js";import"./sanitized-commercial-metrics-Ctrrpq63.js";import"./stagingComposerPrompt-ut90SPpr.js";import"./canvasDocument-BD3jeUPg.js";import"./durableDocument-CwDQPJIK.js";import"./stagingProductStyleBinding-BNVQaSKK.js";import"./TriptychCard-CooUfvoh.js";import"./ImageSquare.es-Ckk4CjAE.js";import"./entries-DM0IuApj.js";import"./catalog-CkHlpXUG.js";import"./sceneCovers-B-dE7_Ce.js";import"./store-CVXWfzEM.js";import"./ShowcaseCard-BFEMhBRb.js";import"./StyleEditStarterOverlay-BFzAjjM3.js";import"./promptBox-D9Xxfn9U.js";import"./StarterModalShell-BqsuvlPe.js";import"./PillSelect-DrQvPMFB.js";import"./use-exclusive-open-LN4OUcjO.js";import"./ChatSubmitButton-Bm0hHp2J.js";import"./CastingTagPill-Dxy3OzJ5.js";import"./User.es-DVlkNLFL.js";import"./castingThumbnail-BTwl0DD5.js";import"./useFileDrop-Bndg9qCI.js";import"./useGenerationCreditCost-DQbGS72G.js";import"./showcase-qHVT8Yso.js";import"./stagingLeanLibrary-OoJ8Uo_5.js";import"./useFullInventory-COSthsrP.js";import"./button-Bt8F5TkE.js";import"./modal-close-button-BhLoO4jQ.js";import"./dropdown-menu-mjIVraPt.js";import"./index-Eo00qZvG.js";import"./index-BKpKuXmL.js";import"./useProgressiveImageSource-CrIWUb3O.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"./Palette.es-Dd5ZEM4v.js";import"./Target.es-Ds7XP-fd.js";import"./WarningCircle.es-CHfqKWRY.js";import"./hydrateStoreContext-CnRDd9GD.js";import"./jobRuntime-D9imWnJq.js";import"./boardSaveRetry-DOnjTgch.js";import"./historyKey-GcKgTVWl.js";import"./importBoardDomain-CQ96NT6j.js";import"./welcomeBoard-4xJYHWeA.js";import"./LandingHeading-Du94IKOt.js";import"./segmented-tabs--x9EQobi.js";const ia=!1,Vo=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M225.29,165.93C216.61,151,212,129.57,212,104a84,84,0,0,0-168,0c0,25.58-4.59,47-13.27,61.93A20.08,20.08,0,0,0,30.66,186,19.77,19.77,0,0,0,48,196H208a19.77,19.77,0,0,0,17.31-10A20.08,20.08,0,0,0,225.29,165.93ZM54.66,172C63.51,154,68,131.14,68,104a60,60,0,0,1,120,0c0,27.13,4.48,50,13.33,68ZM172,224a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,224Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M208,192H48a8,8,0,0,1-6.88-12C47.71,168.6,56,139.81,56,104a72,72,0,0,1,144,0c0,35.82,8.3,64.6,14.9,76A8,8,0,0,1,208,192Z",opacity:"0.2"}),c.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,1,1,0-16h64A8,8,0,0,1,168,224Zm53.85-32A15.8,15.8,0,0,1,208,200H48a16,16,0,0,1-13.8-24.06C39.75,166.38,48,139.34,48,104a80,80,0,1,1,160,0c0,35.33,8.26,62.38,13.81,71.94A15.89,15.89,0,0,1,221.84,192ZM208,184c-7.73-13.27-16-43.95-16-80a64,64,0,1,0-128,0c0,36.06-8.28,66.74-16,80Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,1,1,0-16h64A8,8,0,0,1,168,224Zm53.81-48.06C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H208a16,16,0,0,0,13.8-24.06Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M166,224a6,6,0,0,1-6,6H96a6,
16,0,0,1,0-12h64A6,6,0,0,1,166,224Zm54.11-33a13.83,13.83,0,0,1-12.1,7H48a14,14,0,0,1-12.06-21.06C41.59,167.2,50,139.74,50,104a78,78,0,1,1,156,0c0,35.73,8.42,63.2,14.08,72.94A13.9,13.9,0,0,1,220.11,191Zm-10.41-8C202.13,170,194,139.68,194,104a66,66,0,1,0-132,0c0,35.69-8.14,66-15.71,79a2,2,0,0,0,0,2,1.9,1.9,0,0,0,1.7,1H208a1.9,1.9,0,0,0,1.7-1A2,2,0,0,0,209.7,183Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M168,224a8,8,0,0,1-8,8H96a8,8,0,1,1,0-16h64A8,8,0,0,1,168,224Zm53.85-32A15.8,15.8,0,0,1,208,200H48a16,16,0,0,1-13.8-24.06C39.75,166.38,48,139.34,48,104a80,80,0,1,1,160,0c0,35.33,8.26,62.38,13.81,71.94A15.89,15.89,0,0,1,221.84,192ZM208,184c-7.73-13.27-16-43.95-16-80a64,64,0,1,0-128,0c0,36.06-8.28,66.74-16,80Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M164,224a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,224Zm54.38-34A11.84,11.84,0,0,1,208,196H48A12,12,0,0,1,37.65,178C43.42,168,52,140.13,52,104a76,76,0,1,1,152,0c0,36.13,8.59,64,14.36,73.95A11.92,11.92,0,0,1,218.38,190Zm-6.95-8C204,169.17,196,139.31,196,104a68,68,0,1,0-136,0c0,35.32-8,65.17-15.44,78a4,4,0,0,0,0,4A3.91,3.91,0,0,0,48,188H208a3.91,3.91,0,0,0,3.44-2A4,4,0,0,0,211.43,182Z"}))]]),Go=new Map([["bold",c.createElement(c.Fragment,null,c.createElement("path",{d:"M187.3,159.06A36.09,36.09,0,0,1,152,188a84.09,84.09,0,0,1-84-84A36.09,36.09,0,0,1,96.94,68.7,12,12,0,0,1,110,75.1l11.48,23a12,12,0,0,1-.75,12l-8.52,12.78a44.56,44.56,0,0,0,20.91,20.91l12.78-8.52a12,12,0,0,1,12-.75l23,11.48A12,12,0,0,1,187.3,159.06ZM236,128A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z"}))],["duotone",c.createElement(c.Fragment,null,c.createElement("path",{d:"M128,32A96,96,0,0,0,44.89,176.07L32.42,213.46a8,8,0,0,0,10.12,10.12l37.39-12.47A96,96,0,1,0,128,32Zm24,152a80,80,0,0,1-80-80,32,32,0,0,1,32-32l16,32-12.32,18.47a48.19,48.19,0,0,0,25.85,25.85L152,136l32,16A32,32,0,0,1,152,184Z",opacity:"0.2"}),c.createElement("path",{d:"M187.58,144.84l-32-16a8,8,0,0,0-8,.5l-14.69,9.8a40.55,40.55,0,0,1-16-16l9.8-14.69a8,8,0,0,0,.5-8l-16-32A8,8,0,0,0,104,64a40,40,0,0,0-40,40,88.1,88.1,0,0,0,88,88,40,40,0,0,0,40-40A8,8,0,0,0,187.58,144.84ZM152,176a72.08,72.08,0,0,1-72-72A24,24,0,0,1,99.29,80.46l11.48,23L101,118a8,8,0,0,0-.73,7.51,56.47,56.47,0,0,0,30.15,30.15A8,8,0,0,0,138,155l14.62-9.74,23,11.48A24,24,0,0,1,152,176ZM128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"}))],["fill",c.createElement(c.Fragment,null,c.createElement("path",{d:"M152.58,145.23l23,11.48A24,24,0,0,1,152,176a72.08,72.08,0,0,1-72-72A24,24,0,0,1,99.29,80.46l11.48,23L101,118a8,8,0,0,0-.73,7.51,56.47,56.47,0,0,0,30.15,30.15A8,8,0,0,0,138,155ZM232,128A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-40,24a8,8,0,0,0-4.42-7.16l-32-16a8,8,0,0,0-8,.5l-14.69,9.8a40.55,40.55,0,0,1-16-16l9.8-14.69a8,8,0,0,0,.5-8l-16-32A8,8,0,0,0,104,64a40,40,0,0,0-40,40,88.1,88.1,0,0,0,88,88A40,40,0,0,0,192,152Z"}))],["light",c.createElement(c.Fragment,null,c.createElement("path",{d:"M186.68,146.63l-32-16a6,6,0,0,0-6,.38L133,141.46A42.49,42.49,0,0,1,114.54,123L125,107.33a6,6,0,0,0,.38-6l-16-32A6,6,0,0,0,104,66a38,38,0,0,0-38,38,86.1,86.1,0,0,0,86,86,38,38,0,0,0,38-38A6,6,0,0,0,186.68,146.63ZM152,178a74.09,74.09,0,0,1-74-74,26,26,0,0,1,22.42-25.75l12.66,25.32-10.39,15.58a6,6,0,0,0-.54,5.63,54.43,54.43,0,0,0,29.07,29.07,6,6,0,0,0,5.63-.54l15.58-10.39,25.32,12.66A26,26,0,0,1,152,178ZM128,26A102,102,0,0,0,38.35,176.69L26.73,211.56a14,14,0,0,0,17.71,17.71l34.87-11.62A102,102,0,1,0,128,26Zm0,192a90,90,0,0,1-45.06-12.08,6.09,6.09,0,0,0-3-.81,6.2,6.2,0,0,0-1.9.31L40.65,217.88a2,2,0,0,1-2.53-2.53L50.58,178a6,6,0,0,0-.5-4.91A90,90,0,1,1,128,218Z"}))],["regular",c.createElement(c.Fragment,null,c.createElement("path",{d:"M187.58,144.84l-32-16a8,8,0,0,0-8,.5l-14.69,9.8a40.55,40.55,0,0,1-16-16l9.8-14.69a8,8,0,0,0,.5-8l-16-32A8,8,0,0,0,104,64a40,40,0,0,0-40,40,88.1,88.1,0,0,0,88,88,40,40,0,0,0,40-40A8,8,0,0,0,187.58,144.84ZM152,176a72.08,72.08,0,0,1-72-72A24,24,0,0,1,99.29,80.46l11.48,23L101,118a8,8,0,0,0-.73,7.51,56.47,56.47,0,0,0,30.15,30.15A8,8,0,0,0,138,155l14.61-9.74,23,11.48A24,24,0,0,1,152,176ZM128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-6.54-.67L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Z"}))],["thin",c.createElement(c.Fragment,null,c.createElement("path",{d:"M185.79,148.42l-32-16a4,4,0,0,0-4,.25l-16.64,11.1a44.56,44.56,0,0,1-20.91-20.91l11.1-16.64a4,4,0,0,0,.25-4l-16-32A4,4,0,0,0,104,68a36,36,0,0,0-36,36,84.09,84.09,0,0,0,84,84,36,36,0,0,0,36-36A4,4,0,0,0,185.79,148.42ZM152,180a76.08,76.08,0,0,1-76-76,28,28,0,0,1,25.58-27.9l13.8,27.61-11,16.54A4,4,0,0,0,104,124a52.43,52.43,0,0,0,28,28,4,4,0,0,0,3.76-.37l16.54-11,27.61,13.8A28,28,0,0,1,152,180ZM128,28A100,100,0,0,0,40.53,176.5l-11.9,35.69a12,12,0,0,0,15.18,15.18l35.69-11.9A100,100,0,1,0,128,28Zm0,192a92,92,0,0,1-46.07-12.35,4.05,4.05,0,0,0-2-.54,3.93,3.93,0,0,0-1.27.21L41.28,219.78a4,4,0,0,1-5.06-5.06l12.46-37.38a4,4,0,0,0-.33-3.27A92,92,0,1,1,128,220Z"}))]]),ka=c.forwardRef((t,r)=>c.createElement(va,{ref:r,...t,weights:Vo}));ka.displayName="BellSimpleIcon";const Zo=ka,Ca=c.forwardRef((t,r)=>c.createElement(va,{ref:r,...t,weights:Go}));Ca.displayName="WhatsappLogoIcon";const Qo=Ca;function St(t){return t.print_focus||t.subcategory==="apparel"||t.content_texture?"detail":"agent"}function Yo({kind:t,product:r,suggestion:a,language:n,onClose:d,onChangeProduct:i,onContinue:x}){var V,S,I,H;const g=n==="en",[y,k]=c.useState("agent"),[B,F]=c.useState(null),[R,T]=c.useState(t==="video"?"loading":"ready");c.useEffect(()=>{if(t!=="video")return;let j=!0;return T("loading"),eo({sourceImageUrl:r.image,productName:r.name}).then(O=>
1{j&&(F(O),k(St(O)),T("ready"))}).catch(async()=>{const O=await to({sourceImageUrl:r.image,productName:r.name}).catch(()=>null);if(j){if(!O){T("unavailable");return}F(O),k(St(O)),T("fallback")}}),()=>{j=!1}},[t,r.image,r.name]);const P=(a==null?void 0:a.styleDesc)||(g?"Introduce the selected product, then move closer to its visible details.":"Apresente o produto selecionado e aproxime o olhar dos detalhes visÃveis."),E=((V=B==null?void 0:B.content_texture)==null?void 0:V.trim())||((S=B==null?void 0:B.product_form)==null?void 0:S.replace(/[-_]/g," ").trim()),z=B?St(B):"agent",C=t==="video"?[{id:"agent",title:g?"Gentle push-in":"Aproximação suave",description:g?`A gentle camera move introduces the ${E||"product"} without changing it.`:"Uma aproximação suave apresenta o produto sem alterá-lo.",direction:`One continuous 5-second shot, a slow camera push-in toward the visible ${E||"product"}. Preserve the reference product throughout; no invented surfaces or morphing.`},{id:"detail",title:g?"Details in motion":"Detalhes em movimento",description:g?`A slow camera move highlights the visible ${E||"details"}.`:"A câmera desliza pelos detalhes visÃveis do produto.",direction:`5-second continuous close-up of the selected product, slow lateral camera drift across visible ${E||"construction"}. Preserve lettering, shape and material; do not invent hidden details.`},{id:"hero",title:g?"Product reveal":"Revelação do produto",description:g?"Light gradually reveals the product, ending on its full silhouette.":"A luz revela a peça aos poucos e termina na silhueta completa.",direction:"5-second continuous product reveal: gentle lighting change and a slow camera pullback to the reference silhouette. Product stays still and unchanged, no rotation to unseen sides."}]:[{id:"agent",title:g?"Creative Planner suggestion":"Sugestão do Creative Planner",description:P,direction:`Develop a campaign around this concrete scene: ${P}. Plan three distinct frames: establishing scene, product interaction, visible detail. Include an Instagram feed caption and a Story sequence.`},{id:"discovery",title:g?"Introduce the product":"Apresentar o produto",description:g?"A connected sequence: product, context and a visible detail.":"Uma sequência conectada: produto, contexto e um detalhe visÃvel.",direction:"Plan a product discovery campaign: hero image, contextual scene, visible construction detail. Three 4:5 frames and a 9:16 Story adaptation, with distinct copy for each."},{id:"identity",title:g?"Build brand affinity":"Criar identificação com a marca",description:g?"Connect the product to a moment your audience recognizes.":"Conecte o produto a um momento que o público reconhece.",direction:`Plan a brand affinity campaign using this product and this context: ${P}. Three connected editorial frames and captions. Distinguish intended audience from verified customer evidence.`}],q=C.find(j=>j.id===y),M=((I=C.find(j=>j.id===z))==null?void 0:I.title)??q.title;return e.jsx(fa,{open:!0,onOpenChange:j=>{j||d()},children:e.jsxs(ba,{className:"max-w-2xl max-h-[90dvh] overflow-y-auto",children:[e.jsx(xa,{children:e.jsx(ya,{children:t==="video"?g?"Choose a video direction":"Escolha a direção do vÃdeo":g?"Choose a campaign direction":"Escolha a direção da campanha"})}
1),e.jsxs("div",{className:"flex items-center gap-4 rounded-2xl bg-neutral-50 p-4",children:[e.jsx("img",{src:r.image,alt:r.name,className:"h-20 w-20 rounded-xl object-cover"}),e.jsx("span",{className:"flex-1 text-sm",children:r.name}),e.jsx("button",{type:"button",onClick:i,className:"text-sm underline",children:g?"Change":"Trocar"})]}),t==="video"&&e.jsx("p",{role:"status",className:"text-sm text-neutral-600",children:R==="loading"?g?"Reading the product image to suggest a Filmmaker actionâ¦":"Lendo a imagem do produto para sugerir uma ação do Filmmakerâ¦":R==="unavailable"?g?"Image analysis is unavailable. Choose a direction manually.":"A leitura da imagem não está disponÃvel. Escolha uma direção manualmente.":R==="fallback"?g?`Visual analysis is unavailable. Based on the available product information, try ${M.toLowerCase()}.`:`A leitura visual está indisponÃvel. Com os dados disponÃveis do produto, sugerimos ${M.toLowerCase()}.`:g?`Filmmaker recommends ${M.toLowerCase()} from the visible product details.`:`O Filmmaker recomenda ${M.toLowerCase()} pelos detalhes visÃveis do produto.`}),e.jsx("div",{className:"grid gap-3",role:"group","aria-label":g?"Creative presets":"Presets criativos",children:C.map(j=>e.jsxs("button",{type:"button",disabled:t==="video"&&R==="loading","aria-pressed":y===j.id,onClick:()=>k(j.id),className:`rounded-2xl border p-4 text-left disabled:opacity-50 ${y===j.id?"border-neutral-800 bg-neutral-100":"border-transparent bg-neutral-50"}`,children:[e.jsxs("span",{className:"block text-sm font-medium",children:[j.title,t==="video"&&(R==="ready"||R==="fallback")&&z===j.id?g?" · Recommended":" · Recomendado":""]}),e.jsx("span",{className:"mt-1 block text-sm text-neutral-600",children:j.description})]},j.id))}),t==="campaign"&&y==="agent"&&e.jsx("p",{className:"text-sm text-neutral-600",children:((H=a==null?void 0:a.recommendation)==null?void 0:H.reason)||(g?"Based on your selected reference. Brand and audience information can be added to refine this direction.":"Baseado na referência escolhida. Informações de marca e público podem refinar esta direção.")}),e.jsx(Ct,{type:"button",size:"lg",block:!0,disabled:t==="video"&&R==="loading",onClick:()=>{var j;return x({product:r,title:q.title,prompt:`${q.direction} 2Selected product: ${r.name}. Preserve the exact supplied reference. ${((j=a==null?void 0:a.recommendation)==null?void 0:j.reason)||""} 3Do not invent sales, performance, discounts, product attributes or customer statistics.`})},children:t==="video"?g?"Continue to video":"Continuar para vÃdeo":g?"Create campaign plan":"Criar plano de campanha"})]})})}const Ko=[{id:"style-editorial-pose",title:"Pose editorial",sub:"Produto em uma pose editorial com luz suave.",cover:"/templates/editorial.svg"},{id:"style-color-backdrop",title:"Fundo colorido",sub:"Cor vibrante para destacar o produto.",cover:"/templates/vibrant.svg"},{id:"style-studio-branco",title:"Studio fundo branco",sub:"Packshot clean para e-commerce.",cover:"/templates/studio.svg"},{id:"style-lifestyle-ambiente",title:"Lifestyle em ambiente real",sub:"Produto em uma cena cotidiana.",cover:"/templates/lifestyle.svg"},{id:"style-macro-detail",title:"Macro detalhe",sub:"Material e textura em primeiro plano.",cover:"/templates/minimal.svg"},{id:"style-flat-lay",title:"Flat lay top-down",sub:"Vista de cima com composição de objetos.",cover:"/templates/artisan.svg"},{id:"style-athletic",title:"Movimento atlético",sub:"Energia e contraste alto.",cover:"/templates/athletic.svg"},{id:"style-statement",title:"Statement tipográfico",sub:"Composição com tipografia em destaque.",cover:"/templates/statement.svg"}];function Jo({open:t,language:r,connected:a,onClose:n,onContinue:d}){const i=r==="en";return e.jsx(fa,{open:t,onOpenChange:x=>{x||n()},children:e.jsxs(ba,{className:"max-w-md",children:[e.jsx(xa,{children:e.jsx(ya,{children:i?"Start with the agent":"Comece com o agente"})}),e.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:a?i?"Your store is connected. Open the agent to explore actions for your catalog.":"Sua loja está conectada. Abra o agente para explorar ações para seu catálogo.":i?"Connect your store so the agent can read your catalog and suggest useful actions.":"Conecte sua loja para o agente ler seu catálogo e sugerir ações úteis."}),e.jsx(Ct,{type:"button",size:"lg",block:!0,onClick:d,children:a?i?"Open agent":"Abrir agente":i?"Connect store":"Conectar loja"})]})})}function Xo(){return e.jsx($e,{style:{width:180,height:26,marginBottom:se.titleGap}})}function er(){return e.jsxs("div",{children:[e.jsx($e,{style:{width:"100%",aspectRatio:"4 / 3",borderRadius:me.homeCard}}),e.jsx($e,{style:{width:"62%",height:18,marginTop:10,borderRadius:me.sm}}),e.jsx($e,{style:{width:"34%",height:14,marginTop:2,borderRadius:me.sm}})]})}function tr(){return e.jsxs("section",{"data-home-section-skeleton":"boards","aria-hidden":"true",style:{marginBottom:se.sectionGap},children:[e.jsx(Xo,{}),e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 lg:gap-8",children:Array.from({length:4},(t,r)=>e.jsx(er,{},r))})]})}const sa=5;function ar(t,r){const a=c.useRef(""),[n,d]=c.useState({key:"",index:0}),i=t?JSON.stringify([t,r]):"";return c.useEffect(()=>{if(!t||a.current===i)return;a.current=i;let x=0;try{const g=`snew:home-intro:v1:${t}`,y=Number(sessionStorage.getItem(g)??0);x=Number.isInteger(y)&&y>=0?y%sa:0,sessionStorage.setItem(g,String((x+1)%sa))}catch{}d({key:i,index:x})},[i,t]),n.key===i?n.index:0}function or(t,r,a){var g,y,k,B;const n=(y=(g=r.recommendation)==null?void 0:g.creativeContext)==null?void 0:y.editorial;if(n)return a?{"strength-training":"identity and presence in strength training",running:"freedom in every running str
3ide",yoga:"ease and balance in movement"}[n.territory]:{"strength-training":"identidade e presença na musculação",running:"liberdade em cada passada",yoga:"leveza e equilÃbrio em movimento"}[n.territory];const d=[t==null?void 0:t.niche,t==null?void 0:t.audience,t==null?void 0:t.tone,t==null?void 0:t.visualConcept,(k=t==null?void 0:t.siteMetadata)==null?void 0:k.description,(B=r.product)==null?void 0:B.name].filter(Boolean).join(" ").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),i=/personaliz|bordad|personalit|embroider/.test(d),x=/confort|comfort|macio|soft|aconcheg|knit|trico/.test(d);return x&&i?a?"comfort and personality":"conforto e personalidade":i?a?"personality in every detail":"personalidade em cada detalhe":x?a?"comfort in everyday moments":"conforto nos momentos do dia a dia":a?"what makes your products distinctive":"o que torna seus produtos especiais"}function rr(t,r){var d,i,x,g;if((d=t.recommendation)!=null&&d.scene)return t.recommendation.scene.description;const a=((x=(i=t.recommendation)==null?void 0:i.creativeContext)==null?void 0:x.category)==="apparel";return((g={"carrossel-instagram":["Uma sequência que conecta apresentação, uso e detalhes da peça.","A sequence connecting the product, its use and its details."],"adicionar-modelo":["Caimento e proporção numa cena de uso natural.","Fit and proportion in a natural everyday moment."],"produto-em-uso":["Uma interação que mostra como o produto faz parte da rotina.","An interaction showing how the product fits into everyday life."],"detalhe-produto":["Aproxime o olhar dos detalhes que tornam este produto único.","A closer look at the details that make this product distinctive."],"variacao-angulos":["Novos enquadramentos dos detalhes visÃveis na referência.","New framings of the details visible in the reference."],"renovar-mais-vendido":[a?"Silhueta e acabamento em uma imagem principal.":"Forma e acabamento em uma imagem principal.","Shape and finish in a hero image."],"produto-em-ambiente":["Uma cena que conecta o produto ao universo da marca.","A scene connecting the product to the brandâs world."],"story-instagram":["Uma composição vertical para apresentar o produto no celular.","A vertical composition to introduce the product on mobile."],"aplicar-estilo":["A direção visual da marca aplicada ao produto real.","The brandâs visual direction applied to the actual product."],"peca-de-marca":["Luz e composição para expressar a identidade da marca.","Lighting and composition expressing the brandâs identity."]}[t.id])==null?void 0:g[r?1:0])??t.styleDesc}function nr(t){var R;const r=t.language==="en";if(t.loading)return{heading:r?"Getting your catalog ready":"Preparando seu catálogo",intro:"",options:{}};if(t.error)return{heading:r?"Your catalog could not be loaded":"Não foi possÃvel carregar seu catálogo",intro:r?"Try loading your products again to see relevant ideas.":"Tente carregar seus produtos novamente para ver ideias pertinentes.",options:{}};if(!((R=t.actions[0])==null?void 0:R.product))return{heading:r?"Bring a product. Letâs find its creative direction.":"Traga um produto. Vamos encontrar sua direção criativa.",intro:r?"Add a store URL or a product photo to start with your own context.":"Adicione a URL da loja ou uma foto de produto para começar pelo seu contexto.",options:{}};const n={},d=[["agent",["carrossel-instagram","lancamento"]],["produto",["adicionar-modelo","produto-em-uso","produto-em-ambiente"]],["board",["detalhe-produto","variacao-angulos"]],["estilos",["aplicar-estilo","peca-de-marca","renovar-mais-vendido","story-instagram"]]],i=new Set,x=new Set,g=new Set,y=T=>T.label.normalize("NFD").replace(/[\u0300-\u036f]/g,"").trim().toLowerCase();for(const[T,P]of d){const E=t.actions.filter(C=>C.product&&!x.has(C.product.id)&&!g.has(y(C))),z=P.map(C=>E.find(q=>q.id===C&&!i.has(q.id))).find(Boolean)??E.find(C=>!i.has(C.id))??E[0];z&&(i.add(z.id),x.add(z.product.id),g.add(y(z)),n[T]={title:z.label,description:rr(z,r),action:z})}const k=or(t.store,t.actions[0],r),B=r?[`Letâs show ${k}.`,"What story will your products tell today?","A new scene for your products.","Letâs create images worth remembering.","A fresh perspective on your products."]:[`Vamos mostrar ${k}.`,"Que história seus produtos vão contar hoje?","Uma nova cena para seus produtos.","Vamos criar imagens memoráveis.","Um novo olhar para seus produtos."],F=Number.isInteger(t.introIndex)&&t.introIndex>=0?t.introIndex%B.length:0;return{heading:B[F],intro:"",options:n}}const ke=je,ir=ke.audiencias.find(t=>
3t.id==="inativos"),sr=ke.audiencias.find(t=>t.id==="vip"),lr=ke.audiencias.find(t=>t.id==="maes");function dr(t){switch(t){case"reativacao":return{analyzing:"Lendo a base de inativosâ¦",proposing:`São ${ir.tamanho.toLocaleString("pt-BR")} clientes parados há 60 dias â reativar custa menos que captar. Montei uma régua de 3 toques em 7 dias. Ativamos?`,primaryActionLabel:"Ativar régua",refineLabel:"Ajustar os toques",actingNote:"Pra ativar de verdade preciso da integração com o seu CRM/WhatsApp. Em breve.",doneText:"Régua salva como rascunho. Quando a integração estiver pronta, ativo de uma vez.",nextStepLabel:"Próximo passo"};case"automacao":return{analyzing:"Olhando a régua atualâ¦",proposing:"Montei uma régua de 3 toques (e-mail · WhatsApp · push) cobrindo as primeiras 72h. Curta o suficiente pra não cansar, longa o suficiente pra recuperar. Ativamos?",primaryActionLabel:"Ativar régua",refineLabel:"Ajustar os toques",actingNote:"Pra ativar preciso conectar o disparador (e-mail/WhatsApp). Em breve.",doneText:"Régua salva. Conecte o disparador quando quiser ligar.",nextStepLabel:"Próximo passo"};case"relatorio":return{analyzing:"Cruzando ROAS por canalâ¦",proposing:`Seu ${ke.melhorCanalSemana.canal} tá em ROAS ${ke.melhorCanalSemana.roas} â contra ${ke.melhorCanalSemana.vs}. Realocaria 30% do budget pra lá essa semana. Topa?`,primaryActionLabel:"Realocar budget",refineLabel:"Ver por campanha",actingNote:"Pra realocar de verdade preciso da integração com o Ads Manager. Em breve.",doneText:"Recomendação salva. Conecte o Ads Manager pra eu aplicar direto.",nextStepLabel:"Próximo passo"};case"segmento":return{analyzing:"Cortando a base por LTVâ¦",proposing:`Identifiquei ${sr.tamanho} clientes de alto valor â recompram 3x mais que a média. Crio o segmento "VIP" pra você falar com eles separado?`,primaryActionLabel:"Criar segmento",refineLabel:"Refinar critérios",actingNote:"Pra criar o segmento na origem preciso da integração com seu CRM. Em breve.",doneText:"Segmento salvo. Quando conectar o CRM, sincronizo automaticamente.",nextStepLabel:"Régua VIP"};case"calendario":return{analyzing:"Montando o calendárioâ¦",proposing:`Plano de 30 dias com 3 posts/semana â alternando educativo, prova social e oferta. ${lr.tamanho.toLocaleString("pt-BR")} mães na base cabem como público recorrente. Agendamos?`,primaryActionLabel:"Agendar calendário",refineLabel:"Ajustar pauta",actingNote:"Pra agendar nos canais preciso conectar Instagram/Meta. Em breve.",doneText:"Calendário salvo como rascunho. Conecte os canais pra agendar.",nextStepLabel:"Gerar criativos do mês"}}}function cr(t,r){switch(t){case"proposing":return[{id:"primary",label:r.primaryActionLabel,primary:!0},{id:"refine",label:r.refineLabel}];case"done":return[{id:"next",label:r.nextStepLabel,primary:!0},{id:"close",label:"Fechar"}];case"analyzing":case"acting":default:return[]}}const m={bg:"#0E0E10",surface:"#16161A",surface2:"#1C1C21",border:"#26262C",borderHi:"#3A3A42",text:"#EDEDF0",textDim:"#9A9AA3",textMute:"#6A6A73"},ur=[{step:1,canal:"e-mail",timing:"Dia 1",resumo:"Sentimos sua falta â sem desconto, só lembrar do valor."},{step:2,canal:"whatsapp",timing:"Dia 3",resumo:"Mensagem curta com a peça que mais converteu pra esse perfil."},{step:3,canal:"push",timing:"Dia 7",resumo:"Oferta condicional (cupom só pra quem abriu os 2 anteriores)."}],pr=[{step:1,canal:"e-mail",timing:"+15 min",resumo:"Resgate de carrinho â produto + frete grátis se aplicável."},{step:2,canal:"whatsapp",timing:"+4 h",resumo:"Toque humano â pergunta se ficou alguma dúvida."},{step:3,canal:"push",timing:"+24 h",resumo:"Ãltima chamada â escassez baseada no estoque real."}],mr={"e-mail":e.jsx(yo,{size:16,weight:"regular"}),whatsapp:e.jsx(Qo,{size:16,weight:"regular"}),push:e.jsx(Zo,{size:16,weight:"regular"})},gr=({flow:t})=>{const r=t==="reativacao"?ur:pr;return e.jsxs("div",{style:{width:"100%",maxWidth:540,display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between"},children:[e.jsx("h3",{style:{margin:0,fontSize:15,fontWeight:600,color:m.text},children:"Régua de 3 toques"}),e.jsx("span",{style:{fontSize:11,color:m.textMute},children:t==="reativacao"?"7 dias":"24 h"})]}),e.jsx("ol",{style:{listStyle:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:8},children:r.map(a=>e.jsxs("li",{style:{display:"grid",gridTemplateColumns:"28px 1fr auto",gap:12,alignItems:"center",padding:"12px 14px",background:m.surface2,border:`1px solid ${m.border}`,borderRadius:10},children:[e.jsx("div",{style:{width:26,height:26,borderRadius:999,background:m.bg,color:m.textDim,dis
3play:"flex",alignItems:"center",justifyContent:"center",fontSize:12,fontWeight:600},children:a.step}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:m.text,fontSize:13,fontWeight:500},children:[e.jsx("span",{style:{color:m.textDim},children:mr[a.canal]}),e.jsx("span",{style:{textTransform:"capitalize"},children:a.canal})]}),e.jsx("div",{style:{fontSize:12,color:m.textDim,lineHeight:1.45},children:a.resumo})]}),e.jsx("div",{style:{fontSize:11,color:m.textMute,whiteSpace:"nowrap"},children:a.timing})]},a.step))})]})},hr=[{canal:"Instagram",roas:je.melhorCanalSemana.roas,share:1},{canal:"Google",roas:2.1,share:2.1/je.melhorCanalSemana.roas},{canal:"TikTok",roas:1.4,share:1.4/je.melhorCanalSemana.roas},{canal:"Meta Ads (FB)",roas:1.8,share:1.8/je.melhorCanalSemana.roas}],fr=()=>e.jsxs("div",{style:{width:"100%",maxWidth:540,display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between"},children:[e.jsx("h3",{style:{margin:0,fontSize:15,fontWeight:600,color:m.text},children:"ROAS por canal · semana"}),e.jsx("span",{style:{fontSize:11,color:m.textMute},children:"últimos 7 dias"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:hr.map((t,r)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"140px 1fr 56px",gap:12,alignItems:"center"},children:[e.jsx("div",{style:{fontSize:13,color:m.text},children:t.canal}),e.jsx("div",{style:{height:8,borderRadius:999,background:m.surface2,overflow:"hidden"},children:e.jsx("div",{style:{width:`${Math.max(4,Math.min(100,t.share*100))}%`,height:"100%",background:r===0?m.text:m.borderHi,transition:"width .3s"}})}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:r===0?m.text:m.textDim,textAlign:"right"},children:t.roas.toFixed(1)})]},t.canal))}),e.jsxs("div",{style:{marginTop:6,padding:"10px 12px",background:m.surface2,border:`1px solid ${m.border}`,borderRadius:10,fontSize:12,color:m.textDim},children:["Recomendação: realocar 30% do budget pro ",e.jsx("span",{style:{color:m.text,fontWeight:600},children:"Instagram"}),"."]})]}),br=["LTV alto (top 10% da base)","Recompra nos últimos 90 dias","Ticket médio acima de R$ 350","Engajamento em 2+ campanhas"],xr=()=>{const t=je.audiencias.find(r=>r.id==="vip");return e.jsxs("div",{style:{width:"100%",maxWidth:540,display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between"},children:[e.jsxs("h3",{style:{margin:0,fontSize:15,fontWeight:600,color:m.text},children:["Segmento · ",t.nome]}),e.jsx("span",{style:{fontSize:11,color:m.textMute},children:"preview"})]}),e.jsxs("div",{style:{padding:"20px 18px",background:m.surface2,border:`1px solid ${m.border}`,borderRadius:12,display:"flex",flexDirection:"column",gap:4},children:[e.jsx("div",{style:{fontSize:32,fontWeight:600,color:m.text,lineHeight:1.1},children:t.tamanho.toLocaleString("pt-BR")}),e.jsxs("div",{style:{fontSize:12,color:m.textDim},children:["clientes elegÃveis · LTV ",t.ltv]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[e.jsx("div",{style:{fontSize:11,color:m.textMute,textTransform:"uppercase",letterSpacing:.4},children:"Critérios"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:br.map(r=>e.jsx("span",{style:{padding:"4px 10px",borderRadius:999,background:m.surface2,border:`1px solid ${m.border}`,color:m.textDim,fontSize:11},children:r},r))})]})]})},la=["edu","prova","oferta"],wt={edu:"Educativo",prova:"Prova social",oferta:"Oferta"},da={edu:"#3A7BBF",prova:"#5F9F6F",oferta:"#B6883A"},yr=new Set([1,3,5]),vr=()=>{const t=Array.from({length:30},(a,n)=>n+1);let r=0;return e.jsxs("div",{style:{width:"100%",maxWidth:540,display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between"},children:[e.jsx("h3",{style:{margin:0,fontSize:15,fontWeight:600,color:m.text},children:"Calendário · 30 dias"}),e.jsx("span",{style:{fontSize:11,color:m.textMute},children:"3 posts/semana"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:6},children:[["S","T","Q","Q","S","S","D"].map((a,n)=>
3e.jsx("div",{style:{fontSize:10,color:m.textMute,textAlign:"center",padding:"2px 0"},children:a},n)),t.map(a=>{const n=(a-1)%7,i=yr.has(n)?la[r++%la.length]:null;return e.jsxs("div",{style:{aspectRatio:"1 / 1",borderRadius:6,position:"relative",background:m.surface2,border:`1px solid ${m.border}`,display:"flex",flexDirection:"column",justifyContent:"space-between",padding:4},title:i?wt[i]:"",children:[e.jsx("span",{style:{fontSize:9,color:m.textMute},children:a}),i&&e.jsx("div",{style:{height:5,borderRadius:2,background:da[i]}})]},a)})]}),e.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:Object.keys(wt).map(a=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:m.textDim},children:[e.jsx("span",{style:{width:10,height:5,borderRadius:2,background:da[a]}}),wt[a]]},a))})]})};function Sr({flow:t}){switch(t){case"reativacao":case"automacao":return e.jsx(gr,{flow:t});case"relatorio":return e.jsx(fr,{});case"segmento":return e.jsx(xr,{});case"calendario":return e.jsx(vr,{})}}const wr=({open:t,onClose:r,flow:a,cardLabel:n,dataBadgeLabel:d})=>{var O;const[i,x]=p.useState("analyzing"),[g,y]=p.useState([]),[k,B]=p.useState(""),[F,R]=p.useState(!1),T=p.useRef(null),P=p.useRef(!1),E=p.useMemo(()=>a?dr(a):null,[a]);if(p.useEffect(()=>{t||(P.current=!1,x("analyzing"),y([]),B(""),R(!1))},[t]),p.useEffect(()=>{if(!t||!E||P.current)return;P.current=!0,x("analyzing"),y([{id:"m-analyze",role:"agent",text:E.analyzing}]);const v=window.setTimeout(()=>{x("proposing"),y($=>[...$,{id:"m-propose",role:"agent",text:E.proposing}])},900);return()=>window.clearTimeout(v)},[t,E]),p.useEffect(()=>{if(!t)return;const v=$=>{$.key==="Escape"&&r()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[t,r]),p.useEffect(()=>{var v;(v=T.current)==null||v.scrollTo({top:T.current.scrollHeight,behavior:"smooth"})},[g,i]),!t||!a||!E)return null;const z=cr(i,E),C=[n,d].filter(Boolean).join(" · "),q=p.useMemo(()=>{switch(a){case"reativacao":case"automacao":return"Régua de 3 toques (Email · WhatsApp · Push) cobrindo 7 dias.";case"relatorio":return"Relatório ROAS por canal com sugestão de realocação de budget.";case"segmento":return"Segmento VIP por LTV alto com critérios de recompra.";case"calendario":return"Calendário de 30 dias, 3 posts/semana, alternando educativo/prova social/oferta.";default:return""}},[a]),M=p.useCallback(async(v,$)=>{const b=$.filter(X=>X.id!=="m-analyze").map(X=>({role:X.role==="agent"?"assistant":"user",content:X.text})).concat({role:"user",content:v}),{data:w,error:ne}=await Rt.functions.invoke("actionable-chat",{body:{flow:a,cardLabel:n,dataBadgeLabel:d,artifactSummary:q,messages:b,storeSignals:oo()}});if(ne)throw ne;if(w!=null&&w.error)throw new Error(w.error);return w.text},[a,n,d,q]),V=v=>{if(i==="proposing"&&v==="primary"){x("acting"),y($=>[...$,{id:`u-${Date.now()}`,role:"user",text:E.primaryActionLabel},{id:`a-${Date.now()+1}`,role:"agent",text:E.actingNote}]),window.setTimeout(()=>{x("done"),y($=>[...$,{id:`a-${Date.now()+2}`,role:"agent",text:E.doneText}])},1200);return}if(i==="proposing"&&v==="refine"){S(E.refineLabel);return}if(i==="done"&&v==="close"){r();return}if(i==="done"&&v==="next"){S(E.nextStepLabel);return}},S=async v=>{if(F)return;const $=`u-${Date.now()}`;let b=[];y(w=>(b=w,[...w,{id:$,role:"user",text:v}])),R(!0);try{const w=await M(v,b);y(ne=>[...ne,{id:`a-${Date.now()}`,role:"agent",text:w}])}catch(w){console.error("actionable-chat invoke error",w),L.error("Não consegui falar com o agente agora."),y(ne=>[...ne,{id:`a-${Date.now()}`,role:"agent",text:"Tive um problema pra responder agora. Tenta de novo em alguns segundos."}])}finally{R(!1)}},I=()=>{const v=k.trim();!v||F||(B(""),S(v))},H=i==="analyzing"||F,j=(O=[...g].reverse().find(v=>v.role==="agent"))==null?void 0:O.id;return Va.createPortal(e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"rgba(0,0,0,0.6)",display:"flex"},children:e.jsxs("div",{style:{flex:1,display:"grid",gridTemplateColumns:"1fr 420px",background:m.bg,color:m.text,fontFamily:"Inter,system-ui,sans-serif",minWidth:0,minHeight:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"32px",background:m.surface,borderRight:`1px solid ${m.border}`,minWidth:0,minHeight:0,overflow:"auto"},children:[e.jsx(Sr,{flow:a}),i==="acting"&&e.jsxs("div",{style:{position:"absolute",inset:0,background:"rgba(10,10,12,0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:m.text,fontSize:13,pointerEvents:"none"},children:["Aplicando⦠",e.jsx(ca,{})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",background:m.bg,minHeight:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 18px",borderBottom:`1px solid ${m.border}`},children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:m.text},children:"Strategy Agent"}),e.jsx("button",{type:"button",onClick:r,"aria-label":"Fechar",style:{background:"transparent",border:"none",color:m.textDim,padding:6,cursor:"pointer",borderRadius:6,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(Bt,{size:16,weight:"regular"})})]}),e.jsxs("div",{ref:T,style:{flex:1,overflowY:"auto",padding:"24px 20px 12px 20px",display:"flex",flexDirection:"column",gap:16,minHeight:0},children:[C?e.jsxs("div",{style:{alignSelf:"flex-start",display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:999,background:m.surface2,border:`1px solid ${m.border}`,color:m.textDim,fontSize:11,lineHeight:1.3,maxWidth:"100%"},title:C,children:[e.jsx("span",{style:{color:m.textMute}
3,children:"Veio de:"}),e.jsx("span",{style:{color:m.text,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:C})]}):null,H&&e.jsx("div",{style:{color:m.textMute,fontSize:13},children:e.jsx(ca,{})}),g.map(v=>{const $=v.id===j;return v.role==="user"?e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsx("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:14,borderBottomRightRadius:4,background:"#26262E",color:m.text,fontSize:13,lineHeight:1.5,whiteSpace:"pre-wrap"},children:v.text})},v.id):e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start"},children:e.jsxs("div",{style:{maxWidth:"92%",display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:{color:m.text,fontSize:13,lineHeight:1.55,whiteSpace:"pre-wrap"},children:v.text}),$&&z.length>0&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:2},children:z.map(b=>e.jsx("button",{onClick:()=>V(b.id),style:{padding:"7px 12px",borderRadius:999,border:`1px solid ${b.primary?"#FFFFFF":m.border}`,background:b.primary?"#FFFFFF":"transparent",color:b.primary?"#000":m.text,fontSize:12,fontWeight:500,cursor:"pointer"},children:b.label},b.id))}),$&&i==="acting"&&e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,padding:"4px 10px",borderRadius:999,background:m.surface2,border:`1px solid ${m.border}`,fontSize:11,color:m.textDim,marginTop:2},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:999,background:"#E0563A"}}),"em breve · conectar integração"]})]})},v.id)})]}),e.jsx("div",{style:{padding:"12px 16px 16px 16px"},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,background:m.surface2,border:`1.5px solid ${m.border}`,borderRadius:24,padding:8,boxShadow:"0 1px 0 rgba(0,0,0,0.25)"},children:[e.jsx("textarea",{value:k,onChange:v=>{B(v.target.value),v.currentTarget.style.height="auto",v.currentTarget.style.height=Math.min(v.currentTarget.scrollHeight,200)+"px"},onKeyDown:v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),I())},placeholder:"Responda ou peça um ajusteâ¦",rows:3,style:{width:"100%",minHeight:64,maxHeight:200,padding:"2px 4px",border:"none",outline:"none",resize:"none",lineHeight:1.5,background:"transparent",fontFamily:"inherit",fontSize:14,fontWeight:400,color:m.text}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[e.jsx("button",{type:"button","aria-label":"Anexar",title:"Anexar",style:{width:30,height:30,flexShrink:0,borderRadius:999,background:"transparent",color:m.textDim,border:`1px solid ${m.border}`,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx(wa,{size:14,weight:"regular"})}),e.jsx("button",{type:"button",onClick:I,disabled:!k.trim(),"aria-label":"Enviar",style:{width:30,height:30,borderRadius:999,background:k.trim()?"#FFFFFF":m.border,color:k.trim()?"#0E0E10":m.textMute,border:"none",cursor:k.trim()?"pointer":"default",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(xo,{size:14,weight:"bold"})})]})]})})]})]})}),document.body)},ca=()=>e.jsxs("span",{style:{display:"inline-flex",gap:4},children:[e.jsx(At,{delay:0}),e.jsx(At,{delay:150}),e.jsx(At,{delay:300})]}),At=({delay:t})=>e.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:m.textMute,animation:`actionable-pulse 1s ${t}ms infinite ease-in-out`,display:"inline-block"}});if(typeof document<"u"&&!document.getElementById("actionable-keyframes")){const t=document.createElement("style");t.id="actionable-keyframes",t.textContent="@keyframes actionable-pulse { 0%,80%,100%{opacity:.2} 40%{opacity:1} }",document.head.appendChild(t)}const Ke=[{id:"option-01",label:"Produto em cena",description:"Produto em ambiente coerente com a categoria, luz natural.",count:3,thumb:"/templates/studio.svg"},{id:"option-02",label:"Lifestyle com modelo",description:"Pessoa usando ou interagindo com o produto, tom autêntico.",count:3,thumb:"/templates/lifestyle.svg"},{id:"option-03",label:"Close de textura",description:"Detalhe macro do material, foco na tatilidade.",count:2,thumb:"/templates/minimal.svg"},{id:"option-04",label:"Fundo de cor",description:"Fundo sólido em paleta editorial, produto centralizado.",count:2,thumb:"/templates/vibrant.svg"},{id:"option-05",label:"Composição editorial",description:"Arranjo com props e tipografia leve, cara de revista.",count:2,thumb:"/templates/editorial.svg"}],Pe=at.map(t=>
3t.id),Ar=({value:t,onChange:r})=>{const[a,n]=c.useState(!1),d=c.useRef(null);return c.useEffect(()=>{if(!a)return;const i=g=>{d.current&&!d.current.contains(g.target)&&n(!1)},x=setTimeout(()=>document.addEventListener("mousedown",i),0);return()=>{clearTimeout(x),document.removeEventListener("mousedown",i)}},[a]),e.jsxs("div",{ref:d,style:{position:"relative"},children:[e.jsxs("button",{type:"button",onClick:()=>n(i=>!i),style:{width:"100%",background:"#F5F5F5",border:"none",borderRadius:10,padding:"12px 14px",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",fontFamily:"inherit",fontSize:13,color:"#1A1A1A"},children:[e.jsx("span",{style:{color:"#6B6B6B"},children:"Formato"}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontWeight:500},children:[e.jsx(et,{ratioId:t,size:12}),t]})]}),a&&e.jsx(Aa,{placement:"up",align:"end",minWidth:160,zIndex:90,value:t,aspectRatio:!0,options:at.map(i=>({id:i.id,label:i.label,leftIcon:e.jsx(et,{ratioId:i.id,size:14})})),onPick:i=>{r(i),n(!1)}})]})};function jr(t){var n;const r=((n=t.name)==null?void 0:n.toLowerCase())??"",a=(t.category??"").toLowerCase();return/(t[eê]nis|cal[çc]ado|sand[aá]lia|chinelo)/.test(r)||/verao|summer|cal[çc]ado/.test(a)?"Vamos transformar seu produto em uma sequência de imagens que valoriza e transmite a energia do verão com o conforto do produto.":/beb[eê]|body|infantil|kid/.test(r+" "+a)?"Preparei uma sequência que traduz o cuidado e a leveza que o público infantil pede.":/joia|colar|anel|brinco|pulseira|rel[oó]gio/.test(r+" "+a)?"Pensei uma sequência que valoriza o brilho e o acabamento do produto em contextos elegantes.":/skin|beleza|s[eé]rum|batom|hidrat|perfume|cosm/.test(r+" "+a)?"Montei uma sequência que destaca textura e ritual de uso, com estética clean de beleza.":/moda|vestido|jaqueta|camisa|cal[çc]a|casaco|bolsa/.test(r+" "+a)?"Preparei uma sequência editorial que mostra o caimento e o styling do produto em situações reais.":"Analisei seu produto e preparei uma sequência de imagens pensada pra destacar o que ele tem de melhor."}function kr({open:t,product:r,onClose:a,onApprove:n}){const[d,i]=c.useState(!0),[x,g]=c.useState(""),[y,k]=c.useState({}),[B,F]=c.useState(null),[R,T]=c.useState(()=>Math.max(0,Pe.indexOf("3:4")));c.useEffect(()=>{if(!t||!r)return;i(!0),g(r.images[0]??""),k(Object.fromEntries(Ke.map(I=>[I.id,!0]))),F(null),T(Math.max(0,Pe.indexOf("3:4")));const S=setTimeout(()=>i(!1),1500);return()=>clearTimeout(S)},[t,r==null?void 0:r.id]),c.useEffect(()=>{if(!t)return;const S=I=>{I.key==="Escape"&&a()};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[t,a]);const P=c.useMemo(()=>r?jr(r):"",[r]),E=c.useMemo(()=>Ke.reduce((S,I)=>S+(y[I.id]?I.count:0),0),[y]),z=Math.ceil(E*7),C=E>0,q=c.useCallback(S=>{k(I=>({...I,[S]:!I[S]}))},[]),M=c.useCallback(()=>{!r||!C||n({product:r,selectedImage:x||r.images[0]||"",aspectRatio:Pe[R],options:Ke.filter(S=>y[S.id])})},[r,C,x,R,y,n]);if(!t||!r)return null;const V=r.images.length>1;return e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Agente criativo",onClick:a,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:24,animation:"fade-in 0.2s ease-out"},children:e.jsxs("div",{onClick:S=>S.stopPropagation(),style:{background:"#FFFFFF",borderRadius:16,width:"min(960px, 100%)",maxHeight:"min(720px, 92vh)",overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"inherit",boxShadow:"0 20px 60px rgba(0,0,0,0.24)",animation:"scale-in 0.18s ease-out"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 24px",borderBottom:"1px solid #EDEDED"},children:[e.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:500,letterSpacing:"-0.01em",color:"#1A1A1A"},children:"Creative agent"}),e.jsx("button",{type:"button",onClick:a,"aria-label":"Fechar",style:{background:"transparent",border:"none",cursor:"pointer",padding:4,color:"#6B6B6B",display:"flex"},children:e.jsx(Bt,{size:18})})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:24,padding:24,overflow:"auto",flex:1},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{style:{background:"#F5F5F5",borderRadius:12,aspectRatio:"1 / 1",width:"100%",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},children:x?e.jsx("img",{src:x,alt:r.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):null}),V&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:8},children:r.images.slice(0,4).map(S=>{const I=S===x;return e.jsx("button",{type:"button",onClick:()=>g(S),style:{background:"#F5F5F5",border:I?"2px solid #1A1A1A":"1px solid #EDEDED",borderRadius:8,padding:0,aspectRatio:"1 / 1",overflow:"hidden",cursor:"pointer"},children:e.jsx("img",{src:S,alt:"",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},S)})})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[d?e.jsx("div",{style:{fontSize:12,color:"#9B9B9B",letterSpacing:"-0.005em"},className:"animate-pulse",children:"Thinking..."}):e.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"#1A1A1A",margin:0,letterSpacing:"-0.005em"},className:"animate-fade-in",children:P},"intro"),!d&&e.jsx("div",{className:"animate-fade-in",style:{display:"flex",flexDirection:"column",gap:2},children:Ke.map((S,I)=>{const H=!!y[S.id],j=B===S.id;return e.jsxs("div",{style:{borderTop:I===0?"1px solid #EDEDED":"none",borderBottom:"1px solid #EDEDED"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"10px 2px"},children:[e.jsxs("button",{type:"button",onClick:()=>q(S.id),"aria-pressed":H,style:{flex:1,textAlign:"left",background:"transparent",border:"none",cursor:"pointer",padding:0,fontFamily:"inherit",fontSize:13,color:"#1A1A1A",opacity:H?1:.35,letterSpacing:"-0.005em",display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{width:28,height:28,borderRadius:6,background:"#F5F5F5",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("img",{src:S.thumb,alt:"",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),S.label]}),e.jsx("button",{type:"button",onClick:()=>F(j?null:S.id),"aria-label":j?"Recolher":"Expandir",style:{background:"transparent",border:"none",cursor:"pointer",color:"#6B6B6B",padding:4,display:"flex"},children:j?e.jsx(ro,{size:16}):e.jsx(Qa,{size:16})})]}),j&&e.jsxs("div",{className:"animate-fade-in",style:{padding:"0 2px 10px",fontSize:12,color:"#6B6B6B",lineHeight:1.5,letterSpacing:"-0.005em"},children:[S.description," · ",S.count," imagens"]})]},S.id)})}),!d&&e.jsxs("div",{className:"animate-fade-in",style:{marginTop:"auto",display:"flex",flexDirection:"column",gap:10},children:[e.jsx(Ar,{value:Pe[R],onChange:S=>{const I=Pe.indexOf(S);I>=0&&T(I)}}),e.jsx("button",{className:"snew-main-action",type:"button",onClick:M,disabled:!C,style:{border:"none",borderRadius:999,padding:"14px 20px",fontFamily:"inherit",fontSize:14,fontWeight:500,cursor:C?"pointer":"not-allowed",letterSpacing:"-0.005em"},children:"Aprovar"}),e.jsx("div",{style:{textAlign:"center",fontSize:12,color:"#9B9B9B",letterSpacing:"-0.005em"},children:C?`${E} imagens · ${z} créditos`:"Selecione pelo menos um preset"})]})]})]})]})})}const ua=4,Cr="option-01",ze=at.map(t=>
3t.id),Br=({value:t,onChange:r})=>{const[a,n]=c.useState(!1),d=c.useRef(null);return c.useEffect(()=>{if(!a)return;const i=g=>{d.current&&!d.current.contains(g.target)&&n(!1)},x=setTimeout(()=>document.addEventListener("mousedown",i),0);return()=>{clearTimeout(x),document.removeEventListener("mousedown",i)}},[a]),e.jsxs("div",{ref:d,style:{position:"relative"},children:[e.jsxs("button",{type:"button",onClick:()=>n(i=>!i),style:{width:"100%",background:"#F5F5F5",border:"none",borderRadius:10,padding:"12px 14px",display:"flex",alignItems:"center",justifyContent:"space-between",cursor:"pointer",fontFamily:"inherit",fontSize:13,color:"#1A1A1A"},children:[e.jsx("span",{style:{color:"#6B6B6B"},children:"Formato"}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontWeight:500},children:[e.jsx(et,{ratioId:t,size:12}),t]})]}),a&&e.jsx(Aa,{placement:"up",align:"end",minWidth:160,zIndex:90,value:t,aspectRatio:!0,options:at.map(i=>({id:i.id,label:i.label,leftIcon:e.jsx(et,{ratioId:i.id,size:14})})),onPick:i=>{r(i),n(!1)}})]})};function Rr({open:t,style:r,products:a,onClose:n,onApprove:d}){const[i,x]=c.useState(!0),[g,y]=c.useState("product"),[k,B]=c.useState(null),[F,R]=c.useState(null),[T,P]=c.useState(null),[E,z]=c.useState(""),[C,q]=c.useState(()=>Math.max(0,ze.indexOf("3:4"))),M=c.useRef(null);c.useEffect(()=>{var w;if(!t||!r)return;x(!0),y("product"),B(null),R(null),P(((w=a[0])==null?void 0:w.id)??null),z(""),q(Math.max(0,ze.indexOf("3:4")));const b=setTimeout(()=>x(!1),1200);return()=>clearTimeout(b)},[t,r==null?void 0:r.id]),c.useEffect(()=>{if(!t)return;const b=w=>{w.key==="Escape"&&n()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[t,n]);const V=ua,S=Math.ceil(V*7),I=c.useMemo(()=>a.find(b=>b.id===T)??null,[a,T]),H=c.useMemo(()=>{const b=E.trim().toLowerCase();return b?a.filter(w=>w.name.toLowerCase().includes(b)):a},[a,E]),j=g==="upload"&&!!k||g==="product"&&!!I,O=j,v=b=>{if(!b)return;const w=new FileReader;w.onload=()=>{B(String(w.result)),R(b.name),y("upload")},w.readAsDataURL(b)},$=c.useCallback(()=>{if(!r||!O)return;const b=g==="upload"&&k?{kind:"upload",imageUrl:k,name:F??void 0}:I?{kind:"product",product:I}:null;b&&d({style:r,source:b,aspectRatio:ze[C],options:[{id:Cr,label:r.title,description:"",count:ua}]})},[r,O,g,k,F,I,C,d]);return!t||!r?null:e.jsx("div",{role:"dialog","aria-modal":"true","aria-label":"Aplicar preset",onClick:n,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.55)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:24,animation:"fade-in 0.2s ease-out"},children:e.jsxs("div",{onClick:b=>b.stopPropagation(),style:{background:"#FFFFFF",borderRadius:16,width:"min(960px, 100%)",maxHeight:"min(720px, 92vh)",overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"inherit",boxShadow:"0 20px 60px rgba(0,0,0,0.24)",animation:"scale-in 0.18s ease-out"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"18px 24px",borderBottom:"1px solid #EDEDED"},children:[e.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:500,letterSpacing:"-0.01em",color:"#1A1A1A"},children:"Creative agent"}),e.jsx("button",{type:"button",onClick:n,"aria-label":"Fechar",style:{background:"transparent",border:"none",cursor:"pointer",padding:4,color:"#6B6B6B",display:"flex"},children:e.jsx(Bt,{size:18})})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"220px 1fr",gap:24,padding:24,overflow:"auto",flex:1},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{style:{background:"#F5F5F5",borderRadius:12,aspectRatio:"1 / 1",width:"100%",overflow:"hidden",position:"relative"},children:e.jsx("div",{style:{position:"absolute",inset:0,background:`url(${r.cover}) center/cover`}})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[e.jsx("span",{style:{fontSize:14,fontWeight:500,color:"#1A1A1A",letterSpacing:"-0.005em"},children:r.title}),r.sub&&e.jsx("span",{style:{fontSize:12,color:"#6B6B6B",lineHeight:1.5,letterSpacing:"-0.005em"},children:r.sub})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[i?e.jsx("div",{style:{fontSize:12,color:"#9B9B9B",letterSpacing:"-0.005em"},className:"animate-pulse",children:"Thinking..."}):e.jsxs("p",{style:{fontSize:14,lineHeight:1.5,color:"#1A1A1A",margin:0,letterSpacing:"-0.005em"},className:"animate-fade-in",children:["Escolha uma imagem ou um produto pra aplicar o preset ",e.jsx("strong",{children:r.title}),"."]}),!i&&e.jsxs("div",{className:"animate-fade-in",style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6,background:"#F5F5F5",borderRadius:10,padding:4},children:[{id:"product",label:"Escolher produto",icon:e.jsx(vo,{size:14})},{id:"upload",label:"Carregar imagem",icon:e.jsx(ea,{size:14})}].map(b=>
3{const w=g===b.id;return e.jsxs("button",{type:"button",onClick:()=>y(b.id),style:{background:w?"#FFFFFF":"transparent",border:"none",borderRadius:8,padding:"8px 10px",fontSize:13,fontFamily:"inherit",fontWeight:w?500:400,color:w?"#1A1A1A":"#6B6B6B",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,boxShadow:w?"0 1px 2px rgba(0,0,0,0.06)":"none"},children:[b.icon,b.label]},b.id)})}),g==="product"?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,minHeight:0},children:[e.jsx(So,{value:E,onChange:z,placeholder:"Buscar produto..."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:8,maxHeight:380,overflowY:"auto",paddingRight:2},children:[H.map(b=>{const w=b.id===T;return e.jsx("button",{type:"button",onClick:()=>P(b.id),title:b.name,style:{background:"#F5F5F5",border:w?"2px solid #1A1A1A":"1px solid #EDEDED",borderRadius:8,padding:0,aspectRatio:"1 / 1",overflow:"hidden",cursor:"pointer"},children:e.jsx("img",{src:b.image,alt:b.name,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})},b.id)}),H.length===0&&e.jsx("div",{style:{gridColumn:"1 / -1",textAlign:"center",padding:"16px 0",fontSize:12,color:"#9B9B9B"},children:"Nenhum produto encontrado"})]})]}):e.jsxs("div",{children:[e.jsx("input",{ref:M,type:"file",accept:"image/*",onChange:b=>{var w;return v(((w=b.target.files)==null?void 0:w[0])??null)},style:{display:"none"}}),k?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{width:64,height:64,borderRadius:8,overflow:"hidden",background:"#F5F5F5"},children:e.jsx("img",{src:k,alt:"upload",style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}})}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},children:[e.jsx("span",{style:{fontSize:13,color:"#1A1A1A",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:F??"imagem carregada"}),e.jsx("button",{type:"button",onClick:()=>{var b;return(b=M.current)==null?void 0:b.click()},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:12,color:"#6B6B6B",textAlign:"left"},children:"Trocar imagem"})]})]}):e.jsxs("button",{type:"button",onClick:()=>{var b;return(b=M.current)==null?void 0:b.click()},style:{width:"100%",background:"#F5F5F5",border:"1px dashed #D4D4D4",borderRadius:10,padding:"18px 14px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:8,fontFamily:"inherit",fontSize:13,color:"#6B6B6B"},children:[e.jsx(ea,{size:16}),"Selecionar imagem do computador"]})]})]}),!i&&e.jsxs("div",{className:"animate-fade-in",style:{marginTop:"auto",display:"flex",flexDirection:"column",gap:10},children:[e.jsx(Br,{value:ze[C],onChange:b=>{const w=ze.indexOf(b);w>=0&&q(w)}}),e.jsx("button",{className:"snew-main-action",type:"button",onClick:$,disabled:!O,style:{border:"none",borderRadius:999,padding:"14px 20px",fontFamily:"inherit",fontSize:14,fontWeight:500,cursor:O?"pointer":"not-allowed",letterSpacing:"-0.005em"},children:"Aprovar"}),e.jsx("div",{style:{textAlign:"center",fontSize:12,color:"#9B9B9B",letterSpacing:"-0.005em"},children:j?`${V} imagens · ${S} créditos`:"Escolha uma imagem ou produto"})]})]})]})]})})}const Er=[{id:"fashion-editorial",styleId:"fashion-editorial",headline:"Editorial de estúdio",sugestao:"vamos levar sua peça pra um editorial de estúdio?",sugestaoDinamica:"vamos levar {peca} pra um editorial de estúdio?",clima:"estudio",abertura:"vamos"},{id:"attitude-fashion",styleId:"attitude-fashion",headline:"Pose de atitude",sugestao:"que tal sua peça num editorial de pura atitude?",sugestaoDinamica:"que tal {peca} num editorial de pura atitude?",clima:"estudio",abertura:"que_tal"},{id:"seated-editorial",styleId:"seated-editorial",headline:"Editorial sentado",sugestao:"o que acha de sua peça num retrato sentado de corpo inteiro?",sugestaoDinamica:"o que acha de {peca} num retrato sentado de corpo inteiro?",clima:"estudio",abertura:"o_que_acha"},{id:"monochrome",styleId:"monochrome",headline:"Tom sobre tom",sugestao:"vamos mergulhar sua peça num mundo tom sobre tom?",sugestaoDinamica:"vamos mergulhar {peca} num mundo tom sobre tom?",clima:"estudio",abertura:"vamos"},{id:"rooftop-attitude",styleId:"rooftop-attitude",headline:"Atitude no terraço",sugestao:"que tal sua peça num ângulo baixo lá no terraço?",sugestaoDinamica:"que tal {peca} num ângulo baixo lá no terraço?",clima:"rua",abertura:"que_tal"},{id:"top-view-crossing",styleId:"top-view-crossing",headline:"Flagra na faixa",sugestao:"o que acha de sua peça num flagra visto de cima na faixa?",sugestaoDinamica:"o que acha de {peca} num flagra visto de cima na faixa?",clima:"rua",abertura:"o_que_acha"},{id:"inside-bag-pov",styleId:"inside-bag-pov",headline:"Dentro da sacola",sugestao:"vamos ver sua peça caindo dentro da sacola?",sugestaoDinamica:"vamos ver {peca} caindo dentro da sacola?",clima:"imersivo",abertura:"vamos"},{id:"inside-backpack-pov",styleId:"inside-backpack-pov",headline:"Dentro da mochila",sugestao:"que tal sua peça descendo pela mochila aberta?",sugestaoDinamica:"que tal {peca}
3 descendo pela mochila aberta?",clima:"imersivo",abertura:"que_tal"},{id:"brazilian-core",styleId:"brazilian-core",headline:"Verão brasileiro",sugestao:"o que acha de sua peça num verão brasileiro de sol forte?",sugestaoDinamica:"o que acha de {peca} num verão brasileiro de sol forte?",clima:"solar",abertura:"o_que_acha"},{id:"hanger",styleId:"hanger",headline:"Peça no céu",sugestao:"vamos pendurar sua peça no céu com movimento?",sugestaoDinamica:"vamos pendurar {peca} no céu com movimento?",clima:"solar",abertura:"vamos"}];function Ir(){const t="snew_home_suggestions_seed";try{const r=sessionStorage.getItem(t);if(r)return Number(r);const a=Math.floor(Math.random()*1e6);return sessionStorage.setItem(t,String(a)),a}catch{return Math.floor(Math.random()*1e6)}}function Dr(t,r){const a=[...t];let n=r;for(let d=a.length-1;d>0;d--){n=(n*9301+49297)%233280;const i=Math.floor(n/233280*(d+1));[a[d],a[i]]=[a[i],a[d]]}return a}function Fr(){const t=Dr(Er,Ir()),r=[],a=new Set,n={};for(const d of t){if(r.length===4)break;a.has(d.clima)||(n[d.abertura]??0)>=2||(r.push(d),a.add(d.clima),n[d.abertura]=(n[d.abertura]??0)+1)}if(r.length<4)for(const d of t){if(r.length===4)break;r.includes(d)||a.has(d.clima)||(r.push(d),a.add(d.clima))}return r}function Tr(){return e.jsx("div",{"aria-hidden":"true","data-testid":"product-card-skeleton",children:e.jsx($e,{className:"aspect-square",style:{width:"100%",borderRadius:me.homeCard,border:"1px solid hsl(var(--border))"}})})}const Lr="snew:boards:pinned:v1";async function Ba(t){const{data:r,error:a}=await Rt.auth.getUser();if(a||!r.user)throw new Error("AUTH_REQUIRED");return{boardId:t,userId:r.user.id}}function Pr(t,r){const a=t.nodes.filter(d=>{const i=d.data,x=i==null?void 0:i.finalUiAsset;return(i==null?void 0:i.state)!=="queued"&&(i==null?void 0:i.state)!=="generating"&&(x==null?void 0:x.generationState)!=="generating"&&(x==null?void 0:x.isPlaceholder)!==!0}),n=new Set(a.map(d=>d.id));return{...structuredClone(t),finalUiTitle:r,nodes:a,edges:t.edges.filter(d=>{const i=d;return(!i.source||n.has(String(i.source)))&&(!i.target||n.has(String(i.target)))})}}async function zr(t,r){const a=r.trim();if(!a)throw new Error("BOARD_TITLE_REQUIRED");const n=await Ba(t),d=await tt.read(n);return tt.save(n,{id:crypto.randomUUID(),expectedRevision:d.updated_at,snapshot:{...d.snapshot,finalUiTitle:a}})}async function Mr(t,r){const a=await Ba(t),n=await tt.read(a),d=crypto.randomUUID(),i=r.trim()||n.title,x=await Oo(d,i),g={...a,boardId:d};return await tt.save(g,{id:crypto.randomUUID(),expectedRevision:x.updated_at,snapshot:Pr(n.snapshot,i)}),{id:d,title:i}}function Ra(t){return`${Lr}:${t}`}function Xe(t){if(!t||typeof window>"u")return new Set;try{const r=JSON.parse(window.localStorage.getItem(Ra(t))??"[]");return new Set(Array.isArray(r)?r.filter(a=>typeof a=="string"):[])}catch{return new Set}}function $r(t,r,a){const n=Xe(t);a?n.add(r):n.delete(r),window.localStorage.setItem(Ra(t),JSON.stringify([...n])),window.dispatchEvent(new CustomEvent(ja))}const Nr=2500,Or=12;function _r({storeId:t,platform:r,catalogFingerprint:a,refetchCatalog:n}){const[d,i]=c.useState("idle"),[x,g]=c.useState(null),y=c.useRef(!1),k=c.useRef(a),B=c.useCallback(async()=>{if(!t||!r)throw new yt("STORE_NOT_FOUND","Conecte uma loja para sincronizar o catálogo.");if(!y.current){y.current=!0,k.current=a,g(null),i("requesting");try{Ya();const F=await Rt.functions.invoke(r==="shopify"?"shopify-sync":"nuvemshop-sync",{body:{storeId:t}});await ho(F),i("polling")}catch(F){const R=F instanceof yt?F:new yt("LOCAL_CONFIGURATION_ERROR","Não foi possÃvel iniciar a sincronização do catálogo.");throw g(R),i("error"),R}finally{y.current=!1}}},[a,r,t]);return c.useEffect(()=>{d==="polling"&&a!==k.current&&i("idle")},[a,d]),c.useEffect(()=>{if(d!=="polling")return;let F=!0,R=0,T;const P=async()=>{try{await n()}catch{}if(R+=1,!!F){if(R>=Or){i("idle");return}T=window.setTimeout(()=>{P()},Nr)}};return P(),()=>{F=!1,T!==void 0&&window.clearTimeout(T)}},[n,d]),{error:x,status:d,syncing:d==="requesting"||d==="polling",sync:B}}function pa(t){return t.dataUrl.startsWith("data:image/")?qo(t)?{ok:!0}:{ok:!1,reason:"Não foi possÃvel preparar esta imagem para o Board. Use PNG, JPEG ou WebP de até 10 MB."}:{ok:!1,reason:"Envie um arquivo de imagem (PNG, JPEG ou WebP)."}}
3const ma=4,Je=8,ga={height:1,background:"hsl(var(--border))",margin:`0 0 ${se.titleGap}`},qr={en:["What idea do you want to bring to life today?","What do you want to create to start the week?","Which product do you want to sell more of?","Which product deserves a new scene?","What do you want to create today?","Which product do you want to spotlight this weekend?","What does your brand need to show right now?"],"pt-BR":["Que ideia você quer tirar do papel hoje?","O que você quer criar para começar a semana?","Qual produto você quer vender mais?","Que produto merece uma nova cena?","O que você quer criar hoje?","Qual produto você quer colocar em destaque neste fim de semana?","O que sua marca precisa mostrar agora?"]};function ha(t,r,a){return{greeting:go(t,r,void 0,a),question:qr[a][t.getDay()]}}const Me="https://images.unsplash.com/photo-1441986300917-64674bd600d8?auto=format&fit=crop&w=800&q=80";function Hr(t,r){const a=H=>t.audiencias.find(j=>j.id===H),n=r.bestSeller,d=r.encalhado,i=r.fotoFraca,x=r.margemBaixa,g=a("maes"),y=a("vip"),k=a("inativos"),B=[];t.proximaData&&t.proximaData.emDias<=30&&(B.push({id:"sg-data",label:`Campanha de ${t.proximaData.nome}`,briefing:`${g.tamanho.toLocaleString("pt-BR")} mães na sua base esperando.`,prompt:`Campanha de ${t.proximaData.nome} com tom afetivo, voltada à audiência de mães da base.`,dataBadge:{label:`em ${t.proximaData.emDias} dias`,tone:"urgent"},kind:"criativo",brief:{purpose:"vendas",occasion:t.proximaData.nome,audienceId:g.id,tipo_acao:"campanha"}}),B.push({id:"sg-data-aqueca",label:`Aqueça a base pro ${t.proximaData.nome}`,briefing:`Sequência de e-mail/WhatsApp pras ${g.tamanho.toLocaleString("pt-BR")} mães.`,prompt:"",dataBadge:{label:`em ${t.proximaData.emDias} dias`,tone:"urgent"},kind:"acionavel",flow:"automacao"}));const F=[{id:"mk-edu",label:"Post educativo da semana",briefing:"Ensine algo sobre seu produto.",prompt:"Post educativo sobre o produto em linguagem simples.",kind:"criativo",brief:{purpose:"awareness"}},{id:"mk-car",label:"Carrossel de dicas",briefing:"5 dicas práticas em carrossel.",prompt:"Carrossel de 5 slides com dicas práticas relacionadas ao produto.",kind:"criativo"},{id:"mk-cal",label:"Calendário de 30 dias",briefing:"Plano de conteúdo do mês.",prompt:"",kind:"acionavel",flow:"calendario"}],R=[];t.melhorCanalSemana&&t.melhorCanalSemana.roas>=3&&R.push({id:"mk-canal",label:`Concentre no ${t.melhorCanalSemana.canal}`,briefing:`ROAS ${t.melhorCanalSemana.roas} â recomendação de budget.`,prompt:"",dataBadge:{label:`ROAS ${t.melhorCanalSemana.roas}`,tone:"positive"},kind:"acionavel",flow:"relatorio"}),R.push({id:"mk-story",label:"Story interativo",briefing:"Enquete ou quiz.",prompt:"Story 9:16 com enquete interativa, visual chamativo.",kind:"criativo"});const T=[];n.vendasSemana>=50&&T.push({id:"sg-campeao-alta",label:`Surfe na alta do ${n.nome}`,briefing:`Seu best-seller, ${n.vendasSemana} vendas essa semana.`,prompt:`Criativo de upsell aproveitando a alta do ${n.nome}, tom confiante.`,dataBadge:{label:`${n.vendasSemana} vendas`,tone:"positive"},kind:"criativo",brief:{productId:n.id,purpose:"vendas",tipo_acao:"upsell"}}),n.bestSeller&&d.tendencia==="baixa"&&d.estoque==="alto"&&T.push({id:"sg-bundle",label:`Bundle ${n.nome} + ${d.nome}`,briefing:`Gira o campeão com o ${d.nome} parado.`,prompt:`Criativo de bundle ${n.nome} + ${d.nome} pra girar estoque.`,dataBadge:{label:"gira estoque",tone:"positive"},kind:"criativo",brief:{productId:n.id,tipo_acao:"bundle"}});const P=[{id:"vd-carrinho",label:"Recupere carrinhos abandonados",briefing:"Ative a régua de carrinho.",prompt:"",kind:"acionavel",flow:"automacao"},{id:"sg-inativos",label:"Traga de volta os inativos",briefing:`${k.tamanho.toLocaleString("pt-BR")} sumidos há 60 dias.`,prompt:"",dataBadge:{label:`${k.tamanho.toLocaleString("pt-BR")} inativos`,tone:"urgent"},kind:"acionavel",flow:"reativacao"}],E=[{id:"sg-vip",label:"Régua exclusiva pros VIP",briefing:`${y.tamanho} clientes de alto valor.`,prompt:"",dataBadge:{label:`${y.tamanho} VIP`,tone:"positive"},kind:"acionavel",flow:"segmento"},{id:"vd-recompra",label:"Oferta de recompra",briefing:"Pós-entrega, no timing certo.",prompt:"Criativo de oferta de recompra pós-entrega, tom próximo.",kind:"criativo",brief:{purpose:"retencao"}}],z=[];
3x.margem==="ruim"&&z.push({id:"sg-margem-baixa",label:`Cuidado com a margem da ${x.nome}`,briefing:"Margem apertada â segure o desconto antes de promover.",prompt:"",dataBadge:{label:"margem baixa",tone:"warning"},kind:"acionavel",flow:"relatorio"});const C=[];i.foto==="ruim"&&C.push({id:"sg-foto-fraca",label:`Refaça a foto da ${i.nome}`,briefing:`Vende bem (${i.vendasSemana}/sem) mas tem a foto mais fraca do catálogo.`,prompt:`Refazer foto base da ${i.nome} com qualidade editorial antes de divulgar.`,dataBadge:{label:"foto fraca",tone:"warning"},kind:"criativo",brief:{productId:i.id,purpose:"divulgacao",tipo_acao:"diagnostico_asset"}});const q=[{id:"ds-studio",label:"Foto de produto limpa",briefing:"Studio branco pro catálogo.",prompt:"Foto de produto em estúdio fundo branco, iluminação suave.",kind:"criativo",brief:{purpose:"divulgacao"}},{id:"sg-campeao-lifestyle",label:`Lifestyle do ${n.nome}`,briefing:"Seu campeão fora do fundo branco.",prompt:`Foto lifestyle do ${n.nome} em ambiente real, mood editorial.`,kind:"criativo",brief:{productId:n.id,purpose:"awareness",tipo_acao:"variacao_angulo"}},{id:"ds-macro",label:"Detalhe macro",briefing:"Close na textura.",prompt:"Foto macro do produto destacando textura, materiais e acabamento.",kind:"criativo"}],M=[{id:"ds-ad-beneficio",label:"Ad de benefÃcio",briefing:"Direto ao benefÃcio principal.",prompt:"Anúncio direto ao benefÃcio principal do produto com CTA claro.",kind:"criativo"},{id:"ds-ad-prova",label:"Ad prova social",briefing:"Usando depoimento real.",prompt:"Anúncio com depoimento em destaque + foto do produto.",kind:"criativo"}],V=[{id:"ds-9x16",label:"Adapte pro Stories/Reels",briefing:"Seus criativos em 9:16.",prompt:"Adaptar criativos existentes para 9:16 mantendo legibilidade.",kind:"criativo"},{id:"ds-kit",label:"Kit de formatos por canal",briefing:"1:1, 4:5, 9:16, 16:9.",prompt:"Gerar kit do criativo nos formatos 1:1, 4:5, 9:16 e 16:9.",kind:"criativo"}],S=H=>[...H].sort((j,O)=>{var b,w;const v=((b=j.dataBadge)==null?void 0:b.tone)==="urgent"?0:1,$=((w=O.dataBadge)==null?void 0:w.tone)==="urgent"?0:1;return v-$}),I=H=>H.filter(j=>j.items.length>0);return{marketing:I([{title:"Pra agora",items:S(B)},{title:"Conteúdo",items:F}
3,{title:"Alcance & canais",items:R}]),vendas:I([{title:"Aproveitar o que vende",items:S(T)},{title:"Recuperar receita",items:P},{title:"Fidelizar",items:E},{title:"Preço & margem",items:z}]),design:I([{title:"Resolver antes de divulgar",items:S(C)},{title:"Imagens de produto",items:q},{title:"Criativos de anúncio",items:M},{title:"Formatos & adaptação",items:V}])}}function Wr({variant:t="default"}={}){var Gt,Zt,Qt,Yt;const r=jt(),{lang:a}=kt(),{user:n,loading:d}=Sa(),i=t==="home5",x=i,g=p.useMemo(()=>{var o;return((o=Po())==null?void 0:o.name)??null},[]),y=n?Ae(n):null,{boards:k,total:B,status:F}=zo(g,y,"active",ma-1),[R,T]=p.useState(null),[P,E]=p.useState(()=>Xe(n==null?void 0:n.id));p.useEffect(()=>{E(Xe(n==null?void 0:n.id))},[n==null?void 0:n.id]);const z=p.useMemo(()=>[...k].sort((o,s)=>{const l=P.has(o.id)?1:0;return(P.has(s.id)?1:0)-l}),[k,P]),C=p.useCallback(o=>`/board?${new URLSearchParams({boardId:o.id,boardTitle:o.title}).toString()}`,[]),q=p.useCallback(o=>r(C(o),{state:{openBoard:!0,boardId:o.id,boardTitle:o.title,_ts:Date.now()}}),[C,r]),M=p.useCallback(async(o,s,l)=>{T(o.id);try{await s(),window.dispatchEvent(new CustomEvent(ja)),L.success(l)}catch{L.error(a==="pt-BR"?"Não foi possÃvel concluir esta ação.":"This action could not be completed.")}finally{T(null)}},[a]),V=p.useCallback((o,s)=>M(o,async()=>{if(vt){if(!y)throw new Error("BOARD_UNAVAILABLE");Mo(y,o.id,s)}else await zr(o.id,s)},a==="pt-BR"?"Board renomeado":"Board renamed"),[y,a,M]),S=p.useCallback(o=>M(o,async()=>{const s=a==="pt-BR"?`${o.title} â cópia`:`${o.title} â copy`;if(vt){if(!y)throw new Error("BOARD_UNAVAILABLE");await $o(y,o.id,s)}else await Mr(o.id,s)},a==="pt-BR"?"Board duplicado":"Board duplicated"),[y,a,M]),I=p.useCallback(o=>{if(window.confirm(a==="pt-BR"?`Excluir â${o.title}â? Esta ação não pode ser desfeita.`:`Delete â${o.title}â? This action cannot be undone.`))return M(o,async()=>{if(vt){if(!y)throw new Error("BOARD_UNAVAILABLE");No(y,o.id)}else await _o(o.id,"delete")},a==="pt-BR"?"Board excluÃdo":"Board deleted")},[y,a,M]),H=p.useCallback(async o=>{var l;const s=new URL(C(o),window.location.origin).href;try{if(!((l=navigator.clipboard)!=null&&l.writeText))throw new Error("CLIPBOARD_UNAVAILABLE");await navigator.clipboard.writeText(s),L.success(a==="pt-BR"?"Link copiado":"Link copied")}catch{const u=document.createElement("textarea");u.value=s,u.style.position="fixed",u.style.opacity="0",document.body.appendChild(u),u.select();let f=!1;try{f=document.execCommand("copy")}catch{f=!1}finally{u.remove()}f?L.success(a==="pt-BR"?"Link copiado":"Link copied"):L.error(a==="pt-BR"?"Não foi possÃvel copiar o link.":"The link could not be copied.")}},[C,a]),j=p.useCallback(o=>{if(!(n!=null&&n.id))return;const s=!P.has(o.id);$r(n.id,o.id,s),E(Xe(n.id)),L.success(a==="pt-BR"?s?"Board fixado":"Board desafixado":s?"Board pinned":"Board unpinned")},[a,P,n==null?void 0:n.id]),O=no(),v=(n==null?void 0:n.id)??null,$=(n==null?void 0:n.teamId)??null,b=!!(n!=null&&n.activeStore),w=((Gt=n==null?void 0:n.activeStore)==null?void 0:Gt.id)??null,ne=((Zt=n==null?void 0:n.activeStore)==null?void 0:Zt.name)??null,X=((Qt=n==null?void 0:n.activeStore)==null?void 0:Qt.source)??null,Ne=((Yt=n==null?void 0:n.activeStore)==null?void 0:Yt.lastSyncedAt)??null,Et=n==null?void 0:n.profile.catalogSource,Ea=p.useMemo(()=>v?{userId:v,teamId:$,store:b?{id:w,name:ne,source:X,lastSyncedAt:Ne}:null,catalogSource:Et}:null,[v,$,b,w,ne,X,Ne,Et]),{products:_,origin:K,loading:ot,error:xe,connectedStoreState:ye,recommendationStore:G,refetch:rt}=io({realDataOnly:!0,authenticatedScope:Ea}),ie=ot&&_.length===0,Oe=X==="shopify"||X==="nuvemshop"?X:null,Ia=p.useMemo(()=>_.map(o=>`${o.product_id}:${o.updated_at??""}`).join("|"),[_]),ge=_r({storeId:Oe?w:null,platform:Oe,catalogFingerprint:Ia,refetchCatalog:rt}),nt=p.useMemo(()=>(K==="url"?_.slice(0,10):_).map(o=>({id:o.product_id,nome:o.name,vendasSemana:0,tendencia:"estável",estoque:"ok",margem:"média",foto:"boa",bestSeller:!1,image:o.image_url,galleryImages:o.gallery_urls,sourceProductId:o.source_product_id,sku:o.sku,lastSaleAt:null,source:K==="url"?"url":void 0})),[K,_]),ee=p.useMemo(()=>({...O,produtos:nt}),[O,nt]),J=p.useMemo(()=>K==="url"?so():null,[K,_]),it=p.useMemo(()=>{const o=[Ne,J==null?void 0:J.importedAt,..._.map(s=>s.updated_at)].flatMap(s=>{const l=s?Date.parse(s):Number.NaN;return Number.isFinite(l)?[l]:[]});return o.length>0?new Date(Math.max(...o)):null},[_,Ne,J==null?void 0:J.importedAt]),Da=p.useMemo(()=>
3{if(!it)return a==="pt-BR"?"Ainda não sincronizado":"Not synced yet";const o=new Intl.DateTimeFormat(a==="pt-BR"?"pt-BR":"en-US",{dateStyle:"short",timeStyle:"short"}).format(it);return a==="pt-BR"?`Ãltima sincronização: ${o}`:`Last synced: ${o}`},[it,a]);p.useEffect(()=>{K==="url"&&!ot&&lo()},[K,ot,n==null?void 0:n.id,J]);const W=p.useMemo(()=>co(ee),[ee]),ve=p.useMemo(()=>W?Hr(ee,W):{marketing:[],vendas:[],design:[]},[ee,W]),[st,Vr]=p.useState("marketing"),[te,It]=p.useState("products"),[Dt,lt]=p.useState(!1),[Ft,Tt]=p.useState(null),[Lt,dt]=p.useState(null),[Fa,ct]=p.useState(!1),Ta=p.useCallback(async()=>{if(!Oe||!w||ye==="disconnected"){if(K==="url"){await rt(),L.success(a==="pt-BR"?"Catálogo atualizado":"Catalog updated");return}r("/onboarding/import?source=store");return}try{await ge.sync(),L.success(a==="pt-BR"?"Sincronização do catálogo iniciada":"Catalog sync started")}catch(o){L.error(o instanceof Error?o.message:a==="pt-BR"?"Não foi possÃvel sincronizar o catálogo.":"The catalog could not be synced.")}},[K,w,ge,Oe,ye,a,r,rt]),ut=p.useMemo(()=>i?Fr():[],[i]),[La,Pa]=p.useState(0);p.useEffect(()=>{if(!i)return;const o=()=>Pa(s=>s+1);return window.addEventListener(ra,o),window.addEventListener("storage",o),()=>{window.removeEventListener(ra,o),window.removeEventListener("storage",o)}},[i]);const Ce=p.useMemo(()=>!i||ie||xe?[]:_.filter(o=>!!o.image_url).map(Ye),[_,i,ie,xe]),pt=p.useMemo(()=>{if(!i)return[];const o=Ce.map(s=>aa(oa(s,G),2,a));return[0,1].flatMap(s=>o.flatMap(l=>l[s]?[l[s]]:[]))},[i,a,La,Ce,G]),za=Ga(),Pt=ar(i&&n&&!ie&&!xe&&pt.length?Ae(n):null,za.key),Ma=p.useMemo(()=>nr({store:G,actions:pt,loading:ie,error:!!xe,language:a,introIndex:Pt}),[G,pt,ie,xe,a,Pt]),zt=ye==="connected"||ye==="empty"||ye==="syncing",$a=x&&F==="ready"&&B>0,Be=i&&!d&&!ie&&!xe&&nt.length===0&&!!n,Mt=p.useRef(!1);p.useEffect(()=>{!Be||Mt.current||(Mt.current=!0,It("presets"),lt(!1))},[Be]);const[ae,_e]=p.useState(null),[Na,Re]=p.useState(!1),[Se,Ee]=p.useState(null),[he,Ie]=p.useState(null),Oa=o=>{Ee(o),Ie(null),Re(!0)},_a=()=>r("/board",{state:{_ts:Date.now(),openBoard:!0,blankBoard:!0,boardTitle:Jt,initialBoardAssets:[]}}),[$t,Nt]=p.useState(!1),[qa,mt]=p.useState([]),[gt,qe]=p.useState(!1),ht=p.useRef(null),ft=p.useRef(null);p.useEffect(()=>{const o=n==null?void 0:n.id;if(!o){mt([]);return}let s=!0;const l=()=>{Co(o).then(f=>{s&&mt(f.map(A=>({id:A.id,nome:A.name,image:A.image,galleryImages:A.gallery,vendasSemana:0,tendencia:"estável",estoque:"ok",margem:"média",foto:"boa",bestSeller:!1,lastSaleAt:null,source:"upload"})))}).catch(()=>{s&&mt([])})},u=f=>{var h;const A=(h=f.detail)==null?void 0:h.ownerId;(!A||A===o)&&l()};return l(),window.addEventListener(ta,u),()=>{s=!1,window.removeEventListener(ta,u)}},[n==null?void 0:n.id]),p.useEffect(()=>{var s;if(!n||F!=="ready"||B>0)return;const o=(n.profile.onboardingFirstImages??[]).filter(l=>/^https:\/\//.test(l.url)).slice(0,3);!o.length||ft.current===n.id||(ft.current=n.id,Ho({userId:n.id,title:((s=n.profile.starterProductSnapshot)==null?void 0:s.name)||"Minhas primeiras imagens",images:o,language:a}).catch(l=>{console.warn("[home] onboarding Board recovery failed",l),ft.current=null}))},[a,n,F,B]);const Ot=p.useCallback(o=>{if(!o.type.startsWith("image/")){L.error("Envie um arquivo de imagem.");return}const s=new FileReader;s.onload=()=>{if(typeof s.result!="string")return;const l=o.name.replace(/\.[^.]+$/,"").trim()||"Imagem enviada",u={label:l,dataUrl:s.result},f=pa(u);if("reason"in f){L.error(f.reason);return}if(!na(u)){L.error("Não foi possÃvel preparar esta imagem para o Board. Tente novamente.");return}r("/board?paywall=1",{state:{_ts:Date.now(),blankBoard:!0,boardTitle:l,firstRunProduct:!0,fromHomeUpload:!0}})},s.onerror=()=>L.error("Não foi possÃvel carregar essa imagem."),s.readAsDataURL(o)},[r]);p.useEffect(()=>{i&&ut.length&&console.log("[home-5·suggestions]",ut)},[i,ut]);const _t=p.useRef(null),qt=o=>{const s=_t.current;if(!s)return;const l=s.querySelector("[data-tpl-card]"),u=l?l.offsetWidth+16:s.clientWidth*.8;s.scrollBy({left:o*u*3,behavior:"smooth"})},Ht=p.useRef(null),Wt=o=>{const s=Ht.current;if(!s)return;const l=s.querySelector("[data-style-card]"),u=l?l.offsetWidth+16:s.clientWidth*.8;s.scrollBy({left:o*u*3,behavior:"smooth"})},[oe,Ha]=p.useState(null);p.useMemo(()=>
3{if(st==="tudo"){const o=[];return["marketing","vendas","design"].forEach(s=>{ve[s].forEach(l=>l.items.forEach(u=>{var f;((f=u.dataBadge)==null?void 0:f.tone)==="urgent"&&o.push(u)}))}),[{title:"Pra agora",items:o},{title:"Marketing",items:ve.marketing.flatMap(s=>s.items).slice(0,4)},{title:"Vendas",items:ve.vendas.flatMap(s=>s.items).slice(0,4)},{title:"Design",items:ve.design.flatMap(s=>s.items).slice(0,4)}].filter(s=>s.items.length>0)}return ve[st]},[ve,st]);const[N,De]=p.useState(null),He=p.useMemo(()=>{var s;return N?_.find(l=>{var u,f;return l.product_id===N.id||((u=N.identityAliases)==null?void 0:u.includes(l.id))||((f=N.identityAliases)==null?void 0:f.includes(l.product_id))})??{product_id:N.id,name:N.name,image_url:N.image,category:N.category,subcategory:N.subcategory,product_form:N.productForm,description:N.description,traits:N.traits,stock_quantity:N.stockQuantity,variant_count:N.variantCount,store_collections:(s=N.collections)==null?void 0:s.map(l=>({name:l}))}:null},[N,_]),Ut=p.useRef(null),bt=(o,s,l)=>{Ut.current=l;const u=_.find(f=>f.product_id===String(o.id));De(u?Ye(u):{id:String(o.id),name:o.nome,image:s??"",weeklySales:0,addedAt:""})},Vt=()=>e.jsx("section",{id:"meus-produtos",style:{marginBottom:56},children:e.jsxs(Io,{value:te,onValueChange:o=>{It(o),lt(!1)},children:[e.jsxs("div",{className:"flex flex-col items-stretch gap-4 sm:flex-row sm:items-center sm:justify-between",style:{margin:`0 0 ${se.sectionGap}`},children:[e.jsx(Do,{"aria-label":a==="pt-BR"?"Conteúdo para criar":"Creation content",className:"h-auto justify-start gap-6 rounded-none bg-transparent p-0 text-inherit",children:(Be?[{value:"presets",label:a==="pt-BR"?"Explorar":"Explore"},{value:"products",label:"Meus produtos"},{value:"uploads",label:"Uploads"}]:[{value:"products",label:"Meus produtos"},{value:"uploads",label:"Uploads"},{value:"presets",label:a==="pt-BR"?"Explorar":"Explore"}]).map(o=>{const s=te===o.value;return e.jsx(Fo,{value:o.value,className:`h-auto rounded-none border-0 bg-transparent p-0 pb-1 shadow-none transition-colors data-[state=active]:bg-transparent data-[state=active]:shadow-none ${s?"text-foreground":"text-muted-foreground/50 hover:text-muted-foreground"}`,style:{...Le.homeSectionTitle,color:s?"hsl(var(--foreground))":"hsl(var(--muted-foreground) / 0.5)"},children:o.label},o.value)})}),te==="products"&&e.jsxs("div",{className:"flex w-full min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-2 sm:w-auto sm:justify-end",children:[J?e.jsxs("span",{style:{maxWidth:280,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:12,color:`hsl(${Y.text.tertiary})`},children:[a==="pt-BR"?`${J.products.length} produtos de `:`${J.products.length} products from `,new URL(J.sourceUrl).hostname.replace(/^www\./,"")]}):null,e.jsxs("div",{className:"ml-auto flex flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[e.jsx("span",{"data-catalog-last-sync":!0,className:"whitespace-nowrap text-[11px] text-muted-foreground/60",children:Da}),e.jsxs("button",{type:"button","data-catalog-sync":!0,"aria-busy":ge.syncing,disabled:ge.syncing,onClick:()=>{Ta()},className:"inline-flex shrink-0 items-center gap-1.5 border-0 bg-transparent p-0 text-muted-foreground transition-colors hover:text-foreground disabled:cursor-wait disabled:opacity-70",style:{fontFamily:"inherit",fontSize:12,fontWeight:400,cursor:ge.syncing?"wait":"pointer"},children:[e.jsx(bo,{"aria-hidden":"true",size:12,weight:"regular",className:ge.syncing?"animate-spin":void 0}),ge.syncing?a==="pt-BR"?"Sincronizandoâ¦":"Syncingâ¦":a==="pt-BR"?"Sincronizar":"Sync"]})]})]})]}),te==="presets"?e.jsx(wo,{embedded:!0}):e.jsxs("div",{"aria-busy":te==="products"&&ie,className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 lg:gap-8",children:[e.jsx("input",{ref:ht,"data-product-upload-input":!0,type:"file",accept:"image/*",hidden:!0,onChange:o=>{var l;const s=(l=o.target.files)==null?void 0:l[0];o.target.value="",s&&Ot(s)}}),te==="uploads"&&e.jsx("button",{type:"button","data-product-dropzone":!0,"aria-label":"Carregar imagem ou produto",onClick:()=>{var o;return(o=ht.current)==null?void 0:o.click()},onMouseEnter:()=>Nt(!0),onMouseLeave:()=>Nt(!1),onDragEnter:o=>{o.preventDefault(),qe(!0)},onDragOver:o=>{o.preventDefault(),o.dataTransfer.dropEffect="copy",qe(!0)},onDragLeave:o=>{const s=o.relatedTarget;(!s||!o.currentTarget.contains(s))&&qe(!1)},onDrop:o=>{var l;o.preventDefault(),qe(!1);const s=(l=o.dataTransfer.files)==null?void 0:l[0];s&&Ot(s)},style:{aspectRatio:"1 / 1",border:`1px dashed hsl(${gt||$t?Y.border.primary:Y.border.secondary})`,borderRadius:me.homeCard,background:`hsl(${gt||$t?Y.bg.secondary:Y.bg.tertiary})`,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",fontFamily:"inherit",transition:"background-color 120ms ease, border-color 120ms ease"},children:e.jsx(Bo,{dragging:gt})}),(()=>{if(te==="products"&&ie)return Array.from({length:Je},(f,A)=>e.jsx(Tr,{},`product-skeleton-${A}`));const o=K==="url",s=_.map(f=>({id:f.product_id,nome:f.name,image:f.image_url,vendasSemana:0,tendencia:"estável",estoque:"ok",margem:"média",foto:"boa",bestSeller:!1,lastSaleAt:null}));s.sort((f,A)=>{const h=f.lastSaleAt?Date.parse(f.lastSaleAt):0;return(A.lastSaleAt?Date.parse(A.lastSaleAt):0)-h});const l=o?10:Dt?16:Je,u=te==="uploads"?qa:s.slice(0,l);return te==="products"&&_.length===0&&ye==="disconnected"?[{id:"upload",title:a==="pt-BR"?"Envie uma foto":"Upload a photo",
3support:a==="pt-BR"?"Comece com um produto do seu computador.":"Start with a product from your computer.",icon:wa,action:()=>{var A;return(A=ht.current)==null?void 0:A.click()}},{id:"url",title:"Use a URL",support:a==="pt-BR"?"Importe produtos de uma loja pública.":"Import products from a public storefront.",icon:mo,action:()=>r("/onboarding/import?source=url")},{id:"store",title:a==="pt-BR"?"Conecte sua loja":"Connect your store",support:a==="pt-BR"?"Sincronize seu catálogo para criar.":"Sync your catalog to start creating.",icon:Ka,action:()=>r("/onboarding/import?source=store")}].map(A=>{const h=A.icon;return e.jsxs("button",{type:"button","data-empty-product-placeholder":A.id,onClick:A.action,style:{aspectRatio:"1 / 1",border:`1px dashed hsl(${Y.border.secondary})`,borderRadius:me.homeCard,background:`linear-gradient(145deg, hsl(${Y.bg.tertiary}), hsl(${Y.bg.secondary}))`,color:`hsl(${Y.text.primary})`,padding:24,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-end",gap:6,textAlign:"left",cursor:"pointer",fontFamily:"inherit"},children:[e.jsx(h,{size:24,weight:"regular",style:{marginBottom:"auto",color:`hsl(${Y.text.tertiary})`}}),e.jsx("span",{style:{...Le.cardTitle},children:A.title}),e.jsx("span",{style:{...Le.cardSupport},children:A.support})]},A.id)}):u.map((f,A)=>e.jsx("button",{type:"button",className:"home-product-card-enter",onClick:h=>bt(f,f.image??Me,h.currentTarget),style:{background:"transparent",border:"none",padding:0,cursor:"pointer",textAlign:"left",fontFamily:"inherit",display:"flex",flexDirection:"column",gap:10,animationDelay:`${Math.min(A,Je-1)*35}ms`},children:e.jsxs("div",{className:"group",style:{position:"relative",aspectRatio:"1 / 1",borderRadius:me.homeCard,background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",overflow:"hidden"},children:[e.jsx("img",{"data-home-product-image":!0,src:f.image??Me,alt:f.nome,loading:"lazy",decoding:"async",style:{width:"100%",height:"100%",objectFit:"cover",display:"block",boxSizing:"border-box"}}),e.jsx("div",{className:"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity",style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.35)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8},children:e.jsx("span",{role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),bt(f,f.image??Me,h.currentTarget)},onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),h.stopPropagation(),bt(f,f.image??Me,h.currentTarget))},style:jo,children:a==="en"?"Create with this product":"Criar com este produto"})})]})},f.id))})()]}),te==="products"&&K!=="url"&&_.length>Je&&e.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:24},children:e.jsx("button",{type:"button",onClick:()=>lt(o=>!o),style:{background:"transparent",border:"1px solid hsl(var(--border))",borderRadius:999,padding:"8px 18px",fontSize:13,fontFamily:"inherit",color:"hsl(var(--foreground))",cursor:"pointer"},children:Dt?"Ver menos":"Ver mais"})})]})});return e.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",background:i?`hsl(${Y.bg.primary})`:"hsl(var(--background))",padding:"0 0 80px",fontFamily:"var(--font-sans, Inter, sans-serif)"},children:[e.jsxs("div",{style:{width:"100%",maxWidth:po.contentMaxWidth,margin:"0 auto",boxSizing:"border-box",padding:`${i?160:80}px ${uo[7]} 0`},children:[i&&(()=>{const o=new Date,s=ie?null:(G==null?void 0:G.name)??null,{greeting:l}=ha(o,s,a);return e.jsx("section",{style:{marginBottom:i?se.sectionGap:40},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[e.jsx("span",{style:{fontSize:28,color:"hsl(var(--muted-foreground))",letterSpacing:"-0.014em"},children:d?e.jsx("span",{"aria-label":"Loading profile",className:"skeleton-shimmer inline-block w-48 h-7 rounded bg-muted"}):e.jsx("span",{"data-no-translate":!0,children:l})}),e.jsx("h2",{style:{fontSize:28,fontWeight:500,color:"hsl(var(--foreground))",margin:0,letterSpacing:"-0.014em"},children:Ma.heading})]})})})(),i&&e.jsx("section",{style:{marginBottom:se.sectionGap},children:e.jsx(ao,{language:a,onProduct:()=>{Ee(null),Re(!0)},onStyle:()=>r("/library"),onVideo:()=>Oa("video"),onAgent:()=>ct(!0),onScratch:_a})}),i&&Vt(),!i&&e.jsxs("section",{style:{marginBottom:40},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",margin:"0 0 28px",gap:24},children:[(()=>{const o=new Date,s=d?null:(n==null?void 0:n.firstName)??null,{greeting:l,question:u}=ha(o,s,a);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[e.jsx("span",{style:{fontSize:20,color:"hsl(var(--muted-foreground))",letterSpacing:"-0.014em"},children:d?e.jsx("span",{"aria-label":"Loading profile",className:"skeleton-shimmer inline-block w-48 h-7 rounded bg-muted"}):e.jsx("span",{"data-no-translate":!0,children:l})}),e.jsx("h2",{style:{fontSize:20,fontWeight:500,color:"hsl(var(--foreground))",margin:0,letterSpacing:"-0.014em"},children:u})]})})(),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{type:"button","aria-label":"Anterior",onClick:()=>qt(-1),style:{width:32,height:32,borderRadius:999,border:"1px solid hsl(var(--border))",background:"hsl(var(--background))",color:"hsl(var(--foreground))",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,lineHeight:1},children:"â¹"}),e.jsx("button",{type:"button","aria-label":"Próximo",onClick:()=>qt(1),style:{width:32,height:32,borderRadius:999,border:"1px solid hsl(var(--border))",background:"hsl(var(--background))",color:"hsl(var(--foreground))",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,lineHeight:1},children:"âº"})]})]}),e.jsx("div",{ref:_t,style:{display:"grid",gridAutoFlow:"column",gridAutoColumns:"calc((100% - 48px) / 4)",gap:16,overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none",paddingBottom:4},children:(()=>{var we,le,de,Z;const o=ee.produtos,s=W==null?void 0:W.bestSeller,l=W==null?void 0:W.encalhado,u=W==null?void 0:W.fotoFraca,f=W==null?void 0:W.margemBaixa,A=((we=ee.proximaData)==null?void 0:we.nome)??"Dia das Mães",h=D=>(D==null?void 0:D.image)??Me;return[{id:"tpl-product-hero-campeao",title:"Feed Instagram",product:s,sub:`${(s==null?void 0:s.nome)??"Seu produto"} é o best seller da semana com ${(s==null?void 0:s.vendasSemana)??0} vendas. Um post único 1:1 no feed mantém o ritmo.`,briefId:"studio-branco",coverGradient:"linear-gradient(135deg, #F2F2F2 0%, #BFBFBF 100%)",coverLabel:"best seller",coverInk:"#1A1A1A",thumbs:[h(s),h(l),h(u),h(f)],isNew:!0},{id:"tpl-color-backdrop-foto-fraca",title:"Carrossel Instagram",product:u,sub:`${(u==null?void 0:u.nome)??"Um produto"}
3 está com a foto mais fraca do catálogo. Um carrossel de 5 slides com cor sólida recupera atenção rápido.`,briefId:"studio-branco",coverGradient:"linear-gradient(135deg, #FFD93D 0%, #FF6B9D 100%)",coverLabel:"foto fraca",coverInk:"#1A1A1A",thumbs:[h(u),h(s),h(f),h(l)],isNew:!0},{id:"tpl-campanha-proxima",title:"Email",product:s,sub:`Faltam ${((le=ee.proximaData)==null?void 0:le.emDias)??0} dias pro ${A} e ${(s==null?void 0:s.nome)??"seu campeão"} é a aposta certa. Broadcast pronto pra ativar a base.`,briefId:"dia-das-maes",coverGradient:"linear-gradient(135deg, #1A1A1A 0%, #FF3B30 100%)",coverLabel:`${((de=A==null?void 0:A.toLowerCase)==null?void 0:de.call(A))??"data sazonal"}`,coverInk:"#FFFFFF",thumbs:[h(s),h(u),h(f),h(l)]},{id:"tpl-lifestyle-margem",title:"Stories",product:f,sub:`${(f==null?void 0:f.nome)??"Um produto"} está com margem apertada e precisa reaquecer. Stories 9:16 em lifestyle engajou mais no último mês.`,briefId:"lifestyle-ambiente",coverGradient:"linear-gradient(135deg, #E8C9A6 0%, #A67C52 100%)",coverLabel:"reativar produto",coverInk:"#1A1A1A",thumbs:[h(f),h(s),h(u),h(l)]},{id:"tpl-campanha-black-friday",title:"Ad Meta",product:l,sub:`${(l==null?void 0:l.nome)??"Um produto"} tem estoque alto e giro baixo. Um criativo pago de alto contraste no Meta empurra a saÃda.`,briefId:"black-friday",coverGradient:"linear-gradient(135deg, #0A0A0A 0%, #00C2FF 100%)",coverLabel:"girar estoque",coverInk:"#FFFFFF",thumbs:[h(l),h(s),h(f),h(u)]},{id:"tpl-macro-detail-encalhado",title:"Banner Site",product:l,sub:`${(l==null?void 0:l.nome)??"Um produto"} está parado: um banner macro detail na home conta a história do material e justifica a margem.`,briefId:"studio-branco",coverGradient:"linear-gradient(135deg, #FAFAF7 0%, #D4D4D0 100%)",coverLabel:"material em detalhe",coverInk:"#1A1A1A",thumbs:[h(l),h(s),h(u),h(f)]},{id:"tpl-pop-foto-fraca",title:"TikTok",product:u,sub:`${(u==null?void 0:u.nome)??"Um produto"} pede imagem nova. Um vÃdeo vertical pop no TikTok pega o algoritmo e amplia o alcance.`,briefId:"studio-branco",coverGradient:"linear-gradient(135deg, #D4B896 0%, #6B7B5A 100%)",coverLabel:"viralizar",coverInk:"#1A1A1A",thumbs:[h(u),h(f),h(s),h(l)],isNew:!0},{id:"tpl-flat-lay",title:"VÃdeo Reels",product:s,sub:`${(s==null?void 0:s.nome)??"Seu campeão"} lidera o mix. Um reels top-down flat lay apresenta a coleção em 15s no pico ${((Z=ee.horariosPico)==null?void 0:Z.feed)??"do feed"}.`,briefId:"flat-lay",coverGradient:"linear-gradient(135deg, #E8DCC4 0%, #8B6F47 100%)",coverLabel:"horário de pico",coverInk:"#1A1A1A",thumbs:[h(s),h(l),h(u),h(f)]}].map(D=>e.jsxs("div",{"data-tpl-card":!0,style:{scrollSnapAlign:"start",display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:11,fontWeight:500,color:"hsl(var(--foreground))",background:"hsl(var(--muted))",border:"1px solid hsl(var(--border))",borderRadius:6,padding:"3px 8px",lineHeight:1.2,textTransform:"capitalize",letterSpacing:"0.01em"},children:D.title}),D.isNew&&e.jsx("span",{className:"home3-new-badge",style:{fontSize:11,fontWeight:600,color:"#0A7A3B",border:"none",borderRadius:6,padding:"3px 8px",lineHeight:1.2,letterSpacing:"0.02em",textTransform:"uppercase"},children:"New"})]}),e.jsx(Xt,{onClick:()=>{var U;const ce=Date.now(),fe={"Feed Instagram":"1:1","Carrossel Instagram":"1:1",Email:"4:5",Stories:"9:16","Ad Meta":"1:1","Banner Site":"16:9",TikTok:"9:16","VÃdeo Reels":"9:16"}[D.title]??"1:1";r("/board",{state:{_ts:ce,openBoard:!0,blankBoard:!0,boardTitle:D.title,templateId:D.id,workflowPreset:{templateId:D.id,title:D.title,productImageUrl:D.thumbs[0],productName:((U=D.product)==null?void 0:U.nome)??D.title,prompt:D.sub,taskText:D.sub,coverLabel:D.coverLabel,styleChips:[D.coverLabel,D.briefId].filter(Boolean),format:fe}}})},media:e.jsx("div",{style:{position:"absolute",inset:0,background:D.coverGradient,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{fontSize:22,fontWeight:600,letterSpacing:"-0.01em",color:D.coverInk,opacity:.9,textAlign:"center",padding:"0 16px",lineHeight:1.15},children:D.coverLabel})}),overlay:D.product?e.jsxs("div",{style:{position:"absolute",left:10,bottom:10,display:"flex",alignItems:"center",gap:8,padding:"6px 10px 6px 6px",borderRadius:8,background:"rgba(255,255,255,0.96)",boxShadow:"0 1px 2px rgba(0,0,0,0.08)",maxWidth:"calc(100% - 20px)"},children:[e.jsx("div",{style:{width:24,height:24,borderRadius:me.sm,background:`#E5E7EB url(${D.product.image??""}) center/cover`,flexShrink:0}}),e.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#1A1A1A",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:D.product.nome})]}):null,title:"",sub:e.jsx("span",{style:{fontSize:13,lineHeight:1.45,color:"#71717A"},children:(()=>{const ce=o.map(U=>
3U.nome).filter(Boolean),ue=new RegExp(`(${ce.map(U=>U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")})`,"g");return D.sub.split(ue).map((U,be)=>ce.includes(U)?e.jsx("span",{style:{color:"hsl(var(--foreground))",fontWeight:500},children:U},be):e.jsx(p.Fragment,{children:U},be))})()})})]},D.id))})()})]}),(!i||!Be&&ia)&&e.jsx("div",{style:i?ga:{height:1,background:"hsl(var(--border))",margin:"8px 0 32px"}}),i&&!Be&&ia,!i&&e.jsxs("section",{style:{marginBottom:i?48:40},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",margin:"0 0 16px"},children:[e.jsx("h2",{style:{...Le.homeSectionTitle,margin:0},children:i?"Comece agora":"Presets para aplicar nos seus produtos"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{type:"button","aria-label":"Anterior",onClick:()=>Wt(-1),style:{width:32,height:32,borderRadius:999,border:"1px solid hsl(var(--border))",background:"hsl(var(--background))",color:"hsl(var(--foreground))",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,lineHeight:1},children:"â¹"}),e.jsx("button",{type:"button","aria-label":"Próximo",onClick:()=>Wt(1),style:{width:32,height:32,borderRadius:999,border:"1px solid hsl(var(--border))",background:"hsl(var(--background))",color:"hsl(var(--foreground))",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,lineHeight:1},children:"âº"})]})]}),e.jsx("div",{ref:Ht,style:{display:"grid",gridAutoFlow:"column",gridAutoColumns:"calc((100% - 48px) / 4)",gap:16,overflowX:"auto",scrollSnapType:"x mandatory",scrollbarWidth:"none",paddingBottom:4},children:(()=>{const o=ee.produtos,s="https://images.unsplash.com/photo-1542291026-7eec264c27ff?auto=format&fit=crop&w=400&q=80",l=o[0];return l==null||l.image,Ko.map(u=>e.jsx("div",{"data-style-card":!0,style:{scrollSnapAlign:"start"},children:e.jsx(Xt,{onClick:()=>{dt({id:u.id,title:u.title,sub:u.sub,cover:u.cover})},aspectRatio:i?"3 / 4":void 0,media:e.jsx("div",{style:{position:"absolute",inset:0,background:`url(${u.cover}) center/cover`}}),title:u.title,sub:i?void 0:e.jsx("span",{style:{fontSize:13,lineHeight:1.45,color:"#71717A"},children:u.sub})})},u.id))})()})]}),e.jsx("div",{style:i?ga:{height:1,background:"hsl(var(--border))",margin:"8px 0 32px"}}),i&&!!n&&F==="loading"&&e.jsx(tr,{}),$a&&e.jsxs("section",{style:{marginBottom:i?se.sectionGap:40},children:[e.jsx("button",{type:"button",onClick:()=>r("/boards"),style:{display:"flex",minHeight:se.sectionHeaderHeight,alignItems:"center",gap:8,margin:`0 0 ${se.titleGap}`,padding:0,border:"none",background:"transparent",cursor:"pointer",fontFamily:"inherit"},children:e.jsx("h2",{style:{...Le.homeSectionTitle,margin:0},children:a==="en"?"My Boards":"Meus Boards"})}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 lg:gap-8",children:[e.jsx(Ro,{onClick:()=>r("/board",{state:{openBoard:!0,blankBoard:!0,boardTitle:Jt,initialBoardAssets:[],_ts:Date.now()}})}),z.slice(0,ma-1).map(o=>e.jsx(Eo,{board:o,showThumbnailSkeletons:!0,onOpen:q,menu:{busy:R===o.id,pinned:P.has(o.id),onOpenNewTab:s=>{window.open(new URL(C(s),window.location.origin).href,"_blank","noopener,noreferrer")},onRename:V,onDuplicate:S,onCopyLink:H,onTogglePin:j,onDelete:I}},o.id))]})]}),!i&&Vt(),!1]}),e.jsx(wr,{open:!!oe,onClose:()=>Ha(null),flow:(oe==null?void 0:oe.flow)??null,cardLabel:(oe==null?void 0:oe.label)??null,dataBadgeLabel:(oe==null?void 0:oe.badge)??null}),e.jsx(Jo,{open:Fa,language:a,connected:zt,onClose:()=>ct(!1),onContinue:()=>{ct(!1),r(zt?"/agent":"/onboarding/import?source=store")}}),e.jsx(Rr,{open:!!Lt,style:Lt,products:ee.produtos.map(o=>({id:o.id,name:o.nome,image:o.image??""})).filter(o=>!!o.image),onClose:()=>dt(null),onApprove:o=>{const s=Date.now(),{style:l,source:u,aspectRatio:f,options:A}=o,h=f.split(":").map(Q=>parseInt(Q,10)),Fe=Number.isFinite(h[0])&&h[0]>0?h[0]:1,we=Number.isFinite(h[1])&&h[1]>0?h[1]:1,le=240,de=le,Z=Math.round(le*we/Fe),D=20,ce=40,ue={"option-01":["https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800","https://images.unsplash.com/photo-1526170375885-4d8ecf77b99f?w=800","https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=800"],"option-02":["https://images.unsplash.com/photo-1483985988355-763728e1935b?w=800","https://images.unsplash.com/photo-1490481651871-ab68de25d43d?w=800"],"option-03":["https://images.unsplash.com/photo-1519415943484-9fa1873496d4?w=800","https://images.unsplash.com/photo-1520975916090-3105956dac38?w=800"],"option-04":["https://images.unsplash.com/photo-1558769132-cb1aea458c5e?w=800","https://images.unsplash.com/photo-1580651315530-69c8e0903883?w=800"],"option-05":["https://images.unsplash.com/photo-1487222477894-8943e31ef7b2?w=800","https://images.unsplash.com/photo-1445205170230-053b83016050?w=800"]},fe=u.kind==="upload"?u.imageUrl:u.product.image,U=u.kind==="upload"?u.name??"imagem carregada":u.product.name,be=u.kind==="product"?u.product.id:void 0,Te=`home3-style-src-${l.id}-${s}`,We={id:Te,imageUrl:fe,x:-520,y:-Z/2,width:300,height:300,label:U,type:"image",aspectRatio:"1:1",productId:be,isPlaceholder:!1},re=[],Ue=[];let Ve=0;A.forEach((Q,Ge)=>{const xt=-Z/2+Ge*(Z+ce);for(let pe=0;
3pe<Q.count;pe++){const Ze=`sa-${s}-${Q.id}-${pe}`,Wa=-100+pe*(de+D);re.push({id:Ze,imageUrl:"",x:Wa,y:xt,width:de,height:Z,label:`${l.title} · ${Q.label} · ${f}`,styleName:l.title,type:"image",aspectRatio:f,isPlaceholder:!0,placeholderState:"generating",placeholderMode:"image",placeholderStartedAt:Date.now(),parentAssetId:Te});const Kt=ue[Q.id]??ue["option-01"],Ua=Kt[pe%Kt.length];Ve+=2e3+Math.random()*2e3,Ue.push({id:Ze,imageUrl:Ua,delayMs:Ve})}}),dt(null),r("/board",{state:{_ts:s,openBoard:!0,blankBoard:!0,boardTitle:l.title,initialBoardAssets:[We,...re],creativeAgentQueue:Ue,styleId:l.id,styleName:l.title,styleDesc:l.sub,templateId:l.id}})}}),e.jsx(kr,{open:!!Ft,product:Ft,onClose:()=>Tt(null),onApprove:o=>{const s=Date.now(),{product:l,selectedImage:u,aspectRatio:f,options:A}=o,h=f.split(":").map(re=>parseInt(re,10)),Fe=Number.isFinite(h[0])&&h[0]>0?h[0]:1,we=Number.isFinite(h[1])&&h[1]>0?h[1]:1,le=240,de=le,Z=Math.round(le*we/Fe),D=20,ce=40,ue={"option-01":["https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=800","https://images.unsplash.com/photo-1526170375885-4d8ecf77b99f?w=800","https://images.unsplash.com/photo-1542291026-7eec264c27ff?w=800"],"option-02":["https://images.unsplash.com/photo-1483985988355-763728e1935b?w=800","https://images.unsplash.com/photo-1490481651871-ab68de25d43d?w=800","https://images.unsplash.com/photo-1529139574466-a303027c1d8b?w=800"],"option-03":["https://images.unsplash.com/photo-1519415943484-9fa1873496d4?w=800","https://images.unsplash.com/photo-1520975916090-3105956dac38?w=800"],"option-04":["https://images.unsplash.com/photo-1558769132-cb1aea458c5e?w=800","https://images.unsplash.com/photo-1580651315530-69c8e0903883?w=800"],"option-05":["https://images.unsplash.com/photo-1487222477894-8943e31ef7b2?w=800","https://images.unsplash.com/photo-1445205170230-053b83016050?w=800"]},fe=`home3-prod-${l.id}-${s}`,U={id:fe,imageUrl:u,x:-520,y:-Z/2,width:300,height:300,label:l.name,type:"image",aspectRatio:"1:1",productId:l.id,isPlaceholder:!1},be=[],Te=[];let We=0;A.forEach((re,Ue)=>{const Ve=-Z/2+Ue*(Z+ce);for(let Q=0;Q<re.count;Q++){const Ge=`ca-${s}-${re.id}-${Q}`,xt=-100+Q*(de+D);be.push({id:Ge,imageUrl:"",x:xt,y:Ve,width:de,height:Z,label:`${re.label} · ${f}`,styleName:re.label,type:"image",aspectRatio:f,isPlaceholder:!0,placeholderState:"generating",placeholderMode:"image",placeholderStartedAt:Date.now(),parentAssetId:fe});const pe=ue[re.id]??ue["option-01"],Ze=pe[Q%pe.length];We+=2e3+Math.random()*2e3,Te.push({id:Ge,imageUrl:Ze,delayMs:We})}}),Tt(null),r("/board",{state:{_ts:s,openBoard:!0,blankBoard:!0,boardTitle:l.name,initialBoardAssets:[U,...be],creativeAgentQueue:Te}})}}),e.jsx(ko,{open:Na,catalogOnly:Se==="video",onClose:()=>Re(!1),onPick:o=>{if(Re(!1),!o.image){L.error("Este produto está sem imagem â escolha outro para continuar.");return}if(Se==="campaign"){Ie(o);return}if(Se==="video"){if(!n){L.error("Entre na sua conta para criar um vÃdeo no Board.");return}const l=_.find(u=>u.product_id===o.id);if(!l){L.error("Escolha um produto do catálogo para receber as sugestões do Film Maker.");return}try{const u=Qe(Ae(n),{...Ye(l),image:o.image},null,a,null,"video-maker");Ee(null),r(`/board?${new URLSearchParams({productEntry:u.id,boardId:u.boardId})}`)}catch{L.error("Não foi possÃvel preparar o Film Maker para este produto. Tente novamente.")}return}if(o.image.startsWith("data:image/")){const l={label:o.name,dataUrl:o.image},u=pa(l);if("reason"in u){L.error(u.reason);return}if(!na(l)){L.error("Não foi possÃvel preparar esta imagem para o Board. Tente novamente.");return}r("/board",{state:{_ts:Date.now(),openBoard:!0,blankBoard:!0,boardTitle:o.name,firstRunProduct:!0,fromHomeUpload:!0}});return}if(!n){L.error("Entre na sua conta para abrir o produto no Board.");return}const s=_.find(l=>l.product_id===o.id);if(!s){L.error("Este produto não está mais disponÃvel no catálogo. Escolha novamente.");return}try{const l=Qe(Ae(n),{...Ye(s),image:o.image},null,a,G);r(`/board?${new URLSearchParams({productEntry:l.id,boardId:l.boardId})}`)}catch{L.error("Não foi possÃvel abrir o produto no Board. Tente novamente.")}}}),Se==="campaign"&&he&&e.jsx(Yo,{kind:Se,product:he,language:a,suggestion:aa(oa({...Ce.find(o=>{var s;return o.id===he.id||((s=o.identityAliases)==null?void 0:s.includes(he.id))})??{weeklySales:0,addedAt:""},...he},G),1,a)[0],onClose:()=>{Ee(null),Ie(null)},onChangeProduct:()=>{Ie(null),Re(!0)},onContinue:o=>{Ie(null),Ee(null),r("/campaign",{state:{creativeEntry:o}})}},`${Se}:${he.id}:${he.image}`),e.jsx(To,{open:!!He,onOpenChange:o=>{o||De(null)},children:e.jsx(Lo,{side:"right","data-testid":"home-product-drawer",className:"w-full p-0 sm:max-w-[600px]",style:{overflowY:"auto",background:`hsl(${Y.bg.primary})`},onCloseAutoFocus:o=>{var s;o.preventDefault(),(s=Ut.current)==null||s.focus()},children:He?e.jsx(fo,{product:He,decisionBacked:!0,store:G??null,onOpenBoard:()=>
3{if(N){if(!n){L.error(a==="en"?"Sign in to open this product.":"Entre na sua conta para abrir este produto.");return}try{const o=Qe(Ae(n),N,null,a,G);De(null),r(`/board?${new URLSearchParams({productEntry:o.id,boardId:o.boardId})}`)}catch{L.error(a==="en"?"Could not open this product in Board. Try again.":"Não foi possÃvel abrir este produto no Board. Tente novamente.")}}},onGenerate:({action:o})=>{N&&(_e({...o,product:N}),De(null))}},He.product_id):null})}),e.jsx(Ao,{open:!!ae,action:ae,catalog:ae!=null&&ae.recommendation&&ae.product?[ae.product]:Ce,onClose:()=>_e(null),onBack:()=>{const o=ae==null?void 0:ae.product;_e(null),o&&De(o)},onConfirm:({action:o,product:s,format:l,imageCount:u})=>{if(!n){L.error(a==="en"?"Sign in to open this plan.":"Entre na sua conta para abrir este plano.");return}const f=Ce.find(A=>A.id===s.id);if(!f){L.error(a==="en"?"This product is no longer available. Choose it again.":"Este produto não está mais disponÃvel. Escolha novamente.");return}try{const A=Qe(Ae(n),f,{...o,imageCount:u,defaultFormat:l??o.defaultFormat??"4:5"},a,G);r(`/board?${new URLSearchParams({productEntry:A.id,boardId:A.boardId})}`),_e(null)}catch{L.error(a==="en"?"Could not prepare this plan. Your selection was preserved; try again.":"Não foi possÃvel preparar este plano. Sua seleção foi preservada; tente novamente.")}}})]})}function Ur(){const t=jt(),{lang:r}=kt();return e.jsxs("header",{className:"fixed inset-x-0 top-0 z-50 flex h-16 items-center px-5 sm:px-8","aria-label":r==="pt-BR"?"Primeiro acesso":"First access",children:[e.jsx("button",{type:"button","aria-label":"Snew",onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),className:"snew-hit flex items-center text-foreground",children:e.jsx(Xa,{altura:18})}),e.jsx(Ct,{size:"sm",className:"snew-hit ml-auto !border-transparent !bg-secondary !text-[13px] !text-muted-foreground hover:!bg-secondary/80 hover:!text-foreground",onClick:()=>t("/signup?from=home"),children:r==="pt-BR"?"Criar conta":"Create account"})]})}function qi(){const t=jt(),{user:r,loading:a}=Sa(),{lang:n}=kt(),d=Uo(n),i=!a&&!r;return e.jsxs("div",{style:{position:"relative",minHeight:"100vh",width:"100%",background:"hsl(var(--background))"},children:[e.jsx(Wr,{variant:"home5"}),!a&&(i?e.jsx(Ur,{}):e.jsx(Ja,{})),i&&e.jsx(Wo,{titulo:d.pricingTitle,cicloAnual:d.pricingYearly,cicloMensal:d.pricingMonthly,cta:d.pricingCta,ctaPorPlano:d.pricingCtaPlan,contatoSales:d.pricingContactSales,idioma:n,source:"home-pricing",onEscolher:(x,g)=>t(Za(n,x,"home-pricing",g))})]})}export{qi 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.