PageSourceSearch

https://sentinel-365-c9d4f.web.app/assets/TiresPage-DoMBzihF.js

js sentinel-365-c9d4f.web.app collected 2026-10-03 12:38:20 UTC 59,472 bytes, 4 lines download raw bytes

1import{r as x,j as e}from"./react-vendor-pafHdoJx.js";import{k as je,b as ne,d as w,a as fe,c as v,M as $,I as O}from"./index-Db0fDLGN.js";import{e as Ne,a as ge,f as V,b as se}from"./export-utils-BHX8wKd9.js";import{E as ve}from"./ExportMenu-kt6fodhv.js";import{P as ye,H as we}from"./HelpTooltip-DKugySwl.js";import{O as Re}from"./OrigemDoDado-ChhhMO_H.js";import{L as k,l as ie,aO as P,as as De,x as Z,aG as Ee,a4 as H,J as Y,f as te,a5 as ce,a7 as de,al as ae,aP as Se,ae as le,o as Ce,aQ as q,an as Te,aR as ke,r as Le,Y as U,aE as xe,aS as _e,c as me,at as qe,n as Pe}from"./ui-vendor-DLXJn6s3.js";import"./map-vendor-Dr8zbd0c.js";import"./firebase-vendor-D3UzkAhn.js";const J={em_uso:{label:"Em Uso",cls:"bg-emerald-500/10 border-emerald-500/20 text-emerald-400"},estoque:{label:"Estoque",cls:"bg-blue-500/10 border-blue-500/20 text-blue-400"},reforma:{label:"Reforma",cls:"bg-amber-500/10 border-amber-500/20 text-amber-400"},descartado:{label:"Descartado",cls:"bg-slate-500/10 border-slate-500/20 text-slate-400"}},ee={novo:"Novo",reformado:"Reformado",usado:"Usado"},oe={critical:{cls:"bg-red-500/10 border-red-500/30 text-red-400",icon:ae},warning:{cls:"bg-amber-500/10 border-amber-500/30 text-amber-400",icon:ie},info:{cls:"bg-blue-500/10 border-blue-500/30 text-blue-400",icon:Ce}},I={FL:"Dianteiro Esq.",FR:"Dianteiro Dir.",RL:"Traseiro 1 Esq.",RR:"Traseiro 1 Dir.",RL_outer:"Traseiro 1 Esq. Ext.",RL_inner:"Traseiro 1 Esq. Int.",RR_outer:"Traseiro 1 Dir. Ext.",RR_inner:"Traseiro 1 Dir. Int.",R2L:"Traseiro 2 Esq.",R2R:"Traseiro 2 Dir.",R2L_outer:"Traseiro 2 Esq. Ext.",R2L_inner:"Traseiro 2 Esq. Int.",R2R_outer:"Traseiro 2 Dir. Ext.",R2R_inner:"Traseiro 2 Dir. Int.",R3L:"Traseiro 3 Esq.",R3R:"Traseiro 3 Dir.",R3L_outer:"Traseiro 3 Esq. Ext.",R3L_inner:"Traseiro 3 Esq. Int.",R3R_outer:"Traseiro 3 Dir. Ext.",R3R_inner:"Traseiro 3 Dir. Int.",FL2:"2° Diant. Esq.",FR2:"2° Diant. Dir.",spare:"Estepe",spare2:"Estepe 2"},z={"2x2":{label:"4×2 (Utilitário / VUC)",axles:[{name:"Dianteiro",positions:[{pos:"FL",label:"Esq."},{pos:"FR",label:"Dir."}]},{name:"Traseiro",positions:[{pos:"RL",label:"Esq."},{pos:"RR",label:"Dir."}]}]},"2x4":{label:"4×2 Duplo (Toco)",axles:[{name:"Dianteiro",positions:[{pos:"FL",label:"Esq."},{pos:"FR",label:"Dir."}]},{name:"Traseiro (duplo)",positions:[{pos:"RL_outer",label:"E. Ext."},{pos:"RL_inner",label:"E. Int."},{pos:"RR_inner",label:"D. Int."},{pos:"RR_outer",label:"D. Ext."}]}]},"2x4x2":{label:"6×2 (Truck)",axles:[{name:"Dianteiro",positions:[{pos:"FL",label:"Esq."},{pos:"FR",label:"Dir."}]},{name:"1° Traseiro (duplo)",positions:[{pos:"RL_outer",label:"E. Ext."},{pos:"RL_inner",label:"E. Int."},{pos:"RR_inner",label:"D. Int."},{pos:"RR_outer",label:"D. Ext."}]},{name:"2° Traseiro",positions:[{pos:"R2L",label:"Esq."},{pos:"R2R",label:"Dir."}]}]},"2x4x4":{label:"6×4 (Truck Traçado)",axles:[{name:"Dianteiro",positions:[{pos:"FL",label:"Esq."},{pos:"FR",label:"Dir."}]},{name:"1° Traseiro (duplo)",positions:[{pos:"RL_outer",label:"E. Ext."},{pos:"RL_inner",label:"E. Int."},{pos:"RR_inner",label:"D. Int."},{pos:"RR_outer",label:"D. Ext."}]},{name:"2° Traseiro (duplo)",positions:[{pos:"R2L_outer",label:"E. Ext."},{pos:"R2L_inner",label:"E. Int."},{pos:"R2R_inner",label:"D. Int."},{pos:"R2R_outer",label:"D. Ext."}]}]},"4x2":{label:"4×2 Duplo Dianteiro (Ônibus)",axles:[{name:"1° Dianteiro",positions:[{pos:"FL",label:"Esq."},{pos:"FR",label:"Dir."}]},{name:"2° Dianteiro",positions:[{pos:"FL2",label:"Esq."},{pos:"FR2",label:"Dir."}]},{name:"Traseiro",positions:[{pos:"RL",label:"Esq."},{pos:"RR",label:"Dir."}]}]},"4x4":{label:"4×4 (Tração integral)",axles:[{name:"Dianteiro",positions:[{pos:"FL",label:"Esq."},{pos:"FR",label:"Dir."}]},{name:"Traseiro",positions:[{pos:"RL",label:"Esq."},{pos:"RR",label:"Dir."}]}]},"2x4x4x4":{label:"8×4 (Bi-Truck)",axles:[{name:"Dianteiro",positions:[{pos:"FL",label:"Esq."},{pos:"FR",label:"Dir."}]},{name:"1° Traseiro (duplo)",positions:[{pos:"RL_outer",label:"E. Ext."},{pos:"RL_inner",label:"E. Int."},{pos:"RR_inner",label:"D. Int."},{pos:"RR_outer",label:"D. Ext."}]},{name:"2° Traseiro (duplo)",positions:[{pos:"R2L_outer",label:"E. Ext."},{pos:"R2L_inner",label:"E. Int."}
1,{pos:"R2R_inner",label:"D. Int."},{pos:"R2R_outer",label:"D. Ext."}]},{name:"3° Traseiro (duplo)",positions:[{pos:"R3L_outer",label:"E. Ext."},{pos:"R3L_inner",label:"E. Int."},{pos:"R3R_inner",label:"D. Int."},{pos:"R3R_outer",label:"D. Ext."}]}]},custom:{label:"Personalizado",axles:[{name:"Dianteiro",positions:[{pos:"FL",label:"Esq."},{pos:"FR",label:"Dir."}]},{name:"Traseiro",positions:[{pos:"RL",label:"Esq."},{pos:"RR",label:"Dir."}]}]}};function G(s){return s<1.6?"text-red-400":s<3?"text-amber-400":s<5?"text-yellow-400":"text-emerald-400"}function Ie(s){return s<1.6?"bg-red-500":s<3?"bg-amber-500":s<5?"bg-yellow-500":"bg-emerald-500"}function Fe(s){return!s.expectedLifeKm||s.expectedLifeKm<=0?0:Math.min(Math.round((s.currentKm||0)/s.expectedLifeKm*100),100)}function Me({tire:s,onClose:r,onSaved:o}){var a;const[t,l]=x.useState({brand:(s==null?void 0:s.brand)||"",model:(s==null?void 0:s.model)||"",size:(s==null?void 0:s.size)||"",dotCode:(s==null?void 0:s.dotCode)||"",condition:(s==null?void 0:s.condition)||"novo",purchaseDate:((a=s==null?void 0:s.purchaseDate)==null?void 0:a.slice(0,10))||new Date().toISOString().slice(0,10),purchaseCost:(s==null?void 0:s.purchaseCost)||"",supplier:(s==null?void 0:s.supplier)||"",treadDepth:(s==null?void 0:s.treadDepth)||8,expectedLifeKm:(s==null?void 0:s.expectedLifeKm)||5e4,notes:(s==null?void 0:s.notes)||"",quantity:1}),[h,u]=x.useState(!1),[n,b]=x.useState("");async function d(m){m.preventDefault(),u(!0),b("");try{const i={...t,purchaseCost:t.purchaseCost?Number(t.purchaseCost):0,expectedLifeKm:Number(t.expectedLifeKm),treadDepth:Number(t.treadDepth)};s!=null&&s.id?await w.updateTire(s.id,i):await w.createTire(i),o()}catch(i){b(i.message)}finally{u(!1)}}return e.jsx($,{open:!0,onClose:r,title:s?"Editar Pneu":"Cadastrar Pneus",size:"md",bodyClassName:"p-0",icon:e.jsx(P,{className:"w-5 h-5"}),intent:"default",children:e.jsxs("form",{onSubmit:d,className:"p-5 space-y-4 max-h-[70vh] overflow-y-auto",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Marca *"}),e.jsx(O,{value:t.brand,onChange:m=>l({...t,brand:m}),className:"w-full",required:!0,placeholder:"Ex: Michelin"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Modelo"}),e.jsx(O,{value:t.model,onChange:m=>l({...t,model:m}),className:"w-full",placeholder:"Ex: Agilis"})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Medida *"}),e.jsx(O,{value:t.size,onChange:m=>l({...t,size:m}),className:"w-full",required:!0,placeholder:"215/75R17.5"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Código DOT"}),e.jsx(O,{value:t.dotCode,onChange:m=>l({...t,dotCode:m}),className:"w-full font-mono",placeholder:"2521"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Condição"}),e.jsxs("select",{value:t.condition,onChange:m=>l({...t,condition:m.target.value}),className:"input w-full text-sm",children:[e.jsx("option",{value:"novo",children:"Novo"}),e.jsx("option",{value:"reformado",children:"Reformado"}),e.jsx("option",{value:"usado",children:"Usado"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Custo Unitário (R$)"}),e.jsx("input",{type:"number",step:"0.01",value:t.purchaseCost,onChange:m=>l({...t,purchaseCost:m.target.value}),className:"input w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Sulco Inicial (mm)"}),e.jsx("input",{type:"number",step:"0.1",value:t.treadDepth,onChange:m=>l({...t,treadDepth:m.target.value}),className:"input w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Vida Esperada (km)"}),e.jsx("input",{type:"number",value:t.expectedLifeKm,onChange:m=>l({...t,expectedLifeKm:m.target.value}),className:"input w-full"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Fornecedor"}
1),e.jsx(O,{value:t.supplier,onChange:m=>l({...t,supplier:m}),className:"w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Data Compra"}),e.jsx("input",{type:"date",value:t.purchaseDate,onChange:m=>l({...t,purchaseDate:m.target.value}),className:"input w-full"})]})]}),!s&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Quantidade (lote)"}),e.jsx("input",{type:"number",min:1,max:20,value:t.quantity,onChange:m=>l({...t,quantity:Math.max(1,Math.min(20,Number(m.target.value)))}),className:"input w-24"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Observações"}),e.jsx("textarea",{value:t.notes,onChange:m=>l({...t,notes:m.target.value}),className:"input w-full",rows:2})]}),n&&e.jsx("p",{className:"text-sm text-red-400",children:n}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:r,className:"btn-secondary text-sm",children:"Cancelar"}),e.jsxs("button",{type:"submit",disabled:h,className:"btn-primary text-sm flex items-center gap-2",children:[h&&e.jsx(k,{className:"w-4 h-4 animate-spin"})," ",s?"Salvar":`Cadastrar${t.quantity>1?` (${t.quantity})`:""}`]})]})]})})}function Oe({tire:s,vehicles:r,onClose:o,onDone:t}){const[l,h]=x.useState(""),[u,n]=x.useState("FL"),[b,d]=x.useState(""),[a,m]=x.useState(!1),[i,p]=x.useState("");async function j(g){g.preventDefault(),m(!0),p("");try{await w.installTire(s.id,{vehiclePlate:l.toUpperCase(),position:u,installKm:b?Number(b):void 0}),t()}catch(E){p(E.message)}finally{m(!1)}}return e.jsx($,{open:!0,onClose:o,title:"Instalar Pneu",size:"md",bodyClassName:"p-0",icon:e.jsx(P,{className:"w-5 h-5"}),intent:"default",children:e.jsxs("form",{onSubmit:j,className:"p-5 space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-slate-800/50 border border-slate-700/50",children:[e.jsxs("p",{className:"text-sm font-bold",style:{color:"var(--page-text)"},children:[s.brand," ",s.model]}),e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text-secondary)"},children:[s.size," · Sulco: ",s.treadDepth,"mm · ",ee[s.condition]||s.condition]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Veículo *"}),e.jsxs("select",{value:l,onChange:g=>h(g.target.value),className:"input w-full font-mono",required:!0,children:[e.jsx("option",{value:"",children:"Selecione um veículo"}),r==null?void 0:r.map(g=>e.jsxs("option",{value:g.plate,children:[g.plate," — ",g.brand," ",g.model]},g.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Posição *"}),e.jsxs("select",{value:u,onChange:g=>n(g.target.value),className:"input w-full text-sm",children:[e.jsxs("optgroup",{label:"Eixo Dianteiro",children:[e.jsx("option",{value:"FL",children:"Dianteiro Esq."}),e.jsx("option",{value:"FR",children:"Dianteiro Dir."})]}),e.jsxs("optgroup",{label:"2° Dianteiro",children:[e.jsx("option",{value:"FL2",children:"2° Diant. Esq."}),e.jsx("option",{value:"FR2",children:"2° Diant. Dir."})]}),e.jsxs("optgroup",{label:"Traseiro 1 (simples)",children:[e.jsx("option",{value:"RL",children:"Traseiro 1 Esq."}),e.jsx("option",{value:"RR",children:"Traseiro 1 Dir."})]}),e.jsxs("optgroup",{label:"Traseiro 1 (duplo)",children:[e.jsx("option",{value:"RL_outer",children:"Tras. 1 Esq. Ext."}),e.jsx("option",{value:"RL_inner",children:"Tras. 1 Esq. Int."}),e.jsx("option",{value:"RR_inner",children:"Tras. 1 Dir. Int."}),e.jsx("option",{value:"RR_outer",children:"Tras. 1 Dir. Ext."})]}),e.jsxs("optgroup",{label:"Traseiro 2 (simples)",children:[e.jsx("option",{value:"R2L",children:"Traseiro 2 Esq."}),e.jsx("option",{value:"R2R",children:"Traseiro 2 Dir."})]}),e.jsxs("optgroup",{label:"Traseiro 2 (duplo)",children:[e.jsx("option",{value:"R2L_outer",children:"Tras. 2 Esq. Ext."}),e.jsx("option",{value:"R2L_inner",children:"Tras. 2 Esq. Int."}),e.jsx("option",{value:"R2R_inner",children:"Tras. 2 Dir. Int."}),e.jsx("option",{value:"R2R_outer",children:"Tras. 2 Dir. Ext."})]}),e.jsxs("optgroup",{label:"Traseiro 3 (duplo)",children:[e.jsx("option",{value:"R3L_outer",children:"Tras. 3 Esq. Ext."}),e.jsx("option",{value:"R3L_inner",children:"Tras. 3 Esq. Int."}),e.jsx("option",{value:"R3R_inner",children:"Tras. 3 Dir. Int."}),e.jsx("option",{value:"R3R_outer",children:"Tras. 3 Dir. Ext."})]}),e.jsxs("optgroup",{label:"Estepe",children:[e.jsx("option",{value:"spare",children:"Estepe"}),e.jsx("option",{value:"spare2",children:"Estepe 2"})]})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Km do Odômetro"}),e.jsx("input",{type:"number",value:b,onChange:g=>d(g.target.value),className:"input w-full",placeholder:"Opcional"})]}),i&&e.jsx("p",{className:"text-sm text-red-400",children:i}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:o,className:"btn-secondary text-sm",children:"Cancelar"}),e.jsxs("button",{type:"submit",disabled:a,className:"btn-primary text-sm flex items-center gap-2",children:[a&&e.jsx(k,{className:"w-4 h-4 animate-spin"})," Instalar"]})]})]})})}function ze({tire:s,onClose:r,onDone:o}){const[t,l]=x.useState(s.treadDepth||""),[h,u]=x.useState(""),[n,b]=x.use
1State(""),[d,a]=x.useState(!1),[m,i]=x.useState("");async function p(j){j.preventDefault(),a(!0),i("");try{await w.inspectTire(s.id,{treadDepth:Number(t),km:h?Number(h):void 0,notes:n}),o()}catch(g){i(g.message)}finally{a(!1)}}return e.jsx($,{open:!0,onClose:r,title:"Inspecionar Pneu",size:"md",bodyClassName:"p-0",icon:e.jsx(U,{className:"w-5 h-5"}),intent:"default",children:e.jsxs("form",{onSubmit:p,className:"p-5 space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-slate-800/50 border border-slate-700/50",children:[e.jsxs("p",{className:"text-sm font-bold",style:{color:"var(--page-text)"},children:[s.brand," ",s.model," · ",s.vehiclePlate||"Estoque"]}),e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text-secondary)"},children:[s.size," · Último sulco: ",s.treadDepth,"mm"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Profundidade Sulco (mm) *"}),e.jsx("input",{type:"number",step:"0.1",min:"0",max:"20",value:t,onChange:j=>l(j.target.value),className:"input w-full",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Km do Odômetro"}),e.jsx("input",{type:"number",value:h,onChange:j=>u(j.target.value),className:"input w-full",placeholder:"Opcional"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Observações"}),e.jsx("textarea",{value:n,onChange:j=>b(j.target.value),className:"input w-full",rows:2,placeholder:"Desgaste irregular, bolha lateral..."})]}),m&&e.jsx("p",{className:"text-sm text-red-400",children:m}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:r,className:"btn-secondary text-sm",children:"Cancelar"}),e.jsxs("button",{type:"submit",disabled:d,className:"btn-primary text-sm flex items-center gap-2",children:[d&&e.jsx(k,{className:"w-4 h-4 animate-spin"})," Registrar Inspeção"]})]})]})})}function $e({tire:s,onClose:r,onDone:o}){const[t,l]=x.useState("desgaste"),[h,u]=x.useState(!1),[n,b]=x.useState(""),[d,a]=x.useState(!1),[m,i]=x.useState("");async function p(j){j.preventDefault(),a(!0),i("");try{await w.discardTire(s.id,{reason:t,sendToReform:h,reformShop:n}),o()}catch(g){i(g.message)}finally{a(!1)}}return e.jsx($,{open:!0,onClose:r,title:"Remover Pneu",size:"md",bodyClassName:"p-0",icon:e.jsx(me,{className:"w-5 h-5"}),intent:"danger",children:e.jsxs("form",{onSubmit:p,className:"p-5 space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-slate-800/50 border border-slate-700/50",children:[e.jsxs("p",{className:"text-sm font-bold",style:{color:"var(--page-text)"},children:[s.brand," ",s.model]}),e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text-secondary)"},children:[s.size," · Sulco: ",s.treadDepth,"mm · ",s.vehiclePlate||"Estoque"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Motivo"}),e.jsxs("select",{value:t,onChange:j=>l(j.target.value),className:"input w-full text-sm",children:[e.jsx("option",{value:"desgaste",children:"Desgaste natural"}),e.jsx("option",{value:"dano",children:"Dano / Avaria"}),e.jsx("option",{value:"bolha",children:"Bolha lateral"}),e.jsx("option",{value:"furo_irreparavel",children:"Furo irreparável"}),e.jsx("option",{value:"idade",children:"Idade / DOT expirado"}),e.jsx("option",{value:"outro",children:"Outro"})]})]}),e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:h,onChange:j=>u(j.target.checked),className:"rounded border-slate-600"}),e.jsx("span",{className:"text-sm",style:{color:"var(--page-text)"},children:"Enviar para reforma (recapagem)"})]}),h&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Reformadora"}),e.jsx(O,{value:n,onChange:j=>b(j),className:"w-full",placeholder:"Nome da empresa"})]}),m&&e.jsx("p",{className:"text-sm text-red-400",children:m}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:r,className:"btn-secondary text-sm",children:"Cancelar"}),e.jsxs("button",{type:"submit",disabled:d,className:v("text-sm flex items-center gap-2",h?"btn-primary":"px-4 py-2.5 rounded-xl bg-red-600 hover:bg-red-500 text-white font-medium transition-colors"),children:[d&&e.jsx(k,{className:"w-4 h-4 animate-spin"})," ",h?"Enviar p/ Reforma":"Descartar"]})]})]})})}function Ke({tire:s,vehicles:r,onClose:o,onDone:t}){const[l,h]=x.useState(""),[u,n]=x.useState(""),[b,d]=x.useState(!1),[a,m]=x.useState("");async function i(p){p.preventDefault(),d(!0),m("");try{await w.rotateTire(s.id,{newPosition:l,newVehiclePlate:u||void 0}),t()}catch(j){m(j.message)}finally{d(!1)}}return e.jsx($,{open:!0,onClose:o,title:"Rodízio de Pneu",size:"md",bodyClassName:"p-0",icon:e.jsx(q,{className:"w-5 h-5"}),intent:"default",children:e.jsxs("form",{onSubmit:i,className:"p-5 space-y-4",children:[e.jsxs("div",{className:"p-3 rounded-xl bg-slate-800/50 border border-slate-700/50",children:[e.jsxs("p",{className:"text-sm font-bold",style:{color:"var(--page-text)"},children:[s.brand," ",s.model]}),e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text-secondary)"},children:["Atual: ",s.vehiclePlate," / ",I[s.position]||s.position]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Nova Posição *"}
1),e.jsxs("select",{value:l,onChange:p=>h(p.target.value),className:"input w-full text-sm",required:!0,children:[e.jsx("option",{value:"",children:"Selecionar..."}),Object.entries(z).filter(([p])=>p!=="custom").map(([,p])=>p.axles.map(j=>e.jsx("optgroup",{label:j.name,children:j.positions.map(g=>e.jsx("option",{value:g.pos,children:I[g.pos]||g.label},g.pos))},j.name))).flat(),e.jsxs("optgroup",{label:"Estepe",children:[e.jsx("option",{value:"spare",children:"Estepe"}),e.jsx("option",{value:"spare2",children:"Estepe 2"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1 block",children:"Outro Veículo (opcional)"}),e.jsxs("select",{value:u,onChange:p=>n(p.target.value),className:"input w-full font-mono",children:[e.jsx("option",{value:"",children:"Manter no mesmo veículo"}),r==null?void 0:r.map(p=>e.jsxs("option",{value:p.plate,children:[p.plate," — ",p.brand," ",p.model]},p.id))]})]}),a&&e.jsx("p",{className:"text-sm text-red-400",children:a}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{type:"button",onClick:o,className:"btn-secondary text-sm",children:"Cancelar"}),e.jsxs("button",{type:"submit",disabled:b||!l,className:"btn-primary text-sm flex items-center gap-2",children:[b&&e.jsx(k,{className:"w-4 h-4 animate-spin"})," Executar Rodízio"]})]})]})})}const T={current:null};function X({pos:s,label:r,tire:o,onDragStart:t,onDropHere:l,onClick:h,onContextMenu:u}){const n=(o==null?void 0:o.treadDepth)||0,[b,d]=x.useState(!1);return e.jsxs("div",{draggable:!!o,onDragStart:a=>{if(!o){a.preventDefault();return}a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("text/plain",o.id),t(o.id,s)},onDragOver:a=>{a.preventDefault(),a.dataTransfer.dropEffect="move",d(!0)},onDragLeave:()=>d(!1),onDrop:a=>{a.preventDefault(),d(!1),l(s)},onClick:h,onContextMenu:a=>{o&&u&&(a.preventDefault(),u())},className:v("relative w-20 h-28 rounded-xl border-2 flex flex-col items-center justify-center gap-1 transition-all select-none",o?"cursor-grab active:cursor-grabbing":"",b&&"ring-2 ring-brand-400 scale-105",o?n<1.6?"border-red-500/60 bg-red-500/10 hover:bg-red-500/20":n<3?"border-amber-500/60 bg-amber-500/10 hover:bg-amber-500/20":"border-emerald-500/40 bg-emerald-500/5 hover:bg-emerald-500/10":b?"border-brand-400/60 border-dashed bg-brand-500/10":"border-slate-700 border-dashed bg-slate-800/30 opacity-50"),title:o?`${o.brand} ${o.model} · ${o.size}
2Arraste para trocar posição
3Clique direito: devolver ao estoque`:"Arraste um pneu aqui",children:[o?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:v("text-lg font-bold tabular-nums",G(n)),children:n}),e.jsx("span",{className:"text-[9px] text-slate-400",children:"mm"}),e.jsx("div",{className:"w-12 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:e.jsx("div",{className:v("h-full rounded-full",Ie(n)),style:{width:`${Math.min(n/8*100,100)}%`}})})]}):e.jsx(Z,{className:"w-4 h-4 text-slate-600"}),e.jsx("span",{className:"text-[8px] text-slate-500 absolute -bottom-4",children:r})]})}function Ae({tire:s,onDragStart:r,onClick:o}){return e.jsxs("div",{draggable:!0,onDragStart:t=>{t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",s.id),r(s.id)},onClick:o,className:"flex items-center gap-2 px-3 py-2 rounded-lg border border-blue-500/20 bg-blue-500/5 hover:bg-blue-500/10 cursor-grab active:cursor-grabbing select-none transition-all",title:`${s.brand} ${s.model} · ${s.size} · Sulco: ${s.treadDepth}mm
4Arraste para uma posição no diagrama`,children:[e.jsx("div",{className:v("w-6 h-6 rounded-md flex items-center justify-center text-[10px] font-bold",G(s.treadDepth||
40)),children:s.treadDepth||0}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[11px] font-medium text-white truncate max-w-[100px]",children:s.brand}),e.jsx("p",{className:"text-[9px] text-slate-500 truncate",children:s.size})]})]})}function Be({tires:s,stockTires:r,onDrop:o,onTireClick:t,onUninstall:l,isDualAxle:h,axleConfig:u}){const n=x.useMemo(()=>{const i={};return s.filter(p=>p.status==="em_uso").forEach(p=>{p.position&&(i[p.position]=p)}),i},[s]),b=x.useCallback((i,p)=>{T.current={tireId:i,from:"position",fromPos:p}},[]),d=x.useCallback(i=>{T.current={tireId:i,from:"stock"}},[]),a=x.useCallback(i=>{T.current&&(o==null||o(T.current.tireId,i),T.current=null)},[o]),m=u&&z[u]?z[u]:h?z["2x4"]:z["2x2"];return e.jsxs("div",{className:"flex flex-col items-center gap-6 py-4",children:[m.axles.map((i,p)=>e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[p>0&&e.jsxs("div",{className:"flex items-center gap-2 w-full max-w-[320px]",children:[e.jsx("div",{className:"flex-1 h-px bg-slate-700"}),e.jsx("span",{className:"text-[10px] text-slate-500 px-2 whitespace-nowrap",children:i.name}),e.jsx("div",{className:"flex-1 h-px bg-slate-700"})]}),p===0&&e.jsx("span",{className:"text-[10px] text-slate-500 mb-1",children:i.name}),e.jsx("div",{className:v("flex items-center",i.positions.length<=2?"gap-6":"gap-3"),children:i.positions.length<=2?e.jsxs(e.Fragment,{children:[e.jsx(X,{pos:i.positions[0].pos,label:i.positions[0].label,tire:n[i.positions[0].pos],onDragStart:b,onDropHere:a,onClick:()=>n[i.positions[0].pos]&&(t==null?void 0:t(n[i.positions[0].pos])),onContextMenu:()=>n[i.positions[0].pos]&&(l==null?void 0:l(n[i.positions[0].pos]))}),p===0&&e.jsx("div",{className:"w-16 h-24 rounded-xl bg-slate-800/40 border border-slate-700/30 flex items-center justify-center",children:e.jsx(Y,{className:"w-7 h-7 text-slate-600"})}),e.jsx(X,{pos:i.positions[1].pos,label:i.positions[1].label,tire:n[i.positions[1].pos],onDragStart:b,onDropHere:a,onClick:()=>n[i.positions[1].pos]&&(t==null?void 0:t(n[i.positions[1].pos])),onContextMenu:()=>n[i.positions[1].pos]&&(l==null?void 0:l(n[i.positions[1].pos]))})]}):i.positions.map(j=>e.jsx(X,{pos:j.pos,label:j.label,tire:n[j.pos],onDragStart:b,onDropHere:a,onClick:()=>n[j.pos]&&(t==null?void 0:t(n[j.pos])),onContextMenu:()=>n[j.pos]&&(l==null?void 0:l(n[j.pos]))},j.pos))})]},p)),e.jsx(X,{pos:"spare",label:"Estepe",tire:n.spare,onDragStart:b,onDropHere:a,onClick:()=>n.spare&&(t==null?void 0:t(n.spare)),onContextMenu:()=>n.spare&&(l==null?void 0:l(n.spare))}),r&&r.length>0&&e.jsxs("div",{className:"w-full border-t border-dashed border-slate-700 mt-2 pt-4",children:[e.jsxs("p",{className:"text-xs font-semibold text-slate-400 mb-3 flex items-center gap-2",children:[e.jsx(H,{className:"w-3.5 h-3.5"})," Estoque — arraste para instalar"]}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:r.slice(0,12).map(i=>e.jsx(Ae,{tire:i,onDragStart:d,onClick:()=>t==null?void 0:t(i)},i.id))})]})]})}function Ve({tires:s,alerts:r,analysis:o,onRefresh:t}){var n;const l=(r==null?void 0:r.alerts)||[],h=(r==null?void 0:r.rotationRecommendations)||[],u=(o==null?void 0:o.summary)||{};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"card flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-blue-500/15 flex items-center justify-center",children:e.jsx(P,{className:"w-5 h-5 text-blue-400"})}),e.jsx("span",{className:"text-sm",style:{color:"var(--page-text-secondary)"},children:"Total"})]}),e.jsx("span",{className:"text-2xl font-bold",style:{color:"var(--page-text)"},children:u.total||0}),e.jsxs("span",{className:"text-xs text-slate-500 mt-1",children:[u.inUse||0," em uso · ",u.inStock||0," estoque"]})]}),e.jsxs("div",{className:"card flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-emerald-500/15 flex items-center justify-center",children:e.jsx(ce,{className:"w-5 h-5 text-emerald-400"})}),e.jsx("span",{className:"text-sm",style:{color:"var(--page-text-secondary)"},children:"Investimento"})]}),e.jsx("span",{className:"text-2xl font-bold text-emerald-400",children:V(u.totalInvestment)}),u.costPerKm>0&&e.jsxs("span",{className:"text-xs text-slate-500 mt-1",children:["R$ ",(u.costPerKm*1e3).toFixed(2),"/1000km"]})]}),e.jsxs("div",{className:"card flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-amber-500/15 flex items-center justify-center",children:e.jsx(de,{className:"w-5 h-5 text-amber-400"})}),e.jsx("span",{className:"text-sm",style:{color:"var(--page-text-secondary)"},children:"Reforma"})]}),e.jsx("span",{className:"text-2xl font-bold text-amber-400",children:u.inReform||0}),u.totalReformCost>0&&e.jsxs("span",{className:"text-xs text-slate-500 mt-1",children:[V(u.totalReformCost)," investido"]})]}),e.jsxs("div",{className:"card flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:v("w-10 h-10 rounded-xl flex items-center justify-center",u.criticalAlerts>0?"bg-red-500/15":"bg-emerald-500/15"),children:e.jsx(ae,{className:"w-5 h-5 text-white"})}),e.jsx("span",{className:"text-sm",style:{color:"var(--page-text-secondary)"},children:"Alertas"})]}),e.jsx("span",{className:v("text-2xl font-bold",u.criticalAlerts>0?"text-red-400":"text-emerald-400"),children:u.criticalAlerts||0}),e.jsxs("span",{className:"text-xs text-slate-500 mt-1",children:[u.warningAlerts||0," atenção"]})]}),e.jsxs("div",{className:"card flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-purple-500/15 flex items-center justify-center",children:e.jsx(Se,{className:"w-5 h-5 text-purple-400"})}),e.jsx("span",{className:"text-sm",style:{color:"var(--page-text-secondary)"},children:"Descartados"})]}),e.jsx("span",{className:"text-2xl font-bold text-slate-300",children:u.discarded||0}),e.jsxs("span",{className:"text-xs text-slate-500 mt-1",children:[((n=u.totalKm)==null?void 0:n.toLocaleStr
4ing("pt-BR"))||0," km total"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"card",children:[e.jsxs("h3",{className:"text-sm font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(ae,{className:"w-4 h-4 text-red-400"})," Alertas Ativos (",l.length,")"]}),l.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(le,{className:"w-8 h-8 text-emerald-500/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Nenhum alerta ativo"})]}):e.jsx("div",{className:"space-y-2 max-h-[320px] overflow-y-auto",children:l.slice(0,20).map((b,d)=>{const a=oe[b.severity]||oe.info,m=a.icon;return e.jsxs("div",{className:v("flex items-start gap-3 p-3 rounded-xl border",a.cls),children:[e.jsx(m,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:b.message}),e.jsxs("p",{className:"text-xs opacity-70",children:[b.vehiclePlate," · ",I[b.position]||b.position]})]})]},d)})})]}),e.jsxs("div",{className:"card",children:[e.jsxs("h3",{className:"text-sm font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4 text-cyan-400"})," Recomendações de Rodízio (",h.length,")"]}),h.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(le,{className:"w-8 h-8 text-emerald-500/50 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-slate-500",children:"Todos os veículos com desgaste uniforme"})]}):e.jsx("div",{className:"space-y-3",children:h.map((b,d)=>e.jsxs("div",{className:"p-3 rounded-xl bg-cyan-500/5 border border-cyan-500/20",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-bold text-white font-mono",children:b.vehiclePlate}),e.jsxs("span",{className:"text-xs text-cyan-400 font-bold",children:[b.differential,"mm diff."]})]}),e.jsx("p",{className:"text-xs",style:{color:"var(--page-text-secondary)"},children:b.reason}),e.jsxs("div",{className:"flex gap-4 mt-2 text-xs",children:[e.jsxs("span",{className:"text-slate-500",children:["Diant: ",e.jsxs("span",{className:"text-slate-300 font-bold",children:[b.frontAvgDepth,"mm"]})]}),e.jsxs("span",{className:"text-slate-500",children:["Tras: ",e.jsxs("span",{className:"text-slate-300 font-bold",children:[b.rearAvgDepth,"mm"]})]})]})]},d))})]})]})]})}function He({tires:s,isAdmin:r,onAction:o}){const[t,l]=x.useState(""),[h,u]=x.useState(""),[n,b]=x.useState(!1),d=x.useMemo(()=>s.filter(a=>{if(h&&a.status!==h)return!1;if(t){const m=t.toLowerCase();if(![a.brand,a.model,a.size,a.vehiclePlate,a.dotCode].some(i=>{var p;return(p=i==null?void 0:i.toLowerCase)==null?void 0:p.call(i).includes(m)}))return!1}return!0}),[s,t,h]);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-3 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[240px]",children:[e.jsx(Te,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500"}),e.jsx("input",{type:"text",placeholder:"Buscar marca, modelo, medida, placa...",value:t,onChange:a=>l(a.target.value),className:"input pl-10 w-full"})]}),e.jsxs("button",{onClick:()=>b(!n),className:v("flex items-center gap-2 px-4 py-2.5 rounded-xl border text-sm font-medium transition-all",n||h?"border-brand-500/40 bg-brand-500/10 text-brand-400":"border-slate-700 text-slate-400 hover:border-slate-600"),children:[e.jsx(ke,{className:"w-4 h-4"})," Filtros",h&&e.jsx("span",{className:"w-2 h-2 rounded-full bg-brand-400"}),e.jsx(Le,{className:v("w-3.5 h-3.5 transition-transform",n&&"rotate-180")})]})]}),n&&e.jsxs("div",{className:"flex gap-3 flex-wrap p-4 rounded-xl bg-slate-800/30 border border-slate-700/50",children:[e.jsxs("div",{className:"min-w-[180px]",children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1.5 block",children:"Status"}),e.jsxs("select",{value:h,onChange:a=>u(a.target.value),className:"input w-full text-sm",children:[e.jsx("option",{value:"",children:"Todos"}),e.jsx("option",{value:"em_uso",children:"Em Uso"}),e.jsx("option",{value:"estoque",children:"Estoque"}),e.jsx("option",{value:"reforma",children:"Reforma"}),e.jsx("option",{value:"descartado",children:"Descartado"})]})]}),(h||t)&&e.jsx("div",{className:"flex items-end",children:e.jsx("button",{onClick:()=>{u(""),l("")},className:"text-xs text-brand-400 hover:text-brand-300 font-medium px-3 py-2.5",children:"Limpar filtros"})})]}),d.length===0?e.jsxs("div",{className:"card text-center py-16",children:[e.jsx(P,{className:"w-12 h-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{className:"text-slate-400",children:t?"Nenhum pneu encontrado":"Nenhum pneu cadastrado"})]}):e.jsx("div",{className:"card overflow-hidden p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-800",children:[e.jsx("th",{className:"text-left text-xs font-medium uppercase  tracking-wider px-5 py-3",children:"Pneu"}),e.jsx("th",{className:"text-center text-xs font-medium uppercase  tracking-wider px-5 py-3",children:"Status"}),e.jsx("th",{className:"text-center text-xs font-medium uppercase  tracking-wider px-5 py-3",children:"Sulco"}),e.jsx("th",{className:"text-center text-xs font-medium uppercase  tracking-wider px-5 py-3",children:"Vida"}),e.jsx("th",{className:"text-left text-xs font-medium uppercase  tracking-wider px-5 py-3 hidden md:table-cell",children:"Veículo"}),e.jsx("th",{className:"text-left text-xs font-medium uppercase  tracking-wider px-5 py-3 hidden lg:table-cell",children:"Previsão"}),e.jsx("th",{className:"text-center text-xs font-medium uppercase  tracking-wider px-5 py-3 w-40",children:"Ações"})]})}),e.jsx("tbody",{children:d.map(a=>{var i,p,j;const m=Fe(a);return e.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/30 transition-colors",children:[e.jsx("td",{className:"px-5 py-3",children:e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-bold",style:{color:"var(--page-text)"},children:[a.brand," ",a.model]}),e.jsxs("p",{className:"text-[11px] text-slate-500",children:[a.size," · ",ee[a.condition]||a.condition,a.dotCode?` · DOT ${a.dotC
4ode}`:""]})]})}),e.jsx("td",{className:"px-5 py-3 text-center",children:e.jsx("span",{className:v("text-[10px] font-bold px-2 py-0.5 rounded-lg border",((i=J[a.status])==null?void 0:i.cls)||""),children:((p=J[a.status])==null?void 0:p.label)||a.status})}),e.jsx("td",{className:"px-5 py-3 text-center",children:e.jsxs("span",{className:v("text-sm font-bold tabular-nums",G(a.treadDepth||0)),children:[a.treadDepth??"—","mm"]})}),e.jsx("td",{className:"px-5 py-3 text-center",children:a.status==="em_uso"?e.jsxs("div",{className:"inline-flex flex-col items-center",children:[e.jsx("div",{className:"w-16 h-1.5 rounded-full bg-slate-800 overflow-hidden",children:e.jsx("div",{className:v("h-full rounded-full",m>=90?"bg-red-500":m>=70?"bg-amber-500":"bg-emerald-500"),style:{width:`${m}%`}})}),e.jsxs("span",{className:"text-[10px] text-slate-500 mt-0.5",children:[m,"%"]})]}):e.jsx("span",{className:"text-xs text-slate-600",children:"—"})}),e.jsx("td",{className:"px-5 py-3 hidden md:table-cell",children:a.vehiclePlate?e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-mono text-white",children:a.vehiclePlate}),e.jsx("p",{className:"text-[10px] text-slate-500",children:I[a.position]||a.position})]}):e.jsx("span",{className:"text-xs text-slate-600",children:"—"})}),e.jsx("td",{className:"px-5 py-3 hidden lg:table-cell",children:a.prediction?e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text)"},children:[(j=a.prediction.estimatedRemainingKm)==null?void 0:j.toLocaleString("pt-BR")," km restantes"]}),a.prediction.estimatedReplacementDate&&e.jsxs("p",{className:"text-[10px] text-slate-500",children:["Troca ~ ",se(a.prediction.estimatedReplacementDate)]})]}):e.jsx("span",{className:"text-[10px] text-slate-600",children:"Sem dados"})}),e.jsx("td",{className:"px-5 py-3",children:e.jsxs("div",{className:"flex items-center justify-center gap-1",children:[a.status==="estoque"&&r&&e.jsx("button",{onClick:()=>o("install",a),title:"Instalar",className:"p-1.5 rounded-lg hover:bg-emerald-500/10 text-slate-500 hover:text-emerald-400 transition-colors",children:e.jsx(Z,{className:"w-4 h-4"})}),a.status==="em_uso"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>o("inspect",a),title:"Inspecionar",className:"p-1.5 rounded-lg hover:bg-blue-500/10 text-slate-500 hover:text-blue-400 transition-colors",children:e.jsx(U,{className:"w-4 h-4"})}),r&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>o("rotate",a),title:"Rodízio",className:"p-1.5 rounded-lg hover:bg-cyan-500/10 text-slate-500 hover:text-cyan-400 transition-colors",children:e.jsx(q,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>o("uninstall",a),title:"Devolver ao Estoque",className:"p-1.5 rounded-lg hover:bg-amber-500/10 text-slate-500 hover:text-amber-400 transition-colors",children:e.jsx(H,{className:"w-4 h-4"})})]})]}),(a.status==="em_uso"||a.status==="estoque")&&r&&e.jsx("button",{onClick:()=>o("discard",a),title:"Remover/Descartar",className:"p-1.5 rounded-lg hover:bg-red-500/10 text-slate-500 hover:text-red-400 transition-colors",children:e.jsx(xe,{className:"w-4 h-4"})}),r&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>o("edit",a),title:"Editar",className:"p-1.5 rounded-lg hover:bg-slate-800 text-slate-500 hover:text-slate-300 transition-colors",children:e.jsx(_e,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>o("delete",a),title:"Excluir",className:"p-1.5 rounded-lg hover:bg-red-500/10 text-slate-500 hover:text-red-400 transition-colors",children:e.jsx(me,{className:"w-4 h-4"})})]})]})})]},a.id)})})]})})})]})}function Ge({tire:s,onClose:r}){const o=[...s.timeline||[]].sort((l,h)=>{const u=l.timestamp?new Date(l.timestamp).getTime():0;return(h.timestamp?new Date(h.timestamp).getTime():0)-u}),t={compra:{icon:ce,color:"text-emerald-400"},instalação:{icon:Z,color:"text-blue-400"},desinstalação:{icon:H,color:"text-amber-400"},rodízio:{icon:q,color:"text-cyan-400"},inspeção:{icon:U,color:"text-purple-400"},envio_reforma:{icon:de,color:"text-amber-400"},retorno_reforma:{icon:le,color:"text-emerald-400"},descarte:{icon:xe,color:"text-red-400"}};return e.jsx($,{open:!0,onClose:r,title:`${s.brand} ${s.model}`,description:`${s.size} · ${ee[s.condition]||s.condition} · Sulco: ${s.treadDepth}mm`,size:"md",icon:e.jsx(P,{className:"w-5 h-5"}),intent:"info",children:e.jsxs(e.Fragment,{children:[o.length===0?e.jsx("p",{className:"text-sm text-slate-500 text-center py-8",children:"Nenhum evento registrado"}):e.jsxs("div",{className:"relative pl-6 space-y-4",children:[e.jsx("div",{className:"absolute left-2.5 top-1 bottom-1 w-px bg-slate-700"}),o.map((l,h)=>{const u=t[l.action]||{icon:P,color:"text-slate-400"},n=u.icon;return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:v("absolute -left-6 top-0.5 w-5 h-5 rounded-full bg-slate-900 border-2 border-slate-700 flex items-center justify-center"),children:e.jsx(n,{className:v("w-3 h-3",u.color)})}),e.jsxs("div",{className:"ml-2",children:[e.jsx("p",{className:"text-sm text-white",children:l.note||l.action}),e.jsxs("div",{className:"flex gap-3 mt-1",children:[l.timestamp&&e.jsx("span",{className:"text-[10px] text-slate-500",children:se(l.timestamp)}),l.by&&e.jsx("span",{className:"text-[10px] text-slate-600",children:l.by})]})]})]},h)})]}),(s.inspections||[]).length>0&&e.jsxs("div",{className:"mt-6 pt-4 border-t border-slate-800",children:[e.jsx("h4",{className:"text-xs font-semibold text-slate-400 mb-3",children:"Histórico de Inspeções"}),e.jsx("div",{className:"space-y-2",children:s.inspections.slice(0,10).map((l,h)=>e.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-slate-800/30",children:[e.jsx("div",{className:v("w-8 h-8 rounded-lg flex items-center justify-center text-xs font-bold",G(l.treadDepth||
40)),children:l.treadDepth}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("span",{className:"text-xs",style:{color:"var(--page-text)"},children:[l.treadDepth,"mm"]}),l.km&&e.jsxs("span",{className:"text-xs text-slate-500 ml-2",children:[l.km.toLocaleString("pt-BR")," km"]})]}),e.jsx("span",{className:"text-[10px] text-slate-600",children:se(l.date)})]},h))})]})]})})}function Qe({tires:s,allTires:r,isAdmin:o,onAction:t,onRefresh:l}){const h=x.useMemo(()=>{const c=new Set;return s.filter(N=>N.vehiclePlate&&N.status==="em_uso").forEach(N=>c.add(N.vehiclePlate)),Array.from(c).sort()},[s]),u=x.useMemo(()=>r.filter(c=>c.status==="estoque"),[r]),[n,b]=x.useState(h[0]||""),[d,a]=x.useState(null),[m,i]=x.useState(!1),[p,j]=x.useState(!1),[g,E]=x.useState(null),[F,L]=x.useState(!1),[K,D]=x.useState("2x2"),M=x.useMemo(()=>d!=null&&d.tires?d.tires.some(c=>{var N;return(N=c.position)==null?void 0:N.includes("_")}):!1,[d]);x.useEffect(()=>{if(!(d!=null&&d.tires))return;const c=d.tires.map(N=>N.position).filter(Boolean);c.some(N=>N.startsWith("R3"))?D("2x4x4x4"):c.some(N=>N.startsWith("R2")&&N.includes("_"))?D("2x4x4"):c.some(N=>N.startsWith("R2"))?D("2x4x2"):D(M?"2x4":"2x2")},[d,M]);const S=x.useCallback(()=>{if(!n){a(null);return}i(!0),w.tiresByVehicle(n).then(a).catch(()=>{}).finally(()=>i(!1))},[n]);x.useEffect(()=>{S()},[S]);async function Q(c,N){if(!(!o||p)){j(!0);try{const R=[...(d==null?void 0:d.tires)||[],...u].find(C=>C.id===c);if(!R)return;R.status==="estoque"?await w.installTire(c,{vehiclePlate:n,position:N}):R.status==="em_uso"&&await w.rotateTire(c,{newPosition:N,newVehiclePlate:n}),S(),l()}catch(R){alert(R.message||"Erro ao mover pneu")}finally{j(!1)}}}async function A(c){if(!(!o||p)&&confirm(`Devolver "${c.brand} ${c.model}" ao estoque?`)){j(!0);try{await w.uninstallTire(c.id,{reason:"Remoção manual via diagrama"}),S(),l()}catch(N){alert(N.message||"Erro ao desinstalar")}finally{j(!1)}}}async function W(c){var R;if(!o||p)return;const N=(R=d==null?void 0:d.tires)==null?void 0:R.find(C=>C.id===c);if(!(!N||N.status!=="em_uso")){j(!0);try{await w.uninstallTire(c,{reason:"Removido via drag & drop"}),S(),l()}catch(C){alert(C.message||"Erro ao devolver ao estoque")}finally{j(!1)}}}return h.length===0&&u.length===0?e.jsxs("div",{className:"card text-center py-16",children:[e.jsx(Y,{className:"w-12 h-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{className:"text-slate-400",children:"Nenhum pneu instalado em veículos"}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Instale pneus a partir do inventário."})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex gap-3 flex-wrap items-end",children:[e.jsxs("div",{className:"min-w-[200px]",children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1.5 block",children:"Veículo"}),e.jsxs("select",{value:n,onChange:c=>b(c.target.value),className:"input w-full font-mono",children:[h.length===0&&e.jsx("option",{value:"",children:"Nenhum veículo"}),h.map(c=>e.jsx("option",{value:c,children:c},c))]})]}),e.jsxs("div",{className:"min-w-[220px]",children:[e.jsx("label",{className:"text-xs font-medium text-slate-400 mb-1.5 block",children:"Configuração de Eixos"}),e.jsx("select",{value:K,onChange:c=>D(c.target.value),className:"input w-full text-sm",children:Object.entries(z).filter(([c])=>c!=="custom").map(([c,N])=>e.jsx("option",{value:c,children:N.label},c))})]}),p&&e.jsx(k,{className:"w-5 h-5 text-brand-400 animate-spin mb-2"})]}),o&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-xl bg-slate-800/30 border border-slate-700/50",children:[e.jsx(q,{className:"w-4 h-4 text-cyan-400 flex-shrink-0"}),e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text-secondary)"},children:[e.jsx("span",{className:"font-medium text-slate-300",children:"Arraste"})," pneus entre posições para rodízio, do estoque para instalar, ou para a zona de estoque para desinstalar.",e.jsx("span",{className:"text-slate-500 ml-1",children:"Clique direito em um pneu instalado para devolver ao estoque."})]})]}),m?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(k,{className:"w-8 h-8 text-brand-500 animate-spin"})}
4):n?e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"card relative",children:[e.jsxs("h3",{className:"text-sm font-semibold text-white mb-2 flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4 text-cyan-400"})," Diagrama — ",n]}),e.jsx(Be,{tires:(d==null?void 0:d.tires)||[],stockTires:o?u:void 0,onDrop:Q,onTireClick:E,onUninstall:A,isDualAxle:M,axleConfig:K}),o&&e.jsxs("div",{onDragOver:c=>{c.preventDefault(),c.dataTransfer.dropEffect="move",L(!0)},onDragLeave:()=>L(!1),onDrop:c=>{c.preventDefault(),L(!1),T.current&&(W(T.current.tireId),T.current=null)},className:v("mt-4 p-5 rounded-xl border-2 border-dashed flex items-center justify-center gap-3 transition-all",F?"border-amber-400 bg-amber-500/15 scale-[1.02] shadow-lg shadow-amber-500/10":"border-amber-500/40 bg-amber-500/5 hover:bg-amber-500/10 hover:border-amber-400/60"),children:[e.jsx(H,{className:v("w-6 h-6",F?"text-amber-400 animate-bounce":"text-amber-500/70")}),e.jsx("span",{className:v("text-sm font-semibold",F?"text-amber-300":"text-amber-400/80"),children:"Solte aqui para devolver ao estoque"})]})]}),e.jsxs("div",{className:"space-y-4",children:[(d==null?void 0:d.rotationRecommendation)&&e.jsxs("div",{className:"p-4 rounded-xl bg-cyan-500/5 border border-cyan-500/20",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(q,{className:"w-4 h-4 text-cyan-400"}),e.jsx("span",{className:"text-sm font-bold text-cyan-400",children:"Rodízio Recomendado"})]}),e.jsx("p",{className:"text-xs",style:{color:"var(--page-text-secondary)"},children:d.rotationRecommendation.reason}),e.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:["Diferencial: ",d.rotationRecommendation.differential,"mm"]})]}),e.jsxs("div",{className:"card",children:[e.jsx("h3",{className:"text-sm font-semibold text-white mb-3",children:"Pneus Instalados"}),e.jsxs("div",{className:"space-y-2",children:[((d==null?void 0:d.tires)||[]).filter(c=>c.status==="em_uso").map(c=>{var N,R;return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl bg-slate-800/40 border border-slate-700/50 hover:border-slate-600 transition-colors group",children:[e.jsx("div",{className:v("w-10 h-10 rounded-xl flex items-center justify-center text-sm font-bold",G(c.treadDepth)),children:c.treadDepth}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",style:{color:"var(--page-text)"},children:I[c.position]||c.position}),e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text-muted)"},children:[c.brand," ",c.model," · ",c.size]})]}),e.jsxs("div",{className:"text-right mr-2",children:[e.jsxs("p",{className:"text-xs",style:{color:"var(--page-text-secondary)"},children:[(c.currentKm||0).toLocaleString("pt-BR")," km"]}),c.prediction&&e.jsxs("p",{className:"text-[10px] text-slate-600",children:[(R=(N=c.prediction)==null?void 0:N.estimatedRemainingKm)==null?void 0:R.toLocaleString("pt-BR")," km rest."]})]}),e.jsxs("div",{className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:()=>E(c),title:"Histórico",className:"p-1.5 rounded-lg hover:bg-slate-700 text-slate-500 hover:text-slate-300",children:e.jsx(qe,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>t("inspect",c),title:"Inspecionar",className:"p-1.5 rounded-lg hover:bg-blue-500/10 text-slate-500 hover:text-blue-400",children:e.jsx(U,{className:"w-3.5 h-3.5"})}),o&&e.jsx("button",{onClick:()=>t("rotate",c),title:"Rodízio",className:"p-1.5 rounded-lg hover:bg-cyan-500/10 text-slate-500 hover:text-cyan-400",children:e.jsx(q,{className:"w-3.5 h-3.5"})})]})]},c.id)}),((d==null?void 0:d.tires)||[]).filter(c=>c.status==="em_uso").length===0&&e.jsx("p",{className:"text-sm text-slate-500 text-center py-4",children:"Nenhum pneu instalado"})]})]})]})]}):null,g&&e.jsx(Ge,{tire:g,onClose:()=>E(null)})]})}function We({analysis:s}){const r=(s==null?void 0:s.summary)||{},o=(s==null?void 0:s.tcoByBrand)||[];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"card flex flex-col",children:[e.jsx("span",{className:"text-xs text-slate-500 mb-2",children:"Investimento Total"}),e.jsx("span",{className:"text-xl font-bold",style:{color:"var(--page-text)"},children:V(r.totalInvestment)})]}),e.jsxs("div",{className:"card flex flex-col",children:[e.jsx("span",{className:"text-xs text-slate-500 mb-2",children:"Custo Reformas"}),e.jsx("span",{className:"text-xl font-bold text-amber-400",children:V(r.totalReformCost)})]}),e.jsxs("div",{className:"card flex flex-col",children:[e.jsx("span",{className:"text-xs text-slate-500 mb-2",children:"Km Total Rodados"}),e.jsx("span",{className:"text-xl font-bold",style:{color:"var(--page-text)"}
4,children:(r.totalKm||0).toLocaleString("pt-BR")})]}),e.jsxs("div",{className:"card flex flex-col",children:[e.jsx("span",{className:"text-xs text-slate-500 mb-2",children:"Custo por 1000km"}),e.jsxs("span",{className:"text-xl font-bold text-emerald-400",children:["R$ ",((r.costPerKm||0)*1e3).toFixed(2)]})]})]}),o.length>0&&e.jsxs("div",{className:"card",children:[e.jsxs("h3",{className:"text-sm font-semibold text-white mb-4 flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4 text-purple-400"})," TCO Comparativo por Marca"]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-800",children:[e.jsx("th",{className:"text-left text-xs font-medium uppercase  tracking-wider px-4 py-2",children:"Marca"}),e.jsx("th",{className:"text-center text-xs font-medium uppercase  tracking-wider px-4 py-2",children:"Qtd"}),e.jsx("th",{className:"text-right text-xs font-medium uppercase  tracking-wider px-4 py-2",children:"Custo Médio"}),e.jsx("th",{className:"text-right text-xs font-medium uppercase  tracking-wider px-4 py-2",children:"Vida Média (km)"}),e.jsx("th",{className:"text-right text-xs font-medium uppercase  tracking-wider px-4 py-2",children:"R$/km"}),e.jsx("th",{className:"text-left text-xs font-medium uppercase  tracking-wider px-4 py-2",children:"Eficiência"})]})}),e.jsx("tbody",{children:o.map((t,l)=>{var n;const h=Math.max(...o.map(b=>b.costPerKm)),u=h>0?100-Math.round(t.costPerKm/h*100):50;return e.jsxs("tr",{className:"border-b border-slate-800/50 hover:bg-slate-800/30",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[l===0&&e.jsx(Pe,{className:"w-3.5 h-3.5 text-emerald-400"}),e.jsx("span",{className:"text-sm font-medium",style:{color:"var(--page-text)"},children:t.brand})]})}),e.jsx("td",{className:"px-4 py-3 text-center text-sm text-slate-300 tabular-nums",children:t.count}),e.jsx("td",{className:"px-4 py-3 text-right text-sm text-slate-300 tabular-nums",children:V(t.avgCost)}),e.jsx("td",{className:"px-4 py-3 text-right text-sm text-slate-300 tabular-nums",children:(n=t.avgLifeKm)==null?void 0:n.toLocaleString("pt-BR")}),e.jsxs("td",{className:"px-4 py-3 text-right text-sm text-emerald-400 tabular-nums font-bold",children:["R$ ",(t.costPerKm*1e3).toFixed(2),"/1000km"]}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("div",{className:"w-20 h-2 bg-slate-800 rounded-full overflow-hidden",children:e.jsx("div",{className:v("h-full rounded-full",l===0?"bg-emerald-500":"bg-slate-600"),style:{width:`${Math.max(u,10)}%`}})})})})]},t.brand)})})]})})]}),o.length===0&&e.jsxs("div",{className:"card text-center py-16",children:[e.jsx(te,{className:"w-12 h-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{className:"text-slate-400",children:"Sem dados suficientes para análise"}),e.jsx("p",{className:"text-slate-500 text-sm mt-2",children:"Cadastre pneus e registre inspeções para gerar análises de TCO."})]})]})}function ls(){const s=je("pneus"),{data:r,loading:o,error:t,refetch:l}=ne(()=>w.tires(),[]),{data:h}=ne(()=>w.vehicles(),[]),[u,n]=x.useState(null),[b,d]=x.useState(null),{role:a,orgName:m}=fe(),i=a==="fleet_admin"||a==="super_admin",[p,j]=x.useState("panel"),[g,E]=x.useState(!1),[F,L]=x.useState(null),[K,D]=x.useState(null),[M,S]=x.useState(null),[Q,A]=x.useState(null),[W,c]=x.useState(null),[N,R]=x.useState(""),C=x.useCallback(()=>{w.tireAlerts().then(n).catch(()=>{}),w.tireAnalysis().then(d).catch(()=>{})},[]);x.useEffect(()=>{C()},[C]);function _(){l(),C()}function re(f,y){switch(f){case"install":D(y);break;case"inspect":S(y);break;case"discard":A(y);break;case"rotate":c(y);break;case"edit":L(y);break;case"uninstall":confirm(`Devolver "${y.brand} ${y.model}" ao estoque?`)&&w.uninstallTire(y.id,{reason:"Remoção manual"}).then(_).catch(be=>alert(be.message||"Erro"));break;case"delete":confirm(`Excluir pneu ${y.brand} ${y.model} (${y.size})?`)&&(R(y.id),w.deleteTire(y.id).then(_).catch(()=>{}).finally(()=>R("")));break}}function B(){E(!1),L(null),D(null),S(null),A(null),c(null),_()}const pe=[{id:"panel",label:"Painel",icon:Ee},{id:"inventory",label:"Inventário",icon:H},{id:"vehicle",label:"Veículo",icon:Y},{id:"analysis",label:"Análise",icon:te}],ue=x.useCallback(()=>{r&&Ne({filename:`pneus-${new Date().toISOString().slice(0,10)}`,sheetName:"Pneus",headers:["Marca","Modelo","Medida","Status","Sulco (mm)","Veículo","Posição","Km Rodados","Custo","Condição","DOT"],rows:r.map(f=>{var y;return[f.brand,f.model,f.size,((y=J[f.status])==null?void 0:y.label)||f.status,f.treadDepth,f.vehiclePlate||"—",I[f.position]||f.position||"—",f.currentKm||0,f.purchaseCost||0,ee[f.condition]||f.condition,f.dotCode||"—"]})})},[r]),he=x.useCallback(()=>{r&&ge({filename:`pneus-${new Date().toISOString().slice(0,10)}`,title:"Relatório de Pneus",subtitle:`${r.length} pneus cadastrados`,orgName:m||void 0,headers:["Marca","Modelo","Medida","Status","Sulco","Veículo","Posição","Km"],rows:r.map(f=>{var y;return[f.brand,f.model,f.size,((y=J[f.status])==null?void 0:y.label)||f.status,`${f.treadDepth}mm`,f.vehiclePlate||"—",I[f.position]||f.position||"—",(f.currentKm||0).toLocaleStr
4ing("pt-BR")]}),kpis:b!=null&&b.summary?[{label:"Total",value:b.summary.total},{label:"Em Uso",value:b.summary.inUse},{label:"Estoque",value:b.summary.inStock},{label:"Alertas",value:b.summary.criticalAlerts}]:void 0})},[r,b,m]);return o?e.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:e.jsx(k,{className:"w-8 h-8 text-brand-500 animate-spin"})}):t?e.jsxs("div",{className:"text-center py-20",children:[e.jsx(ie,{className:"w-12 h-12 text-amber-400 mx-auto mb-4"}),e.jsx("p",{className:"text-slate-300 mb-4",children:t}),e.jsx("button",{onClick:_,className:"btn-primary",children:"Tentar novamente"})]}):e.jsxs("div",{className:"space-y-6 max-w-7xl",children:[e.jsx(ye,{tips:["Gerencie o ciclo completo dos pneus: compra, estoque, instalação, inspeção, rodízio, reforma e descarte.","O sistema calcula previsão de desgaste e recomenda rodízios automaticamente.","Use a aba Análise para comparar TCO entre marcas e fornecedores."],storageKey:"tires"}),s.modo==="conectado"&&e.jsx(Re,{origem:s.origem,mesmoConectado:s.mesmoConectado}),e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-orange-500/15 flex items-center justify-center",children:e.jsx(P,{className:"w-5 h-5 text-orange-400"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold",style:{color:"var(--page-text)"},children:["Pneus ",e.jsx(we,{content:"Gestão completa do ciclo de vida dos pneus: estoque, instalação, inspeção, rodízio, reforma e descarte com análise preditiva.",position:"bottom"})]}),e.jsxs("p",{className:"text-slate-400 text-sm",children:[(r==null?void 0:r.length)||0," pneu",((r==null?void 0:r.length)||0)!==1?"s":""," cadastrado",((r==null?void 0:r.length)||0)!==1?"s":""]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ve,{onExportExcel:ue,onExportPdf:he,disabled:!(r!=null&&r.length)}),e.jsxs("button",{onClick:_,className:"btn-secondary flex items-center gap-2 text-sm",children:[e.jsx(De,{className:"w-4 h-4"})," Atualizar"]}),i&&s.podeCriar&&e.jsxs("button",{onClick:()=>E(!0),className:"btn-primary flex items-center gap-2 text-sm",children:[e.jsx(Z,{className:"w-4 h-4"})," Novo Pneu"]})]})]}),e.jsx("div",{className:"flex gap-1 p-1 bg-slate-800/40 border border-slate-700/50 rounded-xl w-fit",children:pe.map(f=>e.jsxs("button",{onClick:()=>j(f.id),className:v("flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all",p===f.id?"bg-slate-700 text-white shadow-sm":"text-slate-400 hover:text-slate-200"),children:[e.jsx(f.icon,{className:"w-4 h-4"})," ",f.label]},f.id))}),p==="panel"&&e.jsx(Ve,{tires:r||[],alerts:u,analysis:b,onRefresh:_}),p==="inventory"&&e.jsx(He,{tires:r||[],isAdmin:i,onAction:re}),p==="vehicle"&&e.jsx(Qe,{tires:r||[],allTires:r||[],isAdmin:i,onAction:re,onRefresh:_}),p==="analysis"&&e.jsx(We,{analysis:b}),(g||F)&&e.jsx(Me,{tire:F,onClose:()=>{E(!1),L(null)},onSaved:B}),K&&e.jsx(Oe,{tire:K,vehicles:h||void 0,onClose:()=>D(null),onDone:B}),M&&e.jsx(ze,{tire:M,onClose:()=>S(null),onDone:B}),Q&&e.jsx($e,{tire:Q,onClose:()=>A(null),onDone:B}),W&&e.jsx(Ke,{tire:W,vehicles:h||void 0,onClose:()=>c(null),onDone:B})]})}export{ls as TiresPage};

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.