{"version":3,"file":"index.mjs","names":[],"sources":["../src/utils/volumetric.ts","../src/index.ts"],"sourcesContent":["export interface VolumetricItem {\n    qty: number;\n    length: number;\n    width: number;\n    height: number;\n}\n\nexport interface Dimensions {\n    length: number;\n    width: number;\n    height: number;\n}\n\nexport const calculate = (items: VolumetricItem[]): Dimensions => {\n    if (!items || items.length === 0) {\n        return { length: 0, width: 0, height: 0 };\n    }\n\n    let lVert = 0, wVert = 0, hVert = 0;\n    let lHor = 0, wHor = 0, hHor = 0;\n    let lSide = 0, wSide = 0, hSide = 0;\n\n    for (const it of items) {\n        const qty = it.qty < 1 ? 1 : it.qty;\n        const l = it.length;\n        const w = it.width;\n        const h = it.height;\n\n        // Vertical stacking: heights add up\n        hVert += h * qty;\n        if (l > lVert) lVert = l;\n        if (w > wVert) wVert = w;\n\n        // Horizontal stacking: lengths add up\n        lHor += l * qty;\n        if (h > hHor) hHor = h;\n        if (w > wHor) wHor = w;\n\n        // Side-by-side stacking: widths add up\n        wSide += w * qty;\n        if (h > hSide) hSide = h;\n        if (l > lSide) lSide = l;\n    }\n\n    const volVert = lVert * wVert * hVert;\n    const volHor = lHor * wHor * hHor;\n    const volSide = lSide * wSide * hSide;\n\n    if (volVert <= volHor && volVert <= volSide) {\n        return { length: lVert, width: wVert, height: hVert };\n    }\n    if (volHor <= volSide) {\n        return { length: lHor, width: wHor, height: hHor };\n    }\n    return { length: lSide, width: wSide, height: hSide };\n};\n\nexport const Volumetric = { calculate };\n","import { KAEnv } from \"./config/api\";\nimport { init } from \"./config/client\";\nimport { services } from \"./services/index\";\nimport { Volumetric } from \"./utils/volumetric\";\n\nexport { KAEnv, Volumetric };\nexport * from \"./utils/volumetric\";\n\nconst KiriminAja = {\n    init,\n    Init: init,\n    ...services,\n    Volumetric,\n};\n\nexport default KiriminAja;\n"],"mappings":";;AAaA,IAAa,KAAa,MAAwC;AAC9D,KAAI,CAAC,KAAS,EAAM,WAAW,EAC3B,QAAO;EAAE,QAAQ;EAAG,OAAO;EAAG,QAAQ;EAAG;CAG7C,IAAI,IAAQ,GAAG,IAAQ,GAAG,IAAQ,GAC9B,IAAO,GAAG,IAAO,GAAG,IAAO,GAC3B,IAAQ,GAAG,IAAQ,GAAG,IAAQ;AAElC,MAAK,IAAM,KAAM,GAAO;EACpB,IAAM,IAAM,EAAG,MAAM,IAAI,IAAI,EAAG,KAC1B,IAAI,EAAG,QACP,IAAI,EAAG,OACP,IAAI,EAAG;AAeb,EAZA,KAAS,IAAI,GACT,IAAI,MAAO,IAAQ,IACnB,IAAI,MAAO,IAAQ,IAGvB,KAAQ,IAAI,GACR,IAAI,MAAM,IAAO,IACjB,IAAI,MAAM,IAAO,IAGrB,KAAS,IAAI,GACT,IAAI,MAAO,IAAQ,IACnB,IAAI,MAAO,IAAQ;;CAG3B,IAAM,IAAU,IAAQ,IAAQ,GAC1B,IAAS,IAAO,IAAO,GACvB,IAAU,IAAQ,IAAQ;AAQhC,QANI,KAAW,KAAU,KAAW,IACzB;EAAE,QAAQ;EAAO,OAAO;EAAO,QAAQ;EAAO,GAErD,KAAU,IACH;EAAE,QAAQ;EAAM,OAAO;EAAM,QAAQ;EAAM,GAE/C;EAAE,QAAQ;EAAO,OAAO;EAAO,QAAQ;EAAO;GAG5C,IAAa,EAAE,cAAW,ECjDjC,IAAa;CACf;CACA,MAAM;CACN,GAAG;CACH;CACH"}