@nuxt/scripts 1.0.0-beta.7 → 1.0.0-rc.2

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 (270) hide show
  1. package/dist/devtools-client/200.html +1 -0
  2. package/dist/devtools-client/404.html +1 -0
  3. package/dist/devtools-client/_fonts/4ppnHhMi-pBsWSPo7mY0avYxlDoAg1N3PTzCwXLZ5rA-d9oibkGnTd1JL3tc_xnaVgBLYmOB8kjrK2cvZaqwj9s.woff2 +0 -0
  4. package/dist/devtools-client/_fonts/4qBuU9MRVUlPZNPSF7Xom_sK8RBEnfYu-9VXFrdq8A8-8TDwLE1HAj1sQn7XxVWtM_7sIaPM-DTdO3Pf8U2DF1U.woff2 +0 -0
  5. package/dist/devtools-client/_fonts/6dYsbWUd_BpKJ7mdDihgOcya1gHXLpJBuMYXux3WMjE-q3fYNS8YbW5n7ZeXI2vSNgkRWW5VDPKAl51SNTjG2qk.woff2 +0 -0
  6. package/dist/devtools-client/_fonts/Lr-hqqZZsYmCt0ITUlr1CUrWim9fsKvoDFZliMxgNHY-iTa_Yt_PzhOY9TX7ZXdSlEPim6iRt92xhECwaxWxd5w.woff2 +0 -0
  7. package/dist/devtools-client/_fonts/OknHvWI6KtYn1JQBzX7eSpNDBQ8520F9TvSUJYkVf6A-xeZn9253svK_8Q2LD0XEruY_MnEsuCRO5LenPoggC0Y.woff2 +0 -0
  8. package/dist/devtools-client/_fonts/PV2hrQG6wq5BlIPDjdL1IcOflycaghyt5MHzlBqZtlo-lb_WexLz3VZqfTN0oi554iBH5tT2j2UFEV-XErCAS3E.woff2 +0 -0
  9. package/dist/devtools-client/_fonts/UA7OtwYHwGN_HjcVGTdmiQxUit7FlqkCwxVUWSeXVnQ-B4OXCFOL_tWrYODpQTc07aMaj0c2cewTOmBRWR9tD-A.woff2 +0 -0
  10. package/dist/devtools-client/_fonts/VE4cDVCv5MxbFM7ZLoLCGbIpNd71zhp7MDI9lmN5Y7I-xZyDYCUVrd6LV8eVGF3Um3UZjBFuUtDGtvdyTBBRYBo.woff2 +0 -0
  11. package/dist/devtools-client/_fonts/fVoGbnMbBFd5L9BBp9fUPavUSkZ_EmsQNSyadkT-108-U4T0khaeLQSIhtt9eVvaCEKJjtWJ4ioRJOf8hvqkWY0.woff2 +0 -0
  12. package/dist/devtools-client/_fonts/lQAxeCEs1R0Lw-H9XRU1RlOARQN8J6npRsPjyEDMe5s-_DUSLEkO3tKTuun_gSnDLoQPVEnpOnyqZMOw0ByZ6PA.woff2 +0 -0
  13. package/dist/devtools-client/_fonts/lntlqNHKLV2n82yTwMde70QqOjcfLE2XJ5oKZ3vRPWc-z6TxpIZQdWXztWLr9_OFWqt_WJJoeGtuK_-XQMZGQwE.woff2 +0 -0
  14. package/dist/devtools-client/_fonts/qxAYvKsXWeYv731eb-h5TRurcdIP_W44mpNdX-HABAk-zUDeMEFlNtNbrwvT9JxLEBg0TphGy70O6RfIoIX_ZwU.woff2 +0 -0
  15. package/dist/devtools-client/_nuxt/B3kN3DAy.js +1 -0
  16. package/dist/devtools-client/_nuxt/B8PEiB0p.js +1 -0
  17. package/dist/devtools-client/_nuxt/C8jhSQ8l.js +1 -0
  18. package/dist/devtools-client/_nuxt/CJD6wrkT.js +188 -0
  19. package/dist/devtools-client/_nuxt/CfOsp0mU.js +1 -0
  20. package/dist/devtools-client/_nuxt/DKL6PHO3.js +1 -0
  21. package/dist/devtools-client/_nuxt/ajngqPCs.js +1 -0
  22. package/dist/devtools-client/_nuxt/builds/latest.json +1 -0
  23. package/dist/devtools-client/_nuxt/builds/meta/cb4e67c6-e8b7-4205-95b7-708fd96ffab6.json +1 -0
  24. package/dist/devtools-client/_nuxt/dlaR8P-P.js +1 -0
  25. package/dist/devtools-client/_nuxt/entry.BwpOBArY.css +1 -0
  26. package/dist/devtools-client/_nuxt/error-404.CvOVjXeC.css +1 -0
  27. package/dist/devtools-client/_nuxt/error-500.BIm53nmx.css +1 -0
  28. package/dist/devtools-client/_nuxt/first-party.C8Ha4JLM.css +1 -0
  29. package/dist/devtools-client/_nuxt/index.CA-OpSj0.css +1 -0
  30. package/dist/devtools-client/_nuxt/registry.B9lnjF_b.css +1 -0
  31. package/dist/devtools-client/_nuxt/wDzz0qaB.js +1 -0
  32. package/dist/devtools-client/docs/index.html +1 -0
  33. package/dist/devtools-client/first-party/index.html +1 -0
  34. package/dist/devtools-client/index.html +1 -0
  35. package/dist/devtools-client/registry/index.html +1 -0
  36. package/dist/module.d.mts +29 -84
  37. package/dist/module.d.ts +121 -0
  38. package/dist/module.json +1 -1
  39. package/dist/module.mjs +940 -755
  40. package/dist/registry.d.mts +91 -4
  41. package/dist/registry.d.ts +93 -0
  42. package/dist/registry.mjs +668 -326
  43. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.d.vue.ts +19 -87
  44. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue +79 -180
  45. package/dist/runtime/components/GoogleMaps/ScriptGoogleMaps.vue.d.ts +19 -87
  46. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.d.vue.ts +6 -55
  47. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue +12 -83
  48. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsAdvancedMarkerElement.vue.d.ts +6 -55
  49. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.d.vue.ts +5 -1
  50. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue +24 -38
  51. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsCircle.vue.d.ts +5 -1
  52. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.d.vue.ts +43 -0
  53. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue +60 -0
  54. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsGeoJson.vue.d.ts +43 -0
  55. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.d.vue.ts +4 -0
  56. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +22 -26
  57. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue.d.ts +4 -0
  58. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.d.vue.ts +11 -8
  59. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue +57 -57
  60. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsInfoWindow.vue.d.ts +11 -8
  61. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.d.vue.ts +24 -42
  62. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue +70 -73
  63. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarker.vue.d.ts +24 -42
  64. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.d.vue.ts +42 -5
  65. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue +83 -37
  66. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsMarkerClusterer.vue.d.ts +42 -5
  67. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.d.vue.ts +77 -0
  68. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue +223 -0
  69. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsOverlayView.vue.d.ts +77 -0
  70. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.d.vue.ts +10 -3
  71. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue +9 -41
  72. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPinElement.vue.d.ts +10 -3
  73. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.d.vue.ts +7 -3
  74. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue +23 -38
  75. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolygon.vue.d.ts +7 -3
  76. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.d.vue.ts +7 -3
  77. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue +23 -38
  78. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsPolyline.vue.d.ts +7 -3
  79. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.d.vue.ts +7 -3
  80. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue +24 -38
  81. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsRectangle.vue.d.ts +7 -3
  82. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.d.vue.ts +200 -0
  83. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue +166 -0
  84. package/dist/runtime/components/GoogleMaps/ScriptGoogleMapsStaticMap.vue.d.ts +200 -0
  85. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.d.ts +13 -0
  86. package/dist/runtime/components/GoogleMaps/bindGoogleMapsEvents.js +8 -0
  87. package/dist/runtime/components/GoogleMaps/injectionKeys.d.ts +10 -0
  88. package/dist/runtime/components/GoogleMaps/injectionKeys.js +2 -0
  89. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.d.ts +48 -0
  90. package/dist/runtime/components/GoogleMaps/useGoogleMapsResource.js +51 -0
  91. package/dist/runtime/components/ScriptBlueskyEmbed.d.vue.ts +84 -0
  92. package/dist/runtime/components/ScriptBlueskyEmbed.vue +89 -0
  93. package/dist/runtime/components/ScriptBlueskyEmbed.vue.d.ts +84 -0
  94. package/dist/runtime/components/ScriptCarbonAds.d.vue.ts +4 -7
  95. package/dist/runtime/components/ScriptCarbonAds.vue +1 -0
  96. package/dist/runtime/components/ScriptCarbonAds.vue.d.ts +4 -7
  97. package/dist/runtime/components/ScriptCrisp.d.vue.ts +7 -11
  98. package/dist/runtime/components/ScriptCrisp.vue +2 -1
  99. package/dist/runtime/components/ScriptCrisp.vue.d.ts +7 -11
  100. package/dist/runtime/components/ScriptGoogleAdsense.d.vue.ts +4 -7
  101. package/dist/runtime/components/ScriptGoogleAdsense.vue +2 -1
  102. package/dist/runtime/components/ScriptGoogleAdsense.vue.d.ts +4 -7
  103. package/dist/runtime/components/ScriptGravatar.d.vue.ts +22 -0
  104. package/dist/runtime/components/ScriptGravatar.vue +46 -0
  105. package/dist/runtime/components/ScriptGravatar.vue.d.ts +22 -0
  106. package/dist/runtime/components/ScriptInstagramEmbed.d.vue.ts +12 -15
  107. package/dist/runtime/components/ScriptInstagramEmbed.vue +9 -3
  108. package/dist/runtime/components/ScriptInstagramEmbed.vue.d.ts +12 -15
  109. package/dist/runtime/components/ScriptIntercom.d.vue.ts +7 -11
  110. package/dist/runtime/components/ScriptIntercom.vue +5 -3
  111. package/dist/runtime/components/ScriptIntercom.vue.d.ts +7 -11
  112. package/dist/runtime/components/ScriptLemonSqueezy.d.vue.ts +2 -3
  113. package/dist/runtime/components/ScriptLemonSqueezy.vue +1 -0
  114. package/dist/runtime/components/ScriptLemonSqueezy.vue.d.ts +2 -3
  115. package/dist/runtime/components/ScriptPayPalButtons.d.vue.ts +43 -37
  116. package/dist/runtime/components/ScriptPayPalButtons.vue +49 -79
  117. package/dist/runtime/components/ScriptPayPalButtons.vue.d.ts +43 -37
  118. package/dist/runtime/components/ScriptPayPalMessages.d.vue.ts +37 -28
  119. package/dist/runtime/components/ScriptPayPalMessages.vue +47 -50
  120. package/dist/runtime/components/ScriptPayPalMessages.vue.d.ts +37 -28
  121. package/dist/runtime/components/ScriptStripePricingTable.d.vue.ts +5 -9
  122. package/dist/runtime/components/ScriptStripePricingTable.vue +3 -2
  123. package/dist/runtime/components/ScriptStripePricingTable.vue.d.ts +5 -9
  124. package/dist/runtime/components/ScriptVimeoPlayer.d.vue.ts +17 -11
  125. package/dist/runtime/components/ScriptVimeoPlayer.vue +14 -10
  126. package/dist/runtime/components/ScriptVimeoPlayer.vue.d.ts +17 -11
  127. package/dist/runtime/components/ScriptXEmbed.d.vue.ts +10 -13
  128. package/dist/runtime/components/ScriptXEmbed.vue +15 -8
  129. package/dist/runtime/components/ScriptXEmbed.vue.d.ts +10 -13
  130. package/dist/runtime/components/ScriptYouTubePlayer.d.vue.ts +10 -15
  131. package/dist/runtime/components/ScriptYouTubePlayer.vue +12 -5
  132. package/dist/runtime/components/ScriptYouTubePlayer.vue.d.ts +10 -15
  133. package/dist/runtime/composables/useScript.js +148 -8
  134. package/dist/runtime/composables/useScriptEventPage.js +2 -2
  135. package/dist/runtime/composables/useScriptTriggerConsent.d.ts +10 -0
  136. package/dist/runtime/composables/useScriptTriggerConsent.js +33 -20
  137. package/dist/runtime/composables/useScriptTriggerElement.js +1 -1
  138. package/dist/runtime/composables/useScriptTriggerIdleTimeout.js +1 -1
  139. package/dist/runtime/devtools-standalone-bridge.client.d.ts +8 -0
  140. package/dist/runtime/devtools-standalone-bridge.client.js +50 -0
  141. package/dist/runtime/registry/bing-uet.d.ts +20 -0
  142. package/dist/runtime/registry/bing-uet.js +29 -0
  143. package/dist/runtime/registry/bluesky-embed.d.ts +116 -0
  144. package/dist/runtime/registry/bluesky-embed.js +72 -0
  145. package/dist/runtime/registry/clarity.d.ts +10 -15
  146. package/dist/runtime/registry/clarity.js +22 -31
  147. package/dist/runtime/registry/cloudflare-web-analytics.d.ts +2 -13
  148. package/dist/runtime/registry/cloudflare-web-analytics.js +2 -14
  149. package/dist/runtime/registry/crisp.d.ts +10 -40
  150. package/dist/runtime/registry/crisp.js +2 -33
  151. package/dist/runtime/registry/databuddy-analytics.d.ts +2 -35
  152. package/dist/runtime/registry/databuddy-analytics.js +20 -45
  153. package/dist/runtime/registry/fathom-analytics.d.ts +7 -26
  154. package/dist/runtime/registry/fathom-analytics.js +3 -25
  155. package/dist/runtime/registry/google-adsense.d.ts +3 -11
  156. package/dist/runtime/registry/google-adsense.js +2 -11
  157. package/dist/runtime/registry/google-analytics.d.ts +3 -5
  158. package/dist/runtime/registry/google-analytics.js +3 -8
  159. package/dist/runtime/registry/google-maps.d.ts +3 -9
  160. package/dist/runtime/registry/google-maps.js +2 -8
  161. package/dist/runtime/registry/google-recaptcha.d.ts +2 -6
  162. package/dist/runtime/registry/google-recaptcha.js +4 -12
  163. package/dist/runtime/registry/google-sign-in.d.ts +2 -13
  164. package/dist/runtime/registry/google-sign-in.js +2 -22
  165. package/dist/runtime/registry/google-tag-manager.d.ts +3 -28
  166. package/dist/runtime/registry/google-tag-manager.js +4 -27
  167. package/dist/runtime/registry/gravatar.d.ts +26 -0
  168. package/dist/runtime/registry/gravatar.js +36 -0
  169. package/dist/runtime/registry/hotjar.d.ts +4 -6
  170. package/dist/runtime/registry/hotjar.js +2 -5
  171. package/dist/runtime/registry/instagram-embed.d.ts +3 -18
  172. package/dist/runtime/registry/instagram-embed.js +4 -19
  173. package/dist/runtime/registry/intercom.d.ts +5 -13
  174. package/dist/runtime/registry/intercom.js +2 -12
  175. package/dist/runtime/registry/matomo-analytics.d.ts +3 -12
  176. package/dist/runtime/registry/matomo-analytics.js +3 -12
  177. package/dist/runtime/registry/meta-pixel.d.ts +4 -6
  178. package/dist/runtime/registry/meta-pixel.js +2 -4
  179. package/dist/runtime/registry/mixpanel-analytics.d.ts +22 -0
  180. package/dist/runtime/registry/mixpanel-analytics.js +46 -0
  181. package/dist/runtime/registry/npm.d.ts +3 -7
  182. package/dist/runtime/registry/npm.js +2 -9
  183. package/dist/runtime/registry/paypal.d.ts +4 -25
  184. package/dist/runtime/registry/paypal.js +3 -66
  185. package/dist/runtime/registry/plausible-analytics.js +19 -14
  186. package/dist/runtime/registry/posthog.d.ts +10 -12
  187. package/dist/runtime/registry/posthog.js +3 -12
  188. package/dist/runtime/registry/reddit-pixel.d.ts +5 -6
  189. package/dist/runtime/registry/reddit-pixel.js +2 -4
  190. package/dist/runtime/registry/rybbit-analytics.d.ts +2 -14
  191. package/dist/runtime/registry/rybbit-analytics.js +10 -20
  192. package/dist/runtime/registry/schemas.d.ts +982 -0
  193. package/dist/runtime/registry/schemas.js +937 -0
  194. package/dist/runtime/registry/segment.d.ts +2 -5
  195. package/dist/runtime/registry/segment.js +2 -5
  196. package/dist/runtime/registry/snapchat-pixel.d.ts +5 -34
  197. package/dist/runtime/registry/snapchat-pixel.js +2 -20
  198. package/dist/runtime/registry/stripe.d.ts +3 -4
  199. package/dist/runtime/registry/stripe.js +2 -4
  200. package/dist/runtime/registry/tiktok-pixel.d.ts +4 -7
  201. package/dist/runtime/registry/tiktok-pixel.js +2 -6
  202. package/dist/runtime/registry/umami-analytics.d.ts +2 -31
  203. package/dist/runtime/registry/umami-analytics.js +2 -36
  204. package/dist/runtime/registry/vercel-analytics.d.ts +29 -0
  205. package/dist/runtime/registry/vercel-analytics.js +84 -0
  206. package/dist/runtime/registry/vimeo-player.d.ts +2 -2
  207. package/dist/runtime/registry/vimeo-player.js +1 -1
  208. package/dist/runtime/registry/x-embed.d.ts +3 -17
  209. package/dist/runtime/registry/x-embed.js +3 -18
  210. package/dist/runtime/registry/x-pixel.d.ts +4 -7
  211. package/dist/runtime/registry/x-pixel.js +2 -5
  212. package/dist/runtime/registry/youtube-player.d.ts +7 -7
  213. package/dist/runtime/registry/youtube-player.js +1 -1
  214. package/dist/runtime/server/bluesky-embed-image.d.ts +2 -0
  215. package/dist/runtime/server/bluesky-embed-image.js +7 -0
  216. package/dist/runtime/server/bluesky-embed.d.ts +16 -0
  217. package/dist/runtime/server/bluesky-embed.js +59 -0
  218. package/dist/runtime/server/google-maps-geocode-proxy.d.ts +2 -0
  219. package/dist/runtime/server/google-maps-geocode-proxy.js +34 -0
  220. package/dist/runtime/server/google-static-maps-proxy.js +2 -13
  221. package/dist/runtime/server/gravatar-proxy.d.ts +2 -0
  222. package/dist/runtime/server/gravatar-proxy.js +46 -0
  223. package/dist/runtime/server/instagram-embed-asset.js +8 -41
  224. package/dist/runtime/server/instagram-embed-image.js +6 -53
  225. package/dist/runtime/server/instagram-embed.d.ts +16 -0
  226. package/dist/runtime/server/instagram-embed.js +176 -35
  227. package/dist/runtime/server/proxy-handler.js +101 -83
  228. package/dist/runtime/server/utils/image-proxy.d.ts +12 -0
  229. package/dist/runtime/server/utils/image-proxy.js +70 -0
  230. package/dist/runtime/server/utils/privacy.d.ts +1 -10
  231. package/dist/runtime/server/utils/privacy.js +60 -40
  232. package/dist/runtime/server/x-embed-image.js +5 -49
  233. package/dist/runtime/server/x-embed.js +3 -2
  234. package/dist/runtime/types.d.ts +277 -53
  235. package/dist/runtime/types.js +0 -2
  236. package/dist/runtime/utils/pure.d.ts +1 -1
  237. package/dist/runtime/utils.d.ts +6 -4
  238. package/dist/runtime/utils.js +31 -14
  239. package/dist/stats.d.mts +202 -0
  240. package/dist/stats.d.ts +202 -0
  241. package/dist/stats.mjs +3875 -0
  242. package/dist/types-source.d.mts +17 -0
  243. package/dist/types-source.d.ts +17 -0
  244. package/dist/types-source.mjs +3835 -0
  245. package/dist/types.d.mts +4 -2
  246. package/package.json +35 -61
  247. package/README.md +0 -86
  248. package/dist/client/200.html +0 -1
  249. package/dist/client/404.html +0 -1
  250. package/dist/client/_nuxt/BJa0m50V.js +0 -1
  251. package/dist/client/_nuxt/BPQ3VLAy.js +0 -1
  252. package/dist/client/_nuxt/Ci5iXYuB.js +0 -1
  253. package/dist/client/_nuxt/DaI2y8Uz.js +0 -162
  254. package/dist/client/_nuxt/builds/latest.json +0 -1
  255. package/dist/client/_nuxt/builds/meta/9b4fb16a-3c62-48b0-8295-126cb077b5d3.json +0 -1
  256. package/dist/client/_nuxt/entry.D45OuV0w.css +0 -1
  257. package/dist/client/_nuxt/error-404.B57D-jUQ.css +0 -1
  258. package/dist/client/_nuxt/error-500.DTHUW7BI.css +0 -1
  259. package/dist/client/_nuxt/vPLZfVXe.js +0 -1
  260. package/dist/client/index.html +0 -1
  261. package/dist/runtime/components/ScriptPayPalMarks.d.vue.ts +0 -52
  262. package/dist/runtime/components/ScriptPayPalMarks.vue +0 -69
  263. package/dist/runtime/components/ScriptPayPalMarks.vue.d.ts +0 -52
  264. package/dist/runtime/validation/mock.d.ts +0 -42
  265. package/dist/runtime/validation/mock.js +0 -21
  266. package/dist/runtime/validation/valibot.d.ts +0 -1
  267. package/dist/runtime/validation/valibot.js +0 -1
  268. /package/dist/{client → devtools-client}/_nuxt/CVO1_9PV.js +0 -0
  269. /package/dist/{client → devtools-client}/_nuxt/Cp-IABpG.js +0 -0
  270. /package/dist/{client → devtools-client}/_nuxt/D0r3Knsf.js +0 -0
