@noodleseed/one 0.93.0 → 0.94.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 (439) hide show
  1. package/dist/bin.js +0 -0
  2. package/dist/deploy.js +1 -1
  3. package/dist/deploy.js.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/platform-support.js +2 -2
  9. package/dist/platform-support.js.map +1 -1
  10. package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.d.ts.map +1 -1
  11. package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.js +8 -0
  12. package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.js.map +1 -1
  13. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +3 -3
  14. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
  15. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
  16. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +9 -0
  17. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
  18. package/node_modules/@noodle-borg/agent-kit/dist/plugin-bundle.d.ts.map +1 -1
  19. package/node_modules/@noodle-borg/agent-kit/dist/plugin-bundle.js +8 -0
  20. package/node_modules/@noodle-borg/agent-kit/dist/plugin-bundle.js.map +1 -1
  21. package/node_modules/@noodle-borg/agent-kit/dist/plugin-launcher.d.ts.map +1 -1
  22. package/node_modules/@noodle-borg/agent-kit/dist/plugin-launcher.js +24 -1
  23. package/node_modules/@noodle-borg/agent-kit/dist/plugin-launcher.js.map +1 -1
  24. package/node_modules/@noodle-borg/agent-kit/dist/plugin-manifests.js +30 -22
  25. package/node_modules/@noodle-borg/agent-kit/dist/plugin-manifests.js.map +1 -1
  26. package/node_modules/@noodle-borg/agent-kit/dist/plugin-marketplace-docs.d.ts.map +1 -1
  27. package/node_modules/@noodle-borg/agent-kit/dist/plugin-marketplace-docs.js +15 -0
  28. package/node_modules/@noodle-borg/agent-kit/dist/plugin-marketplace-docs.js.map +1 -1
  29. package/node_modules/@noodle-borg/agent-kit/dist/plugin-platform-support.d.ts +13 -0
  30. package/node_modules/@noodle-borg/agent-kit/dist/plugin-platform-support.d.ts.map +1 -0
  31. package/node_modules/@noodle-borg/agent-kit/dist/plugin-platform-support.js +13 -0
  32. package/node_modules/@noodle-borg/agent-kit/dist/plugin-platform-support.js.map +1 -0
  33. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-auth-ref.d.ts +2 -0
  34. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-auth-ref.d.ts.map +1 -0
  35. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-auth-ref.js +171 -0
  36. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-auth-ref.js.map +1 -0
  37. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.d.ts.map +1 -1
  38. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +3 -97
  39. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js.map +1 -1
  40. package/node_modules/@noodle-borg/auth/dist/claims.d.ts +2 -0
  41. package/node_modules/@noodle-borg/auth/dist/claims.d.ts.map +1 -1
  42. package/node_modules/@noodle-borg/auth/dist/claims.js +15 -0
  43. package/node_modules/@noodle-borg/auth/dist/claims.js.map +1 -1
  44. package/node_modules/@noodle-borg/auth/dist/index.d.ts +2 -2
  45. package/node_modules/@noodle-borg/auth/dist/index.d.ts.map +1 -1
  46. package/node_modules/@noodle-borg/auth/dist/index.js +1 -1
  47. package/node_modules/@noodle-borg/auth/dist/index.js.map +1 -1
  48. package/node_modules/@noodle-borg/auth/dist/verify.d.ts +10 -1
  49. package/node_modules/@noodle-borg/auth/dist/verify.d.ts.map +1 -1
  50. package/node_modules/@noodle-borg/auth/dist/verify.js +9 -2
  51. package/node_modules/@noodle-borg/auth/dist/verify.js.map +1 -1
  52. package/node_modules/@noodle-borg/authoring/dist/connectors.d.ts +2 -2
  53. package/node_modules/@noodle-borg/authoring/dist/connectors.d.ts.map +1 -1
  54. package/node_modules/@noodle-borg/authoring/dist/connectors.js +4 -1
  55. package/node_modules/@noodle-borg/authoring/dist/connectors.js.map +1 -1
  56. package/node_modules/@noodle-borg/authoring/dist/customer-auth.d.ts +13 -0
  57. package/node_modules/@noodle-borg/authoring/dist/customer-auth.d.ts.map +1 -1
  58. package/node_modules/@noodle-borg/authoring/dist/customer-auth.js +31 -2
  59. package/node_modules/@noodle-borg/authoring/dist/customer-auth.js.map +1 -1
  60. package/node_modules/@noodle-borg/authoring/dist/customer-endpoint.d.ts +10 -0
  61. package/node_modules/@noodle-borg/authoring/dist/customer-endpoint.d.ts.map +1 -0
  62. package/node_modules/@noodle-borg/authoring/dist/customer-endpoint.js +18 -0
  63. package/node_modules/@noodle-borg/authoring/dist/customer-endpoint.js.map +1 -0
  64. package/node_modules/@noodle-borg/authoring/dist/index.d.ts +2 -1
  65. package/node_modules/@noodle-borg/authoring/dist/index.d.ts.map +1 -1
  66. package/node_modules/@noodle-borg/authoring/dist/index.js +1 -0
  67. package/node_modules/@noodle-borg/authoring/dist/index.js.map +1 -1
  68. package/node_modules/@noodle-borg/authoring/dist/server.d.ts +1 -1
  69. package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
  70. package/node_modules/@noodle-borg/authoring/dist/server.js +1 -13
  71. package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
  72. package/node_modules/@noodle-borg/compiler/dist/artifact/assemble.d.ts +27 -0
  73. package/node_modules/@noodle-borg/compiler/dist/artifact/assemble.d.ts.map +1 -0
  74. package/node_modules/@noodle-borg/compiler/dist/artifact/assemble.js +73 -0
  75. package/node_modules/@noodle-borg/compiler/dist/artifact/assemble.js.map +1 -0
  76. package/node_modules/@noodle-borg/compiler/dist/artifact/catalog-emission.d.ts +50 -0
  77. package/node_modules/@noodle-borg/compiler/dist/artifact/catalog-emission.d.ts.map +1 -0
  78. package/node_modules/@noodle-borg/compiler/dist/artifact/catalog-emission.js +119 -0
  79. package/node_modules/@noodle-borg/compiler/dist/artifact/catalog-emission.js.map +1 -0
  80. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +22 -1
  81. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts.map +1 -1
  82. package/node_modules/@noodle-borg/compiler/dist/artifact/types.js +5 -1
  83. package/node_modules/@noodle-borg/compiler/dist/artifact/types.js.map +1 -1
  84. package/node_modules/@noodle-borg/compiler/dist/catalog/in-memory.js +1 -1
  85. package/node_modules/@noodle-borg/compiler/dist/catalog/in-memory.js.map +1 -1
  86. package/node_modules/@noodle-borg/compiler/dist/catalog/types.d.ts +8 -0
  87. package/node_modules/@noodle-borg/compiler/dist/catalog/types.d.ts.map +1 -1
  88. package/node_modules/@noodle-borg/compiler/dist/catalog/types.js +0 -9
  89. package/node_modules/@noodle-borg/compiler/dist/catalog/types.js.map +1 -1
  90. package/node_modules/@noodle-borg/compiler/dist/compile.d.ts +1 -11
  91. package/node_modules/@noodle-borg/compiler/dist/compile.d.ts.map +1 -1
  92. package/node_modules/@noodle-borg/compiler/dist/compile.js +29 -163
  93. package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
  94. package/node_modules/@noodle-borg/compiler/dist/context-compile.d.ts +2 -1
  95. package/node_modules/@noodle-borg/compiler/dist/context-compile.d.ts.map +1 -1
  96. package/node_modules/@noodle-borg/compiler/dist/context-compile.js +3 -1
  97. package/node_modules/@noodle-borg/compiler/dist/context-compile.js.map +1 -1
  98. package/node_modules/@noodle-borg/compiler/dist/customer-endpoint.d.ts +34 -0
  99. package/node_modules/@noodle-borg/compiler/dist/customer-endpoint.d.ts.map +1 -0
  100. package/node_modules/@noodle-borg/compiler/dist/customer-endpoint.js +240 -0
  101. package/node_modules/@noodle-borg/compiler/dist/customer-endpoint.js.map +1 -0
  102. package/node_modules/@noodle-borg/compiler/dist/customer-routing.d.ts +24 -0
  103. package/node_modules/@noodle-borg/compiler/dist/customer-routing.d.ts.map +1 -0
  104. package/node_modules/@noodle-borg/compiler/dist/customer-routing.js +136 -0
  105. package/node_modules/@noodle-borg/compiler/dist/customer-routing.js.map +1 -0
  106. package/node_modules/@noodle-borg/compiler/dist/errors.d.ts +1 -1
  107. package/node_modules/@noodle-borg/compiler/dist/errors.d.ts.map +1 -1
  108. package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.d.ts +7 -3
  109. package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.d.ts.map +1 -1
  110. package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.js +7 -1
  111. package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.js.map +1 -1
  112. package/node_modules/@noodle-borg/compiler/dist/index.d.ts +3 -2
  113. package/node_modules/@noodle-borg/compiler/dist/index.d.ts.map +1 -1
  114. package/node_modules/@noodle-borg/compiler/dist/index.js +1 -0
  115. package/node_modules/@noodle-borg/compiler/dist/index.js.map +1 -1
  116. package/node_modules/@noodle-borg/compiler/dist/manifest/auth-schema.d.ts +110 -0
  117. package/node_modules/@noodle-borg/compiler/dist/manifest/auth-schema.d.ts.map +1 -0
  118. package/node_modules/@noodle-borg/compiler/dist/manifest/auth-schema.js +191 -0
  119. package/node_modules/@noodle-borg/compiler/dist/manifest/auth-schema.js.map +1 -0
  120. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +12 -0
  121. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
  122. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +1 -73
  123. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -1
  124. package/node_modules/@noodle-borg/compiler/package.json +1 -0
  125. package/node_modules/@noodle-borg/compute/dist/code-connector.d.ts +1 -0
  126. package/node_modules/@noodle-borg/compute/dist/code-connector.d.ts.map +1 -1
  127. package/node_modules/@noodle-borg/compute/dist/code-connector.js.map +1 -1
  128. package/node_modules/@noodle-borg/connector-defs/dist/call-graph.d.ts.map +1 -1
  129. package/node_modules/@noodle-borg/connector-defs/dist/call-graph.js +6 -6
  130. package/node_modules/@noodle-borg/connector-defs/dist/call-graph.js.map +1 -1
  131. package/node_modules/@noodle-borg/connector-defs/dist/compile-auth.d.ts +2 -0
  132. package/node_modules/@noodle-borg/connector-defs/dist/compile-auth.d.ts.map +1 -1
  133. package/node_modules/@noodle-borg/connector-defs/dist/compile-auth.js +12 -9
  134. package/node_modules/@noodle-borg/connector-defs/dist/compile-auth.js.map +1 -1
  135. package/node_modules/@noodle-borg/connector-defs/dist/compile-http.d.ts +14 -0
  136. package/node_modules/@noodle-borg/connector-defs/dist/compile-http.d.ts.map +1 -0
  137. package/node_modules/@noodle-borg/connector-defs/dist/compile-http.js +347 -0
  138. package/node_modules/@noodle-borg/connector-defs/dist/compile-http.js.map +1 -0
  139. package/node_modules/@noodle-borg/connector-defs/dist/compile.d.ts +4 -2
  140. package/node_modules/@noodle-borg/connector-defs/dist/compile.d.ts.map +1 -1
  141. package/node_modules/@noodle-borg/connector-defs/dist/compile.js +17 -333
  142. package/node_modules/@noodle-borg/connector-defs/dist/compile.js.map +1 -1
  143. package/node_modules/@noodle-borg/connector-defs/dist/customer-routing.d.ts +11 -0
  144. package/node_modules/@noodle-borg/connector-defs/dist/customer-routing.d.ts.map +1 -0
  145. package/node_modules/@noodle-borg/connector-defs/dist/customer-routing.js +124 -0
  146. package/node_modules/@noodle-borg/connector-defs/dist/customer-routing.js.map +1 -0
  147. package/node_modules/@noodle-borg/connector-defs/dist/http-headers.d.ts +4 -0
  148. package/node_modules/@noodle-borg/connector-defs/dist/http-headers.d.ts.map +1 -0
  149. package/node_modules/@noodle-borg/connector-defs/dist/http-headers.js +52 -0
  150. package/node_modules/@noodle-borg/connector-defs/dist/http-headers.js.map +1 -0
  151. package/node_modules/@noodle-borg/connector-defs/dist/identity-key.d.ts +5 -0
  152. package/node_modules/@noodle-borg/connector-defs/dist/identity-key.d.ts.map +1 -0
  153. package/node_modules/@noodle-borg/connector-defs/dist/identity-key.js +9 -0
  154. package/node_modules/@noodle-borg/connector-defs/dist/identity-key.js.map +1 -0
  155. package/node_modules/@noodle-borg/connector-defs/dist/schema.d.ts +33 -3
  156. package/node_modules/@noodle-borg/connector-defs/dist/schema.d.ts.map +1 -1
  157. package/node_modules/@noodle-borg/connector-defs/dist/schema.js +22 -3
  158. package/node_modules/@noodle-borg/connector-defs/dist/schema.js.map +1 -1
  159. package/node_modules/@noodle-borg/connector-http/dist/customer-route.d.ts +17 -0
  160. package/node_modules/@noodle-borg/connector-http/dist/customer-route.d.ts.map +1 -0
  161. package/node_modules/@noodle-borg/connector-http/dist/customer-route.js +77 -0
  162. package/node_modules/@noodle-borg/connector-http/dist/customer-route.js.map +1 -0
  163. package/node_modules/@noodle-borg/connector-http/dist/http-connector.d.ts +2 -2
  164. package/node_modules/@noodle-borg/connector-http/dist/http-connector.d.ts.map +1 -1
  165. package/node_modules/@noodle-borg/connector-http/dist/http-connector.js +64 -67
  166. package/node_modules/@noodle-borg/connector-http/dist/http-connector.js.map +1 -1
  167. package/node_modules/@noodle-borg/connector-http/dist/http-response.d.ts.map +1 -1
  168. package/node_modules/@noodle-borg/connector-http/dist/http-response.js +23 -21
  169. package/node_modules/@noodle-borg/connector-http/dist/http-response.js.map +1 -1
  170. package/node_modules/@noodle-borg/connector-http/dist/ssrf.d.ts.map +1 -1
  171. package/node_modules/@noodle-borg/connector-http/dist/ssrf.js +17 -2
  172. package/node_modules/@noodle-borg/connector-http/dist/ssrf.js.map +1 -1
  173. package/node_modules/@noodle-borg/connector-http/dist/url-resolution.d.ts +4 -0
  174. package/node_modules/@noodle-borg/connector-http/dist/url-resolution.d.ts.map +1 -0
  175. package/node_modules/@noodle-borg/connector-http/dist/url-resolution.js +31 -0
  176. package/node_modules/@noodle-borg/connector-http/dist/url-resolution.js.map +1 -0
  177. package/node_modules/@noodle-borg/module/dist/contract.d.ts +14 -2
  178. package/node_modules/@noodle-borg/module/dist/contract.d.ts.map +1 -1
  179. package/node_modules/@noodle-borg/module/dist/contract.js.map +1 -1
  180. package/node_modules/@noodle-borg/protocol/dist/mapping.d.ts.map +1 -1
  181. package/node_modules/@noodle-borg/protocol/dist/mapping.js +17 -0
  182. package/node_modules/@noodle-borg/protocol/dist/mapping.js.map +1 -1
  183. package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts +4 -0
  184. package/node_modules/@noodle-borg/protocol/dist/sdk-server.d.ts.map +1 -1
  185. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js +7 -1
  186. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -1
  187. package/node_modules/@noodle-borg/runtime/dist/broker/types.d.ts +24 -3
  188. package/node_modules/@noodle-borg/runtime/dist/broker/types.d.ts.map +1 -1
  189. package/node_modules/@noodle-borg/runtime/dist/broker/types.js +21 -0
  190. package/node_modules/@noodle-borg/runtime/dist/broker/types.js.map +1 -1
  191. package/node_modules/@noodle-borg/runtime/dist/confirmation.d.ts.map +1 -1
  192. package/node_modules/@noodle-borg/runtime/dist/confirmation.js +10 -0
  193. package/node_modules/@noodle-borg/runtime/dist/confirmation.js.map +1 -1
  194. package/node_modules/@noodle-borg/runtime/dist/connector/failure-details.d.ts +8 -0
  195. package/node_modules/@noodle-borg/runtime/dist/connector/failure-details.d.ts.map +1 -0
  196. package/node_modules/@noodle-borg/runtime/dist/connector/failure-details.js +53 -0
  197. package/node_modules/@noodle-borg/runtime/dist/connector/failure-details.js.map +1 -0
  198. package/node_modules/@noodle-borg/runtime/dist/connector/types.d.ts +7 -0
  199. package/node_modules/@noodle-borg/runtime/dist/connector/types.d.ts.map +1 -1
  200. package/node_modules/@noodle-borg/runtime/dist/connector/types.js +15 -0
  201. package/node_modules/@noodle-borg/runtime/dist/connector/types.js.map +1 -1
  202. package/node_modules/@noodle-borg/runtime/dist/customer-routing.d.ts +45 -0
  203. package/node_modules/@noodle-borg/runtime/dist/customer-routing.d.ts.map +1 -0
  204. package/node_modules/@noodle-borg/runtime/dist/customer-routing.js +135 -0
  205. package/node_modules/@noodle-borg/runtime/dist/customer-routing.js.map +1 -0
  206. package/node_modules/@noodle-borg/runtime/dist/execute.d.ts +10 -49
  207. package/node_modules/@noodle-borg/runtime/dist/execute.d.ts.map +1 -1
  208. package/node_modules/@noodle-borg/runtime/dist/execute.js +14 -363
  209. package/node_modules/@noodle-borg/runtime/dist/execute.js.map +1 -1
  210. package/node_modules/@noodle-borg/runtime/dist/index.d.ts +4 -2
  211. package/node_modules/@noodle-borg/runtime/dist/index.d.ts.map +1 -1
  212. package/node_modules/@noodle-borg/runtime/dist/index.js +4 -2
  213. package/node_modules/@noodle-borg/runtime/dist/index.js.map +1 -1
  214. package/node_modules/@noodle-borg/runtime/dist/interactive.d.ts.map +1 -1
  215. package/node_modules/@noodle-borg/runtime/dist/interactive.js +7 -0
  216. package/node_modules/@noodle-borg/runtime/dist/interactive.js.map +1 -1
  217. package/node_modules/@noodle-borg/runtime/dist/operation-credential.d.ts +16 -0
  218. package/node_modules/@noodle-borg/runtime/dist/operation-credential.d.ts.map +1 -0
  219. package/node_modules/@noodle-borg/runtime/dist/operation-credential.js +58 -0
  220. package/node_modules/@noodle-borg/runtime/dist/operation-credential.js.map +1 -0
  221. package/node_modules/@noodle-borg/runtime/dist/operation-execution.d.ts +48 -0
  222. package/node_modules/@noodle-borg/runtime/dist/operation-execution.d.ts.map +1 -0
  223. package/node_modules/@noodle-borg/runtime/dist/operation-execution.js +328 -0
  224. package/node_modules/@noodle-borg/runtime/dist/operation-execution.js.map +1 -0
  225. package/node_modules/@noodle-borg/runtime/dist/prepared-action-match.d.ts +3 -0
  226. package/node_modules/@noodle-borg/runtime/dist/prepared-action-match.d.ts.map +1 -0
  227. package/node_modules/@noodle-borg/runtime/dist/prepared-action-match.js +48 -0
  228. package/node_modules/@noodle-borg/runtime/dist/prepared-action-match.js.map +1 -0
  229. package/node_modules/@noodle-borg/runtime/dist/result.d.ts +1 -1
  230. package/node_modules/@noodle-borg/runtime/dist/result.d.ts.map +1 -1
  231. package/node_modules/@noodle-borg/runtime/dist/result.js.map +1 -1
  232. package/node_modules/@noodle-borg/runtime/dist/routed-output-guard.d.ts +15 -0
  233. package/node_modules/@noodle-borg/runtime/dist/routed-output-guard.d.ts.map +1 -0
  234. package/node_modules/@noodle-borg/runtime/dist/routed-output-guard.js +163 -0
  235. package/node_modules/@noodle-borg/runtime/dist/routed-output-guard.js.map +1 -0
  236. package/node_modules/@noodle-borg/service/dist/assistant-customer-issuer.d.ts +8 -0
  237. package/node_modules/@noodle-borg/service/dist/assistant-customer-issuer.d.ts.map +1 -0
  238. package/node_modules/@noodle-borg/service/dist/assistant-customer-issuer.js +13 -0
  239. package/node_modules/@noodle-borg/service/dist/assistant-customer-issuer.js.map +1 -0
  240. package/node_modules/@noodle-borg/service/dist/assistant-interactive.d.ts.map +1 -1
  241. package/node_modules/@noodle-borg/service/dist/assistant-interactive.js +2 -1
  242. package/node_modules/@noodle-borg/service/dist/assistant-interactive.js.map +1 -1
  243. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts.map +1 -1
  244. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js +1 -1
  245. package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js.map +1 -1
  246. package/node_modules/@noodle-borg/service/dist/credential-binding-index.d.ts +2 -0
  247. package/node_modules/@noodle-borg/service/dist/credential-binding-index.d.ts.map +1 -1
  248. package/node_modules/@noodle-borg/service/dist/credential-binding-index.js +5 -1
  249. package/node_modules/@noodle-borg/service/dist/credential-binding-index.js.map +1 -1
  250. package/node_modules/@noodle-borg/service/dist/credential-broker-delegated-refresh.d.ts +47 -0
  251. package/node_modules/@noodle-borg/service/dist/credential-broker-delegated-refresh.d.ts.map +1 -0
  252. package/node_modules/@noodle-borg/service/dist/credential-broker-delegated-refresh.js +165 -0
  253. package/node_modules/@noodle-borg/service/dist/credential-broker-delegated-refresh.js.map +1 -0
  254. package/node_modules/@noodle-borg/service/dist/credential-broker-delegated-token-exchange.d.ts +18 -0
  255. package/node_modules/@noodle-borg/service/dist/credential-broker-delegated-token-exchange.d.ts.map +1 -0
  256. package/node_modules/@noodle-borg/service/dist/credential-broker-delegated-token-exchange.js +112 -0
  257. package/node_modules/@noodle-borg/service/dist/credential-broker-delegated-token-exchange.js.map +1 -0
  258. package/node_modules/@noodle-borg/service/dist/credential-broker.d.ts +6 -24
  259. package/node_modules/@noodle-borg/service/dist/credential-broker.d.ts.map +1 -1
  260. package/node_modules/@noodle-borg/service/dist/credential-broker.js +23 -271
  261. package/node_modules/@noodle-borg/service/dist/credential-broker.js.map +1 -1
  262. package/node_modules/@noodle-borg/service/dist/credential-probe-route.d.ts +20 -0
  263. package/node_modules/@noodle-borg/service/dist/credential-probe-route.d.ts.map +1 -0
  264. package/node_modules/@noodle-borg/service/dist/credential-probe-route.js +28 -0
  265. package/node_modules/@noodle-borg/service/dist/credential-probe-route.js.map +1 -0
  266. package/node_modules/@noodle-borg/service/dist/credential-probes.d.ts +3 -1
  267. package/node_modules/@noodle-borg/service/dist/credential-probes.d.ts.map +1 -1
  268. package/node_modules/@noodle-borg/service/dist/credential-probes.js +54 -13
  269. package/node_modules/@noodle-borg/service/dist/credential-probes.js.map +1 -1
  270. package/node_modules/@noodle-borg/service/dist/credential-route-guard.d.ts +9 -0
  271. package/node_modules/@noodle-borg/service/dist/credential-route-guard.d.ts.map +1 -0
  272. package/node_modules/@noodle-borg/service/dist/credential-route-guard.js +34 -0
  273. package/node_modules/@noodle-borg/service/dist/credential-route-guard.js.map +1 -0
  274. package/node_modules/@noodle-borg/service/dist/credential-route-key.d.ts +12 -0
  275. package/node_modules/@noodle-borg/service/dist/credential-route-key.d.ts.map +1 -0
  276. package/node_modules/@noodle-borg/service/dist/credential-route-key.js +17 -0
  277. package/node_modules/@noodle-borg/service/dist/credential-route-key.js.map +1 -0
  278. package/node_modules/@noodle-borg/service/dist/customer-verifier.d.ts.map +1 -1
  279. package/node_modules/@noodle-borg/service/dist/customer-verifier.js +72 -21
  280. package/node_modules/@noodle-borg/service/dist/customer-verifier.js.map +1 -1
  281. package/node_modules/@noodle-borg/service/dist/delegated-token-exchange.d.ts +3 -1
  282. package/node_modules/@noodle-borg/service/dist/delegated-token-exchange.d.ts.map +1 -1
  283. package/node_modules/@noodle-borg/service/dist/delegated-token-exchange.js +24 -2
  284. package/node_modules/@noodle-borg/service/dist/delegated-token-exchange.js.map +1 -1
  285. package/node_modules/@noodle-borg/service/dist/developer-mcp/mount.js +6 -5
  286. package/node_modules/@noodle-borg/service/dist/developer-mcp/mount.js.map +1 -1
  287. package/node_modules/@noodle-borg/service/dist/external-credential-binding-broker.d.ts.map +1 -1
  288. package/node_modules/@noodle-borg/service/dist/external-credential-binding-broker.js +4 -3
  289. package/node_modules/@noodle-borg/service/dist/external-credential-binding-broker.js.map +1 -1
  290. package/node_modules/@noodle-borg/service/dist/google-workload-identity-probe.d.ts +2 -1
  291. package/node_modules/@noodle-borg/service/dist/google-workload-identity-probe.d.ts.map +1 -1
  292. package/node_modules/@noodle-borg/service/dist/google-workload-identity-probe.js +23 -7
  293. package/node_modules/@noodle-borg/service/dist/google-workload-identity-probe.js.map +1 -1
  294. package/node_modules/@noodle-borg/service/dist/google-workload-identity.d.ts.map +1 -1
  295. package/node_modules/@noodle-borg/service/dist/google-workload-identity.js +6 -5
  296. package/node_modules/@noodle-borg/service/dist/google-workload-identity.js.map +1 -1
  297. package/node_modules/@noodle-borg/service/dist/managed-config-broker-options.d.ts +18 -0
  298. package/node_modules/@noodle-borg/service/dist/managed-config-broker-options.d.ts.map +1 -0
  299. package/node_modules/@noodle-borg/service/dist/managed-config-broker-options.js +2 -0
  300. package/node_modules/@noodle-borg/service/dist/managed-config-broker-options.js.map +1 -0
  301. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts.map +1 -1
  302. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js +6 -5
  303. package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js.map +1 -1
  304. package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -1
  305. package/node_modules/@noodle-borg/service/dist/oauth/provider.js +10 -8
  306. package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -1
  307. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js +5 -5
  308. package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js.map +1 -1
  309. package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.d.ts.map +1 -1
  310. package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.js +3 -2
  311. package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.js.map +1 -1
  312. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-resolution.d.ts.map +1 -1
  313. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-resolution.js +2 -1
  314. package/node_modules/@noodle-borg/service/dist/routes/assistant-interaction-resolution.js.map +1 -1
  315. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.d.ts.map +1 -1
  316. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js +3 -2
  317. package/node_modules/@noodle-borg/service/dist/routes/assistant-interactions.js.map +1 -1
  318. package/node_modules/@noodle-borg/service/dist/routes/assistant.d.ts.map +1 -1
  319. package/node_modules/@noodle-borg/service/dist/routes/assistant.js +8 -7
  320. package/node_modules/@noodle-borg/service/dist/routes/assistant.js.map +1 -1
  321. package/node_modules/@noodle-borg/service/dist/routes/auth-doctor-live.d.ts.map +1 -1
  322. package/node_modules/@noodle-borg/service/dist/routes/auth-doctor-live.js +6 -3
  323. package/node_modules/@noodle-borg/service/dist/routes/auth-doctor-live.js.map +1 -1
  324. package/node_modules/@noodle-borg/service/dist/store.d.ts +3 -1
  325. package/node_modules/@noodle-borg/service/dist/store.d.ts.map +1 -1
  326. package/node_modules/@noodle-borg/transport-http/dist/handler.js +18 -2
  327. package/node_modules/@noodle-borg/transport-http/dist/handler.js.map +1 -1
  328. package/node_modules/@noodle-borg/transport-http/dist/identity-authorization.d.ts +2 -0
  329. package/node_modules/@noodle-borg/transport-http/dist/identity-authorization.d.ts.map +1 -1
  330. package/node_modules/@noodle-borg/transport-http/dist/identity-authorization.js +27 -9
  331. package/node_modules/@noodle-borg/transport-http/dist/identity-authorization.js.map +1 -1
  332. package/node_modules/tldts/LICENSE +13 -0
  333. package/node_modules/tldts/README.md +368 -0
  334. package/node_modules/tldts/bin/cli.js +21 -0
  335. package/node_modules/tldts/dist/cjs/index.js +1170 -0
  336. package/node_modules/tldts/dist/cjs/index.js.map +1 -0
  337. package/node_modules/tldts/dist/cjs/src/data/trie.js +12 -0
  338. package/node_modules/tldts/dist/cjs/src/data/trie.js.map +1 -0
  339. package/node_modules/tldts/dist/cjs/src/suffix-trie.js +170 -0
  340. package/node_modules/tldts/dist/cjs/src/suffix-trie.js.map +1 -0
  341. package/node_modules/tldts/dist/cjs/tsconfig.tsbuildinfo +1 -0
  342. package/node_modules/tldts/dist/es6/index.js +41 -0
  343. package/node_modules/tldts/dist/es6/index.js.map +1 -0
  344. package/node_modules/tldts/dist/es6/src/data/trie.js +9 -0
  345. package/node_modules/tldts/dist/es6/src/data/trie.js.map +1 -0
  346. package/node_modules/tldts/dist/es6/src/suffix-trie.js +167 -0
  347. package/node_modules/tldts/dist/es6/src/suffix-trie.js.map +1 -0
  348. package/node_modules/tldts/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  349. package/node_modules/tldts/dist/index.cjs.min.js +2 -0
  350. package/node_modules/tldts/dist/index.cjs.min.js.map +1 -0
  351. package/node_modules/tldts/dist/index.esm.min.js +2 -0
  352. package/node_modules/tldts/dist/index.esm.min.js.map +1 -0
  353. package/node_modules/tldts/dist/index.umd.min.js +2 -0
  354. package/node_modules/tldts/dist/index.umd.min.js.map +1 -0
  355. package/node_modules/tldts/dist/types/index.d.ts +8 -0
  356. package/node_modules/tldts/dist/types/src/data/trie.d.ts +7 -0
  357. package/node_modules/tldts/dist/types/src/suffix-trie.d.ts +5 -0
  358. package/node_modules/tldts/index.ts +74 -0
  359. package/node_modules/tldts/package.json +89 -0
  360. package/node_modules/tldts/src/data/trie.ts +8 -0
  361. package/node_modules/tldts/src/suffix-trie.ts +207 -0
  362. package/node_modules/tldts-core/LICENSE +13 -0
  363. package/node_modules/tldts-core/README.md +3 -0
  364. package/node_modules/tldts-core/dist/cjs/index.js +955 -0
  365. package/node_modules/tldts-core/dist/cjs/index.js.map +1 -0
  366. package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js +15 -0
  367. package/node_modules/tldts-core/dist/cjs/src/domain-without-suffix.js.map +1 -0
  368. package/node_modules/tldts-core/dist/cjs/src/domain.js +83 -0
  369. package/node_modules/tldts-core/dist/cjs/src/domain.js.map +1 -0
  370. package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js +439 -0
  371. package/node_modules/tldts-core/dist/cjs/src/extract-hostname.js.map +1 -0
  372. package/node_modules/tldts-core/dist/cjs/src/factory.js +128 -0
  373. package/node_modules/tldts-core/dist/cjs/src/factory.js.map +1 -0
  374. package/node_modules/tldts-core/dist/cjs/src/is-ip.js +72 -0
  375. package/node_modules/tldts-core/dist/cjs/src/is-ip.js.map +1 -0
  376. package/node_modules/tldts-core/dist/cjs/src/is-special-use.js +65 -0
  377. package/node_modules/tldts-core/dist/cjs/src/is-special-use.js.map +1 -0
  378. package/node_modules/tldts-core/dist/cjs/src/is-valid.js +80 -0
  379. package/node_modules/tldts-core/dist/cjs/src/is-valid.js.map +1 -0
  380. package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js +69 -0
  381. package/node_modules/tldts-core/dist/cjs/src/lookup/fast-path.js.map +1 -0
  382. package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js +3 -0
  383. package/node_modules/tldts-core/dist/cjs/src/lookup/interface.js.map +1 -0
  384. package/node_modules/tldts-core/dist/cjs/src/options.js +23 -0
  385. package/node_modules/tldts-core/dist/cjs/src/options.js.map +1 -0
  386. package/node_modules/tldts-core/dist/cjs/src/subdomain.js +14 -0
  387. package/node_modules/tldts-core/dist/cjs/src/subdomain.js.map +1 -0
  388. package/node_modules/tldts-core/dist/cjs/tsconfig.tsbuildinfo +1 -0
  389. package/node_modules/tldts-core/dist/es6/index.js +4 -0
  390. package/node_modules/tldts-core/dist/es6/index.js.map +1 -0
  391. package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js +12 -0
  392. package/node_modules/tldts-core/dist/es6/src/domain-without-suffix.js.map +1 -0
  393. package/node_modules/tldts-core/dist/es6/src/domain.js +80 -0
  394. package/node_modules/tldts-core/dist/es6/src/domain.js.map +1 -0
  395. package/node_modules/tldts-core/dist/es6/src/extract-hostname.js +435 -0
  396. package/node_modules/tldts-core/dist/es6/src/extract-hostname.js.map +1 -0
  397. package/node_modules/tldts-core/dist/es6/src/factory.js +123 -0
  398. package/node_modules/tldts-core/dist/es6/src/factory.js.map +1 -0
  399. package/node_modules/tldts-core/dist/es6/src/is-ip.js +69 -0
  400. package/node_modules/tldts-core/dist/es6/src/is-ip.js.map +1 -0
  401. package/node_modules/tldts-core/dist/es6/src/is-special-use.js +62 -0
  402. package/node_modules/tldts-core/dist/es6/src/is-special-use.js.map +1 -0
  403. package/node_modules/tldts-core/dist/es6/src/is-valid.js +77 -0
  404. package/node_modules/tldts-core/dist/es6/src/is-valid.js.map +1 -0
  405. package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js +66 -0
  406. package/node_modules/tldts-core/dist/es6/src/lookup/fast-path.js.map +1 -0
  407. package/node_modules/tldts-core/dist/es6/src/lookup/interface.js +2 -0
  408. package/node_modules/tldts-core/dist/es6/src/lookup/interface.js.map +1 -0
  409. package/node_modules/tldts-core/dist/es6/src/options.js +20 -0
  410. package/node_modules/tldts-core/dist/es6/src/options.js.map +1 -0
  411. package/node_modules/tldts-core/dist/es6/src/subdomain.js +11 -0
  412. package/node_modules/tldts-core/dist/es6/src/subdomain.js.map +1 -0
  413. package/node_modules/tldts-core/dist/es6/tsconfig.bundle.tsbuildinfo +1 -0
  414. package/node_modules/tldts-core/dist/types/index.d.ts +4 -0
  415. package/node_modules/tldts-core/dist/types/src/domain-without-suffix.d.ts +6 -0
  416. package/node_modules/tldts-core/dist/types/src/domain.d.ts +5 -0
  417. package/node_modules/tldts-core/dist/types/src/extract-hostname.d.ts +17 -0
  418. package/node_modules/tldts-core/dist/types/src/factory.d.ts +29 -0
  419. package/node_modules/tldts-core/dist/types/src/is-ip.d.ts +6 -0
  420. package/node_modules/tldts-core/dist/types/src/is-special-use.d.ts +5 -0
  421. package/node_modules/tldts-core/dist/types/src/is-valid.d.ts +15 -0
  422. package/node_modules/tldts-core/dist/types/src/lookup/fast-path.d.ts +2 -0
  423. package/node_modules/tldts-core/dist/types/src/lookup/interface.d.ts +9 -0
  424. package/node_modules/tldts-core/dist/types/src/options.d.ts +11 -0
  425. package/node_modules/tldts-core/dist/types/src/subdomain.d.ts +4 -0
  426. package/node_modules/tldts-core/index.ts +10 -0
  427. package/node_modules/tldts-core/package.json +68 -0
  428. package/node_modules/tldts-core/src/domain-without-suffix.ts +14 -0
  429. package/node_modules/tldts-core/src/domain.ts +100 -0
  430. package/node_modules/tldts-core/src/extract-hostname.ts +480 -0
  431. package/node_modules/tldts-core/src/factory.ts +199 -0
  432. package/node_modules/tldts-core/src/is-ip.ts +87 -0
  433. package/node_modules/tldts-core/src/is-special-use.ts +65 -0
  434. package/node_modules/tldts-core/src/is-valid.ts +89 -0
  435. package/node_modules/tldts-core/src/lookup/fast-path.ts +80 -0
  436. package/node_modules/tldts-core/src/lookup/interface.ts +10 -0
  437. package/node_modules/tldts-core/src/options.ts +45 -0
  438. package/node_modules/tldts-core/src/subdomain.ts +11 -0
  439. package/package.json +3 -1
