@axium/server 0.18.6 → 0.19.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 (191) hide show
  1. package/build/client/_app/immutable/chunks/BYEtX5Az.js +1 -0
  2. package/build/client/_app/immutable/chunks/BYEtX5Az.js.br +0 -0
  3. package/build/client/_app/immutable/chunks/BYEtX5Az.js.gz +0 -0
  4. package/build/client/_app/immutable/chunks/Cyzk4yeH.js +3 -0
  5. package/build/client/_app/immutable/chunks/Cyzk4yeH.js.br +0 -0
  6. package/build/client/_app/immutable/chunks/Cyzk4yeH.js.gz +0 -0
  7. package/build/client/_app/immutable/chunks/{B3bf7yrh.js → DCUM25og.js} +1 -1
  8. package/build/client/_app/immutable/chunks/DCUM25og.js.br +0 -0
  9. package/build/client/_app/immutable/chunks/{B3bf7yrh.js.gz → DCUM25og.js.gz} +0 -0
  10. package/build/client/_app/immutable/chunks/DY1x3fBx.js +1 -0
  11. package/build/client/_app/immutable/chunks/DY1x3fBx.js.br +0 -0
  12. package/build/client/_app/immutable/chunks/DY1x3fBx.js.gz +0 -0
  13. package/build/client/_app/immutable/chunks/{B4IjTTLF.js → DYZBB-Ix.js} +8 -8
  14. package/build/client/_app/immutable/chunks/DYZBB-Ix.js.br +0 -0
  15. package/build/client/_app/immutable/chunks/DYZBB-Ix.js.gz +0 -0
  16. package/build/client/_app/immutable/chunks/FWeOBoAM.js +1 -0
  17. package/build/client/_app/immutable/chunks/FWeOBoAM.js.br +0 -0
  18. package/build/client/_app/immutable/chunks/FWeOBoAM.js.gz +0 -0
  19. package/build/client/_app/immutable/chunks/IgiyYk6u.js +1 -0
  20. package/build/client/_app/immutable/chunks/IgiyYk6u.js.br +0 -0
  21. package/build/client/_app/immutable/chunks/IgiyYk6u.js.gz +0 -0
  22. package/build/client/_app/immutable/chunks/p-F-zYzk.js +1 -0
  23. package/build/client/_app/immutable/chunks/p-F-zYzk.js.br +0 -0
  24. package/build/client/_app/immutable/chunks/p-F-zYzk.js.gz +0 -0
  25. package/build/client/_app/immutable/entry/app.BOAQU4lu.js +2 -0
  26. package/build/client/_app/immutable/entry/app.BOAQU4lu.js.br +0 -0
  27. package/build/client/_app/immutable/entry/app.BOAQU4lu.js.gz +0 -0
  28. package/build/client/_app/immutable/entry/start.BcxVnXqP.js +1 -0
  29. package/build/client/_app/immutable/entry/start.BcxVnXqP.js.br +2 -0
  30. package/build/client/_app/immutable/entry/start.BcxVnXqP.js.gz +0 -0
  31. package/build/client/_app/immutable/nodes/{0.BbGefPez.js → 0.fU2Fkia3.js} +1 -1
  32. package/build/client/_app/immutable/nodes/0.fU2Fkia3.js.br +0 -0
  33. package/build/client/_app/immutable/nodes/0.fU2Fkia3.js.gz +0 -0
  34. package/build/client/_app/immutable/nodes/1.ebxToP8U.js +1 -0
  35. package/build/client/_app/immutable/nodes/1.ebxToP8U.js.br +0 -0
  36. package/build/client/_app/immutable/nodes/1.ebxToP8U.js.gz +0 -0
  37. package/build/client/_app/immutable/nodes/{2._Jmh03he.js → 2.Cczp5_pl.js} +1 -1
  38. package/build/client/_app/immutable/nodes/2.Cczp5_pl.js.br +0 -0
  39. package/build/client/_app/immutable/nodes/2.Cczp5_pl.js.gz +0 -0
  40. package/build/client/_app/immutable/nodes/3.BwwptDiR.js +1 -0
  41. package/build/client/_app/immutable/nodes/3.BwwptDiR.js.br +0 -0
  42. package/build/client/_app/immutable/nodes/3.BwwptDiR.js.gz +0 -0
  43. package/build/client/_app/immutable/nodes/4.DFZa97F0.js +1 -0
  44. package/build/client/_app/immutable/nodes/4.DFZa97F0.js.br +0 -0
  45. package/build/client/_app/immutable/nodes/4.DFZa97F0.js.gz +0 -0
  46. package/build/client/_app/immutable/nodes/5.CObFvODa.js +1 -0
  47. package/build/client/_app/immutable/nodes/5.CObFvODa.js.br +0 -0
  48. package/build/client/_app/immutable/nodes/5.CObFvODa.js.gz +0 -0
  49. package/build/client/_app/immutable/nodes/6.ezb4muQm.js +1 -0
  50. package/build/client/_app/immutable/nodes/6.ezb4muQm.js.br +0 -0
  51. package/build/client/_app/immutable/nodes/6.ezb4muQm.js.gz +0 -0
  52. package/build/client/_app/version.json +1 -1
  53. package/build/client/_app/version.json.br +0 -0
  54. package/build/client/_app/version.json.gz +0 -0
  55. package/build/server/chunks/{0-CUfr8UwD.js → 0-BwO1RCtn.js} +2 -2
  56. package/build/server/chunks/{0-CUfr8UwD.js.map → 0-BwO1RCtn.js.map} +1 -1
  57. package/build/server/chunks/1-BtBlW1Zd.js +9 -0
  58. package/build/server/chunks/{1-DffE3_iJ.js.map → 1-BtBlW1Zd.js.map} +1 -1
  59. package/build/server/chunks/{2-c1bljkMr.js → 2-BwMXZ3uH.js} +2 -2
  60. package/build/server/chunks/{2-c1bljkMr.js.map → 2-BwMXZ3uH.js.map} +1 -1
  61. package/build/server/chunks/3-DZ3qU23G.js +9 -0
  62. package/build/server/chunks/3-DZ3qU23G.js.map +1 -0
  63. package/build/server/chunks/4-CiYhCg7w.js +9 -0
  64. package/build/server/chunks/4-CiYhCg7w.js.map +1 -0
  65. package/build/server/chunks/5-DeLLDZUB.js +9 -0
  66. package/build/server/chunks/5-DeLLDZUB.js.map +1 -0
  67. package/build/server/chunks/6-WSYEiBK_.js +9 -0
  68. package/build/server/chunks/6-WSYEiBK_.js.map +1 -0
  69. package/build/server/chunks/{Logout-CkwmxNTt.js → Logout-CXx10rDN.js} +4 -5
  70. package/build/server/chunks/Logout-CXx10rDN.js.map +1 -0
  71. package/build/server/chunks/_page.svelte-BBp1dML7.js +11 -0
  72. package/build/server/chunks/{_page.svelte-DPdvFuWg.js.map → _page.svelte-BBp1dML7.js.map} +1 -1
  73. package/build/server/chunks/{_page.svelte-CVJoQAAB.js → _page.svelte-C_AR-luT.js} +4 -5
  74. package/build/server/chunks/_page.svelte-C_AR-luT.js.map +1 -0
  75. package/build/server/chunks/{_page.svelte-whmO3TtB.js → _page.svelte-CrDbYLUc.js} +10 -365
  76. package/build/server/chunks/_page.svelte-CrDbYLUc.js.map +1 -0
  77. package/build/server/chunks/{_page.svelte-D3kXcWlK.js → _page.svelte-Ds-0vPQG.js} +4 -5
  78. package/build/server/chunks/_page.svelte-Ds-0vPQG.js.map +1 -0
  79. package/build/server/chunks/error.svelte-DkJRpKga.js +46 -0
  80. package/build/server/chunks/error.svelte-DkJRpKga.js.map +1 -0
  81. package/build/server/chunks/exports-Cc9yggiy.js +226 -0
  82. package/build/server/chunks/exports-Cc9yggiy.js.map +1 -0
  83. package/build/server/chunks/hooks.server-PyYsuy1-.js +1324 -0
  84. package/build/server/chunks/hooks.server-PyYsuy1-.js.map +1 -0
  85. package/build/server/chunks/{exports-DeY8o0ws.js → index-CBVFb-Fk.js} +2 -223
  86. package/build/server/chunks/index-CBVFb-Fk.js.map +1 -0
  87. package/build/server/chunks/{user-DW-tjDe0.js → schemas-C2VqNPFY.js} +129 -2079
  88. package/build/server/chunks/schemas-C2VqNPFY.js.map +1 -0
  89. package/build/server/chunks/string-CafUlmcI.js +355 -0
  90. package/build/server/chunks/string-CafUlmcI.js.map +1 -0
  91. package/build/server/chunks/user-B61vTdij.js +2078 -0
  92. package/build/server/chunks/user-B61vTdij.js.map +1 -0
  93. package/build/server/index.js +4 -3
  94. package/build/server/index.js.map +1 -1
  95. package/build/server/manifest.js +8 -8
  96. package/build/server/manifest.js.map +1 -1
  97. package/dist/api/acl.js +2 -2
  98. package/dist/api/metadata.js +3 -4
  99. package/dist/api/passkeys.js +1 -2
  100. package/dist/api/register.js +9 -10
  101. package/dist/api/session.js +1 -2
  102. package/dist/api/users.js +11 -12
  103. package/dist/auth.d.ts +1 -1
  104. package/dist/auth.js +1 -2
  105. package/dist/cli.js +2 -2
  106. package/dist/config.d.ts +74 -70
  107. package/dist/config.js +62 -57
  108. package/dist/index.d.ts +1 -1
  109. package/dist/index.js +1 -1
  110. package/dist/requests.d.ts +36 -2
  111. package/dist/requests.js +65 -7
  112. package/dist/routes.d.ts +1 -1
  113. package/dist/serve.d.ts +6 -1
  114. package/dist/serve.js +19 -1
  115. package/dist/sveltekit.d.ts +3 -3
  116. package/dist/sveltekit.js +11 -46
  117. package/package.json +1 -2
  118. package/routes/account/+page.svelte +4 -5
  119. package/svelte.config.js +1 -2
  120. package/web/hooks.server.ts +3 -17
  121. package/web/lib/FormDialog.svelte +4 -5
  122. package/web/lib/Logout.svelte +6 -2
  123. package/web/tsconfig.json +1 -1
  124. package/build/client/_app/immutable/chunks/B3bf7yrh.js.br +0 -0
  125. package/build/client/_app/immutable/chunks/B4IjTTLF.js.br +0 -0
  126. package/build/client/_app/immutable/chunks/B4IjTTLF.js.gz +0 -0
  127. package/build/client/_app/immutable/chunks/BeFE4kE2.js +0 -3
  128. package/build/client/_app/immutable/chunks/BeFE4kE2.js.br +0 -0
  129. package/build/client/_app/immutable/chunks/BeFE4kE2.js.gz +0 -0
  130. package/build/client/_app/immutable/chunks/CtT1TXOG.js +0 -1
  131. package/build/client/_app/immutable/chunks/CtT1TXOG.js.br +0 -0
  132. package/build/client/_app/immutable/chunks/CtT1TXOG.js.gz +0 -0
  133. package/build/client/_app/immutable/chunks/D5lcOOwR.js +0 -1
  134. package/build/client/_app/immutable/chunks/D5lcOOwR.js.br +0 -0
  135. package/build/client/_app/immutable/chunks/D5lcOOwR.js.gz +0 -0
  136. package/build/client/_app/immutable/chunks/DCs3KlJy.js +0 -1
  137. package/build/client/_app/immutable/chunks/DCs3KlJy.js.br +0 -0
  138. package/build/client/_app/immutable/chunks/DCs3KlJy.js.gz +0 -0
  139. package/build/client/_app/immutable/chunks/ct9jA5hl.js +0 -1
  140. package/build/client/_app/immutable/chunks/ct9jA5hl.js.br +0 -0
  141. package/build/client/_app/immutable/chunks/ct9jA5hl.js.gz +0 -0
  142. package/build/client/_app/immutable/chunks/rXU5YtEm.js +0 -1
  143. package/build/client/_app/immutable/chunks/rXU5YtEm.js.br +0 -0
  144. package/build/client/_app/immutable/chunks/rXU5YtEm.js.gz +0 -0
  145. package/build/client/_app/immutable/entry/app.VDao1I0a.js +0 -2
  146. package/build/client/_app/immutable/entry/app.VDao1I0a.js.br +0 -0
  147. package/build/client/_app/immutable/entry/app.VDao1I0a.js.gz +0 -0
  148. package/build/client/_app/immutable/entry/start.CqVn4hZK.js +0 -1
  149. package/build/client/_app/immutable/entry/start.CqVn4hZK.js.br +0 -0
  150. package/build/client/_app/immutable/entry/start.CqVn4hZK.js.gz +0 -0
  151. package/build/client/_app/immutable/nodes/0.BbGefPez.js.br +0 -0
  152. package/build/client/_app/immutable/nodes/0.BbGefPez.js.gz +0 -0
  153. package/build/client/_app/immutable/nodes/1.C3jvF6zj.js +0 -1
  154. package/build/client/_app/immutable/nodes/1.C3jvF6zj.js.br +0 -0
  155. package/build/client/_app/immutable/nodes/1.C3jvF6zj.js.gz +0 -0
  156. package/build/client/_app/immutable/nodes/2._Jmh03he.js.br +0 -0
  157. package/build/client/_app/immutable/nodes/2._Jmh03he.js.gz +0 -0
  158. package/build/client/_app/immutable/nodes/3.C1G23fTe.js +0 -1
  159. package/build/client/_app/immutable/nodes/3.C1G23fTe.js.br +0 -0
  160. package/build/client/_app/immutable/nodes/3.C1G23fTe.js.gz +0 -0
  161. package/build/client/_app/immutable/nodes/4.TQjMBeyV.js +0 -1
  162. package/build/client/_app/immutable/nodes/4.TQjMBeyV.js.br +0 -0
  163. package/build/client/_app/immutable/nodes/4.TQjMBeyV.js.gz +0 -0
  164. package/build/client/_app/immutable/nodes/5.SHyxFZfo.js +0 -1
  165. package/build/client/_app/immutable/nodes/5.SHyxFZfo.js.br +0 -0
  166. package/build/client/_app/immutable/nodes/5.SHyxFZfo.js.gz +0 -0
  167. package/build/client/_app/immutable/nodes/6.ikul5Bcl.js +0 -1
  168. package/build/client/_app/immutable/nodes/6.ikul5Bcl.js.br +0 -0
  169. package/build/client/_app/immutable/nodes/6.ikul5Bcl.js.gz +0 -0
  170. package/build/server/chunks/1-DffE3_iJ.js +0 -9
  171. package/build/server/chunks/3-D6wMMS06.js +0 -9
  172. package/build/server/chunks/3-D6wMMS06.js.map +0 -1
  173. package/build/server/chunks/4-BIBXJVxM.js +0 -9
  174. package/build/server/chunks/4-BIBXJVxM.js.map +0 -1
  175. package/build/server/chunks/5-DnTszr4V.js +0 -9
  176. package/build/server/chunks/5-DnTszr4V.js.map +0 -1
  177. package/build/server/chunks/6-Ls1UJLAz.js +0 -9
  178. package/build/server/chunks/6-Ls1UJLAz.js.map +0 -1
  179. package/build/server/chunks/Logout-CkwmxNTt.js.map +0 -1
  180. package/build/server/chunks/_page.svelte-CVJoQAAB.js.map +0 -1
  181. package/build/server/chunks/_page.svelte-D3kXcWlK.js.map +0 -1
  182. package/build/server/chunks/_page.svelte-DPdvFuWg.js +0 -12
  183. package/build/server/chunks/_page.svelte-whmO3TtB.js.map +0 -1
  184. package/build/server/chunks/client-C5BesWYV.js +0 -33
  185. package/build/server/chunks/client-C5BesWYV.js.map +0 -1
  186. package/build/server/chunks/error.svelte-Crm_85Km.js +0 -24
  187. package/build/server/chunks/error.svelte-Crm_85Km.js.map +0 -1
  188. package/build/server/chunks/exports-DeY8o0ws.js.map +0 -1
  189. package/build/server/chunks/hooks.server-DmgUjoZV.js +0 -17
  190. package/build/server/chunks/hooks.server-DmgUjoZV.js.map +0 -1
  191. package/build/server/chunks/user-DW-tjDe0.js.map +0 -1
