pakdatakit 2.2.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/DATA.md +512 -34
  2. package/LICENSE +1 -1
  3. package/NOTICE +14 -0
  4. package/README.md +472 -28
  5. package/dist/address.cjs +6 -5
  6. package/dist/address.js +4 -3
  7. package/dist/bills.cjs +19 -0
  8. package/dist/bills.d.cts +63 -0
  9. package/dist/bills.d.ts +63 -0
  10. package/dist/bills.js +2 -0
  11. package/dist/{chunk-4VSGCQ6K.cjs → chunk-2OBKPYJZ.cjs} +3 -3
  12. package/dist/chunk-33GOK7EE.cjs +5312 -0
  13. package/dist/chunk-33QMFE2Z.js +21244 -0
  14. package/dist/chunk-34U2ZMHR.js +194 -0
  15. package/dist/chunk-4GSBHJX6.js +165 -0
  16. package/dist/chunk-5DDHO5Z7.cjs +565 -0
  17. package/dist/chunk-5EY5DQS7.js +51 -0
  18. package/dist/chunk-5RGX4DWF.js +559 -0
  19. package/dist/chunk-5UCRHVI4.cjs +302 -0
  20. package/dist/{chunk-TTARJWGT.js → chunk-7DY26QPN.js} +2 -2
  21. package/dist/chunk-7E7L3NYS.cjs +11 -0
  22. package/dist/{chunk-3ZA265SK.cjs → chunk-AUQFA7EE.cjs} +172 -4
  23. package/dist/{chunk-QKH7W2CC.js → chunk-B7DOQ5QF.js} +6 -5
  24. package/dist/{chunk-HBOZIITD.js → chunk-CADQM4ZN.js} +14 -14
  25. package/dist/chunk-CF6AMRBU.cjs +198 -0
  26. package/dist/chunk-CZOZB4K3.js +61 -0
  27. package/dist/{chunk-3IARSCO6.cjs → chunk-DHOP7LQX.cjs} +25 -14
  28. package/dist/chunk-E2XU6NOW.js +909 -0
  29. package/dist/chunk-E6GWBOKV.cjs +911 -0
  30. package/dist/chunk-E6HSKRAE.js +9 -0
  31. package/dist/chunk-EA3SIHYT.js +313 -0
  32. package/dist/{chunk-33FXHM2E.cjs → chunk-ESKXG7Y6.cjs} +5 -5
  33. package/dist/chunk-I7UUPD3G.cjs +21252 -0
  34. package/dist/{chunk-YPPKY5XZ.js → chunk-IBZPJS4H.js} +26 -15
  35. package/dist/chunk-IDTRFOQW.js +35 -0
  36. package/dist/{chunk-XCXFGTHW.cjs → chunk-J5ZF46NZ.cjs} +14 -14
  37. package/dist/{chunk-NZQ47NWD.js → chunk-KRYHLYN2.js} +1 -1
  38. package/dist/{chunk-RXNYY5K5.js → chunk-LQHM3ADX.js} +172 -4
  39. package/dist/{chunk-HTERSQGF.cjs → chunk-MTS6SVNP.cjs} +4 -4
  40. package/dist/chunk-OTI7HY55.js +297 -0
  41. package/dist/{chunk-6IPPANNX.js → chunk-P7LVE2TF.js} +2 -2
  42. package/dist/{chunk-47P7HILD.cjs → chunk-QFPEFD67.cjs} +9 -8
  43. package/dist/chunk-RZQJAZKC.js +22 -0
  44. package/dist/{chunk-PLDVGOKZ.js → chunk-S274QFFB.js} +2 -2
  45. package/dist/chunk-SF4ECUZ6.cjs +56 -0
  46. package/dist/chunk-SQIHFEXI.cjs +25 -0
  47. package/dist/{chunk-NAJGGUAM.cjs → chunk-TC3VRWZV.cjs} +2 -2
  48. package/dist/{chunk-U7MWHXMF.cjs → chunk-TVL6RDAU.cjs} +4 -4
  49. package/dist/chunk-UYFTXD4P.js +168 -0
  50. package/dist/{chunk-AZV45DMG.js → chunk-V2XE3NCG.js} +2 -2
  51. package/dist/chunk-XCFZKCV2.cjs +37 -0
  52. package/dist/chunk-XOTCIXY6.js +5301 -0
  53. package/dist/chunk-XVEG53NN.cjs +322 -0
  54. package/dist/chunk-YDUXIENX.cjs +172 -0
  55. package/dist/chunk-YPAWNWFD.cjs +168 -0
  56. package/dist/chunk-YQFI7W3I.cjs +65 -0
  57. package/dist/{chunk-NTD4JLDW.cjs → chunk-YTLE5K7G.cjs} +1 -1
  58. package/dist/{chunk-EMH4IP2U.js → chunk-ZRONAQBV.js} +1 -1
  59. package/dist/class-validator.cjs +65 -0
  60. package/dist/class-validator.d.cts +63 -0
  61. package/dist/class-validator.d.ts +63 -0
  62. package/dist/class-validator.js +54 -0
  63. package/dist/cli.js +1 -1
  64. package/dist/courier.cjs +16 -0
  65. package/dist/courier.d.cts +51 -0
  66. package/dist/courier.d.ts +51 -0
  67. package/dist/courier.js +3 -0
  68. package/dist/fbr-invoice.cjs +25 -0
  69. package/dist/fbr-invoice.d.cts +170 -0
  70. package/dist/fbr-invoice.d.ts +170 -0
  71. package/dist/fbr-invoice.js +4 -0
  72. package/dist/geo.cjs +23 -6
  73. package/dist/geo.d.cts +56 -1
  74. package/dist/geo.d.ts +56 -1
  75. package/dist/geo.js +2 -1
  76. package/dist/holidays.cjs +4 -4
  77. package/dist/holidays.js +1 -1
  78. package/dist/iban.cjs +5 -5
  79. package/dist/iban.d.cts +8 -6
  80. package/dist/iban.d.ts +8 -6
  81. package/dist/iban.js +1 -1
  82. package/dist/incometax.cjs +27 -0
  83. package/dist/incometax.d.cts +91 -0
  84. package/dist/incometax.d.ts +91 -0
  85. package/dist/incometax.js +2 -0
  86. package/dist/index.cjs +253 -111
  87. package/dist/index.d.cts +12 -4
  88. package/dist/index.d.ts +12 -4
  89. package/dist/index.js +25 -15
  90. package/dist/input.cjs +9 -9
  91. package/dist/input.js +3 -3
  92. package/dist/joi.cjs +43 -0
  93. package/dist/joi.d.cts +25 -0
  94. package/dist/joi.d.ts +25 -0
  95. package/dist/joi.js +37 -0
  96. package/dist/networks.cjs +3 -3
  97. package/dist/networks.js +2 -2
  98. package/dist/numbers.cjs +6 -6
  99. package/dist/numbers.js +2 -2
  100. package/dist/passport.cjs +11 -0
  101. package/dist/passport.d.cts +27 -0
  102. package/dist/passport.d.ts +27 -0
  103. package/dist/passport.js +2 -0
  104. package/dist/phone.cjs +8 -8
  105. package/dist/phone.js +3 -3
  106. package/dist/postal.cjs +14 -6
  107. package/dist/postal.d.cts +54 -2
  108. package/dist/postal.d.ts +54 -2
  109. package/dist/postal.js +1 -1
  110. package/dist/quality.cjs +25 -0
  111. package/dist/quality.d.cts +62 -0
  112. package/dist/quality.d.ts +62 -0
  113. package/dist/quality.js +8 -0
  114. package/dist/raast.cjs +6 -6
  115. package/dist/raast.js +2 -2
  116. package/dist/salestax.cjs +20 -0
  117. package/dist/salestax.d.cts +106 -0
  118. package/dist/salestax.d.ts +106 -0
  119. package/dist/salestax.js +3 -0
  120. package/dist/superstruct.cjs +41 -0
  121. package/dist/superstruct.d.cts +25 -0
  122. package/dist/superstruct.d.ts +25 -0
  123. package/dist/superstruct.js +39 -0
  124. package/dist/text.cjs +21 -5
  125. package/dist/text.d.cts +90 -1
  126. package/dist/text.d.ts +90 -1
  127. package/dist/text.js +1 -1
  128. package/dist/valibot.cjs +18 -8
  129. package/dist/valibot.d.cts +3 -0
  130. package/dist/valibot.d.ts +3 -0
  131. package/dist/valibot.js +17 -7
  132. package/dist/vehicle.cjs +15 -0
  133. package/dist/vehicle.d.cts +43 -0
  134. package/dist/vehicle.d.ts +43 -0
  135. package/dist/vehicle.js +2 -0
  136. package/dist/whatsapp.cjs +3 -3
  137. package/dist/whatsapp.js +2 -2
  138. package/dist/yup.cjs +18 -8
  139. package/dist/yup.d.cts +3 -0
  140. package/dist/yup.d.ts +3 -0
  141. package/dist/yup.js +17 -7
  142. package/dist/zod.cjs +18 -8
  143. package/dist/zod.d.cts +3 -0
  144. package/dist/zod.d.ts +3 -0
  145. package/dist/zod.js +17 -7
  146. package/package.json +167 -6
  147. package/dist/chunk-34CJGJ67.cjs +0 -1697
  148. package/dist/chunk-4VVFS6FN.cjs +0 -715
  149. package/dist/chunk-E6DT2DWQ.js +0 -1689
  150. package/dist/chunk-GJENL6VK.cjs +0 -22
  151. package/dist/chunk-HUQY2WR5.js +0 -20
  152. package/dist/chunk-JKE4AMSZ.js +0 -47
  153. package/dist/chunk-KEHCTYLO.cjs +0 -52
  154. package/dist/chunk-LIYNKIKS.js +0 -709
