vue3-router-tab 1.3.5 → 1.3.6

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