tauri-notice-window 1.0.18 → 1.0.21

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,9 +1,9 @@
1
- import { create as me } from "zustand";
2
- import { syncTabs as _e } from "zustand-sync";
3
- import ve from "dexie";
4
- import { useCallback as F, useState as L, useRef as X, useEffect as O } from "react";
5
- import { jsx as T } from "react/jsx-runtime";
6
- const ue = "tauri-notice-config", ee = {
1
+ import { create as ve } from "zustand";
2
+ import { syncTabs as Se } from "zustand-sync";
3
+ import We from "dexie";
4
+ import { useCallback as q, createContext as ze, useState as R, useRef as te, useEffect as P, useContext as Ae } from "react";
5
+ import { jsx as I } from "react/jsx-runtime";
6
+ const ce = "tauri-notice-config", ie = {
7
7
  routePrefix: "/notice",
8
8
  databaseName: "tauri-notice-db",
9
9
  defaultWidth: 400,
@@ -22,26 +22,26 @@ const ue = "tauri-notice-config", ee = {
22
22
  // Max height when auto-sizing
23
23
  autoSizeTimeout: 3e3
24
24
  // Fallback show timeout if measurement fails
25
- }, ce = () => {
25
+ }, we = () => {
26
26
  try {
27
- const t = localStorage.getItem(ue);
27
+ const t = localStorage.getItem(ce);
28
28
  if (t)
29
- return { ...ee, ...JSON.parse(t) };
29
+ return { ...ie, ...JSON.parse(t) };
30
30
  } catch (t) {
31
31
  console.warn("Failed to load config from localStorage:", t);
32
32
  }
33
- return ee;
34
- }, Se = (t) => {
33
+ return ie;
34
+ }, Ne = (t) => {
35
35
  try {
36
- localStorage.setItem(ue, JSON.stringify(t));
36
+ localStorage.setItem(ce, JSON.stringify(t));
37
37
  } catch (e) {
38
38
  console.warn("Failed to save config to localStorage:", e);
39
39
  }
40
- }, tt = (t) => {
41
- const i = { ...ce(), ...t };
42
- Se(i);
43
- }, q = () => ce();
44
- class We extends ve {
40
+ }, at = (t) => {
41
+ const i = { ...we(), ...t };
42
+ Ne(i);
43
+ }, B = () => we();
44
+ class De extends We {
45
45
  messages;
46
46
  constructor(e) {
47
47
  super(e), this.version(1).stores({
@@ -49,14 +49,14 @@ class We extends ve {
49
49
  });
50
50
  }
51
51
  }
52
- let P = null;
53
- const we = () => {
54
- if (!P) {
55
- const t = q();
56
- P = new We(t.databaseName);
57
- }
58
- return P;
59
- }, b = () => P || we(), ze = async (t) => {
52
+ let k = null;
53
+ const de = () => {
54
+ if (!k) {
55
+ const t = B();
56
+ k = new De(t.databaseName);
57
+ }
58
+ return k;
59
+ }, p = () => k || de(), xe = async (t) => {
60
60
  const e = {
61
61
  ...t,
62
62
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -65,31 +65,31 @@ const we = () => {
65
65
  queueStatus: "pending",
66
66
  queuePosition: 0
67
67
  };
68
- await b().messages.put(e);
69
- }, Ae = async (t) => !!await b().messages.get(t), Ne = async (t) => {
70
- const e = await b().messages.get(t);
68
+ await p().messages.put(e);
69
+ }, Me = async (t) => !!await p().messages.get(t), Oe = async (t) => {
70
+ const e = await p().messages.get(t);
71
71
  return e?.isShown === !0 || e?.queueStatus === "shown";
72
- }, De = async () => await b().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), Me = async (t, e) => {
73
- await b().messages.update(t, { queueStatus: e });
74
- }, xe = async (t) => {
75
- await b().messages.update(t, {
72
+ }, Pe = async () => await p().messages.where("queueStatus").equals("pending").sortBy("queuePosition"), Ie = async (t, e) => {
73
+ await p().messages.update(t, { queueStatus: e });
74
+ }, ke = async (t) => {
75
+ await p().messages.update(t, {
76
76
  queueStatus: "shown",
77
77
  isShown: !0
78
78
  });
79
- }, Oe = async (t) => {
80
- await b().messages.update(t, {
79
+ }, Ce = async (t) => {
80
+ await p().messages.update(t, {
81
81
  queueStatus: "hidden"
82
82
  });
83
- }, de = async (t) => await b().messages.get(t), Pe = async (t) => {
84
- await b().messages.delete(t);
85
- }, Ie = async () => {
86
- await b().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
87
- }, ke = async (t) => {
83
+ }, he = async (t) => await p().messages.get(t), Le = async (t) => {
84
+ await p().messages.delete(t);
85
+ }, Re = async () => {
86
+ await p().messages.where("queueStatus").anyOf(["pending", "showing"]).delete();
87
+ }, Te = async (t) => {
88
88
  const e = t.map(
89
- (i) => b().messages.update(i.id, { queuePosition: i.position })
89
+ (i) => p().messages.update(i.id, { queuePosition: i.position })
90
90
  );
91
91
  await Promise.all(e);
92
- }, Le = (t, e) => ({
92
+ }, Ee = (t, e) => ({
93
93
  // Initial state
94
94
  queue: [],
95
95
  currentMessage: null,
@@ -99,13 +99,13 @@ const we = () => {
99
99
  // Enqueue a new message
100
100
  enqueue: async (i) => {
101
101
  const n = e();
102
- if (await Ne(i.id)) {
102
+ if (await Oe(i.id)) {
103
103
  console.log(`Message ${i.id} was already shown, skipping`);
104
104
  return;
105
105
  }
106
- if (await Ae(i.id) || await ze(i), !n.queue.some((h) => h.id === i.id)) {
107
- const h = [...n.queue, i];
108
- t({ queue: h }), await e().persistQueue();
106
+ if (await Me(i.id) || await xe(i), !n.queue.some((y) => y.id === i.id)) {
107
+ const y = [...n.queue, i];
108
+ t({ queue: y }), await e().persistQueue();
109
109
  }
110
110
  !n.isProcessing && !n.currentMessage && await e().showNext();
111
111
  },
@@ -124,14 +124,14 @@ const we = () => {
124
124
  t({ isProcessing: !1, currentMessage: null });
125
125
  return;
126
126
  }
127
- if (!await de(n.id)) {
127
+ if (!await he(n.id)) {
128
128
  console.log(`Message ${n.id} was deleted, skipping to next`), await e().showNext();
129
129
  return;
130
130
  }
131
131
  t({
132
132
  currentMessage: n,
133
133
  isProcessing: !0
134
- }), await Me(n.id, "showing"), await e().persistQueue();
134
+ }), await Ie(n.id, "showing"), await e().persistQueue();
135
135
  },
136
136
  // Clear current message and show next
137
137
  clearCurrent: () => {
@@ -156,7 +156,7 @@ const we = () => {
156
156
  initializeFromDatabase: async () => {
157
157
  if (e().initialized) return;
158
158
  t({ initialized: !0 });
159
- const n = await De();
159
+ const n = await Pe();
160
160
  n.length > 0 && (t({ queue: n }), await e().showNext());
161
161
  },
162
162
  // Persist queue to database
@@ -165,7 +165,7 @@ const we = () => {
165
165
  id: a.id,
166
166
  position: o
167
167
  }));
168
- await ke(n);
168
+ await Te(n);
169
169
  },
170
170
  // Clear all messages on logout
171
171
  clearOnLogout: async () => {
@@ -175,7 +175,7 @@ const we = () => {
175
175
  isProcessing: !1,
176
176
  activeWindowIds: [],
177
177
  initialized: !1
178
- }), await Ie();
178
+ }), await Re();
179
179
  },
180
180
  // Remove a specific message from the queue by ID (memory only)
181
181
  removeFromQueue: async (i) => {
@@ -184,15 +184,15 @@ const we = () => {
184
184
  },
185
185
  // Delete message completely (from both memory and database)
186
186
  deleteMessage: async (i) => {
187
- await Pe(i), await e().removeFromQueue(i);
187
+ await Le(i), await e().removeFromQueue(i);
188
188
  },
189
189
  // Hide a message (mark as hidden and remove from queue)
190
190
  hideMessage: async (i) => {
191
- await Oe(i), await e().removeFromQueue(i);
191
+ await Ce(i), await e().removeFromQueue(i);
192
192
  },
193
193
  // Mark message as shown in database
194
194
  markMessageAsShown: async (i) => {
195
- await xe(i);
195
+ await ke(i);
196
196
  },
197
197
  // Add active window ID
198
198
  addActiveWindow: (i) => {
@@ -211,46 +211,46 @@ const we = () => {
211
211
  const n = e(), a = String(i);
212
212
  return n.activeWindowIds.includes(a);
213
213
  }
214
- }), w = me()(
215
- _e(Le, {
214
+ }), w = ve()(
215
+ Se(Ee, {
216
216
  name: "tauri-notice-queue"
217
217
  })
218
- ), C = {
218
+ ), T = {
219
219
  queueLength: (t) => t.queue.length,
220
220
  currentMessage: (t) => t.currentMessage,
221
221
  isProcessing: (t) => t.isProcessing,
222
222
  queue: (t) => t.queue
223
- }, it = () => {
223
+ }, rt = () => {
224
224
  const t = w((i) => i.enqueue);
225
- return { showNotice: F(
225
+ return { showNotice: q(
226
226
  async (i) => {
227
227
  await t(i);
228
228
  },
229
229
  [t]
230
230
  ) };
231
231
  };
232
- function Te(t, e, i, n) {
232
+ function Fe(t, e, i, n) {
233
233
  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");
234
234
  return i === "m" ? n : i === "a" ? n.call(t) : n ? n.value : e.get(t);
235
235
  }
236
- function Ce(t, e, i, n, a) {
236
+ function qe(t, e, i, n, a) {
237
237
  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");
238
238
  return e.set(t, i), i;
239
239
  }
240
- var R;
241
- const y = "__TAURI_TO_IPC_KEY__";
242
- function Re(t, e = !1) {
240
+ var E;
241
+ const g = "__TAURI_TO_IPC_KEY__";
242
+ function Be(t, e = !1) {
243
243
  return window.__TAURI_INTERNALS__.transformCallback(t, e);
244
244
  }
245
245
  async function s(t, e = {}, i) {
246
246
  return window.__TAURI_INTERNALS__.invoke(t, e, i);
247
247
  }
248
- class Ee {
248
+ class He {
249
249
  get rid() {
250
- return Te(this, R, "f");
250
+ return Fe(this, E, "f");
251
251
  }
252
252
  constructor(e) {
253
- R.set(this, void 0), Ce(this, R, e);
253
+ E.set(this, void 0), qe(this, E, e);
254
254
  }
255
255
  /**
256
256
  * Destroys and cleans up this resource from memory.
@@ -262,8 +262,8 @@ class Ee {
262
262
  });
263
263
  }
264
264
  }
265
- R = /* @__PURE__ */ new WeakMap();
266
- class V {
265
+ E = /* @__PURE__ */ new WeakMap();
266
+ class j {
267
267
  constructor(...e) {
268
268
  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]);
269
269
  }
@@ -283,19 +283,19 @@ class V {
283
283
  * @since 2.0.0
284
284
  */
285
285
  toPhysical(e) {
286
- return new S(this.width * e, this.height * e);
286
+ return new z(this.width * e, this.height * e);
287
287
  }
288
- [y]() {
288
+ [g]() {
289
289
  return {
290
290
  width: this.width,
291
291
  height: this.height
292
292
  };
293
293
  }
294
294
  toJSON() {
295
- return this[y]();
295
+ return this[g]();
296
296
  }
297
297
  }
298
- class S {
298
+ class z {
299
299
  constructor(...e) {
300
300
  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]);
301
301
  }
@@ -311,29 +311,29 @@ class S {
311
311
  * ```
312
312
  */
313
313
  toLogical(e) {
314
- return new V(this.width / e, this.height / e);
314
+ return new j(this.width / e, this.height / e);
315
315
  }
316
- [y]() {
316
+ [g]() {
317
317
  return {
318
318
  width: this.width,
319
319
  height: this.height
320
320
  };
321
321
  }
322
322
  toJSON() {
323
- return this[y]();
323
+ return this[g]();
324
324
  }
325
325
  }
326
- class v {
326
+ class W {
327
327
  constructor(e) {
328
328
  this.size = e;
329
329
  }
330
330
  toLogical(e) {
331
- return this.size instanceof V ? this.size : this.size.toLogical(e);
331
+ return this.size instanceof j ? this.size : this.size.toLogical(e);
332
332
  }
333
333
  toPhysical(e) {
334
- return this.size instanceof S ? this.size : this.size.toPhysical(e);
334
+ return this.size instanceof z ? this.size : this.size.toPhysical(e);
335
335
  }
336
- [y]() {
336
+ [g]() {
337
337
  return {
338
338
  [`${this.size.type}`]: {
339
339
  width: this.size.width,
@@ -342,7 +342,7 @@ class v {
342
342
  };
343
343
  }
344
344
  toJSON() {
345
- return this[y]();
345
+ return this[g]();
346
346
  }
347
347
  }
348
348
  class J {
@@ -365,19 +365,19 @@ class J {
365
365
  * @since 2.0.0
366
366
  */
367
367
  toPhysical(e) {
368
- return new c(this.x * e, this.y * e);
368
+ return new h(this.x * e, this.y * e);
369
369
  }
370
- [y]() {
370
+ [g]() {
371
371
  return {
372
372
  x: this.x,
373
373
  y: this.y
374
374
  };
375
375
  }
376
376
  toJSON() {
377
- return this[y]();
377
+ return this[g]();
378
378
  }
379
379
  }
380
- class c {
380
+ class h {
381
381
  constructor(...e) {
382
382
  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]);
383
383
  }
@@ -399,17 +399,17 @@ class c {
399
399
  toLogical(e) {
400
400
  return new J(this.x / e, this.y / e);
401
401
  }
402
- [y]() {
402
+ [g]() {
403
403
  return {
404
404
  x: this.x,
405
405
  y: this.y
406
406
  };
407
407
  }
408
408
  toJSON() {
409
- return this[y]();
409
+ return this[g]();
410
410
  }
411
411
  }
412
- class A {
412
+ class D {
413
413
  constructor(e) {
414
414
  this.position = e;
415
415
  }
@@ -417,9 +417,9 @@ class A {
417
417
  return this.position instanceof J ? this.position : this.position.toLogical(e);
418
418
  }
419
419
  toPhysical(e) {
420
- return this.position instanceof c ? this.position : this.position.toPhysical(e);
420
+ return this.position instanceof h ? this.position : this.position.toPhysical(e);
421
421
  }
422
- [y]() {
422
+ [g]() {
423
423
  return {
424
424
  [`${this.position.type}`]: {
425
425
  x: this.position.x,
@@ -428,56 +428,47 @@ class A {
428
428
  };
429
429
  }
430
430
  toJSON() {
431
- return this[y]();
431
+ return this[g]();
432
432
  }
433
433
  }
434
- const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
435
- __proto__: null,
436
- LogicalPosition: J,
437
- LogicalSize: V,
438
- PhysicalPosition: c,
439
- PhysicalSize: S,
440
- Position: A,
441
- Size: v
442
- }, Symbol.toStringTag, { value: "Module" }));
443
434
  var u;
444
435
  (function(t) {
445
436
  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";
446
437
  })(u || (u = {}));
447
- async function he(t, e) {
438
+ async function ge(t, e) {
448
439
  window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(t, e), await s("plugin:event|unlisten", {
449
440
  event: t,
450
441
  eventId: e
451
442
  });
452
443
  }
453
- async function B(t, e, i) {
444
+ async function H(t, e, i) {
454
445
  var n;
455
446
  const a = typeof i?.target == "string" ? { kind: "AnyLabel", label: i.target } : (n = i?.target) !== null && n !== void 0 ? n : { kind: "Any" };
456
447
  return s("plugin:event|listen", {
457
448
  event: t,
458
449
  target: a,
459
- handler: Re(e)
460
- }).then((o) => async () => he(t, o));
450
+ handler: Be(e)
451
+ }).then((o) => async () => ge(t, o));
461
452
  }
462
453
  async function Z(t, e, i) {
463
- return B(t, (n) => {
464
- he(t, n.id), e(n);
454
+ return H(t, (n) => {
455
+ ge(t, n.id), e(n);
465
456
  }, i);
466
457
  }
467
- async function ge(t, e) {
458
+ async function ye(t, e) {
468
459
  await s("plugin:event|emit", {
469
460
  event: t,
470
461
  payload: e
471
462
  });
472
463
  }
473
- async function ye(t, e, i) {
464
+ async function be(t, e, i) {
474
465
  await s("plugin:event|emit_to", {
475
466
  target: typeof t == "string" ? { kind: "AnyLabel", label: t } : t,
476
467
  event: e,
477
468
  payload: i
478
469
  });
479
470
  }
480
- class I extends Ee {
471
+ class C extends He {
481
472
  /**
482
473
  * Creates an Image from a resource ID. For internal use only.
483
474
  *
@@ -489,10 +480,10 @@ class I extends Ee {
489
480
  /** Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height. */
490
481
  static async new(e, i, n) {
491
482
  return s("plugin:image|new", {
492
- rgba: E(e),
483
+ rgba: F(e),
493
484
  width: i,
494
485
  height: n
495
- }).then((a) => new I(a));
486
+ }).then((a) => new C(a));
496
487
  }
497
488
  /**
498
489
  * Creates a new image using the provided bytes by inferring the file format.
@@ -509,8 +500,8 @@ class I extends Ee {
509
500
  */
510
501
  static async fromBytes(e) {
511
502
  return s("plugin:image|from_bytes", {
512
- bytes: E(e)
513
- }).then((i) => new I(i));
503
+ bytes: F(e)
504
+ }).then((i) => new C(i));
514
505
  }
515
506
  /**
516
507
  * Creates a new image using the provided path.
@@ -525,7 +516,7 @@ class I extends Ee {
525
516
  * ```
526
517
  */
527
518
  static async fromPath(e) {
528
- return s("plugin:image|from_path", { path: e }).then((i) => new I(i));
519
+ return s("plugin:image|from_path", { path: e }).then((i) => new C(i));
529
520
  }
530
521
  /** Returns the RGBA data for this image, in row-major order from top to bottom. */
531
522
  async rgba() {
@@ -538,14 +529,14 @@ class I extends Ee {
538
529
  return s("plugin:image|size", { rid: this.rid });
539
530
  }
540
531
  }
541
- function E(t) {
542
- return t == null ? null : typeof t == "string" ? t : t instanceof I ? t.rid : t;
532
+ function F(t) {
533
+ return t == null ? null : typeof t == "string" ? t : t instanceof C ? t.rid : t;
543
534
  }
544
- var j;
535
+ var V;
545
536
  (function(t) {
546
537
  t[t.Critical = 1] = "Critical", t[t.Informational = 2] = "Informational";
547
- })(j || (j = {}));
548
- class Fe {
538
+ })(V || (V = {}));
539
+ class Ue {
549
540
  constructor(e) {
550
541
  this._preventDefault = !1, this.event = e.event, this.id = e.id;
551
542
  }
@@ -556,11 +547,11 @@ class Fe {
556
547
  return this._preventDefault;
557
548
  }
558
549
  }
559
- var ie;
550
+ var ne;
560
551
  (function(t) {
561
552
  t.None = "none", t.Normal = "normal", t.Indeterminate = "indeterminate", t.Paused = "paused", t.Error = "error";
562
- })(ie || (ie = {}));
563
- function be() {
553
+ })(ne || (ne = {}));
554
+ function pe() {
564
555
  return new U(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
565
556
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
566
557
  skip: !0
@@ -620,7 +611,7 @@ class U {
620
611
  * Get an instance of `Window` for the current window.
621
612
  */
622
613
  static getCurrent() {
623
- return be();
614
+ return pe();
624
615
  }
625
616
  /**
626
617
  * Gets a list of instances of `Window` for all available windows.
@@ -667,7 +658,7 @@ class U {
667
658
  return this._handleTauriEvent(e, i) ? () => {
668
659
  const n = this.listeners[e];
669
660
  n.splice(n.indexOf(i), 1);
670
- } : B(e, i, {
661
+ } : H(e, i, {
671
662
  target: { kind: "Window", label: this.label }
672
663
  });
673
664
  }
@@ -719,7 +710,7 @@ class U {
719
710
  });
720
711
  return;
721
712
  }
722
- return ge(e, i);
713
+ return ye(e, i);
723
714
  }
724
715
  /**
725
716
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -743,7 +734,7 @@ class U {
743
734
  });
744
735
  return;
745
736
  }
746
- return ye(e, i, n);
737
+ return be(e, i, n);
747
738
  }
748
739
  /** @ignore */
749
740
  _handleTauriEvent(e, i) {
@@ -778,7 +769,7 @@ class U {
778
769
  async innerPosition() {
779
770
  return s("plugin:window|inner_position", {
780
771
  label: this.label
781
- }).then((e) => new c(e));
772
+ }).then((e) => new h(e));
782
773
  }
783
774
  /**
784
775
  * The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
@@ -793,7 +784,7 @@ class U {
793
784
  async outerPosition() {
794
785
  return s("plugin:window|outer_position", {
795
786
  label: this.label
796
- }).then((e) => new c(e));
787
+ }).then((e) => new h(e));
797
788
  }
798
789
  /**
799
790
  * The physical size of the window's client area.
@@ -809,7 +800,7 @@ class U {
809
800
  async innerSize() {
810
801
  return s("plugin:window|inner_size", {
811
802
  label: this.label
812
- }).then((e) => new S(e));
803
+ }).then((e) => new z(e));
813
804
  }
814
805
  /**
815
806
  * The physical size of the entire window.
@@ -825,7 +816,7 @@ class U {
825
816
  async outerSize() {
826
817
  return s("plugin:window|outer_size", {
827
818
  label: this.label
828
- }).then((e) => new S(e));
819
+ }).then((e) => new z(e));
829
820
  }
830
821
  /**
831
822
  * Gets the window's current fullscreen state.
@@ -1076,7 +1067,7 @@ class U {
1076
1067
  */
1077
1068
  async requestUserAttention(e) {
1078
1069
  let i = null;
1079
- return e && (e === j.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
1070
+ return e && (e === V.Critical ? i = { type: "Critical" } : i = { type: "Informational" }), s("plugin:window|request_user_attention", {
1080
1071
  label: this.label,
1081
1072
  value: i
1082
1073
  });
@@ -1476,7 +1467,7 @@ class U {
1476
1467
  async setSize(e) {
1477
1468
  return s("plugin:window|set_size", {
1478
1469
  label: this.label,
1479
- value: e instanceof v ? e : new v(e)
1470
+ value: e instanceof W ? e : new W(e)
1480
1471
  });
1481
1472
  }
1482
1473
  /**
@@ -1493,7 +1484,7 @@ class U {
1493
1484
  async setMinSize(e) {
1494
1485
  return s("plugin:window|set_min_size", {
1495
1486
  label: this.label,
1496
- value: e instanceof v ? e : e ? new v(e) : null
1487
+ value: e instanceof W ? e : e ? new W(e) : null
1497
1488
  });
1498
1489
  }
1499
1490
  /**
@@ -1510,7 +1501,7 @@ class U {
1510
1501
  async setMaxSize(e) {
1511
1502
  return s("plugin:window|set_max_size", {
1512
1503
  label: this.label,
1513
- value: e instanceof v ? e : e ? new v(e) : null
1504
+ value: e instanceof W ? e : e ? new W(e) : null
1514
1505
  });
1515
1506
  }
1516
1507
  /**
@@ -1552,7 +1543,7 @@ class U {
1552
1543
  async setPosition(e) {
1553
1544
  return s("plugin:window|set_position", {
1554
1545
  label: this.label,
1555
- value: e instanceof A ? e : new A(e)
1546
+ value: e instanceof D ? e : new D(e)
1556
1547
  });
1557
1548
  }
1558
1549
  /**
@@ -1646,7 +1637,7 @@ class U {
1646
1637
  async setIcon(e) {
1647
1638
  return s("plugin:window|set_icon", {
1648
1639
  label: this.label,
1649
- value: E(e)
1640
+ value: F(e)
1650
1641
  });
1651
1642
  }
1652
1643
  /**
@@ -1764,7 +1755,7 @@ class U {
1764
1755
  async setCursorPosition(e) {
1765
1756
  return s("plugin:window|set_cursor_position", {
1766
1757
  label: this.label,
1767
- value: e instanceof A ? e : new A(e)
1758
+ value: e instanceof D ? e : new D(e)
1768
1759
  });
1769
1760
  }
1770
1761
  /**
@@ -1881,7 +1872,7 @@ class U {
1881
1872
  async setOverlayIcon(e) {
1882
1873
  return s("plugin:window|set_overlay_icon", {
1883
1874
  label: this.label,
1884
- value: e ? E(e) : void 0
1875
+ value: e ? F(e) : void 0
1885
1876
  });
1886
1877
  }
1887
1878
  /**
@@ -1971,7 +1962,7 @@ class U {
1971
1962
  */
1972
1963
  async onResized(e) {
1973
1964
  return this.listen(u.WINDOW_RESIZED, (i) => {
1974
- i.payload = new S(i.payload), e(i);
1965
+ i.payload = new z(i.payload), e(i);
1975
1966
  });
1976
1967
  }
1977
1968
  /**
@@ -1993,7 +1984,7 @@ class U {
1993
1984
  */
1994
1985
  async onMoved(e) {
1995
1986
  return this.listen(u.WINDOW_MOVED, (i) => {
1996
- i.payload = new c(i.payload), e(i);
1987
+ i.payload = new h(i.payload), e(i);
1997
1988
  });
1998
1989
  }
1999
1990
  /**
@@ -2020,7 +2011,7 @@ class U {
2020
2011
  */
2021
2012
  async onCloseRequested(e) {
2022
2013
  return this.listen(u.WINDOW_CLOSE_REQUESTED, async (i) => {
2023
- const n = new Fe(i);
2014
+ const n = new Ue(i);
2024
2015
  await e(n), n.isPreventDefault() || await this.destroy();
2025
2016
  });
2026
2017
  }
@@ -2056,7 +2047,7 @@ class U {
2056
2047
  payload: {
2057
2048
  type: "enter",
2058
2049
  paths: r.payload.paths,
2059
- position: new c(r.payload.position)
2050
+ position: new h(r.payload.position)
2060
2051
  }
2061
2052
  });
2062
2053
  }), n = await this.listen(u.DRAG_OVER, (r) => {
@@ -2064,7 +2055,7 @@ class U {
2064
2055
  ...r,
2065
2056
  payload: {
2066
2057
  type: "over",
2067
- position: new c(r.payload.position)
2058
+ position: new h(r.payload.position)
2068
2059
  }
2069
2060
  });
2070
2061
  }), a = await this.listen(u.DRAG_DROP, (r) => {
@@ -2073,7 +2064,7 @@ class U {
2073
2064
  payload: {
2074
2065
  type: "drop",
2075
2066
  paths: r.payload.paths,
2076
- position: new c(r.payload.position)
2067
+ position: new h(r.payload.position)
2077
2068
  }
2078
2069
  });
2079
2070
  }), o = await this.listen(u.DRAG_LEAVE, (r) => {
@@ -2155,44 +2146,44 @@ class U {
2155
2146
  return this.listen(u.WINDOW_THEME_CHANGED, e);
2156
2147
  }
2157
2148
  }
2158
- var ne;
2159
- (function(t) {
2160
- t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
2161
- })(ne || (ne = {}));
2162
2149
  var se;
2163
2150
  (function(t) {
2164
- t.Default = "default", t.FluentOverlay = "fluentOverlay";
2151
+ t.Disabled = "disabled", t.Throttle = "throttle", t.Suspend = "suspend";
2165
2152
  })(se || (se = {}));
2166
2153
  var ae;
2167
2154
  (function(t) {
2168
- 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";
2155
+ t.Default = "default", t.FluentOverlay = "fluentOverlay";
2169
2156
  })(ae || (ae = {}));
2170
2157
  var re;
2171
2158
  (function(t) {
2172
- t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
2159
+ 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";
2173
2160
  })(re || (re = {}));
2174
- function qe(t) {
2161
+ var oe;
2162
+ (function(t) {
2163
+ t.FollowsWindowActiveState = "followsWindowActiveState", t.Active = "active", t.Inactive = "inactive";
2164
+ })(oe || (oe = {}));
2165
+ function $e(t) {
2175
2166
  return t === null ? null : {
2176
2167
  name: t.name,
2177
2168
  scaleFactor: t.scaleFactor,
2178
- position: new c(t.position),
2179
- size: new S(t.size),
2169
+ position: new h(t.position),
2170
+ size: new z(t.size),
2180
2171
  workArea: {
2181
- position: new c(t.workArea.position),
2182
- size: new S(t.workArea.size)
2172
+ position: new h(t.workArea.position),
2173
+ size: new z(t.workArea.size)
2183
2174
  }
2184
2175
  };
2185
2176
  }
2186
- async function Be() {
2187
- return s("plugin:window|primary_monitor").then(qe);
2177
+ async function Ge() {
2178
+ return s("plugin:window|primary_monitor").then($e);
2188
2179
  }
2189
- function pe() {
2190
- return new Y(be(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2180
+ function fe() {
2181
+ return new Y(pe(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {
2191
2182
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2192
2183
  skip: !0
2193
2184
  });
2194
2185
  }
2195
- async function oe() {
2186
+ async function le() {
2196
2187
  return s("plugin:webview|get_all_webviews").then((t) => t.map((e) => new Y(new U(e.windowLabel, {
2197
2188
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2198
2189
  skip: !0
@@ -2257,19 +2248,19 @@ class Y {
2257
2248
  */
2258
2249
  static async getByLabel(e) {
2259
2250
  var i;
2260
- return (i = (await oe()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
2251
+ return (i = (await le()).find((n) => n.label === e)) !== null && i !== void 0 ? i : null;
2261
2252
  }
2262
2253
  /**
2263
2254
  * Get an instance of `Webview` for the current webview.
2264
2255
  */
2265
2256
  static getCurrent() {
2266
- return pe();
2257
+ return fe();
2267
2258
  }
2268
2259
  /**
2269
2260
  * Gets a list of instances of `Webview` for all available webviews.
2270
2261
  */
2271
2262
  static async getAll() {
2272
- return oe();
2263
+ return le();
2273
2264
  }
2274
2265
  /**
2275
2266
  * Listen to an emitted event on this webview.
@@ -2294,7 +2285,7 @@ class Y {
2294
2285
  return this._handleTauriEvent(e, i) ? () => {
2295
2286
  const n = this.listeners[e];
2296
2287
  n.splice(n.indexOf(i), 1);
2297
- } : B(e, i, {
2288
+ } : H(e, i, {
2298
2289
  target: { kind: "Webview", label: this.label }
2299
2290
  });
2300
2291
  }
@@ -2347,7 +2338,7 @@ class Y {
2347
2338
  });
2348
2339
  return;
2349
2340
  }
2350
- return ge(e, i);
2341
+ return ye(e, i);
2351
2342
  }
2352
2343
  /**
2353
2344
  * Emits an event to all {@link EventTarget|targets} matching the given target.
@@ -2372,7 +2363,7 @@ class Y {
2372
2363
  });
2373
2364
  return;
2374
2365
  }
2375
- return ye(e, i, n);
2366
+ return be(e, i, n);
2376
2367
  }
2377
2368
  /** @ignore */
2378
2369
  _handleTauriEvent(e, i) {
@@ -2392,7 +2383,7 @@ class Y {
2392
2383
  async position() {
2393
2384
  return s("plugin:webview|webview_position", {
2394
2385
  label: this.label
2395
- }).then((e) => new c(e));
2386
+ }).then((e) => new h(e));
2396
2387
  }
2397
2388
  /**
2398
2389
  * The physical size of the webview's client area.
@@ -2408,7 +2399,7 @@ class Y {
2408
2399
  async size() {
2409
2400
  return s("plugin:webview|webview_size", {
2410
2401
  label: this.label
2411
- }).then((e) => new S(e));
2402
+ }).then((e) => new z(e));
2412
2403
  }
2413
2404
  // Setters
2414
2405
  /**
@@ -2440,7 +2431,7 @@ class Y {
2440
2431
  async setSize(e) {
2441
2432
  return s("plugin:webview|set_webview_size", {
2442
2433
  label: this.label,
2443
- value: e instanceof v ? e : new v(e)
2434
+ value: e instanceof W ? e : new W(e)
2444
2435
  });
2445
2436
  }
2446
2437
  /**
@@ -2457,7 +2448,7 @@ class Y {
2457
2448
  async setPosition(e) {
2458
2449
  return s("plugin:webview|set_webview_position", {
2459
2450
  label: this.label,
2460
- value: e instanceof A ? e : new A(e)
2451
+ value: e instanceof D ? e : new D(e)
2461
2452
  });
2462
2453
  }
2463
2454
  /**
@@ -2619,7 +2610,7 @@ class Y {
2619
2610
  payload: {
2620
2611
  type: "enter",
2621
2612
  paths: r.payload.paths,
2622
- position: new c(r.payload.position)
2613
+ position: new h(r.payload.position)
2623
2614
  }
2624
2615
  });
2625
2616
  }), n = await this.listen(u.DRAG_OVER, (r) => {
@@ -2627,7 +2618,7 @@ class Y {
2627
2618
  ...r,
2628
2619
  payload: {
2629
2620
  type: "over",
2630
- position: new c(r.payload.position)
2621
+ position: new h(r.payload.position)
2631
2622
  }
2632
2623
  });
2633
2624
  }), a = await this.listen(u.DRAG_DROP, (r) => {
@@ -2636,7 +2627,7 @@ class Y {
2636
2627
  payload: {
2637
2628
  type: "drop",
2638
2629
  paths: r.payload.paths,
2639
- position: new c(r.payload.position)
2630
+ position: new h(r.payload.position)
2640
2631
  }
2641
2632
  });
2642
2633
  }), o = await this.listen(u.DRAG_LEAVE, (r) => {
@@ -2648,16 +2639,16 @@ class Y {
2648
2639
  }
2649
2640
  }
2650
2641
  function N() {
2651
- const t = pe();
2652
- return new D(t.label, { skip: !0 });
2642
+ const t = fe();
2643
+ return new x(t.label, { skip: !0 });
2653
2644
  }
2654
- async function le() {
2655
- return s("plugin:window|get_all_windows").then((t) => t.map((e) => new D(e, {
2645
+ async function ue() {
2646
+ return s("plugin:window|get_all_windows").then((t) => t.map((e) => new x(e, {
2656
2647
  // @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor
2657
2648
  skip: !0
2658
2649
  })));
2659
2650
  }
2660
- class D {
2651
+ class x {
2661
2652
  /**
2662
2653
  * Creates a new {@link Window} hosting a {@link Webview}.
2663
2654
  * @example
@@ -2700,8 +2691,8 @@ class D {
2700
2691
  */
2701
2692
  static async getByLabel(e) {
2702
2693
  var i;
2703
- const n = (i = (await le()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2704
- return n ? new D(n.label, { skip: !0 }) : null;
2694
+ const n = (i = (await ue()).find((a) => a.label === e)) !== null && i !== void 0 ? i : null;
2695
+ return n ? new x(n.label, { skip: !0 }) : null;
2705
2696
  }
2706
2697
  /**
2707
2698
  * Get an instance of `Webview` for the current webview.
@@ -2713,7 +2704,7 @@ class D {
2713
2704
  * Gets a list of instances of `Webview` for all available webviews.
2714
2705
  */
2715
2706
  static async getAll() {
2716
- return le();
2707
+ return ue();
2717
2708
  }
2718
2709
  /**
2719
2710
  * Listen to an emitted event on this webview window.
@@ -2738,7 +2729,7 @@ class D {
2738
2729
  return this._handleTauriEvent(e, i) ? () => {
2739
2730
  const n = this.listeners[e];
2740
2731
  n.splice(n.indexOf(i), 1);
2741
- } : B(e, i, {
2732
+ } : H(e, i, {
2742
2733
  target: { kind: "WebviewWindow", label: this.label }
2743
2734
  });
2744
2735
  }
@@ -2789,8 +2780,8 @@ class D {
2789
2780
  return s("plugin:window|set_background_color", { color: e }).then(() => s("plugin:webview|set_webview_background_color", { color: e }));
2790
2781
  }
2791
2782
  }
2792
- Ue(D, [U, Y]);
2793
- function Ue(t, e) {
2783
+ Qe(x, [U, Y]);
2784
+ function Qe(t, e) {
2794
2785
  (Array.isArray(e) ? e : [e]).forEach((i) => {
2795
2786
  Object.getOwnPropertyNames(i.prototype).forEach((n) => {
2796
2787
  var a;
@@ -2803,17 +2794,17 @@ function Ue(t, e) {
2803
2794
  });
2804
2795
  });
2805
2796
  }
2806
- const k = /* @__PURE__ */ new Map(), He = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), $e = (t) => {
2797
+ const L = /* @__PURE__ */ new Map(), Ve = () => navigator.platform.toLowerCase().includes("mac") || navigator.userAgent.toLowerCase().includes("mac"), je = (t) => {
2807
2798
  if (!t || t.trim() === "") return !1;
2808
2799
  try {
2809
2800
  return !!(t.startsWith("/") || t.startsWith("http://") || t.startsWith("https://") || t.startsWith("tauri://"));
2810
2801
  } catch {
2811
2802
  return !1;
2812
2803
  }
2813
- }, Ge = async () => {
2804
+ }, Je = async () => {
2814
2805
  let t = 1920, e = 1080;
2815
2806
  try {
2816
- const i = await Be();
2807
+ const i = await Ge();
2817
2808
  if (i?.size) {
2818
2809
  const n = i.scaleFactor || 1;
2819
2810
  t = i.size.width / n, e = i.size.height / n;
@@ -2822,11 +2813,11 @@ const k = /* @__PURE__ */ new Map(), He = () => navigator.platform.toLowerCase()
2822
2813
  console.warn("Failed to get monitor info, using defaults:", i);
2823
2814
  }
2824
2815
  return { screenWidth: t, screenHeight: e };
2825
- }, fe = async (t, e, i) => {
2816
+ }, me = async (t, e, i) => {
2826
2817
  const n = i?.padding ?? 20;
2827
2818
  if (i?.x !== void 0 && i?.y !== void 0)
2828
2819
  return { x: i.x, y: i.y };
2829
- const { screenWidth: a, screenHeight: o } = await Ge();
2820
+ const { screenWidth: a, screenHeight: o } = await Je();
2830
2821
  switch (i?.position ?? "right-bottom") {
2831
2822
  case "right-bottom":
2832
2823
  return {
@@ -2859,104 +2850,104 @@ const k = /* @__PURE__ */ new Map(), He = () => navigator.platform.toLowerCase()
2859
2850
  y: o - e - n
2860
2851
  };
2861
2852
  }
2862
- }, Qe = async (t) => {
2853
+ }, Ze = async (t) => {
2863
2854
  const e = String(t.id), i = w.getState();
2864
2855
  if (i.isWindowActive(e)) {
2865
2856
  console.log(`Notice window already open for message: ${e}`);
2866
2857
  return;
2867
2858
  }
2868
- const n = q(), a = `notice-${e}`;
2859
+ const n = B(), a = `notice-${e}`;
2869
2860
  let o = `${n.routePrefix}/${t.type}?id=${t.id}`;
2870
- $e(o) || (console.warn(`Invalid window URL: ${o}. Using fallback 404 page.`), o = n.notFoundUrl || "/404");
2871
- const r = t.min_width || n.defaultWidth, h = t.min_height || n.defaultHeight, m = t.decorations ?? n.defaultDecorations ?? !0, g = n.autoSize ?? !0, { x: z, y: M } = await fe(r, h, t.windowPosition);
2861
+ je(o) || (console.warn(`Invalid window URL: ${o}. Using fallback 404 page.`), o = n.notFoundUrl || "/404");
2862
+ const r = t.min_width || n.defaultWidth, y = t.min_height || n.defaultHeight, _ = t.decorations ?? n.defaultDecorations ?? !0, b = n.autoSize ?? !0, { x: M, y: S } = await me(r, y, t.windowPosition);
2872
2863
  try {
2873
2864
  const d = {
2874
2865
  url: o,
2875
2866
  title: t.title,
2876
2867
  width: r,
2877
- height: h,
2878
- x: z,
2879
- y: M,
2868
+ height: y,
2869
+ x: M,
2870
+ y: S,
2880
2871
  resizable: !0,
2881
2872
  skipTaskbar: !1,
2882
2873
  alwaysOnTop: !0
2883
2874
  };
2884
- g && (d.visible = !1), m ? d.decorations = !0 : He() ? (d.decorations = !0, d.titleBarStyle = "overlay", d.hiddenTitle = !0) : (d.decorations = !1, d.transparent = !0);
2885
- const p = new D(a, d);
2886
- k.set(e, p), i.addActiveWindow(e);
2875
+ b && (d.visible = !1), _ ? d.decorations = !0 : Ve() ? (d.decorations = !0, d.titleBarStyle = "overlay", d.hiddenTitle = !0) : (d.decorations = !1, d.transparent = !0);
2876
+ const f = new x(a, d);
2877
+ L.set(e, f), i.addActiveWindow(e);
2887
2878
  let l = null;
2888
- const f = n.loadTimeout ?? 1e4;
2889
- !m && f > 0 && (l = setTimeout(async () => {
2879
+ const m = n.loadTimeout ?? 1e4;
2880
+ !_ && m > 0 && (l = setTimeout(async () => {
2890
2881
  console.warn(`Notice window ${a} load timeout - auto closing`);
2891
2882
  try {
2892
- await p.close();
2883
+ await f.close();
2893
2884
  } catch {
2894
2885
  }
2895
- }, f)), p.once("tauri://created", () => {
2886
+ }, m)), f.once("tauri://created", () => {
2896
2887
  l && (clearTimeout(l), l = null), console.log(`Notice window created successfully: ${a}`);
2897
- }), p.once("tauri://error", async (_) => {
2898
- if (console.error(`Notice window error: ${a}`, _), l && (clearTimeout(l), l = null), !m)
2888
+ }), f.once("tauri://error", async (v) => {
2889
+ if (console.error(`Notice window error: ${a}`, v), l && (clearTimeout(l), l = null), !_)
2899
2890
  try {
2900
- await p.close();
2891
+ await f.close();
2901
2892
  } catch {
2902
2893
  }
2903
- }), p.once("tauri://destroyed", async () => {
2904
- l && (clearTimeout(l), l = null), k.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2905
- }), console.log(`Created notice window: ${a} (autoSize: ${g}, visible: ${!g})`);
2894
+ }), f.once("tauri://destroyed", async () => {
2895
+ l && (clearTimeout(l), l = null), L.delete(e), i.removeActiveWindow(e), await i.markMessageAsShown(e), i.clearCurrent();
2896
+ }), console.log(`Created notice window: ${a} (autoSize: ${b}, visible: ${!b})`);
2906
2897
  } catch (d) {
2907
2898
  console.error("Failed to create notice window:", d), i.removeActiveWindow(e), i.clearCurrent();
2908
2899
  }
2909
2900
  }, K = async (t) => {
2910
- const e = String(t), i = k.get(e), n = w.getState();
2901
+ const e = String(t), i = L.get(e), n = w.getState();
2911
2902
  if (i)
2912
2903
  try {
2913
- await i.close(), k.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2904
+ await i.close(), L.delete(e), n.removeActiveWindow(e), await n.markMessageAsShown(e), n.clearCurrent(), console.log(`Closed notice window: ${e}`);
2914
2905
  } catch (a) {
2915
2906
  console.error("Failed to close notice window:", a);
2916
2907
  }
2917
- }, je = async () => {
2918
- const t = Array.from(k.keys()).map(
2908
+ }, Ye = async () => {
2909
+ const t = Array.from(L.keys()).map(
2919
2910
  (e) => K(e)
2920
2911
  );
2921
2912
  await Promise.all(t);
2922
- }, Ve = () => {
2913
+ }, Ke = () => {
2923
2914
  let t = null;
2924
2915
  w.subscribe((e) => {
2925
2916
  const i = e.currentMessage;
2926
- i && i !== t ? (t = i, Qe(i)) : i || (t = null);
2917
+ i && i !== t ? (t = i, Ze(i)) : i || (t = null);
2927
2918
  }), console.log("Notice window system initialized");
2928
- }, nt = () => {
2919
+ }, ot = () => {
2929
2920
  const t = w((i) => i.currentMessage);
2930
- return { closeNotice: F(async () => {
2921
+ return { closeNotice: q(async () => {
2931
2922
  t && await K(t.id);
2932
2923
  }, [t]) };
2933
- }, st = () => {
2924
+ }, lt = () => {
2934
2925
  const t = w((i) => i.hideMessage);
2935
- return { hideNotice: F(
2926
+ return { hideNotice: q(
2936
2927
  async (i) => {
2937
2928
  await t(i), await K(i);
2938
2929
  },
2939
2930
  [t]
2940
2931
  ) };
2941
- }, at = () => {
2932
+ }, ut = () => {
2942
2933
  const t = w((i) => i.clearOnLogout);
2943
- return { hideAllNotices: F(async () => {
2944
- await je(), await t();
2934
+ return { hideAllNotices: q(async () => {
2935
+ await Ye(), await t();
2945
2936
  }, [t]) };
2946
- }, rt = () => {
2947
- const t = w(C.queueLength), e = w(C.currentMessage), i = w(C.isProcessing), n = w(C.queue);
2937
+ }, ct = () => {
2938
+ const t = w(T.queueLength), e = w(T.currentMessage), i = w(T.isProcessing), n = w(T.queue);
2948
2939
  return {
2949
2940
  queueLength: t,
2950
2941
  currentMessage: e,
2951
2942
  isProcessing: i,
2952
2943
  queue: n
2953
2944
  };
2954
- }, Je = async (t) => {
2945
+ }, _e = ze({ windowReady: !0 }), wt = () => Ae(_e), Xe = async (t) => {
2955
2946
  try {
2956
- const e = q(), i = e.defaultWidth || 400, n = e.maxHeight ?? 800, a = e.defaultHeight || 300, o = Math.max(a, Math.min(Math.ceil(t), n)), { LogicalSize: r } = await Promise.resolve().then(() => te), h = N();
2957
- await h.setSize(new r(i, o));
2958
- const { x: m, y: g } = await fe(i, o), { LogicalPosition: z } = await Promise.resolve().then(() => te);
2959
- await h.setPosition(new z(m, g)), await h.show(), console.log(`[NoticeLayout] Auto-sized window to ${i}x${o}`);
2947
+ const e = B(), i = e.defaultWidth || 400, n = e.maxHeight ?? 800, a = e.defaultHeight || 300, o = Math.max(a, Math.min(Math.ceil(t), n)), r = N();
2948
+ await r.setSize(new j(i, o));
2949
+ const { x: y, y: _ } = await me(i, o);
2950
+ await r.setPosition(new J(y, _)), await r.show(), console.log(`[NoticeLayout] Auto-sized window to ${i}x${o}`);
2960
2951
  } catch (e) {
2961
2952
  console.error("[NoticeLayout] Failed to auto-size, showing window as-is:", e);
2962
2953
  try {
@@ -2964,99 +2955,102 @@ const k = /* @__PURE__ */ new Map(), He = () => navigator.platform.toLowerCase()
2964
2955
  } catch {
2965
2956
  }
2966
2957
  }
2967
- }, ot = ({ children: t, onLoad: e, onClose: i }) => {
2968
- const [n, a] = L(null), [o, r] = L(!0), [h, m] = L(null), [g, z] = L(!1), M = X(null), d = X(!1), p = q(), l = p.autoSize ?? !0;
2969
- return O(() => {
2970
- l || z(!0);
2971
- }, [l]), O(() => {
2958
+ }, dt = ({ children: t, onLoad: e, onClose: i }) => {
2959
+ const [n, a] = R(null), [o, r] = R(!0), [y, _] = R(null), [b, M] = R(!1), S = te(null), d = te(!1), f = B(), l = f.autoSize ?? !0;
2960
+ return P(() => {
2961
+ l || M(!0);
2962
+ }, [l]), P(() => {
2972
2963
  (async () => {
2973
2964
  try {
2974
- const W = new URLSearchParams(window.location.search).get("id");
2975
- if (!W) {
2976
- m("No message ID provided"), r(!1), setTimeout(async () => {
2965
+ const c = new URLSearchParams(window.location.search).get("id");
2966
+ if (!c) {
2967
+ _("No message ID provided"), r(!1), setTimeout(async () => {
2977
2968
  try {
2978
2969
  await N().close();
2979
- } catch (x) {
2980
- console.error("Failed to close window:", x);
2970
+ } catch (A) {
2971
+ console.error("Failed to close window:", A);
2981
2972
  }
2982
2973
  }, 1e3);
2983
2974
  return;
2984
2975
  }
2985
- const H = await de(W);
2986
- if (!H) {
2987
- console.log(`Message ${W} not found in database, closing window`), m("Message not found"), r(!1), setTimeout(async () => {
2976
+ const O = await he(c);
2977
+ if (!O) {
2978
+ console.log(`Message ${c} not found in database, closing window`), _("Message not found"), r(!1), setTimeout(async () => {
2988
2979
  try {
2989
2980
  await N().close();
2990
- } catch (x) {
2991
- console.error("Failed to close window:", x);
2981
+ } catch (A) {
2982
+ console.error("Failed to close window:", A);
2992
2983
  }
2993
2984
  }, 500);
2994
2985
  return;
2995
2986
  }
2996
- a(H), r(!1), e && e(H);
2997
- } catch (_) {
2998
- console.error("Failed to load message:", _), m("Failed to load message"), r(!1), setTimeout(async () => {
2987
+ a(O), r(!1), e && e(O);
2988
+ } catch (v) {
2989
+ console.error("Failed to load message:", v), _("Failed to load message"), r(!1), setTimeout(async () => {
2999
2990
  try {
3000
2991
  await N().close();
3001
- } catch (W) {
3002
- console.error("Failed to close window:", W);
2992
+ } catch (c) {
2993
+ console.error("Failed to close window:", c);
3003
2994
  }
3004
2995
  }, 1e3);
3005
2996
  }
3006
2997
  })();
3007
- }, [e]), O(() => {
3008
- if (!l || !n || g || d.current) return;
3009
- const f = requestAnimationFrame(() => {
3010
- if (!M.current || d.current) return;
3011
- d.current = !0;
3012
- const _ = M.current.getBoundingClientRect();
3013
- Je(_.height).then(() => {
3014
- z(!0);
2998
+ }, [e]), P(() => {
2999
+ if (!l || !n || b || d.current) return;
3000
+ const m = requestAnimationFrame(() => {
3001
+ const v = requestAnimationFrame(() => {
3002
+ if (!S.current || d.current) return;
3003
+ d.current = !0;
3004
+ const c = document.body, O = c.style.height, A = c.style.overflow;
3005
+ c.style.height = "auto", c.style.overflow = "visible", S.current.offsetHeight;
3006
+ const X = S.current.getBoundingClientRect(), ee = Math.max(X.height, S.current.scrollHeight);
3007
+ console.log(`[NoticeLayout] Measured natural content height: ${ee}px (rect=${X.height}, scroll=${S.current.scrollHeight})`), c.style.height = O, c.style.overflow = A, Xe(ee).then(() => {
3008
+ M(!0);
3009
+ });
3015
3010
  });
3011
+ return () => cancelAnimationFrame(v);
3016
3012
  });
3017
- return () => cancelAnimationFrame(f);
3018
- }, [l, n, g]), O(() => {
3019
- if (!l || g) return;
3020
- const f = p.autoSizeTimeout ?? 3e3, _ = setTimeout(async () => {
3021
- if (!g) {
3013
+ return () => cancelAnimationFrame(m);
3014
+ }, [l, n, b]), P(() => {
3015
+ if (!l || b) return;
3016
+ const m = f.autoSizeTimeout ?? 3e3, v = setTimeout(async () => {
3017
+ if (!b) {
3022
3018
  console.warn("[NoticeLayout] Auto-size timeout reached, showing window as-is");
3023
3019
  try {
3024
3020
  await N().show();
3025
3021
  } catch {
3026
3022
  }
3027
- z(!0);
3023
+ M(!0);
3028
3024
  }
3029
- }, f);
3030
- return () => clearTimeout(_);
3031
- }, [l, g, p.autoSizeTimeout]), O(() => {
3025
+ }, m);
3026
+ return () => clearTimeout(v);
3027
+ }, [l, b, f.autoSizeTimeout]), P(() => {
3032
3028
  if (!n || !i) return;
3033
- const f = () => {
3029
+ const m = () => {
3034
3030
  i(n);
3035
3031
  };
3036
- return window.addEventListener("beforeunload", f), () => {
3037
- window.removeEventListener("beforeunload", f);
3038
- };
3039
- }, [n, i]), o ? /* @__PURE__ */ T("div", { style: {
3032
+ return window.addEventListener("beforeunload", m), () => window.removeEventListener("beforeunload", m);
3033
+ }, [n, i]), o ? /* @__PURE__ */ I("div", { style: {
3040
3034
  display: "flex",
3041
3035
  justifyContent: "center",
3042
3036
  alignItems: "center",
3043
3037
  height: "100vh",
3044
3038
  fontFamily: "system-ui, -apple-system, sans-serif"
3045
- }, children: "Loading..." }) : h ? /* @__PURE__ */ T("div", { style: {
3039
+ }, children: "Loading..." }) : y ? /* @__PURE__ */ I("div", { style: {
3046
3040
  display: "flex",
3047
3041
  justifyContent: "center",
3048
3042
  alignItems: "center",
3049
3043
  height: "100vh",
3050
3044
  fontFamily: "system-ui, -apple-system, sans-serif",
3051
3045
  color: "#ef4444"
3052
- }, children: h }) : n ? /* @__PURE__ */ T(
3046
+ }, children: y }) : n ? /* @__PURE__ */ I(_e.Provider, { value: { windowReady: b }, children: /* @__PURE__ */ I(
3053
3047
  "div",
3054
3048
  {
3055
- ref: M,
3056
- style: g ? { height: "100vh" } : void 0,
3049
+ ref: S,
3050
+ style: b ? { height: "100vh" } : void 0,
3057
3051
  children: t(n)
3058
3052
  }
3059
- ) : /* @__PURE__ */ T("div", { style: {
3053
+ ) }) : /* @__PURE__ */ I("div", { style: {
3060
3054
  display: "flex",
3061
3055
  justifyContent: "center",
3062
3056
  alignItems: "center",
@@ -3064,40 +3058,41 @@ const k = /* @__PURE__ */ new Map(), He = () => navigator.platform.toLowerCase()
3064
3058
  fontFamily: "system-ui, -apple-system, sans-serif",
3065
3059
  color: "#ef4444"
3066
3060
  }, children: "Closing window..." });
3067
- }, lt = async () => {
3068
- we(), Ve();
3061
+ }, ht = async () => {
3062
+ de(), Ke();
3069
3063
  const { initializeFromDatabase: t } = w.getState();
3070
3064
  await t(), console.log("Tauri Notice System initialized");
3071
- }, ut = async (t) => {
3065
+ }, gt = async (t) => {
3072
3066
  await w.getState().deleteMessage(t);
3073
- }, ct = async (t) => {
3067
+ }, yt = async (t) => {
3074
3068
  await w.getState().hideMessage(t);
3075
- }, wt = async (t) => {
3069
+ }, bt = async (t) => {
3076
3070
  await w.getState().markMessageAsShown(t);
3077
3071
  };
3078
3072
  export {
3079
- ot as NoticeLayout,
3080
- fe as calculateWindowPosition,
3081
- je as closeAllNoticeWindows,
3073
+ dt as NoticeLayout,
3074
+ me as calculateWindowPosition,
3075
+ Ye as closeAllNoticeWindows,
3082
3076
  K as closeNoticeWindow,
3083
- Qe as createNoticeWindow,
3084
- ut as deleteMessageById,
3085
- Ge as getLogicalScreenSize,
3086
- de as getMessage,
3087
- q as getNoticeConfig,
3088
- De as getPendingMessages,
3089
- ct as hideMessageById,
3090
- we as initializeDatabase,
3091
- lt as initializeNoticeSystem,
3092
- Ve as initializeNoticeWindowSystem,
3093
- wt as markMessageAsShown,
3094
- C as messageQueueSelectors,
3095
- tt as setNoticeConfig,
3096
- nt as useCloseNotice,
3097
- at as useHideAllNotices,
3098
- st as useHideNotice,
3099
- rt as useMessageQueue,
3077
+ Ze as createNoticeWindow,
3078
+ gt as deleteMessageById,
3079
+ Je as getLogicalScreenSize,
3080
+ he as getMessage,
3081
+ B as getNoticeConfig,
3082
+ Pe as getPendingMessages,
3083
+ yt as hideMessageById,
3084
+ de as initializeDatabase,
3085
+ ht as initializeNoticeSystem,
3086
+ Ke as initializeNoticeWindowSystem,
3087
+ bt as markMessageAsShown,
3088
+ T as messageQueueSelectors,
3089
+ at as setNoticeConfig,
3090
+ ot as useCloseNotice,
3091
+ ut as useHideAllNotices,
3092
+ lt as useHideNotice,
3093
+ ct as useMessageQueue,
3100
3094
  w as useMessageQueueStore,
3101
- it as useNoticeWindow
3095
+ rt as useNoticeWindow,
3096
+ wt as useNoticeWindowContext
3102
3097
  };
3103
3098
  //# sourceMappingURL=index.js.map