PageSourceSearch

https://www.visitecamposdojordao.org.br/assets/SiteSettings-C21wosDo.js

js visitecamposdojordao.org.br collected 2026-09-25 09:01:22 UTC 26,131 bytes, 7 lines download raw bytes

1import{r as a,j as e}from"./vendor-react-CoH7wDUq.js";import{ad as B,ae as G,af as I,u as V,ag as H,ah as Y,ai as J,aj as Q}from"./AdminApp-DooYmww9.js";import{m as M,D as O,c as _}from"./useHomeHeroImages-DKZkHjE3.js";import{p as F}from"./index-co-p2Yz-.js";import"./vendor-pdf-DNjb9-t8.js";function $(i){try{return new Date(i).toLocaleString("pt-BR",{dateStyle:"short",timeStyle:"medium"})}catch{return i}}function Z(){const[i,f]=a.useState([]),[j,L]=a.useState(!0),[E,g]=a.useState(""),[y,A]=a.useState(""),[w,u]=a.useState(""),[N,S]=a.useState(""),[r,o]=a.useState(""),[d,v]=a.useState("editor"),[c,b]=a.useState(!1),P=a.useCallback(()=>{L(!0),g(""),B().then(p=>f(p.users)).catch(()=>g("Não foi possível carregar a lista de administradores.")).finally(()=>L(!1))},[]);a.useEffect(()=>{P()},[P]);const z=async p=>{p.preventDefault(),b(!0),g(""),A("");try{await I({email:w.trim(),name:N.trim(),password:r,role:d}),A("Utilizador criado. Pode enviar-lhe o e-mail e a senha por um canal seguro."),u(""),S(""),o(""),v("editor"),P()}catch(U){g(U instanceof Error?U.message:"Falha ao criar")}finally{b(!1)}};return e.jsxs("div",{className:"mt-10 max-w-6xl space-y-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-slate-800 md:text-xl",style:{fontFamily:"'Poppins', sans-serif"},children:"Administradores"}),e.jsxs("p",{className:"mt-1 text-sm text-slate-500",children:["O login no painel é feito com o ",e.jsx("strong",{children:"e-mail"}),". O nome de utilizador é apenas para identificação no relatório."]})]}),E&&e.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:E}),y&&e.jsx("div",{className:"rounded-lg border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-800",children:y}),e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-4 shadow-sm md:p-6",children:[e.jsx("h3",{className:"mb-4 text-base font-semibold text-slate-800",children:"Novo utilizador"}),e.jsxs("form",{onSubmit:z,className:"grid max-w-xl gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-slate-700",children:"E-mail"}),e.jsx("input",{type:"email",value:w,onChange:p=>u(p.target.value),className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-slate-700",children:"Nome de utilizador"}),e.jsx("input",{type:"text",value:N,onChange:p=>S(p.target.value),className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm",required:!0,minLength:2})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-slate-700",children:"Perfil"}),e.jsxs("select",{value:d,onChange:p=>v(p.target.value),className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm",children:[e.jsx("option",{value:"editor",children:"Editor (conteúdo)"}),e.jsx("option",{value:"admin",children:"Administrador (inclui esta área)"})]})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-slate-700",children:"Senha inicial"}),e.jsx("input",{type:"password",value:r,onChange:p=>o(p.target.value),className:"w-full rounded-lg border border-slate-300 px-3 py-2 text-sm",required:!0,minLength:10,placeholder:"Mínimo 10 caracteres (letras e números)"})]}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx("button",{type:"submit",disabled:c,className:"rounded-lg bg-blue-600 px-4 py-2.5 text-sm font-semibold text-white hover:bg-blue-700 disabled:opacity-50",children:c?"A criar…":"Criar utilizador"})})]})]}),e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-4 shadow-sm md:p-6",children:[e.jsx("h3",{className:"mb-4 text-base font-semibold text-slate-800",children:"Utilizadores registados"}),j?e.jsx("p",{className:"text-sm text-slate-500",children:"A carregar…"}):i.length===0?e.jsx("p",{className:"text-sm text-slate-500",children:"Nenhum utilizador."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-200 text-slate-500",children:[e.jsx("th",{className:"py-2 pr-3 font-medium",children:"E-mail"}),e.jsx("th",{className:"py-2 pr-3 font-medium",children:"Nome"}),e.jsx("th",{className:"py-2 pr-3 font-medium",children:"Perfil"}),e.jsx("th",{className:"py-2 pr-3 font-medium",children:"Ativo"}),e.jsx("th",{className:"py-2 pr-3 font-medium",children:"Último login"})]})}),e.jsx("tbody",{children:i.map(p=>e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("td",{className:"py-2 pr-3 font-mono text-xs text-slate-800",children:p.email}),e.jsx("td",{className:"py-2 pr-3 text-slate-700",children:p.name||"—"}),e.jsx("td",{className:"py-2 pr-3 text-slate-700",children:p.role}),e.jsx("td",{className:"py-2 pr-3",children:p.isActive?"Sim":"Não"}),e.jsx("td",{className:"py-2 pr-3 text-slate-600",children:p.lastLoginAt?$(p.lastLoginAt):"—"})]}
1,p.id))})]})})]})]})}const W=40;function ee(){const[i,f]=a.useState([]),[j,L]=a.useState(0),[E,g]=a.useState(0),[y,A]=a.useState(!0),[w,u]=a.useState(""),[N,S]=a.useState(!1),r=a.useCallback((d,v,c)=>{A(!0),u(""),G({limit:W,offset:d,failedLogin:c}).then(b=>{L(b.total),g(d+b.items.length),f(v?P=>[...P,...b.items]:b.items)}).catch(()=>u("Não foi possível carregar o relatório.")).finally(()=>A(!1))},[]);a.useEffect(()=>{r(0,!1,N)},[r,N]);const o=i.length<j;return e.jsxs("div",{className:"mt-10 max-w-6xl space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-slate-800 md:text-xl",style:{fontFamily:"'Poppins', sans-serif"},children:"Relatório de atividade"}),e.jsx("p",{className:"mt-1 text-sm text-slate-500",children:"Registos de alterações no painel (POST, PUT, PATCH, DELETE) e inícios de sessão. Ordenado do mais recente para o mais antigo."}),e.jsxs("label",{className:"mt-3 flex items-center gap-2 text-sm text-slate-700",children:[e.jsx("input",{type:"checkbox",checked:N,onChange:d=>{f([]),g(0),S(d.target.checked)},className:"rounded border-slate-300"}),"Mostrar só tentativas de login falhadas / bloqueios"]})]}),w&&e.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:w}),e.jsx("div",{className:"rounded-xl border border-slate-200 bg-white p-2 shadow-sm md:p-4",children:y&&i.length===0?e.jsx("p",{className:"p-4 text-sm text-slate-500",children:"A carregar…"}):i.length===0?e.jsx("p",{className:"p-4 text-sm text-slate-500",children:"Ainda não há registos."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[720px] text-left text-xs md:text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-200 text-slate-500",children:[e.jsx("th",{className:"py-2 pr-2 font-medium",children:"Data / hora"}),e.jsx("th",{className:"py-2 pr-2 font-medium",children:"Quem"}),e.jsx("th",{className:"py-2 pr-2 font-medium",children:"Método"}),e.jsx("th",{className:"py-2 pr-2 font-medium",children:"Rota"}),e.jsx("th",{className:"py-2 pr-2 font-medium",children:"HTTP"})]})}),e.jsx("tbody",{children:i.map(d=>e.jsxs("tr",{className:"border-b border-slate-100 align-top",children:[e.jsx("td",{className:"max-w-[140px] py-2 pr-2 whitespace-nowrap text-slate-600",children:$(d.createdAt)}),e.jsx("td",{className:"py-2 pr-2 text-slate-800",children:d.admin?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:d.admin.name||d.admin.email}),e.jsx("span",{className:"block text-[11px] text-slate-500",children:d.admin.email})]}):e.jsx("span",{className:"text-slate-400",children:"—"})}),e.jsx("td",{className:"py-2 pr-2 font-mono text-slate-700",children:d.method}),e.jsxs("td",{className:"max-w-md py-2 pr-2 break-all font-mono text-[11px] text-slate-600 md:text-xs",children:[d.path,d.summary&&e.jsx("span",{className:"mt-0.5 block text-slate-500 normal-case",children:d.summary})]}),e.jsx("td",{className:"py-2 pr-2 whitespace-nowrap",children:e.jsx("span",{className:d.statusCode>=400?"font-semibold text-red-600":d.statusCode>=300?"text-amber-600":"text-emerald-700",children:d.statusCode})})]},d.id))})]})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-slate-100 p-3",children:[e.jsxs("p",{className:"text-xs text-slate-500",children:["A mostrar ",i.length," de ",j]}),o&&e.jsx("button",{type:"button",disabled:y,onClick:()=>r(E,!0,N),className:"rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50 disabled:opacity-50",children:y?"A carregar…":"Carregar mais"})]})]})})]})}const T="home_hero_images",R="home_hero_copy",se=4,k={url:"",posX:50,posY:50,zoom:1,brightness:1,sharpness:1};function te(){return""}const ae={"(raiz)":"Raiz de uploads",locais:"Locais (atrações, hospedagens, restaurantes)",site:"Site — hero e imagens gerais",atas:"Atas (associados)",avaliacoes:"Avaliações (depoimentos)",eventos:"Eventos",cpl:"CPL Turismo","conselho/membros":"Conselho — fotos de membros","conselho/galeria":"Conselho — galeria"};function le(i){return ae[i]||i.replace(/\//g," → ")}function re(i){return i==null||Number.isNaN(i)?"—":i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/(1024*1024)).toFixed(1)} MB`}function oe(){const[i,f]=a.useState(!0),[j,L]=a.useState([]),[E,g]=a.useState(""),[y,A]=a.useState(0),[w,u]=a.useState(null),N=a.useCallback(()=>{f(!0),g(""),J().then(r=>L(r.sections)).catch(()=>g("Não foi possível listar os ficheiros em uploads/.")).finally(()=>f(!1))},[]);a.useEffect(()=>{N()},[N,y]);const S=async(r,o)=>{if(window.confirm(`Eliminar este ficheiro do servidor?
2
3${r}
4
5Referência: ${o}
6
7As ligações na base de dados (locais, conselho, hero, etc.) serão limpas quando coincidirem com este ficheiro.`)){u(r),g("");try{await Q(r),A(v=>v+1)}catch(v){g(v instanceof Error?v.message:"Falha ao eliminar")}finally{u(null)}}};return e.jsxs("div",{className:"mt-10 max-w-6xl space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg md:text-xl font-bold text-slate-800",style:{fontFamily:"'Poppins', sans-serif"},children:"Armazenamento (uploads)"}),e.jsxs("p",{className:"text-sm text-slate-500 mt-1",children:["Ficheiros na pasta ",e.jsx("code",{className:"text-xs bg-slate-100 px-1 rounded",children:"backend/uploads"}),", agrupados por subpasta. Em cada cartão: pré-visualização (se for imagem), nome ligado na base de dados quando detetado, e eliminação do ficheiro."]})]}),E&&e.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm",children:E}),i?e.jsx("p",{className:"text-slate-500",children:"A carregar biblioteca de ficheiros…"}):j.length===0?e.jsx("p",{className:"text-slate-500",children:"Nenhum ficheiro encontrado em uploads/."}):e.jsx("div",{className:"space-y-10",children:j.map(r=>e.jsxs("section",{className:"rounded-xl border border-slate-200 bg-white p-4 md:p-6 shadow-sm",children:[e.jsx("h3",{className:"text-base font-bold text-slate-800 mb-1",children:le(r.sectionKey)}),e.jsx("p",{className:"text-xs text-slate-500 mb-4 font-mono",children:r.sectionKey}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:r.items.map(o=>e.jsxs("div",{className:"rounded-xl border border-slate-200 overflow-hidden bg-slate-50/80 flex flex-col",children:[e.jsx("div",{className:"aspect-[4/3] bg-slate-200 relative",children:o.isImage?e.jsx("img",{src:F(o.publicUrl.replace(/^\/+/,"")),alt:"",className:"absolute inset-0 w-full h-full object-cover",loading:"lazy"}):e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-slate-500 text-xs p-2 text-center",children:[e.jsx("span",{className:"text-2xl mb-1","aria-hidden":!0,children:"📄"}),"Ficheiro não-imagem"]})}),e.jsxs("div",{className:"p-3 flex-1 flex flex-col gap-2 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-900 line-clamp-2",title:o.linkedName,children:o.linkedName}),e.jsx("p",{className:"text-[11px] text-slate-500 font-mono truncate",title:o.fileName,children:o.fileName}),e.jsx("p",{className:"text-[10px] text-slate-400",children:re(o.size)}),e.jsx("button",{type:"button",disabled:w===o.relPath,onClick:()=>void S(o.relPath,o.linkedName),className:"mt-auto w-full py-2 rounded-lg text-sm font-semibold bg-red-600 text-white hover:bg-red-700 disabled:opacity-50",children:w===o.relPath?"A eliminar…":"Eliminar ficheiro"})]})]},o.relPath))})]},r.sectionKey))})]})}function pe(){const{user:i}=V(),f=(i==null?void 0:i.role)==="admin",[j,L]=a.useState(()=>typeof window<"u"&&new URLSearchParams(window.location.search).get("tab")==="audit"?"audit":"hero"),[E,g]=a.useState(!0),[y,A]=a.useState(!1),[w,u]=a.useState(""),[N,S]=a.useState(""),[r,o]=a.useState([{...k},{...k},{...k},{...k}]),[d,v]=a.useState(null),[c,b]=a.useState(()=>M(void 0)),[P,z]=a.useState(!1),[p,U]=a.useState(!1);a.useEffect(()=>{let s=!1;const t=te();return g(!0),fetch(`${t}/api/app-config`).then(x=>x.json()).then(x=>{if(s)return;b(M(x[R]));const l=x[T],n=Array.isArray(l)?l.map(m=>{if(typeof m=="string")return{...k,url:m.trim()};if(m&&typeof m=="object"){const C=m;return{url:String(C.url||"").trim(),posX:Number.isFinite(Number(C.posX))?Math.min(100,Math.max(0,Number(C.posX))):50,posY:Number.isFinite(Number(C.posY))?Math.min(100,Math.max(0,Number(C.posY))):50,zoom:Number.isFinite(Number(C.zoom))?Math.min(2,Math.max(1,Number(C.zoom))):1,brightness:Number.isFinite(Number(C.brightness))?Math.min(2,Math.max(.25,Number(C.brightness))):1,sharpness:Number.isFinite(Number(C.sharpness))?Math.min(3,Math.max(.25,Number(C.sharpness))):1}}return{...k}}):[],h=[n[0]||{...k},n[1]||{...k},n[2]||{...k},n[3]||{...k}];o(h)}).catch(()=>u("Não foi possível carregar as configurações.")).finally(()=>{s||g(!1)}),()=>{s=!0}},[]);const D=async()=>{z(!0),u(""),S("");try{const s={logoUrl:c.logoUrl.trim(),pt:{title:c.pt.title.trim(),subtitle:c.pt.subtitle.trim(),imageCredit:c.pt.imageCredit.trim()},en:{title:c.en.title.trim(),subtitle:c.en.subtitle.trim(),imageCredit:c.en.imageCredit.trim()},es:{title:c.es.title.trim(),subtitle:c.es.subtitle.trim(),imageCredit:c.es.imageCredit.trim()}};await H(R,s),_(),S("Textos e logo do hero guardados.")}catch(s){u(s instanceof Error?s.message:"Erro ao guardar")}finally{z(!1)}},X=async s=>{U(!0),u("");try{const{url:t}=await Y(se,s);b(x=>({...x,logoUrl:t}))}catch(t){u(t instanceof Error?t.message:"Falha no upload do logo")}finally{U(!1)}},q=async()=>{A(!0),u(""),S("");try{const s=r.filter(t=>t.url.trim()).map(t=>({url:t.url.trim(),posX:t.posX,posY:t.posY,zoom:t.zoom,brightness:t.brightness,sharpness:t.sharpness}));await H(T,s),_(),S("Imagens da home guardadas.")}catch(s){u(s instanceof Error?s.message:"Erro ao guardar")}finally{A(!1)}},K=async(s,t)=>{v(s),u("");try{const{url:x}=await Y(s,t);o(l=>{const n=[...l];return n[s]={...n[s],url:x},n})}catch(x){u(x instanceof Error?x.message:"Falha no upload")}finally{v(null)}};return e.jsxs("div",{className:"max-w-6xl",children:[e.jsx("h1",{className:"text-xl md:text-2xl font-bold text-slate-800",style:{fontFamily:"'Poppins', sans-serif"},children:"Configurações do site"}),e.jsx("p",{className:"text-sm text-slate-500 mt-1 mb-4",children:f?"Hero da página inicial, armazenamento, gestão de administradores e relatório de atividade.":"Hero da página inicial e ficheiros em armazenamento."}),f&&e.jsx("div",{className:"mb-6 flex flex-wrap gap-2 border-b border-slate-200 pb-4",children:[{id:"hero",label:"Hero & ficheiros"},{id:"admins",label:"Administradores"},{id:"audit",label:"Relatório de atividade"}].map(s=>e.jsx("button",{type:"button",onClick:()=>L(s.id),className:`rounded-full px-4 py-2 text-sm font-semibold transition-colors ${j===s.id?"bg-blue-600 text-white shadow-sm":"bg-slate-100 text-slate-700 hover:bg-slate-200"}`,children:s.label},s.id))}),f&&j==="admins"&&e.jsx(Z,{}),f&&j==="audit"&&e.jsx(ee,{}),(!f||j==="hero")&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-slate-500 mb-6",children:["Hero da home: textos e logo (",e.jsx("code",{className:"text-xs bg-slate-100 px-1 rounded",children:R}),") e até 4 imagens de fundo (",e.jsx("code",{className:"text-xs bg-slate-100 px-1 rounded",children:T}),"). Se guardar um campo de texto vazio, o site volta a mostrar o texto padrão desse campo."]}),w&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg text-red-700 text-sm",children:w}),N&&e.jsx("div",{className:"mb-4 p-3 bg-emerald-50 border border-emerald-200 rounded-lg text-emerald-800 text-sm",children:N}),E?e.jsx("p",{className:"text-slate-500",children:"A carregar…"}):e.jsxs("div",{className:"space-y-8 max-w-3xl",children:[e.jsxs("div",{className:"space-y-6 bg-white rounded-xl border border-slate-200 p-4 md:p-6",children:[e.jsx("h2",{className:"text-lg font-bold text-slate-800",style:{fontFamily:"'Poppins', sans-serif"},children:"Textos e logo (hero)"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Título, subtítulo e crédito das imagens por idioma. Logo: URL ou envio de ficheiro (PNG/JPG recomendado, fundo transparente se aplicável)."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 sm:items-start border-b border-slate-100 pb-6",children:[e.jsx("div",{className:"w-full sm:w-36 h-36 rounded-lg bg-slate-900/10 border border-slate-200 flex items-center justify-center overflow-hidden flex-shrink-0 p-2",children:c.logoUrl.trim()?e.jsx("img",{src:/^https?:\/\//i.test(c.logoUrl)?c.logoUrl:F(c.logoUrl.replace(/^\//,"")),alt:"",className:"max-w-full max-h-full object-contain"}):e.jsx("span",{className:"text-xs text-slate-500 text-center",children:"Logo por omissão do site"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium text-slate-700",children:"URL do logo (opcional)"}),e.jsx("input",{type:"text",value:c.logoUrl,onChange:s=>b(t=>({...t,logoUrl:s.target.value})),className:"w-full px-3 py-2 border rounded-lg text-sm font-mono",placeholder:"ex.: /uploads/site/hero-4-….png ou https://…"}),e.jsx("input",{type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",disabled:p,onChange:s=>{var x;const t=(x=s.target.files)==null?void 0:x[0];t&&X(t),s.target.value=""},className:"block text-sm text-slate-600"}),p&&e.jsx("p",{className:"text-xs text-slate-500",children:"A enviar logo…"}),e.jsx("button",{type:"button",onClick:()=>b(s=>({...s,logoUrl:""})),className:"text-sm font-semibold text-slate-600 hover:text-slate-900 underline",children:"Repor logo por omissão"})]})]}),[{code:"pt",label:"Português"},{code:"en",label:"English"},{code:"es",label:"Español"}].map(({code:s,label:t})=>e.jsxs("div",{className:"space-y-3 border-b border-slate-100 pb-5 last:border-0 last:pb-0",children:[e.jsx("h3",{className:"text-base font-semibold text-slate-800",children:t}),e.jsxs("label",{className:"block text-sm text-slate-600",children:[e.jsx("span",{className:"font-medium text-slate-700",children:"Título"}),e.jsx("input",{type:"text",value:c[s].title,onChange:x=>b(l=>({...l,[s]:{...l[s],title:x.target.value}})),className:"mt-1 w-full px-3 py-2 border rounded-lg text-sm"})]}),e.jsxs("label",{className:"block text-sm text-slate-600",children:[e.jsx("span",{className:"font-medium text-slate-700",children:"Subtítulo"}),e.jsx("textarea",{value:c[s].subtitle,onChange:x=>b(l=>({...l,[s]:{...l[s],subtitle:x.target.value}})),rows:3,className:"mt-1 w-full px-3 py-2 border rounded-lg text-sm"})]}),e.jsxs("label",{className:"block text-sm text-slate-600",children:[e.jsx("span",{className:"font-medium text-slate-700",children:"Crédito das imagens de fundo"}),e.jsx("input",{type:"text",value:c[s].imageCredit,onChange:x=>b(l=>({...l,[s]:{...l[s],imageCredit:x.target.value}})),className:"mt-1 w-full px-3 py-2 border rounded-lg text-sm"})]})]},s)),e.jsxs("div",{className:"flex flex-wrap gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:()=>void D(),disabled:P,className:"px-4 py-2.5 bg-emerald-600 text-white rounded-lg hover:bg-emerald-700 font-medium disabled:opacity-50",children:P?"A guardar…":"Guardar textos e logo"}),e.jsx("button",{type:"button",onClick:()=>b(s=>({...s,pt:{...O.pt},en:{...O.en},es:{...O.es}})),className:"px-4 py-2.5 border border-slate-300 rounded-lg text-slate-700 hover:bg-slate-50 font-medium text-sm",children:"Repor textos por omissão (mantém o logo)"})]})]}),e.jsxs("div",{className:"space-y-6 bg-white rounded-xl border border-slate-200 p-4 md:p-6 max-w-3xl",children:[e.jsx("h2",{className:"text-lg font-bold text-slate-800",style:{fontFamily:"'Poppins', sans-serif"},children:"Imagens de fundo (hero)"}),[0,1,2,3].map(s=>{var x;const t=r[s]||k;return e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 sm:items-start border-b border-slate-100 pb-4 last:border-0 last:pb-0",children:[e.jsx("div",{className:"w-full sm:w-40 h-28 rounded-lg bg-slate-100 border border-slate-200 overflow-hidden flex-shrink-0",children:t.url?e.jsx("img",{src:/^https?:\/\//i.test(t.url)?t.url:F(t.url.replace(/^\//,"")),alt:"",className:"w-full h-full object-cover",style:{objectPosition:`${t.posX}% ${t.posY}%`,transform:`scale(${t.zoom})`}}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-slate-400 text-sm",children:"Vazio"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("label",{className:"block text-sm font-medium text-slate-700",children:["Imagem ",s+1]}),e.jsx("input",{type:"url",value:t.url,onChange:l=>o(n=>{const h=[...n];return h[s]={...h[s],url:l.target.value},h}),className:"w-full px-3 py-2 border rounded-lg text-sm",placeholder:"URL ou use o upload"}),e.jsx("input",{type:"file",accept:"image/jpeg,image/png,image/webp,image/gif",disabled:d===s,onChange:l=>{var h;const n=(h=l.target.files)==null?void 0:h[0];n&&K(s,n),l.target.value=""},className:"block text-sm text-slate-600"}),d===s&&e.jsx("p",{className:"text-xs text-slate-500",children:"A enviar…"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 pt-2",children:[e.jsxs("label",{className:"text-xs text-slate-600",children:[e.jsx("span",{className:"block mb-1 font-medium text-slate-700",children:"Horizontal"}),e.jsx("input",{type:"range",min:0,max:100,value:t.posX,onChange:l=>{const n=Number(l.target.value);o(h=>{const m=[...h];return m[s]={...m[s],posX:n},m})},className:"w-full"}),e.jsxs("span",{className:"text-[11px] text-slate-500",children:[t.posX,"%"]})]}),e.jsxs("label",{className:"text-xs text-slate-600",children:[e.jsx("span",{className:"block mb-1 font-medium text-slate-700",children:"Vertical"}
7),e.jsx("input",{type:"range",min:0,max:100,value:t.posY,onChange:l=>{const n=Number(l.target.value);o(h=>{const m=[...h];return m[s]={...m[s],posY:n},m})},className:"w-full"}),e.jsxs("span",{className:"text-[11px] text-slate-500",children:[t.posY,"%"]})]}),e.jsxs("label",{className:"text-xs text-slate-600",children:[e.jsx("span",{className:"block mb-1 font-medium text-slate-700",children:"Zoom"}),e.jsx("input",{type:"range",min:1,max:3,step:.01,value:t.zoom,onChange:l=>{const n=Number(l.target.value);o(h=>{const m=[...h];return m[s]={...m[s],zoom:n},m})},className:"w-full"}),e.jsxs("span",{className:"text-[11px] text-slate-500",children:[t.zoom.toFixed(2),"×"]})]})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 pt-2",children:[e.jsxs("label",{className:"text-xs text-slate-600",children:[e.jsx("span",{className:"block mb-1 font-medium text-slate-700",children:"Brilho"}),e.jsx("input",{type:"range",min:.25,max:2,step:.01,value:t.brightness,onChange:l=>{const n=Number(l.target.value);o(h=>{const m=[...h];return m[s]={...m[s],brightness:n},m})},className:"w-full"}),e.jsxs("span",{className:"text-[11px] text-slate-500",children:[t.brightness.toFixed(2),"×"]})]}),e.jsxs("label",{className:"text-xs text-slate-600",children:[e.jsx("span",{className:"block mb-1 font-medium text-slate-700",children:"Nitidez"}),e.jsx("input",{type:"range",min:.25,max:3,step:.01,value:t.sharpness,onChange:l=>{const n=Number(l.target.value);o(h=>{const m=[...h];return m[s]={...m[s],sharpness:n},m})},className:"w-full"}),e.jsxs("span",{className:"text-[11px] text-slate-500",children:[t.sharpness.toFixed(2),"×"]})]})]}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("button",{type:"button",onClick:()=>o(l=>{const n=[...l];return n[s]={...n[s],posX:50,posY:50,zoom:1,brightness:1,sharpness:1},n}),className:"inline-flex items-center justify-center rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-50",children:"Reset ajustes"}),e.jsx("div",{className:"rounded-2xl border border-slate-200 bg-slate-50 p-3 text-xs text-slate-600",children:"Ajuste mais: mova a imagem para cima, baixo, esquerda e direita, aumente o zoom e controle brilho/nitidez."})]}),e.jsxs("div",{className:"mt-4 rounded-2xl border border-slate-200 bg-slate-950/5 overflow-hidden",children:[e.jsx("div",{className:"bg-slate-900/10 px-3 py-2 text-xs uppercase tracking-[0.18em] text-slate-500",children:"Preview do hero"}),e.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-slate-900",children:(x=r[s])!=null&&x.url?e.jsx("img",{src:/^https?:\/\//i.test(r[s].url)?r[s].url:F(r[s].url.replace(/^\//,"")),alt:"Prévia do hero",className:"absolute inset-0 h-full w-full object-cover",style:{objectPosition:`${r[s].posX}% ${r[s].posY}%`,transform:`scale(${r[s].zoom})`,filter:`brightness(${r[s].brightness}) contrast(${r[s].sharpness})`}}):e.jsx("div",{className:"flex h-full items-center justify-center text-slate-500",children:"Preview vazio"})})]})]})]},s)}),e.jsx("button",{type:"button",onClick:()=>void q(),disabled:y,className:"px-4 py-2.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 font-medium disabled:opacity-50",children:y?"A guardar…":"Guardar imagens do hero"})]})]}),e.jsx(oe,{})]})]})}export{pe 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.