1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[58667],{19865:(e,t,a)=>{a.d(t,{IG:()=>c,db:()=>u,j2:()=>o,yA:()=>d});var l=a(97873),r=a(65140),n=a(30928),i=a(4927);let s={apiKey:"AIzaSyAO_sbTBemKD068NVqv3RYb15ckEthjtrQ",authDomain:"login.brasilmineral.com.br",projectId:"brasil-mineral-newsletter",storageBucket:"brasil-mineral-newsletter.firebasestorage.app",messagingSenderId:"145521886346",appId:"1:145521886346:web:bb9afd106c161d05031973",measurementId:"G-QCKC22MY1G"},d=0===(0,l.Dk)().length?(0,l.Wp)(s):(0,l.Sx)(),o=(0,r.xI)(d),c=(0,n.c7)(d),u=(0,i.aU)(d,"premium-us".trim()||"(default)");s.projectId||console.error("Firebase Initialization Error: Firebase config is not fully set. Check your NEXT_PUBLIC_FIREBASE_ environment variables. Firebase features may not work correctly.")},40980:(e,t,a)=>{a.d(t,{Y:()=>i,cn:()=>n,o:()=>s});var l=a(29722),r=a(622);function n(...e){return(0,r.QP)((0,l.$)(e))}function i(e){return e?e.toString().toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\s_]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,""):`artigo-sem-titulo-${Date.now()}`}function s(e){return e&&"string"==typeof e?e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]/g,""):""}},42282:(e,t,a)=>{a.d(t,{B:()=>D});var l=a(95155),r=a(12115),n=a(37206),i=a(42763),s=a(88428),d=a(82724),o=a(37595),c=a(25237),u=a(92972);function x({onSelect:e}){return(0,l.jsxs)("div",{className:"space-y-6",children:[(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-red-100 dark:bg-red-950/30 mb-3",children:(0,l.jsx)(o.A,{className:"h-6 w-6 text-red-600"})}),(0,l.jsx)("h3",{className:"text-lg font-semibold text-neutral-900 dark:text-white",children:"Escolha um formato"}),(0,l.jsx)("p",{className:"text-sm text-neutral-500 mt-1",children:"Selecione o tamanho do banner que deseja criar"})]}),(0,l.jsx)("div",{className:"grid gap-4 sm:grid-cols-2",children:d.EE.map(t=>{let a=t.width>2*t.height;return(0,l.jsxs)("button",{onClick:()=>e(t),className:"group relative flex flex-col items-center rounded-xl border-2 border-neutral-200 dark:border-neutral-700 p-5 hover:border-red-500 hover:shadow-lg transition-all text-left",children:[(0,l.jsx)("div",{className:"rounded-lg bg-gradient-to-br from-neutral-800 to-neutral-900 mb-4 flex items-center justify-center overflow-hidden border border-neutral-300 dark:border-neutral-600",style:{width:a?"100%":120,height:a?60:100,maxWidth:240,aspectRatio:`${t.width}/${t.height}`},children:(0,l.jsx)("div",{className:"text-center px-2",children:(0,l.jsxs)("p",{className:"text-[10px] text-neutral-400 font-medium",children:[t.width," \xd7 ",t.height]})})}),(0,l.jsxs)("div",{className:"text-center",children:[(0,l.jsx)("p",{className:"font-semibold text-neutral-900 dark:text-white group-hover:text-red-600 transition-colors",children:t.name}),(0,l.jsx)("p",{className:"text-xs text-neutral-500 mt-0.5",children:t.label})]}),(0,l.jsx)("div",{className:"flex items-center gap-1.5 mt-3 text-[10px] text-neutral-400",children:"sidebar"===t.category?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(c.A,{className:"h-3 w-3"}),(0,l.jsx)("span",{children:"Sidebar / Mobile"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(u.A,{className:"h-3 w-3"}),(0,l.jsx)("span",{children:"Topo / Desktop"})]})}),(0,l.jsx)("div",{className:"absolute inset-0 rounded-xl border-2 border-transparent group-hover:border-red-500 transition-colors pointer-events-none"})]},t.id)})})]})}var m=a(24338),h=a(36201),p=a(17243),f=a(56842),b=a(72055),g=a(51914),v=a(34220),j=a(68459),N=a(6489),w=a(21975),y=a(51900),k=a(86901);let C={enabled:!1,color:"#000000",blur:10,offsetX:4,offsetY:4,opacity:.5},S={enabled:!1,color:"#ffffff",blur:15};function I({elements:e,selectedElementId:t,onSelectElement:a,onUpdateElement:n,onAddElement:i,onAddOrUpdateBackgroun
1dImage:s,onDeleteElement:o,onReorderLayer:c,clickThroughUrl:u,onClickThroughUrlChange:x,bannerName:E,onBannerNameChange:A,templateWidth:G,templateHeight:R,usedColors:z=[],onColorUsed:F,authToken:M}){let T=e.filter(e=>e.editable),D=e.find(e=>e.id===t);function B(e,t,a,l){let r=Math.min(a/e,l/t);return{width:e*r,height:t*r}}let U=e=>{switch(e){case"text":return(0,l.jsx)(m.A,{className:"h-3.5 w-3.5"});case"rect":default:return(0,l.jsx)(h.A,{className:"h-3.5 w-3.5"});case"logo":case"image":return(0,l.jsx)(p.A,{className:"h-3.5 w-3.5"})}},$=e.filter(e=>e.id.startsWith("user-text-")).length,P=e.filter(e=>e.id.startsWith("user-img-")).length,[L,O]=(0,r.useState)(""),[H,X]=(0,r.useState)(!1),[Y,W]=(0,r.useState)(null),V=async()=>{if(!M)return void W("Fa\xe7a login para usar gera\xe7\xe3o com IA.");X(!0),W(null);try{let t=await fetch("/api/banner-generate-background",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({prompt:L||"gradiente azul escuro e vermelho, setor de minera\xe7\xe3o, abstrato",width:G,height:R})}),a=await t.json();if(!t.ok)throw Error(a.error||"Erro ao gerar");let l=a.dataUrl;if(!l)throw Error("Sem imagem na resposta");s?s(l):e.find(e=>"bg-img"===e.id)?n("bg-img",{src:l,width:G,height:R}):i({id:"bg-img",type:"image",label:"Imagem de fundo",editable:!0,x:0,y:0,width:G,height:R,src:l})}catch(e){W(e instanceof Error?e.message:"Erro ao gerar fundo com IA.")}finally{X(!1)}},_=D?.shadow??C,q=D?.glow??S,K=e=>{if(!D)return;let t={..._,...e};t.enabled&&q.enabled?n(D.id,{shadow:t,glow:{...q,enabled:!1}}):n(D.id,{shadow:t})},J=e=>{if(!D)return;let t={...q,...e};t.enabled&&_.enabled?n(D.id,{glow:t,shadow:{..._,enabled:!1}}):n(D.id,{glow:t})};return(0,l.jsxs)("div",{className:"space-y-4",children:[(0,l.jsxs)("div",{className:"space-y-3 p-3 rounded-lg bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-neutral-600 dar
1k:text-neutral-400 mb-1",children:"Nome do banner"}),(0,l.jsx)("input",{type:"text",value:E,onChange:e=>A(e.target.value),placeholder:"Ex: Banner Campanha Mar\xe7o",className:"w-full rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-3 py-1.5 text-sm outline-none focus:ring-1 focus:ring-red-500"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-neutral-600 dark:text-neutral-400 mb-1",children:"URL de destino"}),(0,l.jsx)("input",{type:"url",value:u,onChange:e=>x(e.target.value),placeholder:"https://seusite.com.br",className:"w-full rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-3 py-1.5 text-sm outline-none focus:ring-1 focus:ring-red-500"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-xs font-medium text-neutral-500 dark:text-neutral-400 mb-2 uppercase tracking-wider",children:"Elementos"}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[T.map(e=>(0,l.jsxs)("div",{className:"inline-flex items-center gap-0.5 rounded-md overflow-hidden border border-neutral-200 dark:border-neutral-700",children:[(0,l.jsxs)("button",{onClick:()=>a(e.id),className:`inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium transition-colors ${t===e.id?"bg-red-600 text-white":"bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dar
1k:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-700"}`,children:[U(e.type),e.label]}),c&&(0,l.jsxs)("div",{className:"flex border-l border-neutral-200 dark:border-neutral-600",children:[(0,l.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e.id,"back")},className:"p-1 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-700 dark:text-neutral-400",title:"Enviar para tr\xe1s",children:(0,l.jsx)(f.A,{className:"h-3 w-3"})}),(0,l.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e.id,"front")},className:"p-1 text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100 dark:hover:bg-neutral-700 dark:text-neutral-400",title:"Trazer \xe0 frente",children:(0,l.jsx)(b.A,{className:"h-3 w-3"})})]})]},e.id)),(0,l.jsxs)("button",{onClick:()=>{let e=`user-text-${Date.now()}`;i({id:e,type:"text",label:`Texto ${$+1}`,editable:!0,x:Math.round(.1*G),y:Math.round(.4*R),width:Math.round(.5*G),height:40,text:"Novo texto",fontSize:16,fontFamily:"Inter",fontStyle:"normal",fill:"#ffffff",align:"left",lineHeight:1.3}),a(e)},className:"inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium border-2 border-dashed border-neutral-300 dark:border-neutral-600 text-neutral-500 dark:text-neutral-400 hover:border-red-400 hover:text-red-500 transition-colors",children:[(0,l.jsx)(g.A,{className:"h-3.5 w-3.5"}),"Texto"]}),(0,l.jsxs)("button",{onClick:()=>{let e=document.createElement("input");e.type="file",e.accept="image/*",e.onchange=()=>{let t=e.files?.[0];if(!t)return;let l=new FileReader;l.onload=()=>{let e=l.result,t=new window.Image;t.onload=()=>{let l=B(t.naturalWidth,t.naturalHeight,Math.round(.4*G),Math.round(.6*R)),r=`user-img-${Date.now()}`;i({id:r,type:"image",label:`Imagem ${P+1}`,editable:!0,x:Math.round((G-l.width)/2),y:Math.round((R-l.height)/2),width:Math.round(l.width),height:Math.round(l.height),src:e}),a(r)},t.src=e},l.readAsDataURL(t)},e.click()},className:"inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium border-2 border-dashed border-neutral-300 dark:border-neutral-600 text-neutral-500 dark:text-neutral-400 hover:border-blue-400 hover:text-blue-500 transition-colors",children:[(0,l.jsx)(g.A,{className:"h-3.5 w-3.5"}),"Imagem"]}),(0,l.jsxs)("button",{onClick:()=>{let t=document.createElement("input");t.type="file",t.accept="image/*",t.onchange=()=>{let a=t.files?.[0];if(!a)return;let l=new FileReader;l.onload=()=>{let t=l.result;s?s(t):e.find(e=>"bg-img"===e.id)?n("bg-img",{src:t,width:G,height:R}):i({id:"bg-img",type:"image",label:"Imagem de fundo",editable:!0,x:0,y:0,width:G,height:R,src:t})},l.readAsDataURL(a)},t.click()},className:"inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium border-2 border-dashed border-neutral-300 dark:border-neutral-600 text-neutral-500 dark:text-neutral-400 hover:border-emerald-400 hover:text-emerald-500 transition-colors",children:[(0,l.jsx)(p.A,{className:"h-3.5 w-3.5"}),"Fundo"]}),M&&(0,l.jsxs)("div",{className:"flex flex-col gap-1 w-full mt-2",children:[(0,l.jsxs)("div",{className:"flex gap-1",children:[(0,l.jsx)("input",{type:"text",value:L,onChange:e=>O(e.target.value),placeholder:"Ex: gradiente azul e vermelho, minera\xe7\xe3o",className:"flex-1 rounded border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-2 py-1 text-xs"}),(0,l.jsxs)("button",{type:"button",onClick:V,disabled:H,className:"inline-flex items-center gap-1 rounded-md px-2.5 py-1.5 text-xs font-medium bg-violet-600 text-white hover:bg-violet-700 disabled:opacity-50",children:[H?"...":(0,l.jsx)(v.A,{className:"h-3.5 w-3.5"}),"IA"]})]}),Y&&(0,l.jsx)("p",{className:"text-[10px] text-red-500",children:Y})]})]})]}),D&&D.editable&&(0,l.jsxs)("div",{className:"space-y-3 p-3 rounded-lg bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2 pb-2 border-b border-neutral-200 dark:border-neutral-700",children:[U(D.type),(0,l.jsx)("span",{className:"text-sm font-medium text-neutral-900 dark:text-white",children:D.label}),(0,l.jsxs)("span",{className:"text-[10px] text-neutral-400 ml-auto",children:[D.width,"\xd7",D.height]}),(0,l.jsx)("button",{onClick:()=>{o(D.id),a(null)},className:"p-1 rounded text-neutral-400 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-950/20 transition-colors",title:"Remover elemento",children:(0,l.jsx)(j.A,{className:"h-3.5 w-3.5"})})]}),"text"===D.type&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-neutral-500 dark:text-neutral-400 mb-1",children:"Texto"}),(0,l.jsx)("textarea",{value:D.text||"",onChange:e=>n(D.id,{text:e.target.value}),rows:2,className:"w-full rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-3 py-1.5 text-sm outline-none focus:ring-1 focus:ring-red-500 resize-none"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-neutral-500 dark:text-neutral-400 mb-1",children:"Fonte"}),(0,l.jsx)("select",{value:D.fontFamily||"Inter",onChange:e=>n(D.id,{fontFamily:e.target.value}),className:"w-full rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-2 py-1.5 text-xs outline-none focus:ring-1 focus:ring-red-500",children:d.VK.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-neutral-500 dark:text-neutral-400 mb-1",children:"Tamanho"}),(0,l.jsx)("select",{value:D.fontSize||16,onChange:e=>n(D.id,{fontSize:Number(e.target.value)}),className:"w-full rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-2 py-1.5 text-xs outline-none focus:ring-1 focus:ring-red-500",children:d.$
1N.map(e=>(0,l.jsxs)("option",{value:e,children:[e,"px"]},e))})]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,l.jsx)("button",{onClick:()=>n(D.id,{fontStyle:"bold"===D.fontStyle?"normal":"bold"}),className:`rounded-md px-2 py-1.5 text-xs font-bold transition-colors ${"bold"===D.fontStyle||"bold italic"===D.fontStyle?"bg-red-600 text-white":"bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400"}`,children:"B"}),(0,l.jsx)("button",{onClick:()=>n(D.id,{fontStyle:"italic"===D.fontStyle?"normal":"italic"}),className:`rounded-md px-2 py-1.5 text-xs italic transition-colors ${"italic"===D.fontStyle||"bold italic"===D.fontStyle?"bg-red-600 text-white":"bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400"}`,children:"I"}),(0,l.jsxs)("select",{value:D.align||"left",onChange:e=>n(D.id,{align:e.target.value}),className:"rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-2 py-1.5 text-xs outline-none focus:ring-1 focus:ring-red-500",children:[(0,l.jsx)("option",{value:"left",children:"Esq."}),(0,l.jsx)("option",{value:"center",children:"Centro"}),(0,l.jsx)("option",{value:"right",children:"Dir."})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs font-medium text-neutral-500 dark:text-neutral-400 mb-1.5",children:[(0,l.jsx)(N.A,{className:"h-3 w-3"}),"Cor do texto"]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("input",{type:"color",value:D.fill||"#000000",onChange:e=>{let t=e.target.value;n(D.id,{fill:t}),F?.(t)},className:"h-8 w-8 rounded border border-neutral-300 dark:border-neutral-700 cursor-pointer",title:"Selecione no espectro"}),(0,l.jsx)("input",{type:"text",value:D.fill||"#000000",onChange:e=>{let t=e.target.value;/^#[0-9A-Fa-f]{6}$/.test(t)&&(n(D.id,{fill:t}),F?.(t))},className:"w-20 rounded border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-1.5 py-1 text-[10px] font-mono",placeholder:"#000000"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-1",children:[...new Set([...z.slice(-8),...d.dX.slice(0,6)])].map(e=>(0,l.jsx)("button",{onClick:()=>{n(D.id,{fill:e}),F?.(e)},className:"h-5 w-5 rounded-sm border border-neutral-300 dark:border-neutral-600 transition-transform hover:scale-110",style:{backgroundColor:e},title:e},e))})]})]})]}),"rect"===D.type&&(0,l.jsxs)("div",{className:"space-y-3",children:[(0,l.jsxs)("div",{children:[(0,l.jsxs)("label",{className:"flex items-center gap-1.5 text-xs font-medium text-neutral-500 dark:text-neutral-400 mb-1.5",children:[(0,l.jsx)(N.A,{className:"h-3 w-3"}),"Preenchimento"]}),(0,l.jsxs)("select",{value:D.fillGradient?.type??"solid",onChange:e=>{let t=e.target.value;"solid"===t?n(D.id,{fillGradient:null}):"linear"===t?n(D.id,{fillGradient:{type:"linear",angle:90,colorStops:[{position:0,color:D.fillColor||"#1a1a2e"},{position:1,color:"#2d3748"}]}}):"radial"===t&&n(D.id,{fillGradient:{type:"radial",centerX:.5,centerY:.5,radius:.5,colorStops:[{position:0,color:D.fillColor||"#1a1a2e"},{position:1,color:"#0f172a"}]}})},className:"w-full rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-2 py-1.5 text-xs outline-none focus:ring-1 focus:ring-red-500",children:[(0,l.jsx)("option",{value:"solid",children:"Cor s\xf3lida"}),(0,l.jsx)("option",{value:"linear",children:"Gradiente linear"}),(0,l.jsx)("option",{value:"radial",children:"Gradiente radial"})]})]}),(!D.fillGradient||"solid"===D.fillGradient.type)&&(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("input",{type:"color",value:D.fillColor||"#000000",onChange:e=>{let t=e.target.value;n(D.id,{fillColor:t}),F?.(t)},className:"h-8 w-8 rounded border border-neutral-300 dark:border-neutral-700 cursor-pointer",title:"Selecione"}),(0,l.jsx)("input",{type:"text",value:D.fillColor||"#000000",onChange:e=>{let t=e.target.value;/^#[0-9A-Fa-f]{6}$/.test(t)&&(n(D.id,{fillColor:t}),F?.(t))},className:"w-20 rounded border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-800 px-1.5 py-1 text-[10px] font-mono",placeholder:"#000000"}),(0,l.jsx)("div",{className:"flex flex-wrap gap-1",children:[...new Set([...z.slice(-8),...d.dX])].map(e=>(0,l.jsx)("button",{onClick:()=>{n(D.id,{fillColor:e}),F?.(e)},className:"h-5 w-5 rounded-sm border border-neutral-300 dark:border-neutral-600 transition-transform hover:scale-110",style:{backgroundColor:e},title:e},e))})]}),D.fillGradient?.type==="linear"&&(0,l.jsxs)("div",{className:"space-y-2 pl-1 border-l-2 border-neutral-200 dark:border-neutral-700",children:[(0,l.jsx)("label",{className:"block text-[10px] font-medium text-neutral-500",children:"\xc2ngulo (\xb0)"}),(0,l.jsx)("input",{type:"range",min:0,max:360,value:D.fillGradient.angle,onChange:e=>n(D.id,{fillGradient:{...D.fillGradient,angle:Number(e.target.value)}}),className:"w-full accent-red-600"}),(0,l.jsxs)("div",{className:"flex gap-2 items-end",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-[10px] font-medium text-neutral-500 mb-0.5",children:"Cor 1"}),(0,l.jsxs)("div",{className:"flex gap-1",children:[(0,l.jsx)("input",{type:"color",value:D.fillGradient.colorStops[0]?.color||"#1a1a2e",onCh
1ange:e=>{let t=D.fillGradient,a=[...t.colorStops];a[0]?a[0]={...a[0],color:e.target.value}:a.unshift({position:0,color:e.target.value}),n(D.id,{fillGradient:{...t,colorStops:a}}),F?.(e.target.value)},className:"h-6 w-6 rounded border cursor-pointer"}),(0,l.jsx)("input",{type:"text",value:D.fillGradient.colorStops[0]?.color||"#1a1a2e",onChange:e=>{let t=e.target.value;if(/^#[0-9A-Fa-f]{6}$/.test(t)){let e=D.fillGradient,a=[...e.colorStops];a[0]?a[0]={...a[0],color:t}:a.unshift({position:0,color:t}),n(D.id,{fillGradient:{...e,colorStops:a}}),F?.(t)}},className:"w-16 rounded border px-1 py-0.5 text-[10px] font-mono bg-white dark:bg-neutral-800"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-[10px] font-medium text-neutral-500 mb-0.5",children:"Cor 2"}),(0,l.jsxs)("div",{className:"flex gap-1",children:[(0,l.jsx)("input",{type:"color",value:D.fillGradient.colorStops[1]?.color||"#2d3748",onChange:e=>{let t=D.fillGradient,a=[...t.colorStops];a[1]?a[1]={...a[1],color:e.target.value}:(a[0]||a.push({position:0,color:a[0]?.color||"#1a1a2e"}),a.push({position:1,color:e.target.value})),n(D.id,{fillGradient:{...t,colorStops:a}}),F?.(e.target.value)},className:"h-6 w-6 rounded border cursor-pointer"}),(0,l.jsx)("input",{type:"text",value:D.fillGradient.colorStops[1]?.color||"#2d3748",onChange:e=>{let t=e.target.value;if(/^#[0-9A-Fa-f]{6}$/.test(t)){let e=D.fillGradient,a=[...e.colorStops];a[1]?a[1]={...a[1],color:t}:a[0]&&a.push({position:1,color:t}),n(D.id,{fillGradient:{...e,colorStops:a}}),F?.(t)}},className:"w-16 rounded border px-1 py-0.5 text-[10px] font-mono bg-white dark:bg-neutral-800"})]})]})]})]}),D.fillGradient?.type==="radial"&&(0,l.jsxs)("div",{className:"space-y-2 pl-1 border-l-2 border-neutral-200 dark:border-neutral-700",children:[(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-[10px] font-medium text-neutral-500",children:"Centro X (%)"}),(0,l.jsx)("input",{type:"range",min:0,max:100,value:(D.fillGradient.centerX??.5)*100,onChange:e=>n(D.id,{fillGradient:{...D.fillGradient,centerX:Number(e.target.value)/100}}),className:"w-full accent-red-600"})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-[10px] font-medium text-neutral-500",children:"Centro Y (%)"}),(0,l.jsx)("input",{type:"range",min:0,max:100,value:(D.fillGradient.centerY??.5)*100,onChange:e=>n(D.id,{fillGradient:{...D.fillGradient,centerY:Number(e.target.value)/100}}),className:"w-full accent-red-600"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-[10px] font-medium text-neutral-500",children:"Raio (%)"}),(0,l.jsx)("input",{type:"range",min:10,max:100,value:(D.fillGradient.radius??.5)*100,onChange:e=>n(D.id,{fillGradient:{...D.fillGradient,radius:Number(e.target.value)/100}}),className:"w-full accent-red-600"})]}),(0,l.jsxs)("div",{className:"flex gap-2 items-end",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-[10px] font-medium text-neutral-500 mb-0.5",children:"Cor centro"}),(0,l.jsxs)("div",{className:"flex gap-1",children:[(0,l.jsx)("input",{type:"color",value:D.fillGradient.colorStops[0]?.color||"#1a1a2e",onChange:e=>{let t=D.fillGradient,a=[...t.colorStops];a[0]?a[0]={...a[0],color:e.target.value}:a.unshift({position:0,color:e.target.value}),n(D.id,{fillGradient:{...t,colorStops:a}}),F?.(e.target.value)},className:"h-6 w-6 rounded border cursor-pointer"}),(0,l.jsx)("input",{type:"text",value:D.fillGradient.colorStops[0]?.color||"#1a1a2e",readOnly:!0,className:"w-16 rounded border px-1 py-0.5 text-[10px] font-mono bg-white dark:bg-neutral-800"})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-[10px] font-medium text-neutral-500 mb-0.5",children:"Cor borda"}),(0,l.jsxs)("div",{className:"flex gap-1",children:[(0,l.jsx)("input",{type:"color",value:D.fillGradient.colorStops[1]?.color||"#0f172a",onChange:e=>{let t=D.fillGradient,a=[...t.colorStops];a[1]?a[1]={...a[1],color:e.target.value}:a.push({position:1,color:e.target.value}),n(D.id,{fillGradient:{...t,colorStops:a}}),F?.(e.target.value)},className:"h-6 w-6 rounded border cursor-pointer"}),(0,l.jsx)("input",{type:"text",value:D.fillGradient.colorStops[1]?.color||"#0f172a",readOnly:!0,className:"w-16 rounded border px-1 py-0.5 text-[10px] font-mono bg-white dark:bg-neutral-800"})]})]})]})]}),D.id.includes("cta")&&(0,l.jsxs)("div",{className:"mt-3",children:[(0,l.jsx)("label",{className:"block text-xs font-medium text-neutral-500 dark:text-neutral-400 mb-1",children:"Arredondamento"}),(0,l.jsx)("input",{type:"range",min:0,max:Math.min(D.width,D.height)/2,value:D.cornerRadius||0,onChange:e=>n(D.id,{cornerRadius:Number(e.target.value)}),className:"w-full accent-red-600"})]})]}),("logo"===D.type||"image"===D.type)&&(0,l.jsx)("div",{className:"space-y-3",children:(0,l.jsxs)("label",{className:"flex flex-col items-center justify-center rounded-lg border-2 border-dashed border-neutral-300 dark:border-neutral-700 p-4 cursor-pointer hover:border-red-400 transition-colors",children:[D.src?(0,l.jsx)("img",{src:D.src,alt:"Preview",className:"max-h-20 object-contain mb-2 rounded",style:{background:"repeating-conic-gradient(#d4d4d8 0% 25%, transparent 0% 50%) 50% / 12px 12px"}}):(0,l.jsx)(w.A,{className:"h-6 w-6 text-neutral-400 mb-2"}),(0,l.jsx)("span",{className:"text-xs text-neutral-500",children:D.src?"Trocar imagem":"Enviar imagem (PNG com transpar\xeancia)"}),(0,l.jsx)("input",{type:"file",accept:"image/png,image/svg+xml,image/webp,image/*",className:"hidden",onChange:e=>{var t;let a,l=e.target.files?.[0];l&&(t=D.id,(a=new FileReader).onload=()=>{let e=a.result,l=new window.Image;l.onload=()=>
1{let a=B(l.naturalWidth,l.naturalHeight,D.width,D.height);n(t,{src:e,width:Math.round(a.width),height:Math.round(a.height)})},l.src=e},a.readAsDataURL(l))}})]})}),("text"===D.type||"logo"===D.type||"image"===D.type||D.id.includes("cta"))&&(0,l.jsxs)("div",{className:"space-y-3 pt-2 border-t border-neutral-200 dark:border-neutral-700",children:[(0,l.jsx)("p",{className:"text-xs font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-wider",children:"Efeitos"}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:_.enabled,onChange:e=>K({enabled:e.target.checked}),className:"h-3.5 w-3.5 rounded border-neutral-300 text-red-600 accent-red-600"}),(0,l.jsx)(y.A,{className:"h-3.5 w-3.5 text-neutral-500"}),(0,l.jsx)("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-300",children:"Sombra"})]}),_.enabled&&(0,l.jsxs)("div",{className:"pl-6 space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-[10px] text-neutral-500 w-12",children:"Cor"}),(0,l.jsx)("input",{type:"color",value:_.color,onChange:e=>K({color:e.target.value}),className:"h-6 w-6 rounded border border-neutral-300 dark:border-neutral-700 cursor-pointer"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-[10px] text-neutral-500 w-12",children:"Blur"}),(0,l.jsx)("input",{type:"range",min:0,max:30,value:_.blur,onChange:e=>K({blur:Number(e.target.value)}),className:"flex-1 accent-red-600"}),(0,l.jsx)("span",{className:"text-[10px] text-neutral-400 w-6 text-right",children:_.blur})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-[10px] text-neutral-500 w-12",children:"X"}),(0,l.jsx)("input",{type:"range",min:-20,max:20,value:_.offsetX,onChange:e=>K({offsetX:Number(e.target.value)}),className:"flex-1 accent-red-600"}),(0,l.jsx)("span",{className:"text-[10px] text-neutral-400 w-6 text-right",children:_.offsetX})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-[10px] text-neutral-500 w-12",children:"Y"}),(0,l.jsx)("input",{type:"range",min:-20,max:20,value:_.offsetY,onChange:e=>K({offsetY:Number(e.target.value)}),className:"flex-1 accent-red-600"}),(0,l.jsx)("span",{className:"text-[10px] text-neutral-400 w-6 text-right",children:_.offsetY})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-[10px] text-neutral-500 w-12",children:"Opac."}),(0,l.jsx)("input",{type:"range",min:0,max:100,value:Math.round(100*_.opacity),onChange:e=>K({opacity:Number(e.target.value)/100}),className:"flex-1 accent-red-600"}),(0,l.jsxs)("span",{className:"text-[10px] text-neutral-400 w-6 text-right",children:[Math.round(100*_.opacity),"%"]})]})]})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,l.jsx)("input",{type:"checkbox",checked:q.enabled,onChange:e=>J({enabled:e.target.checked}),className:"h-3.5 w-3.5 rounded border-neutral-300 text-red-600 accent-red-600"}),(0,l.jsx)(k.A,{className:"h-3.5 w-3.5 text-neutral-500"}),(0,l.jsx)("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-300",children:"Glow"})]}),q.enabled&&(0,l.jsxs)("div",{className:"pl-6 space-y-2",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-[10px] text-neutral-500 w-12",children:"Cor"}),(0,l.jsx)("input",{type:"color",value:q.color,onChange:e=>J({color:e.target.value}),className:"h-6 w-6 rounded border border-neutral-300 dark:border-neutral-700 cursor-pointer"}),(0,l.jsx)("div",{className:"flex gap-1 ml-1",children:["#ffffff","#e63946","#3b82f6","#22c55e","#f59e0b"].map(e=>(0,l.jsx)("button",{onClick:()=>J({color:e}),className:"h-4 w-4 rounded-sm border border-neutral-300 dark:border-neutral-600 transition-transform hover:scale-110",style:{backgroundColor:e}},e))})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("label",{className:"text-[10px] text-neutral-500 w-12",children:"Blur"}),(0,l.jsx)("input",{type:"range",min:2,max:40,value:q.blur,onChange:e=>J({blur:Number(e.target.value)}),className:"flex-1 accent-red-600"}),(0,l.jsx)("span",{className:"text-[10px] text-neutral-400 w-6 text-right",children:q.blur})]})]})]})]})]}),!D&&(0,l.jsx)("div",{className:"text-center py-6 text-sm text-neutral-400",children:"Selecione um elemento no canvas ou na lista acima para editar"})]})}var E=a(55711),A=a(44529),G=a(9199),R=a(6962),z=a(55243);function F({canUndo:e,canRedo:t,onUndo:a,onRedo:r,onReset:n,onExport:i,onSave:s,saving:d,bannerName:o,clickThroughUrl:c}){let u=o.trim().length>0&&c.trim().length>0;return(0,l.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-2 rounded-lg bg-neutral-50 dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800",children:[(0,l.jsxs)("div",{className:"flex items-center gap-1",children:[(0,l.jsx)("button",{onClick:a,disabled:!e,title:"Desfazer",className:"p-2 rounded-md text-neutral-600 dar
1k:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 transition-colors",children:(0,l.jsx)(E.A,{className:"h-4 w-4"})}),(0,l.jsx)("button",{onClick:r,disabled:!t,title:"Refazer",className:"p-2 rounded-md text-neutral-600 dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-800 disabled:opacity-30 transition-colors",children:(0,l.jsx)(A.A,{className:"h-4 w-4"})}),(0,l.jsx)("div",{className:"w-px h-5 bg-neutral-200 dark:bg-neutral-700 mx-1"}),(0,l.jsx)("button",{onClick:n,title:"Resetar template",className:"p-2 rounded-md text-neutral-600 dark:text-neutral-400 hover:bg-neutral-200 dark:hover:bg-neutral-800 transition-colors",children:(0,l.jsx)(G.A,{className:"h-4 w-4"})})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)("button",{onClick:i,title:"Baixar PNG",className:"inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium text-neutral-600 dark:text-neutral-400 bg-neutral-100 dark:bg-neutral-800 hover:bg-neutral-200 dark:hover:bg-neutral-700 transition-colors",children:[(0,l.jsx)(R.A,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{className:"hidden sm:inline",children:"Baixar"})]}),(0,l.jsxs)("button",{onClick:s,disabled:d||!u,title:u?"Salvar criativo":"Preencha nome e URL de destino",className:"inline-flex items-center gap-1.5 rounded-md px-4 py-1.5 text-xs font-medium text-white bg-red-600 hover:bg-red-700 disabled:opacity-50 transition-colors",children:[d?(0,l.jsx)("div",{className:"h-3.5 w-3.5 border-2 border-white/30 border-t-white rounded-full animate-spin"}):(0,l.jsx)(z.A,{className:"h-3.5 w-3.5"}),(0,l.jsx)("span",{children:d?"Salvando...":"Salvar"})]})]})]})}var M=a(80723);let T=(0,n.default)(()=>Promise.all([a.e(10179),a.e(11296)]).then(a.bind(a,88915)).then(e=>({default:e.BannerEditorCanvas})),{loadableGenerated:{webpack:()=>[88915]},ssr:!1,loading:()=>(0,l.jsx)("div",{className:"flex items-center justify-center h-48 text-neutral-400 text-sm",children:"Carregando editor..."})});function D({open:e,onOpenChange:t,onSave:a,authToken:n,editCreative:d}){let[o,c]=(0,r.useState)("select"),[u,m]=(0,r.useState)(null),[h,p]=(0,r.useState)([]),[f,b]=(0,r.useState)(null),[g,j]=(0,r.useState)(""),[N,w]=(0,r.useState)(""),[y,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(null),[E,A]=(0,r.useState)([]),[G,R]=(0,r.useState)(-1),[z,B]=(0,r.useState)([]),[U,$]=(0,r.useState)(null),P=(0,r.useRef)(null),L=!!u&&u.width/u.height>2;(0,r.useEffect)(()=>{if(e&&d?.editorState){let{template:e,elements:t}=d.editorState;m(e);let a=t.map((e,t)=>({...e,zIndex:e.zIndex??t})),l=a.find(e=>"bg"===e.id);if(l&&"image"===l.type&&l.src){let t=e.width,r=e.height,n=a.findIndex(e=>"bg"===e.id),i=a[n]?.zIndex??n,s={id:"bg-img",type:"image",label:"Imagem de fundo",editable:!0,x:0,y:0,width:t,height:r,src:l.src,zIndex:i+1};a.splice(n,1,{id:"bg",type:"rect",label:"Fundo",editable:!0,x:0,y:0,width:t,height:r,fillColor:"#1a1a2e",cornerRadius:0,zIndex:i},s)}p(a),A([a.map(e=>({...e}))]),R(0),j(d.name),w(d.clickThroughUrl||""),S(d.id),c("edit");let r=[];t.forEach(e=>{e.fill&&/^#[0-9A-Fa-f]{6}$/.test(e.fill)&&r.push(e.fill),e.fillColor&&/^#[0-9A-Fa-f]{6}$/.test(e.fillColor)&&r.push(e.fillColor)}),B([...new Set(r)].slice(-12))}else e&&!d&&(S(null),B([]))},[e,d]);let O=(0,r.useCallback)(e=>{A(t=>[...t.slice(0,G+1),e]),R(e=>e+1)},[G]),H=(e,t)=>{let a=h.map(a=>a.id===e?{...a,...t}:a);p(a),O(a)},X=(e,t,a)=>{let l=h.map(l=>l.id===e?{...l,x:t,y:a}:l);p(l),O(l)},Y=(e,t,a,l,r)=>{let n=h.map(n=>n.id===e?{...n,width:t,height:a,x:l,y:r}:n);p(n),O(n)},W=e=>{let t=h.length?Math.max(...h.map(e=>e.zIndex??0)):-1,a=[...h,{...e,zIndex:t+1}];p(a),O(a)},V=(0,r.useCallback)(e=>{if(u)if(h.find(e=>"bg-img"===e.id))H("bg-img",{src:e,width:u.width,height:u.height});else{let t=h.findIndex(e=>"bg"===e.id),a=t>=0?t+1:0,l=h[a]?.zIndex??a,r={id:"bg-img",type:"image",label:"Imagem de fundo",editable:!0,x:0,y:0,width:u.width,height:u.height,src:e,zIndex:l},n=[...h.slice(0,a),r,...h.slice(a)];p(n),O(n)}},[h,u,H,O]),_=(0,r.useCallback)(e=>{B(t=>[...t.filter(t=>t!==e),e].slice(-12))},[]),q=(0,r.useCallback)((e,t,a)=>{let l=h.find(t=>
1t.id===e);if(l&&u){if("rect"===l.type&&"bg"===l.id)V(t);else if("bg-img"===l.id)H("bg-img",{src:t,width:u.width,height:u.height});else if("logo"===l.type||"image"===l.type){let a=new window.Image;a.onload=()=>{let r=Math.min((l.width||100)/a.naturalWidth,(l.height||100)/a.naturalHeight);H(e,{src:t,width:Math.round(a.naturalWidth*r),height:Math.round(a.naturalHeight*r)})},a.src=t}}},[h,u,H]),K=e=>{let t=h.filter(t=>t.id!==e);p(t),O(t),f===e&&b(null)},J=(0,r.useCallback)((e,t)=>{let a=h.find(t=>t.id===e);if(!a)return;a.zIndex??h.indexOf(a);let l=h.map((e,t)=>e.zIndex??t);if("front"===t){let t=Math.max(...l,0)+1,a=h.map(a=>a.id===e?{...a,zIndex:t}:a);p(a),O(a)}else{let t=Math.max(0,Math.min(...l)-1),a=h.map(a=>a.id===e?{...a,zIndex:t}:a);p(a),O(a)}},[h,O]);(0,r.useEffect)(()=>{if("edit"!==o)return;let e=e=>{let t=e.target,a="INPUT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable;if("Delete"===e.key||"Backspace"===e.key)!a&&f&&(e.preventDefault(),K(f),b(null));else if(e.ctrlKey||e.metaKey){if("c"===e.key){if(!a&&f){let t=h.find(e=>e.id===f);t&&"bg"!==t.id&&"bg-img"!==t.id&&(e.preventDefault(),$({...t}))}}else if("v"===e.key&&!a&&U&&u){e.preventDefault();let t=U.id.startsWith("user-")?U.id.split("-").slice(0,3).join("-"):`user-${U.type}`,a=`${t}-${Date.now()}`,l=h.length?Math.max(...h.map(e=>e.zIndex??0)):-1,r=[...h,{...JSON.parse(JSON.stringify(U)),id:a,x:U.x+12,y:U.y+12,zIndex:l+1}];p(r),O(r),b(a)}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o,f,h,U,u,K,O]);let Q=async()=>{if(!u||!P.current)return;let e=P.current.exportPNG();if(e){k(!0);try{await a({dataUrl:e,name:g,clickThroughUrl:N,width:u.width,height:u.height,templateId:u.id,editorState:{elements:h,template:u},creativeId:C||void 0}),Z()}catch(e){console.error("Failed to save banner:",e)}finally{k(!1)}}},Z=()=>{c("select"),m(null),p([]),b(null),j(""),w(""),S(null),A([]),R(-1),k(!1),t(!1)};return(0,l.jsx)(i.lG,{open:e,onOpenChange:e=>{e||Z()},children:(0,l.jsxs)(i.Cf,{className:"max-w-5xl w-[95vw] max-h-[90vh] overflow-y-auto p-0",onInteractOutside:e=>e.preventDefault(),children:[(0,l.jsx)(s.bL,{children:(0,l.jsx)(i.L3,{children:"Editor de Banner"})}),"select"===o&&(0,l.jsx)("div",{className:"p-6",children:(0,l.jsx)(x,{onSelect:e=>{let t=e.elements.map((e,t)=>({...e,zIndex:e.zIndex??t}));m(e),p(t),A([t]),R(0),b(null),j(""),w(""),c("edit")}})}),"edit"===o&&u&&(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-neutral-200 dark:border-neutral-800",children:[(0,l.jsx)("button",{onClick:()=>c("select"),className:"p-1.5 rounded-md text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-colors",title:"Voltar",children:(0,l.jsx)(M.A,{className:"h-4 w-4"})}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(v.A,{className:"h-4 w-4 text-red-500"}),(0,l.jsx)("span",{className:"text-sm font-semibold text-neutral-900 dark:text-white",children:u.name}),(0,l.jsxs)("span",{className:"text-xs text-neutral-400",children:[u.width,"\xd7",u.height]})]})]}),(0,l.jsx)("div",{className:"px-4 pt-3",children:(0,l.jsx)(F,{canUndo:G>0,canRedo:G<E.length-1,onUndo:()=>{if(G<=0)return;let e=G-1;R(e),p(E[e].map(e=>({...e})))},onRedo:()=>
1{if(G>=E.length-1)return;let e=G+1;R(e),p(E[e].map(e=>({...e})))},onReset:()=>{if(!u)return;let e=u.elements.map(e=>({...e}));p(e),O(e),b(null)},onExport:()=>{let e=P.current?.exportPNG();if(!e)return;let t=document.createElement("a");t.download=`${g||"banner"}.png`,t.href=e,t.click()},onSave:Q,saving:y,bannerName:g,clickThroughUrl:N})}),L?(0,l.jsxs)("div",{className:"flex flex-col gap-4 p-4",children:[(0,l.jsx)(T,{ref:P,width:u.width,height:u.height,elements:h,selectedElementId:f,onSelectElement:b,onElementMove:X,onElementResize:Y,onTextChange:(e,t)=>H(e,{text:t}),onImageDrop:q}),(0,l.jsx)(I,{elements:h,selectedElementId:f,onSelectElement:b,onUpdateElement:H,onAddElement:W,onAddOrUpdateBackgroundImage:V,onDeleteElement:K,onReorderLayer:J,clickThroughUrl:N,onClickThroughUrlChange:w,bannerName:g,onBannerNameChange:j,templateWidth:u.width,templateHeight:u.height,usedColors:z,onColorUsed:_,authToken:n})]}):(0,l.jsxs)("div",{className:"flex flex-col md:flex-row gap-4 p-4",children:[(0,l.jsx)("div",{className:"md:order-2 md:flex-1",children:(0,l.jsx)("div",{className:"sticky top-0",children:(0,l.jsx)(T,{ref:P,width:u.width,height:u.height,elements:h,selectedElementId:f,onSelectElement:b,onElementMove:X,onElementResize:Y,onTextChange:(e,t)=>
1H(e,{text:t})})})}),(0,l.jsx)("div",{className:"md:order-1 md:w-[320px] md:shrink-0",children:(0,l.jsx)(I,{elements:h,selectedElementId:f,onSelectElement:b,onUpdateElement:H,onAddElement:W,onAddOrUpdateBackgroundImage:V,onDeleteElement:K,onReorderLayer:J,clickThroughUrl:N,onClickThroughUrlChange:w,bannerName:g,onBannerNameChange:j,templateWidth:u.width,templateHeight:u.height,usedColors:z,onColorUsed:_,authToken:n})})]})]})]})})}},42763:(e,t,a)=>{a.d(t,{Cf:()=>m,Es:()=>p,HM:()=>u,L3:()=>f,c7:()=>h,lG:()=>d,rr:()=>b,zM:()=>o});var l=a(95155),r=a(12115),n=a(43146),i=a(33210),s=a(40980);let d=n.bL,o=n.l9,c=n.ZL,u=n.bm,x=r.forwardRef(({className:e,...t},a)=>(0,l.jsx)(n.hJ,{ref:a,className:(0,s.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));x.displayName=n.hJ.displayName;let m=r.forwardRef(({className:e,children:t,hideCloseButton:a,...r},d)=>(0,l.jsxs)(c,{children:[(0,l.jsx)(x,{}),(0,l.jsxs)(n.UC,{ref:d,className:(0,s.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,!a&&(0,l.jsxs)(n.bm,{className:"absolute right-4 top-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,l.jsx)(i.A,{className:"h-4 w-4"}),(0,l.jsx)("span",{className:"sr-only",children:"Fechar"})]})]})]}));m.displayName=n.UC.displayName;let h=({className:e,...t})=>(0,l.jsx)("div",{className:(0,s.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});h.displayName="DialogHeader";let p=({className:e,...t})=>(0,l.jsx)("div",{className:(0,s.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});p.displayName="DialogFooter";let f=r.forwardRef(({className:e,...t},a)=>(0,l.jsx)(n.hE,{ref:a,className:(0,s.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));f.displayName=n.hE.displayName;let b=r.forwardRef(({className:e,...t},a)=>(0,l.jsx)(n.VY,{ref:a,className:(0,s.cn)("text-sm text-muted-foreground",e),...t}));b.displayName=n.VY.displayName},45160:(e,t,a)=>{a.d(t,{E:()=>s});var l=a(95155);a(12115);var r=a(18460),n=a(40980);let i=(0,r.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function s({className:e,variant:t,...a}){return(0,l.jsx)("span",{className:(0,n.cn)(i({variant:t}),e),...a})}},48375:(e,t,a)=>{a.d(t,{A:()=>o,O:()=>d});var l=a(95155),r=a(12115),n=a(65140),i=a(19865);let s=(0,r.createContext)(void 0);function d({children:e}){let[t,a]=(0,r.useState)(null),[o,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(null),[m,h]=(0,r.useState)(null),[p,f]=(0,r.useState)(!0),[b,g]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e,t=!1,l=()=>{t||(e=(0,n.hg)(i.j2,async e=>{if(a(e),g(!!e?.emailVerified),e)try{let t=await e.getIdToken(),a=await fetch("/api/auth/me",{headers:{Authorization:`Bearer ${t}`}}),l=a.ok?await a.json():null;c(l?.user??null),x(l?.profile??null),h(l?.access??null)}catch(e){console.error("[AuthContext] Failed to fetch user data:",e),c(null),x(null),h(null)}else c(null),x(null),h(null);f(!1)}))},r="function"==typeof window.requestIdleCallback?window.requestIdleCallback(l,{timeout:2e3}):window.setTimeout(l,0);return()=>{t=!0,"function"==typeof window.cancelIdleCallback?window.cancelIdleCallback(r):window.clearTimeout(r),e?.()}},[]);let v=(0,r.useMemo)(()=>m?.isAdmin??o?.role==="admin",[m,o]),j=(0,r.useMemo)(()=>m?.isEditor??(o?.role==="admin"||o?.role==="editor"),[m,o]),N=(0,r.useMemo)(()=>m?.dashboardPermissions??o?.dashboardPermissions??[],[m,o]),w=(0,r.useMemo)(()=>e=>v||N.includes(e),[v,N]),y=(0,r.useMemo)(()=>!!t,[t]),k=(0,r.useMemo)(()=>u?.accountType==="premium",[u]),C=(0,r.useMemo)(()=>!!u?.isAdvertiser,[u]),S=async()=>{await i.j2.currentUser?.reload(),g(!!i.j2.currentUser?.emailVerified)},I=(0,r.useMemo)(()=>({user:t,appUser:o,userProfile:u,isLoading:p,isAdmin:v,isEditor:j,dashboardPermissions:N,hasFeature:w,isAuthenticated:y,isPremium:k,isAdvertiser:C,emailVerified:b,refreshEmailVerified:S}),[t,o,u,p,v,j,N,w,y,k,C,b]);return(0,l.jsx)(s.Provider,{value:I,children:e})}function o(){let e=(0,r.useContext)(s);if(void 0===e)throw Error("useAuth must be used within an AuthProvider");return e}}
1,81477:(e,t,a)=>{a.d(t,{BT:()=>o,Wu:()=>c,ZB:()=>d,Zp:()=>i,aR:()=>s});var l=a(95155),r=a(12115),n=a(40980);let i=r.forwardRef(({className:e,...t},a)=>(0,l.jsx)("div",{ref:a,className:(0,n.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));i.displayName="Card";let s=r.forwardRef(({className:e,...t},a)=>(0,l.jsx)("div",{ref:a,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",e),...t}));s.displayName="CardHeader";let d=r.forwardRef(({className:e,...t},a)=>(0,l.jsx)("div",{ref:a,className:(0,n.cn)("text-2xl font-semibold leading-none tracking-tight",e),...t}));d.displayName="CardTitle";let o=r.forwardRef(({className:e,...t},a)=>(0,l.jsx)("div",{ref:a,className:(0,n.cn)("text-sm text-muted-foreground",e),...t}));o.displayName="CardDescription";let c=r.forwardRef(({className:e,...t},a)=>(0,l.jsx)("div",{ref:a,className:(0,n.cn)("p-6 pt-0",e),...t}));c.displayName="CardContent",r.forwardRef(({className:e,...t},a)=>(0,l.jsx)("div",{ref:a,className:(0,n.cn)("flex items-center p-6 pt-0",e),...t})).displayName="CardFooter"},82724:(e,t,a)=>{a.d(t,{$N:()=>s,EE:()=>n,Nw:()=>r,VK:()=>i,dX:()=>d,gs:()=>l});let l={id:"sidebar-300x250-v1",name:"Sidebar 300\xd7250",label:"Ret\xe2ngulo M\xe9dio",width:300,height:250,category:"sidebar",elements:[{id:"bg",type:"rect",label:"Fundo",editable:!0,x:0,y:0,width:300,height:250,fillColor:"#1a1a2e",cornerRadius:0},{id:"accent",type:"rect",label:"Faixa de destaque",editable:!0,x:0,y:0,width:300,height:6,fillColor:"#e63946",cornerRadius:0},{id:"logo",type:"logo",label:"Logo",editable:!0,x:100,y:24,width:100,height:50,objectFit:"contain"},{id:"headline",type:"text",label:"T\xedtulo",editable:!0,x:20,y:88,width:260,height:60,text:"Seu t\xedtulo aqui",fontSize:22,fontFamily:"Inter",fontStyle:"bold",fill:"#ffffff",align:"center",lineHeight:1.2},{id:"subtitle",type:"text",label:"Subt\xedtulo",editable:!0,x:20,y:152,width:260,height:40,text:"Descri\xe7\xe3o breve do seu an\xfancio",fontSize:13,fontFamily:"Inter",fontStyle:"normal",fill:"#cccccc",align:"center",lineHeight:1.3},{id:"cta-bg",type:"rect",label:"Fundo do bot\xe3o",editable:!0,x:75,y:200,width:150,height:36,fillColor:"#e63946",cornerRadius:18},{id:"cta",type:"text",label:"Bot\xe3o CTA",editable:!0,x:75,y:200,width:150,height:36,text:"Saiba mais",fontSize:14,fontFamily:"Inter",fontStyle:"bold",fill:"#ffffff",align:"center",lineHeight:2.5}]},r={id:"leaderboard-1095x250-v1",name:"Leaderboard 1095\xd7250",label:"Banner Horizontal",width:1095,height:250,category:"leaderboard",elements:[{id:"bg",type:"rect",label:"Fundo",editable:!0,x:0,y:0,width:1095,height:250,fillColor:"#0f172a",cornerRadius:0},{id:"accent",type:"rect",label:"Faixa lateral",editable:!0,x:0,y:0,width:8,height:250,fillColor:"#e63946",cornerRadius:0},{id:"logo",type:"logo",label:"Logo",editable:!0,x:40,y:60,width:160,height:130,objectFit:"contain"},{id:"headline",type:"text",label:"T\xedtulo",editable:!0,x:240,y:50,width:500,height:70,text:"Seu t\xedtulo aqui",fontSize:32,fontFamily:"Inter",fontStyle:"bold",fill:"#ffffff",align:"left",lineHeight:1.15},{id:"subtitle",type:"text",label:"Subt\xedtulo",editable:!0,x:240,y:128,width:500,height:50,text:"Descri\xe7\xe3o breve do seu an\xfancio com mais detalhes",fontSize:16,fontFamily:"Inter",fontStyle:"normal",fill:"#94a3b8",align:"left",lineHeight:1.4},{id:"cta-bg",type:"rect",label:"Fundo do bot\xe3o",editable:!0,x:870,y:95,width:180,height:48,fillColor:"#e63946",cornerRadius:24},{id:"cta",type:"text",label:"Bot\xe3o CTA",editable:!0,x:870,y:95,width:180,height:48,text:"Saiba mais",fontSize:16,fontFamily:"Inter",fontStyle:"bold",fill:"#ffffff",align:"center",lineHeight:2.9}]},n=[l,r],i=[{label:"Inter",value:"Inter"},{label:"Roboto",value:"Roboto"},{label:"Montserrat",value:"Montserrat"},{label:"Open Sans",value:"Open Sans"},{label:"Lato",value:"Lato"},{label:"Oswald",value:"Oswald"},{label:"Poppins",value:"Poppins"},{label:"Raleway",value:"Raleway"},{label:"Playfair Display",value:"Playfair Display"},{label:"Merriweather",value:"Merriweather"},{label:"Source Sans Pro",value:"Source Sans Pro"},{label:"Bebas Neue",value:"Bebas Neue"},{label:"Arial",value:"Arial"},{label:"Georgia",value:"Georgia"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"}],s=[8,10,12,14,16,18,20,24,28,32,36,40,48,56,64,72],d=["#e63946","#1d3557","#457b9d","#a8dadc","#f1faee","#264653","#2a9d8f","#e9c46a","#f4a261","#e76f51","#0f172a","#1e293b","#334155","#ffffff","#000000"]}}]);
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.