@@ -1,595 +1,3 @@
1
- import { T as push, a9 as copy_payload, aa as assign_payload, aj as bind_props, W as pop, ak as spread_props, ai as spread_attributes, al as attr_class, a7 as escape_html, am as clsx } from './exports-DeY8o0ws.js';
2
- import '@sveltejs/kit/internal';
3
- import './client-C5BesWYV.js';
4
-
5
- /**
6
- * Convert the given array buffer into a Base64URL-encoded string. Ideal for converting various
7
- * credential response ArrayBuffers to string for sending back to the server as JSON.
8
- *
9
- * Helper method to compliment `base64URLStringToBuffer`
10
- */
11
- function bufferToBase64URLString(buffer) {
12
- const bytes = new Uint8Array(buffer);
13
- let str = '';
14
- for (const charCode of bytes) {
15
- str += String.fromCharCode(charCode);
16
- }
17
- const base64String = btoa(str);
18
- return base64String.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
19
- }
20
-
21
- /**
22
- * Convert from a Base64URL-encoded string to an Array Buffer. Best used when converting a
23
- * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
24
- * excludeCredentials
25
- *
26
- * Helper method to compliment `bufferToBase64URLString`
27
- */
28
- function base64URLStringToBuffer(base64URLString) {
29
- // Convert from Base64URL to Base64
30
- const base64 = base64URLString.replace(/-/g, '+').replace(/_/g, '/');
31
- /**
32
- * Pad with '=' until it's a multiple of four
33
- * (4 - (85 % 4 = 1) = 3) % 4 = 3 padding
34
- * (4 - (86 % 4 = 2) = 2) % 4 = 2 padding
35
- * (4 - (87 % 4 = 3) = 1) % 4 = 1 padding
36
- * (4 - (88 % 4 = 0) = 4) % 4 = 0 padding
37
- */
38
- const padLength = (4 - (base64.length % 4)) % 4;
39
- const padded = base64.padEnd(base64.length + padLength, '=');
40
- // Convert to a binary string
41
- const binary = atob(padded);
42
- // Convert binary string to buffer
43
- const buffer = new ArrayBuffer(binary.length);
44
- const bytes = new Uint8Array(buffer);
45
- for (let i = 0; i < binary.length; i++) {
46
- bytes[i] = binary.charCodeAt(i);
47
- }
48
- return buffer;
49
- }
50
-
51
- /**
52
- * Determine if the browser is capable of Webauthn
53
- */
54
- function browserSupportsWebAuthn() {
55
- return _browserSupportsWebAuthnInternals.stubThis(globalThis?.PublicKeyCredential !== undefined &&
56
- typeof globalThis.PublicKeyCredential === 'function');
57
- }
58
- /**
59
- * Make it possible to stub the return value during testing
60
- * @ignore Don't include this in docs output
61
- */
62
- const _browserSupportsWebAuthnInternals = {
63
- stubThis: (value) => value,
64
- };
65
-
66
- function toPublicKeyCredentialDescriptor(descriptor) {
67
- const { id } = descriptor;
68
- return {
69
- ...descriptor,
70
- id: base64URLStringToBuffer(id),
71
- /**
72
- * `descriptor.transports` is an array of our `AuthenticatorTransportFuture` that includes newer
73
- * transports that TypeScript's DOM lib is ignorant of. Convince TS that our list of transports
74
- * are fine to pass to WebAuthn since browsers will recognize the new value.
75
- */
76
- transports: descriptor.transports,
77
- };
78
- }
79
-
80
- /**
81
- * A simple test to determine if a hostname is a properly-formatted domain name
82
- *
83
- * A "valid domain" is defined here: https://url.spec.whatwg.org/#valid-domain
84
- *
85
- * Regex sourced from here:
86
- * https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html
87
- */
88
- function isValidDomain(hostname) {
89
- return (
90
- // Consider localhost valid as well since it's okay wrt Secure Contexts
91
- hostname === 'localhost' ||
92
- /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(hostname));
93
- }
94
-
95
- /**
96
- * A custom Error used to return a more nuanced error detailing _why_ one of the eight documented
97
- * errors in the spec was raised after calling `navigator.credentials.create()` or
98
- * `navigator.credentials.get()`:
99
- *
100
- * - `AbortError`
101
- * - `ConstraintError`
102
- * - `InvalidStateError`
103
- * - `NotAllowedError`
104
- * - `NotSupportedError`
105
- * - `SecurityError`
106
- * - `TypeError`
107
- * - `UnknownError`
108
- *
109
- * Error messages were determined through investigation of the spec to determine under which
110
- * scenarios a given error would be raised.
111
- */
112
- class WebAuthnError extends Error {
113
- constructor({ message, code, cause, name, }) {
114
- // @ts-ignore: help Rollup understand that `cause` is okay to set
115
- super(message, { cause });
116
- Object.defineProperty(this, "code", {
117
- enumerable: true,
118
- configurable: true,
119
- writable: true,
120
- value: void 0
121
- });
122
- this.name = name ?? cause.name;
123
- this.code = code;
124
- }
125
- }
126
-
127
- /**
128
- * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.create()`
129
- */
130
- function identifyRegistrationError({ error, options, }) {
131
- const { publicKey } = options;
132
- if (!publicKey) {
133
- throw Error('options was missing required publicKey property');
134
- }
135
- if (error.name === 'AbortError') {
136
- if (options.signal instanceof AbortSignal) {
137
- // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)
138
- return new WebAuthnError({
139
- message: 'Registration ceremony was sent an abort signal',
140
- code: 'ERROR_CEREMONY_ABORTED',
141
- cause: error,
142
- });
143
- }
144
- }
145
- else if (error.name === 'ConstraintError') {
146
- if (publicKey.authenticatorSelection?.requireResidentKey === true) {
147
- // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 4)
148
- return new WebAuthnError({
149
- message: 'Discoverable credentials were required but no available authenticator supported it',
150
- code: 'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',
151
- cause: error,
152
- });
153
- }
154
- else if (
155
- // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
156
- options.mediation === 'conditional' &&
157
- publicKey.authenticatorSelection?.userVerification === 'required') {
158
- // https://w3c.github.io/webauthn/#sctn-createCredential (Step 22.4)
159
- return new WebAuthnError({
160
- message: 'User verification was required during automatic registration but it could not be performed',
161
- code: 'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',
162
- cause: error,
163
- });
164
- }
165
- else if (publicKey.authenticatorSelection?.userVerification === 'required') {
166
- // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 5)
167
- return new WebAuthnError({
168
- message: 'User verification was required but no available authenticator supported it',
169
- code: 'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',
170
- cause: error,
171
- });
172
- }
173
- }
174
- else if (error.name === 'InvalidStateError') {
175
- // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 20)
176
- // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 3)
177
- return new WebAuthnError({
178
- message: 'The authenticator was previously registered',
179
- code: 'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',
180
- cause: error,
181
- });
182
- }
183
- else if (error.name === 'NotAllowedError') {
184
- /**
185
- * Pass the error directly through. Platforms are overloading this error beyond what the spec
186
- * defines and we don't want to overwrite potentially useful error messages.
187
- */
188
- return new WebAuthnError({
189
- message: error.message,
190
- code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',
191
- cause: error,
192
- });
193
- }
194
- else if (error.name === 'NotSupportedError') {
195
- const validPubKeyCredParams = publicKey.pubKeyCredParams.filter((param) => param.type === 'public-key');
196
- if (validPubKeyCredParams.length === 0) {
197
- // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 10)
198
- return new WebAuthnError({
199
- message: 'No entry in pubKeyCredParams was of type "public-key"',
200
- code: 'ERROR_MALFORMED_PUBKEYCREDPARAMS',
201
- cause: error,
202
- });
203
- }
204
- // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 2)
205
- return new WebAuthnError({
206
- message: 'No available authenticator supported any of the specified pubKeyCredParams algorithms',
207
- code: 'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',
208
- cause: error,
209
- });
210
- }
211
- else if (error.name === 'SecurityError') {
212
- const effectiveDomain = globalThis.location.hostname;
213
- if (!isValidDomain(effectiveDomain)) {
214
- // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 7)
215
- return new WebAuthnError({
216
- message: `${globalThis.location.hostname} is an invalid domain`,
217
- code: 'ERROR_INVALID_DOMAIN',
218
- cause: error,
219
- });
220
- }
221
- else if (publicKey.rp.id !== effectiveDomain) {
222
- // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 8)
223
- return new WebAuthnError({
224
- message: `The RP ID "${publicKey.rp.id}" is invalid for this domain`,
225
- code: 'ERROR_INVALID_RP_ID',
226
- cause: error,
227
- });
228
- }
229
- }
230
- else if (error.name === 'TypeError') {
231
- if (publicKey.user.id.byteLength < 1 || publicKey.user.id.byteLength > 64) {
232
- // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 5)
233
- return new WebAuthnError({
234
- message: 'User ID was not between 1 and 64 characters',
235
- code: 'ERROR_INVALID_USER_ID_LENGTH',
236
- cause: error,
237
- });
238
- }
239
- }
240
- else if (error.name === 'UnknownError') {
241
- // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 1)
242
- // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 8)
243
- return new WebAuthnError({
244
- message: 'The authenticator was unable to process the specified options, or could not create a new credential',
245
- code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',
246
- cause: error,
247
- });
248
- }
249
- return error;
250
- }
251
-
252
- class BaseWebAuthnAbortService {
253
- constructor() {
254
- Object.defineProperty(this, "controller", {
255
- enumerable: true,
256
- configurable: true,
257
- writable: true,
258
- value: void 0
259
- });
260
- }
261
- createNewAbortSignal() {
262
- // Abort any existing calls to navigator.credentials.create() or navigator.credentials.get()
263
- if (this.controller) {
264
- const abortError = new Error('Cancelling existing WebAuthn API call for new one');
265
- abortError.name = 'AbortError';
266
- this.controller.abort(abortError);
267
- }
268
- const newController = new AbortController();
269
- this.controller = newController;
270
- return newController.signal;
271
- }
272
- cancelCeremony() {
273
- if (this.controller) {
274
- const abortError = new Error('Manually cancelling existing WebAuthn API call');
275
- abortError.name = 'AbortError';
276
- this.controller.abort(abortError);
277
- this.controller = undefined;
278
- }
279
- }
280
- }
281
- /**
282
- * A service singleton to help ensure that only a single WebAuthn ceremony is active at a time.
283
- *
284
- * Users of **@simplewebauthn/browser** shouldn't typically need to use this, but it can help e.g.
285
- * developers building projects that use client-side routing to better control the behavior of
286
- * their UX in response to router navigation events.
287
- */
288
- const WebAuthnAbortService = new BaseWebAuthnAbortService();
289
-
290
- const attachments = ['cross-platform', 'platform'];
291
- /**
292
- * If possible coerce a `string` value into a known `AuthenticatorAttachment`
293
- */
294
- function toAuthenticatorAttachment(attachment) {
295
- if (!attachment) {
296
- return;
297
- }
298
- if (attachments.indexOf(attachment) < 0) {
299
- return;
300
- }
301
- return attachment;
302
- }
303
-
304
- /**
305
- * Begin authenticator "registration" via WebAuthn attestation
306
- *
307
- * @param optionsJSON Output from **@simplewebauthn/server**'s `generateRegistrationOptions()`
308
- * @param useAutoRegister (Optional) Try to silently create a passkey with the password manager that the user just signed in with. Defaults to `false`.
309
- */
310
- async function startRegistration(options) {
311
- // @ts-ignore: Intentionally check for old call structure to warn about improper API call
312
- if (!options.optionsJSON && options.challenge) {
313
- console.warn('startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.');
314
- // @ts-ignore: Reassign the options, passed in as a positional argument, to the expected variable
315
- options = { optionsJSON: options };
316
- }
317
- const { optionsJSON, useAutoRegister = false } = options;
318
- if (!browserSupportsWebAuthn()) {
319
- throw new Error('WebAuthn is not supported in this browser');
320
- }
321
- // We need to convert some values to Uint8Arrays before passing the credentials to the navigator
322
- const publicKey = {
323
- ...optionsJSON,
324
- challenge: base64URLStringToBuffer(optionsJSON.challenge),
325
- user: {
326
- ...optionsJSON.user,
327
- id: base64URLStringToBuffer(optionsJSON.user.id),
328
- },
329
- excludeCredentials: optionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor),
330
- };
331
- // Prepare options for `.create()`
332
- const createOptions = {};
333
- /**
334
- * Try to use conditional create to register a passkey for the user with the password manager
335
- * the user just used to authenticate with. The user won't be shown any prominent UI by the
336
- * browser.
337
- */
338
- if (useAutoRegister) {
339
- // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024
340
- createOptions.mediation = 'conditional';
341
- }
342
- // Finalize options
343
- createOptions.publicKey = publicKey;
344
- // Set up the ability to cancel this request if the user attempts another
345
- createOptions.signal = WebAuthnAbortService.createNewAbortSignal();
346
- // Wait for the user to complete attestation
347
- let credential;
348
- try {
349
- credential = (await navigator.credentials.create(createOptions));
350
- }
351
- catch (err) {
352
- throw identifyRegistrationError({ error: err, options: createOptions });
353
- }
354
- if (!credential) {
355
- throw new Error('Registration was not completed');
356
- }
357
- const { id, rawId, response, type } = credential;
358
- // Continue to play it safe with `getTransports()` for now, even when L3 types say it's required
359
- let transports = undefined;
360
- if (typeof response.getTransports === 'function') {
361
- transports = response.getTransports();
362
- }
363
- // L3 says this is required, but browser and webview support are still not guaranteed.
364
- let responsePublicKeyAlgorithm = undefined;
365
- if (typeof response.getPublicKeyAlgorithm === 'function') {
366
- try {
367
- responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();
368
- }
369
- catch (error) {
370
- warnOnBrokenImplementation('getPublicKeyAlgorithm()', error);
371
- }
372
- }
373
- let responsePublicKey = undefined;
374
- if (typeof response.getPublicKey === 'function') {
375
- try {
376
- const _publicKey = response.getPublicKey();
377
- if (_publicKey !== null) {
378
- responsePublicKey = bufferToBase64URLString(_publicKey);
379
- }
380
- }
381
- catch (error) {
382
- warnOnBrokenImplementation('getPublicKey()', error);
383
- }
384
- }
385
- // L3 says this is required, but browser and webview support are still not guaranteed.
386
- let responseAuthenticatorData;
387
- if (typeof response.getAuthenticatorData === 'function') {
388
- try {
389
- responseAuthenticatorData = bufferToBase64URLString(response.getAuthenticatorData());
390
- }
391
- catch (error) {
392
- warnOnBrokenImplementation('getAuthenticatorData()', error);
393
- }
394
- }
395
- return {
396
- id,
397
- rawId: bufferToBase64URLString(rawId),
398
- response: {
399
- attestationObject: bufferToBase64URLString(response.attestationObject),
400
- clientDataJSON: bufferToBase64URLString(response.clientDataJSON),
401
- transports,
402
- publicKeyAlgorithm: responsePublicKeyAlgorithm,
403
- publicKey: responsePublicKey,
404
- authenticatorData: responseAuthenticatorData,
405
- },
406
- type,
407
- clientExtensionResults: credential.getClientExtensionResults(),
408
- authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),
409
- };
410
- }
411
- /**
412
- * Visibly warn when we detect an issue related to a passkey provider intercepting WebAuthn API
413
- * calls
414
- */
415
- function warnOnBrokenImplementation(methodName, cause) {
416
- console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.\n`, cause);
417
- }
418
-
419
- /**
420
- * Determine if the browser supports conditional UI, so that WebAuthn credentials can
421
- * be shown to the user in the browser's typical password autofill popup.
422
- */
423
- function browserSupportsWebAuthnAutofill() {
424
- if (!browserSupportsWebAuthn()) {
425
- return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));
426
- }
427
- /**
428
- * I don't like the `as unknown` here but there's a `declare var PublicKeyCredential` in
429
- * TS' DOM lib that's making it difficult for me to just go `as PublicKeyCredentialFuture` as I
430
- * want. I think I'm fine with this for now since it's _supposed_ to be temporary, until TS types
431
- * have a chance to catch up.
432
- */
433
- const globalPublicKeyCredential = globalThis
434
- .PublicKeyCredential;
435
- if (globalPublicKeyCredential?.isConditionalMediationAvailable === undefined) {
436
- return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));
437
- }
438
- return _browserSupportsWebAuthnAutofillInternals.stubThis(globalPublicKeyCredential.isConditionalMediationAvailable());
439
- }
440
- // Make it possible to stub the return value during testing
441
- const _browserSupportsWebAuthnAutofillInternals = {
442
- stubThis: (value) => value,
443
- };
444
-
445
- /**
446
- * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.get()`
447
- */
448
- function identifyAuthenticationError({ error, options, }) {
449
- const { publicKey } = options;
450
- if (!publicKey) {
451
- throw Error('options was missing required publicKey property');
452
- }
453
- if (error.name === 'AbortError') {
454
- if (options.signal instanceof AbortSignal) {
455
- // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)
456
- return new WebAuthnError({
457
- message: 'Authentication ceremony was sent an abort signal',
458
- code: 'ERROR_CEREMONY_ABORTED',
459
- cause: error,
460
- });
461
- }
462
- }
463
- else if (error.name === 'NotAllowedError') {
464
- /**
465
- * Pass the error directly through. Platforms are overloading this error beyond what the spec
466
- * defines and we don't want to overwrite potentially useful error messages.
467
- */
468
- return new WebAuthnError({
469
- message: error.message,
470
- code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',
471
- cause: error,
472
- });
473
- }
474
- else if (error.name === 'SecurityError') {
475
- const effectiveDomain = globalThis.location.hostname;
476
- if (!isValidDomain(effectiveDomain)) {
477
- // https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 5)
478
- return new WebAuthnError({
479
- message: `${globalThis.location.hostname} is an invalid domain`,
480
- code: 'ERROR_INVALID_DOMAIN',
481
- cause: error,
482
- });
483
- }
484
- else if (publicKey.rpId !== effectiveDomain) {
485
- // https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 6)
486
- return new WebAuthnError({
487
- message: `The RP ID "${publicKey.rpId}" is invalid for this domain`,
488
- code: 'ERROR_INVALID_RP_ID',
489
- cause: error,
490
- });
491
- }
492
- }
493
- else if (error.name === 'UnknownError') {
494
- // https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 1)
495
- // https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 12)
496
- return new WebAuthnError({
497
- message: 'The authenticator was unable to process the specified options, or could not create a new assertion signature',
498
- code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',
499
- cause: error,
500
- });
501
- }
502
- return error;
503
- }
504
-
505
- /**
506
- * Begin authenticator "login" via WebAuthn assertion
507
- *
508
- * @param optionsJSON Output from **@simplewebauthn/server**'s `generateAuthenticationOptions()`
509
- * @param useBrowserAutofill (Optional) Initialize conditional UI to enable logging in via browser autofill prompts. Defaults to `false`.
510
- * @param verifyBrowserAutofillInput (Optional) Ensure a suitable `<input>` element is present when `useBrowserAutofill` is `true`. Defaults to `true`.
511
- */
512
- async function startAuthentication(options) {
513
- // @ts-ignore: Intentionally check for old call structure to warn about improper API call
514
- if (!options.optionsJSON && options.challenge) {
515
- console.warn('startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.');
516
- // @ts-ignore: Reassign the options, passed in as a positional argument, to the expected variable
517
- options = { optionsJSON: options };
518
- }
519
- const { optionsJSON, useBrowserAutofill = false, verifyBrowserAutofillInput = true, } = options;
520
- if (!browserSupportsWebAuthn()) {
521
- throw new Error('WebAuthn is not supported in this browser');
522
- }
523
- // We need to avoid passing empty array to avoid blocking retrieval
524
- // of public key
525
- let allowCredentials;
526
- if (optionsJSON.allowCredentials?.length !== 0) {
527
- allowCredentials = optionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor);
528
- }
529
- // We need to convert some values to Uint8Arrays before passing the credentials to the navigator
530
- const publicKey = {
531
- ...optionsJSON,
532
- challenge: base64URLStringToBuffer(optionsJSON.challenge),
533
- allowCredentials,
534
- };
535
- // Prepare options for `.get()`
536
- const getOptions = {};
537
- /**
538
- * Set up the page to prompt the user to select a credential for authentication via the browser's
539
- * input autofill mechanism.
540
- */
541
- if (useBrowserAutofill) {
542
- if (!(await browserSupportsWebAuthnAutofill())) {
543
- throw Error('Browser does not support WebAuthn autofill');
544
- }
545
- // Check for an <input> with "webauthn" in its `autocomplete` attribute
546
- const eligibleInputs = document.querySelectorAll("input[autocomplete$='webauthn']");
547
- // WebAuthn autofill requires at least one valid input
548
- if (eligibleInputs.length < 1 && verifyBrowserAutofillInput) {
549
- throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
550
- }
551
- // `CredentialMediationRequirement` doesn't know about "conditional" yet as of
552
- // typescript@4.6.3
553
- getOptions.mediation = 'conditional';
554
- // Conditional UI requires an empty allow list
555
- publicKey.allowCredentials = [];
556
- }
557
- // Finalize options
558
- getOptions.publicKey = publicKey;
559
- // Set up the ability to cancel this request if the user attempts another
560
- getOptions.signal = WebAuthnAbortService.createNewAbortSignal();
561
- // Wait for the user to complete assertion
562
- let credential;
563
- try {
564
- credential = (await navigator.credentials.get(getOptions));
565
- }
566
- catch (err) {
567
- throw identifyAuthenticationError({ error: err, options: getOptions });
568
- }
569
- if (!credential) {
570
- throw new Error('Authentication was not completed');
571
- }
572
- const { id, rawId, response, type } = credential;
573
- let userHandle = undefined;
574
- if (response.userHandle) {
575
- userHandle = bufferToBase64URLString(response.userHandle);
576
- }
577
- // Convert values to base64 to make it easier to send back to the server
578
- return {
579
- id,
580
- rawId: bufferToBase64URLString(rawId),
581
- response: {
582
- authenticatorData: bufferToBase64URLString(response.authenticatorData),
583
- clientDataJSON: bufferToBase64URLString(response.clientDataJSON),
584
- signature: bufferToBase64URLString(response.signature),
585
- userHandle,
586
- },
587
- type,
588
- clientExtensionResults: credential.getClientExtensionResults(),
589
- authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),
590
- };
591
- }
592
-
593
1
  /** A special constant with type `never` */
