import{q as k,n as e,L as F}from"./vendor-react-Br0ZiotI.js";import{b5 as g,a2 as N,br as r,aa as U,B as H,by as t,aA as T,D as O,G as d,K as f,L as v,I as R,H as m,aC as h,aB as j,be as o,ay as W}from"./index-DHmWpjgK.js";import"./vendor-dayjs-CbzZgysf.js";import{d as G,C as q,c as _}from"./MarketingShell-B9Sa-0Uh.js";import{T as K}from"./ToolPageSEO-B2OTMwdS.js";import{T as J}from"./toolsMeta-CeuNOhcH.js";import{A as Q}from"./arrow-left-26ItqGyo.js";import{P as p}from"./users-CcdVsMxi.js";import{P as z}from"./plus-d-A6sPRo.js";import{S as A}from"./scale-C_Ey0wbM.js";import{T as X}from"./trash-2-LVg9XXy5.js";import"./vendor-query-9i1Av1pr.js";import"./vendor-i18n-C54Hc0CQ.js";import"./vendor-antd-core-CbYNMZQB.js";import"./vendor-sentry-Cx26FE6p.js";import"./zap-hgyIfjkp.js";import"./globe-CjEndryE.js";import"./shield-check-B-6jEzxu.js";import"./file-text-E6Bk5t1Q.js";import"./SiteFooter-6EXToXJZ.js";import"./send-BBOKHuXM.js";import"./building-2-N2Q_sRKX.js";function S(){return Math.random().toString(36).slice(2,10)}function y(s){const i=parseFloat(s);return isNaN(i)||i<0?0:i}function Y(s){const i=parseInt(s,10);return isNaN(i)||i<1?0:i}function I(s){return y(s.l)*y(s.w)*y(s.h)*Y(s.qty)/1e6}const Z=new Intl.NumberFormat("ru-RU",{maximumFractionDigits:2}),ee=new Intl.NumberFormat("ru-RU",{maximumFractionDigits:3}),se=new Intl.NumberFormat("ru-RU",{maximumFractionDigits:0});function w(s){return ee.format(s)}function te(s){return Z.format(s)}function B(s){return se.format(s)}function ae({row:s,onChange:i,onRemove:u,disableRemove:C,index:b}){const $=I(s);function x(l){return L=>{i({...s,[l]:L.target.value})}}return e.jsxs("div",{className:"rounded-lg border border-border bg-white p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3",children:[e.jsxs(t,{variant:"muted",className:"text-xs font-semibold uppercase tracking-wide",children:["Позиция ",b+1]}),e.jsx("button",{type:"button",onClick:u,disabled:C,"aria-label":`Удалить позицию ${b+1}`,className:"inline-flex items-center justify-center h-7 w-7 rounded-md text-text-muted hover:text-red-500 hover:bg-red-50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:e.jsx(X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mb-3",children:[e.jsx(h,{htmlFor:`desc-${s.id}`,className:"text-xs mb-1 block",children:"Наименование"}),e.jsx(j,{id:`desc-${s.id}`,type:"text",placeholder:"Товар",value:s.desc,onChange:x("desc")})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 mb-3",children:[e.jsxs("div",{children:[e.jsx(h,{htmlFor:`l-${s.id}`,className:"text-xs mb-1 block",children:"Длина (см)"}),e.jsx(j,{id:`l-${s.id}`,type:"number",min:"0",step:"0.1",placeholder:"100",value:s.l,onChange:x("l")})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:`w-${s.id}`,className:"text-xs mb-1 block",children:"Ширина (см)"}),e.jsx(j,{id:`w-${s.id}`,type:"number",min:"0",step:"0.1",placeholder:"80",value:s.w,onChange:x("w")})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:`h-${s.id}`,className:"text-xs mb-1 block",children:"Высота (см)"}),e.jsx(j,{id:`h-${s.id}`,type:"number",min:"0",step:"0.1",placeholder:"120",value:s.h,onChange:x("h")})]}),e.jsxs("div",{children:[e.jsx(h,{htmlFor:`qty-${s.id}`,className:"text-xs mb-1 block",children:"Кол-во (шт)"}),e.jsx(j,{id:`qty-${s.id}`,type:"number",min:"1",step:"1",placeholder:"1",value:s.qty,onChange:x("qty")})]})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-md bg-surface px-3 py-1.5",children:[e.jsx(t,{variant:"muted",className:"text-xs",children:"CBM этой позиции:"}),e.jsxs(t,{className:"text-sm font-semibold tabular-nums",children:[w($)," м³"]})]})]})}function Le(){const[s,i]=k.useState([{id:S(),desc:"",l:"",w:"",h:"",qty:"1"}]),[u,C]=k.useState("");function b(){i(a=>[...a,{id:S(),desc:"",l:"",w:"",h:"",qty:"1"}])}function $(a){i(n=>n.filter(c=>c.id!==a))}function x(a){i(n=>n.map(c=>c.id===a.id?a:c))}const l=k.useMemo(()=>{const a=s.reduce((P,E)=>P+I(E),0),n=y(u),c=a*167,M=Math.max(n,c),D=Math.max(a,n/1e3),V=c>n;return{totalCbm:a,gross:n,volWeightAir:c,chargeableAir:M,freightTonSea:D,isVolumetric:V}},[s,u]),L=l.totalCbm>0;return e.jsxs(G,{active:"tools",children:[e.jsx(K,{...J.cbm}),e.jsx(g,{py:"md",bg:"surface",children:e.jsx(N,{size:"base",children:e.jsxs(r,{gap:4,children:[e.jsxs(F,{to:"/tools",className:"inline-flex items-center gap-1.5 text-sm text-text-muted hover:text-text transition-colors w-fit",children:[e.jsx(Q,{className:"h-4 w-4"}),"Все инструменты"]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-12 w-12 rounded-xl bg-primary-light flex items-center justify-center flex-shrink-0",children:e.jsx(p,{className:"h-6 w-6 text-primary"})}),e.jsxs(r,{gap:1,children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(U,{size:"sm",children:"CBM-калькулятор"}),e.jsx(H,{variant:"default",children:"Логистика"})]}),e.jsx(t,{variant:"lead",className:"text-text-muted max-w-2xl",children:"Рассчитайте объём груза, объёмный вес для авиа и фрахтовую тонну для морского LCL — в режиме реального времени"})]})]})]})})}),e.jsx(g,{py:"lg",children:e.jsx(N,{size:"base",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_380px] gap-8 items-start",children:[e.jsxs(r,{gap:6,children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>i(a=>[...a,{id:S(),desc:"Европаллет",l:"120",w:"80",h:"100",qty:"1"}]),className:"inline-flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-full border border-border bg-white text-text-muted hover:border-primary/40 hover:text-primary transition-colors",children:[e.jsx(z,{className:"h-3.5 w-3.5"}),"1 палет 120×80×100 (евро)"]}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-full border border-border bg-surface text-text-muted cursor-default select-none",children:[e.jsx(T,{className:"h-3.5 w-3.5"}),"1 TEU ≈ 33 КВМ / 22 т максимум"]})]}),e.jsx(r,{gap:3,children:s.map((a,n)=>e.jsx(ae,{row:a,index:n,onChange:x,onRemove:()=>$(a.id),disableRemove:s.length===1},a.id))}),e.jsxs(O,{variant:"outline",size:"sm",onClick:b,className:"w-full",children:[e.jsx(z,{className:"h-4 w-4"}),"Добавить позицию"]}),e.jsxs(d,{children:[e.jsxs(f,{className:"pb-3",children:[e.jsxs(v,{className:"flex items-center gap-2 text-base",children:[e.jsx(A,{className:"h-4 w-4 text-text-muted"}),"Брутто-вес"]}),e.jsx(R,{children:"Общий вес груза по документам (кг)"})]}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"gross-weight",children:"Брутто-вес (кг)"}),e.jsxs("div",{className:"relative",children:[e.jsx(j,{id:"gross-weight",type:"number",min:"0",step:"0.1",placeholder:"например, 500",value:u,onChange:a=>C(a.target.value),className:"pr-10"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-text-muted pointer-events-none",children:"кг"})]}),e.jsx(t,{variant:"muted",className:"text-xs",children:"Используется для расчёта оплачиваемого веса авиа и фрахтовой тонны"})]})})]}),e.jsxs(d,{children:[e.jsx(f,{className:"pb-3",children:e.jsxs(v,{className:"flex items-center gap-2 text-base",children:[e.jsx(T,{className:"h-4 w-4 text-text-muted"}),"Формулы расчёта"]})}),e.jsx(m,{children:e.jsxs(r,{gap:4,children:[e.jsxs(r,{gap:1,children:[e.jsx(t,{className:"text-sm font-semibold",children:"CBM (кубический метр)"}),e.jsx(t,{variant:"muted",className:"text-xs",children:"CBM = (Д × Ш × В, см) × Кол-во ÷ 1 000 000"}),e.jsx(t,{variant:"muted",className:"text-xs",children:"Суммируется по всем позициям."})]}),e.jsx(o,{}),e.jsxs(r,{gap:1,children:[e.jsx(t,{className:"text-sm font-semibold",children:"Объёмный вес для авиа"}),e.jsx(t,{variant:"muted",className:"text-xs",children:"Вол.вес (кг) = CBM × 167 — отраслевой стандарт IATA"}),e.jsx(t,{variant:"muted",className:"text-xs",children:"Эквивалент: Д × Ш × В (см) ÷ 6 000 для одного места."})]}),e.jsx(o,{}),e.jsxs(r,{gap:1,children:[e.jsx(t,{className:"text-sm font-semibold",children:"Оплачиваемый вес авиа"}),e.jsx(t,{variant:"muted",className:"text-xs",children:"max(брутто-вес кг, объёмный вес кг) — тарифицируется большее."})]}),e.jsx(o,{}),e.jsxs(r,{gap:1,children:[e.jsx(t,{className:"text-sm font-semibold",children:"Фрахтовая тонна (море, LCL)"}),e.jsx(t,{variant:"muted",className:"text-xs",children:"max(CBM, брутто-вес кг ÷ 1 000) — W/M (weight or measurement)."}),e.jsx(t,{variant:"muted",className:"text-xs",children:"Линии выставляют счёт по тому показателю, что больше."})]})]})})]})]}),e.jsx("div",{className:"lg:sticky lg:top-6",children:L?e.jsxs(r,{gap:4,children:[e.jsxs(d,{className:"border-primary/20 bg-primary-light/30",children:[e.jsxs(f,{className:"pb-2",children:[e.jsxs(v,{className:"text-base flex items-center gap-2",children:[e.jsx(p,{className:"h-4 w-4 text-primary"}),"Итого объём"]}),e.jsxs(R,{children:[s.length," ",s.length===1?"позиция":s.length<5?"позиции":"позиций"]})]}),e.jsxs(m,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("span",{className:"text-5xl font-bold text-primary tabular-nums leading-none",children:w(l.totalCbm)}),e.jsx("span",{className:"ml-2 text-xl font-semibold text-primary/70",children:"м³"})]}),e.jsx(o,{}),e.jsxs(r,{gap:2,className:"mt-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(t,{variant:"muted",className:"text-sm",children:"Брутто-вес"}),e.jsx(t,{className:"text-sm font-semibold tabular-nums",children:l.gross>0?`${te(l.gross)} кг`:"—"})]}),e.jsx(o,{}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(t,{variant:"muted",className:"text-sm",children:"Объёмный вес (авиа)"}),e.jsxs(t,{className:"text-sm font-semibold tabular-nums",children:[B(l.volWeightAir)," кг"]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(t,{variant:"muted",className:"text-sm",children:"Оплач. вес авиа"}),e.jsx(t,{className:"text-sm font-bold tabular-nums text-text",children:l.gross>0?`${B(l.chargeableAir)} кг`:`${B(l.volWeightAir)} кг`})]}),e.jsx(o,{}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(t,{variant:"muted",className:"text-sm",children:"Фрахтовая тонна (море LCL)"}),e.jsxs(t,{className:"text-sm font-bold tabular-nums text-text",children:[w(l.freightTonSea)," W/M"]})]})]})]})]}),l.gross>0&&e.jsxs("div",{className:`flex items-start gap-3 rounded-lg border px-4 py-3 ${l.isVolumetric?"bg-amber-50 border-amber-200":"bg-green-50 border-green-200"}`,children:[e.jsx(A,{className:`h-5 w-5 mt-0.5 shrink-0 ${l.isVolumetric?"text-amber-500":"text-green-600"}`}),e.jsxs(r,{gap:0,children:[e.jsx(t,{className:`text-sm font-semibold ${l.isVolumetric?"text-amber-800":"text-green-800"}`,children:l.isVolumetric?"Объёмный груз (вол.вес > факт.вес)":"Тяжёлый груз (факт.вес > вол.вес)"}),e.jsx(t,{variant:"muted",className:`text-xs ${l.isVolumetric?"text-amber-700":"text-green-700"}`,children:l.isVolumetric?"Авиаперевозчик тарифицирует по объёмному весу":"Авиаперевозчик тарифицирует по фактическому весу"})]})]}),s.length>1&&e.jsxs(d,{children:[e.jsx(f,{className:"pb-2",children:e.jsx(v,{className:"text-sm font-medium text-text-muted",children:"Разбивка по позициям"})}),e.jsx(m,{children:e.jsx(r,{gap:2,children:s.map((a,n)=>{const c=I(a),M=l.totalCbm>0?c/l.totalCbm*100:0;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(t,{variant:"muted",className:"text-xs truncate max-w-[60%]",children:a.desc?a.desc:`Позиция ${n+1}`}),e.jsxs(t,{className:"text-xs font-semibold tabular-nums",children:[w(c)," м³"]})]}),e.jsx("div",{className:"relative h-1.5 w-full rounded-full bg-border overflow-hidden",children:e.jsx("div",{className:"absolute left-0 top-0 h-full rounded-full bg-primary/60 transition-all duration-300",style:{width:`${M}%`}})})]},a.id)})})})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-surface px-3 py-2.5 flex items-start gap-2",children:[e.jsx(T,{className:"h-4 w-4 text-text-muted flex-shrink-0 mt-0.5"}),e.jsx(t,{variant:"muted",className:"text-xs",children:"Авиа: 1 КВМ = 167 кг (IATA). Море LCL: W/M — тарифицируется большее из объёма (КВМ) и веса (т)."})]})]}):e.jsx(d,{className:"border-dashed",children:e.jsx(m,{className:"py-12",children:e.jsxs(r,{gap:4,align:"center",className:"text-center",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-primary-light flex items-center justify-center",children:e.jsx(q,{className:"h-7 w-7 text-primary/40"})}),e.jsxs(r,{gap:1,children:[e.jsx(t,{weight:"semibold",className:"text-text-muted",children:"Результат появится здесь"}),e.jsx(t,{variant:"muted",className:"text-sm",children:"Заполните габариты хотя бы одной позиции"})]})]})})})})]})})}),e.jsx(g,{py:"lg",bg:"surface",children:e.jsx(N,{size:"base",children:e.jsxs(r,{gap:8,children:[e.jsxs(r,{gap:2,className:"text-center max-w-2xl mx-auto",children:[e.jsx(W,{size:"h2",children:"Зачем считать CBM"}),e.jsx(t,{variant:"lead",className:"text-text-muted",children:"Объём груза напрямую влияет на тариф при авиа и морском LCL. Правильный расчёт избавляет от сюрпризов при выставлении счёта."})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs(r,{gap:2,children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-blue-100 flex items-center justify-center",children:e.jsx(p,{className:"h-4 w-4 text-blue-600"})}),e.jsx(t,{weight:"semibold",children:"Авиакарго"}),e.jsx(t,{variant:"muted",className:"text-sm",children:"Авиалинии берут max(вес, объёмный вес). Коэффициент 167 кг/м³ означает: лёгкий объёмный товар (пенопласт, мебель) платит по объёму."})]})})}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs(r,{gap:2,children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-primary-light flex items-center justify-center",children:e.jsx(A,{className:"h-4 w-4 text-primary"})}),e.jsx(t,{weight:"semibold",children:"Морской LCL"}),e.jsx(t,{variant:"muted",className:"text-sm",children:"Линии выставляют счёт по W/M — weight or measurement. Одна «фрахтовая тонна» = 1 КВМ = 1 тонна. Тарифицируется больший показатель."})]})})}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs(r,{gap:2,children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-amber-100 flex items-center justify-center",children:e.jsx(q,{className:"h-4 w-4 text-amber-600"})}),e.jsx(t,{weight:"semibold",children:"Оптимизация упаковки"}),e.jsx(t,{variant:"muted",className:"text-sm",children:"Уменьшение высоты на 10 см у паллета 120×80×130 экономит ≈ 0,1 КВМ. При ставке $100/КВМ это $10 с паллета."})]})})})]}),e.jsx(d,{className:"bg-blue-50 border-blue-200",children:e.jsx(m,{className:"pt-6 pb-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{gap:2,children:[e.jsx(t,{weight:"semibold",className:"text-blue-800",children:"Пример: еврапаллет"}),e.jsxs(t,{className:"text-sm text-blue-700",children:["120 × 80 × 100 см = 0,96 КВМ. Объёмный вес для авиа = 0,96 × 167 ≈"," ",e.jsx("strong",{children:"160 кг"}),". Если реальный вес паллета 80 кг — вы платите за 160 кг."]})]}),e.jsxs(r,{gap:2,children:[e.jsx(t,{weight:"semibold",className:"text-blue-800",children:"Пример: морской LCL"}),e.jsxs(t,{className:"text-sm text-blue-700",children:["5 КВМ / 800 кг. W/M = max(5 КВМ, 0,8 т) = ",e.jsx("strong",{children:"5 фрахтовых тонн"}),". Объём побеждает — тарифицируется по КВМ."]})]})]})})})]})})}),e.jsx(g,{py:"md",children:e.jsx(N,{size:"base",children:e.jsxs(r,{gap:3,children:[e.jsx(W,{size:"h3",children:"Похожие инструменты"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(F,{to:"/tools/container-fill-calculator",className:"inline-flex items-center gap-2 rounded-lg border border-border bg-white px-4 py-2.5 text-sm font-medium text-text hover:border-primary/40 hover:text-primary transition-colors",children:[e.jsx(p,{className:"h-4 w-4"}),"Заполняемость контейнера 20/40"]}),e.jsxs(F,{to:"/tools/load-plan",className:"inline-flex items-center gap-2 rounded-lg border border-border bg-white px-4 py-2.5 text-sm font-medium text-text hover:border-primary/40 hover:text-primary transition-colors",children:[e.jsx(p,{className:"h-4 w-4"}),"Планирование загрузки"]})]})]})})}),e.jsx(_,{title:"Нужен расчёт стоимости перевозки?",ctaLabel:"Рассчитать",ctaTo:"/calculator"})]})}export{Le as default};