vue3-router-tab 1.4.0 → 1.4.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.
@@ -1,7 +1,7 @@
1
1
  import './vue3-router-tab.css';
2
- import { reactive as ie, ref as S, shallowRef as Kt, computed as k, watch as A, nextTick as B, inject as Le, getCurrentInstance as We, onMounted as ke, defineComponent as Ke, provide as Et, onErrorCaptured as $t, onBeforeUnmount as At, h as Pt, resolveComponent as St, createElementBlock as x, openBlock as $, createElementVNode as j, withDirectives as It, normalizeClass as q, renderSlot as ve, createVNode as Oe, TransitionGroup as xt, mergeProps as he, withCtx as me, Fragment as ye, renderList as je, withModifiers as Te, createCommentVNode as te, toDisplayString as Ue, normalizeProps as Dt, createBlock as ne, KeepAlive as Bt, resolveDynamicComponent as Ve, Transition as Mt, normalizeStyle as Lt, vShow as Ot, isRef as jt, isReadonly as Ut } from "vue";
2
+ import { reactive as ie, ref as x, shallowRef as kt, computed as K, watch as S, nextTick as M, inject as De, getCurrentInstance as Ye, onMounted as Fe, onBeforeMount as Ct, defineComponent as Ce, provide as Kt, onErrorCaptured as Et, onBeforeUnmount as $t, h as Pt, resolveComponent as At, createElementBlock as B, openBlock as $, createElementVNode as V, withDirectives as St, normalizeClass as q, renderSlot as me, createVNode as It, TransitionGroup as xt, mergeProps as he, withCtx as ye, Fragment as Te, renderList as Me, withModifiers as we, createCommentVNode as te, toDisplayString as Le, createBlock as X, normalizeProps as Bt, KeepAlive as Dt, resolveDynamicComponent as Oe, Transition as Mt, normalizeStyle as Lt, vShow as Ot, isRef as jt, isReadonly as Ut } from "vue";
3
3
  import { RouterView as Vt } from "vue-router";