594
2
  function $constructor(name, initializer, params) {
595
3
  function init(inst, def) {
@@ -1134,6 +542,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
1134
542
  }
1135
543
  return result.value;
1136
544
  };
545
+ const parse$1 = /* @__PURE__*/ _parse($ZodRealError);
1137
546
  const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
1138
547
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
1139
548
  let result = schema._zod.run({ value, issues: [] }, ctx);
@@ -1146,6 +555,7 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
1146
555
  }
1147
556
  return result.value;
1148
557
  };
558
+ const parseAsync$1 = /* @__PURE__*/ _parseAsync($ZodRealError);
1149
559
  const _safeParse = (_Err) => (schema, value, _ctx) => {
1150
560
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
1151
561
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -2596,6 +2006,80 @@ function handleIntersectionResults(result, left, right) {
2596
2006
  result.value = merged.data;
2597
2007
  return result;
2598
2008
  }
2009
+ const $ZodTuple = /*@__PURE__*/ $constructor("$ZodTuple", (inst, def) => {
2010
+ $ZodType.init(inst, def);
2011
+ const items = def.items;
2012
+ const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
2013
+ inst._zod.parse = (payload, ctx) => {
2014
+ const input = payload.value;
2015
+ if (!Array.isArray(input)) {
2016
+ payload.issues.push({
2017
+ input,
2018
+ inst,
2019
+ expected: "tuple",
2020
+ code: "invalid_type",
2021
+ });
2022
+ return payload;
2023
+ }
2024
+ payload.value = [];
2025
+ const proms = [];
2026
+ if (!def.rest) {
2027
+ const tooBig = input.length > items.length;
2028
+ const tooSmall = input.length < optStart - 1;
2029
+ if (tooBig || tooSmall) {
2030
+ payload.issues.push({
2031
+ input,
2032
+ inst,
2033
+ origin: "array",
2034
+ ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
2035
+ });
2036
+ return payload;
2037
+ }
2038
+ }
2039
+ let i = -1;
2040
+ for (const item of items) {
2041
+ i++;
2042
+ if (i >= input.length)
2043
+ if (i >= optStart)
2044
+ continue;
2045
+ const result = item._zod.run({
2046
+ value: input[i],
2047
+ issues: [],
2048
+ }, ctx);
2049
+ if (result instanceof Promise) {
2050
+ proms.push(result.then((result) => handleTupleResult(result, payload, i)));
2051
+ }
2052
+ else {
2053
+ handleTupleResult(result, payload, i);
2054
+ }
2055
+ }
2056
+ if (def.rest) {
2057
+ const rest = input.slice(items.length);
2058
+ for (const el of rest) {
2059
+ i++;
2060
+ const result = def.rest._zod.run({
2061
+ value: el,
2062
+ issues: [],
2063
+ }, ctx);
2064
+ if (result instanceof Promise) {
2065
+ proms.push(result.then((result) => handleTupleResult(result, payload, i)));
2066
+ }
2067
+ else {
2068
+ handleTupleResult(result, payload, i);
2069
+ }
2070
+ }
2071
+ }
2072
+ if (proms.length)
2073
+ return Promise.all(proms).then(() => payload);
2074
+ return payload;
2075
+ };
2076
+ });
2077
+ function handleTupleResult(result, final, index) {
2078
+ if (result.issues.length) {
2079
+ final.issues.push(...prefixIssues(index, result.issues));
2080
+ }
2081
+ final.value[index] = result.value;
2082
+ }
2599
2083
  const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
2600
2084
  $ZodType.init(inst, def);
2601
2085
  inst._zod.parse = (payload, ctx) => {
@@ -3435,6 +2919,33 @@ function _array(Class, element, params) {
3435
2919
  ...normalizeParams(params),
3436
2920
  });
3437
2921
  }
2922
+ // export function _tuple(
2923
+ // Class: util.SchemaClass<schemas.$ZodTuple>,
2924
+ // items: [],
2925
+ // params?: string | $ZodTupleParams
2926
+ // ): schemas.$ZodTuple<[], null>;
2927
+ function _tuple(Class, items, _paramsOrRest, _params) {
2928
+ const hasRest = _paramsOrRest instanceof $ZodType;
2929
+ const params = hasRest ? _params : _paramsOrRest;
2930
+ const rest = hasRest ? _paramsOrRest : null;
2931
+ return new Class({
2932
+ type: "tuple",
2933
+ items,
2934
+ rest,
2935
+ ...normalizeParams(params),
2936
+ });
2937
+ }
2938
+ function _custom(Class, fn, _params) {
2939
+ const norm = normalizeParams(_params);
2940
+ norm.abort ?? (norm.abort = true); // default to abort:false
2941
+ const schema = new Class({
2942
+ type: "custom",
2943
+ check: "custom",
2944
+ fn: fn,
2945
+ ...norm,
2946
+ });
2947
+ return schema;
2948
+ }
3438
2949
  // export function _refine<T>(
3439
2950
  // Class: util.SchemaClass<schemas.$ZodCustom>,
3440
2951
  // fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
@@ -3886,6 +3397,18 @@ function object(shape, params) {
3886
3397
  };
3887
3398
  return new ZodObject(def);
3888
3399
  }
3400
+ // looseObject
3401
+ function looseObject(shape, params) {
3402
+ return new ZodObject({
3403
+ type: "object",
3404
+ get shape() {
3405
+ assignProp(this, "shape", { ...shape });
3406
+ return this.shape;
3407
+ },
3408
+ catchall: unknown(),
3409
+ ...normalizeParams(params),
3410
+ });
3411
+ }
3889
3412
  const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
3890
3413
  $ZodUnion.init(inst, def);
3891
3414
  ZodType.init(inst, def);
@@ -3923,6 +3446,15 @@ function record(keyType, valueType, params) {
3923
3446
  ...normalizeParams(params),
3924
3447
  });
3925
3448
  }
3449
+ // type alksjf = core.output<core.$ZodRecordKey>;
3450
+ function partialRecord(keyType, valueType, params) {
3451
+ return new ZodRecord({
3452
+ type: "record",
3453
+ keyType: union([keyType, never()]),
3454
+ valueType: valueType,
3455
+ ...normalizeParams(params),
3456
+ });
3457
+ }
3926
3458
  const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
3927
3459
  $ZodEnum.init(inst, def);
3928
3460
  ZodType.init(inst, def);
@@ -4140,6 +3672,9 @@ function check(fn) {
4140
3672
  ch._zod.check = fn;
4141
3673
  return ch;
4142
3674
  }
3675
+ function custom(fn, _params) {
3676
+ return _custom(ZodCustom, fn ?? (() => true), _params);
3677
+ }
4143
3678
  function refine(fn, _params = {}) {
4144
3679
  return _refine(ZodCustom, fn, _params);
4145
3680
  }
@@ -4167,1490 +3702,5 @@ function superRefine(fn) {
4167
3702
  return ch;
4168
3703
  }
4169
3704
 
