@qwanyx/stack 0.2.15 → 0.2.17

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.
package/dist/index.esm.js CHANGED
@@ -1,15 +1,15 @@
1
1
  var zt = Object.defineProperty;
2
2
  var Gt = (o, e, r) => e in o ? zt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[e] = r;
3
- var Ee = (o, e, r) => Gt(o, typeof e != "symbol" ? e + "" : e, r);
4
- import vt, { useState as U, useCallback as Y, useEffect as pe, useMemo as Et, useRef as dt } from "react";
3
+ var ve = (o, e, r) => Gt(o, typeof e != "symbol" ? e + "" : e, r);
4
+ import st, { useState as P, useCallback as H, useEffect as pe, useMemo as vt, useRef as ft } from "react";
5
5
  class yr {
6
6
  constructor(e) {
7
- Ee(this, "config");
7
+ ve(this, "config");
8
8
  // ===== FILE OPERATIONS =====
9
9
  /**
10
10
  * Options for file upload
11
11
  */
12
- Ee(this, "defaultUploadOptions", {
12
+ ve(this, "defaultUploadOptions", {
13
13
  maxSizeMB: 10,
14
14
  maxImageDimension: 0,
15
15
  // 0 = no resize
@@ -30,7 +30,7 @@ class yr {
30
30
  params: r
31
31
  };
32
32
  try {
33
- const a = await fetch(`${this.config.baseUrl}/spu/invoke`, {
33
+ const s = await fetch(`${this.config.baseUrl}/spu/invoke`, {
34
34
  method: "POST",
35
35
  headers: {
36
36
  "Content-Type": "application/json",
@@ -38,16 +38,16 @@ class yr {
38
38
  },
39
39
  body: JSON.stringify(u)
40
40
  });
41
- if (!a.ok) {
42
- const t = await a.text();
43
- throw new Error(`API error (${a.status}): ${t}`);
41
+ if (!s.ok) {
42
+ const t = await s.text();
43
+ throw new Error(`API error (${s.status}): ${t}`);
44
44
  }
45
- const n = await a.json();
45
+ const n = await s.json();
46
46
  if (!n.success && n.error)
47
47
  throw new Error(n.error);
48
48
  return n;
49
- } catch (a) {
50
- throw console.error("Graph API call failed:", a), a;
49
+ } catch (s) {
50
+ throw console.error("Graph API call failed:", s), s;
51
51
  }
52
52
  }
53
53
  /**
@@ -96,10 +96,10 @@ class yr {
96
96
  ...r,
97
97
  modified: (/* @__PURE__ */ new Date()).toISOString()
98
98
  }
99
- }, a = await this.callGraph("update_node", u);
100
- if (!a.result)
99
+ }, s = await this.callGraph("update_node", u);
100
+ if (!s.result)
101
101
  throw new Error("Failed to update node");
102
- return a.result;
102
+ return s.result;
103
103
  }
104
104
  /**
105
105
  * Delete a node
@@ -114,23 +114,23 @@ class yr {
114
114
  /**
115
115
  * Get children with edges (supports different display modes)
116
116
  */
117
- async getChildrenWithEdges(e, r = "children", u, a) {
117
+ async getChildrenWithEdges(e, r = "children", u, s) {
118
118
  return (await this.callGraph("get_children_with_edges", {
119
119
  node_id: e,
120
120
  display_mode: r,
121
121
  edge_type: u,
122
- node_type: a
122
+ node_type: s
123
123
  })).result || [];
124
124
  }
125
125
  /**
126
126
  * Add an edge between two nodes
127
127
  */
128
- async addEdge(e, r, u = "link", a) {
128
+ async addEdge(e, r, u = "link", s) {
129
129
  return await this.callGraph("add_edge", {
130
130
  source_id: e,
131
131
  target_id: r,
132
132
  edge_type: u,
133
- data: a
133
+ data: s
134
134
  });
135
135
  }
136
136
  /**
@@ -209,11 +209,11 @@ class yr {
209
209
  */
210
210
  fileToBase64(e) {
211
211
  return new Promise((r, u) => {
212
- const a = new FileReader();
213
- a.onload = () => {
214
- const t = a.result.split(",")[1];
212
+ const s = new FileReader();
213
+ s.onload = () => {
214
+ const t = s.result.split(",")[1];
215
215
  r(t);
216
- }, a.onerror = () => u(new Error("Failed to read file")), a.readAsDataURL(e);
216
+ }, s.onerror = () => u(new Error("Failed to read file")), s.readAsDataURL(e);
217
217
  });
218
218
  }
219
219
  /**
@@ -221,37 +221,37 @@ class yr {
221
221
  * Returns the original file if not an image or no resize needed
222
222
  */
223
223
  async resizeImage(e, r, u) {
224
- return e.type.startsWith("image/") ? new Promise((a) => {
224
+ return e.type.startsWith("image/") ? new Promise((s) => {
225
225
  const n = new Image(), t = URL.createObjectURL(e);
226
226
  n.onload = () => {
227
227
  if (URL.revokeObjectURL(t), n.width <= r && n.height <= r) {
228
- a(e);
228
+ s(e);
229
229
  return;
230
230
  }
231
231
  let i, l;
232
232
  n.width > n.height ? (i = r, l = Math.round(n.height / n.width * r)) : (l = r, i = Math.round(n.width / n.height * r));
233
- const d = document.createElement("canvas");
234
- d.width = i, d.height = l;
235
- const c = d.getContext("2d");
236
- if (!c) {
237
- a(e);
233
+ const c = document.createElement("canvas");
234
+ c.width = i, c.height = l;
235
+ const d = c.getContext("2d");
236
+ if (!d) {
237
+ s(e);
238
238
  return;
239
239
  }
240
- c.drawImage(n, 0, 0, i, l);
241
- const h = e.type === "image/png" ? "image/png" : "image/jpeg";
242
- d.toBlob(
240
+ d.drawImage(n, 0, 0, i, l);
241
+ const p = e.type === "image/png" ? "image/png" : "image/jpeg";
242
+ c.toBlob(
243
243
  (m) => {
244
244
  if (m) {
245
- const A = new File([m], e.name, { type: h });
246
- a(A);
245
+ const D = new File([m], e.name, { type: p });
246
+ s(D);
247
247
  } else
248
- a(e);
248
+ s(e);
249
249
  },
250
- h,
250
+ p,
251
251
  u
252
252
  );
253
253
  }, n.onerror = () => {
254
- URL.revokeObjectURL(t), a(e);
254
+ URL.revokeObjectURL(t), s(e);
255
255
  }, n.src = t;
256
256
  }) : e;
257
257
  }
@@ -262,8 +262,8 @@ class yr {
262
262
  * @param file - The File object to upload
263
263
  * @param options - Upload options (maxSizeMB, maxImageDimension, imageQuality)
264
264
  */
265
- async uploadFile(e, r, u, a = {}) {
266
- const n = { ...this.defaultUploadOptions, ...a };
265
+ async uploadFile(e, r, u, s = {}) {
266
+ const n = { ...this.defaultUploadOptions, ...s };
267
267
  try {
268
268
  let t = u;
269
269
  n.maxImageDimension > 0 && u.type.startsWith("image/") && (t = await this.resizeImage(u, n.maxImageDimension, n.imageQuality));
@@ -273,12 +273,12 @@ class yr {
273
273
  success: !1,
274
274
  error: `File too large (${(t.size / 1024 / 1024).toFixed(1)} MB). Max: ${n.maxSizeMB} MB`
275
275
  };
276
- const l = await this.fileToBase64(t), d = await this.callGraph("upload_file", {
276
+ const l = await this.fileToBase64(t), c = await this.callGraph("upload_file", {
277
277
  node_id: e,
278
278
  filename: r,
279
279
  content: l
280
280
  });
281
- return d.success ? { success: !0, path: d.path } : { success: !1, error: d.error || "Upload failed" };
281
+ return c.success ? { success: !0, path: c.path } : { success: !1, error: c.error || "Upload failed" };
282
282
  } catch (t) {
283
283
  return {
284
284
  success: !1,
@@ -291,10 +291,10 @@ class yr {
291
291
  * @param nodeId - The node to list files for
292
292
  */
293
293
  async listFiles(e) {
294
- var a;
295
- return (((a = (await this.callGraph("list_files", {
294
+ var s;
295
+ return (((s = (await this.callGraph("list_files", {
296
296
  node_id: e
297
- })).result) == null ? void 0 : a.files) || []).map((n) => ({
297
+ })).result) == null ? void 0 : s.files) || []).map((n) => ({
298
298
  filename: n.name,
299
299
  path: n.path
300
300
  }));
@@ -319,20 +319,20 @@ class yr {
319
319
  return `${this.config.baseUrl}/files/${this.config.system_id}/${e}/${r}`;
320
320
  }
321
321
  }
322
- const he = new TextEncoder(), ft = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ce = new Uint8Array(256);
323
- for (var _e = 0; _e < ft.length; _e++)
324
- Ce[ft.charCodeAt(_e)] = _e;
322
+ const he = new TextEncoder(), pt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Ce = new Uint8Array(256);
323
+ for (var _e = 0; _e < pt.length; _e++)
324
+ Ce[pt.charCodeAt(_e)] = _e;
325
325
  function rt(o) {
326
326
  let e = Math.ceil(o.length / 4) * 3;
327
327
  const r = o.length;
328
328
  let u = 0;
329
329
  o.length % 4 === 3 ? e-- : o.length % 4 === 2 ? e -= 2 : o[o.length - 1] === "=" && (e--, o[o.length - 2] === "=" && e--);
330
- const a = new ArrayBuffer(e), n = new Uint8Array(a);
330
+ const s = new ArrayBuffer(e), n = new Uint8Array(s);
331
331
  for (let t = 0; t < r; t += 4) {
332
- let i = Ce[o.charCodeAt(t)], l = Ce[o.charCodeAt(t + 1)], d = Ce[o.charCodeAt(t + 2)], c = Ce[o.charCodeAt(t + 3)];
333
- n[u++] = i << 2 | l >> 4, n[u++] = (l & 15) << 4 | d >> 2, n[u++] = (d & 3) << 6 | c & 63;
332
+ let i = Ce[o.charCodeAt(t)], l = Ce[o.charCodeAt(t + 1)], c = Ce[o.charCodeAt(t + 2)], d = Ce[o.charCodeAt(t + 3)];
333
+ n[u++] = i << 2 | l >> 4, n[u++] = (l & 15) << 4 | c >> 2, n[u++] = (c & 3) << 6 | d & 63;
334
334
  }
335
- return a;
335
+ return s;
336
336
  }
337
337
  function Be(o) {
338
338
  o = o || "utf8";
@@ -349,54 +349,54 @@ async function Pe(o) {
349
349
  return await o.arrayBuffer();
350
350
  const e = new FileReader();
351
351
  return new Promise((r, u) => {
352
- e.onload = function(a) {
353
- r(a.target.result);
354
- }, e.onerror = function(a) {
352
+ e.onload = function(s) {
353
+ r(s.target.result);
354
+ }, e.onerror = function(s) {
355
355
  u(e.error);
356
356
  }, e.readAsArrayBuffer(o);
357
357
  });
358
358
  }
359
- function pt(o) {
359
+ function ht(o) {
360
360
  return o >= 48 && o <= 57 || o >= 97 && o <= 102 || o >= 65 && o <= 70 ? String.fromCharCode(o) : !1;
361
361
  }
362
362
  function Ht(o, e, r) {
363
363
  let u = o.indexOf("*");
364
364
  u >= 0 && (o = o.substr(0, u)), e = e.toUpperCase();
365
- let a;
365
+ let s;
366
366
  if (e === "Q") {
367
367
  r = r.replace(/=\s+([0-9a-fA-F])/g, "=$1").replace(/[_\s]/g, " ");
368
368
  let n = he.encode(r), t = [];
369
- for (let l = 0, d = n.length; l < d; l++) {
370
- let c = n[l];
371
- if (l <= d - 2 && c === 61) {
372
- let h = pt(n[l + 1]), m = pt(n[l + 2]);
373
- if (h && m) {
374
- let A = parseInt(h + m, 16);
375
- t.push(A), l += 2;
369
+ for (let l = 0, c = n.length; l < c; l++) {
370
+ let d = n[l];
371
+ if (l <= c - 2 && d === 61) {
372
+ let p = ht(n[l + 1]), m = ht(n[l + 2]);
373
+ if (p && m) {
374
+ let D = parseInt(p + m, 16);
375
+ t.push(D), l += 2;
376
376
  continue;
377
377
  }
378
378
  }
379
- t.push(c);
379
+ t.push(d);
380
380
  }
381
- a = new ArrayBuffer(t.length);
382
- let i = new DataView(a);
383
- for (let l = 0, d = t.length; l < d; l++)
381
+ s = new ArrayBuffer(t.length);
382
+ let i = new DataView(s);
383
+ for (let l = 0, c = t.length; l < c; l++)
384
384
  i.setUint8(l, t[l]);
385
- } else e === "B" ? a = rt(r.replace(/[^a-zA-Z0-9\+\/=]+/g, "")) : a = he.encode(r);
386
- return Be(o).decode(a);
385
+ } else e === "B" ? s = rt(r.replace(/[^a-zA-Z0-9\+\/=]+/g, "")) : s = he.encode(r);
386
+ return Be(o).decode(s);
387
387
  }
388
388
  function ke(o) {
389
389
  let e = !0;
390
390
  for (; ; ) {
391
391
  let r = (o || "").toString().replace(
392
392
  /(=\?([^?]+)\?[Bb]\?([^?]*)\?=)\s*(?==\?([^?]+)\?[Bb]\?[^?]*\?=)/g,
393
- (u, a, n, t, i) => e && n === i && t.length % 4 === 0 && !/=$/.test(t) ? a + "__\0JOIN\0__" : u
393
+ (u, s, n, t, i) => e && n === i && t.length % 4 === 0 && !/=$/.test(t) ? s + "__\0JOIN\0__" : u
394
394
  ).replace(
395
395
  /(=\?([^?]+)\?[Qq]\?[^?]*\?=)\s*(?==\?([^?]+)\?[Qq]\?[^?]*\?=)/g,
396
- (u, a, n, t) => e && n === t ? a + "__\0JOIN\0__" : u
396
+ (u, s, n, t) => e && n === t ? s + "__\0JOIN\0__" : u
397
397
  ).replace(/(\?=)?__\x00JOIN\x00__(=\?([^?]+)\?[QqBb]\?)?/g, "").replace(/(=\?[^?]+\?[QqBb]\?[^?]*\?=)\s+(?==\?[^?]+\?[QqBb]\?[^?]*\?=)/g, "$1").replace(
398
398
  /=\?([\w_\-*]+)\?([QqBb])\?([^?]*)\?=/g,
399
- (u, a, n, t) => Ht(a, n, t)
399
+ (u, s, n, t) => Ht(s, n, t)
400
400
  );
401
401
  if (e && r.indexOf("�") >= 0)
402
402
  e = !1;
@@ -419,9 +419,9 @@ function Vt(o, e) {
419
419
  } else
420
420
  r.push(t.charCodeAt(0));
421
421
  }
422
- const u = new ArrayBuffer(r.length), a = new DataView(u);
422
+ const u = new ArrayBuffer(r.length), s = new DataView(u);
423
423
  for (let n = 0, t = r.length; n < t; n++)
424
- a.setUint8(n, r[n]);
424
+ s.setUint8(n, r[n]);
425
425
  return Be(e).decode(u);
426
426
  }
427
427
  function Wt(o) {
@@ -430,16 +430,16 @@ function Wt(o) {
430
430
  let u = r.match(/\*((\d+)\*?)?$/);
431
431
  if (!u)
432
432
  return;
433
- let a = r.substr(0, u.index).toLowerCase(), n = Number(u[2]) || 0, t;
434
- e.has(a) ? t = e.get(a) : (t = {
433
+ let s = r.substr(0, u.index).toLowerCase(), n = Number(u[2]) || 0, t;
434
+ e.has(s) ? t = e.get(s) : (t = {
435
435
  charset: !1,
436
436
  values: []
437
- }, e.set(a, t));
437
+ }, e.set(s, t));
438
438
  let i = o.params[r];
439
439
  n === 0 && u[0].charAt(u[0].length - 1) === "*" && (u = i.match(/^([^']*)'[^']*'(.*)$/)) && (t.charset = u[1] || "utf-8", i = u[2]), t.values.push({ nr: n, value: i }), delete o.params[r];
440
440
  }), e.forEach((r, u) => {
441
441
  o.params[u] = Vt(
442
- r.values.sort((a, n) => a.nr - n.nr).map((a) => a.value).join(""),
442
+ r.values.sort((s, n) => s.nr - n.nr).map((s) => s.value).join(""),
443
443
  r.charset
444
444
  );
445
445
  });
@@ -463,40 +463,40 @@ class Yt {
463
463
  update(e) {
464
464
  let r = this.decoder.decode(e);
465
465
  if (/[^a-zA-Z0-9+\/]/.test(r) && (r = r.replace(/[^a-zA-Z0-9+\/]+/g, "")), this.remainder += r, this.remainder.length >= this.maxChunkSize) {
466
- let u = Math.floor(this.remainder.length / 4) * 4, a;
467
- u === this.remainder.length ? (a = this.remainder, this.remainder = "") : (a = this.remainder.substr(0, u), this.remainder = this.remainder.substr(u)), a.length && this.chunks.push(rt(a));
466
+ let u = Math.floor(this.remainder.length / 4) * 4, s;
467
+ u === this.remainder.length ? (s = this.remainder, this.remainder = "") : (s = this.remainder.substr(0, u), this.remainder = this.remainder.substr(u)), s.length && this.chunks.push(rt(s));
468
468
  }
469
469
  }
470
470
  finalize() {
471
471
  return this.remainder && !/^=+$/.test(this.remainder) && this.chunks.push(rt(this.remainder)), Pe(new Blob(this.chunks, { type: "application/octet-stream" }));
472
472
  }
473
473
  }
474
- const ht = /^=[a-f0-9]{2}$/i, Jt = /(?==[a-f0-9]{2})/i, Kt = /=\r?\n/g, Xt = /=[a-fA-F0-9]?$/;
474
+ const gt = /^=[a-f0-9]{2}$/i, Jt = /(?==[a-f0-9]{2})/i, Kt = /=\r?\n/g, Xt = /=[a-fA-F0-9]?$/;
475
475
  class Zt {
476
476
  constructor(e) {
477
477
  e = e || {}, this.decoder = e.decoder || new TextDecoder(), this.maxChunkSize = 100 * 1024, this.remainder = "", this.chunks = [];
478
478
  }
479
479
  decodeQPBytes(e) {
480
480
  let r = new ArrayBuffer(e.length), u = new DataView(r);
481
- for (let a = 0, n = e.length; a < n; a++)
482
- u.setUint8(a, parseInt(e[a], 16));
481
+ for (let s = 0, n = e.length; s < n; s++)
482
+ u.setUint8(s, parseInt(e[s], 16));
483
483
  return r;
484
484
  }
485
485
  decodeChunks(e) {
486
486
  e = e.replace(Kt, "");
487
487
  let r = e.split(Jt), u = [];
488
- for (let a of r) {
489
- if (a.charAt(0) !== "=") {
490
- u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(a);
488
+ for (let s of r) {
489
+ if (s.charAt(0) !== "=") {
490
+ u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(s);
491
491
  continue;
492
492
  }
493
- if (a.length === 3) {
494
- ht.test(a) ? u.push(a.substr(1)) : (u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(a));
493
+ if (s.length === 3) {
494
+ gt.test(s) ? u.push(s.substr(1)) : (u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(s));
495
495
  continue;
496
496
  }
497
- if (a.length > 3) {
498
- const n = a.substr(0, 3);
499
- ht.test(n) ? (u.push(a.substr(1, 2)), this.chunks.push(this.decodeQPBytes(u)), u = [], a = a.substr(3), this.chunks.push(a)) : (u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(a));
497
+ if (s.length > 3) {
498
+ const n = s.substr(0, 3);
499
+ gt.test(n) ? (u.push(s.substr(1, 2)), this.chunks.push(this.decodeQPBytes(u)), u = [], s = s.substr(3), this.chunks.push(s)) : (u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []), this.chunks.push(s));
500
500
  }
501
501
  }
502
502
  u.length && (this.chunks.push(this.decodeQPBytes(u)), u = []);
@@ -523,7 +523,7 @@ class Zt {
523
523
  return this.remainder.length && (this.decodeChunks(this.remainder), this.remainder = ""), Pe(new Blob(this.chunks, { type: "application/octet-stream" }));
524
524
  }
525
525
  }
526
- class gt {
526
+ class mt {
527
527
  constructor(e) {
528
528
  if (this.options = e || {}, this.postalMime = this.options.postalMime, this.root = !!this.options.parentNode, this.childNodes = [], this.options.parentNode) {
529
529
  if (this.parentNode = this.options.parentNode, this.depth = this.parentNode.depth + 1, this.depth > this.options.maxNestingDepth)
@@ -563,31 +563,31 @@ class gt {
563
563
  let r = {
564
564
  value: !1,
565
565
  params: {}
566
- }, u = !1, a = "", n = "value", t = !1, i = !1, l;
567
- for (let d = 0, c = e.length; d < c; d++)
568
- switch (l = e.charAt(d), n) {
566
+ }, u = !1, s = "", n = "value", t = !1, i = !1, l;
567
+ for (let c = 0, d = e.length; c < d; c++)
568
+ switch (l = e.charAt(c), n) {
569
569
  case "key":
570
570
  if (l === "=") {
571
- u = a.trim().toLowerCase(), n = "value", a = "";
571
+ u = s.trim().toLowerCase(), n = "value", s = "";
572
572
  break;
573
573
  }
574
- a += l;
574
+ s += l;
575
575
  break;
576
576
  case "value":
577
577
  if (i)
578
- a += l;
578
+ s += l;
579
579
  else if (l === "\\") {
580
580
  i = !0;
581
581
  continue;
582
- } else t && l === t ? t = !1 : !t && l === '"' ? t = l : !t && l === ";" ? (u === !1 ? r.value = a.trim() : r.params[u] = a.trim(), n = "key", a = "") : a += l;
582
+ } else t && l === t ? t = !1 : !t && l === '"' ? t = l : !t && l === ";" ? (u === !1 ? r.value = s.trim() : r.params[u] = s.trim(), n = "key", s = "") : s += l;
583
583
  i = !1;
584
584
  break;
585
585
  }
586
- return a = a.trim(), n === "value" ? u === !1 ? r.value = a : r.params[u] = a : a && (r.params[a.toLowerCase()] = ""), r.value && (r.value = r.value.toLowerCase()), Wt(r), r;
586
+ return s = s.trim(), n === "value" ? u === !1 ? r.value = s : r.params[u] = s : s && (r.params[s.toLowerCase()] = ""), r.value && (r.value = r.value.toLowerCase()), Wt(r), r;
587
587
  }
588
588
  decodeFlowedText(e, r) {
589
- return e.split(/\r?\n/).reduce((u, a) => / $/.test(u) && !/(^|\n)-- $/.test(u) ? r ? u.slice(0, -1) + a : u + a : u + `
590
- ` + a).replace(/^ /gm, "");
589
+ return e.split(/\r?\n/).reduce((u, s) => / $/.test(u) && !/(^|\n)-- $/.test(u) ? r ? u.slice(0, -1) + s : u + s : u + `
590
+ ` + s).replace(/^ /gm, "");
591
591
  }
592
592
  getTextContent() {
593
593
  if (!this.content)
@@ -603,8 +603,8 @@ class gt {
603
603
  ` + r, this.headerLines.splice(e, 1);
604
604
  else {
605
605
  r = r.replace(/\s+/g, " ");
606
- let u = r.indexOf(":"), a = u < 0 ? r.trim() : r.substr(0, u).trim(), n = u < 0 ? "" : r.substr(u + 1).trim();
607
- switch (this.headers.push({ key: a.toLowerCase(), originalKey: a, value: n }), a.toLowerCase()) {
606
+ let u = r.indexOf(":"), s = u < 0 ? r.trim() : r.substr(0, u).trim(), n = u < 0 ? "" : r.substr(u + 1).trim();
607
+ switch (this.headers.push({ key: s.toLowerCase(), originalKey: s, value: n }), s.toLowerCase()) {
608
608
  case "content-type":
609
609
  this.contentType.default && (this.contentType = { value: n, parsed: {} });
610
610
  break;
@@ -642,7 +642,7 @@ class gt {
642
642
  }
643
643
  }
644
644
  }
645
- const mt = {
645
+ const Dt = {
646
646
  "&AElig": "Æ",
647
647
  "&AElig;": "Æ",
648
648
  "&AMP": "&",
@@ -2878,24 +2878,24 @@ const mt = {
2878
2878
  };
2879
2879
  function er(o) {
2880
2880
  return o.replace(/&(#\d+|#x[a-f0-9]+|[a-z]+\d*);?/gi, (e, r) => {
2881
- if (typeof mt[e] == "string")
2882
- return mt[e];
2881
+ if (typeof Dt[e] == "string")
2882
+ return Dt[e];
2883
2883
  if (r.charAt(0) !== "#" || e.charAt(e.length - 1) !== ";")
2884
2884
  return e;
2885
2885
  let u;
2886
2886
  r.charAt(1) === "x" ? u = parseInt(r.substr(2), 16) : u = parseInt(r.substr(1), 10);
2887
- var a = "";
2888
- return u >= 55296 && u <= 57343 || u > 1114111 ? "�" : (u > 65535 && (u -= 65536, a += String.fromCharCode(u >>> 10 & 1023 | 55296), u = 56320 | u & 1023), a += String.fromCharCode(u), a);
2887
+ var s = "";
2888
+ return u >= 55296 && u <= 57343 || u > 1114111 ? "�" : (u > 65535 && (u -= 65536, s += String.fromCharCode(u >>> 10 & 1023 | 55296), u = 56320 | u & 1023), s += String.fromCharCode(u), s);
2889
2889
  });
2890
2890
  }
2891
- function se(o) {
2891
+ function ae(o) {
2892
2892
  return o.trim().replace(/[<>"'?&]/g, (e) => {
2893
2893
  let r = e.charCodeAt(0).toString(16);
2894
2894
  return r.length < 2 && (r = "0" + r), "&#x" + r.toUpperCase() + ";";
2895
2895
  });
2896
2896
  }
2897
2897
  function tr(o) {
2898
- return "<div>" + se(o).replace(/\n/g, "<br />") + "</div>";
2898
+ return "<div>" + ae(o).replace(/\n/g, "<br />") + "</div>";
2899
2899
  }
2900
2900
  function rr(o) {
2901
2901
  return o = o.replace(/\r?\n/g, "").replace(/<\!\-\-.*?\-\->/gi, " ").replace(/<br\b[^>]*>/gi, `
@@ -2910,26 +2910,26 @@ function rr(o) {
2910
2910
  `).replace(/\n+$/, `
2911
2911
  `), o = er(o), o;
2912
2912
  }
2913
- function xt(o) {
2913
+ function Et(o) {
2914
2914
  return [].concat(o.name || []).concat(o.name ? `<${o.address}>` : o.address).join(" ");
2915
2915
  }
2916
2916
  function Ke(o) {
2917
- let e = [], r = (u, a) => {
2918
- if (a && e.push(", "), u.group) {
2917
+ let e = [], r = (u, s) => {
2918
+ if (s && e.push(", "), u.group) {
2919
2919
  let n = `${u.name}:`, t = ";";
2920
2920
  e.push(n), u.group.forEach(r), e.push(t);
2921
2921
  } else
2922
- e.push(xt(u));
2922
+ e.push(Et(u));
2923
2923
  };
2924
2924
  return o.forEach(r), e.join("");
2925
2925
  }
2926
2926
  function wt(o) {
2927
- return `<a href="mailto:${se(o.address)}" class="postal-email-address">${se(o.name || `<${o.address}>`)}</a>`;
2927
+ return `<a href="mailto:${ae(o.address)}" class="postal-email-address">${ae(o.name || `<${o.address}>`)}</a>`;
2928
2928
  }
2929
2929
  function Xe(o) {
2930
- let e = [], r = (u, a) => {
2931
- if (a && e.push('<span class="postal-email-address-separator">, </span>'), u.group) {
2932
- let n = `<span class="postal-email-address-group">${se(u.name)}:</span>`, t = '<span class="postal-email-address-group">;</span>';
2930
+ let e = [], r = (u, s) => {
2931
+ if (s && e.push('<span class="postal-email-address-separator">, </span>'), u.group) {
2932
+ let n = `<span class="postal-email-address-group">${ae(u.name)}:</span>`, t = '<span class="postal-email-address-group">;</span>';
2933
2933
  e.push(n), u.group.forEach(r), e.push(t);
2934
2934
  } else
2935
2935
  e.push(wt(u));
@@ -2938,8 +2938,8 @@ function Xe(o) {
2938
2938
  }
2939
2939
  function ur(o, e, r) {
2940
2940
  o = (o || "").toString(), e = e || 76;
2941
- let u = 0, a = o.length, n = "", t, i;
2942
- for (; u < a; ) {
2941
+ let u = 0, s = o.length, n = "", t, i;
2942
+ for (; u < s; ) {
2943
2943
  if (t = o.substr(u, e), t.length < e) {
2944
2944
  n += t;
2945
2945
  break;
@@ -2948,14 +2948,14 @@ function ur(o, e, r) {
2948
2948
  t = i[0], n += t, u += t.length;
2949
2949
  continue;
2950
2950
  } else (i = t.match(/(\s+)[^\s]*$/)) && i[0].length - (i[1] || "").length < t.length ? t = t.substr(0, t.length - (i[0].length - (i[1] || "").length)) : (i = o.substr(u + t.length).match(/^[^\s]+(\s*)/)) && (t = t + i[0].substr(0, i[0].length - 0));
2951
- n += t, u += t.length, u < a && (n += `\r
2951
+ n += t, u += t.length, u < s && (n += `\r
2952
2952
  `);
2953
2953
  }
2954
2954
  return n;
2955
2955
  }
2956
- function Dt(o) {
2956
+ function At(o) {
2957
2957
  let e = [];
2958
- if (o.from && e.push({ key: "From", val: xt(o.from) }), o.subject && e.push({ key: "Subject", val: o.subject }), o.date) {
2958
+ if (o.from && e.push({ key: "From", val: Et(o.from) }), o.subject && e.push({ key: "Subject", val: o.subject }), o.date) {
2959
2959
  let t = {
2960
2960
  year: "numeric",
2961
2961
  month: "numeric",
@@ -2970,23 +2970,23 @@ function Dt(o) {
2970
2970
  o.to && o.to.length && e.push({ key: "To", val: Ke(o.to) }), o.cc && o.cc.length && e.push({ key: "Cc", val: Ke(o.cc) }), o.bcc && o.bcc.length && e.push({ key: "Bcc", val: Ke(o.bcc) });
2971
2971
  let r = e.map((t) => t.key.length).reduce((t, i) => i > t ? i : t, 0);
2972
2972
  e = e.flatMap((t) => {
2973
- let i = r - t.key.length, l = `${t.key}: ${" ".repeat(i)}`, d = `${" ".repeat(t.key.length + 1)} ${" ".repeat(i)}`;
2974
- return ur(t.val, 80).split(/\r?\n/).map((h) => h.trim()).map((h, m) => `${m ? d : l}${h}`);
2973
+ let i = r - t.key.length, l = `${t.key}: ${" ".repeat(i)}`, c = `${" ".repeat(t.key.length + 1)} ${" ".repeat(i)}`;
2974
+ return ur(t.val, 80).split(/\r?\n/).map((p) => p.trim()).map((p, m) => `${m ? c : l}${p}`);
2975
2975
  });
2976
- let u = e.map((t) => t.length).reduce((t, i) => i > t ? i : t, 0), a = "-".repeat(u);
2976
+ let u = e.map((t) => t.length).reduce((t, i) => i > t ? i : t, 0), s = "-".repeat(u);
2977
2977
  return `
2978
- ${a}
2978
+ ${s}
2979
2979
  ${e.join(`
2980
2980
  `)}
2981
- ${a}
2981
+ ${s}
2982
2982
  `;
2983
2983
  }
2984
- function At(o) {
2984
+ function bt(o) {
2985
2985
  let e = [];
2986
2986
  if (o.from && e.push(
2987
2987
  `<div class="postal-email-header-key">From</div><div class="postal-email-header-value">${wt(o.from)}</div>`
2988
2988
  ), o.subject && e.push(
2989
- `<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${se(
2989
+ `<div class="postal-email-header-key">Subject</div><div class="postal-email-header-value postal-email-header-subject">${ae(
2990
2990
  o.subject
2991
2991
  )}</div>`
2992
2992
  ), o.date) {
@@ -2998,11 +2998,11 @@ function At(o) {
2998
2998
  minute: "numeric",
2999
2999
  second: "numeric",
3000
3000
  hour12: !1
3001
- }, a = typeof Intl > "u" ? o.date : new Intl.DateTimeFormat("default", u).format(new Date(o.date));
3001
+ }, s = typeof Intl > "u" ? o.date : new Intl.DateTimeFormat("default", u).format(new Date(o.date));
3002
3002
  e.push(
3003
- `<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${se(
3003
+ `<div class="postal-email-header-key">Date</div><div class="postal-email-header-value postal-email-header-date" data-date="${ae(
3004
3004
  o.date
3005
- )}">${se(a)}</div>`
3005
+ )}">${ae(s)}</div>`
3006
3006
  );
3007
3007
  }
3008
3008
  return o.to && o.to.length && e.push(
@@ -3016,45 +3016,45 @@ function At(o) {
3016
3016
  <div class="postal-email-header-row">`
3017
3017
  )}${e.length ? "</div>" : ""}</div>`;
3018
3018
  }
3019
- function ar(o, e) {
3020
- let r = !1, u = "text", a, n = [], t = {
3019
+ function sr(o, e) {
3020
+ let r = !1, u = "text", s, n = [], t = {
3021
3021
  address: [],
3022
3022
  comment: [],
3023
3023
  group: [],
3024
3024
  text: [],
3025
3025
  textWasQuoted: []
3026
3026
  // Track which text tokens came from inside quotes
3027
- }, i, l, d = !1;
3027
+ }, i, l, c = !1;
3028
3028
  for (i = 0, l = o.length; i < l; i++) {
3029
- let c = o[i], h = i ? o[i - 1] : null;
3030
- if (c.type === "operator")
3031
- switch (c.value) {
3029
+ let d = o[i], p = i ? o[i - 1] : null;
3030
+ if (d.type === "operator")
3031
+ switch (d.value) {
3032
3032
  case "<":
3033
- u = "address", d = !1;
3033
+ u = "address", c = !1;
3034
3034
  break;
3035
3035
  case "(":
3036
- u = "comment", d = !1;
3036
+ u = "comment", c = !1;
3037
3037
  break;
3038
3038
  case ":":
3039
- u = "group", r = !0, d = !1;
3039
+ u = "group", r = !0, c = !1;
3040
3040
  break;
3041
3041
  case '"':
3042
- d = !d, u = "text";
3042
+ c = !c, u = "text";
3043
3043
  break;
3044
3044
  default:
3045
- u = "text", d = !1;
3045
+ u = "text", c = !1;
3046
3046
  break;
3047
3047
  }
3048
- else c.value && (u === "address" && (c.value = c.value.replace(/^[^<]*<\s*/, "")), h && h.noBreak && t[u].length ? (t[u][t[u].length - 1] += c.value, u === "text" && d && (t.textWasQuoted[t.textWasQuoted.length - 1] = !0)) : (t[u].push(c.value), u === "text" && t.textWasQuoted.push(d)));
3048
+ else d.value && (u === "address" && (d.value = d.value.replace(/^[^<]*<\s*/, "")), p && p.noBreak && t[u].length ? (t[u][t[u].length - 1] += d.value, u === "text" && c && (t.textWasQuoted[t.textWasQuoted.length - 1] = !0)) : (t[u].push(d.value), u === "text" && t.textWasQuoted.push(c)));
3049
3049
  }
3050
3050
  if (!t.text.length && t.comment.length && (t.text = t.comment, t.comment = []), r) {
3051
3051
  t.text = t.text.join(" ");
3052
- let c = [];
3052
+ let d = [];
3053
3053
  t.group.length && Fe(t.group.join(","), { _depth: e + 1 }).forEach((m) => {
3054
- m.group ? c = c.concat(m.group) : c.push(m);
3054
+ m.group ? d = d.concat(m.group) : d.push(m);
3055
3055
  }), n.push({
3056
- name: ke(t.text || a && a.name),
3057
- group: c
3056
+ name: ke(t.text || s && s.name),
3057
+ group: d
3058
3058
  });
3059
3059
  } else {
3060
3060
  if (!t.address.length && t.text.length) {
@@ -3063,28 +3063,28 @@ function ar(o, e) {
3063
3063
  t.address = t.text.splice(i, 1), t.textWasQuoted.splice(i, 1);
3064
3064
  break;
3065
3065
  }
3066
- let c = function(h) {
3067
- return t.address.length ? h : (t.address = [h.trim()], " ");
3066
+ let d = function(p) {
3067
+ return t.address.length ? p : (t.address = [p.trim()], " ");
3068
3068
  };
3069
3069
  if (!t.address.length)
3070
- for (i = t.text.length - 1; i >= 0 && !(!t.textWasQuoted[i] && (t.text[i] = t.text[i].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/, c).trim(), t.address.length)); i--)
3070
+ for (i = t.text.length - 1; i >= 0 && !(!t.textWasQuoted[i] && (t.text[i] = t.text[i].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/, d).trim(), t.address.length)); i--)
3071
3071
  ;
3072
3072
  }
3073
3073
  if (!t.text.length && t.comment.length && (t.text = t.comment, t.comment = []), t.address.length > 1 && (t.text = t.text.concat(t.address.splice(1))), t.text = t.text.join(" "), t.address = t.address.join(" "), !t.address && /^=\?[^=]+?=$/.test(t.text.trim())) {
3074
- const c = Fe(ke(t.text));
3075
- if (c && c.length)
3076
- return c;
3074
+ const d = Fe(ke(t.text));
3075
+ if (d && d.length)
3076
+ return d;
3077
3077
  }
3078
3078
  if (!t.address && r)
3079
3079
  return [];
3080
- a = {
3080
+ s = {
3081
3081
  address: t.address || t.text || "",
3082
3082
  name: ke(t.text || t.address || "")
3083
- }, a.address === a.name && ((a.address || "").match(/@/) ? a.name = "" : a.address = ""), n.push(a);
3083
+ }, s.address === s.name && ((s.address || "").match(/@/) ? s.name = "" : s.address = ""), n.push(s);
3084
3084
  }
3085
3085
  return n;
3086
3086
  }
3087
- class sr {
3087
+ class ar {
3088
3088
  constructor(e) {
3089
3089
  this.str = (e || "").toString(), this.operatorCurrent = "", this.operatorExpecting = "", this.node = null, this.escaped = !1, this.list = [], this.operators = {
3090
3090
  '"': '"',
@@ -3109,8 +3109,8 @@ class sr {
3109
3109
  tokenize() {
3110
3110
  let e = [];
3111
3111
  for (let r = 0, u = this.str.length; r < u; r++) {
3112
- let a = this.str.charAt(r), n = r < u - 1 ? this.str.charAt(r + 1) : null;
3113
- this.checkChar(a, n);
3112
+ let s = this.str.charAt(r), n = r < u - 1 ? this.str.charAt(r + 1) : null;
3113
+ this.checkChar(s, n);
3114
3114
  }
3115
3115
  return this.list.forEach((r) => {
3116
3116
  r.value = (r.value || "").toString().trim(), r.value && e.push(r);
@@ -3154,27 +3154,27 @@ function Fe(o, e) {
3154
3154
  let r = e._depth || 0;
3155
3155
  if (r > nr)
3156
3156
  return [];
3157
- let a = new sr(o).tokenize(), n = [], t = [], i = [];
3158
- if (a.forEach((l) => {
3157
+ let s = new ar(o).tokenize(), n = [], t = [], i = [];
3158
+ if (s.forEach((l) => {
3159
3159
  l.type === "operator" && (l.value === "," || l.value === ";") ? (t.length && n.push(t), t = []) : t.push(l);
3160
3160
  }), t.length && n.push(t), n.forEach((l) => {
3161
- l = ar(l, r), l.length && (i = i.concat(l));
3161
+ l = sr(l, r), l.length && (i = i.concat(l));
3162
3162
  }), e.flatten) {
3163
- let l = [], d = (c) => {
3164
- c.forEach((h) => {
3165
- if (h.group)
3166
- return d(h.group);
3167
- l.push(h);
3163
+ let l = [], c = (d) => {
3164
+ d.forEach((p) => {
3165
+ if (p.group)
3166
+ return c(p.group);
3167
+ l.push(p);
3168
3168
  });
3169
3169
  };
3170
- return d(i), l;
3170
+ return c(i), l;
3171
3171
  }
3172
3172
  return i;
3173
3173
  }
3174
3174
  function ir(o) {
3175
- for (var e = "", r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = new Uint8Array(o), a = u.byteLength, n = a % 3, t = a - n, i, l, d, c, h, m = 0; m < t; m = m + 3)
3176
- h = u[m] << 16 | u[m + 1] << 8 | u[m + 2], i = (h & 16515072) >> 18, l = (h & 258048) >> 12, d = (h & 4032) >> 6, c = h & 63, e += r[i] + r[l] + r[d] + r[c];
3177
- return n == 1 ? (h = u[t], i = (h & 252) >> 2, l = (h & 3) << 4, e += r[i] + r[l] + "==") : n == 2 && (h = u[t] << 8 | u[t + 1], i = (h & 64512) >> 10, l = (h & 1008) >> 4, d = (h & 15) << 2, e += r[i] + r[l] + r[d] + "="), e;
3175
+ for (var e = "", r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = new Uint8Array(o), s = u.byteLength, n = s % 3, t = s - n, i, l, c, d, p, m = 0; m < t; m = m + 3)
3176
+ p = u[m] << 16 | u[m + 1] << 8 | u[m + 2], i = (p & 16515072) >> 18, l = (p & 258048) >> 12, c = (p & 4032) >> 6, d = p & 63, e += r[i] + r[l] + r[c] + r[d];
3177
+ return n == 1 ? (p = u[t], i = (p & 252) >> 2, l = (p & 3) << 4, e += r[i] + r[l] + "==") : n == 2 && (p = u[t] << 8 | u[t + 1], i = (p & 64512) >> 10, l = (p & 1008) >> 4, c = (p & 15) << 2, e += r[i] + r[l] + r[c] + "="), e;
3178
3178
  }
3179
3179
  const or = 256, lr = 2 * 1024 * 1024;
3180
3180
  class Le {
@@ -3185,7 +3185,7 @@ class Le {
3185
3185
  this.options = e || {}, this.mimeOptions = {
3186
3186
  maxNestingDepth: this.options.maxNestingDepth || or,
3187
3187
  maxHeadersSize: this.options.maxHeadersSize || lr
3188
- }, this.root = this.currentNode = new gt({
3188
+ }, this.root = this.currentNode = new mt({
3189
3189
  postalMime: this,
3190
3190
  ...this.mimeOptions
3191
3191
  }), this.boundaries = [], this.textContent = {}, this.attachments = [], this.attachmentEncoding = (this.options.attachmentEncoding || "").toString().replace(/[-_\s]/g, "").trim().toLowerCase() || "arraybuffer", this.started = !1;
@@ -3196,8 +3196,8 @@ class Le {
3196
3196
  async processLine(e, r) {
3197
3197
  let u = this.boundaries;
3198
3198
  if (u.length && e.length > 2 && e[0] === 45 && e[1] === 45)
3199
- for (let a = u.length - 1; a >= 0; a--) {
3200
- let n = u[a];
3199
+ for (let s = u.length - 1; s >= 0; s--) {
3200
+ let n = u[s];
3201
3201
  if (e.length !== n.value.length + 2 && e.length !== n.value.length + 4)
3202
3202
  continue;
3203
3203
  let t = e.length === n.value.length + 4;
@@ -3210,7 +3210,7 @@ class Le {
3210
3210
  break;
3211
3211
  }
3212
3212
  if (i)
3213
- return t ? (await n.node.finalize(), this.currentNode = n.node.parentNode || this.root) : (await n.node.finalizeChildNodes(), this.currentNode = new gt({
3213
+ return t ? (await n.node.finalize(), this.currentNode = n.node.parentNode || this.root) : (await n.node.finalizeChildNodes(), this.currentNode = new mt({
3214
3214
  postalMime: this,
3215
3215
  parentNode: n.node,
3216
3216
  ...this.mimeOptions
@@ -3225,53 +3225,53 @@ class Le {
3225
3225
  done: this.readPos >= this.av.length
3226
3226
  });
3227
3227
  for (; this.readPos < this.av.length; ) {
3228
- const a = this.av[this.readPos++];
3229
- if (a !== 13 && a !== 10 && (r = this.readPos), a === 10)
3228
+ const s = this.av[this.readPos++];
3229
+ if (s !== 13 && s !== 10 && (r = this.readPos), s === 10)
3230
3230
  return u();
3231
3231
  }
3232
3232
  return u();
3233
3233
  }
3234
3234
  async processNodeTree() {
3235
- let e = {}, r = /* @__PURE__ */ new Set(), u = this.textMap = /* @__PURE__ */ new Map(), a = this.forceRfc822Attachments(), n = async (t, i, l) => {
3235
+ let e = {}, r = /* @__PURE__ */ new Set(), u = this.textMap = /* @__PURE__ */ new Map(), s = this.forceRfc822Attachments(), n = async (t, i, l) => {
3236
3236
  if (i = i || !1, l = l || !1, t.contentType.multipart)
3237
3237
  t.contentType.multipart === "alternative" ? i = t : t.contentType.multipart === "related" && (l = t);
3238
- else if (this.isInlineMessageRfc822(t) && !a) {
3239
- const d = new Le();
3240
- t.subMessage = await d.parse(t.content), u.has(t) || u.set(t, {});
3241
- let c = u.get(t);
3242
- (t.subMessage.text || !t.subMessage.html) && (c.plain = c.plain || [], c.plain.push({ type: "subMessage", value: t.subMessage }), r.add("plain")), t.subMessage.html && (c.html = c.html || [], c.html.push({ type: "subMessage", value: t.subMessage }), r.add("html")), d.textMap && d.textMap.forEach((h, m) => {
3243
- u.set(m, h);
3238
+ else if (this.isInlineMessageRfc822(t) && !s) {
3239
+ const c = new Le();
3240
+ t.subMessage = await c.parse(t.content), u.has(t) || u.set(t, {});
3241
+ let d = u.get(t);
3242
+ (t.subMessage.text || !t.subMessage.html) && (d.plain = d.plain || [], d.plain.push({ type: "subMessage", value: t.subMessage }), r.add("plain")), t.subMessage.html && (d.html = d.html || [], d.html.push({ type: "subMessage", value: t.subMessage }), r.add("html")), c.textMap && c.textMap.forEach((p, m) => {
3243
+ u.set(m, p);
3244
3244
  });
3245
- for (let h of t.subMessage.attachments || [])
3246
- this.attachments.push(h);
3245
+ for (let p of t.subMessage.attachments || [])
3246
+ this.attachments.push(p);
3247
3247
  } else if (this.isInlineTextNode(t)) {
3248
- let d = t.contentType.parsed.value.substr(t.contentType.parsed.value.indexOf("/") + 1), c = i || t;
3249
- u.has(c) || u.set(c, {});
3250
- let h = u.get(c);
3251
- h[d] = h[d] || [], h[d].push({ type: "text", value: t.getTextContent() }), r.add(d);
3248
+ let c = t.contentType.parsed.value.substr(t.contentType.parsed.value.indexOf("/") + 1), d = i || t;
3249
+ u.has(d) || u.set(d, {});
3250
+ let p = u.get(d);
3251
+ p[c] = p[c] || [], p[c].push({ type: "text", value: t.getTextContent() }), r.add(c);
3252
3252
  } else if (t.content) {
3253
- const d = t.contentDisposition.parsed.params.filename || t.contentType.parsed.params.name || null, c = {
3254
- filename: d ? ke(d) : null,
3253
+ const c = t.contentDisposition.parsed.params.filename || t.contentType.parsed.params.name || null, d = {
3254
+ filename: c ? ke(c) : null,
3255
3255
  mimeType: t.contentType.parsed.value,
3256
3256
  disposition: t.contentDisposition.parsed.value || null
3257
3257
  };
3258
- switch (l && t.contentId && (c.related = !0), t.contentDescription && (c.description = t.contentDescription), t.contentId && (c.contentId = t.contentId), t.contentType.parsed.value) {
3258
+ switch (l && t.contentId && (d.related = !0), t.contentDescription && (d.description = t.contentDescription), t.contentId && (d.contentId = t.contentId), t.contentType.parsed.value) {
3259
3259
  case "text/calendar":
3260
3260
  case "application/ics": {
3261
- t.contentType.parsed.params.method && (c.method = t.contentType.parsed.params.method.toString().toUpperCase().trim());
3262
- const h = t.getTextContent().replace(/\r?\n/g, `
3261
+ t.contentType.parsed.params.method && (d.method = t.contentType.parsed.params.method.toString().toUpperCase().trim());
3262
+ const p = t.getTextContent().replace(/\r?\n/g, `
3263
3263
  `).replace(/\n*$/, `
3264
3264
  `);
3265
- c.content = he.encode(h);
3265
+ d.content = he.encode(p);
3266
3266
  break;
3267
3267
  }
3268
3268
  default:
3269
- c.content = t.content;
3269
+ d.content = t.content;
3270
3270
  }
3271
- this.attachments.push(c);
3271
+ this.attachments.push(d);
3272
3272
  }
3273
- for (let d of t.childNodes)
3274
- await n(d, i, l);
3273
+ for (let c of t.childNodes)
3274
+ await n(c, i, l);
3275
3275
  };
3276
3276
  await n(this.root, !1, []), u.forEach((t) => {
3277
3277
  r.forEach((i) => {
@@ -3284,10 +3284,10 @@ class Le {
3284
3284
  case "subMessage":
3285
3285
  switch (i) {
3286
3286
  case "html":
3287
- e[i].push(At(l.value));
3287
+ e[i].push(bt(l.value));
3288
3288
  break;
3289
3289
  case "plain":
3290
- e[i].push(Dt(l.value));
3290
+ e[i].push(At(l.value));
3291
3291
  break;
3292
3292
  }
3293
3293
  break;
@@ -3303,25 +3303,25 @@ class Le {
3303
3303
  l = "html";
3304
3304
  break;
3305
3305
  }
3306
- (t[l] || []).forEach((d) => {
3307
- switch (d.type) {
3306
+ (t[l] || []).forEach((c) => {
3307
+ switch (c.type) {
3308
3308
  case "text":
3309
3309
  switch (i) {
3310
3310
  case "html":
3311
- e[i].push(tr(d.value));
3311
+ e[i].push(tr(c.value));
3312
3312
  break;
3313
3313
  case "plain":
3314
- e[i].push(rr(d.value));
3314
+ e[i].push(rr(c.value));
3315
3315
  break;
3316
3316
  }
3317
3317
  break;
3318
3318
  case "subMessage":
3319
3319
  switch (i) {
3320
3320
  case "html":
3321
- e[i].push(At(d.value));
3321
+ e[i].push(bt(c.value));
3322
3322
  break;
3323
3323
  case "plain":
3324
- e[i].push(Dt(d.value));
3324
+ e[i].push(At(c.value));
3325
3325
  break;
3326
3326
  }
3327
3327
  break;
@@ -3356,16 +3356,16 @@ class Le {
3356
3356
  return !0;
3357
3357
  let e = !1, r = (u) => {
3358
3358
  u.contentType.multipart || ["message/delivery-status", "message/feedback-report"].includes(u.contentType.parsed.value) && (e = !0);
3359
- for (let a of u.childNodes)
3360
- r(a);
3359
+ for (let s of u.childNodes)
3360
+ r(s);
3361
3361
  };
3362
3362
  return r(this.root), e;
3363
3363
  }
3364
3364
  async resolveStream(e) {
3365
3365
  let r = 0, u = [];
3366
- const a = e.getReader();
3366
+ const s = e.getReader();
3367
3367
  for (; ; ) {
3368
- const { done: i, value: l } = await a.read();
3368
+ const { done: i, value: l } = await s.read();
3369
3369
  if (i)
3370
3370
  break;
3371
3371
  u.push(l), r += l.length;
@@ -3377,7 +3377,7 @@ class Le {
3377
3377
  return n;
3378
3378
  }
3379
3379
  async parse(e) {
3380
- var a, n;
3380
+ var s, n;
3381
3381
  if (this.started)
3382
3382
  throw new Error("Can not reuse parser, create a new PostalMime object");
3383
3383
  for (this.started = !0, e && typeof e.getReader == "function" && (e = await this.resolveStream(e)), e = e || new ArrayBuffer(0), typeof e == "string" && (e = he.encode(e)), (e instanceof Blob || Object.prototype.toString.call(e) === "[object Blob]") && (e = await Pe(e)), e.buffer instanceof ArrayBuffer && (e = new Uint8Array(e).buffer), this.buf = e, this.av = new Uint8Array(e), this.readPos = 0; this.readPos < this.av.length; ) {
@@ -3400,23 +3400,23 @@ class Le {
3400
3400
  if (i && i.value) {
3401
3401
  const l = Fe(i.value);
3402
3402
  if (l && l.length && l[0].address) {
3403
- const d = t.replace(/\-(.)/g, (c, h) => h.toUpperCase());
3404
- r[d] = l[0].address;
3403
+ const c = t.replace(/\-(.)/g, (d, p) => p.toUpperCase());
3404
+ r[c] = l[0].address;
3405
3405
  }
3406
3406
  }
3407
3407
  }
3408
3408
  for (const t of ["to", "cc", "bcc", "reply-to"]) {
3409
- const i = this.root.headers.filter((d) => d.key === t);
3409
+ const i = this.root.headers.filter((c) => c.key === t);
3410
3410
  let l = [];
3411
- if (i.filter((d) => d && d.value).map((d) => Fe(d.value)).forEach((d) => l = l.concat(d || [])), l && l.length) {
3412
- const d = t.replace(/\-(.)/g, (c, h) => h.toUpperCase());
3413
- r[d] = l;
3411
+ if (i.filter((c) => c && c.value).map((c) => Fe(c.value)).forEach((c) => l = l.concat(c || [])), l && l.length) {
3412
+ const c = t.replace(/\-(.)/g, (d, p) => p.toUpperCase());
3413
+ r[c] = l;
3414
3414
  }
3415
3415
  }
3416
3416
  for (const t of ["subject", "message-id", "in-reply-to", "references"]) {
3417
3417
  const i = this.root.headers.find((l) => l.key === t);
3418
3418
  if (i && i.value) {
3419
- const l = t.replace(/\-(.)/g, (d, c) => c.toUpperCase());
3419
+ const l = t.replace(/\-(.)/g, (c, d) => d.toUpperCase());
3420
3420
  r[l] = ke(i.value);
3421
3421
  }
3422
3422
  }
@@ -3425,7 +3425,7 @@ class Le {
3425
3425
  let t = new Date(u.value);
3426
3426
  !t || t.toString() === "Invalid Date" ? t = u.value : t = t.toISOString(), r.date = t;
3427
3427
  }
3428
- switch ((a = this.textContent) != null && a.html && (r.html = this.textContent.html), (n = this.textContent) != null && n.plain && (r.text = this.textContent.plain), r.attachments = this.attachments, this.attachmentEncoding) {
3428
+ switch ((s = this.textContent) != null && s.html && (r.html = this.textContent.html), (n = this.textContent) != null && n.plain && (r.text = this.textContent.plain), r.attachments = this.attachments, this.attachmentEncoding) {
3429
3429
  case "arraybuffer":
3430
3430
  break;
3431
3431
  case "base64":
@@ -3445,7 +3445,7 @@ class Le {
3445
3445
  }
3446
3446
  class cr {
3447
3447
  constructor(e) {
3448
- Ee(this, "config");
3448
+ ve(this, "config");
3449
3449
  if (!e.system_id)
3450
3450
  throw new Error("MailClient: system_id is REQUIRED");
3451
3451
  this.config = e;
@@ -3454,7 +3454,7 @@ class cr {
3454
3454
  * Call a coprocessor (default: mail)
3455
3455
  */
3456
3456
  async callCoprocessor(e, r, u = {}) {
3457
- const a = {
3457
+ const s = {
3458
3458
  coprocessor: e,
3459
3459
  method: r,
3460
3460
  system_id: this.config.system_id,
@@ -3470,7 +3470,7 @@ class cr {
3470
3470
  "Content-Type": "application/json",
3471
3471
  Authorization: `Bearer ${this.getToken()}`
3472
3472
  },
3473
- body: JSON.stringify(a)
3473
+ body: JSON.stringify(s)
3474
3474
  });
3475
3475
  if (!n.ok) {
3476
3476
  const i = await n.text();
@@ -3560,10 +3560,10 @@ class cr {
3560
3560
  */
3561
3561
  async trashEmails(e, r) {
3562
3562
  const u = ["[Gmail]/Trash", "[Gmail]/Corbeille", "[Gmail]/Bin", "Trash"];
3563
- for (const a of u) {
3563
+ for (const s of u) {
3564
3564
  const n = [
3565
3565
  "SELECT INBOX",
3566
- ...r.map((l) => `UID MOVE ${l} ${a}`)
3566
+ ...r.map((l) => `UID MOVE ${l} ${s}`)
3567
3567
  ], i = (await this.imapExec(e, n)).responses.filter((l) => l.ok && l.command === "UID MOVE").length;
3568
3568
  if (i > 0)
3569
3569
  return { success: !0, moved: i };
@@ -3585,7 +3585,7 @@ class cr {
3585
3585
  * List available folders
3586
3586
  */
3587
3587
  async listFolders(e) {
3588
- const u = (await this.imapExec(e, ['LIST "" *'])).responses.find((a) => a.command === "LIST");
3588
+ const u = (await this.imapExec(e, ['LIST "" *'])).responses.find((s) => s.command === "LIST");
3589
3589
  return u != null && u.ok && u.folders ? { success: !0, folders: u.folders } : { success: !1, folders: [] };
3590
3590
  }
3591
3591
  /**
@@ -3593,44 +3593,44 @@ class cr {
3593
3593
  * This is the preferred method - all logic in TypeScript, backend is just a proxy
3594
3594
  */
3595
3595
  async listEmailsSorted(e, r = "INBOX", u = 20) {
3596
- const a = await this.imapExec(e, [
3596
+ const s = await this.imapExec(e, [
3597
3597
  `SELECT ${r}`,
3598
3598
  "FETCH 1:* (UID INTERNALDATE)"
3599
- ]), n = a.responses.find((A) => A.command === "SELECT");
3599
+ ]), n = s.responses.find((D) => D.command === "SELECT");
3600
3600
  if (!(n != null && n.ok))
3601
3601
  throw new Error(`Failed to select folder: ${(n == null ? void 0 : n.error) || "Unknown error"}`);
3602
- const t = a.responses.find((A) => A.command === "FETCH");
3602
+ const t = s.responses.find((D) => D.command === "FETCH");
3603
3603
  if (!(t != null && t.ok) || !t.messages)
3604
3604
  return {
3605
3605
  account: { id: e, label: "", email: "" },
3606
3606
  mailbox: { name: r, total: n.exists || 0 },
3607
3607
  messages: []
3608
3608
  };
3609
- const l = [...t.messages].sort((A, w) => {
3610
- const B = A.internalDate ? new Date(A.internalDate).getTime() : 0;
3611
- return (w.internalDate ? new Date(w.internalDate).getTime() : 0) - B;
3612
- }).slice(0, u).map((A) => A.uid).filter(Boolean);
3609
+ const l = [...t.messages].sort((D, E) => {
3610
+ const B = D.internalDate ? new Date(D.internalDate).getTime() : 0;
3611
+ return (E.internalDate ? new Date(E.internalDate).getTime() : 0) - B;
3612
+ }).slice(0, u).map((D) => D.uid).filter(Boolean);
3613
3613
  if (l.length === 0)
3614
3614
  return {
3615
3615
  account: { id: e, label: "", email: "" },
3616
3616
  mailbox: { name: r, total: n.exists || 0 },
3617
3617
  messages: []
3618
3618
  };
3619
- const c = (await this.imapExec(e, [
3619
+ const d = (await this.imapExec(e, [
3620
3620
  `SELECT ${r}`,
3621
3621
  `UID FETCH ${l.join(",")} (UID FLAGS ENVELOPE)`
3622
- ])).responses.find((A) => A.command === "UID FETCH");
3623
- if (!(c != null && c.ok) || !c.messages)
3624
- throw new Error(`Failed to fetch details: ${(c == null ? void 0 : c.error) || "Unknown error"}`);
3625
- const h = /* @__PURE__ */ new Map();
3626
- for (const A of c.messages)
3627
- A.uid && h.set(A.uid, A);
3628
- const m = l.map((A) => {
3629
- var I, b, N, y, q;
3630
- const w = h.get(A);
3631
- if (!w) return null;
3632
- const B = ((I = w.flags) == null ? void 0 : I.some((L) => L.includes("Seen"))) || !1, G = ((N = (b = w.envelope) == null ? void 0 : b.from) == null ? void 0 : N.email) || "Unknown", O = ((y = w.envelope) == null ? void 0 : y.subject) || "(No subject)", C = ((q = w.envelope) == null ? void 0 : q.date) || "";
3633
- return { uid: A, from: G, subject: O, date: C, seen: B };
3622
+ ])).responses.find((D) => D.command === "UID FETCH");
3623
+ if (!(d != null && d.ok) || !d.messages)
3624
+ throw new Error(`Failed to fetch details: ${(d == null ? void 0 : d.error) || "Unknown error"}`);
3625
+ const p = /* @__PURE__ */ new Map();
3626
+ for (const D of d.messages)
3627
+ D.uid && p.set(D.uid, D);
3628
+ const m = l.map((D) => {
3629
+ var U, g, k, y, q;
3630
+ const E = p.get(D);
3631
+ if (!E) return null;
3632
+ const B = ((U = E.flags) == null ? void 0 : U.some((O) => O.includes("Seen"))) || !1, M = ((k = (g = E.envelope) == null ? void 0 : g.from) == null ? void 0 : k.email) || "Unknown", L = ((y = E.envelope) == null ? void 0 : y.subject) || "(No subject)", C = ((q = E.envelope) == null ? void 0 : q.date) || "";
3633
+ return { uid: D, from: M, subject: L, date: C, seen: B };
3634
3634
  }).filter(Boolean);
3635
3635
  return {
3636
3636
  account: { id: e, label: "", email: "" },
@@ -3648,43 +3648,55 @@ class cr {
3648
3648
  folder: u
3649
3649
  });
3650
3650
  }
3651
+ /**
3652
+ * Get a specific attachment from an email
3653
+ * Returns base64-encoded content for download
3654
+ */
3655
+ async getAttachment(e, r, u, s = "INBOX") {
3656
+ return this.callMail("get_attachment", {
3657
+ account_id: e,
3658
+ uid: r,
3659
+ attachment_index: u,
3660
+ folder: s
3661
+ });
3662
+ }
3651
3663
  /**
3652
3664
  * Get email with client-side parsing using postal-mime
3653
3665
  * This handles CID embedded images by converting them to base64 data URIs
3654
3666
  */
3655
3667
  async getEmailParsed(e, r, u = "INBOX") {
3656
- var w, B, G, O;
3668
+ var E, B, M, L;
3657
3669
  const n = (await this.imapExec(e, [
3658
3670
  `SELECT "${u}"`,
3659
3671
  `UID FETCH ${r} (FLAGS BODY[])`
3660
3672
  ])).responses.find((C) => C.command === "UID FETCH");
3661
- if (!(n != null && n.ok) || !((w = n.messages) != null && w[0]))
3673
+ if (!(n != null && n.ok) || !((E = n.messages) != null && E[0]))
3662
3674
  return console.error("Failed to fetch raw email:", n == null ? void 0 : n.error), null;
3663
3675
  const t = n.messages[0], i = t.body || t.raw;
3664
3676
  if (!i)
3665
3677
  return console.error("No raw email content in response"), null;
3666
- const d = await new Le().parse(i), c = /* @__PURE__ */ new Map();
3667
- for (const C of d.attachments || [])
3678
+ const c = await new Le().parse(i), d = /* @__PURE__ */ new Map();
3679
+ for (const C of c.attachments || [])
3668
3680
  if (C.contentId) {
3669
- const I = this.contentToBase64(C.content), b = `data:${C.mimeType};base64,${I}`, N = C.contentId.replace(/^<|>$/g, "");
3670
- c.set(N, b), c.set(`<${N}>`, b);
3681
+ const U = this.contentToBase64(C.content), g = `data:${C.mimeType};base64,${U}`, k = C.contentId.replace(/^<|>$/g, "");
3682
+ d.set(k, g), d.set(`<${k}>`, g);
3671
3683
  }
3672
- let h = d.html || "";
3673
- h && c.size > 0 && (h = h.replace(/src=["']cid:([^"']+)["']/gi, (C, I) => {
3674
- const b = c.get(I) || c.get(`<${I}>`);
3675
- return b ? `src="${b}"` : C;
3684
+ let p = c.html || "";
3685
+ p && d.size > 0 && (p = p.replace(/src=["']cid:([^"']+)["']/gi, (C, U) => {
3686
+ const g = d.get(U) || d.get(`<${U}>`);
3687
+ return g ? `src="${g}"` : C;
3676
3688
  }));
3677
- const m = ((B = t.flags) == null ? void 0 : B.some((C) => C.toLowerCase().includes("seen"))) || !1, A = ((G = d.from) == null ? void 0 : G.address) || ((O = d.from) == null ? void 0 : O.name) || "Unknown";
3689
+ const m = ((B = t.flags) == null ? void 0 : B.some((C) => C.toLowerCase().includes("seen"))) || !1, D = ((M = c.from) == null ? void 0 : M.address) || ((L = c.from) == null ? void 0 : L.name) || "Unknown";
3678
3690
  return {
3679
3691
  uid: r,
3680
- from: A,
3681
- subject: d.subject || "(No subject)",
3682
- date: d.date || "",
3683
- body: h || d.text || "",
3684
- html: h,
3685
- text: d.text || "",
3692
+ from: D,
3693
+ subject: c.subject || "(No subject)",
3694
+ date: c.date || "",
3695
+ body: p || c.text || "",
3696
+ html: p,
3697
+ text: c.text || "",
3686
3698
  seen: m,
3687
- attachments: (d.attachments || []).map((C) => ({
3699
+ attachments: (c.attachments || []).map((C) => ({
3688
3700
  filename: C.filename || "attachment",
3689
3701
  mimeType: C.mimeType || "application/octet-stream",
3690
3702
  size: this.getContentSize(C.content)
@@ -3703,8 +3715,8 @@ class cr {
3703
3715
  }
3704
3716
  const r = e instanceof Uint8Array ? e : new Uint8Array(e);
3705
3717
  let u = "";
3706
- for (let a = 0; a < r.byteLength; a++)
3707
- u += String.fromCharCode(r[a]);
3718
+ for (let s = 0; s < r.byteLength; s++)
3719
+ u += String.fromCharCode(r[s]);
3708
3720
  return btoa(u);
3709
3721
  }
3710
3722
  /**
@@ -3775,7 +3787,7 @@ class dr {
3775
3787
  }
3776
3788
  class fr {
3777
3789
  constructor(e) {
3778
- Ee(this, "config");
3790
+ ve(this, "config");
3779
3791
  this.config = {
3780
3792
  timeout: 3e4,
3781
3793
  headers: {
@@ -3791,8 +3803,8 @@ class fr {
3791
3803
  if (!e || Object.keys(e).length === 0)
3792
3804
  return "";
3793
3805
  const r = new URLSearchParams();
3794
- Object.entries(e).forEach(([a, n]) => {
3795
- n != null && r.append(a, String(n));
3806
+ Object.entries(e).forEach(([s, n]) => {
3807
+ n != null && r.append(s, String(n));
3796
3808
  });
3797
3809
  const u = r.toString();
3798
3810
  return u ? `?${u}` : "";
@@ -3803,32 +3815,32 @@ class fr {
3803
3815
  async request(e, r = {}) {
3804
3816
  const {
3805
3817
  method: u = "GET",
3806
- headers: a = {},
3818
+ headers: s = {},
3807
3819
  body: n,
3808
3820
  params: t
3809
3821
  } = r, i = `${this.config.baseUrl}/${e}${this.buildQueryString(t)}`, l = {
3810
3822
  ...this.config.headers,
3811
3823
  ...dr.getAuthHeader(),
3812
- ...a
3813
- }, d = {
3824
+ ...s
3825
+ }, c = {
3814
3826
  method: u,
3815
3827
  headers: l
3816
3828
  };
3817
- n && u !== "GET" && (d.body = JSON.stringify(n));
3829
+ n && u !== "GET" && (c.body = JSON.stringify(n));
3818
3830
  try {
3819
- const c = new AbortController(), h = setTimeout(() => c.abort(), this.config.timeout), m = await fetch(i, {
3820
- ...d,
3821
- signal: c.signal
3831
+ const d = new AbortController(), p = setTimeout(() => d.abort(), this.config.timeout), m = await fetch(i, {
3832
+ ...c,
3833
+ signal: d.signal
3822
3834
  });
3823
- if (clearTimeout(h), !m.ok) {
3824
- const A = await m.json().catch(() => ({
3835
+ if (clearTimeout(p), !m.ok) {
3836
+ const D = await m.json().catch(() => ({
3825
3837
  message: m.statusText
3826
3838
  }));
3827
- throw new Error(A.message || `HTTP ${m.status}`);
3839
+ throw new Error(D.message || `HTTP ${m.status}`);
3828
3840
  }
3829
3841
  return await m.json();
3830
- } catch (c) {
3831
- throw c instanceof Error ? c : new Error("An unexpected error occurred");
3842
+ } catch (d) {
3843
+ throw d instanceof Error ? d : new Error("An unexpected error occurred");
3832
3844
  }
3833
3845
  }
3834
3846
  /**
@@ -3875,7 +3887,7 @@ class fr {
3875
3887
  }
3876
3888
  }
3877
3889
  let Oe = null;
3878
- function vr(o) {
3890
+ function xr(o) {
3879
3891
  return Oe = new fr(o), Oe;
3880
3892
  }
3881
3893
  function Ct() {
@@ -3886,76 +3898,76 @@ function Ct() {
3886
3898
  function pr(o, e, r = {}) {
3887
3899
  const {
3888
3900
  enabled: u = !0,
3889
- refetchOnMount: a = !0,
3901
+ refetchOnMount: s = !0,
3890
3902
  onSuccess: n,
3891
3903
  onError: t
3892
- } = r, [i, l] = U(null), [d, c] = U(u), [h, m] = U(null), A = Y(async () => {
3904
+ } = r, [i, l] = P(null), [c, d] = P(u), [p, m] = P(null), D = H(async () => {
3893
3905
  if (u) {
3894
- c(!0), m(null);
3906
+ d(!0), m(null);
3895
3907
  try {
3896
3908
  const B = await Ct().get(o, e);
3897
3909
  l(B), n == null || n(B);
3898
- } catch (w) {
3899
- const B = w instanceof Error ? w : new Error("Unknown error");
3910
+ } catch (E) {
3911
+ const B = E instanceof Error ? E : new Error("Unknown error");
3900
3912
  m(B), t == null || t(B);
3901
3913
  } finally {
3902
- c(!1);
3914
+ d(!1);
3903
3915
  }
3904
3916
  }
3905
3917
  }, [o, JSON.stringify(e), u, n, t]);
3906
3918
  return pe(() => {
3907
- a && A();
3908
- }, [A, a]), {
3919
+ s && D();
3920
+ }, [D, s]), {
3909
3921
  data: i,
3910
- loading: d,
3911
- error: h,
3912
- refetch: A
3922
+ loading: c,
3923
+ error: p,
3924
+ refetch: D
3913
3925
  };
3914
3926
  }
3915
- function Er(o, e = "POST", r = {}) {
3916
- const { onSuccess: u, onError: a } = r, [n, t] = U(null), [i, l] = U(!1), [d, c] = U(null), h = Y(
3917
- async (A) => {
3918
- l(!0), c(null);
3927
+ function vr(o, e = "POST", r = {}) {
3928
+ const { onSuccess: u, onError: s } = r, [n, t] = P(null), [i, l] = P(!1), [c, d] = P(null), p = H(
3929
+ async (D) => {
3930
+ l(!0), d(null);
3919
3931
  try {
3920
- const w = Ct();
3932
+ const E = Ct();
3921
3933
  let B;
3922
3934
  switch (e) {
3923
3935
  case "POST":
3924
- B = await w.post(o, A);
3936
+ B = await E.post(o, D);
3925
3937
  break;
3926
3938
  case "PUT":
3927
- B = await w.put(o, A);
3939
+ B = await E.put(o, D);
3928
3940
  break;
3929
3941
  case "PATCH":
3930
- B = await w.patch(o, A);
3942
+ B = await E.patch(o, D);
3931
3943
  break;
3932
3944
  case "DELETE":
3933
- B = await w.delete(o);
3945
+ B = await E.delete(o);
3934
3946
  break;
3935
3947
  default:
3936
3948
  throw new Error(`Unsupported method: ${e}`);
3937
3949
  }
3938
- return t(B), u == null || u(B, A), B;
3939
- } catch (w) {
3940
- const B = w instanceof Error ? w : new Error("Unknown error");
3941
- return c(B), a == null || a(B, A), null;
3950
+ return t(B), u == null || u(B, D), B;
3951
+ } catch (E) {
3952
+ const B = E instanceof Error ? E : new Error("Unknown error");
3953
+ return d(B), s == null || s(B, D), null;
3942
3954
  } finally {
3943
3955
  l(!1);
3944
3956
  }
3945
3957
  },
3946
- [o, e, u, a]
3947
- ), m = Y(() => {
3948
- t(null), c(null), l(!1);
3958
+ [o, e, u, s]
3959
+ ), m = H(() => {
3960
+ t(null), d(null), l(!1);
3949
3961
  }, []);
3950
3962
  return {
3951
3963
  data: n,
3952
3964
  loading: i,
3953
- error: d,
3954
- mutate: h,
3965
+ error: c,
3966
+ mutate: p,
3955
3967
  reset: m
3956
3968
  };
3957
3969
  }
3958
- var ut = { exports: {} }, xe = {};
3970
+ var ut = { exports: {} }, Ee = {};
3959
3971
  /**
3960
3972
  * @license React
3961
3973
  * react-jsx-runtime.production.min.js
@@ -3965,19 +3977,19 @@ var ut = { exports: {} }, xe = {};
3965
3977
  * This source code is licensed under the MIT license found in the
3966
3978
  * LICENSE file in the root directory of this source tree.
3967
3979
  */
3968
- var bt;
3980
+ var yt;
3969
3981
  function hr() {
3970
- if (bt) return xe;
3971
- bt = 1;
3972
- var o = vt, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, a = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = { key: !0, ref: !0, __self: !0, __source: !0 };
3973
- function t(i, l, d) {
3974
- var c, h = {}, m = null, A = null;
3975
- d !== void 0 && (m = "" + d), l.key !== void 0 && (m = "" + l.key), l.ref !== void 0 && (A = l.ref);
3976
- for (c in l) u.call(l, c) && !n.hasOwnProperty(c) && (h[c] = l[c]);
3977
- if (i && i.defaultProps) for (c in l = i.defaultProps, l) h[c] === void 0 && (h[c] = l[c]);
3978
- return { $$typeof: e, type: i, key: m, ref: A, props: h, _owner: a.current };
3982
+ if (yt) return Ee;
3983
+ yt = 1;
3984
+ var o = st, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, s = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = { key: !0, ref: !0, __self: !0, __source: !0 };
3985
+ function t(i, l, c) {
3986
+ var d, p = {}, m = null, D = null;
3987
+ c !== void 0 && (m = "" + c), l.key !== void 0 && (m = "" + l.key), l.ref !== void 0 && (D = l.ref);
3988
+ for (d in l) u.call(l, d) && !n.hasOwnProperty(d) && (p[d] = l[d]);
3989
+ if (i && i.defaultProps) for (d in l = i.defaultProps, l) p[d] === void 0 && (p[d] = l[d]);
3990
+ return { $$typeof: e, type: i, key: m, ref: D, props: p, _owner: s.current };
3979
3991
  }
3980
- return xe.Fragment = r, xe.jsx = t, xe.jsxs = t, xe;
3992
+ return Ee.Fragment = r, Ee.jsx = t, Ee.jsxs = t, Ee;
3981
3993
  }
3982
3994
  var we = {};
3983
3995
  /**
@@ -3989,91 +4001,91 @@ var we = {};
3989
4001
  * This source code is licensed under the MIT license found in the
3990
4002
  * LICENSE file in the root directory of this source tree.
3991
4003
  */
3992
- var yt;
4004
+ var xt;
3993
4005
  function gr() {
3994
- return yt || (yt = 1, process.env.NODE_ENV !== "production" && function() {
3995
- var o = vt, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), n = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), i = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), A = Symbol.for("react.offscreen"), w = Symbol.iterator, B = "@@iterator";
3996
- function G(s) {
3997
- if (s === null || typeof s != "object")
4006
+ return xt || (xt = 1, process.env.NODE_ENV !== "production" && function() {
4007
+ var o = st, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), n = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), i = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), m = Symbol.for("react.lazy"), D = Symbol.for("react.offscreen"), E = Symbol.iterator, B = "@@iterator";
4008
+ function M(a) {
4009
+ if (a === null || typeof a != "object")
3998
4010
  return null;
3999
- var p = w && s[w] || s[B];
4000
- return typeof p == "function" ? p : null;
4011
+ var h = E && a[E] || a[B];
4012
+ return typeof h == "function" ? h : null;
4001
4013
  }
4002
- var O = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
4003
- function C(s) {
4014
+ var L = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
4015
+ function C(a) {
4004
4016
  {
4005
- for (var p = arguments.length, g = new Array(p > 1 ? p - 1 : 0), E = 1; E < p; E++)
4006
- g[E - 1] = arguments[E];
4007
- I("error", s, g);
4017
+ for (var h = arguments.length, A = new Array(h > 1 ? h - 1 : 0), v = 1; v < h; v++)
4018
+ A[v - 1] = arguments[v];
4019
+ U("error", a, A);
4008
4020
  }
4009
4021
  }
4010
- function I(s, p, g) {
4022
+ function U(a, h, A) {
4011
4023
  {
4012
- var E = O.ReactDebugCurrentFrame, j = E.getStackAddendum();
4013
- j !== "" && (p += "%s", g = g.concat([j]));
4014
- var _ = g.map(function(S) {
4015
- return String(S);
4024
+ var v = L.ReactDebugCurrentFrame, _ = v.getStackAddendum();
4025
+ _ !== "" && (h += "%s", A = A.concat([_]));
4026
+ var R = A.map(function(j) {
4027
+ return String(j);
4016
4028
  });
4017
- _.unshift("Warning: " + p), Function.prototype.apply.call(console[s], console, _);
4029
+ R.unshift("Warning: " + h), Function.prototype.apply.call(console[a], console, R);
4018
4030
  }
4019
4031
  }
4020
- var b = !1, N = !1, y = !1, q = !1, L = !1, k;
4021
- k = Symbol.for("react.module.reference");
4022
- function R(s) {
4023
- return !!(typeof s == "string" || typeof s == "function" || s === u || s === n || L || s === a || s === d || s === c || q || s === A || b || N || y || typeof s == "object" && s !== null && (s.$$typeof === m || s.$$typeof === h || s.$$typeof === t || s.$$typeof === i || s.$$typeof === l || // This needs to include all possible module reference object
4032
+ var g = !1, k = !1, y = !1, q = !1, O = !1, F;
4033
+ F = Symbol.for("react.module.reference");
4034
+ function N(a) {
4035
+ return !!(typeof a == "string" || typeof a == "function" || a === u || a === n || O || a === s || a === c || a === d || q || a === D || g || k || y || typeof a == "object" && a !== null && (a.$$typeof === m || a.$$typeof === p || a.$$typeof === t || a.$$typeof === i || a.$$typeof === l || // This needs to include all possible module reference object
4024
4036
  // types supported by any Flight configuration anywhere since
4025
4037
  // we don't know which Flight build this will end up being used
4026
4038
  // with.
4027
- s.$$typeof === k || s.getModuleId !== void 0));
4039
+ a.$$typeof === F || a.getModuleId !== void 0));
4028
4040
  }
4029
- function v(s, p, g) {
4030
- var E = s.displayName;
4031
- if (E)
4032
- return E;
4033
- var j = p.displayName || p.name || "";
4034
- return j !== "" ? g + "(" + j + ")" : g;
4041
+ function x(a, h, A) {
4042
+ var v = a.displayName;
4043
+ if (v)
4044
+ return v;
4045
+ var _ = h.displayName || h.name || "";
4046
+ return _ !== "" ? A + "(" + _ + ")" : A;
4035
4047
  }
4036
- function H(s) {
4037
- return s.displayName || "Context";
4048
+ function V(a) {
4049
+ return a.displayName || "Context";
4038
4050
  }
4039
- function M(s) {
4040
- if (s == null)
4051
+ function z(a) {
4052
+ if (a == null)
4041
4053
  return null;
4042
- if (typeof s.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof s == "function")
4043
- return s.displayName || s.name || null;
4044
- if (typeof s == "string")
4045
- return s;
4046
- switch (s) {
4054
+ if (typeof a.tag == "number" && C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof a == "function")
4055
+ return a.displayName || a.name || null;
4056
+ if (typeof a == "string")
4057
+ return a;
4058
+ switch (a) {
4047
4059
  case u:
4048
4060
  return "Fragment";
4049
4061
  case r:
4050
4062
  return "Portal";
4051
4063
  case n:
4052
4064
  return "Profiler";
4053
- case a:
4065
+ case s:
4054
4066
  return "StrictMode";
4055
- case d:
4056
- return "Suspense";
4057
4067
  case c:
4068
+ return "Suspense";
4069
+ case d:
4058
4070
  return "SuspenseList";
4059
4071
  }
4060
- if (typeof s == "object")
4061
- switch (s.$$typeof) {
4072
+ if (typeof a == "object")
4073
+ switch (a.$$typeof) {
4062
4074
  case i:
4063
- var p = s;
4064
- return H(p) + ".Consumer";
4075
+ var h = a;
4076
+ return V(h) + ".Consumer";
4065
4077
  case t:
4066
- var g = s;
4067
- return H(g._context) + ".Provider";
4078
+ var A = a;
4079
+ return V(A._context) + ".Provider";
4068
4080
  case l:
4069
- return v(s, s.render, "ForwardRef");
4070
- case h:
4071
- var E = s.displayName || null;
4072
- return E !== null ? E : M(s.type) || "Memo";
4081
+ return x(a, a.render, "ForwardRef");
4082
+ case p:
4083
+ var v = a.displayName || null;
4084
+ return v !== null ? v : z(a.type) || "Memo";
4073
4085
  case m: {
4074
- var j = s, _ = j._payload, S = j._init;
4086
+ var _ = a, R = _._payload, j = _._init;
4075
4087
  try {
4076
- return M(S(_));
4088
+ return z(j(R));
4077
4089
  } catch {
4078
4090
  return null;
4079
4091
  }
@@ -4081,80 +4093,80 @@ function gr() {
4081
4093
  }
4082
4094
  return null;
4083
4095
  }
4084
- var T = Object.assign, z = 0, K, ge, me, Te, De, V, re;
4096
+ var S = Object.assign, G = 0, K, ge, me, Te, De, W, re;
4085
4097
  function ne() {
4086
4098
  }
4087
4099
  ne.__reactDisabledLog = !0;
4088
4100
  function Ue() {
4089
4101
  {
4090
- if (z === 0) {
4091
- K = console.log, ge = console.info, me = console.warn, Te = console.error, De = console.group, V = console.groupCollapsed, re = console.groupEnd;
4092
- var s = {
4102
+ if (G === 0) {
4103
+ K = console.log, ge = console.info, me = console.warn, Te = console.error, De = console.group, W = console.groupCollapsed, re = console.groupEnd;
4104
+ var a = {
4093
4105
  configurable: !0,
4094
4106
  enumerable: !0,
4095
4107
  value: ne,
4096
4108
  writable: !0
4097
4109
  };
4098
4110
  Object.defineProperties(console, {
4099
- info: s,
4100
- log: s,
4101
- warn: s,
4102
- error: s,
4103
- group: s,
4104
- groupCollapsed: s,
4105
- groupEnd: s
4111
+ info: a,
4112
+ log: a,
4113
+ warn: a,
4114
+ error: a,
4115
+ group: a,
4116
+ groupCollapsed: a,
4117
+ groupEnd: a
4106
4118
  });
4107
4119
  }
4108
- z++;
4120
+ G++;
4109
4121
  }
4110
4122
  }
4111
4123
  function Ie() {
4112
4124
  {
4113
- if (z--, z === 0) {
4114
- var s = {
4125
+ if (G--, G === 0) {
4126
+ var a = {
4115
4127
  configurable: !0,
4116
4128
  enumerable: !0,
4117
4129
  writable: !0
4118
4130
  };
4119
4131
  Object.defineProperties(console, {
4120
- log: T({}, s, {
4132
+ log: S({}, a, {
4121
4133
  value: K
4122
4134
  }),
4123
- info: T({}, s, {
4135
+ info: S({}, a, {
4124
4136
  value: ge
4125
4137
  }),
4126
- warn: T({}, s, {
4138
+ warn: S({}, a, {
4127
4139
  value: me
4128
4140
  }),
4129
- error: T({}, s, {
4141
+ error: S({}, a, {
4130
4142
  value: Te
4131
4143
  }),
4132
- group: T({}, s, {
4144
+ group: S({}, a, {
4133
4145
  value: De
4134
4146
  }),
4135
- groupCollapsed: T({}, s, {
4136
- value: V
4147
+ groupCollapsed: S({}, a, {
4148
+ value: W
4137
4149
  }),
4138
- groupEnd: T({}, s, {
4150
+ groupEnd: S({}, a, {
4139
4151
  value: re
4140
4152
  })
4141
4153
  });
4142
4154
  }
4143
- z < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
4155
+ G < 0 && C("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
4144
4156
  }
4145
4157
  }
4146
- var Ae = O.ReactCurrentDispatcher, be;
4147
- function ie(s, p, g) {
4158
+ var Ae = L.ReactCurrentDispatcher, be;
4159
+ function ie(a, h, A) {
4148
4160
  {
4149
4161
  if (be === void 0)
4150
4162
  try {
4151
4163
  throw Error();
4152
- } catch (j) {
4153
- var E = j.stack.trim().match(/\n( *(at )?)/);
4154
- be = E && E[1] || "";
4164
+ } catch (_) {
4165
+ var v = _.stack.trim().match(/\n( *(at )?)/);
4166
+ be = v && v[1] || "";
4155
4167
  }
4156
4168
  return `
4157
- ` + be + s;
4169
+ ` + be + a;
4158
4170
  }
4159
4171
  }
4160
4172
  var ye = !1, oe;
@@ -4162,418 +4174,418 @@ function gr() {
4162
4174
  var $e = typeof WeakMap == "function" ? WeakMap : Map;
4163
4175
  oe = new $e();
4164
4176
  }
4165
- function Se(s, p) {
4166
- if (!s || ye)
4177
+ function Se(a, h) {
4178
+ if (!a || ye)
4167
4179
  return "";
4168
4180
  {
4169
- var g = oe.get(s);
4170
- if (g !== void 0)
4171
- return g;
4181
+ var A = oe.get(a);
4182
+ if (A !== void 0)
4183
+ return A;
4172
4184
  }
4173
- var E;
4185
+ var v;
4174
4186
  ye = !0;
4175
- var j = Error.prepareStackTrace;
4187
+ var _ = Error.prepareStackTrace;
4176
4188
  Error.prepareStackTrace = void 0;
4177
- var _;
4178
- _ = Ae.current, Ae.current = null, Ue();
4189
+ var R;
4190
+ R = Ae.current, Ae.current = null, Ue();
4179
4191
  try {
4180
- if (p) {
4181
- var S = function() {
4192
+ if (h) {
4193
+ var j = function() {
4182
4194
  throw Error();
4183
4195
  };
4184
- if (Object.defineProperty(S.prototype, "props", {
4196
+ if (Object.defineProperty(j.prototype, "props", {
4185
4197
  set: function() {
4186
4198
  throw Error();
4187
4199
  }
4188
4200
  }), typeof Reflect == "object" && Reflect.construct) {
4189
4201
  try {
4190
- Reflect.construct(S, []);
4191
- } catch (Q) {
4192
- E = Q;
4202
+ Reflect.construct(j, []);
4203
+ } catch (Y) {
4204
+ v = Y;
4193
4205
  }
4194
- Reflect.construct(s, [], S);
4206
+ Reflect.construct(a, [], j);
4195
4207
  } else {
4196
4208
  try {
4197
- S.call();
4198
- } catch (Q) {
4199
- E = Q;
4209
+ j.call();
4210
+ } catch (Y) {
4211
+ v = Y;
4200
4212
  }
4201
- s.call(S.prototype);
4213
+ a.call(j.prototype);
4202
4214
  }
4203
4215
  } else {
4204
4216
  try {
4205
4217
  throw Error();
4206
- } catch (Q) {
4207
- E = Q;
4218
+ } catch (Y) {
4219
+ v = Y;
4208
4220
  }
4209
- s();
4221
+ a();
4210
4222
  }
4211
- } catch (Q) {
4212
- if (Q && E && typeof Q.stack == "string") {
4213
- for (var F = Q.stack.split(`
4214
- `), W = E.stack.split(`
4215
- `), P = F.length - 1, $ = W.length - 1; P >= 1 && $ >= 0 && F[P] !== W[$]; )
4223
+ } catch (Y) {
4224
+ if (Y && v && typeof Y.stack == "string") {
4225
+ for (var T = Y.stack.split(`
4226
+ `), Q = v.stack.split(`
4227
+ `), I = T.length - 1, $ = Q.length - 1; I >= 1 && $ >= 0 && T[I] !== Q[$]; )
4216
4228
  $--;
4217
- for (; P >= 1 && $ >= 0; P--, $--)
4218
- if (F[P] !== W[$]) {
4219
- if (P !== 1 || $ !== 1)
4229
+ for (; I >= 1 && $ >= 0; I--, $--)
4230
+ if (T[I] !== Q[$]) {
4231
+ if (I !== 1 || $ !== 1)
4220
4232
  do
4221
- if (P--, $--, $ < 0 || F[P] !== W[$]) {
4233
+ if (I--, $--, $ < 0 || T[I] !== Q[$]) {
4222
4234
  var Z = `
4223
- ` + F[P].replace(" at new ", " at ");
4224
- return s.displayName && Z.includes("<anonymous>") && (Z = Z.replace("<anonymous>", s.displayName)), typeof s == "function" && oe.set(s, Z), Z;
4235
+ ` + T[I].replace(" at new ", " at ");
4236
+ return a.displayName && Z.includes("<anonymous>") && (Z = Z.replace("<anonymous>", a.displayName)), typeof a == "function" && oe.set(a, Z), Z;
4225
4237
  }
4226
- while (P >= 1 && $ >= 0);
4238
+ while (I >= 1 && $ >= 0);
4227
4239
  break;
4228
4240
  }
4229
4241
  }
4230
4242
  } finally {
4231
- ye = !1, Ae.current = _, Ie(), Error.prepareStackTrace = j;
4243
+ ye = !1, Ae.current = R, Ie(), Error.prepareStackTrace = _;
4232
4244
  }
4233
- var fe = s ? s.displayName || s.name : "", ae = fe ? ie(fe) : "";
4234
- return typeof s == "function" && oe.set(s, ae), ae;
4245
+ var fe = a ? a.displayName || a.name : "", se = fe ? ie(fe) : "";
4246
+ return typeof a == "function" && oe.set(a, se), se;
4235
4247
  }
4236
- function Me(s, p, g) {
4237
- return Se(s, !1);
4248
+ function Me(a, h, A) {
4249
+ return Se(a, !1);
4238
4250
  }
4239
- function ze(s) {
4240
- var p = s.prototype;
4241
- return !!(p && p.isReactComponent);
4251
+ function ze(a) {
4252
+ var h = a.prototype;
4253
+ return !!(h && h.isReactComponent);
4242
4254
  }
4243
- function le(s, p, g) {
4244
- if (s == null)
4255
+ function le(a, h, A) {
4256
+ if (a == null)
4245
4257
  return "";
4246
- if (typeof s == "function")
4247
- return Se(s, ze(s));
4248
- if (typeof s == "string")
4249
- return ie(s);
4250
- switch (s) {
4251
- case d:
4252
- return ie("Suspense");
4258
+ if (typeof a == "function")
4259
+ return Se(a, ze(a));
4260
+ if (typeof a == "string")
4261
+ return ie(a);
4262
+ switch (a) {
4253
4263
  case c:
4264
+ return ie("Suspense");
4265
+ case d:
4254
4266
  return ie("SuspenseList");
4255
4267
  }
4256
- if (typeof s == "object")
4257
- switch (s.$$typeof) {
4268
+ if (typeof a == "object")
4269
+ switch (a.$$typeof) {
4258
4270
  case l:
4259
- return Me(s.render);
4260
- case h:
4261
- return le(s.type, p, g);
4271
+ return Me(a.render);
4272
+ case p:
4273
+ return le(a.type, h, A);
4262
4274
  case m: {
4263
- var E = s, j = E._payload, _ = E._init;
4275
+ var v = a, _ = v._payload, R = v._init;
4264
4276
  try {
4265
- return le(_(j), p, g);
4277
+ return le(R(_), h, A);
4266
4278
  } catch {
4267
4279
  }
4268
4280
  }
4269
4281
  }
4270
4282
  return "";
4271
4283
  }
4272
- var ue = Object.prototype.hasOwnProperty, qe = {}, Re = O.ReactDebugCurrentFrame;
4273
- function ce(s) {
4274
- if (s) {
4275
- var p = s._owner, g = le(s.type, s._source, p ? p.type : null);
4276
- Re.setExtraStackFrame(g);
4284
+ var ue = Object.prototype.hasOwnProperty, je = {}, qe = L.ReactDebugCurrentFrame;
4285
+ function ce(a) {
4286
+ if (a) {
4287
+ var h = a._owner, A = le(a.type, a._source, h ? h.type : null);
4288
+ qe.setExtraStackFrame(A);
4277
4289
  } else
4278
- Re.setExtraStackFrame(null);
4290
+ qe.setExtraStackFrame(null);
4279
4291
  }
4280
- function Ge(s, p, g, E, j) {
4292
+ function Ge(a, h, A, v, _) {
4281
4293
  {
4282
- var _ = Function.call.bind(ue);
4283
- for (var S in s)
4284
- if (_(s, S)) {
4285
- var F = void 0;
4294
+ var R = Function.call.bind(ue);
4295
+ for (var j in a)
4296
+ if (R(a, j)) {
4297
+ var T = void 0;
4286
4298
  try {
4287
- if (typeof s[S] != "function") {
4288
- var W = Error((E || "React class") + ": " + g + " type `" + S + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof s[S] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
4289
- throw W.name = "Invariant Violation", W;
4299
+ if (typeof a[j] != "function") {
4300
+ var Q = Error((v || "React class") + ": " + A + " type `" + j + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof a[j] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
4301
+ throw Q.name = "Invariant Violation", Q;
4290
4302
  }
4291
- F = s[S](p, S, E, g, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
4292
- } catch (P) {
4293
- F = P;
4303
+ T = a[j](h, j, v, A, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
4304
+ } catch (I) {
4305
+ T = I;
4294
4306
  }
4295
- F && !(F instanceof Error) && (ce(j), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", E || "React class", g, S, typeof F), ce(null)), F instanceof Error && !(F.message in qe) && (qe[F.message] = !0, ce(j), C("Failed %s type: %s", g, F.message), ce(null));
4307
+ T && !(T instanceof Error) && (ce(_), C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", v || "React class", A, j, typeof T), ce(null)), T instanceof Error && !(T.message in je) && (je[T.message] = !0, ce(_), C("Failed %s type: %s", A, T.message), ce(null));
4296
4308
  }
4297
4309
  }
4298
4310
  }
4299
4311
  var He = Array.isArray;
4300
- function D(s) {
4301
- return He(s);
4312
+ function b(a) {
4313
+ return He(a);
4302
4314
  }
4303
- function x(s) {
4315
+ function w(a) {
4304
4316
  {
4305
- var p = typeof Symbol == "function" && Symbol.toStringTag, g = p && s[Symbol.toStringTag] || s.constructor.name || "Object";
4306
- return g;
4317
+ var h = typeof Symbol == "function" && Symbol.toStringTag, A = h && a[Symbol.toStringTag] || a.constructor.name || "Object";
4318
+ return A;
4307
4319
  }
4308
4320
  }
4309
- function J(s) {
4321
+ function J(a) {
4310
4322
  try {
4311
- return X(s), !1;
4323
+ return X(a), !1;
4312
4324
  } catch {
4313
4325
  return !0;
4314
4326
  }
4315
4327
  }
4316
- function X(s) {
4317
- return "" + s;
4328
+ function X(a) {
4329
+ return "" + a;
4318
4330
  }
4319
- function te(s) {
4320
- if (J(s))
4321
- return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", x(s)), X(s);
4331
+ function te(a) {
4332
+ if (J(a))
4333
+ return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", w(a)), X(a);
4322
4334
  }
4323
- var ee = O.ReactCurrentOwner, Ve = {
4335
+ var ee = L.ReactCurrentOwner, Ve = {
4324
4336
  key: !0,
4325
4337
  ref: !0,
4326
4338
  __self: !0,
4327
4339
  __source: !0
4328
- }, ve, je;
4329
- function Bt(s) {
4330
- if (ue.call(s, "ref")) {
4331
- var p = Object.getOwnPropertyDescriptor(s, "ref").get;
4332
- if (p && p.isReactWarning)
4340
+ }, xe, Ne;
4341
+ function Bt(a) {
4342
+ if (ue.call(a, "ref")) {
4343
+ var h = Object.getOwnPropertyDescriptor(a, "ref").get;
4344
+ if (h && h.isReactWarning)
4333
4345
  return !1;
4334
4346
  }
4335
- return s.ref !== void 0;
4347
+ return a.ref !== void 0;
4336
4348
  }
4337
- function kt(s) {
4338
- if (ue.call(s, "key")) {
4339
- var p = Object.getOwnPropertyDescriptor(s, "key").get;
4340
- if (p && p.isReactWarning)
4349
+ function kt(a) {
4350
+ if (ue.call(a, "key")) {
4351
+ var h = Object.getOwnPropertyDescriptor(a, "key").get;
4352
+ if (h && h.isReactWarning)
4341
4353
  return !1;
4342
4354
  }
4343
- return s.key !== void 0;
4355
+ return a.key !== void 0;
4344
4356
  }
4345
- function Ft(s, p) {
4346
- typeof s.ref == "string" && ee.current;
4357
+ function Ft(a, h) {
4358
+ typeof a.ref == "string" && ee.current;
4347
4359
  }
4348
- function Tt(s, p) {
4360
+ function Tt(a, h) {
4349
4361
  {
4350
- var g = function() {
4351
- ve || (ve = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
4362
+ var A = function() {
4363
+ xe || (xe = !0, C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
4352
4364
  };
4353
- g.isReactWarning = !0, Object.defineProperty(s, "key", {
4354
- get: g,
4365
+ A.isReactWarning = !0, Object.defineProperty(a, "key", {
4366
+ get: A,
4355
4367
  configurable: !0
4356
4368
  });
4357
4369
  }
4358
4370
  }
4359
- function St(s, p) {
4371
+ function St(a, h) {
4360
4372
  {
4361
- var g = function() {
4362
- je || (je = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", p));
4373
+ var A = function() {
4374
+ Ne || (Ne = !0, C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", h));
4363
4375
  };
4364
- g.isReactWarning = !0, Object.defineProperty(s, "ref", {
4365
- get: g,
4376
+ A.isReactWarning = !0, Object.defineProperty(a, "ref", {
4377
+ get: A,
4366
4378
  configurable: !0
4367
4379
  });
4368
4380
  }
4369
4381
  }
4370
- var qt = function(s, p, g, E, j, _, S) {
4371
- var F = {
4382
+ var jt = function(a, h, A, v, _, R, j) {
4383
+ var T = {
4372
4384
  // This tag allows us to uniquely identify this as a React Element
4373
4385
  $$typeof: e,
4374
4386
  // Built-in properties that belong on the element
4375
- type: s,
4376
- key: p,
4377
- ref: g,
4378
- props: S,
4387
+ type: a,
4388
+ key: h,
4389
+ ref: A,
4390
+ props: j,
4379
4391
  // Record the component responsible for creating this element.
4380
- _owner: _
4392
+ _owner: R
4381
4393
  };
4382
- return F._store = {}, Object.defineProperty(F._store, "validated", {
4394
+ return T._store = {}, Object.defineProperty(T._store, "validated", {
4383
4395
  configurable: !1,
4384
4396
  enumerable: !1,
4385
4397
  writable: !0,
4386
4398
  value: !1
4387
- }), Object.defineProperty(F, "_self", {
4399
+ }), Object.defineProperty(T, "_self", {
4388
4400
  configurable: !1,
4389
4401
  enumerable: !1,
4390
4402
  writable: !1,
4391
- value: E
4392
- }), Object.defineProperty(F, "_source", {
4403
+ value: v
4404
+ }), Object.defineProperty(T, "_source", {
4393
4405
  configurable: !1,
4394
4406
  enumerable: !1,
4395
4407
  writable: !1,
4396
- value: j
4397
- }), Object.freeze && (Object.freeze(F.props), Object.freeze(F)), F;
4408
+ value: _
4409
+ }), Object.freeze && (Object.freeze(T.props), Object.freeze(T)), T;
4398
4410
  };
4399
- function Rt(s, p, g, E, j) {
4411
+ function qt(a, h, A, v, _) {
4400
4412
  {
4401
- var _, S = {}, F = null, W = null;
4402
- g !== void 0 && (te(g), F = "" + g), kt(p) && (te(p.key), F = "" + p.key), Bt(p) && (W = p.ref, Ft(p, j));
4403
- for (_ in p)
4404
- ue.call(p, _) && !Ve.hasOwnProperty(_) && (S[_] = p[_]);
4405
- if (s && s.defaultProps) {
4406
- var P = s.defaultProps;
4407
- for (_ in P)
4408
- S[_] === void 0 && (S[_] = P[_]);
4413
+ var R, j = {}, T = null, Q = null;
4414
+ A !== void 0 && (te(A), T = "" + A), kt(h) && (te(h.key), T = "" + h.key), Bt(h) && (Q = h.ref, Ft(h, _));
4415
+ for (R in h)
4416
+ ue.call(h, R) && !Ve.hasOwnProperty(R) && (j[R] = h[R]);
4417
+ if (a && a.defaultProps) {
4418
+ var I = a.defaultProps;
4419
+ for (R in I)
4420
+ j[R] === void 0 && (j[R] = I[R]);
4409
4421
  }
4410
- if (F || W) {
4411
- var $ = typeof s == "function" ? s.displayName || s.name || "Unknown" : s;
4412
- F && Tt(S, $), W && St(S, $);
4422
+ if (T || Q) {
4423
+ var $ = typeof a == "function" ? a.displayName || a.name || "Unknown" : a;
4424
+ T && Tt(j, $), Q && St(j, $);
4413
4425
  }
4414
- return qt(s, F, W, j, E, ee.current, S);
4426
+ return jt(a, T, Q, _, v, ee.current, j);
4415
4427
  }
4416
4428
  }
4417
- var We = O.ReactCurrentOwner, at = O.ReactDebugCurrentFrame;
4418
- function de(s) {
4419
- if (s) {
4420
- var p = s._owner, g = le(s.type, s._source, p ? p.type : null);
4421
- at.setExtraStackFrame(g);
4429
+ var We = L.ReactCurrentOwner, at = L.ReactDebugCurrentFrame;
4430
+ function de(a) {
4431
+ if (a) {
4432
+ var h = a._owner, A = le(a.type, a._source, h ? h.type : null);
4433
+ at.setExtraStackFrame(A);
4422
4434
  } else
4423
4435
  at.setExtraStackFrame(null);
4424
4436
  }
4425
4437
  var Qe;
4426
4438
  Qe = !1;
4427
- function Ye(s) {
4428
- return typeof s == "object" && s !== null && s.$$typeof === e;
4439
+ function Ye(a) {
4440
+ return typeof a == "object" && a !== null && a.$$typeof === e;
4429
4441
  }
4430
- function st() {
4442
+ function nt() {
4431
4443
  {
4432
4444
  if (We.current) {
4433
- var s = M(We.current.type);
4434
- if (s)
4445
+ var a = z(We.current.type);
4446
+ if (a)
4435
4447
  return `
4436
4448
 
4437
- Check the render method of \`` + s + "`.";
4449
+ Check the render method of \`` + a + "`.";
4438
4450
  }
4439
4451
  return "";
4440
4452
  }
4441
4453
  }
4442
- function jt(s) {
4454
+ function Nt(a) {
4443
4455
  return "";
4444
4456
  }
4445
- var nt = {};
4446
- function _t(s) {
4457
+ var it = {};
4458
+ function _t(a) {
4447
4459
  {
4448
- var p = st();
4449
- if (!p) {
4450
- var g = typeof s == "string" ? s : s.displayName || s.name;
4451
- g && (p = `
4460
+ var h = nt();
4461
+ if (!h) {
4462
+ var A = typeof a == "string" ? a : a.displayName || a.name;
4463
+ A && (h = `
4452
4464
 
4453
- Check the top-level render call using <` + g + ">.");
4465
+ Check the top-level render call using <` + A + ">.");
4454
4466
  }
4455
- return p;
4467
+ return h;
4456
4468
  }
4457
4469
  }
4458
- function it(s, p) {
4470
+ function ot(a, h) {
4459
4471
  {
4460
- if (!s._store || s._store.validated || s.key != null)
4472
+ if (!a._store || a._store.validated || a.key != null)
4461
4473
  return;
4462
- s._store.validated = !0;
4463
- var g = _t(p);
4464
- if (nt[g])
4474
+ a._store.validated = !0;
4475
+ var A = _t(h);
4476
+ if (it[A])
4465
4477
  return;
4466
- nt[g] = !0;
4467
- var E = "";
4468
- s && s._owner && s._owner !== We.current && (E = " It was passed a child from " + M(s._owner.type) + "."), de(s), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', g, E), de(null);
4478
+ it[A] = !0;
4479
+ var v = "";
4480
+ a && a._owner && a._owner !== We.current && (v = " It was passed a child from " + z(a._owner.type) + "."), de(a), C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', A, v), de(null);
4469
4481
  }
4470
4482
  }
4471
- function ot(s, p) {
4483
+ function lt(a, h) {
4472
4484
  {
4473
- if (typeof s != "object")
4485
+ if (typeof a != "object")
4474
4486
  return;
4475
- if (D(s))
4476
- for (var g = 0; g < s.length; g++) {
4477
- var E = s[g];
4478
- Ye(E) && it(E, p);
4487
+ if (b(a))
4488
+ for (var A = 0; A < a.length; A++) {
4489
+ var v = a[A];
4490
+ Ye(v) && ot(v, h);
4479
4491
  }
4480
- else if (Ye(s))
4481
- s._store && (s._store.validated = !0);
4482
- else if (s) {
4483
- var j = G(s);
4484
- if (typeof j == "function" && j !== s.entries)
4485
- for (var _ = j.call(s), S; !(S = _.next()).done; )
4486
- Ye(S.value) && it(S.value, p);
4492
+ else if (Ye(a))
4493
+ a._store && (a._store.validated = !0);
4494
+ else if (a) {
4495
+ var _ = M(a);
4496
+ if (typeof _ == "function" && _ !== a.entries)
4497
+ for (var R = _.call(a), j; !(j = R.next()).done; )
4498
+ Ye(j.value) && ot(j.value, h);
4487
4499
  }
4488
4500
  }
4489
4501
  }
4490
- function Nt(s) {
4502
+ function Rt(a) {
4491
4503
  {
4492
- var p = s.type;
4493
- if (p == null || typeof p == "string")
4504
+ var h = a.type;
4505
+ if (h == null || typeof h == "string")
4494
4506
  return;
4495
- var g;
4496
- if (typeof p == "function")
4497
- g = p.propTypes;
4498
- else if (typeof p == "object" && (p.$$typeof === l || // Note: Memo only checks outer props here.
4507
+ var A;
4508
+ if (typeof h == "function")
4509
+ A = h.propTypes;
4510
+ else if (typeof h == "object" && (h.$$typeof === l || // Note: Memo only checks outer props here.
4499
4511
  // Inner props are checked in the reconciler.
4500
- p.$$typeof === h))
4501
- g = p.propTypes;
4512
+ h.$$typeof === p))
4513
+ A = h.propTypes;
4502
4514
  else
4503
4515
  return;
4504
- if (g) {
4505
- var E = M(p);
4506
- Ge(g, s.props, "prop", E, s);
4507
- } else if (p.PropTypes !== void 0 && !Qe) {
4516
+ if (A) {
4517
+ var v = z(h);
4518
+ Ge(A, a.props, "prop", v, a);
4519
+ } else if (h.PropTypes !== void 0 && !Qe) {
4508
4520
  Qe = !0;
4509
- var j = M(p);
4510
- C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", j || "Unknown");
4521
+ var _ = z(h);
4522
+ C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _ || "Unknown");
4511
4523
  }
4512
- typeof p.getDefaultProps == "function" && !p.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
4524
+ typeof h.getDefaultProps == "function" && !h.getDefaultProps.isReactClassApproved && C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
4513
4525
  }
4514
4526
  }
4515
- function Lt(s) {
4527
+ function Lt(a) {
4516
4528
  {
4517
- for (var p = Object.keys(s.props), g = 0; g < p.length; g++) {
4518
- var E = p[g];
4519
- if (E !== "children" && E !== "key") {
4520
- de(s), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", E), de(null);
4529
+ for (var h = Object.keys(a.props), A = 0; A < h.length; A++) {
4530
+ var v = h[A];
4531
+ if (v !== "children" && v !== "key") {
4532
+ de(a), C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), de(null);
4521
4533
  break;
4522
4534
  }
4523
4535
  }
4524
- s.ref !== null && (de(s), C("Invalid attribute `ref` supplied to `React.Fragment`."), de(null));
4536
+ a.ref !== null && (de(a), C("Invalid attribute `ref` supplied to `React.Fragment`."), de(null));
4525
4537
  }
4526
4538
  }
4527
- var lt = {};
4528
- function ct(s, p, g, E, j, _) {
4539
+ var ct = {};
4540
+ function dt(a, h, A, v, _, R) {
4529
4541
  {
4530
- var S = R(s);
4531
- if (!S) {
4532
- var F = "";
4533
- (s === void 0 || typeof s == "object" && s !== null && Object.keys(s).length === 0) && (F += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
4534
- var W = jt();
4535
- W ? F += W : F += st();
4536
- var P;
4537
- s === null ? P = "null" : D(s) ? P = "array" : s !== void 0 && s.$$typeof === e ? (P = "<" + (M(s.type) || "Unknown") + " />", F = " Did you accidentally export a JSX literal instead of a component?") : P = typeof s, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, F);
4542
+ var j = N(a);
4543
+ if (!j) {
4544
+ var T = "";
4545
+ (a === void 0 || typeof a == "object" && a !== null && Object.keys(a).length === 0) && (T += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
4546
+ var Q = Nt();
4547
+ Q ? T += Q : T += nt();
4548
+ var I;
4549
+ a === null ? I = "null" : b(a) ? I = "array" : a !== void 0 && a.$$typeof === e ? (I = "<" + (z(a.type) || "Unknown") + " />", T = " Did you accidentally export a JSX literal instead of a component?") : I = typeof a, C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", I, T);
4538
4550
  }
4539
- var $ = Rt(s, p, g, j, _);
4551
+ var $ = qt(a, h, A, _, R);
4540
4552
  if ($ == null)
4541
4553
  return $;
4542
- if (S) {
4543
- var Z = p.children;
4554
+ if (j) {
4555
+ var Z = h.children;
4544
4556
  if (Z !== void 0)
4545
- if (E)
4546
- if (D(Z)) {
4557
+ if (v)
4558
+ if (b(Z)) {
4547
4559
  for (var fe = 0; fe < Z.length; fe++)
4548
- ot(Z[fe], s);
4560
+ lt(Z[fe], a);
4549
4561
  Object.freeze && Object.freeze(Z);
4550
4562
  } else
4551
4563
  C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
4552
4564
  else
4553
- ot(Z, s);
4565
+ lt(Z, a);
4554
4566
  }
4555
- if (ue.call(p, "key")) {
4556
- var ae = M(s), Q = Object.keys(p).filter(function(Mt) {
4567
+ if (ue.call(h, "key")) {
4568
+ var se = z(a), Y = Object.keys(h).filter(function(Mt) {
4557
4569
  return Mt !== "key";
4558
- }), Je = Q.length > 0 ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}";
4559
- if (!lt[ae + Je]) {
4560
- var $t = Q.length > 0 ? "{" + Q.join(": ..., ") + ": ...}" : "{}";
4570
+ }), Je = Y.length > 0 ? "{key: someKey, " + Y.join(": ..., ") + ": ...}" : "{key: someKey}";
4571
+ if (!ct[se + Je]) {
4572
+ var $t = Y.length > 0 ? "{" + Y.join(": ..., ") + ": ...}" : "{}";
4561
4573
  C(`A props object containing a "key" prop is being spread into JSX:
4562
4574
  let props = %s;
4563
4575
  <%s {...props} />
4564
4576
  React keys must be passed directly to JSX without using spread:
4565
4577
  let props = %s;
4566
- <%s key={someKey} {...props} />`, Je, ae, $t, ae), lt[ae + Je] = !0;
4578
+ <%s key={someKey} {...props} />`, Je, se, $t, se), ct[se + Je] = !0;
4567
4579
  }
4568
4580
  }
4569
- return s === u ? Lt($) : Nt($), $;
4581
+ return a === u ? Lt($) : Rt($), $;
4570
4582
  }
4571
4583
  }
4572
- function Ot(s, p, g) {
4573
- return ct(s, p, g, !0);
4584
+ function Ot(a, h, A) {
4585
+ return dt(a, h, A, !0);
4574
4586
  }
4575
- function Pt(s, p, g) {
4576
- return ct(s, p, g, !1);
4587
+ function Pt(a, h, A) {
4588
+ return dt(a, h, A, !1);
4577
4589
  }
4578
4590
  var Ut = Pt, It = Ot;
4579
4591
  we.Fragment = u, we.jsx = Ut, we.jsxs = It;
@@ -4592,20 +4604,20 @@ class tt {
4592
4604
  * Filter by field value
4593
4605
  */
4594
4606
  static filterBy(e, r, u) {
4595
- return e.filter((a) => a[r] === u);
4607
+ return e.filter((s) => s[r] === u);
4596
4608
  }
4597
4609
  /**
4598
4610
  * Filter by multiple fields
4599
4611
  */
4600
4612
  static filterByFields(e, r) {
4601
- return e.filter((u) => Object.entries(r).every(([a, n]) => u[a] === n));
4613
+ return e.filter((u) => Object.entries(r).every(([s, n]) => u[s] === n));
4602
4614
  }
4603
4615
  /**
4604
4616
  * Sort array by field
4605
4617
  */
4606
4618
  static sort(e, r, u = "asc") {
4607
- return [...e].sort((a, n) => {
4608
- const t = a[r], i = n[r];
4619
+ return [...e].sort((s, n) => {
4620
+ const t = s[r], i = n[r];
4609
4621
  if (t === i) return 0;
4610
4622
  let l = 0;
4611
4623
  return t > i && (l = 1), t < i && (l = -1), u === "asc" ? l : -l;
@@ -4616,19 +4628,19 @@ class tt {
4616
4628
  */
4617
4629
  static search(e, r, u) {
4618
4630
  if (!r.trim()) return e;
4619
- const a = r.toLowerCase();
4631
+ const s = r.toLowerCase();
4620
4632
  return e.filter((n) => u.some((t) => {
4621
4633
  const i = n[t];
4622
- return i == null ? !1 : String(i).toLowerCase().includes(a);
4634
+ return i == null ? !1 : String(i).toLowerCase().includes(s);
4623
4635
  }));
4624
4636
  }
4625
4637
  /**
4626
4638
  * Paginate array
4627
4639
  */
4628
4640
  static paginate(e, r, u) {
4629
- const a = (r - 1) * u, n = a + u;
4641
+ const s = (r - 1) * u, n = s + u;
4630
4642
  return {
4631
- data: e.slice(a, n),
4643
+ data: e.slice(s, n),
4632
4644
  total: e.length,
4633
4645
  page: r,
4634
4646
  totalPages: Math.ceil(e.length / u)
@@ -4638,24 +4650,24 @@ class tt {
4638
4650
  * Group items by field value
4639
4651
  */
4640
4652
  static groupBy(e, r) {
4641
- return e.reduce((u, a) => {
4642
- const n = String(a[r]);
4643
- return u[n] || (u[n] = []), u[n].push(a), u;
4653
+ return e.reduce((u, s) => {
4654
+ const n = String(s[r]);
4655
+ return u[n] || (u[n] = []), u[n].push(s), u;
4644
4656
  }, {});
4645
4657
  }
4646
4658
  /**
4647
4659
  * Get unique values for a field
4648
4660
  */
4649
4661
  static unique(e, r) {
4650
- const u = e.map((a) => a[r]);
4662
+ const u = e.map((s) => s[r]);
4651
4663
  return [...new Set(u)];
4652
4664
  }
4653
4665
  /**
4654
4666
  * Count items by field value
4655
4667
  */
4656
4668
  static countBy(e, r) {
4657
- return e.reduce((u, a) => {
4658
- const n = String(a[r]);
4669
+ return e.reduce((u, s) => {
4670
+ const n = String(s[r]);
4659
4671
  return u[n] = (u[n] || 0) + 1, u;
4660
4672
  }, {});
4661
4673
  }
@@ -4663,71 +4675,71 @@ class tt {
4663
4675
  * Apply multiple operations in sequence
4664
4676
  */
4665
4677
  static pipe(e, r) {
4666
- return r.reduce((u, a) => a(u), e);
4678
+ return r.reduce((u, s) => s(u), e);
4667
4679
  }
4668
4680
  }
4669
- function xr({
4681
+ function Er({
4670
4682
  endpoint: o,
4671
4683
  params: e,
4672
4684
  layout: r = "list",
4673
4685
  title: u,
4674
- emptyMessage: a = "No items found",
4686
+ emptyMessage: s = "No items found",
4675
4687
  renderItem: n,
4676
- keyExtractor: t = (B, G) => B.id || B._id || String(G),
4688
+ keyExtractor: t = (B, M) => B.id || B._id || String(M),
4677
4689
  searchable: i = !1,
4678
4690
  searchFields: l = [],
4679
- searchPlaceholder: d = "Search...",
4680
- filters: c = [],
4681
- pageSize: h = 20,
4691
+ searchPlaceholder: c = "Search...",
4692
+ filters: d = [],
4693
+ pageSize: p = 20,
4682
4694
  onItemClick: m,
4683
- onRefresh: A,
4684
- theme: w = {}
4695
+ onRefresh: D,
4696
+ theme: E = {}
4685
4697
  }) {
4686
- const { data: B, loading: G, error: O, refetch: C } = pr(o, e), [I, b] = U(""), [N, y] = U({}), [q, L] = U(1), k = Et(() => {
4698
+ const { data: B, loading: M, error: L, refetch: C } = pr(o, e), [U, g] = P(""), [k, y] = P({}), [q, O] = P(1), F = vt(() => {
4687
4699
  if (!B) return { data: [], total: 0, totalPages: 0 };
4688
- let T = B;
4689
- return i && I && l.length > 0 && (T = tt.search(T, I, l)), Object.keys(N).length > 0 && (T = tt.filterByFields(T, N)), tt.paginate(T, q, h);
4690
- }, [B, I, N, q, h, i, l]);
4700
+ let S = B;
4701
+ return i && U && l.length > 0 && (S = tt.search(S, U, l)), Object.keys(k).length > 0 && (S = tt.filterByFields(S, k)), tt.paginate(S, q, p);
4702
+ }, [B, U, k, q, p, i, l]);
4691
4703
  pe(() => {
4692
- L(1);
4693
- }, [I, N]);
4694
- const R = () => {
4695
- b(""), y({}), L(1), C(), A == null || A();
4696
- }, v = {
4697
- background: w.background || "#ffffff",
4698
- cardBackground: w.cardBackground || "#f9fafb",
4699
- text: w.text || "#111827",
4700
- textSecondary: w.textSecondary || "#6b7280",
4701
- border: w.border || "#e5e7eb",
4702
- primary: w.primary || "#3b82f6"
4703
- }, M = n || ((T) => /* @__PURE__ */ f.jsxs("div", { style: {
4704
+ O(1);
4705
+ }, [U, k]);
4706
+ const N = () => {
4707
+ g(""), y({}), O(1), C(), D == null || D();
4708
+ }, x = {
4709
+ background: E.background || "#ffffff",
4710
+ cardBackground: E.cardBackground || "#f9fafb",
4711
+ text: E.text || "#111827",
4712
+ textSecondary: E.textSecondary || "#6b7280",
4713
+ border: E.border || "#e5e7eb",
4714
+ primary: E.primary || "#3b82f6"
4715
+ }, z = n || ((S) => /* @__PURE__ */ f.jsxs("div", { style: {
4704
4716
  padding: "16px",
4705
4717
  cursor: m ? "pointer" : "default"
4706
4718
  }, children: [
4707
- /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: v.text }, children: T.title || T.name || T.label || "Untitled" }),
4708
- T.description && /* @__PURE__ */ f.jsx("div", { style: { fontSize: "13px", color: v.textSecondary, marginTop: "4px" }, children: T.description })
4719
+ /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", fontWeight: 500, color: x.text }, children: S.title || S.name || S.label || "Untitled" }),
4720
+ S.description && /* @__PURE__ */ f.jsx("div", { style: { fontSize: "13px", color: x.textSecondary, marginTop: "4px" }, children: S.description })
4709
4721
  ] }));
4710
- return G && !B ? /* @__PURE__ */ f.jsx("div", { style: {
4722
+ return M && !B ? /* @__PURE__ */ f.jsx("div", { style: {
4711
4723
  display: "flex",
4712
4724
  alignItems: "center",
4713
4725
  justifyContent: "center",
4714
4726
  padding: "48px",
4715
- color: v.textSecondary
4716
- }, children: "Loading..." }) : O ? /* @__PURE__ */ f.jsxs("div", { style: {
4727
+ color: x.textSecondary
4728
+ }, children: "Loading..." }) : L ? /* @__PURE__ */ f.jsxs("div", { style: {
4717
4729
  padding: "24px",
4718
4730
  textAlign: "center",
4719
4731
  color: "#ef4444"
4720
4732
  }, children: [
4721
4733
  /* @__PURE__ */ f.jsx("div", { style: { fontWeight: 500, marginBottom: "8px" }, children: "Error" }),
4722
- /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px" }, children: O.message }),
4734
+ /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px" }, children: L.message }),
4723
4735
  /* @__PURE__ */ f.jsx(
4724
4736
  "button",
4725
4737
  {
4726
- onClick: R,
4738
+ onClick: N,
4727
4739
  style: {
4728
4740
  marginTop: "16px",
4729
4741
  padding: "8px 16px",
4730
- background: v.primary,
4742
+ background: x.primary,
4731
4743
  color: "white",
4732
4744
  border: "none",
4733
4745
  borderRadius: "6px",
@@ -4737,36 +4749,36 @@ function xr({
4737
4749
  }
4738
4750
  )
4739
4751
  ] }) : /* @__PURE__ */ f.jsxs("div", { style: {
4740
- background: v.background,
4752
+ background: x.background,
4741
4753
  borderRadius: "12px",
4742
4754
  overflow: "hidden"
4743
4755
  }, children: [
4744
- (u || i || c.length > 0) && /* @__PURE__ */ f.jsxs("div", { style: {
4756
+ (u || i || d.length > 0) && /* @__PURE__ */ f.jsxs("div", { style: {
4745
4757
  padding: "16px",
4746
- borderBottom: `1px solid ${v.border}`
4758
+ borderBottom: `1px solid ${x.border}`
4747
4759
  }, children: [
4748
4760
  /* @__PURE__ */ f.jsxs("div", { style: {
4749
4761
  display: "flex",
4750
4762
  alignItems: "center",
4751
4763
  justifyContent: "space-between",
4752
- marginBottom: i || c.length > 0 ? "12px" : "0"
4764
+ marginBottom: i || d.length > 0 ? "12px" : "0"
4753
4765
  }, children: [
4754
4766
  u && /* @__PURE__ */ f.jsx("h2", { style: {
4755
4767
  margin: 0,
4756
4768
  fontSize: "18px",
4757
4769
  fontWeight: 600,
4758
- color: v.text
4770
+ color: x.text
4759
4771
  }, children: u }),
4760
4772
  /* @__PURE__ */ f.jsx(
4761
4773
  "button",
4762
4774
  {
4763
- onClick: R,
4775
+ onClick: N,
4764
4776
  style: {
4765
4777
  padding: "6px 12px",
4766
4778
  background: "transparent",
4767
- border: `1px solid ${v.border}`,
4779
+ border: `1px solid ${x.border}`,
4768
4780
  borderRadius: "6px",
4769
- color: v.textSecondary,
4781
+ color: x.textSecondary,
4770
4782
  cursor: "pointer",
4771
4783
  fontSize: "13px"
4772
4784
  },
@@ -4778,13 +4790,13 @@ function xr({
4778
4790
  "input",
4779
4791
  {
4780
4792
  type: "text",
4781
- placeholder: d,
4782
- value: I,
4783
- onChange: (T) => b(T.target.value),
4793
+ placeholder: c,
4794
+ value: U,
4795
+ onChange: (S) => g(S.target.value),
4784
4796
  style: {
4785
4797
  width: "100%",
4786
4798
  padding: "8px 12px",
4787
- border: `1px solid ${v.border}`,
4799
+ border: `1px solid ${x.border}`,
4788
4800
  borderRadius: "8px",
4789
4801
  fontSize: "14px",
4790
4802
  outline: "none"
@@ -4798,52 +4810,52 @@ function xr({
4798
4810
  gridTemplateColumns: r === "grid" ? "repeat(auto-fill, minmax(250px, 1fr))" : void 0,
4799
4811
  gap: r === "list" ? "0" : "16px",
4800
4812
  padding: r === "list" ? "0" : "16px"
4801
- }, children: k.data.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: {
4813
+ }, children: F.data.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: {
4802
4814
  padding: "48px",
4803
4815
  textAlign: "center",
4804
- color: v.textSecondary
4805
- }, children: a }) : k.data.map((T, z) => /* @__PURE__ */ f.jsx(
4816
+ color: x.textSecondary
4817
+ }, children: s }) : F.data.map((S, G) => /* @__PURE__ */ f.jsx(
4806
4818
  "div",
4807
4819
  {
4808
- onClick: () => m == null ? void 0 : m(T),
4820
+ onClick: () => m == null ? void 0 : m(S),
4809
4821
  style: {
4810
- background: v.cardBackground,
4822
+ background: x.cardBackground,
4811
4823
  borderRadius: r === "list" ? "0" : "8px",
4812
- borderBottom: r === "list" ? `1px solid ${v.border}` : "none",
4824
+ borderBottom: r === "list" ? `1px solid ${x.border}` : "none",
4813
4825
  transition: "all 0.15s ease"
4814
4826
  },
4815
4827
  onMouseEnter: (K) => {
4816
- m && (K.currentTarget.style.background = v.border);
4828
+ m && (K.currentTarget.style.background = x.border);
4817
4829
  },
4818
4830
  onMouseLeave: (K) => {
4819
- K.currentTarget.style.background = v.cardBackground;
4831
+ K.currentTarget.style.background = x.cardBackground;
4820
4832
  },
4821
- children: M(T, z)
4833
+ children: z(S, G)
4822
4834
  },
4823
- t(T, z)
4835
+ t(S, G)
4824
4836
  )) }),
4825
- k.totalPages > 1 && /* @__PURE__ */ f.jsxs("div", { style: {
4837
+ F.totalPages > 1 && /* @__PURE__ */ f.jsxs("div", { style: {
4826
4838
  padding: "16px",
4827
- borderTop: `1px solid ${v.border}`,
4839
+ borderTop: `1px solid ${x.border}`,
4828
4840
  display: "flex",
4829
4841
  alignItems: "center",
4830
4842
  justifyContent: "space-between"
4831
4843
  }, children: [
4832
- /* @__PURE__ */ f.jsxs("div", { style: { fontSize: "13px", color: v.textSecondary }, children: [
4844
+ /* @__PURE__ */ f.jsxs("div", { style: { fontSize: "13px", color: x.textSecondary }, children: [
4833
4845
  "Page ",
4834
4846
  q,
4835
4847
  " of ",
4836
- k.totalPages
4848
+ F.totalPages
4837
4849
  ] }),
4838
4850
  /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", gap: "8px" }, children: [
4839
4851
  /* @__PURE__ */ f.jsx(
4840
4852
  "button",
4841
4853
  {
4842
- onClick: () => L((T) => Math.max(1, T - 1)),
4854
+ onClick: () => O((S) => Math.max(1, S - 1)),
4843
4855
  disabled: q === 1,
4844
4856
  style: {
4845
4857
  padding: "6px 12px",
4846
- border: `1px solid ${v.border}`,
4858
+ border: `1px solid ${x.border}`,
4847
4859
  borderRadius: "6px",
4848
4860
  background: "white",
4849
4861
  cursor: q === 1 ? "not-allowed" : "pointer",
@@ -4855,15 +4867,15 @@ function xr({
4855
4867
  /* @__PURE__ */ f.jsx(
4856
4868
  "button",
4857
4869
  {
4858
- onClick: () => L((T) => Math.min(k.totalPages, T + 1)),
4859
- disabled: q === k.totalPages,
4870
+ onClick: () => O((S) => Math.min(F.totalPages, S + 1)),
4871
+ disabled: q === F.totalPages,
4860
4872
  style: {
4861
4873
  padding: "6px 12px",
4862
- border: `1px solid ${v.border}`,
4874
+ border: `1px solid ${x.border}`,
4863
4875
  borderRadius: "6px",
4864
4876
  background: "white",
4865
- cursor: q === k.totalPages ? "not-allowed" : "pointer",
4866
- opacity: q === k.totalPages ? 0.5 : 1
4877
+ cursor: q === F.totalPages ? "not-allowed" : "pointer",
4878
+ opacity: q === F.totalPages ? 0.5 : 1
4867
4879
  },
4868
4880
  children: "Next"
4869
4881
  }
@@ -4877,10 +4889,10 @@ function wr({
4877
4889
  onClick: e,
4878
4890
  title: r = (t) => t.title || t.name || t.label || "Untitled",
4879
4891
  subtitle: u = (t) => t.description || t.subtitle || "",
4880
- image: a = (t) => t.image || t.thumbnail || t.photo,
4892
+ image: s = (t) => t.image || t.thumbnail || t.photo,
4881
4893
  badge: n = (t) => t.badge || t.tag || t.type
4882
4894
  }) {
4883
- const t = r(o), i = u(o), l = a(o), d = n(o);
4895
+ const t = r(o), i = u(o), l = s(o), c = n(o);
4884
4896
  return /* @__PURE__ */ f.jsxs(
4885
4897
  "div",
4886
4898
  {
@@ -4902,7 +4914,7 @@ function wr({
4902
4914
  /* @__PURE__ */ f.jsxs("div", { className: "flex-1 min-w-0", children: [
4903
4915
  /* @__PURE__ */ f.jsxs("div", { className: "flex items-center gap-2", children: [
4904
4916
  /* @__PURE__ */ f.jsx("h3", { className: "font-medium text-gray-900 truncate", children: t }),
4905
- d && /* @__PURE__ */ f.jsx("span", { className: "px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full", children: d })
4917
+ c && /* @__PURE__ */ f.jsx("span", { className: "px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 rounded-full", children: c })
4906
4918
  ] }),
4907
4919
  i && /* @__PURE__ */ f.jsx("p", { className: "text-sm text-gray-600 truncate mt-0.5", children: i })
4908
4920
  ] }),
@@ -4916,7 +4928,7 @@ function Cr({
4916
4928
  onClose: e,
4917
4929
  title: r = (n) => n.title || n.name || n.label || "Detail",
4918
4930
  image: u = (n) => n.image || n.thumbnail || n.photo,
4919
- fields: a = []
4931
+ fields: s = []
4920
4932
  }) {
4921
4933
  if (!o) return null;
4922
4934
  const n = r(o), t = u(o);
@@ -4941,14 +4953,14 @@ function Cr({
4941
4953
  className: "w-full h-64 object-cover rounded-lg"
4942
4954
  }
4943
4955
  ) }),
4944
- a.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "space-y-4", children: a.map((i, l) => {
4945
- const d = i.value(o);
4946
- return d == null || d === "" ? null : /* @__PURE__ */ f.jsxs("div", { children: [
4956
+ s.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "space-y-4", children: s.map((i, l) => {
4957
+ const c = i.value(o);
4958
+ return c == null || c === "" ? null : /* @__PURE__ */ f.jsxs("div", { children: [
4947
4959
  /* @__PURE__ */ f.jsx("div", { className: "text-sm font-medium text-gray-500 mb-1", children: i.label }),
4948
- /* @__PURE__ */ f.jsx("div", { className: "text-base text-gray-900", children: typeof d == "object" ? JSON.stringify(d, null, 2) : String(d) })
4960
+ /* @__PURE__ */ f.jsx("div", { className: "text-base text-gray-900", children: typeof c == "object" ? JSON.stringify(c, null, 2) : String(c) })
4949
4961
  ] }, l);
4950
4962
  }) }),
4951
- a.length === 0 && /* @__PURE__ */ f.jsx("pre", { className: "bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto", children: JSON.stringify(o, null, 2) })
4963
+ s.length === 0 && /* @__PURE__ */ f.jsx("pre", { className: "bg-gray-50 p-4 rounded-lg text-sm overflow-x-auto", children: JSON.stringify(o, null, 2) })
4952
4964
  ] }),
4953
4965
  e && /* @__PURE__ */ f.jsx("div", { className: "sticky bottom-0 bg-gray-50 border-t border-gray-200 px-6 py-4", children: /* @__PURE__ */ f.jsx(
4954
4966
  "button",
@@ -4970,85 +4982,85 @@ function Br({
4970
4982
  cardCount: e = 2,
4971
4983
  minInterval: r = 1e3,
4972
4984
  maxInterval: u = 3e3,
4973
- onCardClick: a,
4985
+ onCardClick: s,
4974
4986
  cardSize: n = "medium",
4975
4987
  className: t = ""
4976
4988
  }) {
4977
- const i = Math.min(Math.max(e, 1), 5), [l, d] = U([]), [c, h] = U([]), [m, A] = U(Array(i).fill(!1)), [w, B] = U(Array(i).fill(!1)), G = dt([]), O = Y((y) => {
4978
- const q = o.filter((k) => !y.includes(k._id));
4989
+ const i = Math.min(Math.max(e, 1), 5), [l, c] = P([]), [d, p] = P([]), [m, D] = P(Array(i).fill(!1)), [E, B] = P(Array(i).fill(!1)), M = ft([]), L = H((y) => {
4990
+ const q = o.filter((F) => !y.includes(F._id));
4979
4991
  if (q.length === 0) return null;
4980
- const L = Math.floor(Math.random() * q.length);
4981
- return q[L];
4982
- }, [o]), C = Y(() => Math.random() * (u - r) + r, [r, u]);
4992
+ const O = Math.floor(Math.random() * q.length);
4993
+ return q[O];
4994
+ }, [o]), C = H(() => Math.random() * (u - r) + r, [r, u]);
4983
4995
  pe(() => {
4984
4996
  if (o.length === 0) {
4985
- d([]), h([]);
4997
+ c([]), p([]);
4986
4998
  return;
4987
4999
  }
4988
- const y = [], q = [], L = [];
4989
- for (let k = 0; k < i && k < o.length; k++) {
4990
- const R = O(L);
4991
- R && (y.push(R), L.push(R._id));
5000
+ const y = [], q = [], O = [];
5001
+ for (let F = 0; F < i && F < o.length; F++) {
5002
+ const N = L(O);
5003
+ N && (y.push(N), O.push(N._id));
4992
5004
  }
4993
- for (let k = 0; k < y.length; k++) {
4994
- const R = [
4995
- y[k]._id,
4996
- ...y.filter((H, M) => M !== k).map((H) => H._id)
4997
- ], v = O(R);
4998
- v ? q.push(v) : q.push(y[k]);
5005
+ for (let F = 0; F < y.length; F++) {
5006
+ const N = [
5007
+ y[F]._id,
5008
+ ...y.filter((V, z) => z !== F).map((V) => V._id)
5009
+ ], x = L(N);
5010
+ x ? q.push(x) : q.push(y[F]);
4999
5011
  }
5000
- d(y), h(q);
5001
- }, [o, i, O]);
5002
- const I = Y((y) => {
5003
- const q = C(), L = setTimeout(() => {
5004
- A((k) => {
5005
- const R = [...k];
5006
- return R[y] = !R[y], R;
5012
+ c(y), p(q);
5013
+ }, [o, i, L]);
5014
+ const U = H((y) => {
5015
+ const q = C(), O = setTimeout(() => {
5016
+ D((F) => {
5017
+ const N = [...F];
5018
+ return N[y] = !N[y], N;
5007
5019
  }), setTimeout(() => {
5008
- B((k) => {
5009
- const R = [...k];
5010
- return R[y] = !R[y], R;
5020
+ B((F) => {
5021
+ const N = [...F];
5022
+ return N[y] = !N[y], N;
5011
5023
  }), setTimeout(() => {
5012
- const k = !w[y];
5013
- k && d((R) => {
5014
- const v = [...R];
5015
- return v[y] = c[y], v;
5016
- }), h((R) => {
5017
- const v = [...R], M = [
5018
- (k ? c[y] : l[y])._id,
5019
- ...l.filter((z, K) => K !== y).map((z) => z._id),
5020
- ...R.filter((z, K) => K !== y).map((z) => z._id)
5021
- ], T = O(M);
5022
- return T && (v[y] = T), v;
5024
+ const F = !E[y];
5025
+ F && c((N) => {
5026
+ const x = [...N];
5027
+ return x[y] = d[y], x;
5028
+ }), p((N) => {
5029
+ const x = [...N], z = [
5030
+ (F ? d[y] : l[y])._id,
5031
+ ...l.filter((G, K) => K !== y).map((G) => G._id),
5032
+ ...N.filter((G, K) => K !== y).map((G) => G._id)
5033
+ ], S = L(z);
5034
+ return S && (x[y] = S), x;
5023
5035
  }), setTimeout(() => {
5024
- I(y);
5036
+ U(y);
5025
5037
  }, 150);
5026
5038
  }, 200);
5027
5039
  }, 150);
5028
5040
  }, q);
5029
- G.current[y] = L;
5030
- }, [C, O, l, c, w]), b = dt(!1);
5041
+ M.current[y] = O;
5042
+ }, [C, L, l, d, E]), g = ft(!1);
5031
5043
  pe(() => {
5032
- if (!(l.length === 0 || o.length <= 1) && !b.current) {
5033
- b.current = !0;
5044
+ if (!(l.length === 0 || o.length <= 1) && !g.current) {
5045
+ g.current = !0;
5034
5046
  for (let y = 0; y < l.length; y++)
5035
- I(y);
5047
+ U(y);
5036
5048
  return () => {
5037
- G.current.forEach((y) => clearTimeout(y)), G.current = [], b.current = !1;
5049
+ M.current.forEach((y) => clearTimeout(y)), M.current = [], g.current = !1;
5038
5050
  };
5039
5051
  }
5040
5052
  }, [l.length, o.length]);
5041
- const N = (y) => {
5042
- a && a(y);
5053
+ const k = (y) => {
5054
+ s && s(y);
5043
5055
  };
5044
5056
  return o.length === 0 ? /* @__PURE__ */ f.jsx("div", { className: `flex items-center justify-center p-8 ${t}`, children: /* @__PURE__ */ f.jsx("p", { className: "text-gray-500", children: "No nodes available" }) }) : l.length === 0 ? /* @__PURE__ */ f.jsx("div", { className: `flex items-center justify-center p-8 ${t}`, children: /* @__PURE__ */ f.jsx("p", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ f.jsx("div", { className: `flex gap-4 justify-center items-center flex-wrap ${t}`, children: l.map((y, q) => {
5045
- const L = c[q], k = w[q];
5057
+ const O = d[q], F = E[q];
5046
5058
  return /* @__PURE__ */ f.jsx(
5047
5059
  "div",
5048
5060
  {
5049
5061
  className: `relative ${mr[n]}`,
5050
5062
  style: { perspective: "1000px" },
5051
- onClick: () => N(k ? L : y),
5063
+ onClick: () => k(F ? O : y),
5052
5064
  children: /* @__PURE__ */ f.jsxs(
5053
5065
  "div",
5054
5066
  {
@@ -5064,7 +5076,7 @@ function Br({
5064
5076
  {
5065
5077
  className: "absolute inset-0 transition-opacity duration-200",
5066
5078
  style: {
5067
- opacity: k ? 0 : 1
5079
+ opacity: F ? 0 : 1
5068
5080
  },
5069
5081
  children: /* @__PURE__ */ f.jsxs(
5070
5082
  "div",
@@ -5089,12 +5101,12 @@ function Br({
5089
5101
  )
5090
5102
  }
5091
5103
  ),
5092
- L && /* @__PURE__ */ f.jsx(
5104
+ O && /* @__PURE__ */ f.jsx(
5093
5105
  "div",
5094
5106
  {
5095
5107
  className: "absolute inset-0 transition-opacity duration-200",
5096
5108
  style: {
5097
- opacity: k ? 1 : 0
5109
+ opacity: F ? 1 : 0
5098
5110
  },
5099
5111
  children: /* @__PURE__ */ f.jsxs(
5100
5112
  "div",
@@ -5108,12 +5120,12 @@ function Br({
5108
5120
  /* @__PURE__ */ f.jsx(
5109
5121
  "img",
5110
5122
  {
5111
- src: L.data.image,
5112
- alt: L.title,
5123
+ src: O.data.image,
5124
+ alt: O.title,
5113
5125
  className: "w-full h-full object-cover"
5114
5126
  }
5115
5127
  ),
5116
- /* @__PURE__ */ f.jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2", children: /* @__PURE__ */ f.jsx("p", { className: "text-white text-sm font-medium truncate", children: L.title }) })
5128
+ /* @__PURE__ */ f.jsx("div", { className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2", children: /* @__PURE__ */ f.jsx("p", { className: "text-white text-sm font-medium truncate", children: O.title }) })
5117
5129
  ]
5118
5130
  }
5119
5131
  )
@@ -5127,15 +5139,15 @@ function Br({
5127
5139
  );
5128
5140
  }) });
5129
5141
  }
5130
- function Ne(o) {
5142
+ function Re(o) {
5131
5143
  if (!o) return "";
5132
5144
  const e = /=\?([^?]+)\?([BQbq])\?([^?]*)\?=/g;
5133
- return o.replace(e, (r, u, a, n) => {
5145
+ return o.replace(e, (r, u, s, n) => {
5134
5146
  try {
5135
- if (a.toUpperCase() === "B") {
5147
+ if (s.toUpperCase() === "B") {
5136
5148
  const t = atob(n);
5137
5149
  return decodeURIComponent(escape(t));
5138
- } else if (a.toUpperCase() === "Q") {
5150
+ } else if (s.toUpperCase() === "Q") {
5139
5151
  const t = n.replace(/_/g, " ").replace(
5140
5152
  /=([0-9A-Fa-f]{2})/g,
5141
5153
  (i, l) => String.fromCharCode(parseInt(l, 16))
@@ -5164,198 +5176,198 @@ function kr({
5164
5176
  systemId: e,
5165
5177
  accountId: r,
5166
5178
  limit: u = 30,
5167
- folder: a,
5179
+ folder: s,
5168
5180
  selectable: n = !0,
5169
5181
  showDetail: t = !1,
5170
5182
  emptyMessage: i = "No emails",
5171
5183
  autoLoad: l = !0,
5172
- onSelect: d,
5173
- onSelectionChange: c,
5174
- onDelete: h,
5184
+ onSelect: c,
5185
+ onSelectionChange: d,
5186
+ onDelete: p,
5175
5187
  onError: m,
5176
- onLoad: A,
5177
- renderItem: w,
5188
+ onLoad: D,
5189
+ renderItem: E,
5178
5190
  renderDetail: B,
5179
- renderActions: G,
5180
- renderEmpty: O,
5191
+ renderActions: M,
5192
+ renderEmpty: L,
5181
5193
  renderLoading: C,
5182
- theme: I = {}
5194
+ theme: U = {}
5183
5195
  }) {
5184
- const b = { ...Dr, ...I }, [N, y] = U([]), [q, L] = U(!1), [k, R] = U(null), [v, H] = U(/* @__PURE__ */ new Set()), [M, T] = U(null), [z, K] = U(null), [ge, me] = U(null), [Te, De] = U(!1), V = Et(() => e ? new cr({ baseUrl: o, system_id: e }) : null, [o, e]), re = Y(async () => {
5185
- if (V) {
5186
- L(!0), R(null);
5196
+ const g = { ...Dr, ...U }, [k, y] = P([]), [q, O] = P(!1), [F, N] = P(null), [x, V] = P(/* @__PURE__ */ new Set()), [z, S] = P(null), [G, K] = P(null), [ge, me] = P(null), [Te, De] = P(!1), W = vt(() => e ? new cr({ baseUrl: o, system_id: e }) : null, [o, e]), re = H(async () => {
5197
+ if (W) {
5198
+ O(!0), N(null);
5187
5199
  try {
5188
- const D = await V.listEmails(r, u, a);
5189
- D != null && D.messages && (y(D.messages), A == null || A(D.messages));
5190
- } catch (D) {
5191
- const x = D instanceof Error ? D : new Error("Failed to fetch emails");
5192
- R(x.message), m == null || m(x);
5200
+ const b = await W.listEmails(r, u, s);
5201
+ b != null && b.messages && (y(b.messages), D == null || D(b.messages));
5202
+ } catch (b) {
5203
+ const w = b instanceof Error ? b : new Error("Failed to fetch emails");
5204
+ N(w.message), m == null || m(w);
5193
5205
  }
5194
- L(!1);
5206
+ O(!1);
5195
5207
  }
5196
- }, [V, r, u, a, m, A]);
5208
+ }, [W, r, u, s, m, D]);
5197
5209
  pe(() => {
5198
5210
  l && re();
5199
5211
  }, [l, re]), pe(() => {
5200
5212
  re();
5201
- }, [a]);
5202
- const ne = Y(async (D) => {
5203
- if (V) {
5204
- K(D), me(null), De(!0);
5213
+ }, [s]);
5214
+ const ne = H(async (b) => {
5215
+ if (W) {
5216
+ K(b), me(null), De(!0);
5205
5217
  try {
5206
- const x = await V.getEmailParsed(r, D.uid, a || "INBOX");
5207
- x != null && x.body && me(x.body);
5208
- } catch (x) {
5209
- console.error("Failed to fetch email body:", x);
5218
+ const w = await W.getEmailParsed(r, b.uid, s || "INBOX");
5219
+ w != null && w.body && me(w.body);
5220
+ } catch (w) {
5221
+ console.error("Failed to fetch email body:", w);
5210
5222
  }
5211
5223
  De(!1);
5212
5224
  }
5213
- }, [V, r, a]), Ue = Y((D) => {
5214
- d == null || d(D), t && ne(D);
5215
- }, [d, t, ne]), Ie = Y((D, x, J) => {
5225
+ }, [W, r, s]), Ue = H((b) => {
5226
+ c == null || c(b), t && ne(b);
5227
+ }, [c, t, ne]), Ie = H((b, w, J) => {
5216
5228
  if (!n) {
5217
- d == null || d(D), t && ne(D);
5229
+ c == null || c(b), t && ne(b);
5218
5230
  return;
5219
5231
  }
5220
- const X = D.uid;
5221
- if (J.shiftKey && M !== null) {
5222
- const te = Math.min(M, x), ee = Math.max(M, x), Ve = N.slice(te, ee + 1).map((je) => je.uid), ve = new Set(Ve);
5223
- H(ve), c == null || c(Array.from(ve));
5232
+ const X = b.uid;
5233
+ if (J.shiftKey && z !== null) {
5234
+ const te = Math.min(z, w), ee = Math.max(z, w), Ve = k.slice(te, ee + 1).map((Ne) => Ne.uid), xe = new Set(Ve);
5235
+ V(xe), d == null || d(Array.from(xe));
5224
5236
  } else if (J.ctrlKey || J.metaKey)
5225
- H((te) => {
5237
+ V((te) => {
5226
5238
  const ee = new Set(te);
5227
- return ee.has(X) ? ee.delete(X) : ee.add(X), c == null || c(Array.from(ee)), ee;
5228
- }), T(x);
5239
+ return ee.has(X) ? ee.delete(X) : ee.add(X), d == null || d(Array.from(ee)), ee;
5240
+ }), S(w);
5229
5241
  else {
5230
5242
  const te = /* @__PURE__ */ new Set([X]);
5231
- H(te), T(x), c == null || c(Array.from(te));
5243
+ V(te), S(w), d == null || d(Array.from(te));
5232
5244
  }
5233
- }, [n, M, N, v, d, c, t]), Ae = Y(async () => {
5234
- if (!(!V || v.size === 0))
5245
+ }, [n, z, k, x, c, d, t]), Ae = H(async () => {
5246
+ if (!(!W || x.size === 0))
5235
5247
  try {
5236
- const D = await V.trashEmails(r, Array.from(v));
5237
- if (console.log("Trash result:", D), D.success && D.moved > 0) {
5238
- y((J) => J.filter((X) => !v.has(X.uid)));
5239
- const x = Array.from(v);
5240
- H(/* @__PURE__ */ new Set()), h == null || h(x);
5248
+ const b = await W.trashEmails(r, Array.from(x));
5249
+ if (console.log("Trash result:", b), b.success && b.moved > 0) {
5250
+ y((J) => J.filter((X) => !x.has(X.uid)));
5251
+ const w = Array.from(x);
5252
+ V(/* @__PURE__ */ new Set()), p == null || p(w);
5241
5253
  } else
5242
- R("Failed to move emails to trash");
5243
- } catch (D) {
5244
- const x = D instanceof Error ? D : new Error("Trash failed");
5245
- console.error("Trash error:", x), R(x.message), m == null || m(x);
5254
+ N("Failed to move emails to trash");
5255
+ } catch (b) {
5256
+ const w = b instanceof Error ? b : new Error("Trash failed");
5257
+ console.error("Trash error:", w), N(w.message), m == null || m(w);
5246
5258
  }
5247
- }, [V, r, v, h, m]), be = Y(async () => {
5248
- if (!(!V || v.size === 0))
5259
+ }, [W, r, x, p, m]), be = H(async () => {
5260
+ if (!(!W || x.size === 0))
5249
5261
  try {
5250
- const D = await V.archiveEmails(r, Array.from(v));
5251
- if (console.log("Archive result:", D), D.success && D.archived > 0) {
5252
- y((J) => J.filter((X) => !v.has(X.uid)));
5253
- const x = Array.from(v);
5254
- H(/* @__PURE__ */ new Set()), h == null || h(x);
5262
+ const b = await W.archiveEmails(r, Array.from(x));
5263
+ if (console.log("Archive result:", b), b.success && b.archived > 0) {
5264
+ y((J) => J.filter((X) => !x.has(X.uid)));
5265
+ const w = Array.from(x);
5266
+ V(/* @__PURE__ */ new Set()), p == null || p(w);
5255
5267
  } else
5256
- R("Failed to archive emails");
5257
- } catch (D) {
5258
- const x = D instanceof Error ? D : new Error("Archive failed");
5259
- console.error("Archive error:", x), R(x.message), m == null || m(x);
5268
+ N("Failed to archive emails");
5269
+ } catch (b) {
5270
+ const w = b instanceof Error ? b : new Error("Archive failed");
5271
+ console.error("Archive error:", w), N(w.message), m == null || m(w);
5260
5272
  }
5261
- }, [V, r, v, h, m]), ie = Y(() => {
5262
- if (v.size === N.length)
5263
- H(/* @__PURE__ */ new Set()), c == null || c([]);
5273
+ }, [W, r, x, p, m]), ie = H(() => {
5274
+ if (x.size === k.length)
5275
+ V(/* @__PURE__ */ new Set()), d == null || d([]);
5264
5276
  else {
5265
- const D = new Set(N.map((x) => x.uid));
5266
- H(D), c == null || c(Array.from(D));
5277
+ const b = new Set(k.map((w) => w.uid));
5278
+ V(b), d == null || d(Array.from(b));
5267
5279
  }
5268
- }, [N, v.size, c]), ye = Y(() => {
5269
- H(/* @__PURE__ */ new Set()), c == null || c([]);
5270
- }, [c]), oe = {
5280
+ }, [k, x.size, d]), ye = H(() => {
5281
+ V(/* @__PURE__ */ new Set()), d == null || d([]);
5282
+ }, [d]), oe = {
5271
5283
  delete: Ae,
5272
5284
  archive: be,
5273
5285
  refresh: re,
5274
5286
  selectAll: ie,
5275
5287
  clearSelection: ye
5276
- }, $e = (D) => {
5277
- if (!D) return "";
5278
- const x = new Date(D), J = /* @__PURE__ */ new Date();
5279
- return x.toDateString() === J.toDateString() ? x.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : x.toLocaleDateString([], { month: "short", day: "numeric" });
5280
- }, Se = (D, x) => /* @__PURE__ */ f.jsx("div", { style: {
5288
+ }, $e = (b) => {
5289
+ if (!b) return "";
5290
+ const w = new Date(b), J = /* @__PURE__ */ new Date();
5291
+ return w.toDateString() === J.toDateString() ? w.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : w.toLocaleDateString([], { month: "short", day: "numeric" });
5292
+ }, Se = (b, w) => /* @__PURE__ */ f.jsx("div", { style: {
5281
5293
  padding: "12px 16px",
5282
- background: x ? b.selectedBackground : D.seen ? b.cardBackground : b.unreadBackground,
5283
- borderBottom: `1px solid ${b.border}`,
5294
+ background: w ? g.selectedBackground : b.seen ? g.cardBackground : g.unreadBackground,
5295
+ borderBottom: `1px solid ${g.border}`,
5284
5296
  cursor: "pointer",
5285
5297
  transition: "background 0.15s ease"
5286
5298
  }, children: /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: "12px" }, children: [
5287
5299
  /* @__PURE__ */ f.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
5288
5300
  /* @__PURE__ */ f.jsx("div", { style: {
5289
5301
  fontSize: "14px",
5290
- fontWeight: D.seen ? 400 : 600,
5291
- color: b.text,
5302
+ fontWeight: b.seen ? 400 : 600,
5303
+ color: g.text,
5292
5304
  whiteSpace: "nowrap",
5293
5305
  overflow: "hidden",
5294
5306
  textOverflow: "ellipsis"
5295
- }, children: Ne(D.from).split("@")[0] }),
5307
+ }, children: Re(b.from).split("@")[0] }),
5296
5308
  /* @__PURE__ */ f.jsx("div", { style: {
5297
5309
  fontSize: "14px",
5298
- fontWeight: D.seen ? 400 : 500,
5299
- color: D.seen ? b.textSecondary : b.text,
5310
+ fontWeight: b.seen ? 400 : 500,
5311
+ color: b.seen ? g.textSecondary : g.text,
5300
5312
  marginTop: "2px",
5301
5313
  whiteSpace: "nowrap",
5302
5314
  overflow: "hidden",
5303
5315
  textOverflow: "ellipsis"
5304
- }, children: Ne(D.subject) || "(No subject)" })
5316
+ }, children: Re(b.subject) || "(No subject)" })
5305
5317
  ] }),
5306
5318
  /* @__PURE__ */ f.jsx("div", { style: {
5307
5319
  fontSize: "12px",
5308
- color: b.textSecondary,
5320
+ color: g.textSecondary,
5309
5321
  flexShrink: 0
5310
- }, children: $e(D.date) })
5311
- ] }) }), Me = (D) => /* @__PURE__ */ f.jsxs("div", { style: { padding: "24px" }, children: [
5312
- /* @__PURE__ */ f.jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", color: b.text }, children: Ne(D.subject) || "(No subject)" }),
5313
- /* @__PURE__ */ f.jsxs("div", { style: { fontSize: "14px", color: b.textSecondary, marginBottom: "16px" }, children: [
5322
+ }, children: $e(b.date) })
5323
+ ] }) }), Me = (b) => /* @__PURE__ */ f.jsxs("div", { style: { padding: "24px" }, children: [
5324
+ /* @__PURE__ */ f.jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", color: g.text }, children: Re(b.subject) || "(No subject)" }),
5325
+ /* @__PURE__ */ f.jsxs("div", { style: { fontSize: "14px", color: g.textSecondary, marginBottom: "16px" }, children: [
5314
5326
  "From: ",
5315
- Ne(D.from),
5327
+ Re(b.from),
5316
5328
  " • ",
5317
- new Date(D.date).toLocaleString()
5329
+ new Date(b.date).toLocaleString()
5318
5330
  ] }),
5319
- Te ? /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", color: b.textSecondary }, children: "Loading..." }) : ge ? /* @__PURE__ */ f.jsx(
5331
+ Te ? /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", color: g.textSecondary }, children: "Loading..." }) : ge ? /* @__PURE__ */ f.jsx(
5320
5332
  "div",
5321
5333
  {
5322
- style: { fontSize: "14px", color: b.text },
5334
+ style: { fontSize: "14px", color: g.text },
5323
5335
  dangerouslySetInnerHTML: { __html: ge }
5324
5336
  }
5325
- ) : /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", color: b.textSecondary }, children: "No content available" })
5326
- ] }), ze = (D, x) => /* @__PURE__ */ f.jsxs("div", { style: {
5337
+ ) : /* @__PURE__ */ f.jsx("div", { style: { fontSize: "14px", color: g.textSecondary }, children: "No content available" })
5338
+ ] }), ze = (b, w) => /* @__PURE__ */ f.jsxs("div", { style: {
5327
5339
  display: "flex",
5328
5340
  alignItems: "center",
5329
5341
  gap: "8px",
5330
5342
  padding: "8px 16px",
5331
- background: b.cardBackground,
5332
- borderBottom: `1px solid ${b.border}`
5343
+ background: g.cardBackground,
5344
+ borderBottom: `1px solid ${g.border}`
5333
5345
  }, children: [
5334
5346
  /* @__PURE__ */ f.jsx(
5335
5347
  "button",
5336
5348
  {
5337
- onClick: x.selectAll,
5349
+ onClick: w.selectAll,
5338
5350
  style: {
5339
5351
  padding: "6px 12px",
5340
5352
  background: "transparent",
5341
- border: `1px solid ${b.border}`,
5353
+ border: `1px solid ${g.border}`,
5342
5354
  borderRadius: "6px",
5343
5355
  fontSize: "13px",
5344
5356
  cursor: "pointer",
5345
- color: b.text
5357
+ color: g.text
5346
5358
  },
5347
- children: D.length === N.length ? "Deselect All" : "Select All"
5359
+ children: b.length === k.length ? "Deselect All" : "Select All"
5348
5360
  }
5349
5361
  ),
5350
- D.length > 0 && /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
5351
- /* @__PURE__ */ f.jsxs("span", { style: { fontSize: "13px", color: b.textSecondary }, children: [
5352
- D.length,
5362
+ b.length > 0 && /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
5363
+ /* @__PURE__ */ f.jsxs("span", { style: { fontSize: "13px", color: g.textSecondary }, children: [
5364
+ b.length,
5353
5365
  " selected"
5354
5366
  ] }),
5355
5367
  /* @__PURE__ */ f.jsx(
5356
5368
  "button",
5357
5369
  {
5358
- onClick: x.archive,
5370
+ onClick: w.archive,
5359
5371
  title: "Archive",
5360
5372
  style: {
5361
5373
  display: "flex",
@@ -5364,10 +5376,10 @@ function kr({
5364
5376
  width: "32px",
5365
5377
  height: "32px",
5366
5378
  background: "transparent",
5367
- border: `1px solid ${b.border}`,
5379
+ border: `1px solid ${g.border}`,
5368
5380
  borderRadius: "6px",
5369
5381
  cursor: "pointer",
5370
- color: b.textSecondary
5382
+ color: g.textSecondary
5371
5383
  },
5372
5384
  children: /* @__PURE__ */ f.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "archive" })
5373
5385
  }
@@ -5375,7 +5387,7 @@ function kr({
5375
5387
  /* @__PURE__ */ f.jsx(
5376
5388
  "button",
5377
5389
  {
5378
- onClick: x.delete,
5390
+ onClick: w.delete,
5379
5391
  title: "Delete",
5380
5392
  style: {
5381
5393
  display: "flex",
@@ -5384,10 +5396,10 @@ function kr({
5384
5396
  width: "32px",
5385
5397
  height: "32px",
5386
5398
  background: "transparent",
5387
- border: `1px solid ${b.border}`,
5399
+ border: `1px solid ${g.border}`,
5388
5400
  borderRadius: "6px",
5389
5401
  cursor: "pointer",
5390
- color: b.textSecondary
5402
+ color: g.textSecondary
5391
5403
  },
5392
5404
  children: /* @__PURE__ */ f.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "delete" })
5393
5405
  }
@@ -5397,7 +5409,7 @@ function kr({
5397
5409
  /* @__PURE__ */ f.jsx(
5398
5410
  "button",
5399
5411
  {
5400
- onClick: x.refresh,
5412
+ onClick: w.refresh,
5401
5413
  title: "Refresh",
5402
5414
  style: {
5403
5415
  display: "flex",
@@ -5406,10 +5418,10 @@ function kr({
5406
5418
  width: "32px",
5407
5419
  height: "32px",
5408
5420
  background: "transparent",
5409
- border: `1px solid ${b.border}`,
5421
+ border: `1px solid ${g.border}`,
5410
5422
  borderRadius: "6px",
5411
5423
  cursor: "pointer",
5412
- color: b.textSecondary
5424
+ color: g.textSecondary
5413
5425
  },
5414
5426
  children: /* @__PURE__ */ f.jsx("span", { className: "material-icons", style: { fontSize: "18px" }, children: "refresh" })
5415
5427
  }
@@ -5417,39 +5429,155 @@ function kr({
5417
5429
  ] }), le = () => /* @__PURE__ */ f.jsx("div", { style: {
5418
5430
  padding: "48px",
5419
5431
  textAlign: "center",
5420
- color: b.textSecondary
5432
+ color: g.textSecondary
5421
5433
  }, children: i }), ue = () => /* @__PURE__ */ f.jsx("div", { style: {
5422
5434
  padding: "48px",
5423
5435
  textAlign: "center",
5424
- color: b.textSecondary
5425
- }, children: "Loading..." }), qe = w || Se, Re = B || Me, ce = G || ze, Ge = O || le, He = C || ue;
5426
- return q && N.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: { background: b.background, width: "100%", height: "100%" }, children: He() }) : /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", background: b.background, width: "100%", height: "100%" }, children: [
5436
+ color: g.textSecondary
5437
+ }, children: "Loading..." }), je = E || Se, qe = B || Me, ce = M || ze, Ge = L || le, He = C || ue;
5438
+ return q && k.length === 0 ? /* @__PURE__ */ f.jsx("div", { style: { background: g.background, width: "100%", height: "100%" }, children: He() }) : /* @__PURE__ */ f.jsxs("div", { style: { display: "flex", background: g.background, width: "100%", height: "100%" }, children: [
5427
5439
  /* @__PURE__ */ f.jsxs("div", { style: {
5428
- flex: t && z ? "0 0 50%" : "1",
5440
+ flex: t && G ? "0 0 50%" : "1",
5429
5441
  display: "flex",
5430
5442
  flexDirection: "column",
5431
- borderRight: t && z ? `1px solid ${b.border}` : "none",
5443
+ borderRight: t && G ? `1px solid ${g.border}` : "none",
5432
5444
  overflow: "hidden"
5433
5445
  }, children: [
5434
- n && ce(Array.from(v), oe),
5435
- k && /* @__PURE__ */ f.jsx("div", { style: {
5446
+ n && ce(Array.from(x), oe),
5447
+ F && /* @__PURE__ */ f.jsx("div", { style: {
5436
5448
  padding: "12px 16px",
5437
5449
  background: "#fef2f2",
5438
- color: b.danger,
5450
+ color: g.danger,
5439
5451
  fontSize: "14px",
5440
- borderBottom: `1px solid ${b.border}`
5441
- }, children: k }),
5442
- /* @__PURE__ */ f.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: N.length === 0 ? Ge() : N.map((D, x) => /* @__PURE__ */ f.jsx(
5452
+ borderBottom: `1px solid ${g.border}`
5453
+ }, children: F }),
5454
+ /* @__PURE__ */ f.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: k.length === 0 ? Ge() : k.map((b, w) => /* @__PURE__ */ f.jsx(
5443
5455
  "div",
5444
5456
  {
5445
- onClick: (J) => Ie(D, x, J),
5446
- onDoubleClick: () => Ue(D),
5447
- children: qe(D, v.has(D.uid))
5457
+ onClick: (J) => Ie(b, w, J),
5458
+ onDoubleClick: () => Ue(b),
5459
+ children: je(b, x.has(b.uid))
5448
5460
  },
5449
- D.uid
5461
+ b.uid
5450
5462
  )) })
5451
5463
  ] }),
5452
- t && z && /* @__PURE__ */ f.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: Re(z) })
5464
+ t && G && /* @__PURE__ */ f.jsx("div", { style: { flex: 1, overflowY: "auto" }, children: qe(G) })
5465
+ ] });
5466
+ }
5467
+ function Fr({
5468
+ items: o,
5469
+ renderItem: e,
5470
+ onSelectionChange: r,
5471
+ onCurrentChange: u,
5472
+ onAction: s,
5473
+ actions: n = [],
5474
+ emptyMessage: t = "No items",
5475
+ showSelectAll: i = !0,
5476
+ className: l = ""
5477
+ }) {
5478
+ const [c, d] = P(/* @__PURE__ */ new Set()), [p, m] = P(-1), D = o.filter((g) => c.has(g.id)), E = p >= 0 && p < D.length ? D[p] : null, B = H((g) => {
5479
+ d((k) => {
5480
+ const y = new Set(k);
5481
+ return y.has(g) ? y.delete(g) : y.add(g), r == null || r(Array.from(y)), y;
5482
+ });
5483
+ }, [r]), M = H(() => {
5484
+ if (c.size === o.length)
5485
+ d(/* @__PURE__ */ new Set()), m(-1), r == null || r([]);
5486
+ else {
5487
+ const g = new Set(o.map((k) => k.id));
5488
+ d(g), o.length > 0 && (m(0), u == null || u(o[0], 0)), r == null || r(o.map((k) => k.id));
5489
+ }
5490
+ }, [o, c.size, r, u]), L = H(() => {
5491
+ if (D.length === 0) return;
5492
+ const g = p <= 0 ? D.length - 1 : p - 1;
5493
+ m(g), u == null || u(D[g], g);
5494
+ }, [D, p, u]), C = H(() => {
5495
+ if (D.length === 0) return;
5496
+ const g = p >= D.length - 1 ? 0 : p + 1;
5497
+ m(g), u == null || u(D[g], g);
5498
+ }, [D, p, u]), U = H((g) => {
5499
+ s == null || s(g, D, E);
5500
+ }, [s, D, E]);
5501
+ return st.useEffect(() => {
5502
+ D.length === 0 ? m(-1) : p >= D.length ? m(D.length - 1) : p < 0 && D.length > 0 && (m(0), u == null || u(D[0], 0));
5503
+ }, [D.length, p, u]), o.length === 0 ? /* @__PURE__ */ f.jsx("div", { className: `text-sm text-neutral-400 text-center py-4 ${l}`, children: t }) : /* @__PURE__ */ f.jsxs("div", { className: `space-y-2 ${l}`, children: [
5504
+ /* @__PURE__ */ f.jsxs("div", { className: "flex items-center justify-between text-xs text-neutral-500", children: [
5505
+ /* @__PURE__ */ f.jsxs("div", { className: "flex items-center gap-2", children: [
5506
+ i && /* @__PURE__ */ f.jsxs(
5507
+ "button",
5508
+ {
5509
+ onClick: M,
5510
+ className: "flex items-center gap-1 hover:text-neutral-700 transition-colors",
5511
+ children: [
5512
+ /* @__PURE__ */ f.jsx("span", { className: "material-icons text-sm", children: c.size === o.length ? "check_box" : c.size > 0 ? "indeterminate_check_box" : "check_box_outline_blank" }),
5513
+ /* @__PURE__ */ f.jsx("span", { children: c.size === o.length ? "Deselect all" : "Select all" })
5514
+ ]
5515
+ }
5516
+ ),
5517
+ c.size > 0 && /* @__PURE__ */ f.jsxs("span", { className: "text-neutral-400", children: [
5518
+ "(",
5519
+ c.size,
5520
+ " selected)"
5521
+ ] })
5522
+ ] }),
5523
+ D.length > 1 && /* @__PURE__ */ f.jsxs("div", { className: "flex items-center gap-1", children: [
5524
+ /* @__PURE__ */ f.jsx(
5525
+ "button",
5526
+ {
5527
+ onClick: L,
5528
+ className: "p-1 hover:bg-neutral-100 rounded transition-colors",
5529
+ title: "Previous",
5530
+ children: /* @__PURE__ */ f.jsx("span", { className: "material-icons text-sm", children: "chevron_left" })
5531
+ }
5532
+ ),
5533
+ /* @__PURE__ */ f.jsxs("span", { className: "text-xs min-w-[3rem] text-center", children: [
5534
+ p + 1,
5535
+ " / ",
5536
+ D.length
5537
+ ] }),
5538
+ /* @__PURE__ */ f.jsx(
5539
+ "button",
5540
+ {
5541
+ onClick: C,
5542
+ className: "p-1 hover:bg-neutral-100 rounded transition-colors",
5543
+ title: "Next",
5544
+ children: /* @__PURE__ */ f.jsx("span", { className: "material-icons text-sm", children: "chevron_right" })
5545
+ }
5546
+ )
5547
+ ] })
5548
+ ] }),
5549
+ /* @__PURE__ */ f.jsx("div", { className: "space-y-1", children: o.map((g) => {
5550
+ const k = c.has(g.id), y = (E == null ? void 0 : E.id) === g.id;
5551
+ return /* @__PURE__ */ f.jsxs(
5552
+ "div",
5553
+ {
5554
+ className: `flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors ${y ? "bg-blue-50 ring-1 ring-blue-200" : k ? "bg-neutral-100" : "hover:bg-neutral-50"}`,
5555
+ onClick: () => B(g.id),
5556
+ children: [
5557
+ /* @__PURE__ */ f.jsx("span", { className: `material-icons text-lg ${k ? "text-blue-500" : "text-neutral-300"}`, children: k ? "check_box" : "check_box_outline_blank" }),
5558
+ /* @__PURE__ */ f.jsx("div", { className: "flex-1 min-w-0", children: e(g, k, y) })
5559
+ ]
5560
+ },
5561
+ g.id
5562
+ );
5563
+ }) }),
5564
+ n.length > 0 && c.size > 0 && /* @__PURE__ */ f.jsx("div", { className: "flex items-center gap-2 pt-2 border-t border-neutral-100", children: n.map((g) => {
5565
+ var y;
5566
+ const k = ((y = g.disabled) == null ? void 0 : y.call(g, D)) ?? !1;
5567
+ return /* @__PURE__ */ f.jsxs(
5568
+ "button",
5569
+ {
5570
+ onClick: () => U(g.id),
5571
+ disabled: k,
5572
+ className: `flex items-center gap-1 px-3 py-1.5 text-xs rounded-lg transition-colors ${k ? "bg-neutral-100 text-neutral-400 cursor-not-allowed" : "bg-neutral-100 hover:bg-neutral-200 text-neutral-700"}`,
5573
+ children: [
5574
+ g.icon && /* @__PURE__ */ f.jsx("span", { className: "material-icons text-sm", children: g.icon }),
5575
+ g.label
5576
+ ]
5577
+ },
5578
+ g.id
5579
+ );
5580
+ }) })
5453
5581
  ] });
5454
5582
  }
5455
5583
  export {
@@ -5462,9 +5590,10 @@ export {
5462
5590
  yr as GraphClient,
5463
5591
  kr as Mail,
5464
5592
  cr as MailClient,
5465
- xr as Stack,
5593
+ Fr as SelectableList,
5594
+ Er as Stack,
5466
5595
  Ct as getApiClient,
5467
- vr as initializeApiClient,
5468
- Er as useMutation,
5596
+ xr as initializeApiClient,
5597
+ vr as useMutation,
5469
5598
  pr as useQuery
5470
5599
  };