tauri-notice-window 1.0.14 → 1.0.15

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.js CHANGED
@@ -1,37 +1,39 @@
1
- import { create as ce } from "zustand";
2
- import { syncTabs as we } from "zustand-sync";
3
- import de from "dexie";
4
- import { useCallback as I, useState as L, useEffect as G } from "react";
5
- import { jsx as z, Fragment as he } from "react/jsx-runtime";
6
- const K = "tauri-notice-config", Q = {
1
+ import { create as we } from "zustand";
2
+ import { syncTabs as he } from "zustand-sync";
3
+ import ge from "dexie";
4
+ import { useCallback as P, useState as L, useEffect as H } from "react";
5
+ import { jsx as z, Fragment as ye } from "react/jsx-runtime";
6
+ const ee = "tauri-notice-config", $ = {
7
7
  routePrefix: "/notice",
8
8
  databaseName: "tauri-notice-db",
9
9
  defaultWidth: 400,
10
10
  defaultHeight: 300,
11
11
  notFoundUrl: "/404",
12
12
  // Default 404 page
13
- defaultDecorations: !0
13
+ defaultDecorations: !0,
14
14
  // Show title bar by default
15
- }, X = () => {
15
+ loadTimeout: 4e3
16
+ // Auto-close after 4s if stuck (only when decorations=false)
17
+ }, te = () => {
16
18
  try {
17
- const t = localStorage.getItem(K);
19
+ const t = localStorage.getItem(ee);
18
20
  if (t)
19
- return { ...Q, ...JSON.parse(t) };
21
+ return { ...$, ...JSON.parse(t) };
20
22
  } catch (t) {
21
23
  console.warn("Failed to load config from localStorage:", t);
22
24
  }
23
- return Q;
24
- }, ge = (t) => {
25
+ return $;
26
+ }, be = (t) => {
25
27
  try {
26
- localStorage.setItem(K, JSON.stringify(t));
28
+ localStorage.setItem(ee, JSON.stringify(t));
27
29
  } catch (e) {
28
30
  console.warn("Failed to save config to localStorage:", e);
29
31
  }
30
- }, Ve = (t) => {
31
- const i = { ...X(), ...t };
32
- ge(i);
33
- }, ee = () => X();
34
- class ye extends de {
32
+ }, Je = (t) => {
33
+ const i = { ...te(), ...t };
34
+ be(i);
35
+ }, ie = () => te();
36
+ class pe extends ge {
35
37
  messages;
36
38
  constructor(e) {
37
39
  super(e), this.version(1).stores({
@@ -40,13 +42,13 @@ class ye extends de {
40
42
  }
41
43
  }
42
44
  let S = null;
43
- const te = () => {
45
+ const ne = () => {
44
46
  if (!S) {
45
- const t = ee();
46
- S = new ye(t.databaseName);
47
+ const t = ie();
48
+ S = new pe(t.databaseName);
47
49
  }
48
50
  return S;
49
- }, g = () => S || te(), be = async (t) => {
51
+ }, y = () => S || ne(), _e = async (t) => {
50
52
  const e = {
51
53
  ...t,
52
54
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -55,31 +57,31 @@ const te = () => {
55
57
  queueStatus: "pending",
56
58
  queuePosition: 0
57
59
  };
58
- await g().messages.put(e);
59
- }, pe = async (t) => !!await g().messages.get(t), _e = async (t) => {
60
- const e = await g().messages.get(t);
60
+ await y().messages.put(e);
61
+ }, fe = async (t) => !!await y().messages.get(t), me = async (t) => {
62
+ const e = await y().messages.get(t);
61
63
  return e?.isShown === !0 || e?.queueStatus === "shown";
62
- }, fe = async () => await g().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), me = async (t, e) => {
63
- await g().messages.update(t, { queueStatus: e });
64
- }, ve = async (t) => {
65
- await g().messages.update(t, {
64
+ }, ve = async () => await y().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), We = async (t, e) => {
65
+ await y().messages.update(t, { queueStatus: e });
66
+ }, Se = async (t) => {
67
+ await y().messages.update(t, {
66
68
  queueStatus: "shown",
67
69
  isShown: !0
68
70
  });
69
- }, We = async (t) => {
70
- await g().messages.update(t, {
71
+ }, De = async (t) => {
72
+ await y().messages.update(t, {
71
73
  queueStatus: "hidden"
72
74
  });
73
- }, ie = async (t) => await g().messages.get(t), Se = async (t) => {
74
- await g().messages.delete(t);
75
- }, De = async () => {
76
- await g().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
77
- }, Ae = async (t) => {
75
+ }, se = async (t) => await y().messages.get(t), Ae = async (t) => {
76
+ await y().messages.delete(t);
77
+ }, Ne = async () => {
78
+ await y().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
79
+ }, ze = async (t) => {
78
80
  const e = t.map(
79
- (i) => g().messages.update(i.id, { queuePosition: i.position })
81
+ (i) => y().messages.update(i.id, { queuePosition: i.position })
80
82
  );
81
83
  await Promise.all(e);
82
- }, Ne = (t, e) => ({
84
+ }, Me = (t, e) => ({
83
85
  // Initial state
84
86
  queue: [],
85
87
  currentMessage: null,
@@ -89,13 +91,13 @@ const te = () => {
89
91
  // Enqueue a new message
90
92
  enqueue: async (i) => {
91
93
  const n = e();
92
- if (await _e(i.id)) {
94
+ if (await me(i.id)) {
93
95
  console.log(`Message ${i.id} was already shown, skipping`);
94
96
  return;
95
97
  }
96
- if (await pe(i.id) || await be(i), !n.queue.some((c) => c.id === i.id)) {
97
- const c = [...n.queue, i];
98
- t({ queue: c }), await e().persistQueue();
98
+ if (await fe(i.id) || await _e(i), !n.queue.some((d) => d.id === i.id)) {
99
+ const d = [...n.queue, i];
100
+ t({ queue: d }), await e().persistQueue();
99
101
  }
100
102
  !n.isProcessing && !n.currentMessage && await e().showNext();
101
103
  },
@@ -114,14 +116,14 @@ const te = () => {
114
116
  t({ isProcessing: !1, currentMessage: null });
115
117
  return;
116
118
  }
117
- if (!await ie(n.id)) {
119
+ if (!await se(n.id)) {
118
120
  console.log(`Message ${n.id} was deleted, skipping to next`), await e().showNext();
119
121
  return;
120
122
  }
121
123
  t({
122
124
  currentMessage: n,
123
125
  isProcessing: !0
124
- }), await me(n.id, "showing"), await e().persistQueue();
126
+ }), await We(n.id, "showing"), await e().persistQueue();
125
127
  },
126
128
  // Clear current message and show next
127
129
  clearCurrent: () => {
@@ -146,7 +148,7 @@ const te = () => {
146
148
  initializeFromDatabase: async () => {
147
149
  if (e().initialized) return;
148
150
  t({ initialized: !0 });
149
- const n = await fe();
151
+ const n = await ve();
150
152
  n.length > 0 && (t({ queue: n }), await e().showNext());
151
153
  },
152
154
  // Persist queue to database
@@ -155,7 +157,7 @@ const te = () => {
155
157
  id: a.id,
156
158
  position: l
157
159
  }));
158
- await Ae(n);
160
+ await ze(n);
159
161
  },
160
162
  // Clear all messages on logout
161
163
  clearOnLogout: async () => {
@@ -165,7 +167,7 @@ const te = () => {
165
167
  isProcessing: !1,
166
168
  activeWindowIds: [],
167
169
  initialized: !1
168
- }), await De();
170
+ }), await Ne();
169
171
  },
170
172
  // Remove a specific message from the queue by ID (memory only)
171
173
  removeFromQueue: async (i) => {
@@ -174,15 +176,15 @@ const te = () => {
174
176
  },
175
177
  // Delete message completely (from both memory and database)
176
178
  deleteMessage: async (i) => {
177
- await Se(i), await e().removeFromQueue(i);
179
+ await Ae(i), await e().removeFromQueue(i);
178
180
  },
179
181
  // Hide a message (mark as hidden and remove from queue)
180
182
  hideMessage: async (i) => {
181
- await We(i), await e().removeFromQueue(i);
183
+ await De(i), await e().removeFromQueue(i);
182
184
  },
183
185
  // Mark message as shown in database
184
186
  markMessageAsShown: async (i) => {
185
- await ve(i);
187
+ await Se(i);
186
188
  },
187
189
  // Add active window ID
188
190
  addActiveWindow: (i) => {
@@ -201,8 +203,8 @@ const te = () => {
201
203
  const n = e(), a = String(i);
202
204
  return n.activeWindowIds.includes(a);
203
205
  }
204
- }), w = ce()(
205
- we(Ne, {
206
+ }), w = we()(
207
+ he(Me, {
206
208
  name: "tauri-notice-queue"
207
209
  })
208
210
  ), M = {
@@ -210,37 +212,37 @@ const te = () => {
210
212
  currentMessage: (t) => t.currentMessage,
211
213
  isProcessing: (t) => t.isProcessing,
212
214
  queue: (t) => t.queue
213
- }, $e = () => {
215
+ }, Ze = () => {
214
216
  const t = w((i) => i.enqueue);
215
- return { showNotice: I(
217
+ return { showNotice: P(
216
218
  async (i) => {
217
219
  await t(i);
218
220
  },
219
221
  [t]
220
222
  ) };
221
223
  };
222
- function ze(t, e, i, n) {
224
+ function Oe(t, e, i, n) {
223
225
  if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
224
226
  return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
225
227
  }
226
- function Me(t, e, i, n, a) {
228
+ function xe(t, e, i, n, a) {
227
229
  if (typeof e == "function" ? t !== e || !0 : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
228
230
  return e.set(t, i), i;
229
231
  }
230
232
  var O;
231
- const h = "__TAURI_TO_IPC_KEY__";
232
- function Oe(t, e = !1) {
233
+ const g = "__TAURI_TO_IPC_KEY__";
234
+ function Ie(t, e = !1) {
233
235
  return window.__TAURI_INTERNALS__.transformCallback(t, e);
234
236
  }
235
237
  async function s(t, e = {}, i) {
236
238
  return window.__TAURI_INTERNALS__.invoke(t, e, i);
237
239
  }
238
- class xe {
240
+ class Pe {
239
241
  get rid() {
240
- return ze(this, O, "f");
242
+ return Oe(this, O, "f");
241
243
  }
242
244
  constructor(e) {
243
- O.set(this, void 0), Me(this, O, e);
245
+ O.set(this, void 0), xe(this, O, e);
244
246
  }
245
247
  /**
246
248
  * Destroys and cleans up this resource from memory.
@@ -253,7 +255,7 @@ class xe {
253
255
  }
254
256
  }
255
257
  O = /* @__PURE__ */ new WeakMap();
256
- class ne {
258
+ class ae {
257
259
  constructor(...e) {
258
260
  this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.width = e[0].Logical.width, this.height = e[0].Logical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
259
261
  }
@@ -273,19 +275,19 @@ class ne {
273
275
  * @since 2.0.0
274
276
  */
275
277
  toPhysical(e) {
276
- return new b(this.width * e, this.height * e);
278
+ return new _(this.width * e, this.height * e);
277
279
  }
278
- [h]() {
280
+ [g]() {
279
281
  return {
280
282
  width: this.width,
281
283
  height: this.height
282
284
  };
283
285
  }
284
286
  toJSON() {
285
- return this[h]();
287
+ return this[g]();
286
288
  }
287
289
  }
288
- class b {
290
+ class _ {
289
291
  constructor(...e) {
290
292
  this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.width = e[0].Physical.width, this.height = e[0].Physical.height) : (this.width = e[0].width, this.height = e[0].height) : (this.width = e[0], this.height = e[1]);
291
293
  }
@@ -301,29 +303,29 @@ class b {
301
303
  * ```
302
304
  */
303
305
  toLogical(e) {
304
- return new ne(this.width / e, this.height / e);
306
+ return new ae(this.width / e, this.height / e);
305
307
  }
306
- [h]() {
308
+ [g]() {
307
309
  return {
308
310
  width: this.width,
309
311
  height: this.height
310
312
  };
311
313
  }
312
314
  toJSON() {
313
- return this[h]();
315
+ return this[g]();
314
316
  }
315
317
  }
316
- class y {
318
+ class p {
317
319
  constructor(e) {
318
320
  this.size = e;
319
321
  }
320
322
  toLogical(e) {
321
- return this.size instanceof ne ? this.size : this.size.toLogical(e);
323
+ return this.size instanceof ae ? this.size : this.size.toLogical(e);
322
324
  }
323
325
  toPhysical(e) {
324
- return this.size instanceof b ? this.size : this.size.toPhysical(e);
326
+ return this.size instanceof _ ? this.size : this.size.toPhysical(e);
325
327
  }
326
- [h]() {
328
+ [g]() {
327
329
  return {
328
330
  [`${this.size.type}`]: {
329
331
  width: this.size.width,
@@ -332,10 +334,10 @@ class y {
332
334
  };
333
335
  }
334
336
  toJSON() {
335
- return this[h]();
337
+ return this[g]();
336
338
  }
337
339
  }
338
- class se {
340
+ class re {
339
341
  constructor(...e) {
340
342
  this.type = "Logical", e.length === 1 ? "Logical" in e[0] ? (this.x = e[0].Logical.x, this.y = e[0].Logical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
341
343
  }
@@ -355,19 +357,19 @@ class se {
355
357
  * @since 2.0.0
356
358
  */
357
359
  toPhysical(e) {
358
- return new d(this.x * e, this.y * e);
360
+ return new h(this.x * e, this.y * e);
359
361
  }
360
- [h]() {
362
+ [g]() {
361
363
  return {
362
364
  x: this.x,
363
365
  y: this.y
364
366
  };
365
367
  }
366
368
  toJSON() {
367
- return this[h]();
369
+ return this[g]();
368
370
  }
369
371
  }
370
- class d {
372
+ class h {
371
373
  constructor(...e) {
372
374
  this.type = "Physical", e.length === 1 ? "Physical" in e[0] ? (this.x = e[0].Physical.x, this.y = e[0].Physical.y) : (this.x = e[0].x, this.y = e[0].y) : (this.x = e[0], this.y = e[1]);
373
375
  }
@@ -387,29 +389,29 @@ class d {
387
389
  * @since 2.0.0
388
390
  */
389
391
  toLogical(e) {
390
- return new se(this.x / e, this.y / e);
392
+ return new re(this.x / e, this.y / e);
391
393
  }
392
- [h]() {
394
+ [g]() {
393
395
  return {
394
396
  x: this.x,
395
397
  y: this.y
396
398
  };
397
399
  }
398
400
  toJSON() {
399
- return this[h]();
401
+ return this[g]();
400
402
  }
401
403
  }
402
- class _ {
404
+ class m {
403
405
  constructor(e) {
404
406
  this.position = e;
405
407
  }
406
408
  toLogical(e) {
407
- return this.position instanceof se ? this.position : this.position.toLogical(e);
409
+ return this.position instanceof re ? this.position : this.position.toLogical(e);
408
410
  }
409
411
  toPhysical(e) {
410
- return this.position instanceof d ? this.position : this.position.toPhysical(e);
412
+ return this.position instanceof h ? this.position : this.position.toPhysical(e);
411
413
  }
412
- [h]() {
414
+ [g]() {
413
415
  return {
414
416
  [`${this.position.type}`]: {
415
417
  x: this.position.x,
@@ -418,14 +420,14 @@ class _ {
418
420
  };
419
421
  }
420
422
  toJSON() {
421
- return this[h]();
423
+ return this[g]();
422
424
  }
423
425
  }
424
426
  var o;
425
427
  (function(t) {
426
428
  t.WINDOW_RESIZED = "tauri://resize", t.WINDOW_MOVED = "tauri://move", t.WINDOW_CLOSE_REQUESTED = "tauri://close-requested", t.WINDOW_DESTROYED = "tauri://destroyed", t.WINDOW_FOCUS = "tauri://focus", t.WINDOW_BLUR = "tauri://blur", t.WINDOW_SCALE_FACTOR_CHANGED = "tauri://scale-change", t.WINDOW_THEME_CHANGED = "tauri://theme-changed", t.WINDOW_CREATED = "tauri://window-created", t.WEBVIEW_CREATED = "tauri://webview-created", t.DRAG_ENTER = "tauri://drag-enter", t.DRAG_OVER = "tauri://drag-over", t.DRAG_DROP = "tauri://drag-drop", t.DRAG_LEAVE = "tauri://drag-leave";
427
429
  })(o || (o = {}));
428
- async function ae(t, e) {
430
+ async function le(t, e) {
429
431
  window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
430
432
  event: t,
431
433
  eventId: e
@@ -437,28 +439,28 @@ async function k(t, e, i) {
437
439
  return s("plugin:event|listen", {
438
440
  event: t,
439
441
  target: a,
440
- handler: Oe(e)
441
- }).then((l) => async () => ae(t, l));
442
+ handler: Ie(e)
443
+ }).then((l) => async () => le(t, l));
442
444
  }
443
445
  async function F(t, e, i) {
444
446
  return k(t, (n) => {
445
- ae(t, n.id), e(n);
447
+ le(t, n.id), e(n);
446
448
  }, i);
447
449
  }
448
- async function re(t, e) {
450
+ async function oe(t, e) {
449
451
  await s("plugin:event|emit", {
450
452
  event: t,
451
453
  payload: e
452
454
  });
453
455
  }
454
- async function le(t, e, i) {
456
+ async function ue(t, e, i) {
455
457
  await s("plugin:event|emit_to", {
456
458
  target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
457
459
  event: e,
458
460
  payload: i
459
461
  });
460
462
  }
461
- class D extends xe {
463
+ class D extends Pe {
462
464
  /**
463
465
  * Creates an Image from a resource ID. For internal use only.
464
466
  *
@@ -470,7 +472,7 @@ class D extends xe {
470
472
  /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
471
473
  static async new(e, i, n) {
472
474
  return s("plugin:image|new", {
473
- rgba: P(e),
475
+ rgba: I(e),
474
476
  width: i,
475
477
  height: n
476
478
  }).then((a) => new D(a));
@@ -490,7 +492,7 @@ class D extends xe {
490
492
  */
491
493
  static async fromBytes(e) {
492
494
  return s("plugin:image|from_bytes", {
493
- bytes: P(e)
495
+ bytes: I(e)
494
496
  }).then((i) => new D(i));
495
497
  }
496
498
  /**
@@ -519,14 +521,14 @@ class D extends xe {
519
521
  return s("plugin:image|size", { rid: this.rid });
520
522
  }
521
523
  }
522
- function P(t) {
524
+ function I(t) {
523
525
  return t == null ? null : typeof t == "string" ? t : t instanceof D ? t.rid : t;
524
526
  }
525
527
  var q;
526
528
  (function(t) {
527
529
  t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
528
530
  })(q || (q = {}));
529
- class Pe {
531
+ class ke {
530
532
  constructor(e) {
531
533
  this._preventDefault = !1, this.event = e.event, this.id = e.id;
532
534
  }
@@ -537,23 +539,23 @@ class Pe {
537
539
  return this._preventDefault;
538
540
  }
539
541
  }
540
- var H;
542
+ var V;
541
543
  (function(t) {
542
544
  t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
543
- })(H || (H = {}));
544
- function oe() {
545
+ })(V || (V = {}));
546
+ function ce() {
545
547
  return new C(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
546
548
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
547
549
  skip: !0
548
550
  });
549
551
  }
550
- async function E() {
552
+ async function T() {
551
553
  return s("plugin:window|get_all_windows").then((t) => t.map((e) => new C(e, {
552
554
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
553
555
  skip: !0
554
556
  })));
555
557
  }
556
- const R = ["tauri://created", "tauri://error"];
558
+ const E = ["tauri://created", "tauri://error"];
557
559
  class C {
558
560
  /**
559
561
  * Creates a new Window.
@@ -595,19 +597,19 @@ class C {
595
597
  */
596
598
  static async getByLabel(e) {
597
599
  var i;
598
- return (i = (await E()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
600
+ return (i = (await T()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
599
601
  }
600
602
  /**
601
603
  * Get an instance of `Window` for the current window.
602
604
  */
603
605
  static getCurrent() {
604
- return oe();
606
+ return ce();
605
607
  }
606
608
  /**
607
609
  * Gets a list of instances of `Window` for all available windows.
608
610
  */
609
611
  static async getAll() {
610
- return E();
612
+ return T();
611
613
  }
612
614
  /**
613
615
  * Gets the focused window.
@@ -620,7 +622,7 @@ class C {
620
622
  * @returns The Window instance or `undefined` if there is not any focused window.
621
623
  */
622
624
  static async getFocusedWindow() {
623
- for (const e of await E())
625
+ for (const e of await T())
624
626
  if (await e.isFocused())
625
627
  return e;
626
628
  return null;
@@ -691,7 +693,7 @@ class C {
691
693
  * @param payload Event payload.
692
694
  */
693
695
  async emit(e, i) {
694
- if (R.includes(e)) {
696
+ if (E.includes(e)) {
695
697
  for (const n of this.listeners[e] || [])
696
698
  n({
697
699
  event: e,
@@ -700,7 +702,7 @@ class C {
700
702
  });
701
703
  return;
702
704
  }
703
- return re(e, i);
705
+ return oe(e, i);
704
706
  }
705
707
  /**
706
708
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -715,7 +717,7 @@ class C {
715
717
  * @param payload Event payload.
716
718
  */
717
719
  async emitTo(e, i, n) {
718
- if (R.includes(i)) {
720
+ if (E.includes(i)) {
719
721
  for (const a of this.listeners[i] || [])
720
722
  a({
721
723
  event: i,
@@ -724,11 +726,11 @@ class C {
724
726
  });
725
727
  return;
726
728
  }
727
- return le(e, i, n);
729
+ return ue(e, i, n);
728
730
  }
729
731
  /** @ignore */
730
732
  _handleTauriEvent(e, i) {
731
- return R.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
733
+ return E.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
732
734
  }
733
735
  // Getters
734
736
  /**
@@ -759,7 +761,7 @@ class C {
759
761
  async innerPosition() {
760
762
  return s("plugin:window|inner_position", {
761
763
  label: this.label
762
- }).then((e) => new d(e));
764
+ }).then((e) => new h(e));
763
765
  }
764
766
  /**
765
767
  * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
@@ -774,7 +776,7 @@ class C {
774
776
  async outerPosition() {
775
777
  return s("plugin:window|outer_position", {
776
778
  label: this.label
777
- }).then((e) => new d(e));
779
+ }).then((e) => new h(e));
778
780
  }
779
781
  /**
780
782
  * The physical size of the window's client area.
@@ -790,7 +792,7 @@ class C {
790
792
  async innerSize() {
791
793
  return s("plugin:window|inner_size", {
792
794
  label: this.label
793
- }).then((e) => new b(e));
795
+ }).then((e) => new _(e));
794
796
  }
795
797
  /**
796
798
  * The physical size of the entire window.
@@ -806,7 +808,7 @@ class C {
806
808
  async outerSize() {
807
809
  return s("plugin:window|outer_size", {
808
810
  label: this.label
809
- }).then((e) => new b(e));
811
+ }).then((e) => new _(e));
810
812
  }
811
813
  /**
812
814
  * Gets the window's current fullscreen state.
@@ -1457,7 +1459,7 @@ class C {
1457
1459
  async setSize(e) {
1458
1460
  return s("plugin:window|set_size", {
1459
1461
  label: this.label,
1460
- value: e instanceof y ? e : new y(e)
1462
+ value: e instanceof p ? e : new p(e)
1461
1463
  });
1462
1464
  }
1463
1465
  /**
@@ -1474,7 +1476,7 @@ class C {
1474
1476
  async setMinSize(e) {
1475
1477
  return s("plugin:window|set_min_size", {
1476
1478
  label: this.label,
1477
- value: e instanceof y ? e : e ? new y(e) : null
1479
+ value: e instanceof p ? e : e ? new p(e) : null
1478
1480
  });
1479
1481
  }
1480
1482
  /**
@@ -1491,7 +1493,7 @@ class C {
1491
1493
  async setMaxSize(e) {
1492
1494
  return s("plugin:window|set_max_size", {
1493
1495
  label: this.label,
1494
- value: e instanceof y ? e : e ? new y(e) : null
1496
+ value: e instanceof p ? e : e ? new p(e) : null
1495
1497
  });
1496
1498
  }
1497
1499
  /**
@@ -1533,7 +1535,7 @@ class C {
1533
1535
  async setPosition(e) {
1534
1536
  return s("plugin:window|set_position", {
1535
1537
  label: this.label,
1536
- value: e instanceof _ ? e : new _(e)
1538
+ value: e instanceof m ? e : new m(e)
1537
1539
  });
1538
1540
  }
1539
1541
  /**
@@ -1627,7 +1629,7 @@ class C {
1627
1629
  async setIcon(e) {
1628
1630
  return s("plugin:window|set_icon", {
1629
1631
  label: this.label,
1630
- value: P(e)
1632
+ value: I(e)
1631
1633
  });
1632
1634
  }
1633
1635
  /**
@@ -1745,7 +1747,7 @@ class C {
1745
1747
  async setCursorPosition(e) {
1746
1748
  return s("plugin:window|set_cursor_position", {
1747
1749
  label: this.label,
1748
- value: e instanceof _ ? e : new _(e)
1750
+ value: e instanceof m ? e : new m(e)
1749
1751
  });
1750
1752
  }
1751
1753
  /**
@@ -1862,7 +1864,7 @@ class C {
1862
1864
  async setOverlayIcon(e) {
1863
1865
  return s("plugin:window|set_overlay_icon", {
1864
1866
  label: this.label,
1865
- value: e ? P(e) : void 0
1867
+ value: e ? I(e) : void 0
1866
1868
  });
1867
1869
  }
1868
1870
  /**
@@ -1952,7 +1954,7 @@ class C {
1952
1954
  */
1953
1955
  async onResized(e) {
1954
1956
  return this.listen(o.WINDOW_RESIZED, (i) => {
1955
- i.payload = new b(i.payload), e(i);
1957
+ i.payload = new _(i.payload), e(i);
1956
1958
  });
1957
1959
  }
1958
1960
  /**
@@ -1974,7 +1976,7 @@ class C {
1974
1976
  */
1975
1977
  async onMoved(e) {
1976
1978
  return this.listen(o.WINDOW_MOVED, (i) => {
1977
- i.payload = new d(i.payload), e(i);
1979
+ i.payload = new h(i.payload), e(i);
1978
1980
  });
1979
1981
  }
1980
1982
  /**
@@ -2001,7 +2003,7 @@ class C {
2001
2003
  */
2002
2004
  async onCloseRequested(e) {
2003
2005
  return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
2004
- const n = new Pe(i);
2006
+ const n = new ke(i);
2005
2007
  await e(n), n.isPreventDefault() || await this.destroy();
2006
2008
  });
2007
2009
  }
@@ -2037,7 +2039,7 @@ class C {
2037
2039
  payload: {
2038
2040
  type: "enter",
2039
2041
  paths: r.payload.paths,
2040
- position: new d(r.payload.position)
2042
+ position: new h(r.payload.position)
2041
2043
  }
2042
2044
  });
2043
2045
  }), n = await this.listen(o.DRAG_OVER, (r) => {
@@ -2045,7 +2047,7 @@ class C {
2045
2047
  ...r,
2046
2048
  payload: {
2047
2049
  type: "over",
2048
- position: new d(r.payload.position)
2050
+ position: new h(r.payload.position)
2049
2051
  }
2050
2052
  });
2051
2053
  }), a = await this.listen(o.DRAG_DROP, (r) => {
@@ -2054,7 +2056,7 @@ class C {
2054
2056
  payload: {
2055
2057
  type: "drop",
2056
2058
  paths: r.payload.paths,
2057
- position: new d(r.payload.position)
2059
+ position: new h(r.payload.position)
2058
2060
  }
2059
2061
  });
2060
2062
  }), l = await this.listen(o.DRAG_LEAVE, (r) => {
@@ -2136,44 +2138,44 @@ class C {
2136
2138
  return this.listen(o.WINDOW_THEME_CHANGED, e);
2137
2139
  }
2138
2140
  }
2139
- var V;
2141
+ var j;
2140
2142
  (function(t) {
2141
2143
  t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
2142
- })(V || (V = {}));
2143
- var $;
2144
+ })(j || (j = {}));
2145
+ var J;
2144
2146
  (function(t) {
2145
2147
  t.Default = "default", t.FluentOverlay = "fluentOverlay";
2146
- })($ || ($ = {}));
2147
- var j;
2148
+ })(J || (J = {}));
2149
+ var Z;
2148
2150
  (function(t) {
2149
2151
  t.AppearanceBased = "appearanceBased", t.Light = "light", t.Dark = "dark", t.MediumLight = "mediumLight", t.UltraDark = "ultraDark", t.Titlebar = "titlebar", t.Selection = "selection", t.Menu = "menu", t.Popover = "popover", t.Sidebar = "sidebar", t.HeaderView = "headerView", t.Sheet = "sheet", t.WindowBackground = "windowBackground", t.HudWindow = "hudWindow", t.FullScreenUI = "fullScreenUI", t.Tooltip = "tooltip", t.ContentBackground = "contentBackground", t.UnderWindowBackground = "underWindowBackground", t.UnderPageBackground = "underPageBackground", t.Mica = "mica", t.Blur = "blur", t.Acrylic = "acrylic", t.Tabbed = "tabbed", t.TabbedDark = "tabbedDark", t.TabbedLight = "tabbedLight";
2150
- })(j || (j = {}));
2151
- var J;
2152
+ })(Z || (Z = {}));
2153
+ var Y;
2152
2154
  (function(t) {
2153
2155
  t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
2154
- })(J || (J = {}));
2155
- function Ie(t) {
2156
+ })(Y || (Y = {}));
2157
+ function Ce(t) {
2156
2158
  return t === null ? null : {
2157
2159
  name: t.name,
2158
2160
  scaleFactor: t.scaleFactor,
2159
- position: new d(t.position),
2160
- size: new b(t.size),
2161
+ position: new h(t.position),
2162
+ size: new _(t.size),
2161
2163
  workArea: {
2162
- position: new d(t.workArea.position),
2163
- size: new b(t.workArea.size)
2164
+ position: new h(t.workArea.position),
2165
+ size: new _(t.workArea.size)
2164
2166
  }
2165
2167
  };
2166
2168
  }
2167
- async function ke() {
2168
- return s("plugin:window|primary_monitor").then(Ie);
2169
+ async function Le() {
2170
+ return s("plugin:window|primary_monitor").then(Ce);
2169
2171
  }
2170
- function ue() {
2171
- return new B(oe(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2172
+ function de() {
2173
+ return new B(ce(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2172
2174
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2173
2175
  skip: !0
2174
2176
  });
2175
2177
  }
2176
- async function Z() {
2178
+ async function K() {
2177
2179
  return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new B(new C(e.windowLabel, {
2178
2180
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2179
2181
  skip: !0
@@ -2182,7 +2184,7 @@ async function Z() {
2182
2184
  skip: !0
2183
2185
  })));
2184
2186
  }
2185
- const T = ["tauri://created", "tauri://error"];
2187
+ const R = ["tauri://created", "tauri://error"];
2186
2188
  class B {
2187
2189
  /**
2188
2190
  * Creates a new Webview.
@@ -2238,19 +2240,19 @@ class B {
2238
2240
  */
2239
2241
  static async getByLabel(e) {
2240
2242
  var i;
2241
- return (i = (await Z()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
2243
+ return (i = (await K()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
2242
2244
  }
2243
2245
  /**
2244
2246
  * Get an instance of `Webview` for the current webview.
2245
2247
  */
2246
2248
  static getCurrent() {
2247
- return ue();
2249
+ return de();
2248
2250
  }
2249
2251
  /**
2250
2252
  * Gets a list of instances of `Webview` for all available webviews.
2251
2253
  */
2252
2254
  static async getAll() {
2253
- return Z();
2255
+ return K();
2254
2256
  }
2255
2257
  /**
2256
2258
  * Listen to an emitted event on this webview.
@@ -2319,7 +2321,7 @@ class B {
2319
2321
  * @param payload Event payload.
2320
2322
  */
2321
2323
  async emit(e, i) {
2322
- if (T.includes(e)) {
2324
+ if (R.includes(e)) {
2323
2325
  for (const n of this.listeners[e] || [])
2324
2326
  n({
2325
2327
  event: e,
@@ -2328,7 +2330,7 @@ class B {
2328
2330
  });
2329
2331
  return;
2330
2332
  }
2331
- return re(e, i);
2333
+ return oe(e, i);
2332
2334
  }
2333
2335
  /**
2334
2336
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -2344,7 +2346,7 @@ class B {
2344
2346
  * @param payload Event payload.
2345
2347
  */
2346
2348
  async emitTo(e, i, n) {
2347
- if (T.includes(i)) {
2349
+ if (R.includes(i)) {
2348
2350
  for (const a of this.listeners[i] || [])
2349
2351
  a({
2350
2352
  event: i,
@@ -2353,11 +2355,11 @@ class B {
2353
2355
  });
2354
2356
  return;
2355
2357
  }
2356
- return le(e, i, n);
2358
+ return ue(e, i, n);
2357
2359
  }
2358
2360
  /** @ignore */
2359
2361
  _handleTauriEvent(e, i) {
2360
- return T.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
2362
+ return R.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
2361
2363
  }
2362
2364
  // Getters
2363
2365
  /**
@@ -2373,7 +2375,7 @@ class B {
2373
2375
  async position() {
2374
2376
  return s("plugin:webview|webview_position", {
2375
2377
  label: this.label
2376
- }).then((e) => new d(e));
2378
+ }).then((e) => new h(e));
2377
2379
  }
2378
2380
  /**
2379
2381
  * The physical size of the webview's client area.
@@ -2389,7 +2391,7 @@ class B {
2389
2391
  async size() {
2390
2392
  return s("plugin:webview|webview_size", {
2391
2393
  label: this.label
2392
- }).then((e) => new b(e));
2394
+ }).then((e) => new _(e));
2393
2395
  }
2394
2396
  // Setters
2395
2397
  /**
@@ -2421,7 +2423,7 @@ class B {
2421
2423
  async setSize(e) {
2422
2424
  return s("plugin:webview|set_webview_size", {
2423
2425
  label: this.label,
2424
- value: e instanceof y ? e : new y(e)
2426
+ value: e instanceof p ? e : new p(e)
2425
2427
  });
2426
2428
  }
2427
2429
  /**
@@ -2438,7 +2440,7 @@ class B {
2438
2440
  async setPosition(e) {
2439
2441
  return s("plugin:webview|set_webview_position", {
2440
2442
  label: this.label,
2441
- value: e instanceof _ ? e : new _(e)
2443
+ value: e instanceof m ? e : new m(e)
2442
2444
  });
2443
2445
  }
2444
2446
  /**
@@ -2600,7 +2602,7 @@ class B {
2600
2602
  payload: {
2601
2603
  type: "enter",
2602
2604
  paths: r.payload.paths,
2603
- position: new d(r.payload.position)
2605
+ position: new h(r.payload.position)
2604
2606
  }
2605
2607
  });
2606
2608
  }), n = await this.listen(o.DRAG_OVER, (r) => {
@@ -2608,7 +2610,7 @@ class B {
2608
2610
  ...r,
2609
2611
  payload: {
2610
2612
  type: "over",
2611
- position: new d(r.payload.position)
2613
+ position: new h(r.payload.position)
2612
2614
  }
2613
2615
  });
2614
2616
  }), a = await this.listen(o.DRAG_DROP, (r) => {
@@ -2617,7 +2619,7 @@ class B {
2617
2619
  payload: {
2618
2620
  type: "drop",
2619
2621
  paths: r.payload.paths,
2620
- position: new d(r.payload.position)
2622
+ position: new h(r.payload.position)
2621
2623
  }
2622
2624
  });
2623
2625
  }), l = await this.listen(o.DRAG_LEAVE, (r) => {
@@ -2629,16 +2631,16 @@ class B {
2629
2631
  }
2630
2632
  }
2631
2633
  function x() {
2632
- const t = ue();
2633
- return new f(t.label, { skip: !0 });
2634
+ const t = de();
2635
+ return new v(t.label, { skip: !0 });
2634
2636
  }
2635
- async function Y() {
2636
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new f(e, {
2637
+ async function X() {
2638
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new v(e, {
2637
2639
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2638
2640
  skip: !0
2639
2641
  })));
2640
2642
  }
2641
- class f {
2643
+ class v {
2642
2644
  /**
2643
2645
  * Creates a new {@link Window} hosting a {@link Webview}.
2644
2646
  * @example
@@ -2681,8 +2683,8 @@ class f {
2681
2683
  */
2682
2684
  static async getByLabel(e) {
2683
2685
  var i;
2684
- const n = (i = (await Y()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2685
- return n ? new f(n.label, { skip: !0 }) : null;
2686
+ const n = (i = (await X()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2687
+ return n ? new v(n.label, { skip: !0 }) : null;
2686
2688
  }
2687
2689
  /**
2688
2690
  * Get an instance of `Webview` for the current webview.
@@ -2694,7 +2696,7 @@ class f {
2694
2696
  * Gets a list of instances of `Webview` for all available webviews.
2695
2697
  */
2696
2698
  static async getAll() {
2697
- return Y();
2699
+ return X();
2698
2700
  }
2699
2701
  /**
2700
2702
  * Listen to an emitted event on this webivew window.
@@ -2770,8 +2772,8 @@ class f {
2770
2772
  return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
2771
2773
  }
2772
2774
  }
2773
- Ce(f, [C, B]);
2774
- function Ce(t, e) {
2775
+ Te(v, [C, B]);
2776
+ function Te(t, e) {
2775
2777
  (Array.isArray(e) ? e : [e]).forEach((i) => {
2776
2778
  Object.getOwnPropertyNames(i.prototype).forEach((n) => {
2777
2779
  var a;
@@ -2784,23 +2786,23 @@ function Ce(t, e) {
2784
2786
  });
2785
2787
  });
2786
2788
  }
2787
- const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), Ee = (t) => {
2789
+ const A = /* @__PURE__ */ new Map(), Ee = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), Re = (t) => {
2788
2790
  if (!t || t.trim() === "") return !1;
2789
2791
  try {
2790
2792
  return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
2791
2793
  } catch {
2792
2794
  return !1;
2793
2795
  }
2794
- }, Re = async (t, e, i) => {
2796
+ }, qe = async (t, e, i) => {
2795
2797
  const n = i?.padding ?? 20;
2796
2798
  if (i?.x !== void 0 && i?.y !== void 0)
2797
2799
  return { x: i.x, y: i.y };
2798
2800
  let a = 1920, l = 1080;
2799
2801
  try {
2800
- const c = await ke();
2801
- c?.size && (a = c.size.width, l = c.size.height);
2802
- } catch (c) {
2803
- console.warn("Failed to get monitor info, using defaults:", c);
2802
+ const d = await Le();
2803
+ d?.size && (a = d.size.width, l = d.size.height);
2804
+ } catch (d) {
2805
+ console.warn("Failed to get monitor info, using defaults:", d);
2804
2806
  }
2805
2807
  switch (i?.position ?? "right-bottom") {
2806
2808
  case "right-bottom":
@@ -2834,32 +2836,49 @@ const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase()
2834
2836
  y: l - e - n
2835
2837
  };
2836
2838
  }
2837
- }, Te = async (t) => {
2839
+ }, Fe = async (t) => {
2838
2840
  const e = String(t.id), i = w.getState();
2839
2841
  if (i.isWindowActive(e)) {
2840
2842
  console.log(`Notice window already open for message: ${e}`);
2841
2843
  return;
2842
2844
  }
2843
- const n = ee(), a = `notice-${e}`;
2845
+ const n = ie(), a = `notice-${e}`;
2844
2846
  let l = `${n.routePrefix}/${t.type}?id=${t.id}`;
2845
- Ee(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
2846
- const r = t.min_width || n.defaultWidth, c = t.min_height || n.defaultHeight, m = t.decorations ?? n.defaultDecorations ?? !0, { x: v, y: N } = await Re(r, c, t.windowPosition);
2847
+ Re(l) || (console.warn(`Invalid window URL: ${l}. Using fallback 404 page.`), l = n.notFoundUrl || "/404");
2848
+ const r = t.min_width || n.defaultWidth, d = t.min_height || n.defaultHeight, f = t.decorations ?? n.defaultDecorations ?? !0, { x: W, y: N } = await qe(r, d, t.windowPosition);
2847
2849
  try {
2848
2850
  const u = {
2849
2851
  url: l,
2850
2852
  title: t.title,
2851
2853
  width: r,
2852
- height: c,
2853
- x: v,
2854
+ height: d,
2855
+ x: W,
2854
2856
  y: N,
2855
2857
  resizable: !0,
2856
2858
  skipTaskbar: !1,
2857
2859
  alwaysOnTop: !0
2858
2860
  };
2859
- m ? u.decorations = !0 : Le() ? (u.decorations = !0, u.titleBarStyle = "overlay", u.hiddenTitle = !0) : (u.decorations = !1, u.transparent = !0);
2860
- const p = new f(a, u);
2861
- A.set(e, p), i.addActiveWindow(e), p.once("tauri://destroyed", async () => {
2862
- A.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2861
+ f ? u.decorations = !0 : Ee() ? (u.decorations = !0, u.titleBarStyle = "overlay", u.hiddenTitle = !0) : (u.decorations = !1, u.transparent = !0);
2862
+ const b = new v(a, u);
2863
+ A.set(e, b), i.addActiveWindow(e);
2864
+ let c = null;
2865
+ const G = n.loadTimeout ?? 1e4;
2866
+ !f && G > 0 && (c = setTimeout(async () => {
2867
+ console.warn(`Notice window ${a} load timeout - auto closing`);
2868
+ try {
2869
+ await b.close();
2870
+ } catch {
2871
+ }
2872
+ }, G)), b.once("tauri://created", () => {
2873
+ c && (clearTimeout(c), c = null), console.log(`Notice window created successfully: ${a}`);
2874
+ }), b.once("tauri://error", async (Q) => {
2875
+ if (console.error(`Notice window error: ${a}`, Q), c && (clearTimeout(c), c = null), !f)
2876
+ try {
2877
+ await b.close();
2878
+ } catch {
2879
+ }
2880
+ }), b.once("tauri://destroyed", async () => {
2881
+ c && (clearTimeout(c), c = null), A.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2863
2882
  }), console.log(`Created notice window: ${a}`);
2864
2883
  } catch (u) {
2865
2884
  console.error("Failed to create notice window:", u), i.removeActiveWindow(e), i.clearCurrent();
@@ -2872,36 +2891,36 @@ const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase()
2872
2891
  } catch (a) {
2873
2892
  console.error("Failed to close notice window:", a);
2874
2893
  }
2875
- }, qe = async () => {
2894
+ }, Be = async () => {
2876
2895
  const t = Array.from(A.keys()).map(
2877
2896
  (e) => U(e)
2878
2897
  );
2879
2898
  await Promise.all(t);
2880
- }, Fe = () => {
2899
+ }, Ue = () => {
2881
2900
  let t = null;
2882
2901
  w.subscribe((e) => {
2883
2902
  const i = e.currentMessage;
2884
- i && i !== t ? (t = i, Te(i)) : i || (t = null);
2903
+ i && i !== t ? (t = i, Fe(i)) : i || (t = null);
2885
2904
  }), console.log("Notice window system initialized");
2886
- }, je = () => {
2905
+ }, Ye = () => {
2887
2906
  const t = w((i) => i.currentMessage);
2888
- return { closeNotice: I(async () => {
2907
+ return { closeNotice: P(async () => {
2889
2908
  t && await U(t.id);
2890
2909
  }, [t]) };
2891
- }, Je = () => {
2910
+ }, Ke = () => {
2892
2911
  const t = w((i) => i.hideMessage);
2893
- return { hideNotice: I(
2912
+ return { hideNotice: P(
2894
2913
  async (i) => {
2895
2914
  await t(i), await U(i);
2896
2915
  },
2897
2916
  [t]
2898
2917
  ) };
2899
- }, Ze = () => {
2918
+ }, Xe = () => {
2900
2919
  const t = w((i) => i.clearOnLogout);
2901
- return { hideAllNotices: I(async () => {
2902
- await qe(), await t();
2920
+ return { hideAllNotices: P(async () => {
2921
+ await Be(), await t();
2903
2922
  }, [t]) };
2904
- }, Ye = () => {
2923
+ }, et = () => {
2905
2924
  const t = w(M.queueLength), e = w(M.currentMessage), i = w(M.isProcessing), n = w(M.queue);
2906
2925
  return {
2907
2926
  queueLength: t,
@@ -2909,36 +2928,36 @@ const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase()
2909
2928
  isProcessing: i,
2910
2929
  queue: n
2911
2930
  };
2912
- }, Ke = ({ children: t, onLoad: e, onClose: i }) => {
2913
- const [n, a] = L(null), [l, r] = L(!0), [c, m] = L(null);
2914
- return G(() => {
2931
+ }, tt = ({ children: t, onLoad: e, onClose: i }) => {
2932
+ const [n, a] = L(null), [l, r] = L(!0), [d, f] = L(null);
2933
+ return H(() => {
2915
2934
  (async () => {
2916
2935
  try {
2917
2936
  const u = new URLSearchParams(window.location.search).get("id");
2918
2937
  if (!u) {
2919
- m("No message ID provided"), r(!1), setTimeout(async () => {
2938
+ f("No message ID provided"), r(!1), setTimeout(async () => {
2920
2939
  try {
2921
2940
  await x().close();
2922
- } catch (W) {
2923
- console.error("Failed to close window:", W);
2941
+ } catch (c) {
2942
+ console.error("Failed to close window:", c);
2924
2943
  }
2925
2944
  }, 1e3);
2926
2945
  return;
2927
2946
  }
2928
- const p = await ie(u);
2929
- if (!p) {
2930
- console.log(`Message ${u} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
2947
+ const b = await se(u);
2948
+ if (!b) {
2949
+ console.log(`Message ${u} not found in database, closing window`), f("Message not found"), r(!1), setTimeout(async () => {
2931
2950
  try {
2932
2951
  await x().close();
2933
- } catch (W) {
2934
- console.error("Failed to close window:", W);
2952
+ } catch (c) {
2953
+ console.error("Failed to close window:", c);
2935
2954
  }
2936
2955
  }, 500);
2937
2956
  return;
2938
2957
  }
2939
- a(p), r(!1), e && e(p);
2958
+ a(b), r(!1), e && e(b);
2940
2959
  } catch (N) {
2941
- console.error("Failed to load message:", N), m("Failed to load message"), r(!1), setTimeout(async () => {
2960
+ console.error("Failed to load message:", N), f("Failed to load message"), r(!1), setTimeout(async () => {
2942
2961
  try {
2943
2962
  await x().close();
2944
2963
  } catch (u) {
@@ -2947,13 +2966,13 @@ const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase()
2947
2966
  }, 1e3);
2948
2967
  }
2949
2968
  })();
2950
- }, [e]), G(() => {
2969
+ }, [e]), H(() => {
2951
2970
  if (!n || !i) return;
2952
- const v = () => {
2971
+ const W = () => {
2953
2972
  i(n);
2954
2973
  };
2955
- return window.addEventListener("beforeunload", v), () => {
2956
- window.removeEventListener("beforeunload", v);
2974
+ return window.addEventListener("beforeunload", W), () => {
2975
+ window.removeEventListener("beforeunload", W);
2957
2976
  };
2958
2977
  }, [n, i]), l ? /* @__PURE__ */ z("div", { style: {
2959
2978
  display: "flex",
@@ -2961,14 +2980,14 @@ const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase()
2961
2980
  alignItems: "center",
2962
2981
  height: "100vh",
2963
2982
  fontFamily: "system-ui, -apple-system, sans-serif"
2964
- }, children: "Loading..." }) : c ? /* @__PURE__ */ z("div", { style: {
2983
+ }, children: "Loading..." }) : d ? /* @__PURE__ */ z("div", { style: {
2965
2984
  display: "flex",
2966
2985
  justifyContent: "center",
2967
2986
  alignItems: "center",
2968
2987
  height: "100vh",
2969
2988
  fontFamily: "system-ui, -apple-system, sans-serif",
2970
2989
  color: "#ef4444"
2971
- }, children: c }) : n ? /* @__PURE__ */ z(he, { children: t(n) }) : /* @__PURE__ */ z("div", { style: {
2990
+ }, children: d }) : n ? /* @__PURE__ */ z(ye, { children: t(n) }) : /* @__PURE__ */ z("div", { style: {
2972
2991
  display: "flex",
2973
2992
  justifyContent: "center",
2974
2993
  alignItems: "center",
@@ -2976,38 +2995,38 @@ const A = /* @__PURE__ */ new Map(), Le = () => navigator.platform.toLowerCase()
2976
2995
  fontFamily: "system-ui, -apple-system, sans-serif",
2977
2996
  color: "#ef4444"
2978
2997
  }, children: "Closing window..." });
2979
- }, Xe = async () => {
2980
- te(), Fe();
2998
+ }, it = async () => {
2999
+ ne(), Ue();
2981
3000
  const { initializeFromDatabase: t } = w.getState();
2982
3001
  await t(), console.log("Tauri Notice System initialized");
2983
- }, et = async (t) => {
3002
+ }, nt = async (t) => {
2984
3003
  await w.getState().deleteMessage(t);
2985
- }, tt = async (t) => {
3004
+ }, st = async (t) => {
2986
3005
  await w.getState().hideMessage(t);
2987
- }, it = async (t) => {
3006
+ }, at = async (t) => {
2988
3007
  await w.getState().markMessageAsShown(t);
2989
3008
  };
2990
3009
  export {
2991
- Ke as NoticeLayout,
2992
- qe as closeAllNoticeWindows,
3010
+ tt as NoticeLayout,
3011
+ Be as closeAllNoticeWindows,
2993
3012
  U as closeNoticeWindow,
2994
- Te as createNoticeWindow,
2995
- et as deleteMessageById,
2996
- ie as getMessage,
2997
- ee as getNoticeConfig,
2998
- fe as getPendingMessages,
2999
- tt as hideMessageById,
3000
- te as initializeDatabase,
3001
- Xe as initializeNoticeSystem,
3002
- Fe as initializeNoticeWindowSystem,
3003
- it as markMessageAsShown,
3013
+ Fe as createNoticeWindow,
3014
+ nt as deleteMessageById,
3015
+ se as getMessage,
3016
+ ie as getNoticeConfig,
3017
+ ve as getPendingMessages,
3018
+ st as hideMessageById,
3019
+ ne as initializeDatabase,
3020
+ it as initializeNoticeSystem,
3021
+ Ue as initializeNoticeWindowSystem,
3022
+ at as markMessageAsShown,
3004
3023
  M as messageQueueSelectors,
3005
- Ve as setNoticeConfig,
3006
- je as useCloseNotice,
3007
- Ze as useHideAllNotices,
3008
- Je as useHideNotice,
3009
- Ye as useMessageQueue,
3024
+ Je as setNoticeConfig,
3025
+ Ye as useCloseNotice,
3026
+ Xe as useHideAllNotices,
3027
+ Ke as useHideNotice,
3028
+ et as useMessageQueue,
3010
3029
  w as useMessageQueueStore,
3011
- $e as useNoticeWindow
3030
+ Ze as useNoticeWindow
3012
3031
  };
3013
3032
  //# sourceMappingURL=index.js.map