vue-stack-tabs 1.1.0 → 1.3.1

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.
Files changed (115) hide show
  1. package/README.en.md +526 -0
  2. package/README.md +141 -39
  3. package/README.ru.md +526 -0
  4. package/dist/iframe-bridge.d.ts +8 -0
  5. package/dist/iframe-bridge.html +77 -0
  6. package/dist/iframe-bridge.mjs +20 -0
  7. package/dist/iframe-child.html +19 -6
  8. package/dist/nuxt/favicon.svg +10 -0
  9. package/dist/nuxt/iframe-bridge.html +77 -0
  10. package/dist/nuxt/iframe-child.html +88 -0
  11. package/dist/nuxt/module.d.ts +6 -0
  12. package/dist/nuxt/module.mjs +28 -0
  13. package/dist/nuxt/plugin.mjs +9 -0
  14. package/dist/nuxt/runtime/plugin.d.ts +2 -0
  15. package/dist/nuxt/runtime/plugin.mjs +9 -0
  16. package/dist/src/lib/StackTabs.vue.d.ts +30 -16
  17. package/dist/src/lib/components/ContextMenu/ContextMenuItem.vue.d.ts +7 -1
  18. package/dist/src/lib/components/ContextMenu/index.vue.d.ts +5 -4
  19. package/dist/src/lib/components/PageLoading.vue.d.ts +2 -1
  20. package/dist/src/lib/components/StackKeepAlive/StackCacheRenderer.vue.d.ts +25 -0
  21. package/dist/src/lib/components/StackKeepAlive/StackKeepAlive.vue.d.ts +12 -0
  22. package/dist/src/lib/components/TabHeader/TabHeaderButton.vue.d.ts +11 -12
  23. package/dist/src/lib/components/TabHeader/TabHeaderItem.vue.d.ts +5 -4
  24. package/dist/src/lib/components/TabHeader/TabHeaderScroll.vue.d.ts +8 -22
  25. package/dist/src/lib/components/TabHeader/index.vue.d.ts +11 -164
  26. package/dist/src/lib/hooks/stackTabsContext.d.ts +49 -0
  27. package/dist/src/lib/hooks/tabPanel/evict.d.ts +21 -61
  28. package/dist/src/lib/hooks/tabPanel/navigationTransaction.d.ts +35 -0
  29. package/dist/src/lib/hooks/tabPanel/refresh.d.ts +17 -0
  30. package/dist/src/lib/hooks/tabPanel/scroll.d.ts +8 -8
  31. package/dist/src/lib/hooks/tabPanel/session.d.ts +9 -8
  32. package/dist/src/lib/hooks/tabPanel/state.d.ts +20 -72
  33. package/dist/src/lib/hooks/useIframeManager.d.ts +35 -0
  34. package/dist/src/lib/hooks/useTabActions.d.ts +5 -46
  35. package/dist/src/lib/hooks/useTabEventBus.d.ts +22 -9
  36. package/dist/src/lib/hooks/useTabPanel.d.ts +14 -73
  37. package/dist/src/lib/i18n/index.d.ts +6 -4
  38. package/dist/src/lib/i18n/lang/en.d.ts +5 -0
  39. package/dist/src/lib/i18n/lang/zh-CN.d.ts +5 -0
  40. package/dist/src/lib/i18n/stackTabsLocale.d.ts +2 -0
  41. package/dist/src/lib/iframe-bridge.d.ts +8 -0
  42. package/dist/src/lib/iframe.vue.d.ts +2 -1
  43. package/dist/src/lib/index.d.ts +4 -5
  44. package/dist/src/lib/model/TabModel.d.ts +11 -40
  45. package/dist/src/lib/nuxt/module.d.ts +6 -0
  46. package/dist/src/lib/nuxt/runtime/plugin.client.d.ts +2 -0
  47. package/dist/src/lib/nuxt/runtime/plugin.d.ts +2 -0
  48. package/dist/src/lib/utils/iframeBridge.d.ts +11 -3
  49. package/dist/src/lib/utils/stackTabsA11y.d.ts +8 -0
  50. package/dist/src/lib/utils/stackTabsMessage.d.ts +7 -0
  51. package/dist/src/lib/utils/tabInfoEncoder.d.ts +0 -15
  52. package/dist/src/lib/utils/typeGuards.d.ts +2 -0
  53. package/dist/src/lib/utils/urlParser.d.ts +24 -3
  54. package/dist/src/lib/versionLogger.d.ts +1 -0
  55. package/dist/style.css +2 -1
  56. package/dist/utils/iframeBridge.d.ts +39 -0
  57. package/dist/vue-stack-tabs.css +2 -1
  58. package/dist/vue-stack-tabs.es.js +1 -2220
  59. package/package.json +71 -50
  60. package/src/lib/StackTabs.vue +223 -196
  61. package/src/lib/assets/style/stackTab.scss +110 -13
  62. package/src/lib/components/ContextMenu/ContextMenuItem.vue +23 -11
  63. package/src/lib/components/ContextMenu/index.vue +94 -10
  64. package/src/lib/components/PageLoading.vue +9 -7
  65. package/src/lib/components/StackKeepAlive/StackCacheRenderer.vue +70 -0
  66. package/src/lib/components/StackKeepAlive/StackKeepAlive.vue +57 -0
  67. package/src/lib/components/TabHeader/TabHeaderButton.vue +19 -8
  68. package/src/lib/components/TabHeader/TabHeaderItem.vue +74 -17
  69. package/src/lib/components/TabHeader/TabHeaderScroll.vue +47 -25
  70. package/src/lib/components/TabHeader/index.vue +181 -13
  71. package/src/lib/hooks/stackTabsContext.ts +135 -0
  72. package/src/lib/hooks/tabPanel/evict.ts +122 -87
  73. package/src/lib/hooks/tabPanel/navigationTransaction.ts +61 -0
  74. package/src/lib/hooks/tabPanel/refresh.ts +109 -0
  75. package/src/lib/hooks/tabPanel/scroll.ts +57 -40
  76. package/src/lib/hooks/tabPanel/session.ts +84 -22
  77. package/src/lib/hooks/tabPanel/state.ts +41 -44
  78. package/src/lib/hooks/useIframeManager.ts +253 -0
  79. package/src/lib/hooks/useTabActions.ts +64 -30
  80. package/src/lib/hooks/useTabEventBus.ts +29 -19
  81. package/src/lib/hooks/useTabLoading.ts +3 -2
  82. package/src/lib/hooks/useTabPanel.tsx +290 -313
  83. package/src/lib/hooks/useTabRouter.ts +111 -97
  84. package/src/lib/i18n/index.ts +53 -45
  85. package/src/lib/i18n/lang/en.ts +6 -1
  86. package/src/lib/i18n/lang/zh-CN.ts +6 -1
  87. package/src/lib/i18n/stackTabsLocale.ts +8 -0
  88. package/src/lib/iframe-bridge.ts +12 -0
  89. package/src/lib/index.ts +14 -19
  90. package/src/lib/model/TabModel.ts +27 -82
  91. package/src/lib/nuxt/module.d.ts +4 -0
  92. package/src/lib/nuxt/module.ts +8 -3
  93. package/src/lib/nuxt/runtime/plugin.client.ts +1 -0
  94. package/src/lib/nuxt/runtime/plugin.ts +11 -0
  95. package/src/lib/utils/iframeBridge.ts +29 -5
  96. package/src/lib/utils/scrollUtils.ts +9 -4
  97. package/src/lib/utils/stackTabsA11y.ts +12 -0
  98. package/src/lib/utils/stackTabsMessage.ts +99 -0
  99. package/src/lib/utils/tabInfoEncoder.ts +70 -21
  100. package/src/lib/utils/typeGuards.ts +3 -0
  101. package/src/lib/utils/urlParser.ts +144 -14
  102. package/src/lib/versionLogger.ts +7 -19
  103. package/dist/src/lib/hooks/tabPanel/evict.spec.d.ts +0 -1
  104. package/dist/src/lib/hooks/useTabPanel.spec.d.ts +0 -1
  105. package/dist/src/lib/model/TabModel.spec.d.ts +0 -1
  106. package/dist/src/lib/utils/iframeBridge.spec.d.ts +0 -1
  107. package/dist/src/lib/utils/tabInfoEncoder.spec.d.ts +0 -1
  108. package/dist/src/lib/utils/urlParser.spec.d.ts +0 -1
  109. package/dist/vue-stack-tabs.umd.js +0 -1
  110. package/src/lib/hooks/tabPanel/evict.spec.ts +0 -85
  111. package/src/lib/hooks/useTabPanel.spec.ts +0 -34
  112. package/src/lib/model/TabModel.spec.ts +0 -40
  113. package/src/lib/utils/iframeBridge.spec.ts +0 -37
  114. package/src/lib/utils/tabInfoEncoder.spec.ts +0 -32
  115. package/src/lib/utils/urlParser.spec.ts +0 -45
@@ -1,10 +1,70 @@
1
1
  /**
2
- * 判断是否为不可嵌入 iframe 的协议
2
+ * URL 解析与安全校验工具。
3
+ *
4
+ * 提供标签 URL 的安全检查(防止 javascript: 等危险 scheme)、
5
+ * 跨域判断、query 参数克隆与比较、保留参数过滤等功能。
6
+ */
7
+ import type { LocationQueryRaw } from 'vue-router'
8
+
9
+ const ALLOWED_ABOUT_URLS = new Set(['about:blank'])
10
+ const STACK_TABS_RESERVED_QUERY_KEYS = new Set(['__tab', '__src'])
11
+
12
+ const hasUnsafeUrlCharacter = (value: string): boolean => {
13
+ for (const char of value) {
14
+ const code = char.charCodeAt(0)
15
+ const isControl = code <= 31 || code === 127 || (code >= 128 && code <= 159)
16
+ const isZeroWidth =
17
+ code === 0x200b || code === 0x200c || code === 0x200d || code === 0x2060 || code === 0xfeff
18
+ const isBidiControl = (code >= 0x202a && code <= 0x202e) || (code >= 0x2066 && code <= 0x2069)
19
+ if (isControl || isZeroWidth || isBidiControl) return true
20
+ }
21
+ return false
22
+ }
23
+ const getUrlBase = (): string => {
24
+ if (typeof window !== 'undefined') return window.location.origin
25
+ return 'http://localhost'
26
+ }
27
+
28
+ /**
29
+ * 判断标签 URL 是否允许进入 iframe/window.open/router 等 URL sink。
30
+ * 允许相对路径、http(s) URL 与 about:blank;拒绝其它 scheme。
31
+ */
32
+ export function isAllowedTabUrl(url: string): boolean {
33
+ const value = url.trim()
34
+ if (!value) return true
35
+ if (hasUnsafeUrlCharacter(value)) return false
36
+ if (ALLOWED_ABOUT_URLS.has(value.toLowerCase())) return true
37
+ if (value.toLowerCase().startsWith('about:')) return false
38
+
39
+ try {
40
+ const parsed = new URL(value, getUrlBase())
41
+ return parsed.protocol === 'http:' || parsed.protocol === 'https:'
42
+ } catch {
43
+ return false
44
+ }
45
+ }
46
+
47
+ /**
48
+ * 判断是否为不允许嵌入 iframe 的 URL
3
49
  * @param url - 待检查的 URL 字符串
4
- * @returns javascript:、data: 等返回 true
50
+ * @returns 非 allowlist URL 返回 true
5
51
  */
6
52
  export function isInvalidIframeUrl(url: string): boolean {
7
- return !!(url && /^(javascript|data):/i.test(url))
53
+ return !isAllowedTabUrl(url)
54
+ }
55
+
56
+ /** 非法 URL 降级为 about:blank,避免进入 iframe/window.open 等 URL sink */
57
+ export function toSafeTabUrl(url: string): string {
58
+ return isAllowedTabUrl(url) ? url : 'about:blank'
59
+ }
60
+
61
+ export function decodeSafeTabUrl(encodedUrl: unknown): string {
62
+ if (typeof encodedUrl !== 'string') return 'about:blank'
63
+ try {
64
+ return toSafeTabUrl(decodeURIComponent(encodedUrl))
65
+ } catch {
66
+ return 'about:blank'
67
+ }
8
68
  }
9
69
 
10
70
  /**
@@ -26,17 +86,87 @@ export function isCrossOriginUrl(url: string): boolean {
26
86
  * 解析 URL 字符串为 path 和 query
27
87
  * @param uri 完整 URL 或 path?query 字符串
28
88
  */