@@ -0,0 +1,302 @@
1
+ 'use strict';
2
+
3
+ var chunkCF6AMRBU_cjs = require('./chunk-CF6AMRBU.cjs');
4
+ var chunkSF4ECUZ6_cjs = require('./chunk-SF4ECUZ6.cjs');
5
+ var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
6
+
7
+ // src/fbr-invoice.ts
8
+ var FBR_DI_SPEC_VERSION = "1.12";
9
+ var INVOICE_TYPES = /* @__PURE__ */ new Set(["Sale Invoice", "Debit Note"]);
10
+ var REGISTRATION_TYPES = /* @__PURE__ */ new Set(["Registered", "Unregistered"]);
11
+ var NTN_OR_CNIC = /^(?:\d{7}|\d{13})$/;
12
+ var FBR_INVOICE_NUMBER = /^(?:\d{7}|\d{13})DI\d{13}$/;
13
+ var SCENARIO = /^SN0(?:0[1-9]|1\d|2[0-8])$/;
14
+ var PERCENT_RATE = /^(\d+(?:\.\d+)?)%$/;
15
+ var PER_UNIT_RATE = /^rs\.?\s*(\d+(?:\.\d+)?)$/i;
16
+ var isText = (value) => typeof value === "string";
17
+ var filled = (value) => isText(value) && value.trim().length > 0;
18
+ var isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
19
+ var saleTypeKey = (value) => isText(value) ? chunkVPBMIYO2_cjs.normalizeKey(value) : "";
20
+ function decimalPlaces(value) {
21
+ if (!Number.isFinite(value)) return null;
22
+ const match = /^-?\d+(?:\.(\d+))?(?:e([+-]\d+))?$/.exec(String(value));
23
+ if (!match) return null;
24
+ const places = (match[1] ?? "").length - Number(match[2] ?? "0");
25
+ return places > 0 ? places : 0;
26
+ }
27
+ function expectedSalesTax(item) {
28
+ if (!isObject(item) || !isText(item.rate)) return null;
29
+ const rate = item.rate.trim();
30
+ const percent = PERCENT_RATE.exec(rate);
31
+ if (percent) {
32
+ const base = saleTypeKey(item.saleType) === "3rd schedule goods" ? item.fixedNotifiedValueOrRetailPrice : item.valueSalesExcludingST;
33
+ if (typeof base !== "number") return null;
34
+ return chunkCF6AMRBU_cjs.calculateSalesTax(base, { rate: Number(percent[1]) })?.tax ?? null;
35
+ }
36
+ const perUnit = PER_UNIT_RATE.exec(rate);
37
+ if (perUnit) {
38
+ if (typeof item.quantity !== "number") return null;
39
+ const quantity = chunkSF4ECUZ6_cjs.toUnits(item.quantity, 4);
40
+ const price = chunkSF4ECUZ6_cjs.toUnits(Number(perUnit[1]), 2);
41
+ if (quantity === null || price === null) return null;
42
+ return chunkSF4ECUZ6_cjs.fromPaisa(chunkSF4ECUZ6_cjs.divideHalfUp(BigInt(quantity) * BigInt(price), 10000n));
43
+ }
44
+ return null;
45
+ }
46
+ var NUMBER_FIELDS = [
47
+ "quantity",
48
+ "valueSalesExcludingST",
49
+ "salesTaxApplicable",
50
+ "salesTaxWithheldAtSource",
51
+ "extraTax",
52
+ "furtherTax",
53
+ "fedPayable",
54
+ "discount"
55
+ ];
56
+ function columnTotal(items, key) {
57
+ const scale = key === "quantity" ? 4 : 2;
58
+ let sum = 0;
59
+ for (const item of items) {
60
+ const value = item[key];
61
+ if (typeof value !== "number") continue;
62
+ const units = chunkSF4ECUZ6_cjs.toUnits(value, scale);
63
+ if (units !== null) sum += units;
64
+ }
65
+ return sum / (scale === 4 ? 1e4 : 100);
66
+ }
67
+ function buildFbrInvoice(input) {
68
+ if (!isObject(input) || !Array.isArray(input.items)) return null;
69
+ const items = [];
70
+ for (const raw of input.items) {
71
+ if (!isObject(raw)) return null;
72
+ const line = raw;
73
+ const item = {
74
+ ...line,
75
+ totalValues: line.totalValues ?? 0,
76
+ fixedNotifiedValueOrRetailPrice: line.fixedNotifiedValueOrRetailPrice ?? 0,
77
+ salesTaxWithheldAtSource: line.salesTaxWithheldAtSource ?? 0
78
+ };
79
+ item.salesTaxApplicable = line.salesTaxApplicable ?? expectedSalesTax(item) ?? 0;
80
+ items.push(item);
81
+ }
82
+ const invoice = {
83
+ ...input,
84
+ buyerNTNCNIC: input.buyerNTNCNIC ?? "",
85
+ invoiceRefNo: input.invoiceRefNo ?? "",
86
+ items
87
+ };
88
+ const totals = Object.fromEntries(
89
+ NUMBER_FIELDS.map((key) => [key, columnTotal(items, key)])
90
+ );
91
+ return { invoice, totals };
92
+ }
93
+ function validDate(text) {
94
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text);
95
+ if (!match) return false;
96
+ const [y, m, d] = [Number(match[1]), Number(match[2]), Number(match[3])];
97
+ const leap = y % 4 === 0 && y % 100 !== 0 || y % 400 === 0;
98
+ const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
99
+ return m >= 1 && m <= 12 && d >= 1 && d <= days[m - 1];
100
+ }
101
+ function validateFbrInvoice(invoice, options = {}) {
102
+ const errors = [];
103
+ const add = (code, field, message) => errors.push({ code, field, message });
104
+ if (!isObject(invoice)) {
105
+ add(null, "invoice", "The invoice must be an object");
106
+ return { valid: false, errors };
107
+ }
108
+ const inv = invoice;
109
+ if (!filled(inv.invoiceType)) {
110
+ add("0011", "invoiceType", "Invoice type is empty");
111
+ } else if (!INVOICE_TYPES.has(inv.invoiceType)) {
112
+ add(
113
+ "0003",
114
+ "invoiceType",
115
+ 'Invoice type must be "Sale Invoice" or "Debit Note"'
116
+ );
117
+ }
118
+ if (!filled(inv.invoiceDate)) {
119
+ add("0042", "invoiceDate", "Invoice date is empty");
120
+ } else if (!/^\d{4}-\d{2}-\d{2}$/.test(inv.invoiceDate)) {
121
+ add("0005", "invoiceDate", "Invoice date must be in YYYY-MM-DD format");
122
+ } else if (!validDate(inv.invoiceDate)) {
123
+ add("0113", "invoiceDate", "Invoice date is not a valid date");
124
+ } else if (isText(options?.today) && validDate(options.today) && inv.invoiceDate > options.today) {
125
+ add("0043", "invoiceDate", "Invoice date is later than today");
126
+ }
127
+ if (!isText(inv.sellerNTNCNIC) || !NTN_OR_CNIC.test(inv.sellerNTNCNIC)) {
128
+ add("0401", "sellerNTNCNIC", "Seller NTN or CNIC must be 7 or 13 digits");
129
+ }
130
+ if (!filled(inv.sellerBusinessName)) {
131
+ add(null, "sellerBusinessName", "Seller business name is required");
132
+ }
133
+ if (!filled(inv.sellerProvince)) {
134
+ add("0073", "sellerProvince", "Seller province is empty");
135
+ }
136
+ if (!filled(inv.sellerAddress)) {
137
+ add(null, "sellerAddress", "Seller address is required");
138
+ }
139
+ const registration = inv.buyerRegistrationType;
140
+ if (!isText(registration) || !REGISTRATION_TYPES.has(registration)) {
141
+ add(
142
+ "0012",
143
+ "buyerRegistrationType",
144
+ 'Buyer registration type must be "Registered" or "Unregistered"'
145
+ );
146
+ }
147
+ const buyerId = inv.buyerNTNCNIC;
148
+ if (!filled(buyerId)) {
149
+ if (registration !== "Unregistered") {
150
+ add("0009", "buyerNTNCNIC", "Buyer NTN or CNIC is empty");
151
+ }
152
+ } else if (!NTN_OR_CNIC.test(buyerId)) {
153
+ add("0402", "buyerNTNCNIC", "Buyer NTN or CNIC must be 7 or 13 digits");
154
+ } else if (buyerId === inv.sellerNTNCNIC) {
155
+ add(
156
+ "0058",
157
+ "buyerNTNCNIC",
158
+ "Buyer and seller must be different (self-invoicing is not allowed)"
159
+ );
160
+ }
161
+ if (!filled(inv.buyerBusinessName)) {
162
+ add("0010", "buyerBusinessName", "Buyer business name is empty");
163
+ }
164
+ if (!filled(inv.buyerProvince)) {
165
+ add("0074", "buyerProvince", "Buyer province is empty");
166
+ }
167
+ if (!filled(inv.buyerAddress)) {
168
+ add(null, "buyerAddress", "Buyer address is required");
169
+ }
170
+ if (filled(inv.invoiceRefNo)) {
171
+ if (!FBR_INVOICE_NUMBER.test(inv.invoiceRefNo.trim())) {
172
+ add(
173
+ null,
174
+ "invoiceRefNo",
175
+ 'Invoice reference number must be an FBR invoice number (NTN or CNIC, "DI", 13 digits)'
176
+ );
177
+ }
178
+ } else if (inv.invoiceType === "Debit Note") {
179
+ add(
180
+ "0026",
181
+ "invoiceRefNo",
182
+ "Invoice reference number is required for a debit note"
183
+ );
184
+ }
185
+ if (inv.scenarioId !== void 0 && inv.scenarioId !== null && inv.scenarioId !== "") {
186
+ if (!isText(inv.scenarioId) || !SCENARIO.test(inv.scenarioId)) {
187
+ add(null, "scenarioId", "Scenario ID must be SN001 to SN028");
188
+ }
189
+ }
190
+ if (!Array.isArray(inv.items) || inv.items.length === 0) {
191
+ add(null, "items", "The invoice needs at least one item");
192
+ return { valid: errors.length === 0, errors };
193
+ }
194
+ inv.items.forEach((raw, index) => {
195
+ const at = (key) => `items[${index}].${key}`;
196
+ if (!isObject(raw)) {
197
+ add(null, `items[${index}]`, "Each item must be an object");
198
+ return;
199
+ }
200
+ const item = raw;
201
+ if (!filled(item.hsCode)) add("0044", at("hsCode"), "HS code is empty");
202
+ if (!isText(item.productDescription)) {
203
+ add(null, at("productDescription"), "Product description is required");
204
+ }
205
+ if (!filled(item.rate)) add("0020", at("rate"), "Rate is empty");
206
+ if (!filled(item.uoM)) add(null, at("uoM"), "Unit of measure is required");
207
+ if (!filled(item.saleType))
208
+ add("0013", at("saleType"), "Sale type is empty");
209
+ const missingCodes = {
210
+ quantity: "0098",
211
+ valueSalesExcludingST: "0021",
212
+ salesTaxApplicable: "0023",
213
+ salesTaxWithheldAtSource: "0024",
214
+ totalValues: null,
215
+ fixedNotifiedValueOrRetailPrice: null
216
+ };
217
+ const numbersOk = {};
218
+ for (const key of [
219
+ ...Object.keys(missingCodes),
220
+ "extraTax",
221
+ "furtherTax",
222
+ "fedPayable",
223
+ "discount"
224
+ ]) {
225
+ const value = item[key];
226
+ const required = key in missingCodes;
227
+ if (value === void 0 || value === null || !required && value === "") {
228
+ if (required) {
229
+ add(missingCodes[key] ?? null, at(key), `${key} is required`);
230
+ }
231
+ continue;
232
+ }
233
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
234
+ add("0300", at(key), `${key} must be a number, not negative`);
235
+ continue;
236
+ }
237
+ const places = decimalPlaces(value);
238
+ const limit = key === "quantity" ? 4 : 2;
239
+ if (places > limit) {
240
+ add("0302", at(key), `${key} has more than ${limit} decimal places`);
241
+ continue;
242
+ }
243
+ numbersOk[key] = true;
244
+ }
245
+ const rate = isText(item.rate) ? item.rate.trim() : "";
246
+ if (filled(item.rate) && rate !== "18%" && !filled(item.sroScheduleNo)) {
247
+ add(
248
+ "0077",
249
+ at("sroScheduleNo"),
250
+ "SRO/schedule number is required when the rate is not 18%"
251
+ );
252
+ }
253
+ if (filled(item.sroScheduleNo) && !filled(item.sroItemSerialNo)) {
254
+ add(
255
+ "0078",
256
+ at("sroItemSerialNo"),
257
+ "Item serial number is required when an SRO/schedule number is given"
258
+ );
259
+ }
260
+ const saleType = saleTypeKey(item.saleType);
261
+ if (saleType === "3rd schedule goods" && numbersOk.fixedNotifiedValueOrRetailPrice === true && item.fixedNotifiedValueOrRetailPrice === 0) {
262
+ add(
263
+ "0090",
264
+ at("fixedNotifiedValueOrRetailPrice"),
265
+ "Retail price is required for Third Schedule goods"
266
+ );
267
+ }
268
+ if (saleType === "goods at reduced rate" && item.extraTax !== void 0 && item.extraTax !== null && item.extraTax !== "") {
269
+ add(
270
+ "0091",
271
+ at("extraTax"),
272
+ "Extra tax must be empty for goods at a reduced rate"
273
+ );
274
+ }
275
+ if (numbersOk.salesTaxApplicable === true) {
276
+ const percent = PERCENT_RATE.test(rate);
277
+ const perUnit = PER_UNIT_RATE.test(rate);
278
+ const baseKey = perUnit ? "quantity" : saleType === "3rd schedule goods" ? "fixedNotifiedValueOrRetailPrice" : "valueSalesExcludingST";
279
+ if ((percent || perUnit) && numbersOk[baseKey] === true) {
280
+ const expected = expectedSalesTax(item);
281
+ if (expected !== null) {
282
+ const actual = chunkSF4ECUZ6_cjs.toUnits(item.salesTaxApplicable, 2);
283
+ const wanted = chunkSF4ECUZ6_cjs.toUnits(expected, 2);
284
+ if (actual !== null && wanted !== null && Math.abs(actual - wanted) > 1) {
285
+ const code = perUnit ? "0105" : saleType === "3rd schedule goods" ? "0102" : "0104";
286
+ add(
287
+ code,
288
+ at("salesTaxApplicable"),
289
+ `Sales tax should be ${expected.toFixed(2)} for this rate`
290
+ );
291
+ }
292
+ }
293
+ }
294
+ }
295
+ });
296
+ return { valid: errors.length === 0, errors };
297
+ }
298
+
299
+ exports.FBR_DI_SPEC_VERSION = FBR_DI_SPEC_VERSION;
300
+ exports.buildFbrInvoice = buildFbrInvoice;
301
+ exports.expectedSalesTax = expectedSalesTax;
302
+ exports.validateFbrInvoice = validateFbrInvoice;
@@ -1,6 +1,6 @@
1
- import { isAllocatedPrefix } from './chunk-6IPPANNX.js';
1
+ import { validateIBAN } from './chunk-IBZPJS4H.js';
2
+ import { isAllocatedPrefix } from './chunk-P7LVE2TF.js';
2
3
  import { validateCNIC } from './chunk-EEVNLTB4.js';
