@fumadocs/api-docs 0.0.1

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 (179) hide show
  1. package/LICENSE +21 -0
  2. package/css/generated/shared.css +1 -0
  3. package/css/preset.css +1 -0
  4. package/dist/.translations/index.d.ts +28 -0
  5. package/dist/.translations/keys.js +28 -0
  6. package/dist/_virtual/_rolldown/runtime.js +4 -0
  7. package/dist/auto-anchor/client.d.ts +16 -0
  8. package/dist/auto-anchor/client.js +20 -0
  9. package/dist/auto-anchor/index.d.ts +9 -0
  10. package/dist/auto-anchor/index.js +17 -0
  11. package/dist/codegen.d.ts +38 -0
  12. package/dist/codegen.js +35 -0
  13. package/dist/components/accordion.d.ts +22 -0
  14. package/dist/components/accordion.js +67 -0
  15. package/dist/components/dialog.d.ts +39 -0
  16. package/dist/components/dialog.js +61 -0
  17. package/dist/components/input.d.ts +8 -0
  18. package/dist/components/input.js +17 -0
  19. package/dist/components/playground/inputs.d.ts +50 -0
  20. package/dist/components/playground/inputs.js +426 -0
  21. package/dist/components/playground/schema.d.ts +66 -0
  22. package/dist/components/playground/schema.js +144 -0
  23. package/dist/components/schema/client.d.ts +17 -0
  24. package/dist/components/schema/client.js +415 -0
  25. package/dist/components/schema/index.d.ts +102 -0
  26. package/dist/components/schema/index.js +276 -0
  27. package/dist/components/select-tab.d.ts +33 -0
  28. package/dist/components/select-tab.js +56 -0
  29. package/dist/components/select.d.ts +16 -0
  30. package/dist/components/select.js +72 -0
  31. package/dist/components/spinner.d.ts +7 -0
  32. package/dist/components/spinner.js +14 -0
  33. package/dist/i18n.d.ts +7 -0
  34. package/dist/i18n.js +7 -0
  35. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js +239 -0
  36. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js +187 -0
  37. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.d.ts +157 -0
  38. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js +136 -0
  39. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js +41 -0
  40. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.d.ts +166 -0
  41. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js +124 -0
  42. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js +109 -0
  43. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js +30 -0
  44. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/json.js +46 -0
  45. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js +36 -0
  46. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/yaml.js +49 -0
  47. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.d.ts +96 -0
  48. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js +242 -0
  49. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.d.ts +190 -0
  50. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js +247 -0
  51. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.d.ts +134 -0
  52. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js +210 -0
  53. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolve-external.js +100 -0
  54. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js +41 -0
  55. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js +112 -0
  56. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/types/index.d.ts +133 -0
  57. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js +8 -0
  58. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.d.ts +34 -0
  59. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js +146 -0
  60. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js +5 -0
  61. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js +18 -0
  62. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js +11 -0
  63. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js +99 -0
  64. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/schema-resources.js +30 -0
  65. package/dist/node_modules/.pnpm/@apidevtools_json-schema-ref-parser@15.3.5_@types_json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js +315 -0
  66. package/dist/node_modules/.pnpm/@fastify_deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js +108 -0
  67. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js +110 -0
  68. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js +138 -0
  69. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/index.js +674 -0
  70. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/scope.js +141 -0
  71. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/errors.js +102 -0
  72. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/index.js +223 -0
  73. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/names.js +28 -0
  74. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/ref_error.js +18 -0
  75. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/resolve.js +133 -0
  76. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/rules.js +61 -0
  77. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/util.js +146 -0
  78. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/applicability.js +23 -0
  79. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/boolSchema.js +48 -0
  80. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/dataType.js +172 -0
  81. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/defaults.js +31 -0
  82. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/index.js +433 -0
  83. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/keyword.js +113 -0
  84. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/validate/subschema.js +72 -0
  85. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/core.js +583 -0
  86. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/data.js +18 -0
  87. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/index.js +42 -0
  88. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.js +50 -0
  89. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.js +20 -0
  90. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.js +51 -0
  91. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.js +16 -0
  92. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.js +36 -0
  93. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.js +19 -0
  94. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.js +85 -0
  95. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/refs/json-schema-2020-12/schema.js +59 -0
  96. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/equal.js +12 -0
  97. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/ucs2length.js +25 -0
  98. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/uri.js +12 -0
  99. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/runtime/validation_error.js +16 -0
  100. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +57 -0
  101. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +96 -0
  102. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +29 -0
  103. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +16 -0
  104. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +89 -0
  105. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +87 -0
  106. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js +16 -0
  107. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/if.js +62 -0
  108. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/index.js +60 -0
  109. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items.js +59 -0
  110. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +34 -0
  111. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/not.js +31 -0
  112. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +51 -0
  113. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +61 -0
  114. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +17 -0
  115. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +52 -0
  116. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +41 -0
  117. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +17 -0
  118. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/code.js +130 -0
  119. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/id.js +14 -0
  120. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/index.js +22 -0
  121. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/core/ref.js +112 -0
  122. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +101 -0
  123. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +14 -0
  124. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/draft2020.js +35 -0
  125. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js +46 -0
  126. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js +45 -0
  127. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/index.js +22 -0
  128. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js +20 -0
  129. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js +15 -0
  130. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/format.js +92 -0
  131. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/format/index.js +10 -0
  132. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/metadata.js +23 -0
  133. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/next.js +19 -0
  134. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/index.js +13 -0
  135. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js +46 -0
  136. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +59 -0
  137. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/const.js +27 -0
  138. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js +17 -0
  139. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/enum.js +49 -0
  140. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/index.js +48 -0
  141. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitContains.js +18 -0
  142. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +28 -0
  143. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +33 -0
  144. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +47 -0
  145. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +28 -0
  146. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +27 -0
  147. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +38 -0
  148. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/required.js +72 -0
  149. package/dist/node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +70 -0
  150. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +33 -0
  151. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +236 -0
  152. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +187 -0
  153. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +282 -0
  154. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +78 -0
  155. package/dist/schema/bundle.d.ts +2 -0
  156. package/dist/schema/bundle.js +2 -0
  157. package/dist/schema/dereference.d.ts +19 -0
  158. package/dist/schema/dereference.js +49 -0
  159. package/dist/schema/index.d.ts +21 -0
  160. package/dist/schema/index.js +0 -0
  161. package/dist/schema/merge.d.ts +12 -0
  162. package/dist/schema/merge.js +156 -0
  163. package/dist/schema/ref.d.ts +20 -0
  164. package/dist/schema/ref.js +43 -0
  165. package/dist/schema/resolve-ref.d.ts +4 -0
  166. package/dist/schema/resolve-ref.js +11 -0
  167. package/dist/schema/sample.d.ts +12 -0
  168. package/dist/schema/sample.js +442 -0
  169. package/dist/schema/to-string.d.ts +10 -0
  170. package/dist/schema/to-string.js +51 -0
  171. package/dist/utils/cn.js +2 -0
  172. package/dist/utils/deep-equal.js +21 -0
  173. package/dist/utils/id-to-title.d.ts +4 -0
  174. package/dist/utils/id-to-title.js +12 -0
  175. package/dist/utils/is-plain-object.js +8 -0
  176. package/dist/utils/merge-refs.js +11 -0
  177. package/dist/utils/url.d.ts +5 -0
  178. package/dist/utils/url.js +13 -0
  179. package/package.json +105 -0