4
- function Nt(e = {}) {
4
+ function _t(e = {}) {
5
5
  return {
6
6
  initialTabs: e.initialTabs ?? [],
7
7
  keepAlive: e.keepAlive ?? !0,
@@ -17,7 +17,7 @@ function _(e, r) {
17
17
  throw new Error(`[RouterTabs] Unable to resolve route: ${String(r)}`);
18
18
  return o;
19
19
  }
20
- const _t = {
20
+ const Nt = {
21
21
  path: (e) => e.path,
22
22
  fullpath: (e) => e.fullPath,
23
23
  fullname: (e) => e.fullPath,
@@ -30,32 +30,32 @@ function z(e) {
30
30
  const o = r(e);
31
31
  if (typeof o == "string" && o.length) return o;
32
32
  } else if (typeof r == "string" && r.length) {
33
- const o = _t[r.toLowerCase()];
33
+ const o = Nt[r.toLowerCase()];
34
34
  return o ? o(e) : r;
35
35
  }
36
36
  return e.fullPath;
37
37
  }
38
- function Ee(e, r) {
38
+ function Ke(e, r) {
39
39
  const o = e.meta?.keepAlive;
40
40
  return typeof o == "boolean" ? o : r;
41
41
  }
42
- function $e(e, r) {
42
+ function Ee(e, r) {
43
43
  const o = e.meta?.reuse;
44
44
  return typeof o == "boolean" ? o : r;
45
45
  }
46
- function Je(e) {
46
+ function He(e) {
47
47
  const r = e.meta ?? {}, o = {};
48
48
  return "title" in r && (o.title = r.title), "tips" in r && (o.tips = r.tips), "icon" in r && (o.icon = r.icon), "closable" in r && (o.closable = r.closable), "tabClass" in r && (o.tabClass = r.tabClass), "target" in r && (o.target = r.target), "href" in r && (o.href = r.href), o;
49
49
  }
50
- function oe(e, r, o) {
51
- const s = Je(e);
50
+ function ne(e, r, o) {
51
+ const s = He(e);
52
52
  return {
53
53
  id: z(e),
54
54
  to: e.fullPath,
55
55
  fullPath: e.fullPath,
56
56
  matched: e,
57
- alive: Ee(e, o),
58
- reusable: $e(e, !1),
57
+ alive: Ke(e, o),
58
+ reusable: Ee(e, !1),
59
59
  closable: s.closable ?? !0,
60
60
  renderKey: typeof r.renderKey == "number" ? r.renderKey : 0,
61
61
  ...s,
@@ -63,27 +63,27 @@ function oe(e, r, o) {
63
63
  };
64
64
  }
65
65
  function Re(e, r, o, s) {
66
- if (!e.find((v) => v.id === r.id)) {
66
+ if (!e.find((p) => p.id === r.id)) {
67
67
  if (o === "next" && s) {
68
- const v = e.findIndex((T) => T.id === s);
69
- if (v !== -1) {
70
- e.splice(v + 1, 0, r);
68
+ const p = e.findIndex((w) => w.id === s);
69
+ if (p !== -1) {
70
+ e.splice(p + 1, 0, r);
71
71
  return;
72
72
  }
73
73
  }
74
74
  e.push(r);
75
75
  }
76
76
  }
77
- function we(e, r, o, s) {
77
+ function oe(e, r, o, s) {
78
78
  if (!r || r <= 0) return;
79
- const a = e.filter((v) => v.alive);
79
+ const a = e.filter((p) => p.alive);
80
80
  for (; a.length > r; ) {
81
- const v = a.shift();
82
- if (!v || v.id === o) continue;
83
- const T = e.findIndex((l) => l.id === v.id);
84
- if (T > -1) {
85
- const l = e[T], d = `${l.id}::${l.renderKey ?? 0}`;
86
- s.delete(d), l.alive = !1;
81
+ const p = a.shift();
82
+ if (!p || p.id === o) continue;
83
+ const w = e.findIndex((i) => i.id === p.id);
84
+ if (w > -1) {
85
+ const i = e[w], m = `${i.id}::${i.renderKey ?? 0}`;
86
+ s.delete(m), i.alive = !1;
87
87
  }
88
88
  }
89
89
  }
@@ -103,177 +103,183 @@ function Yt(e) {
103
103
  return "title" in e && (r.title = e.title), "tips" in e && (r.tips = e.tips), "icon" in e && (r.icon = e.icon), "tabClass" in e && (r.tabClass = e.tabClass), "closable" in e && (r.closable = e.closable), "renderKey" in e && typeof e.renderKey == "number" && (r.renderKey = e.renderKey), r;
104
104
  }
105
105
  function Ft(e, r = {}) {
106
- const o = Nt(r), s = ie([]), a = S(null), v = Kt(), T = S(null), l = ie(/* @__PURE__ */ new Set()), d = k(() => Array.from(l));
107
- let h = !1;
108
- function E(u) {
109
- const b = typeof u.matched == "object" ? u : _(e, u);
106
+ const o = _t(r), s = ie([]), a = x(null), p = kt(), w = x(null), i = ie(/* @__PURE__ */ new Set()), m = K(() => Array.from(i));
107
+ let v = !1;
108
+ function T(u) {
109
+ const d = typeof u.matched == "object" ? u : _(e, u);
110
110
  return {
111
- key: z(b),
112
- fullPath: b.fullPath,
113
- alive: Ee(b, o.keepAlive),
114
- reusable: $e(b, !1),
115
- matched: b
111
+ key: z(d),
112
+ fullPath: d.fullPath,
113
+ alive: Ke(d, o.keepAlive),
114
+ reusable: Ee(d, !1),
115
+ matched: d
116
116
  };
117
117
  }
118
- function P(u) {
119
- const b = z(u);
120
- let c = s.find((y) => y.id === b);
121
- const m = Ee(u, o.keepAlive);
118
+ function I(u) {
119
+ const d = z(u);
120
+ let c = s.find((y) => y.id === d);
121
+ const h = Ke(u, o.keepAlive);
122
122
  if (c) {
123
- c.fullPath = u.fullPath, c.to = u.fullPath, c.matched = u, c.reusable = $e(u, c.reusable), typeof c.renderKey != "number" && (c.renderKey = 0);
124
- const y = `${b}::${c.renderKey}`;
125
- return m ? l.has(y) ? c.alive || (c.alive = !0) : (l.add(y), c.alive = !0) : c.alive && (l.delete(y), c.alive = !1), Object.assign(c, Je(u)), c;
123
+ c.fullPath = u.fullPath, c.to = u.fullPath, c.matched = u, c.reusable = Ee(u, c.reusable), typeof c.renderKey != "number" && (c.renderKey = 0);
124
+ const y = `${d}::${c.renderKey}`;
125
+ return h ? i.has(y) ? c.alive || (c.alive = !0) : (i.add(y), c.alive = !0) : c.alive && (i.delete(y), c.alive = !1), Object.assign(c, He(u)), c;
126
126
  }
127
- if (c = oe(u, {}, o.keepAlive), c.alive) {
128
- const y = `${b}::${c.renderKey ?? 0}`;
129
- l.add(y);
127
+ if (c = ne(u, {}, o.keepAlive), c.alive) {
128
+ const y = `${d}::${c.renderKey ?? 0}`;
129
+ i.add(y);
130
130
  }
131
- return Re(s, c, o.appendPosition, a.value), we(s, o.maxAlive, a.value, l), c;
131
+ return Re(s, c, o.appendPosition, a.value), oe(s, o.maxAlive, a.value, i), c;
132
132
  }
133
- async function M(u, b = !1, c = "sameTab") {
134
- const m = _(e, u), y = z(m), w = a.value === y;
135
- c === "sameTab" && (c = w), c && await U(y, !0), await e[b ? "replace" : "push"](m), w && await V();
133
+ async function A(u, d = !1, c = "sameTab") {
134
+ const h = _(e, u), y = z(h), E = a.value === y;
135
+ c === "sameTab" && (c = E), c && await j(y, !0), await e[d ? "replace" : "push"](h), E && await F();
136
136
  }
137
- function Y(u) {
138
- const b = s.findIndex((I) => I.id === u);
139
- if (b === -1) return o.defaultRoute;
140
- const c = s[b + 1], m = s[b - 1], y = s.find((I) => I.id !== u), w = c || m || y;
141
- return w ? w.to : o.defaultRoute;
137
+ function L(u) {
138
+ const d = s.findIndex((C) => C.id === u);
139
+ if (d === -1) return o.defaultRoute;
140
+ const c = s[d + 1], h = s[d - 1], y = s.find((C) => C.id !== u), E = c || h || y;
141
+ return E ? E.to : o.defaultRoute;
142
142
  }
143
- async function L(u = a.value, b = {}) {
143
+ async function O(u = a.value, d = {}) {
144
144
  if (!u) return;
145
- if (!b.force && o.keepLastTab && s.length === 1)
145
+ if (!d.force && o.keepLastTab && s.length === 1)
146
146
  throw new Error("[RouterTabs] Unable to close the final tab when keepLastTab is true.");
147
- const m = a.value === u && b.redirect !== null, y = m ? b.redirect ?? Y(u) : null;
148
- await F(u, { force: b.force }), b.redirect !== null && m && y && await e.replace(y);
147
+ const h = a.value === u && d.redirect !== null, y = h ? d.redirect ?? L(u) : null;
148
+ await Y(u, { force: d.force }), d.redirect !== null && h && y && await e.replace(y);
149
149
  }
150
- async function F(u, b = {}) {
151
- const c = s.findIndex((w) => w.id === u);
150
+ async function Y(u, d = {}) {
151
+ const c = s.findIndex((E) => E.id === u);
152
152
  if (c === -1) return;
153
- const m = s[c], y = `${u}::${m.renderKey ?? 0}`;
154
- l.delete(y), m.alive = !1, s.splice(c, 1), T.value === u && (T.value = null), a.value === u && (a.value = null, v.value = void 0);
153
+ const h = s[c], y = `${u}::${h.renderKey ?? 0}`;
154
+ i.delete(y), h.alive = !1, s.splice(c, 1), w.value === u && (w.value = null), a.value === u && (a.value = null, p.value = void 0);
155
155
  }
156
- async function U(u = a.value ?? void 0, b = !1) {
156
+ async function j(u = a.value ?? void 0, d = !1) {
157
157
  if (!u) return;
158
- const c = s.find((I) => I.id === u);
158
+ const c = s.find((C) => C.id === u);
159
159
  if (!c) return;
160
- const m = o.keepAlive && c.alive, y = `${u}::${c.renderKey ?? 0}`;
161
- m && (l.delete(y), c.alive = !1, await B()), c.renderKey = (c.renderKey ?? 0) + 1;
162
- const w = `${u}::${c.renderKey}`;
163
- m && (l.add(w), c.alive = !0), T.value = u, await B(), b || await B(), T.value = null;
160
+ const h = o.keepAlive && c.alive, y = `${u}::${c.renderKey ?? 0}`;
161
+ h && (i.delete(y), c.alive = !1, await M()), c.renderKey = (c.renderKey ?? 0) + 1;
162
+ const E = `${u}::${c.renderKey}`;
163
+ h && (i.add(E), c.alive = !0), w.value = u, await M(), d || await M(), w.value = null;
164
164
  }
165
165
  async function se(u = !1) {
166
- for (const b of s)
167
- await U(b.id, u);
166
+ for (const d of s)
167
+ await j(d.id, u);
168
168
  }
169
- function R(u, b) {
169
+ function ue(u, d) {
170
170
  const c = s.find((y) => y.id === u);
171
171
  if (!c) return;
172
- const m = `${u}::${c.renderKey ?? 0}`;
173
- b ? (l.add(m), c.alive = !0, we(s, o.maxAlive, a.value, l)) : (l.delete(m), c.alive = !1);
172
+ const h = `${u}::${c.renderKey ?? 0}`;
173
+ d ? (i.add(h), c.alive = !0, oe(s, o.maxAlive, a.value, i)) : (i.delete(h), c.alive = !1);
174
174
  }
175
- function Q(u) {
176
- const b = s.find((m) => m.id === u);
177
- if (!b) return;
178
- const c = `${u}::${b.renderKey ?? 0}`;
179
- l.delete(c), b.alive = !1, b.renderKey = (b.renderKey ?? 0) + 1;
175
+ function R(u) {
176
+ const d = s.find((h) => h.id === u);
177
+ if (!d) return;
178
+ const c = `${u}::${d.renderKey ?? 0}`;
179
+ i.delete(c), d.alive = !1, d.renderKey = (d.renderKey ?? 0) + 1;
180
180
  }
181
- function O() {
182
- l.clear(), s.forEach((u) => {
181
+ function Z() {
182
+ i.clear(), s.forEach((u) => {
183
183
  u.alive = !1;
184
184
  });
185
185
  }
186
- function D() {
187
- return d.value.slice();
186
+ function U() {
187
+ return m.value.slice();
188
188
  }
189
- async function Z(u = o.defaultRoute) {
190
- s.splice(0, s.length), a.value = null, v.value = void 0;
191
- for (const b of o.initialTabs) {
192
- const c = _(e, b.to), m = oe(c, b, o.keepAlive);
193
- s.push(m);
189
+ async function D(u = o.defaultRoute) {
190
+ s.splice(0, s.length), a.value = null, p.value = void 0;
191
+ for (const d of o.initialTabs) {
192
+ const c = _(e, d.to), h = ne(c, d, o.keepAlive);
193
+ s.push(h);
194
194
  }
195
195
  await e.replace(u);
196
196
  }
197
- async function V() {
197
+ async function F() {
198
198
  const u = a.value;
199
- u && await U(u, !0);
199
+ u && await j(u, !0);
200
200
  }
201
- function C(u) {
201
+ function H(u) {
202
202
  return typeof u.matched == "object" ? z(u) : z(_(e, u));
203
203
  }
204
- function ue() {
205
- const u = s.find((b) => b.id === a.value);
204
+ function k() {
205
+ const u = s.find((d) => d.id === a.value);
206
206
  return {
207
207
  tabs: s.map(zt),
208
208
  active: u ? u.to : null
209
209
  };
210
210
  }
211
- async function H(u) {
212
- h = !0, s.splice(0, s.length), a.value = null, v.value = void 0;
213
- const b = u?.tabs ?? [];
214
- for (const m of b)
211
+ async function ce(u) {
212
+ v = !0, s.splice(0, s.length), a.value = null, p.value = void 0;
213
+ const d = u?.tabs ?? [];
214
+ for (const h of d)
215
215
  try {
216
- const y = _(e, m.to), w = Yt(m), I = oe(y, w, o.keepAlive);
217
- Re(s, I, "last", null);
216
+ const y = _(e, h.to), E = Yt(h), C = ne(y, E, o.keepAlive);
217
+ Re(s, C, "last", null);
218
218
  } catch (y) {
219
- console.warn("[RouterTabs] Failed to restore tab", m, y);
219
+ console.warn("[RouterTabs] Failed to restore tab", h, y);
220
220
  }
221
- h = !1;
222
- const c = u?.active ?? b[b.length - 1]?.to ?? o.defaultRoute;
221
+ v = !1;
222
+ const c = u?.active ?? d[d.length - 1]?.to ?? o.defaultRoute;
223
223
  if (c)
224
224
  try {
225
- await e.replace(c);
226
- } catch (m) {
227
- console.warn("[RouterTabs] Failed to navigate to restored route", c, m);
225
+ const h = _(e, c), y = e.currentRoute.value;
226
+ if (h.fullPath === y.fullPath) {
227
+ const E = I(y);
228
+ a.value = E.id, p.value = E, oe(s, o.maxAlive, a.value, i);
229
+ return;
230
+ }
231
+ await e.replace(h);
232
+ } catch (h) {
233
+ console.warn("[RouterTabs] Failed to navigate to restored route", c, h);
228
234
  }
229
235
  }
230
- return A(
236
+ return S(
231
237
  () => e.currentRoute.value,
232
238
  (u) => {
233
- if (h) return;
234
- const b = P(u);
235
- a.value = b.id, v.value = b, we(s, o.maxAlive, a.value, l);
239
+ if (v) return;
240
+ const d = I(u);
241
+ a.value = d.id, p.value = d, oe(s, o.maxAlive, a.value, i);
236
242
  },
237
243
  { immediate: !0 }
238
244
  ), o.initialTabs.length && o.initialTabs.forEach((u) => {
239
- const b = _(e, u.to), c = oe(b, u, o.keepAlive);
245
+ const d = _(e, u.to), c = ne(d, u, o.keepAlive);
240
246
  Re(s, c, "last", null);
241
247
  }), {
242
248
  options: o,
243
249
  tabs: s,
244
250
  activeId: a,
245
- current: v,
246
- includeKeys: d,
247
- refreshingKey: T,
248
- openTab: M,
249
- closeTab: L,
250
- removeTab: F,
251
- refreshTab: U,
251
+ current: p,
252
+ includeKeys: m,
253
+ refreshingKey: w,
254
+ openTab: A,
255
+ closeTab: O,
256
+ removeTab: Y,
257
+ refreshTab: j,
252
258
  refreshAll: se,
253
- setTabAlive: R,
254
- evictCache: Q,
255
- clearCache: O,
256
- getCacheKeys: D,
257
- reset: Z,
258
- reload: V,
259
- getRouteKey: C,
260
- matchRoute: E,
261
- snapshot: ue,
262
- hydrate: H,
263
- ensureTab: P
259
+ setTabAlive: ue,
260
+ evictCache: R,
261
+ clearCache: Z,
262
+ getCacheKeys: U,
263
+ reset: D,
264
+ reload: F,
265
+ getRouteKey: H,
266
+ matchRoute: T,
267
+ snapshot: k,
268
+ hydrate: ce,
269
+ ensureTab: I
264
270
  };
265
271
  }
266
- function Ne(e) {
272
+ function je(e) {
267
273
  return e ? typeof e == "string" ? { name: e } : e : {};
268
274
  }
269
275
  const le = Symbol("RouterTabsContext"), ae = "router-tabs:snapshot";
270
- function _e(e = {}) {
271
- const { optional: r = !1 } = e, o = Le(le, null);
276
+ function Ue(e = {}) {
277
+ const { optional: r = !1 } = e, o = De(le, null);
272
278
  if (o) return o;
273
- const s = Le("$tabs", null);
279
+ const s = De("$tabs", null);
274
280
  if (s) return s;
275
- const v = We()?.appContext.config.globalProperties.$tabs;
276
- if (v) return v;
281
+ const p = Ye()?.appContext.config.globalProperties.$tabs;
282
+ if (p) return p;
277
283
  if (!r)
278
284
  throw new Error("[RouterTabs] useRouterTabs must be used within <router-tab>.");
279
285
  return null;
@@ -287,22 +293,22 @@ function Wt(e) {
287
293
  return decodeURIComponent(s.slice(r.length));
288
294
  return null;
289
295
  }
290
- function ze(e, r, o) {
296
+ function Ve(e, r, o) {
291
297
  if (typeof document > "u") return;
292
298
  const {
293
299
  expiresInDays: s = 7,
294
300
  path: a = "/",
295
- domain: v,
296
- secure: T,
297
- sameSite: l = "lax"
298
- } = o, d = [`${encodeURIComponent(e)}=${encodeURIComponent(r)}`];
301
+ domain: p,
302
+ secure: w,
303
+ sameSite: i = "lax"
304
+ } = o, m = [`${encodeURIComponent(e)}=${encodeURIComponent(r)}`];
299
305
  if (s !== 1 / 0) {
300
- const h = new Date(Date.now() + s * Ht).toUTCString();
301
- d.push(`Expires=${h}`);
306
+ const v = new Date(Date.now() + s * Ht).toUTCString();
307
+ m.push(`Expires=${v}`);
302
308
  }
303
- a && d.push(`Path=${a}`), v && d.push(`Domain=${v}`), T && d.push("Secure"), l && d.push(`SameSite=${l.charAt(0).toUpperCase()}${l.slice(1)}`), document.cookie = d.join("; ");
309
+ a && m.push(`Path=${a}`), p && m.push(`Domain=${p}`), w && m.push("Secure"), i && m.push(`SameSite=${i.charAt(0).toUpperCase()}${i.slice(1)}`), document.cookie = m.join("; ");
304
310
  }
305
- function Ye(e, r) {
311
+ function _e(e, r) {
306
312
  if (typeof document > "u") return;
307
313
  const { path: o = "/", domain: s } = r, a = [`${encodeURIComponent(e)}=`];
308
314
  a.push("Expires=Thu, 01 Jan 1970 00:00:01 GMT"), o && a.push(`Path=${o}`), s && a.push(`Domain=${s}`), document.cookie = a.join("; ");
@@ -315,63 +321,61 @@ const Jt = (e) => JSON.stringify(e ?? null), Gt = (e) => {
315
321
  return null;
316
322
  }
317
323
  };
318
- function Ge(e = {}) {
324
+ function We(e = {}) {
319
325
  const {
320
326
  cookieKey: r = ae,
321
327
  serialize: o = Jt,
322
328
  deserialize: s = Gt
323
- } = e, a = _e({ optional: !0 }), v = S(!0), T = (l) => {
324
- ke(async () => {
325
- const d = s(Wt(r));
326
- if (d && d.tabs?.length)
327
- try {
328
- if (v.value = !0, await l.hydrate(d), d.active) {
329
- await B();
330
- const E = l.tabs.find((P) => P.to === d.active);
331
- E && (l.activeId.value = E.id, l.current.value = E);
329
+ } = e, a = Ue({ optional: !0 }), p = x(!0), w = (i, m = "hook") => {
330
+ const v = async () => {
331
+ p.value = !0;
332
+ try {
333
+ const T = s(Wt(r));
334
+ if (T && T.tabs?.length) {
335
+ if (await i.hydrate(T), T.active) {
336
+ await M();
337
+ const A = i.tabs.find((L) => L.to === T.active);
338
+ A && (i.activeId.value = A.id, i.current.value = A);
332
339
  }
333
- } finally {
334
- v.value = !1;
340
+ } else if (Object.prototype.hasOwnProperty.call(e, "fallbackRoute")) {
341
+ const A = e.fallbackRoute ?? i.options.defaultRoute;
342
+ await i.reset(A);
335
343
  }
336
- else if (Object.prototype.hasOwnProperty.call(e, "fallbackRoute"))
337
- try {
338
- v.value = !0;
339
- const E = e.fallbackRoute ?? l.options.defaultRoute;
340
- await l.reset(E);
341
- } finally {
342
- v.value = !1;
343
- }
344
- else
345
- v.value = !1;
346
- const h = l.snapshot();
347
- h.tabs.length ? ze(r, o(h), e) : Ye(r, e), v.value = !1;
348
- }), A(
344
+ const I = i.snapshot();
345
+ I.tabs.length ? Ve(r, o(I), e) : _e(r, e);
346
+ } finally {
347
+ p.value = !1;
348
+ }
349
+ };
350
+ m === "immediate" ? v() : Ct(() => {
351
+ v();
352
+ }), S(
349
353
  () => ({
350
- tabs: l.tabs.map((d) => ({
351
- to: d.to,
352
- title: d.title,
353
- tips: d.tips,
354
- icon: d.icon,
355
- tabClass: d.tabClass,
356
- closable: d.closable,
357
- renderKey: d.renderKey
354
+ tabs: i.tabs.map((T) => ({
355
+ to: T.to,
356
+ title: T.title,
357
+ tips: T.tips,
358
+ icon: T.icon,
359
+ tabClass: T.tabClass,
360
+ closable: T.closable,
361
+ renderKey: T.renderKey
358
362
  })),
359
- active: l.activeId.value
363
+ active: i.activeId.value
360
364
  }),
361
365
  () => {
362
- if (v.value) return;
363
- const d = l.snapshot();
364
- d.tabs.length ? ze(r, o(d), e) : Ye(r, e);
366
+ if (p.value) return;
367
+ const T = i.snapshot();
368
+ T.tabs.length ? Ve(r, o(T), e) : _e(r, e);
365
369
  },
366
370
  { deep: !0 }
367
371
  );
368
372
  };
369
- a ? T(a) : ke(() => {
370
- const l = _e({ optional: !0 });
371
- l && T(l);
372
- });
373
+ return a ? w(a) : Fe(() => {
374
+ const i = Ue({ optional: !0 });
375
+ i && w(i, "immediate");
376
+ }), { hydrating: p };
373
377
  }
374
- const qt = Ke({
378
+ const qt = Ce({
375
379
  name: "RouterTab",
376
380
  components: { RouterView: Vt },
377
381
  props: {
@@ -426,7 +430,7 @@ const qt = Ke({
426
430
  },
427
431
  emits: ["tab-sort", "tab-sorted"],
428
432
  setup(e, { emit: r }) {
429
- const o = We();
433
+ const o = Ye();
430
434
  if (!o)
431
435
  throw new Error("[RouterTab] component must be used within a Vue application context.");
432
436
  const s = o.appContext.app.config.globalProperties.$router;
@@ -440,32 +444,32 @@ const qt = Ke({
440
444
  appendPosition: e.append,
441
445
  defaultRoute: e.defaultPage
442
446
  });
443
- Et(le, a), o.appContext.config.globalProperties.$tabs = a;
444
- const v = k(() => !!o?.slots?.default), T = k(() => !!o?.slots?.start), l = k(() => !!o?.slots?.end), d = S(0), h = k(() => {
445
- d.value;
447
+ Kt(le, a), o.appContext.config.globalProperties.$tabs = a;
448
+ const p = K(() => !!o?.slots?.default), w = K(() => !!o?.slots?.start), i = K(() => !!o?.slots?.end), m = x(0), v = K(() => {
449
+ m.value;
446
450
  const t = {};
447
451
  return a.tabs.forEach((n) => {
448
- const i = typeof n.title == "string" ? n.title : String(n.title || ce(n));
449
- t[n.id] = i;
452
+ const l = typeof n.title == "string" ? n.title : String(n.title || fe(n));
453
+ t[n.id] = l;
450
454
  }), t;
451
455
  });
452
- function E() {
453
- d.value++;
456
+ function T() {
457
+ m.value++;
454
458
  }
455
- const P = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
456
- function Y(t, n) {
457
- if (!(!n || P.has(t)))
459
+ const I = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
460
+ function L(t, n) {
461
+ if (!(!n || I.has(t)))
458
462
  try {
459
- P.set(t, n);
460
- const i = a.tabs.find((p) => a.getRouteKey(p.to) === t);
461
- if (!i) {
463
+ I.set(t, n);
464
+ const l = a.tabs.find((g) => a.getRouteKey(g.to) === t);
465
+ if (!l) {
462
466
  console.warn(`[RouterTab] Cannot setup watching: tab not found for ${t}`);
463
467
  return;
464
468
  }
465
- const g = [];
469
+ const b = [];
466
470
  if (n.routeTabTitle !== void 0)
467
471
  try {
468
- const p = A(
472
+ const g = S(
469
473
  () => {
470
474
  const f = n.routeTabTitle;
471
475
  return f && typeof f == "object" && "value" in f ? f.value : f;
@@ -473,105 +477,107 @@ const qt = Ke({
473
477
  (f) => {
474
478
  if (f != null) {
475
479
  const N = String(f);
476
- i.title = N, E();
480
+ l.title = N, T();
477
481
  }
478
482
  },
479
483
  { immediate: !0 }
480
484
  );
481
- g.push(p);
482
- } catch (p) {
483
- console.error(`[RouterTab] Error watching routeTabTitle for ${t}:`, p);
485
+ b.push(g);
486
+ } catch (g) {
487
+ console.error(`[RouterTab] Error watching routeTabTitle for ${t}:`, g);
484
488
  }
485
489
  if (n.routeTabIcon !== void 0)
486
490
  try {
487
- const p = A(
491
+ const g = S(
488
492
  () => {
489
493
  const f = n.routeTabIcon;
490
494
  return f && typeof f == "object" && "value" in f ? f.value : f;
491
495
  },
492
496
  (f) => {
493
- f != null && (i.icon = String(f), E());
497
+ f != null && (l.icon = String(f), T());
494
498
  },
495
499
  { immediate: !0 }
496
500
  );
497
- g.push(p);
498
- } catch (p) {
499
- console.error(`[RouterTab] Error watching routeTabIcon for ${t}:`, p);
501
+ b.push(g);
502
+ } catch (g) {
503
+ console.error(`[RouterTab] Error watching routeTabIcon for ${t}:`, g);
500
504
  }
501
505
  if (n.routeTabClosable !== void 0)
502
506
  try {
503
- const p = A(
507
+ const g = S(
504
508
  () => {
505
509
  const f = n.routeTabClosable;
506
510
  return f && typeof f == "object" && "value" in f ? f.value : f;
507
511
  },
508
512
  (f) => {
509
- f != null && (i.closable = !!f, E());
513
+ f != null && (l.closable = !!f, T());
510
514
  },
511
515
  { immediate: !0 }
512
516
  );
513
- g.push(p);
514
- } catch (p) {
515
- console.error(`[RouterTab] Error watching routeTabClosable for ${t}:`, p);
517
+ b.push(g);
518
+ } catch (g) {
519
+ console.error(`[RouterTab] Error watching routeTabClosable for ${t}:`, g);
516
520
  }
517
521
  if (n.routeTabMeta !== void 0)
518
522
  try {
519
- const p = A(
523
+ const g = S(
520
524
  () => {
521
525
  const f = n.routeTabMeta;
522
526
  return f && typeof f == "object" && "value" in f ? f.value : f;
523
527
  },
524
528
  (f) => {
525
- f && typeof f == "object" && (Object.assign(i, f), E());
529
+ f && typeof f == "object" && (Object.assign(l, f), T());
526
530
  },
527
531
  { immediate: !0, deep: !0 }
528
532
  );
529
- g.push(p);
530
- } catch (p) {
531
- console.error(`[RouterTab] Error watching routeTabMeta for ${t}:`, p);
533
+ b.push(g);
534
+ } catch (g) {
535
+ console.error(`[RouterTab] Error watching routeTabMeta for ${t}:`, g);
532
536
  }
533
- M.set(t, g);
534
- } catch (i) {
535
- console.error(`[RouterTab] Error in setupComponentWatching for ${t}:`, i), L(t);
537
+ A.set(t, b);
538
+ } catch (l) {
539
+ console.error(`[RouterTab] Error in setupComponentWatching for ${t}:`, l), O(t);
536
540
  }
537
541
  }
538
- function L(t) {
542
+ function O(t) {
539
543
  try {
540
- const n = M.get(t);
541
- n && (n.forEach((i) => {
544
+ const n = A.get(t);
545
+ n && (n.forEach((l) => {
542
546
  try {
543
- i();
544
- } catch (g) {
545
- console.error(`[RouterTab] Error cleaning up watcher for ${t}:`, g);
547
+ l();
548
+ } catch (b) {
549
+ console.error(`[RouterTab] Error cleaning up watcher for ${t}:`, b);
546
550
  }
547
- }), M.delete(t)), P.delete(t);
551
+ }), A.delete(t)), I.delete(t);
548
552
  } catch (n) {
549
553
  console.error(`[RouterTab] Error in cleanupComponentWatching for ${t}:`, n);
550
554
  }
551
555
  }
552
- function F(t, n) {
556
+ function Y(t, n) {
553
557
  try {
554
- t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? Y(n, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && Y(n, t.$) : t === null && L(n);
555
- } catch (i) {
556
- console.error(`[RouterTab] Error handling component ref for ${n}:`, i), L(n);
558
+ t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? L(n, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && L(n, t.$) : t === null && O(n);
559
+ } catch (l) {
560
+ console.error(`[RouterTab] Error handling component ref for ${n}:`, l), O(n);
557
561
  }
558
562
  }
559
- if ($t((t, n, i) => (console.error("[RouterTab] Error captured from component:", t, i), !1)), e.cookieKey !== null || e.persistence) {
563
+ Et((t, n, l) => (console.error("[RouterTab] Error captured from component:", t, l), !1));
564
+ let j = x(!1);
565
+ if (e.cookieKey !== null || e.persistence) {
560
566
  const t = {
561
567
  ...e.persistence ?? {}
562
568
  };
563
- e.cookieKey !== null ? t.cookieKey = e.cookieKey || ae : t.cookieKey || (t.cookieKey = ae), Ge(t);
569
+ e.cookieKey !== null ? t.cookieKey = e.cookieKey || ae : t.cookieKey || (t.cookieKey = ae), j = We(t).hydrating;
564
570
  }
565
- const U = k(() => Ne(e.tabTransition)), se = k(() => Ne(e.pageTransition)), R = ie({
571
+ const se = K(() => je(e.tabTransition)), ue = K(() => je(e.pageTransition)), R = ie({
566
572
  visible: !1,
567
573
  target: null,
568
574
  position: { x: 0, y: 0 }
569
- }), Q = S(null), O = S([]), D = S(-1), Z = S(null), V = /* @__PURE__ */ new Map(), C = ie({
575
+ }), Z = x(null), U = x([]), D = x(-1), F = x(null), H = /* @__PURE__ */ new Map(), k = ie({
570
576
  dragging: !1,
571
577
  dragIndex: -1,
572
578
  dropIndex: -1,
573
579
  dragTab: null
574
- }), ue = [
580
+ }), ce = [
575
581
  "refresh",
576
582
  "refreshAll",
577
583
  "close",
@@ -579,29 +585,29 @@ const qt = Ke({
579
585
  "closeRights",
580
586
  "closeOthers"
581
587
  ];
582
- function H(t) {
588
+ function u(t) {
583
589
  return a.tabs.findIndex((n) => n.id === t);
584
590
  }
585
- function u(t) {
586
- const n = H(t.id);
591
+ function d(t) {
592
+ const n = u(t.id);
587
593
  return n > 0 ? a.tabs.slice(0, n) : [];
588
594
  }
589
- function b(t) {
590
- const n = H(t.id);
595
+ function c(t) {
596
+ const n = u(t.id);
591
597
  return n > -1 ? a.tabs.slice(n + 1) : [];
592
598
  }
593
- function c(t) {
599
+ function h(t) {
594
600
  return a.tabs.filter((n) => n.id !== t.id);
595
601
  }
596
- async function m(t, n) {
597
- const i = t.filter((g) => g.closable !== !1);
598
- if (i.length) {
599
- for (const g of i)
600
- a.activeId.value === g.id ? await a.closeTab(g.id, { redirect: n.to, force: !0 }) : await a.removeTab(g.id, { force: !0 });
602
+ async function y(t, n) {
603
+ const l = t.filter((b) => b.closable !== !1);
604
+ if (l.length) {
605
+ for (const b of l)
606
+ a.activeId.value === b.id ? await a.closeTab(b.id, { redirect: n.to, force: !0 }) : await a.removeTab(b.id, { force: !0 });
601
607
  a.activeId.value !== n.id && await a.openTab(n.to, !0, !1);
602
608
  }
603
609
  }
604
- const y = {
610
+ const E = {
605
611
  refresh: {
606
612
  label: "Refresh",
607
613
  handler: async ({ target: t }) => {
@@ -619,95 +625,95 @@ const qt = Ke({
619
625
  handler: async ({ target: t }) => {
620
626
  await a.closeTab(t.id);
621
627
  },
622
- enable: ({ target: t }) => de(t)
628
+ enable: ({ target: t }) => be(t)
623
629
  },
624
630
  closeLefts: {
625
631
  label: "Close to the Left",
626
632
  handler: async ({ target: t }) => {
627
- await m(u(t), t);
633
+ await y(d(t), t);
628
634
  },
629
- enable: ({ target: t }) => u(t).some((n) => n.closable !== !1)
635
+ enable: ({ target: t }) => d(t).some((n) => n.closable !== !1)
630
636
  },
631
637
  closeRights: {
632
638
  label: "Close to the Right",
633
639
  handler: async ({ target: t }) => {
634
- await m(b(t), t);
640
+ await y(c(t), t);
635
641
  },
636
- enable: ({ target: t }) => b(t).some((n) => n.closable !== !1)
642
+ enable: ({ target: t }) => c(t).some((n) => n.closable !== !1)
637
643
  },
638
644
  closeOthers: {
639
645
  label: "Close Others",
640
646
  handler: async ({ target: t }) => {
641
- await m(c(t), t);
647
+ await y(h(t), t);
642
648
  },
643
- enable: ({ target: t }) => c(t).some((n) => n.closable !== !1)
649
+ enable: ({ target: t }) => h(t).some((n) => n.closable !== !1)
644
650
  }
645
651
  };
646
- function w() {
647
- R.visible = !1, R.target = null, D.value = -1, O.value = [];
652
+ function C() {
653
+ R.visible = !1, R.target = null, D.value = -1, U.value = [];
648
654
  }
649
- function I(t, n) {
650
- e.contextmenu && (R.target = t, R.position.x = n.clientX, R.position.y = n.clientY, B(() => {
651
- R.visible = !0, document.addEventListener("click", w, { once: !0 }), B(() => {
652
- tt();
655
+ function Qe(t, n) {
656
+ e.contextmenu && (R.target = t, R.position.x = n.clientX, R.position.y = n.clientY, M(() => {
657
+ R.visible = !0, document.addEventListener("click", C, { once: !0 }), M(() => {
658
+ et();
653
659
  });
654
660
  }));
655
661
  }
656
- function et(t, n) {
657
- const i = typeof t == "string" ? { id: t } : t, g = y[i.id], p = i.label ?? g?.label ?? String(i.id), f = i.visible ?? g?.visible ?? !0;
662
+ function Ze(t, n) {
663
+ const l = typeof t == "string" ? { id: t } : t, b = E[l.id], g = l.label ?? b?.label ?? String(l.id), f = l.visible ?? b?.visible ?? !0;
658
664
  if (!(typeof f == "function" ? f(n) : f !== !1)) return null;
659
- const pe = i.enable ?? g?.enable ?? !0, Ct = typeof pe == "function" ? pe(n) : pe !== !1, Me = i.handler ?? g?.handler;
660
- if (!Me) return null;
661
- const kt = async () => {
662
- await Promise.resolve(Me(n));
665
+ const ve = l.enable ?? b?.enable ?? !0, wt = typeof ve == "function" ? ve(n) : ve !== !1, Be = l.handler ?? b?.handler;
666
+ if (!Be) return null;
667
+ const Rt = async () => {
668
+ await Promise.resolve(Be(n));
663
669
  };
664
670
  return {
665
- id: String(i.id),
666
- label: p,
667
- disabled: !Ct,
668
- action: kt
671
+ id: String(l.id),
672
+ label: g,
673
+ disabled: !wt,
674
+ action: Rt
669
675
  };
670
676
  }
671
- const W = k(() => {
677
+ const W = K(() => {
672
678
  if (!R.visible || !R.target || e.contextmenu === !1) return [];
673
- const t = Array.isArray(e.contextmenu) ? e.contextmenu : ue, n = { target: R.target, controller: a };
674
- return t.map((i) => et(i, n)).filter((i) => !!i);
679
+ const t = Array.isArray(e.contextmenu) ? e.contextmenu : ce, n = { target: R.target, controller: a };
680
+ return t.map((l) => Ze(l, n)).filter((l) => !!l);
675
681
  });
676
- function tt() {
677
- const t = Q.value;
682
+ function et() {
683
+ const t = Z.value;
678
684
  if (!t) return;
679
- const n = 8, { innerWidth: i, innerHeight: g } = window, p = t.getBoundingClientRect();
685
+ const n = 8, { innerWidth: l, innerHeight: b } = window, g = t.getBoundingClientRect();
680
686
  let f = R.position.x, N = R.position.y;
681
- p.right > i - n && (f = Math.max(n, i - p.width - n)), p.bottom > g - n && (N = Math.max(n, g - p.height - n)), (f !== R.position.x || N !== R.position.y) && (R.position.x = f, R.position.y = N);
687
+ g.right > l - n && (f = Math.max(n, l - g.width - n)), g.bottom > b - n && (N = Math.max(n, b - g.height - n)), (f !== R.position.x || N !== R.position.y) && (R.position.x = f, R.position.y = N);
682
688
  }
683
- function nt(t, n) {
684
- O.value[n] = t ?? null;
689
+ function tt(t, n) {
690
+ U.value[n] = t ?? null;
685
691
  }
686
- function ot(t) {
692
+ function nt(t) {
687
693
  if (t < 0) return;
688
- O.value[t]?.focus({ preventScroll: !0 });
694
+ U.value[t]?.focus({ preventScroll: !0 });
689
695
  }
690
- function ee(t, n, i = W.value) {
691
- if (!i.length) return -1;
692
- const g = i.length;
693
- let p = t;
694
- for (let f = 0; f < g; f++)
695
- if (p = (p + n + g) % g, !i[p].disabled) return p;
696
+ function ee(t, n, l = W.value) {
697
+ if (!l.length) return -1;
698
+ const b = l.length;
699
+ let g = t;
700
+ for (let f = 0; f < b; f++)
701
+ if (g = (g + n + b) % b, !l[g].disabled) return g;
696
702
  return -1;
697
703
  }
698
704
  function J(t) {
699
- D.value = t, !(t < 0) && B(() => ot(t));
705
+ D.value = t, !(t < 0) && M(() => nt(t));
700
706
  }
701
- function Se(t) {
707
+ function Ae(t) {
702
708
  const n = ee(D.value, t);
703
709
  n !== -1 && J(n);
704
710
  }
705
- function rt(t) {
711
+ function ot(t) {
706
712
  if (!R.visible) return;
707
- const n = t.key, i = W.value;
708
- if (!i.length) return;
713
+ const n = t.key, l = W.value;
714
+ if (!l.length) return;
709
715
  if (n === "Tab") {
710
- w();
716
+ C();
711
717
  return;
712
718
  }
713
719
  if ([
@@ -725,100 +731,97 @@ const qt = Ke({
725
731
  switch (t.preventDefault(), n) {
726
732
  case "ArrowDown":
727
733
  case "ArrowRight":
728
- Se(1);
734
+ Ae(1);
729
735
  break;
730
736
  case "ArrowUp":
731
737
  case "ArrowLeft":
732
- Se(-1);
738
+ Ae(-1);
733
739
  break;
734
740
  case "Home":
735
741
  J(ee(-1, 1));
736
742
  break;
737
743
  case "End":
738
- J(ee(i.length, -1));
744
+ J(ee(l.length, -1));
739
745
  break;
740
746
  case "Enter":
741
747
  case " ":
742
748
  case "Spacebar": {
743
- const p = D.value;
744
- if (p > -1) {
745
- const f = i[p];
746
- f.disabled || Ie(f);
749
+ const g = D.value;
750
+ if (g > -1) {
751
+ const f = l[g];
752
+ f.disabled || Se(f);
747
753
  }
748
754
  break;
749
755
  }
750
756
  case "Escape":
751
- w();
757
+ C();
752
758
  break;
753
759
  }
754
760
  }
755
- async function Ie(t) {
756
- t.disabled || (w(), await t.action());
761
+ async function Se(t) {
762
+ t.disabled || (C(), await t.action());
757
763
  }
758
- function ce(t) {
764
+ function fe(t) {
759
765
  return typeof t.title == "string" && t.title.trim() ? t.title : Array.isArray(t.title) && t.title.length && String(t.title[0]).trim() ? String(t.title[0]) : "Untitled";
760
766
  }
761
- function at(t) {
762
- return h.value[t.id] || ce(t);
767
+ function rt(t) {
768
+ return v.value[t.id] || fe(t);
763
769
  }
764
- function xe(t, n) {
765
- return Ke({
770
+ function Ie(t, n) {
771
+ return Ce({
766
772
  name: n,
767
- setup(i, { attrs: g, slots: p }) {
768
- return () => Pt(t, g, p);
773
+ setup(l, { attrs: b, slots: g }) {
774
+ return () => Pt(t, b, g);
769
775
  }
770
776
  });
771
777
  }
772
- const G = /* @__PURE__ */ new Map(), fe = S(0);
773
- function it(t, n, i) {
774
- G.has(i) || (G.set(i, n), fe.value++), t && F(t, i);
778
+ const G = /* @__PURE__ */ new Map(), de = x(0);
779
+ function at(t, n, l) {
780
+ G.has(l) || (G.set(l, n), de.value++), t && Y(t, l);
775
781
  }
776
- function lt(t, n) {
782
+ function it(t, n) {
777
783
  return t && ((!t.name || t.name !== n) && (t.name = n), t);
778
784
  }
779
- function st(t, n) {
785
+ function lt(t, n) {
780
786
  if (!t) return t;
781
- const i = G.get(n);
782
- if (i) return i;
783
- const g = xe(t, n);
784
- return G.set(n, g), fe.value++, g;
787
+ const l = G.get(n);
788
+ if (l) return l;
789
+ const b = Ie(t, n);
790
+ return G.set(n, b), de.value++, b;
785
791
  }
786
- function ut(t) {
787
- const n = a.getRouteKey(t), i = s.currentRoute.value, g = a.getRouteKey(i);
788
- return n === g;
792
+ function st(t) {
793
+ const n = a.getRouteKey(t), l = s.currentRoute.value, b = a.getRouteKey(l);
794
+ return n === b;
789
795
  }
790
- function De(t) {
791
- const n = a.getRouteKey(t), i = a.tabs.find((f) => f.id === n);
792
- if (!i)
796
+ function ut(t) {
797
+ const n = a.getRouteKey(t), l = a.tabs.find((f) => f.id === n);
798
+ if (!l)
793
799
  return console.warn("[RouterTab] Tab not found for route:", n), `${n}::0`;
794
- const g = i.renderKey ?? 0, p = `${n}::${g}`;
800
+ const b = l.renderKey ?? 0, g = `${n}::${b}`;
795
801
  return (n.includes("students") || n.includes("classroom") || n.includes("quiz")) && console.log(`[getComponentCacheKey] Route: ${t.fullPath}`, {
796
802
  routeKey: n,
797
- renderKey: g,
798
- cacheKey: p,
799
- tabAlive: i.alive,
800
- includeKeys: ge.value,
801
- isIncluded: ge.value.includes(p)
802
- }), p;
803
+ renderKey: b,
804
+ cacheKey: g,
805
+ tabAlive: l.alive,
806
+ includeKeys: pe.value,
807
+ isIncluded: pe.value.includes(g)
808
+ }), g;
803
809
  }
804
- function ct(t) {
805
- return `${De(t)}::refresh`;
806
- }
807
- function de(t) {
810
+ function be(t) {
808
811
  return !(t.closable === !1 || a.options.keepLastTab && a.tabs.length <= 1);
809
812
  }
810
- async function ft(t) {
813
+ async function ct(t) {
811
814
  await a.closeTab(t.id);
812
815
  }
813
- function dt(t, n) {
814
- n ? V.set(t, n) : V.delete(t);
816
+ function ft(t, n) {
817
+ n ? H.set(t, n) : H.delete(t);
815
818
  }
816
- function be(t) {
817
- B(() => {
818
- const n = V.get(t), i = Z.value;
819
- if (n && i) {
820
- const g = n.getBoundingClientRect(), p = i.getBoundingClientRect();
821
- (g.left < p.left || g.right > p.right) && n.scrollIntoView({
819
+ function ge(t) {
820
+ M(() => {
821
+ const n = H.get(t), l = F.value;
822
+ if (n && l) {
823
+ const b = n.getBoundingClientRect(), g = l.getBoundingClientRect();
824
+ (b.left < g.left || b.right > g.right) && n.scrollIntoView({
822
825
  behavior: "smooth",
823
826
  block: "nearest",
824
827
  inline: "nearest"
@@ -826,168 +829,164 @@ const qt = Ke({
826
829
  }
827
830
  });
828
831
  }
829
- function bt(t) {
832
+ function dt(t) {
830
833
  if (t.href && typeof window < "u") {
831
834
  t.target && t.target !== "_self" ? window.open(t.href, t.target) : window.location.assign(t.href);
832
835
  return;
833
836
  }
834
- a.activeId.value !== t.id && (a.openTab(t.to, !1), be(t.id));
837
+ a.activeId.value !== t.id && (a.openTab(t.to, !1), ge(t.id));
835
838
  }
836
- function gt(t) {
839
+ function bt(t) {
837
840
  return [
838
841
  "router-tab__item",
839
842
  {
840
843
  "is-active": a.activeId.value === t.id,
841
- "is-closable": de(t),
842
- "is-dragging": C.dragging && C.dragTab?.id === t.id,
843
- "is-drag-over": C.dropIndex === H(t.id)
844
+ "is-closable": be(t),
845
+ "is-dragging": k.dragging && k.dragTab?.id === t.id,
846
+ "is-drag-over": k.dropIndex === u(t.id)
844
847
  },
845
848
  t.tabClass
846
849
  ];
847
850
  }
848
- function pt(t) {
849
- return a.refreshingKey.value === a.getRouteKey(t);
850
- }
851
- function vt(t) {
852
- const n = a.getRouteKey(t), i = a.tabs.find((g) => g.id === n);
853
- return i ? i.alive : !1;
851
+ function gt(t) {
852
+ const n = a.getRouteKey(t), l = a.tabs.find((b) => b.id === n);
853
+ return l ? l.alive : !1;
854
854
  }
855
- function ht(t) {
855
+ function pt(t) {
856
856
  const n = a.getRouteKey(t);
857
- return !!a.tabs.find((g) => g.id === n);
857
+ return !!a.tabs.find((b) => b.id === n);
858
858
  }
859
- function mt(t, n, i) {
860
- e.sortable && (C.dragging = !0, C.dragIndex = n, C.dragTab = t, i.dataTransfer && (i.dataTransfer.effectAllowed = "move", i.dataTransfer.setData("text/plain", t.id)), r("tab-sort", { tab: t, index: n }));
859
+ function vt(t, n, l) {
860
+ e.sortable && (k.dragging = !0, k.dragIndex = n, k.dragTab = t, l.dataTransfer && (l.dataTransfer.effectAllowed = "move", l.dataTransfer.setData("text/plain", t.id)), r("tab-sort", { tab: t, index: n }));
861
861
  }
862
- function yt(t, n) {
863
- !e.sortable || !C.dragging || (n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = "move"));
862
+ function mt(t, n) {
863
+ !e.sortable || !k.dragging || (n.preventDefault(), n.dataTransfer && (n.dataTransfer.dropEffect = "move"));
864
864
  }
865
- function Tt(t) {
866
- !e.sortable || !C.dragging || (C.dropIndex = t);
865
+ function ht(t) {
866
+ !e.sortable || !k.dragging || (k.dropIndex = t);
867
867
  }
868
- function Rt() {
869
- !e.sortable || C.dragging;
868
+ function yt() {
869
+ !e.sortable || k.dragging;
870
870
  }
871
- function wt(t, n) {
872
- if (!(!e.sortable || !C.dragging)) {
873
- if (n.preventDefault(), C.dragIndex !== -1 && C.dragIndex !== t) {
874
- const i = a.tabs.splice(C.dragIndex, 1)[0];
875
- a.tabs.splice(t, 0, i), r("tab-sorted", {
876
- tab: i,
877
- fromIndex: C.dragIndex,
871
+ function Tt(t, n) {
872
+ if (!(!e.sortable || !k.dragging)) {
873
+ if (n.preventDefault(), k.dragIndex !== -1 && k.dragIndex !== t) {
874
+ const l = a.tabs.splice(k.dragIndex, 1)[0];
875
+ a.tabs.splice(t, 0, l), r("tab-sorted", {
876
+ tab: l,
877
+ fromIndex: k.dragIndex,
878
878
  toIndex: t
879
879
  });
880
880
  }
881
- Be();
881
+ xe();
882
882
  }
883
883
  }
884
- function Be() {
885
- C.dragging = !1, C.dragIndex = -1, C.dropIndex = -1, C.dragTab = null;
884
+ function xe() {
885
+ k.dragging = !1, k.dragIndex = -1, k.dropIndex = -1, k.dragTab = null;
886
886
  }
887
- ke(() => {
888
- document.addEventListener("keydown", w);
889
- }), At(() => {
890
- document.removeEventListener("keydown", w), o.appContext.config.globalProperties.$tabs = null, M.forEach((t) => {
887
+ Fe(() => {
888
+ document.addEventListener("keydown", C);
889
+ }), $t(() => {
890
+ document.removeEventListener("keydown", C), o.appContext.config.globalProperties.$tabs = null, A.forEach((t) => {
891
891
  t.forEach((n) => {
892
892
  try {
893
893
  n();
894
- } catch (i) {
895
- console.error("[RouterTab] Error during cleanup:", i);
894
+ } catch (l) {
895
+ console.error("[RouterTab] Error during cleanup:", l);
896
896
  }
897
897
  });
898
- }), M.clear(), P.clear();
899
- }), A(
898
+ }), A.clear(), I.clear();
899
+ }), S(
900
900
  () => e.keepAlive,
901
901
  (t) => {
902
902
  a.options.keepAlive = t;
903
903
  }
904
- ), A(
904
+ ), S(
905
905
  () => a.activeId.value,
906
906
  (t) => {
907
- t && be(t), w();
907
+ t && ge(t), C();
908
908
  }
909
- ), A(
909
+ ), S(
910
910
  () => a.tabs.length,
911
911
  () => {
912
- const t = new Set(a.tabs.map((i) => i.id));
913
- Array.from(P.keys()).forEach((i) => {
914
- t.has(i) || (console.log(`[RouterTab] Cleaning up stale component instance: ${i}`), L(i));
912
+ const t = new Set(a.tabs.map((l) => l.id));
913
+ Array.from(I.keys()).forEach((l) => {
914
+ t.has(l) || (console.log(`[RouterTab] Cleaning up stale component instance: ${l}`), O(l));
915
915
  });
916
916
  }
917
- ), A(
917
+ ), S(
918
918
  () => e.contextmenu,
919
919
  (t) => {
920
- t || w();
920
+ t || C();
921
921
  }
922
- ), A(
922
+ ), S(
923
923
  () => W.value.length,
924
924
  (t) => {
925
- R.visible && t === 0 && w();
925
+ R.visible && t === 0 && C();
926
926
  },
927
927
  { flush: "post" }
928
928
  // Run after component updates to prevent blocking render
929
- ), A(W, (t) => {
929
+ ), S(W, (t) => {
930
930
  if (!R.visible) return;
931
- O.value = new Array(t.length).fill(null);
931
+ U.value = new Array(t.length).fill(null);
932
932
  const n = ee(-1, 1, t);
933
933
  J(n);
934
- }, { flush: "post" }), A(
934
+ }, { flush: "post" }), S(
935
935
  () => R.visible,
936
936
  (t) => {
937
- t || (D.value = -1, O.value = []);
937
+ t || (D.value = -1, U.value = []);
938
938
  }
939
939
  );
940
- const ge = a.includeKeys;
940
+ const pe = a.includeKeys;
941
941
  return {
942
942
  controller: a,
943
943
  tabs: a.tabs,
944
- includeKeys: ge,
944
+ includeKeys: pe,
945
+ persistenceHydrating: j,
945
946
  componentCache: G,
946
- componentCacheTrigger: fe,
947
- cacheCurrentComponent: it,
948
- tabTransitionProps: U,
949
- pageTransitionProps: se,
950
- buildTabClass: gt,
951
- activate: bt,
952
- close: ft,
947
+ componentCacheTrigger: de,
948
+ cacheCurrentComponent: at,
949
+ tabTransitionProps: se,
950
+ pageTransitionProps: ue,
951
+ buildTabClass: bt,
952
+ activate: dt,
953
+ close: ct,
953
954
  context: R,
954
955
  menuItems: W,
955
- handleMenuAction: Ie,
956
- showContextMenu: I,
957
- hideContextMenu: w,
958
- getTabTitle: ce,
959
- isClosable: de,
960
- isRefreshing: pt,
961
- isTabCached: vt,
962
- isTabReady: ht,
963
- hasCustomSlot: v,
964
- hasStartSlot: T,
965
- hasEndSlot: l,
966
- onDragStart: mt,
967
- onDragOver: yt,
968
- onDragEnter: Tt,
969
- onDragLeave: Rt,
970
- onDrop: wt,
971
- onDragEnd: Be,
972
- setupComponentWatching: Y,
973
- cleanupComponentWatching: L,
974
- handleComponentRef: F,
975
- getReactiveTabTitle: at,
976
- getComponentCacheKey: De,
977
- getRefreshComponentKey: ct,
978
- createNamedComponent: xe,
979
- ensureNamedComponent: lt,
980
- getNamedComponent: st,
981
- shouldRenderRoute: ut,
982
- triggerTabUpdate: E,
983
- menuRef: Q,
956
+ handleMenuAction: Se,
957
+ showContextMenu: Qe,
958
+ hideContextMenu: C,
959
+ getTabTitle: fe,
960
+ isClosable: be,
961
+ isTabCached: gt,
962
+ isTabReady: pt,
963
+ hasCustomSlot: p,
964
+ hasStartSlot: w,
965
+ hasEndSlot: i,
966
+ onDragStart: vt,
967
+ onDragOver: mt,
968
+ onDragEnter: ht,
969
+ onDragLeave: yt,
970
+ onDrop: Tt,
971
+ onDragEnd: xe,
972
+ setupComponentWatching: L,
973
+ cleanupComponentWatching: O,
974
+ handleComponentRef: Y,
975
+ getReactiveTabTitle: rt,
976
+ getComponentCacheKey: ut,
977
+ createNamedComponent: Ie,
978
+ ensureNamedComponent: it,
979
+ getNamedComponent: lt,
980
+ shouldRenderRoute: st,
981
+ triggerTabUpdate: T,
982
+ menuRef: Z,
984
983
  highlightedIndex: D,
985
- setMenuItemRef: nt,
986
- onMenuKeydown: rt,
984
+ setMenuItemRef: tt,
985
+ onMenuKeydown: ot,
987
986
  highlightMenuIndex: J,
988
- scrollContainer: Z,
989
- setTabRef: dt,
990
- scrollTabIntoView: be
987
+ scrollContainer: F,
988
+ setTabRef: ft,
989
+ scrollTabIntoView: ge
991
990
  };
992
991
  }
993
992
  }), Xt = (e, r) => {
@@ -998,86 +997,90 @@ const qt = Ke({
998
997
  }, Qt = { class: "router-tab" }, Zt = { class: "router-tab__header" }, en = {
999
998
  class: "router-tab__scroll",
1000
999
  ref: "scrollContainer"
1001
- }, tn = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], nn = ["title"], on = ["onClick"], rn = { class: "router-tab__container" }, an = ["aria-disabled", "disabled", "tabindex", "onMouseenter", "onClick"];
1002
- function ln(e, r, o, s, a, v) {
1003
- const T = St("RouterView");
1004
- return $(), x("div", Qt, [
1005
- j("header", Zt, [
1006
- j("div", {
1000
+ }, tn = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], nn = ["title"], on = ["onClick"], rn = { class: "router-tab__container" }, an = {
1001
+ key: 1,
1002
+ class: "router-tab__hydrating",
1003
+ "aria-hidden": "true"
1004
+ }, ln = ["aria-disabled", "disabled", "tabindex", "onMouseenter", "onClick"];
1005
+ function sn(e, r, o, s, a, p) {
1006
+ const w = At("RouterView");
1007
+ return $(), B("div", Qt, [
1008
+ V("header", Zt, [
1009
+ V("div", {
1007
1010
  class: q(["router-tab__slot-start", { "has-content": e.hasStartSlot }])
1008
1011
  }, [
1009
- ve(e.$slots, "start")
1012
+ me(e.$slots, "start")
1010
1013
  ], 2),
1011
- j("div", en, [
1012
- Oe(xt, he({
1014
+ V("div", en, [
1015
+ It(xt, he({
1013
1016
  tag: "ul",
1014
1017
  class: "router-tab__nav"
1015
1018
  }, e.tabTransitionProps), {
1016
- default: me(() => [
1017
- ($(!0), x(ye, null, je(e.tabs, (l, d) => ($(), x("li", {
1018
- key: l.id,
1019
- class: q(e.buildTabClass(l)),
1020
- "data-title": e.getTabTitle(l),
1019
+ default: ye(() => [
1020
+ ($(!0), B(Te, null, Me(e.tabs, (i, m) => ($(), B("li", {
1021
+ key: i.id,
1022
+ class: q(e.buildTabClass(i)),
1023
+ "data-title": e.getTabTitle(i),
1021
1024
  draggable: e.sortable,
1022
1025
  ref_for: !0,
1023
- ref: (h) => e.setTabRef(l.id, h),
1024
- onClick: (h) => e.activate(l),
1025
- onAuxclick: Te((h) => e.close(l), ["middle", "prevent"]),
1026
- onContextmenu: Te((h) => e.showContextMenu(l, h), ["prevent"]),
1027
- onDragstart: (h) => e.onDragStart(l, d, h),
1028
- onDragover: (h) => e.onDragOver(d, h),
1029
- onDragenter: (h) => e.onDragEnter(d),
1030
- onDragleave: r[0] || (r[0] = (...h) => e.onDragLeave && e.onDragLeave(...h)),
1031
- onDrop: (h) => e.onDrop(d, h),
1032
- onDragend: r[1] || (r[1] = (...h) => e.onDragEnd && e.onDragEnd(...h))
1026
+ ref: (v) => e.setTabRef(i.id, v),
1027
+ onClick: (v) => e.activate(i),
1028
+ onAuxclick: we((v) => e.close(i), ["middle", "prevent"]),
1029
+ onContextmenu: we((v) => e.showContextMenu(i, v), ["prevent"]),
1030
+ onDragstart: (v) => e.onDragStart(i, m, v),
1031
+ onDragover: (v) => e.onDragOver(m, v),
1032
+ onDragenter: (v) => e.onDragEnter(m),
1033
+ onDragleave: r[0] || (r[0] = (...v) => e.onDragLeave && e.onDragLeave(...v)),
1034
+ onDrop: (v) => e.onDrop(m, v),
1035
+ onDragend: r[1] || (r[1] = (...v) => e.onDragEnd && e.onDragEnd(...v))
1033
1036
  }, [
1034
- l.icon ? ($(), x("i", {
1037
+ i.icon ? ($(), B("i", {
1035
1038
  key: 0,
1036
- class: q(["router-tab__item-icon", l.icon])
1039
+ class: q(["router-tab__item-icon", i.icon])
1037
1040
  }, null, 2)) : te("", !0),
1038
- j("span", {
1041
+ V("span", {
1039
1042
  class: "router-tab__item-title",
1040
- title: e.getReactiveTabTitle(l)
1041
- }, Ue(e.getReactiveTabTitle(l)), 9, nn),
1042
- e.isClosable(l) ? ($(), x("a", {
1043
+ title: e.getReactiveTabTitle(i)
1044
+ }, Le(e.getReactiveTabTitle(i)), 9, nn),
1045
+ e.isClosable(i) ? ($(), B("a", {
1043
1046
  key: 1,
1044
1047
  class: "router-tab__item-close",
1045
- onClick: Te((h) => e.close(l), ["stop"])
1048
+ onClick: we((v) => e.close(i), ["stop"])
1046
1049
  }, null, 8, on)) : te("", !0)
1047
1050
  ], 42, tn))), 128))
1048
1051
  ]),
1049
1052
  _: 1
1050
1053
  }, 16)
1051
1054
  ], 512),
1052
- j("div", {
1055
+ V("div", {
1053
1056
  class: q(["router-tab__slot-end", { "has-content": e.hasEndSlot }])
1054
1057
  }, [
1055
- ve(e.$slots, "end")
1058
+ me(e.$slots, "end")
1056
1059
  ], 2)
1057
1060
  ]),
1058
- j("div", rn, [
1059
- Oe(T, null, {
1060
- default: me(({ Component: l, route: d }) => [
1061
- e.hasCustomSlot ? ve(e.$slots, "default", Dt(he({ key: 0 }, {
1062
- Component: l,
1063
- route: d,
1061
+ V("div", rn, [
1062
+ e.persistenceHydrating ? ($(), B("div", an)) : ($(), X(w, { key: 0 }, {
1063
+ default: ye(({ Component: i, route: m }) => [
1064
+ e.hasCustomSlot ? me(e.$slots, "default", Bt(he({ key: 0 }, {
1065
+ Component: i,
1066
+ route: m,
1064
1067
  controller: e.controller,
1065
- pageRef: (h) => e.handleComponentRef(h, e.controller.getRouteKey(d))
1066
- }))) : ($(), x(ye, { key: 1 }, [
1067
- e.controller.options.keepAlive ? ($(), ne(Bt, {
1068
+ pageRef: (v) => e.handleComponentRef(v, e.controller.getRouteKey(m))
1069
+ }))) : ($(), B(Te, { key: 1 }, [
1070
+ e.controller.options.keepAlive ? ($(), X(Dt, {
1068
1071
  key: 0,
1069
1072
  include: e.includeKeys
1070
1073
  }, [
1071
- l ? ($(), ne(Ve(e.getNamedComponent(l, e.getComponentCacheKey(d))), {
1072
- key: e.isRefreshing(d) ? e.getRefreshComponentKey(d) : e.getComponentCacheKey(d),
1073
- ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(d)),
1074
+ i ? ($(), X(Oe(e.getNamedComponent(i, e.getComponentCacheKey(m))), {
1075
+ key: e.getComponentCacheKey(m),
1076
+ ref: (v) => e.handleComponentRef(v, e.controller.getRouteKey(m)),
1074
1077
  class: "router-tab-page"
1075
1078
  })) : te("", !0)
1076
- ], 1032, ["include"])) : ($(), ne(Mt, he({ key: 1 }, e.pageTransitionProps, { appear: "" }), {
1077
- default: me(() => [
1078
- l ? ($(), ne(Ve(l), {
1079
- key: e.controller.getRouteKey(d),
1080
- ref: (h) => e.handleComponentRef(h, e.controller.getRouteKey(d)),
1079
+ ], 1032, ["include"])) : ($(), X(Mt, he({ key: 1 }, e.pageTransitionProps, { appear: "" }), {
1080
+ default: ye(() => [
1081
+ i ? ($(), X(Oe(i), {
1082
+ key: e.controller.getRouteKey(m),
1083
+ ref: (v) => e.handleComponentRef(v, e.controller.getRouteKey(m)),
1081
1084
  class: "router-tab-page"
1082
1085
  })) : te("", !0)
1083
1086
  ]),
@@ -1086,36 +1089,36 @@ function ln(e, r, o, s, a, v) {
1086
1089
  ], 64))
1087
1090
  ]),
1088
1091
  _: 3
1089
- })
1092
+ }))
1090
1093
  ]),
1091
- It(j("div", {
1094
+ St(V("div", {
1092
1095
  ref: "menuRef",
1093
1096
  class: "router-tab__contextmenu",
1094
1097
  role: "menu",
1095
- onKeydown: r[2] || (r[2] = (...l) => e.onMenuKeydown && e.onMenuKeydown(...l)),
1098
+ onKeydown: r[2] || (r[2] = (...i) => e.onMenuKeydown && e.onMenuKeydown(...i)),
1096
1099
  style: Lt({ left: e.context.position.x + "px", top: e.context.position.y + "px" })
1097
1100
  }, [
1098
- ($(!0), x(ye, null, je(e.menuItems, (l, d) => ($(), x("a", {
1099
- key: l.id,
1101
+ ($(!0), B(Te, null, Me(e.menuItems, (i, m) => ($(), B("a", {
1102
+ key: i.id,
1100
1103
  role: "menuitem",
1101
- class: q(["router-tab__contextmenu-item", { "is-focused": d === e.highlightedIndex }]),
1102
- "aria-disabled": l.disabled,
1103
- disabled: l.disabled,
1104
- tabindex: l.disabled ? -1 : d === e.highlightedIndex ? 0 : -1,
1104
+ class: q(["router-tab__contextmenu-item", { "is-focused": m === e.highlightedIndex }]),
1105
+ "aria-disabled": i.disabled,
1106
+ disabled: i.disabled,
1107
+ tabindex: i.disabled ? -1 : m === e.highlightedIndex ? 0 : -1,
1105
1108
  ref_for: !0,
1106
- ref: (h) => e.setMenuItemRef(h, d),
1107
- onMouseenter: (h) => !l.disabled && e.highlightMenuIndex(d),
1108
- onClick: (h) => e.handleMenuAction(l)
1109
- }, Ue(l.label), 43, an))), 128))
1109
+ ref: (v) => e.setMenuItemRef(v, m),
1110
+ onMouseenter: (v) => !i.disabled && e.highlightMenuIndex(m),
1111
+ onClick: (v) => e.handleMenuAction(i)
1112
+ }, Le(i.label), 43, ln))), 128))
1110
1113
  ], 36), [
1111
1114
  [Ot, e.context.visible && e.context.target]
1112
1115
  ])
1113
1116
  ]);
1114
1117
  }
1115
- const Fe = /* @__PURE__ */ Xt(qt, [["render", ln]]), sn = {
1118
+ const Ne = /* @__PURE__ */ Xt(qt, [["render", sn]]), un = {
1116
1119
  class: "router-tabs",
1117
1120
  "aria-hidden": "true"
1118
- }, Ce = /* @__PURE__ */ Ke({
1121
+ }, ke = /* @__PURE__ */ Ce({
1119
1122
  name: "RouterTabs",
1120
1123
  __name: "RouterTabs",
1121
1124
  props: {
@@ -1130,11 +1133,11 @@ const Fe = /* @__PURE__ */ Xt(qt, [["render", ln]]), sn = {
1130
1133
  fallbackRoute: {}
1131
1134
  },
1132
1135
  setup(e) {
1133
- return Ge(e), (o, s) => ($(), x("span", sn));
1136
+ return We(e), (o, s) => ($(), B("span", un));
1134
1137
  }
1135
- }), qe = "tab-theme-style", Xe = "tab-theme-primary-color", un = "system", Qe = "(prefers-color-scheme: dark)";
1136
- let X = null;
1137
- const K = {
1138
+ }), Je = "tab-theme-style", Ge = "tab-theme-primary-color", cn = "system", qe = "(prefers-color-scheme: dark)";
1139
+ let Q = null;
1140
+ const P = {
1138
1141
  primary: "#034960",
1139
1142
  background: "#ffffff",
1140
1143
  text: "#1e293b",
@@ -1148,7 +1151,7 @@ const K = {
1148
1151
  activeButtonBackground: "#034960",
1149
1152
  activeButtonColor: "#ffffff",
1150
1153
  iconColor: "#475569"
1151
- }, cn = {
1154
+ }, fn = {
1152
1155
  primary: "#38bdf8",
1153
1156
  background: "#0f172a",
1154
1157
  text: "#f1f5f9",
@@ -1164,7 +1167,7 @@ const K = {
1164
1167
  activeButtonColor: "#0f172a",
1165
1168
  iconColor: "#cbd5e1"
1166
1169
  };
1167
- function fn(e) {
1170
+ function dn(e) {
1168
1171
  if (typeof window > "u") return null;
1169
1172
  const r = window.localStorage.getItem(e);
1170
1173
  if (!r) return null;
@@ -1175,42 +1178,42 @@ function fn(e) {
1175
1178
  return null;
1176
1179
  }
1177
1180
  }
1178
- function Ae(e) {
1179
- typeof document > "u" || (document.documentElement.style.setProperty("--router-tab-primary", e.primary ?? K.primary), document.documentElement.style.setProperty("--router-tab-header-bg", e.headerBackground ?? K.headerBackground), document.documentElement.style.setProperty("--router-tab-background", e.background ?? K.background), document.documentElement.style.setProperty("--router-tab-active-background", e.activeBackground ?? K.activeBackground), document.documentElement.style.setProperty("--router-tab-text", e.text ?? K.text), document.documentElement.style.setProperty("--router-tab-active-text", e.activeText ?? K.activeText), document.documentElement.style.setProperty("--router-tab-border", e.border ?? K.border), document.documentElement.style.setProperty("--router-tab-active-border", e.activeBorder ?? K.activeBorder), document.documentElement.style.setProperty("--router-tab-button-color", e.buttonColor ?? K.buttonColor), document.documentElement.style.setProperty("--router-tab-active-button-color", e.activeButtonColor ?? K.activeButtonColor), document.documentElement.style.setProperty("--router-tab-button-background", e.buttonBackground ?? K.buttonBackground), document.documentElement.style.setProperty("--router-tab-active-button-background", e.activeButtonBackground ?? K.activeButtonBackground), document.documentElement.style.setProperty("--router-tab-icon-color", e.iconColor ?? K.iconColor));
1181
+ function $e(e) {
1182
+ typeof document > "u" || (document.documentElement.style.setProperty("--router-tab-primary", e.primary ?? P.primary), document.documentElement.style.setProperty("--router-tab-header-bg", e.headerBackground ?? P.headerBackground), document.documentElement.style.setProperty("--router-tab-background", e.background ?? P.background), document.documentElement.style.setProperty("--router-tab-active-background", e.activeBackground ?? P.activeBackground), document.documentElement.style.setProperty("--router-tab-text", e.text ?? P.text), document.documentElement.style.setProperty("--router-tab-active-text", e.activeText ?? P.activeText), document.documentElement.style.setProperty("--router-tab-border", e.border ?? P.border), document.documentElement.style.setProperty("--router-tab-active-border", e.activeBorder ?? P.activeBorder), document.documentElement.style.setProperty("--router-tab-button-color", e.buttonColor ?? P.buttonColor), document.documentElement.style.setProperty("--router-tab-active-button-color", e.activeButtonColor ?? P.activeButtonColor), document.documentElement.style.setProperty("--router-tab-button-background", e.buttonBackground ?? P.buttonBackground), document.documentElement.style.setProperty("--router-tab-active-button-background", e.activeButtonBackground ?? P.activeButtonBackground), document.documentElement.style.setProperty("--router-tab-icon-color", e.iconColor ?? P.iconColor));
1180
1183
  }
1181
- function Ze(e) {
1184
+ function Xe(e) {
1182
1185
  if (typeof document > "u") return;
1183
- const r = document.documentElement, o = window.matchMedia(Qe), s = () => {
1186
+ const r = document.documentElement, o = window.matchMedia(qe), s = () => {
1184
1187
  r.dataset.theme = o.matches ? "dark" : "light";
1185
1188
  };
1186
- X && (o.removeEventListener("change", X), X = null), e === "system" ? (s(), X = () => s(), o.addEventListener("change", X)) : r.dataset.theme = e;
1189
+ Q && (o.removeEventListener("change", Q), Q = null), e === "system" ? (s(), Q = () => s(), o.addEventListener("change", Q)) : r.dataset.theme = e;
1187
1190
  }
1188
- function dn(e = {}) {
1191
+ function bn(e = {}) {
1189
1192
  if (typeof window > "u") return;
1190
1193
  const {
1191
- styleKey: r = qe,
1192
- primaryKey: o = Xe,
1193
- defaultStyle: s = un,
1194
+ styleKey: r = Je,
1195
+ primaryKey: o = Ge,
1196
+ defaultStyle: s = cn,
1194
1197
  defaultPrimary: a
1195
- } = e, v = window.localStorage.getItem(r) ?? s;
1196
- Ze(v);
1197
- const l = v === "dark" || v === "system" && window.matchMedia(Qe).matches ? { ...cn } : { ...K };
1198
- a && (l.primary = a);
1199
- const d = fn(o);
1200
- Ae(d ? {
1201
- ...l,
1202
- ...d
1203
- } : l);
1198
+ } = e, p = window.localStorage.getItem(r) ?? s;
1199
+ Xe(p);
1200
+ const i = p === "dark" || p === "system" && window.matchMedia(qe).matches ? { ...fn } : { ...P };
1201
+ a && (i.primary = a);
1202
+ const m = dn(o);
1203
+ $e(m ? {
1204
+ ...i,
1205
+ ...m
1206
+ } : i);
1204
1207
  }
1205
- function pn(e, r) {
1208
+ function vn(e, r) {
1206
1209
  if (typeof window > "u") return;
1207
- const o = r?.styleKey ?? qe;
1208
- window.localStorage.setItem(o, e), Ze(e);
1210
+ const o = r?.styleKey ?? Je;
1211
+ window.localStorage.setItem(o, e), Xe(e);
1209
1212
  }
1210
- function vn(e, r) {
1213
+ function mn(e, r) {
1211
1214
  if (typeof window > "u") return;
1212
- const o = r?.primaryKey ?? Xe;
1213
- window.localStorage.setItem(o, JSON.stringify(e)), Ae(e);
1215
+ const o = r?.primaryKey ?? Ge;
1216
+ window.localStorage.setItem(o, JSON.stringify(e)), $e(e);
1214
1217
  }
1215
1218
  function re(e, r) {
1216
1219
  if (jt(e)) {
@@ -1225,11 +1228,11 @@ function re(e, r) {
1225
1228
  }
1226
1229
  if (typeof e == "function")
1227
1230
  return {
1228
- value: k(e),
1231
+ value: K(e),
1229
1232
  update: () => {
1230
1233
  }
1231
1234
  };
1232
- const o = S(
1235
+ const o = x(
1233
1236
  e === void 0 ? r : e
1234
1237
  );
1235
1238
  return {
@@ -1254,18 +1257,18 @@ function Pe(e = {}) {
1254
1257
  }
1255
1258
  function hn(e, r = "Page") {
1256
1259
  return Pe({
1257
- title: k(() => e.value ? "Loading..." : r),
1258
- icon: k(() => e.value ? "mdi-loading mdi-spin" : "mdi-page"),
1259
- closable: k(() => !e.value)
1260
+ title: K(() => e.value ? "Loading..." : r),
1261
+ icon: K(() => e.value ? "mdi-loading mdi-spin" : "mdi-page"),
1262
+ closable: K(() => !e.value)
1260
1263
  });
1261
1264
  }
1262
- function mn(e, r = "Page", o = "mdi-page") {
1265
+ function yn(e, r = "Page", o = "mdi-page") {
1263
1266
  return Pe({
1264
- title: k(() => e.value > 0 ? `${r} (${e.value})` : r),
1265
- icon: k(() => e.value > 0 ? "mdi-bell-badge" : o)
1267
+ title: K(() => e.value > 0 ? `${r} (${e.value})` : r),
1268
+ icon: K(() => e.value > 0 ? "mdi-bell-badge" : o)
1266
1269
  });
1267
1270
  }
1268
- function yn(e, r = "Page") {
1271
+ function Tn(e, r = "Page") {
1269
1272
  const o = {
1270
1273
  normal: { suffix: "", icon: "mdi-page" },
1271
1274
  loading: { suffix: " - Loading", icon: "mdi-loading mdi-spin" },
@@ -1273,46 +1276,46 @@ function yn(e, r = "Page") {
1273
1276
  success: { suffix: " - Success", icon: "mdi-check-circle" }
1274
1277
  };
1275
1278
  return Pe({
1276
- title: k(() => r + o[e.value].suffix),
1277
- icon: k(() => o[e.value].icon),
1278
- closable: k(() => e.value !== "loading")
1279
+ title: K(() => r + o[e.value].suffix),
1280
+ icon: K(() => o[e.value].icon),
1281
+ closable: K(() => e.value !== "loading")
1279
1282
  });
1280
1283
  }
1281
- let He = !1;
1282
- const Tn = {
1284
+ let ze = !1;
1285
+ const wn = {
1283
1286
  install(e, r) {
1284
- if (He) return;
1285
- He = !0;
1287
+ if (ze) return;
1288
+ ze = !0;
1286
1289
  const {
1287
1290
  initTheme: o = !0,
1288
1291
  themeOptions: s,
1289
- componentName: a = Fe.name || "RouterTab",
1290
- tabsComponentName: v = Ce.name || "RouterTabs"
1292
+ componentName: a = Ne.name || "RouterTab",
1293
+ tabsComponentName: p = ke.name || "RouterTabs"
1291
1294
  } = r ?? {};
1292
- o && dn(s ?? {}), e.component(a, Fe), e.component(v, Ce), v.toLowerCase() !== "router-tabs" && e.component("router-tabs", Ce), Object.defineProperty(e.config.globalProperties, "$tabs", {
1295
+ o && bn(s ?? {}), e.component(a, Ne), e.component(p, ke), p.toLowerCase() !== "router-tabs" && e.component("router-tabs", ke), Object.defineProperty(e.config.globalProperties, "$tabs", {
1293
1296
  configurable: !0,
1294
1297
  enumerable: !1,
1295
1298
  get() {
1296
1299
  return e._context.provides[le];
1297
1300
  },
1298
- set(T) {
1299
- T && e.provide(le, T);
1301
+ set(w) {
1302
+ w && e.provide(le, w);
1300
1303
  }
1301
1304
  });
1302
1305
  }
1303
1306
  };
1304
1307
  export {
1305
- Fe as RouterTab,
1306
- Ce as RouterTabs,
1307
- Tn as default,
1308
- dn as initRouterTabsTheme,
1308
+ Ne as RouterTab,
1309
+ ke as RouterTabs,
1310
+ wn as default,
1311
+ bn as initRouterTabsTheme,
1309
1312
  le as routerTabsKey,
1310
- vn as setRouterTabsPrimary,
1311
- pn as setRouterTabsTheme,
1313
+ mn as setRouterTabsPrimary,
1314
+ vn as setRouterTabsTheme,
1312
1315
  hn as useLoadingTab,
1313
- mn as useNotificationTab,
1316
+ yn as useNotificationTab,
1314
1317
  Pe as useReactiveTab,
1315
- _e as useRouterTabs,
1316
- Ge as useRouterTabsPersistence,
1317
- yn as useStatusTab
1318
+ Ue as useRouterTabs,
1319
+ We as useRouterTabsPersistence,
1320
+ Tn as useStatusTab
1318
1321
  };