3
- import { validateIBAN } from './chunk-YPPKY5XZ.js';
4
4
  import { toAsciiDigits } from './chunk-ENQ7O7VW.js';
5
5
 
6
6
  // src/input.ts
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
4
+
5
+ // src/passport.ts
6
+ function validatePassport(passport) {
7
+ const compact = chunkVPBMIYO2_cjs.toAsciiDigits(passport.trim()).toUpperCase().replace(/[-‐‑‒–— ]/g, "");
8
+ return /^[A-Z]{2}\d{7}$/.test(compact);
9
+ }
10
+
11
+ exports.validatePassport = validatePassport;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNTD4JLDW_cjs = require('./chunk-NTD4JLDW.cjs');
3
+ var chunkYTLE5K7G_cjs = require('./chunk-YTLE5K7G.cjs');
4
4
  var chunkVPBMIYO2_cjs = require('./chunk-VPBMIYO2.cjs');
5
5
 
6
6
  // data/area-codes.json
@@ -145,6 +145,66 @@ var area_codes_default = [
145
145
  code: "57",
146
146
  cities: ["Attock"]
147
147
  },
148
+ {
149
+ code: "5811",
150
+ cities: ["Gilgit"]
151
+ },
152
+ {
153
+ code: "5812",
154
+ cities: ["Diamer"]
155
+ },
156
+ {
157
+ code: "5813",
158
+ cities: ["Hunza"]
159
+ },
160
+ {
161
+ code: "5814",
162
+ cities: ["Ghizer"]
163
+ },
164
+ {
165
+ code: "5815",
166
+ cities: ["Skardu"]
167
+ },
168
+ {
169
+ code: "5816",
170
+ cities: ["Ghanche"]
171
+ },
172
+ {
173
+ code: "5817",
174
+ cities: ["Astore"]
175
+ },
176
+ {
177
+ code: "5821",
178
+ cities: ["Neelam"]
179
+ },
180
+ {
181
+ code: "5822",
182
+ cities: ["Muzaffarabad"]
183
+ },
184
+ {
185
+ code: "5823",
186
+ cities: ["Bagh"]
187
+ },
188
+ {
189
+ code: "5824",
190
+ cities: ["Poonch"]
191
+ },
192
+ {
193
+ code: "5825",
194
+ cities: ["Sudhnuti"]
195
+ },
196
+ {
197
+ code: "5826",
198
+ cities: ["Kotli"]
199
+ },
200
+ {
201
+ code: "5827",
202
+ cities: ["Mirpur"]
203
+ },
204
+ {
205
+ code: "5828",
206
+ cities: ["Bhimber"]
207
+ },
148
208
  {
149
209
  code: "604",
150
210
  cities: ["Rajanpur"]
@@ -213,6 +273,66 @@ var area_codes_default = [
213
273
  code: "81",
214
274
  cities: ["Quetta"]
215
275
  },
276
+ {
277
+ code: "822",
278
+ cities: ["Zhob"]
279
+ },
280
+ {
281
+ code: "823",
282
+ cities: ["Killa Saifullah"]
283
+ },
284
+ {
285
+ code: "824",
286
+ cities: ["Loralai"]
287
+ },
288
+ {
289
+ code: "825",
290
+ cities: ["Chagai"]
291
+ },
292
+ {
293
+ code: "826",
294
+ cities: ["Killa Abdullah", "Pishin"]
295
+ },
296
+ {
297
+ code: "828",
298
+ cities: ["Musakhel"]
299
+ },
300
+ {
301
+ code: "829",
302
+ cities: ["Barkhan", "Kohlu"]
303
+ },
304
+ {
305
+ code: "832",
306
+ cities: ["Kachhi", "Bolan"]
307
+ },
308
+ {
309
+ code: "833",
310
+ cities: ["Sibi", "Ziarat"]
311
+ },
312
+ {
313
+ code: "835",
314
+ cities: ["Dera Bugti", "North Dera Bugti", "South Dera Bugti"]
315
+ },
316
+ {
317
+ code: "837",
318
+ cities: ["Jhal Magsi"]
319
+ },
320
+ {
321
+ code: "838",
322
+ cities: ["Jaffarabad", "Nasirabad"]
323
+ },
324
+ {
325
+ code: "843",
326
+ cities: ["Mastung"]
327
+ },
328
+ {
329
+ code: "844",
330
+ cities: ["Kalat"]
331
+ },
332
+ {
333
+ code: "847",
334
+ cities: ["Kharan"]
335
+ },
216
336
  {
217
337
  code: "848",
218
338
  cities: ["Khuzdar"]
@@ -221,6 +341,18 @@ var area_codes_default = [
221
341
  code: "852",
222
342
  cities: ["Turbat"]
223
343
  },
344
+ {
345
+ code: "853",
346
+ cities: ["Lasbela"]
347
+ },
348
+ {
349
+ code: "855",
350
+ cities: ["Panjgur"]
351
+ },
352
+ {
353
+ code: "856",
354
+ cities: ["Awaran"]
355
+ },
224
356
  {
225
357
  code: "86",
226
358
  cities: ["Gwadar"]
@@ -237,6 +369,10 @@ var area_codes_default = [
237
369
  code: "923",
238
370
  cities: ["Nowshera"]
239
371
  },
372
+ {
373
+ code: "924",
374
+ cities: ["Khyber", "Mohmand"]
375
+ },
240
376
  {
241
377
  code: "925",
242
378
  cities: ["Hangu"]
@@ -253,6 +389,10 @@ var area_codes_default = [
253
389
  code: "928",
254
390
  cities: ["Bannu"]
255
391
  },
392
+ {
393
+ code: "932",
394
+ cities: ["Malakand"]
395
+ },
256
396
  {
257
397
  code: "937",
258
398
  cities: ["Mardan"]
@@ -261,10 +401,26 @@ var area_codes_default = [
261
401
  code: "938",
262
402
  cities: ["Swabi"]
263
403
  },
404
+ {
405
+ code: "939",
406
+ cities: ["Buner"]
407
+ },
408
+ {
409
+ code: "942",
410
+ cities: ["Bajaur"]
411
+ },
264
412
  {
265
413
  code: "943",
266
414
  cities: ["Chitral"]
267
415
  },
416
+ {
417
+ code: "944",
418
+ cities: ["Upper Dir"]
419
+ },
420
+ {
421
+ code: "945",
422
+ cities: ["Lower Dir"]
423
+ },
268
424
  {
269
425
  code: "946",
270
426
  cities: ["Swat", "Mingora"]
@@ -273,6 +429,14 @@ var area_codes_default = [
273
429
  code: "963",
274
430
  cities: ["Tank"]
275
431
  },
432
+ {
433
+ code: "965",
434
+ cities: [
435
+ "South Waziristan",
436
+ "Lower South Waziristan",
437
+ "Upper South Waziristan"
438
+ ]
439
+ },
276
440
  {
277
441
  code: "966",
278
442
  cities: ["Dera Ismail Khan"]
@@ -289,6 +453,10 @@ var area_codes_default = [
289
453
  code: "995",
290
454
  cities: ["Haripur"]
291
455
  },
456
+ {
457
+ code: "996",
458
+ cities: ["Shangla"]
459
+ },
292
460
  {
293
461
  code: "997",
294
462
  cities: ["Mansehra"]
@@ -306,8 +474,8 @@ var UAN_WITHOUT_AREA_CODE = /^111(\d{6})$/;
306
474
  var TOLL_FREE = /^800(\d{5}(?:\d{3})?)$/;
307
475
  var PREMIUM = /^900(\d{5})$/;
308
476
  var PERSONAL = /^122(\d{6})$/;
309
- var areaCodes = chunkVPBMIYO2_cjs.lazy(() => area_codes_default);
310
- var areaCodeMap = chunkVPBMIYO2_cjs.lazy(
477
+ var areaCodes = /* @__PURE__ */ chunkVPBMIYO2_cjs.lazy(() => area_codes_default);
478
+ var areaCodeMap = /* @__PURE__ */ chunkVPBMIYO2_cjs.lazy(
311
479
  () => new Map(areaCodes().map((entry) => [entry.code, entry.cities]))
312
480
  );
313
481
  function toNationalNumber(input) {
@@ -339,7 +507,7 @@ function groupDigits(digits, size = 3) {
339
507
  return digits.match(new RegExp(`\\d{1,${size}}`, "g"))?.join("-") ?? digits;
340
508
  }
341
509
  function analyzeNumber(phone) {
342
- const mobile = chunkNTD4JLDW_cjs.normalizePhoneDigits(phone);
510
+ const mobile = chunkYTLE5K7G_cjs.normalizePhoneDigits(phone);
343
511
  if (mobile !== null) {
344
512
  const national2 = mobile.slice(2);
345
513
  return {
@@ -1,15 +1,16 @@
1
- import { getCityByPostalCode } from './chunk-LIYNKIKS.js';
2
- import { cities_default, districts_default, getProvince, getDistrictProvince } from './chunk-E6DT2DWQ.js';
3
- import { lazy, normalizeWhitespace, normalizeKey } from './chunk-ENQ7O7VW.js';
1
+ import { getCityByPostalCode } from './chunk-33QMFE2Z.js';
2
+ import { getProvince, getDistrictProvince, districts_default } from './chunk-XOTCIXY6.js';
3
+ import { cities_default } from './chunk-E2XU6NOW.js';
4
+ import { normalizeWhitespace, normalizeKey, lazy } from './chunk-ENQ7O7VW.js';
4
5
 
5
6
  // src/address.ts
6
7
  function byLengthDesc(a, b) {
7
8
  return b.length - a.length;
8
9
  }
9
- var cityNames = lazy(
10
+ var cityNames = /* @__PURE__ */ lazy(
10
11
  () => cities_default.map((entry) => entry.city).sort(byLengthDesc)
11
12
  );
12
- var districtNames = lazy(
13
+ var districtNames = /* @__PURE__ */ lazy(
13
14
  () => districts_default.map((entry) => entry.district).sort(byLengthDesc)
14
15
  );
15
16
  var PROVINCES = [