@@ -1,15 +1,18 @@
1
- import { defineEventHandler, getHeaders, getRequestIP, readBody, getRequestWebStream, getQuery, setResponseHeader, createError } from "h3";
2
1
  import { useRuntimeConfig } from "#imports";
2
+ import { createError, defineEventHandler, getHeaders, getQuery, getRequestIP, getRequestWebStream, readBody, setResponseHeader } from "h3";
3
3
  import { useNitroApp } from "nitropack/runtime";
4
4
  import {
5
- SENSITIVE_HEADERS,
6
5
  anonymizeIP,
6
+ mergePrivacy,
7
7
  normalizeLanguage,
8
8
  normalizeUserAgent,
9
- stripPayloadFingerprinting,
10
9
  resolvePrivacy,
11
- mergePrivacy
10
+ SENSITIVE_HEADERS,
11
+ stripPayloadFingerprinting
12
12
  } from "./utils/privacy.js";
13
+ const COMPRESSION_RE = /gzip|deflate|br|compress|base64/i;
14
+ const CLIENT_HINT_VERSION_RE = /;v="(\d+)\.[^"]*"/g;
15
+ const SKIP_RESPONSE_HEADERS = /* @__PURE__ */ new Set(["set-cookie", "transfer-encoding", "content-encoding", "content-length"]);
13
16
  function stripQueryFingerprinting(query, privacy) {
14
17
  const stripped = stripPayloadFingerprinting(query, privacy);
15
18
  const params = new URLSearchParams();
@@ -18,11 +21,10 @@ function stripQueryFingerprinting(query, privacy) {
18
21
  params.set(key, typeof value === "object" ? JSON.stringify(value) : String(value));
19
22
  }
20
23
  }
