DJAKOUA KWANKAM BRAYAN STEVE commited on
Commit
c8a3cfa
·
1 Parent(s): 26c6a7e

chore: remove tracked node_modules from git index and update gitignore

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitignore +1 -0
  2. node_modules/.bin/highlight +0 -2
  3. node_modules/.bin/marked +0 -15
  4. node_modules/.package-lock.json +0 -1220
  5. node_modules/@colors/colors/LICENSE +0 -26
  6. node_modules/@colors/colors/README.md +0 -219
  7. node_modules/@colors/colors/examples/normal-usage.js +0 -83
  8. node_modules/@colors/colors/examples/safe-string.js +0 -80
  9. node_modules/@colors/colors/index.d.ts +0 -136
  10. node_modules/@colors/colors/lib/colors.js +0 -211
  11. node_modules/@colors/colors/lib/custom/trap.js +0 -46
  12. node_modules/@colors/colors/lib/custom/zalgo.js +0 -110
  13. node_modules/@colors/colors/lib/extendStringPrototype.js +0 -110
  14. node_modules/@colors/colors/lib/index.js +0 -13
  15. node_modules/@colors/colors/lib/maps/america.js +0 -10
  16. node_modules/@colors/colors/lib/maps/rainbow.js +0 -12
  17. node_modules/@colors/colors/lib/maps/random.js +0 -11
  18. node_modules/@colors/colors/lib/maps/zebra.js +0 -5
  19. node_modules/@colors/colors/lib/styles.js +0 -95
  20. node_modules/@colors/colors/lib/system/has-flag.js +0 -35
  21. node_modules/@colors/colors/lib/system/supports-colors.js +0 -151
  22. node_modules/@colors/colors/package.json +0 -45
  23. node_modules/@colors/colors/safe.d.ts +0 -48
  24. node_modules/@colors/colors/safe.js +0 -10
  25. node_modules/@colors/colors/themes/generic-logging.js +0 -12
  26. node_modules/@gradio/client/CHANGELOG.md +0 -1029
  27. node_modules/@gradio/client/LICENSE +0 -201
  28. node_modules/@gradio/client/README.md +0 -448
  29. node_modules/@gradio/client/dist/__vite-browser-external-DYxpcVy9.js +0 -4
  30. node_modules/@gradio/client/dist/browser.js +0 -1960
  31. node_modules/@gradio/client/dist/client.d.ts +0 -78
  32. node_modules/@gradio/client/dist/client.d.ts.map +0 -1
  33. node_modules/@gradio/client/dist/constants.d.ts +0 -34
  34. node_modules/@gradio/client/dist/constants.d.ts.map +0 -1
  35. node_modules/@gradio/client/dist/helpers/api_info.d.ts +0 -48
  36. node_modules/@gradio/client/dist/helpers/api_info.d.ts.map +0 -1
  37. node_modules/@gradio/client/dist/helpers/data.d.ts +0 -21
  38. node_modules/@gradio/client/dist/helpers/data.d.ts.map +0 -1
  39. node_modules/@gradio/client/dist/helpers/init_helpers.d.ts +0 -25
  40. node_modules/@gradio/client/dist/helpers/init_helpers.d.ts.map +0 -1
  41. node_modules/@gradio/client/dist/helpers/spaces.d.ts +0 -8
  42. node_modules/@gradio/client/dist/helpers/spaces.d.ts.map +0 -1
  43. node_modules/@gradio/client/dist/helpers/zerogpu.d.ts +0 -3
  44. node_modules/@gradio/client/dist/helpers/zerogpu.d.ts.map +0 -1
  45. node_modules/@gradio/client/dist/index.d.ts +0 -11
  46. node_modules/@gradio/client/dist/index.d.ts.map +0 -1
  47. node_modules/@gradio/client/dist/index.js +0 -2554
  48. node_modules/@gradio/client/dist/types.d.ts +0 -351
  49. node_modules/@gradio/client/dist/types.d.ts.map +0 -1
  50. node_modules/@gradio/client/dist/upload.d.ts +0 -29
.gitignore CHANGED
@@ -7,3 +7,4 @@ venv/
7
  __pycache__/
8
  **/logo.png
9
  **/.env
 
 
7
  __pycache__/
8
  **/logo.png
9
  **/.env
10
+ node_modules/
node_modules/.bin/highlight DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- require('../dist/cli');
 
 
 
node_modules/.bin/marked DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Marked CLI
5
- * Copyright (c) 2011-2013, Christopher Jeffrey (MIT License)
6
- */
7
-
8
- import { main } from './main.js';
9
-
10
- /**
11
- * Expose / Entry Point
12
- */
13
-
14
- process.title = 'marked';
15
- main(process);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/.package-lock.json DELETED
@@ -1,1220 +0,0 @@
1
- {
2
- "name": "cypher-coder",
3
- "version": "1.0.0",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "node_modules/@colors/colors": {
8
- "version": "1.5.0",
9
- "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
10
- "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
11
- "license": "MIT",
12
- "optional": true,
13
- "engines": {
14
- "node": ">=0.1.90"
15
- }
16
- },
17
- "node_modules/@gradio/client": {
18
- "version": "2.2.1",
19
- "resolved": "https://registry.npmjs.org/@gradio/client/-/client-2.2.1.tgz",
20
- "integrity": "sha512-Tbp2zPBCjlhFTA9PLyYpqyk7zJodOf03uk/Cn3sywVz+85OerqG6Qpr6jr0Ee+zRU7D1OoqLy3S2YVEl+QtvQw==",
21
- "license": "ISC",
22
- "dependencies": {
23
- "fetch-event-stream": "^0.1.5"
24
- },
25
- "engines": {
26
- "node": ">=18.0.0"
27
- }
28
- },
29
- "node_modules/@huggingface/inference": {
30
- "version": "2.8.1",
31
- "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.8.1.tgz",
32
- "integrity": "sha512-EfsNtY9OR6JCNaUa5bZu2mrs48iqeTz0Gutwf+fU0Kypx33xFQB4DKMhp8u4Ee6qVbLbNWvTHuWwlppLQl4p4Q==",
33
- "license": "MIT",
34
- "dependencies": {
35
- "@huggingface/tasks": "^0.12.9"
36
- },
37
- "engines": {
38
- "node": ">=18"
39
- }
40
- },
41
- "node_modules/@huggingface/tasks": {
42
- "version": "0.12.30",
43
- "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.12.30.tgz",
44
- "integrity": "sha512-A1ITdxbEzx9L8wKR8pF7swyrTLxWNDFIGDLUWInxvks2ruQ8PLRBZe8r0EcjC3CDdtlj9jV1V4cgV35K/iy3GQ==",
45
- "license": "MIT"
46
- },
47
- "node_modules/@inquirer/external-editor": {
48
- "version": "1.0.3",
49
- "resolved": "https://registry.npmjs.org/@inquirer/external-editor/-/external-editor-1.0.3.tgz",
50
- "integrity": "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA==",
51
- "license": "MIT",
52
- "dependencies": {
53
- "chardet": "^2.1.1",
54
- "iconv-lite": "^0.7.0"
55
- },
56
- "engines": {
57
- "node": ">=18"
58
- },
59
- "peerDependencies": {
60
- "@types/node": ">=18"
61
- },
62
- "peerDependenciesMeta": {
63
- "@types/node": {
64
- "optional": true
65
- }
66
- }
67
- },
68
- "node_modules/@inquirer/figures": {
69
- "version": "1.0.15",
70
- "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.15.tgz",
71
- "integrity": "sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g==",
72
- "license": "MIT",
73
- "engines": {
74
- "node": ">=18"
75
- }
76
- },
77
- "node_modules/@sindresorhus/is": {
78
- "version": "4.6.0",
79
- "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",
80
- "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==",
81
- "license": "MIT",
82
- "engines": {
83
- "node": ">=10"
84
- },
85
- "funding": {
86
- "url": "https://github.com/sindresorhus/is?sponsor=1"
87
- }
88
- },
89
- "node_modules/ansi-escapes": {
90
- "version": "4.3.2",
91
- "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz",
92
- "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
93
- "license": "MIT",
94
- "dependencies": {
95
- "type-fest": "^0.21.3"
96
- },
97
- "engines": {
98
- "node": ">=8"
99
- },
100
- "funding": {
101
- "url": "https://github.com/sponsors/sindresorhus"
102
- }
103
- },
104
- "node_modules/ansi-regex": {
105
- "version": "5.0.1",
106
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
107
- "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
108
- "license": "MIT",
109
- "engines": {
110
- "node": ">=8"
111
- }
112
- },
113
- "node_modules/ansi-styles": {
114
- "version": "4.3.0",
115
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
116
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
117
- "license": "MIT",
118
- "dependencies": {
119
- "color-convert": "^2.0.1"
120
- },
121
- "engines": {
122
- "node": ">=8"
123
- },
124
- "funding": {
125
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
126
- }
127
- },
128
- "node_modules/any-promise": {
129
- "version": "1.3.0",
130
- "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
131
- "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",
132
- "license": "MIT"
133
- },
134
- "node_modules/base64-js": {
135
- "version": "1.5.1",
136
- "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
137
- "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
138
- "funding": [
139
- {
140
- "type": "github",
141
- "url": "https://github.com/sponsors/feross"
142
- },
143
- {
144
- "type": "patreon",
145
- "url": "https://www.patreon.com/feross"
146
- },
147
- {
148
- "type": "consulting",
149
- "url": "https://feross.org/support"
150
- }
151
- ],
152
- "license": "MIT"
153
- },
154
- "node_modules/bl": {
155
- "version": "5.1.0",
156
- "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz",
157
- "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==",
158
- "license": "MIT",
159
- "dependencies": {
160
- "buffer": "^6.0.3",
161
- "inherits": "^2.0.4",
162
- "readable-stream": "^3.4.0"
163
- }
164
- },
165
- "node_modules/buffer": {
166
- "version": "6.0.3",
167
- "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
168
- "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
169
- "funding": [
170
- {
171
- "type": "github",
172
- "url": "https://github.com/sponsors/feross"
173
- },
174
- {
175
- "type": "patreon",
176
- "url": "https://www.patreon.com/feross"
177
- },
178
- {
179
- "type": "consulting",
180
- "url": "https://feross.org/support"
181
- }
182
- ],
183
- "license": "MIT",
184
- "dependencies": {
185
- "base64-js": "^1.3.1",
186
- "ieee754": "^1.2.1"
187
- }
188
- },
189
- "node_modules/chalk": {
190
- "version": "5.6.2",
191
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
192
- "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
193
- "license": "MIT",
194
- "engines": {
195
- "node": "^12.17.0 || ^14.13 || >=16.0.0"
196
- },
197
- "funding": {
198
- "url": "https://github.com/chalk/chalk?sponsor=1"
199
- }
200
- },
201
- "node_modules/char-regex": {
202
- "version": "1.0.2",
203
- "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz",
204
- "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==",
205
- "license": "MIT",
206
- "engines": {
207
- "node": ">=10"
208
- }
209
- },
210
- "node_modules/chardet": {
211
- "version": "2.1.1",
212
- "resolved": "https://registry.npmjs.org/chardet/-/chardet-2.1.1.tgz",
213
- "integrity": "sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==",
214
- "license": "MIT"
215
- },
216
- "node_modules/cli-cursor": {
217
- "version": "4.0.0",
218
- "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz",
219
- "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==",
220
- "license": "MIT",
221
- "dependencies": {
222
- "restore-cursor": "^4.0.0"
223
- },
224
- "engines": {
225
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
226
- },
227
- "funding": {
228
- "url": "https://github.com/sponsors/sindresorhus"
229
- }
230
- },
231
- "node_modules/cli-highlight": {
232
- "version": "2.1.11",
233
- "resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.11.tgz",
234
- "integrity": "sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==",
235
- "license": "ISC",
236
- "dependencies": {
237
- "chalk": "^4.0.0",
238
- "highlight.js": "^10.7.1",
239
- "mz": "^2.4.0",
240
- "parse5": "^5.1.1",
241
- "parse5-htmlparser2-tree-adapter": "^6.0.0",
242
- "yargs": "^16.0.0"
243
- },
244
- "bin": {
245
- "highlight": "bin/highlight"
246
- },
247
- "engines": {
248
- "node": ">=8.0.0",
249
- "npm": ">=5.0.0"
250
- }
251
- },
252
- "node_modules/cli-highlight/node_modules/chalk": {
253
- "version": "4.1.2",
254
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
255
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
256
- "license": "MIT",
257
- "dependencies": {
258
- "ansi-styles": "^4.1.0",
259
- "supports-color": "^7.1.0"
260
- },
261
- "engines": {
262
- "node": ">=10"
263
- },
264
- "funding": {
265
- "url": "https://github.com/chalk/chalk?sponsor=1"
266
- }
267
- },
268
- "node_modules/cli-spinners": {
269
- "version": "2.9.2",
270
- "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz",
271
- "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==",
272
- "license": "MIT",
273
- "engines": {
274
- "node": ">=6"
275
- },
276
- "funding": {
277
- "url": "https://github.com/sponsors/sindresorhus"
278
- }
279
- },
280
- "node_modules/cli-table3": {
281
- "version": "0.6.5",
282
- "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz",
283
- "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==",
284
- "license": "MIT",
285
- "dependencies": {
286
- "string-width": "^4.2.0"
287
- },
288
- "engines": {
289
- "node": "10.* || >= 12.*"
290
- },
291
- "optionalDependencies": {
292
- "@colors/colors": "1.5.0"
293
- }
294
- },
295
- "node_modules/cli-width": {
296
- "version": "4.1.0",
297
- "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz",
298
- "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==",
299
- "license": "ISC",
300
- "engines": {
301
- "node": ">= 12"
302
- }
303
- },
304
- "node_modules/cliui": {
305
- "version": "7.0.4",
306
- "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
307
- "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
308
- "license": "ISC",
309
- "dependencies": {
310
- "string-width": "^4.2.0",
311
- "strip-ansi": "^6.0.0",
312
- "wrap-ansi": "^7.0.0"
313
- }
314
- },
315
- "node_modules/cliui/node_modules/wrap-ansi": {
316
- "version": "7.0.0",
317
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
318
- "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
319
- "license": "MIT",
320
- "dependencies": {
321
- "ansi-styles": "^4.0.0",
322
- "string-width": "^4.1.0",
323
- "strip-ansi": "^6.0.0"
324
- },
325
- "engines": {
326
- "node": ">=10"
327
- },
328
- "funding": {
329
- "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
330
- }
331
- },
332
- "node_modules/clone": {
333
- "version": "1.0.4",
334
- "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
335
- "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==",
336
- "license": "MIT",
337
- "engines": {
338
- "node": ">=0.8"
339
- }
340
- },
341
- "node_modules/color-convert": {
342
- "version": "2.0.1",
343
- "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
344
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
345
- "license": "MIT",
346
- "dependencies": {
347
- "color-name": "~1.1.4"
348
- },
349
- "engines": {
350
- "node": ">=7.0.0"
351
- }
352
- },
353
- "node_modules/color-name": {
354
- "version": "1.1.4",
355
- "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
356
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
357
- "license": "MIT"
358
- },
359
- "node_modules/defaults": {
360
- "version": "1.0.4",
361
- "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz",
362
- "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==",
363
- "license": "MIT",
364
- "dependencies": {
365
- "clone": "^1.0.2"
366
- },
367
- "funding": {
368
- "url": "https://github.com/sponsors/sindresorhus"
369
- }
370
- },
371
- "node_modules/eastasianwidth": {
372
- "version": "0.2.0",
373
- "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
374
- "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
375
- "license": "MIT"
376
- },
377
- "node_modules/emoji-regex": {
378
- "version": "8.0.0",
379
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
380
- "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
381
- "license": "MIT"
382
- },
383
- "node_modules/emojilib": {
384
- "version": "2.4.0",
385
- "resolved": "https://registry.npmjs.org/emojilib/-/emojilib-2.4.0.tgz",
386
- "integrity": "sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==",
387
- "license": "MIT"
388
- },
389
- "node_modules/environment": {
390
- "version": "1.1.0",
391
- "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",
392
- "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==",
393
- "license": "MIT",
394
- "engines": {
395
- "node": ">=18"
396
- },
397
- "funding": {
398
- "url": "https://github.com/sponsors/sindresorhus"
399
- }
400
- },
401
- "node_modules/escalade": {
402
- "version": "3.2.0",
403
- "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
404
- "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
405
- "license": "MIT",
406
- "engines": {
407
- "node": ">=6"
408
- }
409
- },
410
- "node_modules/fetch-event-stream": {
411
- "version": "0.1.6",
412
- "resolved": "https://registry.npmjs.org/fetch-event-stream/-/fetch-event-stream-0.1.6.tgz",
413
- "integrity": "sha512-GREtJ5HNikdU2AXtZ6E/5bk+aslMU6ie5mPG6H9nvsdDkkHQ6m5lHwmmmDTOBexok9hApQ7EprsXCdmz9ZC68w==",
414
- "license": "MIT"
415
- },
416
- "node_modules/get-caller-file": {
417
- "version": "2.0.5",
418
- "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
419
- "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
420
- "license": "ISC",
421
- "engines": {
422
- "node": "6.* || 8.* || >= 10.*"
423
- }
424
- },
425
- "node_modules/has-flag": {
426
- "version": "4.0.0",
427
- "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
428
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
429
- "license": "MIT",
430
- "engines": {
431
- "node": ">=8"
432
- }
433
- },
434
- "node_modules/highlight.js": {
435
- "version": "10.7.3",
436
- "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
437
- "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==",
438
- "license": "BSD-3-Clause",
439
- "engines": {
440
- "node": "*"
441
- }
442
- },
443
- "node_modules/iconv-lite": {
444
- "version": "0.7.2",
445
- "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
446
- "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
447
- "license": "MIT",
448
- "dependencies": {
449
- "safer-buffer": ">= 2.1.2 < 3.0.0"
450
- },
451
- "engines": {
452
- "node": ">=0.10.0"
453
- },
454
- "funding": {
455
- "type": "opencollective",
456
- "url": "https://opencollective.com/express"
457
- }
458
- },
459
- "node_modules/ieee754": {
460
- "version": "1.2.1",
461
- "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
462
- "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
463
- "funding": [
464
- {
465
- "type": "github",
466
- "url": "https://github.com/sponsors/feross"
467
- },
468
- {
469
- "type": "patreon",
470
- "url": "https://www.patreon.com/feross"
471
- },
472
- {
473
- "type": "consulting",
474
- "url": "https://feross.org/support"
475
- }
476
- ],
477
- "license": "BSD-3-Clause"
478
- },
479
- "node_modules/inherits": {
480
- "version": "2.0.4",
481
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
482
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
483
- "license": "ISC"
484
- },
485
- "node_modules/inquirer": {
486
- "version": "9.3.8",
487
- "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.3.8.tgz",
488
- "integrity": "sha512-pFGGdaHrmRKMh4WoDDSowddgjT1Vkl90atobmTeSmcPGdYiwikch/m/Ef5wRaiamHejtw0cUUMMerzDUXCci2w==",
489
- "license": "MIT",
490
- "dependencies": {
491
- "@inquirer/external-editor": "^1.0.2",
492
- "@inquirer/figures": "^1.0.3",
493
- "ansi-escapes": "^4.3.2",
494
- "cli-width": "^4.1.0",
495
- "mute-stream": "1.0.0",
496
- "ora": "^5.4.1",
497
- "run-async": "^3.0.0",
498
- "rxjs": "^7.8.1",
499
- "string-width": "^4.2.3",
500
- "strip-ansi": "^6.0.1",
501
- "wrap-ansi": "^6.2.0",
502
- "yoctocolors-cjs": "^2.1.2"
503
- },
504
- "engines": {
505
- "node": ">=18"
506
- }
507
- },
508
- "node_modules/inquirer/node_modules/bl": {
509
- "version": "4.1.0",
510
- "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
511
- "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
512
- "license": "MIT",
513
- "dependencies": {
514
- "buffer": "^5.5.0",
515
- "inherits": "^2.0.4",
516
- "readable-stream": "^3.4.0"
517
- }
518
- },
519
- "node_modules/inquirer/node_modules/buffer": {
520
- "version": "5.7.1",
521
- "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
522
- "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
523
- "funding": [
524
- {
525
- "type": "github",
526
- "url": "https://github.com/sponsors/feross"
527
- },
528
- {
529
- "type": "patreon",
530
- "url": "https://www.patreon.com/feross"
531
- },
532
- {
533
- "type": "consulting",
534
- "url": "https://feross.org/support"
535
- }
536
- ],
537
- "license": "MIT",
538
- "dependencies": {
539
- "base64-js": "^1.3.1",
540
- "ieee754": "^1.1.13"
541
- }
542
- },
543
- "node_modules/inquirer/node_modules/chalk": {
544
- "version": "4.1.2",
545
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
546
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
547
- "license": "MIT",
548
- "dependencies": {
549
- "ansi-styles": "^4.1.0",
550
- "supports-color": "^7.1.0"
551
- },
552
- "engines": {
553
- "node": ">=10"
554
- },
555
- "funding": {
556
- "url": "https://github.com/chalk/chalk?sponsor=1"
557
- }
558
- },
559
- "node_modules/inquirer/node_modules/cli-cursor": {
560
- "version": "3.1.0",
561
- "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
562
- "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
563
- "license": "MIT",
564
- "dependencies": {
565
- "restore-cursor": "^3.1.0"
566
- },
567
- "engines": {
568
- "node": ">=8"
569
- }
570
- },
571
- "node_modules/inquirer/node_modules/is-interactive": {
572
- "version": "1.0.0",
573
- "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",
574
- "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==",
575
- "license": "MIT",
576
- "engines": {
577
- "node": ">=8"
578
- }
579
- },
580
- "node_modules/inquirer/node_modules/is-unicode-supported": {
581
- "version": "0.1.0",
582
- "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
583
- "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
584
- "license": "MIT",
585
- "engines": {
586
- "node": ">=10"
587
- },
588
- "funding": {
589
- "url": "https://github.com/sponsors/sindresorhus"
590
- }
591
- },
592
- "node_modules/inquirer/node_modules/log-symbols": {
593
- "version": "4.1.0",
594
- "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
595
- "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
596
- "license": "MIT",
597
- "dependencies": {
598
- "chalk": "^4.1.0",
599
- "is-unicode-supported": "^0.1.0"
600
- },
601
- "engines": {
602
- "node": ">=10"
603
- },
604
- "funding": {
605
- "url": "https://github.com/sponsors/sindresorhus"
606
- }
607
- },
608
- "node_modules/inquirer/node_modules/ora": {
609
- "version": "5.4.1",
610
- "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz",
611
- "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==",
612
- "license": "MIT",
613
- "dependencies": {
614
- "bl": "^4.1.0",
615
- "chalk": "^4.1.0",
616
- "cli-cursor": "^3.1.0",
617
- "cli-spinners": "^2.5.0",
618
- "is-interactive": "^1.0.0",
619
- "is-unicode-supported": "^0.1.0",
620
- "log-symbols": "^4.1.0",
621
- "strip-ansi": "^6.0.0",
622
- "wcwidth": "^1.0.1"
623
- },
624
- "engines": {
625
- "node": ">=10"
626
- },
627
- "funding": {
628
- "url": "https://github.com/sponsors/sindresorhus"
629
- }
630
- },
631
- "node_modules/inquirer/node_modules/restore-cursor": {
632
- "version": "3.1.0",
633
- "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
634
- "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
635
- "license": "MIT",
636
- "dependencies": {
637
- "onetime": "^5.1.0",
638
- "signal-exit": "^3.0.2"
639
- },
640
- "engines": {
641
- "node": ">=8"
642
- }
643
- },
644
- "node_modules/is-fullwidth-code-point": {
645
- "version": "3.0.0",
646
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
647
- "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
648
- "license": "MIT",
649
- "engines": {
650
- "node": ">=8"
651
- }
652
- },
653
- "node_modules/is-interactive": {
654
- "version": "2.0.0",
655
- "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz",
656
- "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==",
657
- "license": "MIT",
658
- "engines": {
659
- "node": ">=12"
660
- },
661
- "funding": {
662
- "url": "https://github.com/sponsors/sindresorhus"
663
- }
664
- },
665
- "node_modules/is-unicode-supported": {
666
- "version": "1.3.0",
667
- "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz",
668
- "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==",
669
- "license": "MIT",
670
- "engines": {
671
- "node": ">=12"
672
- },
673
- "funding": {
674
- "url": "https://github.com/sponsors/sindresorhus"
675
- }
676
- },
677
- "node_modules/log-symbols": {
678
- "version": "5.1.0",
679
- "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz",
680
- "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==",
681
- "license": "MIT",
682
- "dependencies": {
683
- "chalk": "^5.0.0",
684
- "is-unicode-supported": "^1.1.0"
685
- },
686
- "engines": {
687
- "node": ">=12"
688
- },
689
- "funding": {
690
- "url": "https://github.com/sponsors/sindresorhus"
691
- }
692
- },
693
- "node_modules/marked": {
694
- "version": "15.0.12",
695
- "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.12.tgz",
696
- "integrity": "sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==",
697
- "license": "MIT",
698
- "bin": {
699
- "marked": "bin/marked.js"
700
- },
701
- "engines": {
702
- "node": ">= 18"
703
- }
704
- },
705
- "node_modules/marked-terminal": {
706
- "version": "7.3.0",
707
- "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-7.3.0.tgz",
708
- "integrity": "sha512-t4rBvPsHc57uE/2nJOLmMbZCQ4tgAccAED3ngXQqW6g+TxA488JzJ+FK3lQkzBQOI1mRV/r/Kq+1ZlJ4D0owQw==",
709
- "license": "MIT",
710
- "dependencies": {
711
- "ansi-escapes": "^7.0.0",
712
- "ansi-regex": "^6.1.0",
713
- "chalk": "^5.4.1",
714
- "cli-highlight": "^2.1.11",
715
- "cli-table3": "^0.6.5",
716
- "node-emoji": "^2.2.0",
717
- "supports-hyperlinks": "^3.1.0"
718
- },
719
- "engines": {
720
- "node": ">=16.0.0"
721
- },
722
- "peerDependencies": {
723
- "marked": ">=1 <16"
724
- }
725
- },
726
- "node_modules/marked-terminal/node_modules/ansi-escapes": {
727
- "version": "7.3.0",
728
- "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.3.0.tgz",
729
- "integrity": "sha512-BvU8nYgGQBxcmMuEeUEmNTvrMVjJNSH7RgW24vXexN4Ven6qCvy4TntnvlnwnMLTVlcRQQdbRY8NKnaIoeWDNg==",
730
- "license": "MIT",
731
- "dependencies": {
732
- "environment": "^1.0.0"
733
- },
734
- "engines": {
735
- "node": ">=18"
736
- },
737
- "funding": {
738
- "url": "https://github.com/sponsors/sindresorhus"
739
- }
740
- },
741
- "node_modules/marked-terminal/node_modules/ansi-regex": {
742
- "version": "6.2.2",
743
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
744
- "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
745
- "license": "MIT",
746
- "engines": {
747
- "node": ">=12"
748
- },
749
- "funding": {
750
- "url": "https://github.com/chalk/ansi-regex?sponsor=1"
751
- }
752
- },
753
- "node_modules/mimic-fn": {
754
- "version": "2.1.0",
755
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
756
- "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
757
- "license": "MIT",
758
- "engines": {
759
- "node": ">=6"
760
- }
761
- },
762
- "node_modules/mute-stream": {
763
- "version": "1.0.0",
764
- "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz",
765
- "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==",
766
- "license": "ISC",
767
- "engines": {
768
- "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
769
- }
770
- },
771
- "node_modules/mz": {
772
- "version": "2.7.0",
773
- "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
774
- "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
775
- "license": "MIT",
776
- "dependencies": {
777
- "any-promise": "^1.0.0",
778
- "object-assign": "^4.0.1",
779
- "thenify-all": "^1.0.0"
780
- }
781
- },
782
- "node_modules/node-emoji": {
783
- "version": "2.2.0",
784
- "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-2.2.0.tgz",
785
- "integrity": "sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw==",
786
- "license": "MIT",
787
- "dependencies": {
788
- "@sindresorhus/is": "^4.6.0",
789
- "char-regex": "^1.0.2",
790
- "emojilib": "^2.4.0",
791
- "skin-tone": "^2.0.0"
792
- },
793
- "engines": {
794
- "node": ">=18"
795
- }
796
- },
797
- "node_modules/object-assign": {
798
- "version": "4.1.1",
799
- "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
800
- "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
801
- "license": "MIT",
802
- "engines": {
803
- "node": ">=0.10.0"
804
- }
805
- },
806
- "node_modules/onetime": {
807
- "version": "5.1.2",
808
- "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
809
- "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
810
- "license": "MIT",
811
- "dependencies": {
812
- "mimic-fn": "^2.1.0"
813
- },
814
- "engines": {
815
- "node": ">=6"
816
- },
817
- "funding": {
818
- "url": "https://github.com/sponsors/sindresorhus"
819
- }
820
- },
821
- "node_modules/ora": {
822
- "version": "7.0.1",
823
- "resolved": "https://registry.npmjs.org/ora/-/ora-7.0.1.tgz",
824
- "integrity": "sha512-0TUxTiFJWv+JnjWm4o9yvuskpEJLXTcng8MJuKd+SzAzp2o+OP3HWqNhB4OdJRt1Vsd9/mR0oyaEYlOnL7XIRw==",
825
- "license": "MIT",
826
- "dependencies": {
827
- "chalk": "^5.3.0",
828
- "cli-cursor": "^4.0.0",
829
- "cli-spinners": "^2.9.0",
830
- "is-interactive": "^2.0.0",
831
- "is-unicode-supported": "^1.3.0",
832
- "log-symbols": "^5.1.0",
833
- "stdin-discarder": "^0.1.0",
834
- "string-width": "^6.1.0",
835
- "strip-ansi": "^7.1.0"
836
- },
837
- "engines": {
838
- "node": ">=16"
839
- },
840
- "funding": {
841
- "url": "https://github.com/sponsors/sindresorhus"
842
- }
843
- },
844
- "node_modules/ora/node_modules/ansi-regex": {
845
- "version": "6.2.2",
846
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
847
- "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
848
- "license": "MIT",
849
- "engines": {
850
- "node": ">=12"
851
- },
852
- "funding": {
853
- "url": "https://github.com/chalk/ansi-regex?sponsor=1"
854
- }
855
- },
856
- "node_modules/ora/node_modules/emoji-regex": {
857
- "version": "10.6.0",
858
- "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz",
859
- "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==",
860
- "license": "MIT"
861
- },
862
- "node_modules/ora/node_modules/string-width": {
863
- "version": "6.1.0",
864
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-6.1.0.tgz",
865
- "integrity": "sha512-k01swCJAgQmuADB0YIc+7TuatfNvTBVOoaUWJjTB9R4VJzR5vNWzf5t42ESVZFPS8xTySF7CAdV4t/aaIm3UnQ==",
866
- "license": "MIT",
867
- "dependencies": {
868
- "eastasianwidth": "^0.2.0",
869
- "emoji-regex": "^10.2.1",
870
- "strip-ansi": "^7.0.1"
871
- },
872
- "engines": {
873
- "node": ">=16"
874
- },
875
- "funding": {
876
- "url": "https://github.com/sponsors/sindresorhus"
877
- }
878
- },
879
- "node_modules/ora/node_modules/strip-ansi": {
880
- "version": "7.2.0",
881
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
882
- "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
883
- "license": "MIT",
884
- "dependencies": {
885
- "ansi-regex": "^6.2.2"
886
- },
887
- "engines": {
888
- "node": ">=12"
889
- },
890
- "funding": {
891
- "url": "https://github.com/chalk/strip-ansi?sponsor=1"
892
- }
893
- },
894
- "node_modules/parse5": {
895
- "version": "5.1.1",
896
- "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",
897
- "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==",
898
- "license": "MIT"
899
- },
900
- "node_modules/parse5-htmlparser2-tree-adapter": {
901
- "version": "6.0.1",
902
- "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz",
903
- "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==",
904
- "license": "MIT",
905
- "dependencies": {
906
- "parse5": "^6.0.1"
907
- }
908
- },
909
- "node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5": {
910
- "version": "6.0.1",
911
- "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
912
- "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==",
913
- "license": "MIT"
914
- },
915
- "node_modules/readable-stream": {
916
- "version": "3.6.2",
917
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
918
- "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
919
- "license": "MIT",
920
- "dependencies": {
921
- "inherits": "^2.0.3",
922
- "string_decoder": "^1.1.1",
923
- "util-deprecate": "^1.0.1"
924
- },
925
- "engines": {
926
- "node": ">= 6"
927
- }
928
- },
929
- "node_modules/require-directory": {
930
- "version": "2.1.1",
931
- "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
932
- "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
933
- "license": "MIT",
934
- "engines": {
935
- "node": ">=0.10.0"
936
- }
937
- },
938
- "node_modules/restore-cursor": {
939
- "version": "4.0.0",
940
- "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz",
941
- "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==",
942
- "license": "MIT",
943
- "dependencies": {
944
- "onetime": "^5.1.0",
945
- "signal-exit": "^3.0.2"
946
- },
947
- "engines": {
948
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
949
- },
950
- "funding": {
951
- "url": "https://github.com/sponsors/sindresorhus"
952
- }
953
- },
954
- "node_modules/run-async": {
955
- "version": "3.0.0",
956
- "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz",
957
- "integrity": "sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==",
958
- "license": "MIT",
959
- "engines": {
960
- "node": ">=0.12.0"
961
- }
962
- },
963
- "node_modules/rxjs": {
964
- "version": "7.8.2",
965
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
966
- "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
967
- "license": "Apache-2.0",
968
- "dependencies": {
969
- "tslib": "^2.1.0"
970
- }
971
- },
972
- "node_modules/safe-buffer": {
973
- "version": "5.2.1",
974
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
975
- "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
976
- "funding": [
977
- {
978
- "type": "github",
979
- "url": "https://github.com/sponsors/feross"
980
- },
981
- {
982
- "type": "patreon",
983
- "url": "https://www.patreon.com/feross"
984
- },
985
- {
986
- "type": "consulting",
987
- "url": "https://feross.org/support"
988
- }
989
- ],
990
- "license": "MIT"
991
- },
992
- "node_modules/safer-buffer": {
993
- "version": "2.1.2",
994
- "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
995
- "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
996
- "license": "MIT"
997
- },
998
- "node_modules/signal-exit": {
999
- "version": "3.0.7",
1000
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
1001
- "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
1002
- "license": "ISC"
1003
- },
1004
- "node_modules/skin-tone": {
1005
- "version": "2.0.0",
1006
- "resolved": "https://registry.npmjs.org/skin-tone/-/skin-tone-2.0.0.tgz",
1007
- "integrity": "sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==",
1008
- "license": "MIT",
1009
- "dependencies": {
1010
- "unicode-emoji-modifier-base": "^1.0.0"
1011
- },
1012
- "engines": {
1013
- "node": ">=8"
1014
- }
1015
- },
1016
- "node_modules/stdin-discarder": {
1017
- "version": "0.1.0",
1018
- "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz",
1019
- "integrity": "sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==",
1020
- "license": "MIT",
1021
- "dependencies": {
1022
- "bl": "^5.0.0"
1023
- },
1024
- "engines": {
1025
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
1026
- },
1027
- "funding": {
1028
- "url": "https://github.com/sponsors/sindresorhus"
1029
- }
1030
- },
1031
- "node_modules/string_decoder": {
1032
- "version": "1.3.0",
1033
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
1034
- "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
1035
- "license": "MIT",
1036
- "dependencies": {
1037
- "safe-buffer": "~5.2.0"
1038
- }
1039
- },
1040
- "node_modules/string-width": {
1041
- "version": "4.2.3",
1042
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
1043
- "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
1044
- "license": "MIT",
1045
- "dependencies": {
1046
- "emoji-regex": "^8.0.0",
1047
- "is-fullwidth-code-point": "^3.0.0",
1048
- "strip-ansi": "^6.0.1"
1049
- },
1050
- "engines": {
1051
- "node": ">=8"
1052
- }
1053
- },
1054
- "node_modules/strip-ansi": {
1055
- "version": "6.0.1",
1056
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
1057
- "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
1058
- "license": "MIT",
1059
- "dependencies": {
1060
- "ansi-regex": "^5.0.1"
1061
- },
1062
- "engines": {
1063
- "node": ">=8"
1064
- }
1065
- },
1066
- "node_modules/supports-color": {
1067
- "version": "7.2.0",
1068
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
1069
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
1070
- "license": "MIT",
1071
- "dependencies": {
1072
- "has-flag": "^4.0.0"
1073
- },
1074
- "engines": {
1075
- "node": ">=8"
1076
- }
1077
- },
1078
- "node_modules/supports-hyperlinks": {
1079
- "version": "3.2.0",
1080
- "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz",
1081
- "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==",
1082
- "license": "MIT",
1083
- "dependencies": {
1084
- "has-flag": "^4.0.0",
1085
- "supports-color": "^7.0.0"
1086
- },
1087
- "engines": {
1088
- "node": ">=14.18"
1089
- },
1090
- "funding": {
1091
- "url": "https://github.com/chalk/supports-hyperlinks?sponsor=1"
1092
- }
1093
- },
1094
- "node_modules/thenify": {
1095
- "version": "3.3.1",
1096
- "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
1097
- "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
1098
- "license": "MIT",
1099
- "dependencies": {
1100
- "any-promise": "^1.0.0"
1101
- }
1102
- },
1103
- "node_modules/thenify-all": {
1104
- "version": "1.6.0",
1105
- "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
1106
- "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",
1107
- "license": "MIT",
1108
- "dependencies": {
1109
- "thenify": ">= 3.1.0 < 4"
1110
- },
1111
- "engines": {
1112
- "node": ">=0.8"
1113
- }
1114
- },
1115
- "node_modules/tslib": {
1116
- "version": "2.8.1",
1117
- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
1118
- "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
1119
- "license": "0BSD"
1120
- },
1121
- "node_modules/type-fest": {
1122
- "version": "0.21.3",
1123
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
1124
- "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
1125
- "license": "(MIT OR CC0-1.0)",
1126
- "engines": {
1127
- "node": ">=10"
1128
- },
1129
- "funding": {
1130
- "url": "https://github.com/sponsors/sindresorhus"
1131
- }
1132
- },
1133
- "node_modules/unicode-emoji-modifier-base": {
1134
- "version": "1.0.0",
1135
- "resolved": "https://registry.npmjs.org/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz",
1136
- "integrity": "sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==",
1137
- "license": "MIT",
1138
- "engines": {
1139
- "node": ">=4"
1140
- }
1141
- },
1142
- "node_modules/util-deprecate": {
1143
- "version": "1.0.2",
1144
- "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
1145
- "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
1146
- "license": "MIT"
1147
- },
1148
- "node_modules/wcwidth": {
1149
- "version": "1.0.1",
1150
- "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
1151
- "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==",
1152
- "license": "MIT",
1153
- "dependencies": {
1154
- "defaults": "^1.0.3"
1155
- }
1156
- },
1157
- "node_modules/wrap-ansi": {
1158
- "version": "6.2.0",
1159
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
1160
- "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
1161
- "license": "MIT",
1162
- "dependencies": {
1163
- "ansi-styles": "^4.0.0",
1164
- "string-width": "^4.1.0",
1165
- "strip-ansi": "^6.0.0"
1166
- },
1167
- "engines": {
1168
- "node": ">=8"
1169
- }
1170
- },
1171
- "node_modules/y18n": {
1172
- "version": "5.0.8",
1173
- "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
1174
- "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
1175
- "license": "ISC",
1176
- "engines": {
1177
- "node": ">=10"
1178
- }
1179
- },
1180
- "node_modules/yargs": {
1181
- "version": "16.2.0",
1182
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
1183
- "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
1184
- "license": "MIT",
1185
- "dependencies": {
1186
- "cliui": "^7.0.2",
1187
- "escalade": "^3.1.1",
1188
- "get-caller-file": "^2.0.5",
1189
- "require-directory": "^2.1.1",
1190
- "string-width": "^4.2.0",
1191
- "y18n": "^5.0.5",
1192
- "yargs-parser": "^20.2.2"
1193
- },
1194
- "engines": {
1195
- "node": ">=10"
1196
- }
1197
- },
1198
- "node_modules/yargs-parser": {
1199
- "version": "20.2.9",
1200
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
1201
- "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
1202
- "license": "ISC",
1203
- "engines": {
1204
- "node": ">=10"
1205
- }
1206
- },
1207
- "node_modules/yoctocolors-cjs": {
1208
- "version": "2.1.3",
1209
- "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz",
1210
- "integrity": "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==",
1211
- "license": "MIT",
1212
- "engines": {
1213
- "node": ">=18"
1214
- },
1215
- "funding": {
1216
- "url": "https://github.com/sponsors/sindresorhus"
1217
- }
1218
- }
1219
- }
1220
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/LICENSE DELETED
@@ -1,26 +0,0 @@
1
- MIT License
2
-
3
- Original Library
4
- - Copyright (c) Marak Squires
5
-
6
- Additional Functionality
7
- - Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
8
- - Copyright (c) DABH (https://github.com/DABH)
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in
18
- all copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
- THE SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/README.md DELETED
@@ -1,219 +0,0 @@
1
- # @colors/colors ("colors.js")
2
- [![Build Status](https://github.com/DABH/colors.js/actions/workflows/ci.yml/badge.svg)](https://github.com/DABH/colors.js/actions/workflows/ci.yml)
3
- [![version](https://img.shields.io/npm/v/@colors/colors.svg)](https://www.npmjs.org/package/@colors/colors)
4
-
5
- Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback.
6
-
7
- ## get color and style in your node.js console
8
-
9
- ![Demo](https://raw.githubusercontent.com/DABH/colors.js/master/screenshots/colors.png)
10
-
11
- ## Installation
12
-
13
- npm install @colors/colors
14
-
15
- ## colors and styles!
16
-
17
- ### text colors
18
-
19
- - black
20
- - red
21
- - green
22
- - yellow
23
- - blue
24
- - magenta
25
- - cyan
26
- - white
27
- - gray
28
- - grey
29
-
30
- ### bright text colors
31
-
32
- - brightRed
33
- - brightGreen
34
- - brightYellow
35
- - brightBlue
36
- - brightMagenta
37
- - brightCyan
38
- - brightWhite
39
-
40
- ### background colors
41
-
42
- - bgBlack
43
- - bgRed
44
- - bgGreen
45
- - bgYellow
46
- - bgBlue
47
- - bgMagenta
48
- - bgCyan
49
- - bgWhite
50
- - bgGray
51
- - bgGrey
52
-
53
- ### bright background colors
54
-
55
- - bgBrightRed
56
- - bgBrightGreen
57
- - bgBrightYellow
58
- - bgBrightBlue
59
- - bgBrightMagenta
60
- - bgBrightCyan
61
- - bgBrightWhite
62
-
63
- ### styles
64
-
65
- - reset
66
- - bold
67
- - dim
68
- - italic
69
- - underline
70
- - inverse
71
- - hidden
72
- - strikethrough
73
-
74
- ### extras
75
-
76
- - rainbow
77
- - zebra
78
- - america
79
- - trap
80
- - random
81
-
82
-
83
- ## Usage
84
-
85
- By popular demand, `@colors/colors` now ships with two types of usages!
86
-
87
- The super nifty way
88
-
89
- ```js
90
- var colors = require('@colors/colors');
91
-
92
- console.log('hello'.green); // outputs green text
93
- console.log('i like cake and pies'.underline.red); // outputs red underlined text
94
- console.log('inverse the color'.inverse); // inverses the color
95
- console.log('OMG Rainbows!'.rainbow); // rainbow
96
- console.log('Run the trap'.trap); // Drops the bass
97
-
98
- ```
99
-
100
- or a slightly less nifty way which doesn't extend `String.prototype`
101
-
102
- ```js
103
- var colors = require('@colors/colors/safe');
104
-
105
- console.log(colors.green('hello')); // outputs green text
106
- console.log(colors.red.underline('i like cake and pies')); // outputs red underlined text
107
- console.log(colors.inverse('inverse the color')); // inverses the color
108
- console.log(colors.rainbow('OMG Rainbows!')); // rainbow
109
- console.log(colors.trap('Run the trap')); // Drops the bass
110
-
111
- ```
112
-
113
- I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
114
-
115
- If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
116
-
117
- ## Enabling/Disabling Colors
118
-
119
- The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
120
-
121
- ```bash
122
- node myapp.js --no-color
123
- node myapp.js --color=false
124
-
125
- node myapp.js --color
126
- node myapp.js --color=true
127
- node myapp.js --color=always
128
-
129
- FORCE_COLOR=1 node myapp.js
130
- ```
131
-
132
- Or in code:
133
-
134
- ```javascript
135
- var colors = require('@colors/colors');
136
- colors.enable();
137
- colors.disable();
138
- ```
139
-
140
- ## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
141
-
142
- ```js
143
- var name = 'Beowulf';
144
- console.log(colors.green('Hello %s'), name);
145
- // outputs -> 'Hello Beowulf'
146
- ```
147
-
148
- ## Custom themes
149
-
150
- ### Using standard API
151
-
152
- ```js
153
-
154
- var colors = require('@colors/colors');
155
-
156
- colors.setTheme({
157
- silly: 'rainbow',
158
- input: 'grey',
159
- verbose: 'cyan',
160
- prompt: 'grey',
161
- info: 'green',
162
- data: 'grey',
163
- help: 'cyan',
164
- warn: 'yellow',
165
- debug: 'blue',
166
- error: 'red'
167
- });
168
-
169
- // outputs red text
170
- console.log("this is an error".error);
171
-
172
- // outputs yellow text
173
- console.log("this is a warning".warn);
174
- ```
175
-
176
- ### Using string safe API
177
-
178
- ```js
179
- var colors = require('@colors/colors/safe');
180
-
181
- // set single property
182
- var error = colors.red;
183
- error('this is red');
184
-
185
- // set theme
186
- colors.setTheme({
187
- silly: 'rainbow',
188
- input: 'grey',
189
- verbose: 'cyan',
190
- prompt: 'grey',
191
- info: 'green',
192
- data: 'grey',
193
- help: 'cyan',
194
- warn: 'yellow',
195
- debug: 'blue',
196
- error: 'red'
197
- });
198
-
199
- // outputs red text
200
- console.log(colors.error("this is an error"));
201
-
202
- // outputs yellow text
203
- console.log(colors.warn("this is a warning"));
204
-
205
- ```
206
-
207
- ### Combining Colors
208
-
209
- ```javascript
210
- var colors = require('@colors/colors');
211
-
212
- colors.setTheme({
213
- custom: ['red', 'underline']
214
- });
215
-
216
- console.log('test'.custom);
217
- ```
218
-
219
- *Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/examples/normal-usage.js DELETED
@@ -1,83 +0,0 @@
1
- var colors = require('../lib/index');
2
-
3
- console.log('First some yellow text'.yellow);
4
-
5
- console.log('Underline that text'.yellow.underline);
6
-
7
- console.log('Make it bold and red'.red.bold);
8
-
9
- console.log(('Double Raindows All Day Long').rainbow);
10
-
11
- console.log('Drop the bass'.trap);
12
-
13
- console.log('DROP THE RAINBOW BASS'.trap.rainbow);
14
-
15
- // styles not widely supported
16
- console.log('Chains are also cool.'.bold.italic.underline.red);
17
-
18
- // styles not widely supported
19
- console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse
20
- + ' styles! '.yellow.bold);
21
- console.log('Zebras are so fun!'.zebra);
22
-
23
- //
24
- // Remark: .strikethrough may not work with Mac OS Terminal App
25
- //
26
- console.log('This is ' + 'not'.strikethrough + ' fun.');
27
-
28
- console.log('Background color attack!'.black.bgWhite);
29
- console.log('Use random styles on everything!'.random);
30
- console.log('America, Heck Yeah!'.america);
31
-
32
- // eslint-disable-next-line max-len
33
- console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
34
-
35
- console.log('Setting themes is useful');
36
-
37
- //
38
- // Custom themes
39
- //
40
- console.log('Generic logging theme as JSON'.green.bold.underline);
41
- // Load theme with JSON literal
42
- colors.setTheme({
43
- silly: 'rainbow',
44
- input: 'grey',
45
- verbose: 'cyan',
46
- prompt: 'grey',
47
- info: 'green',
48
- data: 'grey',
49
- help: 'cyan',
50
- warn: 'yellow',
51
- debug: 'blue',
52
- error: 'red',
53
- });
54
-
55
- // outputs red text
56
- console.log('this is an error'.error);
57
-
58
- // outputs yellow text
59
- console.log('this is a warning'.warn);
60
-
61
- // outputs grey text
62
- console.log('this is an input'.input);
63
-
64
- console.log('Generic logging theme as file'.green.bold.underline);
65
-
66
- // Load a theme from file
67
- try {
68
- colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
69
- } catch (err) {
70
- console.log(err);
71
- }
72
-
73
- // outputs red text
74
- console.log('this is an error'.error);
75
-
76
- // outputs yellow text
77
- console.log('this is a warning'.warn);
78
-
79
- // outputs grey text
80
- console.log('this is an input'.input);
81
-
82
- // console.log("Don't summon".zalgo)
83
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/examples/safe-string.js DELETED
@@ -1,80 +0,0 @@
1
- var colors = require('../safe');
2
-
3
- console.log(colors.yellow('First some yellow text'));
4
-
5
- console.log(colors.yellow.underline('Underline that text'));
6
-
7
- console.log(colors.red.bold('Make it bold and red'));
8
-
9
- console.log(colors.rainbow('Double Raindows All Day Long'));
10
-
11
- console.log(colors.trap('Drop the bass'));
12
-
13
- console.log(colors.rainbow(colors.trap('DROP THE RAINBOW BASS')));
14
-
15
- // styles not widely supported
16
- console.log(colors.bold.italic.underline.red('Chains are also cool.'));
17
-
18
- // styles not widely supported
19
- console.log(colors.green('So ') + colors.underline('are') + ' '
20
- + colors.inverse('inverse') + colors.yellow.bold(' styles! '));
21
-
22
- console.log(colors.zebra('Zebras are so fun!'));
23
-
24
- console.log('This is ' + colors.strikethrough('not') + ' fun.');
25
-
26
-
27
- console.log(colors.black.bgWhite('Background color attack!'));
28
- console.log(colors.random('Use random styles on everything!'));
29
- console.log(colors.america('America, Heck Yeah!'));
30
-
31
- // eslint-disable-next-line max-len
32
- console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
33
-
34
- console.log('Setting themes is useful');
35
-
36
- //
37
- // Custom themes
38
- //
39
- // console.log('Generic logging theme as JSON'.green.bold.underline);
40
- // Load theme with JSON literal
41
- colors.setTheme({
42
- silly: 'rainbow',
43
- input: 'blue',
44
- verbose: 'cyan',
45
- prompt: 'grey',
46
- info: 'green',
47
- data: 'grey',
48
- help: 'cyan',
49
- warn: 'yellow',
50
- debug: 'blue',
51
- error: 'red',
52
- });
53
-
54
- // outputs red text
55
- console.log(colors.error('this is an error'));
56
-
57
- // outputs yellow text
58
- console.log(colors.warn('this is a warning'));
59
-
60
- // outputs blue text
61
- console.log(colors.input('this is an input'));
62
-
63
-
64
- // console.log('Generic logging theme as file'.green.bold.underline);
65
-
66
- // Load a theme from file
67
- colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
68
-
69
- // outputs red text
70
- console.log(colors.error('this is an error'));
71
-
72
- // outputs yellow text
73
- console.log(colors.warn('this is a warning'));
74
-
75
- // outputs grey text
76
- console.log(colors.input('this is an input'));
77
-
78
- // console.log(colors.zalgo("Don't summon him"))
79
-
80
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/index.d.ts DELETED
@@ -1,136 +0,0 @@
1
- // Type definitions for @colors/colors 1.4+
2
- // Project: https://github.com/Marak/colors.js
3
- // Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
4
- // Definitions: https://github.com/DABH/colors.js
5
-
6
- export interface Color {
7
- (text: string): string;
8
-
9
- strip: Color;
10
- stripColors: Color;
11
-
12
- black: Color;
13
- red: Color;
14
- green: Color;
15
- yellow: Color;
16
- blue: Color;
17
- magenta: Color;
18
- cyan: Color;
19
- white: Color;
20
- gray: Color;
21
- grey: Color;
22
-
23
- bgBlack: Color;
24
- bgRed: Color;
25
- bgGreen: Color;
26
- bgYellow: Color;
27
- bgBlue: Color;
28
- bgMagenta: Color;
29
- bgCyan: Color;
30
- bgWhite: Color;
31
-
32
- reset: Color;
33
- bold: Color;
34
- dim: Color;
35
- italic: Color;
36
- underline: Color;
37
- inverse: Color;
38
- hidden: Color;
39
- strikethrough: Color;
40
-
41
- rainbow: Color;
42
- zebra: Color;
43
- america: Color;
44
- trap: Color;
45
- random: Color;
46
- zalgo: Color;
47
- }
48
-
49
- export function enable(): void;
50
- export function disable(): void;
51
- export function setTheme(theme: any): void;
52
-
53
- export let enabled: boolean;
54
-
55
- export const strip: Color;
56
- export const stripColors: Color;
57
-
58
- export const black: Color;
59
- export const red: Color;
60
- export const green: Color;
61
- export const yellow: Color;
62
- export const blue: Color;
63
- export const magenta: Color;
64
- export const cyan: Color;
65
- export const white: Color;
66
- export const gray: Color;
67
- export const grey: Color;
68
-
69
- export const bgBlack: Color;
70
- export const bgRed: Color;
71
- export const bgGreen: Color;
72
- export const bgYellow: Color;
73
- export const bgBlue: Color;
74
- export const bgMagenta: Color;
75
- export const bgCyan: Color;
76
- export const bgWhite: Color;
77
-
78
- export const reset: Color;
79
- export const bold: Color;
80
- export const dim: Color;
81
- export const italic: Color;
82
- export const underline: Color;
83
- export const inverse: Color;
84
- export const hidden: Color;
85
- export const strikethrough: Color;
86
-
87
- export const rainbow: Color;
88
- export const zebra: Color;
89
- export const america: Color;
90
- export const trap: Color;
91
- export const random: Color;
92
- export const zalgo: Color;
93
-
94
- declare global {
95
- interface String {
96
- strip: string;
97
- stripColors: string;
98
-
99
- black: string;
100
- red: string;
101
- green: string;
102
- yellow: string;
103
- blue: string;
104
- magenta: string;
105
- cyan: string;
106
- white: string;
107
- gray: string;
108
- grey: string;
109
-
110
- bgBlack: string;
111
- bgRed: string;
112
- bgGreen: string;
113
- bgYellow: string;
114
- bgBlue: string;
115
- bgMagenta: string;
116
- bgCyan: string;
117
- bgWhite: string;
118
-
119
- reset: string;
120
- // @ts-ignore
121
- bold: string;
122
- dim: string;
123
- italic: string;
124
- underline: string;
125
- inverse: string;
126
- hidden: string;
127
- strikethrough: string;
128
-
129
- rainbow: string;
130
- zebra: string;
131
- america: string;
132
- trap: string;
133
- random: string;
134
- zalgo: string;
135
- }
136
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/colors.js DELETED
@@ -1,211 +0,0 @@
1
- /*
2
-
3
- The MIT License (MIT)
4
-
5
- Original Library
6
- - Copyright (c) Marak Squires
7
-
8
- Additional functionality
9
- - Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in
19
- all copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
- THE SOFTWARE.
28
-
29
- */
30
-
31
- var colors = {};
32
- module['exports'] = colors;
33
-
34
- colors.themes = {};
35
-
36
- var util = require('util');
37
- var ansiStyles = colors.styles = require('./styles');
38
- var defineProps = Object.defineProperties;
39
- var newLineRegex = new RegExp(/[\r\n]+/g);
40
-
41
- colors.supportsColor = require('./system/supports-colors').supportsColor;
42
-
43
- if (typeof colors.enabled === 'undefined') {
44
- colors.enabled = colors.supportsColor() !== false;
45
- }
46
-
47
- colors.enable = function() {
48
- colors.enabled = true;
49
- };
50
-
51
- colors.disable = function() {
52
- colors.enabled = false;
53
- };
54
-
55
- colors.stripColors = colors.strip = function(str) {
56
- return ('' + str).replace(/\x1B\[\d+m/g, '');
57
- };
58
-
59
- // eslint-disable-next-line no-unused-vars
60
- var stylize = colors.stylize = function stylize(str, style) {
61
- if (!colors.enabled) {
62
- return str+'';
63
- }
64
-
65
- var styleMap = ansiStyles[style];
66
-
67
- // Stylize should work for non-ANSI styles, too
68
- if (!styleMap && style in colors) {
69
- // Style maps like trap operate as functions on strings;
70
- // they don't have properties like open or close.
71
- return colors[style](str);
72
- }
73
-
74
- return styleMap.open + str + styleMap.close;
75
- };
76
-
77
- var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
78
- var escapeStringRegexp = function(str) {
79
- if (typeof str !== 'string') {
80
- throw new TypeError('Expected a string');
81
- }
82
- return str.replace(matchOperatorsRe, '\\$&');
83
- };
84
-
85
- function build(_styles) {
86
- var builder = function builder() {
87
- return applyStyle.apply(builder, arguments);
88
- };
89
- builder._styles = _styles;
90
- // __proto__ is used because we must return a function, but there is
91
- // no way to create a function with a different prototype.
92
- builder.__proto__ = proto;
93
- return builder;
94
- }
95
-
96
- var styles = (function() {
97
- var ret = {};
98
- ansiStyles.grey = ansiStyles.gray;
99
- Object.keys(ansiStyles).forEach(function(key) {
100
- ansiStyles[key].closeRe =
101
- new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
102
- ret[key] = {
103
- get: function() {
104
- return build(this._styles.concat(key));
105
- },
106
- };
107
- });
108
- return ret;
109
- })();
110
-
111
- var proto = defineProps(function colors() {}, styles);
112
-
113
- function applyStyle() {
114
- var args = Array.prototype.slice.call(arguments);
115
-
116
- var str = args.map(function(arg) {
117
- // Use weak equality check so we can colorize null/undefined in safe mode
118
- if (arg != null && arg.constructor === String) {
119
- return arg;
120
- } else {
121
- return util.inspect(arg);
122
- }
123
- }).join(' ');
124
-
125
- if (!colors.enabled || !str) {
126
- return str;
127
- }
128
-
129
- var newLinesPresent = str.indexOf('\n') != -1;
130
-
131
- var nestedStyles = this._styles;
132
-
133
- var i = nestedStyles.length;
134
- while (i--) {
135
- var code = ansiStyles[nestedStyles[i]];
136
- str = code.open + str.replace(code.closeRe, code.open) + code.close;
137
- if (newLinesPresent) {
138
- str = str.replace(newLineRegex, function(match) {
139
- return code.close + match + code.open;
140
- });
141
- }
142
- }
143
-
144
- return str;
145
- }
146
-
147
- colors.setTheme = function(theme) {
148
- if (typeof theme === 'string') {
149
- console.log('colors.setTheme now only accepts an object, not a string. ' +
150
- 'If you are trying to set a theme from a file, it is now your (the ' +
151
- 'caller\'s) responsibility to require the file. The old syntax ' +
152
- 'looked like colors.setTheme(__dirname + ' +
153
- '\'/../themes/generic-logging.js\'); The new syntax looks like '+
154
- 'colors.setTheme(require(__dirname + ' +
155
- '\'/../themes/generic-logging.js\'));');
156
- return;
157
- }
158
- for (var style in theme) {
159
- (function(style) {
160
- colors[style] = function(str) {
161
- if (typeof theme[style] === 'object') {
162
- var out = str;
163
- for (var i in theme[style]) {
164
- out = colors[theme[style][i]](out);
165
- }
166
- return out;
167
- }
168
- return colors[theme[style]](str);
169
- };
170
- })(style);
171
- }
172
- };
173
-
174
- function init() {
175
- var ret = {};
176
- Object.keys(styles).forEach(function(name) {
177
- ret[name] = {
178
- get: function() {
179
- return build([name]);
180
- },
181
- };
182
- });
183
- return ret;
184
- }
185
-
186
- var sequencer = function sequencer(map, str) {
187
- var exploded = str.split('');
188
- exploded = exploded.map(map);
189
- return exploded.join('');
190
- };
191
-
192
- // custom formatter methods
193
- colors.trap = require('./custom/trap');
194
- colors.zalgo = require('./custom/zalgo');
195
-
196
- // maps
197
- colors.maps = {};
198
- colors.maps.america = require('./maps/america')(colors);
199
- colors.maps.zebra = require('./maps/zebra')(colors);
200
- colors.maps.rainbow = require('./maps/rainbow')(colors);
201
- colors.maps.random = require('./maps/random')(colors);
202
-
203
- for (var map in colors.maps) {
204
- (function(map) {
205
- colors[map] = function(str) {
206
- return sequencer(colors.maps[map], str);
207
- };
208
- })(map);
209
- }
210
-
211
- defineProps(colors, init());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/custom/trap.js DELETED
@@ -1,46 +0,0 @@
1
- module['exports'] = function runTheTrap(text, options) {
2
- var result = '';
3
- text = text || 'Run the trap, drop the bass';
4
- text = text.split('');
5
- var trap = {
6
- a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'],
7
- b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'],
8
- c: ['\u00a9', '\u023b', '\u03fe'],
9
- d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'],
10
- e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc',
11
- '\u0a6c'],
12
- f: ['\u04fa'],
13
- g: ['\u0262'],
14
- h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'],
15
- i: ['\u0f0f'],
16
- j: ['\u0134'],
17
- k: ['\u0138', '\u04a0', '\u04c3', '\u051e'],
18
- l: ['\u0139'],
19
- m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'],
20
- n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'],
21
- o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd',
22
- '\u06dd', '\u0e4f'],
23
- p: ['\u01f7', '\u048e'],
24
- q: ['\u09cd'],
25
- r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'],
26
- s: ['\u00a7', '\u03de', '\u03df', '\u03e8'],
27
- t: ['\u0141', '\u0166', '\u0373'],
28
- u: ['\u01b1', '\u054d'],
29
- v: ['\u05d8'],
30
- w: ['\u0428', '\u0460', '\u047c', '\u0d70'],
31
- x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'],
32
- y: ['\u00a5', '\u04b0', '\u04cb'],
33
- z: ['\u01b5', '\u0240'],
34
- };
35
- text.forEach(function(c) {
36
- c = c.toLowerCase();
37
- var chars = trap[c] || [' '];
38
- var rand = Math.floor(Math.random() * chars.length);
39
- if (typeof trap[c] !== 'undefined') {
40
- result += trap[c][rand];
41
- } else {
42
- result += c;
43
- }
44
- });
45
- return result;
46
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/custom/zalgo.js DELETED
@@ -1,110 +0,0 @@
1
- // please no
2
- module['exports'] = function zalgo(text, options) {
3
- text = text || ' he is here ';
4
- var soul = {
5
- 'up': [
6
- '̍', '̎', '̄', '̅',
7
- '̿', '̑', '̆', '̐',
8
- '͒', '͗', '͑', '̇',
9
- '̈', '̊', '͂', '̓',
10
- '̈', '͊', '͋', '͌',
11
- '̃', '̂', '̌', '͐',
12
- '̀', '́', '̋', '̏',
13
- '̒', '̓', '̔', '̽',
14
- '̉', 'ͣ', 'ͤ', 'ͥ',
15
- 'ͦ', 'ͧ', 'ͨ', 'ͩ',
16
- 'ͪ', 'ͫ', 'ͬ', 'ͭ',
17
- 'ͮ', 'ͯ', '̾', '͛',
18
- '͆', '̚',
19
- ],
20
- 'down': [
21
- '̖', '̗', '̘', '̙',
22
- '̜', '̝', '̞', '̟',
23
- '̠', '̤', '̥', '̦',
24
- '̩', '̪', '̫', '̬',
25
- '̭', '̮', '̯', '̰',
26
- '̱', '̲', '̳', '̹',
27
- '̺', '̻', '̼', 'ͅ',
28
- '͇', '͈', '͉', '͍',
29
- '͎', '͓', '͔', '͕',
30
- '͖', '͙', '͚', '̣',
31
- ],
32
- 'mid': [
33
- '̕', '̛', '̀', '́',
34
- '͘', '̡', '̢', '̧',
35
- '̨', '̴', '̵', '̶',
36
- '͜', '͝', '͞',
37
- '͟', '͠', '͢', '̸',
38
- '̷', '͡', ' ҉',
39
- ],
40
- };
41
- var all = [].concat(soul.up, soul.down, soul.mid);
42
-
43
- function randomNumber(range) {
44
- var r = Math.floor(Math.random() * range);
45
- return r;
46
- }
47
-
48
- function isChar(character) {
49
- var bool = false;
50
- all.filter(function(i) {
51
- bool = (i === character);
52
- });
53
- return bool;
54
- }
55
-
56
-
57
- function heComes(text, options) {
58
- var result = '';
59
- var counts;
60
- var l;
61
- options = options || {};
62
- options['up'] =
63
- typeof options['up'] !== 'undefined' ? options['up'] : true;
64
- options['mid'] =
65
- typeof options['mid'] !== 'undefined' ? options['mid'] : true;
66
- options['down'] =
67
- typeof options['down'] !== 'undefined' ? options['down'] : true;
68
- options['size'] =
69
- typeof options['size'] !== 'undefined' ? options['size'] : 'maxi';
70
- text = text.split('');
71
- for (l in text) {
72
- if (isChar(l)) {
73
- continue;
74
- }
75
- result = result + text[l];
76
- counts = {'up': 0, 'down': 0, 'mid': 0};
77
- switch (options.size) {
78
- case 'mini':
79
- counts.up = randomNumber(8);
80
- counts.mid = randomNumber(2);
81
- counts.down = randomNumber(8);
82
- break;
83
- case 'maxi':
84
- counts.up = randomNumber(16) + 3;
85
- counts.mid = randomNumber(4) + 1;
86
- counts.down = randomNumber(64) + 3;
87
- break;
88
- default:
89
- counts.up = randomNumber(8) + 1;
90
- counts.mid = randomNumber(6) / 2;
91
- counts.down = randomNumber(8) + 1;
92
- break;
93
- }
94
-
95
- var arr = ['up', 'mid', 'down'];
96
- for (var d in arr) {
97
- var index = arr[d];
98
- for (var i = 0; i <= counts[index]; i++) {
99
- if (options[index]) {
100
- result = result + soul[index][randomNumber(soul[index].length)];
101
- }
102
- }
103
- }
104
- }
105
- return result;
106
- }
107
- // don't summon him
108
- return heComes(text, options);
109
- };
110
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/extendStringPrototype.js DELETED
@@ -1,110 +0,0 @@
1
- var colors = require('./colors');
2
-
3
- module['exports'] = function() {
4
- //
5
- // Extends prototype of native string object to allow for "foo".red syntax
6
- //
7
- var addProperty = function(color, func) {
8
- String.prototype.__defineGetter__(color, func);
9
- };
10
-
11
- addProperty('strip', function() {
12
- return colors.strip(this);
13
- });
14
-
15
- addProperty('stripColors', function() {
16
- return colors.strip(this);
17
- });
18
-
19
- addProperty('trap', function() {
20
- return colors.trap(this);
21
- });
22
-
23
- addProperty('zalgo', function() {
24
- return colors.zalgo(this);
25
- });
26
-
27
- addProperty('zebra', function() {
28
- return colors.zebra(this);
29
- });
30
-
31
- addProperty('rainbow', function() {
32
- return colors.rainbow(this);
33
- });
34
-
35
- addProperty('random', function() {
36
- return colors.random(this);
37
- });
38
-
39
- addProperty('america', function() {
40
- return colors.america(this);
41
- });
42
-
43
- //
44
- // Iterate through all default styles and colors
45
- //
46
- var x = Object.keys(colors.styles);
47
- x.forEach(function(style) {
48
- addProperty(style, function() {
49
- return colors.stylize(this, style);
50
- });
51
- });
52
-
53
- function applyTheme(theme) {
54
- //
55
- // Remark: This is a list of methods that exist
56
- // on String that you should not overwrite.
57
- //
58
- var stringPrototypeBlacklist = [
59
- '__defineGetter__', '__defineSetter__', '__lookupGetter__',
60
- '__lookupSetter__', 'charAt', 'constructor', 'hasOwnProperty',
61
- 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString',
62
- 'valueOf', 'charCodeAt', 'indexOf', 'lastIndexOf', 'length',
63
- 'localeCompare', 'match', 'repeat', 'replace', 'search', 'slice',
64
- 'split', 'substring', 'toLocaleLowerCase', 'toLocaleUpperCase',
65
- 'toLowerCase', 'toUpperCase', 'trim', 'trimLeft', 'trimRight',
66
- ];
67
-
68
- Object.keys(theme).forEach(function(prop) {
69
- if (stringPrototypeBlacklist.indexOf(prop) !== -1) {
70
- console.log('warn: '.red + ('String.prototype' + prop).magenta +
71
- ' is probably something you don\'t want to override. ' +
72
- 'Ignoring style name');
73
- } else {
74
- if (typeof(theme[prop]) === 'string') {
75
- colors[prop] = colors[theme[prop]];
76
- addProperty(prop, function() {
77
- return colors[prop](this);
78
- });
79
- } else {
80
- var themePropApplicator = function(str) {
81
- var ret = str || this;
82
- for (var t = 0; t < theme[prop].length; t++) {
83
- ret = colors[theme[prop][t]](ret);
84
- }
85
- return ret;
86
- };
87
- addProperty(prop, themePropApplicator);
88
- colors[prop] = function(str) {
89
- return themePropApplicator(str);
90
- };
91
- }
92
- }
93
- });
94
- }
95
-
96
- colors.setTheme = function(theme) {
97
- if (typeof theme === 'string') {
98
- console.log('colors.setTheme now only accepts an object, not a string. ' +
99
- 'If you are trying to set a theme from a file, it is now your (the ' +
100
- 'caller\'s) responsibility to require the file. The old syntax ' +
101
- 'looked like colors.setTheme(__dirname + ' +
102
- '\'/../themes/generic-logging.js\'); The new syntax looks like '+
103
- 'colors.setTheme(require(__dirname + ' +
104
- '\'/../themes/generic-logging.js\'));');
105
- return;
106
- } else {
107
- applyTheme(theme);
108
- }
109
- };
110
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/index.js DELETED
@@ -1,13 +0,0 @@
1
- var colors = require('./colors');
2
- module['exports'] = colors;
3
-
4
- // Remark: By default, colors will add style properties to String.prototype.
5
- //
6
- // If you don't wish to extend String.prototype, you can do this instead and
7
- // native String will not be touched:
8
- //
9
- // var colors = require('colors/safe);
10
- // colors.red("foo")
11
- //
12
- //
13
- require('./extendStringPrototype')();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/maps/america.js DELETED
@@ -1,10 +0,0 @@
1
- module['exports'] = function(colors) {
2
- return function(letter, i, exploded) {
3
- if (letter === ' ') return letter;
4
- switch (i%3) {
5
- case 0: return colors.red(letter);
6
- case 1: return colors.white(letter);
7
- case 2: return colors.blue(letter);
8
- }
9
- };
10
- };
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/maps/rainbow.js DELETED
@@ -1,12 +0,0 @@
1
- module['exports'] = function(colors) {
2
- // RoY G BiV
3
- var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
4
- return function(letter, i, exploded) {
5
- if (letter === ' ') {
6
- return letter;
7
- } else {
8
- return colors[rainbowColors[i++ % rainbowColors.length]](letter);
9
- }
10
- };
11
- };
12
-
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/maps/random.js DELETED
@@ -1,11 +0,0 @@
1
- module['exports'] = function(colors) {
2
- var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
3
- 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
4
- 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
5
- return function(letter, i, exploded) {
6
- return letter === ' ' ? letter :
7
- colors[
8
- available[Math.round(Math.random() * (available.length - 2))]
9
- ](letter);
10
- };
11
- };
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/maps/zebra.js DELETED
@@ -1,5 +0,0 @@
1
- module['exports'] = function(colors) {
2
- return function(letter, i, exploded) {
3
- return i % 2 === 0 ? letter : colors.inverse(letter);
4
- };
5
- };
 
 
 
 
 
 
node_modules/@colors/colors/lib/styles.js DELETED
@@ -1,95 +0,0 @@
1
- /*
2
- The MIT License (MIT)
3
-
4
- Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
23
-
24
- */
25
-
26
- var styles = {};
27
- module['exports'] = styles;
28
-
29
- var codes = {
30
- reset: [0, 0],
31
-
32
- bold: [1, 22],
33
- dim: [2, 22],
34
- italic: [3, 23],
35
- underline: [4, 24],
36
- inverse: [7, 27],
37
- hidden: [8, 28],
38
- strikethrough: [9, 29],
39
-
40
- black: [30, 39],
41
- red: [31, 39],
42
- green: [32, 39],
43
- yellow: [33, 39],
44
- blue: [34, 39],
45
- magenta: [35, 39],
46
- cyan: [36, 39],
47
- white: [37, 39],
48
- gray: [90, 39],
49
- grey: [90, 39],
50
-
51
- brightRed: [91, 39],
52
- brightGreen: [92, 39],
53
- brightYellow: [93, 39],
54
- brightBlue: [94, 39],
55
- brightMagenta: [95, 39],
56
- brightCyan: [96, 39],
57
- brightWhite: [97, 39],
58
-
59
- bgBlack: [40, 49],
60
- bgRed: [41, 49],
61
- bgGreen: [42, 49],
62
- bgYellow: [43, 49],
63
- bgBlue: [44, 49],
64
- bgMagenta: [45, 49],
65
- bgCyan: [46, 49],
66
- bgWhite: [47, 49],
67
- bgGray: [100, 49],
68
- bgGrey: [100, 49],
69
-
70
- bgBrightRed: [101, 49],
71
- bgBrightGreen: [102, 49],
72
- bgBrightYellow: [103, 49],
73
- bgBrightBlue: [104, 49],
74
- bgBrightMagenta: [105, 49],
75
- bgBrightCyan: [106, 49],
76
- bgBrightWhite: [107, 49],
77
-
78
- // legacy styles for colors pre v1.0.0
79
- blackBG: [40, 49],
80
- redBG: [41, 49],
81
- greenBG: [42, 49],
82
- yellowBG: [43, 49],
83
- blueBG: [44, 49],
84
- magentaBG: [45, 49],
85
- cyanBG: [46, 49],
86
- whiteBG: [47, 49],
87
-
88
- };
89
-
90
- Object.keys(codes).forEach(function(key) {
91
- var val = codes[key];
92
- var style = styles[key] = [];
93
- style.open = '\u001b[' + val[0] + 'm';
94
- style.close = '\u001b[' + val[1] + 'm';
95
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/system/has-flag.js DELETED
@@ -1,35 +0,0 @@
1
- /*
2
- MIT License
3
-
4
- Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy of
7
- this software and associated documentation files (the "Software"), to deal in
8
- the Software without restriction, including without limitation the rights to
9
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10
- of the Software, and to permit persons to whom the Software is furnished to do
11
- so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in all
14
- copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- SOFTWARE.
23
- */
24
-
25
- 'use strict';
26
-
27
- module.exports = function(flag, argv) {
28
- argv = argv || process.argv;
29
-
30
- var terminatorPos = argv.indexOf('--');
31
- var prefix = /^-{1,2}/.test(flag) ? '' : '--';
32
- var pos = argv.indexOf(prefix + flag);
33
-
34
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
35
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/lib/system/supports-colors.js DELETED
@@ -1,151 +0,0 @@
1
- /*
2
- The MIT License (MIT)
3
-
4
- Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
23
-
24
- */
25
-
26
- 'use strict';
27
-
28
- var os = require('os');
29
- var hasFlag = require('./has-flag.js');
30
-
31
- var env = process.env;
32
-
33
- var forceColor = void 0;
34
- if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
35
- forceColor = false;
36
- } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true')
37
- || hasFlag('color=always')) {
38
- forceColor = true;
39
- }
40
- if ('FORCE_COLOR' in env) {
41
- forceColor = env.FORCE_COLOR.length === 0
42
- || parseInt(env.FORCE_COLOR, 10) !== 0;
43
- }
44
-
45
- function translateLevel(level) {
46
- if (level === 0) {
47
- return false;
48
- }
49
-
50
- return {
51
- level: level,
52
- hasBasic: true,
53
- has256: level >= 2,
54
- has16m: level >= 3,
55
- };
56
- }
57
-
58
- function supportsColor(stream) {
59
- if (forceColor === false) {
60
- return 0;
61
- }
62
-
63
- if (hasFlag('color=16m') || hasFlag('color=full')
64
- || hasFlag('color=truecolor')) {
65
- return 3;
66
- }
67
-
68
- if (hasFlag('color=256')) {
69
- return 2;
70
- }
71
-
72
- if (stream && !stream.isTTY && forceColor !== true) {
73
- return 0;
74
- }
75
-
76
- var min = forceColor ? 1 : 0;
77
-
78
- if (process.platform === 'win32') {
79
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
80
- // libuv that enables 256 color output on Windows. Anything earlier and it
81
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
82
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first
83
- // Windows release that supports 256 colors. Windows 10 build 14931 is the
84
- // first release that supports 16m/TrueColor.
85
- var osRelease = os.release().split('.');
86
- if (Number(process.versions.node.split('.')[0]) >= 8
87
- && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
88
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
89
- }
90
-
91
- return 1;
92
- }
93
-
94
- if ('CI' in env) {
95
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) {
96
- return sign in env;
97
- }) || env.CI_NAME === 'codeship') {
98
- return 1;
99
- }
100
-
101
- return min;
102
- }
103
-
104
- if ('TEAMCITY_VERSION' in env) {
105
- return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0
106
- );
107
- }
108
-
109
- if ('TERM_PROGRAM' in env) {
110
- var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
111
-
112
- switch (env.TERM_PROGRAM) {
113
- case 'iTerm.app':
114
- return version >= 3 ? 3 : 2;
115
- case 'Hyper':
116
- return 3;
117
- case 'Apple_Terminal':
118
- return 2;
119
- // No default
120
- }
121
- }
122
-
123
- if (/-256(color)?$/i.test(env.TERM)) {
124
- return 2;
125
- }
126
-
127
- if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
128
- return 1;
129
- }
130
-
131
- if ('COLORTERM' in env) {
132
- return 1;
133
- }
134
-
135
- if (env.TERM === 'dumb') {
136
- return min;
137
- }
138
-
139
- return min;
140
- }
141
-
142
- function getSupportLevel(stream) {
143
- var level = supportsColor(stream);
144
- return translateLevel(level);
145
- }
146
-
147
- module.exports = {
148
- supportsColor: getSupportLevel,
149
- stdout: getSupportLevel(process.stdout),
150
- stderr: getSupportLevel(process.stderr),
151
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/package.json DELETED
@@ -1,45 +0,0 @@
1
- {
2
- "name": "@colors/colors",
3
- "description": "get colors in your node.js console",
4
- "version": "1.5.0",
5
- "author": "DABH",
6
- "contributors": [
7
- {
8
- "name": "DABH",
9
- "url": "https://github.com/DABH"
10
- }
11
- ],
12
- "homepage": "https://github.com/DABH/colors.js",
13
- "bugs": "https://github.com/DABH/colors.js/issues",
14
- "keywords": [
15
- "ansi",
16
- "terminal",
17
- "colors"
18
- ],
19
- "repository": {
20
- "type": "git",
21
- "url": "http://github.com/DABH/colors.js.git"
22
- },
23
- "license": "MIT",
24
- "scripts": {
25
- "lint": "eslint . --fix",
26
- "test": "export FORCE_COLOR=1 && node tests/basic-test.js && node tests/safe-test.js"
27
- },
28
- "engines": {
29
- "node": ">=0.1.90"
30
- },
31
- "main": "lib/index.js",
32
- "files": [
33
- "examples",
34
- "lib",
35
- "LICENSE",
36
- "safe.js",
37
- "themes",
38
- "index.d.ts",
39
- "safe.d.ts"
40
- ],
41
- "devDependencies": {
42
- "eslint": "^5.2.0",
43
- "eslint-config-google": "^0.11.0"
44
- }
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/safe.d.ts DELETED
@@ -1,48 +0,0 @@
1
- // Type definitions for Colors.js 1.2
2
- // Project: https://github.com/Marak/colors.js
3
- // Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
4
- // Definitions: https://github.com/Marak/colors.js
5
-
6
- export const enabled: boolean;
7
- export function enable(): void;
8
- export function disable(): void;
9
- export function setTheme(theme: any): void;
10
-
11
- export function strip(str: string): string;
12
- export function stripColors(str: string): string;
13
-
14
- export function black(str: string): string;
15
- export function red(str: string): string;
16
- export function green(str: string): string;
17
- export function yellow(str: string): string;
18
- export function blue(str: string): string;
19
- export function magenta(str: string): string;
20
- export function cyan(str: string): string;
21
- export function white(str: string): string;
22
- export function gray(str: string): string;
23
- export function grey(str: string): string;
24
-
25
- export function bgBlack(str: string): string;
26
- export function bgRed(str: string): string;
27
- export function bgGreen(str: string): string;
28
- export function bgYellow(str: string): string;
29
- export function bgBlue(str: string): string;
30
- export function bgMagenta(str: string): string;
31
- export function bgCyan(str: string): string;
32
- export function bgWhite(str: string): string;
33
-
34
- export function reset(str: string): string;
35
- export function bold(str: string): string;
36
- export function dim(str: string): string;
37
- export function italic(str: string): string;
38
- export function underline(str: string): string;
39
- export function inverse(str: string): string;
40
- export function hidden(str: string): string;
41
- export function strikethrough(str: string): string;
42
-
43
- export function rainbow(str: string): string;
44
- export function zebra(str: string): string;
45
- export function america(str: string): string;
46
- export function trap(str: string): string;
47
- export function random(str: string): string;
48
- export function zalgo(str: string): string;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/safe.js DELETED
@@ -1,10 +0,0 @@
1
- //
2
- // Remark: Requiring this file will use the "safe" colors API,
3
- // which will not touch String.prototype.
4
- //
5
- // var colors = require('colors/safe');
6
- // colors.red("foo")
7
- //
8
- //
9
- var colors = require('./lib/colors');
10
- module['exports'] = colors;
 
 
 
 
 
 
 
 
 
 
 
node_modules/@colors/colors/themes/generic-logging.js DELETED
@@ -1,12 +0,0 @@
1
- module['exports'] = {
2
- silly: 'rainbow',
3
- input: 'grey',
4
- verbose: 'cyan',
5
- prompt: 'grey',
6
- info: 'green',
7
- data: 'grey',
8
- help: 'cyan',
9
- warn: 'yellow',
10
- debug: 'blue',
11
- error: 'red',
12
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/CHANGELOG.md DELETED
@@ -1,1029 +0,0 @@
1
- # @gradio/client
2
-
3
- ## 2.2.1
4
-
5
- ### Fixes
6
-
7
- - [#13403](https://github.com/gradio-app/gradio/pull/13403) [`df56862`](https://github.com/gradio-app/gradio/commit/df56862a1531fc372a3248716dc4bd07e6db1c52) - [js-client] close submit iterator on next/close race. Thanks @hysts!
8
-
9
- ## 2.2.0
10
-
11
- ### Features
12
-
13
- - [#13176](https://github.com/gradio-app/gradio/pull/13176) [`45c4ecd`](https://github.com/gradio-app/gradio/commit/45c4ecd25fc83c7ee0210d216df1bc4bd509e622) - Add `@gr.cache()` decorator for caching deterministic functions, as as well as a lower-level `gr.Cache` that uses dependency injection. Thanks @abidlabs!
14
-
15
- ### Fixes
16
-
17
- - [#13210](https://github.com/gradio-app/gradio/pull/13210) [`4005b93`](https://github.com/gradio-app/gradio/commit/4005b93dd59d7e0d144619986f01e900659b3d0b) - Fix ZeroGPU handling for `gr.Server`. Thanks @abidlabs!
18
-
19
- ## 2.1.0
20
-
21
- ### Features
22
-
23
- - [#12929](https://github.com/gradio-app/gradio/pull/12929) [`978bc6e`](https://github.com/gradio-app/gradio/commit/978bc6ea5094aa11e10994cdd662c4c663a86a83) - Add server functions support to gr.HTML. Thanks @aliabid94!
24
- - [#12907](https://github.com/gradio-app/gradio/pull/12907) [`3e625a0`](https://github.com/gradio-app/gradio/commit/3e625a0ecfab6e74b7561b68adbe55341ecbc47a) - Better error handling when connection to server is lost. Thanks @abidlabs!
25
-
26
- ## 2.0.4
27
-
28
- ### Fixes
29
-
30
- - [#12828](https://github.com/gradio-app/gradio/pull/12828) [`151cbd1`](https://github.com/gradio-app/gradio/commit/151cbd1aac0da3aeb5f0b7b33585223d2bc47138) - Fix private spaces. Thanks @freddyaboulton!
31
- - [#12835](https://github.com/gradio-app/gradio/pull/12835) [`5ecf6d2`](https://github.com/gradio-app/gradio/commit/5ecf6d27c50a20e2329c1aca0634924479ceb6cd) - Fix CSS root in spaces. Thanks @freddyaboulton!
32
- - [#12817](https://github.com/gradio-app/gradio/pull/12817) [`05acc66`](https://github.com/gradio-app/gradio/commit/05acc6627de866db6a742e0540c2733041d76a86) - Fix Login. Thanks @freddyaboulton!
33
-
34
- ## 2.0.3
35
-
36
- ### Fixes
37
-
38
- - [#12773](https://github.com/gradio-app/gradio/pull/12773) [`6edcea5`](https://github.com/gradio-app/gradio/commit/6edcea5d74be661d37c70ccca08900be2ceb8e1e) - Fix dev mode. Thanks @pngwn!
39
- - [#12472](https://github.com/gradio-app/gradio/pull/12472) [`9a2bc0d`](https://github.com/gradio-app/gradio/commit/9a2bc0dacdd2b3f670fae815093c61ad08eee7e3) - Re-enable SSR mode. Thanks @pngwn!
40
-
41
- ## 2.0.2
42
-
43
- ### Fixes
44
-
45
- - [#12608](https://github.com/gradio-app/gradio/pull/12608) [`ab20c59`](https://github.com/gradio-app/gradio/commit/ab20c592e1fab33e96ab2698bbbb942d0972501b) - feat(client): add generic type parameter to predict() method. Thanks @majiayu000!
46
-
47
- ## 2.0.1
48
-
49
- ### Fixes
50
-
51
- - [#12600](https://github.com/gradio-app/gradio/pull/12600) [`1fafaba`](https://github.com/gradio-app/gradio/commit/1fafabaace315b1c699855cadb69eb17488de957) - Add x-gradio-user-header. Thanks @freddyaboulton!
52
-
53
- ## 2.0.0
54
-
55
- ### Features
56
-
57
- - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - [No Merge] Gradio 6.0
58
- - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Pass component props as input
59
- - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Rename show_api
60
- - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix error toast type definition for exception handling
61
- - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix queue false render issue
62
- - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Fix some e2e tests
63
- - [#12438](https://github.com/gradio-app/gradio/pull/12438) [`25ffc03`](https://github.com/gradio-app/gradio/commit/25ffc0398f8feb43d817c02b2ab970c16de6d797) - Svelte5 migration and bugfix
64
-
65
- ## 2.0.0-dev.2
66
-
67
- ### Features
68
-
69
- - [#12363](https://github.com/gradio-app/gradio/pull/12363) [`4845bfd`](https://github.com/gradio-app/gradio/commit/4845bfdab53096a609d80485e87d5cc70f3f0521) - Fix queue false render issue. Thanks @freddyaboulton!
70
- - [#12378](https://github.com/gradio-app/gradio/pull/12378) [`f5e5344`](https://github.com/gradio-app/gradio/commit/f5e5344db61eba28253719928577dc2c495958e1) - Fix some e2e tests. Thanks @freddyaboulton!
71
-
72
- ## 2.0.0-dev.1
73
-
74
- ### Features
75
-
76
- - [#12069](https://github.com/gradio-app/gradio/pull/12069) [`9de88ca`](https://github.com/gradio-app/gradio/commit/9de88ca470ce529366d259f0deaa955f658000b9) - Rename show_api. Thanks @freddyaboulton!
77
-
78
- ## 2.0.0-dev.0
79
-
80
- ### Features
81
-
82
- - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`53d9098`](https://github.com/gradio-app/gradio/commit/53d9098cca378f6ebff9dec15d2faa8a3d2fb510) - [No Merge] Gradio 6.0. Thanks @freddyaboulton!
83
-
84
- ## 1.19.1
85
-
86
- ### Fixes
87
-
88
- - [#11955](https://github.com/gradio-app/gradio/pull/11955) [`64046cc`](https://github.com/gradio-app/gradio/commit/64046ccd76a41f06ef9eed0e3aa1ec66348f55bd) - Fix Multi-page demo in Dev Mode. Thanks @ftoh!
89
-
90
- ## 1.19.0
91
-
92
- ### Features
93
-
94
- - [#11858](https://github.com/gradio-app/gradio/pull/11858) [`3f8ea13`](https://github.com/gradio-app/gradio/commit/3f8ea13a8ca92abf0ad34392e403a449fda3c6c2) - remove lite. Thanks @pngwn!
95
- - [#11902](https://github.com/gradio-app/gradio/pull/11902) [`6d39644`](https://github.com/gradio-app/gradio/commit/6d39644ee1000b04728eb4909cee405e7ee3b5b2) - Add navbar visibility controls and customization options. Thanks @abidlabs!
96
-
97
- ### Fixes
98
-
99
- - [#11784](https://github.com/gradio-app/gradio/pull/11784) [`d9dd3f5`](https://github.com/gradio-app/gradio/commit/d9dd3f54b7fb34cf7118e549d39fc63937ca3489) - Add "hidden" option to component's `visible` kwarg to render but visually hide the component. Thanks @pngwn!
100
-
101
- ## 1.18.0
102
-
103
- ### Features
104
-
105
- - [#11814](https://github.com/gradio-app/gradio/pull/11814) [`013784a`](https://github.com/gradio-app/gradio/commit/013784a7086047651e8e661a38bde7d5c7f10db7) - add validation support. Thanks @pngwn!
106
-
107
- ## 1.17.1
108
-
109
- ### Fixes
110
-
111
- - [#11709](https://github.com/gradio-app/gradio/pull/11709) [`48f1dcf`](https://github.com/gradio-app/gradio/commit/48f1dcf58cd6437daa03a8cf1c9942aae2cec421) - Fix output paths for the @gradio/client browser build. Thanks @pngwn!
112
-
113
- ## 1.17.0
114
-
115
- ### Features
116
-
117
- - [#11691](https://github.com/gradio-app/gradio/pull/11691) [`2605a99`](https://github.com/gradio-app/gradio/commit/2605a99bf29bebbbb0a97cc8e0015b5bf8d8e79b) - Add .failure() event listener for error handling. Thanks @elanehan!
118
-
119
- ## 1.16.0
120
-
121
- ### Features
122
-
123
- - [#11662](https://github.com/gradio-app/gradio/pull/11662) [`a78f5fa`](https://github.com/gradio-app/gradio/commit/a78f5fa466a4b11ffaaafc5099a64df49afb6e41) - Gradio vibe editor. Thanks @aliabid94!
124
-
125
- ## 1.15.7
126
-
127
- ### Fixes
128
-
129
- - [#11604](https://github.com/gradio-app/gradio/pull/11604) [`83e14bc`](https://github.com/gradio-app/gradio/commit/83e14bcfa653e2ec477f0d09b497adf605734e46) - Fix event cancelling bug. Thanks @freddyaboulton!
130
-
131
- ## 1.15.6
132
-
133
- ### Features
134
-
135
- - [#11543](https://github.com/gradio-app/gradio/pull/11543) [`ac95ac0`](https://github.com/gradio-app/gradio/commit/ac95ac0d8c2e65d1632376e632fb7d16131334b6) - Connection handling messaging. Thanks @aliabid94!
136
-
137
- ## 1.15.5
138
-
139
- ### Fixes
140
-
141
- - [#11430](https://github.com/gradio-app/gradio/pull/11430) [`4d4cd4b`](https://github.com/gradio-app/gradio/commit/4d4cd4b08d6daafc66e0189a2b274916da00d480) - fix exports + add browser build. Thanks @pngwn!
142
- - [#11435](https://github.com/gradio-app/gradio/pull/11435) [`50d43a8`](https://github.com/gradio-app/gradio/commit/50d43a8e8bc2a4862668a5d46a5e6482b4f75fe3) - SSR Auth Fix. Thanks @dawoodkhan82!
143
-
144
- ## 1.15.4
145
-
146
- ### Fixes
147
-
148
- - [#11432](https://github.com/gradio-app/gradio/pull/11432) [`dd1eee5`](https://github.com/gradio-app/gradio/commit/dd1eee5f9cd3d70773912fd6444d093bdcea321a) - Fix bug where cancelling an event would close the event stream. Thanks @freddyaboulton!
149
- - [#11421](https://github.com/gradio-app/gradio/pull/11421) [`c2acf6e`](https://github.com/gradio-app/gradio/commit/c2acf6e33025fe7bbfe0660c182006651cc95090) - Preserve value in reload mode. Thanks @aliabid94!
150
-
151
- ## 1.15.3
152
-
153
- ### Fixes
154
-
155
- - [#11387](https://github.com/gradio-app/gradio/pull/11387) [`8245afc`](https://github.com/gradio-app/gradio/commit/8245afc669501e1e5f0d619f452455f68a3b7667) - Define root URL in frontend. Thanks @aliabid94!
156
-
157
- ## 1.15.2
158
-
159
- ### Fixes
160
-
161
- - [#11325](https://github.com/gradio-app/gradio/pull/11325) [`2b571e1`](https://github.com/gradio-app/gradio/commit/2b571e13afdc8031ce9c1291abf0fc7062340064) - Fix image streaming - wait for ws to open. Thanks @freddyaboulton!
162
-
163
- ## 1.15.1
164
-
165
- ### Fixes
166
-
167
- - [#11243](https://github.com/gradio-app/gradio/pull/11243) [`35afa21`](https://github.com/gradio-app/gradio/commit/35afa21f0d6647e4fbda711f3f22a2fd54eedaf9) - Only show parameters warning when valid `endpoint_info` exists. Thanks @hannahblair!
168
-
169
- ## 1.15.0
170
-
171
- ### Features
172
-
173
- - [#11155](https://github.com/gradio-app/gradio/pull/11155) [`30a1d9e`](https://github.com/gradio-app/gradio/commit/30a1d9e2ac3013d9c844b236410010bce97ffaf5) - Improvements to MCP page. Thanks @abidlabs!
174
- - [#11047](https://github.com/gradio-app/gradio/pull/11047) [`6d4b8a7`](https://github.com/gradio-app/gradio/commit/6d4b8a7f10daefc9c79aa224635da23fbaeebb76) - Implement custom i18n. Thanks @hannahblair!
175
-
176
- ## 1.14.2
177
-
178
- ### Fixes
179
-
180
- - [#11017](https://github.com/gradio-app/gradio/pull/11017) [`734b309`](https://github.com/gradio-app/gradio/commit/734b3099d79647695e635d87726666d4b28d1bcf) - Include HF token in stream requests. Thanks @nostalgebraist!
181
-
182
- ## 1.14.1
183
-
184
- ### Features
185
-
186
- - [#10890](https://github.com/gradio-app/gradio/pull/10890) [`01b88c7`](https://github.com/gradio-app/gradio/commit/01b88c7fdedb413ba92ef6191967a8aed25e185f) - Improve API error handling in JS Client. Thanks @l2dy!
187
-
188
- ## 1.14.0
189
-
190
- ### Features
191
-
192
- - [#10834](https://github.com/gradio-app/gradio/pull/10834) [`c05610c`](https://github.com/gradio-app/gradio/commit/c05610c87dd7f9e9fe5d0aed2fe93e40fdd32648) - Add Deep Links. Thanks @freddyaboulton!
193
-
194
- ## 1.13.1
195
-
196
- ### Features
197
-
198
- - [#10694](https://github.com/gradio-app/gradio/pull/10694) [`16244f3`](https://github.com/gradio-app/gradio/commit/16244f3c1cb1a65ac1f719142f8fab67512fbb25) - Event Listeners in gradio sketch. Thanks @aliabid94!
199
-
200
- ### Fixes
201
-
202
- - [#10719](https://github.com/gradio-app/gradio/pull/10719) [`b710d7c`](https://github.com/gradio-app/gradio/commit/b710d7cf13c1277fd18c7809cad0f707b880ef70) - Fix error display. Thanks @aliabid94!
203
-
204
- ## 1.13.0
205
-
206
- ### Features
207
-
208
- - [#10500](https://github.com/gradio-app/gradio/pull/10500) [`16d419b`](https://github.com/gradio-app/gradio/commit/16d419b9f1f18ae4507d18a4739eb83ac4f3fae9) - Allow functions that solely update component properties to run in the frontend by setting `js=True`. Thanks @abidlabs!
209
-
210
- ## 1.12.0
211
-
212
- ### Features
213
-
214
- - [#10492](https://github.com/gradio-app/gradio/pull/10492) [`29880d5`](https://github.com/gradio-app/gradio/commit/29880d51fbe7fbd222b0765a83c95134dc7d0e90) - Allow showing progress updates on arbitrary components. Thanks @abidlabs!
215
-
216
- ### Fixes
217
-
218
- - [#10547](https://github.com/gradio-app/gradio/pull/10547) [`083d68b`](https://github.com/gradio-app/gradio/commit/083d68b223be82a65f18c553df9ae690a8118a49) - quick_fix_client. Thanks @aliabid94!
219
-
220
- ## 1.11.0
221
-
222
- ### Features
223
-
224
- - [#10433](https://github.com/gradio-app/gradio/pull/10433) [`2e8dc74`](https://github.com/gradio-app/gradio/commit/2e8dc74f751be02f7217f78d241806b42fcdca04) - Allow building multipage Gradio apps. Thanks @aliabid94!
225
-
226
- ## 1.10.0
227
-
228
- ### Features
229
-
230
- - [#10270](https://github.com/gradio-app/gradio/pull/10270) [`bb11a2a`](https://github.com/gradio-app/gradio/commit/bb11a2a702ca04fde245e7d54d155cbcbde7791e) - [ZeroGPU] Handshake-based postMessage. Thanks @cbensimon!
231
-
232
- ### Fixes
233
-
234
- - [#10332](https://github.com/gradio-app/gradio/pull/10332) [`e742dcc`](https://github.com/gradio-app/gradio/commit/e742dcccb376692c9ddd5a6c251080e7c5936574) - Allow users to add a custom API route. Thanks @aliabid94!
235
-
236
- ## 1.9.0
237
-
238
- ### Features
239
-
240
- - [#10262](https://github.com/gradio-app/gradio/pull/10262) [`f3bedd4`](https://github.com/gradio-app/gradio/commit/f3bedd4011bdfdecc952eb1275a9dd96af3e8d71) - add gr.Success and update windows contributing. Thanks @not-lain!
241
- - [#10254](https://github.com/gradio-app/gradio/pull/10254) [`da07707`](https://github.com/gradio-app/gradio/commit/da0770748db9ea40194a43c9138ee2c6536b1247) - Add a `settings` link to the footer with i18n options & pwa instructions. Thanks @abidlabs!
242
-
243
- ## 1.8.0
244
-
245
- ### Features
246
-
247
- - [#9930](https://github.com/gradio-app/gradio/pull/9930) [`eae345e`](https://github.com/gradio-app/gradio/commit/eae345e5fde39aea220b57c6a954cd7d72ff32d5) - Allow settings custom headers in js client. Thanks @elgiano!
248
- - [#9950](https://github.com/gradio-app/gradio/pull/9950) [`fc06fe4`](https://github.com/gradio-app/gradio/commit/fc06fe41f015678a0545f4e5c99f6ae2704f0031) - Add ability to read and write from LocalStorage. Thanks @abidlabs!
249
-
250
- ## 1.7.1
251
-
252
- ### Fixes
253
-
254
- - [#9814](https://github.com/gradio-app/gradio/pull/9814) [`6505d42`](https://github.com/gradio-app/gradio/commit/6505d4289a3e3d27d9133b1c8af41697fdc1476d) - support gradio apps on spaces served on subpaths. Thanks @pngwn!
255
-
256
- ## 1.7.0
257
-
258
- ### Features
259
-
260
- - [#9681](https://github.com/gradio-app/gradio/pull/9681) [`2ed2361`](https://github.com/gradio-app/gradio/commit/2ed236187a9aab18e17fc4a8079eddef7dd195a5) - Allow setting title in gr.Info/Warning/Error. Thanks @ABucket!
261
-
262
- ## 1.6.0
263
-
264
- ### Features
265
-
266
- - [#8843](https://github.com/gradio-app/gradio/pull/8843) [`6f95286`](https://github.com/gradio-app/gradio/commit/6f95286337459efbccb95c9cfac63355669df9ee) - Disable liking user message in chatbot by default but make it configurable
267
- - [#8843](https://github.com/gradio-app/gradio/pull/8843) [`6f95286`](https://github.com/gradio-app/gradio/commit/6f95286337459efbccb95c9cfac63355669df9ee) - Open audio/image input stream only when queue is ready
268
- - [#8843](https://github.com/gradio-app/gradio/pull/8843) [`6f95286`](https://github.com/gradio-app/gradio/commit/6f95286337459efbccb95c9cfac63355669df9ee) - Send Streaming data over Websocket if possible. Also support base64 output format for images.
269
- - [#8843](https://github.com/gradio-app/gradio/pull/8843) [`6f95286`](https://github.com/gradio-app/gradio/commit/6f95286337459efbccb95c9cfac63355669df9ee) - Streaming inputs for 5.0
270
- - [#8843](https://github.com/gradio-app/gradio/pull/8843) [`6f95286`](https://github.com/gradio-app/gradio/commit/6f95286337459efbccb95c9cfac63355669df9ee) - fix SSR apps on spaces
271
- - [#8843](https://github.com/gradio-app/gradio/pull/8843) [`6f95286`](https://github.com/gradio-app/gradio/commit/6f95286337459efbccb95c9cfac63355669df9ee) - Ssr part 2
272
- - [#8843](https://github.com/gradio-app/gradio/pull/8843) [`6f95286`](https://github.com/gradio-app/gradio/commit/6f95286337459efbccb95c9cfac63355669df9ee) - prefix api routes
273
-
274
- ### Fixes
275
-
276
-
277
- - [#8843](https://github.com/gradio-app/gradio/pull/8843) [`6f95286`](https://github.com/gradio-app/gradio/commit/6f95286337459efbccb95c9cfac63355669df9ee) - Trigger state change event on iterators
278
-
279
- ## 1.6.0-beta.4
280
-
281
- ### Features
282
-
283
- - [#9483](https://github.com/gradio-app/gradio/pull/9483) [`8dc7c12`](https://github.com/gradio-app/gradio/commit/8dc7c12389311b60efcde1b9d3e3668a34d2dc00) - Send Streaming data over Websocket if possible. Also support base64 output format for images. Thanks @freddyaboulton!
284
-
285
- ## 1.6.0-beta.3
286
-
287
- ### Features
288
-
289
- - [#9412](https://github.com/gradio-app/gradio/pull/9412) [`c2c2fd9`](https://github.com/gradio-app/gradio/commit/c2c2fd989348f826566773c07c0e0bda200199ff) - fix SSR apps on spaces. Thanks @pngwn!
290
-
291
- ## 1.6.0-beta.2
292
-
293
- ### Features
294
-
295
- - [#9323](https://github.com/gradio-app/gradio/pull/9323) [`06babda`](https://github.com/gradio-app/gradio/commit/06babda0395fd3fbd323c1c3cb33704ecfd6deb0) - Disable liking user message in chatbot by default but make it configurable. Thanks @freddyaboulton!
296
- - [#9339](https://github.com/gradio-app/gradio/pull/9339) [`4c8c6f2`](https://github.com/gradio-app/gradio/commit/4c8c6f2fe603081941c5fdc43f48a0632b9f31ad) - Ssr part 2. Thanks @pngwn!
297
-
298
- ### Fixes
299
-
300
- - [#9299](https://github.com/gradio-app/gradio/pull/9299) [`aa35b07`](https://github.com/gradio-app/gradio/commit/aa35b0788e613fdd45446d267513e6f94fa208ea) - Trigger state change event on iterators. Thanks @freddyaboulton!
301
-
302
- ## 1.6.0-beta.1
303
-
304
- ### Features
305
-
306
- - [#9200](https://github.com/gradio-app/gradio/pull/9200) [`2e179d3`](https://github.com/gradio-app/gradio/commit/2e179d35be6ed60a5a6bfc7303178d63e41781ad) - prefix api routes. Thanks @pngwn!
307
-
308
- ## 1.6.0-beta.0
309
-
310
- ### Features
311
-
312
- - [#9149](https://github.com/gradio-app/gradio/pull/9149) [`3d7a9b8`](https://github.com/gradio-app/gradio/commit/3d7a9b81f6fef06187eca832471dc1692eb493a0) - Open audio/image input stream only when queue is ready. Thanks @freddyaboulton!
313
- - [#8941](https://github.com/gradio-app/gradio/pull/8941) [`97a7bf6`](https://github.com/gradio-app/gradio/commit/97a7bf66a79179d1b91a3199d68e5c11216ca500) - Streaming inputs for 5.0. Thanks @freddyaboulton!
314
-
315
- ## 1.5.2
316
-
317
- ### Fixes
318
-
319
- - [#9163](https://github.com/gradio-app/gradio/pull/9163) [`2b6cbf2`](https://github.com/gradio-app/gradio/commit/2b6cbf25908e42cf027324e54ef2cc0baad11a91) - fix exports and generate types. Thanks @pngwn!
320
-
321
- ## 1.5.1
322
-
323
- ### Features
324
-
325
- - [#9118](https://github.com/gradio-app/gradio/pull/9118) [`e1c404d`](https://github.com/gradio-app/gradio/commit/e1c404da1143fb52b659d03e028bdba1badf443d) - setup npm-previews of all packages. Thanks @pngwn!
326
-
327
- ## 1.5.0
328
-
329
- ### Features
330
-
331
- - [#8965](https://github.com/gradio-app/gradio/pull/8965) [`d30432e`](https://github.com/gradio-app/gradio/commit/d30432e9c6d4cc1e5cfd989a1a3ae4aba7e21290) - harden CI. Thanks @pngwn!
332
-
333
- ### Fixes
334
-
335
- - [#8847](https://github.com/gradio-app/gradio/pull/8847) [`4d8a473`](https://github.com/gradio-app/gradio/commit/4d8a473632e388a312aee5c705b3c1f79853441b) - fix: wrong named param check for js client. Thanks @freddyaboulton!
336
-
337
- ## 1.4.0
338
-
339
- ### Features
340
-
341
- - [#8816](https://github.com/gradio-app/gradio/pull/8816) [`9ee6839`](https://github.com/gradio-app/gradio/commit/9ee6839f94d23d685a800ed3a275206e0b0e48f6) - Change optionality of the `data` param in `submit` + `predict`. Thanks @hannahblair!
342
-
343
- ### Fixes
344
-
345
- - [#8820](https://github.com/gradio-app/gradio/pull/8820) [`5050b36`](https://github.com/gradio-app/gradio/commit/5050b36221e75a18d8a5d4f74a725e70768a4c4a) - fix: wrong named param check for js client. Thanks @JacobLinCool!
346
-
347
- ## 1.3.0
348
-
349
- ### Fixes
350
-
351
- - [#8699](https://github.com/gradio-app/gradio/pull/8699) [`012da05`](https://github.com/gradio-app/gradio/commit/012da05287846d94beb0ecdc28d7fbc48c4248ff) - Ensure JS client `status_callback` functionality works and improve status messages. Thanks @hannahblair!
352
- - [#8505](https://github.com/gradio-app/gradio/pull/8505) [`2943d6d`](https://github.com/gradio-app/gradio/commit/2943d6d68847314885dc6c5c0247083116017ca0) - Add Timer component. Thanks @aliabid94!
353
- - [#8715](https://github.com/gradio-app/gradio/pull/8715) [`a6b3c6c`](https://github.com/gradio-app/gradio/commit/a6b3c6ce4e1d06253860c72740024a9138e3a93a) - Ensure `@gradio/client`'s `submit` iterator releases as expected. Thanks @pngwn!
354
- - [#8716](https://github.com/gradio-app/gradio/pull/8716) [`e834d30`](https://github.com/gradio-app/gradio/commit/e834d302e44f7a54565129bf2c11acf4e882a59b) - ensure `@gradio/client` always returns the correct data. Thanks @pngwn!
355
- - [#8714](https://github.com/gradio-app/gradio/pull/8714) [`1b5b5b0`](https://github.com/gradio-app/gradio/commit/1b5b5b0b43e69ee84f3baad2aae59ffc9c4d995a) - Bind `fetch` and `stream` in JS client. Thanks @hannahblair!
356
- - [#8720](https://github.com/gradio-app/gradio/pull/8720) [`936c713`](https://github.com/gradio-app/gradio/commit/936c7137a99ef59efdf75bae5dd27eea2ac1f577) - Documents auth in the guides, in the view API page, and also types the Blocks.config object. Thanks @abidlabs!
357
-
358
- ## 1.2.1
359
-
360
- ### Features
361
-
362
- - [#8649](https://github.com/gradio-app/gradio/pull/8649) [`4b6c8b1`](https://github.com/gradio-app/gradio/commit/4b6c8b1c004cee67345a7f103ba2dc8e90b82e6c) - ensure `File` objects are handled in JS client `handle_file`. Thanks @hannahblair!
363
-
364
- ## 1.2.0
365
-
366
- ### Features
367
-
368
- - [#8489](https://github.com/gradio-app/gradio/pull/8489) [`c2a0d05`](https://github.com/gradio-app/gradio/commit/c2a0d056d679d90631d9ccd944dadd67e7e03b7f) - Control Display of Error, Info, Warning. Thanks @freddyaboulton!
369
- - [#8571](https://github.com/gradio-app/gradio/pull/8571) [`a77877f`](https://github.com/gradio-app/gradio/commit/a77877f62df7c610fcfac7b3b00e186a087c8ec6) - First time loading performance optimization. Thanks @baojianting!
370
- - [#8600](https://github.com/gradio-app/gradio/pull/8600) [`7289c4b`](https://github.com/gradio-app/gradio/commit/7289c4b036d8a78c48f8c9e66ba998e6730e80d2) - Add credentials: include and Cookie header to prevent 401 error. Thanks @yinkiu602!
371
- - [#8522](https://github.com/gradio-app/gradio/pull/8522) [`bdaa678`](https://github.com/gradio-app/gradio/commit/bdaa678d0c0a22250b41104f32e9121f98dc7437) - add handle_file docs. Thanks @pngwn!
372
-
373
- ### Fixes
374
-
375
- - [#8521](https://github.com/gradio-app/gradio/pull/8521) [`900cf25`](https://github.com/gradio-app/gradio/commit/900cf25256a5b0563860097d69aac28b6afbfd8b) - Ensure frontend functions work when they don't return a value. Thanks @pngwn!
376
- - [#8548](https://github.com/gradio-app/gradio/pull/8548) [`7fc0f51`](https://github.com/gradio-app/gradio/commit/7fc0f5149bb8d31f3d01b4151b478070499751ee) - Fix reload mode by implementing `close` on the client. Thanks @freddyaboulton!
377
-
378
- ## 1.1.1
379
-
380
- ### Features
381
-
382
- - [#8499](https://github.com/gradio-app/gradio/pull/8499) [`c5f6e77`](https://github.com/gradio-app/gradio/commit/c5f6e7722a197d4706419ade14276ddecf3196f8) - Cache break themes on change. Thanks @aliabid94!
383
-
384
- ## 1.1.0
385
-
386
- ### Features
387
-
388
- - [#8483](https://github.com/gradio-app/gradio/pull/8483) [`e2271e2`](https://github.com/gradio-app/gradio/commit/e2271e207d98074bf39b02ae3c5443b2f097627d) - documentation for @gradio/client. Thanks @pngwn!
389
- - [#8485](https://github.com/gradio-app/gradio/pull/8485) [`f8ebace`](https://github.com/gradio-app/gradio/commit/f8ebaceccef60a112603d290d10072ef4e938a6a) - Ensure all status are reported internally when calling `predict`. Thanks @pngwn!
390
-
391
- ## 1.0.0
392
-
393
- ### Highlights
394
-
395
- #### Clients 1.0 Launch! ([#8468](https://github.com/gradio-app/gradio/pull/8468) [`7cc0a0c`](https://github.com/gradio-app/gradio/commit/7cc0a0c1abea585c3f50ffb1ff78d2b08ddbdd92))
396
-
397
- We're excited to unveil the first major release of the Gradio clients.
398
- We've made it even easier to turn any Gradio application into a production endpoint thanks to the clients' **ergonomic**, **transparent**, and **portable** design.
399
-
400
- #### Ergonomic API 💆
401
-
402
- **Stream From a Gradio app in 5 lines**
403
-
404
- Use the `submit` method to get a job you can iterate over:
405
-
406
- ```python
407
- from gradio_client import Client
408
-
409
- client = Client("gradio/llm_stream")
410
-
411
- for result in client.submit("What's the best UI framework in Python?"):
412
- print(result)
413
- ```
414
-
415
- ```ts
416
- import { Client } from "@gradio/client";
417
-
418
- const client = await Client.connect("gradio/llm_stream")
419
- const job = client.submit("/predict", {"text": "What's the best UI framework in Python?"})
420
-
421
- for await (const msg of job) console.log(msg.data)
422
- ```
423
-
424
- **Use the same keyword arguments as the app**
425
-
426
-
427
- ```python
428
- from gradio_client import Client
429
-
430
- client = Client("http://127.0.0.1:7860/")
431
- result = client.predict(
432
- message="Hello!!",
433
- system_prompt="You are helpful AI.",
434
- tokens=10,
435
- api_name="/chat"
436
- )
437
- print(result)
438
- ```
439
-
440
- ```ts
441
- import { Client } from "@gradio/client";
442
-
443
- const client = await Client.connect("http://127.0.0.1:7860/");
444
- const result = await client.predict("/chat", {
445
- message: "Hello!!",
446
- system_prompt: "Hello!!",
447
- tokens: 10,
448
- });
449
-
450
- console.log(result.data);
451
- ```
452
-
453
- **Better Error Messages**
454
-
455
- If something goes wrong in the upstream app, the client will raise the same exception as the app provided that `show_error=True` in the original app's `launch()` function, or it's a `gr.Error` exception.
456
-
457
- #### Transparent Design 🪟
458
-
459
- Anything you can do in the UI, you can do with the client:
460
- * 🔒 Authentication
461
- * 🛑 Job Cancelling
462
- * ℹ️ Access Queue Position and API
463
- * 📕 View the API information
464
-
465
- Here's an example showing how to display the queue position of a pending job:
466
-
467
- ```python
468
- from gradio_client import Client
469
-
470
- client = Client("gradio/diffusion_model")
471
-
472
- job = client.submit("A cute cat")
473
- while not job.done():
474
- status = job.status()
475
- print(f"Current in position {status.rank} out of {status.queue_size}")
476
- ```
477
-
478
- #### Portable Design ⛺️
479
-
480
- The client can run from pretty much any python and javascript environment (node, deno, the browser, Service Workers).
481
-
482
- Here's an example using the client from a Flask server using gevent:
483
-
484
- ```python
485
- from gevent import monkey
486
- monkey.patch_all()
487
-
488
- from gradio_client import Client
489
- from flask import Flask, send_file
490
- import time
491
-
492
- app = Flask(__name__)
493
-
494
- imageclient = Client("gradio/diffusion_model")
495
-
496
- @app.route("/gen")
497
- def gen():
498
- result = imageclient.predict(
499
- "A cute cat",
500
- api_name="/predict"
501
- )
502
- return send_file(result)
503
-
504
- if __name__ == "__main__":
505
- app.run(host="0.0.0.0", port=5000)
506
- ```
507
-
508
- #### 1.0 Migration Guide and Breaking Changes
509
-
510
- **Python**
511
- - The `serialize` argument of the `Client` class was removed. Has no effect.
512
- - The `upload_files` argument of the `Client` was removed.
513
- - All filepaths must be wrapped in the `handle_file` method. Example:
514
- ```python
515
- from gradio_client import Client, handle_file
516
-
517
- client = Client("gradio/image_captioner")
518
- client.predict(handle_file("cute_cat.jpg"))
519
- ```
520
- - The `output_dir` argument was removed. It is not specified in the `download_files` argument.
521
-
522
-
523
- **Javascript**
524
- The client has been redesigned entirely. It was refactored from a function into a class. An instance can now be constructed by awaiting the `connect` method.
525
-
526
- ```js
527
- const app = await Client.connect("gradio/whisper")
528
- ```
529
- The app variable has the same methods as the python class (`submit`, `predict`, `view_api`, `duplicate`).
530
-
531
-
532
-
533
- #### Additional Changes
534
-
535
- - [#8243](https://github.com/gradio-app/gradio/pull/8243) - Set orig_name in python client file uploads.
536
- - [#8264](https://github.com/gradio-app/gradio/pull/8264) - Make exceptions in the Client more specific.
537
- - [#8247](https://github.com/gradio-app/gradio/pull/8247) - Fix api recorder.
538
- - [#8276](https://github.com/gradio-app/gradio/pull/8276) - Fix bug where client could not connect to apps that had self signed certificates.
539
- - [#8245](https://github.com/gradio-app/gradio/pull/8245) - Cancel server progress from the python client.
540
- - [#8200](https://github.com/gradio-app/gradio/pull/8200) - Support custom components in gr.load
541
- - [#8182](https://github.com/gradio-app/gradio/pull/8182) - Convert sse calls in client from async to sync.
542
- - [#7732](https://github.com/gradio-app/gradio/pull/7732) - Adds support for kwargs and default arguments in the python client, and improves how parameter information is displayed in the "view API" page.
543
- - [#7888](https://github.com/gradio-app/gradio/pull/7888) - Cache view_api info in server and python client.
544
- - [#7575](https://github.com/gradio-app/gradio/pull/7575) - Files should now be supplied as `file(...)` in the Client, and some fixes to `gr.load()` as well.
545
- - [#8401](https://github.com/gradio-app/gradio/pull/8401) - Add CDN installation to JS docs.
546
- - [#8299](https://github.com/gradio-app/gradio/pull/8299) - Allow JS Client to work with authenticated spaces 🍪.
547
- - [#8408](https://github.com/gradio-app/gradio/pull/8408) - Connect heartbeat if state created in render. Also fix config cleanup bug #8407.
548
- - [#8258](https://github.com/gradio-app/gradio/pull/8258) - Improve URL handling in JS Client.
549
- - [#8322](https://github.com/gradio-app/gradio/pull/8322) - ensure the client correctly handles all binary data.
550
- - [#8296](https://github.com/gradio-app/gradio/pull/8296) - always create a jwt when connecting to a space if a hf_token is present.
551
- - [#8285](https://github.com/gradio-app/gradio/pull/8285) - use the correct query param to pass the jwt to the heartbeat event.
552
- - [#8272](https://github.com/gradio-app/gradio/pull/8272) - ensure client works for private spaces.
553
- - [#8197](https://github.com/gradio-app/gradio/pull/8197) - Add support for passing keyword args to `data` in JS client.
554
- - [#8252](https://github.com/gradio-app/gradio/pull/8252) - Client node fix.
555
- - [#8209](https://github.com/gradio-app/gradio/pull/8209) - Rename `eventSource_Factory` and `fetch_implementation`.
556
- - [#8109](https://github.com/gradio-app/gradio/pull/8109) - Implement JS Client tests.
557
- - [#8211](https://github.com/gradio-app/gradio/pull/8211) - remove redundant event source logic.
558
- - [#8179](https://github.com/gradio-app/gradio/pull/8179) - rework upload to be a class method + pass client into each component.
559
- - [#8181](https://github.com/gradio-app/gradio/pull/8181) - Ensure connectivity to private HF spaces with SSE protocol.
560
- - [#8169](https://github.com/gradio-app/gradio/pull/8169) - Only connect to heartbeat if needed.
561
- - [#8118](https://github.com/gradio-app/gradio/pull/8118) - Add eventsource polyfill for Node.js and browser environments.
562
- - [#7646](https://github.com/gradio-app/gradio/pull/7646) - Refactor JS Client.
563
- - [#7974](https://github.com/gradio-app/gradio/pull/7974) - Fix heartbeat in the js client to be Lite compatible.
564
- - [#7926](https://github.com/gradio-app/gradio/pull/7926) - Fixes streaming event race condition.
565
-
566
- Thanks @freddyaboulton!
567
-
568
- ### Features
569
-
570
- - [#8370](https://github.com/gradio-app/gradio/pull/8370) [`48eeea4`](https://github.com/gradio-app/gradio/commit/48eeea4eaab7e24168688e3c3fbafb30e4e78d51) - Refactor Cancelling Logic To Use /cancel. Thanks @freddyaboulton!
571
-
572
- ### Fixes
573
-
574
- - [#8477](https://github.com/gradio-app/gradio/pull/8477) [`d5a9604`](https://github.com/gradio-app/gradio/commit/d5a960493017a4890685af61d78ce7d3b3b12e6b) - Fix js client bundle. Thanks @pngwn!
575
- - [#8451](https://github.com/gradio-app/gradio/pull/8451) [`9d2d605`](https://github.com/gradio-app/gradio/commit/9d2d6051caed5c8749a26a6fa7480a5ae6e6c4f3) - Change client submit API to be an AsyncIterable and support more platforms. Thanks @pngwn!
576
- - [#8462](https://github.com/gradio-app/gradio/pull/8462) [`6447dfa`](https://github.com/gradio-app/gradio/commit/6447dface4d46db1c69460e8325a1928d0476a46) - Improve file handling in JS Client. Thanks @hannahblair!
577
- - [#8439](https://github.com/gradio-app/gradio/pull/8439) [`63d36fb`](https://github.com/gradio-app/gradio/commit/63d36fbbf4bf6dc909be9a0ffc7b6bf6621d83e8) - Handle gradio apps using `state` in the JS Client. Thanks @hannahblair!
578
-
579
- ## 0.20.1
580
-
581
- ### Features
582
-
583
- - [#8415](https://github.com/gradio-app/gradio/pull/8415) [`227de35`](https://github.com/gradio-app/gradio/commit/227de352982b3dcdf9384eaa28b7e9cf09afb6e8) - Fix spaces load error. Thanks @aliabid94!
584
-
585
- ## 0.20.0
586
-
587
- ### Features
588
-
589
- - [#8401](https://github.com/gradio-app/gradio/pull/8401) [`d078621`](https://github.com/gradio-app/gradio/commit/d078621928136c09ca902d2f37594ed887c67d2e) - Add CDN installation to JS docs. Thanks @hannahblair!
590
- - [#8243](https://github.com/gradio-app/gradio/pull/8243) [`55f664f`](https://github.com/gradio-app/gradio/commit/55f664f2979a49acc29a73cde16c6ebdfcc91db2) - Add event listener support to render blocks. Thanks @aliabid94!
591
- - [#8398](https://github.com/gradio-app/gradio/pull/8398) [`945ac83`](https://github.com/gradio-app/gradio/commit/945ac837e779b120790814ea6f6f81bd2712f5f8) - Improve rendering. Thanks @aliabid94!
592
- - [#8299](https://github.com/gradio-app/gradio/pull/8299) [`ab65360`](https://github.com/gradio-app/gradio/commit/ab653608045ff9462db7ad9fe63e1c60bf20e773) - Allow JS Client to work with authenticated spaces 🍪. Thanks @hannahblair!
593
-
594
- ### Fixes
595
-
596
- - [#8408](https://github.com/gradio-app/gradio/pull/8408) [`e86dd01`](https://github.com/gradio-app/gradio/commit/e86dd01b6e8f7bab3d3c25b84f2ad33129138af4) - Connect heartbeat if state created in render. Also fix config cleanup bug #8407. Thanks @freddyaboulton!
597
- - [#8258](https://github.com/gradio-app/gradio/pull/8258) [`1f8e5c4`](https://github.com/gradio-app/gradio/commit/1f8e5c44e054b943052d8f24d044696ddfd01a54) - Improve URL handling in JS Client. Thanks @hannahblair!
598
-
599
- ## 0.19.4
600
-
601
- ### Fixes
602
-
603
- - [#8322](https://github.com/gradio-app/gradio/pull/8322) [`47012a0`](https://github.com/gradio-app/gradio/commit/47012a0c4e3e8a80fcae620aaf08b16ceb343cde) - ensure the client correctly handles all binary data. Thanks @Saghen!
604
-
605
- ## 0.19.3
606
-
607
- ### Features
608
-
609
- - [#8229](https://github.com/gradio-app/gradio/pull/8229) [`7c81897`](https://github.com/gradio-app/gradio/commit/7c81897076ddcd0bb05e0e4ffec35bb9a986d330) - chore(deps): update dependency esbuild to ^0.21.0. Thanks @renovate!
610
-
611
- ### Fixes
612
-
613
- - [#8296](https://github.com/gradio-app/gradio/pull/8296) [`929d216`](https://github.com/gradio-app/gradio/commit/929d216d49aa05614bc83f0761cf7b1cd803d8fe) - always create a jwt when connecting to a space if a hf_token is present. Thanks @pngwn!
614
-
615
- ## 0.19.2
616
-
617
- ### Fixes
618
-
619
- - [#8285](https://github.com/gradio-app/gradio/pull/8285) [`7d9d8ea`](https://github.com/gradio-app/gradio/commit/7d9d8eab50d36cbecbb84c6a0f3cc1bca7215604) - use the correct query param to pass the jwt to the heartbeat event. Thanks @pngwn!
620
-
621
- ## 0.19.1
622
-
623
- ### Fixes
624
-
625
- - [#8272](https://github.com/gradio-app/gradio/pull/8272) [`fbf4edd`](https://github.com/gradio-app/gradio/commit/fbf4edde7c896cdf4c903463e44c31ed96111b3c) - ensure client works for private spaces. Thanks @pngwn!
626
-
627
- ## 0.19.0
628
-
629
- ### Features
630
-
631
- - [#8110](https://github.com/gradio-app/gradio/pull/8110) [`5436031`](https://github.com/gradio-app/gradio/commit/5436031f92c1596282eb64e1e74d555f279e9697) - Render decorator 2. Thanks @aliabid94!
632
- - [#8197](https://github.com/gradio-app/gradio/pull/8197) [`e09b4e8`](https://github.com/gradio-app/gradio/commit/e09b4e8216b970bc1b142a0f08e7d190b954eb35) - Add support for passing keyword args to `data` in JS client. Thanks @hannahblair!
633
-
634
- ### Fixes
635
-
636
- - [#8252](https://github.com/gradio-app/gradio/pull/8252) [`22df61a`](https://github.com/gradio-app/gradio/commit/22df61a26adf8023f6dd49c051979990e8d3879a) - Client node fix. Thanks @pngwn!
637
-
638
- ## 0.18.0
639
-
640
- ### Features
641
-
642
- - [#8121](https://github.com/gradio-app/gradio/pull/8121) [`f5b710c`](https://github.com/gradio-app/gradio/commit/f5b710c919b0ce604ea955f0d5f4faa91095ca4a) - chore(deps): update dependency eslint to v9. Thanks @renovate!
643
- - [#8209](https://github.com/gradio-app/gradio/pull/8209) [`b9afe93`](https://github.com/gradio-app/gradio/commit/b9afe93915401df5bd6737c89395c2477acfa585) - Rename `eventSource_Factory` and `fetch_implementation`. Thanks @hannahblair!
644
- - [#8109](https://github.com/gradio-app/gradio/pull/8109) [`bed2f82`](https://github.com/gradio-app/gradio/commit/bed2f82e2297b50f7b59423a3de05af0b9910724) - Implement JS Client tests. Thanks @hannahblair!
645
- - [#8211](https://github.com/gradio-app/gradio/pull/8211) [`91b5cd6`](https://github.com/gradio-app/gradio/commit/91b5cd6132fb8903c92f70fce0800324836a1fc3) - remove redundant event source logic. Thanks @hannahblair!
646
-
647
- ### Fixes
648
-
649
- - [#8179](https://github.com/gradio-app/gradio/pull/8179) [`6a218b4`](https://github.com/gradio-app/gradio/commit/6a218b4148095aaa0c58d8c20973ba01c8764fc2) - rework upload to be a class method + pass client into each component. Thanks @pngwn!
650
- - [#8181](https://github.com/gradio-app/gradio/pull/8181) [`cf52ca6`](https://github.com/gradio-app/gradio/commit/cf52ca6a51320ece97f009a177792840b5fbc785) - Ensure connectivity to private HF spaces with SSE protocol. Thanks @hannahblair!
651
- - [#8169](https://github.com/gradio-app/gradio/pull/8169) [`3a6f1a5`](https://github.com/gradio-app/gradio/commit/3a6f1a50b263e0a733f609a08019fc4d05480e1a) - Only connect to heartbeat if needed. Thanks @freddyaboulton!
652
- - [#8118](https://github.com/gradio-app/gradio/pull/8118) [`7aca673`](https://github.com/gradio-app/gradio/commit/7aca673b38a087533524b2fd8dd3a03e0e4bacfe) - Add eventsource polyfill for Node.js and browser environments. Thanks @hannahblair!
653
-
654
- ## 0.17.0
655
-
656
- ### Highlights
657
-
658
- #### Setting File Upload Limits ([#7909](https://github.com/gradio-app/gradio/pull/7909) [`2afca65`](https://github.com/gradio-app/gradio/commit/2afca6541912b37dc84f447c7ad4af21607d7c72))
659
-
660
- We have added a `max_file_size` size parameter to `launch()` that limits to size of files uploaded to the server. This limit applies to each individual file. This parameter can be specified as a string or an integer (corresponding to the size in bytes).
661
-
662
- The following code snippet sets a max file size of 5 megabytes.
663
-
664
- ```python
665
- import gradio as gr
666
-
667
- demo = gr.Interface(lambda x: x, "image", "image")
668
-
669
- demo.launch(max_file_size="5mb")
670
- # or
671
- demo.launch(max_file_size=5 * gr.FileSize.MB)
672
- ```
673
-
674
- ![max_file_size_upload](https://github.com/gradio-app/gradio/assets/41651716/7547330c-a082-4901-a291-3f150a197e45)
675
-
676
-
677
- #### Error states can now be cleared
678
-
679
- When a component encounters an error, the error state shown in the UI can now be cleared by clicking on the `x` icon in the top right of the component. This applies to all types of errors, whether it's raised in the UI or the server.
680
-
681
- ![error_modal_calculator](https://github.com/gradio-app/gradio/assets/41651716/16cb071c-accd-45a6-9c18-0dea27d4bd98)
682
-
683
- Thanks @freddyaboulton!
684
-
685
- ### Features
686
-
687
- - [#8056](https://github.com/gradio-app/gradio/pull/8056) [`2e469a5`](https://github.com/gradio-app/gradio/commit/2e469a5f99e52a5011a010f46e47dde7bb0c7140) - Using keys to preserve values between reloads. Thanks @aliabid94!
688
- - [#7646](https://github.com/gradio-app/gradio/pull/7646) [`450b8cc`](https://github.com/gradio-app/gradio/commit/450b8cc898f130f15caa3742f65c17b9f7a8f398) - Refactor JS Client. Thanks @hannahblair!
689
- - [#8061](https://github.com/gradio-app/gradio/pull/8061) [`17e83c9`](https://github.com/gradio-app/gradio/commit/17e83c958ebb35b3e122ca486067d1bd5ce33a22) - Docs Reorg and Intro Page. Thanks @aliabd!
690
-
691
- ### Fixes
692
-
693
- - [#8066](https://github.com/gradio-app/gradio/pull/8066) [`624f9b9`](https://github.com/gradio-app/gradio/commit/624f9b9477f74a581a6c14119234f9efdfcda398) - make gradio dev tools a local dependency rather than bundling. Thanks @pngwn!
694
-
695
- ## 0.16.0
696
-
697
- ### Features
698
-
699
- - [#7845](https://github.com/gradio-app/gradio/pull/7845) [`dbb7373`](https://github.com/gradio-app/gradio/commit/dbb7373dde69d4ed2741942b5a1898f8620cec24) - ensure `ImageEditor` events work as expected. Thanks @pngwn!
700
-
701
- ### Fixes
702
-
703
- - [#7974](https://github.com/gradio-app/gradio/pull/7974) [`79e0aa8`](https://github.com/gradio-app/gradio/commit/79e0aa81c94e755faa6e85d76ac5d5a666313e6a) - Fix heartbeat in the js client to be Lite compatible. Thanks @whitphx!
704
-
705
- ## 0.15.1
706
-
707
- ### Fixes
708
-
709
- - [#7926](https://github.com/gradio-app/gradio/pull/7926) [`9666854`](https://github.com/gradio-app/gradio/commit/966685479078f59430b3bced7e6068eb8157c003) - Fixes streaming event race condition. Thanks @aliabid94!
710
-
711
- ## 0.15.0
712
-
713
- ### Highlights
714
-
715
- #### Automatically delete state after user has disconnected from the webpage ([#7829](https://github.com/gradio-app/gradio/pull/7829) [`6a4bf7a`](https://github.com/gradio-app/gradio/commit/6a4bf7abe29059dbdc6a342e0366fdaa2e4120ee))
716
-
717
- Gradio now automatically deletes `gr.State` variables stored in the server's RAM when users close their browser tab.
718
- The deletion will happen 60 minutes after the server detected a disconnect from the user's browser.
719
- If the user connects again in that timeframe, their state will not be deleted.
720
-
721
- Additionally, Gradio now includes a `Blocks.unload()` event, allowing you to run arbitrary cleanup functions when users disconnect (this does not have a 60 minute delay).
722
- You can think of the `unload` event as the opposite of the `load` event.
723
-
724
-
725
- ```python
726
- with gr.Blocks() as demo:
727
- gr.Markdown(
728
- """# State Cleanup Demo
729
- 🖼️ Images are saved in a user-specific directory and deleted when the users closes the page via demo.unload.
730
- """)
731
- with gr.Row():
732
- with gr.Column(scale=1):
733
- with gr.Row():
734
- img = gr.Image(label="Generated Image", height=300, width=300)
735
- with gr.Row():
736
- gen = gr.Button(value="Generate")
737
- with gr.Row():
738
- history = gr.Gallery(label="Previous Generations", height=500, columns=10)
739
- state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
740
-
741
- demo.load(generate_random_img, [state], [img, state, history])
742
- gen.click(generate_random_img, [state], [img, state, history])
743
- demo.unload(delete_directory)
744
-
745
-
746
- demo.launch(auth=lambda user,pwd: True,
747
- auth_message="Enter any username and password to continue")
748
- ```
749
-
750
- Thanks @freddyaboulton!
751
-
752
- ## 0.14.0
753
-
754
- ### Features
755
-
756
- - [#7691](https://github.com/gradio-app/gradio/pull/7691) [`84f81fe`](https://github.com/gradio-app/gradio/commit/84f81fec9287b041203a141bbf2852720f7d199c) - Closing stream from the backend. Thanks @aliabid94!
757
-
758
- ### Fixes
759
-
760
- - [#7564](https://github.com/gradio-app/gradio/pull/7564) [`5d1e8da`](https://github.com/gradio-app/gradio/commit/5d1e8dae5ac23f605c3b5f41dbe18751dff380a0) - batch UI updates on a per frame basis. Thanks @pngwn!
761
-
762
- ## 0.13.0
763
-
764
- ### Fixes
765
-
766
- - [#7575](https://github.com/gradio-app/gradio/pull/7575) [`d0688b3`](https://github.com/gradio-app/gradio/commit/d0688b3c25feabb4fc7dfa0ab86086b3af7eb337) - Files should now be supplied as `file(...)` in the Client, and some fixes to `gr.load()` as well. Thanks @abidlabs!
767
-
768
- ## 0.12.2
769
-
770
- ### Features
771
-
772
- - [#7528](https://github.com/gradio-app/gradio/pull/7528) [`eda33b3`](https://github.com/gradio-app/gradio/commit/eda33b3763897a542acf298e523fa493dc655aee) - Refactors `get_fetchable_url_or_file()` to remove it from the frontend. Thanks [@abidlabs](https://github.com/abidlabs)!
773
- - [#7340](https://github.com/gradio-app/gradio/pull/7340) [`4b0d589`](https://github.com/gradio-app/gradio/commit/4b0d58933057432758a54169a360eb352903d6b4) - chore(deps): update all non-major dependencies. Thanks [@renovate](https://github.com/apps/renovate)!
774
-
775
- ## 0.12.1
776
-
777
- ### Fixes
778
-
779
- - [#7411](https://github.com/gradio-app/gradio/pull/7411) [`32b317f`](https://github.com/gradio-app/gradio/commit/32b317f24e3d43f26684bb9f3964f31efd0ea556) - Set `root` correctly for Gradio apps that are deployed behind reverse proxies. Thanks [@abidlabs](https://github.com/abidlabs)!
780
-
781
- ## 0.12.0
782
-
783
- ### Features
784
-
785
- - [#7183](https://github.com/gradio-app/gradio/pull/7183) [`49d9c48`](https://github.com/gradio-app/gradio/commit/49d9c48537aa706bf72628e3640389470138bdc6) - [WIP] Refactor file normalization to be in the backend and remove it from the frontend of each component. Thanks [@abidlabs](https://github.com/abidlabs)!
786
-
787
- ## 0.11.0
788
-
789
- ### Features
790
-
791
- - [#7102](https://github.com/gradio-app/gradio/pull/7102) [`68a54a7`](https://github.com/gradio-app/gradio/commit/68a54a7a310d8d7072fdae930bf1cfdf12c45a7f) - Improve chatbot streaming performance with diffs. Thanks [@aliabid94](https://github.com/aliabid94)!/n Note that this PR changes the API format for generator functions, which would be a breaking change for any clients reading the EventStream directly
792
-
793
- ## 0.10.1
794
-
795
- ### Fixes
796
-
797
- - [#7055](https://github.com/gradio-app/gradio/pull/7055) [`3c3cf86`](https://github.com/gradio-app/gradio/commit/3c3cf8618a8cad1ef66a7f96664923d2c9f5e0e2) - Fix UI freeze on rapid generators. Thanks [@aliabid94](https://github.com/aliabid94)!
798
-
799
- ## 0.10.0
800
-
801
- ### Features
802
-
803
- - [#6931](https://github.com/gradio-app/gradio/pull/6931) [`6c863af`](https://github.com/gradio-app/gradio/commit/6c863af92fa9ceb5c638857eb22cc5ddb718d549) - Fix functional tests. Thanks [@aliabid94](https://github.com/aliabid94)!
804
- - [#6820](https://github.com/gradio-app/gradio/pull/6820) [`649cd4d`](https://github.com/gradio-app/gradio/commit/649cd4d68041d11fcbe31f8efa455345ac49fc74) - Use `EventSource_factory` in `open_stream()` for Wasm. Thanks [@whitphx](https://github.com/whitphx)!
805
-
806
- ## 0.9.4
807
-
808
- ### Fixes
809
-
810
- - [#6863](https://github.com/gradio-app/gradio/pull/6863) [`d406855`](https://github.com/gradio-app/gradio/commit/d4068557953746662235d595ec435c42ceb24414) - Fix JS Client when app is running behind a proxy. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
811
-
812
- ## 0.9.3
813
-
814
- ### Features
815
-
816
- - [#6814](https://github.com/gradio-app/gradio/pull/6814) [`828fb9e`](https://github.com/gradio-app/gradio/commit/828fb9e6ce15b6ea08318675a2361117596a1b5d) - Refactor queue so that there are separate queues for each concurrency id. Thanks [@aliabid94](https://github.com/aliabid94)!
817
-
818
- ## 0.9.2
819
-
820
- ### Features
821
-
822
- - [#6798](https://github.com/gradio-app/gradio/pull/6798) [`245d58e`](https://github.com/gradio-app/gradio/commit/245d58eff788e8d44a59d37a2d9b26d0f08a62b4) - Improve how server/js client handle unexpected errors. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
823
-
824
- ## 0.9.1
825
-
826
- ### Fixes
827
-
828
- - [#6693](https://github.com/gradio-app/gradio/pull/6693) [`34f9431`](https://github.com/gradio-app/gradio/commit/34f943101bf7dd6b8a8974a6131c1ed7c4a0dac0) - Python client properly handles hearbeat and log messages. Also handles responses longer than 65k. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
829
-
830
- ## 0.9.0
831
-
832
- ### Features
833
-
834
- - [#6398](https://github.com/gradio-app/gradio/pull/6398) [`67ddd40`](https://github.com/gradio-app/gradio/commit/67ddd40b4b70d3a37cb1637c33620f8d197dbee0) - Lite v4. Thanks [@whitphx](https://github.com/whitphx)!
835
-
836
- ### Fixes
837
-
838
- - [#6556](https://github.com/gradio-app/gradio/pull/6556) [`d76bcaa`](https://github.com/gradio-app/gradio/commit/d76bcaaaf0734aaf49a680f94ea9d4d22a602e70) - Fix api event drops. Thanks [@aliabid94](https://github.com/aliabid94)!
839
-
840
- ## 0.8.2
841
-
842
- ### Features
843
-
844
- - [#6511](https://github.com/gradio-app/gradio/pull/6511) [`71f1a1f99`](https://github.com/gradio-app/gradio/commit/71f1a1f9931489d465c2c1302a5c8d768a3cd23a) - Mark `FileData.orig_name` optional on the frontend aligning the type definition on the Python side. Thanks [@whitphx](https://github.com/whitphx)!
845
-
846
- ## 0.8.1
847
-
848
- ### Fixes
849
-
850
- - [#6383](https://github.com/gradio-app/gradio/pull/6383) [`324867f63`](https://github.com/gradio-app/gradio/commit/324867f63c920113d89a565892aa596cf8b1e486) - Fix event target. Thanks [@aliabid94](https://github.com/aliabid94)!
851
-
852
- ## 0.8.0
853
-
854
- ### Features
855
-
856
- - [#6307](https://github.com/gradio-app/gradio/pull/6307) [`f1409f95e`](https://github.com/gradio-app/gradio/commit/f1409f95ed39c5565bed6a601e41f94e30196a57) - Provide status updates on file uploads. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
857
-
858
- ## 0.7.2
859
-
860
- ### Fixes
861
-
862
- - [#6327](https://github.com/gradio-app/gradio/pull/6327) [`bca6c2c80`](https://github.com/gradio-app/gradio/commit/bca6c2c80f7e5062427019de45c282238388af95) - Restore query parameters in request. Thanks [@aliabid94](https://github.com/aliabid94)!
863
-
864
- ## 0.7.1
865
-
866
- ### Features
867
-
868
- - [#6137](https://github.com/gradio-app/gradio/pull/6137) [`2ba14b284`](https://github.com/gradio-app/gradio/commit/2ba14b284f908aa13859f4337167a157075a68eb) - JS Param. Thanks [@dawoodkhan82](https://github.com/dawoodkhan82)!
869
-
870
- ## 0.7.0
871
-
872
- ### Features
873
-
874
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - fix circular dependency with client + upload. Thanks [@pngwn](https://github.com/pngwn)!
875
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Image v4. Thanks [@pngwn](https://github.com/pngwn)!
876
- - [#5498](https://github.com/gradio-app/gradio/pull/5498) [`287fe6782`](https://github.com/gradio-app/gradio/commit/287fe6782825479513e79a5cf0ba0fbfe51443d7) - Swap websockets for SSE. Thanks [@pngwn](https://github.com/pngwn)!
877
-
878
- ## 0.7.0-beta.1
879
-
880
- ### Features
881
-
882
- - [#6143](https://github.com/gradio-app/gradio/pull/6143) [`e4f7b4b40`](https://github.com/gradio-app/gradio/commit/e4f7b4b409323b01aa01b39e15ce6139e29aa073) - fix circular dependency with client + upload. Thanks [@pngwn](https://github.com/pngwn)!
883
- - [#6094](https://github.com/gradio-app/gradio/pull/6094) [`c476bd5a5`](https://github.com/gradio-app/gradio/commit/c476bd5a5b70836163b9c69bf4bfe068b17fbe13) - Image v4. Thanks [@pngwn](https://github.com/pngwn)!
884
- - [#6069](https://github.com/gradio-app/gradio/pull/6069) [`bf127e124`](https://github.com/gradio-app/gradio/commit/bf127e1241a41401e144874ea468dff8474eb505) - Swap websockets for SSE. Thanks [@aliabid94](https://github.com/aliabid94)!
885
-
886
- ## 0.7.0-beta.0
887
-
888
- ### Features
889
-
890
- - [#6016](https://github.com/gradio-app/gradio/pull/6016) [`83e947676`](https://github.com/gradio-app/gradio/commit/83e947676d327ca2ab6ae2a2d710c78961c771a0) - Format js in v4 branch. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
891
-
892
- ### Fixes
893
-
894
- - [#6046](https://github.com/gradio-app/gradio/pull/6046) [`dbb7de5e0`](https://github.com/gradio-app/gradio/commit/dbb7de5e02c53fee05889d696d764d212cb96c74) - fix tests. Thanks [@pngwn](https://github.com/pngwn)!
895
-
896
- ## 0.6.0
897
-
898
- ### Features
899
-
900
- - [#5972](https://github.com/gradio-app/gradio/pull/5972) [`11a300791`](https://github.com/gradio-app/gradio/commit/11a3007916071f0791844b0a37f0fb4cec69cea3) - Lite: Support opening the entrypoint HTML page directly in browser via the `file:` protocol. Thanks [@whitphx](https://github.com/whitphx)!
901
-
902
- ## 0.5.2
903
-
904
- ### Fixes
905
-
906
- - [#5840](https://github.com/gradio-app/gradio/pull/5840) [`4e62b8493`](https://github.com/gradio-app/gradio/commit/4e62b8493dfce50bafafe49f1a5deb929d822103) - Ensure websocket polyfill doesn't load if there is already a `global.Webocket` property set. Thanks [@Jay2theWhy](https://github.com/Jay2theWhy)!
907
-
908
- ## 0.5.1
909
-
910
- ### Fixes
911
-
912
- - [#5816](https://github.com/gradio-app/gradio/pull/5816) [`796145e2c`](https://github.com/gradio-app/gradio/commit/796145e2c48c4087bec17f8ec0be4ceee47170cb) - Fix calls to the component server so that `gr.FileExplorer` works on Spaces. Thanks [@abidlabs](https://github.com/abidlabs)!
913
-
914
- ## 0.5.0
915
-
916
- ### Highlights
917
-
918
- #### new `FileExplorer` component ([#5672](https://github.com/gradio-app/gradio/pull/5672) [`e4a307ed6`](https://github.com/gradio-app/gradio/commit/e4a307ed6cde3bbdf4ff2f17655739addeec941e))
919
-
920
- Thanks to a new capability that allows components to communicate directly with the server _without_ passing data via the value, we have created a new `FileExplorer` component.
921
-
922
- This component allows you to populate the explorer by passing a glob, but only provides the selected file(s) in your prediction function.
923
-
924
- Users can then navigate the virtual filesystem and select files which will be accessible in your predict function. This component will allow developers to build more complex spaces, with more flexible input options.
925
-
926
- ![output](https://github.com/pngwn/MDsveX/assets/12937446/ef108f0b-0e84-4292-9984-9dc66b3e144d)
927
-
928
- For more information check the [`FileExplorer` documentation](https://gradio.app/docs/fileexplorer).
929
-
930
- Thanks [@aliabid94](https://github.com/aliabid94)!
931
-
932
- ### Features
933
-
934
- - [#5787](https://github.com/gradio-app/gradio/pull/5787) [`caeee8bf7`](https://github.com/gradio-app/gradio/commit/caeee8bf7821fd5fe2f936ed82483bed00f613ec) - ensure the client does not depend on `window` when running in a node environment. Thanks [@gibiee](https://github.com/gibiee)!
935
-
936
- ### Fixes
937
-
938
- - [#5776](https://github.com/gradio-app/gradio/pull/5776) [`c0fef4454`](https://github.com/gradio-app/gradio/commit/c0fef44541bfa61568bdcfcdfc7d7d79869ab1df) - Revert replica proxy logic and instead implement using the `root` variable. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
939
-
940
- ## 0.4.2
941
-
942
- ### Features
943
-
944
- - [#5124](https://github.com/gradio-app/gradio/pull/5124) [`6e56a0d9b`](https://github.com/gradio-app/gradio/commit/6e56a0d9b0c863e76c69e1183d9d40196922b4cd) - Lite: Websocket queueing. Thanks [@whitphx](https://github.com/whitphx)!
945
-
946
- ## 0.4.1
947
-
948
- ### Fixes
949
-
950
- - [#5705](https://github.com/gradio-app/gradio/pull/5705) [`78e7cf516`](https://github.com/gradio-app/gradio/commit/78e7cf5163e8d205e8999428fce4c02dbdece25f) - ensure internal data has updated before dispatching `success` or `then` events. Thanks [@pngwn](https://github.com/pngwn)!
951
-
952
- ## 0.4.0
953
-
954
- ### Features
955
-
956
- - [#5682](https://github.com/gradio-app/gradio/pull/5682) [`c57f1b75e`](https://github.com/gradio-app/gradio/commit/c57f1b75e272c76b0af4d6bd0c7f44743ff34f26) - Fix functional tests. Thanks [@abidlabs](https://github.com/abidlabs)!
957
- - [#5681](https://github.com/gradio-app/gradio/pull/5681) [`40de3d217`](https://github.com/gradio-app/gradio/commit/40de3d2178b61ebe424b6f6228f94c0c6f679bea) - add query parameters to the `gr.Request` object through the `query_params` attribute. Thanks [@DarhkVoyd](https://github.com/DarhkVoyd)!
958
- - [#5653](https://github.com/gradio-app/gradio/pull/5653) [`ea0e00b20`](https://github.com/gradio-app/gradio/commit/ea0e00b207b4b90a10e9d054c4202d4e705a29ba) - Prevent Clients from accessing API endpoints that set `api_name=False`. Thanks [@abidlabs](https://github.com/abidlabs)!
959
-
960
- ## 0.3.1
961
-
962
- ### Fixes
963
-
964
- - [#5412](https://github.com/gradio-app/gradio/pull/5412) [`26fef8c7`](https://github.com/gradio-app/gradio/commit/26fef8c7f85a006c7e25cdbed1792df19c512d02) - Skip view_api request in js client when auth enabled. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
965
-
966
- ## 0.3.0
967
-
968
- ### Features
969
-
970
- - [#5267](https://github.com/gradio-app/gradio/pull/5267) [`119c8343`](https://github.com/gradio-app/gradio/commit/119c834331bfae60d4742c8f20e9cdecdd67e8c2) - Faster reload mode. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
971
-
972
- ## 0.2.1
973
-
974
- ### Features
975
-
976
- - [#5173](https://github.com/gradio-app/gradio/pull/5173) [`730f0c1d`](https://github.com/gradio-app/gradio/commit/730f0c1d54792eb11359e40c9f2326e8a6e39203) - Ensure gradio client works as expected for functions that return nothing. Thanks [@raymondtri](https://github.com/raymondtri)!
977
-
978
- ## 0.2.0
979
-
980
- ### Features
981
-
982
- - [#5133](https://github.com/gradio-app/gradio/pull/5133) [`61129052`](https://github.com/gradio-app/gradio/commit/61129052ed1391a75c825c891d57fa0ad6c09fc8) - Update dependency esbuild to ^0.19.0. Thanks [@renovate](https://github.com/apps/renovate)!
983
- - [#5035](https://github.com/gradio-app/gradio/pull/5035) [`8b4eb8ca`](https://github.com/gradio-app/gradio/commit/8b4eb8cac9ea07bde31b44e2006ca2b7b5f4de36) - JS Client: Fixes cannot read properties of null (reading 'is_file'). Thanks [@raymondtri](https://github.com/raymondtri)!
984
-
985
- ### Fixes
986
-
987
- - [#5075](https://github.com/gradio-app/gradio/pull/5075) [`67265a58`](https://github.com/gradio-app/gradio/commit/67265a58027ef1f9e4c0eb849a532f72eaebde48) - Allow supporting >1000 files in `gr.File()` and `gr.UploadButton()`. Thanks [@abidlabs](https://github.com/abidlabs)!
988
-
989
- ## 0.1.4
990
-
991
- ### Patch Changes
992
-
993
- - [#4717](https://github.com/gradio-app/gradio/pull/4717) [`ab5d1ea0`](https://github.com/gradio-app/gradio/commit/ab5d1ea0de87ed888779b66fd2a705583bd29e02) Thanks [@whitphx](https://github.com/whitphx)! - Fix the package description
994
-
995
- ## 0.1.3
996
-
997
- ### Patch Changes
998
-
999
- - [#4357](https://github.com/gradio-app/gradio/pull/4357) [`0dbd8f7f`](https://github.com/gradio-app/gradio/commit/0dbd8f7fee4b4877f783fa7bc493f98bbfc3d01d) Thanks [@pngwn](https://github.com/pngwn)! - Various internal refactors and cleanups.
1000
-
1001
- ## 0.1.2
1002
-
1003
- ### Patch Changes
1004
-
1005
- - [#4273](https://github.com/gradio-app/gradio/pull/4273) [`1d0f0a9d`](https://github.com/gradio-app/gradio/commit/1d0f0a9db096552e67eb2197c932342587e9e61e) Thanks [@pngwn](https://github.com/pngwn)! - Ensure websocket error messages are correctly handled.
1006
-
1007
- - [#4315](https://github.com/gradio-app/gradio/pull/4315) [`b525b122`](https://github.com/gradio-app/gradio/commit/b525b122dd8569bbaf7e06db5b90d622d2e9073d) Thanks [@whitphx](https://github.com/whitphx)! - Refacor types.
1008
-
1009
- - [#4271](https://github.com/gradio-app/gradio/pull/4271) [`1151c525`](https://github.com/gradio-app/gradio/commit/1151c5253554cb87ebd4a44a8a470ac215ff782b) Thanks [@pngwn](https://github.com/pngwn)! - Ensure the full root path is always respected when making requests to a gradio app server.
1010
-
1011
- ## 0.1.1
1012
-
1013
- ### Patch Changes
1014
-
1015
- - [#4201](https://github.com/gradio-app/gradio/pull/4201) [`da5b4ee1`](https://github.com/gradio-app/gradio/commit/da5b4ee11721175858ded96e5710225369097f74) Thanks [@pngwn](https://github.com/pngwn)! - Ensure semiver is bundled so CDN links work correctly.
1016
-
1017
- - [#4202](https://github.com/gradio-app/gradio/pull/4202) [`a26e9afd`](https://github.com/gradio-app/gradio/commit/a26e9afde319382993e6ddc77cc4e56337a31248) Thanks [@pngwn](https://github.com/pngwn)! - Ensure all URLs returned by the client are complete URLs with the correct host instead of an absolute path relative to a server.
1018
-
1019
- ## 0.1.0
1020
-
1021
- ### Minor Changes
1022
-
1023
- - [#4185](https://github.com/gradio-app/gradio/pull/4185) [`67239ca9`](https://github.com/gradio-app/gradio/commit/67239ca9b2fe3796853fbf7bf865c9e4b383200d) Thanks [@pngwn](https://github.com/pngwn)! - Update client for initial release
1024
-
1025
- ### Patch Changes
1026
-
1027
- - [#3692](https://github.com/gradio-app/gradio/pull/3692) [`48e8b113`](https://github.com/gradio-app/gradio/commit/48e8b113f4b55e461d9da4f153bf72aeb4adf0f1) Thanks [@pngwn](https://github.com/pngwn)! - Ensure client works in node, create ESM bundle and generate typescript declaration files.
1028
-
1029
- - [#3605](https://github.com/gradio-app/gradio/pull/3605) [`ae4277a9`](https://github.com/gradio-app/gradio/commit/ae4277a9a83d49bdadfe523b0739ba988128e73b) Thanks [@pngwn](https://github.com/pngwn)! - Update readme.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/README.md DELETED
@@ -1,448 +0,0 @@
1
- ## JavaScript Client Library
2
-
3
- Interact with Gradio APIs using our JavaScript (and TypeScript) client.
4
-
5
-
6
- ## Installation
7
-
8
- The Gradio JavaScript Client is available on npm as `@gradio/client`. You can install it as below:
9
-
10
- ```shell
11
- npm i @gradio/client
12
- ```
13
-
14
- Or, you can include it directly in your HTML via the jsDelivr CDN:
15
-
16
- ```shell
17
- <script src="https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js"></script>
18
- ```
19
-
20
- ## Usage
21
-
22
- The JavaScript Gradio Client exposes the Client class, `Client`, along with various other utility functions. `Client` is used to initialise and establish a connection to, or duplicate, a Gradio app.
23
-
24
- ### `Client`
25
-
26
- The Client function connects to the API of a hosted Gradio space and returns an object that allows you to make calls to that API.
27
-
28
- The simplest example looks like this:
29
-
30
- ```ts
31
- import { Client } from "@gradio/client";
32
-
33
- const app = await Client.connect("user/space-name");
34
- const result = await app.predict("/predict");
35
- ```
36
-
37
- This function accepts two arguments: `source` and `options`:
38
-
39
- #### `source`
40
-
41
- This is the url or name of the gradio app whose API you wish to connect to. This parameter is required and should always be a string. For example:
42
-
43
- ```ts
44
- Client.connect("user/space-name");
45
- ```
46
-
47
- #### `options`
48
-
49
- The options object can optionally be passed a second parameter. This object has two properties, `token` and `status_callback`.
50
-
51
- ##### `token`
52
-
53
- This should be a Hugging Face personal access token and is required if you wish to make calls to a private gradio api. This option is optional and should be a string starting with `"hf_"`.
54
-
55
- Example:
56
-
57
- ```ts
58
- import { Client } from "@gradio/client";
59
-
60
- const app = await Client.connect("user/space-name", { token: "hf_..." });
61
- ```
62
-
63
- ##### `status_callback`
64
-
65
- This should be a function which will notify you of the status of a space if it is not running. If the gradio API you are connecting to is not awake and running or is not hosted on Hugging Face space then this function will do nothing.
66
-
67
- **Additional context**
68
-
69
- Applications hosted on Hugging Face spaces can be in a number of different states. As spaces are a GitOps tool and will rebuild when new changes are pushed to the repository, they have various building, running and error states. If a space is not 'running' then the function passed as the `status_callback` will notify you of the current state of the space and the status of the space as it changes. Spaces that are building or sleeping can take longer than usual to respond, so you can use this information to give users feedback about the progress of their action.
70
-
71
- ```ts
72
- import { Client, type SpaceStatus } from "@gradio/client";
73
-
74
- const app = await Client.connect("user/space-name", {
75
- // The space_status parameter does not need to be manually annotated, this is just for illustration.
76
- space_status: (space_status: SpaceStatus) => console.log(space_status)
77
- });
78
- ```
79
-
80
- ```ts
81
- interface SpaceStatusNormal {
82
- status: "sleeping" | "running" | "building" | "error" | "stopped";
83
- detail:
84
- | "SLEEPING"
85
- | "RUNNING"
86
- | "RUNNING_BUILDING"
87
- | "BUILDING"
88
- | "NOT_FOUND";
89
- load_status: "pending" | "error" | "complete" | "generating";
90
- message: string;
91
- }
92
-
93
- interface SpaceStatusError {
94
- status: "space_error";
95
- detail: "NO_APP_FILE" | "CONFIG_ERROR" | "BUILD_ERROR" | "RUNTIME_ERROR";
96
- load_status: "error";
97
- message: string;
98
- discussions_enabled: boolean;
99
-
100
- type SpaceStatus = SpaceStatusNormal | SpaceStatusError;
101
- ```
102
-
103
- The gradio client returns an object with a number of methods and properties:
104
-
105
- #### `predict`
106
-
107
- The `predict` method allows you to call an api endpoint and get a prediction result:
108
-
109
- ```ts
110
- import { Client } from "@gradio/client";
111
-
112
- const app = await Client.connect("user/space-name");
113
- const result = await app.predict("/predict");
114
- ```
115
-
116
- `predict` accepts two parameters, `endpoint` and `payload`. It returns a promise that resolves to the prediction result.
117
-
118
- ##### `endpoint`
119
-
120
- This is the endpoint for an api request and is required. The default endpoint for a `gradio.Interface` is `"/predict"`. Explicitly named endpoints have a custom name. The endpoint names can be found on the "View API" page of a space.
121
-
122
- ```ts
123
- import { Client } from "@gradio/client";
124
-
125
- const app = await Client.connect("user/space-name");
126
- const result = await app.predict("/predict");
127
- ```
128
-
129
- ##### `payload`
130
-
131
- The `payload` argument is generally required but this depends on the API itself. If the API endpoint depends on values being passed in then the argument is required for the API request to succeed. The data that should be passed in is detailed on the "View API" page of a space, or accessible via the `view_api()` method of the client.
132
-
133
- ```ts
134
- import { Client } from "@gradio/client";
135
-
136
- const app = await Client.connect("user/space-name");
137
- const result = await app.predict("/predict", {
138
- input: 1,
139
- word_1: "Hello",
140
- word_2: "friends"
141
- });
142
- ```
143
-
144
- #### `submit`
145
-
146
- The `submit` method provides a more flexible way to call an API endpoint, providing you with status updates about the current progress of the prediction as well as supporting more complex endpoint types.
147
-
148
- ```ts
149
- import { Client } from "@gradio/client";
150
-
151
- const app = await Client.connect("user/space-name");
152
- const submission = app.submit("/predict", { name: "Chewbacca" });
153
- ```
154
-
155
- The `submit` method accepts the same [`endpoint`](#endpoint) and [`payload`](#payload) arguments as `predict`.
156
-
157
- The `submit` method does not return a promise and should not be awaited, instead it returns an async iterator with a `cancel` method.
158
-
159
- ##### Accessing values
160
-
161
- Iterating the submission allows you to access the events related to the submitted API request. There are two types of events that can be listened for: `"data"` updates and `"status"` updates. By default only the `"data"` event is reported, but you can listen for the `"status"` event by manually passing the events you care about when instantiating the client:
162
-
163
- ```ts
164
- import { Client } from "@gradio/client";
165
-
166
- const app = await Client.connect("user/space-name", {
167
- events: ["data", "status"]
168
- });
169
- ```
170
-
171
- `"data"` updates are issued when the API computes a value, the callback provided as the second argument will be called when such a value is sent to the client. The shape of the data depends on the way the API itself is constructed. This event may fire more than once if that endpoint supports emmitting new values over time.
172
-
173
- `"status` updates are issued when the status of a request changes. This information allows you to offer feedback to users when the queue position of the request changes, or when the request changes from queued to processing.
174
-
175
- The status payload look like this:
176
-
177
- ```ts
178
- interface Status {
179
- queue: boolean;
180
- code?: string;
181
- success?: boolean;
182
- stage: "pending" | "error" | "complete" | "generating";
183
- size?: number;
184
- position?: number;
185
- eta?: number;
186
- message?: string;
187
- progress_data?: Array<{
188
- progress: number | null;
189
- index: number | null;
190
- length: number | null;
191
- unit: string | null;
192
- desc: string | null;
193
- }>;
194
- time?: Date;
195
- }
196
- ```
197
-
198
- Usage looks like this:
199
-
200
- ```ts
201
- import { Client } from "@gradio/client";
202
-
203
- const app = await Client.connect("user/space-name");
204
- const submission = app
205
- .submit("/predict", { name: "Chewbacca" })
206
-
207
- for await (const msg of submission) {
208
- if (msg.type === "data") {
209
- console.log(msg.data);
210
- }
211
-
212
- if (msg.type === "status") {
213
- console.log(msg);
214
- }
215
- }
216
- ```
217
-
218
-
219
- ##### `cancel`
220
-
221
- Certain types of gradio function can run repeatedly and in some cases indefinitely. the `cancel` method will stop such an endpoints and prevent the API from issuing additional updates.
222
-
223
- ```ts
224
- import { Client } from "@gradio/client";
225
-
226
- const app = await Client.connect("user/space-name");
227
- const submission = app
228
- .submit("/predict", { name: "Chewbacca" })
229
-
230
-
231
- // later
232
-
233
- submission.cancel();
234
- ```
235
-
236
- #### `view_api`
237
-
238
- The `view_api` method provides details about the API you are connected to. It returns a JavaScript object of all named endpoints, unnamed endpoints and what values they accept and return. This method does not accept arguments.
239
-
240
- ```ts
241
- import { Client } from "@gradio/client";
242
-
243
- const app = await Client.connect("user/space-name");
244
- const api_info = await app.view_api();
245
-
246
- console.log(api_info);
247
- ```
248
-
249
- #### `config`
250
-
251
- The `config` property contains the configuration for the gradio application you are connected to. This object may contain useful meta information about the application.
252
-
253
- ```ts
254
- import { Client } from "@gradio/client";
255
-
256
- const app = await Client.connect("user/space-name");
257
- console.log(app.config);
258
- ```
259
-
260
- ### `duplicate`
261
-
262
- The duplicate function will attempt to duplicate the space that is referenced and return an instance of `client` connected to that space. If the space has already been duplicated then it will not create a new duplicate and will instead connect to the existing duplicated space. The huggingface token that is passed in will dictate the user under which the space is created.
263
-
264
- `duplicate` accepts the same arguments as `client` with the addition of a `private` options property dictating whether the duplicated space should be private or public. A huggingface token is required for duplication to work.
265
-
266
- ```ts
267
- import { Client } from "@gradio/client";
268
-
269
- const app = await Client.duplicate("user/space-name", {
270
- token: "hf_..."
271
- });
272
- ```
273
-
274
- This function accepts two arguments: `source` and `options`:
275
-
276
- #### `source`
277
-
278
- The space to duplicate and connect to. [See `client`'s `source` parameter](#source).
279
-
280
- #### `options`
281
-
282
- Accepts all options that `client` accepts, except `token` is required. [See `client`'s `options` parameter](#source).
283
-
284
- `duplicate` also accepts one additional `options` property.
285
-
286
- ##### `private`
287
-
288
- This is an optional property specific to `duplicate`'s options object and will determine whether the space should be public or private. Spaces duplicated via the `duplicate` method are public by default.
289
-
290
- ```ts
291
- import { Client } from "@gradio/client";
292
-
293
- const app = await Client.duplicate("user/space-name", {
294
- token: "hf_...",
295
- private: true
296
- });
297
- ```
298
-
299
- ##### `timeout`
300
-
301
- This is an optional property specific to `duplicate`'s options object and will set the timeout in minutes before the duplicated space will go to sleep.
302
-
303
- ```ts
304
- import { Client } from "@gradio/client";
305
-
306
- const app = await Client.duplicate("user/space-name", {
307
- token: "hf_...",
308
- private: true,
309
- timeout: 5
310
- });
311
- ```
312
-
313
- ##### `hardware`
314
-
315
- This is an optional property specific to `duplicate`'s options object and will set the hardware for the duplicated space. By default the hardware used will match that of the original space. If this cannot be obtained it will default to `"cpu-basic"`. For hardware upgrades (beyond the basic CPU tier), you may be required to provide [billing information on Hugging Face](https://huggingface.co/settings/billing).
316
-
317
- Possible hardware options are:
318
-
319
- - `"cpu-basic"`
320
- - `"cpu-upgrade"`
321
- - `"cpu-xl"`
322
- - `"t4-small"`
323
- - `"t4-medium"`
324
- - `"a10g-small"`
325
- - `"a10g-large"`
326
- - `"a10g-largex2"`
327
- - `"a10g-largex4"`
328
- - `"a100-large"`
329
- - `"zero-a10g"`
330
- - `"h100"`
331
- - `"h100x8"`
332
-
333
- ```ts
334
- import { Client } from "@gradio/client";
335
-
336
- const app = await Client.duplicate("user/space-name", {
337
- token: "hf_...",
338
- private: true,
339
- hardware: "a10g-small"
340
- });
341
- ```
342
-
343
- ### `handle_file(file_or_url: File | string | Blob | Buffer)`
344
-
345
- This utility function is used to simplify the process of handling file inputs for the client.
346
-
347
- Gradio APIs expect a special file datastructure that references a location on the server. These files can be manually uploaded but figuring what to do with different file types can be difficult depending on your environment.
348
-
349
- This function will handle files regardless of whether or not they are local files (node only), URLs, Blobs, or Buffers. It will take in a reference and handle it accordingly,uploading the file where appropriate and generating the correct data structure for the client.
350
-
351
- The return value of this function can be used anywhere in the input data where a file is expected:
352
-
353
- ```ts
354
- import { handle_file } from "@gradio/client";
355
-
356
- const app = await Client.connect("user/space-name");
357
- const result = await app.predict("/predict", {
358
- single: handle_file(file),
359
- flat: [handle_file(url), handle_file(buffer)],
360
- nested: {
361
- image: handle_file(url),
362
- layers: [handle_file(buffer)]
363
- },
364
- deeply_nested: {
365
- image: handle_file(url),
366
- layers: [{
367
- layer1: handle_file(buffer),
368
- layer2: handle_file(buffer)
369
- }]
370
- }
371
- });
372
- ```
373
-
374
- #### filepaths
375
-
376
- `handle_file` can be passed a local filepath which it will upload to the client server and return a reference that the client can understand.
377
-
378
- This only works in a node environment.
379
-
380
- Filepaths are resolved relative to the current working directory, not the location of the file that calls `handle_file`.
381
-
382
- ```ts
383
- import { handle_file } from "@gradio/client";
384
-
385
- // not uploaded yet
386
- const file_ref = handle_file("path/to/file");
387
-
388
- const app = await Client.connect("user/space-name");
389
-
390
- // upload happens here
391
- const result = await app.predict("/predict", {
392
- file: file_ref,
393
- });
394
- ```
395
-
396
- #### URLs
397
-
398
- `handle_file` can be passed a URL which it will convert into a reference that the client can understand.
399
-
400
- ```ts
401
- import { handle_file } from "@gradio/client";
402
-
403
- const url_ref = handle_file("https://example.com/file.png");
404
-
405
- const app = await Client.connect("user/space-name");
406
- const result = await app.predict("/predict", {
407
- url: url_ref,
408
- });
409
- ```
410
-
411
- #### Blobs
412
-
413
- `handle_file` can be passed a Blob which it will upload to the client server and return a reference that the client can understand.
414
-
415
- The upload is not initiated until predict or submit are called.
416
-
417
- ```ts
418
- import { handle_file } from "@gradio/client";
419
-
420
- // not uploaded yet
421
- const blob_ref = handle_file(new Blob(["Hello, world!"]));
422
-
423
- const app = await Client.connect("user/space-name");
424
-
425
- // upload happens here
426
- const result = await app.predict("/predict", {
427
- blob: blob_ref,
428
- });
429
- ```
430
-
431
- #### Buffers
432
-
433
- `handle_file` can be passed a Buffer which it will upload to the client server and return a reference that the client can understand.
434
-
435
- ```ts
436
- import { handle_file } from "@gradio/client";
437
- import { readFileSync } from "fs";
438
-
439
- // not uploaded yet
440
- const buffer_ref = handle_file(readFileSync("file.png"));
441
-
442
- const app = await Client.connect("user/space-name");
443
-
444
- // upload happens here
445
- const result = await app.predict("/predict", {
446
- buffer: buffer_ref,
447
- });
448
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/__vite-browser-external-DYxpcVy9.js DELETED
@@ -1,4 +0,0 @@
1
- const e = {};
2
- export {
3
- e as default
4
- };
 
 
 
 
 
node_modules/@gradio/client/dist/browser.js DELETED
@@ -1,1960 +0,0 @@
1
- const Ke = "host", xe = "queue/data", Ve = "queue/join", ye = "upload", Ye = "login", K = "config", Qe = "info", Xe = "runtime", et = "sleeptime", tt = "heartbeat", st = "component_server", nt = "reset", ot = "cancel", it = "app_id", De = "This application is currently busy. Please try again. ", L = "Connection errored out. ", C = "Could not resolve app config. ", rt = "Could not get space status. ", at = "Could not get API info. ", ue = "Space metadata could not be loaded. ", ct = "Invalid URL. A full URL path is required.", ut = "Not authorized to access this space. ", Ce = "Invalid credentials. Could not login. ", lt = "Login credentials are required to access this space.", pt = "File system access is only available in Node.js environments", Le = "Root URL not found in client config", dt = "Error uploading file";
2
- async function be(e, s, t) {
3
- try {
4
- return (await (await fetch(`https://huggingface.co/api/spaces/${e}/jwt`, {
5
- headers: {
6
- Authorization: `Bearer ${s}`,
7
- ...t ? { Cookie: t } : {}
8
- }
9
- })).json()).token || !1;
10
- } catch {
11
- return !1;
12
- }
13
- }
14
- function ht(e) {
15
- let s = {};
16
- return e.forEach(({ api_name: t, id: n }) => {
17
- t && (s[t] = n);
18
- }), s;
19
- }
20
- async function ft(e) {
21
- const s = this.options.token ? { Authorization: `Bearer ${this.options.token}` } : {};
22
- if (s["Content-Type"] = "application/json", typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876") {
23
- if (window.gradio_config.current_page && (e = e.substring(0, e.lastIndexOf("/"))), window.gradio_config.dev_mode || typeof window < "u" && window?.BUILD_MODE === "dev") {
24
- let t = ae(
25
- e,
26
- this.deep_link ? K + "?deep_link=" + this.deep_link : K
27
- );
28
- const n = await this.fetch(t, {
29
- headers: s,
30
- credentials: "include"
31
- }), o = await ve(n, !!this.options.auth);
32
- o.root = e || o.root, window.gradio_config = {
33
- ...o,
34
- current_page: window.gradio_config.current_page
35
- };
36
- }
37
- return { ...window.gradio_config };
38
- } else if (e) {
39
- let t = ae(
40
- e,
41
- this.deep_link ? K + "?deep_link=" + this.deep_link : K
42
- );
43
- const n = await this.fetch(t, {
44
- headers: s,
45
- credentials: "include"
46
- }), o = await ve(n, !!this.options.auth);
47
- return o.root || (o.root = e), o;
48
- }
49
- throw new Error(C);
50
- }
51
- async function ve(e, s) {
52
- if (e?.status === 401 && !s) {
53
- const n = (await e.json())?.detail?.auth_message;
54
- throw new Error(n || lt);
55
- } else if (e?.status === 401 && s)
56
- throw new Error(Ce);
57
- if (e?.status === 200) {
58
- let t = await e.json();
59
- return t.dependencies?.forEach((n, o) => {
60
- n.id === void 0 && (n.id = o);
61
- }), t;
62
- } else if (e?.status === 401)
63
- throw new Error(ut);
64
- throw new Error(C);
65
- }
66
- async function _t() {
67
- const { http_protocol: e, host: s } = await pe(
68
- this.app_reference,
69
- this.options.token
70
- );
71
- try {
72
- if (this.options.auth) {
73
- const t = await Ne(
74
- e,
75
- s,
76
- this.options.auth,
77
- this.fetch,
78
- this.options.token
79
- );
80
- t && this.set_cookies(t);
81
- }
82
- } catch (t) {
83
- throw Error(t.message);
84
- }
85
- }
86
- async function Ne(e, s, t, n, o) {
87
- const r = new FormData();
88
- r.append("username", t?.[0]), r.append("password", t?.[1]);
89
- let i = {};
90
- o && (i.Authorization = `Bearer ${o}`);
91
- const a = await n(`${e}//${s}/${Ye}`, {
92
- headers: i,
93
- method: "POST",
94
- body: r,
95
- credentials: "include"
96
- });
97
- if (a.status === 200)
98
- return a.headers.get("set-cookie");
99
- throw a.status === 401 ? new Error(Ce) : new Error(ue);
100
- }
101
- function re(e) {
102
- if (e.startsWith("http")) {
103
- const { protocol: s, host: t, pathname: n } = new URL(e);
104
- return {
105
- ws_protocol: s === "https:" ? "wss" : "ws",
106
- http_protocol: s,
107
- host: t + (n !== "/" ? n : "")
108
- };
109
- }
110
- return {
111
- ws_protocol: "wss",
112
- http_protocol: "https:",
113
- host: new URL(e).host
114
- };
115
- }
116
- const Pe = (e) => {
117
- let s = [];
118
- return e.split(/,(?=\s*[^\s=;]+=[^\s=;]+)/).forEach((n) => {
119
- const [o, r] = n.split(";")[0].split("=");
120
- o && r && s.push(`${o.trim()}=${r.trim()}`);
121
- }), s;
122
- }, le = /^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+$/, gt = /.*hf\.space\/{0,1}.*$/;
123
- async function pe(e, s) {
124
- const t = {};
125
- s && (t.Authorization = `Bearer ${s}`);
126
- const n = e.trim().replace(/\/$/, "");
127
- if (le.test(n))
128
- try {
129
- const r = (await (await fetch(
130
- `https://huggingface.co/api/spaces/${n}/${Ke}`,
131
- { headers: t }
132
- )).json()).host;
133
- return {
134
- space_id: e,
135
- ...re(r)
136
- };
137
- } catch {
138
- throw new Error(ue);
139
- }
140
- if (gt.test(n)) {
141
- const { ws_protocol: o, http_protocol: r, host: i } = re(n);
142
- return {
143
- space_id: i.split("/")[0].replace(".hf.space", ""),
144
- ws_protocol: o,
145
- http_protocol: r,
146
- host: i
147
- };
148
- }
149
- return {
150
- space_id: !1,
151
- ...re(n)
152
- };
153
- }
154
- const ae = (...e) => {
155
- try {
156
- return e.reduce((s, t) => (s = s.replace(/\/+$/, ""), t = t.replace(/^\/+/, ""), new URL(t, s + "/").toString()));
157
- } catch {
158
- throw new Error(ct);
159
- }
160
- };
161
- function mt(e, s, t) {
162
- const n = {
163
- named_endpoints: {},
164
- unnamed_endpoints: {}
165
- };
166
- return Object.keys(e).forEach((o) => {
167
- (o === "named_endpoints" || o === "unnamed_endpoints") && (n[o] = {}, Object.entries(e[o]).forEach(
168
- ([r, { parameters: i, returns: a }]) => {
169
- const u = s.dependencies.find(
170
- (c) => c.api_name === r || c.api_name === r.replace("/", "")
171
- )?.id || t[r.replace("/", "")] || -1, l = u !== -1 ? s.dependencies.find((c) => c.id == u)?.types : { generator: !1, cancel: !1 };
172
- if (u !== -1 && s.dependencies.find((c) => c.id == u)?.inputs?.length !== i.length) {
173
- const c = s.dependencies.find((g) => g.id == u).inputs.map(
174
- (g) => s.components.find((w) => w.id === g)?.type
175
- );
176
- try {
177
- c.forEach((g, w) => {
178
- if (g === "state") {
179
- const N = {
180
- component: "state",
181
- example: null,
182
- parameter_default: null,
183
- parameter_has_default: !0,
184
- parameter_name: null,
185
- hidden: !0
186
- };
187
- i.splice(w, 0, N);
188
- }
189
- });
190
- } catch (g) {
191
- console.error(g);
192
- }
193
- }
194
- const p = (c, g, w, N) => ({
195
- ...c,
196
- description: yt(c?.type, w),
197
- type: wt(c?.type, g, w, N) || ""
198
- });
199
- n[o][r] = {
200
- parameters: i.map(
201
- (c) => p(c, c?.component, c?.serializer, "parameter")
202
- ),
203
- returns: a.map(
204
- (c) => p(c, c?.component, c?.serializer, "return")
205
- ),
206
- type: l
207
- };
208
- }
209
- ));
210
- }), n;
211
- }
212
- function wt(e, s, t, n) {
213
- if (s === "Api") return e.type;
214
- switch (e?.type) {
215
- case "string":
216
- return "string";
217
- case "boolean":
218
- return "boolean";
219
- case "number":
220
- return "number";
221
- }
222
- if (t === "JSONSerializable" || t === "StringSerializable")
223
- return "any";
224
- if (t === "ListStringSerializable")
225
- return "string[]";
226
- if (s === "Image")
227
- return n === "parameter" ? "Blob | File | Buffer" : "string";
228
- if (t === "FileSerializable")
229
- return e?.type === "array" ? n === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : n === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";
230
- if (t === "GallerySerializable")
231
- return n === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]";
232
- }
233
- function yt(e, s) {
234
- return s === "GallerySerializable" ? "array of [file, label] tuples" : s === "ListStringSerializable" ? "array of strings" : s === "FileSerializable" ? "array of files or single file" : e?.description;
235
- }
236
- function Ee(e, s) {
237
- switch (e.msg) {
238
- case "send_data":
239
- return { type: "data" };
240
- case "send_hash":
241
- return { type: "hash" };
242
- case "queue_full":
243
- return {
244
- type: "update",
245
- status: {
246
- queue: !0,
247
- message: De,
248
- stage: "error",
249
- code: e.code,
250
- success: e.success
251
- }
252
- };
253
- case "heartbeat":
254
- return {
255
- type: "heartbeat"
256
- };
257
- case "unexpected_error":
258
- return {
259
- type: "unexpected_error",
260
- status: {
261
- queue: !0,
262
- message: e.message,
263
- session_not_found: e.session_not_found,
264
- stage: "error",
265
- success: !1
266
- }
267
- };
268
- case "broken_connection":
269
- return {
270
- type: "broken_connection",
271
- status: {
272
- queue: !0,
273
- message: e.message,
274
- stage: "error",
275
- success: !1
276
- }
277
- };
278
- case "estimation":
279
- return {
280
- type: "update",
281
- status: {
282
- queue: !0,
283
- stage: s || "pending",
284
- code: e.code,
285
- size: e.queue_size,
286
- position: e.rank,
287
- eta: e.rank_eta,
288
- success: e.success
289
- }
290
- };
291
- case "progress":
292
- return {
293
- type: "update",
294
- status: {
295
- queue: !0,
296
- stage: "pending",
297
- code: e.code,
298
- progress_data: e.progress_data,
299
- success: e.success
300
- }
301
- };
302
- case "log":
303
- return { type: "log", data: e };
304
- case "process_generating":
305
- return {
306
- type: "generating",
307
- status: {
308
- queue: !0,
309
- message: e.success ? null : e.output.error,
310
- stage: e.success ? "generating" : "error",
311
- code: e.code,
312
- progress_data: e.progress_data,
313
- eta: e.average_duration,
314
- changed_state_ids: e.success ? e.output.changed_state_ids : void 0
315
- },
316
- data: e.success ? e.output : null
317
- };
318
- case "process_streaming":
319
- return {
320
- type: "streaming",
321
- status: {
322
- queue: !0,
323
- message: e.output.error,
324
- stage: "streaming",
325
- time_limit: e.time_limit,
326
- code: e.code,
327
- progress_data: e.progress_data,
328
- eta: e.eta
329
- },
330
- data: e.output
331
- };
332
- case "process_completed":
333
- return "error" in e.output ? {
334
- type: "update",
335
- status: {
336
- queue: !0,
337
- title: e.output.title ?? "Error",
338
- message: e.output.error ?? "An error occurred",
339
- visible: e.output.visible,
340
- duration: e.output.duration,
341
- stage: "error",
342
- code: e.code,
343
- success: e.success
344
- }
345
- } : {
346
- type: "complete",
347
- status: {
348
- queue: !0,
349
- message: e.success ? void 0 : e.output.error,
350
- stage: e.success ? "complete" : "error",
351
- code: e.code,
352
- progress_data: e.progress_data,
353
- changed_state_ids: e.success ? e.output.changed_state_ids : void 0,
354
- used_cache: e.used_cache,
355
- cache_duration: e.cache_duration,
356
- avg_time: e.avg_time
357
- },
358
- data: e.success ? e.output : null
359
- };
360
- case "process_starts":
361
- return {
362
- type: "update",
363
- status: {
364
- queue: !0,
365
- stage: "pending",
366
- code: e.code,
367
- size: e.rank,
368
- position: 0,
369
- success: e.success,
370
- eta: e.eta
371
- },
372
- original_msg: "process_starts"
373
- };
374
- }
375
- return { type: "none", status: { stage: "error", queue: !0 } };
376
- }
377
- const bt = (e = [], s) => {
378
- const t = s ? s.parameters : [];
379
- if (Array.isArray(e))
380
- return s && t.length > 0 && e.length > t.length && console.warn("Too many arguments provided for the endpoint."), e;
381
- const n = [], o = Object.keys(e);
382
- return t.forEach((r, i) => {
383
- if (e.hasOwnProperty(r.parameter_name))
384
- n[i] = e[r.parameter_name];
385
- else if (r.parameter_has_default)
386
- n[i] = r.parameter_default;
387
- else
388
- throw new Error(
389
- `No value provided for required parameter: ${r.parameter_name}`
390
- );
391
- }), o.forEach((r) => {
392
- if (!t.some((i) => i.parameter_name === r))
393
- throw new Error(
394
- `Parameter \`${r}\` is not a valid keyword argument. Please refer to the API for usage.`
395
- );
396
- }), n.forEach((r, i) => {
397
- if (r === void 0 && !t[i].parameter_has_default)
398
- throw new Error(
399
- `No value provided for required parameter: ${t[i].parameter_name}`
400
- );
401
- }), n;
402
- };
403
- async function vt() {
404
- if (this.api_info) return this.api_info;
405
- const { token: e } = this.options, { config: s } = this, t = { "Content-Type": "application/json" };
406
- if (e && (t.Authorization = `Bearer ${e}`), !!s)
407
- try {
408
- let n, o;
409
- if (typeof window < "u" && window.gradio_api_info)
410
- o = window.gradio_api_info;
411
- else {
412
- const r = ae(s.root, this.api_prefix, Qe);
413
- if (n = await this.fetch(r, {
414
- headers: t,
415
- credentials: "include"
416
- }), !n.ok)
417
- throw new Error(L);
418
- o = await n.json();
419
- }
420
- return "api" in o && (o = o.api), o.named_endpoints["/predict"] && !o.unnamed_endpoints[0] && (o.unnamed_endpoints[0] = o.named_endpoints["/predict"]), mt(o, s, this.api_map);
421
- } catch (n) {
422
- throw new Error("Could not get API info. " + n.message);
423
- }
424
- }
425
- async function Et(e, s, t) {
426
- const n = {};
427
- this?.options?.token && (n.Authorization = `Bearer ${this.options.token}`);
428
- const o = 1e3, r = [];
429
- let i;
430
- for (let a = 0; a < s.length; a += o) {
431
- const u = s.slice(a, a + o), l = new FormData();
432
- u.forEach((c) => {
433
- l.append("files", c);
434
- });
435
- try {
436
- const c = t ? `${e}${this.api_prefix}/${ye}?upload_id=${t}` : `${e}${this.api_prefix}/${ye}`;
437
- i = await this.fetch(c, {
438
- method: "POST",
439
- body: l,
440
- headers: n,
441
- credentials: "include"
442
- });
443
- } catch (c) {
444
- throw new Error(L + c.message);
445
- }
446
- if (!i.ok) {
447
- const c = await i.text();
448
- return { error: `HTTP ${i.status}: ${c}` };
449
- }
450
- const p = await i.json();
451
- p && r.push(...p);
452
- }
453
- return { files: r };
454
- }
455
- const St = {
456
- radix: 1e3,
457
- unit: ["b", "kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"]
458
- }, $t = {
459
- radix: 1024,
460
- unit: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"]
461
- }, kt = {
462
- radix: 1024,
463
- unit: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"]
464
- }, Se = {
465
- si: St,
466
- iec: $t,
467
- jedec: kt
468
- };
469
- function Rt(e, s = 1, t = "jedec") {
470
- e = Math.abs(e);
471
- const { radix: n, unit: o } = Se[t] || Se.jedec;
472
- let r = 0;
473
- for (; e >= n; )
474
- e /= n, ++r;
475
- return `${e.toFixed(s)} ${o[r]}`;
476
- }
477
- async function Ot(e, s, t, n) {
478
- let o = (Array.isArray(e) ? e : [e]).map(
479
- (i) => i.blob
480
- );
481
- const r = o.filter(
482
- (i) => i.size > (n ?? 1 / 0)
483
- );
484
- if (r.length)
485
- throw new Error(
486
- `File(s) exceed the maximum allowed size of ${Rt(n || 1 / 0)}: ${r.map((i) => `"${i.name}"`).join(", ")}`
487
- );
488
- return await Promise.all(
489
- await this.upload_files(s, o, t).then(
490
- async (i) => {
491
- if (i.error)
492
- throw new Error(i.error);
493
- return i.files ? i.files.map((a, u) => new Q({
494
- ...e[u],
495
- path: a,
496
- url: `${s}${this.api_prefix}/file=${a}`
497
- })) : [];
498
- }
499
- )
500
- );
501
- }
502
- async function ns(e, s) {
503
- return e.map(
504
- (t) => new Q({
505
- path: t.name,
506
- orig_name: t.name,
507
- blob: t,
508
- size: t.size,
509
- mime_type: t.type,
510
- is_stream: s
511
- })
512
- );
513
- }
514
- class Q {
515
- path;
516
- url;
517
- orig_name;
518
- size;
519
- blob;
520
- is_stream;
521
- mime_type;
522
- alt_text;
523
- b64;
524
- meta = { _type: "gradio.FileData" };
525
- constructor({
526
- path: s,
527
- url: t,
528
- orig_name: n,
529
- size: o,
530
- blob: r,
531
- is_stream: i,
532
- mime_type: a,
533
- alt_text: u,
534
- b64: l
535
- }) {
536
- this.path = s, this.url = t, this.orig_name = n, this.size = o, this.blob = t ? void 0 : r, this.is_stream = i, this.mime_type = a, this.alt_text = u, this.b64 = l;
537
- }
538
- }
539
- class je {
540
- type;
541
- command;
542
- meta;
543
- fileData;
544
- constructor(s, t) {
545
- this.type = "command", this.command = s, this.meta = t;
546
- }
547
- }
548
- const Tt = typeof process < "u" && process.versions && process.versions.node;
549
- function $e(e, s, t) {
550
- for (; t.length > 1; ) {
551
- const o = t.shift();
552
- if (typeof o == "string" || typeof o == "number")
553
- e = e[o];
554
- else
555
- throw new Error("Invalid key type");
556
- }
557
- const n = t.shift();
558
- if (typeof n == "string" || typeof n == "number")
559
- e[n] = s;
560
- else
561
- throw new Error("Invalid key type");
562
- }
563
- async function ce(e, s = void 0, t = [], n = !1, o = void 0) {
564
- if (Array.isArray(e)) {
565
- let r = [];
566
- return await Promise.all(
567
- e.map(async (i, a) => {
568
- let u = t.slice();
569
- u.push(String(a));
570
- const l = await ce(
571
- e[a],
572
- n ? o?.parameters[a]?.component || void 0 : s,
573
- u,
574
- !1,
575
- o
576
- );
577
- r = r.concat(l);
578
- })
579
- ), r;
580
- } else {
581
- if (globalThis.Buffer && e instanceof globalThis.Buffer || e instanceof Blob)
582
- return [
583
- {
584
- path: t,
585
- blob: new Blob([e]),
586
- type: s
587
- }
588
- ];
589
- if (typeof e == "object" && e !== null) {
590
- let r = [];
591
- for (const i of Object.keys(e)) {
592
- const a = [...t, i], u = e[i];
593
- r = r.concat(
594
- await ce(
595
- u,
596
- void 0,
597
- a,
598
- !1,
599
- o
600
- )
601
- );
602
- }
603
- return r;
604
- }
605
- }
606
- return [];
607
- }
608
- function At(e, s) {
609
- let t = s?.dependencies?.find((n) => n.id == e)?.queue;
610
- return t != null ? !t : !s.enable_queue;
611
- }
612
- function xt(e, s) {
613
- return new Promise((t, n) => {
614
- const o = new MessageChannel();
615
- o.port1.onmessage = (({ data: r }) => {
616
- o.port1.close(), t(r);
617
- }), window.parent.postMessage(e, s, [o.port2]);
618
- });
619
- }
620
- function os(e) {
621
- if (typeof e == "string") {
622
- if (e.startsWith("http://") || e.startsWith("https://"))
623
- return {
624
- path: e,
625
- url: e,
626
- orig_name: e.split("/").pop() ?? "unknown",
627
- meta: { _type: "gradio.FileData" }
628
- };
629
- if (Tt)
630
- return new je("upload_file", {
631
- path: e,
632
- name: e,
633
- orig_path: e
634
- });
635
- } else {
636
- if (typeof File < "u" && e instanceof File)
637
- return new Blob([e]);
638
- if (e instanceof Buffer)
639
- return new Blob([e]);
640
- if (e instanceof Blob)
641
- return e;
642
- }
643
- throw new Error(
644
- "Invalid input: must be a URL, File, Blob, or Buffer object."
645
- );
646
- }
647
- function V(e, s, t, n, o = !1) {
648
- if (n === "input" && !o)
649
- throw new Error("Invalid code path. Cannot skip state inputs for input.");
650
- if (n === "output" && o)
651
- return e;
652
- let r = [], i = 0;
653
- const a = n === "input" ? s.inputs : s.outputs;
654
- for (let u = 0; u < a.length; u++) {
655
- const l = a[u];
656
- if (t.find((c) => c.id === l)?.type === "state") {
657
- if (o)
658
- if (e.length === a.length) {
659
- const c = e[i];
660
- r.push(c), i++;
661
- } else
662
- r.push(null);
663
- else {
664
- i++;
665
- continue;
666
- }
667
- continue;
668
- } else {
669
- const c = e[i];
670
- r.push(c), i++;
671
- }
672
- }
673
- return r;
674
- }
675
- async function Dt(e, s, t) {
676
- const n = this;
677
- await Ct(n, s);
678
- const o = await ce(
679
- s,
680
- void 0,
681
- [],
682
- !0,
683
- t
684
- );
685
- return (await Promise.all(
686
- o.map(async ({ path: i, blob: a, type: u }) => {
687
- if (!a) return { path: i, type: u };
688
- const l = await n.upload_files(e, [a]), p = l.files && l.files[0];
689
- return {
690
- path: i,
691
- file_url: p,
692
- type: u,
693
- name: typeof File < "u" && a instanceof File ? a?.name : void 0
694
- };
695
- })
696
- )).forEach(({ path: i, file_url: a, type: u, name: l }) => {
697
- if (u === "Gallery")
698
- $e(s, a, i);
699
- else if (a) {
700
- const p = new Q({ path: a, orig_name: l });
701
- $e(s, p, i);
702
- }
703
- }), s;
704
- }
705
- async function Ct(e, s) {
706
- if (!(e.config?.root || e.config?.root_url))
707
- throw new Error(Le);
708
- await Ie(e, s);
709
- }
710
- async function Ie(e, s, t = []) {
711
- for (const n in s)
712
- s[n] instanceof je ? await Lt(e, s, n) : typeof s[n] == "object" && s[n] !== null && await Ie(e, s[n], [...t, n]);
713
- }
714
- async function Lt(e, s, t) {
715
- let n = s[t];
716
- const o = e.config?.root || e.config?.root_url;
717
- if (!o)
718
- throw new Error(Le);
719
- try {
720
- let r, i;
721
- if (typeof process < "u" && process.versions && process.versions.node) {
722
- const p = await import("./__vite-browser-external-DYxpcVy9.js");
723
- i = (await import("./__vite-browser-external-DYxpcVy9.js")).resolve(process.cwd(), n.meta.path), r = await p.readFile(i);
724
- } else
725
- throw new Error(pt);
726
- const a = new Blob([r], {
727
- type: "application/octet-stream"
728
- }), u = await e.upload_files(o, [a]), l = u.files && u.files[0];
729
- if (l) {
730
- const p = new Q({
731
- path: l,
732
- orig_name: n.meta.name || ""
733
- });
734
- s[t] = p;
735
- }
736
- } catch (r) {
737
- console.error(dt, r);
738
- }
739
- }
740
- async function Nt(e, s, t) {
741
- const n = { "Content-Type": "application/json" };
742
- this.options.token && (n.Authorization = `Bearer ${this.options.token}`);
743
- try {
744
- var o = await this.fetch(e, {
745
- method: "POST",
746
- body: JSON.stringify(s),
747
- headers: { ...n, ...t },
748
- credentials: "include"
749
- });
750
- } catch {
751
- return [{ error: L }, 500];
752
- }
753
- let r, i;
754
- try {
755
- r = await o.json(), i = o.status;
756
- } catch (a) {
757
- r = { error: `Could not parse server response: ${a}` }, i = 500;
758
- }
759
- return [r, i];
760
- }
761
- async function Pt(e, s = {}) {
762
- let t = !1, n = !1;
763
- if (!this.config)
764
- throw new Error("Could not resolve app config");
765
- if (typeof e == "number")
766
- this.config.dependencies.find((o) => o.id == e);
767
- else {
768
- const o = e.replace(/^\//, "");
769
- this.config.dependencies.find(
770
- (r) => r.id == this.api_map[o]
771
- );
772
- }
773
- return new Promise(async (o, r) => {
774
- const i = this.submit(e, s, null, null, !0);
775
- let a;
776
- for await (const u of i)
777
- u.type === "data" && (n && o(a), t = !0, a = u), u.type === "status" && (u.stage === "error" && r(u), u.stage === "complete" && (n = !0, t && o(a)));
778
- });
779
- }
780
- async function F(e, s, t) {
781
- let n = s === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${e}` : `https://huggingface.co/api/spaces/${e}`, o, r;
782
- try {
783
- if (o = await fetch(n), r = o.status, r !== 200)
784
- throw new Error();
785
- o = await o.json();
786
- } catch {
787
- t({
788
- status: "error",
789
- load_status: "error",
790
- message: rt,
791
- detail: "NOT_FOUND"
792
- });
793
- return;
794
- }
795
- if (!o || r !== 200) return;
796
- const {
797
- runtime: { stage: i },
798
- id: a
799
- } = o;
800
- switch (i) {
801
- case "STOPPED":
802
- case "SLEEPING":
803
- t({
804
- status: "sleeping",
805
- load_status: "pending",
806
- message: "Space is asleep. Waking it up...",
807
- detail: i
808
- }), setTimeout(() => {
809
- F(e, s, t);
810
- }, 1e3);
811
- break;
812
- case "PAUSED":
813
- t({
814
- status: "paused",
815
- load_status: "error",
816
- message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
817
- detail: i,
818
- discussions_enabled: await ke(a)
819
- });
820
- break;
821
- case "RUNNING":
822
- case "RUNNING_BUILDING":
823
- t({
824
- status: "running",
825
- load_status: "complete",
826
- message: "Space is running.",
827
- detail: i
828
- });
829
- break;
830
- case "BUILDING":
831
- t({
832
- status: "building",
833
- load_status: "pending",
834
- message: "Space is building...",
835
- detail: i
836
- }), setTimeout(() => {
837
- F(e, s, t);
838
- }, 1e3);
839
- break;
840
- case "APP_STARTING":
841
- t({
842
- status: "starting",
843
- load_status: "pending",
844
- message: "Space is starting...",
845
- detail: i
846
- }), setTimeout(() => {
847
- F(e, s, t);
848
- }, 1e3);
849
- break;
850
- default:
851
- t({
852
- status: "space_error",
853
- load_status: "error",
854
- message: "This space is experiencing an issue.",
855
- detail: i,
856
- discussions_enabled: await ke(a)
857
- });
858
- break;
859
- }
860
- }
861
- const Ue = async (e, s) => {
862
- let t = 0;
863
- const n = 12, o = 5e3;
864
- return new Promise((r) => {
865
- F(
866
- e,
867
- le.test(e) ? "space_name" : "subdomain",
868
- (i) => {
869
- s(i), i.status === "running" || i.status === "error" || i.status === "paused" || i.status === "space_error" ? r() : (i.status === "sleeping" || i.status === "building") && (t < n ? (t++, setTimeout(() => {
870
- Ue(e, s).then(r);
871
- }, o)) : r());
872
- }
873
- );
874
- });
875
- }, jt = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
876
- async function ke(e) {
877
- try {
878
- const s = await fetch(
879
- `https://huggingface.co/api/spaces/${e}/discussions`,
880
- {
881
- method: "HEAD"
882
- }
883
- ), t = s.headers.get("x-error-message");
884
- return !(!s.ok || t && jt.test(t));
885
- } catch {
886
- return !1;
887
- }
888
- }
889
- async function It(e, s) {
890
- const t = {};
891
- s && (t.Authorization = `Bearer ${s}`);
892
- try {
893
- const n = await fetch(
894
- `https://huggingface.co/api/spaces/${e}/${Xe}`,
895
- { headers: t }
896
- );
897
- if (n.status !== 200)
898
- throw new Error("Space hardware could not be obtained.");
899
- const { hardware: o } = await n.json();
900
- return o.current;
901
- } catch (n) {
902
- throw new Error(n.message);
903
- }
904
- }
905
- async function Ut(e, s, t) {
906
- const n = {};
907
- t && (n.Authorization = `Bearer ${t}`);
908
- const o = {
909
- seconds: s
910
- };
911
- try {
912
- const r = await fetch(
913
- `https://huggingface.co/api/spaces/${e}/${et}`,
914
- {
915
- method: "POST",
916
- headers: { "Content-Type": "application/json", ...n },
917
- body: JSON.stringify(o)
918
- }
919
- );
920
- if (r.status !== 200)
921
- throw new Error(
922
- "Could not set sleep timeout on duplicated Space. Please visit *ADD HF LINK TO SETTINGS* to set a timeout manually to reduce billing charges."
923
- );
924
- return await r.json();
925
- } catch (r) {
926
- throw new Error(r.message);
927
- }
928
- }
929
- const Re = [
930
- "cpu-basic",
931
- "cpu-upgrade",
932
- "cpu-xl",
933
- "t4-small",
934
- "t4-medium",
935
- "a10g-small",
936
- "a10g-large",
937
- "a10g-largex2",
938
- "a10g-largex4",
939
- "a100-large",
940
- "zero-a10g",
941
- "h100",
942
- "h100x8"
943
- ];
944
- async function qt(e, s) {
945
- const { token: t, private: n, hardware: o, timeout: r, auth: i } = s;
946
- if (o && !Re.includes(o))
947
- throw new Error(
948
- `Invalid hardware type provided. Valid types are: ${Re.map((m) => `"${m}"`).join(",")}.`
949
- );
950
- const { http_protocol: a, host: u } = await pe(e, t);
951
- let l = null;
952
- if (i) {
953
- const m = await Ne(
954
- a,
955
- u,
956
- i,
957
- fetch
958
- );
959
- m && (l = Pe(m));
960
- }
961
- const p = {
962
- Authorization: `Bearer ${t}`,
963
- "Content-Type": "application/json",
964
- ...l ? { Cookie: l.join("; ") } : {}
965
- }, c = (await (await fetch("https://huggingface.co/api/whoami-v2", {
966
- headers: p
967
- })).json()).name, g = e.split("/")[1], w = {
968
- repository: `${c}/${g}`
969
- };
970
- n && (w.private = !0);
971
- let N;
972
- try {
973
- o || (N = await It(e, t));
974
- } catch (m) {
975
- throw Error(ue + m.message);
976
- }
977
- const f = o || N || "cpu-basic";
978
- w.hardware = f;
979
- try {
980
- const m = await fetch(
981
- `https://huggingface.co/api/spaces/${e}/duplicate`,
982
- {
983
- method: "POST",
984
- headers: p,
985
- body: JSON.stringify(w)
986
- }
987
- );
988
- if (m.status === 409)
989
- try {
990
- return await Y.connect(`${c}/${g}`, s);
991
- } catch (z) {
992
- throw console.error("Failed to connect Client instance:", z), z;
993
- }
994
- else if (m.status !== 200)
995
- throw new Error(m.statusText);
996
- const H = await m.json();
997
- return await Ut(`${c}/${g}`, r || 300, t), await Y.connect(
998
- zt(H.url),
999
- s
1000
- );
1001
- } catch (m) {
1002
- throw new Error(m);
1003
- }
1004
- }
1005
- function zt(e) {
1006
- const s = /https:\/\/huggingface.co\/spaces\/([^/]+\/[^/]+)/, t = e.match(s);
1007
- if (t)
1008
- return t[1];
1009
- }
1010
- const Oe = "supports-zerogpu-headers";
1011
- let Te = !1;
1012
- function Bt() {
1013
- return typeof window < "u" && typeof document < "u" && typeof window.addEventListener == "function";
1014
- }
1015
- function qe(e) {
1016
- return e.includes(".dev.") ? `https://moon-${e.split(".")[1]}.dev.spaces.huggingface.tech` : e.endsWith(".hf.space") ? "https://huggingface.co" : null;
1017
- }
1018
- function Gt() {
1019
- if (!Bt() || Te)
1020
- return;
1021
- window.addEventListener("message", (s) => {
1022
- s.data === Oe && (window.supports_zerogpu_headers = !0);
1023
- }), Te = !0;
1024
- const e = qe(window.location.hostname);
1025
- e && window.parent !== window && window.parent.postMessage(Oe, e);
1026
- }
1027
- class Mt extends TransformStream {
1028
- #e = "";
1029
- /** Constructs a new instance. */
1030
- constructor(s = { allowCR: !1 }) {
1031
- super({
1032
- transform: (t, n) => {
1033
- for (t = this.#e + t; ; ) {
1034
- const o = t.indexOf(`
1035
- `), r = s.allowCR ? t.indexOf("\r") : -1;
1036
- if (r !== -1 && r !== t.length - 1 && (o === -1 || o - 1 > r)) {
1037
- n.enqueue(t.slice(0, r)), t = t.slice(r + 1);
1038
- continue;
1039
- }
1040
- if (o === -1)
1041
- break;
1042
- const i = t[o - 1] === "\r" ? o - 1 : o;
1043
- n.enqueue(t.slice(0, i)), t = t.slice(o + 1);
1044
- }
1045
- this.#e = t;
1046
- },
1047
- flush: (t) => {
1048
- if (this.#e === "")
1049
- return;
1050
- const n = s.allowCR && this.#e.endsWith("\r") ? this.#e.slice(0, -1) : this.#e;
1051
- t.enqueue(n);
1052
- }
1053
- });
1054
- }
1055
- }
1056
- function Ft(e) {
1057
- let s = new TextDecoderStream(), t = new Mt({ allowCR: !0 });
1058
- return e.pipeThrough(s).pipeThrough(t);
1059
- }
1060
- function Ht(e) {
1061
- let t = /[:]\s*/.exec(e), n = t && t.index;
1062
- if (n)
1063
- return [
1064
- e.substring(0, n),
1065
- e.substring(n + t[0].length)
1066
- ];
1067
- }
1068
- function Ae(e, s, t) {
1069
- e.get(s) || e.set(s, t);
1070
- }
1071
- async function* Jt(e, s) {
1072
- if (!e.body)
1073
- return;
1074
- let t = Ft(e.body), n, o = t.getReader(), r;
1075
- for (; ; ) {
1076
- if (s && s.aborted)
1077
- return o.cancel();
1078
- if (n = await o.read(), n.done)
1079
- return;
1080
- if (!n.value) {
1081
- r && (yield r), r = void 0;
1082
- continue;
1083
- }
1084
- let [i, a] = Ht(n.value) || [];
1085
- i === "data" ? (r ||= {}, r[i] = r[i] ? r[i] + `
1086
- ` + a : a) : i === "event" ? (r ||= {}, r[i] = a) : i === "id" ? (r ||= {}, r[i] = String(+a) === a ? +a : a) : i === "retry" && (r ||= {}, r[i] = +a || void 0);
1087
- }
1088
- }
1089
- async function Wt(e, s) {
1090
- let t = new Request(e, s);
1091
- Ae(t.headers, "Accept", "text/event-stream"), Ae(t.headers, "Content-Type", "application/json");
1092
- let n = await fetch(t);
1093
- if (!n.ok)
1094
- throw n;
1095
- return Jt(n, t.signal);
1096
- }
1097
- async function Zt() {
1098
- let {
1099
- event_callbacks: e,
1100
- unclosed_events: s,
1101
- pending_stream_messages: t,
1102
- stream_status: n,
1103
- config: o,
1104
- jwt: r
1105
- } = this;
1106
- const i = this;
1107
- if (!o)
1108
- throw new Error("Could not resolve app config");
1109
- n.open = !0;
1110
- let a = null, u = new URLSearchParams({
1111
- session_hash: this.session_hash
1112
- }).toString(), l = new URL(`${o.root}${this.api_prefix}/${xe}?${u}`);
1113
- if (r && l.searchParams.set("__sign", r), a = this.stream(l), !a) {
1114
- console.warn("Cannot connect to SSE endpoint: " + l.toString());
1115
- return;
1116
- }
1117
- a.onmessage = async function(p) {
1118
- let c = JSON.parse(p.data);
1119
- if (c.msg === "close_stream") {
1120
- de(n, i.abort_controller);
1121
- return;
1122
- }
1123
- const g = c.event_id;
1124
- if (!g)
1125
- await Promise.all(
1126
- Object.keys(e).map(
1127
- (w) => e[w](c)
1128
- )
1129
- );
1130
- else if (e[g] && o) {
1131
- c.msg === "process_completed" && ["sse", "sse_v1", "sse_v2", "sse_v2.1", "sse_v3"].includes(
1132
- o.protocol
1133
- ) && s.delete(g);
1134
- let w = e[g];
1135
- typeof window < "u" && typeof document < "u" ? setTimeout(w, 0, c) : w(c);
1136
- } else
1137
- t[g] || (t[g] = []), t[g].push(c);
1138
- }, a.onerror = async function(p) {
1139
- console.error(p), await Promise.all(
1140
- Object.keys(e).map(
1141
- (c) => e[c]({
1142
- msg: "broken_connection",
1143
- message: L
1144
- })
1145
- )
1146
- );
1147
- };
1148
- }
1149
- function de(e, s) {
1150
- e && (e.open = !1, s?.abort());
1151
- }
1152
- function Kt(e, s, t) {
1153
- !e[s] ? (e[s] = [], t.data.forEach((o, r) => {
1154
- e[s][r] = o;
1155
- })) : t.data.forEach((o, r) => {
1156
- let i = Vt(e[s][r], o);
1157
- e[s][r] = i, t.data[r] = i;
1158
- });
1159
- }
1160
- function Vt(e, s) {
1161
- return s.forEach(([t, n, o]) => {
1162
- e = Yt(e, n, t, o);
1163
- }), e;
1164
- }
1165
- function Yt(e, s, t, n) {
1166
- if (s.length === 0) {
1167
- if (t === "replace")
1168
- return n;
1169
- if (t === "append")
1170
- return e + n;
1171
- throw new Error(`Unsupported action: ${t}`);
1172
- }
1173
- let o = e;
1174
- for (let i = 0; i < s.length - 1; i++)
1175
- o = o[s[i]];
1176
- const r = s[s.length - 1];
1177
- switch (t) {
1178
- case "replace":
1179
- o[r] = n;
1180
- break;
1181
- case "append":
1182
- o[r] += n;
1183
- break;
1184
- case "add":
1185
- Array.isArray(o) ? o.splice(Number(r), 0, n) : o[r] = n;
1186
- break;
1187
- case "delete":
1188
- Array.isArray(o) ? o.splice(Number(r), 1) : delete o[r];
1189
- break;
1190
- default:
1191
- throw new Error(`Unknown action: ${t}`);
1192
- }
1193
- return e;
1194
- }
1195
- function Qt(e, s = {}) {
1196
- const t = {
1197
- close: () => {
1198
- console.warn("Method not implemented.");
1199
- },
1200
- onerror: null,
1201
- onmessage: null,
1202
- onopen: null,
1203
- readyState: 0,
1204
- url: e.toString(),
1205
- withCredentials: !1,
1206
- CONNECTING: 0,
1207
- OPEN: 1,
1208
- CLOSED: 2,
1209
- addEventListener: () => {
1210
- throw new Error("Method not implemented.");
1211
- },
1212
- dispatchEvent: () => {
1213
- throw new Error("Method not implemented.");
1214
- },
1215
- removeEventListener: () => {
1216
- throw new Error("Method not implemented.");
1217
- }
1218
- };
1219
- return Wt(e, s).then(async (n) => {
1220
- t.readyState = t.OPEN;
1221
- try {
1222
- for await (const o of n)
1223
- t.onmessage && t.onmessage(o);
1224
- t.readyState = t.CLOSED;
1225
- } catch (o) {
1226
- t.onerror && t.onerror(o), t.readyState = t.CLOSED;
1227
- }
1228
- }).catch((n) => {
1229
- console.error(n), t.onerror && t.onerror(n), t.readyState = t.CLOSED;
1230
- }), t;
1231
- }
1232
- function Xt(e, s = {}, t, n, o, r) {
1233
- try {
1234
- let i = function(h) {
1235
- (o || Me[h.type]) && p(h);
1236
- }, a = function() {
1237
- for (me = !0; M.length > 0; )
1238
- M.shift()({
1239
- value: void 0,
1240
- done: !0
1241
- });
1242
- }, u = function(h) {
1243
- M.length > 0 ? M.shift()(h) : oe.push(h);
1244
- }, l = function(h) {
1245
- u(es(h)), a();
1246
- }, p = function(h) {
1247
- u({ value: h, done: !1 });
1248
- }, c = function() {
1249
- return oe.length > 0 ? Promise.resolve(oe.shift()) : me ? Promise.resolve({ value: void 0, done: !0 }) : new Promise((h) => M.push(h));
1250
- };
1251
- const { token: g } = this.options, {
1252
- fetch: w,
1253
- app_reference: N,
1254
- config: f,
1255
- session_hash: m,
1256
- api_info: H,
1257
- api_map: z,
1258
- stream_status: X,
1259
- pending_stream_messages: ee,
1260
- pending_diff_streams: te,
1261
- event_callbacks: se,
1262
- unclosed_events: ze,
1263
- post_data: ne,
1264
- options: J,
1265
- api_prefix: T
1266
- } = this, he = r || { "x-gradio-user": "api" }, Be = this;
1267
- if (!H) throw new Error("No API found");
1268
- if (!f) throw new Error("Could not resolve app config");
1269
- let { fn_index: d, endpoint_info: fe, dependency: B } = ts(
1270
- H,
1271
- e,
1272
- z,
1273
- f
1274
- ), Ge = bt(s, fe), j, A = f.protocol ?? "ws";
1275
- if (A === "ws")
1276
- throw new Error("WebSocket protocol is not supported in this version");
1277
- let I = "", ss = () => I;
1278
- const _ = typeof e == "number" ? "/predict" : e;
1279
- let W, v = null, x = !1, _e = {}, G = typeof window < "u" && typeof document < "u" ? new URLSearchParams(window.location.search).toString() : "";
1280
- const Me = J?.events?.reduce(
1281
- (h, R) => (h[R] = !0, h),
1282
- {}
1283
- ) || {};
1284
- async function Fe() {
1285
- let h = {}, R = {};
1286
- h = { event_id: v }, R = { event_id: v, session_hash: m, fn_index: d };
1287
- try {
1288
- if (!f)
1289
- throw new Error("Could not resolve app config");
1290
- "event_id" in R && await w(`${f.root}${T}/${ot}`, {
1291
- headers: { "Content-Type": "application/json" },
1292
- method: "POST",
1293
- body: JSON.stringify(R)
1294
- }), await w(`${f.root}${T}/${nt}`, {
1295
- headers: { "Content-Type": "application/json" },
1296
- method: "POST",
1297
- body: JSON.stringify(h)
1298
- });
1299
- } catch {
1300
- console.warn(
1301
- "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable."
1302
- );
1303
- }
1304
- }
1305
- const He = async (h) => {
1306
- await this._resolve_heartbeat(h);
1307
- };
1308
- async function ge(h) {
1309
- if (!f) return;
1310
- let R = h.render_id;
1311
- f.components = [
1312
- ...f.components.filter((E) => E.props.rendered_in !== R),
1313
- ...h.components
1314
- ], f.dependencies = [
1315
- ...f.dependencies.filter((E) => E.rendered_in !== R),
1316
- ...h.dependencies
1317
- ];
1318
- const Z = f.components.some((E) => E.type === "state"), y = f.dependencies.some(
1319
- (E) => E.targets.some((U) => U[1] === "unload")
1320
- );
1321
- f.connect_heartbeat = Z || y, await He(f), i({
1322
- type: "render",
1323
- data: h,
1324
- endpoint: _,
1325
- fn_index: d
1326
- });
1327
- }
1328
- const Je = this.handle_blob(
1329
- f.root,
1330
- Ge,
1331
- fe
1332
- ).then(async (h) => {
1333
- if (W = {
1334
- data: V(
1335
- h,
1336
- B,
1337
- f.components,
1338
- "input",
1339
- !0
1340
- ) || [],
1341
- event_data: t,
1342
- fn_index: d,
1343
- trigger_id: n
1344
- }, At(d, f))
1345
- i({
1346
- type: "status",
1347
- endpoint: _,
1348
- stage: "pending",
1349
- queue: !1,
1350
- fn_index: d,
1351
- time: /* @__PURE__ */ new Date()
1352
- }), ne(
1353
- `${f.root}${T}/run${_.startsWith("/") ? _ : `/${_}`}${G ? "?" + G : ""}`,
1354
- {
1355
- ...W,
1356
- session_hash: m
1357
- },
1358
- he
1359
- ).then(async ([y, E]) => {
1360
- const U = y.data;
1361
- if (E == 200)
1362
- i({
1363
- type: "data",
1364
- endpoint: _,
1365
- fn_index: d,
1366
- data: V(
1367
- U,
1368
- B,
1369
- f.components,
1370
- "output",
1371
- J.with_null_state
1372
- ),
1373
- time: /* @__PURE__ */ new Date(),
1374
- event_data: t,
1375
- trigger_id: n
1376
- }), y.render_config && await ge(y.render_config), i({
1377
- type: "status",
1378
- endpoint: _,
1379
- fn_index: d,
1380
- stage: "complete",
1381
- eta: y.average_duration,
1382
- queue: !1,
1383
- time: /* @__PURE__ */ new Date()
1384
- });
1385
- else {
1386
- const O = y?.error === L;
1387
- i({
1388
- type: "status",
1389
- stage: "error",
1390
- endpoint: _,
1391
- fn_index: d,
1392
- message: y.error,
1393
- broken: O,
1394
- queue: !1,
1395
- time: /* @__PURE__ */ new Date()
1396
- });
1397
- }
1398
- }).catch((y) => {
1399
- i({
1400
- type: "status",
1401
- stage: "error",
1402
- message: y.message,
1403
- endpoint: _,
1404
- fn_index: d,
1405
- queue: !1,
1406
- time: /* @__PURE__ */ new Date()
1407
- });
1408
- });
1409
- else if (A == "sse") {
1410
- i({
1411
- type: "status",
1412
- stage: "pending",
1413
- queue: !0,
1414
- endpoint: _,
1415
- fn_index: d,
1416
- time: /* @__PURE__ */ new Date()
1417
- });
1418
- var Z = new URLSearchParams({
1419
- fn_index: d.toString(),
1420
- session_hash: m
1421
- }).toString();
1422
- let y = new URL(
1423
- `${f.root}${T}/${xe}?${G ? G + "&" : ""}${Z}`
1424
- );
1425
- if (this.jwt && y.searchParams.set("__sign", this.jwt), j = this.stream(y), !j)
1426
- return Promise.reject(
1427
- new Error("Cannot connect to SSE endpoint: " + y.toString())
1428
- );
1429
- j.onmessage = async function(E) {
1430
- const U = JSON.parse(E.data), { type: O, status: D, data: b } = Ee(
1431
- U,
1432
- _e[d]
1433
- );
1434
- if (O === "update" && D && !x)
1435
- i({
1436
- type: "status",
1437
- endpoint: _,
1438
- fn_index: d,
1439
- time: /* @__PURE__ */ new Date(),
1440
- ...D
1441
- }), D.stage === "error" && (j?.close(), a());
1442
- else if (O === "data") {
1443
- let [q, P] = await ne(
1444
- `${f.root}${T}/queue/data`,
1445
- {
1446
- ...W,
1447
- session_hash: m,
1448
- event_id: v
1449
- }
1450
- );
1451
- P !== 200 && (i({
1452
- type: "status",
1453
- stage: "error",
1454
- message: L,
1455
- queue: !0,
1456
- endpoint: _,
1457
- fn_index: d,
1458
- time: /* @__PURE__ */ new Date()
1459
- }), j?.close(), a());
1460
- } else O === "complete" ? x = D : O === "log" ? i({
1461
- type: "log",
1462
- title: b.title,
1463
- log: b.log,
1464
- level: b.level,
1465
- endpoint: _,
1466
- duration: b.duration,
1467
- visible: b.visible,
1468
- fn_index: d
1469
- }) : (O === "generating" || O === "streaming") && i({
1470
- type: "status",
1471
- time: /* @__PURE__ */ new Date(),
1472
- ...D,
1473
- stage: D?.stage,
1474
- queue: !0,
1475
- endpoint: _,
1476
- fn_index: d
1477
- });
1478
- b && (i({
1479
- type: "data",
1480
- time: /* @__PURE__ */ new Date(),
1481
- data: V(
1482
- b.data,
1483
- B,
1484
- f.components,
1485
- "output",
1486
- J.with_null_state
1487
- ),
1488
- endpoint: _,
1489
- fn_index: d,
1490
- event_data: t,
1491
- trigger_id: n
1492
- }), x && (i({
1493
- type: "status",
1494
- time: /* @__PURE__ */ new Date(),
1495
- ...x,
1496
- stage: D?.stage,
1497
- queue: !0,
1498
- endpoint: _,
1499
- fn_index: d
1500
- }), j?.close(), a()));
1501
- };
1502
- } else if (A == "sse_v1" || A == "sse_v2" || A == "sse_v2.1" || A == "sse_v3") {
1503
- i({
1504
- type: "status",
1505
- stage: "pending",
1506
- queue: !0,
1507
- endpoint: _,
1508
- fn_index: d,
1509
- time: /* @__PURE__ */ new Date()
1510
- });
1511
- let y = "";
1512
- typeof window < "u" && typeof document < "u" && (y = window?.location?.hostname);
1513
- const E = qe(y);
1514
- return (typeof window < "u" && typeof document < "u" && window.parent != window && !!E && window.supports_zerogpu_headers ? xt("zerogpu-headers", E) : Promise.resolve(null)).then((b) => {
1515
- const q = { ...he, ...b || {} };
1516
- return ne(
1517
- `${f.root}${T}/${Ve}?${G}`,
1518
- {
1519
- ...W,
1520
- session_hash: m
1521
- },
1522
- q
1523
- );
1524
- }).then(async ([b, q]) => {
1525
- if (b.event_id && (I = b.event_id), q === 503)
1526
- i({
1527
- type: "status",
1528
- stage: "error",
1529
- message: De,
1530
- queue: !0,
1531
- endpoint: _,
1532
- fn_index: d,
1533
- time: /* @__PURE__ */ new Date(),
1534
- visible: !0
1535
- });
1536
- else if (q === 422)
1537
- i({
1538
- type: "status",
1539
- stage: "error",
1540
- message: b.detail,
1541
- queue: !0,
1542
- endpoint: _,
1543
- fn_index: d,
1544
- code: "validation_error",
1545
- time: /* @__PURE__ */ new Date(),
1546
- visible: !0
1547
- }), a();
1548
- else if (q !== 200) {
1549
- const P = b?.error === L;
1550
- i({
1551
- type: "status",
1552
- stage: "error",
1553
- broken: P,
1554
- message: P ? L : b.detail || b.error,
1555
- queue: !0,
1556
- endpoint: _,
1557
- fn_index: d,
1558
- time: /* @__PURE__ */ new Date(),
1559
- visible: !0
1560
- });
1561
- } else {
1562
- v = b.event_id, I = v;
1563
- let P = async function(ie) {
1564
- try {
1565
- const { type: S, status: $, data: k, original_msg: We } = Ee(
1566
- ie,
1567
- _e[d]
1568
- );
1569
- if (S == "heartbeat")
1570
- return;
1571
- if (S === "update" && $ && !x)
1572
- i({
1573
- type: "status",
1574
- endpoint: _,
1575
- fn_index: d,
1576
- time: /* @__PURE__ */ new Date(),
1577
- original_msg: We,
1578
- ...$
1579
- });
1580
- else if (S === "complete")
1581
- x = $;
1582
- else if (S == "unexpected_error" || S == "broken_connection") {
1583
- console.error("Unexpected error", $?.message);
1584
- const Ze = S === "broken_connection";
1585
- i({
1586
- type: "status",
1587
- stage: "error",
1588
- message: $?.message || "An Unexpected Error Occurred!",
1589
- queue: !0,
1590
- endpoint: _,
1591
- broken: Ze,
1592
- session_not_found: $?.session_not_found,
1593
- fn_index: d,
1594
- time: /* @__PURE__ */ new Date()
1595
- });
1596
- } else if (S === "log") {
1597
- i({
1598
- type: "log",
1599
- title: k.title,
1600
- log: k.log,
1601
- level: k.level,
1602
- endpoint: _,
1603
- duration: k.duration,
1604
- visible: k.visible,
1605
- fn_index: d
1606
- });
1607
- return;
1608
- } else (S === "generating" || S === "streaming") && (i({
1609
- type: "status",
1610
- time: /* @__PURE__ */ new Date(),
1611
- ...$,
1612
- stage: $?.stage,
1613
- queue: !0,
1614
- endpoint: _,
1615
- fn_index: d
1616
- }), k && B.connection !== "stream" && ["sse_v2", "sse_v2.1", "sse_v3"].includes(A) && Kt(te, v, k));
1617
- k && (i({
1618
- type: "data",
1619
- time: /* @__PURE__ */ new Date(),
1620
- data: V(
1621
- k.data,
1622
- B,
1623
- f.components,
1624
- "output",
1625
- J.with_null_state
1626
- ),
1627
- endpoint: _,
1628
- fn_index: d
1629
- }), k.render_config && await ge(k.render_config), x && (i({
1630
- type: "status",
1631
- time: /* @__PURE__ */ new Date(),
1632
- ...x,
1633
- stage: $?.stage,
1634
- queue: !0,
1635
- endpoint: _,
1636
- fn_index: d
1637
- }), a())), ($?.stage === "complete" || $?.stage === "error") && (se[v] && delete se[v], v in te && delete te[v]);
1638
- } catch (S) {
1639
- console.error("Unexpected client exception", S), i({
1640
- type: "status",
1641
- stage: "error",
1642
- message: "An Unexpected Error Occurred!",
1643
- queue: !0,
1644
- endpoint: _,
1645
- fn_index: d,
1646
- time: /* @__PURE__ */ new Date()
1647
- }), ["sse_v2", "sse_v2.1", "sse_v3"].includes(A) && (de(X, Be.abort_controller), X.open = !1, a());
1648
- }
1649
- };
1650
- v in ee && (ee[v].forEach((ie) => P(ie)), delete ee[v]), se[v] = P, ze.add(v), X.open || await this.open_stream();
1651
- }
1652
- });
1653
- }
1654
- });
1655
- let me = !1;
1656
- const oe = [], M = [], we = {
1657
- [Symbol.asyncIterator]: () => we,
1658
- next: c,
1659
- throw: async (h) => (l(h), c()),
1660
- return: async () => (a(), { value: void 0, done: !0 }),
1661
- cancel: Fe,
1662
- send_chunk: (h) => {
1663
- this.post_data(`${f.root}${T}/stream/${I}`, {
1664
- ...h,
1665
- session_hash: this.session_hash
1666
- });
1667
- },
1668
- close_stream: () => {
1669
- this.post_data(
1670
- `${f.root}${T}/stream/${I}/close`,
1671
- {}
1672
- ), a();
1673
- },
1674
- event_id: () => I,
1675
- wait_for_id: async () => (await Je, v)
1676
- };
1677
- return we;
1678
- } catch (i) {
1679
- throw console.error("Submit function encountered an error:", i), i;
1680
- }
1681
- }
1682
- function es(e) {
1683
- return {
1684
- then: (s, t) => t(e)
1685
- };
1686
- }
1687
- function ts(e, s, t, n) {
1688
- let o, r, i;
1689
- if (typeof s == "number")
1690
- o = s, r = e.unnamed_endpoints[o], i = n.dependencies.find((a) => a.id == s);
1691
- else {
1692
- const a = s.replace(/^\//, "");
1693
- o = t[a], r = e.named_endpoints[s.trim()], i = n.dependencies.find(
1694
- (u) => u.id == t[a]
1695
- );
1696
- }
1697
- if (typeof o != "number")
1698
- throw new Error(
1699
- "There is no endpoint matching that name of fn_index matching that number."
1700
- );
1701
- return { fn_index: o, endpoint_info: r, dependency: i };
1702
- }
1703
- class Y {
1704
- app_reference;
1705
- options;
1706
- deep_link = null;
1707
- config;
1708
- api_prefix = "";
1709
- api_info;
1710
- api_map = {};
1711
- session_hash = Math.random().toString(36).substring(2);
1712
- jwt = !1;
1713
- last_status = {};
1714
- cookies = null;
1715
- // streaming
1716
- stream_status = { open: !1 };
1717
- closed = !1;
1718
- pending_stream_messages = {};
1719
- pending_diff_streams = {};
1720
- event_callbacks = {};
1721
- unclosed_events = /* @__PURE__ */ new Set();
1722
- heartbeat_event = null;
1723
- abort_controller = null;
1724
- stream_instance = null;
1725
- current_payload;
1726
- get_url_config(s = null) {
1727
- if (!this.config)
1728
- throw new Error(C);
1729
- s === null && (s = window.location.href);
1730
- const t = (i) => i.replace(/^\/+|\/+$/g, "");
1731
- let n = t(new URL(this.config.root).pathname), o = t(new URL(s).pathname), r;
1732
- return o.startsWith(n) ? r = t(o.substring(n.length)) : r = "", this.get_page_config(r);
1733
- }
1734
- get_page_config(s) {
1735
- if (!this.config)
1736
- throw new Error(C);
1737
- let t = this.config;
1738
- return s in t.page || (s = ""), {
1739
- ...t,
1740
- current_page: s,
1741
- layout: t.page[s].layout,
1742
- components: t.components.filter(
1743
- (n) => t.page[s].components.includes(n.id)
1744
- ),
1745
- dependencies: this.config.dependencies.filter(
1746
- (n) => t.page[s].dependencies.includes(n.id)
1747
- )
1748
- };
1749
- }
1750
- fetch(s, t) {
1751
- const n = new Headers(t?.headers || {});
1752
- return this && this.cookies && n.append("Cookie", this.cookies), this && this.options.headers && new Headers(this.options.headers).forEach((r, i) => {
1753
- n.append(i, r);
1754
- }), fetch(s, { ...t, headers: n });
1755
- }
1756
- stream(s) {
1757
- const t = new Headers();
1758
- return this && this.cookies && t.append("Cookie", this.cookies), this && this.options.headers && new Headers(this.options.headers).forEach((o, r) => {
1759
- t.append(r, o);
1760
- }), this && this.options.token && t.append("Authorization", `Bearer ${this.options.token}`), this.abort_controller = new AbortController(), this.stream_instance = Qt(s.toString(), {
1761
- credentials: "include",
1762
- headers: t,
1763
- signal: this.abort_controller.signal
1764
- }), this.stream_instance;
1765
- }
1766
- view_api;
1767
- upload_files;
1768
- upload;
1769
- handle_blob;
1770
- post_data;
1771
- submit;
1772
- predict;
1773
- open_stream;
1774
- resolve_config;
1775
- resolve_cookies;
1776
- constructor(s, t = { events: ["data"] }) {
1777
- this.app_reference = s, this.deep_link = t.query_params?.deep_link || null, t.events || (t.events = ["data"]), this.options = t, this.current_payload = {}, t.cookies && (this.cookies = t.cookies), this.view_api = vt.bind(this), this.upload_files = Et.bind(this), this.handle_blob = Dt.bind(this), this.post_data = Nt.bind(this), this.submit = Xt.bind(this), this.predict = Pt.bind(this), this.open_stream = Zt.bind(this), this.resolve_config = ft.bind(this), this.resolve_cookies = _t.bind(this), this.upload = Ot.bind(this), this.fetch = this.fetch.bind(this), this.handle_space_success = this.handle_space_success.bind(this), this.stream = this.stream.bind(this);
1778
- }
1779
- async init() {
1780
- Gt(), this.options.auth && await this.resolve_cookies(), await this._resolve_config().then(
1781
- ({ config: s }) => this._resolve_heartbeat(s)
1782
- ), this.api_info = await this.view_api(), this.api_map = ht(this.config?.dependencies || []);
1783
- }
1784
- async _resolve_heartbeat(s) {
1785
- if (s && (this.config = s, this.api_prefix = s.api_prefix || "", this.config && this.config.connect_heartbeat && this.config.space_id && this.options.token && (this.jwt = await be(
1786
- this.config.space_id,
1787
- this.options.token,
1788
- this.cookies
1789
- ))), s.space_id && this.options.token && (this.jwt = await be(s.space_id, this.options.token)), this.config && this.config.connect_heartbeat) {
1790
- const t = new URL(
1791
- `${this.config.root}${this.api_prefix}/${tt}/${this.session_hash}`
1792
- );
1793
- this.jwt && t.searchParams.set("__sign", this.jwt), this.heartbeat_event || (this.heartbeat_event = this.stream(t));
1794
- }
1795
- }
1796
- static async connect(s, t = {
1797
- events: ["data"]
1798
- }) {
1799
- const n = new this(s, t);
1800
- return t.session_hash && (n.session_hash = t.session_hash), await n.init(), n;
1801
- }
1802
- async reconnect() {
1803
- const s = new URL(
1804
- `${this.config.root}${this.api_prefix}/${it}`
1805
- );
1806
- let t;
1807
- try {
1808
- const n = await this.fetch(s);
1809
- if (!n.ok)
1810
- throw new Error();
1811
- t = (await n.json()).app_id;
1812
- } catch {
1813
- return "broken";
1814
- }
1815
- return t !== this.config.app_id ? "changed" : "connected";
1816
- }
1817
- close() {
1818
- this.closed = !0, de(this.stream_status, this.abort_controller);
1819
- }
1820
- set_current_payload(s) {
1821
- this.current_payload = s;
1822
- }
1823
- static async duplicate(s, t = {
1824
- events: ["data"]
1825
- }) {
1826
- return qt(s, t);
1827
- }
1828
- async _resolve_config() {
1829
- const { http_protocol: s, host: t, space_id: n } = await pe(
1830
- this.app_reference,
1831
- this.options.token
1832
- ), { status_callback: o } = this.options;
1833
- n && o && await Ue(n, o);
1834
- let r;
1835
- try {
1836
- let i = `${s}//${t}`;
1837
- if (r = await this.resolve_config(i), !r)
1838
- throw new Error(C);
1839
- return this.config_success(r);
1840
- } catch (i) {
1841
- if (n && o)
1842
- F(
1843
- n,
1844
- le.test(n) ? "space_name" : "subdomain",
1845
- this.handle_space_success
1846
- );
1847
- else
1848
- throw o && o({
1849
- status: "error",
1850
- message: "Could not load this space.",
1851
- load_status: "error",
1852
- detail: "NOT_FOUND"
1853
- }), Error(i);
1854
- }
1855
- }
1856
- async config_success(s) {
1857
- if (this.config = s, this.api_prefix = s.api_prefix || "", this.config.auth_required)
1858
- return this.prepare_return_obj();
1859
- try {
1860
- this.api_info = await this.view_api();
1861
- } catch (t) {
1862
- console.error(at + t.message);
1863
- }
1864
- return this.prepare_return_obj();
1865
- }
1866
- async handle_space_success(s) {
1867
- if (!this)
1868
- throw new Error(C);
1869
- const { status_callback: t } = this.options;
1870
- if (t && t(s), s.status === "running")
1871
- try {
1872
- if (this.config = await this._resolve_config(), this.api_prefix = this?.config?.api_prefix || "", !this.config)
1873
- throw new Error(C);
1874
- return await this.config_success(this.config);
1875
- } catch (n) {
1876
- throw t && t({
1877
- status: "error",
1878
- message: "Could not load this space.",
1879
- load_status: "error",
1880
- detail: "NOT_FOUND"
1881
- }), n;
1882
- }
1883
- }
1884
- async component_server(s, t, n) {
1885
- if (!this.config)
1886
- throw new Error(C);
1887
- const o = {}, { token: r } = this.options, { session_hash: i } = this;
1888
- r && (o.Authorization = `Bearer ${this.options.token}`);
1889
- let a, u = this.config.components.find(
1890
- (p) => p.id === s
1891
- );
1892
- u?.props?.root_url ? a = u.props.root_url : a = this.config.root;
1893
- let l;
1894
- if (typeof n == "object" && n !== null && "binary" in n) {
1895
- const p = n;
1896
- l = new FormData();
1897
- for (const c in p.data)
1898
- c !== "binary" && l.append(c, p.data[c]);
1899
- l.set("component_id", s.toString()), l.set("fn_name", t), l.set("session_hash", i);
1900
- } else
1901
- l = JSON.stringify({
1902
- data: n,
1903
- component_id: s,
1904
- fn_name: t,
1905
- session_hash: i
1906
- }), o["Content-Type"] = "application/json";
1907
- r && (o.Authorization = `Bearer ${r}`);
1908
- try {
1909
- const p = await this.fetch(
1910
- `${a}${this.api_prefix}/${st}/`,
1911
- {
1912
- method: "POST",
1913
- body: l,
1914
- headers: o,
1915
- credentials: "include"
1916
- }
1917
- );
1918
- if (!p.ok)
1919
- throw new Error(
1920
- "Could not connect to component server: " + p.statusText
1921
- );
1922
- return await p.json();
1923
- } catch (p) {
1924
- console.warn(p);
1925
- }
1926
- }
1927
- set_cookies(s) {
1928
- this.cookies = Pe(s).join("; ");
1929
- }
1930
- prepare_return_obj() {
1931
- return {
1932
- config: this.config,
1933
- predict: this.predict,
1934
- submit: this.submit,
1935
- view_api: this.view_api,
1936
- component_server: this.component_server
1937
- };
1938
- }
1939
- }
1940
- async function is(e, s = {
1941
- events: ["data"]
1942
- }) {
1943
- return await Y.connect(e, s);
1944
- }
1945
- async function rs(e, s) {
1946
- return await Y.duplicate(e, s);
1947
- }
1948
- export {
1949
- Y as Client,
1950
- Q as FileData,
1951
- lt as MISSING_CREDENTIALS_MSG,
1952
- is as client,
1953
- rs as duplicate,
1954
- os as handle_file,
1955
- Pt as predict,
1956
- ns as prepare_files,
1957
- Xt as submit,
1958
- Ot as upload,
1959
- Et as up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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/client.d.ts DELETED
@@ -1,78 +0,0 @@
1
- import type { ApiData, ApiInfo, ClientOptions, Config, DuplicateOptions, EndpointInfo, JsApiData, PredictReturn, SpaceStatus, Status, UploadResponse, SubmitIterable, GradioEvent } from "./types";
2
- import { FileData } from "./upload";
3
- export declare class Client {
4
- app_reference: string;
5
- options: ClientOptions;
6
- deep_link: string | null;
7
- config: Config | undefined;
8
- api_prefix: string;
9
- api_info: ApiInfo<JsApiData> | undefined;
10
- api_map: Record<string, number>;
11
- session_hash: string;
12
- jwt: string | false;
13
- last_status: Record<string, Status["stage"]>;
14
- private cookies;
15
- stream_status: {
16
- open: boolean;
17
- };
18
- closed: boolean;
19
- pending_stream_messages: Record<string, any[][]>;
20
- pending_diff_streams: Record<string, any[][]>;
21
- event_callbacks: Record<string, (data?: unknown) => Promise<void>>;
22
- unclosed_events: Set<string>;
23
- heartbeat_event: EventSource | null;
24
- abort_controller: AbortController | null;
25
- stream_instance: EventSource | null;
26
- current_payload: any;
27
- get_url_config(url?: string | null): Config;
28
- get_page_config(page: string): Config;
29
- fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
30
- stream(url: URL): EventSource;
31
- view_api: () => Promise<ApiInfo<JsApiData>>;
32
- upload_files: (root_url: string, files: (Blob | File)[], upload_id?: string) => Promise<UploadResponse>;
33
- upload: (file_data: FileData[], root_url: string, upload_id?: string, max_file_size?: number) => Promise<(FileData | null)[] | null>;
34
- handle_blob: (endpoint: string, data: unknown[], endpoint_info: EndpointInfo<ApiData | JsApiData>) => Promise<unknown[]>;
35
- post_data: (url: string, body: unknown, additional_headers?: any) => Promise<unknown[]>;
36
- submit: (endpoint: string | number, data: unknown[] | Record<string, unknown> | undefined, event_data?: unknown, trigger_id?: number | null, all_events?: boolean) => SubmitIterable<GradioEvent>;
37
- predict: <T = unknown>(endpoint: string | number, data: unknown[] | Record<string, unknown> | undefined, event_data?: unknown) => Promise<PredictReturn<T>>;
38
- open_stream: () => Promise<void>;
39
- private resolve_config;
40
- private resolve_cookies;
41
- constructor(app_reference: string, options?: ClientOptions);
42
- private init;
43
- _resolve_heartbeat(_config: Config): Promise<void>;
44
- static connect(app_reference: string, options?: ClientOptions): Promise<Client>;
45
- reconnect(): Promise<"connected" | "broken" | "changed">;
46
- close(): void;
47
- set_current_payload(payload: any): void;
48
- static duplicate(app_reference: string, options?: DuplicateOptions): Promise<Client>;
49
- private _resolve_config;
50
- private config_success;
51
- handle_space_success(status: SpaceStatus): Promise<Config | void>;
52
- component_server(component_id: number, fn_name: string, data: unknown | {
53
- binary: boolean;
54
- data: Record<string, any>;
55
- }): Promise<unknown>;
56
- set_cookies(raw_cookies: string): void;
57
- private prepare_return_obj;
58
- }
59
- /**
60
- * @deprecated This method will be removed in v1.0. Use `Client.connect()` instead.
61
- * Creates a client instance for interacting with Gradio apps.
62
- *
63
- * @param {string} app_reference - The reference or URL to a Gradio space or app.
64
- * @param {ClientOptions} options - Configuration options for the client.
65
- * @returns {Promise<Client>} A promise that resolves to a `Client` instance.
66
- */
67
- export declare function client(app_reference: string, options?: ClientOptions): Promise<Client>;
68
- /**
69
- * @deprecated This method will be removed in v1.0. Use `Client.duplicate()` instead.
70
- * Creates a duplicate of a space and returns a client instance for the duplicated space.
71
- *
72
- * @param {string} app_reference - The reference or URL to a Gradio space or app to duplicate.
73
- * @param {DuplicateOptions} options - Configuration options for the client.
74
- * @returns {Promise<Client>} A promise that resolves to a `Client` instance.
75
- */
76
- export declare function duplicate_space(app_reference: string, options: DuplicateOptions): Promise<Client>;
77
- export type ClientInstance = Client;
78
- //# sourceMappingURL=client.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/client.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,OAAO,EACP,OAAO,EACP,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,aAAa,EACb,WAAW,EAC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OG;AACH,wBAAsB,MAAM,CAC3B,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,aAER,GACC,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACpC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC"}
 
 
node_modules/@gradio/client/dist/constants.d.ts DELETED
@@ -1,34 +0,0 @@
1
- export declare const HOST_URL = "host";
2
- export declare const API_URL = "predict/";
3
- export declare const SSE_URL_V0 = "queue/join";
4
- export declare const SSE_DATA_URL_V0 = "queue/data";
5
- export declare const SSE_URL = "queue/data";
6
- export declare const SSE_DATA_URL = "queue/join";
7
- export declare const UPLOAD_URL = "upload";
8
- export declare const LOGIN_URL = "login";
9
- export declare const CONFIG_URL = "config";
10
- export declare const API_INFO_URL = "info";
11
- export declare const RUNTIME_URL = "runtime";
12
- export declare const SLEEPTIME_URL = "sleeptime";
13
- export declare const HEARTBEAT_URL = "heartbeat";
14
- export declare const COMPONENT_SERVER_URL = "component_server";
15
- export declare const RESET_URL = "reset";
16
- export declare const CANCEL_URL = "cancel";
17
- export declare const APP_ID_URL = "app_id";
18
- export declare const RAW_API_INFO_URL = "info?serialize=False";
19
- export declare const SPACE_FETCHER_URL = "https://gradio-space-api-fetcher-v2.hf.space/api";
20
- export declare const SPACE_URL = "https://hf.space/{}";
21
- export declare const QUEUE_FULL_MSG = "This application is currently busy. Please try again. ";
22
- export declare const BROKEN_CONNECTION_MSG = "Connection errored out. ";
23
- export declare const CONFIG_ERROR_MSG = "Could not resolve app config. ";
24
- export declare const SPACE_STATUS_ERROR_MSG = "Could not get space status. ";
25
- export declare const API_INFO_ERROR_MSG = "Could not get API info. ";
26
- export declare const SPACE_METADATA_ERROR_MSG = "Space metadata could not be loaded. ";
27
- export declare const INVALID_URL_MSG = "Invalid URL. A full URL path is required.";
28
- export declare const UNAUTHORIZED_MSG = "Not authorized to access this space. ";
29
- export declare const INVALID_CREDENTIALS_MSG = "Invalid credentials. Could not login. ";
30
- export declare const MISSING_CREDENTIALS_MSG = "Login credentials are required to access this space.";
31
- export declare const NODEJS_FS_ERROR_MSG = "File system access is only available in Node.js environments";
32
- export declare const ROOT_URL_ERROR_MSG = "Root URL not found in client config";
33
- export declare const FILE_PROCESSING_ERROR_MSG = "Error uploading file";
34
- //# sourceMappingURL=constants.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/constants.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,QAAQ,SAAS,CAAC;AAC/B,eAAO,MAAM,OAAO,aAAa,CAAC;AAClC,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,eAAe,eAAe,CAAC;AAC5C,eAAO,MAAM,OAAO,eAAe,CAAC;AACpC,eAAO,MAAM,YAAY,eAAe,CAAC;AACzC,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,YAAY,SAAS,CAAC;AACnC,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,aAAa,cAAc,CAAC;AACzC,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AACvD,eAAO,MAAM,SAAS,UAAU,CAAC;AACjC,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,UAAU,WAAW,CAAC;AAEnC,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,iBAAiB,qDACqB,CAAC;AACpD,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAG/C,eAAO,MAAM,cAAc,2DAC8B,CAAC;AAC1D,eAAO,MAAM,qBAAqB,6BAA6B,CAAC;AAChE,eAAO,MAAM,gBAAgB,mCAAmC,CAAC;AACjE,eAAO,MAAM,sBAAsB,iCAAiC,CAAC;AACrE,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAC7D,eAAO,MAAM,wBAAwB,yCAAyC,CAAC;AAC/E,eAAO,MAAM,eAAe,8CAA8C,CAAC;AAC3E,eAAO,MAAM,gBAAgB,0CAA0C,CAAC;AACxE,eAAO,MAAM,uBAAuB,2CAA2C,CAAC;AAChF,eAAO,MAAM,uBAAuB,yDACmB,CAAC;AACxD,eAAO,MAAM,mBAAmB,iEAC+B,CAAC;AAChE,eAAO,MAAM,kBAAkB,wCAAwC,CAAC;AACxE,eAAO,MAAM,yBAAyB,yBAAyB,CAAC"}
 
 
node_modules/@gradio/client/dist/helpers/api_info.d.ts DELETED
@@ -1,48 +0,0 @@
1
- import type { ApiData, ApiInfo, Config, JsApiData, EndpointInfo, Status } from "../types";
2
- export declare const RE_SPACE_NAME: RegExp;
3
- export declare const RE_SPACE_DOMAIN: RegExp;
4
- export declare function process_endpoint(app_reference: string, token?: `hf_${string}`): Promise<{
5
- space_id: string | false;
6
- host: string;
7
- ws_protocol: "ws" | "wss";
8
- http_protocol: "http:" | "https:";
9
- }>;
10
- export declare const join_urls: (...urls: string[]) => string;
11
- export declare function transform_api_info(api_info: ApiInfo<ApiData>, config: Config, api_map: Record<string, number>): ApiInfo<JsApiData>;
12
- export declare function get_type(type: {
13
- type: any;
14
- description: string;
15
- }, component: string, serializer: string, signature_type: "return" | "parameter"): string | undefined;
16
- export declare function get_description(type: {
17
- type: any;
18
- description: string;
19
- }, serializer: string): string;
20
- export declare function handle_message(data: any, last_status: Status["stage"]): {
21
- type: "hash" | "data" | "update" | "complete" | "generating" | "log" | "none" | "heartbeat" | "streaming" | "broken_connection" | "unexpected_error";
22
- data?: any;
23
- status?: Status;
24
- original_msg?: string;
25
- };
26
- /**
27
- * Maps the provided `data` to the parameters defined by the `/info` endpoint response.
28
- * This allows us to support both positional and keyword arguments passed to the client
29
- * and ensures that all parameters are either directly provided or have default values assigned.
30
- *
31
- * @param {unknown[] | Record<string, unknown>} data - The input data for the function,
32
- * which can be either an array of values for positional arguments or an object
33
- * with key-value pairs for keyword arguments.
34
- * @param {JsApiData[]} parameters - Array of parameter descriptions retrieved from the
35
- * `/info` endpoint.
36
- *
37
- * @returns {unknown[]} - Returns an array of resolved data where each element corresponds
38
- * to the expected parameter from the API. The `parameter_default` value is used where
39
- * a value is not provided for a parameter, and optional parameters without defaults are
40
- * set to `undefined`.
41
- *
42
- * @throws {Error} - Throws an error:
43
- * - If more arguments are provided than are defined in the parameters.
44
- * * - If no parameter value is provided for a required parameter and no default value is defined.
45
- * - If an argument is provided that does not match any defined parameter.
46
- */
47
- export declare const map_data_to_params: (data: (unknown[] | Record<string, unknown>) | undefined, endpoint_info: EndpointInfo<JsApiData | ApiData>) => unknown[];
48
- //# sourceMappingURL=api_info.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/helpers/api_info.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"api_info.d.ts","sourceRoot":"","sources":["../../src/helpers/api_info.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,OAAO,EACP,OAAO,EACP,MAAM,EACN,SAAS,EACT,YAAY,EACZ,MAAM,EACN,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,aAAa,QAA2C,CAAC;AACtE,eAAO,MAAM,eAAe,QAA0B,CAAC;AAEvD,wBAAsB,gBAAgB,CACrC,aAAa,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,MAAM,MAAM,EAAE,GACpB,OAAO,CAAC;IACV,QAAQ,EAAE,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AG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aAAK,EAC9C,eAAe,YAAY,CAAC,SAAS,GAAG,OAAO,CAAC,KAC9C,OAAO,EAgDT,CAAC"}
 
 
node_modules/@gradio/client/dist/helpers/data.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { type ApiData, type BlobRef, type Config, type EndpointInfo, type JsApiData, type DataType, Command, type Dependency, type ComponentMeta } from "../types";
2
- import { FileData } from "../upload";
3
- export declare function update_object(object: {
4
- [x: string]: any;
5
- }, newValue: any, stack: (string | number)[]): void;
6
- export declare function walk_and_store_blobs(data: DataType, type?: string | undefined, path?: string[], root?: boolean, endpoint_info?: EndpointInfo<ApiData | JsApiData> | undefined): Promise<BlobRef[]>;
7
- export declare function skip_queue(id: number, config: Config): boolean;
8
- export declare function post_message<Res = any>(message: any, origin: string): Promise<Res>;
9
- export declare function handle_file(file_or_url: File | string | Blob | Buffer): FileData | Blob | Command;
10
- /**
11
- * Handles the payload by filtering out state inputs and returning an array of resolved payload values.
12
- * We send null values for state inputs to the server, but we don't want to include them in the resolved payload.
13
- *
14
- * @param resolved_payload - The resolved payload values received from the client or the server
15
- * @param dependency - The dependency object.
16
- * @param components - The array of component metadata.
17
- * @param with_null_state - Optional. Specifies whether to include null values for state inputs. Default is false.
18
- * @returns An array of resolved payload values, filtered based on the dependency and component metadata.
19
- */
20
- export declare function handle_payload(resolved_payload: unknown[], dependency: Dependency, components: ComponentMeta[], type: "input" | "output", with_null_state?: boolean): unknown[];
21
- //# sourceMappingURL=data.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/helpers/data.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/helpers/data.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,SAA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**
4
- * This function is used to resolve the URL for making requests when the app has a root path.
5
- * The root path could be a path suffix like "/app" which is appended to the end of the base URL. Or
6
- * it could be a full URL like "https://abidlabs-test-client-replica--gqf2x.hf.space" which is used when hosting
7
- * Gradio apps on Hugging Face Spaces.
8
- * @param {string} base_url The base URL at which the Gradio server is hosted
9
- * @param {string} root_path The root path, which could be a path suffix (e.g. mounted in FastAPI app) or a full URL (e.g. hosted on Hugging Face Spaces)
10
- * @param {boolean} prioritize_base Whether to prioritize the base URL over the root path. This is used when both the base path and root paths are full URLs. For example, for fetching files the root path should be prioritized, but for making requests, the base URL should be prioritized.
11
- * @returns {string} the resolved URL
12
- */
13
- export declare function resolve_root(base_url: string, root_path: string, prioritize_base: boolean): string;
14
- export declare function get_jwt(space: string, token: `hf_${string}`, cookies?: string | null): Promise<string | false>;
15
- export declare function map_names_to_ids(fns: Config["dependencies"]): Record<string, number>;
16
- export declare function resolve_config(this: Client, endpoint: string): Promise<Config | undefined>;
17
- export declare function resolve_cookies(this: Client): Promise<void>;
18
- export declare function get_cookie_header(http_protocol: string, host: string, auth: [string, string], _fetch: typeof fetch, token?: `hf_${string}`): Promise<string | null>;
19
- export declare function determine_protocol(endpoint: string): {
20
- ws_protocol: "ws" | "wss";
21
- http_protocol: "http:" | "https:";
22
- host: string;
23
- };
24
- export declare const parse_and_set_cookies: (cookie_header: string) => string[];
25
- //# sourceMappingURL=init_helpers.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/helpers/init_helpers.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"init_helpers.d.ts","sourceRoot":"","sources":["../../src/helpers/init_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAUvC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAG5B;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,OAAO,GACtB,MAAM,CAKR;AAED,wBAAsB,OAAO,CAC5B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,MAAM,EAAE,EACrB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAezB;AAED,wBAAgB,gBAAgB,CAC/B,GAAG,EAAE,MAAM,CAAC,cAAc,CAAC,GACzB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB;AAED,wBAAsB,cAAc,CACnC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA4D7B;AA6BD,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBjE;AAGD,wBAAsB,iBAAiB,CACtC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EACtB,MAAM,EAAE,OAAO,KAAK,EACpB,KAAK,CAAC,EAAE,MAAM,MAAM,EAAE,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAyBxB;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG;IACrD,WAAW,EAAE,IAAI,GAAG,KAAK,CAAC;IAC1B,aAAa,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;CACb,CAkBA;AAED,eAAO,MAAM,qBAAqB,GAAI,eAAe,MAAM,KAAG,MAAM,EAUnE,CAAC"}
 
 
node_modules/@gradio/client/dist/helpers/spaces.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { SpaceStatusCallback } from "../types";
2
- export declare function check_space_status(id: string, type: "subdomain" | "space_name", status_callback: SpaceStatusCallback): Promise<void>;
3
- export declare const check_and_wake_space: (space_id: string, status_callback: SpaceStatusCallback) => Promise<void>;
4
- export declare function discussions_enabled(space_id: string): Promise<boolean>;
5
- export declare function get_space_hardware(space_id: string, token?: `hf_${string}` | undefined): Promise<(typeof hardware_types)[number]>;
6
- export declare function set_space_timeout(space_id: string, timeout: number, token?: `hf_${string}`): Promise<any>;
7
- export declare const hardware_types: readonly ["cpu-basic", "cpu-upgrade", "cpu-xl", "t4-small", "t4-medium", "a10g-small", "a10g-large", "a10g-largex2", "a10g-largex4", "a100-large", "zero-a10g", "h100", "h100x8"];
8
- //# sourceMappingURL=spaces.d.ts.map
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/helpers/spaces.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"spaces.d.ts","sourceRoot":"","sources":["../../src/helpers/spaces.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,wBAAsB,kBAAkB,CACvC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,WAAW,GAAG,YAAY,EAChC,eAAe,EAAE,mBAAmB,GAClC,OAAO,CAAC,IAAI,CAAC,CAiGf;AAED,eAAO,MAAM,oBAAoB,GAChC,UAAU,MAAM,EAChB,iBAAiB,mBAAmB,KAClC,OAAO,CAAC,IAAI,CAoCd,CAAC;AAIF,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAgB5E;AAED,wBAAsB,kBAAkB,CACvC,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,MAAM,EAAE,GAAG,SAAS,GAChC,OAAO,CAAC,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAqB1C;AAED,wBAAsB,iBAAiB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,MAAM,EAAE,GACpB,OAAO,CAAC,GAAG,CAAC,CAiCd;AAED,eAAO,MAAM,cAAc,mLAcjB,CAAC"}
 
 
node_modules/@gradio/client/dist/helpers/zerogpu.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare function get_zerogpu_origin(hostname: string): string | null;
2
- export declare function initialize_zerogpu_handshake(): void;
3
- //# sourceMappingURL=zerogpu.d.ts.map
 
 
 
 
node_modules/@gradio/client/dist/helpers/zerogpu.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"zerogpu.d.ts","sourceRoot":"","sources":["../../src/helpers/zerogpu.ts"],"names":[],"mappings":"AAYA,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQlE;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAiBnD"}
 
 
node_modules/@gradio/client/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export { Client } from "./client";
2
- export { predict } from "./utils/predict";
3
- export { submit } from "./utils/submit";
4
- export { upload_files } from "./utils/upload_files";
5
- export { FileData, upload, prepare_files } from "./upload";
6
- export { handle_file } from "./helpers/data";
7
- export type { SpaceStatus, StatusMessage, Status, client_return, UploadResponse, RenderMessage, LogMessage, Payload, Config, ValidationError } from "./types";
8
- export { MISSING_CREDENTIALS_MSG } from "./constants";
9
- export { client } from "./client";
10
- export { duplicate_space as duplicate } from "./client";
11
- //# sourceMappingURL=index.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,YAAY,EACX,WAAW,EACX,aAAa,EACb,MAAM,EACN,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,EACV,OAAO,EACP,MAAM,EACN,eAAe,EACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC"}
 
 
node_modules/@gradio/client/dist/index.js DELETED
@@ -1,2554 +0,0 @@
1
- const HOST_URL = `host`;
2
- const SSE_URL = `queue/data`;
3
- const SSE_DATA_URL = `queue/join`;
4
- const UPLOAD_URL = `upload`;
5
- const LOGIN_URL = `login`;
6
- const CONFIG_URL = `config`;
7
- const API_INFO_URL = `info`;
8
- const RUNTIME_URL = `runtime`;
9
- const SLEEPTIME_URL = `sleeptime`;
10
- const HEARTBEAT_URL = `heartbeat`;
11
- const COMPONENT_SERVER_URL = `component_server`;
12
- const RESET_URL = `reset`;
13
- const CANCEL_URL = `cancel`;
14
- const APP_ID_URL = `app_id`;
15
- const QUEUE_FULL_MSG = "This application is currently busy. Please try again. ";
16
- const BROKEN_CONNECTION_MSG = "Connection errored out. ";
17
- const CONFIG_ERROR_MSG = "Could not resolve app config. ";
18
- const SPACE_STATUS_ERROR_MSG = "Could not get space status. ";
19
- const API_INFO_ERROR_MSG = "Could not get API info. ";
20
- const SPACE_METADATA_ERROR_MSG = "Space metadata could not be loaded. ";
21
- const INVALID_URL_MSG = "Invalid URL. A full URL path is required.";
22
- const UNAUTHORIZED_MSG = "Not authorized to access this space. ";
23
- const INVALID_CREDENTIALS_MSG = "Invalid credentials. Could not login. ";
24
- const MISSING_CREDENTIALS_MSG = "Login credentials are required to access this space.";
25
- const NODEJS_FS_ERROR_MSG = "File system access is only available in Node.js environments";
26
- const ROOT_URL_ERROR_MSG = "Root URL not found in client config";
27
- const FILE_PROCESSING_ERROR_MSG = "Error uploading file";
28
- async function get_jwt(space, token, cookies) {
29
- try {
30
- const r = await fetch(`https://huggingface.co/api/spaces/${space}/jwt`, {
31
- headers: {
32
- Authorization: `Bearer ${token}`,
33
- ...cookies ? { Cookie: cookies } : {}
34
- }
35
- });
36
- const jwt = (await r.json()).token;
37
- return jwt || false;
38
- } catch (e) {
39
- return false;
40
- }
41
- }
42
- function map_names_to_ids(fns) {
43
- let apis = {};
44
- fns.forEach(({ api_name, id }) => {
45
- if (api_name) apis[api_name] = id;
46
- });
47
- return apis;
48
- }
49
- async function resolve_config(endpoint) {
50
- const headers = this.options.token ? { Authorization: `Bearer ${this.options.token}` } : {};
51
- headers["Content-Type"] = "application/json";
52
- if (typeof window !== "undefined" && window.gradio_config && location.origin !== "http://localhost:9876") {
53
- if (window.gradio_config.current_page) {
54
- endpoint = endpoint.substring(0, endpoint.lastIndexOf("/"));
55
- }
56
- if (window.gradio_config.dev_mode || typeof window !== "undefined" && window?.BUILD_MODE === "dev") {
57
- let config_url = join_urls(
58
- endpoint,
59
- this.deep_link ? CONFIG_URL + "?deep_link=" + this.deep_link : CONFIG_URL
60
- );
61
- const response = await this.fetch(config_url, {
62
- headers,
63
- credentials: "include"
64
- });
65
- const config = await handleConfigResponse(response, !!this.options.auth);
66
- config.root = endpoint || config.root;
67
- window.gradio_config = {
68
- ...config,
69
- current_page: window.gradio_config.current_page
70
- };
71
- }
72
- return { ...window.gradio_config };
73
- } else if (endpoint) {
74
- let config_url = join_urls(
75
- endpoint,
76
- this.deep_link ? CONFIG_URL + "?deep_link=" + this.deep_link : CONFIG_URL
77
- );
78
- const response = await this.fetch(config_url, {
79
- headers,
80
- credentials: "include"
81
- });
82
- const config = await handleConfigResponse(response, !!this.options.auth);
83
- if (!config.root) {
84
- config.root = endpoint;
85
- }
86
- return config;
87
- }
88
- throw new Error(CONFIG_ERROR_MSG);
89
- }
90
- async function handleConfigResponse(response, authorized) {
91
- if (response?.status === 401 && !authorized) {
92
- const error_data = await response.json();
93
- const auth_message = error_data?.detail?.auth_message;
94
- throw new Error(auth_message || MISSING_CREDENTIALS_MSG);
95
- } else if (response?.status === 401 && authorized) {
96
- throw new Error(INVALID_CREDENTIALS_MSG);
97
- }
98
- if (response?.status === 200) {
99
- let config = await response.json();
100
- config.dependencies?.forEach((dep, i) => {
101
- if (dep.id === void 0) {
102
- dep.id = i;
103
- }
104
- });
105
- return config;
106
- } else if (response?.status === 401) {
107
- throw new Error(UNAUTHORIZED_MSG);
108
- }
109
- throw new Error(CONFIG_ERROR_MSG);
110
- }
111
- async function resolve_cookies() {
112
- const { http_protocol, host } = await process_endpoint(
113
- this.app_reference,
114
- this.options.token
115
- );
116
- try {
117
- if (this.options.auth) {
118
- const cookie_header = await get_cookie_header(
119
- http_protocol,
120
- host,
121
- this.options.auth,
122
- this.fetch,
123
- this.options.token
124
- );
125
- if (cookie_header) this.set_cookies(cookie_header);
126
- }
127
- } catch (e) {
128
- throw Error(e.message);
129
- }
130
- }
131
- async function get_cookie_header(http_protocol, host, auth, _fetch, token) {
132
- const formData = new FormData();
133
- formData.append("username", auth?.[0]);
134
- formData.append("password", auth?.[1]);
135
- let headers = {};
136
- if (token) {
137
- headers.Authorization = `Bearer ${token}`;
138
- }
139
- const res = await _fetch(`${http_protocol}//${host}/${LOGIN_URL}`, {
140
- headers,
141
- method: "POST",
142
- body: formData,
143
- credentials: "include"
144
- });
145
- if (res.status === 200) {
146
- return res.headers.get("set-cookie");
147
- } else if (res.status === 401) {
148
- throw new Error(INVALID_CREDENTIALS_MSG);
149
- } else {
150
- throw new Error(SPACE_METADATA_ERROR_MSG);
151
- }
152
- }
153
- function determine_protocol(endpoint) {
154
- if (endpoint.startsWith("http")) {
155
- const { protocol, host, pathname } = new URL(endpoint);
156
- return {
157
- ws_protocol: protocol === "https:" ? "wss" : "ws",
158
- http_protocol: protocol,
159
- host: host + (pathname !== "/" ? pathname : "")
160
- };
161
- }
162
- return {
163
- ws_protocol: "wss",
164
- http_protocol: "https:",
165
- host: new URL(endpoint).host
166
- };
167
- }
168
- const parse_and_set_cookies = (cookie_header) => {
169
- let cookies = [];
170
- const parts = cookie_header.split(/,(?=\s*[^\s=;]+=[^\s=;]+)/);
171
- parts.forEach((cookie) => {
172
- const [cookie_name, cookie_value] = cookie.split(";")[0].split("=");
173
- if (cookie_name && cookie_value) {
174
- cookies.push(`${cookie_name.trim()}=${cookie_value.trim()}`);
175
- }
176
- });
177
- return cookies;
178
- };
179
- const RE_SPACE_NAME = /^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+$/;
180
- const RE_SPACE_DOMAIN = /.*hf\.space\/{0,1}.*$/;
181
- async function process_endpoint(app_reference, token) {
182
- const headers = {};
183
- if (token) {
184
- headers.Authorization = `Bearer ${token}`;
185
- }
186
- const _app_reference = app_reference.trim().replace(/\/$/, "");
187
- if (RE_SPACE_NAME.test(_app_reference)) {
188
- try {
189
- const res = await fetch(
190
- `https://huggingface.co/api/spaces/${_app_reference}/${HOST_URL}`,
191
- { headers }
192
- );
193
- const _host = (await res.json()).host;
194
- return {
195
- space_id: app_reference,
196
- ...determine_protocol(_host)
197
- };
198
- } catch (e) {
199
- throw new Error(SPACE_METADATA_ERROR_MSG);
200
- }
201
- }
202
- if (RE_SPACE_DOMAIN.test(_app_reference)) {
203
- const { ws_protocol, http_protocol, host } = determine_protocol(_app_reference);
204
- return {
205
- space_id: host.split("/")[0].replace(".hf.space", ""),
206
- ws_protocol,
207
- http_protocol,
208
- host
209
- };
210
- }
211
- return {
212
- space_id: false,
213
- ...determine_protocol(_app_reference)
214
- };
215
- }
216
- const join_urls = (...urls) => {
217
- try {
218
- return urls.reduce((base_url, part) => {
219
- base_url = base_url.replace(/\/+$/, "");
220
- part = part.replace(/^\/+/, "");
221
- return new URL(part, base_url + "/").toString();
222
- });
223
- } catch (e) {
224
- throw new Error(INVALID_URL_MSG);
225
- }
226
- };
227
- function transform_api_info(api_info, config, api_map) {
228
- const transformed_info = {
229
- named_endpoints: {},
230
- unnamed_endpoints: {}
231
- };
232
- Object.keys(api_info).forEach((category) => {
233
- if (category === "named_endpoints" || category === "unnamed_endpoints") {
234
- transformed_info[category] = {};
235
- Object.entries(api_info[category]).forEach(
236
- ([endpoint, { parameters, returns }]) => {
237
- const dependencyIndex = config.dependencies.find(
238
- (dep) => dep.api_name === endpoint || dep.api_name === endpoint.replace("/", "")
239
- )?.id || api_map[endpoint.replace("/", "")] || -1;
240
- const dependencyTypes = dependencyIndex !== -1 ? config.dependencies.find((dep) => dep.id == dependencyIndex)?.types : { generator: false, cancel: false };
241
- if (dependencyIndex !== -1 && config.dependencies.find((dep) => dep.id == dependencyIndex)?.inputs?.length !== parameters.length) {
242
- const components = config.dependencies.find((dep) => dep.id == dependencyIndex).inputs.map(
243
- (input) => config.components.find((c) => c.id === input)?.type
244
- );
245
- try {
246
- components.forEach((comp, idx) => {
247
- if (comp === "state") {
248
- const new_param = {
249
- component: "state",
250
- example: null,
251
- parameter_default: null,
252
- parameter_has_default: true,
253
- parameter_name: null,
254
- hidden: true
255
- };
256
- parameters.splice(idx, 0, new_param);
257
- }
258
- });
259
- } catch (e) {
260
- console.error(e);
261
- }
262
- }
263
- const transform_type = (data, component, serializer, signature_type) => ({
264
- ...data,
265
- description: get_description(data?.type, serializer),
266
- type: get_type(data?.type, component, serializer, signature_type) || ""
267
- });
268
- transformed_info[category][endpoint] = {
269
- parameters: parameters.map(
270
- (p) => transform_type(p, p?.component, p?.serializer, "parameter")
271
- ),
272
- returns: returns.map(
273
- (r) => transform_type(r, r?.component, r?.serializer, "return")
274
- ),
275
- type: dependencyTypes
276
- };
277
- }
278
- );
279
- }
280
- });
281
- return transformed_info;
282
- }
283
- function get_type(type, component, serializer, signature_type) {
284
- if (component === "Api") return type.type;
285
- switch (type?.type) {
286
- case "string":
287
- return "string";
288
- case "boolean":
289
- return "boolean";
290
- case "number":
291
- return "number";
292
- }
293
- if (serializer === "JSONSerializable" || serializer === "StringSerializable") {
294
- return "any";
295
- } else if (serializer === "ListStringSerializable") {
296
- return "string[]";
297
- } else if (component === "Image") {
298
- return signature_type === "parameter" ? "Blob | File | Buffer" : "string";
299
- } else if (serializer === "FileSerializable") {
300
- if (type?.type === "array") {
301
- return signature_type === "parameter" ? "(Blob | File | Buffer)[]" : `{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]`;
302
- }
303
- return signature_type === "parameter" ? "Blob | File | Buffer" : `{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}`;
304
- } else if (serializer === "GallerySerializable") {
305
- return signature_type === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : `[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]`;
306
- }
307
- }
308
- function get_description(type, serializer) {
309
- if (serializer === "GallerySerializable") {
310
- return "array of [file, label] tuples";
311
- } else if (serializer === "ListStringSerializable") {
312
- return "array of strings";
313
- } else if (serializer === "FileSerializable") {
314
- return "array of files or single file";
315
- }
316
- return type?.description;
317
- }
318
- function handle_message(data, last_status) {
319
- const queue = true;
320
- switch (data.msg) {
321
- case "send_data":
322
- return { type: "data" };
323
- case "send_hash":
324
- return { type: "hash" };
325
- case "queue_full":
326
- return {
327
- type: "update",
328
- status: {
329
- queue,
330
- message: QUEUE_FULL_MSG,
331
- stage: "error",
332
- code: data.code,
333
- success: data.success
334
- }
335
- };
336
- case "heartbeat":
337
- return {
338
- type: "heartbeat"
339
- };
340
- case "unexpected_error":
341
- return {
342
- type: "unexpected_error",
343
- status: {
344
- queue,
345
- message: data.message,
346
- session_not_found: data.session_not_found,
347
- stage: "error",
348
- success: false
349
- }
350
- };
351
- case "broken_connection":
352
- return {
353
- type: "broken_connection",
354
- status: {
355
- queue,
356
- message: data.message,
357
- stage: "error",
358
- success: false
359
- }
360
- };
361
- case "estimation":
362
- return {
363
- type: "update",
364
- status: {
365
- queue,
366
- stage: last_status || "pending",
367
- code: data.code,
368
- size: data.queue_size,
369
- position: data.rank,
370
- eta: data.rank_eta,
371
- success: data.success
372
- }
373
- };
374
- case "progress":
375
- return {
376
- type: "update",
377
- status: {
378
- queue,
379
- stage: "pending",
380
- code: data.code,
381
- progress_data: data.progress_data,
382
- success: data.success
383
- }
384
- };
385
- case "log":
386
- return { type: "log", data };
387
- case "process_generating":
388
- return {
389
- type: "generating",
390
- status: {
391
- queue,
392
- message: !data.success ? data.output.error : null,
393
- stage: data.success ? "generating" : "error",
394
- code: data.code,
395
- progress_data: data.progress_data,
396
- eta: data.average_duration,
397
- changed_state_ids: data.success ? data.output.changed_state_ids : void 0
398
- },
399
- data: data.success ? data.output : null
400
- };
401
- case "process_streaming":
402
- return {
403
- type: "streaming",
404
- status: {
405
- queue,
406
- message: data.output.error,
407
- stage: "streaming",
408
- time_limit: data.time_limit,
409
- code: data.code,
410
- progress_data: data.progress_data,
411
- eta: data.eta
412
- },
413
- data: data.output
414
- };
415
- case "process_completed":
416
- if ("error" in data.output) {
417
- return {
418
- type: "update",
419
- status: {
420
- queue,
421
- title: data.output.title ?? "Error",
422
- message: data.output.error ?? "An error occurred",
423
- visible: data.output.visible,
424
- duration: data.output.duration,
425
- stage: "error",
426
- code: data.code,
427
- success: data.success
428
- }
429
- };
430
- }
431
- return {
432
- type: "complete",
433
- status: {
434
- queue,
435
- message: !data.success ? data.output.error : void 0,
436
- stage: data.success ? "complete" : "error",
437
- code: data.code,
438
- progress_data: data.progress_data,
439
- changed_state_ids: data.success ? data.output.changed_state_ids : void 0,
440
- used_cache: data.used_cache,
441
- cache_duration: data.cache_duration,
442
- avg_time: data.avg_time
443
- },
444
- data: data.success ? data.output : null
445
- };
446
- case "process_starts":
447
- return {
448
- type: "update",
449
- status: {
450
- queue,
451
- stage: "pending",
452
- code: data.code,
453
- size: data.rank,
454
- position: 0,
455
- success: data.success,
456
- eta: data.eta
457
- },
458
- original_msg: "process_starts"
459
- };
460
- }
461
- return { type: "none", status: { stage: "error", queue } };
462
- }
463
- const map_data_to_params = (data = [], endpoint_info) => {
464
- const parameters = endpoint_info ? endpoint_info.parameters : [];
465
- if (Array.isArray(data)) {
466
- if (endpoint_info && parameters.length > 0 && data.length > parameters.length) {
467
- console.warn("Too many arguments provided for the endpoint.");
468
- }
469
- return data;
470
- }
471
- const resolved_data = [];
472
- const provided_keys = Object.keys(data);
473
- parameters.forEach((param, index) => {
474
- if (data.hasOwnProperty(param.parameter_name)) {
475
- resolved_data[index] = data[param.parameter_name];
476
- } else if (param.parameter_has_default) {
477
- resolved_data[index] = param.parameter_default;
478
- } else {
479
- throw new Error(
480
- `No value provided for required parameter: ${param.parameter_name}`
481
- );
482
- }
483
- });
484
- provided_keys.forEach((key) => {
485
- if (!parameters.some((param) => param.parameter_name === key)) {
486
- throw new Error(
487
- `Parameter \`${key}\` is not a valid keyword argument. Please refer to the API for usage.`
488
- );
489
- }
490
- });
491
- resolved_data.forEach((value, idx) => {
492
- if (value === void 0 && !parameters[idx].parameter_has_default) {
493
- throw new Error(
494
- `No value provided for required parameter: ${parameters[idx].parameter_name}`
495
- );
496
- }
497
- });
498
- return resolved_data;
499
- };
500
- async function view_api() {
501
- if (this.api_info) return this.api_info;
502
- const { token } = this.options;
503
- const { config } = this;
504
- const headers = { "Content-Type": "application/json" };
505
- if (token) {
506
- headers.Authorization = `Bearer ${token}`;
507
- }
508
- if (!config) {
509
- return;
510
- }
511
- try {
512
- let response;
513
- let api_info;
514
- if (typeof window !== "undefined" && window.gradio_api_info) {
515
- api_info = window.gradio_api_info;
516
- } else {
517
- const url = join_urls(config.root, this.api_prefix, API_INFO_URL);
518
- response = await this.fetch(url, {
519
- headers,
520
- credentials: "include"
521
- });
522
- if (!response.ok) {
523
- throw new Error(BROKEN_CONNECTION_MSG);
524
- }
525
- api_info = await response.json();
526
- }
527
- if ("api" in api_info) {
528
- api_info = api_info.api;
529
- }
530
- if (api_info.named_endpoints["/predict"] && !api_info.unnamed_endpoints["0"]) {
531
- api_info.unnamed_endpoints[0] = api_info.named_endpoints["/predict"];
532
- }
533
- return transform_api_info(api_info, config, this.api_map);
534
- } catch (e) {
535
- throw new Error("Could not get API info. " + e.message);
536
- }
537
- }
538
- async function upload_files(root_url, files, upload_id) {
539
- const headers = {};
540
- if (this?.options?.token) {
541
- headers.Authorization = `Bearer ${this.options.token}`;
542
- }
543
- const chunkSize = 1e3;
544
- const uploadResponses = [];
545
- let response;
546
- for (let i = 0; i < files.length; i += chunkSize) {
547
- const chunk = files.slice(i, i + chunkSize);
548
- const formData = new FormData();
549
- chunk.forEach((file) => {
550
- formData.append("files", file);
551
- });
552
- try {
553
- const upload_url = upload_id ? `${root_url}${this.api_prefix}/${UPLOAD_URL}?upload_id=${upload_id}` : `${root_url}${this.api_prefix}/${UPLOAD_URL}`;
554
- response = await this.fetch(upload_url, {
555
- method: "POST",
556
- body: formData,
557
- headers,
558
- credentials: "include"
559
- });
560
- } catch (e) {
561
- throw new Error(BROKEN_CONNECTION_MSG + e.message);
562
- }
563
- if (!response.ok) {
564
- const error_text = await response.text();
565
- return { error: `HTTP ${response.status}: ${error_text}` };
566
- }
567
- const output = await response.json();
568
- if (output) {
569
- uploadResponses.push(...output);
570
- }
571
- }
572
- return { files: uploadResponses };
573
- }
574
- const si = {
575
- radix: 1e3,
576
- unit: ["b", "kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"]
577
- };
578
- const iec = {
579
- radix: 1024,
580
- unit: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"]
581
- };
582
- const jedec = {
583
- radix: 1024,
584
- unit: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"]
585
- };
586
- const SPECS = {
587
- si,
588
- iec,
589
- jedec
590
- };
591
- function filesize(bytes, fixed = 1, spec = "jedec") {
592
- bytes = Math.abs(bytes);
593
- const { radix, unit } = SPECS[spec] || SPECS.jedec;
594
- let loop = 0;
595
- while (bytes >= radix) {
596
- bytes /= radix;
597
- ++loop;
598
- }
599
- return `${bytes.toFixed(fixed)} ${unit[loop]}`;
600
- }
601
- async function upload(file_data, root_url, upload_id, max_file_size) {
602
- let files = (Array.isArray(file_data) ? file_data : [file_data]).map(
603
- (file_data2) => file_data2.blob
604
- );
605
- const oversized_files = files.filter(
606
- (f) => f.size > (max_file_size ?? Infinity)
607
- );
608
- if (oversized_files.length) {
609
- throw new Error(
610
- `File(s) exceed the maximum allowed size of ${filesize(max_file_size || Infinity)}: ${oversized_files.map((f) => `"${f.name}"`).join(", ")}`
611
- );
612
- }
613
- return await Promise.all(
614
- await this.upload_files(root_url, files, upload_id).then(
615
- async (response) => {
616
- if (response.error) {
617
- throw new Error(response.error);
618
- } else {
619
- if (response.files) {
620
- return response.files.map((f, i) => {
621
- const file = new FileData({
622
- ...file_data[i],
623
- path: f,
624
- url: `${root_url}${this.api_prefix}/file=${f}`
625
- });
626
- return file;
627
- });
628
- }
629
- return [];
630
- }
631
- }
632
- )
633
- );
634
- }
635
- async function prepare_files(files, is_stream) {
636
- return files.map(
637
- (f) => new FileData({
638
- path: f.name,
639
- orig_name: f.name,
640
- blob: f,
641
- size: f.size,
642
- mime_type: f.type,
643
- is_stream
644
- })
645
- );
646
- }
647
- class FileData {
648
- path;
649
- url;
650
- orig_name;
651
- size;
652
- blob;
653
- is_stream;
654
- mime_type;
655
- alt_text;
656
- b64;
657
- meta = { _type: "gradio.FileData" };
658
- constructor({
659
- path,
660
- url,
661
- orig_name,
662
- size,
663
- blob,
664
- is_stream,
665
- mime_type,
666
- alt_text,
667
- b64
668
- }) {
669
- this.path = path;
670
- this.url = url;
671
- this.orig_name = orig_name;
672
- this.size = size;
673
- this.blob = url ? void 0 : blob;
674
- this.is_stream = is_stream;
675
- this.mime_type = mime_type;
676
- this.alt_text = alt_text;
677
- this.b64 = b64;
678
- }
679
- }
680
- class Command {
681
- type;
682
- command;
683
- meta;
684
- fileData;
685
- constructor(command, meta) {
686
- this.type = "command";
687
- this.command = command;
688
- this.meta = meta;
689
- }
690
- }
691
- const is_node = typeof process !== "undefined" && process.versions && process.versions.node;
692
- function update_object(object, newValue, stack) {
693
- while (stack.length > 1) {
694
- const key2 = stack.shift();
695
- if (typeof key2 === "string" || typeof key2 === "number") {
696
- object = object[key2];
697
- } else {
698
- throw new Error("Invalid key type");
699
- }
700
- }
701
- const key = stack.shift();
702
- if (typeof key === "string" || typeof key === "number") {
703
- object[key] = newValue;
704
- } else {
705
- throw new Error("Invalid key type");
706
- }
707
- }
708
- async function walk_and_store_blobs(data, type = void 0, path = [], root = false, endpoint_info = void 0) {
709
- if (Array.isArray(data)) {
710
- let blob_refs = [];
711
- await Promise.all(
712
- data.map(async (_, index) => {
713
- let new_path = path.slice();
714
- new_path.push(String(index));
715
- const array_refs = await walk_and_store_blobs(
716
- data[index],
717
- root ? endpoint_info?.parameters[index]?.component || void 0 : type,
718
- new_path,
719
- false,
720
- endpoint_info
721
- );
722
- blob_refs = blob_refs.concat(array_refs);
723
- })
724
- );
725
- return blob_refs;
726
- } else if (globalThis.Buffer && data instanceof globalThis.Buffer || data instanceof Blob) {
727
- return [
728
- {
729
- path,
730
- blob: new Blob([data]),
731
- type
732
- }
733
- ];
734
- } else if (typeof data === "object" && data !== null) {
735
- let blob_refs = [];
736
- for (const key of Object.keys(data)) {
737
- const new_path = [...path, key];
738
- const value = data[key];
739
- blob_refs = blob_refs.concat(
740
- await walk_and_store_blobs(
741
- value,
742
- void 0,
743
- new_path,
744
- false,
745
- endpoint_info
746
- )
747
- );
748
- }
749
- return blob_refs;
750
- }
751
- return [];
752
- }
753
- function skip_queue(id, config) {
754
- let fn_queue = config?.dependencies?.find((dep) => dep.id == id)?.queue;
755
- if (fn_queue != null) {
756
- return !fn_queue;
757
- }
758
- return !config.enable_queue;
759
- }
760
- function post_message(message, origin) {
761
- return new Promise((res, _rej) => {
762
- const channel = new MessageChannel();
763
- channel.port1.onmessage = (({ data }) => {
764
- channel.port1.close();
765
- res(data);
766
- });
767
- window.parent.postMessage(message, origin, [channel.port2]);
768
- });
769
- }
770
- function handle_file(file_or_url) {
771
- if (typeof file_or_url === "string") {
772
- if (file_or_url.startsWith("http://") || file_or_url.startsWith("https://")) {
773
- return {
774
- path: file_or_url,
775
- url: file_or_url,
776
- orig_name: file_or_url.split("/").pop() ?? "unknown",
777
- meta: { _type: "gradio.FileData" }
778
- };
779
- }
780
- if (is_node) {
781
- return new Command("upload_file", {
782
- path: file_or_url,
783
- name: file_or_url,
784
- orig_path: file_or_url
785
- });
786
- }
787
- } else if (typeof File !== "undefined" && file_or_url instanceof File) {
788
- return new Blob([file_or_url]);
789
- } else if (file_or_url instanceof Buffer) {
790
- return new Blob([file_or_url]);
791
- } else if (file_or_url instanceof Blob) {
792
- return file_or_url;
793
- }
794
- throw new Error(
795
- "Invalid input: must be a URL, File, Blob, or Buffer object."
796
- );
797
- }
798
- function handle_payload(resolved_payload, dependency, components, type, with_null_state = false) {
799
- if (type === "input" && !with_null_state) {
800
- throw new Error("Invalid code path. Cannot skip state inputs for input.");
801
- }
802
- if (type === "output" && with_null_state) {
803
- return resolved_payload;
804
- }
805
- let updated_payload = [];
806
- let payload_index = 0;
807
- const deps = type === "input" ? dependency.inputs : dependency.outputs;
808
- for (let i = 0; i < deps.length; i++) {
809
- const input_id = deps[i];
810
- const component = components.find((c) => c.id === input_id);
811
- if (component?.type === "state") {
812
- if (with_null_state) {
813
- if (resolved_payload.length === deps.length) {
814
- const value = resolved_payload[payload_index];
815
- updated_payload.push(value);
816
- payload_index++;
817
- } else {
818
- updated_payload.push(null);
819
- }
820
- } else {
821
- payload_index++;
822
- continue;
823
- }
824
- continue;
825
- } else {
826
- const value = resolved_payload[payload_index];
827
- updated_payload.push(value);
828
- payload_index++;
829
- }
830
- }
831
- return updated_payload;
832
- }
833
- async function handle_blob(endpoint, data, api_info) {
834
- const self = this;
835
- await process_local_file_commands(self, data);
836
- const blobRefs = await walk_and_store_blobs(
837
- data,
838
- void 0,
839
- [],
840
- true,
841
- api_info
842
- );
843
- const results = await Promise.all(
844
- blobRefs.map(async ({ path, blob, type }) => {
845
- if (!blob) return { path, type };
846
- const response = await self.upload_files(endpoint, [blob]);
847
- const file_url = response.files && response.files[0];
848
- return {
849
- path,
850
- file_url,
851
- type,
852
- name: typeof File !== "undefined" && blob instanceof File ? blob?.name : void 0
853
- };
854
- })
855
- );
856
- results.forEach(({ path, file_url, type, name }) => {
857
- if (type === "Gallery") {
858
- update_object(data, file_url, path);
859
- } else if (file_url) {
860
- const file = new FileData({ path: file_url, orig_name: name });
861
- update_object(data, file, path);
862
- }
863
- });
864
- return data;
865
- }
866
- async function process_local_file_commands(client2, data) {
867
- const root = client2.config?.root || client2.config?.root_url;
868
- if (!root) {
869
- throw new Error(ROOT_URL_ERROR_MSG);
870
- }
871
- await recursively_process_commands(client2, data);
872
- }
873
- async function recursively_process_commands(client2, data, path = []) {
874
- for (const key in data) {
875
- if (data[key] instanceof Command) {
876
- await process_single_command(client2, data, key);
877
- } else if (typeof data[key] === "object" && data[key] !== null) {
878
- await recursively_process_commands(client2, data[key], [...path, key]);
879
- }
880
- }
881
- }
882
- async function process_single_command(client2, data, key) {
883
- let cmd_item = data[key];
884
- const root = client2.config?.root || client2.config?.root_url;
885
- if (!root) {
886
- throw new Error(ROOT_URL_ERROR_MSG);
887
- }
888
- try {
889
- let fileBuffer;
890
- let fullPath;
891
- if (typeof process !== "undefined" && process.versions && process.versions.node) {
892
- const fs = await import("fs/promises");
893
- const path = await import("path");
894
- fullPath = path.resolve(process.cwd(), cmd_item.meta.path);
895
- fileBuffer = await fs.readFile(fullPath);
896
- } else {
897
- throw new Error(NODEJS_FS_ERROR_MSG);
898
- }
899
- const file = new Blob([fileBuffer], {
900
- type: "application/octet-stream"
901
- });
902
- const response = await client2.upload_files(root, [file]);
903
- const file_url = response.files && response.files[0];
904
- if (file_url) {
905
- const fileData = new FileData({
906
- path: file_url,
907
- orig_name: cmd_item.meta.name || ""
908
- });
909
- data[key] = fileData;
910
- }
911
- } catch (error) {
912
- console.error(FILE_PROCESSING_ERROR_MSG, error);
913
- }
914
- }
915
- async function post_data(url, body, additional_headers) {
916
- const headers = { "Content-Type": "application/json" };
917
- if (this.options.token) {
918
- headers.Authorization = `Bearer ${this.options.token}`;
919
- }
920
- try {
921
- var response = await this.fetch(url, {
922
- method: "POST",
923
- body: JSON.stringify(body),
924
- headers: { ...headers, ...additional_headers },
925
- credentials: "include"
926
- });
927
- } catch (e) {
928
- return [{ error: BROKEN_CONNECTION_MSG }, 500];
929
- }
930
- let output;
931
- let status;
932
- try {
933
- output = await response.json();
934
- status = response.status;
935
- } catch (e) {
936
- output = { error: `Could not parse server response: ${e}` };
937
- status = 500;
938
- }
939
- return [output, status];
940
- }
941
- async function predict(endpoint, data = {}) {
942
- let data_returned = false;
943
- let status_complete = false;
944
- if (!this.config) {
945
- throw new Error("Could not resolve app config");
946
- }
947
- if (typeof endpoint === "number") {
948
- this.config.dependencies.find((dep) => dep.id == endpoint);
949
- } else {
950
- const trimmed_endpoint = endpoint.replace(/^\//, "");
951
- this.config.dependencies.find(
952
- (dep) => dep.id == this.api_map[trimmed_endpoint]
953
- );
954
- }
955
- return new Promise(async (resolve, reject) => {
956
- const app = this.submit(endpoint, data, null, null, true);
957
- let result;
958
- for await (const message of app) {
959
- if (message.type === "data") {
960
- if (status_complete) {
961
- resolve(result);
962
- }
963
- data_returned = true;
964
- result = message;
965
- }
966
- if (message.type === "status") {
967
- if (message.stage === "error") reject(message);
968
- if (message.stage === "complete") {
969
- status_complete = true;
970
- if (data_returned) {
971
- resolve(result);
972
- }
973
- }
974
- }
975
- }
976
- });
977
- }
978
- async function check_space_status(id, type, status_callback) {
979
- let endpoint = type === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${id}` : `https://huggingface.co/api/spaces/${id}`;
980
- let response;
981
- let _status;
982
- try {
983
- response = await fetch(endpoint);
984
- _status = response.status;
985
- if (_status !== 200) {
986
- throw new Error();
987
- }
988
- response = await response.json();
989
- } catch (e) {
990
- status_callback({
991
- status: "error",
992
- load_status: "error",
993
- message: SPACE_STATUS_ERROR_MSG,
994
- detail: "NOT_FOUND"
995
- });
996
- return;
997
- }
998
- if (!response || _status !== 200) return;
999
- const {
1000
- runtime: { stage },
1001
- id: space_name
1002
- } = response;
1003
- switch (stage) {
1004
- case "STOPPED":
1005
- case "SLEEPING":
1006
- status_callback({
1007
- status: "sleeping",
1008
- load_status: "pending",
1009
- message: "Space is asleep. Waking it up...",
1010
- detail: stage
1011
- });
1012
- setTimeout(() => {
1013
- check_space_status(id, type, status_callback);
1014
- }, 1e3);
1015
- break;
1016
- case "PAUSED":
1017
- status_callback({
1018
- status: "paused",
1019
- load_status: "error",
1020
- message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
1021
- detail: stage,
1022
- discussions_enabled: await discussions_enabled(space_name)
1023
- });
1024
- break;
1025
- case "RUNNING":
1026
- case "RUNNING_BUILDING":
1027
- status_callback({
1028
- status: "running",
1029
- load_status: "complete",
1030
- message: "Space is running.",
1031
- detail: stage
1032
- });
1033
- break;
1034
- case "BUILDING":
1035
- status_callback({
1036
- status: "building",
1037
- load_status: "pending",
1038
- message: "Space is building...",
1039
- detail: stage
1040
- });
1041
- setTimeout(() => {
1042
- check_space_status(id, type, status_callback);
1043
- }, 1e3);
1044
- break;
1045
- case "APP_STARTING":
1046
- status_callback({
1047
- status: "starting",
1048
- load_status: "pending",
1049
- message: "Space is starting...",
1050
- detail: stage
1051
- });
1052
- setTimeout(() => {
1053
- check_space_status(id, type, status_callback);
1054
- }, 1e3);
1055
- break;
1056
- default:
1057
- status_callback({
1058
- status: "space_error",
1059
- load_status: "error",
1060
- message: "This space is experiencing an issue.",
1061
- detail: stage,
1062
- discussions_enabled: await discussions_enabled(space_name)
1063
- });
1064
- break;
1065
- }
1066
- }
1067
- const check_and_wake_space = async (space_id, status_callback) => {
1068
- let retries = 0;
1069
- const max_retries = 12;
1070
- const check_interval = 5e3;
1071
- return new Promise((resolve) => {
1072
- check_space_status(
1073
- space_id,
1074
- RE_SPACE_NAME.test(space_id) ? "space_name" : "subdomain",
1075
- (status) => {
1076
- status_callback(status);
1077
- if (status.status === "running") {
1078
- resolve();
1079
- } else if (status.status === "error" || status.status === "paused" || status.status === "space_error") {
1080
- resolve();
1081
- } else if (status.status === "sleeping" || status.status === "building") {
1082
- if (retries < max_retries) {
1083
- retries++;
1084
- setTimeout(() => {
1085
- check_and_wake_space(space_id, status_callback).then(resolve);
1086
- }, check_interval);
1087
- } else {
1088
- resolve();
1089
- }
1090
- }
1091
- }
1092
- );
1093
- });
1094
- };
1095
- const RE_DISABLED_DISCUSSION = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
1096
- async function discussions_enabled(space_id) {
1097
- try {
1098
- const r = await fetch(
1099
- `https://huggingface.co/api/spaces/${space_id}/discussions`,
1100
- {
1101
- method: "HEAD"
1102
- }
1103
- );
1104
- const error = r.headers.get("x-error-message");
1105
- if (!r.ok || error && RE_DISABLED_DISCUSSION.test(error)) return false;
1106
- return true;
1107
- } catch (e) {
1108
- return false;
1109
- }
1110
- }
1111
- async function get_space_hardware(space_id, token) {
1112
- const headers = {};
1113
- if (token) {
1114
- headers.Authorization = `Bearer ${token}`;
1115
- }
1116
- try {
1117
- const res = await fetch(
1118
- `https://huggingface.co/api/spaces/${space_id}/${RUNTIME_URL}`,
1119
- { headers }
1120
- );
1121
- if (res.status !== 200)
1122
- throw new Error("Space hardware could not be obtained.");
1123
- const { hardware } = await res.json();
1124
- return hardware.current;
1125
- } catch (e) {
1126
- throw new Error(e.message);
1127
- }
1128
- }
1129
- async function set_space_timeout(space_id, timeout, token) {
1130
- const headers = {};
1131
- if (token) {
1132
- headers.Authorization = `Bearer ${token}`;
1133
- }
1134
- const body = {
1135
- seconds: timeout
1136
- };
1137
- try {
1138
- const res = await fetch(
1139
- `https://huggingface.co/api/spaces/${space_id}/${SLEEPTIME_URL}`,
1140
- {
1141
- method: "POST",
1142
- headers: { "Content-Type": "application/json", ...headers },
1143
- body: JSON.stringify(body)
1144
- }
1145
- );
1146
- if (res.status !== 200) {
1147
- throw new Error(
1148
- "Could not set sleep timeout on duplicated Space. Please visit *ADD HF LINK TO SETTINGS* to set a timeout manually to reduce billing charges."
1149
- );
1150
- }
1151
- const response = await res.json();
1152
- return response;
1153
- } catch (e) {
1154
- throw new Error(e.message);
1155
- }
1156
- }
1157
- const hardware_types = [
1158
- "cpu-basic",
1159
- "cpu-upgrade",
1160
- "cpu-xl",
1161
- "t4-small",
1162
- "t4-medium",
1163
- "a10g-small",
1164
- "a10g-large",
1165
- "a10g-largex2",
1166
- "a10g-largex4",
1167
- "a100-large",
1168
- "zero-a10g",
1169
- "h100",
1170
- "h100x8"
1171
- ];
1172
- async function duplicate(app_reference, options) {
1173
- const { token, private: _private, hardware, timeout, auth } = options;
1174
- if (hardware && !hardware_types.includes(hardware)) {
1175
- throw new Error(
1176
- `Invalid hardware type provided. Valid types are: ${hardware_types.map((v) => `"${v}"`).join(",")}.`
1177
- );
1178
- }
1179
- const { http_protocol, host } = await process_endpoint(app_reference, token);
1180
- let cookies = null;
1181
- if (auth) {
1182
- const cookie_header = await get_cookie_header(
1183
- http_protocol,
1184
- host,
1185
- auth,
1186
- fetch
1187
- );
1188
- if (cookie_header) cookies = parse_and_set_cookies(cookie_header);
1189
- }
1190
- const headers = {
1191
- Authorization: `Bearer ${token}`,
1192
- "Content-Type": "application/json",
1193
- ...cookies ? { Cookie: cookies.join("; ") } : {}
1194
- };
1195
- const user = (await (await fetch(`https://huggingface.co/api/whoami-v2`, {
1196
- headers
1197
- })).json()).name;
1198
- const space_name = app_reference.split("/")[1];
1199
- const body = {
1200
- repository: `${user}/${space_name}`
1201
- };
1202
- if (_private) {
1203
- body.private = true;
1204
- }
1205
- let original_hardware;
1206
- try {
1207
- if (!hardware) {
1208
- original_hardware = await get_space_hardware(app_reference, token);
1209
- }
1210
- } catch (e) {
1211
- throw Error(SPACE_METADATA_ERROR_MSG + e.message);
1212
- }
1213
- const requested_hardware = hardware || original_hardware || "cpu-basic";
1214
- body.hardware = requested_hardware;
1215
- try {
1216
- const response = await fetch(
1217
- `https://huggingface.co/api/spaces/${app_reference}/duplicate`,
1218
- {
1219
- method: "POST",
1220
- headers,
1221
- body: JSON.stringify(body)
1222
- }
1223
- );
1224
- if (response.status === 409) {
1225
- try {
1226
- const client2 = await Client.connect(`${user}/${space_name}`, options);
1227
- return client2;
1228
- } catch (error) {
1229
- console.error("Failed to connect Client instance:", error);
1230
- throw error;
1231
- }
1232
- } else if (response.status !== 200) {
1233
- throw new Error(response.statusText);
1234
- }
1235
- const duplicated_space = await response.json();
1236
- await set_space_timeout(`${user}/${space_name}`, timeout || 300, token);
1237
- return await Client.connect(
1238
- get_space_reference(duplicated_space.url),
1239
- options
1240
- );
1241
- } catch (e) {
1242
- throw new Error(e);
1243
- }
1244
- }
1245
- function get_space_reference(url) {
1246
- const regex = /https:\/\/huggingface.co\/spaces\/([^/]+\/[^/]+)/;
1247
- const match = url.match(regex);
1248
- if (match) {
1249
- return match[1];
1250
- }
1251
- }
1252
- const ZEROGPU_HEADERS_MESSAGE = "supports-zerogpu-headers";
1253
- let zerogpu_handshake_initialized = false;
1254
- function supports_browser_handshake() {
1255
- return typeof window !== "undefined" && typeof document !== "undefined" && typeof window.addEventListener === "function";
1256
- }
1257
- function get_zerogpu_origin(hostname) {
1258
- if (hostname.includes(".dev.")) {
1259
- return `https://moon-${hostname.split(".")[1]}.dev.spaces.huggingface.tech`;
1260
- }
1261
- if (hostname.endsWith(".hf.space")) {
1262
- return "https://huggingface.co";
1263
- }
1264
- return null;
1265
- }
1266
- function initialize_zerogpu_handshake() {
1267
- if (!supports_browser_handshake() || zerogpu_handshake_initialized) {
1268
- return;
1269
- }
1270
- window.addEventListener("message", (event) => {
1271
- if (event.data === ZEROGPU_HEADERS_MESSAGE) {
1272
- window.supports_zerogpu_headers = true;
1273
- }
1274
- });
1275
- zerogpu_handshake_initialized = true;
1276
- const origin = get_zerogpu_origin(window.location.hostname);
1277
- if (origin && window.parent !== window) {
1278
- window.parent.postMessage(ZEROGPU_HEADERS_MESSAGE, origin);
1279
- }
1280
- }
1281
- class TextLineStream extends TransformStream {
1282
- #currentLine = "";
1283
- /** Constructs a new instance. */
1284
- constructor(options = { allowCR: false }) {
1285
- super({
1286
- transform: (chars, controller) => {
1287
- chars = this.#currentLine + chars;
1288
- while (true) {
1289
- const lfIndex = chars.indexOf("\n");
1290
- const crIndex = options.allowCR ? chars.indexOf("\r") : -1;
1291
- if (crIndex !== -1 && crIndex !== chars.length - 1 && (lfIndex === -1 || lfIndex - 1 > crIndex)) {
1292
- controller.enqueue(chars.slice(0, crIndex));
1293
- chars = chars.slice(crIndex + 1);
1294
- continue;
1295
- }
1296
- if (lfIndex === -1)
1297
- break;
1298
- const endIndex = chars[lfIndex - 1] === "\r" ? lfIndex - 1 : lfIndex;
1299
- controller.enqueue(chars.slice(0, endIndex));
1300
- chars = chars.slice(lfIndex + 1);
1301
- }
1302
- this.#currentLine = chars;
1303
- },
1304
- flush: (controller) => {
1305
- if (this.#currentLine === "")
1306
- return;
1307
- const currentLine = options.allowCR && this.#currentLine.endsWith("\r") ? this.#currentLine.slice(0, -1) : this.#currentLine;
1308
- controller.enqueue(currentLine);
1309
- }
1310
- });
1311
- }
1312
- }
1313
- function stream$1(input) {
1314
- let decoder = new TextDecoderStream();
1315
- let split2 = new TextLineStream({ allowCR: true });
1316
- return input.pipeThrough(decoder).pipeThrough(split2);
1317
- }
1318
- function split(input) {
1319
- let rgx = /[:]\s*/;
1320
- let match = rgx.exec(input);
1321
- let idx = match && match.index;
1322
- if (idx) {
1323
- return [
1324
- input.substring(0, idx),
1325
- input.substring(idx + match[0].length)
1326
- ];
1327
- }
1328
- }
1329
- function fallback(headers, key, value) {
1330
- let tmp = headers.get(key);
1331
- if (!tmp)
1332
- headers.set(key, value);
1333
- }
1334
- async function* events(res, signal) {
1335
- if (!res.body)
1336
- return;
1337
- let iter = stream$1(res.body);
1338
- let line, reader = iter.getReader();
1339
- let event;
1340
- for (; ; ) {
1341
- if (signal && signal.aborted) {
1342
- return reader.cancel();
1343
- }
1344
- line = await reader.read();
1345
- if (line.done)
1346
- return;
1347
- if (!line.value) {
1348
- if (event)
1349
- yield event;
1350
- event = void 0;
1351
- continue;
1352
- }
1353
- let [field, value] = split(line.value) || [];
1354
- if (field === "data") {
1355
- event ||= {};
1356
- event[field] = event[field] ? event[field] + "\n" + value : value;
1357
- } else if (field === "event") {
1358
- event ||= {};
1359
- event[field] = value;
1360
- } else if (field === "id") {
1361
- event ||= {};
1362
- event[field] = String(+value) === value ? +value : value;
1363
- } else if (field === "retry") {
1364
- event ||= {};
1365
- event[field] = +value || void 0;
1366
- }
1367
- }
1368
- }
1369
- async function stream(input, init) {
1370
- let req = new Request(input, init);
1371
- fallback(req.headers, "Accept", "text/event-stream");
1372
- fallback(req.headers, "Content-Type", "application/json");
1373
- let r = await fetch(req);
1374
- if (!r.ok)
1375
- throw r;
1376
- return events(r, req.signal);
1377
- }
1378
- async function open_stream() {
1379
- let {
1380
- event_callbacks,
1381
- unclosed_events,
1382
- pending_stream_messages,
1383
- stream_status,
1384
- config,
1385
- jwt
1386
- } = this;
1387
- const that = this;
1388
- if (!config) {
1389
- throw new Error("Could not resolve app config");
1390
- }
1391
- stream_status.open = true;
1392
- let stream2 = null;
1393
- let params = new URLSearchParams({
1394
- session_hash: this.session_hash
1395
- }).toString();
1396
- let url = new URL(`${config.root}${this.api_prefix}/${SSE_URL}?${params}`);
1397
- if (jwt) {
1398
- url.searchParams.set("__sign", jwt);
1399
- }
1400
- stream2 = this.stream(url);
1401
- if (!stream2) {
1402
- console.warn("Cannot connect to SSE endpoint: " + url.toString());
1403
- return;
1404
- }
1405
- stream2.onmessage = async function(event) {
1406
- let _data = JSON.parse(event.data);
1407
- if (_data.msg === "close_stream") {
1408
- close_stream(stream_status, that.abort_controller);
1409
- return;
1410
- }
1411
- const event_id = _data.event_id;
1412
- if (!event_id) {
1413
- await Promise.all(
1414
- Object.keys(event_callbacks).map(
1415
- (event_id2) => event_callbacks[event_id2](_data)
1416
- )
1417
- );
1418
- } else if (event_callbacks[event_id] && config) {
1419
- if (_data.msg === "process_completed" && ["sse", "sse_v1", "sse_v2", "sse_v2.1", "sse_v3"].includes(
1420
- config.protocol
1421
- )) {
1422
- unclosed_events.delete(event_id);
1423
- }
1424
- let fn = event_callbacks[event_id];
1425
- if (typeof window !== "undefined" && typeof document !== "undefined") {
1426
- setTimeout(fn, 0, _data);
1427
- } else {
1428
- fn(_data);
1429
- }
1430
- } else {
1431
- if (!pending_stream_messages[event_id]) {
1432
- pending_stream_messages[event_id] = [];
1433
- }
1434
- pending_stream_messages[event_id].push(_data);
1435
- }
1436
- };
1437
- stream2.onerror = async function(e) {
1438
- console.error(e);
1439
- await Promise.all(
1440
- Object.keys(event_callbacks).map(
1441
- (event_id) => event_callbacks[event_id]({
1442
- msg: "broken_connection",
1443
- message: BROKEN_CONNECTION_MSG
1444
- })
1445
- )
1446
- );
1447
- };
1448
- }
1449
- function close_stream(stream_status, abort_controller) {
1450
- if (stream_status) {
1451
- stream_status.open = false;
1452
- abort_controller?.abort();
1453
- }
1454
- }
1455
- function apply_diff_stream(pending_diff_streams, event_id, data) {
1456
- let is_first_generation = !pending_diff_streams[event_id];
1457
- if (is_first_generation) {
1458
- pending_diff_streams[event_id] = [];
1459
- data.data.forEach((value, i) => {
1460
- pending_diff_streams[event_id][i] = value;
1461
- });
1462
- } else {
1463
- data.data.forEach((value, i) => {
1464
- let new_data = apply_diff(pending_diff_streams[event_id][i], value);
1465
- pending_diff_streams[event_id][i] = new_data;
1466
- data.data[i] = new_data;
1467
- });
1468
- }
1469
- }
1470
- function apply_diff(obj, diff) {
1471
- diff.forEach(([action, path, value]) => {
1472
- obj = apply_edit(obj, path, action, value);
1473
- });
1474
- return obj;
1475
- }
1476
- function apply_edit(target, path, action, value) {
1477
- if (path.length === 0) {
1478
- if (action === "replace") {
1479
- return value;
1480
- } else if (action === "append") {
1481
- return target + value;
1482
- }
1483
- throw new Error(`Unsupported action: ${action}`);
1484
- }
1485
- let current = target;
1486
- for (let i = 0; i < path.length - 1; i++) {
1487
- current = current[path[i]];
1488
- }
1489
- const last_path = path[path.length - 1];
1490
- switch (action) {
1491
- case "replace":
1492
- current[last_path] = value;
1493
- break;
1494
- case "append":
1495
- current[last_path] += value;
1496
- break;
1497
- case "add":
1498
- if (Array.isArray(current)) {
1499
- current.splice(Number(last_path), 0, value);
1500
- } else {
1501
- current[last_path] = value;
1502
- }
1503
- break;
1504
- case "delete":
1505
- if (Array.isArray(current)) {
1506
- current.splice(Number(last_path), 1);
1507
- } else {
1508
- delete current[last_path];
1509
- }
1510
- break;
1511
- default:
1512
- throw new Error(`Unknown action: ${action}`);
1513
- }
1514
- return target;
1515
- }
1516
- function readable_stream(input, init = {}) {
1517
- const instance = {
1518
- close: () => {
1519
- console.warn("Method not implemented.");
1520
- },
1521
- onerror: null,
1522
- onmessage: null,
1523
- onopen: null,
1524
- readyState: 0,
1525
- url: input.toString(),
1526
- withCredentials: false,
1527
- CONNECTING: 0,
1528
- OPEN: 1,
1529
- CLOSED: 2,
1530
- addEventListener: () => {
1531
- throw new Error("Method not implemented.");
1532
- },
1533
- dispatchEvent: () => {
1534
- throw new Error("Method not implemented.");
1535
- },
1536
- removeEventListener: () => {
1537
- throw new Error("Method not implemented.");
1538
- }
1539
- };
1540
- stream(input, init).then(async (res) => {
1541
- instance.readyState = instance.OPEN;
1542
- try {
1543
- for await (const chunk of res) {
1544
- instance.onmessage && instance.onmessage(chunk);
1545
- }
1546
- instance.readyState = instance.CLOSED;
1547
- } catch (e) {
1548
- instance.onerror && instance.onerror(e);
1549
- instance.readyState = instance.CLOSED;
1550
- }
1551
- }).catch((e) => {
1552
- console.error(e);
1553
- instance.onerror && instance.onerror(e);
1554
- instance.readyState = instance.CLOSED;
1555
- });
1556
- return instance;
1557
- }
1558
- function submit(endpoint, data = {}, event_data, trigger_id, all_events, additional_headers) {
1559
- try {
1560
- let fire_event = function(event) {
1561
- if (all_events || events_to_publish[event.type]) {
1562
- push_event(event);
1563
- }
1564
- }, close = function() {
1565
- done = true;
1566
- while (resolvers.length > 0)
1567
- resolvers.shift()({
1568
- value: void 0,
1569
- done: true
1570
- });
1571
- }, push = function(data2) {
1572
- if (resolvers.length > 0) {
1573
- resolvers.shift()(data2);
1574
- } else {
1575
- values.push(data2);
1576
- }
1577
- }, push_error = function(error) {
1578
- push(thenable_reject(error));
1579
- close();
1580
- }, push_event = function(event) {
1581
- push({ value: event, done: false });
1582
- }, next = function() {
1583
- if (values.length > 0) {
1584
- return Promise.resolve(values.shift());
1585
- }
1586
- if (done) {
1587
- return Promise.resolve({ value: void 0, done: true });
1588
- }
1589
- return new Promise((resolve) => resolvers.push(resolve));
1590
- };
1591
- const { token } = this.options;
1592
- const {
1593
- fetch: fetch2,
1594
- app_reference,
1595
- config,
1596
- session_hash,
1597
- api_info,
1598
- api_map,
1599
- stream_status,
1600
- pending_stream_messages,
1601
- pending_diff_streams,
1602
- event_callbacks,
1603
- unclosed_events,
1604
- post_data: post_data2,
1605
- options,
1606
- api_prefix
1607
- } = this;
1608
- const addt_headers = additional_headers || { "x-gradio-user": "api" };
1609
- const that = this;
1610
- if (!api_info) throw new Error("No API found");
1611
- if (!config) throw new Error("Could not resolve app config");
1612
- let { fn_index, endpoint_info, dependency } = get_endpoint_info(
1613
- api_info,
1614
- endpoint,
1615
- api_map,
1616
- config
1617
- );
1618
- let resolved_data = map_data_to_params(data, endpoint_info);
1619
- let stream2;
1620
- let protocol = config.protocol ?? "ws";
1621
- if (protocol === "ws") {
1622
- throw new Error("WebSocket protocol is not supported in this version");
1623
- }
1624
- let event_id_final = "";
1625
- let event_id_cb = () => event_id_final;
1626
- const _endpoint = typeof endpoint === "number" ? "/predict" : endpoint;
1627
- let payload;
1628
- let event_id = null;
1629
- let complete = false;
1630
- let last_status = {};
1631
- let url_params = typeof window !== "undefined" && typeof document !== "undefined" ? new URLSearchParams(window.location.search).toString() : "";
1632
- const events_to_publish = options?.events?.reduce(
1633
- (acc, event) => {
1634
- acc[event] = true;
1635
- return acc;
1636
- },
1637
- {}
1638
- ) || {};
1639
- async function cancel() {
1640
- let reset_request = {};
1641
- let cancel_request = {};
1642
- reset_request = { event_id };
1643
- cancel_request = { event_id, session_hash, fn_index };
1644
- try {
1645
- if (!config) {
1646
- throw new Error("Could not resolve app config");
1647
- }
1648
- if ("event_id" in cancel_request) {
1649
- await fetch2(`${config.root}${api_prefix}/${CANCEL_URL}`, {
1650
- headers: { "Content-Type": "application/json" },
1651
- method: "POST",
1652
- body: JSON.stringify(cancel_request)
1653
- });
1654
- }
1655
- await fetch2(`${config.root}${api_prefix}/${RESET_URL}`, {
1656
- headers: { "Content-Type": "application/json" },
1657
- method: "POST",
1658
- body: JSON.stringify(reset_request)
1659
- });
1660
- } catch (e) {
1661
- console.warn(
1662
- "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable."
1663
- );
1664
- }
1665
- }
1666
- const resolve_heartbeat = async (config2) => {
1667
- await this._resolve_heartbeat(config2);
1668
- };
1669
- async function handle_render_config(render_config) {
1670
- if (!config) return;
1671
- let render_id = render_config.render_id;
1672
- config.components = [
1673
- ...config.components.filter((c) => c.props.rendered_in !== render_id),
1674
- ...render_config.components
1675
- ];
1676
- config.dependencies = [
1677
- ...config.dependencies.filter((d) => d.rendered_in !== render_id),
1678
- ...render_config.dependencies
1679
- ];
1680
- const any_state = config.components.some((c) => c.type === "state");
1681
- const any_unload = config.dependencies.some(
1682
- (d) => d.targets.some((t) => t[1] === "unload")
1683
- );
1684
- config.connect_heartbeat = any_state || any_unload;
1685
- await resolve_heartbeat(config);
1686
- fire_event({
1687
- type: "render",
1688
- data: render_config,
1689
- endpoint: _endpoint,
1690
- fn_index
1691
- });
1692
- }
1693
- const job = this.handle_blob(
1694
- config.root,
1695
- resolved_data,
1696
- endpoint_info
1697
- ).then(async (_payload) => {
1698
- let input_data = handle_payload(
1699
- _payload,
1700
- dependency,
1701
- config.components,
1702
- "input",
1703
- true
1704
- );
1705
- payload = {
1706
- data: input_data || [],
1707
- event_data,
1708
- fn_index,
1709
- trigger_id
1710
- };
1711
- if (skip_queue(fn_index, config)) {
1712
- fire_event({
1713
- type: "status",
1714
- endpoint: _endpoint,
1715
- stage: "pending",
1716
- queue: false,
1717
- fn_index,
1718
- time: /* @__PURE__ */ new Date()
1719
- });
1720
- post_data2(
1721
- `${config.root}${api_prefix}/run${_endpoint.startsWith("/") ? _endpoint : `/${_endpoint}`}${url_params ? "?" + url_params : ""}`,
1722
- {
1723
- ...payload,
1724
- session_hash
1725
- },
1726
- addt_headers
1727
- ).then(async ([output, status_code]) => {
1728
- const data2 = output.data;
1729
- if (status_code == 200) {
1730
- fire_event({
1731
- type: "data",
1732
- endpoint: _endpoint,
1733
- fn_index,
1734
- data: handle_payload(
1735
- data2,
1736
- dependency,
1737
- config.components,
1738
- "output",
1739
- options.with_null_state
1740
- ),
1741
- time: /* @__PURE__ */ new Date(),
1742
- event_data,
1743
- trigger_id
1744
- });
1745
- if (output.render_config) {
1746
- await handle_render_config(output.render_config);
1747
- }
1748
- fire_event({
1749
- type: "status",
1750
- endpoint: _endpoint,
1751
- fn_index,
1752
- stage: "complete",
1753
- eta: output.average_duration,
1754
- queue: false,
1755
- time: /* @__PURE__ */ new Date()
1756
- });
1757
- } else {
1758
- const is_connection_error = output?.error === BROKEN_CONNECTION_MSG;
1759
- fire_event({
1760
- type: "status",
1761
- stage: "error",
1762
- endpoint: _endpoint,
1763
- fn_index,
1764
- message: output.error,
1765
- broken: is_connection_error,
1766
- queue: false,
1767
- time: /* @__PURE__ */ new Date()
1768
- });
1769
- }
1770
- }).catch((e) => {
1771
- fire_event({
1772
- type: "status",
1773
- stage: "error",
1774
- message: e.message,
1775
- endpoint: _endpoint,
1776
- fn_index,
1777
- queue: false,
1778
- time: /* @__PURE__ */ new Date()
1779
- });
1780
- });
1781
- } else if (protocol == "sse") {
1782
- fire_event({
1783
- type: "status",
1784
- stage: "pending",
1785
- queue: true,
1786
- endpoint: _endpoint,
1787
- fn_index,
1788
- time: /* @__PURE__ */ new Date()
1789
- });
1790
- var params = new URLSearchParams({
1791
- fn_index: fn_index.toString(),
1792
- session_hash
1793
- }).toString();
1794
- let url = new URL(
1795
- `${config.root}${api_prefix}/${SSE_URL}?${url_params ? url_params + "&" : ""}${params}`
1796
- );
1797
- if (this.jwt) {
1798
- url.searchParams.set("__sign", this.jwt);
1799
- }
1800
- stream2 = this.stream(url);
1801
- if (!stream2) {
1802
- return Promise.reject(
1803
- new Error("Cannot connect to SSE endpoint: " + url.toString())
1804
- );
1805
- }
1806
- stream2.onmessage = async function(event) {
1807
- const _data = JSON.parse(event.data);
1808
- const { type, status, data: data2 } = handle_message(
1809
- _data,
1810
- last_status[fn_index]
1811
- );
1812
- if (type === "update" && status && !complete) {
1813
- fire_event({
1814
- type: "status",
1815
- endpoint: _endpoint,
1816
- fn_index,
1817
- time: /* @__PURE__ */ new Date(),
1818
- ...status
1819
- });
1820
- if (status.stage === "error") {
1821
- stream2?.close();
1822
- close();
1823
- }
1824
- } else if (type === "data") {
1825
- let [_, status2] = await post_data2(
1826
- `${config.root}${api_prefix}/queue/data`,
1827
- {
1828
- ...payload,
1829
- session_hash,
1830
- event_id
1831
- }
1832
- );
1833
- if (status2 !== 200) {
1834
- fire_event({
1835
- type: "status",
1836
- stage: "error",
1837
- message: BROKEN_CONNECTION_MSG,
1838
- queue: true,
1839
- endpoint: _endpoint,
1840
- fn_index,
1841
- time: /* @__PURE__ */ new Date()
1842
- });
1843
- stream2?.close();
1844
- close();
1845
- }
1846
- } else if (type === "complete") {
1847
- complete = status;
1848
- } else if (type === "log") {
1849
- fire_event({
1850
- type: "log",
1851
- title: data2.title,
1852
- log: data2.log,
1853
- level: data2.level,
1854
- endpoint: _endpoint,
1855
- duration: data2.duration,
1856
- visible: data2.visible,
1857
- fn_index
1858
- });
1859
- } else if (type === "generating" || type === "streaming") {
1860
- fire_event({
1861
- type: "status",
1862
- time: /* @__PURE__ */ new Date(),
1863
- ...status,
1864
- stage: status?.stage,
1865
- queue: true,
1866
- endpoint: _endpoint,
1867
- fn_index
1868
- });
1869
- }
1870
- if (data2) {
1871
- fire_event({
1872
- type: "data",
1873
- time: /* @__PURE__ */ new Date(),
1874
- data: handle_payload(
1875
- data2.data,
1876
- dependency,
1877
- config.components,
1878
- "output",
1879
- options.with_null_state
1880
- ),
1881
- endpoint: _endpoint,
1882
- fn_index,
1883
- event_data,
1884
- trigger_id
1885
- });
1886
- if (complete) {
1887
- fire_event({
1888
- type: "status",
1889
- time: /* @__PURE__ */ new Date(),
1890
- ...complete,
1891
- stage: status?.stage,
1892
- queue: true,
1893
- endpoint: _endpoint,
1894
- fn_index
1895
- });
1896
- stream2?.close();
1897
- close();
1898
- }
1899
- }
1900
- };
1901
- } else if (protocol == "sse_v1" || protocol == "sse_v2" || protocol == "sse_v2.1" || protocol == "sse_v3") {
1902
- fire_event({
1903
- type: "status",
1904
- stage: "pending",
1905
- queue: true,
1906
- endpoint: _endpoint,
1907
- fn_index,
1908
- time: /* @__PURE__ */ new Date()
1909
- });
1910
- let hostname = "";
1911
- if (typeof window !== "undefined" && typeof document !== "undefined") {
1912
- hostname = window?.location?.hostname;
1913
- }
1914
- const origin = get_zerogpu_origin(hostname);
1915
- const is_zerogpu_iframe = typeof window !== "undefined" && typeof document !== "undefined" && window.parent != window && !!origin && window.supports_zerogpu_headers;
1916
- const zerogpu_auth_promise = is_zerogpu_iframe ? post_message("zerogpu-headers", origin) : Promise.resolve(null);
1917
- const post_data_promise = zerogpu_auth_promise.then((headers) => {
1918
- const combined_headers = { ...addt_headers, ...headers || {} };
1919
- return post_data2(
1920
- `${config.root}${api_prefix}/${SSE_DATA_URL}?${url_params}`,
1921
- {
1922
- ...payload,
1923
- session_hash
1924
- },
1925
- combined_headers
1926
- );
1927
- });
1928
- return post_data_promise.then(async ([response, status]) => {
1929
- if (response.event_id) {
1930
- event_id_final = response.event_id;
1931
- }
1932
- if (status === 503) {
1933
- fire_event({
1934
- type: "status",
1935
- stage: "error",
1936
- message: QUEUE_FULL_MSG,
1937
- queue: true,
1938
- endpoint: _endpoint,
1939
- fn_index,
1940
- time: /* @__PURE__ */ new Date(),
1941
- visible: true
1942
- });
1943
- } else if (status === 422) {
1944
- fire_event({
1945
- type: "status",
1946
- stage: "error",
1947
- message: response.detail,
1948
- queue: true,
1949
- endpoint: _endpoint,
1950
- fn_index,
1951
- code: "validation_error",
1952
- time: /* @__PURE__ */ new Date(),
1953
- visible: true
1954
- });
1955
- close();
1956
- } else if (status !== 200) {
1957
- const is_connection_error = response?.error === BROKEN_CONNECTION_MSG;
1958
- fire_event({
1959
- type: "status",
1960
- stage: "error",
1961
- broken: is_connection_error,
1962
- message: is_connection_error ? BROKEN_CONNECTION_MSG : response.detail || response.error,
1963
- queue: true,
1964
- endpoint: _endpoint,
1965
- fn_index,
1966
- time: /* @__PURE__ */ new Date(),
1967
- visible: true
1968
- });
1969
- } else {
1970
- event_id = response.event_id;
1971
- event_id_final = event_id;
1972
- let callback = async function(_data) {
1973
- try {
1974
- const { type, status: status2, data: data2, original_msg } = handle_message(
1975
- _data,
1976
- last_status[fn_index]
1977
- );
1978
- if (type == "heartbeat") {
1979
- return;
1980
- }
1981
- if (type === "update" && status2 && !complete) {
1982
- fire_event({
1983
- type: "status",
1984
- endpoint: _endpoint,
1985
- fn_index,
1986
- time: /* @__PURE__ */ new Date(),
1987
- original_msg,
1988
- ...status2
1989
- });
1990
- } else if (type === "complete") {
1991
- complete = status2;
1992
- } else if (type == "unexpected_error" || type == "broken_connection") {
1993
- console.error("Unexpected error", status2?.message);
1994
- const broken = type === "broken_connection";
1995
- fire_event({
1996
- type: "status",
1997
- stage: "error",
1998
- message: status2?.message || "An Unexpected Error Occurred!",
1999
- queue: true,
2000
- endpoint: _endpoint,
2001
- broken,
2002
- session_not_found: status2?.session_not_found,
2003
- fn_index,
2004
- time: /* @__PURE__ */ new Date()
2005
- });
2006
- } else if (type === "log") {
2007
- fire_event({
2008
- type: "log",
2009
- title: data2.title,
2010
- log: data2.log,
2011
- level: data2.level,
2012
- endpoint: _endpoint,
2013
- duration: data2.duration,
2014
- visible: data2.visible,
2015
- fn_index
2016
- });
2017
- return;
2018
- } else if (type === "generating" || type === "streaming") {
2019
- fire_event({
2020
- type: "status",
2021
- time: /* @__PURE__ */ new Date(),
2022
- ...status2,
2023
- stage: status2?.stage,
2024
- queue: true,
2025
- endpoint: _endpoint,
2026
- fn_index
2027
- });
2028
- if (data2 && dependency.connection !== "stream" && ["sse_v2", "sse_v2.1", "sse_v3"].includes(protocol)) {
2029
- apply_diff_stream(pending_diff_streams, event_id, data2);
2030
- }
2031
- }
2032
- if (data2) {
2033
- fire_event({
2034
- type: "data",
2035
- time: /* @__PURE__ */ new Date(),
2036
- data: handle_payload(
2037
- data2.data,
2038
- dependency,
2039
- config.components,
2040
- "output",
2041
- options.with_null_state
2042
- ),
2043
- endpoint: _endpoint,
2044
- fn_index
2045
- });
2046
- if (data2.render_config) {
2047
- await handle_render_config(data2.render_config);
2048
- }
2049
- if (complete) {
2050
- fire_event({
2051
- type: "status",
2052
- time: /* @__PURE__ */ new Date(),
2053
- ...complete,
2054
- stage: status2?.stage,
2055
- queue: true,
2056
- endpoint: _endpoint,
2057
- fn_index
2058
- });
2059
- close();
2060
- }
2061
- }
2062
- if (status2?.stage === "complete" || status2?.stage === "error") {
2063
- if (event_callbacks[event_id]) {
2064
- delete event_callbacks[event_id];
2065
- }
2066
- if (event_id in pending_diff_streams) {
2067
- delete pending_diff_streams[event_id];
2068
- }
2069
- }
2070
- } catch (e) {
2071
- console.error("Unexpected client exception", e);
2072
- fire_event({
2073
- type: "status",
2074
- stage: "error",
2075
- message: "An Unexpected Error Occurred!",
2076
- queue: true,
2077
- endpoint: _endpoint,
2078
- fn_index,
2079
- time: /* @__PURE__ */ new Date()
2080
- });
2081
- if (["sse_v2", "sse_v2.1", "sse_v3"].includes(protocol)) {
2082
- close_stream(stream_status, that.abort_controller);
2083
- stream_status.open = false;
2084
- close();
2085
- }
2086
- }
2087
- };
2088
- if (event_id in pending_stream_messages) {
2089
- pending_stream_messages[event_id].forEach((msg) => callback(msg));
2090
- delete pending_stream_messages[event_id];
2091
- }
2092
- event_callbacks[event_id] = callback;
2093
- unclosed_events.add(event_id);
2094
- if (!stream_status.open) {
2095
- await this.open_stream();
2096
- }
2097
- }
2098
- });
2099
- }
2100
- });
2101
- let done = false;
2102
- const values = [];
2103
- const resolvers = [];
2104
- const iterator = {
2105
- [Symbol.asyncIterator]: () => iterator,
2106
- next,
2107
- throw: async (value) => {
2108
- push_error(value);
2109
- return next();
2110
- },
2111
- return: async () => {
2112
- close();
2113
- return { value: void 0, done: true };
2114
- },
2115
- cancel,
2116
- send_chunk: (payload2) => {
2117
- this.post_data(`${config.root}${api_prefix}/stream/${event_id_final}`, {
2118
- ...payload2,
2119
- session_hash: this.session_hash
2120
- });
2121
- },
2122
- close_stream: () => {
2123
- this.post_data(
2124
- `${config.root}${api_prefix}/stream/${event_id_final}/close`,
2125
- {}
2126
- );
2127
- close();
2128
- },
2129
- event_id: () => event_id_final,
2130
- wait_for_id: async () => {
2131
- await job;
2132
- return event_id;
2133
- }
2134
- };
2135
- return iterator;
2136
- } catch (error) {
2137
- console.error("Submit function encountered an error:", error);
2138
- throw error;
2139
- }
2140
- }
2141
- function thenable_reject(error) {
2142
- return {
2143
- then: (resolve, reject) => reject(error)
2144
- };
2145
- }
2146
- function get_endpoint_info(api_info, endpoint, api_map, config) {
2147
- let fn_index;
2148
- let endpoint_info;
2149
- let dependency;
2150
- if (typeof endpoint === "number") {
2151
- fn_index = endpoint;
2152
- endpoint_info = api_info.unnamed_endpoints[fn_index];
2153
- dependency = config.dependencies.find((dep) => dep.id == endpoint);
2154
- } else {
2155
- const trimmed_endpoint = endpoint.replace(/^\//, "");
2156
- fn_index = api_map[trimmed_endpoint];
2157
- endpoint_info = api_info.named_endpoints[endpoint.trim()];
2158
- dependency = config.dependencies.find(
2159
- (dep) => dep.id == api_map[trimmed_endpoint]
2160
- );
2161
- }
2162
- if (typeof fn_index !== "number") {
2163
- throw new Error(
2164
- "There is no endpoint matching that name of fn_index matching that number."
2165
- );
2166
- }
2167
- return { fn_index, endpoint_info, dependency };
2168
- }
2169
- class Client {
2170
- app_reference;
2171
- options;
2172
- deep_link = null;
2173
- config;
2174
- api_prefix = "";
2175
- api_info;
2176
- api_map = {};
2177
- session_hash = Math.random().toString(36).substring(2);
2178
- jwt = false;
2179
- last_status = {};
2180
- cookies = null;
2181
- // streaming
2182
- stream_status = { open: false };
2183
- closed = false;
2184
- pending_stream_messages = {};
2185
- pending_diff_streams = {};
2186
- event_callbacks = {};
2187
- unclosed_events = /* @__PURE__ */ new Set();
2188
- heartbeat_event = null;
2189
- abort_controller = null;
2190
- stream_instance = null;
2191
- current_payload;
2192
- get_url_config(url = null) {
2193
- if (!this.config) {
2194
- throw new Error(CONFIG_ERROR_MSG);
2195
- }
2196
- if (url === null) {
2197
- url = window.location.href;
2198
- }
2199
- const stripSlashes = (str) => str.replace(/^\/+|\/+$/g, "");
2200
- let root_path = stripSlashes(new URL(this.config.root).pathname);
2201
- let url_path = stripSlashes(new URL(url).pathname);
2202
- let page;
2203
- if (!url_path.startsWith(root_path)) {
2204
- page = "";
2205
- } else {
2206
- page = stripSlashes(url_path.substring(root_path.length));
2207
- }
2208
- return this.get_page_config(page);
2209
- }
2210
- get_page_config(page) {
2211
- if (!this.config) {
2212
- throw new Error(CONFIG_ERROR_MSG);
2213
- }
2214
- let config = this.config;
2215
- if (!(page in config.page)) {
2216
- page = "";
2217
- }
2218
- return {
2219
- ...config,
2220
- current_page: page,
2221
- layout: config.page[page].layout,
2222
- components: config.components.filter(
2223
- (c) => config.page[page].components.includes(c.id)
2224
- ),
2225
- dependencies: this.config.dependencies.filter(
2226
- (d) => config.page[page].dependencies.includes(d.id)
2227
- )
2228
- };
2229
- }
2230
- fetch(input, init) {
2231
- const headers = new Headers(init?.headers || {});
2232
- if (this && this.cookies) {
2233
- headers.append("Cookie", this.cookies);
2234
- }
2235
- if (this && this.options.headers) {
2236
- let additional_headers = new Headers(this.options.headers);
2237
- additional_headers.forEach((value, name) => {
2238
- headers.append(name, value);
2239
- });
2240
- }
2241
- return fetch(input, { ...init, headers });
2242
- }
2243
- stream(url) {
2244
- const headers = new Headers();
2245
- if (this && this.cookies) {
2246
- headers.append("Cookie", this.cookies);
2247
- }
2248
- if (this && this.options.headers) {
2249
- let additional_headers = new Headers(this.options.headers);
2250
- additional_headers.forEach((value, name) => {
2251
- headers.append(name, value);
2252
- });
2253
- }
2254
- if (this && this.options.token) {
2255
- headers.append("Authorization", `Bearer ${this.options.token}`);
2256
- }
2257
- this.abort_controller = new AbortController();
2258
- this.stream_instance = readable_stream(url.toString(), {
2259
- credentials: "include",
2260
- headers,
2261
- signal: this.abort_controller.signal
2262
- });
2263
- return this.stream_instance;
2264
- }
2265
- view_api;
2266
- upload_files;
2267
- upload;
2268
- handle_blob;
2269
- post_data;
2270
- submit;
2271
- predict;
2272
- open_stream;
2273
- resolve_config;
2274
- resolve_cookies;
2275
- constructor(app_reference, options = { events: ["data"] }) {
2276
- this.app_reference = app_reference;
2277
- this.deep_link = options.query_params?.deep_link || null;
2278
- if (!options.events) {
2279
- options.events = ["data"];
2280
- }
2281
- this.options = options;
2282
- this.current_payload = {};
2283
- if (options.cookies) {
2284
- this.cookies = options.cookies;
2285
- }
2286
- this.view_api = view_api.bind(this);
2287
- this.upload_files = upload_files.bind(this);
2288
- this.handle_blob = handle_blob.bind(this);
2289
- this.post_data = post_data.bind(this);
2290
- this.submit = submit.bind(this);
2291
- this.predict = predict.bind(this);
2292
- this.open_stream = open_stream.bind(this);
2293
- this.resolve_config = resolve_config.bind(this);
2294
- this.resolve_cookies = resolve_cookies.bind(this);
2295
- this.upload = upload.bind(this);
2296
- this.fetch = this.fetch.bind(this);
2297
- this.handle_space_success = this.handle_space_success.bind(this);
2298
- this.stream = this.stream.bind(this);
2299
- }
2300
- async init() {
2301
- initialize_zerogpu_handshake();
2302
- if (this.options.auth) {
2303
- await this.resolve_cookies();
2304
- }
2305
- await this._resolve_config().then(
2306
- ({ config }) => this._resolve_heartbeat(config)
2307
- );
2308
- this.api_info = await this.view_api();
2309
- this.api_map = map_names_to_ids(this.config?.dependencies || []);
2310
- }
2311
- async _resolve_heartbeat(_config) {
2312
- if (_config) {
2313
- this.config = _config;
2314
- this.api_prefix = _config.api_prefix || "";
2315
- if (this.config && this.config.connect_heartbeat) {
2316
- if (this.config.space_id && this.options.token) {
2317
- this.jwt = await get_jwt(
2318
- this.config.space_id,
2319
- this.options.token,
2320
- this.cookies
2321
- );
2322
- }
2323
- }
2324
- }
2325
- if (_config.space_id && this.options.token) {
2326
- this.jwt = await get_jwt(_config.space_id, this.options.token);
2327
- }
2328
- if (this.config && this.config.connect_heartbeat) {
2329
- const heartbeat_url = new URL(
2330
- `${this.config.root}${this.api_prefix}/${HEARTBEAT_URL}/${this.session_hash}`
2331
- );
2332
- if (this.jwt) {
2333
- heartbeat_url.searchParams.set("__sign", this.jwt);
2334
- }
2335
- if (!this.heartbeat_event) {
2336
- this.heartbeat_event = this.stream(heartbeat_url);
2337
- }
2338
- }
2339
- }
2340
- static async connect(app_reference, options = {
2341
- events: ["data"]
2342
- }) {
2343
- const client2 = new this(app_reference, options);
2344
- if (options.session_hash) {
2345
- client2.session_hash = options.session_hash;
2346
- }
2347
- await client2.init();
2348
- return client2;
2349
- }
2350
- async reconnect() {
2351
- const app_id_url = new URL(
2352
- `${this.config.root}${this.api_prefix}/${APP_ID_URL}`
2353
- );
2354
- let app_id;
2355
- try {
2356
- const response = await this.fetch(app_id_url);
2357
- if (!response.ok) {
2358
- throw new Error();
2359
- }
2360
- app_id = (await response.json()).app_id;
2361
- } catch (e) {
2362
- return "broken";
2363
- }
2364
- if (app_id !== this.config.app_id) {
2365
- return "changed";
2366
- }
2367
- return "connected";
2368
- }
2369
- close() {
2370
- this.closed = true;
2371
- close_stream(this.stream_status, this.abort_controller);
2372
- }
2373
- set_current_payload(payload) {
2374
- this.current_payload = payload;
2375
- }
2376
- static async duplicate(app_reference, options = {
2377
- events: ["data"]
2378
- }) {
2379
- return duplicate(app_reference, options);
2380
- }
2381
- async _resolve_config() {
2382
- const { http_protocol, host, space_id } = await process_endpoint(
2383
- this.app_reference,
2384
- this.options.token
2385
- );
2386
- const { status_callback } = this.options;
2387
- if (space_id && status_callback) {
2388
- await check_and_wake_space(space_id, status_callback);
2389
- }
2390
- let config;
2391
- try {
2392
- let configUrl = `${http_protocol}//${host}`;
2393
- config = await this.resolve_config(configUrl);
2394
- if (!config) {
2395
- throw new Error(CONFIG_ERROR_MSG);
2396
- }
2397
- return this.config_success(config);
2398
- } catch (e) {
2399
- if (space_id && status_callback) {
2400
- check_space_status(
2401
- space_id,
2402
- RE_SPACE_NAME.test(space_id) ? "space_name" : "subdomain",
2403
- this.handle_space_success
2404
- );
2405
- } else {
2406
- if (status_callback)
2407
- status_callback({
2408
- status: "error",
2409
- message: "Could not load this space.",
2410
- load_status: "error",
2411
- detail: "NOT_FOUND"
2412
- });
2413
- throw Error(e);
2414
- }
2415
- }
2416
- }
2417
- async config_success(_config) {
2418
- this.config = _config;
2419
- this.api_prefix = _config.api_prefix || "";
2420
- if (this.config.auth_required) {
2421
- return this.prepare_return_obj();
2422
- }
2423
- try {
2424
- this.api_info = await this.view_api();
2425
- } catch (e) {
2426
- console.error(API_INFO_ERROR_MSG + e.message);
2427
- }
2428
- return this.prepare_return_obj();
2429
- }
2430
- async handle_space_success(status) {
2431
- if (!this) {
2432
- throw new Error(CONFIG_ERROR_MSG);
2433
- }
2434
- const { status_callback } = this.options;
2435
- if (status_callback) status_callback(status);
2436
- if (status.status === "running") {
2437
- try {
2438
- this.config = await this._resolve_config();
2439
- this.api_prefix = this?.config?.api_prefix || "";
2440
- if (!this.config) {
2441
- throw new Error(CONFIG_ERROR_MSG);
2442
- }
2443
- const _config = await this.config_success(this.config);
2444
- return _config;
2445
- } catch (e) {
2446
- if (status_callback) {
2447
- status_callback({
2448
- status: "error",
2449
- message: "Could not load this space.",
2450
- load_status: "error",
2451
- detail: "NOT_FOUND"
2452
- });
2453
- }
2454
- throw e;
2455
- }
2456
- }
2457
- }
2458
- async component_server(component_id, fn_name, data) {
2459
- if (!this.config) {
2460
- throw new Error(CONFIG_ERROR_MSG);
2461
- }
2462
- const headers = {};
2463
- const { token } = this.options;
2464
- const { session_hash } = this;
2465
- if (token) {
2466
- headers.Authorization = `Bearer ${this.options.token}`;
2467
- }
2468
- let root_url;
2469
- let component = this.config.components.find(
2470
- (comp) => comp.id === component_id
2471
- );
2472
- if (component?.props?.root_url) {
2473
- root_url = component.props.root_url;
2474
- } else {
2475
- root_url = this.config.root;
2476
- }
2477
- let body;
2478
- if (typeof data === "object" && data !== null && "binary" in data) {
2479
- const _data = data;
2480
- body = new FormData();
2481
- for (const key in _data.data) {
2482
- if (key === "binary") continue;
2483
- body.append(key, _data.data[key]);
2484
- }
2485
- body.set("component_id", component_id.toString());
2486
- body.set("fn_name", fn_name);
2487
- body.set("session_hash", session_hash);
2488
- } else {
2489
- body = JSON.stringify({
2490
- data,
2491
- component_id,
2492
- fn_name,
2493
- session_hash
2494
- });
2495
- headers["Content-Type"] = "application/json";
2496
- }
2497
- if (token) {
2498
- headers.Authorization = `Bearer ${token}`;
2499
- }
2500
- try {
2501
- const response = await this.fetch(
2502
- `${root_url}${this.api_prefix}/${COMPONENT_SERVER_URL}/`,
2503
- {
2504
- method: "POST",
2505
- body,
2506
- headers,
2507
- credentials: "include"
2508
- }
2509
- );
2510
- if (!response.ok) {
2511
- throw new Error(
2512
- "Could not connect to component server: " + response.statusText
2513
- );
2514
- }
2515
- const output = await response.json();
2516
- return output;
2517
- } catch (e) {
2518
- console.warn(e);
2519
- }
2520
- }
2521
- set_cookies(raw_cookies) {
2522
- this.cookies = parse_and_set_cookies(raw_cookies).join("; ");
2523
- }
2524
- prepare_return_obj() {
2525
- return {
2526
- config: this.config,
2527
- predict: this.predict,
2528
- submit: this.submit,
2529
- view_api: this.view_api,
2530
- component_server: this.component_server
2531
- };
2532
- }
2533
- }
2534
- async function client(app_reference, options = {
2535
- events: ["data"]
2536
- }) {
2537
- return await Client.connect(app_reference, options);
2538
- }
2539
- async function duplicate_space(app_reference, options) {
2540
- return await Client.duplicate(app_reference, options);
2541
- }
2542
- export {
2543
- Client,
2544
- FileData,
2545
- MISSING_CREDENTIALS_MSG,
2546
- client,
2547
- duplicate_space as duplicate,
2548
- handle_file,
2549
- predict,
2550
- prepare_files,
2551
- submit,
2552
- upload,
2553
- upload_files
2554
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/types.d.ts DELETED
@@ -1,351 +0,0 @@
1
- import { hardware_types } from "./helpers/spaces";
2
- import type { SvelteComponent } from "svelte";
3
- import type { ComponentType } from "svelte";
4
- export interface ApiData {
5
- label: string;
6
- parameter_name: string;
7
- parameter_default?: any;
8
- parameter_has_default?: boolean;
9
- type: {
10
- type: any;
11
- description: string;
12
- };
13
- component: string;
14
- example_input?: any;
15
- python_type: {
16
- type: string;
17
- description: string;
18
- };
19
- serializer: string;
20
- }
21
- export interface JsApiData {
22
- label: string;
23
- parameter_name: string;
24
- parameter_default?: any;
25
- parameter_has_default?: boolean;
26
- type: string;
27
- description: string;
28
- component: string;
29
- example_input?: any;
30
- serializer: string;
31
- python_type: {
32
- type: string;
33
- description: string;
34
- };
35
- }
36
- export interface EndpointInfo<T extends ApiData | JsApiData> {
37
- parameters: T[];
38
- returns: T[];
39
- type?: DependencyTypes;
40
- }
41
- export interface ApiInfo<T extends ApiData | JsApiData> {
42
- named_endpoints: Record<string, EndpointInfo<T>>;
43
- unnamed_endpoints: Record<string, EndpointInfo<T>>;
44
- }
45
- export interface BlobRef {
46
- path: string[];
47
- type: string | undefined;
48
- blob: Blob | File | false;
49
- }
50
- export type DataType = string | Buffer | Record<string, any> | any[];
51
- export declare class Command {
52
- type: string;
53
- command: string;
54
- meta: {
55
- path: string;
56
- name: string;
57
- orig_path: string;
58
- };
59
- fileData?: FileData;
60
- constructor(command: string, meta: {
61
- path: string;
62
- name: string;
63
- orig_path: string;
64
- });
65
- }
66
- export type SubmitFunction = (endpoint: string | number, data?: unknown[] | Record<string, unknown>, event_data?: unknown, trigger_id?: number | null, all_events?: boolean, additional_headers?: Record<string, string>) => SubmitIterable<GradioEvent>;
67
- export type PredictFunction = <T = unknown>(endpoint: string | number, data?: unknown[] | Record<string, unknown>, event_data?: unknown) => Promise<PredictReturn<T>>;
68
- export type client_return = {
69
- config: Config | undefined;
70
- predict: PredictFunction;
71
- submit: SubmitFunction;
72
- component_server: (component_id: number, fn_name: string, data: unknown[]) => any;
73
- view_api: (_fetch: typeof fetch) => Promise<ApiInfo<JsApiData>>;
74
- };
75
- export interface SubmitIterable<T> extends AsyncIterable<T> {
76
- [Symbol.asyncIterator](): SubmitIterable<T>;
77
- next: () => Promise<IteratorResult<T, unknown>>;
78
- throw: (value: unknown) => Promise<IteratorResult<T, unknown>>;
79
- return: () => Promise<IteratorReturnResult<undefined>>;
80
- cancel: () => Promise<void>;
81
- event_id: () => string;
82
- send_chunk: (payload: Record<string, unknown>) => void;
83
- wait_for_id: () => Promise<string | null>;
84
- close_stream: () => void;
85
- }
86
- export type PredictReturn<T = unknown> = {
87
- type: EventType;
88
- time: Date;
89
- data: T;
90
- endpoint: string;
91
- fn_index: number;
92
- };
93
- export type SpaceStatus = SpaceStatusNormal | SpaceStatusError;
94
- export interface SpaceStatusNormal {
95
- status: "sleeping" | "running" | "building" | "error" | "stopped" | "starting";
96
- detail: "SLEEPING" | "RUNNING" | "RUNNING_BUILDING" | "BUILDING" | "APP_STARTING" | "NOT_FOUND";
97
- load_status: "pending" | "error" | "complete" | "generating";
98
- message: string;
99
- }
100
- export interface SpaceStatusError {
101
- status: "space_error" | "paused";
102
- detail: "NO_APP_FILE" | "CONFIG_ERROR" | "BUILD_ERROR" | "RUNTIME_ERROR" | "PAUSED";
103
- load_status: "error";
104
- message: string;
105
- discussions_enabled: boolean;
106
- }
107
- export type SpaceStatusCallback = (a: SpaceStatus) => void;
108
- export interface Config {
109
- deep_link_state?: "none" | "valid" | "invalid";
110
- auth_required?: true;
111
- app_id?: string;
112
- analytics_enabled: boolean;
113
- connect_heartbeat: boolean;
114
- dev_mode: boolean;
115
- vibe_mode: boolean;
116
- auth_message: string;
117
- components: ComponentMeta[];
118
- css: string | null;
119
- js: string | null;
120
- head: string | null;
121
- dependencies: Dependency[];
122
- enable_queue: boolean;
123
- show_error: boolean;
124
- layout: any;
125
- mode: "blocks" | "interface" | "chat_interface";
126
- root: string;
127
- root_url?: string;
128
- theme: string;
129
- title: string;
130
- version: string;
131
- space_id: string | null;
132
- is_space: boolean;
133
- is_colab: boolean;
134
- footer_links: string[];
135
- stylesheets: string[];
136
- current_page: string;
137
- page: Record<string, {
138
- components: number[];
139
- dependencies: number[];
140
- layout: any;
141
- }>;
142
- pages: [string, string, boolean][];
143
- protocol: "sse_v3" | "sse_v2.1" | "sse_v2" | "sse_v1" | "sse" | "ws";
144
- max_file_size?: number;
145
- theme_hash?: number;
146
- username: string | null;
147
- api_prefix?: string;
148
- fill_height?: boolean;
149
- fill_width?: boolean;
150
- pwa?: boolean;
151
- i18n_translations?: Record<string, Record<string, string>> | null;
152
- mcp_server?: boolean;
153
- }
154
- export interface ComponentMeta {
155
- type: string;
156
- id: number;
157
- has_modes: boolean;
158
- props: SharedProps;
159
- instance: SvelteComponent;
160
- component: ComponentType<SvelteComponent>;
161
- documentation?: Documentation;
162
- children?: ComponentMeta[];
163
- parent?: ComponentMeta;
164
- value?: any;
165
- component_class_id: string;
166
- key: string | number | null;
167
- rendered_in?: number;
168
- }
169
- interface SharedProps {
170
- elem_id?: string;
171
- elem_classes?: string[];
172
- components?: string[];
173
- server_fns?: string[];
174
- interactive: boolean;
175
- visible: boolean | "hidden";
176
- [key: string]: unknown;
177
- root_url?: string;
178
- }
179
- export interface Documentation {
180
- type?: TypeDescription;
181
- description?: TypeDescription;
182
- example_data?: string;
183
- }
184
- interface TypeDescription {
185
- input_payload?: string;
186
- response_object?: string;
187
- payload?: string;
188
- }
189
- export interface Dependency {
190
- id: number;
191
- targets: [number, string][];
192
- inputs: number[];
193
- outputs: number[];
194
- backend_fn: boolean;
195
- js: string | null;
196
- scroll_to_output: boolean;
197
- trigger: "click" | "load" | string;
198
- max_batch_size: number;
199
- show_progress: "full" | "minimal" | "hidden";
200
- show_progress_on: number[] | null;
201
- frontend_fn: ((...args: unknown[]) => Promise<unknown[]>) | null;
202
- status?: string;
203
- queue: boolean | null;
204
- every: number | null;
205
- batch: boolean;
206
- api_name: string | null;
207
- cancels: number[];
208
- types: DependencyTypes;
209
- collects_event_data: boolean;
210
- pending_request?: boolean;
211
- trigger_after?: number;
212
- trigger_only_on_success?: boolean;
213
- trigger_only_on_failure?: boolean;
214
- trigger_mode: "once" | "multiple" | "always_last";
215
- final_event: Payload | null;
216
- api_visibility: "public" | "private" | "undocumented";
217
- rendered_in: number | null;
218
- render_id: number | null;
219
- connection: "stream" | "sse";
220
- time_limit: number;
221
- stream_every: number;
222
- like_user_message: boolean;
223
- event_specific_args: string[];
224
- component_prop_inputs: number[];
225
- js_implementation: string | null;
226
- }
227
- export interface DependencyTypes {
228
- generator: boolean;
229
- cancel: boolean;
230
- }
231
- export interface Payload {
232
- fn_index: number;
233
- data: unknown[];
234
- time?: Date;
235
- event_data?: unknown;
236
- trigger_id?: number | null;
237
- }
238
- export interface PostResponse {
239
- error?: string;
240
- [x: string]: any;
241
- }
242
- export interface UploadResponse {
243
- error?: string;
244
- files?: string[];
245
- }
246
- export interface DuplicateOptions extends ClientOptions {
247
- private?: boolean;
248
- hardware?: (typeof hardware_types)[number];
249
- timeout?: number;
250
- }
251
- export interface ClientOptions {
252
- token?: `hf_${string}`;
253
- status_callback?: SpaceStatusCallback | null;
254
- auth?: [string, string] | null;
255
- with_null_state?: boolean;
256
- events?: EventType[];
257
- headers?: Record<string, string> | Headers;
258
- query_params?: Record<string, string>;
259
- session_hash?: string;
260
- cookies?: string;
261
- }
262
- export interface FileData {
263
- name: string;
264
- orig_name?: string;
265
- size?: number;
266
- data: string;
267
- blob?: File;
268
- is_file?: boolean;
269
- mime_type?: string;
270
- alt_text?: string;
271
- }
272
- export type EventType = "data" | "status" | "log" | "render";
273
- export interface EventMap {
274
- data: PayloadMessage;
275
- status: StatusMessage;
276
- log: LogMessage;
277
- render: RenderMessage;
278
- }
279
- export type GradioEvent = {
280
- [P in EventType]: EventMap[P];
281
- }[EventType];
282
- export interface Log {
283
- log: string;
284
- title: string;
285
- level: "warning" | "info" | "success" | "error";
286
- }
287
- export interface Render {
288
- data: {
289
- components: any[];
290
- layout: any;
291
- dependencies: Dependency[];
292
- render_id: number;
293
- };
294
- }
295
- export interface ValidationError {
296
- is_valid: boolean;
297
- message: string;
298
- }
299
- export interface Status {
300
- queue: boolean;
301
- code?: string;
302
- success?: boolean;
303
- stage: "pending" | "error" | "complete" | "generating" | "streaming";
304
- duration?: number;
305
- visible?: boolean;
306
- broken?: boolean;
307
- size?: number;
308
- position?: number;
309
- eta?: number;
310
- title?: string;
311
- message?: string | ValidationError[];
312
- progress_data?: {
313
- progress: number | null;
314
- index: number | null;
315
- length: number | null;
316
- unit: string | null;
317
- desc: string | null;
318
- }[];
319
- time?: Date;
320
- changed_state_ids?: number[];
321
- time_limit?: number;
322
- session_not_found?: boolean;
323
- used_cache?: "full" | "partial" | null;
324
- cache_duration?: number;
325
- avg_time?: number;
326
- }
327
- export interface StatusMessage extends Status {
328
- type: "status";
329
- endpoint: string;
330
- fn_index: number;
331
- original_msg?: string;
332
- }
333
- export interface PayloadMessage extends Payload {
334
- type: "data";
335
- endpoint: string;
336
- fn_index: number;
337
- }
338
- export interface LogMessage extends Log {
339
- type: "log";
340
- endpoint: string;
341
- fn_index: number;
342
- duration: number | null;
343
- visible: boolean;
344
- }
345
- export interface RenderMessage extends Render {
346
- type: "render";
347
- endpoint: string;
348
- fn_index: number;
349
- }
350
- export {};
351
- //# sourceMappingURL=types.d.ts.map
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
node_modules/@gradio/client/dist/types.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,MAAM,WAAW,OAAO;IACvB,KAAK,EAAE,MAAM,CAAC;IACd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B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAW,SAAQ,GAAG;IACtC,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAc,SAAQ,MAAM;IAC5C,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACjB"}
 
 
node_modules/@gradio/client/dist/upload.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import type { Client } from "./client";
2
- export declare function upload(this: Client, file_data: FileData[], root_url: string, upload_id?: string, max_file_size?: number): Promise<(FileData | null)[] | null>;
3
- export declare function prepare_files(files: File[], is_stream?: boolean): Promise<FileData[]>;
4
- export declare class FileData {
5
- path: string;
6
- url?: string;
7
- orig_name?: string;
8
- size?: number;
9
- blob?: File;
10
- is_stream?: boolean;
11
- mime_type?: string;
12
- alt_text?: string;
13
- b64?: string;
14
- readonly meta: {
15
- _type: string;
16
- };
17
- constructor({ path, url, orig_name, size, blob, is_stream, mime_type, alt_text, b64 }: {
18
- path: string;
19
- url?: string;
20
- orig_name?: string;
21
- size?: number;
22
- blob?: File;
23
- is_stream?: boolean;
24
- mime_type?: string;
25
- alt_text?: string;
26
- b64?: string;
27
- });
28
- }
29
- //# sourceMappingURL=upload.d.ts.map