import{j as e}from"./ui-vendor-4PEuZeLa.js";import{u as a}from"./useQuery-DXCMOLoD.js";import{B as s,t as o,s as t,S as i,H as r}from"./index-pJhVXhEU.js";import{H as n}from"./Header-Ccmu9ZV2.js";import{F as c}from"./Footer-D6zVMKkd.js";import{S as l}from"./SEOHead-D2Q2lO5Y.js";import{p as d,t as m,C as u,T as h}from"./cityTldrVariants-BFoKXxeS.js";import{r as p,h as x}from"./react-vendor-SJkaNtXX.js";import{I as v}from"./input-JzDsouLz.js";import{L as f}from"./label-BtNpebIm.js";import{T as g}from"./textarea-BuO_puoV.js";import{f as j,v as y,a as b,b as N}from"./validators-B6ObMgjW.js";import{K as w,L as S,g as _,S as C,k as A}from"./icons-CPboDmvc.js";import{A as q,a as k,b as $,c as E}from"./accordion-CFGBLPOT.js";import"./supabase-vendor-CdxEYpYJ.js";import"./logo-oficial-BW9aD_Pb.js";import"./alert-ByxLEOgp.js";function L({citySlug:a,cityName:i,state:r,pickupLocation:n}){const[c,l]=p.useState(!1),[d,m]=p.useState({nome:"",email:"",telefone:"",vehicleInfo:"",observations:""});return e.jsxs("form",{onSubmit:async e=>{var s,c;e.preventDefault();const u=y(d.nome);if(!u.valid)return void o({title:"Erro no nome",description:u.message,variant:"destructive"});const h=b(d.email);if(!h.valid)return void o({title:"Erro no e-mail",description:h.message,variant:"destructive"});const p=N(d.telefone);if(!p.valid)return void o({title:"Erro no telefone",description:p.message,variant:"destructive"});if(!n)return void o({title:"Localização não selecionada",description:"Por favor, selecione sua localização no mapa acima.",variant:"destructive"});l(!0);let x=null,v=null,f=null;try{const{error:e}=await t.from("locksmith_requests").insert({city_slug:a,city_name:i,state:r,client_name:d.nome,client_email:d.email,client_phone:d.telefone,pickup_address:n.address,latitude:n.latitude,longitude:n.longitude,vehicle_info:d.vehicleInfo||null,observations:d.observations||null,status:"novo"});try{const e=await t.functions.invoke("call-locksmith-quotation",{body:{name:d.nome,email:d.email,phone:d.telefone,lat:n.latitude,lng:n.longitude,address:n.address,vehicleInfo:d.vehicleInfo,serviceType:"abertura_veiculo"}});e.error?f=e.error.message||"Erro ao chamar API de chaveiro":(x=(null==(s=e.data)?void 0:s.quotation_id)||null,v=(null==(c=e.data)?void 0:c.conversation_id)||null,(x||v)&&await t.from("locksmith_requests").update({external_quotation_id:x,external_conversation_id:v}).eq("client_email",d.email).eq("client_phone",d.telefone).order("created_at",{ascending:!1}).limit(1))}catch(g){f=g.message||"Erro de comunicação com API"}f&&await t.from("locksmith_requests").update({status:"pendente_externo",observations:`${d.observations||""}\n\n[ERRO API EXTERNA]: ${f}`.trim()}).eq("client_email",d.email).eq("client_phone",d.telefone).order("created_at",{ascending:!1}).limit(1),o({title:"Solicitação recebida com sucesso!",description:f?"Recebemos sua solicitação e nossa equipe entrará em contato em instantes.":"Você receberá uma mensagem no WhatsApp com um chaveiro disponível."}),m({nome:"",email:"",telefone:"",vehicleInfo:"",observations:""})}catch(j){o({title:"Erro ao enviar solicitação",description:j.message||"Tente novamente mais tarde.",variant:"destructive"})}finally{l(!1)}},className:"space-y-6 bg-card p-6 rounded-lg border border-border",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-6 w-6 text-primary"}),e.jsx("h3",{className:"text-2xl font-bold",children:"Solicite um Chaveiro"})]}),e.jsx("p",{className:"text-muted-foreground",children:"Trancou a chave no carro? Preencha os dados e receba atendimento imediato"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"nome",children:"Nome *"}),e.jsx(v,{id:"nome",name:"nome",placeholder:"Seu nome",value:d.nome,onChange:e=>m({...d,nome:e.target.value}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"email",children:"E-mail *"}),e.jsx(v,{id:"email",name:"email",type:"email",placeholder:"seu@email.com",value:d.email,onChange:e=>m({...d,email:e.target.value}),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"telefone",children:"Telefone *"}),e.jsx(v,{id:"telefone",name:"telefone",type:"tel",placeholder:"(00) 00000-0000",value:d.telefone,onChange:e=>m({...d,telefone:e.target.value}),onBlur:e=>m({...d,telefone:j(e.target.value)}),required:!0})]}),n&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{children:"Localização do veículo"}),e.jsx("div",{className:"p-3 bg-muted rounded-md text-sm",children:n.address})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"vehicleInfo",children:"Informações do veículo (opcional)"}),e.jsx(v,{id:"vehicleInfo",placeholder:"Ex: Gol Prata 2020, Placa ABC-1234",value:d.vehicleInfo,onChange:e=>m({...d,vehicleInfo:e.target.value})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Modelo, cor e placa ajudam o chaveiro a localizar seu veículo"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"observations",children:"Observações (opcional)"}),e.jsx(g,{id:"observations",placeholder:"Informações adicionais sobre a situação",value:d.observations,onChange:e=>m({...d,observations:e.target.value}),rows:3})]})]}),e.jsx(s,{type:"submit",className:"w-full",size:"lg",disabled:c,children:c?e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"mr-2 h-4 w-4 animate-spin"}),"Enviando..."]}):"Chamar Chaveiro Agora"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Ao enviar, você concorda com nossa política de privacidade"})]})}function I(){const{citySlug:s}=x(),[o,v]=p.useState("client"),[f,g]=p.useState(),j=d(s||""),{data:y,isLoading:b}=a({queryKey:["locksmith-city-page",s],queryFn:async()=>{const{data:e,error:a}=await t.from("locksmith_city_pages").select("*").eq("slug",s).eq("is_active",!0).maybeSingle();if(a)throw a;return e}}),{data:N}=a({queryKey:["city-demographics",s],queryFn:async()=>{const{data:e,error:a}=await t.from("city_demographics").select("*").eq("slug",s||"").maybeSingle();return a?null:e??null},staleTime:36e5,enabled:!!s});p.useEffect(()=>{(null==y?void 0:y.id)&&s&&t.rpc("increment_city_page_view",{p_service:"chaveiro",p_slug:s})},[null==y?void 0:y.id,s]);const S=(null==y?void 0:y.city_name)||j.cityName,I=(null==y?void 0:y.state_abbreviation)||j.stateAbbreviation,O=(null==y?void 0:y.state)||j.state,P=(null==y?void 0:y.hero_title)||`Chaveiro Automotivo 24h em ${S}`,T=(null==y?void 0:y.hero_subtitle)||m(s||"","chaveiro",N??null,S,I),z=(null==y?void 0:y.meta_title)||`Chaveiro em ${S} - ${I} | Atendimento 24h`,F=`Precisa de chaveiro automotivo em ${S}? Atendimento 24h para abertura de veículos, cópia de chaves e fechaduras. Ligue: 0800-111-8686.`,H=`/chaveiro/${s||""}`;if(b)return e.jsxs("div",{className:"min-h-screen",children:[e.jsx(l,{title:z,description:F,canonical:H}),e.jsx(n,{viewMode:o,onViewModeChange:v,showViewModeToggle:!1}),e.jsxs("div",{className:"container mx-auto px-4 py-16",children:[e.jsx(i,{className:"h-12 w-3/4 mb-4"}),e.jsx(i,{className:"h-6 w-1/2 mb-8"}),e.jsx(i,{className:"h-96 w-full"})]})]});const Q={"@context":"https://schema.org","@type":"City",name:S,containedInPlace:{"@type":"State",name:O},address:{"@type":"PostalAddress",addressLocality:S,addressRegion:I,addressCountry:"BR"}};null!=(null==N?void 0:N.population)&&(Q.populationCount=N.population);const M={"@context":"https://schema.org","@type":"LocalBusiness",name:`Chaveiro Automotivo 24h em ${S}`,description:F,url:`https://semprecomigo.com.br/chaveiro/${s}`,telephone:"0800-111-8686",address:{"@type":"PostalAddress",addressLocality:S,addressRegion:I,addressCountry:"BR"},areaServed:Q,parentOrganization:{"@type":"Organization",name:"Sempre Comigo"},openingHoursSpecification:{"@type":"OpeningHoursSpecification",dayOfWeek:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],opens:"00:00",closes:"23:59"}},R={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:"https://semprecomigo.com.br"},{"@type":"ListItem",position:2,name:"Chaveiro",item:"https://semprecomigo.com.br/assistencia-24h"},{"@type":"ListItem",position:3,name:S,item:`https://semprecomigo.com.br/chaveiro/${s}`}]};return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(l,{title:z,description:F,canonical:H,keywords:`chaveiro ${S.toLowerCase()}, chaveiros em ${S.toLowerCase()}, chaveiro automotivo ${S.toLowerCase()}, chaveiro 24h ${S.toLowerCase()}, chaveiro veicular, abertura de veículo ${I}, chaveiro mais próximo`}),e.jsxs(r,{children:[e.jsx("script",{type:"application/ld+json",children:JSON.stringify(M)}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(R)}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(Q)})]}),e.jsx(n,{viewMode:o,onViewModeChange:v,showViewModeToggle:!1}),e.jsxs("section",{className:"relative h-[50vh] min-h-[400px] overflow-hidden bg-gradient-to-br from-primary via-primary/90 to-primary/70",children:[e.jsx("div",{className:"absolute inset-0 bg-black/30"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"text-center text-white px-4 max-w-4xl",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-white/20 rounded-full mb-6",children:e.jsx(w,{className:"h-10 w-10 text-white"})}),e.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold mb-4",children:P}),e.jsx("p",{className:"text-xl md:text-2xl mb-8",children:T}),e.jsx("a",{href:"#formulario",className:"inline-block",children:e.jsx("button",{className:"bg-white hover:bg-white/90 text-primary px-8 py-4 rounded-lg text-lg font-semibold transition-colors",children:"Chamar Chaveiro Agora"})})]})})]}),e.jsx(u,{city:N??null,cityName:S,stateAbbr:I}),e.jsx("section",{className:"py-16 bg-muted/30",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(_,{className:"h-8 w-8 text-primary flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-2",children:"Atendimento 24h"}),e.jsx("p",{className:"text-muted-foreground",children:"Estamos disponíveis todos os dias, a qualquer hora"})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(C,{className:"h-8 w-8 text-primary flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-2",children:"Abertura Sem Danos"}),e.jsx("p",{className:"text-muted-foreground",children:"Técnicas profissionais que preservam seu veículo"})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(A,{className:"h-8 w-8 text-primary flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg mb-2",children:"Profissionais Especializados"}),e.jsx("p",{className:"text-muted-foreground",children:"Equipe treinada em abertura de veículos de todas as marcas"})]})]})]})})}),e.jsx("section",{id:"formulario",className:"py-16",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-start",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-3xl font-bold mb-4",children:"Onde está seu veículo?"}),e.jsx("p",{className:"text-muted-foreground",children:"Detectamos automaticamente sua localização para enviar o chaveiro mais próximo"})]}),e.jsx(h,{onLocationSelect:g})]}),e.jsx("div",{className:"lg:sticky lg:top-4",children:e.jsx(L,{citySlug:s,cityName:S,state:O,pickupLocation:f})})]})})}),e.jsxs("section",{className:"py-12 bg-muted/20",children:[e.jsx(r,{children:e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:[{"@type":"Question",name:`Quanto custa um chaveiro automotivo em ${S}?`,acceptedAnswer:{"@type":"Answer",text:`O preço do chaveiro em ${S} varia conforme o tipo de veículo, complexidade da fechadura e horário do atendimento. Ligue para 0800 111 8686 para cotação imediata.`}},{"@type":"Question",name:`O chaveiro em ${S} funciona 24 horas?`,acceptedAnswer:{"@type":"Answer",text:`Sim. Nosso chaveiro automotivo em ${S} atende 24 horas por dia, 7 dias por semana, incluindo feriados.`}},{"@type":"Question",name:"O chaveiro abre o veículo sem danificar a fechadura?",acceptedAnswer:{"@type":"Answer",text:`Sim. Em ${S} usamos técnicas profissionais de abertura que preservam a fechadura e a porta do veículo. Trabalhamos com todas as marcas.`}},{"@type":"Question",name:`Atendem a região metropolitana de ${S}?`,acceptedAnswer:{"@type":"Answer",text:`Sim. Cobrimos ${S} e toda a região metropolitana. Confirme a área exata pelo 0800 111 8686 antes de acionar o serviço.`}},{"@type":"Question",name:`Quais formas de pagamento aceitam para chaveiro em ${S}?`,acceptedAnswer:{"@type":"Answer",text:`Em ${S} aceitamos PIX, cartão de crédito, débito e dinheiro. Clientes com plano Sempre Comigo já têm o serviço incluído na mensalidade.`}},{"@type":"Question",name:`O chaveiro em ${S} faz cópia de chave codificada?`,acceptedAnswer:{"@type":"Answer",text:`Sim. Em ${S} fazemos cópia de chave simples, chave canivete e chave com transponder (codificada). Para chaves presence (smart key), confirme a marca e modelo do veículo no acionamento.`}}]})})}),e.jsxs("div",{className:"container mx-auto px-4 max-w-3xl",children:[e.jsxs("h2",{className:"text-2xl md:text-3xl font-bold text-center mb-8 text-foreground",children:["Perguntas Frequentes - Chaveiro em ",S]}),e.jsxs(q,{type:"single",collapsible:!0,className:"space-y-3",children:[e.jsxs(k,{value:"faq-0",className:"bg-background rounded-lg border px-6",children:[e.jsxs($,{className:"text-left font-semibold text-foreground hover:no-underline",children:["Quanto custa um chaveiro automotivo em ",S,"?"]}),e.jsxs(E,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["O preço do chaveiro em ",S," varia conforme o tipo de veículo, complexidade da fechadura e horário do atendimento. Para cotação imediata, ligue ",e.jsx("strong",{children:"0800 111 8686"})," ou preencha o formulário acima."]})]}),e.jsxs(k,{value:"faq-1",className:"bg-background rounded-lg border px-6",children:[e.jsxs($,{className:"text-left font-semibold text-foreground hover:no-underline",children:["O chaveiro em ",S," funciona 24 horas?"]}),e.jsxs(E,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Sim. Nosso chaveiro automotivo em ",S," atende 24 horas por dia, 7 dias por semana, incluindo feriados."]})]}),e.jsxs(k,{value:"faq-2",className:"bg-background rounded-lg border px-6",children:[e.jsx($,{className:"text-left font-semibold text-foreground hover:no-underline",children:"O chaveiro abre o veículo sem danificar a fechadura?"}),e.jsxs(E,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Sim. Em ",S," usamos técnicas profissionais de abertura que preservam a fechadura e a porta do veículo. Trabalhamos com todas as marcas."]})]}),e.jsxs(k,{value:"faq-3",className:"bg-background rounded-lg border px-6",children:[e.jsxs($,{className:"text-left font-semibold text-foreground hover:no-underline",children:["Atendem a região metropolitana de ",S,"?"]}),e.jsxs(E,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Sim. Cobrimos ",S," e toda a região metropolitana. Confirme a área exata pelo ",e.jsx("strong",{children:"0800 111 8686"})," antes de acionar o serviço."]})]}),e.jsxs(k,{value:"faq-4",className:"bg-background rounded-lg border px-6",children:[e.jsxs($,{className:"text-left font-semibold text-foreground hover:no-underline",children:["Quais formas de pagamento aceitam para chaveiro em ",S,"?"]}),e.jsxs(E,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Em ",S," aceitamos PIX, cartão de crédito, débito e dinheiro. Clientes com plano Sempre Comigo já têm o serviço incluído na mensalidade."]})]}),e.jsxs(k,{value:"faq-5",className:"bg-background rounded-lg border px-6",children:[e.jsxs($,{className:"text-left font-semibold text-foreground hover:no-underline",children:["O chaveiro em ",S," faz cópia de chave codificada?"]}),e.jsxs(E,{className:"text-muted-foreground",style:{lineHeight:1.6},children:["Sim. Em ",S," fazemos cópia de chave simples, chave canivete e chave com transponder (codificada). Para chaves presence (smart key), confirme a marca e modelo do veículo no acionamento."]})]})]})]})]}),e.jsx(c,{})]})}export{I as default};