@rzl-zone/utils-js 3.13.0-beta.2 → 3.13.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.
- package/README.md +4 -4
- package/dist/.references/index.d.cts +1 -1
- package/dist/.references/index.d.ts +1 -1
- package/dist/{assertIsArray-BqjMoan3.cjs → assertIsArray-BgdgVjDu.cjs} +3 -3
- package/dist/{assertIsArray-BqjMoan3.cjs.map → assertIsArray-BgdgVjDu.cjs.map} +1 -1
- package/dist/{assertIsArray-6BcSdNa-.js → assertIsArray-hZyYKvLb.js} +3 -3
- package/dist/{assertIsArray-6BcSdNa-.js.map → assertIsArray-hZyYKvLb.js.map} +1 -1
- package/dist/{assertIsBoolean-Bv6gL-xe.js → assertIsBoolean-9-huIcIR.js} +2 -2
- package/dist/{assertIsBoolean-Bv6gL-xe.js.map → assertIsBoolean-9-huIcIR.js.map} +1 -1
- package/dist/{assertIsBoolean-amRiJHnh.cjs → assertIsBoolean-JGpkg5ju.cjs} +2 -2
- package/dist/{assertIsBoolean-amRiJHnh.cjs.map → assertIsBoolean-JGpkg5ju.cjs.map} +1 -1
- package/dist/{assertIsString-1WiUjgqf.js → assertIsString-CcOpQqcv.js} +3 -3
- package/dist/{assertIsString-1WiUjgqf.js.map → assertIsString-CcOpQqcv.js.map} +1 -1
- package/dist/{assertIsString-C0b28AU1.cjs → assertIsString-UR6QjqyZ.cjs} +3 -3
- package/dist/{assertIsString-C0b28AU1.cjs.map → assertIsString-UR6QjqyZ.cjs.map} +1 -1
- package/dist/assertions/index.cjs +5 -5
- package/dist/assertions/index.d.cts +2 -2
- package/dist/assertions/index.d.ts +2 -2
- package/dist/assertions/index.js +5 -5
- package/dist/conversions/index.cjs +6 -6
- package/dist/conversions/index.d.cts +2 -2
- package/dist/conversions/index.d.ts +2 -2
- package/dist/conversions/index.js +6 -6
- package/dist/{conversions-lvvAYiZs.cjs → conversions-DLt2zlyu.cjs} +12 -12
- package/dist/{conversions-lvvAYiZs.cjs.map → conversions-DLt2zlyu.cjs.map} +1 -1
- package/dist/{conversions-BrI0GIOr.js → conversions-Du6GC5JA.js} +12 -12
- package/dist/{conversions-BrI0GIOr.js.map → conversions-Du6GC5JA.js.map} +1 -1
- package/dist/events/index.cjs +4 -4
- package/dist/events/index.d.cts +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.js +4 -4
- package/dist/formatters/index.cjs +2 -2
- package/dist/formatters/index.d.cts +2 -2
- package/dist/formatters/index.d.ts +2 -2
- package/dist/formatters/index.js +2 -2
- package/dist/{formatters-DQr05EUA.cjs → formatters-C0t5CdX-.cjs} +10 -10
- package/dist/{formatters-DQr05EUA.cjs.map → formatters-C0t5CdX-.cjs.map} +1 -1
- package/dist/{formatters-zDzQvtb4.js → formatters-RomzqDp_.js} +10 -10
- package/dist/{formatters-zDzQvtb4.js.map → formatters-RomzqDp_.js.map} +1 -1
- package/dist/generators/index.cjs +5 -5
- package/dist/generators/index.d.cts +2 -2
- package/dist/generators/index.d.ts +2 -2
- package/dist/generators/index.js +5 -5
- package/dist/{index-GSUN6rjA.d.ts → index-50G4edI1.d.ts} +2 -2
- package/dist/{index-DxZlGbAH.d.ts → index-5DpyzfpU.d.ts} +1 -1
- package/dist/{index-BlTCrSyc.d.cts → index-B6Xg9Z8l.d.ts} +2 -2
- package/dist/{index-3jBnthag.d.cts → index-BFI4R7Pn.d.ts} +1 -1
- package/dist/{index-Ckao53JY.d.ts → index-BcKPWWfh.d.ts} +2 -2
- package/dist/{index-CEm8ZOvj.d.ts → index-CMcxcN7w.d.cts} +2 -2
- package/dist/{index-_dJhBl1h.d.ts → index-CPc-TTMc.d.cts} +1 -1
- package/dist/{index-DIeR8qa-.d.ts → index-D-5AsV9K.d.cts} +1 -1
- package/dist/{index-bMa-0Yr4.d.cts → index-DM_0q4CY.d.cts} +1 -1
- package/dist/{index-z_uCh5KW.d.cts → index-DoteSYTy.d.cts} +1 -1
- package/dist/{index-DHHrLc0B.d.ts → index-bGRsmkyA.d.ts} +1 -1
- package/dist/{index-DyVWeYP3.d.cts → index-hsSSKuvW.d.ts} +1 -1
- package/dist/{index-BXwimNPA.d.cts → index-s7h0w-8H.d.cts} +2 -2
- package/dist/{index-CLq5kZmQ.d.cts → index-tYmZ3X4Y.d.cts} +2 -2
- package/dist/{isBigInt-CIFRnsdx.cjs → isBigInt-C0gHDkh4.cjs} +2 -2
- package/dist/{isBigInt-CIFRnsdx.cjs.map → isBigInt-C0gHDkh4.cjs.map} +1 -1
- package/dist/{isBigInt-D-Pu9sxp.js → isBigInt-bbW78ITJ.js} +2 -2
- package/dist/{isBigInt-D-Pu9sxp.js.map → isBigInt-bbW78ITJ.js.map} +1 -1
- package/dist/{isEmptyObject-CZ9DLi7R.js → isEmptyObject-CZsFdN7x.js} +3 -3
- package/dist/{isEmptyObject-CZ9DLi7R.js.map → isEmptyObject-CZsFdN7x.js.map} +1 -1
- package/dist/{isEmptyObject-CEySmyHK.cjs → isEmptyObject-D-fETD_f.cjs} +3 -3
- package/dist/{isEmptyObject-CEySmyHK.cjs.map → isEmptyObject-D-fETD_f.cjs.map} +1 -1
- package/dist/{isEmptyString-DI64RQCy.cjs → isEmptyString-Dx6OM5PL.cjs} +3 -3
- package/dist/{isEmptyString-DI64RQCy.cjs.map → isEmptyString-Dx6OM5PL.cjs.map} +1 -1
- package/dist/{isEmptyString-DFDtBbNr.js → isEmptyString-pmcf-orv.js} +3 -3
- package/dist/{isEmptyString-DFDtBbNr.js.map → isEmptyString-pmcf-orv.js.map} +1 -1
- package/dist/{isEmptyValue-aGyeClwA.js → isEmptyValue-CkiXENcT.js} +5 -5
- package/dist/{isEmptyValue-aGyeClwA.js.map → isEmptyValue-CkiXENcT.js.map} +1 -1
- package/dist/{isEmptyValue-Cw6ovu7z.cjs → isEmptyValue-v6BsHBiu.cjs} +5 -5
- package/dist/{isEmptyValue-Cw6ovu7z.cjs.map → isEmptyValue-v6BsHBiu.cjs.map} +1 -1
- package/dist/{isEqual-UsvOwrlY.cjs → isEqual-CZxetLzm.cjs} +4 -4
- package/dist/{isEqual-UsvOwrlY.cjs.map → isEqual-CZxetLzm.cjs.map} +1 -1
- package/dist/{isEqual-Dtb2sXUv.js → isEqual-Dc8fNB2J.js} +4 -4
- package/dist/{isEqual-Dtb2sXUv.js.map → isEqual-Dc8fNB2J.js.map} +1 -1
- package/dist/{isFinite-uukWvxJh.cjs → isFinite-0z31xOa2.cjs} +3 -3
- package/dist/{isFinite-uukWvxJh.cjs.map → isFinite-0z31xOa2.cjs.map} +1 -1
- package/dist/{isFinite-Cz_IFXuV.js → isFinite-CI59vUHt.js} +3 -3
- package/dist/{isFinite-Cz_IFXuV.js.map → isFinite-CI59vUHt.js.map} +1 -1
- package/dist/{isInteger-DPYjliLZ.cjs → isInteger-DUhd-dyt.cjs} +2 -2
- package/dist/{isInteger-DPYjliLZ.cjs.map → isInteger-DUhd-dyt.cjs.map} +1 -1
- package/dist/{isInteger-DZ163OQg.js → isInteger-DeN5FIAr.js} +2 -2
- package/dist/{isInteger-DZ163OQg.js.map → isInteger-DeN5FIAr.js.map} +1 -1
- package/dist/{isPlainObject-CBABRyEX.d.cts → isPlainObject-CjoJH9yk.d.ts} +1 -1
- package/dist/{isPlainObject-Dr8gi89U.d.ts → isPlainObject-DvxdHoAf.d.cts} +1 -1
- package/dist/{isServer-BDShLyVJ.js → isServer-BM5GzRpI.js} +2 -2
- package/dist/{isServer-BDShLyVJ.js.map → isServer-BM5GzRpI.js.map} +1 -1
- package/dist/{isServer-BzDeYuGg.cjs → isServer-TOmhgOtP.cjs} +2 -2
- package/dist/{isServer-BzDeYuGg.cjs.map → isServer-TOmhgOtP.cjs.map} +1 -1
- package/dist/{isTypedArray-DuUUA4CL.js → isTypedArray-BPerK072.js} +3 -3
- package/dist/{isTypedArray-DuUUA4CL.js.map → isTypedArray-BPerK072.js.map} +1 -1
- package/dist/{isTypedArray-DaYAkyrt.cjs → isTypedArray-pAdBFUDl.cjs} +3 -3
- package/dist/{isTypedArray-DaYAkyrt.cjs.map → isTypedArray-pAdBFUDl.cjs.map} +1 -1
- package/dist/{isValidDomain-BxyToAlh.cjs → isValidDomain-BMcr9vTp.cjs} +6 -6
- package/dist/isValidDomain-BMcr9vTp.cjs.map +1 -0
- package/dist/{isValidDomain-CTw5vZFY.js → isValidDomain-CHKOn79-.js} +6 -6
- package/dist/isValidDomain-CHKOn79-.js.map +1 -0
- package/dist/{noop-DGg9vMSD.js → noop-BaNz9ls5.js} +2 -2
- package/dist/{noop-DGg9vMSD.js.map → noop-BaNz9ls5.js.map} +1 -1
- package/dist/{noop-7KrqC9DC.cjs → noop-D4g9yTAW.cjs} +2 -2
- package/dist/{noop-7KrqC9DC.cjs.map → noop-D4g9yTAW.cjs.map} +1 -1
- package/dist/{normalizeSpaces-C1eLwykD.js → normalizeSpaces-DupusmF5.js} +3 -3
- package/dist/{normalizeSpaces-C1eLwykD.js.map → normalizeSpaces-DupusmF5.js.map} +1 -1
- package/dist/{normalizeSpaces-B6ZQOZRX.cjs → normalizeSpaces-MWiYtSyS.cjs} +3 -3
- package/dist/{normalizeSpaces-B6ZQOZRX.cjs.map → normalizeSpaces-MWiYtSyS.cjs.map} +1 -1
- package/dist/operations/index.cjs +7 -7
- package/dist/operations/index.d.cts +1 -1
- package/dist/operations/index.d.ts +1 -1
- package/dist/operations/index.js +7 -7
- package/dist/parsers/index.cjs +2 -2
- package/dist/parsers/index.d.cts +1 -1
- package/dist/parsers/index.d.ts +1 -1
- package/dist/parsers/index.js +2 -2
- package/dist/{parsers-DEFpCYhw.cjs → parsers-Bd-YRt6j.cjs} +4 -4
- package/dist/{parsers-DEFpCYhw.cjs.map → parsers-Bd-YRt6j.cjs.map} +1 -1
- package/dist/{parsers-bQQ9mStV.js → parsers-Dl9fFra4.js} +4 -4
- package/dist/{parsers-bQQ9mStV.js.map → parsers-Dl9fFra4.js.map} +1 -1
- package/dist/{parsing-BngARhmu.js → parsing-BG73HUrI.js} +3 -3
- package/dist/{parsing-BngARhmu.js.map → parsing-BG73HUrI.js.map} +1 -1
- package/dist/{parsing-lI5EN4LY.cjs → parsing-CU_Mc7CF.cjs} +3 -3
- package/dist/{parsing-lI5EN4LY.cjs.map → parsing-CU_Mc7CF.cjs.map} +1 -1
- package/dist/predicates/index.cjs +14 -14
- package/dist/predicates/index.d.cts +3 -3
- package/dist/predicates/index.d.ts +3 -3
- package/dist/predicates/index.js +14 -14
- package/dist/{predicates-CMmP3fPJ.cjs → predicates-Bd4AnXr0.cjs} +11 -11
- package/dist/{predicates-CMmP3fPJ.cjs.map → predicates-Bd4AnXr0.cjs.map} +1 -1
- package/dist/{predicates-V87QD8hs.js → predicates-VJN-VDha.js} +11 -11
- package/dist/{predicates-V87QD8hs.js.map → predicates-VJN-VDha.js.map} +1 -1
- package/dist/promises/index.cjs +4 -4
- package/dist/promises/index.d.cts +1 -1
- package/dist/promises/index.d.ts +1 -1
- package/dist/promises/index.js +4 -4
- package/dist/{punyCode-DmTsB7q_.cjs → punyCode-5wmummgP.cjs} +4 -4
- package/dist/{punyCode-DmTsB7q_.cjs.map → punyCode-5wmummgP.cjs.map} +1 -1
- package/dist/{punyCode-BeFYDjj0.js → punyCode-C0ft9dER.js} +4 -4
- package/dist/{punyCode-BeFYDjj0.js.map → punyCode-C0ft9dER.js.map} +1 -1
- package/dist/{removeSpaces-C8mu_yp3.cjs → removeSpaces-CPj1ABLa.cjs} +3 -3
- package/dist/{removeSpaces-C8mu_yp3.cjs.map → removeSpaces-CPj1ABLa.cjs.map} +1 -1
- package/dist/{removeSpaces-B96axxP6.js → removeSpaces-DpiJ1H1P.js} +3 -3
- package/dist/{removeSpaces-B96axxP6.js.map → removeSpaces-DpiJ1H1P.js.map} +1 -1
- package/dist/rzl-utils.global.js +1 -1
- package/dist/{safeJsonParse-DyCsTXlU.js → safeJsonParse-BxOZgGy7.js} +6 -6
- package/dist/{safeJsonParse-DyCsTXlU.js.map → safeJsonParse-BxOZgGy7.js.map} +1 -1
- package/dist/{safeJsonParse-BXbtX_j7.cjs → safeJsonParse-v7ll9iFG.cjs} +6 -6
- package/dist/{safeJsonParse-BXbtX_j7.cjs.map → safeJsonParse-v7ll9iFG.cjs.map} +1 -1
- package/dist/{safeStableStringify-DRYQ56Dg.cjs → safeStableStringify-BiUOLBYo.cjs} +4 -4
- package/dist/{safeStableStringify-DRYQ56Dg.cjs.map → safeStableStringify-BiUOLBYo.cjs.map} +1 -1
- package/dist/{safeStableStringify-BrOcdX9n.js → safeStableStringify-C5Gc3ZED.js} +4 -4
- package/dist/{safeStableStringify-BrOcdX9n.js.map → safeStableStringify-C5Gc3ZED.js.map} +1 -1
- package/dist/strings/index.cjs +5 -5
- package/dist/strings/index.d.cts +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +5 -5
- package/dist/tailwind/index.cjs +2 -2
- package/dist/tailwind/index.d.cts +2 -2
- package/dist/tailwind/index.d.ts +2 -2
- package/dist/tailwind/index.js +2 -2
- package/dist/{tailwind-BZ2_MeNX.js → tailwind-CxI2DXpR.js} +5 -5
- package/dist/{tailwind-BZ2_MeNX.js.map → tailwind-CxI2DXpR.js.map} +1 -1
- package/dist/{tailwind-C1YtxJ-K.cjs → tailwind-DhKiKZAc.cjs} +5 -5
- package/dist/{tailwind-C1YtxJ-K.cjs.map → tailwind-DhKiKZAc.cjs.map} +1 -1
- package/dist/{toStringArrayUnRecursive-tHp2a7KR.js → toStringArrayUnRecursive-BaZrCGaR.js} +6 -6
- package/dist/{toStringArrayUnRecursive-tHp2a7KR.js.map → toStringArrayUnRecursive-BaZrCGaR.js.map} +1 -1
- package/dist/{toStringArrayUnRecursive-D1mPM4wg.cjs → toStringArrayUnRecursive-BuRBWRcB.cjs} +6 -6
- package/dist/{toStringArrayUnRecursive-D1mPM4wg.cjs.map → toStringArrayUnRecursive-BuRBWRcB.cjs.map} +1 -1
- package/dist/urls/index.cjs +3 -3
- package/dist/urls/index.d.cts +1 -1
- package/dist/urls/index.d.ts +1 -1
- package/dist/urls/index.js +3 -3
- package/dist/{urls-DCyx8Wpk.cjs → urls-CyhKg1Cn.cjs} +11 -11
- package/dist/{urls-DCyx8Wpk.cjs.map → urls-CyhKg1Cn.cjs.map} +1 -1
- package/dist/{urls-CoxDAoki.js → urls-nr2hUK75.js} +11 -11
- package/dist/{urls-CoxDAoki.js.map → urls-nr2hUK75.js.map} +1 -1
- package/package.json +5 -5
- package/dist/isValidDomain-BxyToAlh.cjs.map +0 -1
- package/dist/isValidDomain-CTw5vZFY.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidDomain-CHKOn79-.js","names":["ccTldMap","sldMap"],"sources":["../src/predicates/is/isURL.ts","../../build-tools/dist/formatter-Bd8fVs2h.js","../src/predicates/is/_private/data/domain/sldMap.json","../src/predicates/is/_private/data/domain/ccTldMap.json","../src/predicates/is/isValidDomain.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isURL`.***\n * ----------------------------------------------------------\n * **Checks if a value is an instance of the\n * **[`URL`](https://developer.mozilla.org/docs/Web/API/URL)** class.**\n * - **Behavior:**\n * - Narrows type to `URL` when true.\n * - Excludes `strings`, `plain-objects`, and `other non-URL values`.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the value is an instance of `URL`, otherwise `false`.\n * @example\n * isURL(new URL(\"https://example.com\"));\n * // ➔ true\n * isURL(\"https://example.com\");\n * // ➔ false\n */\nexport const isURL = (value: unknown): value is URL => {\n return value instanceof URL;\n};\n","/*!\n* ========================================================================\n* @rzl-zone/build-tools\n* ------------------------------------------------------------------------\n* Version: `0.0.12`\n* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`\n* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`\n* ========================================================================\n*/\n\nimport pcr from \"picocolors\";\nfunction deepFreeze(value) {\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst stack = [value];\n\twhile (stack.length) {\n\t\tconst obj = stack.pop();\n\t\tif (seen.has(obj) || Object.isFrozen(obj)) continue;\n\t\tseen.add(obj);\n\t\tif (isMap(obj)) for (const [k, v] of obj) {\n\t\t\tif (typeof k === \"object\" && k !== null) stack.push(k);\n\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t}\n\t\telse if (isSet(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else if (isArray(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else {\n\t\t\tconst record = obj;\n\t\t\tfor (const key of Reflect.ownKeys(record)) {\n\t\t\t\tconst v = record[key];\n\t\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t\t}\n\t\t}\n\t\tObject.freeze(obj);\n\t}\n\treturn value;\n}\nconst isRegExp = (value) => {\n\treturn value instanceof RegExp;\n};\nconst isString = (value) => {\n\treturn typeof value === \"string\";\n};\nfunction isSet(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Set]\" || value instanceof Set;\n}\nfunction isMap(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Map]\" || value instanceof Map;\n}\nfunction isArray(value) {\n\treturn Array.isArray(value);\n}\nconst isNull = (val) => val === null;\nfunction isPlainObject(value) {\n\tif (!isObject(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\nfunction isObjectOrArray(value) {\n\treturn isArray(value) || isObject(value);\n}\nconst isNil = (value) => {\n\treturn value == null;\n};\nconst isBoolean = (value) => {\n\treturn typeof value === \"boolean\";\n};\nconst isUndefined = (value) => {\n\treturn typeof value === \"undefined\";\n};\nconst isFunction = (value) => {\n\treturn typeof value === \"function\";\n};\nconst isNumberObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Number]\";\n};\nconst isStringObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object String]\";\n};\nconst isBooleanObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Boolean]\";\n};\nconst isInfinityNumber = (value) => {\n\tif (typeof value === \"number\" || isNumberObject(value)) {\n\t\tconst num = Number(value);\n\t\treturn num === Infinity || num === -Infinity;\n\t}\n\treturn false;\n};\nconst isSymbol = (value) => {\n\treturn typeof value === \"symbol\";\n};\nconst isBigInt = (value) => {\n\treturn typeof value === \"bigint\";\n};\nconst isNaN = (value) => {\n\treturn typeof value === \"number\" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\nconst isNonEmptyString = (value, options = {}) => {\n\tif (!isString(value)) return false;\n\treturn (options.trim ?? true ? value.trim() : value).length > 0;\n};\nconst isNumber = (value, options = {}) => {\n\tconst includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;\n\tconst aNumber = typeof value === \"number\";\n\treturn includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\nconst isError = (error) => {\n\treturn Object.prototype.toString.call(error) === \"[object Error]\" || error instanceof Error;\n};\nconst isDate = (value, options = {}) => {\n\tconst skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;\n\tconst instanceDate = value instanceof Date;\n\tif (skipInvalidDate) return instanceDate;\n\treturn instanceDate && !isNaN(value.getTime());\n};\nconst safeStableStringify = (value, options = {}) => {\n\tconst pretty = options.pretty ?? false;\n\tconst sortKeys = options.sortKeys ?? true;\n\tconst sortArray = options.sortArray ?? false;\n\tconst keepUndefined = options.keepUndefined ?? false;\n\tif (isUndefined(value)) return keepUndefined ? \"undefined\" : \"null\";\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);\n\tconst deepProcess = (val) => {\n\t\tif (isNumberObject(val)) {\n\t\t\tconst valOf = val.valueOf();\n\t\t\treturn isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n\t\t}\n\t\tif (isStringObject(val)) return val.valueOf();\n\t\tif (isBooleanObject(val)) return val.valueOf();\n\t\tif (isFunction(val) || isSymbol(val)) return void 0;\n\t\tif (isBigInt(val)) return val.toString();\n\t\tif (isNaN(val) || isInfinityNumber(val)) return null;\n\t\tif (isUndefined(val)) return keepUndefined ? void 0 : null;\n\t\tif (isObjectOrArray(val)) {\n\t\t\tif (seen.has(val)) return \"[Circular]\";\n\t\t\tseen.add(val);\n\t\t\tif (isDate(val)) return val.toISOString();\n\t\t\tif (isMap(val)) return { map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)]) };\n\t\t\tif (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\t\t\tif (isArray(val)) {\n\t\t\t\tconst processedArr = val.map(deepProcess);\n\t\t\t\tif (sortArray) {\n\t\t\t\t\tconst primitives = [];\n\t\t\t\t\tconst nonPrimitives = [];\n\t\t\t\t\tfor (const item of processedArr) if (isPrimitive(item)) primitives.push(item);\n\t\t\t\t\telse nonPrimitives.push(item);\n\t\t\t\t\tprimitives.sort((a, b) => {\n\t\t\t\t\t\tif (isNumber(a) && isNumber(b)) return a - b;\n\t\t\t\t\t\treturn String(a).localeCompare(String(b));\n\t\t\t\t\t});\n\t\t\t\t\treturn [...primitives, ...nonPrimitives];\n\t\t\t\t}\n\t\t\t\treturn processedArr;\n\t\t\t}\n\t\t\tconst keys = Object.keys(val);\n\t\t\tif (sortKeys) keys.sort((a, b) => {\n\t\t\t\tconst na = Number(a);\n\t\t\t\tconst nb = Number(b);\n\t\t\t\tif (!isNaN(na) && !isNaN(nb)) return na - nb;\n\t\t\t\treturn a.localeCompare(b);\n\t\t\t});\n\t\t\tconst result = {};\n\t\t\tif (isObject(val)) for (const k of keys) {\n\t\t\t\tconst v = deepProcess(val[k]);\n\t\t\t\tif (!isUndefined(v)) result[k] = v;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn val;\n\t};\n\ttry {\n\t\treturn JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n\t} catch (err) {\n\t\tconsole.warn(\"Error in safeStableStringify:\", err);\n\t\treturn \"{}\";\n\t}\n};\nconst normalizeSpaces = (value, options = {\n\twithTrim: true,\n\ttrimOnly: false\n}) => {\n\tif (!isNonEmptyString(value)) return \"\";\n\tif (!isPlainObject(options)) options = {};\n\tconst { trimOnly = false, withTrim = true } = options;\n\tif (trimOnly) return value.trim();\n\tif (withTrim) value = value.trim();\n\treturn value.replace(/\\s+/g, \" \");\n};\nconst isStringArray = (v) => isArray(v) && v.every((i) => isString(i));\nconst isStringSet = (v) => isSet(v) && [...v].every((i) => isString(i));\nconst assertValidatePatternArgs = (v, parameterKey = \"pattern\") => {\n\tif (!isString(v) && !isStringArray(v) && !isStringSet(v)) throw new TypeError(`The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`);\n};\nconst flattenStrings = (input) => {\n\treturn input.flat(Infinity).filter((v) => typeof v === \"string\");\n};\nconst toStringSet = (pattern, options = {}) => {\n\tconst { withValidationType = true, parameterKey = \"pattern\" } = options;\n\tif (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\treturn toObjectSet(pattern);\n};\nconst toObjectSet = (value) => {\n\tif (isSet(value)) return value;\n\treturn new Set(isArray(value) ? value : [value]);\n};\nconst toArray = (value) => {\n\treturn isArray(value) ? value : [value];\n};\nconst hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);\nconst getRuntimeRequire = () => {\n\tif (!hasGlobalRequire(globalThis)) return void 0;\n\treturn globalThis.require;\n};\nconst __runtimeRequire = ((x) => {\n\tconst r = getRuntimeRequire();\n\tif (r) return r;\n\tif (typeof Proxy !== \"undefined\") return new Proxy(x, { get(target, prop) {\n\t\tconst r2 = getRuntimeRequire();\n\t\treturn r2 ? r2[prop] : target[prop];\n\t} });\n\treturn x;\n})(function(id) {\n\tconst r = getRuntimeRequire();\n\tif (r) return r.call(this, id);\n\tthrow new Error(`Calling \\`require\\` for \"${id}\" in an environment that doesn't expose the \\`require\\` function.`);\n});\nconst picocolors = pcr;\nconst NEWLINE = atob(\"Cg==\");\nconst EOL = hasGlobalRequire(globalThis) ? __runtimeRequire(\"node:os\").EOL : NEWLINE;\nfunction plural(count, word, pluralWord) {\n\tif (count === 1) return word;\n\treturn pluralWord ?? `${word}s`;\n}\nfunction padText(value, options = {}) {\n\tconst { start = true, end = true, padOnInvalid = true } = options;\n\tif (!isNonEmptyString(value)) return padOnInvalid ? \" \" : \"\";\n\treturn `${start ? \" \" : \"\"}${value}${end ? \" \" : \"\"}`;\n}\nfunction joinInline(...text) {\n\treturn text.filter(Boolean).join(\" \");\n}\nfunction joinLines(...text) {\n\treturn text.filter(Boolean).join(EOL);\n}\nfunction joinLinesLoose(...text) {\n\treturn text.filter((v) => v !== false && v !== null && v !== void 0).join(EOL);\n}\nfunction formatOptionValue(value, options) {\n\tconst { pretty = false, indent = 2, sortKeys = false, sortArray = false } = options ?? {};\n\tconst indentUnit = \" \".repeat(indent);\n\tfunction formatRecursive(input, depth = 0) {\n\t\tconst currentIndent = indentUnit.repeat(depth);\n\t\tconst nextIndent = indentUnit.repeat(depth + 1);\n\t\tconst joinInline = picocolors.dim(\", \");\n\t\tconst joinPretty = `,${EOL}`;\n\t\tif (isSet(input)) return formatRecursive([...input], depth);\n\t\tif (isMap(input)) return formatRecursive(Object.fromEntries(input), depth);\n\t\tif (isArray(input)) {\n\t\t\tconst arr = sortArray ? [...input].sort() : input;\n\t\t\tif (arr.length === 0) return picocolors.gray(\"[]\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst items = arr.map((v) => formatRecursive(v, depth)).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"[\") + items + picocolors.gray(\"]\");\n\t\t\t}\n\t\t\tconst items = arr.map((v) => nextIndent + formatRecursive(v, depth + 1)).join(joinPretty);\n\t\t\treturn picocolors.gray(`[${EOL}`) + items + EOL + currentIndent + picocolors.gray(\"]\");\n\t\t}\n\t\tif (isPlainObject(input)) {\n\t\t\tlet entries = Object.entries(input);\n\t\t\tif (sortKeys) entries = entries.sort(([a], [b]) => a.localeCompare(b));\n\t\t\tif (entries.length === 0) return picocolors.gray(\"{}\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\t\treturn picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth);\n\t\t\t\t}).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"{ \") + props + picocolors.gray(\" }\");\n\t\t\t}\n\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\treturn nextIndent + picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth + 1);\n\t\t\t}).join(joinPretty);\n\t\t\treturn picocolors.gray(`{${EOL}`) + props + EOL + currentIndent + picocolors.gray(\"}\");\n\t\t}\n\t\tif (isRegExp(input)) return picocolors.greenBright(\"/\") + picocolors.redBright(input.source) + picocolors.greenBright(\"/\") + picocolors.magentaBright(input.flags);\n\t\tif (isString(input)) return picocolors.gray(`\"${input}\"`);\n\t\tif (isNumber(input, { includeNaN: true })) return picocolors.redBright(String(input));\n\t\tif (isBoolean(input)) return picocolors.redBright(String(input));\n\t\tif (isNil(input)) return picocolors.redBright(String(input));\n\t\tif (isObject(input)) return picocolors.cyanBright(Object.prototype.toString.call(input));\n\t\treturn picocolors.cyanBright(String(input));\n\t}\n\treturn formatRecursive(value);\n}\nexport { isString as C, toArray as D, safeStableStringify as E, toObjectSet as O, isSet as S, normalizeSpaces as T, isNonEmptyString as _, joinLines as a, isPlainObject as b, picocolors as c, flattenStrings as d, isArray as f, isNil as g, isFunction as h, joinInline as i, toStringSet as k, plural as l, isError as m, NEWLINE as n, joinLinesLoose as o, isBoolean as p, formatOptionValue as r, padText as s, EOL as t, deepFreeze as u, isNull as v, isUndefined as w, isRegExp as x, isNumber as y };\n//# sourceMappingURL=formatter-Bd8fVs2h.js.map\n","","","import { joinLines, EOL } from \"@rzl-zone/build-tools/utils\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport sldMap from \"./_private/data/domain/sldMap.json\";\nimport ccTldMap from \"./_private/data/domain/ccTldMap.json\";\n\nimport { isString } from \"./isString\";\nimport { isBoolean } from \"./isBoolean\";\n\nimport { getPreciseType } from \"../type/getPreciseType\";\n\n/** ---------------------------------------------------------\n * * ***Options for `isValidDomain` predicate.***\n * ---------------------------------------------------------\n * **Customize the behavior of domain validation.**\n */\ntype IsValidDomainOptions = {\n /** * ***Enable conversion of Unicode domains (IDN) to ASCII (punycode).***\n *\n * - Example: `\"пример.рф\"` ➔ `\"xn--e1afmkfd.xn--p1ai\"`\n * - Allows validating Unicode domains correctly.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowUnicode?: boolean;\n\n /** * ***If `true`, validates **only top-level domains (TLDs)** that are not part of any SLD/second-level domain.***\n *\n * - Accepts country-code TLDs like `\"ai\"` or `\"ai.\"` ✅\n * - Rejects common TLDs that are part of SLDs like `\"com\"` ❌\n * - Only the final label is checked; subdomains are ignored.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n topLevel?: boolean;\n\n /** * ***Allow or disallow subdomains.***\n *\n * - Example: `\"sub.example.com\"` ✅ if `subdomain` is `true`, ❌ if `false`\n * - Wildcards and SLDs are considered when evaluating subdomains.\n * - Default: `true`\n *\n * @defaultValue `true`.\n */\n subdomain?: boolean;\n\n /** * ***Allow a wildcard `*` in the left-most label.***\n *\n * - Example: `\"*.example.com\"` ✅ if `wildcard` is `true`, ❌ if `false`\n * - Wildcards are only valid in the first label and require at least one additional label.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n wildcard?: boolean;\n\n /** * ***Allow a port after the domain.***\n *\n * - Example: `\"localhost:3000\"` or `\"example.com:8080\"` ✅ if `allowPort` is `true`\n * - Validates that the port is a number between `1` and `65535`.\n * - Does not affect domain validation rules otherwise.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowPort?: boolean;\n\n /** * ***Allow special domains like `localhost`.***\n *\n * - Example: `\"localhost\"` ✅ if `allowLocalhost` is `true`\n * - Works with or without a port if `allowPort` is enabled.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowLocalhost?: boolean;\n\n /** * ***Allow URLs with protocol (`http`/`https`) and automatically extract the hostname.***\n *\n * - Example: `\"https://example.com/foo/bar\"` ➔ `\"example.com\"`\n * - The function will validate only the hostname part and ignore the path, query, and fragment.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowProtocol?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Predicate: `isValidDomain`.***\n * ---------------------------------------------------------\n * **Validates whether a given string is a properly formatted domain name.**\n *\n * - **Supports options for:**\n * - `allowUnicode` ➔ allows internationalized domain names (IDN) with Unicode characters.\n * - `topLevel` ➔ validates **only top-level domains (TLDs)**; ignores subdomains and SLDs.\n * - `subdomain` ➔ allows or disallows subdomains.\n * - `wildcard` ➔ allows wildcard (`*`) in the left-most label.\n * - `allowPort` ➔ allows a port number after the domain (e.g., `example.com:8080`).\n * - `allowLocalhost` ➔ allows the special domain `\"localhost\"`.\n * - `allowProtocol` ➔ allows a URL with protocol (`http`/`https`) and extracts the hostname.\n *\n * - **Behavior:**\n * - ✅ Converts Unicode to ASCII (punycode) if `allowUnicode` is `true`.\n * - ✅ Checks label lengths (≤63 chars), valid characters, and punycode consistency.\n * - ✅ Validates port if `allowPort` is `true` (must be 1–65535).\n * - ✅ Accepts `\"localhost\"` if `allowLocalhost` is `true`.\n * - ✅ Extracts hostname from URLs if `allowProtocol` is `true`.\n * - ❌ Rejects invalid domains, labels starting/ending with `-`, double dots, malformed TLDs, or invalid port numbers.\n * - ✅ Handles both standard domains (example.com), URLs with protocols (https://example.com/foo), and IDNs (пример.рф).\n *\n * @param {*} value - The value to validate; only strings are valid domains.\n * @param {IsValidDomainOptions} [options] - Optional configuration for domain validation.\n * @param {boolean} [options.allowUnicode=false] - Enable punycode conversion for Unicode domains.\n * @param {boolean} [options.topLevel=false] - Validate only TLDs (e.g., `ai`, `uk.`); ignores SLDs like `com`.\n * @param {boolean} [options.subdomain=true] - Allow subdomains; set `false` to reject any subdomain.\n * @param {boolean} [options.wildcard=false] - Allow wildcard `*` in the left-most label (e.g., `*.example.com`).\n * @param {boolean} [options.allowPort=false] - Allow port number after domain (e.g., `:3000`); must be 1–65535.\n * @param {boolean} [options.allowLocalhost=false] - Allow special domain `\"localhost\"`.\n * @param {boolean} [options.allowProtocol=false] - Allow URLs with protocol (`http`/`https`) and extract hostname only.\n * @returns {boolean} Returns `true` if the value is a valid domain according to the rules and options; otherwise `false`.\n *\n * @example\n * isValidDomain(\"google.com\");\n * // ➔ true\n * isValidDomain(\"пример.рф\", { allowUnicode: true });\n * // ➔ true\n * isValidDomain(\"sub.example.com\", { subdomain: false });\n * // ➔ false\n * isValidDomain(\"*.example.com\", { wildcard: true });\n * // ➔ true\n * isValidDomain(\"com\", { topLevel: true });\n * // ➔ false (common TLD rejected because it's part of SLD)\n * isValidDomain(\"ai.\", { topLevel: true });\n * // ➔ true (country-code TLD accepted)\n * isValidDomain(\"localhost\", { allowLocalhost: true });\n * // ➔ true\n * isValidDomain(\"localhost:3000\", { allowLocalhost: true, allowPort: true });\n * // ➔ true\n * isValidDomain(\"example.com:8080\", { allowPort: true });\n * // ➔ true\n * isValidDomain(\"https://example.com/foo/bar\", { allowProtocol: true });\n * // ➔ true (protocol stripped and hostname validated)\n * isValidDomain(\"invalid_domain.com\");\n * // ➔ false\n */\nexport function isValidDomain(\n value: unknown,\n options: IsValidDomainOptions = {}\n): boolean {\n if (!isString(value)) return false;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const {\n subdomain = true,\n topLevel = false,\n wildcard = false,\n allowUnicode = false,\n allowPort = false,\n allowLocalhost = false,\n allowProtocol = false\n } = options;\n\n // Validate Options:\n const invalid = Object.entries({\n subdomain,\n topLevel,\n wildcard,\n allowUnicode,\n allowProtocol,\n allowPort,\n allowLocalhost\n }).filter(([, value]) => !isBoolean(value));\n\n if (invalid.length) {\n const msg = invalid\n .map(([key, value], i) => {\n return joinLines(\n ` ${i + 1}. option: \"${key}\"`,\n \" expected: boolean\",\n ` received: ${getPreciseType(value)} (${safeStableStringify(\n value,\n {\n keepUndefined: true\n }\n )})`\n );\n })\n .join(EOL);\n\n throw new TypeError(\n joinLines(\n \"\",\n \"> Invalid options detected in second parameter of `isValidDomain`:\",\n msg\n )\n );\n }\n // -----------------\n\n let _value = value.toLowerCase();\n\n if (allowProtocol) {\n try {\n const url = new URL(value); // use original input\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return false; // reject non-http(s)\n if (!allowPort && url.port) return false; // reject port if allowPort=false\n _value = url.hostname.toLowerCase(); // extract only hostname\n\n // wildcard check\n const labels = _value.split(\".\");\n if (labels[0] === \"*\" && !wildcard) return false;\n } catch {\n // if parsing fails, leave _value unchanged\n }\n }\n\n if (value.endsWith(\".\")) {\n _value = _value.slice(0, _value.length - 1);\n }\n\n // Handle port\n let port: string;\n if (allowPort) {\n const portMatch = _value.match(/:(\\d{1,5})$/);\n if (portMatch) {\n port = portMatch[0];\n _value = _value.slice(0, -port.length);\n const portNum = Number(portMatch[1]);\n if (portNum < 1 || portNum > 65535) return false;\n }\n }\n\n // Allow localhost\n if (allowLocalhost && _value === \"localhost\") return true;\n\n if (allowUnicode) {\n try {\n _value = punycodeUtilsJS.toASCII(_value);\n } catch {\n return false;\n }\n }\n\n if (_value.length > 253) return false;\n\n const validChars = /^([\\u0E00-\\u0E7Fa-z0-9-._*]+)$/g;\n if (!validChars.test(_value)) return false;\n\n if (topLevel) {\n if (ccTldMap[_value.replace(/\\.$/, \"\") as keyof typeof ccTldMap]) {\n return true;\n }\n }\n\n const sldRegex = /(.*)\\.(([\\u0E00-\\u0E7Fa-z0-9]+)(\\.[a-z0-9]+))/;\n const matches = _value.match(sldRegex);\n // eslint-disable-next-line no-useless-assignment\n let tld: string | null = null;\n let labels: string[] | null = null;\n\n if (matches && matches.length > 2) {\n if (sldMap[matches[2] as keyof typeof sldMap]) {\n // eslint-disable-next-line no-useless-assignment\n tld = matches[2] || null;\n labels = matches[1]?.split(\".\") || null;\n }\n }\n\n if (!labels) {\n labels = _value.split(\".\");\n if (labels.length <= 1) return false;\n\n tld = labels.pop()!;\n const tldRegex = /^(?:xn--)?(?!^\\d+$)[\\u0E00-\\u0E7Fa-z0-9]+$/gi;\n if (!tldRegex.test(tld)) return false;\n }\n\n if (subdomain === false && labels.length > 1) return false;\n\n return labels.every((label, index) => {\n if (wildcard && index === 0 && label === \"*\" && labels.length > 1) {\n return true;\n }\n\n let validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-_]+)$/g;\n if (index === labels.length - 1) {\n validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-]+)$/g;\n }\n\n const doubleDashCount = (label.match(/--(--)?/g) || []).length;\n const xnDashCount = (label.match(/xn--/g) || []).length;\n if (index === labels.length - 1 && doubleDashCount !== xnDashCount) {\n return false;\n }\n\n return (\n validLabelChars.test(label) &&\n label.length < 64 &&\n !label.startsWith(\"-\") &&\n !label.endsWith(\"-\")\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,UAAiC;CACrD,OAAO,iBAAiB;;;;;;;;;;;;;;ACiC1B,SAAS,QAAQ,OAAO;CACvB,OAAO,MAAM,QAAQ,MAAM;;AAQ5B,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,CAAC,MAAM,MAAM,IAAI,CAAC,QAAQ,MAAM;;AAKrE,MAAM,SAAS,UAAU;CACxB,OAAO,SAAS;;AAQjB,MAAM,cAAc,UAAU;CAC7B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,UAAU,KAAK,UAAU,OAAO,OAAO,SAAS,GAC9D,OAAO;EAGT,IAAI,kBAAkB;EACtB,IAAI,UAAU,OAAO,SAAS,GAC5B,kBAAkB;EAGpB,MAAM,mBAAmB,MAAM,MAAM,WAAW,IAAI,EAAE,EAAE;EACxD,MAAM,eAAe,MAAM,MAAM,QAAQ,IAAI,EAAE,EAAE;EACjD,IAAI,UAAU,OAAO,SAAS,KAAK,oBAAoB,aACrD,OAAO;EAGT,OACE,gBAAgB,KAAK,MAAM,IAC3B,MAAM,SAAS,MACf,CAAC,MAAM,WAAW,IAAI,IACtB,CAAC,MAAM,SAAS,IAAI;GAEtB"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
const noop = () => {};
|
|
11
11
|
export { noop as t };
|
|
12
|
-
//# sourceMappingURL=noop-
|
|
12
|
+
//# sourceMappingURL=noop-BaNz9ls5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop-
|
|
1
|
+
{"version":3,"file":"noop-BaNz9ls5.js","names":[],"sources":["../src/generators/utils/noop.ts"],"sourcesContent":["/**\n * --------------------------------------------------\n * * ***Utility: `noop`.***\n * --------------------------------------------------\n * **A no-operation function that performs no action.**\n *\n * @description\n * Commonly used as a **placeholder**, **default callback**, or **stub function**.\n *\n * - **Behavior**:\n * - Does not return any meaningful value (`void`).\n * - Safely callable in any context without side effects.\n *\n * @remarks\n * Although this function returns `void`, it implicitly results in `undefined`,\n * but the return value should never be relied upon.\n *\n * @example\n * **1. Basic usage** — does nothing and returns undefined implicitly:\n * ```\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * noop(); // ➔ no effect (void)\n * ```\n * @example\n * **2. Using with type-checking helpers:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n * import { isFunction, isUndefined } from \"@rzl-zone/utils-js/predicates\";\n *\n * isFunction(noop); // ➔ true — `noop` is a function\n * isUndefined(noop()); // ➔ true — calling `noop()` returns `undefined`\n * isFunction(noop()); // ➔ false — the return value is `undefined`, not a function\n * ```\n * @example\n * **3. As a default callback:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * const callback = noop;\n * callback(); // ➔ no effect (void)\n * ```\n */\nexport const noop = (): void => {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,aAAmB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
@@ -15,4 +15,4 @@ Object.defineProperty(exports, 'noop', {
|
|
|
15
15
|
return noop;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
//# sourceMappingURL=noop-
|
|
18
|
+
//# sourceMappingURL=noop-D4g9yTAW.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop-
|
|
1
|
+
{"version":3,"file":"noop-D4g9yTAW.cjs","names":[],"sources":["../src/generators/utils/noop.ts"],"sourcesContent":["/**\n * --------------------------------------------------\n * * ***Utility: `noop`.***\n * --------------------------------------------------\n * **A no-operation function that performs no action.**\n *\n * @description\n * Commonly used as a **placeholder**, **default callback**, or **stub function**.\n *\n * - **Behavior**:\n * - Does not return any meaningful value (`void`).\n * - Safely callable in any context without side effects.\n *\n * @remarks\n * Although this function returns `void`, it implicitly results in `undefined`,\n * but the return value should never be relied upon.\n *\n * @example\n * **1. Basic usage** — does nothing and returns undefined implicitly:\n * ```\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * noop(); // ➔ no effect (void)\n * ```\n * @example\n * **2. Using with type-checking helpers:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n * import { isFunction, isUndefined } from \"@rzl-zone/utils-js/predicates\";\n *\n * isFunction(noop); // ➔ true — `noop` is a function\n * isUndefined(noop()); // ➔ true — calling `noop()` returns `undefined`\n * isFunction(noop()); // ➔ false — the return value is `undefined`, not a function\n * ```\n * @example\n * **3. As a default callback:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * const callback = noop;\n * callback(); // ➔ no effect (void)\n * ```\n */\nexport const noop = (): void => {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,aAAmB"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
import { A as isPlainObject, y as isNonEmptyString } from "./assertIsBoolean-
|
|
10
|
+
import { A as isPlainObject, y as isNonEmptyString } from "./assertIsBoolean-9-huIcIR.js";
|
|
11
11
|
const normalizeSpaces = (value, options = {
|
|
12
12
|
withTrim: true,
|
|
13
13
|
trimOnly: false
|
|
@@ -20,4 +20,4 @@ const normalizeSpaces = (value, options = {
|
|
|
20
20
|
return value.replace(/\s+/g, " ");
|
|
21
21
|
};
|
|
22
22
|
export { normalizeSpaces as t };
|
|
23
|
-
//# sourceMappingURL=normalizeSpaces-
|
|
23
|
+
//# sourceMappingURL=normalizeSpaces-DupusmF5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeSpaces-
|
|
1
|
+
{"version":3,"file":"normalizeSpaces-DupusmF5.js","names":[],"sources":["../src/strings/sanitizations/normalizeSpaces.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype NormalizeSpacesOptions = {\n /** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.\n *\n * @default false\n */\n trimOnly?: boolean;\n /** If `false`, skips trimming value, defaultValue: `true`.\n *\n * @default true\n */\n withTrim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `normalizeSpaces`.***\n * ----------------------------------------------------------\n * **Normalizes whitespace in a string by reducing multiple spaces\n * to a single space, optionally trims, or only trims based on options.**\n * - **Behavior:**\n * - Collapses all consecutive whitespace (spaces, tabs, newlines) into a single space.\n * - Can trim leading/trailing spaces (default behavior), or preserve them with `withTrim: false`.\n * - Can skip normalization entirely and only trim using `trimOnly: true`.\n * - Returns an empty string if input is `null` or `undefined`.\n * @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.\n * @param {NormalizeSpacesOptions} [options] - Configuration options.\n * @param {NormalizeSpacesOptions[\"trimOnly\"]} [options.trimOnly=false] - If `true`, skips normalization and only trims the string.\n * @param {NormalizeSpacesOptions[\"withTrim\"]} [options.withTrim=true] - If `false`, preserves leading/trailing whitespace.\n * @returns {string} The processed string.\n * @example\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \");\n * // ➔ \"Hello World this is ok\"\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \", { trimOnly: true });\n * // ➔ \"Hello World\tthis is\\n\\nok\"\n * normalizeSpaces(\" Hello World \", { withTrim: false });\n * // ➔ \" Hello World \"\n * normalizeSpaces(null);\n * // ➔ \"\"\n */\nexport const normalizeSpaces = (\n value: string | null | undefined,\n options: NormalizeSpacesOptions = {\n withTrim: true,\n trimOnly: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const { trimOnly = false, withTrim = true } = options;\n\n if (trimOnly) return value.trim();\n\n if (withTrim) {\n value = value.trim();\n }\n\n // Remove all duplicate spaces (including tabs, newlines, etc.)\n return value.replace(/\\s+/g, \" \");\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,mBACX,OACA,UAAkC;CAChC,UAAU;CACV,UAAU;CACX,KACU;CACX,IAAI,CAAC,iBAAiB,MAAM,EAAE,OAAO;CAErC,IAAI,CAAC,cAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,EAAE,WAAW,OAAO,WAAW,SAAS;CAE9C,IAAI,UAAU,OAAO,MAAM,MAAM;CAEjC,IAAI,UACF,QAAQ,MAAM,MAAM;CAItB,OAAO,MAAM,QAAQ,QAAQ,IAAI"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
|
-
const require_assertIsBoolean = require('./assertIsBoolean-
|
|
11
|
+
const require_assertIsBoolean = require('./assertIsBoolean-JGpkg5ju.cjs');
|
|
12
12
|
const normalizeSpaces = (value, options = {
|
|
13
13
|
withTrim: true,
|
|
14
14
|
trimOnly: false
|
|
@@ -26,4 +26,4 @@ Object.defineProperty(exports, 'normalizeSpaces', {
|
|
|
26
26
|
return normalizeSpaces;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
//# sourceMappingURL=normalizeSpaces-
|
|
29
|
+
//# sourceMappingURL=normalizeSpaces-MWiYtSyS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeSpaces-
|
|
1
|
+
{"version":3,"file":"normalizeSpaces-MWiYtSyS.cjs","names":["isNonEmptyString","isPlainObject"],"sources":["../src/strings/sanitizations/normalizeSpaces.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype NormalizeSpacesOptions = {\n /** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.\n *\n * @default false\n */\n trimOnly?: boolean;\n /** If `false`, skips trimming value, defaultValue: `true`.\n *\n * @default true\n */\n withTrim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `normalizeSpaces`.***\n * ----------------------------------------------------------\n * **Normalizes whitespace in a string by reducing multiple spaces\n * to a single space, optionally trims, or only trims based on options.**\n * - **Behavior:**\n * - Collapses all consecutive whitespace (spaces, tabs, newlines) into a single space.\n * - Can trim leading/trailing spaces (default behavior), or preserve them with `withTrim: false`.\n * - Can skip normalization entirely and only trim using `trimOnly: true`.\n * - Returns an empty string if input is `null` or `undefined`.\n * @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.\n * @param {NormalizeSpacesOptions} [options] - Configuration options.\n * @param {NormalizeSpacesOptions[\"trimOnly\"]} [options.trimOnly=false] - If `true`, skips normalization and only trims the string.\n * @param {NormalizeSpacesOptions[\"withTrim\"]} [options.withTrim=true] - If `false`, preserves leading/trailing whitespace.\n * @returns {string} The processed string.\n * @example\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \");\n * // ➔ \"Hello World this is ok\"\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \", { trimOnly: true });\n * // ➔ \"Hello World\tthis is\\n\\nok\"\n * normalizeSpaces(\" Hello World \", { withTrim: false });\n * // ➔ \" Hello World \"\n * normalizeSpaces(null);\n * // ➔ \"\"\n */\nexport const normalizeSpaces = (\n value: string | null | undefined,\n options: NormalizeSpacesOptions = {\n withTrim: true,\n trimOnly: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const { trimOnly = false, withTrim = true } = options;\n\n if (trimOnly) return value.trim();\n\n if (withTrim) {\n value = value.trim();\n }\n\n // Remove all duplicate spaces (including tabs, newlines, etc.)\n return value.replace(/\\s+/g, \" \");\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,mBACX,OACA,UAAkC;CAChC,UAAU;CACV,UAAU;CACX,KACU;CACX,IAAI,CAACA,yCAAiB,MAAM,EAAE,OAAO;CAErC,IAAI,CAACC,sCAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,EAAE,WAAW,OAAO,WAAW,SAAS;CAE9C,IAAI,UAAU,OAAO,MAAM,MAAM;CAEjC,IAAI,UACF,QAAQ,MAAM,MAAM;CAItB,OAAO,MAAM,QAAQ,QAAQ,IAAI"}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
12
|
-
const require_assertIsBoolean = require('../assertIsBoolean-
|
|
13
|
-
const require_assertIsArray = require('../assertIsArray-
|
|
14
|
-
const require_isEmptyObject = require('../isEmptyObject-
|
|
15
|
-
const require_safeStableStringify = require('../safeStableStringify-
|
|
16
|
-
const require_isEqual = require('../isEqual-
|
|
17
|
-
const require_safeJsonParse = require('../safeJsonParse-
|
|
12
|
+
const require_assertIsBoolean = require('../assertIsBoolean-JGpkg5ju.cjs');
|
|
13
|
+
const require_assertIsArray = require('../assertIsArray-BgdgVjDu.cjs');
|
|
14
|
+
const require_isEmptyObject = require('../isEmptyObject-D-fETD_f.cjs');
|
|
15
|
+
const require_safeStableStringify = require('../safeStableStringify-BiUOLBYo.cjs');
|
|
16
|
+
const require_isEqual = require('../isEqual-CZxetLzm.cjs');
|
|
17
|
+
const require_safeJsonParse = require('../safeJsonParse-v7ll9iFG.cjs');
|
|
18
18
|
const findDuplicates = (values) => {
|
|
19
19
|
require_assertIsArray.assertIsArray(values, { message: ({ currentType, validType }) => `First parameter (\`values\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.` });
|
|
20
20
|
const duplicates = [];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
package/dist/operations/index.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
import { A as isPlainObject, D as isNaN, M as isArray, S as isUndefined, p as isNonEmptyArray, x as isObjectOrArray } from "../assertIsBoolean-
|
|
11
|
-
import { t as assertIsArray } from "../assertIsArray-
|
|
12
|
-
import { n as isEmptyArray } from "../isEmptyObject-
|
|
13
|
-
import { t as safeStableStringify } from "../safeStableStringify-
|
|
14
|
-
import { t as isEqual } from "../isEqual-
|
|
15
|
-
import { t as safeJsonParse } from "../safeJsonParse-
|
|
10
|
+
import { A as isPlainObject, D as isNaN, M as isArray, S as isUndefined, p as isNonEmptyArray, x as isObjectOrArray } from "../assertIsBoolean-9-huIcIR.js";
|
|
11
|
+
import { t as assertIsArray } from "../assertIsArray-hZyYKvLb.js";
|
|
12
|
+
import { n as isEmptyArray } from "../isEmptyObject-CZsFdN7x.js";
|
|
13
|
+
import { t as safeStableStringify } from "../safeStableStringify-C5Gc3ZED.js";
|
|
14
|
+
import { t as isEqual } from "../isEqual-Dc8fNB2J.js";
|
|
15
|
+
import { t as safeJsonParse } from "../safeJsonParse-BxOZgGy7.js";
|
|
16
16
|
const findDuplicates = (values) => {
|
|
17
17
|
assertIsArray(values, { message: ({ currentType, validType }) => `First parameter (\`values\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.` });
|
|
18
18
|
const duplicates = [];
|
package/dist/parsers/index.cjs
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
12
|
-
const require_parsers = require('../parsers-
|
|
12
|
+
const require_parsers = require('../parsers-Bd-YRt6j.cjs');
|
|
13
13
|
exports.extractFileName = require_parsers.extractFileName;
|
package/dist/parsers/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
package/dist/parsers/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
package/dist/parsers/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
import { t as extractFileName } from "../parsers-
|
|
10
|
+
import { t as extractFileName } from "../parsers-Dl9fFra4.js";
|
|
11
11
|
export { extractFileName };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
|
-
const require_assertIsBoolean = require('./assertIsBoolean-
|
|
12
|
-
const require_punyCode = require('./punyCode-
|
|
11
|
+
const require_assertIsBoolean = require('./assertIsBoolean-JGpkg5ju.cjs');
|
|
12
|
+
const require_punyCode = require('./punyCode-5wmummgP.cjs');
|
|
13
13
|
const EXTENSIONS_FILE = new Set([
|
|
14
14
|
"txt",
|
|
15
15
|
"md",
|
|
@@ -646,4 +646,4 @@ Object.defineProperty(exports, 'extractFileName', {
|
|
|
646
646
|
return extractFileName;
|
|
647
647
|
}
|
|
648
648
|
});
|
|
649
|
-
//# sourceMappingURL=parsers-
|
|
649
|
+
//# sourceMappingURL=parsers-Bd-YRt6j.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers-DEFpCYhw.cjs","names":["isNonEmptyString","punycodeUtilsJS"],"sources":["../src/parsers/_private/extensions.ts","../src/parsers/extractFileName.ts"],"sourcesContent":["// ==========================\n// Single extensions\n// ==========================\nexport const EXTENSIONS_FILE = new Set([\n // 📄 Text & Document\n \"txt\",\n \"md\",\n \"rtf\",\n \"tex\",\n \"doc\",\n \"docx\",\n \"odt\",\n \"ott\",\n \"pdf\",\n \"djvu\",\n \"epub\",\n \"fb2\",\n \"lit\",\n \"lrf\",\n \"xls\",\n \"xlsx\",\n \"ods\",\n \"csv\",\n \"tsv\",\n \"ppt\",\n \"pptx\",\n \"pps\",\n \"bib\",\n \"cba\",\n \"cbt\",\n \"cbz\",\n \"cbr\",\n \"opds\",\n \"fodt\",\n \"pages\",\n \"rtfd\",\n \"sxc\",\n \"sxw\",\n \"wpd\",\n \"xps\",\n \"dotx\",\n \"dotm\",\n \"xltx\",\n \"xltm\",\n \"sldx\",\n \"sldm\",\n \"fods\",\n \"mdx\",\n \"markdown\",\n \"texi\",\n \"textile\",\n\n // 🖼️ Image\n \"jpg\",\n \"jpeg\",\n \"png\",\n \"gif\",\n \"bmp\",\n \"tif\",\n \"tiff\",\n \"webp\",\n \"svg\",\n \"ico\",\n \"heif\",\n \"heic\",\n \"raw\",\n \"cr2\",\n \"nef\",\n \"orf\",\n \"sr2\",\n \"dng\",\n \"dds\",\n \"psd\",\n \"exr\",\n \"xcf\",\n \"ai\",\n \"eps\",\n \"cdr\",\n \"indd\",\n \"pcx\",\n \"pgm\",\n \"ppm\",\n \"pbm\",\n \"pnm\",\n \"jfif\",\n \"ras\",\n \"tga\",\n \"j2k\",\n \"jp2\",\n \"emf\",\n \"wmf\",\n \"hdp\",\n \"mdi\",\n \"hevc\",\n\n // 🎵 Audio\n \"mp3\",\n \"wav\",\n \"ogg\",\n \"flac\",\n \"aac\",\n \"m4a\",\n \"wma\",\n \"alac\",\n \"aiff\",\n \"aif\",\n \"amr\",\n \"mid\",\n \"midi\",\n \"opus\",\n \"au\",\n \"caf\",\n \"ape\",\n \"mka\",\n \"spx\",\n \"ra\",\n \"ram\",\n \"mpc\",\n \"wv\",\n \"aifc\",\n \"mod\",\n \"it\",\n \"s3m\",\n \"xm\",\n \"kar\",\n \"m4b\",\n \"voc\",\n \"snd\",\n \"a52\",\n \"ac3\",\n \"dts\",\n\n // 🎥 Video\n \"mp4\",\n \"mkv\",\n \"avi\",\n \"mov\",\n \"wmv\",\n \"webm\",\n \"mpeg\",\n \"mpg\",\n \"3gp\",\n \"3g2\",\n \"m4v\",\n \"ts\",\n \"mts\",\n \"asf\",\n \"rm\",\n \"rmvb\",\n \"vob\",\n \"f4v\",\n \"ogv\",\n \"m2ts\",\n \"dav\",\n \"mxf\",\n \"mjpeg\",\n \"flv\",\n \"divx\",\n \"f4a\",\n \"f4p\",\n \"m2v\",\n \"ogm\",\n \"vp8\",\n \"vp9\",\n \"xvid\",\n \"yuv\",\n \"mng\",\n \"dv\",\n \"m1v\",\n \"roq\",\n \"m2t\",\n \"av1\",\n \"hevc\",\n \"m3u\",\n \"m3u8\",\n\n // 🗃️ Archive & Compression\n \"zip\",\n \"rar\",\n \"7z\",\n \"tar\",\n \"gz\",\n \"bz\",\n \"bz2\",\n \"xz\",\n \"tgz\",\n \"tbz2\",\n \"txz\",\n \"lz\",\n \"lzma\",\n \"z\",\n \"cab\",\n \"arj\",\n \"ace\",\n \"rpm\",\n \"deb\",\n \"pkg\",\n \"apk\",\n \"jar\",\n \"war\",\n \"ear\",\n \"sit\",\n \"sitx\",\n \"cpgz\",\n \"tlz\",\n \"tlzma\",\n \"tzo\",\n \"cpio\",\n \"shar\",\n \"bzip\",\n \"gzip\",\n \"7zip\",\n \"rar5\",\n \"tbz\",\n \"txz\",\n\n // 💾 Disk Image\n \"iso\",\n \"img\",\n \"vhd\",\n \"vmdk\",\n \"qcow2\",\n \"vhdx\",\n \"bin\",\n \"cue\",\n \"nrg\",\n \"daa\",\n \"sdi\",\n \"vfd\",\n \"ima\",\n \"dmg\",\n \"vdi\",\n \"toast\",\n \"ccd\",\n \"mdf\",\n \"cdi\",\n \"bif\",\n \"bifc\",\n \"bifd\",\n\n // 🗃️ Database & Data\n \"sql\",\n \"db\",\n \"dbf\",\n \"mdb\",\n \"accdb\",\n \"json\",\n \"toml\",\n \"ini\",\n \"log\",\n \"plist\",\n \"pkl\",\n \"msgpack\",\n \"h5\",\n \"hdf5\",\n \"parquet\",\n \"avro\",\n \"orc\",\n \"ndjson\",\n \"pdb\",\n \"sqlite\",\n \"sqlite3\",\n \"dbx\",\n \"sdf\",\n \"nc\",\n \"netcdf\",\n \"grib\",\n \"geojson\",\n \"gml\",\n \"hjson\",\n \"cdb\",\n \"db3\",\n \"dta\",\n \"sav\",\n \"sas7bdat\",\n \"ldif\",\n \"fdb\",\n \"gdb\",\n \"sqlite2\",\n \"h5ad\",\n \"nc4\",\n \"xmind\",\n \"drawio\",\n \"sdc\",\n \"jsonl\",\n \"yaml\",\n \"yml\",\n \"toml\",\n\n // 💻 Code & Script\n \"js\",\n \"jsx\",\n \"ts\",\n \"tsx\",\n \"c\",\n \"cpp\",\n \"net\",\n \"h\",\n \"hpp\",\n \"java\",\n \"py\",\n \"rb\",\n \"go\",\n \"rs\",\n \"php\",\n \"pl\",\n \"sh\",\n \"bat\",\n \"cmd\",\n \"ps1\",\n \"lua\",\n \"swift\",\n \"kt\",\n \"scala\",\n \"cs\",\n \"vb\",\n \"dart\",\n \"m\",\n \"r\",\n \"jl\",\n \"fs\",\n \"vbproj\",\n \"sln\",\n \"pri\",\n \"gemspec\",\n \"gradle\",\n \"coffee\",\n \"erl\",\n \"ex\",\n \"exs\",\n \"hs\",\n \"lisp\",\n \"clj\",\n \"groovy\",\n \"scm\",\n \"vbs\",\n \"nim\",\n \"rkt\",\n \"ml\",\n \"mli\",\n \"fsx\",\n \"psm1\",\n \"cbl\",\n \"for\",\n \"f90\",\n \"lock\",\n \"tsconfig\",\n \"vue\",\n \"svelte\",\n \"cjs\",\n \"mjs\",\n \"mts\",\n \"cts\",\n \"json5\",\n \"es6\",\n \"module\",\n \"systemjs\",\n\n // 🌐 Web & Config\n \"html\",\n \"htm\",\n \"xhtml\",\n \"css\",\n \"scss\",\n \"sass\",\n \"less\",\n \"xml\",\n \"xlf\",\n \"po\",\n \"pot\",\n \"jsp\",\n \"asp\",\n \"aspx\",\n \"jspf\",\n \"cgi\",\n \"cfm\",\n \"env\",\n \"babelrc\",\n \"cfg\",\n \"config\",\n \"conf\",\n \"editorconfig\",\n \"eslintrc\",\n \"gitconfig\",\n \"gitattributes\",\n \"gitignore\",\n \"prettierrc\",\n \"webmanifest\",\n \"dockerfile\",\n // \".dockerfile\",\n\n // 🔠 Font\n \"ttf\",\n \"otf\",\n \"woff\",\n \"woff2\",\n \"eot\",\n \"dfont\",\n \"pfa\",\n \"pfb\",\n \"fon\",\n \"fnt\",\n \"bdf\",\n \"ps\",\n\n // 🗺️ CAD & GIS\n \"dwg\",\n \"dxf\",\n \"shp\",\n \"kml\",\n \"kmz\",\n \"gpx\",\n \"stl\",\n \"step\",\n \"iges\",\n \"igs\",\n \"3ds\",\n \"3dm\",\n \"fbx\",\n \"obj\",\n \"dae\",\n \"ifc\",\n\n // 🔧 System / Binary / Execution\n \"exe\",\n \"msi\",\n \"run\",\n \"com\",\n \"app\",\n \"elf\",\n \"dll\",\n \"so\",\n \"dylib\",\n \"sys\",\n \"scr\",\n \"bin\",\n \"out\",\n\n // 🔐 Certificates / Crypto\n \"pem\",\n \"crt\",\n \"cer\",\n \"der\",\n \"csr\",\n \"p12\",\n \"pfx\",\n \"jks\",\n \"asc\",\n \"gpg\",\n \"pgp\",\n \"p7b\",\n \"p7c\",\n \"spc\",\n \"key\",\n \"pub\",\n \"cert\",\n \"p7m\",\n\n // 🎮 Games & Projects\n \"nes\",\n \"sfc\",\n \"gba\",\n \"nds\",\n \"rom\",\n \"pak\",\n \"vpk\",\n \"bik\",\n \"cso\",\n \"wad\",\n \"wadx\",\n \"smc\",\n \"gb\",\n \"gbc\",\n\n // 🔬 Bioinformatics\n \"fasta\",\n \"fa\",\n \"fas\",\n \"ffn\",\n \"faa\",\n \"fna\",\n \"frn\",\n \"fastq\",\n \"fq\",\n \"bam\",\n \"bed\",\n \"sam\",\n \"vcf\",\n \"gff\",\n \"gff3\",\n \"gtf\",\n \"fai\",\n \"tbi\",\n \"fast5\",\n \"fqz\",\n \"fq5\"\n]);\n\n// ==========================\n// Double extensions\n// ==========================\nexport const DOUBLE_EXTENSIONS_FILE = new Set([\n \"log.gz\",\n \"tar.gz\",\n \"tar.bz2\",\n \"tar.bz\",\n \"tar.xz\",\n \"tar.lz\",\n \"tar.lzma\",\n \"tar.Z\",\n \"tar.zst\",\n \"tar.lz4\",\n \"log.gz\",\n \"sql.gz\",\n \"csv.gz\",\n \"tsv.gz\",\n \"json.gz\",\n \"ndjson.gz\",\n \"fq.gz\",\n \"sam.gz\",\n \"fasta.gz\",\n \"fa.gz\",\n \"ffn.gz\",\n \"faa.gz\",\n \"fna.gz\",\n \"frn.gz\",\n \"fastq.gz\",\n \"js.map\",\n \"css.map\"\n]);\n\n// ==========================\n// Special filenames\n// ==========================\nexport const SPECIAL_FILENAMES = new Set([\n \"Makefile\",\n \"Dockerfile\",\n \".dockerignore\",\n \".npmrc\",\n \".envrc\",\n \".htgroup\",\n \".eslintignore\",\n \".env.test\",\n \".env.local\",\n \".env.production\",\n \".env.development\",\n \".env.example\",\n \".dockerfile\",\n \".htaccess\",\n \".htpasswd\",\n \".babelrc\",\n \".eslintrc\",\n \".editorconfig\",\n \".prettierignore\",\n \"docker-compose.override.yml\",\n \"docker-compose.yml\",\n \"Vagrantfile\",\n \"Procfile\",\n \"Gemfile\",\n \"Rakefile\",\n \"package.json\",\n \"package-lock.json\",\n \"yarn.lock\",\n \"pnpm-lock.yaml\",\n \"tsconfig.json\",\n \"webpack.config.js\",\n \"vite.config.js\",\n \"vite.config.ts\",\n \"Gruntfile.js\",\n \"gulpfile.js\",\n \"babel.config.js\",\n \"babel.js\",\n \"rollup.js\",\n\n // SPECIAL PRESERVE NAME\n \"CON\",\n \"NUL\",\n \"PRN\",\n \"AUX\",\n \"COM1\",\n \"COM2\",\n \"COM3\",\n \"COM4\",\n \"COM5\",\n \"COM6\",\n \"COM7\",\n \"COM8\",\n \"COM9\",\n \"LPT1\",\n \"LPT2\",\n \"LPT3\",\n \"LPT4\",\n \"LPT5\",\n \"LPT6\",\n \"LPT7\",\n \"LPT8\",\n \"LPT9\"\n]);\n","import { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\nimport {\n DOUBLE_EXTENSIONS_FILE,\n EXTENSIONS_FILE,\n SPECIAL_FILENAMES\n} from \"./_private/extensions\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\nexport type ExtractFileNameOptions = {\n /** ----------------------------------------------------------\n * * ***Indicates whether the input should be treated as a potential domain string.***\n * ----------------------------------------------------------\n *\n * - Behavior when `true`:\n * - The `domainName` option is required and must be a string and non-empty string.\n * If `domainName` is `undefined`, `null`, or an empty string, a `TypeError` will be thrown.\n * - The `domainName` is used to determine if the input is a domain-only string.\n * - Returns `null` if the input exactly matches `domainName` or any of its subdomains **and** has no additional path or filename.\n * - If the input does not match `domainName` or its subdomains, it will be processed as a regular file-like name.\n * - Supports **Unicode/IDN domains** (e.g., `tést-ドメイン.com`) and **ASCII filenames**, mixed safely.\n *\n * @default false\n */\n domainAware?: boolean;\n\n /** ----------------------------------------------------------\n * * ***The base domain name used for comparison (e.g., `\"example.com\"`).***\n * ----------------------------------------------------------\n *\n * - Required when `domainAware` is `true`.\n * - Helps differentiate between a domain-only input (ignored) and a standalone file-like string (processed normally).\n * - Must be a string and non-empty string. Invalid values (`undefined`, `null`, or empty string) will trigger a `TypeError`.\n * - Works with both **ASCII domains** and **Unicode/IDN domains**.\n * - Example:\n * ```ts *\n * // ASCII domain + ASCII filename\n * extractFileName(\"resume.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ \"resume\"\n * extractFileName(\"example.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ null (because input is treated as domain-name)\n *\n * // Unicode domain + ASCII filename\n * extractFileName(\"tést-ドメイン.com/file.txt\", {\n * domainAware: true,\n * domainName: \"ドメイン.com\"\n * });\n * // ➔ \"file\"\n *\n * // Unicode domain + Unicode filename\n * extractFileName(\"tést-ドメイン.com/ファイル名.pdf\", {\n * domainAware: true,\n * domainName: \"ドメイン.com\"\n * });\n * // ➔ \"ファイル名\"\n *\n * // Invalid domainName, will throw TypeError\n * extractFileName(\"resume.com\", {\n * domainAware: true,\n * domainName: \"\"\n * });\n * // ➔ TypeError\n * ```\n *\n * @default undefined\n */\n domainName?: string;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `extractFileName`.***\n * ----------------------------------------------------------\n *\n * **Extracts the **clean base filename** from nearly any input string, including URLs, local file paths,\n * UNC paths, and plain filenames.**\n *\n * - It automatically safely handles extracts the **base file name** (without extension) from:\n * - File system paths (Windows, Unix, UNC)\n * - Protocols like http, https, ftp, file, mailto, or custom schemes\n * - Percent-encoded, Unicode, and emoji characters\n * - Dotfiles, reserved OS names, multi-part extensions\n * - Data URIs\n * - Optional domain-aware mode to ignore domain-only inputs\n * - Plain filenames\n *\n * - Full support for:\n * - Unicode, emoji, percent-encoding\n * - Dotfiles (e.g., `.env`, `.gitignore`)\n * - Reserved/OS-protected filenames:\n * `CON`, `PRN`, `AUX`, `NUL`, `COM1`–`COM9`, `LPT1`–`LPT9`\n * - Known multi-part extensions:\n * `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.lz`, `.tar.zst`, `.min.js`, `.js.map`, `.log.gz`, `.sql.gz`,\n * `.backup.tar`, etc.\n * - Data URIs (`data:[mime];base64,...` ➔ payload string)\n * - Domain-aware mode (optional)\n *\n * ----------------------------------------------------------\n * - **Behavior / Features**\n * - Strips **known extensions**, including multi-part and common double/triple extensions.\n * - Leaves unknown/custom extensions intact.\n * - Preserves **dotfiles** as-is (leading dot preserved).\n * - Returns `null` if:\n * - input is `null`, `undefined`, or not a string\n * - input is empty, whitespace-only, or only slashes\n * - input represents a folder path (trailing slash/backslash, drive/folder only)\n * - input is a **domain-only string** in domain-aware mode\n * - Normalizes Windows-style backslashes (`\\`) internally as `/`.\n * - Supports UNC paths, mixed slashes, and Windows drive letters safely.\n * - Handles URLs:\n * - Ignores query strings (`?v=1.2.3`) and hash fragments (`#section`)\n * - Decodes percent-encoded filenames (`my%20file.txt` ➔ `my file.txt`)\n * - Supports protocol-relative URLs (`//cdn.example.com/file.jpg`)\n * - Supports uncommon/custom protocols (`ftp://`, `file://`, `mailto:`, etc.)\n * - Handles **multiple dots**, **trailing dots**, **triple or more extensions**\n * - Supports filenames on mixed Unicode/ASCII domains:\n * - Domain names can include Unicode characters (IDN / punycode)\n * - Filenames may contain ASCII, Unicode, and emoji characters\n * - Works correctly when domain is Unicode and filename is ASCII, or vice versa\n * - Supports extremely long filenames safely (up to OS limits)\n * - Domain-aware mode (`domainAware: true` + `domainName`):\n * - Parameter `domainName` must be a string and non-empty string; otherwise a TypeError is thrown.\n * - Returns `null` if input equals `domainName` or any subdomain with no file path\n * - Extracts filename normally if path/file exists on domain or other domain\n * - Safe in Node.js and browsers\n *\n * ----------------------------------------------------------\n * @param {string | null | undefined} input\n * URL, file path, or plain filename to extract from.\n *\n * @param {ExtractFileNameOptions} [options]\n * Optional configuration:\n * - `domainAware?: boolean` – treat input as a domain string. Requires `domainName` to be a string and non-empty string; otherwise, a TypeError is thrown.\n * - `domainName?: string` – base domain for comparison eg (`example.com`), required when `domainAware` is true.\n *\n * @returns {string | null}\n * - Base filename without known extensions\n * - Original filename if extension unknown\n * - `null` for invalid inputs, folder paths, or domain-only strings\n *\n * ----------------------------------------------------------\n * @example\n * ```ts\n * // Basic files\n * extractFileName(\"document.pdf\"); // ➔ \"document\"\n * extractFileName(\"/files/archive.tar.gz\"); // ➔ \"archive\"\n * extractFileName(\"C:\\\\path\\\\file.txt\"); // ➔ \"file\"\n * extractFileName(\".env\"); // ➔ \".env\"\n * extractFileName(\"folder/\"); // ➔ null\n *\n * // Not a file\n * extractFileName(\"not-file\"); // ➔ null\n * extractFileName(\"not-file/\"); // ➔ null\n * extractFileName(\"/not-file/\"); // ➔ null\n * extractFileName(\"/not-file\"); // ➔ null\n *\n * // URLs with queries, hashes, protocols\n * extractFileName(\"https://example.com/file.txt?ver=1\"); // ➔ \"file\"\n * extractFileName(\"https://example.com/archive.tar.gz#part\"); // ➔ \"archive\"\n * extractFileName(\"//cdn.example.com/image.png\"); // ➔ \"image\"\n *\n *\n * // Special protocol handling\n * extractFileName(\"tel:+6212345678\"); // ➔ \"+6212345678\"\n * extractFileName(\"sms:+6212345678\"); // ➔ \"+6212345678\"\n * extractFileName(\"mailto:user@domain.com\"); // ➔ \"user@domain\"\n * extractFileName(\"data:text/plain;base64,SGVsbG8=\"); // ➔ \"SGVsbG8=\"\n * extractFileName(\"mailto:resume.com\"); // ➔ \"resume\"\n * extractFileName(\"ftp://example.com/image.jpeg\"); // ➔ \"image\"\n * extractFileName(\"ftp://files.example.com/app.min.js\"); // ➔ \"app.min\"\n * extractFileName(\"file:///C:/path/to/document.pdf\"); // ➔ \"document\"\n * extractFileName(\"custom-scheme://example.com/video.mp4\"); // ➔ \"video\"\n *\n * // Unicode & emoji\n * extractFileName(\"emoji-😊.png\"); // ➔ \"emoji-😊\"\n * extractFileName(\"🔥project.tar.gz\"); // ➔ \"🔥project\"\n *\n * // Dotfiles\n * extractFileName(\".gitignore\"); // ➔ \".gitignore\"\n * extractFileName(\"/path/.bashrc\"); // ➔ \".bashrc\"\n *\n * // Mixed Unicode domain and ASCII filename\n * extractFileName(\"https://tést-ドメイン.com/file.txt\"); // ➔ \"file\"\n * extractFileName(\"https://example.com/ファイル名.pdf\"); // ➔ \"ファイル名\"\n * extractFileName(\"https://ドメイン例.com/emoji-🔥.png\"); // ➔ \"emoji-🔥\"\n *\n * // Reserved filenames\n * extractFileName(\"CON\"); // ➔ \"CON\"\n * extractFileName(\"NUL.txt\"); // ➔ \"NUL\"\n *\n * // Domain-aware mode\n * extractFileName(\"example.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ null\n * extractFileName(\"cdn.example.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ null\n * extractFileName(\"resume.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ \"resume\"\n * extractFileName(\"https://example.com/file.txt\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ \"file\"\n *\n * // Windows & UNC paths\n * extractFileName(\"C:\\\\Users\\\\rzl\\\\Documents\\\\file.txt\"); // ➔ \"file\"\n * extractFileName(\"\\\\\\\\SERVER\\\\share\\\\logs\\\\output.log\"); // ➔ \"output\"\n * extractFileName(\"C:/Users\\\\rzl/mix\\\\test.pdf\"); // ➔ \"test\"\n *\n * // Edge / extreme cases\n * extractFileName(\"https://example.com/my%20file%20name.txt\"); // ➔ \"my file name\"\n * extractFileName(\"app.min.js.map\"); // ➔ \"app.min\"\n * extractFileName(\"backup.tar.bak\"); // ➔ \"backup.tar.bak\" (unknown double extension)\n * extractFileName(\"filename.\"); // ➔ \"filename.\"\n * extractFileName(\"a\".repeat(255) + \".txt\"); // ➔ \"a\".repeat(255)\n * ```\n *\n * ----------------------------------------------------------\n * @note\n * - Robust: never throws, handles unusual inputs safely.\n * - Suitable for display, logging, or safe storage.\n * - Normalizes slashes consistently.\n * - Covers nearly all real-world filename, URL, path, data URI, and domain scenarios.\n * - Handles Windows UNC paths, mixed slashes, percent-encoded, Unicode/emoji filenames.\n * - Known multi-part extensions list can be extended without breaking functionality.\n */\nexport const extractFileName = (\n input?: string | null,\n options: ExtractFileNameOptions = {}\n): string | null => {\n if (!isNonEmptyString(input)) return null;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const { domainName, domainAware = false } = options;\n\n assertIsBoolean(domainAware, {\n message: ({ currentType, validType }) =>\n `Parameter \\`domainAware\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n let pathname = input.trim();\n\n // Normalize Windows backslashes\n pathname = pathname.replace(/\\\\/g, \"/\");\n\n // domain-aware mode\n if (domainAware) {\n if (!isNonEmptyString(domainName)) {\n throw new TypeError(\n \"If parameter `domainAware` is set to `true`, the option parameter `domainName` is required as string, and cant be an empty-string.\"\n );\n }\n\n const cleanDomain = punycodeUtilsJS\n .toASCII(domainName)\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/^www\\./, \"\")\n .replace(/\\/.*$/, \"\")\n .toLowerCase();\n\n const inputDomain = punycodeUtilsJS\n .toASCII(input)\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/^www\\./, \"\")\n .toLowerCase();\n\n const inputHost = inputDomain.split(\"/\")[0]?.split(/[?#]/)[0];\n const matchesDomain =\n inputHost === cleanDomain || inputHost?.endsWith(`.${cleanDomain}`);\n const hasPath = /\\/[^/]+$/.test(inputDomain);\n\n if (matchesDomain && !hasPath) return null;\n }\n\n // handle special protocol-like strings\n const protocolMatch = pathname.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.+)$/);\n if (protocolMatch) {\n const scheme = protocolMatch[1]?.toLowerCase() || \"\";\n const rest = protocolMatch[2];\n\n if ([\"tel\", \"sms\"].some((sch) => sch.startsWith(scheme))) {\n const clean = rest?.split(\"?\")[0]?.split(\"#\")[0];\n return clean?.trim() || null;\n } else if (scheme === \"mailto\") {\n const parts = rest?.split(\"/\");\n let last = parts?.[parts.length - 1];\n last = last?.split(\"?\")[0]?.split(\"#\")[0]; // strip query/hash\n const dotIndex = last?.lastIndexOf(\".\");\n if (dotIndex && dotIndex > 0) last = last?.slice(0, dotIndex);\n return last || null;\n } else if (scheme === \"data\") {\n const commaIndex = rest?.indexOf(\",\") || -1;\n if (commaIndex === -1) return null;\n let payload = rest?.slice(commaIndex + 1);\n payload = payload?.split?.(\"?\")[0]?.split(\"#\")[0]; // strip query/hash\n return payload?.trim() || null;\n }\n }\n\n if (/^[a-z][a-z\\d+\\-.]*:\\/{3,}/i.test(pathname)) {\n // eg https:///file.txt (has more than 2 slash after : protocol)\n pathname = pathname.replace(/^[a-z][a-z\\d+\\-.]*:\\/{2,}/i, \"\");\n } else {\n try {\n const isProbablyUrl = /^[a-z][a-z\\d+\\-.]*:(\\/\\/)?/i.test(pathname);\n\n pathname = isProbablyUrl\n ? new URL(pathname).pathname\n : new URL(`http://localhost/${pathname}`).pathname;\n } catch {\n // Fallback for weird URLs like 'https:///file.txt'\n // Remove protocol + any number of slashes\n pathname = pathname.replace(/^[a-z][a-z\\d+\\-.]*:(\\/\\/)?/i, \"\");\n }\n }\n\n // split into non-empty segments\n const segments = pathname.split(\"/\").filter(Boolean);\n\n if (segments.length === 0) return null;\n\n // Take the last segment as candidate filename\n let lastSegment =\n segments[segments.length - 1]?.split(\"?\")[0]?.split(\"#\")[0] || \"\";\n // Strip trailing ? or # that is alone\n lastSegment = lastSegment?.replace(/[?#]+$/, \"\");\n if (!lastSegment) return null;\n\n // Replace encoded slashes and dots\n lastSegment = lastSegment\n .replace(/%2F/gi, \"/\")\n .replace(/%5C/gi, \"\\\\\")\n .replace(/%2E/gi, \".\");\n\n // If replacement introduces new slashes, take the new last segment\n if (lastSegment.includes(\"/\")) {\n const parts = lastSegment.split(\"/\").filter(Boolean);\n lastSegment = parts[parts.length - 1] || \"\";\n }\n\n let filename = decodeURIComponent(lastSegment);\n\n if (!filename) return null;\n\n // Special filenames always returned as-is (even if trailing slash)\n if (SPECIAL_FILENAMES.has(filename)) return filename;\n\n // Dotfiles like \".env\" should be returned as-is (single leading dot, no other dot)\n if (/^\\.[^.\\s][^/]*$/.test(filename)) return filename;\n\n // If the original pathname ends with \"/\" and the last segment doesn't look like a file\n // const originalEndsWithSlash = pathname.endsWith(\"/\");\n if (!filename.includes(\".\")) return null;\n\n // Strip double extensions first\n const sortedDouble = [...DOUBLE_EXTENSIONS_FILE].sort(\n (a, b) => b.length - a.length\n );\n for (const ext of sortedDouble) {\n const dotExt = `.${ext.toLowerCase()}`;\n if (filename.toLowerCase().endsWith(dotExt)) {\n filename = filename.slice(0, filename.length - dotExt.length);\n break;\n }\n }\n\n // Strip single extensions\n const sortedSingle = [...EXTENSIONS_FILE].sort((a, b) => b.length - a.length);\n for (const ext of sortedSingle) {\n const dotExt = `.${ext.toLowerCase()}`;\n if (filename.toLowerCase().endsWith(dotExt)) {\n filename = filename.slice(0, filename.length - dotExt.length);\n break;\n }\n }\n\n return filename || null;\n};\n"],"mappings":";;;;;;;;;;;;;;AAGA,MAAa,kBAAkB,IAAI,IAAI;CAErC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAKF,MAAa,yBAAyB,IAAI,IAAI;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAKF,MAAa,oBAAoB,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnWF,MAAa,mBACX,OACA,UAAkC,EAAE,KAClB;CAClB,IAAI,CAACA,yCAAiB,MAAM,EAAE,OAAO;CAErC,4CAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,MACnG,CAAC;CAEF,MAAM,EAAE,YAAY,cAAc,U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EAAE,SAAS,EAAE,OACxB;CACD,KAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,SAAS,IAAI,IAAI,aAAa;EACpC,IAAI,SAAS,aAAa,CAAC,SAAS,OAAO,EAAE;GAC3C,WAAW,SAAS,MAAM,GAAG,SAAS,SAAS,OAAO,OAAO;GAC7D;;;CAKJ,MAAM,eAAe,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO;CAC7E,KAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,SAAS,IAAI,IAAI,aAAa;EACpC,IAAI,SAAS,aAAa,CAAC,SAAS,OAAO,EAAE;GAC3C,WAAW,SAAS,MAAM,GAAG,SAAS,SAAS,OAAO,OAAO;GAC7D;;;CAIJ,OAAO,YAAY"}
|
|
1
|
+
{"version":3,"file":"parsers-Bd-YRt6j.cjs","names":["isNonEmptyString","punycodeUtilsJS"],"sources":["../src/parsers/_private/extensions.ts","../src/parsers/extractFileName.ts"],"sourcesContent":["// ==========================\n// Single extensions\n// ==========================\nexport const EXTENSIONS_FILE = new Set([\n // 📄 Text & Document\n \"txt\",\n \"md\",\n \"rtf\",\n \"tex\",\n \"doc\",\n \"docx\",\n \"odt\",\n \"ott\",\n \"pdf\",\n \"djvu\",\n \"epub\",\n \"fb2\",\n \"lit\",\n \"lrf\",\n \"xls\",\n \"xlsx\",\n \"ods\",\n \"csv\",\n \"tsv\",\n \"ppt\",\n \"pptx\",\n \"pps\",\n \"bib\",\n \"cba\",\n \"cbt\",\n \"cbz\",\n \"cbr\",\n \"opds\",\n \"fodt\",\n \"pages\",\n \"rtfd\",\n \"sxc\",\n \"sxw\",\n \"wpd\",\n \"xps\",\n \"dotx\",\n \"dotm\",\n \"xltx\",\n \"xltm\",\n \"sldx\",\n \"sldm\",\n \"fods\",\n \"mdx\",\n \"markdown\",\n \"texi\",\n \"textile\",\n\n // 🖼️ Image\n \"jpg\",\n \"jpeg\",\n \"png\",\n \"gif\",\n \"bmp\",\n \"tif\",\n \"tiff\",\n \"webp\",\n \"svg\",\n \"ico\",\n \"heif\",\n \"heic\",\n \"raw\",\n \"cr2\",\n \"nef\",\n \"orf\",\n \"sr2\",\n \"dng\",\n \"dds\",\n \"psd\",\n \"exr\",\n \"xcf\",\n \"ai\",\n \"eps\",\n \"cdr\",\n \"indd\",\n \"pcx\",\n \"pgm\",\n \"ppm\",\n \"pbm\",\n \"pnm\",\n \"jfif\",\n \"ras\",\n \"tga\",\n \"j2k\",\n \"jp2\",\n \"emf\",\n \"wmf\",\n \"hdp\",\n \"mdi\",\n \"hevc\",\n\n // 🎵 Audio\n \"mp3\",\n \"wav\",\n \"ogg\",\n \"flac\",\n \"aac\",\n \"m4a\",\n \"wma\",\n \"alac\",\n \"aiff\",\n \"aif\",\n \"amr\",\n \"mid\",\n \"midi\",\n \"opus\",\n \"au\",\n \"caf\",\n \"ape\",\n \"mka\",\n \"spx\",\n \"ra\",\n \"ram\",\n \"mpc\",\n \"wv\",\n \"aifc\",\n \"mod\",\n \"it\",\n \"s3m\",\n \"xm\",\n \"kar\",\n \"m4b\",\n \"voc\",\n \"snd\",\n \"a52\",\n \"ac3\",\n \"dts\",\n\n // 🎥 Video\n \"mp4\",\n \"mkv\",\n \"avi\",\n \"mov\",\n \"wmv\",\n \"webm\",\n \"mpeg\",\n \"mpg\",\n \"3gp\",\n \"3g2\",\n \"m4v\",\n \"ts\",\n \"mts\",\n \"asf\",\n \"rm\",\n \"rmvb\",\n \"vob\",\n \"f4v\",\n \"ogv\",\n \"m2ts\",\n \"dav\",\n \"mxf\",\n \"mjpeg\",\n \"flv\",\n \"divx\",\n \"f4a\",\n \"f4p\",\n \"m2v\",\n \"ogm\",\n \"vp8\",\n \"vp9\",\n \"xvid\",\n \"yuv\",\n \"mng\",\n \"dv\",\n \"m1v\",\n \"roq\",\n \"m2t\",\n \"av1\",\n \"hevc\",\n \"m3u\",\n \"m3u8\",\n\n // 🗃️ Archive & Compression\n \"zip\",\n \"rar\",\n \"7z\",\n \"tar\",\n \"gz\",\n \"bz\",\n \"bz2\",\n \"xz\",\n \"tgz\",\n \"tbz2\",\n \"txz\",\n \"lz\",\n \"lzma\",\n \"z\",\n \"cab\",\n \"arj\",\n \"ace\",\n \"rpm\",\n \"deb\",\n \"pkg\",\n \"apk\",\n \"jar\",\n \"war\",\n \"ear\",\n \"sit\",\n \"sitx\",\n \"cpgz\",\n \"tlz\",\n \"tlzma\",\n \"tzo\",\n \"cpio\",\n \"shar\",\n \"bzip\",\n \"gzip\",\n \"7zip\",\n \"rar5\",\n \"tbz\",\n \"txz\",\n\n // 💾 Disk Image\n \"iso\",\n \"img\",\n \"vhd\",\n \"vmdk\",\n \"qcow2\",\n \"vhdx\",\n \"bin\",\n \"cue\",\n \"nrg\",\n \"daa\",\n \"sdi\",\n \"vfd\",\n \"ima\",\n \"dmg\",\n \"vdi\",\n \"toast\",\n \"ccd\",\n \"mdf\",\n \"cdi\",\n \"bif\",\n \"bifc\",\n \"bifd\",\n\n // 🗃️ Database & Data\n \"sql\",\n \"db\",\n \"dbf\",\n \"mdb\",\n \"accdb\",\n \"json\",\n \"toml\",\n \"ini\",\n \"log\",\n \"plist\",\n \"pkl\",\n \"msgpack\",\n \"h5\",\n \"hdf5\",\n \"parquet\",\n \"avro\",\n \"orc\",\n \"ndjson\",\n \"pdb\",\n \"sqlite\",\n \"sqlite3\",\n \"dbx\",\n \"sdf\",\n \"nc\",\n \"netcdf\",\n \"grib\",\n \"geojson\",\n \"gml\",\n \"hjson\",\n \"cdb\",\n \"db3\",\n \"dta\",\n \"sav\",\n \"sas7bdat\",\n \"ldif\",\n \"fdb\",\n \"gdb\",\n \"sqlite2\",\n \"h5ad\",\n \"nc4\",\n \"xmind\",\n \"drawio\",\n \"sdc\",\n \"jsonl\",\n \"yaml\",\n \"yml\",\n \"toml\",\n\n // 💻 Code & Script\n \"js\",\n \"jsx\",\n \"ts\",\n \"tsx\",\n \"c\",\n \"cpp\",\n \"net\",\n \"h\",\n \"hpp\",\n \"java\",\n \"py\",\n \"rb\",\n \"go\",\n \"rs\",\n \"php\",\n \"pl\",\n \"sh\",\n \"bat\",\n \"cmd\",\n \"ps1\",\n \"lua\",\n \"swift\",\n \"kt\",\n \"scala\",\n \"cs\",\n \"vb\",\n \"dart\",\n \"m\",\n \"r\",\n \"jl\",\n \"fs\",\n \"vbproj\",\n \"sln\",\n \"pri\",\n \"gemspec\",\n \"gradle\",\n \"coffee\",\n \"erl\",\n \"ex\",\n \"exs\",\n \"hs\",\n \"lisp\",\n \"clj\",\n \"groovy\",\n \"scm\",\n \"vbs\",\n \"nim\",\n \"rkt\",\n \"ml\",\n \"mli\",\n \"fsx\",\n \"psm1\",\n \"cbl\",\n \"for\",\n \"f90\",\n \"lock\",\n \"tsconfig\",\n \"vue\",\n \"svelte\",\n \"cjs\",\n \"mjs\",\n \"mts\",\n \"cts\",\n \"json5\",\n \"es6\",\n \"module\",\n \"systemjs\",\n\n // 🌐 Web & Config\n \"html\",\n \"htm\",\n \"xhtml\",\n \"css\",\n \"scss\",\n \"sass\",\n \"less\",\n \"xml\",\n \"xlf\",\n \"po\",\n \"pot\",\n \"jsp\",\n \"asp\",\n \"aspx\",\n \"jspf\",\n \"cgi\",\n \"cfm\",\n \"env\",\n \"babelrc\",\n \"cfg\",\n \"config\",\n \"conf\",\n \"editorconfig\",\n \"eslintrc\",\n \"gitconfig\",\n \"gitattributes\",\n \"gitignore\",\n \"prettierrc\",\n \"webmanifest\",\n \"dockerfile\",\n // \".dockerfile\",\n\n // 🔠 Font\n \"ttf\",\n \"otf\",\n \"woff\",\n \"woff2\",\n \"eot\",\n \"dfont\",\n \"pfa\",\n \"pfb\",\n \"fon\",\n \"fnt\",\n \"bdf\",\n \"ps\",\n\n // 🗺️ CAD & GIS\n \"dwg\",\n \"dxf\",\n \"shp\",\n \"kml\",\n \"kmz\",\n \"gpx\",\n \"stl\",\n \"step\",\n \"iges\",\n \"igs\",\n \"3ds\",\n \"3dm\",\n \"fbx\",\n \"obj\",\n \"dae\",\n \"ifc\",\n\n // 🔧 System / Binary / Execution\n \"exe\",\n \"msi\",\n \"run\",\n \"com\",\n \"app\",\n \"elf\",\n \"dll\",\n \"so\",\n \"dylib\",\n \"sys\",\n \"scr\",\n \"bin\",\n \"out\",\n\n // 🔐 Certificates / Crypto\n \"pem\",\n \"crt\",\n \"cer\",\n \"der\",\n \"csr\",\n \"p12\",\n \"pfx\",\n \"jks\",\n \"asc\",\n \"gpg\",\n \"pgp\",\n \"p7b\",\n \"p7c\",\n \"spc\",\n \"key\",\n \"pub\",\n \"cert\",\n \"p7m\",\n\n // 🎮 Games & Projects\n \"nes\",\n \"sfc\",\n \"gba\",\n \"nds\",\n \"rom\",\n \"pak\",\n \"vpk\",\n \"bik\",\n \"cso\",\n \"wad\",\n \"wadx\",\n \"smc\",\n \"gb\",\n \"gbc\",\n\n // 🔬 Bioinformatics\n \"fasta\",\n \"fa\",\n \"fas\",\n \"ffn\",\n \"faa\",\n \"fna\",\n \"frn\",\n \"fastq\",\n \"fq\",\n \"bam\",\n \"bed\",\n \"sam\",\n \"vcf\",\n \"gff\",\n \"gff3\",\n \"gtf\",\n \"fai\",\n \"tbi\",\n \"fast5\",\n \"fqz\",\n \"fq5\"\n]);\n\n// ==========================\n// Double extensions\n// ==========================\nexport const DOUBLE_EXTENSIONS_FILE = new Set([\n \"log.gz\",\n \"tar.gz\",\n \"tar.bz2\",\n \"tar.bz\",\n \"tar.xz\",\n \"tar.lz\",\n \"tar.lzma\",\n \"tar.Z\",\n \"tar.zst\",\n \"tar.lz4\",\n \"log.gz\",\n \"sql.gz\",\n \"csv.gz\",\n \"tsv.gz\",\n \"json.gz\",\n \"ndjson.gz\",\n \"fq.gz\",\n \"sam.gz\",\n \"fasta.gz\",\n \"fa.gz\",\n \"ffn.gz\",\n \"faa.gz\",\n \"fna.gz\",\n \"frn.gz\",\n \"fastq.gz\",\n \"js.map\",\n \"css.map\"\n]);\n\n// ==========================\n// Special filenames\n// ==========================\nexport const SPECIAL_FILENAMES = new Set([\n \"Makefile\",\n \"Dockerfile\",\n \".dockerignore\",\n \".npmrc\",\n \".envrc\",\n \".htgroup\",\n \".eslintignore\",\n \".env.test\",\n \".env.local\",\n \".env.production\",\n \".env.development\",\n \".env.example\",\n \".dockerfile\",\n \".htaccess\",\n \".htpasswd\",\n \".babelrc\",\n \".eslintrc\",\n \".editorconfig\",\n \".prettierignore\",\n \"docker-compose.override.yml\",\n \"docker-compose.yml\",\n \"Vagrantfile\",\n \"Procfile\",\n \"Gemfile\",\n \"Rakefile\",\n \"package.json\",\n \"package-lock.json\",\n \"yarn.lock\",\n \"pnpm-lock.yaml\",\n \"tsconfig.json\",\n \"webpack.config.js\",\n \"vite.config.js\",\n \"vite.config.ts\",\n \"Gruntfile.js\",\n \"gulpfile.js\",\n \"babel.config.js\",\n \"babel.js\",\n \"rollup.js\",\n\n // SPECIAL PRESERVE NAME\n \"CON\",\n \"NUL\",\n \"PRN\",\n \"AUX\",\n \"COM1\",\n \"COM2\",\n \"COM3\",\n \"COM4\",\n \"COM5\",\n \"COM6\",\n \"COM7\",\n \"COM8\",\n \"COM9\",\n \"LPT1\",\n \"LPT2\",\n \"LPT3\",\n \"LPT4\",\n \"LPT5\",\n \"LPT6\",\n \"LPT7\",\n \"LPT8\",\n \"LPT9\"\n]);\n","import { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\nimport {\n DOUBLE_EXTENSIONS_FILE,\n EXTENSIONS_FILE,\n SPECIAL_FILENAMES\n} from \"./_private/extensions\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\nexport type ExtractFileNameOptions = {\n /** ----------------------------------------------------------\n * * ***Indicates whether the input should be treated as a potential domain string.***\n * ----------------------------------------------------------\n *\n * - Behavior when `true`:\n * - The `domainName` option is required and must be a string and non-empty string.\n * If `domainName` is `undefined`, `null`, or an empty string, a `TypeError` will be thrown.\n * - The `domainName` is used to determine if the input is a domain-only string.\n * - Returns `null` if the input exactly matches `domainName` or any of its subdomains **and** has no additional path or filename.\n * - If the input does not match `domainName` or its subdomains, it will be processed as a regular file-like name.\n * - Supports **Unicode/IDN domains** (e.g., `tést-ドメイン.com`) and **ASCII filenames**, mixed safely.\n *\n * @default false\n */\n domainAware?: boolean;\n\n /** ----------------------------------------------------------\n * * ***The base domain name used for comparison (e.g., `\"example.com\"`).***\n * ----------------------------------------------------------\n *\n * - Required when `domainAware` is `true`.\n * - Helps differentiate between a domain-only input (ignored) and a standalone file-like string (processed normally).\n * - Must be a string and non-empty string. Invalid values (`undefined`, `null`, or empty string) will trigger a `TypeError`.\n * - Works with both **ASCII domains** and **Unicode/IDN domains**.\n * - Example:\n * ```ts *\n * // ASCII domain + ASCII filename\n * extractFileName(\"resume.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ \"resume\"\n * extractFileName(\"example.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ null (because input is treated as domain-name)\n *\n * // Unicode domain + ASCII filename\n * extractFileName(\"tést-ドメイン.com/file.txt\", {\n * domainAware: true,\n * domainName: \"ドメイン.com\"\n * });\n * // ➔ \"file\"\n *\n * // Unicode domain + Unicode filename\n * extractFileName(\"tést-ドメイン.com/ファイル名.pdf\", {\n * domainAware: true,\n * domainName: \"ドメイン.com\"\n * });\n * // ➔ \"ファイル名\"\n *\n * // Invalid domainName, will throw TypeError\n * extractFileName(\"resume.com\", {\n * domainAware: true,\n * domainName: \"\"\n * });\n * // ➔ TypeError\n * ```\n *\n * @default undefined\n */\n domainName?: string;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `extractFileName`.***\n * ----------------------------------------------------------\n *\n * **Extracts the **clean base filename** from nearly any input string, including URLs, local file paths,\n * UNC paths, and plain filenames.**\n *\n * - It automatically safely handles extracts the **base file name** (without extension) from:\n * - File system paths (Windows, Unix, UNC)\n * - Protocols like http, https, ftp, file, mailto, or custom schemes\n * - Percent-encoded, Unicode, and emoji characters\n * - Dotfiles, reserved OS names, multi-part extensions\n * - Data URIs\n * - Optional domain-aware mode to ignore domain-only inputs\n * - Plain filenames\n *\n * - Full support for:\n * - Unicode, emoji, percent-encoding\n * - Dotfiles (e.g., `.env`, `.gitignore`)\n * - Reserved/OS-protected filenames:\n * `CON`, `PRN`, `AUX`, `NUL`, `COM1`–`COM9`, `LPT1`–`LPT9`\n * - Known multi-part extensions:\n * `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.lz`, `.tar.zst`, `.min.js`, `.js.map`, `.log.gz`, `.sql.gz`,\n * `.backup.tar`, etc.\n * - Data URIs (`data:[mime];base64,...` ➔ payload string)\n * - Domain-aware mode (optional)\n *\n * ----------------------------------------------------------\n * - **Behavior / Features**\n * - Strips **known extensions**, including multi-part and common double/triple extensions.\n * - Leaves unknown/custom extensions intact.\n * - Preserves **dotfiles** as-is (leading dot preserved).\n * - Returns `null` if:\n * - input is `null`, `undefined`, or not a string\n * - input is empty, whitespace-only, or only slashes\n * - input represents a folder path (trailing slash/backslash, drive/folder only)\n * - input is a **domain-only string** in domain-aware mode\n * - Normalizes Windows-style backslashes (`\\`) internally as `/`.\n * - Supports UNC paths, mixed slashes, and Windows drive letters safely.\n * - Handles URLs:\n * - Ignores query strings (`?v=1.2.3`) and hash fragments (`#section`)\n * - Decodes percent-encoded filenames (`my%20file.txt` ➔ `my file.txt`)\n * - Supports protocol-relative URLs (`//cdn.example.com/file.jpg`)\n * - Supports uncommon/custom protocols (`ftp://`, `file://`, `mailto:`, etc.)\n * - Handles **multiple dots**, **trailing dots**, **triple or more extensions**\n * - Supports filenames on mixed Unicode/ASCII domains:\n * - Domain names can include Unicode characters (IDN / punycode)\n * - Filenames may contain ASCII, Unicode, and emoji characters\n * - Works correctly when domain is Unicode and filename is ASCII, or vice versa\n * - Supports extremely long filenames safely (up to OS limits)\n * - Domain-aware mode (`domainAware: true` + `domainName`):\n * - Parameter `domainName` must be a string and non-empty string; otherwise a TypeError is thrown.\n * - Returns `null` if input equals `domainName` or any subdomain with no file path\n * - Extracts filename normally if path/file exists on domain or other domain\n * - Safe in Node.js and browsers\n *\n * ----------------------------------------------------------\n * @param {string | null | undefined} input\n * URL, file path, or plain filename to extract from.\n *\n * @param {ExtractFileNameOptions} [options]\n * Optional configuration:\n * - `domainAware?: boolean` – treat input as a domain string. Requires `domainName` to be a string and non-empty string; otherwise, a TypeError is thrown.\n * - `domainName?: string` – base domain for comparison eg (`example.com`), required when `domainAware` is true.\n *\n * @returns {string | null}\n * - Base filename without known extensions\n * - Original filename if extension unknown\n * - `null` for invalid inputs, folder paths, or domain-only strings\n *\n * ----------------------------------------------------------\n * @example\n * ```ts\n * // Basic files\n * extractFileName(\"document.pdf\"); // ➔ \"document\"\n * extractFileName(\"/files/archive.tar.gz\"); // ➔ \"archive\"\n * extractFileName(\"C:\\\\path\\\\file.txt\"); // ➔ \"file\"\n * extractFileName(\".env\"); // ➔ \".env\"\n * extractFileName(\"folder/\"); // ➔ null\n *\n * // Not a file\n * extractFileName(\"not-file\"); // ➔ null\n * extractFileName(\"not-file/\"); // ➔ null\n * extractFileName(\"/not-file/\"); // ➔ null\n * extractFileName(\"/not-file\"); // ➔ null\n *\n * // URLs with queries, hashes, protocols\n * extractFileName(\"https://example.com/file.txt?ver=1\"); // ➔ \"file\"\n * extractFileName(\"https://example.com/archive.tar.gz#part\"); // ➔ \"archive\"\n * extractFileName(\"//cdn.example.com/image.png\"); // ➔ \"image\"\n *\n *\n * // Special protocol handling\n * extractFileName(\"tel:+6212345678\"); // ➔ \"+6212345678\"\n * extractFileName(\"sms:+6212345678\"); // ➔ \"+6212345678\"\n * extractFileName(\"mailto:user@domain.com\"); // ➔ \"user@domain\"\n * extractFileName(\"data:text/plain;base64,SGVsbG8=\"); // ➔ \"SGVsbG8=\"\n * extractFileName(\"mailto:resume.com\"); // ➔ \"resume\"\n * extractFileName(\"ftp://example.com/image.jpeg\"); // ➔ \"image\"\n * extractFileName(\"ftp://files.example.com/app.min.js\"); // ➔ \"app.min\"\n * extractFileName(\"file:///C:/path/to/document.pdf\"); // ➔ \"document\"\n * extractFileName(\"custom-scheme://example.com/video.mp4\"); // ➔ \"video\"\n *\n * // Unicode & emoji\n * extractFileName(\"emoji-😊.png\"); // ➔ \"emoji-😊\"\n * extractFileName(\"🔥project.tar.gz\"); // ➔ \"🔥project\"\n *\n * // Dotfiles\n * extractFileName(\".gitignore\"); // ➔ \".gitignore\"\n * extractFileName(\"/path/.bashrc\"); // ➔ \".bashrc\"\n *\n * // Mixed Unicode domain and ASCII filename\n * extractFileName(\"https://tést-ドメイン.com/file.txt\"); // ➔ \"file\"\n * extractFileName(\"https://example.com/ファイル名.pdf\"); // ➔ \"ファイル名\"\n * extractFileName(\"https://ドメイン例.com/emoji-🔥.png\"); // ➔ \"emoji-🔥\"\n *\n * // Reserved filenames\n * extractFileName(\"CON\"); // ➔ \"CON\"\n * extractFileName(\"NUL.txt\"); // ➔ \"NUL\"\n *\n * // Domain-aware mode\n * extractFileName(\"example.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ null\n * extractFileName(\"cdn.example.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ null\n * extractFileName(\"resume.com\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ \"resume\"\n * extractFileName(\"https://example.com/file.txt\", {\n * domainAware: true,\n * domainName: \"example.com\"\n * });\n * // ➔ \"file\"\n *\n * // Windows & UNC paths\n * extractFileName(\"C:\\\\Users\\\\rzl\\\\Documents\\\\file.txt\"); // ➔ \"file\"\n * extractFileName(\"\\\\\\\\SERVER\\\\share\\\\logs\\\\output.log\"); // ➔ \"output\"\n * extractFileName(\"C:/Users\\\\rzl/mix\\\\test.pdf\"); // ➔ \"test\"\n *\n * // Edge / extreme cases\n * extractFileName(\"https://example.com/my%20file%20name.txt\"); // ➔ \"my file name\"\n * extractFileName(\"app.min.js.map\"); // ➔ \"app.min\"\n * extractFileName(\"backup.tar.bak\"); // ➔ \"backup.tar.bak\" (unknown double extension)\n * extractFileName(\"filename.\"); // ➔ \"filename.\"\n * extractFileName(\"a\".repeat(255) + \".txt\"); // ➔ \"a\".repeat(255)\n * ```\n *\n * ----------------------------------------------------------\n * @note\n * - Robust: never throws, handles unusual inputs safely.\n * - Suitable for display, logging, or safe storage.\n * - Normalizes slashes consistently.\n * - Covers nearly all real-world filename, URL, path, data URI, and domain scenarios.\n * - Handles Windows UNC paths, mixed slashes, percent-encoded, Unicode/emoji filenames.\n * - Known multi-part extensions list can be extended without breaking functionality.\n */\nexport const extractFileName = (\n input?: string | null,\n options: ExtractFileNameOptions = {}\n): string | null => {\n if (!isNonEmptyString(input)) return null;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const { domainName, domainAware = false } = options;\n\n assertIsBoolean(domainAware, {\n message: ({ currentType, validType }) =>\n `Parameter \\`domainAware\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n let pathname = input.trim();\n\n // Normalize Windows backslashes\n pathname = pathname.replace(/\\\\/g, \"/\");\n\n // domain-aware mode\n if (domainAware) {\n if (!isNonEmptyString(domainName)) {\n throw new TypeError(\n \"If parameter `domainAware` is set to `true`, the option parameter `domainName` is required as string, and cant be an empty-string.\"\n );\n }\n\n const cleanDomain = punycodeUtilsJS\n .toASCII(domainName)\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/^www\\./, \"\")\n .replace(/\\/.*$/, \"\")\n .toLowerCase();\n\n const inputDomain = punycodeUtilsJS\n .toASCII(input)\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/^www\\./, \"\")\n .toLowerCase();\n\n const inputHost = inputDomain.split(\"/\")[0]?.split(/[?#]/)[0];\n const matchesDomain =\n inputHost === cleanDomain || inputHost?.endsWith(`.${cleanDomain}`);\n const hasPath = /\\/[^/]+$/.test(inputDomain);\n\n if (matchesDomain && !hasPath) return null;\n }\n\n // handle special protocol-like strings\n const protocolMatch = pathname.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):(.+)$/);\n if (protocolMatch) {\n const scheme = protocolMatch[1]?.toLowerCase() || \"\";\n const rest = protocolMatch[2];\n\n if ([\"tel\", \"sms\"].some((sch) => sch.startsWith(scheme))) {\n const clean = rest?.split(\"?\")[0]?.split(\"#\")[0];\n return clean?.trim() || null;\n } else if (scheme === \"mailto\") {\n const parts = rest?.split(\"/\");\n let last = parts?.[parts.length - 1];\n last = last?.split(\"?\")[0]?.split(\"#\")[0]; // strip query/hash\n const dotIndex = last?.lastIndexOf(\".\");\n if (dotIndex && dotIndex > 0) last = last?.slice(0, dotIndex);\n return last || null;\n } else if (scheme === \"data\") {\n const commaIndex = rest?.indexOf(\",\") || -1;\n if (commaIndex === -1) return null;\n let payload = rest?.slice(commaIndex + 1);\n payload = payload?.split?.(\"?\")[0]?.split(\"#\")[0]; // strip query/hash\n return payload?.trim() || null;\n }\n }\n\n if (/^[a-z][a-z\\d+\\-.]*:\\/{3,}/i.test(pathname)) {\n // eg https:///file.txt (has more than 2 slash after : protocol)\n pathname = pathname.replace(/^[a-z][a-z\\d+\\-.]*:\\/{2,}/i, \"\");\n } else {\n try {\n const isProbablyUrl = /^[a-z][a-z\\d+\\-.]*:(\\/\\/)?/i.test(pathname);\n\n pathname = isProbablyUrl\n ? new URL(pathname).pathname\n : new URL(`http://localhost/${pathname}`).pathname;\n } catch {\n // Fallback for weird URLs like 'https:///file.txt'\n // Remove protocol + any number of slashes\n pathname = pathname.replace(/^[a-z][a-z\\d+\\-.]*:(\\/\\/)?/i, \"\");\n }\n }\n\n // split into non-empty segments\n const segments = pathname.split(\"/\").filter(Boolean);\n\n if (segments.length === 0) return null;\n\n // Take the last segment as candidate filename\n let lastSegment =\n segments[segments.length - 1]?.split(\"?\")[0]?.split(\"#\")[0] || \"\";\n // Strip trailing ? or # that is alone\n lastSegment = lastSegment?.replace(/[?#]+$/, \"\");\n if (!lastSegment) return null;\n\n // Replace encoded slashes and dots\n lastSegment = lastSegment\n .replace(/%2F/gi, \"/\")\n .replace(/%5C/gi, \"\\\\\")\n .replace(/%2E/gi, \".\");\n\n // If replacement introduces new slashes, take the new last segment\n if (lastSegment.includes(\"/\")) {\n const parts = lastSegment.split(\"/\").filter(Boolean);\n lastSegment = parts[parts.length - 1] || \"\";\n }\n\n let filename = decodeURIComponent(lastSegment);\n\n if (!filename) return null;\n\n // Special filenames always returned as-is (even if trailing slash)\n if (SPECIAL_FILENAMES.has(filename)) return filename;\n\n // Dotfiles like \".env\" should be returned as-is (single leading dot, no other dot)\n if (/^\\.[^.\\s][^/]*$/.test(filename)) return filename;\n\n // If the original pathname ends with \"/\" and the last segment doesn't look like a file\n // const originalEndsWithSlash = pathname.endsWith(\"/\");\n if (!filename.includes(\".\")) return null;\n\n // Strip double extensions first\n const sortedDouble = [...DOUBLE_EXTENSIONS_FILE].sort(\n (a, b) => b.length - a.length\n );\n for (const ext of sortedDouble) {\n const dotExt = `.${ext.toLowerCase()}`;\n if (filename.toLowerCase().endsWith(dotExt)) {\n filename = filename.slice(0, filename.length - dotExt.length);\n break;\n }\n }\n\n // Strip single extensions\n const sortedSingle = [...EXTENSIONS_FILE].sort((a, b) => b.length - a.length);\n for (const ext of sortedSingle) {\n const dotExt = `.${ext.toLowerCase()}`;\n if (filename.toLowerCase().endsWith(dotExt)) {\n filename = filename.slice(0, filename.length - dotExt.length);\n break;\n }\n }\n\n return filename || null;\n};\n"],"mappings":";;;;;;;;;;;;;;AAGA,MAAa,kBAAkB,IAAI,IAAI;CAErC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAIA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAKF,MAAa,yBAAyB,IAAI,IAAI;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAKF,MAAa,oBAAoB,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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jE,cAAc,aAAa,QAAQ,UAAU,GAAG;CAChD,IAAI,CAAC,aAAa,OAAO;CAGzB,cAAc,YACX,QAAQ,SAAS,IAAI,CACrB,QAAQ,SAAS,KAAK,CACtB,QAAQ,SAAS,IAAI;CAGxB,IAAI,YAAY,SAAS,IAAI,EAAE;EAC7B,MAAM,QAAQ,YAAY,MAAM,IAAI,CAAC,OAAO,QAAQ;EACpD,cAAc,MAAM,MAAM,SAAS,MAAM;;CAG3C,IAAI,WAAW,mBAAmB,YAAY;CAE9C,IAAI,CAAC,UAAU,OAAO;CAGtB,IAAI,kBAAkB,IAAI,SAAS,EAAE,OAAO;CAG5C,IAAI,kBAAkB,KAAK,SAAS,EAAE,OAAO;CAI7C,IAAI,CAAC,SAAS,SAAS,IAAI,EAAE,OAAO;CAGpC,MAAM,eAAe,CAAC,GAAG,uBAAuB,CAAC,MAC9C,GAAG,MAAM,EAAE,SAAS,EAAE,OACxB;CACD,KAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,SAAS,IAAI,IAAI,aAAa;EACpC,IAAI,SAAS,aAAa,CAAC,SAAS,OAAO,EAAE;GAC3C,WAAW,SAAS,MAAM,GAAG,SAAS,SAAS,OAAO,OAAO;GAC7D;;;CAKJ,MAAM,eAAe,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO;CAC7E,KAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,SAAS,IAAI,IAAI,aAAa;EACpC,IAAI,SAAS,aAAa,CAAC,SAAS,OAAO,EAAE;GAC3C,WAAW,SAAS,MAAM,GAAG,SAAS,SAAS,OAAO,OAAO;GAC7D;;;CAIJ,OAAO,YAAY"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.0
|
|
5
|
+
* Version: `3.13.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
import { T as assertIsPlainObject, t as assertIsBoolean, y as isNonEmptyString } from "./assertIsBoolean-
|
|
11
|
-
import { t as punycodeUtilsJS } from "./punyCode-
|
|
10
|
+
import { T as assertIsPlainObject, t as assertIsBoolean, y as isNonEmptyString } from "./assertIsBoolean-9-huIcIR.js";
|
|
11
|
+
import { t as punycodeUtilsJS } from "./punyCode-C0ft9dER.js";
|
|
12
12
|
const EXTENSIONS_FILE = new Set([
|
|
13
13
|
"txt",
|
|
14
14
|
"md",
|
|
@@ -640,4 +640,4 @@ const extractFileName = (input, options = {}) => {
|
|
|
640
640
|
return filename || null;
|
|
641
641
|
};
|
|
642
642
|
export { extractFileName as t };
|
|
643
|
-
//# sourceMappingURL=parsers-
|
|
643
|
+
//# sourceMappingURL=parsers-Dl9fFra4.js.map
|