@netlify/spark-ui 1.25.0 → 1.26.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/assets/DropZone.css +1 -0
  2. package/dist/chunks/{AskNetlify.jaxhKBOK.js → AskNetlify.bx0blyGV.js} +124 -126
  3. package/dist/chunks/_commonjsHelpers.C6fGbg64.js +6 -0
  4. package/dist/chunks/browser.D58rdxmc.js +444 -0
  5. package/dist/components/index.d.ts +3 -0
  6. package/dist/components/preact/AskNetlify/AskNetlify.js +1 -1
  7. package/dist/components/preact/DropZone/DropZone.d.ts +19 -0
  8. package/dist/components/preact/DropZone/DropZone.js +207 -0
  9. package/dist/components/preact/DropZone/drop-core/client.d.ts +19 -0
  10. package/dist/components/preact/DropZone/drop-core/client.js +41 -0
  11. package/dist/components/preact/DropZone/drop-core/deploy.d.ts +6 -0
  12. package/dist/components/preact/DropZone/drop-core/deploy.js +30 -0
  13. package/dist/components/preact/DropZone/drop-core/digest.d.ts +3 -0
  14. package/dist/components/preact/DropZone/drop-core/digest.js +12 -0
  15. package/dist/components/preact/DropZone/drop-core/index.d.ts +5 -0
  16. package/dist/components/preact/DropZone/drop-core/index.js +16 -0
  17. package/dist/components/preact/DropZone/drop-core/readFiles.d.ts +15 -0
  18. package/dist/components/preact/DropZone/drop-core/readFiles.js +616 -0
  19. package/dist/components/preact/DropZone/drop-core/types.d.ts +30 -0
  20. package/dist/components/preact/DropZone/drop-core/types.js +1 -0
  21. package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +1 -1
  22. package/dist/components/preact/index.js +1 -1
  23. package/package.json +4 -2
  24. package/packages/components/index.ts +16 -0
  25. package/packages/components/preact/DropZone/DropZone.css +340 -0
  26. package/packages/components/preact/DropZone/DropZone.tsx +295 -0
  27. package/packages/components/preact/DropZone/drop-core/client.ts +61 -0
  28. package/packages/components/preact/DropZone/drop-core/deploy.ts +55 -0
  29. package/packages/components/preact/DropZone/drop-core/digest.ts +11 -0
  30. package/packages/components/preact/DropZone/drop-core/index.ts +5 -0
  31. package/packages/components/preact/DropZone/drop-core/readFiles.ts +136 -0
  32. package/packages/components/preact/DropZone/drop-core/types.ts +35 -0