29
- export function parseUrl(uri: string): { path: string; query: Record<string, string> } {
30
- const [pathPart, queryPart] = uri.split('?')
31
- if (!queryPart) {
32
- return { path: pathPart ?? '', query: {} }
33
- }
34
- const query: Record<string, string> = {}
35
- for (const pair of queryPart.split('&')) {
36
- const [key, val] = pair.split('=')
37
- if (key != null && val != null && val !== '') {
38
- query[key] = val
89
+ export function parseUrl(uri: string): { path: string; query: LocationQueryRaw } {
90
+ const [pathPart = '', queryPart] = uri.split('?')
91
+ if (queryPart === undefined) {
92
+ return { path: pathPart, query: {} }
93
+ }
94
+
95
+ const params = new URLSearchParams(queryPart)
96
+ const query: LocationQueryRaw = {}
97
+ for (const [key, value] of params.entries()) {
98
+ const existing = query[key]
99
+ if (existing === undefined) {
100
+ query[key] = value
101
+ continue
102
+ }
103
+ query[key] = Array.isArray(existing) ? [...existing, value] : [existing, value]
104
+ }
105
+ return { path: pathPart, query }
106
+ }
107
+
108
+ /** 浅克隆 LocationQueryRaw,避免引用共享导致的副作用 */
109
+ export function cloneLocationQuery(query: LocationQueryRaw = {}): LocationQueryRaw {
110
+ const cloned: LocationQueryRaw = {}
111
+ for (const [key, value] of Object.entries(query)) {
112
+ cloned[key] = Array.isArray(value) ? [...value] : value
113
+ }
114
+ return cloned
115
+ }
116
+
117
+ export interface CloneablePage {
118
+ query?: LocationQueryRaw
119
+ _backParams?: Record<string, unknown>
120
+ }
121
+
122
+ /** 深克隆页面对象的 query 和 _backParams,防止跨页面引用污染 */
123
+ export function clonePage<T extends CloneablePage>(page: T): T {
124
+ return {
125
+ ...page,
126
+ query: page.query ? cloneLocationQuery(page.query) : undefined,
127
+ _backParams: page._backParams ? { ...page._backParams } : undefined
128
+ }
129
+ }
130
+
131
+ /** 忽略 __tab/__src/_back 等内部保留 key 后比较两个 query 是否等价 */
132
+ export function isSameQueryIgnoringReserved(
133
+ a: LocationQueryRaw = {},
134
+ b: LocationQueryRaw = {}
135
+ ): boolean {
136
+ const clean = (q: LocationQueryRaw): Record<string, string | string[]> => {
137
+ const result: Record<string, string | string[]> = {}
138
+ for (const [key, value] of Object.entries(q)) {
139
+ if (STACK_TABS_RESERVED_QUERY_KEYS.has(key) || key === '_back') continue
140
+ result[key] = Array.isArray(value) ? value.map((item) => String(item ?? '')) : String(value ?? '')
141
+ }
142
+ return result
143
+ }
144
+ const ca = clean(a)
145
+ const cb = clean(b)
146
+ const keysA = Object.keys(ca)
147
+ const keysB = Object.keys(cb)
148
+ if (keysA.length !== keysB.length) return false
149
+ return keysA.every((key) => {
150
+ const aValue = ca[key]
151
+ const bValue = cb[key]
152
+ if (Array.isArray(aValue) || Array.isArray(bValue)) {
153
+ return (
154
+ Array.isArray(aValue) &&
155
+ Array.isArray(bValue) &&
156
+ aValue.length === bValue.length &&
157
+ aValue.every((value, index) => value === bValue[index])
158
+ )
39
159
  }
160
+ return aValue === bValue
161
+ })
162
+ }
163
+
164
+ /** 移除 query 中的 vue-stack-tabs 保留参数(__tab、__src),返回干净的 query */
165
+ export function omitStackTabsReservedQuery(query: LocationQueryRaw = {}): LocationQueryRaw {
166
+ const sanitized: LocationQueryRaw = {}
167
+ for (const [key, value] of Object.entries(query)) {
168
+ if (STACK_TABS_RESERVED_QUERY_KEYS.has(key)) continue
169
+ sanitized[key] = Array.isArray(value) ? [...value] : value
40
170
  }
41
- return { path: pathPart ?? '', query }
171
+ return sanitized
42
172
  }
@@ -1,24 +1,12 @@
1
- import { encode } from 'js-base64'
2
-
1
+ /** 在浏览器控制台输出带样式的库版本标识 */
3
2
  const logVersion = (version: string) => {
4
- const height = 100
5
- const width = 580
6
- const xml = `<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1167.06 237.75"><path d="M79.24,19.73h108.91v29.7h-108.91v-29.7Z" style="fill:#79a7ff; stroke-width:0px;"/><path d="M179.24,199.67H20.26c-11.21-.07-20.26-9.17-20.26-20.38V20.39C0,9.18,9.05.07,20.26,0h59.49c3.51.07,6.34,2.9,6.41,6.42v44.36c0,3.54-2.87,6.41-6.41,6.41s-6.41-2.86-6.42-6.4V12.36H20.25c-4.13.07-7.44,3.44-7.44,7.56v159.41c0,4.13,3.31,7.49,7.44,7.56h158.98c4.13-.07,7.44-3.44,7.44-7.56V51.84c0-3.54,2.87-6.41,6.41-6.42,3.55,0,6.42,2.87,6.42,6.42v127.45c0,11.21-9.05,20.32-20.26,20.39h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M192.8,60.77c-3.66-.07-6.61-3.02-6.68-6.68v-18.23c.09-4.29-3.32-7.83-7.6-7.92h-96.43c-3.69,0-6.69-2.99-6.69-6.69s2.99-6.69,6.69-6.69h96.27c11.69.08,21.13,9.58,21.13,21.27v18.25c0,3.69-2.99,6.68-6.68,6.68h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M193.08,58.67H10.15c-3.61-.08-6.48-3.07-6.41-6.68-.08-3.62,2.79-6.61,6.4-6.69,0,0,0,0,0,0h182.93c3.62.08,6.48,3.08,6.41,6.69.07,3.61-2.79,6.6-6.41,6.68h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M137.2,58.67c-3.42.24-6.4-2.32-6.68-5.74v-28.15c.55-3.69,4-6.24,7.69-5.69,2.94.44,5.24,2.75,5.69,5.69v28.15c-.28,3.42-3.26,5.98-6.68,5.74h-.02Z" style="fill:#377dff; stroke-width:0px;"/><path d="M99.78,100.48l-12.83-22.22h-18.39l31.22,54.05,31.22-54.05h-18.39l-12.83,22.22Z" style="fill:#00d797; stroke-width:0px;"/><path d="M135.28,78.26l-35.49,61.43-35.44-61.43h-20.11l55.55,96.2,55.55-96.2s-20.06,0-20.06,0ZM313.33,59.95c0,.52-.67,1.84-2,3.95s-3.3,5.2-5.9,9.28-5.75,9.28-9.46,15.61c-3.7,6.33-7.52,13.34-11.45,21.04-4.51,8.85-7.76,15.8-9.76,20.86s-2.99,9.41-2.99,13.05c0,2.89,1.53,5.44,4.6,7.63,3.7-2.89,7.34-6.33,10.93-10.32,3.58-3.99,7.13-8.44,10.63-13.36s7.55-11.13,12.14-18.65c4.6-7.52,8.69-14.43,12.27-20.73-.17-.52-.36-1.04-.56-1.56s-.3-.95-.3-1.3c0-2.72.55-5.26,1.65-7.63,1.1-2.37,2.47-4.68,4.12-6.94s4.12-5.44,7.42-9.54c.87-1.1,1.94-1.65,3.21-1.65,2.08,0,3.12,1.33,3.12,3.99s-1.08,6.84-3.25,12.53c-2.17,5.7-5.37,12.39-9.59,20.08s-9.47,16.29-15.74,25.81c-6.28,9.51-13.37,19.45-21.3,29.8-8.04,10.47-13.79,15.7-17.26,15.7-1.97,0-4.19-1.08-6.68-3.25s-4.63-5.13-6.42-8.89-2.69-7.78-2.69-12.06c0-2.54.53-5.81,1.6-9.8s2.75-8.78,5.03-14.36,4.87-11.09,7.76-16.53c3.01-5.72,5.65-10.47,7.94-14.23,2.28-3.76,4.87-7.94,7.76-12.53,2.89-4.6,4.34-7.1,4.34-7.5,0-.87-.58-1.3-1.73-1.3-3.35,0-7.82,1.71-13.4,5.12s-12.85,8.59-21.82,15.53c-3.41,2.66-5.57,4.38-6.46,5.16s-1.34,1.43-1.34,1.95c0,.69.55,1.04,1.65,1.04.46,0,2.02-.17,4.68-.52s4.77-.52,6.33-.52c2.6,0,3.9.46,3.9,1.39,0,.81-.54,1.45-1.61,1.91-1.07.46-2.54.93-4.42,1.39s-4.44,1.1-7.68,1.91c-3.47.93-7.16,2.25-11.06,3.99-3.9,1.73-6.14,2.6-6.72,2.6-1.1,0-1.78-.4-2.04-1.21s-.39-2.14-.39-3.99c0-8.21,1.36-14.56,4.08-19.04s7.58-9.15,14.57-14.01c7.98-5.55,15.61-10.16,22.9-13.84,7.29-3.67,13.58-6.36,18.87-8.07s9.18-2.56,11.67-2.56,4.84,1.56,7.24,4.68,3.6,6.42,3.6,9.89h0ZM366.34,124.75c-8.39,11.1-14.76,19-19.13,23.68s-7.94,7.03-10.71,7.03c-2.2,0-4.22-.91-6.07-2.73-1.85-1.82-3.28-4.28-4.29-7.37s-1.52-6.4-1.52-9.93c0-2.31.22-4.39.65-6.25.43-1.85,1.26-3.89,2.47-6.12s2.82-4.64,4.81-7.24c2-2.6,4.44-5.55,7.33-8.85,1.73-2.02,3.19-3.73,4.38-5.12,1.18-1.39,2.34-2.33,3.47-2.82s2.96-.74,5.51-.74c1.85,0,3.61.25,5.29.74,1.68.49,2.52,1,2.52,1.52,0,1.04-.85,2.92-2.56,5.64s-4.45,6.03-8.24,9.93c-3.79,3.9-8.17,7.74-13.14,11.49-1.1,3.41-1.65,6.01-1.65,7.81,0,2.49.95,3.73,2.86,3.73.69,0,1.85-.59,3.47-1.78,1.62-1.18,4.35-3.47,8.2-6.85,3.84-3.38,7.3-6.38,10.37-8.98,2.25-1.97,4.87-4.9,7.85-8.8s5.39-6.84,7.24-8.8c4.28-4.51,7.2-7.44,8.76-8.8s3.06-2.04,4.51-2.04,2.33.43,2.82,1.3c.49.87.74,2.63.74,5.29,0,1.21-.12,2.2-.35,2.95s-.71,1.72-1.43,2.91-2.18,3.37-4.38,6.55-4.8,6.94-7.81,11.28c-1.66,2.38-3.09,4.93-4.25,7.59-1.21,2.75-1.82,4.81-1.82,6.2,0,3.01,1.18,4.51,3.56,4.51,1.96,0,4.25-.81,6.85-2.43s6.59-4.54,11.97-8.76v5.81c-6.77,6.25-11.77,10.79-15.01,13.62s-6.04,4.97-8.41,6.42-4.63,2.17-6.77,2.17c-4.86,0-7.29-2.89-7.29-8.67,0-2.2.72-5.16,2.17-8.89,1.44-3.73,3.79-9.12,7.03-16.18v-.02Z" style="fill:#306fff; stroke-width:0px;"/><path d="M407.71,133.77v2.17c0,3.41.84,6.07,2.52,7.98,1.68,1.91,3.87,2.86,6.59,2.86s5.77-.66,8.8-2c3.04-1.33,6.06-3.09,9.07-5.29s6.68-5.15,11.02-8.85v5.29c-6.54,7.87-12.67,13.89-18.39,18.09-5.72,4.19-11.54,6.29-17.44,6.29-5.15,0-9.22-2-12.23-5.99s-4.51-9.46-4.51-16.39c0-6.07,1.42-11.58,4.25-16.52s7.46-10.16,13.88-15.66c4.39-3.76,8.76-6.59,13.1-8.5s8.21-2.86,11.62-2.86c2.72,0,4.87.62,6.46,1.86s2.39,3.11,2.39,5.59c0,3.64-1.36,7.27-4.08,10.89s-6.87,7.2-12.45,10.76c-5.58,3.56-12.45,6.98-20.6,10.28h0ZM408.58,128.13c5.2-2.02,9.66-4.54,13.36-7.55,3.7-3.01,6.43-5.88,8.2-8.63,1.76-2.75,2.65-4.76,2.65-6.03s-.61-2-1.82-2c-1.04,0-2.73.67-5.07,2s-4.71,3.07-7.11,5.21-4.55,4.66-6.46,7.55c-1.9,2.86-3.17,6.08-3.73,9.46h-.02ZM585.37,132.9c-1.45-2.66-3.61-5.06-6.51-7.2-2.89-2.14-6.15-3.86-9.76-5.16s-7.39-2.27-11.32-2.91c-11.68-1.74-22.58-5.52-32.7-11.36-.87-.46-1.79-1.44-2.78-2.95-.98-1.5-1.47-2.95-1.47-4.34,0-5.09.85-10.19,2.56-15.31,1.71-5.12,3.89-9.12,6.55-12.01,4.28-4.8,11.98-8.99,23.12-12.58,11.13-3.58,23.67-5.38,37.6-5.38,8.33,0,14.76.64,19.3,1.91s6.81,3.24,6.81,5.9c0,4.34-.59,7.69-1.78,10.06s-2.46,3.95-3.82,4.73c-1.36.78-3.75,1.84-7.16,3.17-3.64,1.27-6.81,2.6-9.5,3.99s-4.99,2.72-6.9,3.99c-1.91,1.27-3.09,1.91-3.56,1.91-.58,0-.87-.23-.87-.69,0-.98,1.03-2.47,3.08-4.47s4.58-3.74,7.59-5.25c3.18-1.68,4.77-2.75,4.77-3.21,0-.75-1.76-1.13-5.29-1.13-10.7,0-20.59.95-29.67,2.86s-16.24,4.42-21.47,7.55c-5.23,3.12-7.85,6.3-7.85,9.54,0,2.02,1.08,3.46,3.25,4.29,2.17.84,6.95,2.24,14.36,4.21,7.4,1.97,14.02,4.22,19.86,6.77,8.38,3.59,14.6,7.32,18.65,11.19,4.05,3.88,6.07,8.21,6.07,13.01,0,3.3-.8,6.61-2.39,9.93-1.59,3.33-3.92,6.38-6.98,9.15-3.07,2.78-6.59,5.06-10.58,6.85-3.41,1.45-7.71,2.8-12.88,4.08-5.18,1.27-10.79,2.27-16.83,2.99-6.04.72-11.81,1.08-17.31,1.08-10.12,0-18.26-.95-24.42-2.86s-9.24-4.8-9.24-8.67c0-1.74,1.04-4.44,3.12-8.11s4.54-6.14,7.37-7.42c2.49-.98,4.89-1.55,7.2-1.69,2.31-.14,3.47.13,3.47.82,0,.17-.09.35-.26.52s-.38.32-.61.43c-.23.12-.46.23-.69.35-1.16.46-2.1.82-2.82,1.08-.72.26-1.3.52-1.74.78-.43.26-.65.62-.65,1.08,0,1.21,5.99,1.82,17.96,1.82,10.41,0,18.94-.38,25.59-1.13s12.52-2.11,17.61-4.08c5.09-1.97,9.71-4.68,13.88-8.15l.04.02ZM640.8,85.63h3.73c3.06-5.49,5.84-9.38,8.33-11.67,2.49-2.28,5.32-3.43,8.5-3.43s4.77.72,4.77,2.17c0,.69-1.24,2.57-3.73,5.64s-4.37,5.64-5.64,7.72c1.96.23,3.71.43,5.25.61,1.53.17,2.73.32,3.6.43-3.3,6.13-7.43,12.4-12.4,18.82l-4.08-.3c-1.1-.09-2.21-.17-3.34-.26s-2.5-.19-4.12-.3c-3.12,5.03-5.74,9.53-7.85,13.49s-3.73,7.59-4.86,10.89-1.69,6.42-1.69,9.37c0,3.99,1.59,5.99,4.77,5.99,2.2,0,5.07-1.17,8.63-3.51s8.31-5.94,14.27-10.8v5.81c-15.61,16.95-27.15,25.42-34.61,25.42-2.6,0-4.7-1.01-6.29-3.04-1.59-2.02-2.38-4.63-2.38-7.81,0-2.14.45-4.68,1.34-7.63.9-2.95,2.5-7.4,4.81-13.36-.81.69-1.58,1.37-2.3,2.04s-1.39,1.27-2,1.82-1.26,1.13-1.95,1.73c-.69.61-1.39,1.23-2.08,1.87v-5.99c6.07-5.09,13.42-14.02,22.03-26.8-.87-.06-1.68-.1-2.43-.13s-1.65-.04-2.69-.04c-3.41,0-5.96.23-7.63.69-.69.17-1.34.36-1.95.56s-1.03.3-1.26.3-.35-.17-.35-.52c0-1.91,1.18-4.77,3.56-8.59,1.91-3.24,3.72-5.64,5.42-7.2,1.71-1.56,3.79-2.62,6.25-3.17,2.46-.55,5.91-.82,10.37-.82h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M664.91,115.12c8.79-7.98,17.32-13.91,25.59-17.78s14.66-5.81,19.17-5.81c1.21,0,2.34.51,3.38,1.52,1.04,1,1.88,2.19,2.47,3.51.61,1.33.91,2.31.91,2.95,0,1.04-.41,1.81-1.21,2.3-.81.49-2.23,1.08-4.25,1.78.4.93.92,2.11,1.56,3.56s1.13,2.62,1.47,3.51c.35.9.52,1.69.52,2.39,0,1.39-1.4,3.98-4.21,7.76-2.81,3.79-4.77,6.58-5.9,8.37-1.13,1.79-1.69,3.99-1.69,6.59,0,4.28,1.96,6.42,5.9,6.42s10.38-3.79,19-11.36v5.29c-14.63,16.25-25.1,24.38-31.4,24.38-2.26,0-3.86-.74-4.81-2.21s-1.43-3.66-1.43-6.55c0-4.57,1.65-11.19,4.94-19.86-8.44,9.37-14.72,16.03-18.82,20-4.11,3.96-7.49,5.94-10.15,5.94-1.27,0-2.86-1.1-4.77-3.3-1.91-2.2-3.6-5.04-5.07-8.54-1.47-3.5-2.21-7.13-2.21-10.89,0-2.72.26-4.99.78-6.81s1.53-3.69,3.04-5.59c1.5-1.91,3.9-4.42,7.2-7.55v-.02ZM706.46,105.58c-15.04,6.88-25.75,12.72-32.14,17.52s-9.59,9.75-9.59,14.83c0,1.85.32,3.37.95,4.55.64,1.19,1.5,1.78,2.6,1.78.64,0,1.76-.4,3.38-1.21,6.07-3.58,11.62-8.25,16.66-14.01,5.03-5.75,11.07-13.58,18.13-23.46h.01Z" style="fill:#306fff; stroke-width:0px;"/><path d="M779.07,130.82v5.81c-6.19,6.07-11.23,10.79-15.14,14.14-3.9,3.35-7.55,5.96-10.93,7.81-3.38,1.85-6.69,2.78-9.93,2.78s-6.1-1.26-8.76-3.77c-2.66-2.52-4.74-5.81-6.25-9.89-1.5-4.08-2.26-8.4-2.26-12.97,0-3.93.87-7.43,2.6-10.5,1.74-3.07,5.09-7.03,10.06-11.88,5.9-5.78,11.38-10.25,16.44-13.4s9.04-4.73,11.93-4.73c2.08,0,3.85.72,5.29,2.17s2.17,3.27,2.17,5.46c0,1.85-.95,4.48-2.86,7.89-1.91,3.41-4.05,6.38-6.42,8.89-2.37,2.52-4.25,3.77-5.64,3.77-1.5,0-2.25-.81-2.25-2.43.06-.46.1-.9.13-1.3s.04-.81.04-1.21c0-.69-.25-1.08-.74-1.17s-1.08.13-1.78.65c-5.78,4.05-9.75,6.9-11.88,8.54-2.14,1.65-3.83,3.31-5.07,4.99s-1.87,3.44-1.87,5.29c0,3.41,1.1,6.19,3.3,8.33s5.06,3.21,8.59,3.21,8.02-1.4,13.14-4.21c5.12-2.8,11.15-6.9,18.09-12.27h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M844.13,130.65v5.81c-6.48,7.58-11.91,13.32-16.31,17.22s-8.07,5.86-11.02,5.86-5.39-.84-7.68-2.52c-2.29-1.68-4.34-3.99-6.16-6.94-1.82-2.95-3.98-7.05-6.46-12.32-2.95,3.64-5.61,7.04-7.98,10.19-2.37,3.15-4.02,5.25-4.94,6.29-.93,1.04-1.77,1.56-2.52,1.56-1.56,0-2.69-1-3.38-2.99-.69-2-1.04-4.9-1.04-8.72,0-5.21.62-10.22,1.87-15.05,1.24-4.83,3.04-9.53,5.38-14.1s5.35-9.5,9.02-14.79c3.67-5.29,7.79-10.83,12.36-16.61,6.3-7.98,11.74-14.5,16.31-19.56,4.57-5.06,8.54-8.88,11.93-11.45,3.38-2.57,6.2-3.86,8.46-3.86,2.78,0,4.16,1.24,4.16,3.73,0,2.14-5.12,9.85-15.35,23.12-10.24,13.27-25.16,31.39-44.76,54.35v7.46c13.13-14.05,23.69-24.49,31.71-31.31,8.01-6.82,14.21-10.24,18.61-10.24,1.79,0,3.18,1.06,4.16,3.17s1.47,4.55,1.47,7.33c0,5.67-2.43,10.92-7.29,15.74-4.86,4.83-12.32,10.37-22.38,16.61,1.74,2.6,3.27,4.5,4.6,5.68,1.33,1.19,3.01,1.78,5.03,1.78,1.79,0,3.73-.61,5.81-1.82s4.21-2.75,6.38-4.6,5.51-4.86,10.02-9.02h-.01ZM809.86,135.07c2.2-1.45,4.93-3.69,8.2-6.72,3.27-3.04,6.06-6.19,8.37-9.46s3.47-6,3.47-8.2c0-.92-.41-1.39-1.21-1.39-2.2,0-5.97,2.11-11.32,6.33-5.35,4.22-10.57,9.63-15.66,16.22,2.2,0,4.92,1.07,8.15,3.21h0ZM951.78,140.71l2.86,2.17c-.75,1.62-1.47,3.04-2.17,4.25-.69,1.21-1.53,2.69-2.52,4.42-.98,1.73-1.73,3.04-2.25,3.9-4.34,7.58-8.41,11.36-12.23,11.36-1.62,0-3.01-.64-4.16-1.91-1.16-1.27-1.73-3.01-1.73-5.2,0-3.12,1.11-7.4,3.34-12.84,2.23-5.43,5.67-12.13,10.32-20.08s10.51-16.96,17.57-27.02c7.05-10.06,15.01-20.67,23.85-31.84-5.09-.75-11.13-1.13-18.13-1.13-8.04,0-16.99.9-26.85,2.69s-18.45,3.86-25.76,6.2c-7.32,2.34-10.97,4.06-10.97,5.16,0,.41.14.68.43.82.29.15.77.26,1.43.35s1.52.19,2.56.3c6.77.93,10.15,1.97,10.15,3.12,0,.58-1.47.85-4.42.82s-6.51-.04-10.67-.04c-3.3,0-5.68-.13-7.16-.39s-2.46-.75-2.95-1.47-.74-1.84-.74-3.34c0-.98.29-3.12.87-6.42,1.1-6.13,2.79-11.04,5.07-14.75,2.28-3.7,5.78-6.72,10.5-9.06,4.71-2.34,11.2-4.21,19.47-5.59,13.88-2.37,25.36-3.56,34.44-3.56,6.71,0,12,.27,15.88.82,3.87.55,6.72,1.34,8.54,2.39,1.82,1.04,2.98,2.07,3.47,3.08s1.14,2.76,1.95,5.25l2.69,7.98c.17.52.32.94.43,1.26.12.32.22.65.3,1,.09.35.13.67.13.95,0,2.26-.51,4.28-1.52,6.07s-2.86,4.48-5.55,8.07-4.67,6.39-5.94,8.41c-14.92,24.23-25.1,42.16-30.53,53.78v.02ZM991.94,115.12c8.79-7.98,17.32-13.91,25.59-17.78s14.66-5.81,19.17-5.81c1.21,0,2.34.51,3.38,1.52,1.04,1,1.88,2.19,2.47,3.51.61,1.33.91,2.31.91,2.95,0,1.04-.41,1.81-1.21,2.3-.81.49-2.23,1.08-4.25,1.78.4.93.92,2.11,1.56,3.56s1.13,2.62,1.47,3.51c.35.9.52,1.69.52,2.39,0,1.39-1.4,3.98-4.21,7.76-2.81,3.79-4.77,6.58-5.9,8.37-1.13,1.79-1.69,3.99-1.69,6.59,0,4.28,1.96,6.42,5.9,6.42s10.38-3.79,19-11.36v5.29c-14.63,16.25-25.1,24.38-31.4,24.38-2.26,0-3.86-.74-4.81-2.21s-1.43-3.66-1.43-6.55c0-4.57,1.65-11.19,4.94-19.86-8.44,9.37-14.72,16.03-18.82,20-4.11,3.96-7.49,5.94-10.15,5.94-1.27,0-2.86-1.1-4.77-3.3-1.91-2.2-3.6-5.04-5.07-8.54-1.47-3.5-2.21-7.13-2.21-10.89,0-2.72.26-4.99.78-6.81s1.53-3.69,3.04-5.59c1.5-1.91,3.9-4.42,7.2-7.55v-.02ZM1033.49,105.58c-15.04,6.88-25.75,12.72-32.14,17.52s-9.59,9.75-9.59,14.83c0,1.85.32,3.37.95,4.55.64,1.19,1.5,1.78,2.6,1.78.64,0,1.76-.4,3.38-1.21,6.07-3.58,11.62-8.25,16.66-14.01,5.03-5.75,11.07-13.58,18.13-23.46h.01Z" style="fill:#306fff; stroke-width:0px;"/><path d="M1111.3,130.82v5.64c-6.02,3.82-10.76,5.72-14.23,5.72-1.91,0-3.93-.32-6.07-.95-5.2,6.59-9.67,11.42-13.4,14.49s-7.47,4.6-11.23,4.6c-4.34,0-7.68-2.29-10.02-6.85-2.34-4.57-3.51-10.24-3.51-17,0-9.2,2.78-19.21,8.33-30.06,5.56-10.85,12.29-21.07,20.08-30.45,7.84-9.46,15.43-17.28,22.77-23.46,7.34-6.19,12.32-9.28,14.92-9.28s3.73,1.71,3.73,5.12c0,15.15-19.43,41.58-58.29,79.29-.12,1.04-.17,3.09-.17,6.16,0,7.98,2.14,11.97,6.42,11.97,1.68,0,3.37-.68,5.07-2.04,1.71-1.36,4.32-3.95,7.85-7.76-1.39-3.12-2.08-5.44-2.08-6.94,0-3.18,1.3-6.62,3.9-10.32s5.57-6.9,8.89-9.59c3.33-2.69,5.74-4.03,7.24-4.03,2.37,0,3.56,1.71,3.56,5.12,0,2.6-.68,5.72-2.04,9.37-1.36,3.64-3.34,7.81-5.94,12.49.98.81,1.76,1.4,2.34,1.78s1.45.56,2.6.56c2.66,0,5.75-1.18,9.28-3.56v-.02ZM1067.24,117.81c3.01-2.6,6.03-5.68,9.06-9.24s7.47-9.01,13.32-16.35c5.61-7.05,10.02-12.94,13.23-17.65s5.62-8.63,7.24-11.75c1.62-3.12,2.43-5.26,2.43-6.42,0-.87-.23-1.3-.69-1.3-1.27,0-3.92,2.1-7.94,6.29-4.02,4.19-8.6,9.93-13.75,17.22-7.11,10.06-12.26,17.64-15.44,22.73-3.18,5.09-5.67,10.58-7.46,16.48h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M1110.96,133.08v-2.08c14.92-15.73,25.18-26.75,30.79-33.05,1.27-7.11,4.34-10.67,9.19-10.67,1.21,0,2.52.35,3.9,1.04l.52,1.65c-.23.69-.35,1.68-.35,2.95,0,1.1.42,3.14,1.26,6.12s1.49,5.48,1.95,7.5.69,4.31.69,6.85c0,3.82-.87,7.48-2.6,10.97-1.73,3.5-4.25,6.85-7.55,10.06-3.3,3.21-7.55,6.49-12.75,9.85,2.08.35,3.73.52,4.94.52,2.37,0,4.93-.59,7.68-1.78,2.75-1.18,5.55-2.78,8.41-4.77,2.86-2,6.2-4.58,10.02-7.76v5.81c-7.4,7.23-14.02,12.71-19.86,16.44s-10.87,5.59-15.09,5.59c-5.44,0-10.47-2.31-15.09-6.94-2.72-2.78-4.41-5.43-5.08-7.98-.67-2.54-1-5.99-1-10.32h.02ZM1143.31,119.8l-1.56-12.66c-3.59,4.05-11.25,11.83-22.99,23.33,3.47.75,5.84,1.76,7.11,3.04,1.27,1.27,3.06,3.73,5.38,7.37,3.93-1.62,6.95-3.83,9.07-6.64,2.11-2.8,3.17-6.64,3.17-11.49,0-.58-.01-1.1-.04-1.56s-.07-.92-.13-1.39h0Z" style="fill:#306fff; stroke-width:0px;"/><g style="isolation:isolate;"><text transform="translate(943.45 229.96)" style="fill:#00d797; font-family:ArialMT, Arial; font-size:24px; isolation:isolate;"><tspan x="0" y="0">version: ${version}</tspan></text></g></svg>`
7
- const svg64 = encode(xml)
8
- const b64Start = 'data:image/svg+xml;base64,'
9
- const image64 = b64Start + svg64
10
- const style =
11
- 'font-size: 1px; padding: ' +
12
- Math.floor(height / 4) +
13
- 'px ' +
14
- Math.floor(width / 2) +
15
- 'px; line-height: ' +
16
- Math.floor(height / 2) +
17
- 'px;'
3
+ if (typeof window === 'undefined') return
4
+
18
5
  window.console.log(
19
- '%c' + '+',
20
- style +
21
- `background-image: url(${image64});background-size: ${width}px ${height}px;background-repeat: norepeat; color: transparent;`
6
+ '%c vue-stack-tabs %c v' + version + ' %c',
7
+ 'background:#306fff; padding:2px 8px; border-radius:3px 0 0 3px; color:#fff;',
8
+ 'background:#00d797; padding:2px 8px; border-radius:0 3px 3px 0; color:#fff;',
9
+ 'background:transparent'
22
10
  )
23
11
  }
24
12
 
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- (function(N,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],n):(N=typeof globalThis<"u"?globalThis:N||self,n(N["vue-stack-tabs"]={},N.Vue,N.vueRouter))})(this,(function(N,n,ke){"use strict";const Pt=Object.freeze(Object.defineProperty({__proto__:null,default:{VueStackTab:{close:"close",closeLeft:"close left",closeRight:"close right",closeOthers:"close others",closeAll:"close all",reload:"reload",reloadAll:"reload all",maximum:"maximum",restore:"restore",undefined:"undefined",loading:"loading",openInNewWindow:"Open in new window"}}},Symbol.toStringTag,{value:"Module"})),Vt=Object.freeze(Object.defineProperty({__proto__:null,default:{VueStackTab:{close:"关闭",closeLeft:"关闭左侧",closeRight:"关闭右侧",closeOthers:"关闭其他",closeAll:"关闭所有",reload:"刷新",reloadAll:"刷新所有",maximum:"最大化",restore:"还原",undefined:"未命名",loading:"加载中",openInNewWindow:"在新窗口打开"}}},Symbol.toStringTag,{value:"Module"}));const Dt=["__proto__","prototype","constructor"];function Wt(e){const t=typeof e;return e!==null&&(t==="object"||t==="function")}function $t(e){return!(Array.isArray(e)?e.length:Object.keys(e).length)}function qt(e){return!e.some(t=>Dt.indexOf(t)!==-1)}function Ft(e){const t=e.split("."),o=[];for(let r=0;r<t.length;r++){let s=t[r];for(;s[s.length-1]==="\\"&&t[r+1]!==void 0;)s=s.slice(0,-1)+".",s+=t[++r];o.push(s)}return qt(o)?o:[]}function Ze(e,t){if(!Wt(e))return"";const o=Ft(t);if(o.length===0)return"";let r=Object.assign({},e);for(let s=0;s<o.length;s++){if(typeof r[o[s]]=="string")return r[o[s]];if(r=r[o[s]],r==null){if(s!==o.length-1)return"";break}}return""}function Ut(e,t){if(Array.isArray(t)){const o={},r=[...e.matchAll(/{(.+?)}/g)];return r&&r.forEach((s,c)=>{t[c]&&(o[s[1]]=t[c])}),o}return t}function Gt(e,t){for(const o in t)e=e.replace(`{${o}}`,String(t[o]));return e}function Xe(e,t){return Object.keys(t).forEach(o=>{t[o]instanceof Object&&o in e&&(t[o]={...t[o],...Xe(e[o],t[o])})}),{...e||{},...t}}const jt=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",Ke=(e=>jt?Symbol(e):"_vt_"+e)("i18n");function he(){return n.inject(Ke)}function Ht(e){const t=Object.assign({locale:"en",fallbackLocale:"en",messages:{}},e),o=n.ref(t.locale),r=n.reactive({});return Object.entries(t.messages).forEach(([s,c])=>{r[s]=c}),{t(s,c){if(!s)return"";const d=typeof c=="string"&&c?c:o.value;let y=Ze(r[d],s)||Ze(r[t.fallbackLocale],s);if(c&&typeof c!="string"){const a=Ut(y,c);$t(a)||(y=Gt(y,a))}return y||s},current:n.readonly(o),options:n.readonly(e||{}),install(s){const c=this;s.config.globalProperties.$t=c.t,s.provide(Ke,c)},changeLocale(s){o.value=s},setLocaleMessage(s,c){r[s]=Xe(n.toRaw(r[s]||{}),c)},getLocaleMessage(s){return r[s]||{}}}}const Zt=()=>{const e=Object.assign({"./lang/en.ts":Pt,"./lang/zh-CN.ts":Vt});function t(s,c){for(const d in s){const y=s[d];if(y?.default){const a=d.substring(d.lastIndexOf("/")+1,d.lastIndexOf(".")),u=c[a];c[a]=u?{...u,...y.default}:y.default}}}const o=()=>{const s={};return t(e,s),s};return{getI18n:s=>{const c={...o()};if(s)for(const d of s)c[d.locale]=d.messages;return Ht({locale:"zh-CN",fallbackLocale:"en",messages:c})}}},Ye=({wrap:e,left:t=0,top:o=0,smooth:r=!0})=>{e&&(e.scrollTo?e.scrollTo({left:t,top:o,behavior:r?"smooth":"auto"}):(e.scrollLeft=t,e.scrollTop=o))};function Xt({el:e,wrap:t,block:o="start",inline:r="nearest"}){const s=t&&typeof t=="object"&&"value"in t?t.value:t;if(!(!e||!s))if(e.scrollIntoView)e.scrollIntoView({behavior:"smooth",block:o,inline:r});else{const{offsetLeft:c,offsetTop:d}=e;let y,a;o==="center"?a=d+(e.clientHeight-s.clientHeight)/2:a=d,r==="center"?y=c+(e.clientWidth-s.clientWidth)/2:y=c,Ye({wrap:s,left:y,top:a})}}const ze=(e=".stack-tab__container *")=>{const t=Array.from(document.querySelectorAll(e)).map(o=>+window.getComputedStyle(o).zIndex||0);return t.length?Math.max(...t.filter(o=>o<9e4))+1:1};function Je(e){return!!(e&&/^(javascript|data):/i.test(e))}function Qe(e){if(!e||!/^https?:\/\//i.test(e))return!1;try{const t=typeof window<"u"?window.location:{origin:"http://localhost"};return new URL(e,t.origin).origin!==t.origin}catch{return!0}}function Ne(e){const[t,o]=e.split("?");if(!o)return{path:t??"",query:{}};const r={};for(const s of o.split("&")){const[c,d]=s.split("=");c!=null&&d!=null&&d!==""&&(r[c]=d)}return{path:t??"",query:r}}var Q=(e=>(e.WHEEL="wheel",e.BUTTON="button",e.BOTH="both",e))(Q||{});class _e{items;constructor(t){if(this.items=new Map,t)for(const o of t)this.push(o)}push(t){this.items.set(this.items.size,t)}pop(){if(this.isEmpty())return;const t=this.items.get(this.items.size-1);return this.items.delete(this.items.size-1),t}peek(){if(!this.isEmpty())return this.items.get(this.items.size-1)}isEmpty(){return this.items.size===0}size(){return this.items.size}clear(){this.items.clear()}list(){return Array.from(this.items.values())}toJSON(){return this.list()}toString(){return this.list().toString()}}function Kt(e,t,o){var r={},s=r.noTrailing,c=s===void 0?!1:s,d=r.noLeading,y=d===void 0?!1:d,a=r.debounceMode,u=a===void 0?void 0:a,k,m=!1,v=0;function B(){k&&clearTimeout(k)}function O(C){var x=C||{},E=x.upcomingOnly,S=E===void 0?!1:E;B(),m=!S}function M(){for(var C=arguments.length,x=new Array(C),E=0;E<C;E++)x[E]=arguments[E];var S=this,w=Date.now()-v;if(m)return;function _(){v=Date.now(),t.apply(S,x)}function l(){k=void 0}!y&&u&&!k&&_(),B(),u===void 0&&w>e?y?(v=Date.now(),c||(k=setTimeout(u?l:_,e))):_():c!==!0&&(k=setTimeout(u?l:_,u===void 0?e-w:e))}return M.cancel=O,M}function Pe(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function Ve(e,t,o=".",r){if(!Pe(t))return Ve(e,{},o,r);const s=Object.assign({},t);for(const c in e){if(c==="__proto__"||c==="constructor")continue;const d=e[c];d!=null&&(r&&r(s,c,d,o)||(Array.isArray(d)&&Array.isArray(s[c])?s[c]=[...d,...s[c]]:Pe(d)&&Pe(s[c])?s[c]=Ve(d,s[c],(o?`${o}.`:"")+c.toString(),r):s[c]=d))}return s}function Yt(e){return(...t)=>t.reduce((o,r)=>Ve(o,r,"",e),{})}const X=Yt(),et="0123456789ABCDEFGHJKMNPQRSTVWXYZ",xe=32,Jt=16,tt=10,nt=0xffffffffffff;var se;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(se||(se={}));class pe extends Error{constructor(t,o){super(`${o} (${t})`),this.name="ULIDError",this.code=t}}function Qt(e){const t=Math.floor(e()*xe)%xe;return et.charAt(t)}function en(e){const t=tn(),o=t&&(t.crypto||t.msCrypto)||null;if(typeof o?.getRandomValues=="function")return()=>{const r=new Uint8Array(1);return o.getRandomValues(r),r[0]/256};if(typeof o?.randomBytes=="function")return()=>o.randomBytes(1).readUInt8()/256;throw new pe(se.PRNGDetectFailure,"Failed to find a reliable PRNG")}function tn(){return rn()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function nn(e,t){let o="";for(;e>0;e--)o=Qt(t)+o;return o}function on(e,t=tt){if(isNaN(e))throw new pe(se.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>nt)throw new pe(se.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${nt}: ${e}`);if(e<0)throw new pe(se.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new pe(se.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let o,r="";for(let s=t;s>0;s--)o=e%xe,r=et.charAt(o)+r,e=(e-o)/xe;return r}function rn(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function me(e,t){const o=en(),r=Date.now();return on(r,tt)+nn(Jt,o)}var De={exports:{}},ot;function sn(){return ot||(ot=1,(function(e){var t=(function(){var o=String.fromCharCode,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",c={};function d(a,u){if(!c[a]){c[a]={};for(var k=0;k<a.length;k++)c[a][a.charAt(k)]=k}return c[a][u]}var y={compressToBase64:function(a){if(a==null)return"";var u=y._compress(a,6,function(k){return r.charAt(k)});switch(u.length%4){default:case 0:return u;case 1:return u+"===";case 2:return u+"==";case 3:return u+"="}},decompressFromBase64:function(a){return a==null?"":a==""?null:y._decompress(a.length,32,function(u){return d(r,a.charAt(u))})},compressToUTF16:function(a){return a==null?"":y._compress(a,15,function(u){return o(u+32)})+" "},decompressFromUTF16:function(a){return a==null?"":a==""?null:y._decompress(a.length,16384,function(u){return a.charCodeAt(u)-32})},compressToUint8Array:function(a){for(var u=y.compress(a),k=new Uint8Array(u.length*2),m=0,v=u.length;m<v;m++){var B=u.charCodeAt(m);k[m*2]=B>>>8,k[m*2+1]=B%256}return k},decompressFromUint8Array:function(a){if(a==null)return y.decompress(a);for(var u=new Array(a.length/2),k=0,m=u.length;k<m;k++)u[k]=a[k*2]*256+a[k*2+1];var v=[];return u.forEach(function(B){v.push(o(B))}),y.decompress(v.join(""))},compressToEncodedURIComponent:function(a){return a==null?"":y._compress(a,6,function(u){return s.charAt(u)})},decompressFromEncodedURIComponent:function(a){return a==null?"":a==""?null:(a=a.replace(/ /g,"+"),y._decompress(a.length,32,function(u){return d(s,a.charAt(u))}))},compress:function(a){return y._compress(a,16,function(u){return o(u)})},_compress:function(a,u,k){if(a==null)return"";var m,v,B={},O={},M="",C="",x="",E=2,S=3,w=2,_=[],l=0,g=0,T;for(T=0;T<a.length;T+=1)if(M=a.charAt(T),Object.prototype.hasOwnProperty.call(B,M)||(B[M]=S++,O[M]=!0),C=x+M,Object.prototype.hasOwnProperty.call(B,C))x=C;else{if(Object.prototype.hasOwnProperty.call(O,x)){if(x.charCodeAt(0)<256){for(m=0;m<w;m++)l=l<<1,g==u-1?(g=0,_.push(k(l)),l=0):g++;for(v=x.charCodeAt(0),m=0;m<8;m++)l=l<<1|v&1,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=v>>1}else{for(v=1,m=0;m<w;m++)l=l<<1|v,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=0;for(v=x.charCodeAt(0),m=0;m<16;m++)l=l<<1|v&1,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=v>>1}E--,E==0&&(E=Math.pow(2,w),w++),delete O[x]}else for(v=B[x],m=0;m<w;m++)l=l<<1|v&1,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=v>>1;E--,E==0&&(E=Math.pow(2,w),w++),B[C]=S++,x=String(M)}if(x!==""){if(Object.prototype.hasOwnProperty.call(O,x)){if(x.charCodeAt(0)<256){for(m=0;m<w;m++)l=l<<1,g==u-1?(g=0,_.push(k(l)),l=0):g++;for(v=x.charCodeAt(0),m=0;m<8;m++)l=l<<1|v&1,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=v>>1}else{for(v=1,m=0;m<w;m++)l=l<<1|v,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=0;for(v=x.charCodeAt(0),m=0;m<16;m++)l=l<<1|v&1,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=v>>1}E--,E==0&&(E=Math.pow(2,w),w++),delete O[x]}else for(v=B[x],m=0;m<w;m++)l=l<<1|v&1,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=v>>1;E--,E==0&&(E=Math.pow(2,w),w++)}for(v=2,m=0;m<w;m++)l=l<<1|v&1,g==u-1?(g=0,_.push(k(l)),l=0):g++,v=v>>1;for(;;)if(l=l<<1,g==u-1){_.push(k(l));break}else g++;return _.join("")},decompress:function(a){return a==null?"":a==""?null:y._decompress(a.length,32768,function(u){return a.charCodeAt(u)})},_decompress:function(a,u,k){var m=[],v=4,B=4,O=3,M="",C=[],x,E,S,w,_,l,g,T={val:k(0),position:u,index:1};for(x=0;x<3;x+=1)m[x]=x;for(S=0,_=Math.pow(2,2),l=1;l!=_;)w=T.val&T.position,T.position>>=1,T.position==0&&(T.position=u,T.val=k(T.index++)),S|=(w>0?1:0)*l,l<<=1;switch(S){case 0:for(S=0,_=Math.pow(2,8),l=1;l!=_;)w=T.val&T.position,T.position>>=1,T.position==0&&(T.position=u,T.val=k(T.index++)),S|=(w>0?1:0)*l,l<<=1;g=o(S);break;case 1:for(S=0,_=Math.pow(2,16),l=1;l!=_;)w=T.val&T.position,T.position>>=1,T.position==0&&(T.position=u,T.val=k(T.index++)),S|=(w>0?1:0)*l,l<<=1;g=o(S);break;case 2:return""}for(m[3]=g,E=g,C.push(g);;){if(T.index>a)return"";for(S=0,_=Math.pow(2,O),l=1;l!=_;)w=T.val&T.position,T.position>>=1,T.position==0&&(T.position=u,T.val=k(T.index++)),S|=(w>0?1:0)*l,l<<=1;switch(g=S){case 0:for(S=0,_=Math.pow(2,8),l=1;l!=_;)w=T.val&T.position,T.position>>=1,T.position==0&&(T.position=u,T.val=k(T.index++)),S|=(w>0?1:0)*l,l<<=1;m[B++]=o(S),g=B-1,v--;break;case 1:for(S=0,_=Math.pow(2,16),l=1;l!=_;)w=T.val&T.position,T.position>>=1,T.position==0&&(T.position=u,T.val=k(T.index++)),S|=(w>0?1:0)*l,l<<=1;m[B++]=o(S),g=B-1,v--;break;case 2:return C.join("")}if(v==0&&(v=Math.pow(2,O),O++),m[g])M=m[g];else if(g===B)M=E+E.charAt(0);else return null;C.push(M),m[B++]=E+M.charAt(0),v--,E=M,v==0&&(v=Math.pow(2,O),O++)}}};return y})();e!=null?e.exports=t:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return t})})(De)),De.exports}var rt=sn();const Ee=e=>{const t=e.iframeRefreshMode==="reload"?"R":"P",o=`${e.id}|${e.title}|${e.iframe?"Y":"N"}|${e.closable?"Y":"N"}|${e.refreshable?"Y":"N"}|${t}`;return rt.compressToEncodedURIComponent(o)},an=e=>{const o=rt.decompressFromEncodedURIComponent(e).split("|"),r=o[5]==="R"?"reload":"postMessage";return{id:o[0]??"",title:o[1]??"",iframe:o[2]==="Y",closable:o[3]==="Y",refreshable:o[4]==="Y",iframeRefreshMode:r}},ee=()=>me();function cn(e){return{all:e=e||new Map,on:function(t,o){var r=e.get(t);r?r.push(o):e.set(t,[o])},off:function(t,o){var r=e.get(t);r&&(o?r.splice(r.indexOf(o)>>>0,1):e.set(t,[]))},emit:function(t,o){var r=e.get(t);r&&r.slice().map(function(s){s(o)}),(r=e.get("*"))&&r.slice().map(function(s){s(t,o)})}}}const ln=cn(),fn={install(e){e.provide("tabEmitter",ln)}},ie=()=>n.inject("tabEmitter");var $=(e=>(e.PAGE_LOADING="PAGE_LOADING",e.TAB_ACTIVE="TAB_ACTIVE",e))($||{});const dn=n.defineComponent({__name:"PageLoading",props:{tabId:{}},setup(e){const t=e,o=ie(),r=n.ref(!1),s=d=>{d.tId===t.tabId&&(r.value=d.value)},c=$.PAGE_LOADING;return o.on(c,s),n.onUnmounted(()=>{o.off(c,s)}),(d,y)=>r.value?(n.openBlock(),n.createElementBlock("div",{key:0,class:"stack-tab-loading-mask",style:n.normalizeStyle({zIndex:n.unref(ze)(".cache-page-wrapper *")})},[...y[0]||(y[0]=[n.createElementVNode("div",{class:"stack-tab-loading--spin turn"},null,-1)])],4)):n.createCommentVNode("",!0)}}),z=n.ref([]),fe=n.ref([]),K=new Map,te=new Set,Y=new Set,We=n.ref(0),ae=new Map,st=n.ref(!1),un="stacktab-active-tab",ne=n.ref({});let Se=0,it=!1,at="";const hn=e=>{Se=e},pn=e=>{it=e},mn=e=>{at=e},$e=e=>{te.add(e)},be=e=>{for(const t of e.pages.list())$e(t.id);Y.add(e.id)},bn=e=>{for(const t of e.pages.list())$e(t.id)},oe=e=>{fe.value.includes(e)||fe.value.push(e)},ct=e=>{const t=fe.value.indexOf(e);t>=0&&fe.value.splice(t,1)},ge=e=>{e&&(te.delete(e),ct(e),K.delete(e))},re=()=>{if(te.size>0){for(const e of[...te])ge(e);te.clear()}},gn=e=>{const t=ae.get(e);if(t)for(const[o,r]of t){const s=o.startsWith("#")?document.getElementById(o.slice(1)):document.querySelector(o);s&&(s.scrollTop=r.top,s.scrollLeft=r.left)}},vn=e=>{const t=ae.get(e);if(t)for(const o of t.keys()){const r=o.startsWith("#")?document.getElementById(o.slice(1)):document.querySelector(o);t.set(o,{top:r?.scrollTop??0,left:r?.scrollLeft??0})}},Tn=e=>{const t=ae.get(e);t&&(t.clear(),ae.delete(e))},lt=(e,...t)=>{ae.has(e)||ae.set(e,new Map);const o=ae.get(e);for(const r of t)o.set(r,{top:0,left:0})},qe=()=>at+un,ft=e=>{e.id&&window.sessionStorage.setItem(qe(),JSON.stringify(e))},dt=()=>{window.sessionStorage.removeItem(qe())},yn=e=>e==null?null:JSON.parse(e,(t,o)=>t==="pages"?new _e(o):o),ut=n.defineComponent({name:"StackTabEmptyPlaceholder",setup(){return()=>null}}),wn=e=>{const o=e.matched[e.matched.length-1]?.path??e.path,r=e.path.endsWith("/")?e.path.slice(0,-1):e.path;return o===r?r:e.path},Me=()=>{const e=ke.useRouter(),t=ie(),{t:o}=he(),r=()=>z.value.length,s=p=>{for(const b of p){const h=X(b,{id:me(),refreshable:!0,closable:!0,iframe:!1}),R=h.id??me();h.id=R;const L=Ne(h.path),D=X(h,{closable:!0,refreshable:!0,iframe:!1}),W=ee(),P={id:W,tabId:R,path:L.path,query:X(L.query,{__tab:Ee(h)})},q=new _e;q.push(P);const ue={id:R,title:D.title??"",closable:D.closable,refreshable:D.refreshable,iframe:D.iframe,iframeRefreshMode:D.iframeRefreshMode==="reload"?"reload":"postMessage",active:!1,pages:q};oe(W),z.value.push({...ue})}const i=sessionStorage.getItem(qe()),f=yn(i);f&&!z.value.some(b=>b.id===f.id)&&(f.iframe&&f.url&&f.iframeRefreshMode===void 0&&(f.iframeRefreshMode=Qe(f.url)?"reload":"postMessage"),f.pages&&typeof f.pages.list=="function"&&f.pages.list().forEach(h=>{h&&h.id&&oe(h.id)}),z.value.push(f)),st.value=!0},c=p=>z.value.some(i=>i.id===p),d=()=>Se<=0||Se>0&&Se>z.value.length,y=p=>(z.value.push(p),Promise.resolve(!0)),a=p=>z.value.find(i=>i.id===p)??null,u=p=>{if(p.query.__tab)return an(p.query.__tab);const i={id:me(),title:o("VueStackTab.undefined"),closable:!0,refreshable:!0,iframe:!1};return p.query.__tab=Ee(i),i},k=(p,i,f,b)=>{let h=null;for(const R of z.value)R.active=!1,R.id===p.id&&(h=R);if(h===null){const R=new _e;R.push(b);const L=i.query.__src;h={id:p.id,title:p.title,closable:p.closable,refreshable:p.refreshable,iframe:p.iframe,iframeRefreshMode:p.iframeRefreshMode??"postMessage",url:decodeURIComponent(L),active:!0,pages:R},y(h).then(()=>{t.emit($.TAB_ACTIVE,{id:p.id,isRoute:!1})})}else h.active=!0,(h.pages.isEmpty()||h.pages.peek().id!==b.id)&&h.pages.push(b);return h},m=()=>ee(),v=p=>{const i=u(p);if(Y.has(i.id))return{empty:!0};const f=wn(p);let b=i.id?a(i.id):null,h,R=null;if(b&&!b.pages.isEmpty()){const L=b.pages.peek();if(!L)throw new Error("[vue-stack-tabs] Stack is not empty but peek() returned undefined");if(L.path===f)h=L.id;else{const D=b.pages.list();let W=-1;for(let P=D.length-2;P>=0;P--){const q=D[P];if(q&&q.path===f){W=P;break}}if(W!==-1){const P=D.length-1-W;for(let ue=0;ue<P;ue++){const we=b.pages.pop();we&&ge(we.id)}const q=b.pages.peek();h=q?q.id:ee(),q||(R={id:h,tabId:i.id,path:p.path,query:p.query})}else h=ee(),R={id:h,tabId:i.id,path:p.path,query:p.query}}}else h=ee(),R={id:h,tabId:i.id,path:p.path,query:p.query};if(te.has(h)){te.delete(h);const L=K.get(h);if(L)return{recovered:L,cacheName:h}}if(R)b=k(i,p,h,R);else{for(const L of z.value)L.active=!1;b.active=!0,!h&&b&&!b.pages.isEmpty()&&(h=b.pages.peek().id)}return ft(b),{cacheName:h,tabInfo:i,targetTab:b}},B=p=>{const{cacheName:i,tabInfo:f}=p;if(K.has(i))return oe(i),K.get(i);const b=n.defineComponent({name:i,props:{vnode:{type:Object,required:!1,default:void 0}},emits:["onLoaded"],setup(h,R){const L=n.ref(null),D=()=>{try{const P=a(f.id)?.pages.peek();P&&P.id===i&&P._backParams?(L.value={...P._backParams},delete P._backParams):L.value=null}catch{L.value=null}};return n.onMounted(()=>{R.emit("onLoaded"),lt(i,`#W-${i}`),D()}),n.onDeactivated(()=>vn(i)),n.onActivated(()=>{R.emit("onLoaded"),gn(i),re(),Y.clear(),D()}),n.onUnmounted(()=>Tn(i)),()=>{const W=h.vnode,P=L.value?{_back:L.value}:{};return n.createVNode("div",{class:"cache-page-wrapper",id:`W-${i}`,style:[it?"overflow:auto":"overflow:hidden","height: 100%"]},[W?n.cloneVNode(W,{tId:f.id,pId:i,...P||{}}):null,n.createVNode(dn,{tabId:f.id},null)])}}});return K.set(i,b),oe(i),b},O=n.ref(""),M=(p,i)=>{if(!i)return ut;const f=v(p);return"empty"in f?ut:"recovered"in f?(oe(f.cacheName),O.value=f.cacheName,f.recovered):(O.value=f.cacheName,B(f))},C=p=>{const i=a(p.id);i&&(bn(i),re(),i.pages.clear())},x=p=>{let i="";const f=a(p),b=z.value,h=b.findIndex(L=>L?.id===p);if(h<0)return"";const R=b[h];return R.closable?(be(R),R.pages.clear(),b.length>1&&R.active&&(i=(h===0?b[1]:b[h-1])?.id??""),b.splice(h,1),i&&t.emit($.TAB_ACTIVE,{id:i}),f?.active||(re(),Y.clear()),i):p},E=()=>{const p=z.value;for(let b=p.length-1;b>=0;b--){const h=p[b];h?.closable&&(be(h),h.pages.clear(),p.splice(b,1))}if(p.some(b=>b.active)){re(),Y.clear();return}const f=p[p.length-1];f&&t.emit($.TAB_ACTIVE,{id:f.id})};return{tabs:z,caches:fe,refreshKey:We,activeCacheKey:O,isInitialized:st,setMaxSize:hn,canAddTab:d,initialize:s,size:r,active:(p,i=!0)=>{t.emit("FORWARD");const f=a(p);if(f&&!f.active){for(const b of z.value)b.active=b.id===p;if(ft(f),z.value=z.value.slice(),i){const b=f.pages.peek();if(b){const h=Ee({id:f.id,title:f.title,closable:f.closable,refreshable:f.refreshable,iframe:f.iframe}),R=X({__tab:h},b.query||{});e.push({path:b.path,query:R})}}}},getCacheName:m,destroy:()=>{z.value.length=0,te.clear(),Y.clear(),ne.value={},fe.value.length=0,K.clear(),dt()},reset:()=>E(),addCache:oe,removeCache:ct,getTab:a,addTab:y,removeTab:x,removeAllTabs:E,removeLeftTabs:p=>{const i=z.value,f=i.findIndex(h=>h?.id===p);if(f<=0)return;for(let h=f-1;h>=0;h--){const R=i[h];R?.closable&&(be(R),R.pages.clear(),i.splice(h,1))}if(i.some(h=>h.active)){re(),Y.clear();return}const b=i[0];b&&t.emit($.TAB_ACTIVE,{id:b.id})},removeRightTabs:p=>{const i=z.value,f=i.findIndex(h=>h?.id===p);if(f<0||f>=i.length-1)return;for(let h=i.length-1;h>f;h--){const R=i[h];R?.closable&&(be(R),R.pages.clear(),i.splice(h,1))}if(i.some(h=>h.active)){re(),Y.clear();return}const b=i[i.length-1];b&&t.emit($.TAB_ACTIVE,{id:b.id})},removeOtherTabs:p=>{const i=z.value;let f;for(let b=i.length-1;b>=0;b--){const h=i[b];h&&(h.id===p?f=h:h.closable&&(be(h),h.pages.clear(),i.splice(b,1)))}f&&!f.active?t.emit($.TAB_ACTIVE,{id:p}):(re(),Y.clear())},hasTab:c,renewTab:C,addPage:M,addComponent:(p,i)=>K.set(p,i),getComponent:p=>K.get(p),removeComponent:p=>K.delete(p),markCacheForEviction:$e,evictMarkedCaches:re,evictPageCache:ge,refreshTab:p=>{const i=a(p);if(!i?.refreshable)return;if(i.iframe){i.iframeRefreshMode==="reload"?ne.value={...ne.value,[p]:(ne.value[p]??0)+1}:t.emit("REFRESH_IFRAME_POSTMESSAGE",p);return}const f=i.pages.peek();if(!f)return;const b=f.id;ge(b),f.id=ee(),oe(f.id),i.active&&We.value++},refreshAllTabs:()=>{let p=!1;for(const i of z.value)if(i?.refreshable)if(i.iframe)i.iframeRefreshMode==="reload"?ne.value={...ne.value,[i.id]:(ne.value[i.id]??0)+1}:t.emit("REFRESH_IFRAME_POSTMESSAGE",i.id);else{const f=i.pages.peek();if(f){const b=f.id;ge(b),f.id=ee(),oe(f.id),i.active&&(p=!0)}}p&&We.value++},iframeRefreshKeys:ne,addPageScroller:lt,setGlobalScroll:pn,clearSession:dt,setSessionPrefix:mn}};let ht;function Be(){const e=ke.useRouter(),t=ie(),{active:o,hasTab:r,refreshKey:s,reset:c,canAddTab:d,renewTab:y,getTab:a,tabs:u,removeTab:k,removeAllTabs:m,refreshTab:v,refreshAllTabs:B}=Me(),O=w=>{const _={refreshable:!0,closable:!0,iframe:!1};w.iframe&&w.iframeRefreshMode===void 0?_.iframeRefreshMode=Qe(w.path??"")?"reload":"postMessage":w.iframe&&(_.iframeRefreshMode=w.iframeRefreshMode??"postMessage");const l=X(w,_);return l.id||(l.id=me()),l},M=Kt(500,(w,_=!1)=>new Promise((l,g)=>{const T=O(w);if(r(T.id)&&!_){t.emit($.TAB_ACTIVE,{id:T.id}),l(T.id);return}if(T.id&&_&&r(T.id)&&(y(w),a(w.id)?.active&&s.value++),!d()){g(new Error("Max Size"));return}C(w,T),l(T.id)})),C=(w,_)=>{const l=Ee(_);let g=X({__tab:l},w.query),T;if(w.iframe)g.__src=encodeURIComponent(w.path),T=ht;else{const V=Ne(w.path);T=V.path,g=X(V.query,g)}e.push({path:T,query:g})};return{openTab:M,closeTab:k,closeAllTabs:m,refreshTab:v,refreshAllTabs:B,activeTab:o,reset:c,tabs:u,setIFramePath:w=>{ht=w},getWrapper:()=>document.getElementsByClassName("cache-page-wrapper")[0],openInNewWindow:w=>{const _=a(w);_?.iframe&&_.url&&window.open(_.url,"_blank","noopener,noreferrer")}}}const kn={class:"stack-tab__contextmenu-item"},J=n.defineComponent({__name:"ContextMenuItem",props:{icon:{},title:{}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",kn,[n.createElementVNode("div",{class:n.normalizeClass(["stack-tab__contextmenu-icon",e.icon])},null,2),n.createElementVNode("div",{style:{"margin-left":"8px"},onContextmenu:o[0]||(o[0]=n.withModifiers(()=>{},["prevent"]))},n.toDisplayString(e.title),33)]))}}),_n={key:1,class:"divider div-transparent"},xn=((e,t)=>{const o=e.__vccOpts||e;for(const[r,s]of t)o[r]=s;return o})(n.defineComponent({__name:"index",props:{index:{},left:{default:0},top:{default:0},contextMenu:{default:()=>[]},tabItem:{},max:{}},emits:["close"],setup(e,{emit:t}){const o=e,r=t,{t:s}=he(),c=n.ref(),d=n.reactive({left:o.left,top:o.top}),{closeTab:y,closeAllTabs:a,refreshTab:u,refreshAllTabs:k,openInNewWindow:m}=Be(),{removeLeftTabs:v,removeRightTabs:B,removeOtherTabs:O}=Me(),M=C=>{C?.(),r("close")};return n.onMounted(()=>{const C=c.value?.clientWidth??0;d.left+C>window.innerWidth&&(d.left=window.innerWidth-C-5)}),(C,x)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"menuElementRef",ref:c,class:"stack-tab__contextmenu",style:n.normalizeStyle({left:`${d.left}px`,top:`${d.top}px`,"z-index":n.unref(ze)(".stack-tab,.stack-tab *")})},[n.createVNode(J,{icon:"stack-tab__icon-reload svg-mask",title:n.unref(s)("VueStackTab.reload"),disabled:e.tabItem.refreshable?null:"disabled",onClick:x[0]||(x[0]=E=>M(()=>n.unref(u)(e.tabItem.id)))},null,8,["title","disabled"]),n.createVNode(J,{icon:"stack-tab__icon-reload-all svg-mask",title:n.unref(s)("VueStackTab.reloadAll"),onClick:x[1]||(x[1]=E=>M(n.unref(k)))},null,8,["title"]),n.createVNode(J,{icon:"stack-tab__icon-close svg-mask",title:n.unref(s)("VueStackTab.close"),disabled:e.tabItem.closable?null:"disabled",onClick:x[2]||(x[2]=E=>M(()=>n.unref(y)(e.tabItem.id)))},null,8,["title","disabled"]),n.createVNode(J,{icon:"stack-tab__icon-close-lefts svg-mask",title:n.unref(s)("VueStackTab.closeLeft"),disabled:e.index<=0?"disabled":null,onClick:x[3]||(x[3]=E=>M(()=>n.unref(v)(e.tabItem.id)))},null,8,["title","disabled"]),n.createVNode(J,{icon:"stack-tab__icon-close-rights svg-mask",title:n.unref(s)("VueStackTab.closeRight"),disabled:e.index>=e.max-1?"disabled":null,onClick:x[4]||(x[4]=E=>M(()=>n.unref(B)(e.tabItem.id)))},null,8,["title","disabled"]),n.createVNode(J,{icon:"stack-tab__icon-close-others svg-mask",title:n.unref(s)("VueStackTab.closeOthers"),onClick:x[5]||(x[5]=E=>M(()=>n.unref(O)(e.tabItem.id)))},null,8,["title"]),n.createVNode(J,{icon:"stack-tab__icon-close-all svg-mask",title:n.unref(s)("VueStackTab.closeAll"),onClick:x[6]||(x[6]=E=>M(n.unref(a)))},null,8,["title"]),e.tabItem.iframe&&e.tabItem.url?(n.openBlock(),n.createBlock(J,{key:0,icon:"stack-tab__icon-open svg-mask",title:n.unref(s)("VueStackTab.openInNewWindow"),onClick:x[7]||(x[7]=E=>M(()=>n.unref(m)(e.tabItem.id)))},null,8,["title"])):n.createCommentVNode("",!0),e.contextMenu!==void 0&&e.contextMenu.length>0?(n.openBlock(),n.createElementBlock("div",_n)):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.contextMenu,(E,S)=>(n.openBlock(),n.createBlock(J,{key:S,icon:E.icon,title:E.title,disabled:E.disabled(e.tabItem)?"disabled":null,onClick:w=>M(()=>!E.disabled(e.tabItem)&&E.callback(e.tabItem.id))},null,8,["icon","title","disabled","onClick"]))),128))],4))}}),[["__scopeId","data-v-6f704637"]]),En=()=>{const e=n.reactive({item:{},index:-1,left:0,top:0,max:0}),t=n.ref(!1),o=s=>{s.target.closest?.(".stack-tab__contextmenu")||(t.value=!1,document.removeEventListener("click",o))};return n.onUnmounted(()=>{document.removeEventListener("click",o)}),{shown:t,contextMenuData:e,showContextMenu:async(s,c,d,y)=>{t.value=!1,document.removeEventListener("click",o),await n.nextTick(()=>{const{clientY:a,clientX:u}=s;t.value=!0,Object.assign(e,{item:c,index:d,top:a,left:u,max:y}),n.nextTick(()=>document.addEventListener("click",o))})}}},Sn={class:"stack-tab__item-title"},Mn=["title"],Bn=["title"],An=n.defineComponent({__name:"TabHeaderItem",props:{item:{}},emits:["close","active"],setup(e,{emit:t}){const o=t,r=ie(),{t:s}=he(),c=n.ref(),d=e,y=v=>{d.item.id===v.id&&m(v.isRoute??!0)},a=$.TAB_ACTIVE;r.on(a,y),n.onUnmounted(()=>{r.off(a,y)});const u=n.computed(()=>d.item.title||s("undefined")),k=()=>{o("close",d.item)},m=(v=!0)=>{o("active",d.item,c.value,v)};return(v,B)=>(n.openBlock(),n.createElementBlock("li",{ref_key:"tabElementRef",ref:c,class:n.normalizeClass(["stack-tab__item",{"is-active":e.item.active,"is-icon":e.item.closable}]),onClick:B[0]||(B[0]=O=>m(!0))},[n.createElementVNode("div",Sn,[n.createElementVNode("div",{class:"stack-tab__item-title-content",title:u.value},n.toDisplayString(u.value),9,Mn)]),e.item.closable?(n.openBlock(),n.createElementBlock("div",{key:0,class:"stack-tab__icon-close-fill stack-tab__item-button",title:n.unref(s)("VueStackTab.close"),onClick:n.withModifiers(k,["stop"])},null,8,Bn)):n.createCommentVNode("",!0)],2))}});var ce=[],Cn=function(){return ce.some(function(e){return e.activeTargets.length>0})},Rn=function(){return ce.some(function(e){return e.skippedTargets.length>0})},pt="ResizeObserver loop completed with undelivered notifications.",On=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:pt}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=pt),window.dispatchEvent(e)},ve;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(ve||(ve={}));var le=function(e){return Object.freeze(e)},In=(function(){function e(t,o){this.inlineSize=t,this.blockSize=o,le(this)}return e})(),mt=(function(){function e(t,o,r,s){return this.x=t,this.y=o,this.width=r,this.height=s,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,le(this)}return e.prototype.toJSON=function(){var t=this,o=t.x,r=t.y,s=t.top,c=t.right,d=t.bottom,y=t.left,a=t.width,u=t.height;return{x:o,y:r,top:s,right:c,bottom:d,left:y,width:a,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e})(),Fe=function(e){return e instanceof SVGElement&&"getBBox"in e},bt=function(e){if(Fe(e)){var t=e.getBBox(),o=t.width,r=t.height;return!o&&!r}var s=e,c=s.offsetWidth,d=s.offsetHeight;return!(c||d||e.getClientRects().length)},gt=function(e){var t;if(e instanceof Element)return!0;var o=(t=e?.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(o&&e instanceof o.Element)},Ln=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Te=typeof window<"u"?window:{},Ae=new WeakMap,vt=/auto|scroll/,zn=/^tb|vertical/,Nn=/msie|trident/i.test(Te.navigator&&Te.navigator.userAgent),G=function(e){return parseFloat(e||"0")},de=function(e,t,o){return e===void 0&&(e=0),t===void 0&&(t=0),o===void 0&&(o=!1),new In((o?t:e)||0,(o?e:t)||0)},Tt=le({devicePixelContentBoxSize:de(),borderBoxSize:de(),contentBoxSize:de(),contentRect:new mt(0,0,0,0)}),yt=function(e,t){if(t===void 0&&(t=!1),Ae.has(e)&&!t)return Ae.get(e);if(bt(e))return Ae.set(e,Tt),Tt;var o=getComputedStyle(e),r=Fe(e)&&e.ownerSVGElement&&e.getBBox(),s=!Nn&&o.boxSizing==="border-box",c=zn.test(o.writingMode||""),d=!r&&vt.test(o.overflowY||""),y=!r&&vt.test(o.overflowX||""),a=r?0:G(o.paddingTop),u=r?0:G(o.paddingRight),k=r?0:G(o.paddingBottom),m=r?0:G(o.paddingLeft),v=r?0:G(o.borderTopWidth),B=r?0:G(o.borderRightWidth),O=r?0:G(o.borderBottomWidth),M=r?0:G(o.borderLeftWidth),C=m+u,x=a+k,E=M+B,S=v+O,w=y?e.offsetHeight-S-e.clientHeight:0,_=d?e.offsetWidth-E-e.clientWidth:0,l=s?C+E:0,g=s?x+S:0,T=r?r.width:G(o.width)-l-_,V=r?r.height:G(o.height)-g-w,F=T+C+_+E,H=V+x+w+S,p=le({devicePixelContentBoxSize:de(Math.round(T*devicePixelRatio),Math.round(V*devicePixelRatio),c),borderBoxSize:de(F,H,c),contentBoxSize:de(T,V,c),contentRect:new mt(m,a,T,V)});return Ae.set(e,p),p},wt=function(e,t,o){var r=yt(e,o),s=r.borderBoxSize,c=r.contentBoxSize,d=r.devicePixelContentBoxSize;switch(t){case ve.DEVICE_PIXEL_CONTENT_BOX:return d;case ve.BORDER_BOX:return s;default:return c}},Pn=(function(){function e(t){var o=yt(t);this.target=t,this.contentRect=o.contentRect,this.borderBoxSize=le([o.borderBoxSize]),this.contentBoxSize=le([o.contentBoxSize]),this.devicePixelContentBoxSize=le([o.devicePixelContentBoxSize])}return e})(),kt=function(e){if(bt(e))return 1/0;for(var t=0,o=e.parentNode;o;)t+=1,o=o.parentNode;return t},Vn=function(){var e=1/0,t=[];ce.forEach(function(d){if(d.activeTargets.length!==0){var y=[];d.activeTargets.forEach(function(u){var k=new Pn(u.target),m=kt(u.target);y.push(k),u.lastReportedSize=wt(u.target,u.observedBox),m<e&&(e=m)}),t.push(function(){d.callback.call(d.observer,y,d.observer)}),d.activeTargets.splice(0,d.activeTargets.length)}});for(var o=0,r=t;o<r.length;o++){var s=r[o];s()}return e},_t=function(e){ce.forEach(function(o){o.activeTargets.splice(0,o.activeTargets.length),o.skippedTargets.splice(0,o.skippedTargets.length),o.observationTargets.forEach(function(s){s.isActive()&&(kt(s.target)>e?o.activeTargets.push(s):o.skippedTargets.push(s))})})},Dn=function(){var e=0;for(_t(e);Cn();)e=Vn(),_t(e);return Rn()&&On(),e>0},Ue,xt=[],Wn=function(){return xt.splice(0).forEach(function(e){return e()})},$n=function(e){if(!Ue){var t=0,o=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Wn()}).observe(o,r),Ue=function(){o.textContent="".concat(t?t--:t++)}}xt.push(e),Ue()},qn=function(e){$n(function(){requestAnimationFrame(e)})},Ce=0,Fn=function(){return!!Ce},Un=250,Gn={attributes:!0,characterData:!0,childList:!0,subtree:!0},Et=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],St=function(e){return e===void 0&&(e=0),Date.now()+e},Ge=!1,jn=(function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var o=this;if(t===void 0&&(t=Un),!Ge){Ge=!0;var r=St(t);qn(function(){var s=!1;try{s=Dn()}finally{if(Ge=!1,t=r-St(),!Fn())return;s?o.run(1e3):t>0?o.run(t):o.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,o=function(){return t.observer&&t.observer.observe(document.body,Gn)};document.body?o():Te.addEventListener("DOMContentLoaded",o)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Et.forEach(function(o){return Te.addEventListener(o,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Et.forEach(function(o){return Te.removeEventListener(o,t.listener,!0)}),this.stopped=!0)},e})(),je=new jn,Mt=function(e){!Ce&&e>0&&je.start(),Ce+=e,!Ce&&je.stop()},Hn=function(e){return!Fe(e)&&!Ln(e)&&getComputedStyle(e).display==="inline"},Zn=(function(){function e(t,o){this.target=t,this.observedBox=o||ve.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=wt(this.target,this.observedBox,!0);return Hn(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e})(),Xn=(function(){function e(t,o){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=o}return e})(),Re=new WeakMap,Bt=function(e,t){for(var o=0;o<e.length;o+=1)if(e[o].target===t)return o;return-1},Oe=(function(){function e(){}return e.connect=function(t,o){var r=new Xn(t,o);Re.set(t,r)},e.observe=function(t,o,r){var s=Re.get(t),c=s.observationTargets.length===0;Bt(s.observationTargets,o)<0&&(c&&ce.push(s),s.observationTargets.push(new Zn(o,r&&r.box)),Mt(1),je.schedule())},e.unobserve=function(t,o){var r=Re.get(t),s=Bt(r.observationTargets,o),c=r.observationTargets.length===1;s>=0&&(c&&ce.splice(ce.indexOf(r),1),r.observationTargets.splice(s,1),Mt(-1))},e.disconnect=function(t){var o=this,r=Re.get(t);r.observationTargets.slice().forEach(function(s){return o.unobserve(t,s.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e})(),At=(function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Oe.connect(this,t)}return e.prototype.observe=function(t,o){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!gt(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Oe.observe(this,t,o)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!gt(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Oe.unobserve(this,t)},e.prototype.disconnect=function(){Oe.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e})();const Kn=["disabled","title"],Yn={key:1,class:"stack-tab__button"},Ie=n.defineComponent({__name:"TabHeaderButton",props:{disabled:{type:Boolean,default:!1},shadow:{default:null},iconClass:{default:""},title:{default:""}},setup(e){return(t,o)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["stack-tab__header-button",{"stack-tab__shadow-right":e.shadow==="right","stack-tab__shadow-left":e.shadow==="left"}]),disabled:e.disabled?"disabled":null,title:e.title},["icon"in t.$slots?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,class:n.normalizeClass(["stack-tab__mask-button",e.iconClass])},null,2)),"icon"in t.$slots?(n.openBlock(),n.createElementBlock("div",Yn,[n.renderSlot(t.$slots,"icon")])):n.createCommentVNode("",!0)],10,Kn))}}),Jn=n.defineComponent({__name:"TabHeaderScroll",props:{space:{default:300},isScrollWheel:{type:Boolean,default:!0},isScrollButton:{type:Boolean,default:!0}},setup(e,{expose:t}){const o=n.ref(null),r=n.ref(null),s=n.ref(null),c=n.ref(!1),d=n.ref(!1),y=n.ref(!1),a=n.ref(!0),u=n.ref(),k=e,m=n.reactive({clientWidth:0,scrollWidth:0,scrollLeft:0}),v=n.reactive({thumbLeft:0,startScrollLeft:0,startThumbLeft:0,startPageX:0});n.watch(m,i=>{B(i)});const B=i=>{d.value=i.scrollLeft<=10,y.value=i.clientWidth+i.scrollLeft-i.scrollWidth>=-10,a.value=i.scrollWidth!==i.clientWidth},O=n.computed(()=>m.scrollWidth>m.clientWidth),M=n.computed(()=>{if(!O.value)return 0;const{clientWidth:i,scrollWidth:f}=m;return i/f*i}),C=n.computed(()=>{if(!O.value)return 0;const{clientWidth:i,scrollWidth:f,scrollLeft:b}=m;return(i-M.value)*(b/(f-i))}),x=()=>{if(!o.value)return;const{clientWidth:i,scrollWidth:f,scrollLeft:b}=o.value;Object.assign(m,{clientWidth:i,scrollWidth:f,scrollLeft:b})},E=()=>{const i=o.value?.querySelector(".stack-tab__item.is-active");i&&!p(i)&&H(i)},S=new At(()=>{x(),E()}),w=new At(()=>{O.value||E(),x()}),_=(i,f=!0)=>{Ye({wrap:o.value,left:i,top:0,smooth:f})},l=i=>{_(o.value.scrollLeft+i)},g=i=>{const f=i.deltaY<0;_(o.value.scrollLeft+(f?-k.space:k.space))},T=i=>{Object.assign(v,{startPageX:i.pageX,startScrollLeft:o.value?.scrollLeft,startThumbLeft:C.value,thumbLeft:C.value}),c.value=!0,document.addEventListener("mousemove",V),document.addEventListener("mouseup",F)},V=i=>{const{clientWidth:f,scrollWidth:b}=m;let h=v.startThumbLeft+i.pageX-v.startPageX;const R=f-M.value;h<0?h=0:h>R&&(h=R),v.thumbLeft=h,_(h*(b-f)/(f-M.value),!1),i.preventDefault()},F=()=>{c.value=!1,document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",F)};n.onMounted(()=>{S.observe(u.value);const i=o.value?.querySelector(".stack-tab__nav");w.observe(i)}),n.onUnmounted(()=>{S.disconnect(),w.disconnect()});const H=i=>{Xt({el:i,wrap:o.value,block:"end",inline:"center"})},p=i=>{if(!O.value)return!0;const f=i.offsetLeft,b=o.value.scrollLeft;return!(f<b||f+i.clientWidth>b+o.value.clientWidth)};return t({scrollIntoView:H,isInView:p}),(i,f)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[a.value?(n.openBlock(),n.createBlock(Ie,{key:0,"icon-class":"stack-tab__icon-left-arrow",disabled:d.value,onClick:f[0]||(f[0]=b=>!d.value&&l(-1*e.space))},null,8,["disabled"])):n.createCommentVNode("",!0),n.createElementVNode("div",{ref_key:"headerScroll",ref:u,class:"stack-tab__scroll",onWheelPassive:g},[n.createElementVNode("div",{ref_key:"container",ref:o,class:n.normalizeClass(["stack-tab__scroll-container",{"stack-tab__shadow-inset-left":!d.value&&y.value,"stack-tab__shadow-inset-right":!y.value&&d.value,"stack-tab__shadow-inset-all":!d.value&&!y.value}]),onScrollPassive:x},[n.renderSlot(i.$slots,"default")],34),n.withDirectives(n.createElementVNode("div",{ref_key:"bar",ref:r,class:n.normalizeClass(["stack-tab__scrollbar",{"is-dragging":c.value}])},[n.createElementVNode("div",{ref_key:"thumb",ref:s,class:n.normalizeClass(["stack-tab__scrollbar-thumb",{"is-dragging":c.value}]),style:n.normalizeStyle({width:`${M.value}px`,transform:`translateX(${C.value}px)`}),onMousedown:n.withModifiers(T,["prevent"])},null,38)],2),[[n.vShow,O.value]])],544),a.value?(n.openBlock(),n.createBlock(Ie,{key:1,"icon-class":"stack-tab__icon-right-arrow",disabled:y.value,onClick:f[1]||(f[1]=b=>!y.value&&l(e.space))},null,8,["disabled"])):n.createCommentVNode("",!0)],64))}}),Qn={class:"stack-tab__header"},eo=n.defineComponent({__name:"index",props:{space:{},tabScrollMode:{default:Q.BOTH},tabTransition:{default:()=>({name:"stack-tab-zoom"})},contextmenu:{type:[Boolean,Object],default:!0},max:{default:20}},emits:["active"],setup(e,{emit:t}){const{t:o}=he(),r=n.inject("maximum"),s=t,c=n.ref(),{shown:d,contextMenuData:y,showContextMenu:a}=En(),u=()=>{d.value=!1},k=e,{closeTab:m,activeTab:v,tabs:B}=Be(),O=n.computed(()=>typeof k.tabTransition=="string"?{name:k.tabTransition}:k.tabTransition),M=n.computed(()=>k.tabScrollMode===Q.BOTH||k.tabScrollMode===Q.BUTTON),C=k.tabScrollMode===Q.BOTH||k.tabScrollMode===Q.WHEEL,x=S=>{S.closable&&m(S.id),d.value=!1},E=(S,w,_)=>{c.value&&w&&n.nextTick(()=>{c.value.isInView(w)||c.value.scrollIntoView(w)}),v(S.id,_),s("active",S.id)};return(S,w)=>(n.openBlock(),n.createElementBlock("div",Qn,[n.renderSlot(S.$slots,"leftButton"),n.createVNode(Jn,{ref_key:"scrollContainerRef",ref:c,space:e.space,"is-scroll-wheel":n.unref(C),"is-scroll-button":M.value},{default:n.withCtx(()=>[n.createVNode(n.TransitionGroup,n.mergeProps({key:"tab-list-transition",tag:"ul",class:"stack-tab__nav"},O.value,{appear:""}),{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(n.unref(B),(_,l)=>(n.openBlock(),n.createBlock(An,{key:_.id,contextmenu:e.contextmenu,item:_,onContextmenu:n.withModifiers(g=>n.unref(a)(g,_,l,n.unref(B).length),["prevent"]),onMouseup:n.withModifiers(g=>x(_),["middle","prevent"]),onClose:x,onActive:E},null,8,["contextmenu","item","onContextmenu","onMouseup"]))),128))]),_:1},16)]),_:1},8,["space","is-scroll-wheel","is-scroll-button"]),n.renderSlot(S.$slots,"rightButton"),n.createVNode(Ie,{"icon-class":n.unref(r)?"stack-tab__icon-restore":"stack-tab__icon-fullscreen",title:n.unref(o)("VueStackTab.maximum"),onClick:w[0]||(w[0]=_=>r.value=!n.unref(r))},null,8,["icon-class","title"]),n.createVNode(n.Transition,{name:"stack-tab-zoom",appear:""},{default:n.withCtx(()=>[n.unref(d)?(n.openBlock(),n.createBlock(xn,{key:"context-menu-transition",left:n.unref(y).left,top:n.unref(y).top,"tab-item":n.unref(y).item,max:n.unref(y).max,index:n.unref(y).index,onClose:u},null,8,["left","top","tab-item","max","index"])):n.createCommentVNode("",!0)]),_:1})]))}}),to={class:"stack-tab__container"},no={class:"stack-tab__iframe-wrapper"},oo={class:"stack-tab__iframe-loading"},ro={class:"stack-tab__iframe-loading-text"},so=["src","onLoad"],io=5e3,Ct=n.defineComponent({__name:"StackTabs",props:{defaultTabs:{default:()=>[]},max:{default:20},contextmenu:{type:[Boolean,Object],default:!0},pageTransition:{default:"stack-tab-swap"},pageTransitionBack:{default:"stack-tab-swap-back"},tabTransition:{default:"stack-tab-zoom"},tabScrollMode:{default:Q.BOTH},width:{default:"100%"},height:{default:"100%"},i18n:{default:"zh-CN"},space:{default:300},globalScroll:{type:Boolean,default:!1},iframePath:{},sessionPrefix:{default:""},iframeAllowedOrigins:{default:()=>[]}},emits:["onActive","onPageLoaded"],setup(e,{emit:t}){const{tabs:o,caches:r,iframeRefreshKeys:s,activeCacheKey:c,destroy:d,addPage:y,initialize:a,setMaxSize:u,setGlobalScroll:k,setSessionPrefix:m}=Me(),v=t,B=e,{changeLocale:O,t:M}=he(),C=n.ref(!1);n.provide("maximum",C);const{setIFramePath:x,openTab:E}=Be();x(B.iframePath),k(B.globalScroll),O(B.i18n);const S=(A,I)=>y(A,I),w=A=>{v("onActive",A)};u(B.max);const _=()=>{v("onPageLoaded")},l=n.ref(B.pageTransition),g=ie(),T=()=>{l.value=B.pageTransition},V=()=>{l.value=B.pageTransitionBack};g.on("FORWARD",T),g.on("BACKWARD",V);const F=n.computed(()=>o.value.filter(A=>A.iframe)),H=n.reactive({}),p=n.computed(()=>F.value.filter(A=>A.active&&(A.url??"")&&!Je(A.url??"")));n.watch(p,A=>{for(const I of A)H[I.id]=!0},{immediate:!0,deep:!0});const i=A=>{const I=A.url??"";return Je(I)?"about:blank":H[A.id]?I:"about:blank"},f=A=>A.iframeRefreshMode==="reload"?`${A.id}-${s.value[A.id]??0}`:A.id,b=n.reactive({}),h=n.reactive({}),R=new Map,L=A=>{const I=R.get(A);I&&(clearTimeout(I),R.delete(A)),b[A]=!0,h[A]=!1},D=A=>{if(b[A])return;h[A]=!0;const I=R.get(A);I&&clearTimeout(I),R.set(A,setTimeout(()=>{R.delete(A),h[A]=!1},io))};n.watch(p,A=>{for(const I of A)D(I.id)},{immediate:!0,deep:!0});const W=n.reactive({}),P=(A,I)=>{I?W[A]=I:delete W[A]},q=A=>{const Z=W[A];if(Z?.contentWindow)try{Z.contentWindow.postMessage({type:"vue-stack-tabs:refresh"},"*")}catch{}},ue=n.computed(()=>{const A=typeof window<"u"?window.location.origin:"",I=B.iframeAllowedOrigins??[];return[A,...I].filter(Boolean)}),we=A=>{if(!ue.value.includes(A.origin))return;const I=A.data;if(!I||typeof I!="object"||I.type!=="vue-stack-tabs:openTab")return;const Z=I.payload;Z&&typeof Z=="object"&&Z.title&&Z.path&&E(Z)};return g.on("REFRESH_IFRAME_POSTMESSAGE",q),n.onBeforeMount(()=>{m(B.sessionPrefix),a(B.defaultTabs),window.addEventListener("message",we)}),n.onBeforeUnmount(()=>{window.removeEventListener("message",we),g.off("REFRESH_IFRAME_POSTMESSAGE",q),g.off("FORWARD",T),g.off("BACKWARD",V),d()}),(A,I)=>{const Z=n.resolveComponent("router-view");return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["stack-tab",{"stack-tab__maximum":C.value}]),style:n.normalizeStyle({width:e.width,height:e.height,"z-index":C.value?n.unref(ze)("body *:not(.stack-tab,.stack-tab *)"):void 0})},[n.createVNode(eo,{space:e.space,"tab-transition":e.tabTransition,max:e.max,onActive:w},{leftButton:n.withCtx(()=>[n.renderSlot(A.$slots,"leftButton")]),rightButton:n.withCtx(()=>[n.renderSlot(A.$slots,"rightButton")]),_:3},8,["space","tab-transition","max"]),n.createElementVNode("div",to,[n.createVNode(Z,null,{default:n.withCtx(({Component:U,route:Le})=>[n.createVNode(n.Transition,{name:l.value,appear:"",mode:"out-in"},{default:n.withCtx(()=>[(n.openBlock(),n.createBlock(n.KeepAlive,{include:n.unref(r)},[(n.openBlock(),n.createBlock(n.resolveDynamicComponent(S(Le,U)),{key:n.unref(c),vnode:U,onOnLoaded:_},null,40,["vnode"]))],1032,["include"]))]),_:2},1032,["name"])]),_:1}),n.createVNode(n.TransitionGroup,{name:e.pageTransition,tag:"div",class:"stack-tab__iframes",appear:""},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(F.value,U=>(n.openBlock(),n.createBlock(n.Transition,{key:f(U),name:e.pageTransition,appear:""},{default:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",no,[n.withDirectives(n.createElementVNode("div",oo,[n.createElementVNode("span",ro,n.toDisplayString(n.unref(M)("VueStackTab.loading")),1)],512),[[n.vShow,h[U.id]!==!1]]),(n.openBlock(),n.createElementBlock("iframe",{key:n.unref(s)[U.id]||0,ref_for:!0,ref:Le=>P(U.id,Le),class:"stack-tab__iframe",src:i(U),frameborder:"0",onLoad:Le=>L(U.id)},null,40,so))],512),[[n.vShow,U.active]])]),_:2},1032,["name"]))),128))]),_:1},8,["name"])])],6)}}}),He=typeof Buffer=="function";typeof TextDecoder=="function"&&new TextDecoder;const Rt=typeof TextEncoder=="function"?new TextEncoder:void 0,ye=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");(e=>{let t={};return e.forEach((o,r)=>t[o]=r),t})(ye);const j=String.fromCharCode.bind(String);typeof Uint8Array.from=="function"&&Uint8Array.from.bind(Uint8Array);const ao=e=>e.replace(/=/g,"").replace(/[+\/]/g,t=>t=="+"?"-":"_"),Ot=typeof btoa=="function"?e=>btoa(e):He?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,o,r,s,c="";const d=e.length%3;for(let y=0;y<e.length;){if((o=e.charCodeAt(y++))>255||(r=e.charCodeAt(y++))>255||(s=e.charCodeAt(y++))>255)throw new TypeError("invalid character found");t=o<<16|r<<8|s,c+=ye[t>>18&63]+ye[t>>12&63]+ye[t>>6&63]+ye[t&63]}return d?c.slice(0,d-3)+"===".substring(d):c},co=He?e=>Buffer.from(e).toString("base64"):e=>{let o=[];for(let r=0,s=e.length;r<s;r+=4096)o.push(j.apply(null,e.subarray(r,r+4096)));return Ot(o.join(""))},lo=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?j(192|t>>>6)+j(128|t&63):j(224|t>>>12&15)+j(128|t>>>6&63)+j(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return j(240|t>>>18&7)+j(128|t>>>12&63)+j(128|t>>>6&63)+j(128|t&63)}},fo=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,uo=e=>e.replace(fo,lo),It=He?e=>Buffer.from(e,"utf8").toString("base64"):Rt?e=>co(Rt.encode(e)):e=>Ot(uo(e)),ho=(e,t=!1)=>t?ao(It(e)):It(e),po=e=>{const r=`<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1167.06 237.75"><path d="M79.24,19.73h108.91v29.7h-108.91v-29.7Z" style="fill:#79a7ff; stroke-width:0px;"/><path d="M179.24,199.67H20.26c-11.21-.07-20.26-9.17-20.26-20.38V20.39C0,9.18,9.05.07,20.26,0h59.49c3.51.07,6.34,2.9,6.41,6.42v44.36c0,3.54-2.87,6.41-6.41,6.41s-6.41-2.86-6.42-6.4V12.36H20.25c-4.13.07-7.44,3.44-7.44,7.56v159.41c0,4.13,3.31,7.49,7.44,7.56h158.98c4.13-.07,7.44-3.44,7.44-7.56V51.84c0-3.54,2.87-6.41,6.41-6.42,3.55,0,6.42,2.87,6.42,6.42v127.45c0,11.21-9.05,20.32-20.26,20.39h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M192.8,60.77c-3.66-.07-6.61-3.02-6.68-6.68v-18.23c.09-4.29-3.32-7.83-7.6-7.92h-96.43c-3.69,0-6.69-2.99-6.69-6.69s2.99-6.69,6.69-6.69h96.27c11.69.08,21.13,9.58,21.13,21.27v18.25c0,3.69-2.99,6.68-6.68,6.68h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M193.08,58.67H10.15c-3.61-.08-6.48-3.07-6.41-6.68-.08-3.62,2.79-6.61,6.4-6.69,0,0,0,0,0,0h182.93c3.62.08,6.48,3.08,6.41,6.69.07,3.61-2.79,6.6-6.41,6.68h0Z" style="fill:#377dff; stroke-width:0px;"/><path d="M137.2,58.67c-3.42.24-6.4-2.32-6.68-5.74v-28.15c.55-3.69,4-6.24,7.69-5.69,2.94.44,5.24,2.75,5.69,5.69v28.15c-.28,3.42-3.26,5.98-6.68,5.74h-.02Z" style="fill:#377dff; stroke-width:0px;"/><path d="M99.78,100.48l-12.83-22.22h-18.39l31.22,54.05,31.22-54.05h-18.39l-12.83,22.22Z" style="fill:#00d797; stroke-width:0px;"/><path d="M135.28,78.26l-35.49,61.43-35.44-61.43h-20.11l55.55,96.2,55.55-96.2s-20.06,0-20.06,0ZM313.33,59.95c0,.52-.67,1.84-2,3.95s-3.3,5.2-5.9,9.28-5.75,9.28-9.46,15.61c-3.7,6.33-7.52,13.34-11.45,21.04-4.51,8.85-7.76,15.8-9.76,20.86s-2.99,9.41-2.99,13.05c0,2.89,1.53,5.44,4.6,7.63,3.7-2.89,7.34-6.33,10.93-10.32,3.58-3.99,7.13-8.44,10.63-13.36s7.55-11.13,12.14-18.65c4.6-7.52,8.69-14.43,12.27-20.73-.17-.52-.36-1.04-.56-1.56s-.3-.95-.3-1.3c0-2.72.55-5.26,1.65-7.63,1.1-2.37,2.47-4.68,4.12-6.94s4.12-5.44,7.42-9.54c.87-1.1,1.94-1.65,3.21-1.65,2.08,0,3.12,1.33,3.12,3.99s-1.08,6.84-3.25,12.53c-2.17,5.7-5.37,12.39-9.59,20.08s-9.47,16.29-15.74,25.81c-6.28,9.51-13.37,19.45-21.3,29.8-8.04,10.47-13.79,15.7-17.26,15.7-1.97,0-4.19-1.08-6.68-3.25s-4.63-5.13-6.42-8.89-2.69-7.78-2.69-12.06c0-2.54.53-5.81,1.6-9.8s2.75-8.78,5.03-14.36,4.87-11.09,7.76-16.53c3.01-5.72,5.65-10.47,7.94-14.23,2.28-3.76,4.87-7.94,7.76-12.53,2.89-4.6,4.34-7.1,4.34-7.5,0-.87-.58-1.3-1.73-1.3-3.35,0-7.82,1.71-13.4,5.12s-12.85,8.59-21.82,15.53c-3.41,2.66-5.57,4.38-6.46,5.16s-1.34,1.43-1.34,1.95c0,.69.55,1.04,1.65,1.04.46,0,2.02-.17,4.68-.52s4.77-.52,6.33-.52c2.6,0,3.9.46,3.9,1.39,0,.81-.54,1.45-1.61,1.91-1.07.46-2.54.93-4.42,1.39s-4.44,1.1-7.68,1.91c-3.47.93-7.16,2.25-11.06,3.99-3.9,1.73-6.14,2.6-6.72,2.6-1.1,0-1.78-.4-2.04-1.21s-.39-2.14-.39-3.99c0-8.21,1.36-14.56,4.08-19.04s7.58-9.15,14.57-14.01c7.98-5.55,15.61-10.16,22.9-13.84,7.29-3.67,13.58-6.36,18.87-8.07s9.18-2.56,11.67-2.56,4.84,1.56,7.24,4.68,3.6,6.42,3.6,9.89h0ZM366.34,124.75c-8.39,11.1-14.76,19-19.13,23.68s-7.94,7.03-10.71,7.03c-2.2,0-4.22-.91-6.07-2.73-1.85-1.82-3.28-4.28-4.29-7.37s-1.52-6.4-1.52-9.93c0-2.31.22-4.39.65-6.25.43-1.85,1.26-3.89,2.47-6.12s2.82-4.64,4.81-7.24c2-2.6,4.44-5.55,7.33-8.85,1.73-2.02,3.19-3.73,4.38-5.12,1.18-1.39,2.34-2.33,3.47-2.82s2.96-.74,5.51-.74c1.85,0,3.61.25,5.29.74,1.68.49,2.52,1,2.52,1.52,0,1.04-.85,2.92-2.56,5.64s-4.45,6.03-8.24,9.93c-3.79,3.9-8.17,7.74-13.14,11.49-1.1,3.41-1.65,6.01-1.65,7.81,0,2.49.95,3.73,2.86,3.73.69,0,1.85-.59,3.47-1.78,1.62-1.18,4.35-3.47,8.2-6.85,3.84-3.38,7.3-6.38,10.37-8.98,2.25-1.97,4.87-4.9,7.85-8.8s5.39-6.84,7.24-8.8c4.28-4.51,7.2-7.44,8.76-8.8s3.06-2.04,4.51-2.04,2.33.43,2.82,1.3c.49.87.74,2.63.74,5.29,0,1.21-.12,2.2-.35,2.95s-.71,1.72-1.43,2.91-2.18,3.37-4.38,6.55-4.8,6.94-7.81,11.28c-1.66,2.38-3.09,4.93-4.25,7.59-1.21,2.75-1.82,4.81-1.82,6.2,0,3.01,1.18,4.51,3.56,4.51,1.96,0,4.25-.81,6.85-2.43s6.59-4.54,11.97-8.76v5.81c-6.77,6.25-11.77,10.79-15.01,13.62s-6.04,4.97-8.41,6.42-4.63,2.17-6.77,2.17c-4.86,0-7.29-2.89-7.29-8.67,0-2.2.72-5.16,2.17-8.89,1.44-3.73,3.79-9.12,7.03-16.18v-.02Z" style="fill:#306fff; stroke-width:0px;"/><path d="M407.71,133.77v2.17c0,3.41.84,6.07,2.52,7.98,1.68,1.91,3.87,2.86,6.59,2.86s5.77-.66,8.8-2c3.04-1.33,6.06-3.09,9.07-5.29s6.68-5.15,11.02-8.85v5.29c-6.54,7.87-12.67,13.89-18.39,18.09-5.72,4.19-11.54,6.29-17.44,6.29-5.15,0-9.22-2-12.23-5.99s-4.51-9.46-4.51-16.39c0-6.07,1.42-11.58,4.25-16.52s7.46-10.16,13.88-15.66c4.39-3.76,8.76-6.59,13.1-8.5s8.21-2.86,11.62-2.86c2.72,0,4.87.62,6.46,1.86s2.39,3.11,2.39,5.59c0,3.64-1.36,7.27-4.08,10.89s-6.87,7.2-12.45,10.76c-5.58,3.56-12.45,6.98-20.6,10.28h0ZM408.58,128.13c5.2-2.02,9.66-4.54,13.36-7.55,3.7-3.01,6.43-5.88,8.2-8.63,1.76-2.75,2.65-4.76,2.65-6.03s-.61-2-1.82-2c-1.04,0-2.73.67-5.07,2s-4.71,3.07-7.11,5.21-4.55,4.66-6.46,7.55c-1.9,2.86-3.17,6.08-3.73,9.46h-.02ZM585.37,132.9c-1.45-2.66-3.61-5.06-6.51-7.2-2.89-2.14-6.15-3.86-9.76-5.16s-7.39-2.27-11.32-2.91c-11.68-1.74-22.58-5.52-32.7-11.36-.87-.46-1.79-1.44-2.78-2.95-.98-1.5-1.47-2.95-1.47-4.34,0-5.09.85-10.19,2.56-15.31,1.71-5.12,3.89-9.12,6.55-12.01,4.28-4.8,11.98-8.99,23.12-12.58,11.13-3.58,23.67-5.38,37.6-5.38,8.33,0,14.76.64,19.3,1.91s6.81,3.24,6.81,5.9c0,4.34-.59,7.69-1.78,10.06s-2.46,3.95-3.82,4.73c-1.36.78-3.75,1.84-7.16,3.17-3.64,1.27-6.81,2.6-9.5,3.99s-4.99,2.72-6.9,3.99c-1.91,1.27-3.09,1.91-3.56,1.91-.58,0-.87-.23-.87-.69,0-.98,1.03-2.47,3.08-4.47s4.58-3.74,7.59-5.25c3.18-1.68,4.77-2.75,4.77-3.21,0-.75-1.76-1.13-5.29-1.13-10.7,0-20.59.95-29.67,2.86s-16.24,4.42-21.47,7.55c-5.23,3.12-7.85,6.3-7.85,9.54,0,2.02,1.08,3.46,3.25,4.29,2.17.84,6.95,2.24,14.36,4.21,7.4,1.97,14.02,4.22,19.86,6.77,8.38,3.59,14.6,7.32,18.65,11.19,4.05,3.88,6.07,8.21,6.07,13.01,0,3.3-.8,6.61-2.39,9.93-1.59,3.33-3.92,6.38-6.98,9.15-3.07,2.78-6.59,5.06-10.58,6.85-3.41,1.45-7.71,2.8-12.88,4.08-5.18,1.27-10.79,2.27-16.83,2.99-6.04.72-11.81,1.08-17.31,1.08-10.12,0-18.26-.95-24.42-2.86s-9.24-4.8-9.24-8.67c0-1.74,1.04-4.44,3.12-8.11s4.54-6.14,7.37-7.42c2.49-.98,4.89-1.55,7.2-1.69,2.31-.14,3.47.13,3.47.82,0,.17-.09.35-.26.52s-.38.32-.61.43c-.23.12-.46.23-.69.35-1.16.46-2.1.82-2.82,1.08-.72.26-1.3.52-1.74.78-.43.26-.65.62-.65,1.08,0,1.21,5.99,1.82,17.96,1.82,10.41,0,18.94-.38,25.59-1.13s12.52-2.11,17.61-4.08c5.09-1.97,9.71-4.68,13.88-8.15l.04.02ZM640.8,85.63h3.73c3.06-5.49,5.84-9.38,8.33-11.67,2.49-2.28,5.32-3.43,8.5-3.43s4.77.72,4.77,2.17c0,.69-1.24,2.57-3.73,5.64s-4.37,5.64-5.64,7.72c1.96.23,3.71.43,5.25.61,1.53.17,2.73.32,3.6.43-3.3,6.13-7.43,12.4-12.4,18.82l-4.08-.3c-1.1-.09-2.21-.17-3.34-.26s-2.5-.19-4.12-.3c-3.12,5.03-5.74,9.53-7.85,13.49s-3.73,7.59-4.86,10.89-1.69,6.42-1.69,9.37c0,3.99,1.59,5.99,4.77,5.99,2.2,0,5.07-1.17,8.63-3.51s8.31-5.94,14.27-10.8v5.81c-15.61,16.95-27.15,25.42-34.61,25.42-2.6,0-4.7-1.01-6.29-3.04-1.59-2.02-2.38-4.63-2.38-7.81,0-2.14.45-4.68,1.34-7.63.9-2.95,2.5-7.4,4.81-13.36-.81.69-1.58,1.37-2.3,2.04s-1.39,1.27-2,1.82-1.26,1.13-1.95,1.73c-.69.61-1.39,1.23-2.08,1.87v-5.99c6.07-5.09,13.42-14.02,22.03-26.8-.87-.06-1.68-.1-2.43-.13s-1.65-.04-2.69-.04c-3.41,0-5.96.23-7.63.69-.69.17-1.34.36-1.95.56s-1.03.3-1.26.3-.35-.17-.35-.52c0-1.91,1.18-4.77,3.56-8.59,1.91-3.24,3.72-5.64,5.42-7.2,1.71-1.56,3.79-2.62,6.25-3.17,2.46-.55,5.91-.82,10.37-.82h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M664.91,115.12c8.79-7.98,17.32-13.91,25.59-17.78s14.66-5.81,19.17-5.81c1.21,0,2.34.51,3.38,1.52,1.04,1,1.88,2.19,2.47,3.51.61,1.33.91,2.31.91,2.95,0,1.04-.41,1.81-1.21,2.3-.81.49-2.23,1.08-4.25,1.78.4.93.92,2.11,1.56,3.56s1.13,2.62,1.47,3.51c.35.9.52,1.69.52,2.39,0,1.39-1.4,3.98-4.21,7.76-2.81,3.79-4.77,6.58-5.9,8.37-1.13,1.79-1.69,3.99-1.69,6.59,0,4.28,1.96,6.42,5.9,6.42s10.38-3.79,19-11.36v5.29c-14.63,16.25-25.1,24.38-31.4,24.38-2.26,0-3.86-.74-4.81-2.21s-1.43-3.66-1.43-6.55c0-4.57,1.65-11.19,4.94-19.86-8.44,9.37-14.72,16.03-18.82,20-4.11,3.96-7.49,5.94-10.15,5.94-1.27,0-2.86-1.1-4.77-3.3-1.91-2.2-3.6-5.04-5.07-8.54-1.47-3.5-2.21-7.13-2.21-10.89,0-2.72.26-4.99.78-6.81s1.53-3.69,3.04-5.59c1.5-1.91,3.9-4.42,7.2-7.55v-.02ZM706.46,105.58c-15.04,6.88-25.75,12.72-32.14,17.52s-9.59,9.75-9.59,14.83c0,1.85.32,3.37.95,4.55.64,1.19,1.5,1.78,2.6,1.78.64,0,1.76-.4,3.38-1.21,6.07-3.58,11.62-8.25,16.66-14.01,5.03-5.75,11.07-13.58,18.13-23.46h.01Z" style="fill:#306fff; stroke-width:0px;"/><path d="M779.07,130.82v5.81c-6.19,6.07-11.23,10.79-15.14,14.14-3.9,3.35-7.55,5.96-10.93,7.81-3.38,1.85-6.69,2.78-9.93,2.78s-6.1-1.26-8.76-3.77c-2.66-2.52-4.74-5.81-6.25-9.89-1.5-4.08-2.26-8.4-2.26-12.97,0-3.93.87-7.43,2.6-10.5,1.74-3.07,5.09-7.03,10.06-11.88,5.9-5.78,11.38-10.25,16.44-13.4s9.04-4.73,11.93-4.73c2.08,0,3.85.72,5.29,2.17s2.17,3.27,2.17,5.46c0,1.85-.95,4.48-2.86,7.89-1.91,3.41-4.05,6.38-6.42,8.89-2.37,2.52-4.25,3.77-5.64,3.77-1.5,0-2.25-.81-2.25-2.43.06-.46.1-.9.13-1.3s.04-.81.04-1.21c0-.69-.25-1.08-.74-1.17s-1.08.13-1.78.65c-5.78,4.05-9.75,6.9-11.88,8.54-2.14,1.65-3.83,3.31-5.07,4.99s-1.87,3.44-1.87,5.29c0,3.41,1.1,6.19,3.3,8.33s5.06,3.21,8.59,3.21,8.02-1.4,13.14-4.21c5.12-2.8,11.15-6.9,18.09-12.27h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M844.13,130.65v5.81c-6.48,7.58-11.91,13.32-16.31,17.22s-8.07,5.86-11.02,5.86-5.39-.84-7.68-2.52c-2.29-1.68-4.34-3.99-6.16-6.94-1.82-2.95-3.98-7.05-6.46-12.32-2.95,3.64-5.61,7.04-7.98,10.19-2.37,3.15-4.02,5.25-4.94,6.29-.93,1.04-1.77,1.56-2.52,1.56-1.56,0-2.69-1-3.38-2.99-.69-2-1.04-4.9-1.04-8.72,0-5.21.62-10.22,1.87-15.05,1.24-4.83,3.04-9.53,5.38-14.1s5.35-9.5,9.02-14.79c3.67-5.29,7.79-10.83,12.36-16.61,6.3-7.98,11.74-14.5,16.31-19.56,4.57-5.06,8.54-8.88,11.93-11.45,3.38-2.57,6.2-3.86,8.46-3.86,2.78,0,4.16,1.24,4.16,3.73,0,2.14-5.12,9.85-15.35,23.12-10.24,13.27-25.16,31.39-44.76,54.35v7.46c13.13-14.05,23.69-24.49,31.71-31.31,8.01-6.82,14.21-10.24,18.61-10.24,1.79,0,3.18,1.06,4.16,3.17s1.47,4.55,1.47,7.33c0,5.67-2.43,10.92-7.29,15.74-4.86,4.83-12.32,10.37-22.38,16.61,1.74,2.6,3.27,4.5,4.6,5.68,1.33,1.19,3.01,1.78,5.03,1.78,1.79,0,3.73-.61,5.81-1.82s4.21-2.75,6.38-4.6,5.51-4.86,10.02-9.02h-.01ZM809.86,135.07c2.2-1.45,4.93-3.69,8.2-6.72,3.27-3.04,6.06-6.19,8.37-9.46s3.47-6,3.47-8.2c0-.92-.41-1.39-1.21-1.39-2.2,0-5.97,2.11-11.32,6.33-5.35,4.22-10.57,9.63-15.66,16.22,2.2,0,4.92,1.07,8.15,3.21h0ZM951.78,140.71l2.86,2.17c-.75,1.62-1.47,3.04-2.17,4.25-.69,1.21-1.53,2.69-2.52,4.42-.98,1.73-1.73,3.04-2.25,3.9-4.34,7.58-8.41,11.36-12.23,11.36-1.62,0-3.01-.64-4.16-1.91-1.16-1.27-1.73-3.01-1.73-5.2,0-3.12,1.11-7.4,3.34-12.84,2.23-5.43,5.67-12.13,10.32-20.08s10.51-16.96,17.57-27.02c7.05-10.06,15.01-20.67,23.85-31.84-5.09-.75-11.13-1.13-18.13-1.13-8.04,0-16.99.9-26.85,2.69s-18.45,3.86-25.76,6.2c-7.32,2.34-10.97,4.06-10.97,5.16,0,.41.14.68.43.82.29.15.77.26,1.43.35s1.52.19,2.56.3c6.77.93,10.15,1.97,10.15,3.12,0,.58-1.47.85-4.42.82s-6.51-.04-10.67-.04c-3.3,0-5.68-.13-7.16-.39s-2.46-.75-2.95-1.47-.74-1.84-.74-3.34c0-.98.29-3.12.87-6.42,1.1-6.13,2.79-11.04,5.07-14.75,2.28-3.7,5.78-6.72,10.5-9.06,4.71-2.34,11.2-4.21,19.47-5.59,13.88-2.37,25.36-3.56,34.44-3.56,6.71,0,12,.27,15.88.82,3.87.55,6.72,1.34,8.54,2.39,1.82,1.04,2.98,2.07,3.47,3.08s1.14,2.76,1.95,5.25l2.69,7.98c.17.52.32.94.43,1.26.12.32.22.65.3,1,.09.35.13.67.13.95,0,2.26-.51,4.28-1.52,6.07s-2.86,4.48-5.55,8.07-4.67,6.39-5.94,8.41c-14.92,24.23-25.1,42.16-30.53,53.78v.02ZM991.94,115.12c8.79-7.98,17.32-13.91,25.59-17.78s14.66-5.81,19.17-5.81c1.21,0,2.34.51,3.38,1.52,1.04,1,1.88,2.19,2.47,3.51.61,1.33.91,2.31.91,2.95,0,1.04-.41,1.81-1.21,2.3-.81.49-2.23,1.08-4.25,1.78.4.93.92,2.11,1.56,3.56s1.13,2.62,1.47,3.51c.35.9.52,1.69.52,2.39,0,1.39-1.4,3.98-4.21,7.76-2.81,3.79-4.77,6.58-5.9,8.37-1.13,1.79-1.69,3.99-1.69,6.59,0,4.28,1.96,6.42,5.9,6.42s10.38-3.79,19-11.36v5.29c-14.63,16.25-25.1,24.38-31.4,24.38-2.26,0-3.86-.74-4.81-2.21s-1.43-3.66-1.43-6.55c0-4.57,1.65-11.19,4.94-19.86-8.44,9.37-14.72,16.03-18.82,20-4.11,3.96-7.49,5.94-10.15,5.94-1.27,0-2.86-1.1-4.77-3.3-1.91-2.2-3.6-5.04-5.07-8.54-1.47-3.5-2.21-7.13-2.21-10.89,0-2.72.26-4.99.78-6.81s1.53-3.69,3.04-5.59c1.5-1.91,3.9-4.42,7.2-7.55v-.02ZM1033.49,105.58c-15.04,6.88-25.75,12.72-32.14,17.52s-9.59,9.75-9.59,14.83c0,1.85.32,3.37.95,4.55.64,1.19,1.5,1.78,2.6,1.78.64,0,1.76-.4,3.38-1.21,6.07-3.58,11.62-8.25,16.66-14.01,5.03-5.75,11.07-13.58,18.13-23.46h.01Z" style="fill:#306fff; stroke-width:0px;"/><path d="M1111.3,130.82v5.64c-6.02,3.82-10.76,5.72-14.23,5.72-1.91,0-3.93-.32-6.07-.95-5.2,6.59-9.67,11.42-13.4,14.49s-7.47,4.6-11.23,4.6c-4.34,0-7.68-2.29-10.02-6.85-2.34-4.57-3.51-10.24-3.51-17,0-9.2,2.78-19.21,8.33-30.06,5.56-10.85,12.29-21.07,20.08-30.45,7.84-9.46,15.43-17.28,22.77-23.46,7.34-6.19,12.32-9.28,14.92-9.28s3.73,1.71,3.73,5.12c0,15.15-19.43,41.58-58.29,79.29-.12,1.04-.17,3.09-.17,6.16,0,7.98,2.14,11.97,6.42,11.97,1.68,0,3.37-.68,5.07-2.04,1.71-1.36,4.32-3.95,7.85-7.76-1.39-3.12-2.08-5.44-2.08-6.94,0-3.18,1.3-6.62,3.9-10.32s5.57-6.9,8.89-9.59c3.33-2.69,5.74-4.03,7.24-4.03,2.37,0,3.56,1.71,3.56,5.12,0,2.6-.68,5.72-2.04,9.37-1.36,3.64-3.34,7.81-5.94,12.49.98.81,1.76,1.4,2.34,1.78s1.45.56,2.6.56c2.66,0,5.75-1.18,9.28-3.56v-.02ZM1067.24,117.81c3.01-2.6,6.03-5.68,9.06-9.24s7.47-9.01,13.32-16.35c5.61-7.05,10.02-12.94,13.23-17.65s5.62-8.63,7.24-11.75c1.62-3.12,2.43-5.26,2.43-6.42,0-.87-.23-1.3-.69-1.3-1.27,0-3.92,2.1-7.94,6.29-4.02,4.19-8.6,9.93-13.75,17.22-7.11,10.06-12.26,17.64-15.44,22.73-3.18,5.09-5.67,10.58-7.46,16.48h0Z" style="fill:#306fff; stroke-width:0px;"/><path d="M1110.96,133.08v-2.08c14.92-15.73,25.18-26.75,30.79-33.05,1.27-7.11,4.34-10.67,9.19-10.67,1.21,0,2.52.35,3.9,1.04l.52,1.65c-.23.69-.35,1.68-.35,2.95,0,1.1.42,3.14,1.26,6.12s1.49,5.48,1.95,7.5.69,4.31.69,6.85c0,3.82-.87,7.48-2.6,10.97-1.73,3.5-4.25,6.85-7.55,10.06-3.3,3.21-7.55,6.49-12.75,9.85,2.08.35,3.73.52,4.94.52,2.37,0,4.93-.59,7.68-1.78,2.75-1.18,5.55-2.78,8.41-4.77,2.86-2,6.2-4.58,10.02-7.76v5.81c-7.4,7.23-14.02,12.71-19.86,16.44s-10.87,5.59-15.09,5.59c-5.44,0-10.47-2.31-15.09-6.94-2.72-2.78-4.41-5.43-5.08-7.98-.67-2.54-1-5.99-1-10.32h.02ZM1143.31,119.8l-1.56-12.66c-3.59,4.05-11.25,11.83-22.99,23.33,3.47.75,5.84,1.76,7.11,3.04,1.27,1.27,3.06,3.73,5.38,7.37,3.93-1.62,6.95-3.83,9.07-6.64,2.11-2.8,3.17-6.64,3.17-11.49,0-.58-.01-1.1-.04-1.56s-.07-.92-.13-1.39h0Z" style="fill:#306fff; stroke-width:0px;"/><g style="isolation:isolate;"><text transform="translate(943.45 229.96)" style="fill:#00d797; font-family:ArialMT, Arial; font-size:24px; isolation:isolate;"><tspan x="0" y="0">version: ${e}</tspan></text></g></svg>`,d="data:image/svg+xml;base64,"+ho(r),y="font-size: 1px; padding: "+Math.floor(100/4)+"px "+Math.floor(580/2)+"px; line-height: "+Math.floor(100/2)+"px;";window.console.log("%c+",y+`background-image: url(${d});background-size: 580px 100px;background-repeat: norepeat; color: transparent;`)},mo="FORWARD",bo="BACKWARD";function Lt(){const e=n.getCurrentInstance(),{attrs:t,props:o}=e,r=t.tId??o.tId,s=t.pId??o.pId,c=ke.useRoute(),d=ke.useRouter(),y=ie(),{getTab:a,evictPageCache:u,addPageScroller:k}=Me(),m=c.query.__tab;return{forward:M=>{const C=a(r),x=M.query||{};if(C){const S=ee();C.pages.push({id:S,tabId:C.id,path:M.path,query:x})}const E=X({__tab:m},M.query);y.emit(mo),d.push({path:M.path,query:E})},backward:(M,C)=>{const x=a(r);if(!x)return!1;const E=x.pages;let S=0;if(typeof M=="number")S=Math.abs(M);else{const g=Ne(M),T=g.query||{},V=E.list();let F=!1;const H=p=>{const i={...p||{}},f={...T};delete i.__tab,delete i._back,delete f.__tab,delete f._back;const b=Object.keys(f);return b.length===0?!0:b.every(h=>String(f[h]??"")===String(i[h]??""))};for(let p=E.size()-2;p>=0;p--){S++;const i=V[p],f=i?.path===g.path,b=H(i?.query);if(f&&b){F=!0;break}}if(!F)return!1}if(S<=0||(E.size()<=S&&(S=E.size()-1),S<=0))return!1;const w=[];for(let g=0;g<S;g++){const T=E.pop();T&&w.push(T.id)}const _=E.peek();if(!_)return!1;C&&(_._backParams=C),y.emit(bo);const l=X({__tab:m},_.query||{});return d.push({path:_.path,query:l}).then(()=>{for(const g of w)u(g)}),!0},addScrollTarget:(...M)=>{k(s,...M)}}}const go=n.defineComponent({__name:"iframe",setup(e){return Lt(),()=>{}}}),vo=()=>{const e=ie(),{attrs:t}=n.getCurrentInstance();n.onUnmounted(()=>{r()});const o=()=>{e.emit($.PAGE_LOADING,{tId:t.tId,value:!0})},r=()=>{e.emit($.PAGE_LOADING,{tId:t.tId,value:!1})};return{openTabLoading:o,closeTabLoading:r}},zt="vue-stack-tabs:refresh",Nt="vue-stack-tabs:openTab";function To(e){typeof window>"u"||!window.parent||window.parent.postMessage({type:Nt,payload:e},"*")}function yo(e=()=>window.location.reload()){if(typeof window>"u")return()=>{};const t=o=>{o.data?.type===zt&&e()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}const wo={install(e,t){po("1.1.0"),e.component("VueStackTabs",Ct).use(fn).use(Zt().getI18n(t))}};N.IFrame=go,N.MSG_OPEN_TAB=Nt,N.MSG_REFRESH=zt,N.Stack=_e,N.StackTab=Ct,N.TabHeaderButton=Ie,N.TabScrollMode=Q,N.default=wo,N.onRefreshRequest=yo,N.postOpenTab=To,N.useTabActions=Be,N.useTabLoading=vo,N.useTabRouter=Lt,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -1,85 +0,0 @@
1
- import { describe, it, expect, beforeEach } from 'vitest'
2
- import {
3
- markCacheForEviction,
4
- markTabPagesForEviction,
5
- markTabPagesForEvictionOnly,
6
- addCache,
7
- removeCache,
8
- evictPageCache,
9
- evictMarkedCaches
10
- } from './evict'
11
- import { caches, cacheIdsToEvict, tabIdsToEvict, components } from './state'
12
- import { Stack } from '../../model/TabModel'
13
- import type { ITabPage } from '../../model/TabModel'
14
-
15
- function resetState() {
16
- caches.value = []
17
- cacheIdsToEvict.clear()
18
- tabIdsToEvict.clear()
19
- components.clear()
20
- }
21
-
22
- beforeEach(resetState)
23
-
24
- describe('evict', () => {
25
- it('addCache 添加缓存 id', () => {
26
- addCache('c1')
27
- expect(caches.value).toContain('c1')
28
- addCache('c1')
29
- expect(caches.value.filter((x) => x === 'c1')).toHaveLength(1)
30
- })
31
-
32
- it('removeCache 移除指定 id', () => {
33
- addCache('c1')
34
- removeCache('c1')
35
- expect(caches.value).not.toContain('c1')
36
- })
37
-
38
- it('markCacheForEviction 标记待驱逐', () => {
39
- markCacheForEviction('c1')
40
- expect(cacheIdsToEvict.has('c1')).toBe(true)
41
- })
42
-
43
- it('markTabPagesForEviction 标记标签下所有页面并加入 tabIdsToEvict', () => {
44
- const page: ITabPage = { id: 'p1', tabId: 't1', path: '/x' }
45
- const stack = new Stack<ITabPage>()
46
- stack.push(page)
47
- const tab = { id: 't1', pages: { list: () => stack.list() } }
48
- markTabPagesForEviction(tab)
49
- expect(cacheIdsToEvict.has('p1')).toBe(true)
50
- expect(tabIdsToEvict.has('t1')).toBe(true)
51
- })
52
-
53
- it('markTabPagesForEvictionOnly 只标记页面不标记 tab', () => {
54
- const page: ITabPage = { id: 'p1', tabId: 't1', path: '/x' }
55
- const stack = new Stack<ITabPage>()
56
- stack.push(page)
57
- const tab = { pages: { list: () => stack.list() } }
58
- markTabPagesForEvictionOnly(tab)
59
- expect(cacheIdsToEvict.has('p1')).toBe(true)
60
- expect(tabIdsToEvict.size).toBe(0)
61
- })
62
-
63
- it('evictPageCache 立即驱逐单个缓存', () => {
64
- addCache('c1')
65
- components.set('c1', {} as never)
66
- evictPageCache('c1')
67
- expect(caches.value).not.toContain('c1')
68
- expect(components.has('c1')).toBe(false)
69
- expect(cacheIdsToEvict.has('c1')).toBe(false)
70
- })
71
-
72
- it('evictMarkedCaches 执行所有待驱逐', () => {
73
- addCache('c1')
74
- addCache('c2')
75
- components.set('c1', {} as never)
76
- components.set('c2', {} as never)
77
- markCacheForEviction('c1')
78
- markCacheForEviction('c2')
79
- evictMarkedCaches()
80
- expect(caches.value).not.toContain('c1')
81
- expect(caches.value).not.toContain('c2')
82
- expect(components.size).toBe(0)
83
- expect(cacheIdsToEvict.size).toBe(0)
84
- })
85
- })
@@ -1,34 +0,0 @@
1
- import { describe, it, expect } from 'vitest'
2
- import { normalizePathForCache } from './useTabPanel'
3
- import type { RouteLocationNormalizedLoaded } from 'vue-router'
4
-
5
- function mockRoute(path: string, matchedPath?: string): RouteLocationNormalizedLoaded {
6
- return {
7
- path,
8
- matched: [{ path: matchedPath ?? path }] as RouteLocationNormalizedLoaded['matched'],
9
- query: {},
10
- params: {},
11
- hash: '',
12
- fullPath: path,
13
- name: undefined,
14
- meta: {},
15
- redirectedFrom: undefined
16
- }
17
- }
18
-
19
- describe('normalizePathForCache', () => {
20
- it('当 matched.path 无尾斜杠且 route.path 有尾斜杠时,返回规范化 path', () => {
21
- const r = mockRoute('/dashboard/', '/dashboard')
22
- expect(normalizePathForCache(r)).toBe('/dashboard')
23
- })
24
-
25
- it('路径与 matched 一致时返回规范化 path', () => {
26
- const r = mockRoute('/home', '/home')
27
- expect(normalizePathForCache(r)).toBe('/home')
28
- })
29
-
30
- it('路径与 matched 不一致时返回原 path', () => {
31
- const r = mockRoute('/detail/1', '/detail/:id')
32
- expect(normalizePathForCache(r)).toBe('/detail/1')
33
- })
34
- })
@@ -1,40 +0,0 @@
1
- import { describe, it, expect } from 'vitest'
2
- import { Stack } from './TabModel'
3
-
4
- describe('Stack', () => {
5
- it('push 与 peek', () => {
6
- const s = new Stack<number>()
7
- s.push(1)
8
- expect(s.peek()).toBe(1)
9
- s.push(2)
10
- expect(s.peek()).toBe(2)
11
- })
12
-
13
- it('pop 返回栈顶并移除', () => {
14
- const s = new Stack<string>(['a', 'b'])
15
- expect(s.pop()).toBe('b')
16
- expect(s.pop()).toBe('a')
17
- expect(s.pop()).toBeUndefined()
18
- })
19
-
20
- it('size 与 isEmpty', () => {
21
- const s = new Stack<number>()
22
- expect(s.isEmpty()).toBe(true)
23
- expect(s.size()).toBe(0)
24
- s.push(1)
25
- expect(s.isEmpty()).toBe(false)
26
- expect(s.size()).toBe(1)
27
- })
28
-
29
- it('list 返回元素数组', () => {
30
- const s = new Stack<number>([1, 2, 3])
31
- expect(s.list()).toEqual([1, 2, 3])
32
- })
33
-
34
- it('clear 清空栈', () => {
35
- const s = new Stack<number>([1, 2])
36
- s.clear()
37
- expect(s.isEmpty()).toBe(true)
38
- expect(s.peek()).toBeUndefined()
39
- })
40
- })
@@ -1,37 +0,0 @@
1
- /**
2
- * @vitest-environment happy-dom
3
- */
4
- import { describe, it, expect, vi } from 'vitest'
5
- import { MSG_REFRESH, MSG_OPEN_TAB, postOpenTab, onRefreshRequest } from './iframeBridge'
6
-
7
- describe('iframeBridge', () => {
8
- it('MSG_REFRESH 和 MSG_OPEN_TAB 为预期常量', () => {
9
- expect(MSG_REFRESH).toBe('vue-stack-tabs:refresh')
10
- expect(MSG_OPEN_TAB).toBe('vue-stack-tabs:openTab')
11
- })
12
-
13
- describe('postOpenTab', () => {
14
- it('有 window.parent 时调用 postMessage', () => {
15
- const spy = vi.spyOn(window.parent, 'postMessage')
16
- postOpenTab({ title: 't', path: '/p' })
17
- expect(spy).toHaveBeenCalledWith(
18
- { type: MSG_OPEN_TAB, payload: { title: 't', path: '/p' } },
19
- '*'
20
- )
21
- spy.mockRestore()
22
- })
23
- })
24
-
25
- describe('onRefreshRequest', () => {
26
- it('注册监听并返回取消函数', () => {
27
- const cb = vi.fn()
28
- const off = onRefreshRequest(cb)
29
- expect(typeof off).toBe('function')
30
- window.dispatchEvent(new MessageEvent('message', { data: { type: MSG_REFRESH } }))
31
- expect(cb).toHaveBeenCalled()
32
- off()
33
- window.dispatchEvent(new MessageEvent('message', { data: { type: MSG_REFRESH } }))
34
- expect(cb).toHaveBeenCalledTimes(1)
35
- })
36
- })
37
- })