{"version":3,"file":"index.mjs","names":[],"sources":["../src/utils.ts","../src/index.ts"],"sourcesContent":["/**\n * BD Logistics Area Utilities\n *\n * Cross-tier helpers that legitimately need division + district + area\n * data. Single-tier helpers (`searchAreas`, `convertProviderId`) live in\n * `./areas.js` so the `/areas` subpath doesn't drag in divisions /\n * districts data.\n */\n\nimport type { AreaResolved } from './types.js';\nimport { DIVISIONS, getDivisionById } from './divisions.js';\nimport { DISTRICTS, getDistrictById } from './districts.js';\nimport { getArea, getAllAreas } from './areas.js';\n\n/**\n * Resolve area with full division/district objects\n */\nexport function resolveArea(internalId: number): AreaResolved | undefined {\n  const area = getArea(internalId);\n  if (!area) return undefined;\n\n  const division = getDivisionById(area.divisionId);\n  const district = getDistrictById(area.districtId);\n  if (!division || !district) return undefined;\n\n  return { ...area, division, district };\n}\n\nexport function getStats() {\n  const allAreas = getAllAreas();\n  return {\n    divisions: DIVISIONS.length,\n    districts: Object.keys(DISTRICTS).reduce((sum, k) => sum + DISTRICTS[k].length, 0),\n    areas: allAreas.length,\n    providerCoverage: {\n      redx: allAreas.filter(a => a.providers.redx).length,\n      pathao: allAreas.filter(a => a.providers.pathao).length,\n      steadfast: allAreas.filter(a => a.providers.steadfast).length,\n    },\n    byDivision: DIVISIONS.map(d => ({\n      division: d.name,\n      districts: DISTRICTS[d.id]?.length || 0,\n      areas: allAreas.filter(a => a.divisionId === d.id).length\n    }))\n  };\n}\n","/**\n * BD Areas - Bangladesh Delivery Areas\n *\n * Unified area data with multi-provider support (RedX, Pathao, Steadfast)\n * 8 divisions, 64 districts, 2836 areas\n *\n * @example FE - Cascading Dropdowns:\n * import { getDivisions, getDistrictsByDivision, getAreasByDistrict } from '@classytic/bd-areas';\n *\n * @example BE - Area Resolution:\n * import { getArea, resolveArea, searchAreas } from '@classytic/bd-areas';\n *\n * @example Multi-provider:\n * const area = getAreaByProvider('redx', 1);\n * const pathaoId = area.providers.pathao;\n *\n * @module @classytic/bd-areas\n */\n\nexport type {\n  Division,\n  District,\n  Area,\n  AreaResolved,\n  ProviderName,\n  ProviderAreaIds,\n} from './types.js';\n\nexport { DIVISIONS, getDivisions, getDivisionById, getDivisionByName } from './divisions.js';\nexport { DISTRICTS, getDistrictsByDivision, getDistrictById, getAllDistricts } from './districts.js';\nexport { AREAS, getAreasByDistrict, getArea, getAreaByProvider, getAllAreas, getAreasByDivision, getAreasByPostCode, searchAreas, convertProviderId } from './areas.js';\nexport { resolveArea, getStats } from './utils.js';\n\nimport { DIVISIONS, getDivisions, getDivisionById } from './divisions.js';\nimport { DISTRICTS, getDistrictsByDivision, getDistrictById, getAllDistricts } from './districts.js';\nimport { AREAS, getAreasByDistrict, getArea, getAreaByProvider, getAllAreas, searchAreas, convertProviderId } from './areas.js';\nimport { resolveArea, getStats } from './utils.js';\n\nexport default {\n  DIVISIONS, DISTRICTS, AREAS,\n  getDivisions, getDivisionById,\n  getDistrictsByDivision, getDistrictById, getAllDistricts,\n  getAreasByDistrict, getArea, getAreaByProvider, getAllAreas,\n  resolveArea, convertProviderId, searchAreas, getStats,\n};\n"],"mappings":";;;;;;;;AAiBA,SAAgB,YAAY,YAA8C;CACxE,MAAM,OAAO,QAAQ,WAAW;AAChC,KAAI,CAAC,KAAM,QAAO;CAElB,MAAM,WAAW,gBAAgB,KAAK,WAAW;CACjD,MAAM,WAAW,gBAAgB,KAAK,WAAW;AACjD,KAAI,CAAC,YAAY,CAAC,SAAU,QAAO;AAEnC,QAAO;EAAE,GAAG;EAAM;EAAU;EAAU;;AAGxC,SAAgB,WAAW;CACzB,MAAM,WAAW,aAAa;AAC9B,QAAO;EACL,WAAW,UAAU;EACrB,WAAW,OAAO,KAAK,UAAU,CAAC,QAAQ,KAAK,MAAM,MAAM,UAAU,GAAG,QAAQ,EAAE;EAClF,OAAO,SAAS;EAChB,kBAAkB;GAChB,MAAM,SAAS,QAAO,MAAK,EAAE,UAAU,KAAK,CAAC;GAC7C,QAAQ,SAAS,QAAO,MAAK,EAAE,UAAU,OAAO,CAAC;GACjD,WAAW,SAAS,QAAO,MAAK,EAAE,UAAU,UAAU,CAAC;GACxD;EACD,YAAY,UAAU,KAAI,OAAM;GAC9B,UAAU,EAAE;GACZ,WAAW,UAAU,EAAE,KAAK,UAAU;GACtC,OAAO,SAAS,QAAO,MAAK,EAAE,eAAe,EAAE,GAAG,CAAC;GACpD,EAAE;EACJ;;;;;ACNH,kBAAe;CACb;CAAW;CAAW;CACtB;CAAc;CACd;CAAwB;CAAiB;CACzC;CAAoB;CAAS;CAAmB;CAChD;CAAa;CAAmB;CAAa;CAC9C"}