@@ -0,0 +1,6 @@
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3
+ }
4
+ export {
5
+ e as g
6
+ };
@@ -0,0 +1,444 @@
1
+ var sr = {}, qr = function(r, e, n, a, f) {
2
+ var t = new Worker(sr[e] || (sr[e] = URL.createObjectURL(new Blob([
3
+ r + ';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'
4
+ ], { type: "text/javascript" }))));
5
+ return t.onmessage = function(v) {
6
+ var o = v.data, u = o.$e$;
7
+ if (u) {
8
+ var s = new Error(u[0]);
9
+ s.code = u[1], s.stack = u[2], f(s, null);
10
+ } else
11
+ f(null, o);
12
+ }, t.postMessage(n, a), t;
13
+ }, m = Uint8Array, B = Uint16Array, wr = Int32Array, rr = new m([
14
+ 0,
15
+ 0,
16
+ 0,
17
+ 0,
18
+ 0,
19
+ 0,
20
+ 0,
21
+ 0,
22
+ 1,
23
+ 1,
24
+ 1,
25
+ 1,
26
+ 2,
27
+ 2,
28
+ 2,
29
+ 2,
30
+ 3,
31
+ 3,
32
+ 3,
33
+ 3,
34
+ 4,
35
+ 4,
36
+ 4,
37
+ 4,
38
+ 5,
39
+ 5,
40
+ 5,
41
+ 5,
42
+ 0,
43
+ /* unused */
44
+ 0,
45
+ 0,
46
+ /* impossible */
47
+ 0
48
+ ]), er = new m([
49
+ 0,
50
+ 0,
51
+ 0,
52
+ 0,
53
+ 1,
54
+ 1,
55
+ 2,
56
+ 2,
57
+ 3,
58
+ 3,
59
+ 4,
60
+ 4,
61
+ 5,
62
+ 5,
63
+ 6,
64
+ 6,
65
+ 7,
66
+ 7,
67
+ 8,
68
+ 8,
69
+ 9,
70
+ 9,
71
+ 10,
72
+ 10,
73
+ 11,
74
+ 11,
75
+ 12,
76
+ 12,
77
+ 13,
78
+ 13,
79
+ /* unused */
80
+ 0,
81
+ 0
82
+ ]), pr = new m([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), mr = function(r, e) {
83
+ for (var n = new B(31), a = 0; a < 31; ++a)
84
+ n[a] = e += 1 << r[a - 1];
85
+ for (var f = new wr(n[30]), a = 1; a < 30; ++a)
86
+ for (var t = n[a]; t < n[a + 1]; ++t)
87
+ f[t] = t - n[a] << 5 | a;
88
+ return { b: n, r: f };
89
+ }, yr = mr(rr, 2), nr = yr.b, Dr = yr.r;
90
+ nr[28] = 258, Dr[258] = 28;
91
+ var Ir = mr(er, 0), xr = Ir.b, X = new B(32768);
92
+ for (var c = 0; c < 32768; ++c) {
93
+ var U = (c & 43690) >> 1 | (c & 21845) << 1;
94
+ U = (U & 52428) >> 2 | (U & 13107) << 2, U = (U & 61680) >> 4 | (U & 3855) << 4, X[c] = ((U & 65280) >> 8 | (U & 255) << 8) >> 1;
95
+ }
96
+ var W = function(r, e, n) {
97
+ for (var a = r.length, f = 0, t = new B(e); f < a; ++f)
98
+ r[f] && ++t[r[f] - 1];
99
+ var v = new B(e);
100
+ for (f = 1; f < e; ++f)
101
+ v[f] = v[f - 1] + t[f - 1] << 1;
102
+ var o;
103
+ if (n) {
104
+ o = new B(1 << e);
105
+ var u = 15 - e;
106
+ for (f = 0; f < a; ++f)
107
+ if (r[f])
108
+ for (var s = f << 4 | r[f], g = e - r[f], i = v[r[f] - 1]++ << g, l = i | (1 << g) - 1; i <= l; ++i)
109
+ o[X[i] >> u] = s;
110
+ } else
111
+ for (o = new B(a), f = 0; f < a; ++f)
112
+ r[f] && (o[f] = X[v[r[f] - 1]++] >> 15 - r[f]);
113
+ return o;
114
+ }, K = new m(288);
115
+ for (var c = 0; c < 144; ++c)
116
+ K[c] = 8;
117
+ for (var c = 144; c < 256; ++c)
118
+ K[c] = 9;
119
+ for (var c = 256; c < 280; ++c)
120
+ K[c] = 7;
121
+ for (var c = 280; c < 288; ++c)
122
+ K[c] = 8;
123
+ var kr = new m(32);
124
+ for (var c = 0; c < 32; ++c)
125
+ kr[c] = 5;
126
+ var Cr = /* @__PURE__ */ W(K, 9, 1), Fr = /* @__PURE__ */ W(kr, 5, 1), Q = function(r) {
127
+ for (var e = r[0], n = 1; n < r.length; ++n)
128
+ r[n] > e && (e = r[n]);
129
+ return e;
130
+ }, C = function(r, e, n) {
131
+ var a = e / 8 | 0;
132
+ return (r[a] | r[a + 1] << 8) >> (e & 7) & n;
133
+ }, V = function(r, e) {
134
+ var n = e / 8 | 0;
135
+ return (r[n] | r[n + 1] << 8 | r[n + 2] << 16) >> (e & 7);
136
+ }, Mr = function(r) {
137
+ return (r + 7) / 8 | 0;
138
+ }, Y = function(r, e, n) {
139
+ return (e == null || e < 0) && (e = 0), (n == null || n > r.length) && (n = r.length), new m(r.subarray(e, n));
140
+ }, Ar = [
141
+ "unexpected EOF",
142
+ "invalid block type",
143
+ "invalid length/literal",
144
+ "invalid distance",
145
+ "stream finished",
146
+ "no stream handler",
147
+ ,
148
+ // determined by compression function
149
+ "no callback",
150
+ "invalid UTF-8 data",
151
+ "extra field too long",
152
+ "date not in range 1980-2099",
153
+ "filename too long",
154
+ "stream finishing",
155
+ "invalid zip data"
156
+ // determined by unknown compression method
157
+ ], w = function(r, e, n) {
158
+ var a = new Error(e || Ar[r]);
159
+ if (a.code = r, Error.captureStackTrace && Error.captureStackTrace(a, w), !n)
160
+ throw a;
161
+ return a;
162
+ }, Or = function(r, e, n, a) {
163
+ var f = r.length, t = a ? a.length : 0;
164
+ if (!f || e.f && !e.l)
165
+ return n || new m(0);
166
+ var v = !n, o = v || e.i != 2, u = e.i;
167
+ v && (n = new m(f * 3));
168
+ var s = function(ur) {
169
+ var lr = n.length;
170
+ if (ur > lr) {
171
+ var cr = new m(Math.max(lr * 2, ur));
172
+ cr.set(n), n = cr;
173
+ }
174
+ }, g = e.f || 0, i = e.p || 0, l = e.b || 0, M = e.l, $ = e.d, O = e.m, y = e.n, x = f * 8;
175
+ do {
176
+ if (!M) {
177
+ g = C(r, i, 1);
178
+ var T = C(r, i + 1, 3);
179
+ if (i += 3, T)
180
+ if (T == 1)
181
+ M = Cr, $ = Fr, O = 9, y = 5;
182
+ else if (T == 2) {
183
+ var G = C(r, i, 31) + 257, L = C(r, i + 10, 15) + 4, z = G + C(r, i + 5, 31) + 1;
184
+ i += 14;
185
+ for (var k = new m(z), D = new m(19), h = 0; h < L; ++h)
186
+ D[pr[h]] = C(r, i + h * 3, 7);
187
+ i += L * 3;
188
+ for (var H = Q(D), Er = (1 << H) - 1, Ur = W(D, H, 1), h = 0; h < z; ) {
189
+ var fr = Ur[C(r, i, Er)];
190
+ i += fr & 15;
191
+ var p = fr >> 4;
192
+ if (p < 16)
193
+ k[h++] = p;
194
+ else {
195
+ var I = 0, N = 0;
196
+ for (p == 16 ? (N = 3 + C(r, i, 3), i += 2, I = k[h - 1]) : p == 17 ? (N = 3 + C(r, i, 7), i += 3) : p == 18 && (N = 11 + C(r, i, 127), i += 7); N--; )
197
+ k[h++] = I;
198
+ }
199
+ }
200
+ var ir = k.subarray(0, G), E = k.subarray(G);
201
+ O = Q(ir), y = Q(E), M = W(ir, O, 1), $ = W(E, y, 1);
202
+ } else
203
+ w(1);
204
+ else {
205
+ var p = Mr(i) + 4, S = r[p - 4] | r[p - 3] << 8, q = p + S;
206
+ if (q > f) {
207
+ u && w(0);
208
+ break;
209
+ }
210
+ o && s(l + S), n.set(r.subarray(p, q), l), e.b = l += S, e.p = i = q * 8, e.f = g;
211
+ continue;
212
+ }
213
+ if (i > x) {
214
+ u && w(0);
215
+ break;
216
+ }
217
+ }
218
+ o && s(l + 131072);
219
+ for (var zr = (1 << O) - 1, Br = (1 << y) - 1, Z = i; ; Z = i) {
220
+ var I = M[V(r, i) & zr], R = I >> 4;
221
+ if (i += I & 15, i > x) {
222
+ u && w(0);
223
+ break;
224
+ }
225
+ if (I || w(2), R < 256)
226
+ n[l++] = R;
227
+ else if (R == 256) {
228
+ Z = i, M = null;
229
+ break;
230
+ } else {
231
+ var or = R - 254;
232
+ if (R > 264) {
233
+ var h = R - 257, J = rr[h];
234
+ or = C(r, i, (1 << J) - 1) + nr[h], i += J;
235
+ }
236
+ var j = $[V(r, i) & Br], _ = j >> 4;
237
+ j || w(3), i += j & 15;
238
+ var E = xr[_];
239
+ if (_ > 3) {
240
+ var J = er[_];
241
+ E += V(r, i) & (1 << J) - 1, i += J;
242
+ }
243
+ if (i > x) {
244
+ u && w(0);
245
+ break;
246
+ }
247
+ o && s(l + 131072);
248
+ var vr = l + or;
249
+ if (l < E) {
250
+ var tr = t - E, $r = Math.min(E, vr);
251
+ for (tr + l < 0 && w(3); l < $r; ++l)
252
+ n[l] = a[tr + l];
253
+ }
254
+ for (; l < vr; ++l)
255
+ n[l] = n[l - E];
256
+ }
257
+ }
258
+ e.l = M, e.p = Z, e.b = l, e.f = g, M && (g = 1, e.m = O, e.d = $, e.n = y);
259
+ } while (!g);
260
+ return l != n.length && v ? Y(n, 0, l) : n.subarray(0, l);
261
+ }, Rr = /* @__PURE__ */ new m(0), Wr = function(r, e) {
262
+ var n = {};
263
+ for (var a in r)
264
+ n[a] = r[a];
265
+ for (var a in e)
266
+ n[a] = e[a];
267
+ return n;
268
+ }, gr = function(r, e, n) {
269
+ for (var a = r(), f = r.toString(), t = f.slice(f.indexOf("[") + 1, f.lastIndexOf("]")).replace(/\s+/g, "").split(","), v = 0; v < a.length; ++v) {
270
+ var o = a[v], u = t[v];
271
+ if (typeof o == "function") {
272
+ e += ";" + u + "=";
273
+ var s = o.toString();
274
+ if (o.prototype)
275
+ if (s.indexOf("[native code]") != -1) {
276
+ var g = s.indexOf(" ", 8) + 1;
277
+ e += s.slice(g, s.indexOf("(", g));
278
+ } else {
279
+ e += s;
280
+ for (var i in o.prototype)
281
+ e += ";" + u + ".prototype." + i + "=" + o.prototype[i].toString();
282
+ }
283
+ else
284
+ e += s;
285
+ } else
286
+ n[u] = o;
287
+ }
288
+ return e;
289
+ }, P = [], Gr = function(r) {
290
+ var e = [];
291
+ for (var n in r)
292
+ r[n].buffer && e.push((r[n] = new r[n].constructor(r[n])).buffer);
293
+ return e;
294
+ }, Hr = function(r, e, n, a) {
295
+ if (!P[n]) {
296
+ for (var f = "", t = {}, v = r.length - 1, o = 0; o < v; ++o)
297
+ f = gr(r[o], f, t);
298
+ P[n] = { c: gr(r[v], f, t), e: t };
299
+ }
300
+ var u = Wr({}, P[n].e);
301
+ return qr(P[n].c + ";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=" + e.toString() + "}", n, u, Gr(u), a);
302
+ }, Jr = function() {
303
+ return [m, B, wr, rr, er, pr, nr, xr, Cr, Fr, X, Ar, W, Q, C, V, Mr, Y, w, Or, ar, Sr, Tr];
304
+ }, Sr = function(r) {
305
+ return postMessage(r, [r.buffer]);
306
+ }, Tr = function(r) {
307
+ return r && {
308
+ out: r.size && new m(r.size),
309
+ dictionary: r.dictionary
310
+ };
311
+ }, Kr = function(r, e, n, a, f, t) {
312
+ var v = Hr(n, a, f, function(o, u) {
313
+ v.terminate(), t(o, u);
314
+ });
315
+ return v.postMessage([r, e], e.consume ? [r.buffer] : []), function() {
316
+ v.terminate();
317
+ };
318
+ }, A = function(r, e) {
319
+ return r[e] | r[e + 1] << 8;
320
+ }, F = function(r, e) {
321
+ return (r[e] | r[e + 1] << 8 | r[e + 2] << 16 | r[e + 3] << 24) >>> 0;
322
+ }, b = function(r, e) {
323
+ return F(r, e) + F(r, e + 4) * 4294967296;
324
+ };
325
+ function Lr(r, e, n) {
326
+ return n || (n = e, e = {}), typeof n != "function" && w(7), Kr(r, e, [
327
+ Jr
328
+ ], function(a) {
329
+ return Sr(ar(a.data[0], Tr(a.data[1])));
330
+ }, 1, n);
331
+ }
332
+ function ar(r, e) {
333
+ return Or(r, { i: 2 }, e && e.out, e && e.dictionary);
334
+ }
335
+ var d = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), Nr = 0;
336
+ try {
337
+ d.decode(Rr, { stream: !0 }), Nr = 1;
338
+ } catch {
339
+ }
340
+ var Pr = function(r) {
341
+ for (var e = "", n = 0; ; ) {
342
+ var a = r[n++], f = (a > 127) + (a > 223) + (a > 239);
343
+ if (n + f > r.length)
344
+ return { s: e, r: Y(r, n - 1) };
345
+ f ? f == 3 ? (a = ((a & 15) << 18 | (r[n++] & 63) << 12 | (r[n++] & 63) << 6 | r[n++] & 63) - 65536, e += String.fromCharCode(55296 | a >> 10, 56320 | a & 1023)) : f & 1 ? e += String.fromCharCode((a & 31) << 6 | r[n++] & 63) : e += String.fromCharCode((a & 15) << 12 | (r[n++] & 63) << 6 | r[n++] & 63) : e += String.fromCharCode(a);
346
+ }
347
+ };
348
+ function Qr(r, e) {
349
+ if (e) {
350
+ for (var n = "", a = 0; a < r.length; a += 16384)
351
+ n += String.fromCharCode.apply(null, r.subarray(a, a + 16384));
352
+ return n;
353
+ } else {
354
+ if (d)
355
+ return d.decode(r);
356
+ var f = Pr(r), t = f.s, n = f.r;
357
+ return n.length && w(8), t;
358
+ }
359
+ }
360
+ var Vr = function(r, e) {
361
+ return e + 30 + A(r, e + 26) + A(r, e + 28);
362
+ }, Xr = function(r, e, n) {
363
+ var a = A(r, e + 28), f = A(r, e + 30), t = Qr(r.subarray(e + 46, e + 46 + a), !(A(r, e + 8) & 2048)), v = e + 46 + a, o = Yr(r, v, f, n, F(r, e + 20), F(r, e + 24), F(r, e + 42)), u = o[0], s = o[1], g = o[2];
364
+ return [A(r, e + 10), u, s, t, v + f + A(r, e + 32), g];
365
+ }, Yr = function(r, e, n, a, f, t, v) {
366
+ var o = f == 4294967295, u = t == 4294967295, s = v == 4294967295, g = e + n, i = o + u + s;
367
+ if (a && i) {
368
+ for (; e + 4 < g; e += 4 + A(r, e + 2))
369
+ if (A(r, e) == 1)
370
+ return [
371
+ o ? b(r, e + 4 + 8 * u) : f,
372
+ u ? b(r, e + 4) : t,
373
+ s ? b(r, e + 4 + 8 * (u + o)) : v,
374
+ 1
375
+ ];
376
+ a < 2 && w(13);
377
+ }
378
+ return [f, t, v, 0];
379
+ }, hr = typeof queueMicrotask == "function" ? queueMicrotask : typeof setTimeout == "function" ? setTimeout : function(r) {
380
+ r();
381
+ };
382
+ function Zr(r, e, n) {
383
+ n || (n = e, e = {}), typeof n != "function" && w(7);
384
+ var a = [], f = function() {
385
+ for (var y = 0; y < a.length; ++y)
386
+ a[y]();
387
+ }, t = {}, v = function(y, x) {
388
+ hr(function() {
389
+ n(y, x);
390
+ });
391
+ };
392
+ hr(function() {
393
+ v = n;
394
+ });
395
+ for (var o = r.length - 22; F(r, o) != 101010256; --o)
396
+ if (!o || r.length - o > 65558)
397
+ return v(w(13, 0, 1), null), f;
398
+ var u = A(r, o + 8);
399
+ if (u) {
400
+ var s = u, g = F(r, o + 16), i = F(r, o - 20) == 117853008;
401
+ if (i) {
402
+ var l = F(r, o - 12);
403
+ i = F(r, l) == 101075792, i && (s = u = F(r, l + 32), g = F(r, l + 48));
404
+ }
405
+ for (var M = e && e.filter, $ = function(y) {
406
+ var x = Xr(r, g, i), T = x[0], p = x[1], S = x[2], q = x[3], G = x[4], L = x[5], z = Vr(r, L);
407
+ g = G;
408
+ var k = function(h, H) {
409
+ h ? (f(), v(h, null)) : (H && (t[q] = H), --u || v(null, t));
410
+ };
411
+ if (!M || M({
412
+ name: q,
413
+ size: p,
414
+ originalSize: S,
415
+ compression: T
416
+ }))
417
+ if (!T)
418
+ k(null, Y(r, z, z + p));
419
+ else if (T == 8) {
420
+ var D = r.subarray(z, z + p);
421
+ if (S < 524288 || p > 0.8 * S)
422
+ try {
423
+ k(null, ar(D, { out: new m(S) }));
424
+ } catch (h) {
425
+ k(h, null);
426
+ }
427
+ else
428
+ a.push(Lr(D, { size: S }, k));
429
+ } else
430
+ k(w(14, "unknown compression type " + T, 1), null);
431
+ else
432
+ k(null, null);
433
+ }, O = 0; O < s; ++O)
434
+ $(O);
435
+ } else
436
+ v(null, {});
437
+ return f;
438
+ }
439
+ export {
440
+ Lr as inflate,
441
+ ar as inflateSync,
442
+ Qr as strFromU8,
443
+ Zr as unzip
444
+ };
@@ -5,4 +5,7 @@ export { default as SearchLink } from './preact/SearchModal/components/SearchLin
5
5
  export { default as SearchHeading } from './preact/SearchModal/components/SearchHeading/SearchHeading';
