urlpurify 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -0
  3. package/dist/clean.d.ts +8 -0
  4. package/dist/clean.js +63 -0
  5. package/dist/defaults.d.ts +7 -0
  6. package/dist/defaults.js +30 -0
  7. package/dist/index.d.ts +80 -0
  8. package/dist/index.js +79 -0
  9. package/dist/params.d.ts +4 -0
  10. package/dist/params.js +157 -0
  11. package/dist/types.d.ts +9 -0
  12. package/dist/unwraps/aceml.d.ts +6 -0
  13. package/dist/unwraps/aceml.js +15 -0
  14. package/dist/unwraps/adjust.d.ts +6 -0
  15. package/dist/unwraps/adjust.js +9 -0
  16. package/dist/unwraps/amazonAffiliate.d.ts +6 -0
  17. package/dist/unwraps/amazonAffiliate.js +9 -0
  18. package/dist/unwraps/ampCache.d.ts +6 -0
  19. package/dist/unwraps/ampCache.js +13 -0
  20. package/dist/unwraps/awin.d.ts +6 -0
  21. package/dist/unwraps/awin.js +9 -0
  22. package/dist/unwraps/bing.d.ts +6 -0
  23. package/dist/unwraps/bing.js +14 -0
  24. package/dist/unwraps/cjNetwork.d.ts +6 -0
  25. package/dist/unwraps/cjNetwork.js +17 -0
  26. package/dist/unwraps/digidip.d.ts +6 -0
  27. package/dist/unwraps/digidip.js +8 -0
  28. package/dist/unwraps/disqus.d.ts +6 -0
  29. package/dist/unwraps/disqus.js +8 -0
  30. package/dist/unwraps/douban.d.ts +6 -0
  31. package/dist/unwraps/douban.js +9 -0
  32. package/dist/unwraps/duckduckgo.d.ts +6 -0
  33. package/dist/unwraps/duckduckgo.js +9 -0
  34. package/dist/unwraps/ebayRover.d.ts +6 -0
  35. package/dist/unwraps/ebayRover.js +8 -0
  36. package/dist/unwraps/effiliation.d.ts +6 -0
  37. package/dist/unwraps/effiliation.js +8 -0
  38. package/dist/unwraps/embedly.d.ts +6 -0
  39. package/dist/unwraps/embedly.js +8 -0
  40. package/dist/unwraps/facebook.d.ts +6 -0
  41. package/dist/unwraps/facebook.js +9 -0
  42. package/dist/unwraps/feedsportal.d.ts +6 -0
  43. package/dist/unwraps/feedsportal.js +44 -0
  44. package/dist/unwraps/firebaseDynamicLinks.d.ts +6 -0
  45. package/dist/unwraps/firebaseDynamicLinks.js +8 -0
  46. package/dist/unwraps/flipboard.d.ts +6 -0
  47. package/dist/unwraps/flipboard.js +9 -0
  48. package/dist/unwraps/gateSc.d.ts +6 -0
  49. package/dist/unwraps/gateSc.js +8 -0
  50. package/dist/unwraps/georiot.d.ts +6 -0
  51. package/dist/unwraps/georiot.js +8 -0
  52. package/dist/unwraps/gitee.d.ts +6 -0
  53. package/dist/unwraps/gitee.js +9 -0
  54. package/dist/unwraps/google.d.ts +6 -0
  55. package/dist/unwraps/google.js +8 -0
  56. package/dist/unwraps/googleAmpViewer.d.ts +6 -0
  57. package/dist/unwraps/googleAmpViewer.js +13 -0
  58. package/dist/unwraps/googleNews.d.ts +6 -0
  59. package/dist/unwraps/googleNews.js +8 -0
  60. package/dist/unwraps/googleNewsModern.d.ts +6 -0
  61. package/dist/unwraps/googleNewsModern.js +14 -0
  62. package/dist/unwraps/googleScholar.d.ts +6 -0
  63. package/dist/unwraps/googleScholar.js +8 -0
  64. package/dist/unwraps/googleTranslate.d.ts +6 -0
  65. package/dist/unwraps/googleTranslate.js +8 -0
  66. package/dist/unwraps/hashnode.d.ts +6 -0
  67. package/dist/unwraps/hashnode.js +9 -0
  68. package/dist/unwraps/icptrack.d.ts +6 -0
  69. package/dist/unwraps/icptrack.js +9 -0
  70. package/dist/unwraps/idealoPartner.d.ts +6 -0
  71. package/dist/unwraps/idealoPartner.js +8 -0
  72. package/dist/unwraps/instagram.d.ts +6 -0
  73. package/dist/unwraps/instagram.js +8 -0
  74. package/dist/unwraps/jianshuGo.d.ts +6 -0
  75. package/dist/unwraps/jianshuGo.js +9 -0
  76. package/dist/unwraps/juejin.d.ts +6 -0
  77. package/dist/unwraps/juejin.js +8 -0
  78. package/dist/unwraps/leverAnalytics.d.ts +6 -0
  79. package/dist/unwraps/leverAnalytics.js +8 -0
  80. package/dist/unwraps/linksynergy.d.ts +6 -0
  81. package/dist/unwraps/linksynergy.js +9 -0
  82. package/dist/unwraps/mailchimp.d.ts +6 -0
  83. package/dist/unwraps/mailchimp.js +9 -0
  84. package/dist/unwraps/mailpanion.d.ts +6 -0
  85. package/dist/unwraps/mailpanion.js +8 -0
  86. package/dist/unwraps/mailpgn.d.ts +6 -0
  87. package/dist/unwraps/mailpgn.js +8 -0
  88. package/dist/unwraps/mailtrack.d.ts +6 -0
  89. package/dist/unwraps/mailtrack.js +8 -0
  90. package/dist/unwraps/medium.d.ts +6 -0
  91. package/dist/unwraps/medium.js +9 -0
  92. package/dist/unwraps/mimecast.d.ts +6 -0
  93. package/dist/unwraps/mimecast.js +11 -0
  94. package/dist/unwraps/mozillaOutgoing.d.ts +6 -0
  95. package/dist/unwraps/mozillaOutgoing.js +13 -0
  96. package/dist/unwraps/narrativ.d.ts +6 -0
  97. package/dist/unwraps/narrativ.js +8 -0
  98. package/dist/unwraps/nicoMs.d.ts +6 -0
  99. package/dist/unwraps/nicoMs.js +12 -0
  100. package/dist/unwraps/outlookSafelinks.d.ts +6 -0
  101. package/dist/unwraps/outlookSafelinks.js +8 -0
  102. package/dist/unwraps/partnerAds.d.ts +6 -0
  103. package/dist/unwraps/partnerAds.js +8 -0
  104. package/dist/unwraps/pocket.d.ts +6 -0
  105. package/dist/unwraps/pocket.js +9 -0
  106. package/dist/unwraps/postmark.d.ts +6 -0
  107. package/dist/unwraps/postmark.js +12 -0
  108. package/dist/unwraps/proofpointV1.d.ts +6 -0
  109. package/dist/unwraps/proofpointV1.js +16 -0
  110. package/dist/unwraps/proofpointV2.d.ts +6 -0
  111. package/dist/unwraps/proofpointV2.js +16 -0
  112. package/dist/unwraps/proofpointV3.d.ts +6 -0
  113. package/dist/unwraps/proofpointV3.js +78 -0
  114. package/dist/unwraps/pxf.d.ts +6 -0
  115. package/dist/unwraps/pxf.js +8 -0
  116. package/dist/unwraps/recruitics.d.ts +6 -0
  117. package/dist/unwraps/recruitics.js +8 -0
  118. package/dist/unwraps/redditOut.d.ts +6 -0
  119. package/dist/unwraps/redditOut.js +8 -0
  120. package/dist/unwraps/redirectingat.d.ts +6 -0
  121. package/dist/unwraps/redirectingat.js +8 -0
  122. package/dist/unwraps/segmentfault.d.ts +6 -0
  123. package/dist/unwraps/segmentfault.js +14 -0
  124. package/dist/unwraps/shareasale.d.ts +6 -0
  125. package/dist/unwraps/shareasale.js +9 -0
  126. package/dist/unwraps/sjv.d.ts +6 -0
  127. package/dist/unwraps/sjv.js +8 -0
  128. package/dist/unwraps/skimlinks.d.ts +6 -0
  129. package/dist/unwraps/skimlinks.js +8 -0
  130. package/dist/unwraps/slack.d.ts +6 -0
  131. package/dist/unwraps/slack.js +9 -0
  132. package/dist/unwraps/smartredirect.d.ts +6 -0
  133. package/dist/unwraps/smartredirect.js +8 -0
  134. package/dist/unwraps/sspai.d.ts +6 -0
  135. package/dist/unwraps/sspai.js +9 -0
  136. package/dist/unwraps/steamLinkfilter.d.ts +6 -0
  137. package/dist/unwraps/steamLinkfilter.js +9 -0
  138. package/dist/unwraps/telegramIv.d.ts +6 -0
  139. package/dist/unwraps/telegramIv.js +9 -0
  140. package/dist/unwraps/tradedoubler.d.ts +6 -0
  141. package/dist/unwraps/tradedoubler.js +9 -0
  142. package/dist/unwraps/tumblr.d.ts +6 -0
  143. package/dist/unwraps/tumblr.js +9 -0
  144. package/dist/unwraps/valuecommerce.d.ts +6 -0
  145. package/dist/unwraps/valuecommerce.js +9 -0
  146. package/dist/unwraps/viglink.d.ts +6 -0
  147. package/dist/unwraps/viglink.js +8 -0
  148. package/dist/unwraps/vkAway.d.ts +6 -0
  149. package/dist/unwraps/vkAway.js +9 -0
  150. package/dist/unwraps/webArchive.d.ts +6 -0
  151. package/dist/unwraps/webArchive.js +12 -0
  152. package/dist/unwraps/yahooSearch.d.ts +6 -0
  153. package/dist/unwraps/yahooSearch.js +12 -0
  154. package/dist/unwraps/yandexTurbo.d.ts +6 -0
  155. package/dist/unwraps/yandexTurbo.js +12 -0
  156. package/dist/unwraps/youtube.d.ts +6 -0
  157. package/dist/unwraps/youtube.js +9 -0
  158. package/dist/unwraps/zhihu.d.ts +6 -0
  159. package/dist/unwraps/zhihu.js +8 -0
  160. package/dist/utils.d.ts +11 -0
  161. package/dist/utils.js +50 -0
  162. package/package.json +45 -0
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/mailpanion.d.ts
4
+ declare const unwrapMailpanion: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapMailpanion };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/mailpanion.ts
3
+ const unwrapMailpanion = createParamExtractor({
4
+ hosts: "mailpanion.com",
5
+ params: ["destination"]
6
+ });
7
+ //#endregion
8
+ export { unwrapMailpanion };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/mailpgn.d.ts
4
+ declare const unwrapMailpgn: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapMailpgn };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/mailpgn.ts
3
+ const unwrapMailpgn = createParamExtractor({
4
+ hosts: "t.mailpgn.com",
5
+ params: ["fl"]
6
+ });
7
+ //#endregion
8
+ export { unwrapMailpgn };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/mailtrack.d.ts
4
+ declare const unwrapMailtrack: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapMailtrack };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/mailtrack.ts
3
+ const unwrapMailtrack = createParamExtractor({
4
+ hosts: "mailtrack.io",
5
+ params: ["url"]
6
+ });
7
+ //#endregion
8
+ export { unwrapMailtrack };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/medium.d.ts
4
+ declare const unwrapMedium: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapMedium };
@@ -0,0 +1,9 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/medium.ts
3
+ const unwrapMedium = createParamExtractor({
4
+ hosts: "medium.com",
5
+ path: "/r/",
6
+ params: ["url"]
7
+ });
8
+ //#endregion
9
+ export { unwrapMedium };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/mimecast.d.ts
4
+ declare const unwrapMimecast: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapMimecast };
@@ -0,0 +1,11 @@
1
+ //#region src/unwraps/mimecast.ts
2
+ const mimecastHostRegex = /\.mimecast\.com$/;
3
+ const unwrapMimecast = (url) => {
4
+ if (!mimecastHostRegex.test(url.hostname)) return;
5
+ const targetUrl = url.searchParams.get("url");
6
+ if (targetUrl) return targetUrl;
7
+ const targetDomain = url.searchParams.get("domain");
8
+ if (targetDomain) return `https://${targetDomain}`;
9
+ };
10
+ //#endregion
11
+ export { unwrapMimecast };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/mozillaOutgoing.d.ts
4
+ declare const unwrapMozillaOutgoing: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapMozillaOutgoing };
@@ -0,0 +1,13 @@
1
+ //#region src/unwraps/mozillaOutgoing.ts
2
+ const pathRegex = /^\/v1\/[0-9a-f]{64}\/(.+)$/;
3
+ const mozillaOutgoingHosts = new Set(["outgoing.prod.mozaws.net", "prod.outgoing.prod.webservices.mozgcp.net"]);
4
+ const unwrapMozillaOutgoing = (url) => {
5
+ if (!mozillaOutgoingHosts.has(url.hostname)) return;
6
+ const match = url.pathname.match(pathRegex);
7
+ if (!match) return;
8
+ try {
9
+ return decodeURIComponent(match[1]);
10
+ } catch {}
11
+ };
12
+ //#endregion
13
+ export { unwrapMozillaOutgoing };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/narrativ.d.ts
4
+ declare const unwrapNarrativ: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapNarrativ };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/narrativ.ts
3
+ const unwrapNarrativ = createParamExtractor({
4
+ hosts: ["narrativ.com", "api.narrativ.com"],
5
+ params: ["url"]
6
+ });
7
+ //#endregion
8
+ export { unwrapNarrativ };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/nicoMs.d.ts
4
+ declare const unwrapNicoMs: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapNicoMs };
@@ -0,0 +1,12 @@
1
+ //#region src/unwraps/nicoMs.ts
2
+ const nicoMsRegex = /^\/((?:sm|nm|so|im)\w+)$/;
3
+ const unwrapNicoMs = (url) => {
4
+ if (url.hostname !== "nico.ms") return;
5
+ const match = url.pathname.match(nicoMsRegex);
6
+ if (!match) return;
7
+ const id = match[1];
8
+ if (id.startsWith("im")) return `https://seiga.nicovideo.jp/seiga/${id}`;
9
+ return `https://www.nicovideo.jp/watch/${id}`;
10
+ };
11
+ //#endregion
12
+ export { unwrapNicoMs };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/outlookSafelinks.d.ts
4
+ declare const unwrapOutlookSafelinks: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapOutlookSafelinks };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/outlookSafelinks.ts
3
+ const unwrapOutlookSafelinks = createParamExtractor({
4
+ hosts: /\.safelinks\.protection\.outlook\.com$/,
5
+ params: ["url"]
6
+ });
7
+ //#endregion
8
+ export { unwrapOutlookSafelinks };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/partnerAds.d.ts
4
+ declare const unwrapPartnerAds: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapPartnerAds };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/partnerAds.ts
3
+ const unwrapPartnerAds = createParamExtractor({
4
+ hosts: /\.partner-ads\.com$/,
5
+ params: ["htmlurl"]
6
+ });
7
+ //#endregion
8
+ export { unwrapPartnerAds };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/pocket.d.ts
4
+ declare const unwrapPocket: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapPocket };
@@ -0,0 +1,9 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/pocket.ts
3
+ const unwrapPocket = createParamExtractor({
4
+ hosts: "getpocket.com",
5
+ path: "/redirect",
6
+ params: ["url"]
7
+ });
8
+ //#endregion
9
+ export { unwrapPocket };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/postmark.d.ts
4
+ declare const unwrapPostmark: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapPostmark };
@@ -0,0 +1,12 @@
1
+ //#region src/unwraps/postmark.ts
2
+ const postmarkPathRegex = /^\/[23][st]\/([^/]+)\//;
3
+ const unwrapPostmark = (url) => {
4
+ if (url.hostname !== "click.pstmrk.it") return;
5
+ const match = url.pathname.match(postmarkPathRegex);
6
+ if (!match) return;
7
+ try {
8
+ return decodeURIComponent(match[1]);
9
+ } catch {}
10
+ };
11
+ //#endregion
12
+ export { unwrapPostmark };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/proofpointV1.d.ts
4
+ declare const unwrapProofpointV1: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapProofpointV1 };
@@ -0,0 +1,16 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/proofpointV1.ts
3
+ const baseExtractor = createParamExtractor({
4
+ hosts: "urldefense.proofpoint.com",
5
+ path: "/v1/url",
6
+ params: ["u"]
7
+ });
8
+ const unwrapProofpointV1 = (url) => {
9
+ const raw = baseExtractor(url);
10
+ if (!raw) return;
11
+ try {
12
+ return decodeURIComponent(raw.replace(/-/g, "%").replace(/_/g, "/"));
13
+ } catch {}
14
+ };
15
+ //#endregion
16
+ export { unwrapProofpointV1 };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/proofpointV2.d.ts
4
+ declare const unwrapProofpointV2: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapProofpointV2 };
@@ -0,0 +1,16 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/proofpointV2.ts
3
+ const baseExtractor = createParamExtractor({
4
+ hosts: "urldefense.proofpoint.com",
5
+ path: "/v2/url",
6
+ params: ["u"]
7
+ });
8
+ const unwrapProofpointV2 = (url) => {
9
+ const raw = baseExtractor(url);
10
+ if (!raw) return;
11
+ try {
12
+ return decodeURIComponent(raw.replace(/-/g, "%").replace(/_/g, "/"));
13
+ } catch {}
14
+ };
15
+ //#endregion
16
+ export { unwrapProofpointV2 };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/proofpointV3.d.ts
4
+ declare const unwrapProofpointV3: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapProofpointV3 };
@@ -0,0 +1,78 @@
1
+ import { decodeBase64Url, getUtf8ByteLength } from "../utils.js";
2
+ //#region src/unwraps/proofpointV3.ts
3
+ const v3PathRegex = /^\/v3\/__(.+)__;([^!]*)!/;
4
+ const v3HostSet = new Set([
5
+ "urldefense.com",
6
+ "urldefense.proofpoint.com",
7
+ "urldefense.us"
8
+ ]);
9
+ const runLengthMap = (() => {
10
+ const map = {};
11
+ const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
12
+ for (let index = 0; index < 64; index += 1) map[alphabet[index]] = index + 2;
13
+ return map;
14
+ })();
15
+ const decodeReplacements = (mangled, replacementBase64) => {
16
+ if (replacementBase64.length === 0) return mangled;
17
+ const replacement = decodeBase64Url(replacementBase64);
18
+ if (replacement === void 0) return;
19
+ const replacementChars = Array.from(replacement);
20
+ const urlChars = Array.from(mangled);
21
+ const result = [];
22
+ const matcher = /(?<!\*)\*(?!\*)|\*{2}[A-Za-z0-9\-_]/g;
23
+ let lastIndex = 0;
24
+ let savedBytes = 0;
25
+ let match;
26
+ match = matcher.exec(mangled);
27
+ while (match !== null) {
28
+ const startChar = positionInChars(mangled, match.index);
29
+ const endChar = positionInChars(mangled, match.index + match[0].length);
30
+ for (let charIndex = lastIndex; charIndex < startChar; charIndex += 1) result.push(urlChars[charIndex]);
31
+ if (match[0] === "*") {
32
+ const next = replacementChars.shift();
33
+ if (next === void 0) return;
34
+ result.push(next);
35
+ } else {
36
+ let bytesToReplace = runLengthMap[match[0][2]];
37
+ if (savedBytes !== 0) {
38
+ bytesToReplace += savedBytes;
39
+ savedBytes = 0;
40
+ }
41
+ let bytesConsumed = 0;
42
+ while (bytesConsumed < bytesToReplace) {
43
+ const next = replacementChars.shift();
44
+ if (next === void 0) return;
45
+ result.push(next);
46
+ bytesConsumed += getUtf8ByteLength(next);
47
+ if (replacementChars.length > 0) {
48
+ if (getUtf8ByteLength(replacementChars[0]) > bytesToReplace - bytesConsumed) {
49
+ savedBytes = bytesToReplace - bytesConsumed;
50
+ bytesConsumed += savedBytes;
51
+ }
52
+ }
53
+ }
54
+ }
55
+ lastIndex = endChar;
56
+ match = matcher.exec(mangled);
57
+ }
58
+ for (let charIndex = lastIndex; charIndex < urlChars.length; charIndex += 1) result.push(urlChars[charIndex]);
59
+ return result.join("");
60
+ };
61
+ const positionInChars = (source, codeUnitIndex) => {
62
+ let charIndex = 0;
63
+ let unit = 0;
64
+ while (unit < codeUnitIndex && unit < source.length) {
65
+ const codePoint = source.codePointAt(unit);
66
+ unit += codePoint !== void 0 && codePoint > 65535 ? 2 : 1;
67
+ charIndex += 1;
68
+ }
69
+ return charIndex;
70
+ };
71
+ const unwrapProofpointV3 = (url) => {
72
+ if (!v3HostSet.has(url.hostname)) return;
73
+ const match = `${url.pathname}${url.search}`.match(v3PathRegex);
74
+ if (!match) return;
75
+ return decodeReplacements(match[1], match[2]);
76
+ };
77
+ //#endregion
78
+ export { unwrapProofpointV3 };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/pxf.d.ts
4
+ declare const unwrapPxf: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapPxf };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/pxf.ts
3
+ const unwrapPxf = createParamExtractor({
4
+ hosts: /\.pxf\.io$/,
5
+ params: ["u"]
6
+ });
7
+ //#endregion
8
+ export { unwrapPxf };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/recruitics.d.ts
4
+ declare const unwrapRecruitics: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapRecruitics };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/recruitics.ts
3
+ const unwrapRecruitics = createParamExtractor({
4
+ hosts: "jsv3.recruitics.com",
5
+ params: ["rx_url"]
6
+ });
7
+ //#endregion
8
+ export { unwrapRecruitics };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/redditOut.d.ts
4
+ declare const unwrapRedditOut: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapRedditOut };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/redditOut.ts
3
+ const unwrapRedditOut = createParamExtractor({
4
+ hosts: "out.reddit.com",
5
+ params: ["url"]
6
+ });
7
+ //#endregion
8
+ export { unwrapRedditOut };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/redirectingat.d.ts
4
+ declare const unwrapRedirectingat: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapRedirectingat };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/redirectingat.ts
3
+ const unwrapRedirectingat = createParamExtractor({
4
+ hosts: "redirectingat.com",
5
+ params: ["url"]
6
+ });
7
+ //#endregion
8
+ export { unwrapRedirectingat };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/segmentfault.d.ts
4
+ declare const unwrapSegmentfault: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapSegmentfault };
@@ -0,0 +1,14 @@
1
+ import { createParamExtractor, decodeBase64 } from "../utils.js";
2
+ //#region src/unwraps/segmentfault.ts
3
+ const baseExtractor = createParamExtractor({
4
+ hosts: "link.segmentfault.com",
5
+ params: ["enc"]
6
+ });
7
+ const unwrapSegmentfault = (url) => {
8
+ const raw = baseExtractor(url);
9
+ if (!raw) return;
10
+ const decoded = decodeBase64(raw);
11
+ if (decoded && (decoded.startsWith("http://") || decoded.startsWith("https://"))) return decoded;
12
+ };
13
+ //#endregion
14
+ export { unwrapSegmentfault };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/shareasale.d.ts
4
+ declare const unwrapShareasale: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapShareasale };
@@ -0,0 +1,9 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/shareasale.ts
3
+ const unwrapShareasale = createParamExtractor({
4
+ hosts: "shareasale.com",
5
+ path: "/r.cfm",
6
+ params: ["urllink"]
7
+ });
8
+ //#endregion
9
+ export { unwrapShareasale };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/sjv.d.ts
4
+ declare const unwrapSjv: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapSjv };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/sjv.ts
3
+ const unwrapSjv = createParamExtractor({
4
+ hosts: /\.sjv\.io$/,
5
+ params: ["u"]
6
+ });
7
+ //#endregion
8
+ export { unwrapSjv };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/skimlinks.d.ts
4
+ declare const unwrapSkimlinks: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapSkimlinks };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/skimlinks.ts
3
+ const unwrapSkimlinks = createParamExtractor({
4
+ hosts: "go.skimresources.com",
5
+ params: ["url"]
6
+ });
7
+ //#endregion
8
+ export { unwrapSkimlinks };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/slack.d.ts
4
+ declare const unwrapSlack: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapSlack };
@@ -0,0 +1,9 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/slack.ts
3
+ const unwrapSlack = createParamExtractor({
4
+ hosts: "slack-redir.net",
5
+ path: "/link",
6
+ params: ["url"]
7
+ });
8
+ //#endregion
9
+ export { unwrapSlack };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/smartredirect.d.ts
4
+ declare const unwrapSmartredirect: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapSmartredirect };
@@ -0,0 +1,8 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/smartredirect.ts
3
+ const unwrapSmartredirect = createParamExtractor({
4
+ hosts: "smartredirect.de",
5
+ params: ["url"]
6
+ });
7
+ //#endregion
8
+ export { unwrapSmartredirect };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/sspai.d.ts
4
+ declare const unwrapSspai: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapSspai };
@@ -0,0 +1,9 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/sspai.ts
3
+ const unwrapSspai = createParamExtractor({
4
+ hosts: "sspai.com",
5
+ path: "/link",
6
+ params: ["target"]
7
+ });
8
+ //#endregion
9
+ export { unwrapSspai };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/steamLinkfilter.d.ts
4
+ declare const unwrapSteamLinkfilter: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapSteamLinkfilter };
@@ -0,0 +1,9 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/steamLinkfilter.ts
3
+ const unwrapSteamLinkfilter = createParamExtractor({
4
+ hosts: "steamcommunity.com",
5
+ path: "/linkfilter/",
6
+ params: ["url"]
7
+ });
8
+ //#endregion
9
+ export { unwrapSteamLinkfilter };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/telegramIv.d.ts
4
+ declare const unwrapTelegramIv: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapTelegramIv };
@@ -0,0 +1,9 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/telegramIv.ts
3
+ const unwrapTelegramIv = createParamExtractor({
4
+ hosts: "t.me",
5
+ path: "/iv",
6
+ params: ["url"]
7
+ });
8
+ //#endregion
9
+ export { unwrapTelegramIv };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/tradedoubler.d.ts
4
+ declare const unwrapTradedoubler: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapTradedoubler };
@@ -0,0 +1,9 @@
1
+ import { createParamExtractor } from "../utils.js";
2
+ //#region src/unwraps/tradedoubler.ts
3
+ const unwrapTradedoubler = createParamExtractor({
4
+ hosts: "clk.tradedoubler.com",
5
+ path: "/click",
6
+ params: ["url"]
7
+ });
8
+ //#endregion
9
+ export { unwrapTradedoubler };
@@ -0,0 +1,6 @@
1
+ import { UrlUnwrapper } from "../types.js";
2
+
3
+ //#region src/unwraps/tumblr.d.ts
4
+ declare const unwrapTumblr: UrlUnwrapper;
5
+ //#endregion
6
+ export { unwrapTumblr };