21
- return params.toString();
24
+ return { queryString: params.toString(), stripped };
22
25
  }
23
26
  export default defineEventHandler(async (event) => {
24
27
  const config = useRuntimeConfig();
25
- const nitro = useNitroApp();
26
28
  const proxyConfig = config["nuxt-scripts-proxy"];
27
29
  if (!proxyConfig) {
28
30
  throw createError({
@@ -30,72 +32,79 @@ export default defineEventHandler(async (event) => {
30
32
  statusMessage: "First-party proxy not configured"
31
33
  });
32
34
  }
33
- const { routes, privacy: globalPrivacy, routePrivacy, debug = import.meta.dev } = proxyConfig;
35
+ const { proxyPrefix, domainPrivacy, privacy: globalPrivacy, debug = import.meta.dev } = proxyConfig;
34
36
  const path = event.path;
35
37
  const log = debug ? (message, ...args) => {
36
38
  console.debug(message, ...args);
37
39
  } : () => {
38
40
  };
39
- let targetBase;
40
- let matchedPrefix;
41
- let matchedRoutePattern;
42
- const sortedRoutes = Object.entries(routes).sort((a, b) => b[0].length - a[0].length);
43
- for (const [routePattern, target] of sortedRoutes) {
44
- const prefix = routePattern.replace(/\/\*\*$/, "");
45
- if (path.startsWith(prefix)) {
46
- targetBase = target.replace(/\/\*\*$/, "");
47
- matchedPrefix = prefix;
48
- matchedRoutePattern = routePattern;
49
- log("[proxy] Matched:", prefix, "->", targetBase);
41
+ const afterPrefix = path.slice(proxyPrefix.length + 1);
42
+ const slashIdx = afterPrefix.indexOf("/");
43
+ const domain = slashIdx > 0 ? afterPrefix.slice(0, slashIdx) : afterPrefix;
44
+ const remainingPath = slashIdx > 0 ? afterPrefix.slice(slashIdx) : "/";
45
+ if (!domain) {
46
+ log("[proxy] No domain in path:", path);
47
+ throw createError({
48
+ statusCode: 404,
49
+ statusMessage: "No proxy domain found",
50
+ message: `No domain in proxy path: ${path}`
51
+ });
52
+ }
53
+ let perScriptInput;
54
+ for (const [configDomain, privacyInput] of Object.entries(domainPrivacy)) {
55
+ if (domain === configDomain || domain.endsWith(`.${configDomain}`)) {
56
+ perScriptInput = privacyInput;
50
57
  break;
51
58
  }
52
59
  }
53
- if (!targetBase || !matchedPrefix || !matchedRoutePattern) {
54
- log("[proxy] No match for path:", path);
60
+ if (perScriptInput === void 0) {
61
+ log("[proxy] Rejected: domain not in allowlist:", domain);
55
62
  throw createError({
56
- statusCode: 404,
57
- statusMessage: "No proxy route matched",
58
- message: `No proxy target found for path: ${path}`
63
+ statusCode: 403,
64
+ statusMessage: "Domain not allowed",
65
+ message: `Proxy domain not in allowlist: ${domain}`
59
66
  });
60
67
  }
61
- const perScriptInput = routePrivacy[matchedRoutePattern];
62
- if (debug && perScriptInput === void 0) {
63
- log("[proxy] WARNING: No privacy config for route", matchedRoutePattern, "\u2014 defaulting to full anonymization");
64
- }
68
+ const targetBase = `https://${domain}`;
69
+ log("[proxy] Matched:", domain, "->", targetBase);
65
70
  const perScriptResolved = resolvePrivacy(perScriptInput ?? true);
66
71
  const privacy = globalPrivacy !== void 0 ? mergePrivacy(perScriptResolved, globalPrivacy) : perScriptResolved;
67
72
  const anyPrivacy = privacy.ip || privacy.userAgent || privacy.language || privacy.screen || privacy.timezone || privacy.hardware;
68
73
  const originalHeaders = getHeaders(event);
74
+ const originalQuery = getQuery(event);
69
75
  const contentType = originalHeaders["content-type"] || "";
70
- const compressionParam = new URL(event.path, "http://localhost").searchParams.get("compression");
76
+ const compressionParam = originalQuery.compression || "";
71
77
  const isBinaryBody = Boolean(
72
- originalHeaders["content-encoding"] || contentType.includes("octet-stream") || compressionParam && /gzip|deflate|br|compress|base64/i.test(compressionParam)
78
+ originalHeaders["content-encoding"] || contentType.includes("octet-stream") || compressionParam && COMPRESSION_RE.test(compressionParam)
73
79
  );
74
- let targetPath = path.slice(matchedPrefix.length);
75
- if (targetPath && !targetPath.startsWith("/")) {
76
- targetPath = "/" + targetPath;
77
- }
78
- let targetUrl = targetBase + targetPath;
80
+ let targetUrl = targetBase + remainingPath;
81
+ let strippedQueryRecord;
79
82
  if (anyPrivacy) {
80
- const query = getQuery(event);
81
- if (Object.keys(query).length > 0) {
82
- const strippedQuery = stripQueryFingerprinting(query, privacy);
83
+ if (Object.keys(originalQuery).length > 0) {
84
+ const { queryString, stripped } = stripQueryFingerprinting(originalQuery, privacy);
85
+ strippedQueryRecord = stripped;
83
86
  const basePath = targetUrl.split("?")[0] || targetUrl;
84
- targetUrl = strippedQuery ? `${basePath}?${strippedQuery}` : basePath;
87
+ targetUrl = queryString ? `${basePath}?${queryString}` : basePath;
85
88
  }
86
89
  }
87
90
  const headers = {};
88
91
  for (const [key, value] of Object.entries(originalHeaders)) {
89
- if (!value) continue;
92
+ if (!value)
93
+ continue;
90
94
  const lowerKey = key.toLowerCase();
91
- if (SENSITIVE_HEADERS.includes(lowerKey)) continue;
95
+ if (lowerKey === "host")
96
+ continue;
97
+ if (SENSITIVE_HEADERS.includes(lowerKey))
98
+ continue;
92
99
  if (lowerKey === "content-length") {
93
- if (anyPrivacy && !isBinaryBody) continue;
100
+ if (anyPrivacy && !isBinaryBody)
101
+ continue;
94
102
  headers[lowerKey] = value;
95
103
  continue;
96
104
  }
97
105
  if (lowerKey === "x-forwarded-for" || lowerKey === "x-real-ip" || lowerKey === "forwarded" || lowerKey === "cf-connecting-ip" || lowerKey === "true-client-ip" || lowerKey === "x-client-ip" || lowerKey === "x-cluster-client-ip") {
98
- if (privacy.ip) continue;
106
+ if (privacy.ip)
107
+ continue;
99
108
  headers[lowerKey] = value;
100
109
  continue;
101
110
  }
@@ -108,11 +117,12 @@ export default defineEventHandler(async (event) => {
108
117
  continue;
109
118
  }
110
119
  if (lowerKey === "sec-ch-ua" || lowerKey === "sec-ch-ua-full-version-list") {
111
- headers[lowerKey] = privacy.hardware ? value.replace(/;v="(\d+)\.[^"]*"/g, ';v="$1"') : value;
120
+ headers[lowerKey] = privacy.hardware ? value.replace(CLIENT_HINT_VERSION_RE, ';v="$1"') : value;
112
121
  continue;
113
122
  }
114
123
  if (lowerKey === "sec-ch-ua-platform-version" || lowerKey === "sec-ch-ua-arch" || lowerKey === "sec-ch-ua-model" || lowerKey === "sec-ch-ua-bitness") {
115
- if (privacy.hardware) continue;
124
+ if (privacy.hardware)
125
+ continue;
116
126
  headers[lowerKey] = value;
117
127
  continue;
118
128
  }
@@ -134,7 +144,6 @@ export default defineEventHandler(async (event) => {
134
144
  let rawBody;
135
145
  let passthroughBody = false;
136
146
  const method = event.method?.toUpperCase();
137
- const originalQuery = getQuery(event);
138
147
  const isWriteMethod = method === "POST" || method === "PUT" || method === "PATCH";
139
148
  if (isWriteMethod) {
140
149
  if (isBinaryBody || !anyPrivacy) {
@@ -149,36 +158,50 @@ export default defineEventHandler(async (event) => {
149
158
  } else if (typeof rawBody === "object") {
150
159
  body = stripPayloadFingerprinting(rawBody, privacy);
151
160
  } else if (typeof rawBody === "string") {
152
- if (rawBody.startsWith("{") || rawBody.startsWith("[")) {
153
- let parsed = null;
154
- try {
155
- parsed = JSON.parse(rawBody);
156
- } catch {
157
- }
158
- if (Array.isArray(parsed)) {
159
- body = parsed.map(
160
- (item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
161
- );
162
- } else if (parsed && typeof parsed === "object") {
163
- body = stripPayloadFingerprinting(parsed, privacy);
164
- } else {
165
- body = rawBody;
166
- }
167
- } else if (contentType.includes("application/x-www-form-urlencoded")) {
161
+ if (contentType.includes("application/x-www-form-urlencoded")) {
168
162
  const params = new URLSearchParams(rawBody);
169
163
  const obj = {};
170
- params.forEach((value, key) => {
171
- obj[key] = value;
172
- });
164
+ for (const [key, value] of params.entries()) {
165
+ if (key in obj) {
166
+ const existing = obj[key];
167
+ obj[key] = Array.isArray(existing) ? [...existing, value] : [existing, value];
168
+ } else {
169
+ obj[key] = value;
170
+ }
171
+ }
173
172
  const stripped = stripPayloadFingerprinting(obj, privacy);
174
- const stringified = {};
173
+ const out = new URLSearchParams();
175
174
  for (const [k, v] of Object.entries(stripped)) {
176
- if (v === void 0 || v === null) continue;
177
- stringified[k] = typeof v === "string" ? v : JSON.stringify(v);
175
+ if (v === void 0 || v === null)
176
+ continue;
177
+ if (Array.isArray(v)) {
178
+ for (const item of v)
179
+ out.append(k, typeof item === "string" ? item : JSON.stringify(item));
180
+ } else {
181
+ out.append(k, typeof v === "string" ? v : JSON.stringify(v));
182
+ }
178
183
  }
179
- body = new URLSearchParams(stringified).toString();
184
+ body = out.toString();
180
185
  } else {
181
- body = rawBody;
186
+ const maybeJson = contentType.includes("json") || (rawBody.startsWith("{") || rawBody.startsWith("["));
187
+ if (maybeJson) {
188
+ let parsed = null;
189
+ try {
190
+ parsed = JSON.parse(rawBody);
191
+ } catch {
192
+ }
193
+ if (Array.isArray(parsed)) {
194
+ body = parsed.map(
195
+ (item) => item && typeof item === "object" && !Array.isArray(item) ? stripPayloadFingerprinting(item, privacy) : item
196
+ );
197
+ } else if (parsed && typeof parsed === "object") {
198
+ body = stripPayloadFingerprinting(parsed, privacy);
199
+ } else {
200
+ body = rawBody;
201
+ }
202
+ } else {
203
+ body = rawBody;
204
+ }
182
205
  }
183
206
  } else {
184
207
  body = rawBody;
@@ -186,6 +209,7 @@ export default defineEventHandler(async (event) => {
186
209
  }
187
210
  }
188
211
  }
212
+ const nitro = useNitroApp();
189
213
  await nitro.hooks.callHook("nuxt-scripts:proxy", {
190
214
  timestamp: Date.now(),
191
215
  path: event.path,
@@ -200,7 +224,7 @@ export default defineEventHandler(async (event) => {
200
224
  },
201
225
  stripped: {
202
226
  headers,
203
- query: anyPrivacy ? stripPayloadFingerprinting(originalQuery, privacy) : originalQuery,
227
+ query: strippedQueryRecord ?? originalQuery,
204
228
  body: passthroughBody ? "<passthrough>" : body ?? null
205
229
  }
206
230
  });
@@ -226,24 +250,18 @@ export default defineEventHandler(async (event) => {
226
250
  duplex: passthroughBody ? "half" : void 0
227
251
  });
228
252
  } catch (err) {
229
- clearTimeout(timeoutId);
230
- log("[proxy] Fetch error:", err instanceof Error ? err.message : err);
231
- if (path.includes("/collect") || path.includes("/tr") || path.includes("/events")) {
232
- event.node.res.statusCode = 204;
233
- return "";
234
- }
235
- const isTimeout = err instanceof Error && (err.message.includes("aborted") || err.message.includes("timeout"));
253
+ log("[proxy] Upstream error:", err);
236
254
  throw createError({
237
- statusCode: isTimeout ? 504 : 502,
238
- statusMessage: isTimeout ? "Upstream timeout" : "Bad Gateway",
239
- message: "Failed to reach upstream"
255
+ statusCode: 502,
256
+ statusMessage: "Bad Gateway",
257
+ message: `Proxy upstream request failed: ${targetUrl}`
240
258
  });
259
+ } finally {
260
+ clearTimeout(timeoutId);
241
261
  }
242
- clearTimeout(timeoutId);
243
262
  log("[proxy] Response:", response.status, response.statusText);
244
- const skipHeaders = ["set-cookie", "transfer-encoding", "content-encoding", "content-length"];
245
263
  response.headers.forEach((value, key) => {
246
- if (!skipHeaders.includes(key.toLowerCase())) {
264
+ if (!SKIP_RESPONSE_HEADERS.has(key.toLowerCase())) {
247
265
  setResponseHeader(event, key, value);
248
266
  }
249
267
  });
@@ -0,0 +1,12 @@
1
+ export interface ImageProxyConfig {
2
+ allowedDomains: string[] | ((hostname: string) => boolean);
3
+ accept?: string;
4
+ userAgent?: string;
5
+ cacheMaxAge?: number;
6
+ contentType?: string;
7
+ /** Follow redirects (default: true). Set to false to reject redirects (SSRF protection). */
8
+ followRedirects?: boolean;
9
+ /** Decode &amp; in URL query parameter */
10
+ decodeAmpersands?: boolean;
11
+ }
12
+ export declare function createImageProxyHandler(config: ImageProxyConfig): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
@@ -0,0 +1,70 @@
1
+ import { createError, defineEventHandler, getQuery, setHeader } from "h3";
2
+ import { $fetch } from "ofetch";
3
+ const AMP_RE = /&amp;/g;
4
+ export function createImageProxyHandler(config) {
5
+ const {
6
+ accept = "image/webp,image/jpeg,image/png,image/*,*/*;q=0.8",
7
+ userAgent,
8
+ cacheMaxAge = 3600,
9
+ contentType = "image/jpeg",
10
+ followRedirects = true,
11
+ decodeAmpersands = false
12
+ } = config;
13
+ return defineEventHandler(async (event) => {
14
+ const query = getQuery(event);
15
+ let url = query.url;
16
+ if (decodeAmpersands && url)
17
+ url = url.replace(AMP_RE, "&");
18
+ if (!url) {
19
+ throw createError({
20
+ statusCode: 400,
21
+ statusMessage: "Image URL is required"
22
+ });
23
+ }
24
+ let parsedUrl;
25
+ try {
26
+ parsedUrl = new URL(url);
27
+ } catch {
28
+ throw createError({
29
+ statusCode: 400,
30
+ statusMessage: "Invalid image URL"
31
+ });
32
+ }
33
+ if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
34
+ throw createError({
35
+ statusCode: 400,
36
+ statusMessage: "Invalid URL scheme"
37
+ });
38
+ }
39
+ const domainAllowed = typeof config.allowedDomains === "function" ? config.allowedDomains(parsedUrl.hostname) : config.allowedDomains.includes(parsedUrl.hostname);
40
+ if (!domainAllowed) {
41
+ throw createError({
42
+ statusCode: 403,
43
+ statusMessage: "Domain not allowed"
44
+ });
45
+ }
46
+ const headers = { Accept: accept };
47
+ if (userAgent)
48
+ headers["User-Agent"] = userAgent;
49
+ const response = await $fetch.raw(url, {
50
+ timeout: 5e3,
51
+ redirect: followRedirects ? "follow" : "manual",
52
+ ignoreResponseError: !followRedirects,
53
+ headers
54
+ }).catch((error) => {
55
+ throw createError({
56
+ statusCode: error.statusCode || 500,
57
+ statusMessage: error.statusMessage || "Failed to fetch image"
58
+ });
59
+ });
60
+ if (!followRedirects && response.status >= 300 && response.status < 400) {
61
+ throw createError({
62
+ statusCode: 403,
63
+ statusMessage: "Redirects not allowed"
64
+ });
65
+ }
66
+ setHeader(event, "Content-Type", response.headers.get("content-type") || contentType);
67
+ setHeader(event, "Cache-Control", `public, max-age=${cacheMaxAge}, s-maxage=${cacheMaxAge}`);
68
+ return response._data;
69
+ });
70
+ }
@@ -20,7 +20,7 @@ export interface ProxyPrivacy {
20
20
  * Privacy input: `true` = full anonymize, `false` = passthrough (still strips sensitive headers),
21
21
  * or a `ProxyPrivacy` object for granular control (unset flags default to `false` — opt-in).
22
22
  */
23
- export type ProxyPrivacyInput = boolean | ProxyPrivacy | null;
23
+ export type ProxyPrivacyInput = boolean | ProxyPrivacy;
24
24
  /** Resolved privacy with all flags explicitly set. */
25
25
  export type ResolvedProxyPrivacy = Required<ProxyPrivacy>;
26
26
  /**
@@ -71,7 +71,6 @@ export declare const STRIP_PARAMS: {
71
71
  browserVersion: string[];
72
72
  browserData: string[];
73
73
  location: string[];
74
- canvas: string[];
75
74
  deviceInfo: string[];
76
75
  };
77
76
  /**
@@ -130,12 +129,4 @@ export declare function generalizeTimezone(value: unknown): string | number;
130
129
  * (timezone, language, screen dimensions) while keeping low-entropy values.
131
130
  */
132
131
  export declare function anonymizeDeviceInfo(value: string): string;
133
- /**
134
- * Recursively anonymize fingerprinting data in payload.
135
- * Fields are generalized or normalized rather than stripped, so endpoints
136
- * still receive valid data with reduced fingerprinting precision.
137
- *
138
- * When `privacy` is provided, only categories with their flag set to `true` are processed.
139
- * Default (no arg) = all categories active, so existing callers work unchanged.
140
- */
141
132
  export declare function stripPayloadFingerprinting(payload: Record<string, unknown>, privacy?: ResolvedProxyPrivacy): Record<string, unknown>;
@@ -1,8 +1,17 @@
1
1
  const FULL_PRIVACY = { ip: true, userAgent: true, language: true, screen: true, timezone: true, hardware: true };
2
2
  const NO_PRIVACY = { ip: false, userAgent: false, language: false, screen: false, timezone: false, hardware: false };
3
+ const MAJOR_VERSION_RE = /^(\d+)/;
4
+ const VERSION_RE = /^(\d+)(([.\-_])\d+)*/;
5
+ const VERSION_SPLIT_RE = /[.\-_]/;
6
+ const SNAPCHAT_VERSION_RE = /("version"\s*:\s*")(\d+(?:\.\d+)*)/g;
7
+ const GA_VERSION_RE = /;(\d+(?:\.\d+)*)/g;
8
+ const UPPERCASE_RE = /^[A-Z]/;
9
+ const LANG_CODE_RE = /^[a-z]{2}(?:-[a-z]{2,})?$/i;
3
10
  export function resolvePrivacy(input) {
4
- if (input === true) return { ...FULL_PRIVACY };
5
- if (input === false || input === void 0 || input === null) return { ...NO_PRIVACY };
11
+ if (input === true)
12
+ return { ...FULL_PRIVACY };
13
+ if (input === false || input === void 0)
14
+ return { ...NO_PRIVACY };
6
15
  return {
7
16
  ip: input.ip ?? false,
8
17
  userAgent: input.userAgent ?? false,
@@ -13,8 +22,10 @@ export function resolvePrivacy(input) {
13
22
  };
14
23
  }
15
24
  export function mergePrivacy(base, override) {
16
- if (override === void 0 || override === null) return base;
17
- if (typeof override === "boolean") return resolvePrivacy(override);
25
+ if (override === void 0)
26
+ return base;
27
+ if (typeof override === "boolean")
28
+ return resolvePrivacy(override);
18
29
  return {
19
30
  ip: override.ip !== void 0 ? override.ip : base.ip,
20
31
  userAgent: override.userAgent !== void 0 ? override.userAgent : base.userAgent,
@@ -67,11 +78,13 @@ export const STRIP_PARAMS = {
67
78
  // Browser version lists — generalized to major versions (d_bvs = Snapchat, uafvl = GA Client Hints)
68
79
  browserVersion: ["d_bvs", "uafvl"],
69
80
  // Browser data lists — replaced with empty value
70
- browserData: ["plugins", "fonts"],
81
+ browserData: ["plugins", "fonts", "audiofingerprint"],
71
82
  // Location/Timezone — generalized
72
83
  location: ["tz", "timezone", "timezoneoffset"],
73
- // Canvas/WebGL/Audio fingerprints — replaced with empty value (pure fingerprints, no analytics value)
74
- canvas: ["canvas", "webgl", "audiofingerprint"],
84
+ // Canvas/WebGL fingerprints — neutralized at build time via AST rewriting (rewrite-ast.ts).
85
+ // These params are no longer stripped at runtime; the source APIs (toDataURL, WEBGL_debug_renderer_info)
86
+ // are neutralized before the script ever runs.
87
+ // canvas: ['canvas', 'webgl'],
75
88
  // Combined device fingerprinting (X/Twitter dv param contains: timezone, locale, vendor, platform, screen, etc.)
76
89
  deviceInfo: ["dv", "device_info", "deviceinfo"]
77
90
  };
@@ -81,7 +94,7 @@ export const NORMALIZE_PARAMS = {
81
94
  };
82
95
  export function anonymizeIP(ip) {
83
96
  if (ip.includes(":")) {
84
- return ip.split(":").slice(0, 3).join(":") + "::";
97
+ return `${ip.split(":").slice(0, 3).join(":")}::`;
85
98
  }
86
99
  const parts = ip.split(".");
87
100
  if (parts.length === 4) {
@@ -103,7 +116,7 @@ export function normalizeUserAgent(ua) {
103
116
  const idx = ua.indexOf(pattern);
104
117
  if (idx !== -1) {
105
118
  const versionStart = idx + pattern.length;
106
- const majorVersion = ua.slice(versionStart).match(/^(\d+)/)?.[1];
119
+ const majorVersion = ua.slice(versionStart).match(MAJOR_VERSION_RE)?.[1];
107
120
  if (majorVersion)
108
121
  return `Mozilla/5.0 (compatible; ${family}/${majorVersion}.0)`;
109
122
  }
@@ -119,8 +132,10 @@ const SCREEN_BUCKETS = {
119
132
  mobile: { w: 360, h: 640 }
120
133
  };
121
134
  function getDeviceClass(width) {
122
- if (width >= 1200) return "desktop";
123
- if (width >= 700) return "tablet";
135
+ if (width >= 1200)
136
+ return "desktop";
137
+ if (width >= 700)
138
+ return "tablet";
124
139
  return "mobile";
125
140
  }
126
141
  export function generalizeScreen(value, dimension) {
@@ -139,31 +154,38 @@ export function generalizeScreen(value, dimension) {
139
154
  }
140
155
  export function generalizeHardware(value) {
141
156
  const num = typeof value === "number" ? value : Number(value);
142
- if (Number.isNaN(num)) return 4;
143
- if (num >= 16) return 16;
144
- if (num >= 8) return 8;
145
- if (num >= 4) return 4;
157
+ if (Number.isNaN(num))
158
+ return 4;
159
+ if (num >= 16)
160
+ return 16;
161
+ if (num >= 8)
162
+ return 8;
163
+ if (num >= 4)
164
+ return 4;
146
165
  return 2;
147
166
  }
148
167
  export function generalizeVersion(value) {
149
- if (typeof value !== "string") return String(value);
150
- const match = value.match(/^(\d+)(([.\-_])\d+)*/);
151
- if (!match) return String(value);
168
+ if (typeof value !== "string")
169
+ return String(value);
170
+ const match = value.match(VERSION_RE);
171
+ if (!match)
172
+ return String(value);
152
173
  const major = match[1];
153
174
  const sep = match[3] || ".";
154
- const segmentCount = value.split(/[.\-_]/).length;
155
- return major + (sep + "0").repeat(segmentCount - 1);
175
+ const segmentCount = value.split(VERSION_SPLIT_RE).length;
176
+ return major + `${sep}0`.repeat(segmentCount - 1);
156
177
  }
157
178
  export function generalizeBrowserVersions(value) {
158
- if (typeof value !== "string") return String(value);
179
+ if (typeof value !== "string")
180
+ return String(value);
159
181
  const zeroSegments = (ver) => {
160
182
  const parts = ver.split(".");
161
183
  return parts[0] + parts.slice(1).map(() => ".0").join("");
162
184
  };
163
185
  if (value.includes('"version"'))
164
- return value.replace(/("version"\s*:\s*")(\d+(?:\.\d+)*)/g, (_, prefix, ver) => prefix + zeroSegments(ver));
186
+ return value.replace(SNAPCHAT_VERSION_RE, (_, prefix, ver) => prefix + zeroSegments(ver));
165
187
  if (value.includes(";"))
166
- return value.replace(/;(\d+(?:\.\d+)*)/g, (_, ver) => ";" + zeroSegments(ver));
188
+ return value.replace(GA_VERSION_RE, (_, ver) => `;${zeroSegments(ver)}`);
167
189
  return value;
168
190
  }
169
191
  export function generalizeTimezone(value) {
@@ -178,15 +200,16 @@ export function generalizeTimezone(value) {
178
200
  export function anonymizeDeviceInfo(value) {
179
201
  const sep = value.includes("|") ? "|" : "&";
180
202
  const parts = value.split(sep);
181
- if (parts.length < 4) return value;
203
+ if (parts.length < 4)
204
+ return value;
182
205
  const result = [...parts];
183
206
  for (let i = 0; i < parts.length; i++) {
184
207
  const part = parts[i];
185
- if (part.includes("/") && /^[A-Z]/.test(part)) {
208
+ if (part.includes("/") && UPPERCASE_RE.test(part)) {
186
209
  result[i] = String(generalizeTimezone(part));
187
210
  continue;
188
211
  }
189
- if (/^[a-z]{2}(?:-[a-z]{2,})?$/i.test(part)) {
212
+ if (LANG_CODE_RE.test(part)) {
190
213
  result[i] = normalizeLanguage(part);
191
214
  continue;
192
215
  }
@@ -209,6 +232,13 @@ export function anonymizeDeviceInfo(value) {
209
232
  }
210
233
  return result.join(sep);
211
234
  }
235
+ function matchesParam(key, params) {
236
+ const lk = key.toLowerCase();
237
+ return params.some((pm) => {
238
+ const lp = pm.toLowerCase();
239
+ return lk === lp || lk.startsWith(`${lp}[`);
240
+ });
241
+ }
212
242
  export function stripPayloadFingerprinting(payload, privacy) {
213
243
  const p = privacy || FULL_PRIVACY;
214
244
  const result = {};
@@ -216,18 +246,12 @@ export function stripPayloadFingerprinting(payload, privacy) {
216
246
  for (const [key, value] of Object.entries(payload)) {
217
247
  if (key.toLowerCase() === "sw") {
218
248
  const num = typeof value === "number" ? value : Number(value);
219
- if (!Number.isNaN(num)) deviceClass = getDeviceClass(num);
249
+ if (!Number.isNaN(num))
250
+ deviceClass = getDeviceClass(num);
220
251
  }
221
252
  }
222
253
  for (const [key, value] of Object.entries(payload)) {
223
254
  const lowerKey = key.toLowerCase();
224
- const matchesParam = (key2, params) => {
225
- const lk = key2.toLowerCase();
226
- return params.some((pm) => {
227
- const lp = pm.toLowerCase();
228
- return lk === lp || lk.startsWith(lp + "[");
229
- });
230
- };
231
255
  const isLanguageParam = NORMALIZE_PARAMS.language.some((pm) => lowerKey === pm.toLowerCase());
232
256
  if (isLanguageParam) {
233
257
  if (Array.isArray(value)) {
@@ -264,7 +288,7 @@ export function stripPayloadFingerprinting(payload, privacy) {
264
288
  continue;
265
289
  }
266
290
  if (matchesParam(key, STRIP_PARAMS.hardware)) {
267
- result[key] = p.screen ? generalizeHardware(value) : value;
291
+ result[key] = p.hardware ? generalizeHardware(value) : value;
268
292
  continue;
269
293
  }
270
294
  if (matchesParam(key, STRIP_PARAMS.version)) {
@@ -280,11 +304,7 @@ export function stripPayloadFingerprinting(payload, privacy) {
280
304
  continue;
281
305
  }
282
306
  if (matchesParam(key, STRIP_PARAMS.browserData)) {
283
- result[key] = p.hardware ? Array.isArray(value) ? [] : "" : value;
284
- continue;
285
- }
286
- if (matchesParam(key, STRIP_PARAMS.canvas)) {
287
- result[key] = p.hardware ? typeof value === "number" ? 0 : typeof value === "object" ? {} : "" : value;
307
+ result[key] = p.hardware ? Array.isArray(value) ? [] : typeof value === "number" ? 0 : "" : value;
288
308
  continue;
289
309
  }
290
310
  if (matchesParam(key, STRIP_PARAMS.deviceInfo)) {