tauri-notice-window 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,18 +1,33 @@
1
- import { create as ne } from "zustand";
2
- import { syncTabs as se } from "zustand-sync";
3
- import ae from "dexie";
4
- import { useCallback as N, useState as x, useEffect as le } from "react";
5
- import { jsx as I, Fragment as re } from "react/jsx-runtime";
6
- let R = {
1
+ import { create as ae } from "zustand";
2
+ import { syncTabs as le } from "zustand-sync";
3
+ import re from "dexie";
4
+ import { useCallback as z, useState as x, useEffect as oe } from "react";
5
+ import { jsx as I, Fragment as ue } from "react/jsx-runtime";
6
+ const $ = "tauri-notice-config", F = {
7
7
  routePrefix: "/notice",
8
8
  databaseName: "tauri-notice-db",
9
9
  defaultWidth: 400,
10
10
  defaultHeight: 300
11
- };
12
- const Ee = (t) => {
13
- R = { ...R, ...t };
14
- }, $ = () => ({ ...R });
15
- class oe extends ae {
11
+ }, J = () => {
12
+ try {
13
+ const t = localStorage.getItem($);
14
+ if (t)
15
+ return { ...F, ...JSON.parse(t) };
16
+ } catch (t) {
17
+ console.warn("Failed to load config from localStorage:", t);
18
+ }
19
+ return F;
20
+ }, ce = (t) => {
21
+ try {
22
+ localStorage.setItem($, JSON.stringify(t));
23
+ } catch (e) {
24
+ console.warn("Failed to save config to localStorage:", e);
25
+ }
26
+ }, Fe = (t) => {
27
+ const i = { ...J(), ...t };
28
+ ce(i);
29
+ }, Z = () => J();
30
+ class de extends re {
16
31
  messages;
17
32
  constructor(e) {
18
33
  super(e), this.version(1).stores({
@@ -21,13 +36,13 @@ class oe extends ae {
21
36
  }
22
37
  }
23
38
  let f = null;
24
- const J = () => {
39
+ const Y = () => {
25
40
  if (!f) {
26
- const t = $();
27
- f = new oe(t.databaseName);
41
+ const t = Z();
42
+ f = new de(t.databaseName);
28
43
  }
29
44
  return f;
30
- }, h = () => f || J(), ue = async (t) => {
45
+ }, h = () => f || Y(), we = async (t) => {
31
46
  const e = {
32
47
  ...t,
33
48
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -37,25 +52,25 @@ const J = () => {
37
52
  queuePosition: 0
38
53
  };
39
54
  await h().messages.put(e);
40
- }, ce = async (t) => !!await h().messages.get(t), we = async () => await h().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), de = async (t, e) => {
55
+ }, he = async (t) => !!await h().messages.get(t), ge = async () => await h().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), be = async (t, e) => {
41
56
  await h().messages.update(t, { queueStatus: e });
42
- }, he = async (t) => {
57
+ }, ye = async (t) => {
43
58
  await h().messages.update(t, {
44
59
  queueStatus: "shown",
45
60
  isShown: !0
46
61
  });
47
- }, be = async (t) => {
62
+ }, pe = async (t) => {
48
63
  await h().messages.update(t, {
49
64
  queueStatus: "hidden"
50
65
  });
51
- }, ge = async (t) => await h().messages.get(t), ye = async () => {
66
+ }, _e = async (t) => await h().messages.get(t), fe = async () => {
52
67
  await h().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
53
- }, pe = async (t) => {
68
+ }, me = async (t) => {
54
69
  const e = t.map(
55
70
  (i) => h().messages.update(i.id, { queuePosition: i.position })
56
71
  );
57
72
  await Promise.all(e);
58
- }, _e = (t, e) => ({
73
+ }, ve = (t, e) => ({
59
74
  // Initial state
60
75
  queue: [],
61
76
  currentMessage: null,
@@ -65,7 +80,7 @@ const J = () => {
65
80
  // Enqueue a new message
66
81
  enqueue: async (i) => {
67
82
  const n = e();
68
- if (await ce(i.id) || await ue(i), !n.queue.some((l) => l.id === i.id)) {
83
+ if (await he(i.id) || await we(i), !n.queue.some((l) => l.id === i.id)) {
69
84
  const l = [...n.queue, i];
70
85
  t({ queue: l }), await e().persistQueue();
71
86
  }
@@ -89,7 +104,7 @@ const J = () => {
89
104
  t({
90
105
  currentMessage: n,
91
106
  isProcessing: !0
92
- }), await de(n.id, "showing"), await e().persistQueue();
107
+ }), await be(n.id, "showing"), await e().persistQueue();
93
108
  },
94
109
  // Clear current message and show next
95
110
  clearCurrent: () => {
@@ -114,7 +129,7 @@ const J = () => {
114
129
  initializeFromDatabase: async () => {
115
130
  if (e().initialized) return;
116
131
  t({ initialized: !0 });
117
- const n = await we();
132
+ const n = await ge();
118
133
  n.length > 0 && (t({ queue: n }), await e().showNext());
119
134
  },
120
135
  // Persist queue to database
@@ -123,7 +138,7 @@ const J = () => {
123
138
  id: a.id,
124
139
  position: r
125
140
  }));
126
- await pe(n);
141
+ await me(n);
127
142
  },
128
143
  // Clear all messages on logout
129
144
  clearOnLogout: async () => {
@@ -133,7 +148,7 @@ const J = () => {
133
148
  isProcessing: !1,
134
149
  activeWindowIds: [],
135
150
  initialized: !1
136
- }), await ye();
151
+ }), await fe();
137
152
  },
138
153
  // Add active window ID
139
154
  addActiveWindow: (i) => {
@@ -152,8 +167,8 @@ const J = () => {
152
167
  const n = e(), a = String(i);
153
168
  return n.activeWindowIds.includes(a);
154
169
  }
155
- }), d = ne()(
156
- se(_e, {
170
+ }), w = ae()(
171
+ le(ve, {
157
172
  name: "tauri-notice-queue"
158
173
  })
159
174
  ), D = {
@@ -161,37 +176,37 @@ const J = () => {
161
176
  currentMessage: (t) => t.currentMessage,
162
177
  isProcessing: (t) => t.isProcessing,
163
178
  queue: (t) => t.queue
164
- }, Te = () => {
165
- const t = d((i) => i.enqueue);
166
- return { showNotice: N(
179
+ }, Be = () => {
180
+ const t = w((i) => i.enqueue);
181
+ return { showNotice: z(
167
182
  async (i) => {
168
183
  await t(i);
169
184
  },
170
185
  [t]
171
186
  ) };
172
187
  };
173
- function fe(t, e, i, n) {
188
+ function We(t, e, i, n) {
174
189
  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");
175
190
  return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
176
191
  }
177
- function me(t, e, i, n, a) {
192
+ function De(t, e, i, n, a) {
178
193
  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");
179
194
  return e.set(t, i), i;
180
195
  }
181
- var z;
182
- const w = "__TAURI_TO_IPC_KEY__";
183
- function ve(t, e = !1) {
196
+ var S;
197
+ const d = "__TAURI_TO_IPC_KEY__";
198
+ function Se(t, e = !1) {
184
199
  return window.__TAURI_INTERNALS__.transformCallback(t, e);
185
200
  }
186
201
  async function s(t, e = {}, i) {
187
202
  return window.__TAURI_INTERNALS__.invoke(t, e, i);
188
203
  }
189
- class We {
204
+ class Ne {
190
205
  get rid() {
191
- return fe(this, z, "f");
206
+ return We(this, S, "f");
192
207
  }
193
208
  constructor(e) {
194
- z.set(this, void 0), me(this, z, e);
209
+ S.set(this, void 0), De(this, S, e);
195
210
  }
196
211
  /**
197
212
  * Destroys and cleans up this resource from memory.
@@ -203,8 +218,8 @@ class We {
203
218
  });
204
219
  }
205
220
  }
206
- z = /* @__PURE__ */ new WeakMap();
207
- class Z {
221
+ S = /* @__PURE__ */ new WeakMap();
222
+ class K {
208
223
  constructor(...e) {
209
224
  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]);
210
225
  }
@@ -224,19 +239,19 @@ class Z {
224
239
  * @since 2.0.0
225
240
  */
226
241
  toPhysical(e) {
227
- return new g(this.width * e, this.height * e);
242
+ return new b(this.width * e, this.height * e);
228
243
  }
229
- [w]() {
244
+ [d]() {
230
245
  return {
231
246
  width: this.width,
232
247
  height: this.height
233
248
  };
234
249
  }
235
250
  toJSON() {
236
- return this[w]();
251
+ return this[d]();
237
252
  }
238
253
  }
239
- class g {
254
+ class b {
240
255
  constructor(...e) {
241
256
  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]);
242
257
  }
@@ -252,29 +267,29 @@ class g {
252
267
  * ```
253
268
  */
254
269
  toLogical(e) {
255
- return new Z(this.width / e, this.height / e);
270
+ return new K(this.width / e, this.height / e);
256
271
  }
257
- [w]() {
272
+ [d]() {
258
273
  return {
259
274
  width: this.width,
260
275
  height: this.height
261
276
  };
262
277
  }
263
278
  toJSON() {
264
- return this[w]();
279
+ return this[d]();
265
280
  }
266
281
  }
267
- class b {
282
+ class g {
268
283
  constructor(e) {
269
284
  this.size = e;
270
285
  }
271
286
  toLogical(e) {
272
- return this.size instanceof Z ? this.size : this.size.toLogical(e);
287
+ return this.size instanceof K ? this.size : this.size.toLogical(e);
273
288
  }
274
289
  toPhysical(e) {
275
- return this.size instanceof g ? this.size : this.size.toPhysical(e);
290
+ return this.size instanceof b ? this.size : this.size.toPhysical(e);
276
291
  }
277
- [w]() {
292
+ [d]() {
278
293
  return {
279
294
  [`${this.size.type}`]: {
280
295
  width: this.size.width,
@@ -283,10 +298,10 @@ class b {
283
298
  };
284
299
  }
285
300
  toJSON() {
286
- return this[w]();
301
+ return this[d]();
287
302
  }
288
303
  }
289
- class Y {
304
+ class X {
290
305
  constructor(...e) {
291
306
  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]);
292
307
  }
@@ -308,14 +323,14 @@ class Y {
308
323
  toPhysical(e) {
309
324
  return new u(this.x * e, this.y * e);
310
325
  }
311
- [w]() {
326
+ [d]() {
312
327
  return {
313
328
  x: this.x,
314
329
  y: this.y
315
330
  };
316
331
  }
317
332
  toJSON() {
318
- return this[w]();
333
+ return this[d]();
319
334
  }
320
335
  }
321
336
  class u {
@@ -338,16 +353,16 @@ class u {
338
353
  * @since 2.0.0
339
354
  */
340
355
  toLogical(e) {
341
- return new Y(this.x / e, this.y / e);
356
+ return new X(this.x / e, this.y / e);
342
357
  }
343
- [w]() {
358
+ [d]() {
344
359
  return {
345
360
  x: this.x,
346
361
  y: this.y
347
362
  };
348
363
  }
349
364
  toJSON() {
350
- return this[w]();
365
+ return this[d]();
351
366
  }
352
367
  }
353
368
  class p {
@@ -355,12 +370,12 @@ class p {
355
370
  this.position = e;
356
371
  }
357
372
  toLogical(e) {
358
- return this.position instanceof Y ? this.position : this.position.toLogical(e);
373
+ return this.position instanceof X ? this.position : this.position.toLogical(e);
359
374
  }
360
375
  toPhysical(e) {
361
376
  return this.position instanceof u ? this.position : this.position.toPhysical(e);
362
377
  }
363
- [w]() {
378
+ [d]() {
364
379
  return {
365
380
  [`${this.position.type}`]: {
366
381
  x: this.position.x,
@@ -369,47 +384,47 @@ class p {
369
384
  };
370
385
  }
371
386
  toJSON() {
372
- return this[w]();
387
+ return this[d]();
373
388
  }
374
389
  }
375
390
  var o;
376
391
  (function(t) {
377
392
  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";
378
393
  })(o || (o = {}));
379
- async function K(t, e) {
394
+ async function ee(t, e) {
380
395
  window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
381
396
  event: t,
382
397
  eventId: e
383
398
  });
384
399
  }
385
- async function S(t, e, i) {
400
+ async function A(t, e, i) {
386
401
  var n;
387
402
  const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
388
403
  return s("plugin:event|listen", {
389
404
  event: t,
390
405
  target: a,
391
- handler: ve(e)
392
- }).then((r) => async () => K(t, r));
406
+ handler: Se(e)
407
+ }).then((r) => async () => ee(t, r));
393
408
  }
394
- async function E(t, e, i) {
395
- return S(t, (n) => {
396
- K(t, n.id), e(n);
409
+ async function R(t, e, i) {
410
+ return A(t, (n) => {
411
+ ee(t, n.id), e(n);
397
412
  }, i);
398
413
  }
399
- async function X(t, e) {
414
+ async function te(t, e) {
400
415
  await s("plugin:event|emit", {
401
416
  event: t,
402
417
  payload: e
403
418
  });
404
419
  }
405
- async function ee(t, e, i) {
420
+ async function ie(t, e, i) {
406
421
  await s("plugin:event|emit_to", {
407
422
  target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
408
423
  event: e,
409
424
  payload: i
410
425
  });
411
426
  }
412
- class m extends We {
427
+ class m extends Ne {
413
428
  /**
414
429
  * Creates an Image from a resource ID. For internal use only.
415
430
  *
@@ -421,7 +436,7 @@ class m extends We {
421
436
  /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
422
437
  static async new(e, i, n) {
423
438
  return s("plugin:image|new", {
424
- rgba: A(e),
439
+ rgba: N(e),
425
440
  width: i,
426
441
  height: n
427
442
  }).then((a) => new m(a));
@@ -441,7 +456,7 @@ class m extends We {
441
456
  */
442
457
  static async fromBytes(e) {
443
458
  return s("plugin:image|from_bytes", {
444
- bytes: A(e)
459
+ bytes: N(e)
445
460
  }).then((i) => new m(i));
446
461
  }
447
462
  /**
@@ -470,14 +485,14 @@ class m extends We {
470
485
  return s("plugin:image|size", { rid: this.rid });
471
486
  }
472
487
  }
473
- function A(t) {
488
+ function N(t) {
474
489
  return t == null ? null : typeof t == "string" ? t : t instanceof m ? t.rid : t;
475
490
  }
476
- var C;
491
+ var M;
477
492
  (function(t) {
478
493
  t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
479
- })(C || (C = {}));
480
- class De {
494
+ })(M || (M = {}));
495
+ class ze {
481
496
  constructor(e) {
482
497
  this._preventDefault = !1, this.event = e.event, this.id = e.id;
483
498
  }
@@ -492,20 +507,20 @@ var B;
492
507
  (function(t) {
493
508
  t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
494
509
  })(B || (B = {}));
495
- function te() {
496
- return new P(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
510
+ function ne() {
511
+ return new O(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
497
512
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
498
513
  skip: !0
499
514
  });
500
515
  }
501
516
  async function k() {
502
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new P(e, {
517
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new O(e, {
503
518
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
504
519
  skip: !0
505
520
  })));
506
521
  }
507
- const L = ["tauri://created", "tauri://error"];
508
- class P {
522
+ const C = ["tauri://created", "tauri://error"];
523
+ class O {
509
524
  /**
510
525
  * Creates a new Window.
511
526
  * @example
@@ -552,7 +567,7 @@ class P {
552
567
  * Get an instance of `Window` for the current window.
553
568
  */
554
569
  static getCurrent() {
555
- return te();
570
+ return ne();
556
571
  }
557
572
  /**
558
573
  * Gets a list of instances of `Window` for all available windows.
@@ -599,7 +614,7 @@ class P {
599
614
  return this._handleTauriEvent(e, i) ? () => {
600
615
  const n = this.listeners[e];
601
616
  n.splice(n.indexOf(i), 1);
602
- } : S(e, i, {
617
+ } : A(e, i, {
603
618
  target: { kind: "Window", label: this.label }
604
619
  });
605
620
  }
@@ -626,7 +641,7 @@ class P {
626
641
  return this._handleTauriEvent(e, i) ? () => {
627
642
  const n = this.listeners[e];
628
643
  n.splice(n.indexOf(i), 1);
629
- } : E(e, i, {
644
+ } : R(e, i, {
630
645
  target: { kind: "Window", label: this.label }
631
646
  });
632
647
  }
@@ -642,7 +657,7 @@ class P {
642
657
  * @param payload Event payload.
643
658
  */
644
659
  async emit(e, i) {
645
- if (L.includes(e)) {
660
+ if (C.includes(e)) {
646
661
  for (const n of this.listeners[e] || [])
647
662
  n({
648
663
  event: e,
@@ -651,7 +666,7 @@ class P {
651
666
  });
652
667
  return;
653
668
  }
654
- return X(e, i);
669
+ return te(e, i);
655
670
  }
656
671
  /**
657
672
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -666,7 +681,7 @@ class P {
666
681
  * @param payload Event payload.
667
682
  */
668
683
  async emitTo(e, i, n) {
669
- if (L.includes(i)) {
684
+ if (C.includes(i)) {
670
685
  for (const a of this.listeners[i] || [])
671
686
  a({
672
687
  event: i,
@@ -675,11 +690,11 @@ class P {
675
690
  });
676
691
  return;
677
692
  }
678
- return ee(e, i, n);
693
+ return ie(e, i, n);
679
694
  }
680
695
  /** @ignore */
681
696
  _handleTauriEvent(e, i) {
682
- return L.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
697
+ return C.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
683
698
  }
684
699
  // Getters
685
700
  /**
@@ -741,7 +756,7 @@ class P {
741
756
  async innerSize() {
742
757
  return s("plugin:window|inner_size", {
743
758
  label: this.label
744
- }).then((e) => new g(e));
759
+ }).then((e) => new b(e));
745
760
  }
746
761
  /**
747
762
  * The physical size of the entire window.
@@ -757,7 +772,7 @@ class P {
757
772
  async outerSize() {
758
773
  return s("plugin:window|outer_size", {
759
774
  label: this.label
760
- }).then((e) => new g(e));
775
+ }).then((e) => new b(e));
761
776
  }
762
777
  /**
763
778
  * Gets the window's current fullscreen state.
@@ -1008,7 +1023,7 @@ class P {
1008
1023
  */
1009
1024
  async requestUserAttention(e) {
1010
1025
  let i = null;
1011
- return e && (e === C.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
1026
+ return e && (e === M.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
1012
1027
  label: this.label,
1013
1028
  value: i
1014
1029
  });
@@ -1408,7 +1423,7 @@ class P {
1408
1423
  async setSize(e) {
1409
1424
  return s("plugin:window|set_size", {
1410
1425
  label: this.label,
1411
- value: e instanceof b ? e : new b(e)
1426
+ value: e instanceof g ? e : new g(e)
1412
1427
  });
1413
1428
  }
1414
1429
  /**
@@ -1425,7 +1440,7 @@ class P {
1425
1440
  async setMinSize(e) {
1426
1441
  return s("plugin:window|set_min_size", {
1427
1442
  label: this.label,
1428
- value: e instanceof b ? e : e ? new b(e) : null
1443
+ value: e instanceof g ? e : e ? new g(e) : null
1429
1444
  });
1430
1445
  }
1431
1446
  /**
@@ -1442,7 +1457,7 @@ class P {
1442
1457
  async setMaxSize(e) {
1443
1458
  return s("plugin:window|set_max_size", {
1444
1459
  label: this.label,
1445
- value: e instanceof b ? e : e ? new b(e) : null
1460
+ value: e instanceof g ? e : e ? new g(e) : null
1446
1461
  });
1447
1462
  }
1448
1463
  /**
@@ -1578,7 +1593,7 @@ class P {
1578
1593
  async setIcon(e) {
1579
1594
  return s("plugin:window|set_icon", {
1580
1595
  label: this.label,
1581
- value: A(e)
1596
+ value: N(e)
1582
1597
  });
1583
1598
  }
1584
1599
  /**
@@ -1813,7 +1828,7 @@ class P {
1813
1828
  async setOverlayIcon(e) {
1814
1829
  return s("plugin:window|set_overlay_icon", {
1815
1830
  label: this.label,
1816
- value: e ? A(e) : void 0
1831
+ value: e ? N(e) : void 0
1817
1832
  });
1818
1833
  }
1819
1834
  /**
@@ -1903,7 +1918,7 @@ class P {
1903
1918
  */
1904
1919
  async onResized(e) {
1905
1920
  return this.listen(o.WINDOW_RESIZED, (i) => {
1906
- i.payload = new g(i.payload), e(i);
1921
+ i.payload = new b(i.payload), e(i);
1907
1922
  });
1908
1923
  }
1909
1924
  /**
@@ -1952,7 +1967,7 @@ class P {
1952
1967
  */
1953
1968
  async onCloseRequested(e) {
1954
1969
  return this.listen(o.WINDOW_CLOSE_REQUESTED, async (i) => {
1955
- const n = new De(i);
1970
+ const n = new ze(i);
1956
1971
  await e(n), n.isPreventDefault() || await this.destroy();
1957
1972
  });
1958
1973
  }
@@ -2087,14 +2102,14 @@ class P {
2087
2102
  return this.listen(o.WINDOW_THEME_CHANGED, e);
2088
2103
  }
2089
2104
  }
2090
- var U;
2105
+ var G;
2091
2106
  (function(t) {
2092
2107
  t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
2093
- })(U || (U = {}));
2094
- var G;
2108
+ })(G || (G = {}));
2109
+ var U;
2095
2110
  (function(t) {
2096
2111
  t.Default = "default", t.FluentOverlay = "fluentOverlay";
2097
- })(G || (G = {}));
2112
+ })(U || (U = {}));
2098
2113
  var H;
2099
2114
  (function(t) {
2100
2115
  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";
@@ -2103,29 +2118,29 @@ var Q;
2103
2118
  (function(t) {
2104
2119
  t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
2105
2120
  })(Q || (Q = {}));
2106
- function ze(t) {
2121
+ function Ae(t) {
2107
2122
  return t === null ? null : {
2108
2123
  name: t.name,
2109
2124
  scaleFactor: t.scaleFactor,
2110
2125
  position: new u(t.position),
2111
- size: new g(t.size),
2126
+ size: new b(t.size),
2112
2127
  workArea: {
2113
2128
  position: new u(t.workArea.position),
2114
- size: new g(t.workArea.size)
2129
+ size: new b(t.workArea.size)
2115
2130
  }
2116
2131
  };
2117
2132
  }
2118
- async function Ae() {
2119
- return s("plugin:window|primary_monitor").then(ze);
2133
+ async function Oe() {
2134
+ return s("plugin:window|primary_monitor").then(Ae);
2120
2135
  }
2121
- function ie() {
2122
- return new T(te(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2136
+ function se() {
2137
+ return new E(ne(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2123
2138
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2124
2139
  skip: !0
2125
2140
  });
2126
2141
  }
2127
2142
  async function V() {
2128
- return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new T(new P(e.windowLabel, {
2143
+ return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new E(new O(e.windowLabel, {
2129
2144
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2130
2145
  skip: !0
2131
2146
  }), e.label, {
@@ -2133,8 +2148,8 @@ async function V() {
2133
2148
  skip: !0
2134
2149
  })));
2135
2150
  }
2136
- const M = ["tauri://created", "tauri://error"];
2137
- class T {
2151
+ const L = ["tauri://created", "tauri://error"];
2152
+ class E {
2138
2153
  /**
2139
2154
  * Creates a new Webview.
2140
2155
  * @example
@@ -2195,7 +2210,7 @@ class T {
2195
2210
  * Get an instance of `Webview` for the current webview.
2196
2211
  */
2197
2212
  static getCurrent() {
2198
- return ie();
2213
+ return se();
2199
2214
  }
2200
2215
  /**
2201
2216
  * Gets a list of instances of `Webview` for all available webviews.
@@ -2226,7 +2241,7 @@ class T {
2226
2241
  return this._handleTauriEvent(e, i) ? () => {
2227
2242
  const n = this.listeners[e];
2228
2243
  n.splice(n.indexOf(i), 1);
2229
- } : S(e, i, {
2244
+ } : A(e, i, {
2230
2245
  target: { kind: "Webview", label: this.label }
2231
2246
  });
2232
2247
  }
@@ -2253,7 +2268,7 @@ class T {
2253
2268
  return this._handleTauriEvent(e, i) ? () => {
2254
2269
  const n = this.listeners[e];
2255
2270
  n.splice(n.indexOf(i), 1);
2256
- } : E(e, i, {
2271
+ } : R(e, i, {
2257
2272
  target: { kind: "Webview", label: this.label }
2258
2273
  });
2259
2274
  }
@@ -2270,7 +2285,7 @@ class T {
2270
2285
  * @param payload Event payload.
2271
2286
  */
2272
2287
  async emit(e, i) {
2273
- if (M.includes(e)) {
2288
+ if (L.includes(e)) {
2274
2289
  for (const n of this.listeners[e] || [])
2275
2290
  n({
2276
2291
  event: e,
@@ -2279,7 +2294,7 @@ class T {
2279
2294
  });
2280
2295
  return;
2281
2296
  }
2282
- return X(e, i);
2297
+ return te(e, i);
2283
2298
  }
2284
2299
  /**
2285
2300
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -2295,7 +2310,7 @@ class T {
2295
2310
  * @param payload Event payload.
2296
2311
  */
2297
2312
  async emitTo(e, i, n) {
2298
- if (M.includes(i)) {
2313
+ if (L.includes(i)) {
2299
2314
  for (const a of this.listeners[i] || [])
2300
2315
  a({
2301
2316
  event: i,
@@ -2304,11 +2319,11 @@ class T {
2304
2319
  });
2305
2320
  return;
2306
2321
  }
2307
- return ee(e, i, n);
2322
+ return ie(e, i, n);
2308
2323
  }
2309
2324
  /** @ignore */
2310
2325
  _handleTauriEvent(e, i) {
2311
- return M.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
2326
+ return L.includes(e) ? (e in this.listeners ? this.listeners[e].push(i) : this.listeners[e] = [i], !0) : !1;
2312
2327
  }
2313
2328
  // Getters
2314
2329
  /**
@@ -2340,7 +2355,7 @@ class T {
2340
2355
  async size() {
2341
2356
  return s("plugin:webview|webview_size", {
2342
2357
  label: this.label
2343
- }).then((e) => new g(e));
2358
+ }).then((e) => new b(e));
2344
2359
  }
2345
2360
  // Setters
2346
2361
  /**
@@ -2372,7 +2387,7 @@ class T {
2372
2387
  async setSize(e) {
2373
2388
  return s("plugin:webview|set_webview_size", {
2374
2389
  label: this.label,
2375
- value: e instanceof b ? e : new b(e)
2390
+ value: e instanceof g ? e : new g(e)
2376
2391
  });
2377
2392
  }
2378
2393
  /**
@@ -2579,8 +2594,8 @@ class T {
2579
2594
  };
2580
2595
  }
2581
2596
  }
2582
- function Ne() {
2583
- const t = ie();
2597
+ function Pe() {
2598
+ const t = se();
2584
2599
  return new _(t.label, { skip: !0 });
2585
2600
  }
2586
2601
  async function j() {
@@ -2639,7 +2654,7 @@ class _ {
2639
2654
  * Get an instance of `Webview` for the current webview.
2640
2655
  */
2641
2656
  static getCurrent() {
2642
- return Ne();
2657
+ return Pe();
2643
2658
  }
2644
2659
  /**
2645
2660
  * Gets a list of instances of `Webview` for all available webviews.
@@ -2670,7 +2685,7 @@ class _ {
2670
2685
  return this._handleTauriEvent(e, i) ? () => {
2671
2686
  const n = this.listeners[e];
2672
2687
  n.splice(n.indexOf(i), 1);
2673
- } : S(e, i, {
2688
+ } : A(e, i, {
2674
2689
  target: { kind: "WebviewWindow", label: this.label }
2675
2690
  });
2676
2691
  }
@@ -2697,7 +2712,7 @@ class _ {
2697
2712
  return this._handleTauriEvent(e, i) ? () => {
2698
2713
  const n = this.listeners[e];
2699
2714
  n.splice(n.indexOf(i), 1);
2700
- } : E(e, i, {
2715
+ } : R(e, i, {
2701
2716
  target: { kind: "WebviewWindow", label: this.label }
2702
2717
  });
2703
2718
  }
@@ -2721,8 +2736,8 @@ class _ {
2721
2736
  return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
2722
2737
  }
2723
2738
  }
2724
- Se(_, [P, T]);
2725
- function Se(t, e) {
2739
+ xe(_, [O, E]);
2740
+ function xe(t, e) {
2726
2741
  (Array.isArray(e) ? e : [e]).forEach((i) => {
2727
2742
  Object.getOwnPropertyNames(i.prototype).forEach((n) => {
2728
2743
  var a;
@@ -2735,13 +2750,13 @@ function Se(t, e) {
2735
2750
  });
2736
2751
  });
2737
2752
  }
2738
- const v = /* @__PURE__ */ new Map(), Pe = async (t, e, i) => {
2753
+ const v = /* @__PURE__ */ new Map(), Ie = async (t, e, i) => {
2739
2754
  const n = i?.padding ?? 20;
2740
2755
  if (i?.x !== void 0 && i?.y !== void 0)
2741
2756
  return { x: i.x, y: i.y };
2742
2757
  let a = 1920, r = 1080;
2743
2758
  try {
2744
- const c = await Ae();
2759
+ const c = await Oe();
2745
2760
  c?.size && (a = c.size.width, r = c.size.height);
2746
2761
  } catch (c) {
2747
2762
  console.warn("Failed to get monitor info, using defaults:", c);
@@ -2778,20 +2793,20 @@ const v = /* @__PURE__ */ new Map(), Pe = async (t, e, i) => {
2778
2793
  y: r - e - n
2779
2794
  };
2780
2795
  }
2781
- }, Oe = async (t) => {
2782
- const e = String(t.id), i = d.getState();
2796
+ }, ke = async (t) => {
2797
+ const e = String(t.id), i = w.getState();
2783
2798
  if (i.isWindowActive(e)) {
2784
2799
  console.log(`Notice window already open for message: ${e}`);
2785
2800
  return;
2786
2801
  }
2787
- const n = $(), a = `notice-${e}`, r = `${n.routePrefix}/${t.type}?id=${t.id}`, l = t.min_width || n.defaultWidth, c = t.min_height || n.defaultHeight, { x: F, y: W } = await Pe(l, c, t.windowPosition);
2802
+ const n = Z(), a = `notice-${e}`, r = `${n.routePrefix}/${t.type}?id=${t.id}`, l = t.min_width || n.defaultWidth, c = t.min_height || n.defaultHeight, { x: q, y: W } = await Ie(l, c, t.windowPosition);
2788
2803
  try {
2789
2804
  const y = new _(a, {
2790
2805
  url: r,
2791
2806
  title: t.title,
2792
2807
  width: l,
2793
2808
  height: c,
2794
- x: F,
2809
+ x: q,
2795
2810
  y: W,
2796
2811
  resizable: !0,
2797
2812
  decorations: !0,
@@ -2799,12 +2814,12 @@ const v = /* @__PURE__ */ new Map(), Pe = async (t, e, i) => {
2799
2814
  alwaysOnTop: !0
2800
2815
  });
2801
2816
  v.set(e, y), i.addActiveWindow(e), y.once("tauri://destroyed", async () => {
2802
- v.delete(e), i.removeActiveWindow(e), await he(e), i.clearCurrent();
2817
+ v.delete(e), i.removeActiveWindow(e), await ye(e), i.clearCurrent();
2803
2818
  }), console.log(`Created notice window: ${a}`);
2804
2819
  } catch (y) {
2805
2820
  console.error("Failed to create notice window:", y), i.removeActiveWindow(e), i.clearCurrent();
2806
2821
  }
2807
- }, q = async (t) => {
2822
+ }, T = async (t) => {
2808
2823
  const e = String(t), i = v.get(e);
2809
2824
  if (i)
2810
2825
  try {
@@ -2812,46 +2827,46 @@ const v = /* @__PURE__ */ new Map(), Pe = async (t, e, i) => {
2812
2827
  } catch (n) {
2813
2828
  console.error("Failed to close notice window:", n);
2814
2829
  }
2815
- }, xe = async () => {
2830
+ }, Ce = async () => {
2816
2831
  const t = Array.from(v.keys()).map(
2817
- (e) => q(e)
2832
+ (e) => T(e)
2818
2833
  );
2819
2834
  await Promise.all(t);
2820
- }, Ie = () => {
2835
+ }, Le = () => {
2821
2836
  let t = null;
2822
- d.subscribe((e) => {
2837
+ w.subscribe((e) => {
2823
2838
  const i = e.currentMessage;
2824
- i && i !== t ? (t = i, Oe(i)) : i || (t = null);
2839
+ i && i !== t ? (t = i, ke(i)) : i || (t = null);
2825
2840
  }), console.log("Notice window system initialized");
2826
- }, qe = () => {
2827
- const t = d((i) => i.currentMessage);
2828
- return { closeNotice: N(async () => {
2829
- t && await q(t.id);
2841
+ }, Ge = () => {
2842
+ const t = w((i) => i.currentMessage);
2843
+ return { closeNotice: z(async () => {
2844
+ t && await T(t.id);
2830
2845
  }, [t]) };
2831
- }, Fe = () => {
2832
- const t = d();
2833
- return { hideNotice: N(
2846
+ }, Ue = () => {
2847
+ const t = w();
2848
+ return { hideNotice: z(
2834
2849
  async (i) => {
2835
- await be(i), await q(i), t.currentMessage?.id === i && t.clearCurrent();
2850
+ await pe(i), await T(i), t.currentMessage?.id === i && t.clearCurrent();
2836
2851
  },
2837
2852
  [t]
2838
2853
  ) };
2839
- }, Be = () => {
2840
- const t = d((i) => i.clearOnLogout);
2841
- return { hideAllNotices: N(async () => {
2842
- await xe(), await t();
2854
+ }, He = () => {
2855
+ const t = w((i) => i.clearOnLogout);
2856
+ return { hideAllNotices: z(async () => {
2857
+ await Ce(), await t();
2843
2858
  }, [t]) };
2844
- }, Ue = () => {
2845
- const t = d(D.queueLength), e = d(D.currentMessage), i = d(D.isProcessing), n = d(D.queue);
2859
+ }, Qe = () => {
2860
+ const t = w(D.queueLength), e = w(D.currentMessage), i = w(D.isProcessing), n = w(D.queue);
2846
2861
  return {
2847
2862
  queueLength: t,
2848
2863
  currentMessage: e,
2849
2864
  isProcessing: i,
2850
2865
  queue: n
2851
2866
  };
2852
- }, Ge = ({ children: t, onLoad: e }) => {
2867
+ }, Ve = ({ children: t, onLoad: e }) => {
2853
2868
  const [i, n] = x(null), [a, r] = x(!0), [l, c] = x(null);
2854
- return le(() => {
2869
+ return oe(() => {
2855
2870
  (async () => {
2856
2871
  try {
2857
2872
  const y = new URLSearchParams(window.location.search).get("id");
@@ -2859,12 +2874,12 @@ const v = /* @__PURE__ */ new Map(), Pe = async (t, e, i) => {
2859
2874
  c("No message ID provided"), r(!1);
2860
2875
  return;
2861
2876
  }
2862
- const O = await ge(y);
2863
- if (!O) {
2877
+ const P = await _e(y);
2878
+ if (!P) {
2864
2879
  c("Message not found"), r(!1);
2865
2880
  return;
2866
2881
  }
2867
- n(O), r(!1), e && e(O);
2882
+ n(P), r(!1), e && e(P);
2868
2883
  } catch (W) {
2869
2884
  console.error("Failed to load message:", W), c("Failed to load message"), r(!1);
2870
2885
  }
@@ -2882,35 +2897,35 @@ const v = /* @__PURE__ */ new Map(), Pe = async (t, e, i) => {
2882
2897
  height: "100vh",
2883
2898
  fontFamily: "system-ui, -apple-system, sans-serif",
2884
2899
  color: "#ef4444"
2885
- }, children: l || "Message not found" }) : /* @__PURE__ */ I(re, { children: t(i) });
2886
- }, He = async () => {
2887
- J(), Ie();
2888
- const { initializeFromDatabase: t } = d.getState();
2900
+ }, children: l || "Message not found" }) : /* @__PURE__ */ I(ue, { children: t(i) });
2901
+ }, je = async () => {
2902
+ Y(), Le();
2903
+ const { initializeFromDatabase: t } = w.getState();
2889
2904
  await t(), console.log("Tauri Notice System initialized");
2890
2905
  };
2891
2906
  export {
2892
- Ge as NoticeLayout,
2893
- ye as clearPendingMessages,
2894
- xe as closeAllNoticeWindows,
2895
- q as closeNoticeWindow,
2896
- Oe as createNoticeWindow,
2897
- ge as getMessage,
2898
- $ as getNoticeConfig,
2899
- we as getPendingMessages,
2900
- ce as hasMessage,
2901
- J as initializeDatabase,
2902
- He as initializeNoticeSystem,
2903
- Ie as initializeNoticeWindowSystem,
2904
- be as markAsHidden,
2905
- he as markAsShown,
2907
+ Ve as NoticeLayout,
2908
+ fe as clearPendingMessages,
2909
+ Ce as closeAllNoticeWindows,
2910
+ T as closeNoticeWindow,
2911
+ ke as createNoticeWindow,
2912
+ _e as getMessage,
2913
+ Z as getNoticeConfig,
2914
+ ge as getPendingMessages,
2915
+ he as hasMessage,
2916
+ Y as initializeDatabase,
2917
+ je as initializeNoticeSystem,
2918
+ Le as initializeNoticeWindowSystem,
2919
+ pe as markAsHidden,
2920
+ ye as markAsShown,
2906
2921
  D as messageQueueSelectors,
2907
- ue as saveMessage,
2908
- Ee as setNoticeConfig,
2909
- qe as useCloseNotice,
2910
- Be as useHideAllNotices,
2911
- Fe as useHideNotice,
2912
- Ue as useMessageQueue,
2913
- d as useMessageQueueStore,
2914
- Te as useNoticeWindow
2922
+ we as saveMessage,
2923
+ Fe as setNoticeConfig,
2924
+ Ge as useCloseNotice,
2925
+ He as useHideAllNotices,
2926
+ Ue as useHideNotice,
2927
+ Qe as useMessageQueue,
2928
+ w as useMessageQueueStore,
2929
+ Be as useNoticeWindow
2915
2930
  };
2916
2931
  //# sourceMappingURL=index.js.map