4170
- const types$1 = {
4171
- 'application/prs.cww': ['cww'],
4172
- 'application/prs.xsf+xml': ['xsf'],
4173
- 'application/vnd.1000minds.decision-model+xml': ['1km'],
4174
- 'application/vnd.3gpp.pic-bw-large': ['plb'],
4175
- 'application/vnd.3gpp.pic-bw-small': ['psb'],
4176
- 'application/vnd.3gpp.pic-bw-var': ['pvb'],
4177
- 'application/vnd.3gpp2.tcap': ['tcap'],
4178
- 'application/vnd.3m.post-it-notes': ['pwn'],
4179
- 'application/vnd.accpac.simply.aso': ['aso'],
4180
- 'application/vnd.accpac.simply.imp': ['imp'],
4181
- 'application/vnd.acucobol': ['acu'],
4182
- 'application/vnd.acucorp': ['atc', 'acutc'],
4183
- 'application/vnd.adobe.air-application-installer-package+zip': ['air'],
4184
- 'application/vnd.adobe.formscentral.fcdt': ['fcdt'],
4185
- 'application/vnd.adobe.fxp': ['fxp', 'fxpl'],
4186
- 'application/vnd.adobe.xdp+xml': ['xdp'],
4187
- 'application/vnd.adobe.xfdf': ['*xfdf'],
4188
- 'application/vnd.age': ['age'],
4189
- 'application/vnd.ahead.space': ['ahead'],
4190
- 'application/vnd.airzip.filesecure.azf': ['azf'],
4191
- 'application/vnd.airzip.filesecure.azs': ['azs'],
4192
- 'application/vnd.amazon.ebook': ['azw'],
4193
- 'application/vnd.americandynamics.acc': ['acc'],
4194
- 'application/vnd.amiga.ami': ['ami'],
4195
- 'application/vnd.android.package-archive': ['apk'],
4196
- 'application/vnd.anser-web-certificate-issue-initiation': ['cii'],
4197
- 'application/vnd.anser-web-funds-transfer-initiation': ['fti'],
4198
- 'application/vnd.antix.game-component': ['atx'],
4199
- 'application/vnd.apple.installer+xml': ['mpkg'],
4200
- 'application/vnd.apple.keynote': ['key'],
4201
- 'application/vnd.apple.mpegurl': ['m3u8'],
4202
- 'application/vnd.apple.numbers': ['numbers'],
4203
- 'application/vnd.apple.pages': ['pages'],
4204
- 'application/vnd.apple.pkpass': ['pkpass'],
4205
- 'application/vnd.aristanetworks.swi': ['swi'],
4206
- 'application/vnd.astraea-software.iota': ['iota'],
4207
- 'application/vnd.audiograph': ['aep'],
4208
- 'application/vnd.autodesk.fbx': ['fbx'],
4209
- 'application/vnd.balsamiq.bmml+xml': ['bmml'],
4210
- 'application/vnd.blueice.multipass': ['mpm'],
4211
- 'application/vnd.bmi': ['bmi'],
4212
- 'application/vnd.businessobjects': ['rep'],
4213
- 'application/vnd.chemdraw+xml': ['cdxml'],
4214
- 'application/vnd.chipnuts.karaoke-mmd': ['mmd'],
4215
- 'application/vnd.cinderella': ['cdy'],
4216
- 'application/vnd.citationstyles.style+xml': ['csl'],
4217
- 'application/vnd.claymore': ['cla'],
4218
- 'application/vnd.cloanto.rp9': ['rp9'],
4219
- 'application/vnd.clonk.c4group': ['c4g', 'c4d', 'c4f', 'c4p', 'c4u'],
4220
- 'application/vnd.cluetrust.cartomobile-config': ['c11amc'],
4221
- 'application/vnd.cluetrust.cartomobile-config-pkg': ['c11amz'],
4222
- 'application/vnd.commonspace': ['csp'],
4223
- 'application/vnd.contact.cmsg': ['cdbcmsg'],
4224
- 'application/vnd.cosmocaller': ['cmc'],
4225
- 'application/vnd.crick.clicker': ['clkx'],
4226
- 'application/vnd.crick.clicker.keyboard': ['clkk'],
4227
- 'application/vnd.crick.clicker.palette': ['clkp'],
4228
- 'application/vnd.crick.clicker.template': ['clkt'],
4229
- 'application/vnd.crick.clicker.wordbank': ['clkw'],
4230
- 'application/vnd.criticaltools.wbs+xml': ['wbs'],
4231
- 'application/vnd.ctc-posml': ['pml'],
4232
- 'application/vnd.cups-ppd': ['ppd'],
4233
- 'application/vnd.curl.car': ['car'],
4234
- 'application/vnd.curl.pcurl': ['pcurl'],
4235
- 'application/vnd.dart': ['dart'],
4236
- 'application/vnd.data-vision.rdz': ['rdz'],
4237
- 'application/vnd.dbf': ['dbf'],
4238
- 'application/vnd.dcmp+xml': ['dcmp'],
4239
- 'application/vnd.dece.data': ['uvf', 'uvvf', 'uvd', 'uvvd'],
4240
- 'application/vnd.dece.ttml+xml': ['uvt', 'uvvt'],
4241
- 'application/vnd.dece.unspecified': ['uvx', 'uvvx'],
4242
- 'application/vnd.dece.zip': ['uvz', 'uvvz'],
4243
- 'application/vnd.denovo.fcselayout-link': ['fe_launch'],
4244
- 'application/vnd.dna': ['dna'],
4245
- 'application/vnd.dolby.mlp': ['mlp'],
4246
- 'application/vnd.dpgraph': ['dpg'],
4247
- 'application/vnd.dreamfactory': ['dfac'],
4248
- 'application/vnd.ds-keypoint': ['kpxx'],
4249
- 'application/vnd.dvb.ait': ['ait'],
4250
- 'application/vnd.dvb.service': ['svc'],
4251
- 'application/vnd.dynageo': ['geo'],
4252
- 'application/vnd.ecowin.chart': ['mag'],
4253
- 'application/vnd.enliven': ['nml'],
4254
- 'application/vnd.epson.esf': ['esf'],
4255
- 'application/vnd.epson.msf': ['msf'],
4256
- 'application/vnd.epson.quickanime': ['qam'],
4257
- 'application/vnd.epson.salt': ['slt'],
4258
- 'application/vnd.epson.ssf': ['ssf'],
4259
- 'application/vnd.eszigno3+xml': ['es3', 'et3'],
4260
- 'application/vnd.ezpix-album': ['ez2'],
4261
- 'application/vnd.ezpix-package': ['ez3'],
4262
- 'application/vnd.fdf': ['*fdf'],
4263
- 'application/vnd.fdsn.mseed': ['mseed'],
4264
- 'application/vnd.fdsn.seed': ['seed', 'dataless'],
4265
- 'application/vnd.flographit': ['gph'],
4266
- 'application/vnd.fluxtime.clip': ['ftc'],
4267
- 'application/vnd.framemaker': ['fm', 'frame', 'maker', 'book'],
4268
- 'application/vnd.frogans.fnc': ['fnc'],
4269
- 'application/vnd.frogans.ltf': ['ltf'],
4270
- 'application/vnd.fsc.weblaunch': ['fsc'],
4271
- 'application/vnd.fujitsu.oasys': ['oas'],
4272
- 'application/vnd.fujitsu.oasys2': ['oa2'],
4273
- 'application/vnd.fujitsu.oasys3': ['oa3'],
4274
- 'application/vnd.fujitsu.oasysgp': ['fg5'],
4275
- 'application/vnd.fujitsu.oasysprs': ['bh2'],
4276
- 'application/vnd.fujixerox.ddd': ['ddd'],
4277
- 'application/vnd.fujixerox.docuworks': ['xdw'],
4278
- 'application/vnd.fujixerox.docuworks.binder': ['xbd'],
4279
- 'application/vnd.fuzzysheet': ['fzs'],
4280
- 'application/vnd.genomatix.tuxedo': ['txd'],
4281
- 'application/vnd.geogebra.file': ['ggb'],
4282
- 'application/vnd.geogebra.slides': ['ggs'],
4283
- 'application/vnd.geogebra.tool': ['ggt'],
4284
- 'application/vnd.geometry-explorer': ['gex', 'gre'],
4285
- 'application/vnd.geonext': ['gxt'],
4286
- 'application/vnd.geoplan': ['g2w'],
4287
- 'application/vnd.geospace': ['g3w'],
4288
- 'application/vnd.gmx': ['gmx'],
4289
- 'application/vnd.google-apps.document': ['gdoc'],
4290
- 'application/vnd.google-apps.drawing': ['gdraw'],
4291
- 'application/vnd.google-apps.form': ['gform'],
4292
- 'application/vnd.google-apps.jam': ['gjam'],
4293
- 'application/vnd.google-apps.map': ['gmap'],
4294
- 'application/vnd.google-apps.presentation': ['gslides'],
4295
- 'application/vnd.google-apps.script': ['gscript'],
4296
- 'application/vnd.google-apps.site': ['gsite'],
4297
- 'application/vnd.google-apps.spreadsheet': ['gsheet'],
4298
- 'application/vnd.google-earth.kml+xml': ['kml'],
4299
- 'application/vnd.google-earth.kmz': ['kmz'],
4300
- 'application/vnd.gov.sk.xmldatacontainer+xml': ['xdcf'],
4301
- 'application/vnd.grafeq': ['gqf', 'gqs'],
4302
- 'application/vnd.groove-account': ['gac'],
4303
- 'application/vnd.groove-help': ['ghf'],
4304
- 'application/vnd.groove-identity-message': ['gim'],
4305
- 'application/vnd.groove-injector': ['grv'],
4306
- 'application/vnd.groove-tool-message': ['gtm'],
4307
- 'application/vnd.groove-tool-template': ['tpl'],
4308
- 'application/vnd.groove-vcard': ['vcg'],
4309
- 'application/vnd.hal+xml': ['hal'],
4310
- 'application/vnd.handheld-entertainment+xml': ['zmm'],
4311
- 'application/vnd.hbci': ['hbci'],
4312
- 'application/vnd.hhe.lesson-player': ['les'],
4313
- 'application/vnd.hp-hpgl': ['hpgl'],
4314
- 'application/vnd.hp-hpid': ['hpid'],
4315
- 'application/vnd.hp-hps': ['hps'],
4316
- 'application/vnd.hp-jlyt': ['jlt'],
4317
- 'application/vnd.hp-pcl': ['pcl'],
4318
- 'application/vnd.hp-pclxl': ['pclxl'],
4319
- 'application/vnd.hydrostatix.sof-data': ['sfd-hdstx'],
4320
- 'application/vnd.ibm.minipay': ['mpy'],
4321
- 'application/vnd.ibm.modcap': ['afp', 'listafp', 'list3820'],
4322
- 'application/vnd.ibm.rights-management': ['irm'],
4323
- 'application/vnd.ibm.secure-container': ['sc'],
4324
- 'application/vnd.iccprofile': ['icc', 'icm'],
4325
- 'application/vnd.igloader': ['igl'],
4326
- 'application/vnd.immervision-ivp': ['ivp'],
4327
- 'application/vnd.immervision-ivu': ['ivu'],
4328
- 'application/vnd.insors.igm': ['igm'],
4329
- 'application/vnd.intercon.formnet': ['xpw', 'xpx'],
4330
- 'application/vnd.intergeo': ['i2g'],
4331
- 'application/vnd.intu.qbo': ['qbo'],
4332
- 'application/vnd.intu.qfx': ['qfx'],
4333
- 'application/vnd.ipunplugged.rcprofile': ['rcprofile'],
4334
- 'application/vnd.irepository.package+xml': ['irp'],
4335
- 'application/vnd.is-xpr': ['xpr'],
4336
- 'application/vnd.isac.fcs': ['fcs'],
4337
- 'application/vnd.jam': ['jam'],
4338
- 'application/vnd.jcp.javame.midlet-rms': ['rms'],
4339
- 'application/vnd.jisp': ['jisp'],
4340
- 'application/vnd.joost.joda-archive': ['joda'],
4341
- 'application/vnd.kahootz': ['ktz', 'ktr'],
4342
- 'application/vnd.kde.karbon': ['karbon'],
4343
- 'application/vnd.kde.kchart': ['chrt'],
4344
- 'application/vnd.kde.kformula': ['kfo'],
4345
- 'application/vnd.kde.kivio': ['flw'],
4346
- 'application/vnd.kde.kontour': ['kon'],
4347
- 'application/vnd.kde.kpresenter': ['kpr', 'kpt'],
4348
- 'application/vnd.kde.kspread': ['ksp'],
4349
- 'application/vnd.kde.kword': ['kwd', 'kwt'],
4350
- 'application/vnd.kenameaapp': ['htke'],
4351
- 'application/vnd.kidspiration': ['kia'],
4352
- 'application/vnd.kinar': ['kne', 'knp'],
4353
- 'application/vnd.koan': ['skp', 'skd', 'skt', 'skm'],
4354
- 'application/vnd.kodak-descriptor': ['sse'],
4355
- 'application/vnd.las.las+xml': ['lasxml'],
4356
- 'application/vnd.llamagraphics.life-balance.desktop': ['lbd'],
4357
- 'application/vnd.llamagraphics.life-balance.exchange+xml': ['lbe'],
4358
- 'application/vnd.lotus-1-2-3': ['123'],
4359
- 'application/vnd.lotus-approach': ['apr'],
4360
- 'application/vnd.lotus-freelance': ['pre'],
4361
- 'application/vnd.lotus-notes': ['nsf'],
4362
- 'application/vnd.lotus-organizer': ['org'],
4363
- 'application/vnd.lotus-screencam': ['scm'],
4364
- 'application/vnd.lotus-wordpro': ['lwp'],
4365
- 'application/vnd.macports.portpkg': ['portpkg'],
4366
- 'application/vnd.mapbox-vector-tile': ['mvt'],
4367
- 'application/vnd.mcd': ['mcd'],
4368
- 'application/vnd.medcalcdata': ['mc1'],
4369
- 'application/vnd.mediastation.cdkey': ['cdkey'],
4370
- 'application/vnd.mfer': ['mwf'],
4371
- 'application/vnd.mfmp': ['mfm'],
4372
- 'application/vnd.micrografx.flo': ['flo'],
4373
- 'application/vnd.micrografx.igx': ['igx'],
4374
- 'application/vnd.mif': ['mif'],
4375
- 'application/vnd.mobius.daf': ['daf'],
4376
- 'application/vnd.mobius.dis': ['dis'],
4377
- 'application/vnd.mobius.mbk': ['mbk'],
4378
- 'application/vnd.mobius.mqy': ['mqy'],
4379
- 'application/vnd.mobius.msl': ['msl'],
4380
- 'application/vnd.mobius.plc': ['plc'],
4381
- 'application/vnd.mobius.txf': ['txf'],
4382
- 'application/vnd.mophun.application': ['mpn'],
4383
- 'application/vnd.mophun.certificate': ['mpc'],
4384
- 'application/vnd.mozilla.xul+xml': ['xul'],
4385
- 'application/vnd.ms-artgalry': ['cil'],
4386
- 'application/vnd.ms-cab-compressed': ['cab'],
4387
- 'application/vnd.ms-excel': ['xls', 'xlm', 'xla', 'xlc', 'xlt', 'xlw'],
4388
- 'application/vnd.ms-excel.addin.macroenabled.12': ['xlam'],
4389
- 'application/vnd.ms-excel.sheet.binary.macroenabled.12': ['xlsb'],
4390
- 'application/vnd.ms-excel.sheet.macroenabled.12': ['xlsm'],
4391
- 'application/vnd.ms-excel.template.macroenabled.12': ['xltm'],
4392
- 'application/vnd.ms-fontobject': ['eot'],
4393
- 'application/vnd.ms-htmlhelp': ['chm'],
4394
- 'application/vnd.ms-ims': ['ims'],
4395
- 'application/vnd.ms-lrm': ['lrm'],
4396
- 'application/vnd.ms-officetheme': ['thmx'],
4397
- 'application/vnd.ms-outlook': ['msg'],
4398
- 'application/vnd.ms-pki.seccat': ['cat'],
4399
- 'application/vnd.ms-pki.stl': ['*stl'],
4400
- 'application/vnd.ms-powerpoint': ['ppt', 'pps', 'pot'],
4401
- 'application/vnd.ms-powerpoint.addin.macroenabled.12': ['ppam'],
4402
- 'application/vnd.ms-powerpoint.presentation.macroenabled.12': ['pptm'],
4403
- 'application/vnd.ms-powerpoint.slide.macroenabled.12': ['sldm'],
4404
- 'application/vnd.ms-powerpoint.slideshow.macroenabled.12': ['ppsm'],
4405
- 'application/vnd.ms-powerpoint.template.macroenabled.12': ['potm'],
4406
- 'application/vnd.ms-project': ['*mpp', 'mpt'],
4407
- 'application/vnd.ms-visio.viewer': ['vdx'],
4408
- 'application/vnd.ms-word.document.macroenabled.12': ['docm'],
4409
- 'application/vnd.ms-word.template.macroenabled.12': ['dotm'],
4410
- 'application/vnd.ms-works': ['wps', 'wks', 'wcm', 'wdb'],
4411
- 'application/vnd.ms-wpl': ['wpl'],
4412
- 'application/vnd.ms-xpsdocument': ['xps'],
4413
- 'application/vnd.mseq': ['mseq'],
4414
- 'application/vnd.musician': ['mus'],
4415
- 'application/vnd.muvee.style': ['msty'],
4416
- 'application/vnd.mynfc': ['taglet'],
4417
- 'application/vnd.nato.bindingdataobject+xml': ['bdo'],
4418
- 'application/vnd.neurolanguage.nlu': ['nlu'],
4419
- 'application/vnd.nitf': ['ntf', 'nitf'],
4420
- 'application/vnd.noblenet-directory': ['nnd'],
4421
- 'application/vnd.noblenet-sealer': ['nns'],
4422
- 'application/vnd.noblenet-web': ['nnw'],
4423
- 'application/vnd.nokia.n-gage.ac+xml': ['*ac'],
4424
- 'application/vnd.nokia.n-gage.data': ['ngdat'],
4425
- 'application/vnd.nokia.n-gage.symbian.install': ['n-gage'],
4426
- 'application/vnd.nokia.radio-preset': ['rpst'],
4427
- 'application/vnd.nokia.radio-presets': ['rpss'],
4428
- 'application/vnd.novadigm.edm': ['edm'],
4429
- 'application/vnd.novadigm.edx': ['edx'],
4430
- 'application/vnd.novadigm.ext': ['ext'],
4431
- 'application/vnd.oasis.opendocument.chart': ['odc'],
4432
- 'application/vnd.oasis.opendocument.chart-template': ['otc'],
4433
- 'application/vnd.oasis.opendocument.database': ['odb'],
4434
- 'application/vnd.oasis.opendocument.formula': ['odf'],
4435
- 'application/vnd.oasis.opendocument.formula-template': ['odft'],
4436
- 'application/vnd.oasis.opendocument.graphics': ['odg'],
4437
- 'application/vnd.oasis.opendocument.graphics-template': ['otg'],
4438
- 'application/vnd.oasis.opendocument.image': ['odi'],
4439
- 'application/vnd.oasis.opendocument.image-template': ['oti'],
4440
- 'application/vnd.oasis.opendocument.presentation': ['odp'],
4441
- 'application/vnd.oasis.opendocument.presentation-template': ['otp'],
4442
- 'application/vnd.oasis.opendocument.spreadsheet': ['ods'],
4443
- 'application/vnd.oasis.opendocument.spreadsheet-template': ['ots'],
4444
- 'application/vnd.oasis.opendocument.text': ['odt'],
4445
- 'application/vnd.oasis.opendocument.text-master': ['odm'],
4446
- 'application/vnd.oasis.opendocument.text-template': ['ott'],
4447
- 'application/vnd.oasis.opendocument.text-web': ['oth'],
4448
- 'application/vnd.olpc-sugar': ['xo'],
4449
- 'application/vnd.oma.dd2+xml': ['dd2'],
4450
- 'application/vnd.openblox.game+xml': ['obgx'],
4451
- 'application/vnd.openofficeorg.extension': ['oxt'],
4452
- 'application/vnd.openstreetmap.data+xml': ['osm'],
4453
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation': [
4454
- 'pptx',
4455
- ],
4456
- 'application/vnd.openxmlformats-officedocument.presentationml.slide': [
4457
- 'sldx',
4458
- ],
4459
- 'application/vnd.openxmlformats-officedocument.presentationml.slideshow': [
4460
- 'ppsx',
4461
- ],
4462
- 'application/vnd.openxmlformats-officedocument.presentationml.template': [
4463
- 'potx',
4464
- ],
4465
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['xlsx'],
4466
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.template': [
4467
- 'xltx',
4468
- ],
4469
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [
4470
- 'docx',
4471
- ],
4472
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.template': [
4473
- 'dotx',
4474
- ],
4475
- 'application/vnd.osgeo.mapguide.package': ['mgp'],
4476
- 'application/vnd.osgi.dp': ['dp'],
4477
- 'application/vnd.osgi.subsystem': ['esa'],
4478
- 'application/vnd.palm': ['pdb', 'pqa', 'oprc'],
4479
- 'application/vnd.pawaafile': ['paw'],
4480
- 'application/vnd.pg.format': ['str'],
4481
- 'application/vnd.pg.osasli': ['ei6'],
4482
- 'application/vnd.picsel': ['efif'],
4483
- 'application/vnd.pmi.widget': ['wg'],
4484
- 'application/vnd.pocketlearn': ['plf'],
4485
- 'application/vnd.powerbuilder6': ['pbd'],
4486
- 'application/vnd.previewsystems.box': ['box'],
4487
- 'application/vnd.procrate.brushset': ['brushset'],
4488
- 'application/vnd.procreate.brush': ['brush'],
4489
- 'application/vnd.procreate.dream': ['drm'],
4490
- 'application/vnd.proteus.magazine': ['mgz'],
4491
- 'application/vnd.publishare-delta-tree': ['qps'],
4492
- 'application/vnd.pvi.ptid1': ['ptid'],
4493
- 'application/vnd.pwg-xhtml-print+xml': ['xhtm'],
4494
- 'application/vnd.quark.quarkxpress': [
4495
- 'qxd',
4496
- 'qxt',
4497
- 'qwd',
4498
- 'qwt',
4499
- 'qxl',
4500
- 'qxb',
4501
- ],
4502
- 'application/vnd.rar': ['rar'],
4503
- 'application/vnd.realvnc.bed': ['bed'],
4504
- 'application/vnd.recordare.musicxml': ['mxl'],
4505
- 'application/vnd.recordare.musicxml+xml': ['musicxml'],
4506
- 'application/vnd.rig.cryptonote': ['cryptonote'],
4507
- 'application/vnd.rim.cod': ['cod'],
4508
- 'application/vnd.rn-realmedia': ['rm'],
4509
- 'application/vnd.rn-realmedia-vbr': ['rmvb'],
4510
- 'application/vnd.route66.link66+xml': ['link66'],
4511
- 'application/vnd.sailingtracker.track': ['st'],
4512
- 'application/vnd.seemail': ['see'],
4513
- 'application/vnd.sema': ['sema'],
4514
- 'application/vnd.semd': ['semd'],
4515
- 'application/vnd.semf': ['semf'],
4516
- 'application/vnd.shana.informed.formdata': ['ifm'],
4517
- 'application/vnd.shana.informed.formtemplate': ['itp'],
4518
- 'application/vnd.shana.informed.interchange': ['iif'],
4519
- 'application/vnd.shana.informed.package': ['ipk'],
4520
- 'application/vnd.simtech-mindmapper': ['twd', 'twds'],
4521
- 'application/vnd.smaf': ['mmf'],
4522
- 'application/vnd.smart.teacher': ['teacher'],
4523
- 'application/vnd.software602.filler.form+xml': ['fo'],
4524
- 'application/vnd.solent.sdkm+xml': ['sdkm', 'sdkd'],
4525
- 'application/vnd.spotfire.dxp': ['dxp'],
4526
- 'application/vnd.spotfire.sfs': ['sfs'],
4527
- 'application/vnd.stardivision.calc': ['sdc'],
4528
- 'application/vnd.stardivision.draw': ['sda'],
4529
- 'application/vnd.stardivision.impress': ['sdd'],
4530
- 'application/vnd.stardivision.math': ['smf'],
4531
- 'application/vnd.stardivision.writer': ['sdw', 'vor'],
4532
- 'application/vnd.stardivision.writer-global': ['sgl'],
4533
- 'application/vnd.stepmania.package': ['smzip'],
4534
- 'application/vnd.stepmania.stepchart': ['sm'],
4535
- 'application/vnd.sun.wadl+xml': ['wadl'],
4536
- 'application/vnd.sun.xml.calc': ['sxc'],
4537
- 'application/vnd.sun.xml.calc.template': ['stc'],
4538
- 'application/vnd.sun.xml.draw': ['sxd'],
4539
- 'application/vnd.sun.xml.draw.template': ['std'],
4540
- 'application/vnd.sun.xml.impress': ['sxi'],
4541
- 'application/vnd.sun.xml.impress.template': ['sti'],
4542
- 'application/vnd.sun.xml.math': ['sxm'],
4543
- 'application/vnd.sun.xml.writer': ['sxw'],
4544
- 'application/vnd.sun.xml.writer.global': ['sxg'],
4545
- 'application/vnd.sun.xml.writer.template': ['stw'],
4546
- 'application/vnd.sus-calendar': ['sus', 'susp'],
4547
- 'application/vnd.svd': ['svd'],
4548
- 'application/vnd.symbian.install': ['sis', 'sisx'],
4549
- 'application/vnd.syncml+xml': ['xsm'],
4550
- 'application/vnd.syncml.dm+wbxml': ['bdm'],
4551
- 'application/vnd.syncml.dm+xml': ['xdm'],
4552
- 'application/vnd.syncml.dmddf+xml': ['ddf'],
4553
- 'application/vnd.tao.intent-module-archive': ['tao'],
4554
- 'application/vnd.tcpdump.pcap': ['pcap', 'cap', 'dmp'],
4555
- 'application/vnd.tmobile-livetv': ['tmo'],
4556
- 'application/vnd.trid.tpt': ['tpt'],
4557
- 'application/vnd.triscape.mxs': ['mxs'],
4558
- 'application/vnd.trueapp': ['tra'],
4559
- 'application/vnd.ufdl': ['ufd', 'ufdl'],
4560
- 'application/vnd.uiq.theme': ['utz'],
4561
- 'application/vnd.umajin': ['umj'],
4562
- 'application/vnd.unity': ['unityweb'],
4563
- 'application/vnd.uoml+xml': ['uoml', 'uo'],
4564
- 'application/vnd.vcx': ['vcx'],
4565
- 'application/vnd.visio': ['vsd', 'vst', 'vss', 'vsw', 'vsdx', 'vtx'],
4566
- 'application/vnd.visionary': ['vis'],
4567
- 'application/vnd.vsf': ['vsf'],
4568
- 'application/vnd.wap.wbxml': ['wbxml'],
4569
- 'application/vnd.wap.wmlc': ['wmlc'],
4570
- 'application/vnd.wap.wmlscriptc': ['wmlsc'],
4571
- 'application/vnd.webturbo': ['wtb'],
4572
- 'application/vnd.wolfram.player': ['nbp'],
4573
- 'application/vnd.wordperfect': ['wpd'],
4574
- 'application/vnd.wqd': ['wqd'],
4575
- 'application/vnd.wt.stf': ['stf'],
4576
- 'application/vnd.xara': ['xar'],
4577
- 'application/vnd.xfdl': ['xfdl'],
4578
- 'application/vnd.yamaha.hv-dic': ['hvd'],
4579
- 'application/vnd.yamaha.hv-script': ['hvs'],
4580
- 'application/vnd.yamaha.hv-voice': ['hvp'],
4581
- 'application/vnd.yamaha.openscoreformat': ['osf'],
4582
- 'application/vnd.yamaha.openscoreformat.osfpvg+xml': ['osfpvg'],
4583
- 'application/vnd.yamaha.smaf-audio': ['saf'],
4584
- 'application/vnd.yamaha.smaf-phrase': ['spf'],
4585
- 'application/vnd.yellowriver-custom-menu': ['cmp'],
4586
- 'application/vnd.zul': ['zir', 'zirz'],
4587
- 'application/vnd.zzazz.deck+xml': ['zaz'],
4588
- 'application/x-7z-compressed': ['7z'],
4589
- 'application/x-abiword': ['abw'],
4590
- 'application/x-ace-compressed': ['ace'],
4591
- 'application/x-apple-diskimage': ['*dmg'],
4592
- 'application/x-arj': ['arj'],
4593
- 'application/x-authorware-bin': ['aab', 'x32', 'u32', 'vox'],
4594
- 'application/x-authorware-map': ['aam'],
4595
- 'application/x-authorware-seg': ['aas'],
4596
- 'application/x-bcpio': ['bcpio'],
4597
- 'application/x-bdoc': ['*bdoc'],
4598
- 'application/x-bittorrent': ['torrent'],
4599
- 'application/x-blender': ['blend'],
4600
- 'application/x-blorb': ['blb', 'blorb'],
4601
- 'application/x-bzip': ['bz'],
4602
- 'application/x-bzip2': ['bz2', 'boz'],
4603
- 'application/x-cbr': ['cbr', 'cba', 'cbt', 'cbz', 'cb7'],
4604
- 'application/x-cdlink': ['vcd'],
4605
- 'application/x-cfs-compressed': ['cfs'],
4606
- 'application/x-chat': ['chat'],
4607
- 'application/x-chess-pgn': ['pgn'],
4608
- 'application/x-chrome-extension': ['crx'],
4609
- 'application/x-cocoa': ['cco'],
4610
- 'application/x-compressed': ['*rar'],
4611
- 'application/x-conference': ['nsc'],
4612
- 'application/x-cpio': ['cpio'],
4613
- 'application/x-csh': ['csh'],
4614
- 'application/x-debian-package': ['*deb', 'udeb'],
4615
- 'application/x-dgc-compressed': ['dgc'],
4616
- 'application/x-director': [
4617
- 'dir',
4618
- 'dcr',
4619
- 'dxr',
4620
- 'cst',
4621
- 'cct',
4622
- 'cxt',
4623
- 'w3d',
4624
- 'fgd',
4625
- 'swa',
4626
- ],
4627
- 'application/x-doom': ['wad'],
4628
- 'application/x-dtbncx+xml': ['ncx'],
4629
- 'application/x-dtbook+xml': ['dtb'],
4630
- 'application/x-dtbresource+xml': ['res'],
4631
- 'application/x-dvi': ['dvi'],
4632
- 'application/x-envoy': ['evy'],
4633
- 'application/x-eva': ['eva'],
4634
- 'application/x-font-bdf': ['bdf'],
4635
- 'application/x-font-ghostscript': ['gsf'],
4636
- 'application/x-font-linux-psf': ['psf'],
4637
- 'application/x-font-pcf': ['pcf'],
4638
- 'application/x-font-snf': ['snf'],
4639
- 'application/x-font-type1': ['pfa', 'pfb', 'pfm', 'afm'],
4640
- 'application/x-freearc': ['arc'],
4641
- 'application/x-futuresplash': ['spl'],
4642
- 'application/x-gca-compressed': ['gca'],
4643
- 'application/x-glulx': ['ulx'],
4644
- 'application/x-gnumeric': ['gnumeric'],
4645
- 'application/x-gramps-xml': ['gramps'],
4646
- 'application/x-gtar': ['gtar'],
4647
- 'application/x-hdf': ['hdf'],
4648
- 'application/x-httpd-php': ['php'],
4649
- 'application/x-install-instructions': ['install'],
4650
- 'application/x-ipynb+json': ['ipynb'],
4651
- 'application/x-iso9660-image': ['*iso'],
4652
- 'application/x-iwork-keynote-sffkey': ['*key'],
4653
- 'application/x-iwork-numbers-sffnumbers': ['*numbers'],
4654
- 'application/x-iwork-pages-sffpages': ['*pages'],
4655
- 'application/x-java-archive-diff': ['jardiff'],
4656
- 'application/x-java-jnlp-file': ['jnlp'],
4657
- 'application/x-keepass2': ['kdbx'],
4658
- 'application/x-latex': ['latex'],
4659
- 'application/x-lua-bytecode': ['luac'],
4660
- 'application/x-lzh-compressed': ['lzh', 'lha'],
4661
- 'application/x-makeself': ['run'],
4662
- 'application/x-mie': ['mie'],
4663
- 'application/x-mobipocket-ebook': ['*prc', 'mobi'],
4664
- 'application/x-ms-application': ['application'],
4665
- 'application/x-ms-shortcut': ['lnk'],
4666
- 'application/x-ms-wmd': ['wmd'],
4667
- 'application/x-ms-wmz': ['wmz'],
4668
- 'application/x-ms-xbap': ['xbap'],
4669
- 'application/x-msaccess': ['mdb'],
4670
- 'application/x-msbinder': ['obd'],
4671
- 'application/x-mscardfile': ['crd'],
4672
- 'application/x-msclip': ['clp'],
4673
- 'application/x-msdos-program': ['*exe'],
4674
- 'application/x-msdownload': ['*exe', '*dll', 'com', 'bat', '*msi'],
4675
- 'application/x-msmediaview': ['mvb', 'm13', 'm14'],
4676
- 'application/x-msmetafile': ['*wmf', '*wmz', '*emf', 'emz'],
4677
- 'application/x-msmoney': ['mny'],
4678
- 'application/x-mspublisher': ['pub'],
4679
- 'application/x-msschedule': ['scd'],
4680
- 'application/x-msterminal': ['trm'],
4681
- 'application/x-mswrite': ['wri'],
4682
- 'application/x-netcdf': ['nc', 'cdf'],
4683
- 'application/x-ns-proxy-autoconfig': ['pac'],
4684
- 'application/x-nzb': ['nzb'],
4685
- 'application/x-perl': ['pl', 'pm'],
4686
- 'application/x-pilot': ['*prc', '*pdb'],
4687
- 'application/x-pkcs12': ['p12', 'pfx'],
4688
- 'application/x-pkcs7-certificates': ['p7b', 'spc'],
4689
- 'application/x-pkcs7-certreqresp': ['p7r'],
4690
- 'application/x-rar-compressed': ['*rar'],
4691
- 'application/x-redhat-package-manager': ['rpm'],
4692
- 'application/x-research-info-systems': ['ris'],
4693
- 'application/x-sea': ['sea'],
4694
- 'application/x-sh': ['sh'],
4695
- 'application/x-shar': ['shar'],
4696
- 'application/x-shockwave-flash': ['swf'],
4697
- 'application/x-silverlight-app': ['xap'],
4698
- 'application/x-sql': ['*sql'],
4699
- 'application/x-stuffit': ['sit'],
4700
- 'application/x-stuffitx': ['sitx'],
4701
- 'application/x-subrip': ['srt'],
4702
- 'application/x-sv4cpio': ['sv4cpio'],
4703
- 'application/x-sv4crc': ['sv4crc'],
4704
- 'application/x-t3vm-image': ['t3'],
4705
- 'application/x-tads': ['gam'],
4706
- 'application/x-tar': ['tar'],
4707
- 'application/x-tcl': ['tcl', 'tk'],
4708
- 'application/x-tex': ['tex'],
4709
- 'application/x-tex-tfm': ['tfm'],
4710
- 'application/x-texinfo': ['texinfo', 'texi'],
4711
- 'application/x-tgif': ['*obj'],
4712
- 'application/x-ustar': ['ustar'],
4713
- 'application/x-virtualbox-hdd': ['hdd'],
4714
- 'application/x-virtualbox-ova': ['ova'],
4715
- 'application/x-virtualbox-ovf': ['ovf'],
4716
- 'application/x-virtualbox-vbox': ['vbox'],
4717
- 'application/x-virtualbox-vbox-extpack': ['vbox-extpack'],
4718
- 'application/x-virtualbox-vdi': ['vdi'],
4719
- 'application/x-virtualbox-vhd': ['vhd'],
4720
- 'application/x-virtualbox-vmdk': ['vmdk'],
4721
- 'application/x-wais-source': ['src'],
4722
- 'application/x-web-app-manifest+json': ['webapp'],
4723
- 'application/x-x509-ca-cert': ['der', 'crt', 'pem'],
4724
- 'application/x-xfig': ['fig'],
4725
- 'application/x-xliff+xml': ['*xlf'],
4726
- 'application/x-xpinstall': ['xpi'],
4727
- 'application/x-xz': ['xz'],
4728
- 'application/x-zip-compressed': ['*zip'],
4729
- 'application/x-zmachine': ['z1', 'z2', 'z3', 'z4', 'z5', 'z6', 'z7', 'z8'],
4730
- 'audio/vnd.dece.audio': ['uva', 'uvva'],
4731
- 'audio/vnd.digital-winds': ['eol'],
4732
- 'audio/vnd.dra': ['dra'],
4733
- 'audio/vnd.dts': ['dts'],
4734
- 'audio/vnd.dts.hd': ['dtshd'],
4735
- 'audio/vnd.lucent.voice': ['lvp'],
4736
- 'audio/vnd.ms-playready.media.pya': ['pya'],
4737
- 'audio/vnd.nuera.ecelp4800': ['ecelp4800'],
4738
- 'audio/vnd.nuera.ecelp7470': ['ecelp7470'],
4739
- 'audio/vnd.nuera.ecelp9600': ['ecelp9600'],
4740
- 'audio/vnd.rip': ['rip'],
4741
- 'audio/x-aac': ['*aac'],
4742
- 'audio/x-aiff': ['aif', 'aiff', 'aifc'],
4743
- 'audio/x-caf': ['caf'],
4744
- 'audio/x-flac': ['flac'],
4745
- 'audio/x-m4a': ['*m4a'],
4746
- 'audio/x-matroska': ['mka'],
4747
- 'audio/x-mpegurl': ['m3u'],
4748
- 'audio/x-ms-wax': ['wax'],
4749
- 'audio/x-ms-wma': ['wma'],
4750
- 'audio/x-pn-realaudio': ['ram', 'ra'],
4751
- 'audio/x-pn-realaudio-plugin': ['rmp'],
4752
- 'audio/x-realaudio': ['*ra'],
4753
- 'audio/x-wav': ['*wav'],
4754
- 'chemical/x-cdx': ['cdx'],
4755
- 'chemical/x-cif': ['cif'],
4756
- 'chemical/x-cmdf': ['cmdf'],
4757
- 'chemical/x-cml': ['cml'],
4758
- 'chemical/x-csml': ['csml'],
4759
- 'chemical/x-xyz': ['xyz'],
4760
- 'image/prs.btif': ['btif', 'btf'],
4761
- 'image/prs.pti': ['pti'],
4762
- 'image/vnd.adobe.photoshop': ['psd'],
4763
- 'image/vnd.airzip.accelerator.azv': ['azv'],
4764
- 'image/vnd.dece.graphic': ['uvi', 'uvvi', 'uvg', 'uvvg'],
4765
- 'image/vnd.djvu': ['djvu', 'djv'],
4766
- 'image/vnd.dvb.subtitle': ['*sub'],
4767
- 'image/vnd.dwg': ['dwg'],
4768
- 'image/vnd.dxf': ['dxf'],
4769
- 'image/vnd.fastbidsheet': ['fbs'],
4770
- 'image/vnd.fpx': ['fpx'],
4771
- 'image/vnd.fst': ['fst'],
4772
- 'image/vnd.fujixerox.edmics-mmr': ['mmr'],
4773
- 'image/vnd.fujixerox.edmics-rlc': ['rlc'],
4774
- 'image/vnd.microsoft.icon': ['ico'],
4775
- 'image/vnd.ms-dds': ['dds'],
4776
- 'image/vnd.ms-modi': ['mdi'],
4777
- 'image/vnd.ms-photo': ['wdp'],
4778
- 'image/vnd.net-fpx': ['npx'],
4779
- 'image/vnd.pco.b16': ['b16'],
4780
- 'image/vnd.tencent.tap': ['tap'],
4781
- 'image/vnd.valve.source.texture': ['vtf'],
4782
- 'image/vnd.wap.wbmp': ['wbmp'],
4783
- 'image/vnd.xiff': ['xif'],
4784
- 'image/vnd.zbrush.pcx': ['pcx'],
4785
- 'image/x-3ds': ['3ds'],
4786
- 'image/x-adobe-dng': ['dng'],
4787
- 'image/x-cmu-raster': ['ras'],
4788
- 'image/x-cmx': ['cmx'],
4789
- 'image/x-freehand': ['fh', 'fhc', 'fh4', 'fh5', 'fh7'],
4790
- 'image/x-icon': ['*ico'],
4791
- 'image/x-jng': ['jng'],
4792
- 'image/x-mrsid-image': ['sid'],
4793
- 'image/x-ms-bmp': ['*bmp'],
4794
- 'image/x-pcx': ['*pcx'],
4795
- 'image/x-pict': ['pic', 'pct'],
4796
- 'image/x-portable-anymap': ['pnm'],
4797
- 'image/x-portable-bitmap': ['pbm'],
4798
- 'image/x-portable-graymap': ['pgm'],
4799
- 'image/x-portable-pixmap': ['ppm'],
4800
- 'image/x-rgb': ['rgb'],
4801
- 'image/x-tga': ['tga'],
4802
- 'image/x-xbitmap': ['xbm'],
4803
- 'image/x-xpixmap': ['xpm'],
4804
- 'image/x-xwindowdump': ['xwd'],
4805
- 'message/vnd.wfa.wsc': ['wsc'],
4806
- 'model/vnd.bary': ['bary'],
4807
- 'model/vnd.cld': ['cld'],
4808
- 'model/vnd.collada+xml': ['dae'],
4809
- 'model/vnd.dwf': ['dwf'],
4810
- 'model/vnd.gdl': ['gdl'],
4811
- 'model/vnd.gtw': ['gtw'],
4812
- 'model/vnd.mts': ['*mts'],
4813
- 'model/vnd.opengex': ['ogex'],
4814
- 'model/vnd.parasolid.transmit.binary': ['x_b'],
4815
- 'model/vnd.parasolid.transmit.text': ['x_t'],
4816
- 'model/vnd.pytha.pyox': ['pyo', 'pyox'],
4817
- 'model/vnd.sap.vds': ['vds'],
4818
- 'model/vnd.usda': ['usda'],
4819
- 'model/vnd.usdz+zip': ['usdz'],
4820
- 'model/vnd.valve.source.compiled-map': ['bsp'],
4821
- 'model/vnd.vtu': ['vtu'],
4822
- 'text/prs.lines.tag': ['dsc'],
4823
- 'text/vnd.curl': ['curl'],
4824
- 'text/vnd.curl.dcurl': ['dcurl'],
4825
- 'text/vnd.curl.mcurl': ['mcurl'],
4826
- 'text/vnd.curl.scurl': ['scurl'],
4827
- 'text/vnd.dvb.subtitle': ['sub'],
4828
- 'text/vnd.familysearch.gedcom': ['ged'],
4829
- 'text/vnd.fly': ['fly'],
4830
- 'text/vnd.fmi.flexstor': ['flx'],
4831
- 'text/vnd.graphviz': ['gv'],
4832
- 'text/vnd.in3d.3dml': ['3dml'],
4833
- 'text/vnd.in3d.spot': ['spot'],
4834
- 'text/vnd.sun.j2me.app-descriptor': ['jad'],
4835
- 'text/vnd.wap.wml': ['wml'],
4836
- 'text/vnd.wap.wmlscript': ['wmls'],
4837
- 'text/x-asm': ['s', 'asm'],
4838
- 'text/x-c': ['c', 'cc', 'cxx', 'cpp', 'h', 'hh', 'dic'],
4839
- 'text/x-component': ['htc'],
4840
- 'text/x-fortran': ['f', 'for', 'f77', 'f90'],
4841
- 'text/x-handlebars-template': ['hbs'],
4842
- 'text/x-java-source': ['java'],
4843
- 'text/x-lua': ['lua'],
4844
- 'text/x-markdown': ['mkd'],
4845
- 'text/x-nfo': ['nfo'],
4846
- 'text/x-opml': ['opml'],
4847
- 'text/x-org': ['*org'],
4848
- 'text/x-pascal': ['p', 'pas'],
4849
- 'text/x-processing': ['pde'],
4850
- 'text/x-sass': ['sass'],
4851
- 'text/x-scss': ['scss'],
4852
- 'text/x-setext': ['etx'],
4853
- 'text/x-sfv': ['sfv'],
4854
- 'text/x-suse-ymp': ['ymp'],
4855
- 'text/x-uuencode': ['uu'],
4856
- 'text/x-vcalendar': ['vcs'],
4857
- 'text/x-vcard': ['vcf'],
4858
- 'video/vnd.dece.hd': ['uvh', 'uvvh'],
4859
- 'video/vnd.dece.mobile': ['uvm', 'uvvm'],
4860
- 'video/vnd.dece.pd': ['uvp', 'uvvp'],
4861
- 'video/vnd.dece.sd': ['uvs', 'uvvs'],
4862
- 'video/vnd.dece.video': ['uvv', 'uvvv'],
4863
- 'video/vnd.dvb.file': ['dvb'],
4864
- 'video/vnd.fvt': ['fvt'],
4865
- 'video/vnd.mpegurl': ['mxu', 'm4u'],
4866
- 'video/vnd.ms-playready.media.pyv': ['pyv'],
4867
- 'video/vnd.uvvu.mp4': ['uvu', 'uvvu'],
4868
- 'video/vnd.vivo': ['viv'],
4869
- 'video/x-f4v': ['f4v'],
4870
- 'video/x-fli': ['fli'],
4871
- 'video/x-flv': ['flv'],
4872
- 'video/x-m4v': ['m4v'],
4873
- 'video/x-matroska': ['mkv', 'mk3d', 'mks'],
4874
- 'video/x-mng': ['mng'],
4875
- 'video/x-ms-asf': ['asf', 'asx'],
4876
- 'video/x-ms-vob': ['vob'],
4877
- 'video/x-ms-wm': ['wm'],
4878
- 'video/x-ms-wmv': ['wmv'],
4879
- 'video/x-ms-wmx': ['wmx'],
4880
- 'video/x-ms-wvx': ['wvx'],
4881
- 'video/x-msvideo': ['avi'],
4882
- 'video/x-sgi-movie': ['movie'],
4883
- 'video/x-smv': ['smv'],
4884
- 'x-conference/x-cooltalk': ['ice'],
4885
- };
4886
- Object.freeze(types$1);
4887
-
4888
- const types = {
4889
- 'application/andrew-inset': ['ez'],
4890
- 'application/appinstaller': ['appinstaller'],
4891
- 'application/applixware': ['aw'],
4892
- 'application/appx': ['appx'],
4893
- 'application/appxbundle': ['appxbundle'],
4894
- 'application/atom+xml': ['atom'],
4895
- 'application/atomcat+xml': ['atomcat'],
4896
- 'application/atomdeleted+xml': ['atomdeleted'],
4897
- 'application/atomsvc+xml': ['atomsvc'],
4898
- 'application/atsc-dwd+xml': ['dwd'],
4899
- 'application/atsc-held+xml': ['held'],
4900
- 'application/atsc-rsat+xml': ['rsat'],
4901
- 'application/automationml-aml+xml': ['aml'],
4902
- 'application/automationml-amlx+zip': ['amlx'],
4903
- 'application/bdoc': ['bdoc'],
4904
- 'application/calendar+xml': ['xcs'],
4905
- 'application/ccxml+xml': ['ccxml'],
4906
- 'application/cdfx+xml': ['cdfx'],
4907
- 'application/cdmi-capability': ['cdmia'],
4908
- 'application/cdmi-container': ['cdmic'],
4909
- 'application/cdmi-domain': ['cdmid'],
4910
- 'application/cdmi-object': ['cdmio'],
4911
- 'application/cdmi-queue': ['cdmiq'],
4912
- 'application/cpl+xml': ['cpl'],
4913
- 'application/cu-seeme': ['cu'],
4914
- 'application/cwl': ['cwl'],
4915
- 'application/dash+xml': ['mpd'],
4916
- 'application/dash-patch+xml': ['mpp'],
4917
- 'application/davmount+xml': ['davmount'],
4918
- 'application/dicom': ['dcm'],
4919
- 'application/docbook+xml': ['dbk'],
4920
- 'application/dssc+der': ['dssc'],
4921
- 'application/dssc+xml': ['xdssc'],
4922
- 'application/ecmascript': ['ecma'],
4923
- 'application/emma+xml': ['emma'],
4924
- 'application/emotionml+xml': ['emotionml'],
4925
- 'application/epub+zip': ['epub'],
4926
- 'application/exi': ['exi'],
4927
- 'application/express': ['exp'],
4928
- 'application/fdf': ['fdf'],
4929
- 'application/fdt+xml': ['fdt'],
4930
- 'application/font-tdpfr': ['pfr'],
4931
- 'application/geo+json': ['geojson'],
4932
- 'application/gml+xml': ['gml'],
4933
- 'application/gpx+xml': ['gpx'],
4934
- 'application/gxf': ['gxf'],
4935
- 'application/gzip': ['gz'],
4936
- 'application/hjson': ['hjson'],
4937
- 'application/hyperstudio': ['stk'],
4938
- 'application/inkml+xml': ['ink', 'inkml'],
4939
- 'application/ipfix': ['ipfix'],
4940
- 'application/its+xml': ['its'],
4941
- 'application/java-archive': ['jar', 'war', 'ear'],
4942
- 'application/java-serialized-object': ['ser'],
4943
- 'application/java-vm': ['class'],
4944
- 'application/javascript': ['*js'],
4945
- 'application/json': ['json', 'map'],
4946
- 'application/json5': ['json5'],
4947
- 'application/jsonml+json': ['jsonml'],
4948
- 'application/ld+json': ['jsonld'],
4949
- 'application/lgr+xml': ['lgr'],
4950
- 'application/lost+xml': ['lostxml'],
4951
- 'application/mac-binhex40': ['hqx'],
4952
- 'application/mac-compactpro': ['cpt'],
4953
- 'application/mads+xml': ['mads'],
4954
- 'application/manifest+json': ['webmanifest'],
4955
- 'application/marc': ['mrc'],
4956
- 'application/marcxml+xml': ['mrcx'],
4957
- 'application/mathematica': ['ma', 'nb', 'mb'],
4958
- 'application/mathml+xml': ['mathml'],
4959
- 'application/mbox': ['mbox'],
4960
- 'application/media-policy-dataset+xml': ['mpf'],
4961
- 'application/mediaservercontrol+xml': ['mscml'],
4962
- 'application/metalink+xml': ['metalink'],
4963
- 'application/metalink4+xml': ['meta4'],
4964
- 'application/mets+xml': ['mets'],
4965
- 'application/mmt-aei+xml': ['maei'],
4966
- 'application/mmt-usd+xml': ['musd'],
4967
- 'application/mods+xml': ['mods'],
4968
- 'application/mp21': ['m21', 'mp21'],
4969
- 'application/mp4': ['*mp4', '*mpg4', 'mp4s', 'm4p'],
4970
- 'application/msix': ['msix'],
4971
- 'application/msixbundle': ['msixbundle'],
4972
- 'application/msword': ['doc', 'dot'],
4973
- 'application/mxf': ['mxf'],
4974
- 'application/n-quads': ['nq'],
4975
- 'application/n-triples': ['nt'],
4976
- 'application/node': ['cjs'],
4977
- 'application/octet-stream': [
4978
- 'bin',
4979
- 'dms',
4980
- 'lrf',
4981
- 'mar',
4982
- 'so',
4983
- 'dist',
4984
- 'distz',
4985
- 'pkg',
4986
- 'bpk',
4987
- 'dump',
4988
- 'elc',
4989
- 'deploy',
4990
- 'exe',
4991
- 'dll',
4992
- 'deb',
4993
- 'dmg',
4994
- 'iso',
4995
- 'img',
4996
- 'msi',
4997
- 'msp',
4998
- 'msm',
4999
- 'buffer',
5000
- ],
5001
- 'application/oda': ['oda'],
5002
- 'application/oebps-package+xml': ['opf'],
5003
- 'application/ogg': ['ogx'],
5004
- 'application/omdoc+xml': ['omdoc'],
5005
- 'application/onenote': [
5006
- 'onetoc',
5007
- 'onetoc2',
5008
- 'onetmp',
5009
- 'onepkg',
5010
- 'one',
5011
- 'onea',
5012
- ],
5013
- 'application/oxps': ['oxps'],
5014
- 'application/p2p-overlay+xml': ['relo'],
5015
- 'application/patch-ops-error+xml': ['xer'],
5016
- 'application/pdf': ['pdf'],
5017
- 'application/pgp-encrypted': ['pgp'],
5018
- 'application/pgp-keys': ['asc'],
5019
- 'application/pgp-signature': ['sig', '*asc'],
5020
- 'application/pics-rules': ['prf'],
5021
- 'application/pkcs10': ['p10'],
5022
- 'application/pkcs7-mime': ['p7m', 'p7c'],
5023
- 'application/pkcs7-signature': ['p7s'],
5024
- 'application/pkcs8': ['p8'],
5025
- 'application/pkix-attr-cert': ['ac'],
5026
- 'application/pkix-cert': ['cer'],
5027
- 'application/pkix-crl': ['crl'],
5028
- 'application/pkix-pkipath': ['pkipath'],
5029
- 'application/pkixcmp': ['pki'],
5030
- 'application/pls+xml': ['pls'],
5031
- 'application/postscript': ['ai', 'eps', 'ps'],
5032
- 'application/provenance+xml': ['provx'],
5033
- 'application/pskc+xml': ['pskcxml'],
5034
- 'application/raml+yaml': ['raml'],
5035
- 'application/rdf+xml': ['rdf', 'owl'],
5036
- 'application/reginfo+xml': ['rif'],
5037
- 'application/relax-ng-compact-syntax': ['rnc'],
5038
- 'application/resource-lists+xml': ['rl'],
5039
- 'application/resource-lists-diff+xml': ['rld'],
5040
- 'application/rls-services+xml': ['rs'],
5041
- 'application/route-apd+xml': ['rapd'],
5042
- 'application/route-s-tsid+xml': ['sls'],
5043
- 'application/route-usd+xml': ['rusd'],
5044
- 'application/rpki-ghostbusters': ['gbr'],
5045
- 'application/rpki-manifest': ['mft'],
5046
- 'application/rpki-roa': ['roa'],
5047
- 'application/rsd+xml': ['rsd'],
5048
- 'application/rss+xml': ['rss'],
5049
- 'application/rtf': ['rtf'],
5050
- 'application/sbml+xml': ['sbml'],
5051
- 'application/scvp-cv-request': ['scq'],
5052
- 'application/scvp-cv-response': ['scs'],
5053
- 'application/scvp-vp-request': ['spq'],
5054
- 'application/scvp-vp-response': ['spp'],
5055
- 'application/sdp': ['sdp'],
5056
- 'application/senml+xml': ['senmlx'],
5057
- 'application/sensml+xml': ['sensmlx'],
5058
- 'application/set-payment-initiation': ['setpay'],
5059
- 'application/set-registration-initiation': ['setreg'],
5060
- 'application/shf+xml': ['shf'],
5061
- 'application/sieve': ['siv', 'sieve'],
5062
- 'application/smil+xml': ['smi', 'smil'],
5063
- 'application/sparql-query': ['rq'],
5064
- 'application/sparql-results+xml': ['srx'],
5065
- 'application/sql': ['sql'],
5066
- 'application/srgs': ['gram'],
5067
- 'application/srgs+xml': ['grxml'],
5068
- 'application/sru+xml': ['sru'],
5069
- 'application/ssdl+xml': ['ssdl'],
5070
- 'application/ssml+xml': ['ssml'],
5071
- 'application/swid+xml': ['swidtag'],
5072
- 'application/tei+xml': ['tei', 'teicorpus'],
5073
- 'application/thraud+xml': ['tfi'],
5074
- 'application/timestamped-data': ['tsd'],
5075
- 'application/toml': ['toml'],
5076
- 'application/trig': ['trig'],
5077
- 'application/ttml+xml': ['ttml'],
5078
- 'application/ubjson': ['ubj'],
5079
- 'application/urc-ressheet+xml': ['rsheet'],
5080
- 'application/urc-targetdesc+xml': ['td'],
5081
- 'application/voicexml+xml': ['vxml'],
5082
- 'application/wasm': ['wasm'],
5083
- 'application/watcherinfo+xml': ['wif'],
5084
- 'application/widget': ['wgt'],
5085
- 'application/winhlp': ['hlp'],
5086
- 'application/wsdl+xml': ['wsdl'],
5087
- 'application/wspolicy+xml': ['wspolicy'],
5088
- 'application/xaml+xml': ['xaml'],
5089
- 'application/xcap-att+xml': ['xav'],
5090
- 'application/xcap-caps+xml': ['xca'],
5091
- 'application/xcap-diff+xml': ['xdf'],
5092
- 'application/xcap-el+xml': ['xel'],
5093
- 'application/xcap-ns+xml': ['xns'],
5094
- 'application/xenc+xml': ['xenc'],
5095
- 'application/xfdf': ['xfdf'],
5096
- 'application/xhtml+xml': ['xhtml', 'xht'],
5097
- 'application/xliff+xml': ['xlf'],
5098
- 'application/xml': ['xml', 'xsl', 'xsd', 'rng'],
5099
- 'application/xml-dtd': ['dtd'],
5100
- 'application/xop+xml': ['xop'],
5101
- 'application/xproc+xml': ['xpl'],
5102
- 'application/xslt+xml': ['*xsl', 'xslt'],
5103
- 'application/xspf+xml': ['xspf'],
5104
- 'application/xv+xml': ['mxml', 'xhvml', 'xvml', 'xvm'],
5105
- 'application/yang': ['yang'],
5106
- 'application/yin+xml': ['yin'],
5107
- 'application/zip': ['zip'],
5108
- 'application/zip+dotlottie': ['lottie'],
5109
- 'audio/3gpp': ['*3gpp'],
5110
- 'audio/aac': ['adts', 'aac'],
5111
- 'audio/adpcm': ['adp'],
5112
- 'audio/amr': ['amr'],
5113
- 'audio/basic': ['au', 'snd'],
5114
- 'audio/midi': ['mid', 'midi', 'kar', 'rmi'],
5115
- 'audio/mobile-xmf': ['mxmf'],
5116
- 'audio/mp3': ['*mp3'],
5117
- 'audio/mp4': ['m4a', 'mp4a', 'm4b'],
5118
- 'audio/mpeg': ['mpga', 'mp2', 'mp2a', 'mp3', 'm2a', 'm3a'],
5119
- 'audio/ogg': ['oga', 'ogg', 'spx', 'opus'],
5120
- 'audio/s3m': ['s3m'],
5121
- 'audio/silk': ['sil'],
5122
- 'audio/wav': ['wav'],
5123
- 'audio/wave': ['*wav'],
5124
- 'audio/webm': ['weba'],
5125
- 'audio/xm': ['xm'],
5126
- 'font/collection': ['ttc'],
5127
- 'font/otf': ['otf'],
5128
- 'font/ttf': ['ttf'],
5129
- 'font/woff': ['woff'],
5130
- 'font/woff2': ['woff2'],
5131
- 'image/aces': ['exr'],
5132
- 'image/apng': ['apng'],
5133
- 'image/avci': ['avci'],
5134
- 'image/avcs': ['avcs'],
5135
- 'image/avif': ['avif'],
5136
- 'image/bmp': ['bmp', 'dib'],
5137
- 'image/cgm': ['cgm'],
5138
- 'image/dicom-rle': ['drle'],
5139
- 'image/dpx': ['dpx'],
5140
- 'image/emf': ['emf'],
5141
- 'image/fits': ['fits'],
5142
- 'image/g3fax': ['g3'],
5143
- 'image/gif': ['gif'],
5144
- 'image/heic': ['heic'],
5145
- 'image/heic-sequence': ['heics'],
5146
- 'image/heif': ['heif'],
5147
- 'image/heif-sequence': ['heifs'],
5148
- 'image/hej2k': ['hej2'],
5149
- 'image/ief': ['ief'],
5150
- 'image/jaii': ['jaii'],
5151
- 'image/jais': ['jais'],
5152
- 'image/jls': ['jls'],
5153
- 'image/jp2': ['jp2', 'jpg2'],
5154
- 'image/jpeg': ['jpg', 'jpeg', 'jpe'],
5155
- 'image/jph': ['jph'],
5156
- 'image/jphc': ['jhc'],
5157
- 'image/jpm': ['jpm', 'jpgm'],
5158
- 'image/jpx': ['jpx', 'jpf'],
5159
- 'image/jxl': ['jxl'],
5160
- 'image/jxr': ['jxr'],
5161
- 'image/jxra': ['jxra'],
5162
- 'image/jxrs': ['jxrs'],
5163
- 'image/jxs': ['jxs'],
5164
- 'image/jxsc': ['jxsc'],
5165
- 'image/jxsi': ['jxsi'],
5166
- 'image/jxss': ['jxss'],
5167
- 'image/ktx': ['ktx'],
5168
- 'image/ktx2': ['ktx2'],
5169
- 'image/pjpeg': ['jfif'],
5170
- 'image/png': ['png'],
5171
- 'image/sgi': ['sgi'],
5172
- 'image/svg+xml': ['svg', 'svgz'],
5173
- 'image/t38': ['t38'],
5174
- 'image/tiff': ['tif', 'tiff'],
5175
- 'image/tiff-fx': ['tfx'],
5176
- 'image/webp': ['webp'],
5177
- 'image/wmf': ['wmf'],
5178
- 'message/disposition-notification': ['disposition-notification'],
5179
- 'message/global': ['u8msg'],
5180
- 'message/global-delivery-status': ['u8dsn'],
5181
- 'message/global-disposition-notification': ['u8mdn'],
5182
- 'message/global-headers': ['u8hdr'],
5183
- 'message/rfc822': ['eml', 'mime', 'mht', 'mhtml'],
5184
- 'model/3mf': ['3mf'],
5185
- 'model/gltf+json': ['gltf'],
5186
- 'model/gltf-binary': ['glb'],
5187
- 'model/iges': ['igs', 'iges'],
5188
- 'model/jt': ['jt'],
5189
- 'model/mesh': ['msh', 'mesh', 'silo'],
5190
- 'model/mtl': ['mtl'],
5191
- 'model/obj': ['obj'],
5192
- 'model/prc': ['prc'],
5193
- 'model/step': ['step', 'stp', 'stpnc', 'p21', '210'],
5194
- 'model/step+xml': ['stpx'],
5195
- 'model/step+zip': ['stpz'],
5196
- 'model/step-xml+zip': ['stpxz'],
5197
- 'model/stl': ['stl'],
5198
- 'model/u3d': ['u3d'],
5199
- 'model/vrml': ['wrl', 'vrml'],
5200
- 'model/x3d+binary': ['*x3db', 'x3dbz'],
5201
- 'model/x3d+fastinfoset': ['x3db'],
5202
- 'model/x3d+vrml': ['*x3dv', 'x3dvz'],
5203
- 'model/x3d+xml': ['x3d', 'x3dz'],
5204
- 'model/x3d-vrml': ['x3dv'],
5205
- 'text/cache-manifest': ['appcache', 'manifest'],
5206
- 'text/calendar': ['ics', 'ifb'],
5207
- 'text/coffeescript': ['coffee', 'litcoffee'],
5208
- 'text/css': ['css'],
5209
- 'text/csv': ['csv'],
5210
- 'text/html': ['html', 'htm', 'shtml'],
5211
- 'text/jade': ['jade'],
5212
- 'text/javascript': ['js', 'mjs'],
5213
- 'text/jsx': ['jsx'],
5214
- 'text/less': ['less'],
5215
- 'text/markdown': ['md', 'markdown'],
5216
- 'text/mathml': ['mml'],
5217
- 'text/mdx': ['mdx'],
5218
- 'text/n3': ['n3'],
5219
- 'text/plain': ['txt', 'text', 'conf', 'def', 'list', 'log', 'in', 'ini'],
5220
- 'text/richtext': ['rtx'],
5221
- 'text/rtf': ['*rtf'],
5222
- 'text/sgml': ['sgml', 'sgm'],
5223
- 'text/shex': ['shex'],
5224
- 'text/slim': ['slim', 'slm'],
5225
- 'text/spdx': ['spdx'],
5226
- 'text/stylus': ['stylus', 'styl'],
5227
- 'text/tab-separated-values': ['tsv'],
5228
- 'text/troff': ['t', 'tr', 'roff', 'man', 'me', 'ms'],
5229
- 'text/turtle': ['ttl'],
5230
- 'text/uri-list': ['uri', 'uris', 'urls'],
5231
- 'text/vcard': ['vcard'],
5232
- 'text/vtt': ['vtt'],
5233
- 'text/wgsl': ['wgsl'],
5234
- 'text/xml': ['*xml'],
5235
- 'text/yaml': ['yaml', 'yml'],
5236
- 'video/3gpp': ['3gp', '3gpp'],
5237
- 'video/3gpp2': ['3g2'],
5238
- 'video/h261': ['h261'],
5239
- 'video/h263': ['h263'],
5240
- 'video/h264': ['h264'],
5241
- 'video/iso.segment': ['m4s'],
5242
- 'video/jpeg': ['jpgv'],
5243
- 'video/jpm': ['*jpm', '*jpgm'],
5244
- 'video/mj2': ['mj2', 'mjp2'],
5245
- 'video/mp2t': ['ts', 'm2t', 'm2ts', 'mts'],
5246
- 'video/mp4': ['mp4', 'mp4v', 'mpg4'],
5247
- 'video/mpeg': ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v'],
5248
- 'video/ogg': ['ogv'],
5249
- 'video/quicktime': ['qt', 'mov'],
5250
- 'video/webm': ['webm'],
5251
- };
5252
- Object.freeze(types);
5253
-
5254
- var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
5255
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5256
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5257
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5258
- };
5259
- var _Mime_extensionToType, _Mime_typeToExtension, _Mime_typeToExtensions;
5260
- class Mime {
5261
- constructor(...args) {
5262
- _Mime_extensionToType.set(this, new Map());
5263
- _Mime_typeToExtension.set(this, new Map());
5264
- _Mime_typeToExtensions.set(this, new Map());
5265
- for (const arg of args) {
5266
- this.define(arg);
5267
- }
5268
- }
5269
- define(typeMap, force = false) {
5270
- for (let [type, extensions] of Object.entries(typeMap)) {
5271
- type = type.toLowerCase();
5272
- extensions = extensions.map((ext) => ext.toLowerCase());
5273
- if (!__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").has(type)) {
5274
- __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, new Set());
5275
- }
5276
- const allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
5277
- let first = true;
5278
- for (let extension of extensions) {
5279
- const starred = extension.startsWith('*');
5280
- extension = starred ? extension.slice(1) : extension;
5281
- allExtensions?.add(extension);
5282
- if (first) {
5283
- __classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension);
5284
- }
5285
- first = false;
5286
- if (starred)
5287
- continue;
5288
- const currentType = __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(extension);
5289
- if (currentType && currentType != type && !force) {
5290
- throw new Error(`"${type} -> ${extension}" conflicts with "${currentType} -> ${extension}". Pass \`force=true\` to override this definition.`);
5291
- }
5292
- __classPrivateFieldGet(this, _Mime_extensionToType, "f").set(extension, type);
5293
- }
5294
- }
5295
- return this;
5296
- }
5297
- getType(path) {
5298
- if (typeof path !== 'string')
5299
- return null;
5300
- const last = path.replace(/^.*[/\\]/s, '').toLowerCase();
5301
- const ext = last.replace(/^.*\./s, '').toLowerCase();
5302
- const hasPath = last.length < path.length;
5303
- const hasDot = ext.length < last.length - 1;
5304
- if (!hasDot && hasPath)
5305
- return null;
5306
- return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
5307
- }
5308
- getExtension(type) {
5309
- if (typeof type !== 'string')
5310
- return null;
5311
- type = type?.split?.(';')[0];
5312
- return ((type && __classPrivateFieldGet(this, _Mime_typeToExtension, "f").get(type.trim().toLowerCase())) ?? null);
5313
- }
5314
- getAllExtensions(type) {
5315
- if (typeof type !== 'string')
5316
- return null;
5317
- return __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type.toLowerCase()) ?? null;
5318
- }
5319
- _freeze() {
5320
- this.define = () => {
5321
- throw new Error('define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances');
5322
- };
5323
- Object.freeze(this);
5324
- for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) {
5325
- Object.freeze(extensions);
5326
- }
5327
- return this;
5328
- }
5329
- _getTestState() {
5330
- return {
5331
- types: __classPrivateFieldGet(this, _Mime_extensionToType, "f"),
5332
- extensions: __classPrivateFieldGet(this, _Mime_typeToExtension, "f"),
5333
- };
5334
- }
5335
- }
5336
- _Mime_extensionToType = new WeakMap(), _Mime_typeToExtension = new WeakMap(), _Mime_typeToExtensions = new WeakMap();
5337
-
5338
- new Mime(types, types$1)._freeze();
5339
-
5340
- function Dialog($$payload, $$props) {
5341
- push();
5342
- let { children, dialog = void 0, $$slots, $$events, ...rest } = $$props;
5343
- $$payload.out.push(`<dialog${spread_attributes({ ...rest }, "svelte-1yuzruq")}>`);
5344
- children($$payload);
5345
- $$payload.out.push(`<!----></dialog>`);
5346
- bind_props($$props, { dialog });
5347
- pop();
5348
- }
5349
- function FormDialog($$payload, $$props) {
5350
- push();
5351
- let {
5352
- children,
5353
- dialog = void 0,
5354
- submitText = "Submit",
5355
- cancel = () => {
5356
- },
5357
- submit = (data) => Promise.resolve(),
5358
- pageMode = false,
5359
- submitDanger = false,
5360
- header,
5361
- footer,
5362
- $$slots,
5363
- $$events,
5364
- ...rest
5365
- } = $$props;
5366
- function onclose(e) {
5367
- e.preventDefault();
5368
- cancel();
5369
- }
5370
- function submitButton($$payload2) {
5371
- $$payload2.out.push(`<button type="submit"${attr_class(clsx(["submit", submitDanger && "danger"]))}>${escape_html(submitText)}</button>`);
5372
- }
5373
- let $$settled = true;
5374
- let $$inner_payload;
5375
- function $$render_inner($$payload2) {
5376
- Dialog($$payload2, spread_props([
5377
- { onclose },
5378
- rest,
5379
- {
5380
- get dialog() {
5381
- return dialog;
5382
- },
5383
- set dialog($$value) {
5384
- dialog = $$value;
5385
- $$settled = false;
5386
- },
5387
- children: ($$payload3) => {
5388
- header?.($$payload3);
5389
- $$payload3.out.push(`<!----> <form class="main" method="dialog">`);
5390
- {
5391
- $$payload3.out.push("<!--[!-->");
5392
- }
5393
- $$payload3.out.push(`<!--]--> `);
5394
- children($$payload3);
5395
- $$payload3.out.push(`<!----> `);
5396
- if (pageMode) {
5397
- $$payload3.out.push("<!--[-->");
5398
- submitButton($$payload3);
5399
- } else {
5400
- $$payload3.out.push("<!--[!-->");
5401
- $$payload3.out.push(`<div class="actions svelte-p6pltw"><button type="button">Cancel</button> `);
5402
- submitButton($$payload3);
5403
- $$payload3.out.push(`<!----></div>`);
5404
- }
5405
- $$payload3.out.push(`<!--]--></form> `);
5406
- footer?.($$payload3);
5407
- $$payload3.out.push(`<!---->`);
5408
- },
5409
- $$slots: { default: true }
5410
- }
5411
- ]));
5412
- }
5413
- do {
5414
- $$settled = true;
5415
- $$inner_payload = copy_payload($$payload);
5416
- $$render_inner($$inner_payload);
5417
- } while (!$$settled);
5418
- assign_payload($$payload, $$inner_payload);
5419
- bind_props($$props, { dialog });
5420
- pop();
5421
- }
5422
- let prefix = "/api/";
5423
- async function fetchAPI(method, endpoint, data, ...params) {
5424
- const options = {
5425
- method,
5426
- headers: {
5427
- "Content-Type": "application/json",
5428
- Accept: "application/json"
5429
- }
5430
- };
5431
- if (method !== "GET" && method !== "HEAD")
5432
- options.body = JSON.stringify(data);
5433
- const parts = [];
5434
- for (const part of endpoint.split("/")) {
5435
- if (!part.startsWith(":")) {
5436
- parts.push(part);
5437
- continue;
5438
- }
5439
- const value = params.shift();
5440
- if (!value)
5441
- throw new Error(`Missing parameter "${part.slice(1)}"`);
5442
- parts.push(value);
5443
- }
5444
- const response = await fetch(prefix + parts.join("/"), options);
5445
- if (!response.headers.get("Content-Type")?.includes("application/json")) {
5446
- throw new Error(`Unexpected response type: ${response.headers.get("Content-Type")}`);
5447
- }
5448
- const json = await response.json().catch(() => ({ message: "Unknown server error (invalid JSON response)" }));
5449
- if (!response.ok)
5450
- throw new Error(json.message);
5451
- return json;
5452
- }
5453
- var Permission;
5454
- (function(Permission2) {
5455
- Permission2[Permission2["None"] = 0] = "None";
5456
- Permission2[Permission2["Read"] = 1] = "Read";
5457
- Permission2[Permission2["Comment"] = 2] = "Comment";
5458
- Permission2[Permission2["Edit"] = 3] = "Edit";
5459
- Permission2[Permission2["Manage"] = 5] = "Manage";
5460
- })(Permission || (Permission = {}));
5461
- ({
5462
- [Permission.None]: "No Permissions",
5463
- [Permission.Read]: "Reader",
5464
- [Permission.Comment]: "Commenter",
5465
- [Permission.Edit]: "Editor",
5466
- [Permission.Manage]: "Manager"
5467
- });
5468
- const transports = ["ble", "cable", "hybrid", "internal", "nfc", "smart-card", "usb"];
5469
- const authenticatorAttachment = literal(["platform", "cross-platform"]).optional();
5470
- const PasskeyRegistration = object({
5471
- id: string(),
5472
- rawId: string(),
5473
- response: object({
5474
- clientDataJSON: string(),
5475
- attestationObject: string(),
5476
- authenticatorData: string().optional(),
5477
- transports: array(_enum(transports)).optional(),
5478
- publicKeyAlgorithm: number().optional(),
5479
- publicKey: string().optional()
5480
- }),
5481
- authenticatorAttachment,
5482
- clientExtensionResults: record(any(), any()),
5483
- type: literal("public-key")
5484
- });
5485
- object({
5486
- id: string(),
5487
- rawId: string(),
5488
- response: object({
5489
- clientDataJSON: string(),
5490
- authenticatorData: string(),
5491
- signature: string(),
5492
- userHandle: string().optional()
5493
- }),
5494
- authenticatorAttachment,
5495
- clientExtensionResults: record(any(), any()),
5496
- type: literal("public-key")
5497
- });
5498
- object({
5499
- name: string().min(1).max(100),
5500
- email: email(),
5501
- userId: uuid(),
5502
- response: PasskeyRegistration
5503
- });
5504
- object({ name: string() }).partial();
5505
- object({ type: literal(["login", "action"]) });
5506
- object({
5507
- id: array(uuid()).optional(),
5508
- confirm_all: boolean().optional()
5509
- });
5510
- const User = object({
5511
- id: uuid(),
5512
- name: string().min(1, "Name is required").max(255, "Name is too long"),
5513
- email: email(),
5514
- emailVerified: date().nullable().optional(),
5515
- image: url().nullable().optional(),
5516
- preferences: record(string(), any()),
5517
- roles: array(string()),
5518
- registeredAt: date()
5519
- });
5520
- const UserChangeable = User.pick({
5521
- name: true,
5522
- email: true,
5523
- image: true,
5524
- preferences: true
5525
- }).partial();
5526
- function getUserImage(user) {
5527
- if (user.image)
5528
- return user.image;
5529
- user.name ??= "\0";
5530
- let color = user.name.charCodeAt(0);
5531
- for (let i = 1; i < user.name.length; i++) {
5532
- color *= user.name.charCodeAt(i);
5533
- }
5534
- color &= 12566463;
5535
- const r = color >> 16 & 255;
5536
- const g = color >> 8 & 255;
5537
- const b = color & 255;
5538
- return `data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" style="background-color:rgb(${r},${g},${b});display:flex;align-items:center;justify-content:center;">
5539
- <text x="23" y="28" style="font-family:sans-serif;font-weight:bold;" fill="white">${user.name.replaceAll(/\W/g, "")[0]}</text>
5540
- </svg>`.replaceAll(/[\t\n]/g, "");
5541
- }
5542
- async function login(userId) {
5543
- const options = await fetchAPI("OPTIONS", "users/:id/auth", { type: "login" }, userId);
5544
- const response = await startAuthentication({ optionsJSON: options });
5545
- return await fetchAPI("POST", "users/:id/auth", response, userId);
5546
- }
5547
- async function elevate(userId) {
5548
- const options = await fetchAPI("OPTIONS", "users/:id/auth", { type: "action" }, userId);
5549
- const response = await startAuthentication({ optionsJSON: options });
5550
- await fetchAPI("POST", "users/:id/auth", response, userId);
5551
- }
5552
- async function loginByEmail(email) {
5553
- const { id: userId } = await fetchAPI("POST", "user_id", {
5554
- using: "email",
5555
- value: email
5556
- });
5557
- return await login(userId);
5558
- }
5559
- async function getCurrentSession() {
5560
- const result = await fetchAPI("GET", "session");
5561
- result.created = new Date(result.created);
5562
- result.expires = new Date(result.expires);
5563
- return result;
5564
- }
5565
- async function getSessions(userId) {
5566
- _checkId(userId);
5567
- const result = await fetchAPI("GET", "users/:id/sessions", {}, userId);
5568
- for (const session of result) {
5569
- session.created = new Date(session.created);
5570
- session.expires = new Date(session.expires);
5571
- }
5572
- return result;
5573
- }
5574
- async function logout(userId, ...sessionId) {
5575
- _checkId(userId);
5576
- const result = await fetchAPI("DELETE", "users/:id/sessions", { id: sessionId }, userId);
5577
- for (const session of result) {
5578
- session.created = new Date(session.created);
5579
- session.expires = new Date(session.expires);
5580
- }
5581
- return result;
5582
- }
5583
- async function logoutAll(userId) {
5584
- _checkId(userId);
5585
- await elevate(userId);
5586
- const result = await fetchAPI("DELETE", "users/:id/sessions", { confirm_all: true }, userId);
5587
- for (const session of result) {
5588
- session.created = new Date(session.created);
5589
- session.expires = new Date(session.expires);
5590
- }
5591
- return result;
5592
- }
5593
- async function logoutCurrentSession() {
5594
- return await fetchAPI("DELETE", "session");
5595
- }
5596
- async function register(_data) {
5597
- const data = object({ name: string(), email: email() }).parse(_data);
5598
- const { options, userId } = await fetchAPI("OPTIONS", "register", data);
5599
- const response = await startRegistration({ optionsJSON: options });
5600
- await fetchAPI("POST", "register", {
5601
- userId,
5602
- name: data.name,
5603
- email: data.email,
5604
- response
5605
- });
5606
- }
5607
- function _checkId(userId) {
5608
- try {
5609
- uuid().parse(userId);
5610
- } catch (e) {
5611
- throw prettifyError(e);
5612
- }
5613
- }
5614
- async function updateUser(userId, data) {
5615
- _checkId(userId);
5616
- const body = await UserChangeable.parseAsync(data).catch((e) => {
5617
- throw prettifyError(e);
5618
- });
5619
- const result = await fetchAPI("PATCH", "users/:id", body, userId);
5620
- result.registeredAt = new Date(result.registeredAt);
5621
- if (result.emailVerified)
5622
- result.emailVerified = new Date(result.emailVerified);
5623
- return result;
5624
- }
5625
- async function deleteUser(userId) {
5626
- _checkId(userId);
5627
- const options = await fetchAPI("OPTIONS", "users/:id/auth", { type: "action" }, userId);
5628
- const response = await startAuthentication({ optionsJSON: options });
5629
- await fetchAPI("POST", "users/:id/auth", response, userId);
5630
- const result = await fetchAPI("DELETE", "users/:id", response, userId);
5631
- result.registeredAt = new Date(result.registeredAt);
5632
- result.emailVerified = new Date(result.emailVerified);
5633
- return result;
5634
- }
5635
- async function emailVerificationEnabled(userId) {
5636
- _checkId(userId);
5637
- const { enabled } = await fetchAPI("OPTIONS", "users/:id/verify_email", {}, userId);
5638
- return enabled;
5639
- }
5640
- async function getPasskeys(userId) {
5641
- _checkId(userId);
5642
- const result = await fetchAPI("GET", "users/:id/passkeys", {}, userId);
5643
- for (const passkey of result) {
5644
- passkey.createdAt = new Date(passkey.createdAt);
5645
- }
5646
- return result;
5647
- }
5648
- async function updatePasskey(passkeyId, data) {
5649
- return await fetchAPI("PATCH", "passkeys/:id", data, passkeyId);
5650
- }
5651
- async function deletePasskey(passkeyId) {
5652
- return await fetchAPI("DELETE", "passkeys/:id", {}, passkeyId);
5653
- }
5654
-
5655
- export { FormDialog as F, getPasskeys as a, getSessions as b, getUserImage as c, deleteUser as d, emailVerificationEnabled as e, deletePasskey as f, getCurrentSession as g, logoutAll as h, updateUser as i, loginByEmail as j, logoutCurrentSession as k, logout as l, register as r, updatePasskey as u };
5656
- //# sourceMappingURL=user-DW-tjDe0.js.map
3705
+ export { $ZodUnknown as $, _unknown as _, _tuple as a, _array as b, $ZodArray as c, $ZodTuple as d, parseAsync$1 as e, any as f, array as g, _enum as h, email as i, boolean as j, custom as k, literal as l, looseObject as m, number as n, object as o, parse$1 as p, partialRecord as q, record as r, string as s, prettifyError as t, uuid as u, date as v, url as w };
3706
+ //# sourceMappingURL=schemas-C2VqNPFY.js.map