6
6
  export { default as SearchToggle } from './preact/SearchModal/components/SearchToggle/SearchToggle';
7
7
  export { default as SearchModal } from './preact/SearchModal/components/SearchModal/SearchModal';
8
+ export { default as DropZone } from './preact/DropZone/DropZone';
9
+ export { AnonymousDropClient, deployFiles, readDataTransfer, readFileList, } from './preact/DropZone/drop-core';
10
+ export type { DropClient, Deploy, Digest, DeployResult, DeployProgress, DeployPhase, ProcessedFile, } from './preact/DropZone/drop-core';
8
11
  export { type IconName } from './preact/Icon';
@@ -1,6 +1,6 @@
1
1
  import "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import "../../../chunks/hooks.module.DRcxknIz.js";
3
- import { A as d } from "../../../chunks/AskNetlify.jaxhKBOK.js";
3
+ import { A as d } from "../../../chunks/AskNetlify.bx0blyGV.js";
4
4
  import "./components/QuestionList/questions.js";
5
5
  import "./components/QuestionList/QuestionList.js";
6
6
  import "./components/BackButton.js";
@@ -0,0 +1,19 @@
1
+ import { DropClient } from './drop-core';
2
+ interface Props {
3
+ /** Override the API base (e.g. for a staging environment). */
4
+ apiBase?: string;
5
+ /** Inject a custom client (e.g. for testing). Defaults to AnonymousDropClient. */
6
+ client?: DropClient;
7
+ /** Build the "claim this site" URL from the assigned site name (subdomain). */
8
+ claimUrl?: (siteName: string) => string;
9
+ /** Called once the deploy is live. */
10
+ onDeploy?: (result: {
11
+ url: string;
12
+ token: string;
13
+ siteName: string;
14
+ siteId: string;
15
+ }) => void;
16
+ className?: string;
17
+ }
18
+ export default function DropZone({ apiBase, client, claimUrl, onDeploy, className, }: Props): import("preact").JSX.Element;
19
+ export {};
@@ -0,0 +1,207 @@
1
+ import { u as e } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import { d as k, A as I } from "../../../chunks/hooks.module.DRcxknIz.js";
3
+ import b from "../Icon/index.js";
4
+ import { getSingleNonIndexHtmlFileName as $, hasMultipleHtmlFilesWithoutIndex as D, readDataTransfer as F, readFileList as T } from "./drop-core/readFiles.js";
5
+ import { AnonymousDropClient as M } from "./drop-core/client.js";
6
+ import { deployFiles as P } from "./drop-core/deploy.js";
7
+ import { Fragment as p } from "preact";
8
+ import '../../../assets/DropZone.css';const U = (n) => `https://app.netlify.com/drop/${n}/claim`;
9
+ function A(n) {
10
+ switch (n.phase) {
11
+ case "creating":
12
+ return { kind: "creating" };
13
+ case "uploading":
14
+ return { kind: "uploading", uploaded: n.uploaded ?? 0, total: n.total ?? 0 };
15
+ case "processing":
16
+ case "ready":
17
+ return { kind: "processing" };
18
+ }
19
+ }
20
+ function Y({
21
+ apiBase: n,
22
+ client: h,
23
+ claimUrl: d = U,
24
+ onDeploy: s,
25
+ className: l
26
+ }) {
27
+ const [o, t] = k({ kind: "idle" }), [w, c] = k(null), [C, g] = k(!1), x = I(h ?? new M(n)).current, f = o.kind !== "idle" && o.kind !== "done" && o.kind !== "error";
28
+ async function z(i) {
29
+ c(null), t({ kind: "reading" });
30
+ try {
31
+ const r = await i();
32
+ if (!r.length) {
33
+ t({ kind: "error", message: "No files found to deploy." });
34
+ return;
35
+ }
36
+ const y = $(r);
37
+ y ? c(`No index.html found — "${y}" won’t be served at the site root.`) : D(r) && c("No index.html found — your site may not have a landing page.");
38
+ const { url: v, token: m, deploy: a } = await P(x, r, {
39
+ onProgress: (S) => t(A(S))
40
+ });
41
+ try {
42
+ localStorage.setItem("drop-token", m), localStorage.setItem("dropSiteName", a.subdomain);
43
+ } catch {
44
+ }
45
+ t({ kind: "done", url: v, token: m, siteName: a.subdomain, siteId: a.id }), s == null || s({ url: v, token: m, siteName: a.subdomain, siteId: a.id });
46
+ } catch (r) {
47
+ t({ kind: "error", message: r instanceof Error ? r.message : String(r) });
48
+ }
49
+ }
50
+ function N() {
51
+ c(null), t({ kind: "idle" });
52
+ }
53
+ return /* @__PURE__ */ e(
54
+ "div",
55
+ {
56
+ class: `n-dropzone${C ? " is-active" : ""}${f ? " is-busy" : ""}${l ? ` ${l}` : ""}`,
57
+ "data-state": o.kind,
58
+ onDragOver: (i) => {
59
+ f || (i.preventDefault(), g(!0));
60
+ },
61
+ onDragLeave: (i) => {
62
+ i.currentTarget === i.target && g(!1);
63
+ },
64
+ onDrop: (i) => {
65
+ if (i.preventDefault(), g(!1), f) return;
66
+ const r = i.dataTransfer;
67
+ r && z(() => F(r));
68
+ },
69
+ children: [
70
+ /* @__PURE__ */ e("div", { class: "n-dropzone-panel", children: /* @__PURE__ */ e(B, { status: o, claimUrl: d, onReset: N, onFiles: z }) }, o.kind),
71
+ w && o.kind !== "error" && /* @__PURE__ */ e("p", { class: "n-dropzone-warning n-fadeIn", role: "status", children: [
72
+ /* @__PURE__ */ e(b, { name: "lightbulb", className: "n-dropzone-warning-icon" }),
73
+ w
74
+ ] })
75
+ ]
76
+ }
77
+ );
78
+ }
79
+ function B({
80
+ status: n,
81
+ claimUrl: h,
82
+ onReset: d,
83
+ onFiles: s
84
+ }) {
85
+ switch (n.kind) {
86
+ case "idle":
87
+ return /* @__PURE__ */ e(p, { children: [
88
+ /* @__PURE__ */ e(L, {}),
89
+ /* @__PURE__ */ e("p", { class: "n-dropzone-title", children: "Drag & drop your site folder or zip" }),
90
+ /* @__PURE__ */ e("p", { class: "n-dropzone-subtitle", children: "Deploys instantly to a live URL — no account needed." }),
91
+ /* @__PURE__ */ e("label", { class: "n-dropzone-browse", children: [
92
+ "Browse files",
93
+ /* @__PURE__ */ e(
94
+ "input",
95
+ {
96
+ type: "file",
97
+ hidden: !0,
98
+ multiple: !0,
99
+ webkitdirectory: "",
100
+ directory: "",
101
+ onChange: (l) => {
102
+ var t;
103
+ const o = l.currentTarget;
104
+ (t = o.files) != null && t.length && s(() => T(o.files));
105
+ }
106
+ }
107
+ )
108
+ ] })
109
+ ] });
110
+ case "reading":
111
+ return /* @__PURE__ */ e(u, { label: "Reading files…" });
112
+ case "creating":
113
+ return /* @__PURE__ */ e(u, { label: "Creating deploy…" });
114
+ case "processing":
115
+ return /* @__PURE__ */ e(u, { label: "Processing — almost live…" });
116
+ case "uploading": {
117
+ const l = n.total ? Math.round(n.uploaded / n.total * 100) : 0;
118
+ return /* @__PURE__ */ e(p, { children: [
119
+ /* @__PURE__ */ e(u, { label: `Uploading ${n.uploaded}/${n.total} files…` }),
120
+ /* @__PURE__ */ e("div", { class: "n-dropzone-progress", role: "progressbar", "aria-valuenow": l, children: /* @__PURE__ */ e("div", { class: "n-dropzone-progress-bar", style: { width: `${l}%` } }) })
121
+ ] });
122
+ }
123
+ case "done":
124
+ return /* @__PURE__ */ e(p, { children: [
125
+ /* @__PURE__ */ e(j, {}),
126
+ /* @__PURE__ */ e("p", { class: "n-dropzone-title", children: "Your site is live!" }),
127
+ /* @__PURE__ */ e("a", { class: "n-dropzone-link", href: n.url, target: "_blank", rel: "noopener noreferrer", children: [
128
+ n.url.replace(/^https?:\/\//, ""),
129
+ /* @__PURE__ */ e(b, { name: "link", className: "n-dropzone-link-icon" })
130
+ ] }),
131
+ /* @__PURE__ */ e("div", { class: "n-dropzone-actions", children: [
132
+ /* @__PURE__ */ e("a", { class: "n-dropzone-browse", href: h(n.siteName), children: "Claim this site" }),
133
+ /* @__PURE__ */ e("button", { type: "button", class: "n-dropzone-reset", onClick: d, children: "Deploy another" })
134
+ ] })
135
+ ] });
136
+ case "error":
137
+ return /* @__PURE__ */ e(p, { children: [
138
+ /* @__PURE__ */ e("p", { class: "n-dropzone-title n-dropzone-title--error", children: "Something went wrong" }),
139
+ /* @__PURE__ */ e("p", { class: "n-dropzone-subtitle", role: "alert", children: n.message }),
140
+ /* @__PURE__ */ e("button", { type: "button", class: "n-dropzone-browse", onClick: d, children: "Try again" })
141
+ ] });
142
+ }
143
+ }
144
+ function u({ label: n }) {
145
+ return /* @__PURE__ */ e("div", { class: "n-dropzone-loading", children: [
146
+ /* @__PURE__ */ e("span", { class: "n-dropzone-spinner", "aria-hidden": "true" }),
147
+ /* @__PURE__ */ e("p", { class: "n-dropzone-subtitle", "aria-live": "polite", children: [
148
+ n,
149
+ " ",
150
+ /* @__PURE__ */ e("span", { class: "n-dropzone-nudge", children: "Please don’t refresh." })
151
+ ] })
152
+ ] });
153
+ }
154
+ function L() {
155
+ return /* @__PURE__ */ e("span", { class: "n-dropzone-glyph", "aria-hidden": "true", children: /* @__PURE__ */ e("svg", { viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
156
+ /* @__PURE__ */ e(
157
+ "path",
158
+ {
159
+ class: "n-dropzone-glyph-tray",
160
+ d: "M8 30v6a4 4 0 0 0 4 4h24a4 4 0 0 0 4-4v-6",
161
+ stroke: "currentColor",
162
+ "stroke-width": "3",
163
+ "stroke-linecap": "round"
164
+ }
165
+ ),
166
+ /* @__PURE__ */ e(
167
+ "path",
168
+ {
169
+ class: "n-dropzone-glyph-arrow",
170
+ d: "M24 32V10m0 0-8 8m8-8 8 8",
171
+ stroke: "currentColor",
172
+ "stroke-width": "3",
173
+ "stroke-linecap": "round",
174
+ "stroke-linejoin": "round"
175
+ }
176
+ )
177
+ ] }) });
178
+ }
179
+ function j() {
180
+ return /* @__PURE__ */ e("span", { class: "n-dropzone-glyph n-dropzone-glyph--success", "aria-hidden": "true", children: /* @__PURE__ */ e("svg", { viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
181
+ /* @__PURE__ */ e(
182
+ "circle",
183
+ {
184
+ class: "n-dropzone-check-ring",
185
+ cx: "24",
186
+ cy: "24",
187
+ r: "20",
188
+ stroke: "currentColor",
189
+ "stroke-width": "3"
190
+ }
191
+ ),
192
+ /* @__PURE__ */ e(
193
+ "path",
194
+ {
195
+ class: "n-dropzone-check-mark",
196
+ d: "M15 24.5 21 30.5 33 18",
197
+ stroke: "currentColor",
198
+ "stroke-width": "3",
199
+ "stroke-linecap": "round",
200
+ "stroke-linejoin": "round"
201
+ }
202
+ )
203
+ ] }) });
204
+ }
205
+ export {
206
+ Y as default
207
+ };