@@ -0,0 +1,955 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Check if `vhost` is a valid suffix of `hostname` (top-domain)
5
+ *
6
+ * It means that `vhost` needs to be a suffix of `hostname` and we then need to
7
+ * make sure that: either they are equal, or the character preceding `vhost` in
8
+ * `hostname` is a '.' (it should not be a partial label).
9
+ *
10
+ * * hostname = 'not.evil.com' and vhost = 'vil.com' => not ok
11
+ * * hostname = 'not.evil.com' and vhost = 'evil.com' => ok
12
+ * * hostname = 'not.evil.com' and vhost = 'not.evil.com' => ok
13
+ */
14
+ function shareSameDomainSuffix(hostname, vhost) {
15
+ if (hostname.endsWith(vhost)) {
16
+ return (hostname.length === vhost.length ||
17
+ hostname[hostname.length - vhost.length - 1] === '.');
18
+ }
19
+ return false;
20
+ }
21
+ /**
22
+ * Given a hostname and its public suffix, extract the general domain.
23
+ */
24
+ function extractDomainWithSuffix(hostname, publicSuffix) {
25
+ // Locate the index of the last '.' in the part of the `hostname` preceding
26
+ // the public suffix.
27
+ //
28
+ // examples:
29
+ // 1. not.evil.co.uk => evil.co.uk
30
+ // ^ ^
31
+ // | | start of public suffix
32
+ // | index of the last dot
33
+ //
34
+ // 2. example.co.uk => example.co.uk
35
+ // ^ ^
36
+ // | | start of public suffix
37
+ // |
38
+ // | (-1) no dot found before the public suffix
39
+ const publicSuffixIndex = hostname.length - publicSuffix.length - 2;
40
+ const lastDotBeforeSuffixIndex = hostname.lastIndexOf('.', publicSuffixIndex);
41
+ // No '.' found, then `hostname` is the general domain (no sub-domain)
42
+ if (lastDotBeforeSuffixIndex === -1) {
43
+ return hostname;
44
+ }
45
+ // Extract the part between the last '.'
46
+ return hostname.slice(lastDotBeforeSuffixIndex + 1);
47
+ }
48
+ /**
49
+ * Detects the domain based on rules and upon and a host string
50
+ */
51
+ function getDomain(suffix, hostname, options) {
52
+ // Check if `hostname` ends with a member of `validHosts`.
53
+ if (options.validHosts !== null) {
54
+ const validHosts = options.validHosts;
55
+ for (const vhost of validHosts) {
56
+ if ( /*@__INLINE__*/shareSameDomainSuffix(hostname, vhost)) {
57
+ return vhost;
58
+ }
59
+ }
60
+ }
61
+ let numberOfLeadingDots = 0;
62
+ if (hostname.startsWith('.')) {
63
+ while (numberOfLeadingDots < hostname.length &&
64
+ hostname[numberOfLeadingDots] === '.') {
65
+ numberOfLeadingDots += 1;
66
+ }
67
+ }
68
+ // If `hostname` is a valid public suffix, then there is no domain to return.
69
+ // Since we already know that `getPublicSuffix` returns a suffix of `hostname`
70
+ // there is no need to perform a string comparison and we only compare the
71
+ // size.
72
+ if (suffix.length === hostname.length - numberOfLeadingDots) {
73
+ return null;
74
+ }
75
+ // To extract the general domain, we start by identifying the public suffix
76
+ // (if any), then consider the domain to be the public suffix with one added
77
+ // level of depth. (e.g.: if hostname is `not.evil.co.uk` and public suffix:
78
+ // `co.uk`, then we take one more level: `evil`, giving the final result:
79
+ // `evil.co.uk`).
80
+ return /*@__INLINE__*/ extractDomainWithSuffix(hostname, suffix);
81
+ }
82
+
83
+ /**
84
+ * Return the part of domain without suffix.
85
+ *
86
+ * Example: for domain 'foo.com', the result would be 'foo'.
87
+ */
88
+ function getDomainWithoutSuffix(domain, suffix) {
89
+ // Note: here `domain` and `suffix` cannot have the same length because in
90
+ // this case we set `domain` to `null` instead. It is thus safe to assume
91
+ // that `suffix` is shorter than `domain`.
92
+ return domain.slice(0, -suffix.length - 1);
93
+ }
94
+
95
+ /**
96
+ * Matches an ASCII tab (U+0009) or newline (U+000A / U+000D). The WHATWG URL
97
+ * parser strips these before parsing; we only allocate a cleaned copy (and
98
+ * re-parse) on the rare input that actually contains one.
99
+ */
100
+ const CONTROL_CHARS = /[\t\n\r]/g;
101
+ // Set by `extractHostname` (a module-scope flag, read synchronously by
102
+ // `parseImpl` right after the call — same pattern as the reused RESULT object).
103
+ // `true` ONLY when extraction validated the returned host inline (a confirmed-
104
+ // valid, "simple" authority) so `parseImpl` can skip the separate
105
+ // `isValidHostname` pass. `false` in every other case (validation disabled, a
106
+ // complex authority — userinfo/port/brackets/trailing-dot/control — an invalid
107
+ // host, or a non-main return path); `parseImpl` then validates as usual. The
108
+ // fast path can only ever SKIP a redundant scan for hosts already known valid,
109
+ // never accept an invalid one.
110
+ let extractedHostnameValidated = false;
111
+ /**
112
+ * True if char `code` is a valid hostname character. This is the per-char half
113
+ * of `is-valid.ts`'s `isValidAscii` (a-z, 0-9, > U+007F) PLUS three additions:
114
+ * A-Z (the host is lowercased before validation, so uppercase ≡ a valid
115
+ * lowercase letter) and '-' / '_' (valid inside a label). KEEP IN SYNC with
116
+ * `is-valid.ts`: these rules are deliberately duplicated to validate during
117
+ * extraction, so any change to the accepted character set there must be
118
+ * mirrored here (and vice-versa).
119
+ */
120
+ function isValidHostnameChar(code) {
121
+ return ((code >= 97 && code <= 122) || // a-z
122
+ (code >= 48 && code <= 57) || // 0-9
123
+ code > 127 || // non-ASCII (accepted, not punycode-checked)
124
+ (code >= 65 && code <= 90) || // A-Z (becomes valid once lowercased)
125
+ code === 45 || // '-'
126
+ code === 95 // '_'
127
+ );
128
+ }
129
+ /**
130
+ * Classify scheme `url.slice(schemeStart, colonIndex)` as a WHATWG special
131
+ * scheme without allocating a substring (case-insensitive via `| 32`).
132
+ * Special schemes: ftp, file, http, https, ws, wss
133
+ * (https://url.spec.whatwg.org/#special-scheme).
134
+ *
135
+ * @returns 0 = not special, 1 = special, 2 = file (its host sits only between
136
+ * "//" and the next slash).
137
+ */
138
+ function getSpecialScheme(url, schemeStart, colonIndex) {
139
+ const length = colonIndex - schemeStart;
140
+ const c0 = url.charCodeAt(schemeStart) | 32;
141
+ if (length === 2) {
142
+ return c0 === 119 && (url.charCodeAt(schemeStart + 1) | 32) === 115 ? 1 : 0; // ws
143
+ }
144
+ else if (length === 3) {
145
+ const c1 = url.charCodeAt(schemeStart + 1) | 32;
146
+ const c2 = url.charCodeAt(schemeStart + 2) | 32;
147
+ if (c0 === 119 && c1 === 115 && c2 === 115)
148
+ return 1; // wss
149
+ if (c0 === 102 && c1 === 116 && c2 === 112)
150
+ return 1; // ftp
151
+ return 0;
152
+ }
153
+ else if (length === 4) {
154
+ const c1 = url.charCodeAt(schemeStart + 1) | 32;
155
+ const c2 = url.charCodeAt(schemeStart + 2) | 32;
156
+ const c3 = url.charCodeAt(schemeStart + 3) | 32;
157
+ if (c0 === 104 && c1 === 116 && c2 === 116 && c3 === 112)
158
+ return 1; // http
159
+ if (c0 === 102 && c1 === 105 && c2 === 108 && c3 === 101)
160
+ return 2; // file
161
+ return 0;
162
+ }
163
+ else if (length === 5) {
164
+ return c0 === 104 &&
165
+ (url.charCodeAt(schemeStart + 1) | 32) === 116 &&
166
+ (url.charCodeAt(schemeStart + 2) | 32) === 116 &&
167
+ (url.charCodeAt(schemeStart + 3) | 32) === 112 &&
168
+ (url.charCodeAt(schemeStart + 4) | 32) === 115
169
+ ? 1
170
+ : 0; // https
171
+ }
172
+ return 0;
173
+ }
174
+ /**
175
+ * Extract a hostname from `url`, matching a WHATWG URL parser's host-boundary
176
+ * behaviour (https://url.spec.whatwg.org/#concept-basic-url-parser) for tldts'
177
+ * scope. It deliberately does NOT normalise the host (no IDNA/punycode or IPv4
178
+ * canonicalisation; IPv6 brackets are stripped, not compressed), strips trailing
179
+ * dots, and stays lenient where a strict parser rejects (bare host:port,
180
+ * out-of-range port, user@host) — all documented deviations.
181
+ *
182
+ * @param urlIsValidHostname - when true, `url` is already a valid hostname and is
183
+ * returned by the same reference (factory.ts skips re-validation on that
184
+ * identity), keeping the common path allocation-free.
185
+ * @param validate - when true, validate the host inline during the authority
186
+ * scan and publish the verdict via `extractedHostnameValidated` so `parseImpl`
187
+ * can skip the redundant `isValidHostname` pass for simple authorities.
188
+ */
189
+ function extractHostname(url, urlIsValidHostname, validate = false) {
190
+ let start = 0;
191
+ let end = url.length;
192
+ let hasUpper = false;
193
+ let isSpecial = false;
194
+ extractedHostnameValidated = false;
195
+ if (!urlIsValidHostname) {
196
+ // Data URLs never carry a host (and may be huge — short-circuit them).
197
+ if (url.startsWith('data:')) {
198
+ return null;
199
+ }
200
+ // WHATWG step 1: trim leading/trailing C0 control or space (<= U+0020).
201
+ // Tab/newline elsewhere are handled lazily below.
202
+ while (start < url.length && url.charCodeAt(start) <= 32) {
203
+ start += 1;
204
+ }
205
+ while (end > start + 1 && url.charCodeAt(end - 1) <= 32) {
206
+ end -= 1;
207
+ }
208
+ if (url.charCodeAt(start) === 47 /* '/' */ &&
209
+ url.charCodeAt(start + 1) === 47 /* '/' */) {
210
+ // Scheme-relative reference ("//host/path").
211
+ start += 2;
212
+ }
213
+ else {
214
+ const indexOfProtocol = url.indexOf(':/', start);
215
+ if (indexOfProtocol !== -1) {
216
+ // "scheme://…". Classify the scheme, then position `start` at the host.
217
+ const special = getSpecialScheme(url, start, indexOfProtocol);
218
+ if (special === 1) {
219
+ // Special scheme: skip the run of '/' and '\' after it
220
+ // (special-authority-(ignore-)slashes states; '\' acts as '/').
221
+ isSpecial = true;
222
+ start = indexOfProtocol + 2;
223
+ while (url.charCodeAt(start) === 47 /* '/' */ ||
224
+ url.charCodeAt(start) === 92 /* '\' */) {
225
+ start += 1;
226
+ }
227
+ }
228
+ else if (special === 2) {
229
+ // file: the host is only what sits between "//" and the next slash, so
230
+ // "file://h/x" => "h" but "file:///x" / "file:/x" => no host.
231
+ isSpecial = true;
232
+ start = indexOfProtocol + 1;
233
+ let slashes = 0;
234
+ while ((url.charCodeAt(start) === 47 || url.charCodeAt(start) === 92) &&
235
+ slashes < 2) {
236
+ start += 1;
237
+ slashes += 1;
238
+ }
239
+ if (slashes < 2) {
240
+ return null;
241
+ }
242
+ }
243
+ else {
244
+ // Unknown scheme: validate the WHATWG scheme grammar [A-Za-z0-9+.-];
245
+ // a control char means it was split by a tab/newline (strip + re-parse).
246
+ for (let i = start; i < indexOfProtocol; i += 1) {
247
+ const code = url.charCodeAt(i) | 32;
248
+ if (!(((code >= 97 && code <= 122) || // [a, z]
249
+ (code >= 48 && code <= 57) || // [0, 9]
250
+ code === 46 || // '.'
251
+ code === 45 || // '-'
252
+ code === 43) // '+'
253
+ )) {
254
+ const raw = url.charCodeAt(i);
255
+ if (raw === 9 || raw === 10 || raw === 13) {
256
+ return extractHostname(url.replace(CONTROL_CHARS, ''), urlIsValidHostname, validate);
257
+ }
258
+ return null;
259
+ }
260
+ }
261
+ // A non-special scheme has an authority only after "//" (else it is an
262
+ // opaque path with no host). `indexOf(':/')` already gave the first '/'.
263
+ if (url.charCodeAt(indexOfProtocol + 2) === 47 /* '/' */) {
264
+ start = indexOfProtocol + 3;
265
+ }
266
+ else {
267
+ return null;
268
+ }
269
+ }
270
+ }
271
+ else if (url.charCodeAt(start) !== 91 /* '[' */) {
272
+ // Cold path: no scheme "://", and not a bare IPv6 literal (whose first
273
+ // ':' would otherwise look like a scheme separator; "[…]" falls through
274
+ // to the ipv6 handling below). May be a bare host, a host:port, a
275
+ // user@host, a slash-less special scheme ("https:host"), or an opaque
276
+ // URI ("mailto:", "tel:", "urn:…").
277
+ let indexOfColon = -1;
278
+ for (let i = start; i < end; i += 1) {
279
+ const code = url.charCodeAt(i);
280
+ if (code === 9 || code === 10 || code === 13) {
281
+ return extractHostname(url.replace(CONTROL_CHARS, ''), urlIsValidHostname, validate);
282
+ }
283
+ if (code === 58 /* ':' */) {
284
+ indexOfColon = i;
285
+ break;
286
+ }
287
+ if (code === 47 || code === 92 || code === 63 || code === 35) {
288
+ break;
289
+ }
290
+ }
291
+ if (indexOfColon !== -1) {
292
+ // An '@' before the next delimiter => the ':' is userinfo, not a
293
+ // scheme ("user:pass@host", "mailto:a@b"): keep the whole authority.
294
+ let hasIdentifier = false;
295
+ for (let i = indexOfColon + 1; i < end; i += 1) {
296
+ const code = url.charCodeAt(i);
297
+ if (code === 47 || code === 92 || code === 63 || code === 35) {
298
+ break;
299
+ }
300
+ if (code === 64 /* '@' */) {
301
+ hasIdentifier = true;
302
+ break;
303
+ }
304
+ }
305
+ if (!hasIdentifier) {
306
+ // All-digits after ':' => a bare "host:port" (tldts accepts
307
+ // hostnames too); keep `start` and let the port handling trim it.
308
+ let allDigits = true;
309
+ let i = indexOfColon + 1;
310
+ for (; i < end; i += 1) {
311
+ const code = url.charCodeAt(i);
312
+ if (code === 47 || code === 92 || code === 63 || code === 35) {
313
+ break;
314
+ }
315
+ if (code < 48 /* '0' */ || code > 57 /* '9' */) {
316
+ allDigits = false;
317
+ break;
318
+ }
319
+ }
320
+ if (i === indexOfColon + 1) {
321
+ allDigits = false; // nothing after ':' => not a port
322
+ }
323
+ if (!allDigits) {
324
+ const special = getSpecialScheme(url, start, indexOfColon);
325
+ if (special === 0) {
326
+ // No "://" anywhere on the cold path and not a special scheme.
327
+ // A second ':' before the host's end marks a bare, unbracketed
328
+ // IPv6 literal ("2a01:e35::1"): fall through and let the host
329
+ // loop + isIp classify it. Without one this is an opaque path
330
+ // with no host ("mailto:x", "foo:bar").
331
+ let isBareIpv6 = false;
332
+ for (let j = indexOfColon + 1; j < end; j += 1) {
333
+ const code = url.charCodeAt(j);
334
+ if (code === 47 ||
335
+ code === 92 ||
336
+ code === 63 ||
337
+ code === 35) {
338
+ break;
339
+ }
340
+ if (code === 58 /* ':' */) {
341
+ isBareIpv6 = true;
342
+ break;
343
+ }
344
+ }
345
+ if (!isBareIpv6) {
346
+ return null;
347
+ }
348
+ }
349
+ else {
350
+ isSpecial = true;
351
+ start = indexOfColon + 1;
352
+ if (special === 2) {
353
+ // file (e.g. "file:\\host"): host only between "//" and next slash.
354
+ let slashes = 0;
355
+ while ((url.charCodeAt(start) === 47 ||
356
+ url.charCodeAt(start) === 92) &&
357
+ slashes < 2) {
358
+ start += 1;
359
+ slashes += 1;
360
+ }
361
+ if (slashes < 2) {
362
+ return null;
363
+ }
364
+ }
365
+ else {
366
+ while (url.charCodeAt(start) === 47 ||
367
+ url.charCodeAt(start) === 92) {
368
+ start += 1;
369
+ }
370
+ }
371
+ }
372
+ }
373
+ }
374
+ }
375
+ }
376
+ }
377
+ // Find the host's end: first '/', '?' or '#' (and '\' for special URLs,
378
+ // which WHATWG treats like '/'). Track the last '@', ']' and ':' for
379
+ // userinfo, ipv6 and port, plus the first ':' of the host (reset at each
380
+ // '@') to tell a bare IPv6 (>= 2 colons) from a host:port (exactly one);
381
+ // flag uppercase and a stray tab/newline. The loop is split on `code < 64`
382
+ // so common host characters take fewer comparisons.
383
+ //
384
+ // When `validate`, also accumulate `is-valid.ts`'s checks over the scanned
385
+ // run so a simple authority's host can be validated in this single pass.
386
+ // `vValid` only stays meaningful for a "simple" authority (no userinfo, port,
387
+ // brackets, control or trailing dot); those cases clear it / are rejected by
388
+ // the guard below, falling back to `isValidHostname`.
389
+ let indexOfIdentifier = -1;
390
+ let indexOfClosingBracket = -1;
391
+ let indexOfPort = -1;
392
+ let indexOfFirstColon = -1;
393
+ let hasControl = false;
394
+ let vValid = validate; // seeded true when validating; cleared on the first invalid char
395
+ let vLastDot = start - 1; // mirrors is-valid.ts `lastDotIndex = -1` at host start
396
+ let vLastCode = -1;
397
+ if (validate && start < end) {
398
+ // First-char rule: must be a valid host char, '.', or '_' (NOT '-').
399
+ const c0 = url.charCodeAt(start);
400
+ if (!(
401
+ /*@__INLINE__*/ (isValidHostnameChar(c0) ||
402
+ c0 === 46 /* '.' */ ||
403
+ c0 === 95 /* '_' */)) ||
404
+ c0 === 45 /* '-' (isValidHostnameChar allows it mid-label, not first) */) {
405
+ vValid = false;
406
+ }
407
+ }
408
+ for (let i = start; i < end; i += 1) {
409
+ const code = url.charCodeAt(i);
410
+ if (code < 64) {
411
+ if (code === 47 || code === 35 || code === 63) {
412
+ end = i;
413
+ break;
414
+ }
415
+ else if (code === 58 /* ':' */) {
416
+ if (indexOfFirstColon === -1) {
417
+ indexOfFirstColon = i;
418
+ }
419
+ indexOfPort = i;
420
+ }
421
+ else if (code === 9 || code === 10 || code === 13) {
422
+ hasControl = true;
423
+ }
424
+ else if (validate) {
425
+ if (code === 46 /* '.' */) {
426
+ if (i - vLastDot > 64 || vLastCode === 46 || vLastCode === 45) {
427
+ vValid = false;
428
+ }
429
+ vLastDot = i;
430
+ }
431
+ else if (code < 48 || code > 57) {
432
+ // < 64 and not a delimiter/dot/digit => only '-' (45) is a valid
433
+ // host char here; everything else (space, %, !, etc.) is invalid.
434
+ // A '-' must also not START a label (the byte right after a '.') —
435
+ // mirrors is-valid.ts; the first label is covered by the first-char
436
+ // rule above. (RFC 1034 §3.5 / RFC 1035 §2.3.1 LDH.)
437
+ if (code !== 45 || vLastCode === 46 /* label-leading '-' */) {
438
+ vValid = false;
439
+ }
440
+ }
441
+ }
442
+ }
443
+ else if (isSpecial && code === 92 /* '\' */) {
444
+ end = i;
445
+ break;
446
+ }
447
+ else if (code === 64 /* '@' */) {
448
+ indexOfIdentifier = i;
449
+ indexOfFirstColon = -1; // colons before '@' are userinfo, not the host
450
+ }
451
+ else if (code === 93 /* ']' */) {
452
+ indexOfClosingBracket = i;
453
+ }
454
+ else if (code >= 65 && code <= 90) {
455
+ hasUpper = true;
456
+ }
457
+ else if (validate && !( /*@__INLINE__*/isValidHostnameChar(code))) {
458
+ // >= 64, not '@'/']'/upper: valid only if a-z, '_', or non-ASCII.
459
+ vValid = false;
460
+ }
461
+ if (validate) {
462
+ vLastCode = code;
463
+ }
464
+ }
465
+ // A tab/newline inside the authority: strip everything and re-parse (rare).
466
+ if (hasControl) {
467
+ return extractHostname(url.replace(CONTROL_CHARS, ''), urlIsValidHostname, validate);
468
+ }
469
+ // Skip userinfo. '>= start' so an empty userinfo ("http://@host") works too.
470
+ if (indexOfIdentifier !== -1 &&
471
+ indexOfIdentifier >= start &&
472
+ indexOfIdentifier < end) {
473
+ start = indexOfIdentifier + 1;
474
+ }
475
+ if (url.charCodeAt(start) === 91 /* '[' */) {
476
+ // ipv6 address: return what is between the brackets, or null if unclosed.
477
+ if (indexOfClosingBracket !== -1) {
478
+ return url.slice(start + 1, indexOfClosingBracket).toLowerCase();
479
+ }
480
+ return null;
481
+ }
482
+ else if (indexOfPort !== -1 &&
483
+ indexOfPort > start &&
484
+ indexOfPort < end &&
485
+ // A host:port has exactly one ':' in the host (so its first ':' is its
486
+ // last); a bare, unbracketed IPv6 literal ("2a01:e35::1") has >= 2, so
487
+ // its first ':' precedes the last. Only the former has a ':port' to trim.
488
+ indexOfFirstColon === indexOfPort) {
489
+ end = indexOfPort; // trim ':port'
490
+ }
491
+ // Empty authority ("http://", "file:///path", "//"); only reachable here via
492
+ // extraction — a bare valid hostname never lands here.
493
+ if (start >= end) {
494
+ return null;
495
+ }
496
+ // Publish the inline-validation verdict — but only for a "simple" authority,
497
+ // where the scanned run equals the final host: no userinfo skip, no port
498
+ // trim, no brackets, no trailing dot (trimmed below), and length within RFC
499
+ // limits. Anything else leaves it `false` so `parseImpl` re-validates.
500
+ //
501
+ // Every clause below is load-bearing for CORRECTNESS, not just speed: the
502
+ // loop accumulates `vValid` over the whole scanned run (it does not stop at
503
+ // ':' or '@', so any port/userinfo bytes are included), so the verdict is
504
+ // only sound when that run equals the final host. Do not drop a clause as
505
+ // "redundant" — e.g. without `indexOfPort === -1`, `host:8080` would be
506
+ // wrongly accepted.
507
+ if (validate &&
508
+ vValid &&
509
+ indexOfIdentifier === -1 &&
510
+ indexOfPort === -1 &&
511
+ indexOfClosingBracket === -1 &&
512
+ url.charCodeAt(end - 1) !== 46 /* no trailing dot */ &&
513
+ end - start <= 255 && // total length
514
+ end - vLastDot - 1 <= 63 && // last label length
515
+ vLastCode !== 45 /* last char not '-' */) {
516
+ extractedHostnameValidated = true;
517
+ }
518
+ }
519
+ // Trim trailing dots
520
+ while (end > start + 1 && url.charCodeAt(end - 1) === 46 /* '.' */) {
521
+ end -= 1;
522
+ }
523
+ const hostname = start !== 0 || end !== url.length ? url.slice(start, end) : url;
524
+ if (hasUpper) {
525
+ return hostname.toLowerCase();
526
+ }
527
+ return hostname;
528
+ }
529
+
530
+ /**
531
+ * Check if a hostname is an IP. You should be aware that this only works
532
+ * because `hostname` is already garanteed to be a valid hostname!
533
+ */
534
+ function isProbablyIpv4(hostname) {
535
+ // Cannot be shorted than 1.1.1.1
536
+ if (hostname.length < 7) {
537
+ return false;
538
+ }
539
+ // Cannot be longer than: 255.255.255.255
540
+ if (hostname.length > 15) {
541
+ return false;
542
+ }
543
+ let numberOfDots = 0;
544
+ for (let i = 0; i < hostname.length; i += 1) {
545
+ const code = hostname.charCodeAt(i);
546
+ if (code === 46 /* '.' */) {
547
+ numberOfDots += 1;
548
+ }
549
+ else if (code < 48 /* '0' */ || code > 57 /* '9' */) {
550
+ return false;
551
+ }
552
+ }
553
+ return (numberOfDots === 3 &&
554
+ hostname.charCodeAt(0) !== 46 /* '.' */ &&
555
+ hostname.charCodeAt(hostname.length - 1) !== 46 /* '.' */);
556
+ }
557
+ /**
558
+ * Similar to isProbablyIpv4.
559
+ */
560
+ function isProbablyIpv6(hostname) {
561
+ if (hostname.length < 3) {
562
+ return false;
563
+ }
564
+ let start = hostname.startsWith('[') ? 1 : 0;
565
+ let end = hostname.length;
566
+ if (hostname[end - 1] === ']') {
567
+ end -= 1;
568
+ }
569
+ // We only consider the maximum size of a normal IPV6. Note that this will
570
+ // fail on so-called "IPv4 mapped IPv6 addresses" but this is a corner-case
571
+ // and a proper validation library should be used for these.
572
+ if (end - start > 39) {
573
+ return false;
574
+ }
575
+ let hasColon = false;
576
+ for (; start < end; start += 1) {
577
+ const code = hostname.charCodeAt(start);
578
+ if (code === 58 /* ':' */) {
579
+ hasColon = true;
580
+ }
581
+ else if (!(((code >= 48 && code <= 57) || // 0-9
582
+ (code >= 97 && code <= 102) || // a-f
583
+ (code >= 65 && code <= 70)) // A-F (RFC 4291 §2.2: an IPv6 hextet is hex digits only)
584
+ )) {
585
+ return false;
586
+ }
587
+ }
588
+ return hasColon;
589
+ }
590
+ /**
591
+ * Check if `hostname` is *probably* a valid ip addr (either ipv6 or ipv4).
592
+ * This *will not* work on any string. We need `hostname` to be a valid
593
+ * hostname.
594
+ */
595
+ function isIp(hostname) {
596
+ return isProbablyIpv6(hostname) || isProbablyIpv4(hostname);
597
+ }
598
+
599
+ /**
600
+ * Special-use domain names from the IANA "Special-Use Domain Names" registry:
601
+ * the authoritative list, created by RFC 6761 and maintained as new RFCs add to
602
+ * it: https://www.iana.org/assignments/special-use-domain-names/
603
+ * Snapshot: 2026-05-24. (RFC 6761 is not obsoleted; draft-hoffman-rfc6761bis
604
+ * proposes to retire its prose but keep this registry, so the registry is the
605
+ * source of truth; re-sync this list against it.)
606
+ *
607
+ * These names never correspond to a public registration, yet neither
608
+ * `isIcann` nor `isPrivate` marks one as special-use: most are absent from the
609
+ * Public Suffix List (so `a.test` looks like a registrable domain), and the
610
+ * few that are listed (`onion`, `home.arpa`) appear there as ordinary ICANN
611
+ * suffixes. `isSpecialUse` is the single signal that covers them all.
612
+ *
613
+ * Per the registry and RFC 6761 ("and any names falling within these domains"),
614
+ * the designation covers each listed name AND all of its sub-domains. DNS labels
615
+ * are case-insensitive (RFC 4343); `hostname` is expected to be already
616
+ * lower-cased and trailing-dot-stripped, as produced by `extractHostname`, the
617
+ * same normalization the Public-Suffix-List lookup relies on.
618
+ *
619
+ * Two groups of registry entries are intentionally excluded: the numeric
620
+ * reverse-DNS delegation zones (`10.in-addr.arpa`, the `*.ip6.arpa` ranges, …),
621
+ * which are reverse-DNS PTR zones rather than hostnames and whose parents
622
+ * (`in-addr.arpa`/`ip6.arpa`) are already in the Public Suffix List; and the
623
+ * deprecated `eap-noob.arpa` entry.
624
+ */
625
+ const SPECIAL_USE_DOMAINS = [
626
+ 'test', // RFC 6761
627
+ 'localhost', // RFC 6761
628
+ 'invalid', // RFC 6761
629
+ 'example', // RFC 6761
630
+ 'example.com', // RFC 6761
631
+ 'example.net', // RFC 6761
632
+ 'example.org', // RFC 6761
633
+ 'local', // RFC 6762 (mDNS)
634
+ 'onion', // RFC 7686 (Tor)
635
+ 'alt', // RFC 9476
636
+ 'home.arpa', // RFC 8375
637
+ 'ipv4only.arpa', // RFC 8880
638
+ 'resolver.arpa', // RFC 9462
639
+ 'service.arpa', // RFC 9665
640
+ '6tisch.arpa', // RFC 9031
641
+ 'eap.arpa', // RFC 9965
642
+ ];
643
+ /**
644
+ * Return `true` if `hostname` is, or is a sub-domain of, a special-use domain
645
+ * (see the registry note above). Expects an already-normalized `hostname`.
646
+ */
647
+ function isSpecialUse(hostname) {
648
+ for (const name of SPECIAL_USE_DOMAINS) {
649
+ // Match on a label boundary: `hostname` is either exactly `name` or ends
650
+ // with `.name` (so `latest` is not matched by `test`, nor `myexample.com`
651
+ // by `example.com`).
652
+ if (hostname.endsWith(name) &&
653
+ (hostname.length === name.length ||
654
+ hostname.charCodeAt(hostname.length - name.length - 1) === 46) /* '.' */) {
655
+ return true;
656
+ }
657
+ }
658
+ return false;
659
+ }
660
+
661
+ /**
662
+ * Implements fast shallow verification of hostnames. This does not perform a
663
+ * struct check on the content of labels (classes of Unicode characters, etc.)
664
+ * but instead check that the structure is valid (number of labels, length of
665
+ * labels, etc.).
666
+ *
667
+ * If you need stricter validation, consider using an external library.
668
+ */
669
+ // KEEP IN SYNC with `extract-hostname.ts` `isValidHostnameChar` + its inline
670
+ // scan/verdict, which duplicate these structural rules to validate during
671
+ // extraction (a perf fusion). That copy additionally accepts A-Z (the host is
672
+ // not yet lowercased there) and folds in '-' / '_'. Any change to the accepted
673
+ // character set or the label/length rules here must be mirrored there.
674
+ function isValidAscii(code) {
675
+ return ((code >= 97 && code <= 122) || (code >= 48 && code <= 57) || code > 127);
676
+ }
677
+ /**
678
+ * Check if a hostname string is valid. It's usually a preliminary check before
679
+ * trying to use getDomain or anything else.
680
+ *
681
+ * Beware: it does not check if the TLD exists.
682
+ */
683
+ function isValidHostname (hostname) {
684
+ if (hostname.length > 255) {
685
+ return false;
686
+ }
687
+ if (hostname.length === 0) {
688
+ return false;
689
+ }
690
+ if (
691
+ /*@__INLINE__*/ !isValidAscii(hostname.charCodeAt(0)) &&
692
+ hostname.charCodeAt(0) !== 46 && // '.' (dot)
693
+ hostname.charCodeAt(0) !== 95 // '_' (underscore)
694
+ ) {
695
+ return false;
696
+ }
697
+ // Validate hostname according to RFC
698
+ let lastDotIndex = -1;
699
+ let lastCharCode = -1;
700
+ const len = hostname.length;
701
+ for (let i = 0; i < len; i += 1) {
702
+ const code = hostname.charCodeAt(i);
703
+ if (code === 46 /* '.' */) {
704
+ if (
705
+ // Check that previous label is < 63 bytes long (64 = 63 + '.')
706
+ i - lastDotIndex > 64 ||
707
+ // Check that previous character was not already a '.'
708
+ lastCharCode === 46 ||
709
+ // Check that the previous label does not end with '-' (RFC 1035 §2.3.1 LDH).
710
+ // '_' is intentionally NOT restricted: DNS allows any octet (RFC 2181 §11) and
711
+ // WHATWG URL does not treat '_' as a forbidden host code point.
712
+ lastCharCode === 45) {
713
+ return false;
714
+ }
715
+ lastDotIndex = i;
716
+ }
717
+ else if (
718
+ // A forbidden character in the label...
719
+ !( /*@__INLINE__*/(isValidAscii(code) || code === 45 || code === 95)) ||
720
+ // ...or a '-' starting a label (the byte right after a '.'). A label must
721
+ // not begin with a hyphen (RFC 1034 §3.5 / RFC 1035 §2.3.1 LDH, as amended
722
+ // by RFC 1123 §2.1; cf. UTS #46 CheckHyphens). The first label is covered by
723
+ // the leading-character guard above; mirrors the trailing-'-' rule below.
724
+ (code === 45 && lastCharCode === 46)) {
725
+ return false;
726
+ }
727
+ lastCharCode = code;
728
+ }
729
+ return (
730
+ // Check that last label is shorter than 63 chars
731
+ len - lastDotIndex - 1 <= 63 &&
732
+ // Check that the last character is an allowed trailing label character.
733
+ // Since we already checked that the char is a valid hostname character,
734
+ // we only need to check that it's different from '-'.
735
+ lastCharCode !== 45);
736
+ }
737
+
738
+ function setDefaultsImpl({ allowIcannDomains = true, allowPrivateDomains = false, detectIp = true, detectSpecialUse = false, extractHostname = true, mixedInputs = true, validHosts = null, validateHostname = true, }) {
739
+ return {
740
+ allowIcannDomains,
741
+ allowPrivateDomains,
742
+ detectIp,
743
+ detectSpecialUse,
744
+ extractHostname,
745
+ mixedInputs,
746
+ validHosts,
747
+ validateHostname,
748
+ };
749
+ }
750
+ const DEFAULT_OPTIONS = /*@__INLINE__*/ setDefaultsImpl({});
751
+ function setDefaults(options) {
752
+ if (options === undefined) {
753
+ return DEFAULT_OPTIONS;
754
+ }
755
+ return /*@__INLINE__*/ setDefaultsImpl(options);
756
+ }
757
+
758
+ /**
759
+ * Returns the subdomain of a hostname string
760
+ */
761
+ function getSubdomain(hostname, domain) {
762
+ // If `hostname` and `domain` are the same, then there is no sub-domain
763
+ if (domain.length === hostname.length) {
764
+ return '';
765
+ }
766
+ return hostname.slice(0, -domain.length - 1);
767
+ }
768
+
769
+ /**
770
+ * Implement a factory allowing to plug different implementations of suffix
771
+ * lookup (e.g.: using a trie or the packed hashes datastructures). This is used
772
+ * and exposed in `tldts.ts` and `tldts-experimental.ts` bundle entrypoints.
773
+ */
774
+ function getEmptyResult() {
775
+ return {
776
+ domain: null,
777
+ domainWithoutSuffix: null,
778
+ hostname: null,
779
+ isIcann: null,
780
+ isIp: null,
781
+ isPrivate: null,
782
+ isSpecialUse: null,
783
+ publicSuffix: null,
784
+ subdomain: null,
785
+ };
786
+ }
787
+ function resetResult(result) {
788
+ result.domain = null;
789
+ result.domainWithoutSuffix = null;
790
+ result.hostname = null;
791
+ result.isIcann = null;
792
+ result.isIp = null;
793
+ result.isPrivate = null;
794
+ result.isSpecialUse = null;
795
+ result.publicSuffix = null;
796
+ result.subdomain = null;
797
+ }
798
+ function parseImpl(url, step, suffixLookup, partialOptions, result) {
799
+ const options = /*@__INLINE__*/ setDefaults(partialOptions);
800
+ // Very fast approximate check to make sure `url` is a string. This is needed
801
+ // because the library will not necessarily be used in a typed setup and
802
+ // values of arbitrary types might be given as argument.
803
+ if (typeof url !== 'string') {
804
+ return result;
805
+ }
806
+ // Extract hostname from `url` only if needed. This can be made optional
807
+ // using `options.extractHostname`. This option will typically be used
808
+ // whenever we are sure the inputs to `parse` are already hostnames and not
809
+ // arbitrary URLs.
810
+ //
811
+ // `mixedInput` allows to specify if we expect a mix of URLs and hostnames
812
+ // as input. If only hostnames are expected then `extractHostname` can be
813
+ // set to `false` to speed-up parsing. If only URLs are expected then
814
+ // `mixedInputs` can be set to `false`. The `mixedInputs` is only a hint
815
+ // and will not change the behavior of the library.
816
+ // Whether `url` itself was already a valid hostname (only computed on the
817
+ // mixedInputs path). Lets us skip the post-extraction validation below when
818
+ // extractHostname returned `url` unchanged (same reference).
819
+ let urlIsValid = false;
820
+ if (!options.extractHostname) {
821
+ result.hostname = url;
822
+ }
823
+ else if (options.mixedInputs) {
824
+ urlIsValid = isValidHostname(url);
825
+ result.hostname = extractHostname(url, urlIsValid, options.validateHostname);
826
+ }
827
+ else {
828
+ result.hostname = extractHostname(url, false, options.validateHostname);
829
+ }
830
+ // Check if `hostname` is a valid ip address
831
+ if (options.detectIp && result.hostname !== null) {
832
+ result.isIp = isIp(result.hostname);
833
+ if (result.isIp) {
834
+ return result;
835
+ }
836
+ }
837
+ // Perform hostname validation if enabled. If hostname is not valid, no need to
838
+ // go further as there will be no valid domain or sub-domain. This validation
839
+ // is applied before any early returns to ensure consistent behavior across
840
+ // all API methods including getHostname().
841
+ if (options.validateHostname &&
842
+ options.extractHostname &&
843
+ result.hostname !== null &&
844
+ // Skip the re-scan when `url` was already validated and extractHostname
845
+ // returned it unchanged (same reference => identical string, still valid).
846
+ !(urlIsValid && result.hostname === url) &&
847
+ // Skip the re-scan when extractHostname already validated the host inline
848
+ // (a confirmed-valid simple authority — see extract-hostname.ts).
849
+ !extractedHostnameValidated &&
850
+ !isValidHostname(result.hostname)) {
851
+ result.hostname = null;
852
+ return result;
853
+ }
854
+ if (step === 0 /* FLAG.HOSTNAME */ || result.hostname === null) {
855
+ return result;
856
+ }
857
+ // Flag special-use domains, only when opted in (`detectSpecialUse`) and only
858
+ // for the full `parse()` result (FLAG.ALL). Computed here, before the
859
+ // public-suffix/domain early-returns below, so single-label names like
860
+ // `localhost` (which have no registrable domain) are still flagged.
861
+ if (step === 5 /* FLAG.ALL */ && options.detectSpecialUse) {
862
+ result.isSpecialUse = isSpecialUse(result.hostname);
863
+ }
864
+ // Extract public suffix
865
+ suffixLookup(result.hostname, options, result);
866
+ if (step === 2 /* FLAG.PUBLIC_SUFFIX */ || result.publicSuffix === null) {
867
+ return result;
868
+ }
869
+ // Extract domain
870
+ result.domain = getDomain(result.publicSuffix, result.hostname, options);
871
+ if (step === 3 /* FLAG.DOMAIN */ || result.domain === null) {
872
+ return result;
873
+ }
874
+ // Extract subdomain
875
+ result.subdomain = getSubdomain(result.hostname, result.domain);
876
+ if (step === 4 /* FLAG.SUB_DOMAIN */) {
877
+ return result;
878
+ }
879
+ // Extract domain without suffix
880
+ result.domainWithoutSuffix = getDomainWithoutSuffix(result.domain, result.publicSuffix);
881
+ return result;
882
+ }
883
+
884
+ function fastPath (hostname, options, out) {
885
+ // Fast path for very popular suffixes; this allows to by-pass lookup
886
+ // completely as well as any extra allocation or string manipulation.
887
+ if (!options.allowPrivateDomains && hostname.length > 3) {
888
+ const last = hostname.length - 1;
889
+ const c3 = hostname.charCodeAt(last);
890
+ const c2 = hostname.charCodeAt(last - 1);
891
+ const c1 = hostname.charCodeAt(last - 2);
892
+ const c0 = hostname.charCodeAt(last - 3);
893
+ if (c3 === 109 /* 'm' */ &&
894
+ c2 === 111 /* 'o' */ &&
895
+ c1 === 99 /* 'c' */ &&
896
+ c0 === 46 /* '.' */) {
897
+ out.isIcann = true;
898
+ out.isPrivate = false;
899
+ out.publicSuffix = 'com';
900
+ return true;
901
+ }
902
+ else if (c3 === 103 /* 'g' */ &&
903
+ c2 === 114 /* 'r' */ &&
904
+ c1 === 111 /* 'o' */ &&
905
+ c0 === 46 /* '.' */) {
906
+ out.isIcann = true;
907
+ out.isPrivate = false;
908
+ out.publicSuffix = 'org';
909
+ return true;
910
+ }
911
+ else if (c3 === 117 /* 'u' */ &&
912
+ c2 === 100 /* 'd' */ &&
913
+ c1 === 101 /* 'e' */ &&
914
+ c0 === 46 /* '.' */) {
915
+ out.isIcann = true;
916
+ out.isPrivate = false;
917
+ out.publicSuffix = 'edu';
918
+ return true;
919
+ }
920
+ else if (c3 === 118 /* 'v' */ &&
921
+ c2 === 111 /* 'o' */ &&
922
+ c1 === 103 /* 'g' */ &&
923
+ c0 === 46 /* '.' */) {
924
+ out.isIcann = true;
925
+ out.isPrivate = false;
926
+ out.publicSuffix = 'gov';
927
+ return true;
928
+ }
929
+ else if (c3 === 116 /* 't' */ &&
930
+ c2 === 101 /* 'e' */ &&
931
+ c1 === 110 /* 'n' */ &&
932
+ c0 === 46 /* '.' */) {
933
+ out.isIcann = true;
934
+ out.isPrivate = false;
935
+ out.publicSuffix = 'net';
936
+ return true;
937
+ }
938
+ else if (c3 === 101 /* 'e' */ &&
939
+ c2 === 100 /* 'd' */ &&
940
+ c1 === 46 /* '.' */) {
941
+ out.isIcann = true;
942
+ out.isPrivate = false;
943
+ out.publicSuffix = 'de';
944
+ return true;
945
+ }
946
+ }
947
+ return false;
948
+ }
949
+
950
+ exports.fastPathLookup = fastPath;
951
+ exports.getEmptyResult = getEmptyResult;
952
+ exports.parseImpl = parseImpl;
953
+ exports.resetResult = resetResult;
954
+ exports.setDefaults = setDefaults;
955
+ //# sourceMappingURL=index.js.map