@@ -0,0 +1,315 @@
1
+ import convertPathToPosix from "./convert-path-to-posix.js";
2
+ import { isWindows } from "./is-windows.js";
3
+ //#region ../../node_modules/.pnpm/@apidevtools+json-schema-ref-parser@15.3.5_@types+json-schema@7.0.15/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js
4
+ const forwardSlashPattern = /\//g;
5
+ const protocolPattern = /^(\w{2,}):\/\//i;
6
+ const jsonPointerSlash = /~1/g;
7
+ const jsonPointerTilde = /~0/g;
8
+ const isAbsoluteWin32Path = /^[a-zA-Z]:[\\/]/;
9
+ const urlEncodePatterns = [[/\?/g, "%3F"], [/#/g, "%23"]];
10
+ const urlDecodePatterns = [
11
+ /%23/g,
12
+ "#",
13
+ /%24/g,
14
+ "$",
15
+ /%26/g,
16
+ "&",
17
+ /%2C/g,
18
+ ",",
19
+ /%40/g,
20
+ "@"
21
+ ];
22
+ const parse = (u) => new URL(u);
23
+ /**
24
+ * Returns resolved target URL relative to a base URL in a manner similar to that of a Web browser resolving an anchor tag HREF.
25
+ *
26
+ * @returns
27
+ */
28
+ function resolve(from, to) {
29
+ const fromUrl = new URL(convertPathToPosix(from), "https://aaa.nonexistanturl.com");
30
+ const resolvedUrl = new URL(convertPathToPosix(to), fromUrl);
31
+ const endSpaces = to.match(/(\s*)$/)?.[1] || "";
32
+ if (resolvedUrl.hostname === "aaa.nonexistanturl.com") {
33
+ const { pathname, search, hash } = resolvedUrl;
34
+ return pathname + search + decodeURIComponent(hash) + endSpaces;
35
+ }
36
+ const resolved = resolvedUrl.toString() + endSpaces;
37
+ if (resolved.includes("#")) {
38
+ const [base, hash] = resolved.split("#", 2);
39
+ return base + "#" + decodeURIComponent(hash || "");
40
+ }
41
+ return resolved;
42
+ }
43
+ /**
44
+ * Returns the current working directory (in Node) or the current page URL (in browsers).
45
+ *
46
+ * @returns
47
+ */
48
+ function cwd() {
49
+ if (typeof window !== "undefined" && window.location && window.location.href) {
50
+ const href = window.location.href;
51
+ if (!href || !href.startsWith("http")) try {
52
+ new URL(href);
53
+ return href;
54
+ } catch {
55
+ return "/";
56
+ }
57
+ return href;
58
+ }
59
+ if (typeof process !== "undefined" && process.cwd) {
60
+ const path = process.cwd();
61
+ const lastChar = path.slice(-1);
62
+ if (lastChar === "/" || lastChar === "\\") return path;
63
+ else return path + "/";
64
+ }
65
+ return "/";
66
+ }
67
+ /**
68
+ * Returns the protocol of the given URL, or `undefined` if it has no protocol.
69
+ *
70
+ * @param path
71
+ * @returns
72
+ */
73
+ function getProtocol(path) {
74
+ const match = protocolPattern.exec(path || "");
75
+ if (match) return match[1].toLowerCase();
76
+ }
77
+ /**
78
+ * Returns the lowercased file extension of the given URL,
79
+ * or an empty string if it has no extension.
80
+ *
81
+ * @param path
82
+ * @returns
83
+ */
84
+ function getExtension(path) {
85
+ const lastDot = path.lastIndexOf(".");
86
+ if (lastDot >= 0) return stripQuery(path.substring(lastDot).toLowerCase());
87
+ return "";
88
+ }
89
+ /**
90
+ * Removes the query, if any, from the given path.
91
+ *
92
+ * @param path
93
+ * @returns
94
+ */
95
+ function stripQuery(path) {
96
+ const queryIndex = path.indexOf("?");
97
+ if (queryIndex >= 0) path = path.substring(0, queryIndex);
98
+ return path;
99
+ }
100
+ /**
101
+ * Returns the hash (URL fragment), of the given path.
102
+ * If there is no hash, then the root hash ("#") is returned.
103
+ *
104
+ * @param path
105
+ * @returns
106
+ */
107
+ function getHash(path) {
108
+ if (!path) return "#";
109
+ const hashIndex = path.indexOf("#");
110
+ if (hashIndex >= 0) return path.substring(hashIndex);
111
+ return "#";
112
+ }
113
+ /**
114
+ * Removes the hash (URL fragment), if any, from the given path.
115
+ *
116
+ * @param path
117
+ * @returns
118
+ */
119
+ function stripHash(path) {
120
+ if (!path) return "";
121
+ const hashIndex = path.indexOf("#");
122
+ if (hashIndex >= 0) path = path.substring(0, hashIndex);
123
+ return path;
124
+ }
125
+ /**
126
+ * Determines whether the given path is an HTTP(S) URL.
127
+ *
128
+ * @param path
129
+ * @returns
130
+ */
131
+ function isHttp(path) {
132
+ const protocol = getProtocol(path);
133
+ if (protocol === "http" || protocol === "https") return true;
134
+ else if (protocol === void 0) return typeof window !== "undefined";
135
+ else return false;
136
+ }
137
+ /**
138
+ * Determines whether the given url is an unsafe or internal url.
139
+ *
140
+ * @param path - The URL or path to check
141
+ * @returns true if the URL is unsafe/internal, false otherwise
142
+ */
143
+ function isUnsafeUrl(path) {
144
+ if (!path || typeof path !== "string") return true;
145
+ const normalizedPath = path.trim().toLowerCase();
146
+ if (!normalizedPath) return true;
147
+ if (normalizedPath.startsWith("javascript:") || normalizedPath.startsWith("vbscript:") || normalizedPath.startsWith("data:")) return true;
148
+ if (normalizedPath.startsWith("file:")) return true;
149
+ if (typeof window !== "undefined" && window.location && window.location.href) return false;
150
+ const localPatterns = [
151
+ "localhost",
152
+ "127.0.0.1",
153
+ "::1",
154
+ "10.",
155
+ "172.16.",
156
+ "172.17.",
157
+ "172.18.",
158
+ "172.19.",
159
+ "172.20.",
160
+ "172.21.",
161
+ "172.22.",
162
+ "172.23.",
163
+ "172.24.",
164
+ "172.25.",
165
+ "172.26.",
166
+ "172.27.",
167
+ "172.28.",
168
+ "172.29.",
169
+ "172.30.",
170
+ "172.31.",
171
+ "192.168.",
172
+ "169.254.",
173
+ ".local",
174
+ ".internal",
175
+ ".intranet",
176
+ ".corp",
177
+ ".home",
178
+ ".lan"
179
+ ];
180
+ try {
181
+ const url = new URL(normalizedPath.startsWith("//") ? "http:" + normalizedPath : normalizedPath);
182
+ const hostname = url.hostname.toLowerCase();
183
+ for (const pattern of localPatterns) if (hostname === pattern || hostname.startsWith(pattern) || hostname.endsWith(pattern)) return true;
184
+ if (isPrivateIP(hostname)) return true;
185
+ const port = url.port;
186
+ if (port && isInternalPort(parseInt(port))) return true;
187
+ } catch {
188
+ if (normalizedPath.startsWith("/") && !normalizedPath.startsWith("//")) return false;
189
+ for (const pattern of localPatterns) if (normalizedPath.includes(pattern)) return true;
190
+ }
191
+ return false;
192
+ }
193
+ /**
194
+ * Helper function to check if an IP address is in a private range
195
+ */
196
+ function isPrivateIP(ip) {
197
+ const match = ip.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
198
+ if (!match) return false;
199
+ const [, a, b, c, d] = match.map(Number);
200
+ if (a > 255 || b > 255 || c > 255 || d > 255) return false;
201
+ return a === 10 || a === 127 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254;
202
+ }
203
+ /**
204
+ * Helper function to check if a port is typically used for internal services
205
+ */
206
+ function isInternalPort(port) {
207
+ return [
208
+ 22,
209
+ 23,
210
+ 25,
211
+ 53,
212
+ 135,
213
+ 139,
214
+ 445,
215
+ 993,
216
+ 995,
217
+ 1433,
218
+ 1521,
219
+ 3306,
220
+ 3389,
221
+ 5432,
222
+ 5900,
223
+ 6379,
224
+ 8080,
225
+ 8443,
226
+ 9200,
227
+ 27017
228
+ ].includes(port);
229
+ }
230
+ /**
231
+ * Determines whether the given path is a filesystem path.
232
+ * This includes "file://" URLs.
233
+ *
234
+ * @param path
235
+ * @returns
236
+ */
237
+ function isFileSystemPath(path) {
238
+ if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) return false;
239
+ const protocol = getProtocol(path);
240
+ return protocol === void 0 || protocol === "file";
241
+ }
242
+ /**
243
+ * Converts a filesystem path to a properly-encoded URL.
244
+ *
245
+ * This is intended to handle situations where JSON Schema $Ref Parser is called
246
+ * with a filesystem path that contains characters which are not allowed in URLs.
247
+ *
248
+ * @example
249
+ * The following filesystem paths would be converted to the following URLs:
250
+ *
251
+ * <"!@#$%^&*+=?'>.json ==> %3C%22!@%23$%25%5E&*+=%3F\'%3E.json
252
+ * C:\\My Documents\\File (1).json ==> C:/My%20Documents/File%20(1).json
253
+ * file://Project #42/file.json ==> file://Project%20%2342/file.json
254
+ *
255
+ * @param path
256
+ * @returns
257
+ */
258
+ function fromFileSystemPath(path) {
259
+ if (isWindows()) {
260
+ const projectDir = cwd();
261
+ const upperPath = path.toUpperCase();
262
+ const posixUpper = convertPathToPosix(projectDir).toUpperCase();
263
+ const hasProjectDir = upperPath.includes(posixUpper);
264
+ const hasProjectUri = upperPath.includes(posixUpper);
265
+ const isAbsolutePath = isAbsoluteWin32Path.test(path) || path.startsWith("http://") || path.startsWith("https://") || path.startsWith("file://");
266
+ if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
267
+ const join = (a, b) => {
268
+ if (a.endsWith("/") || a.endsWith("\\")) return a + b;
269
+ else return a + "/" + b;
270
+ };
271
+ path = join(projectDir, path);
272
+ }
273
+ path = convertPathToPosix(path);
274
+ }
275
+ path = encodeURI(path);
276
+ for (const pattern of urlEncodePatterns) path = path.replace(pattern[0], pattern[1]);
277
+ return path;
278
+ }
279
+ /**
280
+ * Converts a URL to a local filesystem path.
281
+ */
282
+ function toFileSystemPath(path, keepFileProtocol) {
283
+ path = path.replace(/%(?![0-9A-Fa-f]{2})/g, "%25");
284
+ path = decodeURI(path);
285
+ for (let i = 0; i < urlDecodePatterns.length; i += 2) path = path.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]);
286
+ let isFileUrl = path.toLowerCase().startsWith("file://");
287
+ if (isFileUrl) {
288
+ path = path.replace(/^file:\/\//, "").replace(/^\//, "");
289
+ if (isWindows() && path[1] === "/") path = `${path[0]}:${path.substring(1)}`;
290
+ if (keepFileProtocol) path = "file:///" + path;
291
+ else {
292
+ isFileUrl = false;
293
+ path = isWindows() ? path : "/" + path;
294
+ }
295
+ }
296
+ if (isWindows() && !isFileUrl) {
297
+ path = path.replace(forwardSlashPattern, "\\");
298
+ if (path.match(/^[a-z]:\\/i)) path = path[0].toUpperCase() + path.substring(1);
299
+ }
300
+ return path;
301
+ }
302
+ /**
303
+ * Converts a $ref pointer to a valid JSON Path.
304
+ *
305
+ * @param pointer
306
+ * @returns
307
+ */
308
+ function safePointerToPath(pointer) {
309
+ if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") return [];
310
+ return pointer.slice(2).split("/").map((value) => {
311
+ return value.replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
312
+ });
313
+ }
314
+ //#endregion
315
+ export { cwd, fromFileSystemPath, getExtension, getHash, isFileSystemPath, isHttp, isUnsafeUrl, parse, resolve, safePointerToPath, stripHash, toFileSystemPath };
@@ -0,0 +1,108 @@
1
+ import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../node_modules/.pnpm/@fastify+deepmerge@3.2.1/node_modules/@fastify/deepmerge/index.js
3
+ var require_deepmerge = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ const JSON_PROTO = Object.getPrototypeOf({});
5
+ function defaultIsMergeableObjectFactory() {
6
+ return function defaultIsMergeableObject(value) {
7
+ return typeof value === "object" && value !== null && !(value instanceof RegExp) && !(value instanceof Date);
8
+ };
9
+ }
10
+ function deepmergeConstructor(options) {
11
+ function isNotPrototypeKey(value) {
12
+ return value !== "constructor" && value !== "prototype" && value !== "__proto__";
13
+ }
14
+ function cloneArray(value) {
15
+ let i = 0;
16
+ const il = value.length;
17
+ const result = new Array(il);
18
+ for (; i < il; ++i) result[i] = clone(value[i]);
19
+ return result;
20
+ }
21
+ function cloneObject(target) {
22
+ const result = {};
23
+ if (cloneProtoObject && Object.getPrototypeOf(target) !== JSON_PROTO) return cloneProtoObject(target);
24
+ const targetKeys = getKeys(target);
25
+ let i, il, key;
26
+ for (i = 0, il = targetKeys.length; i < il; ++i) isNotPrototypeKey(key = targetKeys[i]) && (result[key] = clone(target[key]));
27
+ return result;
28
+ }
29
+ function concatArrays(target, source) {
30
+ const tl = target.length;
31
+ const sl = source.length;
32
+ let i = 0;
33
+ const result = new Array(tl + sl);
34
+ for (; i < tl; ++i) result[i] = clone(target[i]);
35
+ for (i = 0; i < sl; ++i) result[i + tl] = clone(source[i]);
36
+ return result;
37
+ }
38
+ const propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
39
+ function getSymbolsAndKeys(value) {
40
+ const result = Object.keys(value);
41
+ const keys = Object.getOwnPropertySymbols(value);
42
+ for (let i = 0, il = keys.length; i < il; ++i) propertyIsEnumerable.call(value, keys[i]) && result.push(keys[i]);
43
+ return result;
44
+ }
45
+ const getKeys = options?.symbols ? getSymbolsAndKeys : Object.keys;
46
+ const cloneProtoObject = typeof options?.cloneProtoObject === "function" ? options.cloneProtoObject : void 0;
47
+ const isMergeableObject = typeof options?.isMergeableObject === "function" ? options.isMergeableObject : defaultIsMergeableObjectFactory();
48
+ const onlyDefinedProperties = options?.onlyDefinedProperties === true;
49
+ function isPrimitive(value) {
50
+ return typeof value !== "object" || value === null;
51
+ }
52
+ const mergeArray = options && typeof options.mergeArray === "function" ? options.mergeArray({
53
+ clone,
54
+ deepmerge: _deepmerge,
55
+ getKeys,
56
+ isMergeableObject
57
+ }) : concatArrays;
58
+ function clone(entry) {
59
+ return isMergeableObject(entry) ? Array.isArray(entry) ? cloneArray(entry) : cloneObject(entry) : entry;
60
+ }
61
+ function mergeObject(target, source) {
62
+ const result = {};
63
+ const targetKeys = getKeys(target);
64
+ const sourceKeys = getKeys(source);
65
+ let i, il, key;
66
+ for (i = 0, il = targetKeys.length; i < il; ++i) isNotPrototypeKey(key = targetKeys[i]) && sourceKeys.indexOf(key) === -1 && (result[key] = clone(target[key]));
67
+ for (i = 0, il = sourceKeys.length; i < il; ++i) {
68
+ if (!isNotPrototypeKey(key = sourceKeys[i])) continue;
69
+ if (key in target) {
70
+ if (targetKeys.indexOf(key) !== -1) if (cloneProtoObject && isMergeableObject(source[key]) && Object.getPrototypeOf(source[key]) !== JSON_PROTO) result[key] = cloneProtoObject(source[key]);
71
+ else result[key] = _deepmerge(target[key], source[key]);
72
+ } else {
73
+ if (onlyDefinedProperties && typeof source[key] === "undefined") continue;
74
+ result[key] = clone(source[key]);
75
+ }
76
+ }
77
+ return result;
78
+ }
79
+ function _deepmerge(target, source) {
80
+ if (onlyDefinedProperties && typeof source === "undefined") return clone(target);
81
+ const sourceIsArray = Array.isArray(source);
82
+ const targetIsArray = Array.isArray(target);
83
+ if (isPrimitive(source)) return source;
84
+ else if (!isMergeableObject(target)) return clone(source);
85
+ else if (sourceIsArray && targetIsArray) return mergeArray(target, source);
86
+ else if (sourceIsArray !== targetIsArray) return clone(source);
87
+ else return mergeObject(target, source);
88
+ }
89
+ function _deepmergeAll() {
90
+ switch (arguments.length) {
91
+ case 0: return {};
92
+ case 1: return clone(arguments[0]);
93
+ case 2: return _deepmerge(arguments[0], arguments[1]);
94
+ }
95
+ let result;
96
+ for (let i = 0, il = arguments.length; i < il; ++i) result = _deepmerge(result, arguments[i]);
97
+ return result;
98
+ }
99
+ return options?.all ? _deepmergeAll : _deepmerge;
100
+ }
101
+ module.exports = deepmergeConstructor;
102
+ module.exports.default = deepmergeConstructor;
103
+ module.exports.deepmerge = deepmergeConstructor;
104
+ Object.defineProperty(module.exports, "isMergeableObject", { get: defaultIsMergeableObjectFactory });
105
+ }));
106
+ //#endregion
107
+ export default require_deepmerge();
108
+ export { require_deepmerge };
@@ -0,0 +1,110 @@
1
+ import { __commonJSMin } from "../../../../../../_virtual/_rolldown/runtime.js";
2
+ import { require_codegen } from "./compile/codegen/index.js";
3
+ import { require_validate } from "./compile/validate/index.js";
4
+ import { require_validation_error } from "./runtime/validation_error.js";
5
+ import { require_ref_error } from "./compile/ref_error.js";
6
+ import { require_core } from "./core.js";
7
+ import { require_draft2020 } from "./vocabularies/draft2020.js";
8
+ import { require_discriminator } from "./vocabularies/discriminator/index.js";
9
+ import { require_json_schema_2020_12 } from "./refs/json-schema-2020-12/index.js";
10
+ //#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/2020.js
11
+ var require__2020 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv2020 = void 0;
14
+ const core_1 = require_core();
15
+ const draft2020_1 = require_draft2020();
16
+ const discriminator_1 = require_discriminator();
17
+ const json_schema_2020_12_1 = require_json_schema_2020_12();
18
+ const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
19
+ var Ajv2020 = class extends core_1.default {
20
+ constructor(opts = {}) {
21
+ super({
22
+ ...opts,
23
+ dynamicRef: true,
24
+ next: true,
25
+ unevaluated: true
26
+ });
27
+ }
28
+ _addVocabularies() {
29
+ super._addVocabularies();
30
+ draft2020_1.default.forEach((v) => this.addVocabulary(v));
31
+ if (this.opts.discriminator) this.addKeyword(discriminator_1.default);
32
+ }
33
+ _addDefaultMetaSchema() {
34
+ super._addDefaultMetaSchema();
35
+ const { $data, meta } = this.opts;
36
+ if (!meta) return;
37
+ json_schema_2020_12_1.default.call(this, $data);
38
+ this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
39
+ }
40
+ defaultMeta() {
41
+ return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
42
+ }
43
+ };
44
+ exports.Ajv2020 = Ajv2020;
45
+ module.exports = exports = Ajv2020;
46
+ module.exports.Ajv2020 = Ajv2020;
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.default = Ajv2020;
49
+ var validate_1 = require_validate();
50
+ Object.defineProperty(exports, "KeywordCxt", {
51
+ enumerable: true,
52
+ get: function() {
53
+ return validate_1.KeywordCxt;
54
+ }
55
+ });
56
+ var codegen_1 = require_codegen();
57
+ Object.defineProperty(exports, "_", {
58
+ enumerable: true,
59
+ get: function() {
60
+ return codegen_1._;
61
+ }
62
+ });
63
+ Object.defineProperty(exports, "str", {
64
+ enumerable: true,
65
+ get: function() {
66
+ return codegen_1.str;
67
+ }
68
+ });
69
+ Object.defineProperty(exports, "stringify", {
70
+ enumerable: true,
71
+ get: function() {
72
+ return codegen_1.stringify;
73
+ }
74
+ });
75
+ Object.defineProperty(exports, "nil", {
76
+ enumerable: true,
77
+ get: function() {
78
+ return codegen_1.nil;
79
+ }
80
+ });
81
+ Object.defineProperty(exports, "Name", {
82
+ enumerable: true,
83
+ get: function() {
84
+ return codegen_1.Name;
85
+ }
86
+ });
87
+ Object.defineProperty(exports, "CodeGen", {
88
+ enumerable: true,
89
+ get: function() {
90
+ return codegen_1.CodeGen;
91
+ }
92
+ });
93
+ var validation_error_1 = require_validation_error();
94
+ Object.defineProperty(exports, "ValidationError", {
95
+ enumerable: true,
96
+ get: function() {
97
+ return validation_error_1.default;
98
+ }
99
+ });
100
+ var ref_error_1 = require_ref_error();
101
+ Object.defineProperty(exports, "MissingRefError", {
102
+ enumerable: true,
103
+ get: function() {
104
+ return ref_error_1.default;
105
+ }
106
+ });
107
+ }));
108
+ //#endregion
109
+ export default require__2020();
110
+ export { require__2020 };
@@ -0,0 +1,138 @@
1
+ import { __commonJSMin } from "../../../../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region ../../node_modules/.pnpm/ajv@8.20.0/node_modules/ajv/dist/compile/codegen/code.js
3
+ var require_code = /* @__PURE__ */ __commonJSMin(((exports) => {
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
6
+ var _CodeOrName = class {};
7
+ exports._CodeOrName = _CodeOrName;
8
+ exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
9
+ var Name = class extends _CodeOrName {
10
+ constructor(s) {
11
+ super();
12
+ if (!exports.IDENTIFIER.test(s)) throw new Error("CodeGen: name must be a valid identifier");
13
+ this.str = s;
14
+ }
15
+ toString() {
16
+ return this.str;
17
+ }
18
+ emptyStr() {
19
+ return false;
20
+ }
21
+ get names() {
22
+ return { [this.str]: 1 };
23
+ }
24
+ };
25
+ exports.Name = Name;
26
+ var _Code = class extends _CodeOrName {
27
+ constructor(code) {
28
+ super();
29
+ this._items = typeof code === "string" ? [code] : code;
30
+ }
31
+ toString() {
32
+ return this.str;
33
+ }
34
+ emptyStr() {
35
+ if (this._items.length > 1) return false;
36
+ const item = this._items[0];
37
+ return item === "" || item === "\"\"";
38
+ }
39
+ get str() {
40
+ var _a;
41
+ return (_a = this._str) !== null && _a !== void 0 ? _a : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
42
+ }
43
+ get names() {
44
+ var _a;
45
+ return (_a = this._names) !== null && _a !== void 0 ? _a : this._names = this._items.reduce((names, c) => {
46
+ if (c instanceof Name) names[c.str] = (names[c.str] || 0) + 1;
47
+ return names;
48
+ }, {});
49
+ }
50
+ };
51
+ exports._Code = _Code;
52
+ exports.nil = new _Code("");
53
+ function _(strs, ...args) {
54
+ const code = [strs[0]];
55
+ let i = 0;
56
+ while (i < args.length) {
57
+ addCodeArg(code, args[i]);
58
+ code.push(strs[++i]);
59
+ }
60
+ return new _Code(code);
61
+ }
62
+ exports._ = _;
63
+ const plus = new _Code("+");
64
+ function str(strs, ...args) {
65
+ const expr = [safeStringify(strs[0])];
66
+ let i = 0;
67
+ while (i < args.length) {
68
+ expr.push(plus);
69
+ addCodeArg(expr, args[i]);
70
+ expr.push(plus, safeStringify(strs[++i]));
71
+ }
72
+ optimize(expr);
73
+ return new _Code(expr);
74
+ }
75
+ exports.str = str;
76
+ function addCodeArg(code, arg) {
77
+ if (arg instanceof _Code) code.push(...arg._items);
78
+ else if (arg instanceof Name) code.push(arg);
79
+ else code.push(interpolate(arg));
80
+ }
81
+ exports.addCodeArg = addCodeArg;
82
+ function optimize(expr) {
83
+ let i = 1;
84
+ while (i < expr.length - 1) {
85
+ if (expr[i] === plus) {
86
+ const res = mergeExprItems(expr[i - 1], expr[i + 1]);
87
+ if (res !== void 0) {
88
+ expr.splice(i - 1, 3, res);
89
+ continue;
90
+ }
91
+ expr[i++] = "+";
92
+ }
93
+ i++;
94
+ }
95
+ }
96
+ function mergeExprItems(a, b) {
97
+ if (b === "\"\"") return a;
98
+ if (a === "\"\"") return b;
99
+ if (typeof a == "string") {
100
+ if (b instanceof Name || a[a.length - 1] !== "\"") return;
101
+ if (typeof b != "string") return `${a.slice(0, -1)}${b}"`;
102
+ if (b[0] === "\"") return a.slice(0, -1) + b.slice(1);
103
+ return;
104
+ }
105
+ if (typeof b == "string" && b[0] === "\"" && !(a instanceof Name)) return `"${a}${b.slice(1)}`;
106
+ }
107
+ function strConcat(c1, c2) {
108
+ return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`;
109
+ }
110
+ exports.strConcat = strConcat;
111
+ function interpolate(x) {
112
+ return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
113
+ }
114
+ function stringify(x) {
115
+ return new _Code(safeStringify(x));
116
+ }
117
+ exports.stringify = stringify;
118
+ function safeStringify(x) {
119
+ return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
120
+ }
121
+ exports.safeStringify = safeStringify;
122
+ function getProperty(key) {
123
+ return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`;
124
+ }
125
+ exports.getProperty = getProperty;
126
+ function getEsmExportName(key) {
127
+ if (typeof key == "string" && exports.IDENTIFIER.test(key)) return new _Code(`${key}`);
128
+ throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
129
+ }
130
+ exports.getEsmExportName = getEsmExportName;
131
+ function regexpCode(rx) {
132
+ return new _Code(rx.toString());
133
+ }
134
+ exports.regexpCode = regexpCode;
135
+ }));
136
+ //#endregion
137
+ export default require_code();
138
+ export { require_code };